diff --git a/src/main/java/org/olat/course/nodes/portfolio/PortfolioConfigForm.java b/src/main/java/org/olat/course/nodes/portfolio/PortfolioConfigForm.java index 02089abb961d767e4cadab334524f0de7810319d..7a63ccbc2639abf69a3686f08092b007ec135ca1 100644 --- a/src/main/java/org/olat/course/nodes/portfolio/PortfolioConfigForm.java +++ b/src/main/java/org/olat/course/nodes/portfolio/PortfolioConfigForm.java @@ -45,6 +45,7 @@ import org.olat.course.nodes.CourseNodeFactory; import org.olat.course.nodes.PortfolioCourseNode; import org.olat.modules.ModuleConfiguration; import org.olat.modules.portfolio.Binder; +import org.olat.modules.portfolio.BinderConfiguration; import org.olat.modules.portfolio.BinderSecurityCallback; import org.olat.modules.portfolio.BinderSecurityCallbackFactory; import org.olat.modules.portfolio.PortfolioService; @@ -251,7 +252,8 @@ public class PortfolioConfigForm extends FormBasicController { previewCtr = EPUIFactory.createPortfolioStructureMapPreviewController(ureq, getWindowControl(), map, secCallback); } else if(binder != null && stackPanel instanceof TooledStackedPanel) { BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getReadOnlyCallback(); - previewCtr = new BinderController(ureq, getWindowControl(), (TooledStackedPanel)stackPanel, secCallback, binder); + BinderConfiguration bConfig = BinderConfiguration.createTemplateConfig(); + previewCtr = new BinderController(ureq, getWindowControl(), (TooledStackedPanel)stackPanel, secCallback, binder, bConfig); } else { return; } diff --git a/src/main/java/org/olat/course/nodes/portfolio/PortfolioResultDetailsController.java b/src/main/java/org/olat/course/nodes/portfolio/PortfolioResultDetailsController.java index d5b9763ac1818e505431893bdb3dbef95487c805..224f993c49809ab1802ba626831bf9f1bd56b3fb 100644 --- a/src/main/java/org/olat/course/nodes/portfolio/PortfolioResultDetailsController.java +++ b/src/main/java/org/olat/course/nodes/portfolio/PortfolioResultDetailsController.java @@ -50,6 +50,7 @@ import org.olat.course.CourseModule; import org.olat.course.nodes.PortfolioCourseNode; import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.modules.portfolio.Binder; +import org.olat.modules.portfolio.BinderConfiguration; import org.olat.modules.portfolio.BinderSecurityCallback; import org.olat.modules.portfolio.BinderSecurityCallbackFactory; import org.olat.modules.portfolio.PortfolioService; @@ -292,7 +293,8 @@ public class PortfolioResultDetailsController extends FormBasicController { if(stackPanel instanceof TooledStackedPanel) { List<AccessRights> rights = portfolioService.getAccessRights(binder, getIdentity()); BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForCoach(binder, rights); - BinderController binderCtrl = new BinderController(ureq, getWindowControl(), (TooledStackedPanel)stackPanel, secCallback, binder); + BinderConfiguration config = BinderConfiguration.createConfig(binder); + BinderController binderCtrl = new BinderController(ureq, getWindowControl(), (TooledStackedPanel)stackPanel, secCallback, binder, config); String displayName = StringHelper.escapeHtml(binder.getTitle()); stackPanel.pushController(displayName, binderCtrl); binderCtrl.activate(ureq, null, null); diff --git a/src/main/java/org/olat/modules/portfolio/BinderConfiguration.java b/src/main/java/org/olat/modules/portfolio/BinderConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..b696827c258e2292dfb432a9f3fcbfa3cdf2f070 --- /dev/null +++ b/src/main/java/org/olat/modules/portfolio/BinderConfiguration.java @@ -0,0 +1,84 @@ +package org.olat.modules.portfolio; + +import org.olat.course.CourseFactory; +import org.olat.course.ICourse; +import org.olat.course.nodes.CourseNode; +import org.olat.course.nodes.PortfolioCourseNode; +import org.olat.repository.RepositoryEntry; + +/** + * + * Initial date: 24.06.2016<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class BinderConfiguration { + + private final boolean withScore; + private final boolean withPassed; + private final boolean assessable; + + public BinderConfiguration(boolean assessable, boolean withScore, boolean withPassed) { + this.assessable = assessable; + this.withScore = withScore; + this.withPassed = withPassed; + } + + public boolean isAssessable() { + return assessable; + } + + public boolean isWithScore() { + return withScore; + } + + public boolean isWithPassed() { + return withPassed; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("binderconfig[assessable=").append(assessable).append(";") + .append("withScore=").append(withScore).append(";") + .append("withPassed=").append(withPassed).append("]"); + return sb.toString() + super.toString(); + } + + public static BinderConfiguration createTemplateConfig() { + return new BinderConfiguration(false, false, false); + } + + public static BinderConfiguration createMyPagesConfig() { + return new BinderConfiguration(false, false, false); + } + + public static BinderConfiguration createConfig(Binder binder) { + boolean withScore = false; + boolean withPassed = false; + boolean assessable = false; + + RepositoryEntry entry = binder.getEntry(); + if(binder.getSubIdent() != null) { + ICourse course = CourseFactory.loadCourse(entry); + CourseNode courseNode = course.getRunStructure().getNode(binder.getSubIdent()); + if(courseNode instanceof PortfolioCourseNode) { + PortfolioCourseNode pfNode = (PortfolioCourseNode)courseNode; + withScore = pfNode.hasScoreConfigured(); + withPassed = pfNode.hasPassedConfigured(); + assessable = withPassed || withScore; + } else { + withPassed = true; + withScore = false; + assessable = true; + } + } else if(entry != null) { + withPassed = true; + withScore = false; + assessable = true; + } else { + withPassed = withScore = assessable = false; + } + return new BinderConfiguration(assessable, withScore, withPassed); + } +} diff --git a/src/main/java/org/olat/modules/portfolio/BinderSecurityCallback.java b/src/main/java/org/olat/modules/portfolio/BinderSecurityCallback.java index c3421cd5548ab9031b5b6c31fd17469ec67ae68e..f584616ebd3bb75d1a22cb82bef700ffdb0bb7a7 100644 --- a/src/main/java/org/olat/modules/portfolio/BinderSecurityCallback.java +++ b/src/main/java/org/olat/modules/portfolio/BinderSecurityCallback.java @@ -57,8 +57,6 @@ public interface BinderSecurityCallback { public boolean canReview(PortfolioElement element); - public boolean canBinderAssessment(); - public boolean canAssess(Section section); diff --git a/src/main/java/org/olat/modules/portfolio/BinderSecurityCallbackFactory.java b/src/main/java/org/olat/modules/portfolio/BinderSecurityCallbackFactory.java index d50b4d34c2016c3b42fa6ff5bae9b926068750ee..d941e5cdd6ff3388563c0db58e94429de98c0b55 100644 --- a/src/main/java/org/olat/modules/portfolio/BinderSecurityCallbackFactory.java +++ b/src/main/java/org/olat/modules/portfolio/BinderSecurityCallbackFactory.java @@ -111,11 +111,6 @@ public class BinderSecurityCallbackFactory { return false; } - @Override - public boolean canBinderAssessment() { - return false; - } - @Override public boolean canAssess(Section section) { return false; @@ -231,10 +226,5 @@ public class BinderSecurityCallbackFactory { } return false; } - - @Override - public boolean canBinderAssessment() { - return hasEntry; - } } } \ No newline at end of file diff --git a/src/main/java/org/olat/modules/portfolio/handler/BinderTemplateHandler.java b/src/main/java/org/olat/modules/portfolio/handler/BinderTemplateHandler.java index 88b261bf4edd96ea920afc0f824b396cbacaeba2..f9f32609bec7a989381d658c16d329b342c76256 100644 --- a/src/main/java/org/olat/modules/portfolio/handler/BinderTemplateHandler.java +++ b/src/main/java/org/olat/modules/portfolio/handler/BinderTemplateHandler.java @@ -43,6 +43,7 @@ import org.olat.course.assessment.manager.UserCourseInformationsManager; import org.olat.fileresource.FileResourceManager; import org.olat.fileresource.types.ResourceEvaluation; import org.olat.modules.portfolio.Binder; +import org.olat.modules.portfolio.BinderConfiguration; import org.olat.modules.portfolio.BinderSecurityCallback; import org.olat.modules.portfolio.BinderSecurityCallbackFactory; import org.olat.modules.portfolio.PortfolioService; @@ -163,8 +164,9 @@ public class BinderTemplateHandler implements RepositoryHandler { Binder binder = portfolioService.getBinderByResource(entry.getOlatResource()); CoreSpringFactory.getImpl(UserCourseInformationsManager.class) .updateUserCourseInformations(entry.getOlatResource(), uureq.getIdentity()); + BinderConfiguration bConfig = BinderConfiguration.createTemplateConfig(); BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForTemplate(reSecurity); - return new BinderController(uureq, wwControl, toolbarPanel, secCallback, binder); + return new BinderController(uureq, wwControl, toolbarPanel, secCallback, binder, bConfig); } }); } diff --git a/src/main/java/org/olat/modules/portfolio/model/PageRow.java b/src/main/java/org/olat/modules/portfolio/model/PageRow.java index a33a06c6455559ac66f899bd099704fa35b6d70b..e8189febdb60783101d0673cc79f5a801be6540b 100644 --- a/src/main/java/org/olat/modules/portfolio/model/PageRow.java +++ b/src/main/java/org/olat/modules/portfolio/model/PageRow.java @@ -40,6 +40,7 @@ public class PageRow { private final Page page; private final Section section; + private final boolean assessable; private boolean firstPageOfSection; private final AssessmentSection assessmentSection; @@ -47,9 +48,11 @@ public class PageRow { private FormLink openFormLink; private FormLink newEntryLink; - public PageRow(Page page, Section section, AssessmentSection assessmentSection, boolean firstPageOfSection) { + public PageRow(Page page, Section section, AssessmentSection assessmentSection, + boolean firstPageOfSection, boolean assessable) { this.page = page; this.section = section; + this.assessable = assessable; this.assessmentSection = assessmentSection; this.firstPageOfSection = firstPageOfSection; } @@ -130,8 +133,12 @@ public class PageRow { this.firstPageOfSection = firstPageOfSection; } + public boolean isAssessable() { + return assessable; + } + public boolean hasScore() { - return assessmentSection != null && assessmentSection.getScore() != null; + return assessable && assessmentSection != null && assessmentSection.getScore() != null; } public String getScore() { diff --git a/src/main/java/org/olat/modules/portfolio/ui/AbstractPageListController.java b/src/main/java/org/olat/modules/portfolio/ui/AbstractPageListController.java index 0e2f7e73e7e248e8518857742b9447b7c07bf806..a3e84b8c73a390445b9bbe7e5e09a3102a7b0247 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/AbstractPageListController.java +++ b/src/main/java/org/olat/modules/portfolio/ui/AbstractPageListController.java @@ -48,6 +48,7 @@ import org.olat.core.id.context.ContextEntry; import org.olat.core.id.context.StateEntry; import org.olat.core.util.StringHelper; import org.olat.modules.portfolio.AssessmentSection; +import org.olat.modules.portfolio.BinderConfiguration; import org.olat.modules.portfolio.BinderSecurityCallback; import org.olat.modules.portfolio.Page; import org.olat.modules.portfolio.PortfolioService; @@ -75,14 +76,16 @@ implements Activateable2, TooledController, FlexiTableComponentDelegate { protected int counter; protected final boolean withSections; + protected final BinderConfiguration config; protected final BinderSecurityCallback secCallback; @Autowired protected PortfolioService portfolioService; public AbstractPageListController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, - BinderSecurityCallback secCallback, String vTemplate, boolean withSections) { + BinderSecurityCallback secCallback, BinderConfiguration config, String vTemplate, boolean withSections) { super(ureq, wControl, vTemplate); + this.config = config; this.stackPanel = stackPanel; this.secCallback = secCallback; this.withSections = withSections; @@ -131,7 +134,7 @@ implements Activateable2, TooledController, FlexiTableComponentDelegate { protected abstract void loadModel(); protected PageRow forgeRow(Page page, AssessmentSection assessmentSection, boolean firstOfSection) { - PageRow row = new PageRow(page, page.getSection(), assessmentSection, firstOfSection); + PageRow row = new PageRow(page, page.getSection(), assessmentSection, firstOfSection, config.isAssessable()); String openLinkId = "open_" + (++counter); FormLink openLink = uifactory.addFormLink(openLinkId, "open.full", "open.full.page", null, flc, Link.BUTTON_SMALL); openLink.setIconRightCSS("o_icon o_icon_start"); @@ -142,7 +145,7 @@ implements Activateable2, TooledController, FlexiTableComponentDelegate { } protected PageRow forgeRow(Section section, AssessmentSection assessmentSection, boolean firstOfSection) { - PageRow row = new PageRow(null, section, assessmentSection, firstOfSection); + PageRow row = new PageRow(null, section, assessmentSection, firstOfSection, config.isAssessable()); String openLinkId = "open_" + (++counter); FormLink openLink = uifactory.addFormLink(openLinkId, "open.full", "open.full.page", null, flc, Link.BUTTON_SMALL); openLink.setIconRightCSS("o_icon o_icon_start"); diff --git a/src/main/java/org/olat/modules/portfolio/ui/BinderAssessmentController.java b/src/main/java/org/olat/modules/portfolio/ui/BinderAssessmentController.java index 4eb6471527a6b799589abbf37be1ae4640fea7a9..26bdfecc2f7c13b94441e74d3a8f016803c83c69 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/BinderAssessmentController.java +++ b/src/main/java/org/olat/modules/portfolio/ui/BinderAssessmentController.java @@ -47,6 +47,7 @@ import org.olat.course.assessment.AssessmentHelper; import org.olat.modules.assessment.ui.ScoreCellRenderer; import org.olat.modules.portfolio.AssessmentSection; import org.olat.modules.portfolio.Binder; +import org.olat.modules.portfolio.BinderConfiguration; import org.olat.modules.portfolio.BinderSecurityCallback; import org.olat.modules.portfolio.Page; import org.olat.modules.portfolio.PortfolioRoles; @@ -76,19 +77,19 @@ public class BinderAssessmentController extends FormBasicController { private FlexiTableElement tableEl; private BinderAssessmentDataModel model; - private final boolean withScore, withPassed; + private boolean withScore; + private boolean withPassed; @Autowired private PortfolioService portfolioService; public BinderAssessmentController(UserRequest ureq, WindowControl wControl, - BinderSecurityCallback secCallback, Binder binder) { + BinderSecurityCallback secCallback, Binder binder, BinderConfiguration config) { super(ureq, wControl, "section_assessment"); this.binder = binder; this.secCallback = secCallback; - this.withPassed = true; - this.withScore = true; - + this.withPassed = config.isWithPassed(); + this.withScore = config.isWithScore(); initForm(ureq); loadModel(); } @@ -98,11 +99,14 @@ public class BinderAssessmentController extends FormBasicController { FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel(); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(AssessmentSectionCols.sectionName)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(AssessmentSectionCols.numOfPages)); - columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(AssessmentSectionCols.passed, new PassedCellRenderer())); - columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(AssessmentSectionCols.score, new ScoreCellRenderer())); + if(withPassed) { + columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(AssessmentSectionCols.passed, new PassedCellRenderer())); + } + if(withScore) { + columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(AssessmentSectionCols.score, new ScoreCellRenderer())); + } columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(AssessmentSectionCols.changeStatus)); - model = new BinderAssessmentDataModel(columnsModel); tableEl = uifactory.addTableElement(getWindowControl(), "section-list", model, getTranslator(), formLayout); tableEl.setCustomizeColumns(true); diff --git a/src/main/java/org/olat/modules/portfolio/ui/BinderController.java b/src/main/java/org/olat/modules/portfolio/ui/BinderController.java index e38c82b92c129d44592dd18ccfd305842c68a126..3a2966b558c55468731d57318ac148f9b5f55091 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/BinderController.java +++ b/src/main/java/org/olat/modules/portfolio/ui/BinderController.java @@ -25,7 +25,7 @@ import org.olat.core.gui.UserRequest; import org.olat.core.gui.components.Component; import org.olat.core.gui.components.link.Link; import org.olat.core.gui.components.link.LinkFactory; -import org.olat.core.gui.components.panel.Panel; +import org.olat.core.gui.components.panel.SimpleStackedPanel; import org.olat.core.gui.components.stack.ButtonGroupComponent; import org.olat.core.gui.components.stack.PopEvent; import org.olat.core.gui.components.stack.TooledController; @@ -39,6 +39,7 @@ import org.olat.core.gui.control.generic.dtabs.Activateable2; import org.olat.core.id.context.ContextEntry; import org.olat.core.id.context.StateEntry; import org.olat.modules.portfolio.Binder; +import org.olat.modules.portfolio.BinderConfiguration; import org.olat.modules.portfolio.BinderSecurityCallback; /** @@ -61,12 +62,14 @@ public class BinderController extends BasicController implements TooledControlle private BinderAssessmentController assessmentCtrl; private Binder binder; + private final BinderConfiguration config; private final BinderSecurityCallback secCallback; public BinderController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, - BinderSecurityCallback secCallback, Binder binder) { + BinderSecurityCallback secCallback, Binder binder, BinderConfiguration config) { super(ureq, wControl); this.binder = binder; + this.config = config; this.stackPanel = stackPanel; this.secCallback = secCallback; @@ -77,13 +80,13 @@ public class BinderController extends BasicController implements TooledControlle segmentButtonsCmp.addButton(entriesLink, false); publishLink = LinkFactory.createLink("portfolio.publish", getTranslator(), this); segmentButtonsCmp.addButton(publishLink, false); - if(binder.getEntry() != null) { + if(config.isAssessable()) { assessmentLink = LinkFactory.createLink("portfolio.assessment", getTranslator(), this); segmentButtonsCmp.addButton(assessmentLink, false); } stackPanel.addListener(this); - putInitialPanel(new Panel("portfolioSegments")); + putInitialPanel(new SimpleStackedPanel("portfolioSegments")); } @Override @@ -139,7 +142,7 @@ public class BinderController extends BasicController implements TooledControlle } private void doOpenEntries(UserRequest ureq) { - entriesCtrl = new BinderPageListController(ureq, getWindowControl(), stackPanel, secCallback, binder); + entriesCtrl = new BinderPageListController(ureq, getWindowControl(), stackPanel, secCallback, binder, config); listenTo(entriesCtrl); stackPanel.popUpToController(this); @@ -148,7 +151,7 @@ public class BinderController extends BasicController implements TooledControlle } private void doOpenOverview(UserRequest ureq) { - overviewCtrl = new TableOfContentController(ureq, getWindowControl(), stackPanel, secCallback, binder); + overviewCtrl = new TableOfContentController(ureq, getWindowControl(), stackPanel, secCallback, binder, config); listenTo(overviewCtrl); stackPanel.popUpToController(this); @@ -157,7 +160,7 @@ public class BinderController extends BasicController implements TooledControlle } private void doOpenPublish(UserRequest ureq) { - publishCtrl = new PublishController(ureq, getWindowControl(), stackPanel, secCallback, binder); + publishCtrl = new PublishController(ureq, getWindowControl(), stackPanel, secCallback, binder, config); listenTo(publishCtrl); stackPanel.popUpToController(this); @@ -166,7 +169,7 @@ public class BinderController extends BasicController implements TooledControlle } private void doOpenAssessment(UserRequest ureq) { - assessmentCtrl = new BinderAssessmentController(ureq, getWindowControl(), secCallback, binder); + assessmentCtrl = new BinderAssessmentController(ureq, getWindowControl(), secCallback, binder, config); listenTo(assessmentCtrl); stackPanel.popUpToController(this); diff --git a/src/main/java/org/olat/modules/portfolio/ui/BinderListController.java b/src/main/java/org/olat/modules/portfolio/ui/BinderListController.java index 7445d6cd217fcc9e15f7ab466bd6b2d707d3b0b4..e3348a9df930fa201f1b6e8ed8ef5e5c977788c8 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/BinderListController.java +++ b/src/main/java/org/olat/modules/portfolio/ui/BinderListController.java @@ -64,6 +64,7 @@ import org.olat.core.util.resource.OresHelper; import org.olat.core.util.vfs.VFSLeaf; import org.olat.core.util.vfs.VFSMediaResource; import org.olat.modules.portfolio.Binder; +import org.olat.modules.portfolio.BinderConfiguration; import org.olat.modules.portfolio.BinderRef; import org.olat.modules.portfolio.BinderSecurityCallback; import org.olat.modules.portfolio.BinderSecurityCallbackFactory; @@ -303,7 +304,8 @@ public class BinderListController extends FormBasicController OLATResourceable binderOres = OresHelper.createOLATResourceableInstance("Binder", binder.getKey()); WindowControl swControl = addToHistory(ureq, binderOres, null); BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForOwnedBinder(binder); - binderCtrl = new BinderController(ureq, swControl, stackPanel, secCallback, binder); + BinderConfiguration config = BinderConfiguration.createConfig(binder); + binderCtrl = new BinderController(ureq, swControl, stackPanel, secCallback, binder, config); String displayName = StringHelper.escapeHtml(binder.getTitle()); stackPanel.pushController(displayName, binderCtrl); return binderCtrl; diff --git a/src/main/java/org/olat/modules/portfolio/ui/BinderPageListController.java b/src/main/java/org/olat/modules/portfolio/ui/BinderPageListController.java index 9675b93a9b877fba38922521887061dc05929507..31090bcf14310e5a20b1d874fb3fa7a4e3e2a06f 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/BinderPageListController.java +++ b/src/main/java/org/olat/modules/portfolio/ui/BinderPageListController.java @@ -42,6 +42,7 @@ import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController; import org.olat.modules.portfolio.AssessmentSection; import org.olat.modules.portfolio.Binder; +import org.olat.modules.portfolio.BinderConfiguration; import org.olat.modules.portfolio.BinderSecurityCallback; import org.olat.modules.portfolio.Page; import org.olat.modules.portfolio.Section; @@ -64,8 +65,8 @@ public class BinderPageListController extends AbstractPageListController { private final Binder binder; public BinderPageListController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, - BinderSecurityCallback secCallback, Binder binder) { - super(ureq, wControl, stackPanel, secCallback, "pages", true); + BinderSecurityCallback secCallback, Binder binder, BinderConfiguration config) { + super(ureq, wControl, stackPanel, secCallback, config, "pages", true); this.binder = binder; initForm(ureq); diff --git a/src/main/java/org/olat/modules/portfolio/ui/MyPageListController.java b/src/main/java/org/olat/modules/portfolio/ui/MyPageListController.java index 24706e5a266a672c6b11bfb7ca71fded27777770..94f708d8876ed4ac9ad3b00722cc43ce3b7ec828 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/MyPageListController.java +++ b/src/main/java/org/olat/modules/portfolio/ui/MyPageListController.java @@ -32,6 +32,7 @@ import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController; +import org.olat.modules.portfolio.BinderConfiguration; import org.olat.modules.portfolio.BinderSecurityCallback; import org.olat.modules.portfolio.Page; import org.olat.modules.portfolio.model.PageRow; @@ -51,7 +52,7 @@ public class MyPageListController extends AbstractPageListController { public MyPageListController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, BinderSecurityCallback secCallback) { - super(ureq, wControl, stackPanel, secCallback, "pages", false); + super(ureq, wControl, stackPanel, secCallback, BinderConfiguration.createMyPagesConfig(), "pages", false); initForm(ureq); loadModel(); diff --git a/src/main/java/org/olat/modules/portfolio/ui/MySharedItemsController.java b/src/main/java/org/olat/modules/portfolio/ui/MySharedItemsController.java index c010018c2578f00609097124d5681b14dd938e0e..97f646fe08581cef4b1f0daba685a4ce5dc586de 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/MySharedItemsController.java +++ b/src/main/java/org/olat/modules/portfolio/ui/MySharedItemsController.java @@ -42,6 +42,7 @@ import org.olat.core.id.context.StateEntry; import org.olat.core.util.StringHelper; import org.olat.core.util.resource.OresHelper; import org.olat.modules.portfolio.Binder; +import org.olat.modules.portfolio.BinderConfiguration; import org.olat.modules.portfolio.BinderSecurityCallback; import org.olat.modules.portfolio.BinderSecurityCallbackFactory; import org.olat.modules.portfolio.PortfolioService; @@ -157,7 +158,8 @@ public class MySharedItemsController extends FormBasicController implements Acti OLATResourceable binderOres = OresHelper.createOLATResourceableInstance("Binder", binder.getKey()); WindowControl swControl = addToHistory(ureq, binderOres, null); BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForOwnedBinder(binder); - binderCtrl = new BinderController(ureq, swControl, stackPanel, secCallback, binder); + BinderConfiguration config = BinderConfiguration.createConfig(binder); + binderCtrl = new BinderController(ureq, swControl, stackPanel, secCallback, binder, config); String displayName = StringHelper.escapeHtml(binder.getTitle()); stackPanel.pushController(displayName, binderCtrl); return binderCtrl; diff --git a/src/main/java/org/olat/modules/portfolio/ui/PublishController.java b/src/main/java/org/olat/modules/portfolio/ui/PublishController.java index 87c280491dc7558a92aa646835b8f7b61030857e..3cbd728c4af3e33be4b856821ed2b62d9192a8b2 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/PublishController.java +++ b/src/main/java/org/olat/modules/portfolio/ui/PublishController.java @@ -45,6 +45,7 @@ import org.olat.core.gui.control.generic.wizard.StepsRunContext; import org.olat.core.id.Identity; import org.olat.modules.portfolio.AssessmentSection; import org.olat.modules.portfolio.Binder; +import org.olat.modules.portfolio.BinderConfiguration; import org.olat.modules.portfolio.BinderSecurityCallback; import org.olat.modules.portfolio.Page; import org.olat.modules.portfolio.PortfolioElement; @@ -80,6 +81,7 @@ public class PublishController extends BasicController implements TooledControll private int counter; private Binder binder; private PortfolioElementRow binderRow; + private final BinderConfiguration config; private final BinderSecurityCallback secCallback; @Autowired @@ -88,9 +90,10 @@ public class PublishController extends BasicController implements TooledControll private PortfolioService portfolioService; public PublishController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, - BinderSecurityCallback secCallback, Binder binder) { + BinderSecurityCallback secCallback, Binder binder, BinderConfiguration config) { super(ureq, wControl); this.binder = binder; + this.config = config; this.secCallback = secCallback; this.stackPanel = stackPanel; @@ -343,6 +346,11 @@ public class PublishController extends BasicController implements TooledControll this.assessmentSection = assessmentSection; } + public boolean isAssessable() { + return config.isAssessable(); + } + + public String getTitle() { return element.getTitle(); } @@ -356,7 +364,7 @@ public class PublishController extends BasicController implements TooledControll return ""; } - public String getFormattedScore() { + public String getFormattedResult() { if(element.getType() == PortfolioElementType.section) { return PortfolioRendererHelper.getFormattedResult(assessmentSection, getTranslator()); } diff --git a/src/main/java/org/olat/modules/portfolio/ui/SectionPageListController.java b/src/main/java/org/olat/modules/portfolio/ui/SectionPageListController.java index 809c60291c22886e8e5bd348fb5d139de86e047e..ea0ff1461025efe60531f62225e0a57fbbf496c2 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/SectionPageListController.java +++ b/src/main/java/org/olat/modules/portfolio/ui/SectionPageListController.java @@ -34,6 +34,7 @@ import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController; import org.olat.modules.portfolio.AssessmentSection; import org.olat.modules.portfolio.Binder; +import org.olat.modules.portfolio.BinderConfiguration; import org.olat.modules.portfolio.BinderSecurityCallback; import org.olat.modules.portfolio.Page; import org.olat.modules.portfolio.Section; @@ -55,8 +56,8 @@ public class SectionPageListController extends AbstractPageListController { private final Section section; public SectionPageListController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, - BinderSecurityCallback secCallback, Binder binder, Section section) { - super(ureq, wControl, stackPanel, secCallback, "pages", true); + BinderSecurityCallback secCallback, Binder binder, BinderConfiguration config, Section section) { + super(ureq, wControl, stackPanel, secCallback, config, "pages", true); this.binder = binder; this.section = section; diff --git a/src/main/java/org/olat/modules/portfolio/ui/SharedItemsController.java b/src/main/java/org/olat/modules/portfolio/ui/SharedItemsController.java index b2879d9e9e0aedd8df758b4f66d5da53566d6d69..b81a2b40fa8d488d68d0ddbb0c39d2372fcc691b 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/SharedItemsController.java +++ b/src/main/java/org/olat/modules/portfolio/ui/SharedItemsController.java @@ -43,6 +43,7 @@ import org.olat.core.id.context.StateEntry; import org.olat.core.util.StringHelper; import org.olat.core.util.resource.OresHelper; import org.olat.modules.portfolio.Binder; +import org.olat.modules.portfolio.BinderConfiguration; import org.olat.modules.portfolio.BinderSecurityCallback; import org.olat.modules.portfolio.BinderSecurityCallbackFactory; import org.olat.modules.portfolio.PortfolioService; @@ -195,7 +196,8 @@ public class SharedItemsController extends FormBasicController implements Activa WindowControl swControl = addToHistory(ureq, binderOres, null); List<AccessRights> rights = portfolioService.getAccessRights(binder, getIdentity()); BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForCoach(binder, rights); - binderCtrl = new BinderController(ureq, swControl, stackPanel, secCallback, binder); + BinderConfiguration config = BinderConfiguration.createConfig(binder); + binderCtrl = new BinderController(ureq, swControl, stackPanel, secCallback, binder, config); String displayName = StringHelper.escapeHtml(binder.getTitle()); stackPanel.pushController(displayName, binderCtrl); return binderCtrl; diff --git a/src/main/java/org/olat/modules/portfolio/ui/TableOfContentController.java b/src/main/java/org/olat/modules/portfolio/ui/TableOfContentController.java index da154824cf2d4441330a6b3c1038705b27e5383e..8146e436bac096fbc48df9979886c7442cb7f093 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/TableOfContentController.java +++ b/src/main/java/org/olat/modules/portfolio/ui/TableOfContentController.java @@ -44,6 +44,7 @@ import org.olat.core.id.Identity; import org.olat.core.util.StringHelper; import org.olat.modules.portfolio.AssessmentSection; import org.olat.modules.portfolio.Binder; +import org.olat.modules.portfolio.BinderConfiguration; import org.olat.modules.portfolio.BinderSecurityCallback; import org.olat.modules.portfolio.Page; import org.olat.modules.portfolio.PortfolioService; @@ -79,6 +80,7 @@ public class TableOfContentController extends BasicController implements TooledC private int counter = 0; private Binder binder; private final List<Identity> owners; + private final BinderConfiguration config; private final BinderSecurityCallback secCallback; @Autowired @@ -87,9 +89,10 @@ public class TableOfContentController extends BasicController implements TooledC private PortfolioService portfolioService; public TableOfContentController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, - BinderSecurityCallback secCallback, Binder binder) { + BinderSecurityCallback secCallback, Binder binder, BinderConfiguration config) { super(ureq, wControl); this.binder = binder; + this.config = config; this.stackPanel = stackPanel; this.secCallback = secCallback; @@ -192,7 +195,7 @@ public class TableOfContentController extends BasicController implements TooledC } private PageRow forgePageRow(Page page, SectionRow sectionRow) { - PageRow pageRow = new PageRow(page, sectionRow.getSection(), null, false); + PageRow pageRow = new PageRow(page, sectionRow.getSection(), null, false, config.isAssessable()); String pageId = "page" + (++counter); String title = StringHelper.escapeHtml(page.getTitle()); @@ -282,7 +285,7 @@ public class TableOfContentController extends BasicController implements TooledC private void doOpenSection(UserRequest ureq, Section section) { removeAsListenerAndDispose(sectionPagesCtrl); - sectionPagesCtrl = new SectionPageListController(ureq, getWindowControl(), stackPanel, secCallback, binder, section); + sectionPagesCtrl = new SectionPageListController(ureq, getWindowControl(), stackPanel, secCallback, binder, config, section); listenTo(sectionPagesCtrl); stackPanel.pushController(StringHelper.escapeHtml(section.getTitle()), sectionPagesCtrl); } @@ -369,12 +372,19 @@ public class TableOfContentController extends BasicController implements TooledC ? SectionStatus.notStarted.cssClass() : section.getSectionStatus().cssClass(); } + public boolean isAssessable() { + return config.isAssessable(); + } + /** * It use the same format as the cell renderer. * @return */ - public String getFormatedResult() { - return PortfolioRendererHelper.getFormattedResult(assessmentSection, getTranslator()); + public String getFormattedResult() { + if(config.isAssessable()) { + return PortfolioRendererHelper.getFormattedResult(assessmentSection, getTranslator()); + } + return ""; } public Section getSection() { diff --git a/src/main/java/org/olat/modules/portfolio/ui/_content/page_row.html b/src/main/java/org/olat/modules/portfolio/ui/_content/page_row.html index 4f55b7c27892431d25e36e1cbdf7e3b8abbfe320..c53ba61c12b53f3367a3ac28876a5ac94181eeb5 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/_content/page_row.html +++ b/src/main/java/org/olat/modules/portfolio/ui/_content/page_row.html @@ -12,7 +12,7 @@ <span><strong>$r.translate("end.date"): </strong> $r.formatDate($row.sectionEndDate)</span> #end - #if(${row.hasScore()}) + #if($row.assessable && ${row.hasScore()}) <span><strong>$r.translate("section.score"): </strong> $row.score</span> #end </div> diff --git a/src/main/java/org/olat/modules/portfolio/ui/_content/publish.html b/src/main/java/org/olat/modules/portfolio/ui/_content/publish.html index edb835e64613e6fc211e5c3754241e817be9a45b..a7e40d5a0e5b2ec78b15a0435436253a92c841da 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/_content/publish.html +++ b/src/main/java/org/olat/modules/portfolio/ui/_content/publish.html @@ -14,7 +14,7 @@ <ul class="list-unstyled"> #foreach($section in $binderRow.children) - <li><h4>${foreach.count}. $r.escapeHtml($section.title) <small><i class="o_icon $section.cssClassStatus"> </i> ${section.getFormattedScore()}</small></h4> + <li><h4>${foreach.count}. $r.escapeHtml($section.title) <small><i class="o_icon $section.cssClassStatus"> </i> #if($section.assessable) ${section.getFormattedResult()} #end</small></h4> #if(!${section.getAccessRights().isEmpty()}) <table class="o_portfolio_ac"><tbody> diff --git a/src/main/java/org/olat/modules/portfolio/ui/_content/table_of_contents.html b/src/main/java/org/olat/modules/portfolio/ui/_content/table_of_contents.html index 88778c1e4fc6bbf57eaaa346a9be331e90eaf99e..c69647f917579464c9d2e8ab6b2ce5281a1c2d81 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/_content/table_of_contents.html +++ b/src/main/java/org/olat/modules/portfolio/ui/_content/table_of_contents.html @@ -4,7 +4,7 @@ <ul class="list-unstyled"> #foreach($section in $sections) <li><div class="o_header_with_buttons"> - <h4>${foreach.count}. $r.render($section.sectionLinkName) </h4> <i class="o_icon $section.cssClassStatus"> </i> ${section.getFormatedResult()} + <h4>${foreach.count}. $r.render($section.sectionLinkName) </h4> <i class="o_icon $section.cssClassStatus"> </i>#if(${section.isAssessable()}) ${section.getFormattedResult()} #end #if(${section.hasEditDropdown()}) <div id="sect_$foreach.count" class="o_button_group o_button_group_right dropdown">$r.render($section.editDropdownName)</div> #end diff --git a/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_de.properties index 5c1e658a339cefd9676748cc28438077288a883a..486b97a8078b621bab7d7e9e1d549b67d00ccd5c 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_de.properties @@ -1,4 +1,4 @@ -#Thu Jun 23 19:16:01 CEST 2016 +#Fri Jun 24 10:55:46 CEST 2016 access=Zugang access.rights.coach=Betreuer access.rights.coach.long=als Betreuer (lesen / kommentieren / bewerten) @@ -36,6 +36,7 @@ create.new.binder=Neue Mappe erstellen create.new.binder.descr=Erstellen Sie eine portfolio Mappe um Ihre Eintr\u00E4ge zu strukturieren und zu organisieren und um diese f\u00FCr andere Benutzer zwecks Kommentieren und Bewerten freizugeben. create.new.binder.title=Neue Mappe erstellen create.new.page=Neuer Eintrag erstellen +create.new.page.tite=Neuer Eintrag erstellen create.new.section=Neuer Bereich erstellen create.new.section.text=Erstellen Sie einen neuen Bereich in der Portfolio Mappe um Ihre Eintr\u00E4ge zu organisieren. create.new.section.title=Neuer Bereich hinzuf\u00FCgen @@ -91,7 +92,9 @@ section.status=Status shared.with.me=Mit mir geteilt shared.with.me.text=Liste aller Mappen, die von anderen Benutzern an mich freigegeben wurden. status.closed=geschlossen +status.in.progress=in Bearbeitung status.not.started=nicht gestartet +status.submitted=abgegeben summary=Zusammenfassung summary.placeholder=Kurze Zusammenfassung \u00FCber den Inhalt table.grading.failed.points=<span class\="o_state o_failed"><i class\="o_icon o_icon_failed"> </i> {0} Punkt(e)</span>