Search in sources :

Example 1 with CalendarPanel

use of org.apache.openmeetings.web.user.calendar.CalendarPanel in project openmeetings by apache.

the class OmUrlFragment method getPanel.

public static BasePanel getPanel(AreaKeys area, String type) {
    BasePanel basePanel = null;
    switch(area) {
        case admin:
            if (TYPE_USER.equals(type)) {
                basePanel = new UsersPanel(CHILD_ID);
            } else if (TYPE_CONNECTION.equals(type)) {
                basePanel = new ConnectionsPanel(CHILD_ID);
            } else if (TYPE_GROUP.equals(type)) {
                basePanel = new GroupsPanel(CHILD_ID);
            } else if (TYPE_ROOM.equals(type)) {
                basePanel = new RoomsPanel(CHILD_ID);
            } else if (TYPE_CONFIG.equals(type)) {
                basePanel = new ConfigsPanel(CHILD_ID);
            } else if (TYPE_LANG.equals(type)) {
                basePanel = new LangPanel(CHILD_ID);
            } else if (TYPE_LDAP.equals(type)) {
                basePanel = new LdapsPanel(CHILD_ID);
            } else if (TYPE_BACKUP.equals(type)) {
                basePanel = new BackupPanel(CHILD_ID);
            } else if (TYPE_OAUTH2.equals(type)) {
                basePanel = new OAuthPanel(CHILD_ID);
            } else if (TYPE_EMAIL.equals(type)) {
                basePanel = new EmailPanel(CHILD_ID);
            }
            break;
        case profile:
            if (TYPE_MESSAGES.equals(type)) {
                basePanel = new SettingsPanel(CHILD_ID, MESSAGES_TAB_ID);
            } else if (TYPE_EDIT.equals(type)) {
                basePanel = new SettingsPanel(CHILD_ID, EDIT_PROFILE_TAB_ID);
            }
            break;
        case room:
            try {
                Long roomId = Long.valueOf(type);
                Room r = Application.get().getBean(RoomDao.class).get(roomId);
                if (r != null) {
                    basePanel = new RoomPanel(CHILD_ID, r);
                }
            } catch (NumberFormatException ne) {
            // skip it, bad roomid passed
            }
            if (basePanel == null) {
                basePanel = new OmDashboardPanel(CHILD_ID);
            }
            break;
        case rooms:
            MenuParams params = MenuParams.publicTabButton;
            if (TYPE_GROUP.equals(type)) {
                params = MenuParams.privateTabButton;
            } else if (Application.get().getBean(ConfigurationDao.class).getBool(CONFIG_MYROOMS_ENABLED, true) && TYPE_MY.equals(type)) {
                params = MenuParams.myTabButton;
            }
            basePanel = new RoomsSelectorPanel(CHILD_ID, params);
            break;
        case user:
            if (TYPE_CALENDAR.equals(type)) {
                basePanel = new CalendarPanel(CHILD_ID);
            } else if (TYPE_RECORDINGS.equals(type)) {
                basePanel = new RecordingsPanel(CHILD_ID);
            } else {
                basePanel = new OmDashboardPanel(CHILD_ID);
            }
            break;
        default:
            break;
    }
    return basePanel;
}
Also used : RoomDao(org.apache.openmeetings.db.dao.room.RoomDao) CalendarPanel(org.apache.openmeetings.web.user.calendar.CalendarPanel) SettingsPanel(org.apache.openmeetings.web.user.profile.SettingsPanel) ConfigurationDao(org.apache.openmeetings.db.dao.basic.ConfigurationDao) BasePanel(org.apache.openmeetings.web.common.BasePanel) RoomsPanel(org.apache.openmeetings.web.admin.rooms.RoomsPanel) ConnectionsPanel(org.apache.openmeetings.web.admin.connection.ConnectionsPanel) EmailPanel(org.apache.openmeetings.web.admin.email.EmailPanel) RoomsSelectorPanel(org.apache.openmeetings.web.user.rooms.RoomsSelectorPanel) BackupPanel(org.apache.openmeetings.web.admin.backup.BackupPanel) RecordingsPanel(org.apache.openmeetings.web.user.record.RecordingsPanel) UsersPanel(org.apache.openmeetings.web.admin.users.UsersPanel) GroupsPanel(org.apache.openmeetings.web.admin.groups.GroupsPanel) ConfigsPanel(org.apache.openmeetings.web.admin.configurations.ConfigsPanel) Room(org.apache.openmeetings.db.entity.room.Room) LangPanel(org.apache.openmeetings.web.admin.labels.LangPanel) OAuthPanel(org.apache.openmeetings.web.admin.oauth.OAuthPanel) RoomPanel(org.apache.openmeetings.web.room.RoomPanel) OmDashboardPanel(org.apache.openmeetings.web.user.dashboard.OmDashboardPanel) LdapsPanel(org.apache.openmeetings.web.admin.ldaps.LdapsPanel)

