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);
}
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());
}
}
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);
}
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);
}
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();
}
Aggregations