Jahia DX > path=

0 (0 Good)
0 (0 Bad)

path=

by  tyurk »  2011/06/07 18:00

Good day,
I have a node which contains three lists of nodes. I have simplified for the sake of explanation:

[dp:fileList] > jnt:content, jmix:list, jmix:structuredContent
+ * jnt:fileReference

[dp:imageList] > jnt:content, jmix:list, jmix:structuredContent
+ * jnt:imageReference

[dp:product] > jnt:content, jmix:structuredContent
- productDescription (string, richtext)
+ images (dp:imageList)
+ files (dp:fileList)

Now in the dp_imageList\html\imageList.jsp, I have something like 

<c:forEach items="${currentNode.nodes}" var="item">
${item}
<template:module node="${item}" template="box"/>
</c:forEach>
<c:if test="${renderContext.editMode}">
<template:module path="*"/>
</c:if>

This renders fine if I add the dp:imageList "module" to my page someplace. However, I want to display this as the template for the images node of the dp:product content item (in its content template). So, I have a content template which is default for dp:product nodes, with a mainContentArea which renders product.mainContent.jsp and in this .jsp, I want to render the associated images (and files) lists.

I have tried including a <template:module path="images"/> and variants on that using the node attribute, but to no avail. Each time the template renders empty and without the possibility to add imageReferences to the imageList.

Any pointers? Thanks,