Example 2 with CalendarPanel

use of org.apache.openmeetings.web.user.calendar.CalendarPanel in project openmeetings by apache.

the class TestCalendar method testEventCreate.

@Test
public void testEventCreate() throws OmException {
    testArea(regularUsername, p -> {
        Menu menu = (Menu) p.get(PATH_MENU);
        Assert.assertNotNull(menu);
        tester.getRequest().setParameter("hash", menu.getItemList().get(0).getItems().get(1).getId());
        tester.executeBehavior((AbstractAjaxBehavior) menu.getBehaviorById(0));
        tester.assertComponent(PATH_CHILD, CalendarPanel.class);
        CalendarPanel cal = (CalendarPanel) p.get(PATH_CHILD);
        tester.executeAllTimerBehaviors(cal);
        User u = userDao.getByLogin(regularUsername, User.Type.user, null);
        // test create month
        tester.getRequest().setParameter("allDay", String.valueOf(false));
        tester.getRequest().setParameter("startDate", LocalDateTime.of(2017, 11, 13, 13, 13).toString());
        tester.getRequest().setParameter("endDate", LocalDateTime.of(2017, 11, 13, 13, 13).toString());
        tester.getRequest().setParameter("viewName", CalendarView.month.name());
        // select-event
        tester.executeBehavior((AbstractAjaxBehavior) cal.get("form:calendar").getBehaviorById(0));
        FormTester appTester = tester.newFormTester(PATH_APPOINTMENT_DLG_FRM);
        // check inviteeType:groupContainer:groups is invisible for regular user
        String title = String.format("title%s", UUID.randomUUID());
        appTester.setValue("title", title);
        ButtonAjaxBehavior save = getButtonBehavior(PATH_APPOINTMENT_DLG, "save");
        tester.executeBehavior(save);
        List<Appointment> appts = appointmentDao.searchByTitle(u.getId(), title);
        assertEquals("Appointment should be created", 1, appts.size());
        assertEquals("Appointment should be created", title, appts.get(0).getTitle());
    });
}
Also used : CalendarPanel(org.apache.openmeetings.web.user.calendar.CalendarPanel) Appointment(org.apache.openmeetings.db.entity.calendar.Appointment) User(org.apache.openmeetings.db.entity.user.User) FormTester(org.apache.wicket.util.tester.FormTester) Menu(com.googlecode.wicket.jquery.ui.widget.menu.Menu) ButtonAjaxBehavior(com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior) Test(org.junit.Test)

Aggregations

CalendarPanel (org.apache.openmeetings.web.user.calendar.CalendarPanel)2 ButtonAjaxBehavior (com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior)1 Menu (com.googlecode.wicket.jquery.ui.widget.menu.Menu)1 ConfigurationDao (org.apache.openmeetings.db.dao.basic.ConfigurationDao)1 RoomDao (org.apache.openmeetings.db.dao.room.RoomDao)1 Appointment (org.apache.openmeetings.db.entity.calendar.Appointment)1 Room (org.apache.openmeetings.db.entity.room.Room)1 User (org.apache.openmeetings.db.entity.user.User)1 BackupPanel (org.apache.openmeetings.web.admin.backup.BackupPanel)1 ConfigsPanel (org.apache.openmeetings.web.admin.configurations.ConfigsPanel)1 ConnectionsPanel (org.apache.openmeetings.web.admin.connection.ConnectionsPanel)1 EmailPanel (org.apache.openmeetings.web.admin.email.EmailPanel)1 GroupsPanel (org.apache.openmeetings.web.admin.groups.GroupsPanel)1 LangPanel (org.apache.openmeetings.web.admin.labels.LangPanel)1 LdapsPanel (org.apache.openmeetings.web.admin.ldaps.LdapsPanel)1 OAuthPanel (org.apache.openmeetings.web.admin.oauth.OAuthPanel)1 RoomsPanel (org.apache.openmeetings.web.admin.rooms.RoomsPanel)1 UsersPanel (org.apache.openmeetings.web.admin.users.UsersPanel)1 BasePanel (org.apache.openmeetings.web.common.BasePanel)1 RoomPanel (org.apache.openmeetings.web.room.RoomPanel)1