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

OO-1019: replace the link as a string with real FormLinks

parent 21afef5b
No related branches found
No related tags found
No related merge requests found
...@@ -176,8 +176,6 @@ public abstract class TextBoxListComponent extends FormBaseComponentImpl { ...@@ -176,8 +176,6 @@ public abstract class TextBoxListComponent extends FormBaseComponentImpl {
currentItems.put(caption, itemValue); currentItems.put(caption, itemValue);
} }
} }
System.out.println(cmd + " :: " + cleanedItemValues);
if (logger.isDebug()) if (logger.isDebug())
logger.debug("doDispatchRequest --> firing textBoxListEvent with current items: " + cleanedItemValues); logger.debug("doDispatchRequest --> firing textBoxListEvent with current items: " + cleanedItemValues);
......
...@@ -26,7 +26,6 @@ package org.olat.portfolio.ui.artefacts.view; ...@@ -26,7 +26,6 @@ package org.olat.portfolio.ui.artefacts.view;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -65,6 +64,7 @@ import org.olat.portfolio.model.structel.PortfolioStructure; ...@@ -65,6 +64,7 @@ import org.olat.portfolio.model.structel.PortfolioStructure;
import org.olat.portfolio.ui.artefacts.collect.EPCollectStepForm00; import org.olat.portfolio.ui.artefacts.collect.EPCollectStepForm00;
import org.olat.portfolio.ui.artefacts.collect.EPCollectStepForm03; import org.olat.portfolio.ui.artefacts.collect.EPCollectStepForm03;
import org.olat.portfolio.ui.artefacts.collect.EPReflexionChangeEvent; import org.olat.portfolio.ui.artefacts.collect.EPReflexionChangeEvent;
import org.olat.resource.OLATResource;
import org.olat.util.logging.activity.LoggingResourceable; import org.olat.util.logging.activity.LoggingResourceable;
/** /**
...@@ -203,20 +203,15 @@ public class EPArtefactViewController extends FormBasicController { ...@@ -203,20 +203,15 @@ public class EPArtefactViewController extends FormBasicController {
// get maps wherein this artefact is linked and create links to them // get maps wherein this artefact is linked and create links to them
List<PortfolioStructure> linkedMaps = ePFMgr.getReferencedMapsForArtefact(artefact); List<PortfolioStructure> linkedMaps = ePFMgr.getReferencedMapsForArtefact(artefact);
if (linkedMaps != null && linkedMaps.size() != 0) { if (linkedMaps != null && linkedMaps.size() != 0) {
StringBuilder buf = new StringBuilder(); List<FormLink> selectMapNames = new ArrayList<FormLink>(linkedMaps.size());
for (Iterator<PortfolioStructure> iterator = linkedMaps.iterator(); iterator.hasNext();) { for (PortfolioStructure ePMap : linkedMaps) {
PortfolioStructure ePMap = iterator.next(); String title = StringHelper.escapeHtml(ePMap.getTitle());
if (viewOnlyMode || artefactChooseMode){ FormLink selectMap = uifactory.addFormLink("map", "map", title, null, formLayout, Link.NONTRANSLATED);
StringHelper.escapeHtml(ePMap.getTitle()); selectMap.setUserObject(ePMap.getOlatResource());
buf.append(", "); selectMap.setEnabled(!viewOnlyMode && !artefactChooseMode);
} else { selectMapNames.add(selectMap);
buf.append("<a href=\"").append(createLinkToMap(ePMap)).append("\">");
StringHelper.escapeHtml(ePMap.getTitle());
buf.append("</a>, ");
}
} }
String mapLinks = buf.toString(); flc.contextPut("maps", selectMapNames);
flc.contextPut("maps", mapLinks.substring(0, mapLinks.length() - 2));
} }
// build link to original source // build link to original source
...@@ -276,13 +271,10 @@ public class EPArtefactViewController extends FormBasicController { ...@@ -276,13 +271,10 @@ public class EPArtefactViewController extends FormBasicController {
flc.contextPut("artAttribConfig", attribConfig); flc.contextPut("artAttribConfig", attribConfig);
} }
private String createLinkToMap(PortfolioStructure ePMap) { private void doOpenLinkToMap(UserRequest ureq, OLATResource mapResource) {
BusinessControlFactory bCF = BusinessControlFactory.getInstance(); String businessPath = "[" + mapResource.getResourceableTypeName() + ":"
ContextEntry mapCE = bCF.createContextEntry(ePMap.getOlatResource()); + mapResource.getResourceableId() + "]";
ArrayList<ContextEntry> cEList = new ArrayList<ContextEntry>(); NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
cEList.add(mapCE);
String busLink = bCF.getAsURIString(cEList, true);
return busLink;
} }
private String createLinkToArtefactSource(UserRequest ureq, String businessPath){ private String createLinkToArtefactSource(UserRequest ureq, String businessPath){
...@@ -317,6 +309,12 @@ public class EPArtefactViewController extends FormBasicController { ...@@ -317,6 +309,12 @@ public class EPArtefactViewController extends FormBasicController {
} else if(source == tblE){ } else if(source == tblE){
List<String> actualTags = tblE.getValueList(); List<String> actualTags = tblE.getValueList();
ePFMgr.setArtefactTags(getIdentity(), artefact, actualTags); ePFMgr.setArtefactTags(getIdentity(), artefact, actualTags);
} else if(source instanceof FormLink) {
FormLink link = (FormLink)source;
if("map".equals(link.getCmd())) {
OLATResource map = (OLATResource)link.getUserObject();
doOpenLinkToMap(ureq, map);
}
} }
} }
......
...@@ -59,7 +59,11 @@ ...@@ -59,7 +59,11 @@
#if ($artAttribConfig.get("artefact.used.in.maps")) #if ($artAttribConfig.get("artefact.used.in.maps"))
<div class="b_form_element_wrapper b_clearfix"> <div class="b_form_element_wrapper b_clearfix">
<div class="b_form_element_label">$r.translate("artefact.used.in.maps")</div> <div class="b_form_element_label">$r.translate("artefact.used.in.maps")</div>
<div class="b_form_element">$!maps</div> <div class="b_form_element">
#foreach($map in $maps)
$r.render($map.component.componentName)
#end
</div>
</div> </div>
#end #end
#if ($artAttribConfig.get("artefact.reflexion")) #if ($artAttribConfig.get("artefact.reflexion"))
......
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