Search in sources :

Example 16 with StaticColumnDescriptor

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

the class ExtendedIdentitiesTableDataModel method addColumnDescriptors.

/**
 * Add all column descriptors to this table that are available in the table
 * model
 *
 * @param tableCtr
 */
public void addColumnDescriptors(TableController tableCtr, Translator trans) {
    setLocale(trans.getLocale());
    if (isAdministrativeUser) {
        String action = actionEnabled ? COMMAND_SELECTUSER : null;
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.identity.name", colCount++, action, getLocale()));
    }
    UserManager um = UserManager.getInstance();
    // followed by the users fields
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
        UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
        boolean visible = um.isMandatoryUserProperty(usageIdentifyer, userPropertyHandler);
        String action = null;
        if (actionEnabled && i < 2) {
            action = COMMAND_SELECTUSER;
        }
        tableCtr.addColumnDescriptor(visible, userPropertyHandler.getColumnDescriptor(colCount++, action, getLocale()));
    }
    // in the end the last login and creation date
    tableCtr.addColumnDescriptor(false, new DefaultColumnDescriptor("table.identity.lastlogin", colCount++, null, getLocale()));
    // creation date at the end, enabled by default
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.identity.creationdate", colCount++, null, getLocale()));
    if (actionEnabled) {
        StaticColumnDescriptor vcd = new StaticColumnDescriptor(COMMAND_VCARD, "table.header.vcard", trans.translate("table.identity.vcard"));
        vcd.setIsPopUpWindowAction(true, "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
        tableCtr.addColumnDescriptor(vcd);
    }
}
Also used : UserManager(org.olat.user.UserManager) StaticColumnDescriptor(org.olat.core.gui.components.table.StaticColumnDescriptor) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 17 with StaticColumnDescriptor

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

the class UserSearchController method doSearch.

private void doSearch(UserRequest ureq) {
    String login = searchform.login.getValue();
    // build user fields search map
    Map<String, String> userPropertiesSearch = new HashMap<>();
    for (UserPropertyHandler userPropertyHandler : searchform.userPropertyHandlers) {
        if (userPropertyHandler == null)
            continue;
        FormItem ui = searchform.propFormItems.get(userPropertyHandler.getName());
        String uiValue = userPropertyHandler.getStringValue(ui);
        if (userPropertyHandler.getName().startsWith("genericCheckboxProperty")) {
            if (!"false".equals(uiValue)) {
                userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
            }
        } else if (StringHelper.containsNonWhitespace(uiValue)) {
            userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
        }
    }
    if (userPropertiesSearch.isEmpty()) {
        userPropertiesSearch = null;
    }
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), myContent.getTranslator());
    listenTo(tableCtr);
    List<Identity> users = searchUsers(login, userPropertiesSearch, true);
    int maxResults = securityModule.getUserSearchMaxResultsValue();
    if (maxResults > 0 && users.size() > maxResults) {
        users = users.subList(0, maxResults);
        showWarning("error.search.maxResults", Integer.toString(maxResults));
    }
    if (!users.isEmpty()) {
        tdm = new UserTableDataModel(users, getLocale(), isAdministrativeUser);
        // add the data column descriptors
        tdm.addColumnDescriptors(tableCtr, null);
        // add the action columns
        if (useMultiSelect) {
            // add multiselect action
            tableCtr.addMultiSelectAction(this.actionKeyChoose, ACTION_MULTISELECT_CHOOSE);
        } else {
            // add single column selec action
            tableCtr.addColumnDescriptor(new StaticColumnDescriptor(ACTION_SINGLESELECT_CHOOSE, "table.header.action", myContent.getTranslator().translate("action.choose")));
        }
        tableCtr.setTableDataModel(tdm);
        tableCtr.setMultiSelect(useMultiSelect);
        searchPanel.pushContent(tableCtr.getInitialComponent());
        myContent.contextPut("showButton", "true");
    } else {
        getWindowControl().setInfo(translate("error.no.user.found"));
    }
}
Also used : HashMap(java.util.HashMap) FormItem(org.olat.core.gui.components.form.flexible.FormItem) TableController(org.olat.core.gui.components.table.TableController) StaticColumnDescriptor(org.olat.core.gui.components.table.StaticColumnDescriptor) Identity(org.olat.core.id.Identity) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 18 with StaticColumnDescriptor

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

the class ReadyToDeleteController method initializeTableController.

private void initializeTableController(UserRequest ureq) {
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(translate("error.no.user.found"));
    tableConfig.setShowAllLinkEnabled(false);
    removeAsListenerAndDispose(tableCtr);
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), this.propertyHandlerTranslator);
    listenTo(tableCtr);
    List<Identity> l = UserDeletionManager.getInstance().getIdentitiesInDeletionProcess(UserDeletionManager.getInstance().getDeleteEmailDuration());
    tdm = new UserDeleteTableModel(l, getLocale(), isAdministrativeUser);
    tdm.addColumnDescriptors(tableCtr, null, "table.identity.deleteEmail");
    tableCtr.addColumnDescriptor(new StaticColumnDescriptor(ACTION_SINGLESELECT_CHOOSE, "table.header.action", translate("action.activate")));
    tableCtr.addMultiSelectAction("action.ready.to.delete", ACTION_MULTISELECT_CHOOSE);
    tableCtr.setMultiSelect(true);
    tableCtr.setTableDataModel(tdm);
}
Also used : TableController(org.olat.core.gui.components.table.TableController) StaticColumnDescriptor(org.olat.core.gui.components.table.StaticColumnDescriptor) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) Identity(org.olat.core.id.Identity)

Example 19 with StaticColumnDescriptor

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

the class GroupController method initGroupTable.

/**
 * Init GroupList-table-controller for non-waitinglist (participant-list,
 * owner-list).
 */
protected void initGroupTable(TableController tableCtr, UserRequest ureq, boolean enableTablePreferences, boolean enableUserSelection) {
    List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(usageIdentifyer, isAdministrativeUser);
    if (isAdministrativeUser) {
        // first the login name, but only if administrative user
        DefaultColumnDescriptor cd0 = new DefaultColumnDescriptor("table.user.login", 0, COMMAND_VCARD, ureq.getLocale());
        cd0.setIsPopUpWindowAction(true, "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
        tableCtr.addColumnDescriptor(cd0);
    }
    if (chatEnabled) {
        tableCtr.addColumnDescriptor(new CustomRenderColumnDescriptor("table.header.online", 1, COMMAND_IM, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new OnlineIconRenderer()));
    }
    int visibleColId = 0;
    // followed by the users fields
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
        UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
        boolean visible = userManager.isMandatoryUserProperty(usageIdentifyer, userPropertyHandler);
        ColumnDescriptor cd = userPropertyHandler.getColumnDescriptor(i + 3, COMMAND_VCARD, ureq.getLocale());
        // make all user attributes clickable to open visiting card
        if (cd instanceof DefaultColumnDescriptor) {
            DefaultColumnDescriptor dcd = (DefaultColumnDescriptor) cd;
            dcd.setIsPopUpWindowAction(true, "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
        }
        tableCtr.addColumnDescriptor(visible, cd);
        if (visible) {
            visibleColId++;
        }
    }
    // in the end
    if (enableTablePreferences) {
        DefaultColumnDescriptor cd = new DefaultColumnDescriptor("table.subject.addeddate", 2, COMMAND_VCARD, ureq.getLocale());
        cd.setIsPopUpWindowAction(true, "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
        tableCtr.addColumnDescriptor(true, cd);
        tableCtr.setSortColumn(++visibleColId, true);
    }
    if (enableUserSelection) {
        tableCtr.addColumnDescriptor(new StaticColumnDescriptor(COMMAND_SELECTUSER, "table.subject.action", myTrans.translate("action.general")));
    }
    if (mayModifyMembers) {
        tableCtr.addMultiSelectAction("action.remove", COMMAND_REMOVEUSER);
        tableCtr.setMultiSelect(true);
    }
}
Also used : CustomRenderColumnDescriptor(org.olat.core.gui.components.table.CustomRenderColumnDescriptor) OnlineIconRenderer(org.olat.group.ui.main.OnlineIconRenderer) CustomRenderColumnDescriptor(org.olat.core.gui.components.table.CustomRenderColumnDescriptor) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor) StaticColumnDescriptor(org.olat.core.gui.components.table.StaticColumnDescriptor) ColumnDescriptor(org.olat.core.gui.components.table.ColumnDescriptor) StaticColumnDescriptor(org.olat.core.gui.components.table.StaticColumnDescriptor) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 20 with StaticColumnDescriptor

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

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)

Aggregations

StaticColumnDescriptor (org.olat.core.gui.components.table.StaticColumnDescriptor)26 DefaultColumnDescriptor (org.olat.core.gui.components.table.DefaultColumnDescriptor)18 TableController (org.olat.core.gui.components.table.TableController)16 TableGuiConfiguration (org.olat.core.gui.components.table.TableGuiConfiguration)14 CustomRenderColumnDescriptor (org.olat.core.gui.components.table.CustomRenderColumnDescriptor)10 Identity (org.olat.core.id.Identity)10 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)10 ColumnDescriptor (org.olat.core.gui.components.table.ColumnDescriptor)6 Date (java.util.Date)4 OnlineIconRenderer (org.olat.group.ui.main.OnlineIconRenderer)4 BigDecimal (java.math.BigDecimal)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Locale (java.util.Locale)2 ShortName (org.olat.core.gui.ShortName)2 FormItem (org.olat.core.gui.components.form.flexible.FormItem)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2 CustomCellRenderer (org.olat.core.gui.components.table.CustomCellRenderer)2 DateCellRenderer (org.olat.core.gui.components.table.DateCellRenderer)2