Hello I have an issue about creating a link to a folder. I thought that I get the theory, but I miss something on the technical side:
I my workflow the initiator chose a folder and the user have a link (the http link) in his task which allow him to access to this folder.
My startTask have this field:
<mandatory-aspects>
<aspect>ddg:replyLocation</aspect>
</mandatory-aspects>
where ddg:replyLocation is define as:
<aspect name="ddg:replyLocation">
<associations>
<association name="ddg:replyLocation">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>cm:folder</class>
<mandatory>true</mandatory>
<many>false</many>
</target>
</association>
</associations>
</aspect>
The initiator part works.
For the user part I did this:
I try to use the type app:folderLink, but I don't get what I expect:
here I get the bouton to change the folder, and I don't get the link.
for the user Task I used the type app:linkFolder:
define like this in the model:
<association name="ddg:linkFolder">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>app:folderlink</class>
<mandatory>true</mandatory>
<many>false</many>
</target>
</association>
and initialise like this in the bpmn (in the userTask script)
var ddg_linkFolder=ddg_replyLocation.getNodeRef();
execution.setVariable('ddg_linkFolder', ddg_linkFolder);
To summarize:
Solved! Go to Solution.
the way I finaly found to do it was to create a ftl to use in the share-config.
I apply this ftl to the webdavUrl of my folder, and it build my the following kind of http link:
The con of this solution is that it works only for the folders in the documentLibrary of a site.
in the model.xml
<aspect name="ddg:replyLocation">
<associations>
<association name="ddg:replyLocation">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>cm:folder</class>
<mandatory>true</mandatory>
<many>false</many>
</target>
</association>
</associations>
</aspect>
<aspect name="ddg:folderWebDavUrl">
<properties>
<property name="ddg:folderWebDavUrl">
<type>d:text</type>
</property>
</properties>
</aspect>
in the bpmn:
execution.setVariable('ddg_folderWebDavUrl',ddg_replyLocation.webdavUrl);
in the share-config
<field id="ddg:folderWebDavUrl" set="response">
<control template="/com/iorga/mi/url-folder-link-display.ftl" />
</field>
the ftl
<div class="form-field">
<div class="viewmode-field">
<input type="hidden" id="webdavValue" value=${field.value}/>
<span class="viewmode-label">Dossier:</span>
<img src="/share/res/components/images/filetypes/generic-folder-16.png" alt="" title="test" width="16">
<a id="urlToDisp" href=""></a>
</div>
</div>
<script type="text/javascript">//<![CDATA[
var server = window.location.protocol + "//" + window.location.host;
var webdav = document.getElementById('webdavValue').value;
var splitWebdav = webdav.split("/");
var part0 = server+"/share/page/";
var part1 = "site"+"/"+splitWebdav[3].toLowerCase()+"/"+splitWebdav[4].toLowerCase();
var part2 = "#filter=path%7C";
var part3 = "";
var part4 = "%7C&page=1";
var nameFolder = "";
for ( i = 5; i < splitWebdav.length-1; i++) {
console.log(i + " @@ "+ splitWebdav[i]);
part3+="%2F"+splitWebdav[i];
nameFolder = splitWebdav[i];
}
nameFolder= decodeURI(nameFolder);
var ret = part0+part1+part2+part3+part4;
document.getElementById('urlToDisp').setAttribute("href",ret);
document.getElementById('urlToDisp').innerHTML = nameFolder;
//]]></script>
Hello.
If you use the type app:linkFolder as the target time in your association, then what you are saying is that you are going to be creating an assotiation between the workflow and an object of the type app:linkFolder, which is, as the name suggests, a link to a folder existing in the repository, and I guess that is not what you need.
The right thing to do is to define the target type as cm:folder, and that will let you select an actual folder.
Please, let me know if that makes sense.
If I understand the app:linkFolder is not the object I should use.
My goal is to display to the user the url link of the folder chose by the initiator in the startTast (something like: http://localhost:8080/share/page/context/mine/myfiles#filter=path%7C%2FSites%2Fswsdp%2FdocumentLibra... )
How can I retrieve this url of my object ddg:replyLocation?
You will have to customize the form control to show that URL for you.
One way to see how you can do so is by looking at the breadcrumb component's source code, as it creates just that.
the way I finaly found to do it was to create a ftl to use in the share-config.
I apply this ftl to the webdavUrl of my folder, and it build my the following kind of http link:
The con of this solution is that it works only for the folders in the documentLibrary of a site.
in the model.xml
<aspect name="ddg:replyLocation">
<associations>
<association name="ddg:replyLocation">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>cm:folder</class>
<mandatory>true</mandatory>
<many>false</many>
</target>
</association>
</associations>
</aspect>
<aspect name="ddg:folderWebDavUrl">
<properties>
<property name="ddg:folderWebDavUrl">
<type>d:text</type>
</property>
</properties>
</aspect>
in the bpmn:
execution.setVariable('ddg_folderWebDavUrl',ddg_replyLocation.webdavUrl);
in the share-config
<field id="ddg:folderWebDavUrl" set="response">
<control template="/com/iorga/mi/url-folder-link-display.ftl" />
</field>
the ftl
<div class="form-field">
<div class="viewmode-field">
<input type="hidden" id="webdavValue" value=${field.value}/>
<span class="viewmode-label">Dossier:</span>
<img src="/share/res/components/images/filetypes/generic-folder-16.png" alt="" title="test" width="16">
<a id="urlToDisp" href=""></a>
</div>
</div>
<script type="text/javascript">//<![CDATA[
var server = window.location.protocol + "//" + window.location.host;
var webdav = document.getElementById('webdavValue').value;
var splitWebdav = webdav.split("/");
var part0 = server+"/share/page/";
var part1 = "site"+"/"+splitWebdav[3].toLowerCase()+"/"+splitWebdav[4].toLowerCase();
var part2 = "#filter=path%7C";
var part3 = "";
var part4 = "%7C&page=1";
var nameFolder = "";
for ( i = 5; i < splitWebdav.length-1; i++) {
console.log(i + " @@ "+ splitWebdav[i]);
part3+="%2F"+splitWebdav[i];
nameFolder = splitWebdav[i];
}
nameFolder= decodeURI(nameFolder);
var ret = part0+part1+part2+part3+part4;
document.getElementById('urlToDisp').setAttribute("href",ret);
document.getElementById('urlToDisp').innerHTML = nameFolder;
//]]></script>
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.