Skip to content
Snippets Groups Projects
Commit 2fe4645c authored by srosse's avatar srosse
Browse files

OO-2786: add more visual informations to the publish wizard

parent b2dbc71f
No related branches found
No related tags found
No related merge requests found
Showing
with 81 additions and 69 deletions
...@@ -63,6 +63,8 @@ import org.olat.course.ICourse; ...@@ -63,6 +63,8 @@ import org.olat.course.ICourse;
import org.olat.course.Structure; import org.olat.course.Structure;
import org.olat.course.editor.PublishStepCatalog.CategoryLabel; import org.olat.course.editor.PublishStepCatalog.CategoryLabel;
import org.olat.course.nodes.CourseNode; import org.olat.course.nodes.CourseNode;
import org.olat.course.nodes.CourseNodeConfiguration;
import org.olat.course.nodes.CourseNodeFactory;
import org.olat.course.properties.CoursePropertyManager; import org.olat.course.properties.CoursePropertyManager;
import org.olat.course.run.RunMainController; import org.olat.course.run.RunMainController;
import org.olat.course.tree.CourseEditorTreeModel; import org.olat.course.tree.CourseEditorTreeModel;
...@@ -277,14 +279,12 @@ public class PublishProcess { ...@@ -277,14 +279,12 @@ public class PublishProcess {
// there are nodes generating cylces -> error! this is not a publishable // there are nodes generating cylces -> error! this is not a publishable
// set! // set!
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (Iterator<String> iter = nodesInCycle.iterator(); iter.hasNext();) { for (String id: nodesInCycle) {
String id = iter.next();
String title = editorTreeModel.getCourseEditorNodeById(id).getTitle(); String title = editorTreeModel.getCourseEditorNodeById(id).getTitle();
sb.append("<b>").append(title).append("</b>"); sb.append("<b>").append(title).append("</b> ").append("(id:").append(id).append(")<br>");
sb.append("(id:").append(id).append(")<br />");
} }
StatusDescription sd = new StatusDescription(ValidationStatus.ERROR, "pbl.error.cycles", "pbl.error.cycles", new String[] { sb StatusDescription sd = new StatusDescription(ValidationStatus.ERROR, "pbl.error.cycles", "pbl.error.cycles",
.toString() }, PACKAGE); new String[] { sb.toString() }, PACKAGE);
status = new StatusDescription[] { sd }; status = new StatusDescription[] { sd };
} else { } else {
/* /*
...@@ -650,45 +650,38 @@ public class PublishProcess { ...@@ -650,45 +650,38 @@ public class PublishProcess {
String assemblePublishConfirmation() { String assemblePublishConfirmation() {
List<String> nodeIdsToPublish = this.originalNodeIdsToPublish; List<String> nodeIdsToPublish = originalNodeIdsToPublish;
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
OLATResourceable courseRunOres = OresHelper.createOLATResourceableInstance(RunMainController.ORES_TYPE_COURSE_RUN, repositoryEntry.getOlatResource().getResourceableId()); OLATResourceable courseRunOres = OresHelper.createOLATResourceableInstance(RunMainController.ORES_TYPE_COURSE_RUN, repositoryEntry.getOlatResource().getResourceableId());
int cnt = CoordinatorManager.getInstance().getCoordinator().getEventBus().getListeningIdentityCntFor(courseRunOres) -1; // -1: Remove myself from list int cnt = CoordinatorManager.getInstance().getCoordinator().getEventBus().getListeningIdentityCntFor(courseRunOres) -1; // -1: Remove myself from list
if (cnt < 0 ) {
cnt = 0;// do not show any negative value
}
if (cnt > 0) { if (cnt > 0) {
msg.append(translate("pbl.confirm.users", String.valueOf(cnt))); msg.append(translate("pbl.confirm.users", String.valueOf(cnt)));
} else { } else {
msg.append(translator.translate("pbl.confirm")); msg.append(translator.translate("pbl.confirm"));
} }
msg.append("<ul>");
if(nodeIdsToPublish == null){
return msg.toString();
}
CourseEditorTreeModel cetm = course.getEditorTreeModel(); if(nodeIdsToPublish != null && nodeIdsToPublish.size() > 0) {
for (int i = 0; i < nodeIdsToPublish.size(); i++) { msg.append("<ul class='list-unstyled'>");
msg.append("<li>");
String nodeId = nodeIdsToPublish.get(i); CourseEditorTreeModel cetm = course.getEditorTreeModel();
CourseEditorTreeNode cetn = (CourseEditorTreeNode) cetm.getNodeById(nodeId); for (int i = 0; i < nodeIdsToPublish.size(); i++) {
CourseNode cn = cetm.getCourseNode(nodeId); msg.append("<li>");
msg.append(cn.getShortTitle()); String nodeId = nodeIdsToPublish.get(i);
if (cetn.isDeleted() && !cetn.isNewnode()) { CourseEditorTreeNode cetn = (CourseEditorTreeNode) cetm.getNodeById(nodeId);
//use locale of this initialized translator. CourseNode cn = cetm.getCourseNode(nodeId);
String onDeleteMessage = cn.informOnDelete(translator.getLocale(), course); if (cetn.isDeleted() && !cetn.isNewnode()) {
if (onDeleteMessage != null) { msg.append("<i class='o_icon o_icon_delete_item'> </i> ");
msg.append("<br /><font color=\"red\">"); } else {
msg.append(onDeleteMessage); CourseNodeConfiguration nodeConfig = CourseNodeFactory.getInstance().getCourseNodeConfigurationEvenForDisabledBB(cn.getType());
msg.append("</font>"); if(nodeConfig != null) {
msg.append("<i class='o_icon ").append(nodeConfig.getIconCSSClass()).append("'> </i> ");
}
} }
msg.append(cn.getShortTitle()).append("</li>");
} }
msg.append("</li>"); msg.append("</ul>");
} }
msg.append("</ul>");
return msg.toString(); return msg.toString();
} }
......
...@@ -190,7 +190,7 @@ class PublishStep00 extends BasicStep { ...@@ -190,7 +190,7 @@ class PublishStep00 extends BasicStep {
} }
} }
List<String> asList = new ArrayList<String>(selectedKeys); List<String> asList = new ArrayList<>(selectedKeys);
publishManager2.createPublishSetFor(asList); publishManager2.createPublishSetFor(asList);
addToRunContext("publishSetCreatedFor", selectedKeys); addToRunContext("publishSetCreatedFor", selectedKeys);
// //
...@@ -211,11 +211,11 @@ class PublishStep00 extends BasicStep { ...@@ -211,11 +211,11 @@ class PublishStep00 extends BasicStep {
// assemble warnings and errors // assemble warnings and errors
String generalErrorTxt = null; String generalErrorTxt = null;
String errorTxt = getTranslator().translate("publish.notpossible.setincomplete"); String errorTxt = getTranslator().translate("publish.notpossible.setincomplete");
String warningTxt = getTranslator().translate("publish.withwarnings"); String warningTxt = "";
String errors = "<ul>"; String errors = "<ul class='list-unstyled'>";
int errCnt = 0; int errCnt = 0;
String warnings = "<ul>"; String warnings = "<ul class='list-unstyled'>";
for (int i = 0; i < sds.length; i++) { for (int i = 0; i < sds.length; i++) {
StatusDescription description = sds[i]; StatusDescription description = sds[i];
String nodeId = sds[i].getDescriptionForUnit(); String nodeId = sds[i].getDescriptionForUnit();
...@@ -225,7 +225,7 @@ class PublishStep00 extends BasicStep { ...@@ -225,7 +225,7 @@ class PublishStep00 extends BasicStep {
break; break;
} }
String nodeName = publishProcess.getCourseEditorTreeModel().getCourseNode(nodeId).getShortName(); String nodeName = publishProcess.getCourseEditorTreeModel().getCourseNode(nodeId).getShortName();
String isFor = "<b>" + nodeName + "</b><br/>"; String isFor = "<h5>" + nodeName + "</h5>";
if (description.isError()) { if (description.isError()) {
errors += "<li>" + isFor + description.getShortDescription(getLocale()) + "</li>"; errors += "<li>" + isFor + description.getShortDescription(getLocale()) + "</li>";
errCnt++; errCnt++;
...@@ -236,8 +236,8 @@ class PublishStep00 extends BasicStep { ...@@ -236,8 +236,8 @@ class PublishStep00 extends BasicStep {
warnings += "</ul>"; warnings += "</ul>";
errors += "</ul>"; errors += "</ul>";
// //
errorTxt += "<p/>" + errors; errorTxt += errors;
warningTxt += "<p/>" + warnings; warningTxt += warnings;
if (generalErrorTxt != null) { if (generalErrorTxt != null) {
addToRunContext("STEP00.generalErrorText", generalErrorTxt); addToRunContext("STEP00.generalErrorText", generalErrorTxt);
......
...@@ -27,6 +27,7 @@ package org.olat.course.editor; ...@@ -27,6 +27,7 @@ package org.olat.course.editor;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.form.flexible.FormItemContainer; import org.olat.core.gui.components.form.flexible.FormItemContainer;
import org.olat.core.gui.components.form.flexible.impl.Form; import org.olat.core.gui.components.form.flexible.impl.Form;
import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer;
import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.wizard.BasicStep; import org.olat.core.gui.control.generic.wizard.BasicStep;
...@@ -72,7 +73,7 @@ class PublishStep00a extends BasicStep implements Step { ...@@ -72,7 +73,7 @@ class PublishStep00a extends BasicStep implements Step {
private static class PublishStep00aForm extends StepFormBasicController{ private static class PublishStep00aForm extends StepFormBasicController{
public PublishStep00aForm(UserRequest ureq, WindowControl control, Form rootForm, StepsRunContext runContext) { public PublishStep00aForm(UserRequest ureq, WindowControl control, Form rootForm, StepsRunContext runContext) {
super(ureq, control, rootForm, runContext, LAYOUT_VERTICAL, null); super(ureq, control, rootForm, runContext, LAYOUT_CUSTOM, "publish_warnings");
initForm(ureq); initForm(ureq);
} }
...@@ -88,14 +89,15 @@ class PublishStep00a extends BasicStep implements Step { ...@@ -88,14 +89,15 @@ class PublishStep00a extends BasicStep implements Step {
@Override @Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
formLayout.setElementCssClass("o_sel_publish_update"); if(formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer)formLayout;
if(containsRunContextKey("STEP00.warningMessage")) { if(containsRunContextKey("STEP00.warningMessage")) {
uifactory.addStaticTextElement("warnings", null,(String)getFromRunContext("STEP00.warningMessage"), formLayout); layoutCont.contextPut("hasWarnings", Boolean.TRUE);
} else { layoutCont.contextPut("warnings", getFromRunContext("STEP00.warningMessage"));
uifactory.addStaticTextElement("warnings", null, translate("publish.nowarnings"), formLayout); } else {
layoutCont.contextPut("hasWarnings", Boolean.FALSE);
}
} }
} }
} }
} }
\ No newline at end of file
...@@ -27,6 +27,7 @@ package org.olat.course.editor; ...@@ -27,6 +27,7 @@ package org.olat.course.editor;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.form.flexible.FormItemContainer; import org.olat.core.gui.components.form.flexible.FormItemContainer;
import org.olat.core.gui.components.form.flexible.impl.Form; import org.olat.core.gui.components.form.flexible.impl.Form;
import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer;
import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.wizard.BasicStep; import org.olat.core.gui.control.generic.wizard.BasicStep;
...@@ -85,7 +86,7 @@ class PublishStep00b extends BasicStep implements Step { ...@@ -85,7 +86,7 @@ class PublishStep00b extends BasicStep implements Step {
class PublishStep00bForm extends StepFormBasicController { class PublishStep00bForm extends StepFormBasicController {
public PublishStep00bForm(UserRequest ureq, WindowControl control, Form rootForm, StepsRunContext runContext) { public PublishStep00bForm(UserRequest ureq, WindowControl control, Form rootForm, StepsRunContext runContext) {
super(ureq, control, rootForm, runContext, LAYOUT_VERTICAL, null); super(ureq, control, rootForm, runContext, LAYOUT_CUSTOM, "publish_confirmation");
initForm(ureq); initForm(ureq);
} }
...@@ -104,7 +105,9 @@ class PublishStep00b extends BasicStep implements Step { ...@@ -104,7 +105,9 @@ class PublishStep00b extends BasicStep implements Step {
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
PublishProcess pp = (PublishProcess)getFromRunContext("publishProcess"); PublishProcess pp = (PublishProcess)getFromRunContext("publishProcess");
String confirmMsg= pp.assemblePublishConfirmation(); String confirmMsg= pp.assemblePublishConfirmation();
uifactory.addStaticTextElement("message", null, confirmMsg, formLayout);//null > no label if(formLayout instanceof FormLayoutContainer) {
((FormLayoutContainer)formLayout).contextPut("message", confirmMsg);
}
} }
} }
......
...@@ -293,13 +293,13 @@ public class PublishStep01AccessForm extends StepFormBasicController { ...@@ -293,13 +293,13 @@ public class PublishStep01AccessForm extends StepFormBasicController {
if(editable) { if(editable) {
List<AccessMethod> methods = acService.getAvailableMethods(getIdentity(), ureq.getUserSession().getRoles()); List<AccessMethod> methods = acService.getAvailableMethods(getIdentity(), ureq.getUserSession().getRoles());
for(AccessMethod method:methods) { for(AccessMethod method:methods) {
AccessMethodHandler handler = acModule.getAccessMethodHandler(method.getType()); AccessMethodHandler methodHandler = acModule.getAccessMethodHandler(method.getType());
if(handler.isPaymentMethod() && !allowPaymentMethod) { if(methodHandler.isPaymentMethod() && !allowPaymentMethod) {
continue; continue;
} }
String title = handler.getMethodName(getLocale()); String title = methodHandler.getMethodName(getLocale());
FormLink add = uifactory.addFormLink("create." + handler.getType(), title, null, accessLayout, Link.LINK | Link.NONTRANSLATED); FormLink add = uifactory.addFormLink("create." + methodHandler.getType(), title, null, accessLayout, Link.LINK | Link.NONTRANSLATED);
add.setUserObject(method); add.setUserObject(method);
add.setIconLeftCSS( ("o_icon " + method.getMethodCssClass() + "_icon o_icon-lg").intern()); add.setIconLeftCSS( ("o_icon " + method.getMethodCssClass() + "_icon o_icon-lg").intern());
addMethods.add(add); addMethods.add(add);
...@@ -324,8 +324,8 @@ public class PublishStep01AccessForm extends StepFormBasicController { ...@@ -324,8 +324,8 @@ public class PublishStep01AccessForm extends StepFormBasicController {
protected void loadConfigurations() { protected void loadConfigurations() {
List<Offer> offers = acService.findOfferByResource(resource, true, null); List<Offer> offers = acService.findOfferByResource(resource, true, null);
for(Offer offer:offers) { for(Offer offer:offers) {
List<OfferAccess> offerAccess = acService.getOfferAccess(offer, true); List<OfferAccess> offerAccessList = acService.getOfferAccess(offer, true);
for(OfferAccess access:offerAccess) { for(OfferAccess access:offerAccessList) {
button_id++; button_id++;
addConfiguration(access); addConfiguration(access);
} }
...@@ -333,8 +333,8 @@ public class PublishStep01AccessForm extends StepFormBasicController { ...@@ -333,8 +333,8 @@ public class PublishStep01AccessForm extends StepFormBasicController {
} }
protected void addConfiguration(OfferAccess link) { protected void addConfiguration(OfferAccess link) {
AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType()); AccessMethodHandler methodHandler = acModule.getAccessMethodHandler(link.getMethod().getType());
AccessInfo infos = new AccessInfo(handler.getMethodName(getLocale()), handler.isPaymentMethod(), null, link); AccessInfo infos = new AccessInfo(methodHandler.getMethodName(getLocale()), methodHandler.isPaymentMethod(), null, link);
infos.setButtonId(button_id); infos.setButtonId(button_id);
confControllers.add(infos); confControllers.add(infos);
...@@ -600,15 +600,15 @@ public class PublishStep01AccessForm extends StepFormBasicController { ...@@ -600,15 +600,15 @@ public class PublishStep01AccessForm extends StepFormBasicController {
OfferAccess link = infos.getLink(); OfferAccess link = infos.getLink();
removeAsListenerAndDispose(editMethodCtrl); removeAsListenerAndDispose(editMethodCtrl);
AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType()); AccessMethodHandler methodHandler = acModule.getAccessMethodHandler(link.getMethod().getType());
if (handler != null) { if (methodHandler != null) {
editMethodCtrl = handler.editConfigurationController(ureq, getWindowControl(), link); editMethodCtrl = methodHandler.editConfigurationController(ureq, getWindowControl(), link);
} }
if(editMethodCtrl != null) { if(editMethodCtrl != null) {
listenTo(editMethodCtrl); listenTo(editMethodCtrl);
String title = handler.getMethodName(getLocale()); String title = methodHandler.getMethodName(getLocale());
cmc = new CloseableModalController(getWindowControl(), translate("close"), editMethodCtrl.getInitialComponent(), true, title); cmc = new CloseableModalController(getWindowControl(), translate("close"), editMethodCtrl.getInitialComponent(), true, title);
cmc.activate(); cmc.activate();
listenTo(cmc); listenTo(cmc);
...@@ -620,14 +620,14 @@ public class PublishStep01AccessForm extends StepFormBasicController { ...@@ -620,14 +620,14 @@ public class PublishStep01AccessForm extends StepFormBasicController {
OfferAccess link = acService.createOfferAccess(offer, method); OfferAccess link = acService.createOfferAccess(offer, method);
removeAsListenerAndDispose(newMethodCtrl); removeAsListenerAndDispose(newMethodCtrl);
AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType()); AccessMethodHandler methodHandler = acModule.getAccessMethodHandler(link.getMethod().getType());
if (handler != null) { if (methodHandler != null) {
newMethodCtrl = handler.createConfigurationController(ureq, getWindowControl(), link); newMethodCtrl = methodHandler.createConfigurationController(ureq, getWindowControl(), link);
} }
if(newMethodCtrl != null) { if(newMethodCtrl != null) {
listenTo(newMethodCtrl); listenTo(newMethodCtrl);
String title = handler.getMethodName(getLocale()); String title = methodHandler.getMethodName(getLocale());
cmc = new CloseableModalController(getWindowControl(), translate("close"), newMethodCtrl.getInitialComponent(), true, title); cmc = new CloseableModalController(getWindowControl(), translate("close"), newMethodCtrl.getInitialComponent(), true, title);
cmc.activate(); cmc.activate();
listenTo(cmc); listenTo(cmc);
......
## step PublishStepp00b
<div class="o_sel_publish_confirmation">
<h4>$r.translate("publish.step.title.confirm")</h4>
<div class="o_info">$message</div>
</div>
\ No newline at end of file
## step PublishStepp00a
<div class="o_sel_publish_warnings">
#if($r.isTrue($hasWarnings))
<h4>$r.translate("publish.withwarnings")</h4>
<div class="o_warning">$warnings</div>
#else
<div class="o_info">$r.translate("publish.nowarnings")</div>
#end
</div>
\ No newline at end of file
...@@ -515,7 +515,8 @@ public class CourseEditorPageFragment { ...@@ -515,7 +515,8 @@ public class CourseEditorPageFragment {
//back //back
By breadcrumpBackBy = By.cssSelector("#o_main_toolbar li.o_breadcrumb_back a"); By breadcrumpBackBy = By.cssSelector("#o_main_toolbar li.o_breadcrumb_back a");
browser.findElement(breadcrumpBackBy).click(); browser.findElement(breadcrumpBackBy).click();
OOGraphene.waitBusy(browser); OOGraphene.waitBusyAndScrollTop(browser);
OOGraphene.waitModalDialog(browser);
//auto publish //auto publish
By autoPublishBy = By.cssSelector("div.modal a.o_sel_course_quickpublish_auto"); By autoPublishBy = By.cssSelector("div.modal a.o_sel_course_quickpublish_auto");
...@@ -533,7 +534,7 @@ public class CourseEditorPageFragment { ...@@ -533,7 +534,7 @@ public class CourseEditorPageFragment {
WebElement publishButton = browser.findElement(publishButtonBy); WebElement publishButton = browser.findElement(publishButtonBy);
Assert.assertTrue(publishButton.isDisplayed()); Assert.assertTrue(publishButton.isDisplayed());
publishButton.click(); publishButton.click();
OOGraphene.waitBusy(browser); OOGraphene.waitBusyAndScrollTop(browser);
OOGraphene.waitElement(By.cssSelector("div.o_sel_publish_nodes"), 5, browser); OOGraphene.waitElement(By.cssSelector("div.o_sel_publish_nodes"), 5, browser);
return new PublisherPageFragment(browser); return new PublisherPageFragment(browser);
} }
......
...@@ -86,7 +86,7 @@ public class PublisherPageFragment { ...@@ -86,7 +86,7 @@ public class PublisherPageFragment {
public PublisherPageFragment nextCatalog() { public PublisherPageFragment nextCatalog() {
OOGraphene.nextStep(browser); OOGraphene.nextStep(browser);
OOGraphene.waitElement(By.cssSelector("fieldset.o_sel_publish_update"), 5, browser); OOGraphene.waitElement(By.cssSelector("div.o_sel_publish_warnings"), 5, browser);
return this; return this;
} }
......
...@@ -49,7 +49,6 @@ public class OOGraphene { ...@@ -49,7 +49,6 @@ public class OOGraphene {
private static final long defaultTimeout = 5;//seconds private static final long defaultTimeout = 5;//seconds
private static final By closeBlueBoxButtonBy = By.cssSelector("div.o_alert_info div.o_sel_info_message a.o_alert_close.o_sel_info_close"); private static final By closeBlueBoxButtonBy = By.cssSelector("div.o_alert_info div.o_sel_info_message a.o_alert_close.o_sel_info_close");
//private static final By closeBlueBoxButtonBy = By.cssSelector("div.o_alert_info div.o_sel_info_message a.o_alert_close.o_sel_info_close i.o_icon_close");
private static final By closeModalDialogButtonBy = By.cssSelector("div.modal-dialog div.modal-header button.close"); private static final By closeModalDialogButtonBy = By.cssSelector("div.modal-dialog div.modal-header button.close");
public static final By wizardNextBy = By.xpath("//div[contains(@class,'modal-footer')]//a[contains(@class,'o_wizard_button_next')]"); public static final By wizardNextBy = By.xpath("//div[contains(@class,'modal-footer')]//a[contains(@class,'o_wizard_button_next')]");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment