Search in sources :

Example 26 with TableController

use of org.olat.core.gui.components.table.TableController in project openolat by klemens.

the class GroupController method init.

protected void init(UserRequest ureq, boolean mayModifyMembers, boolean keepAtLeastOne, boolean enableTablePreferences, boolean enableUserSelection, boolean allowDownload, boolean mandatoryEmail, SecurityGroup aSecurityGroup) {
    this.securityGroup = aSecurityGroup;
    this.mayModifyMembers = mayModifyMembers;
    this.keepAtLeastOne = keepAtLeastOne;
    this.mandatoryEmail = mandatoryEmail;
    securityManager = BaseSecurityManager.getInstance();
    imModule = CoreSpringFactory.getImpl(InstantMessagingModule.class);
    imService = CoreSpringFactory.getImpl(InstantMessagingService.class);
    userManager = CoreSpringFactory.getImpl(UserManager.class);
    sessionManager = CoreSpringFactory.getImpl(UserSessionManager.class);
    mailManager = CoreSpringFactory.getImpl(MailManager.class);
    Roles roles = ureq.getUserSession().getRoles();
    BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
    isAdministrativeUser = securityModule.isUserAllowedAdminProps(roles);
    chatEnabled = imModule.isEnabled() && imModule.isPrivateEnabled();
    // default group controller has no mail functionality
    this.addUserMailDefaultTempl = null;
    this.removeUserMailDefaultTempl = null;
    groupmemberview = createVelocityContainer("index");
    addUsersButton = LinkFactory.createButtonSmall("overview.addusers", groupmemberview, this);
    addUsersButton.setElementCssClass("o_sel_group_import_users");
    addUserButton = LinkFactory.createButtonSmall("overview.adduser", groupmemberview, this);
    addUserButton.setElementCssClass("o_sel_group_add_user");
    if (mayModifyMembers) {
        groupmemberview.contextPut("mayadduser", Boolean.TRUE);
    }
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setDownloadOffered(allowDownload);
    if (enableTablePreferences) {
        // save table preferences for each group seperatly
        if (mayModifyMembers) {
            tableConfig.setPreferencesOffered(true, "groupcontroller" + securityGroup.getKey());
        } else {
            // different rowcount...
            tableConfig.setPreferencesOffered(true, "groupcontrollerreadonly" + securityGroup.getKey());
        }
    }
    myTrans = userManager.getPropertyHandlerTranslator(getTranslator());
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), myTrans);
    listenTo(tableCtr);
    initGroupTable(tableCtr, ureq, enableTablePreferences, enableUserSelection);
    // set data model
    reloadData();
    groupmemberview.put("subjecttable", tableCtr.getInitialComponent());
    putInitialPanel(groupmemberview);
}
Also used : UserSessionManager(org.olat.core.util.session.UserSessionManager) UserManager(org.olat.user.UserManager) TableController(org.olat.core.gui.components.table.TableController) InstantMessagingService(org.olat.instantMessaging.InstantMessagingService) MailManager(org.olat.core.util.mail.MailManager) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) Roles(org.olat.core.id.Roles) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) InstantMessagingModule(org.olat.instantMessaging.InstantMessagingModule)

Example 27 with TableController

use of org.olat.core.gui.components.table.TableController in project openolat by klemens.

the class AdvancedPropertiesController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == searchForm && event == Event.DONE_EVENT) {
        String resourceTypeName = searchForm.getResourceTypeName();
        String resourceTypeId = searchForm.getResourceTypeId();
        Long resTypeId = null;
        if (resourceTypeId != null && !resourceTypeId.equals(""))
            resTypeId = Long.valueOf(resourceTypeId);
        String category = searchForm.getCategory();
        if (category != null && category.equals(""))
            category = null;
        String propertyName = searchForm.getPropertyName();
        if (propertyName != null && propertyName.equals(""))
            propertyName = null;
        List<Property> entries = PropertyManager.getInstance().listProperties(searchForm.getIdentity(), null, resourceTypeName, resTypeId, category, propertyName);
        PropertiesTableDataModel ptdm = new PropertiesTableDataModel(entries, isAdministrativeUser);
        TableGuiConfiguration tableConfig = new TableGuiConfiguration();
        removeAsListenerAndDispose(tableCtr);
        tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
        // use null as listener argument because we are using listenTo(..) from basiccontroller
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.userName", 0, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.resourceTypeName", 1, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.resourceTypeId", 2, null, getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.category", 3, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.name", 4, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.floatValue", 5, null, getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.stringValue", 6, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.longValue", 10, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.textValue", 7, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.creationdate", 8, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.lastmodified", 9, null, getLocale()));
        tableCtr.setTableDataModel(ptdm);
        listenTo(tableCtr);
        myPanel.setContent(tableCtr.getInitialComponent());
    }
}
Also used : TableController(org.olat.core.gui.components.table.TableController) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) Property(org.olat.properties.Property) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 28 with TableController

use of org.olat.core.gui.components.table.TableController in project OpenOLAT by OpenOLAT.

the class ScormResultDetailsController method init.

protected void init(UserRequest ureq) {
    main = createVelocityContainer("scores");
    TableGuiConfiguration summaryTableConfig = new TableGuiConfiguration();
    summaryTableConfig.setDownloadOffered(true);
    summaryTableCtr = new TableController(summaryTableConfig, ureq, getWindowControl(), getTranslator());
    summaryTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("summary.column.header.date", 0, null, ureq.getLocale()));
    summaryTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("summary.column.header.duration", 1, null, ureq.getLocale()));
    summaryTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("summary.column.header.assesspoints", 2, null, ureq.getLocale()));
    summaryTableCtr.addColumnDescriptor(new StaticColumnDescriptor("sel", "summary.column.header.details", getTranslator().translate("select")));
    CourseEnvironment courseEnv = assessedUserCourseEnv.getCourseEnvironment();
    String username = assessedUserCourseEnv.getIdentityEnvironment().getIdentity().getName();
    // <OLATCE-289>
    Map<Date, List<CmiData>> rawDatas = ScormAssessmentManager.getInstance().visitScoDatasMultiResults(username, courseEnv, node);
    summaryTableCtr.setTableDataModel(new SummaryTableDataModelMultiResults(rawDatas));
    // </OLATCE-289>
    listenTo(summaryTableCtr);
    main.put("summary", summaryTableCtr.getInitialComponent());
    if (!coachCourseEnv.isCourseReadOnly()) {
        resetButton = LinkFactory.createButton("reset", main, this);
        main.put("resetButton", resetButton);
    }
    putInitialPanel(main);
}
Also used : CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) TableController(org.olat.core.gui.components.table.TableController) StaticColumnDescriptor(org.olat.core.gui.components.table.StaticColumnDescriptor) List(java.util.List) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor) Date(java.util.Date)

Example 29 with TableController

use of org.olat.core.gui.components.table.TableController in project OpenOLAT by OpenOLAT.

the class WikiMainController method selectTab.

private void selectTab(UserRequest ureq, String command, String compName, WikiPage page, Wiki wiki) {
    // first release a potential lock on this page. only when the edit tab
    // is acitve
    // a lock will be created. in all other cases it is save to release an
    // existing lock
    doReleaseEditLock();
    if (command.equals(TabbedPaneChangedEvent.TAB_CHANGED)) {
        updatePageContext(ureq, page);
    }
    if (command.equals(TabbedPaneChangedEvent.TAB_CHANGED) && compName.equals("vc_article")) {
    /**
     *********************************************************************
     * tabbed pane change to article
     *********************************************************************
     */
    // if(page.getContent().equals(""))
    // wikiArticleComp.setVisible(false);
    // FIXME:guido: ... && comp == articleContent)) etc.
    } else if (command.equals(TabbedPaneChangedEvent.TAB_CHANGED) && compName.equals("vc_edit")) {
        /**
         *********************************************************************
         * tabbed pane change to edit tab
         *********************************************************************
         */
        wikiEditForm.resetUpdateComment();
        updateFileAndLinkList(wiki);
        // try to edit acquire lock for this page
        tryToSetEditLock(page, ureq, ores);
    } else if (command.equals(TabbedPaneChangedEvent.TAB_CHANGED) && compName.equals("vc_versions")) {
        /**
         *********************************************************************
         * tabbed pane change to versioning tab
         *********************************************************************
         */
        versioningTableModel = new HistoryTableDateModel(wiki.getHistory(page), getTranslator());
        removeAsListenerAndDispose(versioningTableCtr);
        versioningTableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
        listenTo(versioningTableCtr);
        versioningTableModel.addColumnDescriptors(versioningTableCtr);
        versioningTableCtr.setTableDataModel(versioningTableModel);
        versioningTableCtr.modelChanged();
        versioningTableCtr.setSortColumn(1, false);
        versioningContent.put("versions", versioningTableCtr.getInitialComponent());
        versioningContent.contextPut("diffs", diffs);
    } else if (command.equals(TabbedPaneChangedEvent.TAB_CHANGED) && compName.equals("vc_discuss")) {
        /**
         *********************************************************************
         * tabbed pane change to discussion tab
         *********************************************************************
         */
        Forum forum = null;
        if (page.getForumKey() > 0) {
            forum = ForumManager.getInstance().loadForum(Long.valueOf(page.getForumKey()));
        }
        if (forum == null) {
            forum = ForumManager.getInstance().addAForum();
            page.setForumKey(forum.getKey().longValue());
            WikiManager.getInstance().updateWikiPageProperties(ores, page);
        }
        ForumCallback forumCallback = securityCallback.getForumCallback();
        ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(forum);
        WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl());
        removeAsListenerAndDispose(forumController);
        forumController = new ForumController(ureq, bwControl, forum, forumCallback, false);
        listenTo(forumController);
        discussionContent.put("articleforum", forumController.getInitialComponent());
    }
    OLATResourceable pageRes = OresHelper.createOLATResourceableTypeWithoutCheck("path=" + page.getPageName());
    WindowControl wc = addToHistory(ureq, pageRes, null);
    OLATResourceable tabOres = tabs.getTabResource();
    addToHistory(ureq, tabOres, null, wc, true);
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) TableController(org.olat.core.gui.components.table.TableController) ForumCallback(org.olat.modules.fo.ForumCallback) HistoryTableDateModel(org.olat.modules.wiki.versioning.HistoryTableDateModel) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry) ForumController(org.olat.modules.fo.ui.ForumController) Forum(org.olat.modules.fo.Forum)

