use of org.olat.core.gui.control.generic.iframe.DeliveryOptions in project OpenOLAT by OpenOLAT.
the class CPRunController method doLaunch.
private void doLaunch(UserRequest ureq) {
DeliveryOptions deliveryOptions = (DeliveryOptions) config.get(CPEditController.CONFIG_DELIVERYOPTIONS);
if (cpRoot == null) {
// it is the first time we start the contentpackaging from this instance
// of this controller.
// need to be strict when launching -> "true"
RepositoryEntry re = CPEditController.getCPReference(config, false);
if (re == null) {
showError(CPEditController.NLS_ERROR_CPREPOENTRYMISSING);
return;
}
cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
// nodes reference them
if (cpRoot == null) {
showError(CPEditController.NLS_ERROR_CPREPOENTRYMISSING);
return;
}
if (deliveryOptions != null && deliveryOptions.getInherit() != null && deliveryOptions.getInherit().booleanValue()) {
CPPackageConfig packageConfig = CPManager.getInstance().getCPPackageConfig(re.getOlatResource());
if (packageConfig != null && packageConfig.getDeliveryOptions() != null) {
deliveryOptions = packageConfig.getDeliveryOptions();
}
}
}
// else cpRoot is already set (save some db access if the user opens /
// closes / reopens the cp from the same CPRuncontroller instance)
boolean activateFirstPage = true;
if ((nodecmd != null) && !nodecmd.equals("")) {
activateFirstPage = false;
}
boolean showNavigation = !config.getBooleanSafe(NodeEditController.CONFIG_COMPONENT_MENU);
cpDispC = CPUIFactory.getInstance().createContentOnlyCPDisplayController(ureq, getWindowControl(), new LocalFolderImpl(cpRoot), activateFirstPage, showNavigation, deliveryOptions, nodecmd, courseResource, cpNode.getIdent(), preview);
cpDispC.setContentEncoding(deliveryOptions.getContentEncoding());
cpDispC.setJSEncoding(deliveryOptions.getJavascriptEncoding());
cpDispC.addControllerListener(this);
main.setContent(cpDispC.getInitialComponent());
if (isExternalMenuConfigured()) {
treeModel = cpDispC.getTreeModel();
treeNodeClickListener = this;
if (activateFirstPage) {
selNodeId = cpDispC.getInitialSelectedNodeId();
} else {
String uri = nodecmd;
if (uri.startsWith("/")) {
uri = uri.substring(1, uri.length());
}
selNodeId = cpDispC.getNodeByUri(uri);
}
}
}
use of org.olat.core.gui.control.generic.iframe.DeliveryOptions in project OpenOLAT by OpenOLAT.
the class SPEditController 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)
*/
@Override
public void event(UserRequest urequest, Controller source, Event event) {
if (source instanceof NodeEditController) {
if (combiLinkCtr != null && combiLinkCtr.isDoProposal()) {
combiLinkCtr.setRelFilePath(CourseEditorHelper.createUniqueRelFilePathFromShortTitle(courseNode, courseFolderBaseContainer));
}
} else if (source == accessibilityCondContr) {
if (event == Event.CHANGED_EVENT) {
Condition cond = accessibilityCondContr.getCondition();
courseNode.setPreConditionAccess(cond);
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == deliveryOptionsCtrl) {
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
DeliveryOptions config = deliveryOptionsCtrl.getDeliveryOptions();
if (config != null) {
moduleConfiguration.set(CONFIG_KEY_DELIVERYOPTIONS, config);
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
}
} else if (source == combiLinkCtr) {
if (event == Event.DONE_EVENT) {
String relPath = VFSManager.getRelativeItemPath(combiLinkCtr.getFile(), courseFolderBaseContainer, null);
combiLinkCtr.setEditable(hasEditRights(relPath));
moduleConfiguration.set(CONFIG_KEY_FILE, relPath);
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
if (!myTabbedPane.containsTab(deliveryOptionsCtrl.getInitialComponent())) {
myTabbedPane.addTab(translate(PANE_TAB_DELIVERYOPTIONS), deliveryOptionsCtrl.getInitialComponent());
}
myContent.contextPut("editorEnabled", combiLinkCtr.isEditorEnabled());
}
} else if (source == securitySettingForm) {
if (event == Event.DONE_EVENT) {
boolean allowRelativeLinks = securitySettingForm.getAllowRelativeLinksConfig();
moduleConfiguration.set(CONFIG_KEY_ALLOW_RELATIVE_LINKS, allowRelativeLinks);
moduleConfiguration.set(CONFIG_KEY_ALLOW_COACH_EDIT, securitySettingForm.getAllowCoachEditConfig());
combiLinkCtr.setAllowEditorRelativeLinks(allowRelativeLinks);
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
}
}
use of org.olat.core.gui.control.generic.iframe.DeliveryOptions in project OpenOLAT by OpenOLAT.
the class TaskHelper method getStandardDeliveryOptions.
public static DeliveryOptions getStandardDeliveryOptions() {
DeliveryOptions config = new DeliveryOptions();
config.setjQueryEnabled(Boolean.TRUE);
config.setOpenolatCss(Boolean.TRUE);
return config;
}
use of org.olat.core.gui.control.generic.iframe.DeliveryOptions in project OpenOLAT by OpenOLAT.
the class VarForm method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
*/
public void event(UserRequest ureq, Component source, Event event) {
if (source == chooseCPButton || source == changeCPButton) {
// those must be links
removeAsListenerAndDispose(searchController);
searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, ScormCPFileResource.TYPE_NAME, translate("command.choosecp"));
listenTo(searchController);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent(), true, translate("command.importcp"));
listenTo(cmc);
cmc.activate();
} else if (source == previewLink) {
// Preview as modal dialogue
// only if the config is valid
RepositoryEntry re = getScormCPReference(config, false);
if (re == null) {
// we cannot preview it, because the repository entry
// had been deleted between the time when it was
// chosen here, and now
showError("error.cprepoentrymissing");
} else {
File cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
boolean showMenu = config.getBooleanSafe(CONFIG_SHOWMENU, true);
boolean fullWindow = config.getBooleanSafe(CONFIG_FULLWINDOW, true);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapScormRepositoryEntry(re));
ScormAPIandDisplayController previewController = ScormMainManager.getInstance().createScormAPIandDisplayController(ureq, getWindowControl(), showMenu, null, cpRoot, null, course.getResourceableId().toString(), ScormConstants.SCORM_MODE_BROWSE, ScormConstants.SCORM_MODE_NOCREDIT, true, null, true, fullWindow, false, null);
// configure some display options
boolean showNavButtons = config.getBooleanSafe(ScormEditController.CONFIG_SHOWNAVBUTTONS, true);
previewController.showNavButtons(showNavButtons);
DeliveryOptions deliveryOptions = deliveryOptionsCtrl.getOptionsForPreview();
previewController.setDeliveryOptions(deliveryOptions);
previewController.activate();
}
}
}
use of org.olat.core.gui.control.generic.iframe.DeliveryOptions in project OpenOLAT by OpenOLAT.
the class SPCourseNode method updateModuleConfigDefaults.
/**
* Update the module configuration to have all mandatory configuration flags
* set to usefull default values
*
* @param isNewNode true: an initial configuration is set; false: upgrading
* from previous node configuration version, set default to maintain
* previous behaviour
*/
public void updateModuleConfigDefaults(boolean isNewNode) {
ModuleConfiguration config = getModuleConfiguration();
if (isNewNode) {
// use defaults for new course building blocks
config.setBooleanEntry(NodeEditController.CONFIG_STARTPAGE, false);
config.setBooleanEntry(SPEditController.CONFIG_KEY_ALLOW_RELATIVE_LINKS, false);
DeliveryOptions defaultOptions = DeliveryOptions.defaultWithGlossary();
config.set(SPEditController.CONFIG_KEY_DELIVERYOPTIONS, defaultOptions);
// new since config version 3
config.setConfigurationVersion(4);
} else {
config.remove(NodeEditController.CONFIG_INTEGRATION);
int version = config.getConfigurationVersion();
if (version < 2) {
// use values accoring to previous functionality
config.setBooleanEntry(NodeEditController.CONFIG_STARTPAGE, Boolean.FALSE.booleanValue());
config.setBooleanEntry(SPEditController.CONFIG_KEY_ALLOW_RELATIVE_LINKS, Boolean.FALSE.booleanValue());
config.setConfigurationVersion(2);
}
if (version < 4) {
if (config.get(SPEditController.CONFIG_KEY_DELIVERYOPTIONS) == null) {
DeliveryOptions defaultOptions = DeliveryOptions.defaultWithGlossary();
config.set(SPEditController.CONFIG_KEY_DELIVERYOPTIONS, defaultOptions);
}
config.setConfigurationVersion(4);
}
// there was a version 3 but all keys new in this version have been removed
}
}
Aggregations