use of org.olat.repository.CatalogEntry in project OpenOLAT by OpenOLAT.
the class CatalogNodeManagerController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (addEntryCtrl == source) {
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
loadNodesChildren();
}
cmc.deactivate();
cleanUp();
fireEvent(ureq, Event.CHANGED_EVENT);
} else if (editEntryCtrl == source) {
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
catalogEntry = editEntryCtrl.getEditedCatalogEntry();
loadEntryInfos();
}
cmc.deactivate();
cleanUp();
fireEvent(ureq, Event.CHANGED_EVENT);
} else if (categoryMoveCtrl == source) {
cmc.deactivate();
CatalogEntry moveMe = null;
if (event.equals(Event.DONE_EVENT)) {
showInfo("tools.move.catalog.entry.success", catalogEntry.getName());
moveMe = categoryMoveCtrl.getMoveMe();
} else if (event.equals(Event.FAILED_EVENT)) {
showError("tools.move.catalog.entry.failed");
loadNodesChildren();
}
cleanUp();
// in any case, remove the lock
if (catModificationLock != null && catModificationLock.isSuccess()) {
CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLock(catModificationLock);
catModificationLock = null;
}
// only after jump to the moved entry
if (moveMe != null) {
launchCatalogEntry(ureq, moveMe);
}
} else if (dialogDeleteSubtree == source) {
// from remove subtree dialog -> yes or no
if (DialogBoxUIFactory.isYesEvent(event)) {
catalogManager.deleteCatalogEntry(catalogEntry);
fireEvent(ureq, Event.BACK_EVENT);
}
// in any case, remove the lock
if (catModificationLock != null && catModificationLock.isSuccess()) {
CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLock(catModificationLock);
catModificationLock = null;
}
} else if (childNodeCtrl == source) {
if (event == Event.BACK_EVENT) {
toolbarPanel.popUpToController(this);
removeAsListenerAndDispose(childNodeCtrl);
childNodeCtrl = null;
loadNodesChildren();
}
} else if (entrySearchCtrl == source) {
if (event.getCommand().equals(RepositoryTableModel.TABLE_ACTION_SELECT_LINK)) {
// successfully selected a repository entry which will be a link within
// the current Category
RepositoryEntry selectedEntry = entrySearchCtrl.getSelectedEntry();
doAddResource(ureq, selectedEntry);
fireEvent(ureq, Event.CHANGED_EVENT);
}
cmc.deactivate();
cleanUp();
} else if (groupCtrl == source) {
if (event instanceof IdentitiesAddEvent || event instanceof IdentitiesRemoveEvent) {
doAddRemoveOwners(event);
}
} else if (contactCtrl == source) {
cmc.deactivate();
cleanUp();
} else if (dialogDeleteLink == source) {
if (DialogBoxUIFactory.isYesEvent(event)) {
CatalogEntryRow row = (CatalogEntryRow) dialogDeleteLink.getUserObject();
catalogManager.deleteCatalogEntry(row, catalogEntry);
loadResources(ureq);
}
} else if (entryResourceMoveCtrl == source) {
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
CatalogEntry moveMe = entryResourceMoveCtrl.getMoveMe();
showInfo("tools.move.catalog.entry.success", moveMe.getName());
loadResources(ureq);
}
cmc.deactivate();
cleanUp();
} else if (cmc == source) {
cleanUp();
}
super.event(ureq, source, event);
}
use of org.olat.repository.CatalogEntry in project OpenOLAT by OpenOLAT.
the class CatalogNodeManagerController method doContact.
private void doContact(UserRequest ureq) {
removeAsListenerAndDispose(cmc);
removeAsListenerAndDispose(contactCtrl);
ContactList caretaker = new ContactList(translate("contact.to.groupname.caretaker"));
List<Identity> owners = new ArrayList<Identity>();
CatalogEntry parent = catalogEntry;
while (parent != null && owners.isEmpty()) {
SecurityGroup parentOwner = parent.getOwnerGroup();
if (parentOwner != null) {
owners = securityManager.getIdentitiesOfSecurityGroup(parentOwner);
}
parent = parent.getParent();
}
for (int i = owners.size(); i-- > 0; ) {
caretaker.add(owners.get(i));
}
// create e-mail Message
ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
cmsg.addEmailTo(caretaker);
contactCtrl = new ContactFormController(ureq, getWindowControl(), true, false, false, cmsg);
listenTo(contactCtrl);
// open form in dialog
cmc = new CloseableModalController(getWindowControl(), "close", contactCtrl.getInitialComponent(), true, translate("contact.caretaker"));
listenTo(cmc);
cmc.activate();
}
use of org.olat.repository.CatalogEntry in project OpenOLAT by OpenOLAT.
the class OverviewRepositoryListController method doOpenCatalog.
private CatalogNodeController doOpenCatalog(UserRequest ureq) {
if (!repositoryModule.isCatalogEnabled() || !repositoryModule.isCatalogBrowsingEnabled()) {
return null;
}
cleanUp();
List<CatalogEntry> entries = catalogManager.getRootCatalogEntries();
CatalogEntry rootEntry = null;
if (entries.size() > 0) {
rootEntry = entries.get(0);
}
OLATResourceable ores = OresHelper.createOLATResourceableInstance("Catalog", 0l);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl());
catalogStackPanel = new BreadcrumbedStackedPanel("catstack", getTranslator(), this);
catalogCtrl = new CatalogNodeController(ureq, bwControl, getWindowControl(), rootEntry, catalogStackPanel, false);
catalogStackPanel.pushController(translate("search.catalog"), catalogCtrl);
listenTo(catalogCtrl);
currentCtrl = catalogCtrl;
addToHistory(ureq, catalogCtrl);
mainVC.put("segmentCmp", catalogStackPanel);
return catalogCtrl;
}
use of org.olat.repository.CatalogEntry in project OpenOLAT by OpenOLAT.
the class CatalogSettingsController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
String catalogPage = velocity_root + "/catalog_info.html";
catalog = FormLayoutContainer.createCustomFormLayout("info", getTranslator(), catalogPage);
catalog.setRootForm(mainForm);
formLayout.add(catalog);
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("catalog.path", 0));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("remove", translate("remove"), "remove"));
List<CatalogEntry> catalogEntries = catalogManager.getCatalogCategoriesFor(entry);
model = new CategoriesListModel(catalogEntries, columnsModel);
tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 200, true, getTranslator(), formLayout);
tableEl.setCustomizeColumns(false);
tableEl.setVisible(true);
if (catalogEntries.size() == 0) {
catalog.contextPut("hasContent", false);
tableEl.setEmtpyTableMessageKey("no.catalog.entries");
} else {
catalog.contextPut("hasContent", true);
}
}
use of org.olat.repository.CatalogEntry in project OpenOLAT by OpenOLAT.
the class CatalogSettingsController method doRemove.
private void doRemove(CatalogEntry catEntry) {
List<CatalogEntry> children = catalogManager.getChildrenOf(catEntry);
// find all child element of this level that reference our repo entry
for (CatalogEntry child : children) {
RepositoryEntry childRepoEntry = child.getRepositoryEntry();
if (childRepoEntry != null && childRepoEntry.equalsByPersistableKey(entry)) {
// remove from catalog
catalogManager.deleteCatalogEntry(child);
}
}
// update table
updateTable();
}
Aggregations