use of org.olat.core.gui.control.generic.iframe.DeliveryOptions in project OpenOLAT by OpenOLAT.
the class SPRunController method doInlineIntegration.
private void doInlineIntegration(UserRequest ureq, boolean hasEditRightsTo) {
boolean allowRelativeLinks = config.getBooleanSafe(SPEditController.CONFIG_KEY_ALLOW_RELATIVE_LINKS);
// create the possibility to float
OLATResourceable ores = OresHelper.createOLATResourceableInstance(ICourse.class, userCourseEnv.getCourseEnvironment().getCourseResourceableId());
DeliveryOptions deliveryOptions = (DeliveryOptions) config.get(SPEditController.CONFIG_KEY_DELIVERYOPTIONS);
spCtr = new SinglePageController(ureq, getWindowControl(), courseFolderContainer, fileName, allowRelativeLinks, null, ores, deliveryOptions, userCourseEnv.getCourseEnvironment().isPreview());
spCtr.setAllowDownload(true);
// only for inline integration: register for controller event to forward a olatcmd to the course,
// and also to remember latest position in the script
listenTo(spCtr);
// enable edit mode if user has the according rights
if (hasEditRightsTo) {
spCtr.allowPageEditing();
// set the link tree model to internal for the HTML editor
if (linkTreeModel != null) {
spCtr.setInternalLinkTreeModel(linkTreeModel);
}
}
// create clone wrapper layout
CloneLayoutControllerCreatorCallback clccc = new CloneLayoutControllerCreatorCallback() {
public ControllerCreator createLayoutControllerCreator(UserRequest uureq, final ControllerCreator contentControllerCreator) {
return BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(uureq, new ControllerCreator() {
public Controller createController(UserRequest lureq, WindowControl lwControl) {
// Wrap in column layout, popup window needs a layout controller
Controller ctr = contentControllerCreator.createController(lureq, lwControl);
LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, lwControl, ctr);
layoutCtr.setCustomCSS(CourseFactory.getCustomCourseCss(lureq.getUserSession(), userCourseEnv.getCourseEnvironment()));
// Controller titledCtrl = TitledWrapperHelper.getWrapper(lureq, lwControl, ctr, courseNode, "o_sp_icon");
layoutCtr.addDisposableChildController(ctr);
return layoutCtr;
}
});
}
};
Controller ctrl = TitledWrapperHelper.getWrapper(ureq, getWindowControl(), spCtr, courseNode, "o_sp_icon");
if (ctrl instanceof CloneableController) {
cloneC = new CloneController(ureq, getWindowControl(), (CloneableController) ctrl, clccc);
listenTo(cloneC);
main.setContent(cloneC.getInitialComponent());
} else {
throw new AssertException("Controller must be cloneable");
}
}
use of org.olat.core.gui.control.generic.iframe.DeliveryOptions in project OpenOLAT by OpenOLAT.
the class CompMenuForm 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) {
removeAsListenerAndDispose(searchController);
searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, ImsCPFileResource.TYPE_NAME, translate(NLS_COMMAND_CHOOSECP));
listenTo(searchController);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent(), true, translate(NLS_COMMAND_CREATECP));
listenTo(cmc);
cmc.activate();
} else if (source == previewLink) {
// Preview as modal dialogue only if the config is valid
RepositoryEntry re = getCPReference(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(NLS_ERROR_CPREPOENTRYMISSING);
} else {
File cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
Boolean showMenuB = config.getBooleanEntry(NodeEditController.CONFIG_COMPONENT_MENU);
// pre: showMenuB != null
removeAsListenerAndDispose(previewCtr);
DeliveryOptions previewOptions = deliveryOptionsCtrl.getOptionsForPreview();
previewCtr = CPUIFactory.getInstance().createMainLayoutPreviewController_v2(ureq, getWindowControl(), new LocalFolderImpl(cpRoot), showMenuB.booleanValue(), previewOptions);
stackPanel.pushController(translate("preview.cp"), previewCtr);
}
} else if (source == editLink) {
CourseNodeFactory.getInstance().launchReferencedRepoEntryEditor(ureq, getWindowControl(), cpNode);
}
}
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.control.Controller, org.olat.core.gui.control.Event)
*/
public void event(UserRequest urequest, Controller source, Event event) {
if (source == searchController) {
cmc.deactivate();
if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED) {
// search controller done
RepositoryEntry re = searchController.getSelectedEntry();
if (re != null) {
setScormCPReference(re, config);
cpConfigurationVc.contextPut("showPreviewButton", Boolean.TRUE);
String displayname = StringHelper.escapeHtml(re.getDisplayname());
previewLink = LinkFactory.createCustomLink("command.preview", "command.preview", displayname, Link.NONTRANSLATED, cpConfigurationVc, this);
previewLink.setIconLeftCSS("o_icon o_icon-fw o_icon_preview");
previewLink.setCustomEnabledLinkCSS("o_preview");
previewLink.setTitle(getTranslator().translate("command.preview"));
// fire event so the updated config is saved by the
// editormaincontroller
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
ScormPackageConfig scormConfig = ScormMainManager.getInstance().getScormPackageConfig(re.getOlatResource());
DeliveryOptions parentConfig = scormConfig == null ? null : scormConfig.getDeliveryOptions();
deliveryOptionsCtrl.setParentDeliveryOptions(parentConfig);
}
// else cancelled repo search
}
} else if (source == accessibilityCondContr) {
if (event == Event.CHANGED_EVENT) {
Condition cond = accessibilityCondContr.getCondition();
scormNode.setPreConditionAccess(cond);
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == scorevarform) {
if (event == Event.DONE_EVENT) {
// save form-values to config
config.setBooleanEntry(CONFIG_SHOWMENU, scorevarform.isShowMenu());
config.setBooleanEntry(CONFIG_SKIPLAUNCHPAGE, scorevarform.isSkipLaunchPage());
config.setBooleanEntry(CONFIG_SHOWNAVBUTTONS, scorevarform.isShowNavButtons());
config.setBooleanEntry(CONFIG_ISASSESSABLE, scorevarform.isAssessable());
config.setStringValue(CONFIG_ASSESSABLE_TYPE, scorevarform.getAssessableType());
config.setIntValue(CONFIG_CUTVALUE, scorevarform.getCutValue());
config.setBooleanEntry(CONFIG_FULLWINDOW, scorevarform.isFullWindow());
config.setBooleanEntry(CONFIG_CLOSE_ON_FINISH, scorevarform.isCloseOnFinish());
// <OLATCE-289>
config.setIntValue(CONFIG_MAXATTEMPTS, scorevarform.getAttemptsValue());
config.setBooleanEntry(CONFIG_ADVANCESCORE, scorevarform.isAdvanceScore());
config.setBooleanEntry(CONFIG_ATTEMPTSDEPENDONSCORE, scorevarform.getAttemptsDependOnScore());
// </OLATCE-289>
// fire event so the updated config is saved by the
// editormaincontroller
updateHighscoreTab();
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == deliveryOptionsCtrl) {
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
config.set(CONFIG_DELIVERY_OPTIONS, deliveryOptionsCtrl.getDeliveryOptions());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == highScoreNodeConfigController) {
if (event == Event.DONE_EVENT) {
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
}
}
use of org.olat.core.gui.control.generic.iframe.DeliveryOptions in project openolat by klemens.
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 klemens.
the class VarForm 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 urequest, Controller source, Event event) {
if (source == searchController) {
cmc.deactivate();
if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED) {
// search controller done
RepositoryEntry re = searchController.getSelectedEntry();
if (re != null) {
setScormCPReference(re, config);
cpConfigurationVc.contextPut("showPreviewButton", Boolean.TRUE);
String displayname = StringHelper.escapeHtml(re.getDisplayname());
previewLink = LinkFactory.createCustomLink("command.preview", "command.preview", displayname, Link.NONTRANSLATED, cpConfigurationVc, this);
previewLink.setIconLeftCSS("o_icon o_icon-fw o_icon_preview");
previewLink.setCustomEnabledLinkCSS("o_preview");
previewLink.setTitle(getTranslator().translate("command.preview"));
// fire event so the updated config is saved by the
// editormaincontroller
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
ScormPackageConfig scormConfig = ScormMainManager.getInstance().getScormPackageConfig(re.getOlatResource());
DeliveryOptions parentConfig = scormConfig == null ? null : scormConfig.getDeliveryOptions();
deliveryOptionsCtrl.setParentDeliveryOptions(parentConfig);
}
// else cancelled repo search
}
} else if (source == accessibilityCondContr) {
if (event == Event.CHANGED_EVENT) {
Condition cond = accessibilityCondContr.getCondition();
scormNode.setPreConditionAccess(cond);
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == scorevarform) {
if (event == Event.DONE_EVENT) {
// save form-values to config
config.setBooleanEntry(CONFIG_SHOWMENU, scorevarform.isShowMenu());
config.setBooleanEntry(CONFIG_SKIPLAUNCHPAGE, scorevarform.isSkipLaunchPage());
config.setBooleanEntry(CONFIG_SHOWNAVBUTTONS, scorevarform.isShowNavButtons());
config.setBooleanEntry(CONFIG_ISASSESSABLE, scorevarform.isAssessable());
config.setStringValue(CONFIG_ASSESSABLE_TYPE, scorevarform.getAssessableType());
config.setIntValue(CONFIG_CUTVALUE, scorevarform.getCutValue());
config.setBooleanEntry(CONFIG_FULLWINDOW, scorevarform.isFullWindow());
config.setBooleanEntry(CONFIG_CLOSE_ON_FINISH, scorevarform.isCloseOnFinish());
// <OLATCE-289>
config.setIntValue(CONFIG_MAXATTEMPTS, scorevarform.getAttemptsValue());
config.setBooleanEntry(CONFIG_ADVANCESCORE, scorevarform.isAdvanceScore());
config.setBooleanEntry(CONFIG_ATTEMPTSDEPENDONSCORE, scorevarform.getAttemptsDependOnScore());
// </OLATCE-289>
// fire event so the updated config is saved by the
// editormaincontroller
updateHighscoreTab();
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == deliveryOptionsCtrl) {
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
config.set(CONFIG_DELIVERY_OPTIONS, deliveryOptionsCtrl.getDeliveryOptions());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == highScoreNodeConfigController) {
if (event == Event.DONE_EVENT) {
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
}
}
Aggregations