use of org.olat.core.gui.components.panel.Panel in project OpenOLAT by OpenOLAT.
the class BaseFullWebappController method event.
@Override
public void event(Event event) {
if (event == Window.AFTER_VALIDATING) {
// now update the guimessage
List<ZIndexWrapper> places = getWindowControl().getWindowBackOffice().getGuiMessages();
Panel winnerP = null;
int maxZ = -1;
if (places != null) {
// we have places where we can put the gui message
for (Iterator<ZIndexWrapper> it_places = places.iterator(); it_places.hasNext(); ) {
ZIndexWrapper ziw = it_places.next();
int cind = ziw.getZindex();
if (cind > maxZ) {
maxZ = cind;
winnerP = ziw.getPanel();
}
}
} else {
winnerP = guimsgHolder;
}
if (winnerP != null && winnerP != currentMsgHolder) {
currentMsgHolder.setContent(null);
winnerP.setContent(guimsgPanel);
currentMsgHolder = winnerP;
} else {
currentMsgHolder = guimsgHolder;
currentMsgHolder.setContent(guimsgPanel);
currentMsgHolder.setDirty(guimsgPanel.isDirty());
}
} else if (event instanceof LanguageChangedEvent) {
LanguageChangedEvent lce = (LanguageChangedEvent) event;
UserRequest ureq = lce.getCurrentUreq();
getTranslator().setLocale(lce.getNewLocale());
initialize(ureq);
WindowManager winman = Windows.getWindows(ureq).getWindowManager();
initializeBase(ureq, winman, initialPanel);
initialPanel.setContent(mainVc);
reload = Boolean.TRUE;
} else if (event instanceof ChiefControllerMessageEvent) {
// msg can be set to show only on one node or on all nodes
updateStickyMessage();
} else if (event instanceof AssessmentModeNotificationEvent) {
try {
processAssessmentModeNotificationEvent((AssessmentModeNotificationEvent) event);
} catch (Exception e) {
logError("", e);
}
}
}
use of org.olat.core.gui.components.panel.Panel in project OpenOLAT by OpenOLAT.
the class BaseFullWebappController method initializeBase.
private void initializeBase(UserRequest ureq, WindowManager winman, ComponentCollection mainPanel) {
// component-id of mainPanel for the window id
mainVc.contextPut("o_winid", mainPanel.getDispatchID());
BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
mainVc.contextPut("enforceTopFrame", securityModule.isForceTopFrame());
// add optional css classes
mainVc.contextPut("bodyCssClasses", bodyCssClasses);
Window w = wbo.getWindow();
mainVc.put("jsCssRawHtmlHeader", w.getJsCssRawHtmlHeader());
// control part for ajax-communication. returns an empty panel if ajax
// is not enabled, so that ajax can be turned on on the fly for
// development mode
jsServerC = wbo.createAJAXController(ureq);
mainVc.put("jsServer", jsServerC.getInitialComponent());
// init with no bookmark (=empty bc)
mainVc.contextPut("o_bc", "");
mainVc.contextPut("o_serverUri", Settings.createServerURI());
// the current language; used e.g. by screenreaders
mainVc.contextPut("lang", ureq.getLocale().toString());
// some user properties
if (ureq.getUserSession().isAuthenticated()) {
Identity ident = ureq.getIdentity();
StringBuilder sb = new StringBuilder();
sb.append("{ identity : ").append(ident.getKey());
User user = ident.getUser();
List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(USER_PROPS_ID, ureq.getUserSession().getRoles().isOLATAdmin());
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
String escapedValue = StringHelper.escapeJavaScript(userPropertyHandler.getUserProperty(user, getLocale()));
sb.append(", ").append(userPropertyHandler.getName()).append(" : \"").append(escapedValue).append("\"");
}
sb.append("}");
mainVc.contextPut("userJSON", sb);
}
// the current GUI theme and the global settings that contains the
// font-size. both are pushed as objects so that window.dirty always reads
// out the correct value
mainVc.contextPut("theme", w.getGuiTheme());
mainVc.contextPut("globalSettings", winman.getGlobalSettings());
// also add the optional theme javascript
addThemeJS();
// Add JS analytics code, e.g. for google analytics
if (analyticsModule.isAnalyticsEnabled()) {
AnalyticsSPI analyticsSPI = analyticsModule.getAnalyticsProvider();
mainVc.contextPut("analytics", analyticsSPI.analyticsInitPageJavaScript());
}
// content panel
contentPanel = new Panel("olatContentPanel");
mainVc.put("olatContentPanel", contentPanel);
mainVc.contextPut("o_winid", w.getDispatchID());
mainVc.contextPut("buildversion", Settings.getVersion());
if (wbo.isDebuging()) {
debugC = wbo.createDebugDispatcherController(ureq, getWindowControl());
mainVc.put("guidebug", debugC.getInitialComponent());
}
// Inline translation interceptor. when the translation tool is enabled it
// will start the translation tool in translation mode, if the overlay
// feature is enabled it will start in customizing mode
// fxdiff: allow user-managers to use the inline translation also.
UserSession usess = ureq.getUserSession();
if (usess.isAuthenticated() && (usess.getRoles().isOLATAdmin() || usess.getRoles().isUserManager()) && (i18nModule.isTransToolEnabled() || i18nModule.isOverlayEnabled())) {
inlineTranslationC = wbo.createInlineTranslationDispatcherController(ureq, getWindowControl());
Preferences guiPrefs = usess.getGuiPreferences();
Boolean isInlineTranslationEnabled = (Boolean) guiPrefs.get(I18nModule.class, I18nModule.GUI_PREFS_INLINE_TRANSLATION_ENABLED, Boolean.FALSE);
i18nManager.setMarkLocalizedStringsEnabled(usess, isInlineTranslationEnabled);
mainVc.put("inlineTranslation", inlineTranslationC.getInitialComponent());
}
// debug info if debugging
if (wbo.isDebuging()) {
developmentC = wbo.createDevelopmentController(ureq, getWindowControl());
mainVc.put("development", developmentC.getInitialComponent());
}
// put the global js translator mapper path into the main window
mainVc.contextPut("jsTranslationMapperPath", BaseChiefController.jsTranslationMapperPath);
// master window
// w.addListener(this); // to be able to report "browser reload" to the user
w.setContentPane(mainPanel);
}
use of org.olat.core.gui.components.panel.Panel in project OpenOLAT by OpenOLAT.
the class BaseFullWebappController method lockGUI.
private void lockGUI() {
if (topnavCtr != null) {
topnavCtr.lock();
}
if (footerCtr != null) {
footerCtr.lock();
}
if (userToolsMenuCtrl != null) {
userToolsMenuCtrl.lock();
}
if (dtabsControllers != null) {
for (int i = dtabsControllers.size(); i-- > 0; ) {
DTab tab = dtabs.get(i);
if (lockResource == null || !lockResource.getResourceableId().equals(tab.getOLATResourceable().getResourceableId())) {
removeDTab(null, tab);
} else if (lockResource != null && lockResource.getResourceableId().equals(tab.getOLATResourceable().getResourceableId()) && lockStatus != LockStatus.locked) {
removeDTab(null, tab);
}
}
}
navSitesVc.contextPut("visible", Boolean.FALSE);
navSitesVc.setDirty(true);
navTabsVc.setDirty(true);
main.setContent(new Panel("empty-mode"));
}
use of org.olat.core.gui.components.panel.Panel in project OpenOLAT by OpenOLAT.
the class QTI12StatisticsToolController method doSelectNode.
private void doSelectNode(UserRequest ureq, TreeNode selectedNode) {
removeAsListenerAndDispose(currentCtrl);
WindowControl swControl = addToHistory(ureq, OresHelper.createOLATResourceableInstance(selectedNode.getIdent(), 0l), null);
currentCtrl = result.getController(ureq, swControl, stackPanel, selectedNode);
if (currentCtrl != null) {
listenTo(currentCtrl);
layoutCtr.setCol3(currentCtrl.getInitialComponent());
} else {
layoutCtr.setCol3(new Panel("empty"));
}
}
use of org.olat.core.gui.components.panel.Panel in project OpenOLAT by OpenOLAT.
the class AssessmentTestComposerController method partEditorFactory.
private void partEditorFactory(UserRequest ureq, TreeNode selectedNode) {
// remove old one
if (currentEditorCtrl != null) {
mainVC.remove(currentEditorCtrl.getInitialComponent());
removeAsListenerAndDispose(currentEditorCtrl);
currentEditorCtrl = null;
}
// fill with the new
mainVC.contextPut("cssClass", selectedNode.getIconCssClass());
if (Settings.isDebuging()) {
mainVC.contextPut("identifier", selectedNode.getIdent());
}
mainVC.contextPut("title", selectedNode.getTitle());
mainVC.contextPut("restrictedEdit", restrictedEdit);
Object uobject = selectedNode.getUserObject();
if (uobject instanceof AssessmentTest) {
AssessmentTest test = (AssessmentTest) uobject;
URI testURI = resolvedAssessmentTest.getTestLookup().getSystemId();
File testFile = new File(testURI);
TestPart uniqueTestPart = test.getTestParts().size() == 1 ? test.getTestParts().get(0) : null;
currentEditorCtrl = new AssessmentTestEditorController(ureq, getWindowControl(), assessmentTestBuilder, uniqueTestPart, unzippedDirRoot, unzippedContRoot, testFile, restrictedEdit);
} else if (uobject instanceof TestPart) {
currentEditorCtrl = new AssessmentTestPartEditorController(ureq, getWindowControl(), (TestPart) uobject, restrictedEdit, assessmentTestBuilder.isEditable());
} else if (uobject instanceof AssessmentSection) {
URI testURI = resolvedAssessmentTest.getTestLookup().getSystemId();
File testFile = new File(testURI);
currentEditorCtrl = new AssessmentSectionEditorController(ureq, getWindowControl(), (AssessmentSection) uobject, unzippedDirRoot, unzippedContRoot, testFile, restrictedEdit, assessmentTestBuilder.isEditable());
} else if (uobject instanceof AssessmentItemRef) {
AssessmentItemRef itemRef = (AssessmentItemRef) uobject;
ResolvedAssessmentItem item = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
if (item == null || item.getItemLookup() == null) {
currentEditorCtrl = new BadResourceController(ureq, getWindowControl(), null, unzippedDirRoot, itemRef.getHref());
} else if (item.getItemLookup().getBadResourceException() != null) {
currentEditorCtrl = new BadResourceController(ureq, getWindowControl(), item.getItemLookup().getBadResourceException(), unzippedDirRoot, itemRef.getHref());
} else {
URI itemUri = resolvedAssessmentTest.getSystemIdByItemRefMap().get(itemRef);
File itemFile = new File(itemUri);
ManifestMetadataBuilder metadata = getMetadataBuilder(itemRef);
currentEditorCtrl = new AssessmentItemEditorController(ureq, getWindowControl(), testEntry, item, itemRef, metadata, unzippedDirRoot, unzippedContRoot, itemFile, restrictedEdit);
}
}
if (deleteLink != null) {
if (uobject instanceof AssessmentSection || uobject instanceof AssessmentItemRef) {
deleteLink.setEnabled(true);
} else if (uobject instanceof TestPart) {
TestPart testPart = (TestPart) uobject;
deleteLink.setEnabled(testPart.getParent().getTestParts().size() > 1);
} else {
deleteLink.setEnabled(false);
}
}
if (copyLink != null) {
copyLink.setEnabled(uobject instanceof AssessmentItemRef);
}
if (currentEditorCtrl != null) {
listenTo(currentEditorCtrl);
mainVC.put("content", currentEditorCtrl.getInitialComponent());
} else {
mainVC.put("content", new Panel("empty"));
}
}
Aggregations