Denis

  • path=
    2011/07/04 09:41

    tyurk <p> Good day,<br /> I have a node which contains three lists of nodes. I have simplified for the sake of explanation:<br /> <br /> [dp:fileList] &gt; jnt:content, jmix:list, jmix:structuredContent<br /> + * jnt:fileReference<br /> <br /> [dp:imageList] &gt; jnt:content, jmix:list, jmix:structuredContent<br /> + * jnt:imageReference<br /> <br /> [dp:product] &gt; jnt:content, jmix:structuredContent<br /> - productDescription (string, richtext)<br /> + images (dp:imageList)<br /> + files (dp:fileList)<br /> <br /> Now in the dp_imageList\html\imageList.jsp, I have something like&nbsp;<br /> <br /> &lt;c:forEach items=&quot;${currentNode.nodes}&quot; var=&quot;item&quot;&gt;<br /> ${item}<br /> &lt;template:module node=&quot;${item}&quot; template=&quot;box&quot;/&gt;<br /> &lt;/c:forEach&gt;<br /> &lt;c:if test=&quot;${renderContext.editMode}&quot;&gt;<br /> &lt;template:module path=&quot;*&quot;/&gt;<br /> &lt;/c:if&gt;<br /> <br /> This renders fine if I add the dp:imageList &quot;module&quot; to my page someplace. However, I want to display this as the template for the images node of the dp:product content item (in its content template). So, I have a content template which is default for dp:product nodes, with a mainContentArea which renders product.mainContent.jsp and in this .jsp, I want to render the associated images (and files) lists.<br /> <br /> I have tried including a &lt;template:module path=&quot;images&quot;/&gt; and variants on that using the node attribute, but to no avail. Each time the template renders empty and without the possibility to add imageReferences to the imageList.<br /> <br /> Any pointers? Thanks,<br /> <br /> Denis</p>

  • Number of messages  38
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: path=

    by  tyurk »  2011/06/07 18:00

    I dug a bit deeper and found the formBuilder example. Tried using
    <template:list path="images" listType="dp:imageList" editable="true"/>
    but still nothing. The list just doesn't render.

    Any ideas? Thanks.

    Denis

  • Re: path=
    2011/07/04 09:42

    tyurk <p> I dug a bit deeper and found the formBuilder example. Tried using<br /> &lt;template:list path=&quot;images&quot; listType=&quot;dp:imageList&quot; editable=&quot;true&quot;/&gt;<br /> but still nothing. The list just doesn&#39;t render.<br /> <br /> Any ideas? Thanks.<br /> <br /> Denis</p>

  • Number of messages  38
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: path=

    by  shuber »  2011/06/07 18:00

    I might have missed something but I think you are missing a view JSP for the dp:product. A content template is used to render "around" an object type, but the mainResourceArea will render the dp:product and therefore look for a JSP view for it.

    Regards,
    Serge Huber.

    Serge Huber (shuber)

    Number of messages  271
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re: path=

    by  tyurk »  2011/06/07 18:00

    Hello Serge,
    What I was trying to explain is that inside my view JSP (I mentioned product.mainContent.jsp such that I would have a "mainContent" view in the mainContentArea properties), I have tried including a view of the lists. For example, inspired by the formBuilder module, I have tried <template:list path="images" listType="dp:imageList" editable="true"/> within this view. As I understand it, this should use the standard list implementation (as dp:imageList inherits from jmix:list) view for rendering and allow for adding, reordering, etc of the list items (which, as per the imageList definition, are imageReferences). For reference, this does not work any better if the content item is added directly as an object within a page (area). The stuff around the <template:list ... /> tag renders as expected, but the <template:list ... /> tag renders as nothing.

    Hope this helps explain my conundrum. Thanks in advance for your help.

    Cheers,

    Denis

  • Re: path=
    2011/07/04 09:43

    tyurk <p> Hello Serge,<br /> What I was trying to explain is that inside my view JSP (I mentioned product.mainContent.jsp such that I would have a &quot;mainContent&quot; view in the mainContentArea properties), I have tried including a view of the lists. For example, inspired by the formBuilder module, I have tried &lt;template:list path=&quot;images&quot; listType=&quot;dp:imageList&quot; editable=&quot;true&quot;/&gt; within this view. As I understand it, this should use the standard list implementation (as dp:imageList inherits from jmix:list) view for rendering and allow for adding, reordering, etc of the list items (which, as per the imageList definition, are imageReferences). For reference, this does not work any better if the content item is added directly as an object within a page (area). The stuff around the &lt;template:list ... /&gt; tag renders as expected, but the &lt;template:list ... /&gt; tag renders as nothing.<br /> <br /> Hope this helps explain my conundrum. Thanks in advance for your help.<br /> <br /> Cheers,<br /> <br /> Denis</p>

  • Number of messages  38
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: path=

    by  tyurk »  2011/06/07 18:00

    Hello again,
    Seems I left out an apparently important detail:

    my definition for dp:product was actually more like:
    [dp:product] > jnt:content, jmix:structuredContent
    - productDescription (string, richtext)
    + images (dp:imageList)
    + files (dp:fileList)
    + * (someOtherObject)

    Apparently this makes it such that the other subnodes get lost in the mix. I created a new list type for the someOtherObject type and added a someOtherObjectList node to the definition instead. Using this approach, the <template:list path="images" listType="dp:imageList" editable="true"/> model for each list works like a charm.

    Still curious as to why it wouldn't work the other way, however...

    Cheers,

    Denis

  • Re: path=
    2011/07/04 09:43

    tyurk <p> Hello again,<br /> Seems I left out an apparently important detail:<br /> <br /> my definition for dp:product was actually more like:<br /> [dp:product] &gt; jnt:content, jmix:structuredContent<br /> - productDescription (string, richtext)<br /> + images (dp:imageList)<br /> + files (dp:fileList)<br /> + * (someOtherObject)<br /> <br /> Apparently this makes it such that the other subnodes get lost in the mix. I created a new list type for the someOtherObject type and added a someOtherObjectList node to the definition instead. Using this approach, the &lt;template:list path=&quot;images&quot; listType=&quot;dp:imageList&quot; editable=&quot;true&quot;/&gt; model for each list works like a charm.<br /> <br /> Still curious as to why it wouldn&#39;t work the other way, however...<br /> <br /> Cheers,<br /> <br /> Denis</p>

  • Number of messages  38
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    How to populate a fileReference ?

    by  kamran »  2011/10/10 20:46

    Dear Denis,

    I am trying to something similar and I can not understand how to populate my list with some content.

    How to you add files and images to you product ?

    I tried to do this using the Edit Mode. But each time I edit or create a object (of type product in your case) I am not able to add an image or a file :-(

    Is it possible to do ths directly in Edit Mode or I have to write my own form to create products ?

    Thanks for your help

    Marc

    Ps: here is a part of my definition :

    [mynt:role] > jnt:content, jmix:editorialContent, jmix:structuredContent
    + files (mynt:fileList)
    
    [mynt:fileList] > jnt:content, jmix:list, jmix:structuredContent
    + * (jnt:fileReference)
    
    
    
    

     

      (kamran)

    Number of messages  31
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re: How to populate a fileReference ?

    by  shuber »  2011/10/11 07:23

    Hi guys, 

    Edit mode has some limitations and currently create elements that are named. I have had the same problem and I'm currently submitting a fix for this that is now under review. I hope my fix is correct that way we can have this working.

    You can get around this problem in the meantime with the following alternatives :

    - if you actually give the object the system name corresponding to the named child (like files in Marc's example), it will work, but it's not very practical

    - if you add the objects yourself for example with an AJAX request or custom action it will also work.

    - you could also use areas instead of modules, and constrain the areas to certain specific types of objects that may be drag&dropped.

    Best regards,

      Serge Huber.

    Serge Huber (shuber)

    Number of messages  271
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re: How to populate a fileReference ?

    by  kamran »  2011/10/14 09:32

    Dear Serge,

    thanks for you explenation.

    Do you have an example ? Because I can not understand how to populate my attached list :-(

    Thanks for your help

    Marc

      (kamran)

    Number of messages  31
    Registration date
    1 (1 Good)
    0 (0 Bad)

    Re: Re: How to populate a fileReference ?

    by  shuber »  2011/10/14 13:30

    Hello Marc, for the first case where you enter the system name if you have for example : 

     

    [mynt:role] > jnt:content, jmix:editorialContent, jmix:structuredContent
    + files (mynt:fileList)
    
    If you drag & drop a mynt:filelist under the mynt:role node, assuming you have this in your view : 
     
    <template:module path="files"/>
     
    You will need to manually change, once the edit engine is open, the system name to "files". 
     
    I have submitted a patch for 6.5.1.0 that will be part of the next hotfix that will change the default to "files".
     
    Regards,
      Serge Huber.

    Serge Huber (shuber)

    Number of messages  271
    Registration date
    1 (1 Good)
    0 (0 Bad)

    Re: How to populate a fileReference ?

    by  kamran »  2011/10/17 23:10

    Hi Serge,

    Final, with your help I succeed on attaching several files to my node.

    As you proposed, first of all I create my node, then I add (create or drag&drop) files to my node.

    Here is a sample code :

    definitions.cnd :

    [mynt:fileList] > jnt:content, jmix:list
     + * (jnt:fileReference) = jnt:fileReference
    
    [mynt:foo] > jnt:content, jmix:editorialContent, jmix:structuredContent
    - content (string)
    + files (mynt:fileList)
    

    mynt_fileList/html/fileList.jsp :

    <ul>
        <c:forEach items="${currentNode.nodes}" var="subchild" varStatus="status">
            <li>
                <template:module node="${subchild}" view="default" />
            </li>
        </c:forEach>
    </ul>
    <c:if test="${renderContext.editMode}">
        <template:module path="*"/>
    </c:if>
            

    mynt_foo/html/foo.jsp :

    <div>
        <p>${currentNode.properties.foo.string}</p>
        <label>List of attachments</label>
        <template:list view="default" path="files" listType="mynt:fileList" editable="true"/>
    </div>

    And now, each time I create a foo node, then once the foo node is created, I can add several attachments.

    thanks for your help

    Marc

     

     

     

      (kamran)

    Number of messages  31
    Registration date
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page