link to a folder in a workflow

cancel
Showing results for 
Search instead for 
Did you mean: 
vmiorga
Active Member II

link to a folder in a workflow

Jump to solution

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:

  • does the type app:linkFolder allow to get a link to open a folder, (the url of the folder)?
  • what did I have to correct to have a "redirection link" to the selected folder?
1 Solution

Accepted Solutions
vmiorga
Active Member II

Re: link to a folder in a workflow

Jump 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:

http://localhost:8080/share/page/site/swsdp/documentlibrary#filter=path%7C%2FMeeting%20Notes%7C&page... 

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>

View solution in original post

4 Replies
douglascrp
Advanced II

Re: link to a folder in a workflow

Jump to solution

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.

vmiorga
Active Member II

Re: link to a folder in a workflow

Jump to solution

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?

douglascrp
Advanced II

Re: link to a folder in a workflow

Jump to solution

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.

vmiorga
Active Member II

Re: link to a folder in a workflow

Jump 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:

http://localhost:8080/share/page/site/swsdp/documentlibrary#filter=path%7C%2FMeeting%20Notes%7C&page... 

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>