Example 30 with TableController

use of org.olat.core.gui.components.table.TableController in project OpenOLAT by OpenOLAT.

the class WikiMainController method refreshTableDataModel.

private void refreshTableDataModel(UserRequest ureq, Wiki wiki) {
    removeAsListenerAndDispose(mediaTableCtr);
    mediaTableCtr = new TableController(new TableGuiConfiguration(), ureq, getWindowControl(), getTranslator());
    listenTo(mediaTableCtr);
    mediaTableCtr.setMultiSelect(true);
    mediaTableCtr.addMultiSelectAction(ACTION_DELETE_MEDIAS, ACTION_DELETE_MEDIAS);
    List<VFSItem> filelist = wiki.getMediaFileListWithMetadata();
    Map<String, MediaFileElement> files = new HashMap<String, MediaFileElement>();
    for (Iterator<VFSItem> iter = filelist.iterator(); iter.hasNext(); ) {
        VFSLeaf elem = (VFSLeaf) iter.next();
        if (elem.getName().endsWith(METADATA_SUFFIX)) {
            // *.metadata files
            // go here
            Properties p = new Properties();
            try {
                p.load(elem.getInputStream());
                MediaFileElement mediaFileElement = new MediaFileElement(elem.getName(), p.getProperty(MEDIA_FILE_CREATED_BY), p.getProperty(MEDIA_FILE_CREATIONDATE));
                mediaFileElement.setDeletedBy(p.getProperty(MEDIA_FILE_DELETED_BY));
                mediaFileElement.setDeletionDate(p.getProperty(MEDIA_FILE_DELETIONDATE));
                files.put(p.getProperty(MEDIA_FILE_FILENAME), mediaFileElement);
            } catch (IOException e) {
                throw new OLATRuntimeException("Could'n read properties from media file: " + elem.getName(), e);
            }
        }
    }
    for (Iterator<VFSItem> iter = filelist.iterator(); iter.hasNext(); ) {
        VFSLeaf elem = (VFSLeaf) iter.next();
        if (!elem.getName().endsWith(METADATA_SUFFIX)) {
            if (!files.containsKey(elem.getName())) {
                // legacy file without metadata
                files.put(elem.getName(), new MediaFileElement(elem.getName(), 0, elem.getLastModified()));
            } else {
                // file with metadata, update name
                MediaFileElement element = files.get(elem.getName());
                element.setFileName(elem.getName());
            }
        }
    }
    mediaFilesTableModel = new MediaFilesTableModel(new ArrayList<MediaFileElement>(files.values()), getTranslator());
    mediaFilesTableModel.addColumnDescriptors(mediaTableCtr);
    mediaTableCtr.setTableDataModel(mediaFilesTableModel);
    mediaTableCtr.setSortColumn(3, false);
    mediaTableCtr.modelChanged();
}
Also used : VFSLeaf(org.olat.core.util.vfs.VFSLeaf) HashMap(java.util.HashMap) TableController(org.olat.core.gui.components.table.TableController) ArrayList(java.util.ArrayList) VFSItem(org.olat.core.util.vfs.VFSItem) IOException(java.io.IOException) Properties(java.util.Properties) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration)

Aggregations

TableController (org.olat.core.gui.components.table.TableController)66 TableGuiConfiguration (org.olat.core.gui.components.table.TableGuiConfiguration)60 DefaultColumnDescriptor (org.olat.core.gui.components.table.DefaultColumnDescriptor)38 StaticColumnDescriptor (org.olat.core.gui.components.table.StaticColumnDescriptor)16 CustomRenderColumnDescriptor (org.olat.core.gui.components.table.CustomRenderColumnDescriptor)12 BooleanColumnDescriptor (org.olat.core.gui.components.table.BooleanColumnDescriptor)10 Identity (org.olat.core.id.Identity)10 ArrayList (java.util.ArrayList)6 Date (java.util.Date)6 BaseSecurityModule (org.olat.basesecurity.BaseSecurityModule)6 Roles (org.olat.core.id.Roles)6 HashMap (java.util.HashMap)4 WindowControl (org.olat.core.gui.control.WindowControl)4 Translator (org.olat.core.gui.translator.Translator)4 OLATResourceable (org.olat.core.id.OLATResourceable)4 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)4 RepositoryTableModel (org.olat.repository.ui.RepositoryTableModel)4 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)3 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)3