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