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

OO-4635: enhance portfolio's toc's link to course to open in new window

parent 9df1cb6a
No related branches found
No related tags found
No related merge requests found
...@@ -214,7 +214,7 @@ public class LinkRenderer extends DefaultComponentRenderer { ...@@ -214,7 +214,7 @@ public class LinkRenderer extends DefaultComponentRenderer {
} else { } else {
// a link may force a non ajax-mode and a custom targ // a link may force a non ajax-mode and a custom targ
boolean iframePostEnabled = flags.isIframePostEnabled() && link.isAjaxEnabled() && link.getTarget() == null; boolean iframePostEnabled = flags.isIframePostEnabled() && link.isAjaxEnabled() && link.getTarget() == null;
ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, !link.isSuppressDirtyFormWarning(), true, ubu.buildHrefAndOnclick(sb, link.getUrl(), null, iframePostEnabled, !link.isSuppressDirtyFormWarning(), true,
new NameValuePair(VelocityContainer.COMMAND_ID, command)); new NameValuePair(VelocityContainer.COMMAND_ID, command));
} }
......
...@@ -24,6 +24,7 @@ import java.util.HashMap; ...@@ -24,6 +24,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.olat.NewControllerFactory;
import org.olat.core.commons.fullWebApp.LayoutMain3ColsController; import org.olat.core.commons.fullWebApp.LayoutMain3ColsController;
import org.olat.core.commons.fullWebApp.popup.BaseFullWebappPopupLayoutFactory; import org.olat.core.commons.fullWebApp.popup.BaseFullWebappPopupLayoutFactory;
import org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback; import org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback;
...@@ -57,9 +58,9 @@ import org.olat.core.gui.control.generic.modal.DialogBoxUIFactory; ...@@ -57,9 +58,9 @@ import org.olat.core.gui.control.generic.modal.DialogBoxUIFactory;
import org.olat.core.gui.control.generic.spacesaver.ToggleBoxController; import org.olat.core.gui.control.generic.spacesaver.ToggleBoxController;
import org.olat.core.gui.control.winmgr.ScrollTopCommand; import org.olat.core.gui.control.winmgr.ScrollTopCommand;
import org.olat.core.gui.media.MediaResource; import org.olat.core.gui.media.MediaResource;
import org.olat.core.helpers.Settings;
import org.olat.core.id.Identity; import org.olat.core.id.Identity;
import org.olat.core.id.OLATResourceable; import org.olat.core.id.OLATResourceable;
import org.olat.core.id.context.BusinessControlFactory;
import org.olat.core.id.context.ContextEntry; import org.olat.core.id.context.ContextEntry;
import org.olat.core.id.context.StateEntry; import org.olat.core.id.context.StateEntry;
import org.olat.core.logging.activity.ThreadLocalUserActivityLogger; import org.olat.core.logging.activity.ThreadLocalUserActivityLogger;
...@@ -108,9 +109,18 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -108,9 +109,18 @@ import org.springframework.beans.factory.annotation.Autowired;
*/ */
public class TableOfContentController extends BasicController implements TooledController, Activateable2 { public class TableOfContentController extends BasicController implements TooledController, Activateable2 {
private Link newSectionTool, newSectionButton, newEntryLink, newAssignmentLink, private Link printLink;
editBinderMetadataLink, moveToTrashBinderLink, deleteBinderLink, restoreBinderLink, private Link newEntryLink;
exportBinderAsCpLink, printLink, exportBinderAsPdfLink; private Link newSectionTool;
private Link deleteBinderLink;
private Link newSectionButton;
private Link restoreBinderLink;
private Link newAssignmentLink;
private Link toReferenceEntryLink;
private Link editBinderMetadataLink;
private Link moveToTrashBinderLink;
private Link exportBinderAsCpLink;
private Link exportBinderAsPdfLink;
private final VelocityContainer mainVC; private final VelocityContainer mainVC;
private final TooledStackedPanel stackPanel; private final TooledStackedPanel stackPanel;
...@@ -122,12 +132,14 @@ public class TableOfContentController extends BasicController implements TooledC ...@@ -122,12 +132,14 @@ public class TableOfContentController extends BasicController implements TooledC
private SectionEditController newSectionCtrl; private SectionEditController newSectionCtrl;
private SectionEditController editSectionCtrl; private SectionEditController editSectionCtrl;
private AssignmentEditController newAssignmentCtrl; private AssignmentEditController newAssignmentCtrl;
private DialogBoxController confirmCloseSectionCtrl;
private DialogBoxController confirmReopenSectionCtrl;
private DialogBoxController confirmDeleteSectionCtrl;
private DialogBoxController confirmRestoreBinderCtrl;
private ConfirmDeleteBinderController deleteBinderCtrl; private ConfirmDeleteBinderController deleteBinderCtrl;
private SectionDatesEditController editSectionDatesCtrl; private SectionDatesEditController editSectionDatesCtrl;
private BinderMetadataEditController binderMetadataCtrl; private BinderMetadataEditController binderMetadataCtrl;
private ConfirmMoveBinderToTrashController moveBinderToTrashCtrl; private ConfirmMoveBinderToTrashController moveBinderToTrashCtrl;
private DialogBoxController confirmCloseSectionCtrl, confirmReopenSectionCtrl,
confirmDeleteSectionCtrl, confirmRestoreBinderCtrl;
private PageRunController pageCtrl; private PageRunController pageCtrl;
private PageMetadataEditController newPageCtrl; private PageMetadataEditController newPageCtrl;
...@@ -172,9 +184,14 @@ public class TableOfContentController extends BasicController implements TooledC ...@@ -172,9 +184,14 @@ public class TableOfContentController extends BasicController implements TooledC
RepositoryEntry repoEntry = binder.getEntry(); RepositoryEntry repoEntry = binder.getEntry();
if (repoEntry != null) { if (repoEntry != null) {
mainVC.contextPut("referenceEntryName", repoEntry.getDisplayname()); String repoEntryPath = "[RepositoryEntry:" + repoEntry.getKey() + "]";
String url = Settings.getServerContextPathURI() + "/url/RepositoryEntry/" + repoEntry.getKey(); String url = BusinessControlFactory.getInstance().getURLFromBusinessPathString(repoEntryPath);
mainVC.contextPut("referenceEntryUrl", url); String name = translate("binder.entry.name") + ": " + StringHelper.escapeHtml(repoEntry.getDisplayname());
toReferenceEntryLink = LinkFactory.createLink("to.ref.entry", "to.ref.entry", "to.ref.rentry", name, getTranslator(), mainVC, this, Link.NONTRANSLATED);
toReferenceEntryLink.setDomReplacementWrapperRequired(false);
toReferenceEntryLink.setIconLeftCSS("o_icon o_CourseModule_icon");
toReferenceEntryLink.setElementCssClass("small");
toReferenceEntryLink.setUrl(url);
} }
summaryComp = TextFactory.createTextComponentFromString("summaryCmp" + CodeHelper.getRAMUniqueID(), "", null, summaryComp = TextFactory.createTextComponentFromString("summaryCmp" + CodeHelper.getRAMUniqueID(), "", null,
...@@ -656,6 +673,8 @@ public class TableOfContentController extends BasicController implements TooledC ...@@ -656,6 +673,8 @@ public class TableOfContentController extends BasicController implements TooledC
doPrint(ureq); doPrint(ureq);
} else if(exportBinderAsPdfLink == source) { } else if(exportBinderAsPdfLink == source) {
doExportBinderAsPdf(ureq); doExportBinderAsPdf(ureq);
} else if(toReferenceEntryLink == source) {
doOpenReferenceEntry(ureq);
} else if(stackPanel == source) { } else if(stackPanel == source) {
if(event instanceof PopEvent && pageCtrl != null && ((PopEvent)event).getController() == pageCtrl && pageCtrl.getSection() != null) { if(event instanceof PopEvent && pageCtrl != null && ((PopEvent)event).getController() == pageCtrl && pageCtrl.getSection() != null) {
stackPanel.popUserObject(new TOCSection(pageCtrl.getSection())); stackPanel.popUserObject(new TOCSection(pageCtrl.getSection()));
...@@ -840,6 +859,11 @@ public class TableOfContentController extends BasicController implements TooledC ...@@ -840,6 +859,11 @@ public class TableOfContentController extends BasicController implements TooledC
return pageCtrl; return pageCtrl;
} }
private void doOpenReferenceEntry(UserRequest ureq) {
String businessPath = "[RepositoryEntry:" + binder.getEntry().getKey() + "]";
NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
}
private void doCreateNewEntry(UserRequest ureq) { private void doCreateNewEntry(UserRequest ureq) {
if(guardModalController(newPageCtrl)) return; if(guardModalController(newPageCtrl)) return;
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
$r.contextHelpWithWrapper("Portfolio task and assignment: Collecting and editing") $r.contextHelpWithWrapper("Portfolio task and assignment: Collecting and editing")
#end #end
<h2>$r.translate("table.of.contents", $binderTitle) #if($owners && !$owners.isEmpty())<small>$r.translate("binder.by",$owners)</small>#end </h2> <h2>$r.translate("table.of.contents", $binderTitle) #if($owners && !$owners.isEmpty())<small>$r.translate("binder.by",$owners)</small>#end </h2>
#if($r.isNotNull($referenceEntryName)) #if($r.available("to.ref.entry"))
<div class="o_portfolio_repo_link o_block_bottom o_block_move_up_small"><a href="$referenceEntryUrl" class="small"><i class="o_icon o_CourseModule_icon"> </i> $r.translate("binder.entry.name"): $r.escapeHtml($referenceEntryName)</a></div> <div class="o_portfolio_repo_link o_block_bottom o_block_move_up_small">$r.render("to.ref.entry")</div>
#end #end
#if($r.available("summary")) #if($r.available("summary"))
$r.render("summary") $r.render("summary")
......
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