use of org.olat.core.gui.components.table.TableController in project openolat by klemens.
the class ScormResultDetailsController method event.
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (source == summaryTableCtr) {
TableEvent tEvent = (TableEvent) event;
if (tEvent.getActionId().equals("sel")) {
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setPreferencesOffered(true, "scormAssessmentDetails");
removeAsListenerAndDispose(cmiTableCtr);
cmiTableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
listenTo(cmiTableCtr);
cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.itemId", 0, null, ureq.getLocale()));
cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.translatedKey", 1, null, ureq.getLocale()));
cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.key", 2, null, ureq.getLocale()));
cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.value", 3, null, ureq.getLocale()));
// <BPS-252> BPS-252_3
int rowId = tEvent.getRowId();
List<CmiData> data = ((SummaryTableDataModelMultiResults) summaryTableCtr.getTableDataModel()).getObject(rowId);
cmiTableCtr.setTableDataModel(new CmiTableDataModel(getTranslator(), data));
// </BPS-252> BPS-252_3
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("close"), cmiTableCtr.getInitialComponent());
listenTo(cmc);
cmc.activate();
}
} else if (source == resetConfirmationBox) {
if (DialogBoxUIFactory.isOkEvent(event)) {
// delete scorm
String username = assessedUserCourseEnv.getIdentityEnvironment().getIdentity().getName();
CourseEnvironment courseEnv = assessedUserCourseEnv.getCourseEnvironment();
ScormAssessmentManager.getInstance().deleteResults(username, courseEnv, node);
fireEvent(ureq, Event.DONE_EVENT);
}
}
}
use of org.olat.core.gui.components.table.TableController 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);
}
use of org.olat.core.gui.components.table.TableController in project openolat by klemens.
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);
}
use of org.olat.core.gui.components.table.TableController in project openolat by klemens.
the class EPMultipleArtefactsAsTableController method initOrUpdateTable.
private void initOrUpdateTable(UserRequest ureq, List<AbstractArtefact> artefacts) {
ArtefactTableDataModel artefactListModel = new ArtefactTableDataModel(artefacts);
artefactListModel.setLocale(getLocale());
TableGuiConfiguration tableGuiConfiguration = new TableGuiConfiguration();
tableGuiConfiguration.setTableEmptyMessage(getTranslator().translate("table.empty"));
tableGuiConfiguration.setPageingEnabled(true);
// offer download only when in artefact pool (no struct given)
tableGuiConfiguration.setDownloadOffered(struct == null);
tableGuiConfiguration.setResultsPerPage(10);
tableGuiConfiguration.setPreferencesOffered(true, "artefacts.as.table.prefs");
artefactListTblCtrl = new TableController(tableGuiConfiguration, ureq, getWindowControl(), getTranslator());
if (multiSelect) {
artefactListTblCtrl.setMultiSelect(true);
artefactListTblCtrl.addMultiSelectAction("select", "select");
}
listenTo(artefactListTblCtrl);
String details = artefactChooseMode ? null : CMD_TITLE;
DefaultColumnDescriptor descr = new DefaultColumnDescriptor("artefact.title", 0, details, getLocale());
artefactListTblCtrl.addColumnDescriptor(descr);
descr = new DefaultColumnDescriptor("artefact.description", 1, null, getLocale());
descr.setEscapeHtml(EscapeMode.antisamy);
artefactListTblCtrl.addColumnDescriptor(true, descr);
descr = new DefaultColumnDescriptor("artefact.date", 2, null, getLocale());
artefactListTblCtrl.addColumnDescriptor(true, descr);
descr = new DefaultColumnDescriptor("artefact.author", 3, null, getLocale());
artefactListTblCtrl.addColumnDescriptor(false, descr);
descr = new DefaultColumnDescriptor("artefact.tags", 4, null, getLocale());
artefactListTblCtrl.addColumnDescriptor(false, descr);
descr = new CustomRenderColumnDescriptor("table.header.type", 5, null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_CENTER, new ArtefactTypeImageCellRenderer(getLocale())) {
/**
* @see org.olat.core.gui.components.table.DefaultColumnDescriptor#compareTo(int, int)
*/
@Override
public int compareTo(int rowa, int rowb) {
Object a = table.getTableDataModel().getValueAt(rowa, dataColumn);
Object b = table.getTableDataModel().getValueAt(rowb, dataColumn);
String typeA = getArtefactTranslatedTypeName((AbstractArtefact) a);
String typeB = getArtefactTranslatedTypeName((AbstractArtefact) b);
return typeA.compareTo(typeB);
}
};
artefactListTblCtrl.addColumnDescriptor(false, descr);
StaticColumnDescriptor staticDescr;
if (!artefactChooseMode) {
if (mapClosed || !secCallback.canEditReflexion()) {
// change link-description in row, when map is closed or viewed by another person
staticDescr = new StaticColumnDescriptor(CMD_REFLEXION, "table.header.reflexion", translate("table.header.view"));
} else {
staticDescr = new StaticColumnDescriptor(CMD_REFLEXION, "table.header.reflexion", translate("table.row.reflexion"));
}
artefactListTblCtrl.addColumnDescriptor(true, staticDescr);
}
if (struct == null) {
staticDescr = new StaticColumnDescriptor(CMD_DELETEARTEFACT, "delete.artefact", translate("delete.artefact"));
artefactListTblCtrl.addColumnDescriptor(true, staticDescr);
}
if (artefactChooseMode) {
staticDescr = new StaticColumnDescriptor(CMD_CHOOSE, "table.header.choose", translate("choose.artefact"));
artefactListTblCtrl.addColumnDescriptor(true, staticDescr);
}
if (struct != null && secCallback.canRemoveArtefactFromStruct()) {
staticDescr = new StaticColumnDescriptor(CMD_UNLINK, "table.header.unlink", translate("remove.from.map"));
artefactListTblCtrl.addColumnDescriptor(true, staticDescr);
}
if (struct != null && secCallback.canRemoveArtefactFromStruct() && secCallback.canAddArtefact()) {
staticDescr = new StaticColumnDescriptor(CMD_MOVE, "table.header.move", translate("artefact.options.move"));
artefactListTblCtrl.addColumnDescriptor(true, staticDescr);
}
artefactListTblCtrl.setTableDataModel(artefactListModel);
if (vC.getComponent("artefactTable") != null)
vC.remove(artefactListTblCtrl.getInitialComponent());
vC.put("artefactTable", artefactListTblCtrl.getInitialComponent());
}
use of org.olat.core.gui.components.table.TableController in project openolat by klemens.
the class UserControllerFactory method createTableControllerFor.
public static TableController createTableControllerFor(TableGuiConfiguration tableConfig, List<Identity> identities, UserRequest ureq, WindowControl wControl, String actionCommand) {
Locale loc = ureq.getLocale();
Translator trans = Util.createPackageTranslator(UserControllerFactory.class, loc);
trans = UserManager.getInstance().getPropertyHandlerTranslator(trans);
TableController tableCtr = new TableController(tableConfig, ureq, wControl, trans);
Roles roles = ureq.getUserSession().getRoles();
boolean isAdministrativeUser = (roles.isAuthor() || roles.isGroupManager() || roles.isUserManager() || roles.isOLATAdmin());
UserTableDataModel userDataModel = new UserTableDataModel(identities, loc, isAdministrativeUser);
userDataModel.addColumnDescriptors(tableCtr, actionCommand);
tableCtr.setTableDataModel(userDataModel);
return tableCtr;
}
Aggregations