Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-32957

Not possible to extract names from Multi Selection List in Web Content Structures and Templates

    Details

      Description

      It does not appear to be currently possible to extract the names of items from a Multi Selection List in Web Content Structures and Templates.

      The example shown here: http://www.liferay.com/community/wiki/-/wiki/Main/CMS+Template+%28Velocity%29#section-CMS+Template+(Velocity)-Iterating
      Currently only extracts the Data Types set in the XML structure and not the names. Arguably the Types are useless as they can't contain spaces or special characters and really don't lend themselves to being displayed on a page.

      Take this example:

       
      <?xml version="1.0"?>
      <root>
      	<dynamic-element name="SupportedVersions" type="multi-list" index-type="keyword" repeatable="false">
      		<dynamic-element name="Liferay Portal 6.1 CE GA2 (6.1.1+)" type="CE61GA2" index-type="" repeatable="false"></dynamic-element>
      		<dynamic-element name="Liferay Portal 6.1 EE GA2 (6.1.20+)" type="EE61GA2" index-type="" repeatable="false"/>
      	</dynamic-element>
      </root>
      

      Using the example code in the template:

       
      <h2>Supported Versions: </h2>
          #if($SupportedVersions.getOptions().size() >0)
          <ul>
          #foreach($item in $SupportedVersions.getOptions())
              <li> $item </li>    
          #end
          </ul>
      #end
      

      Steps to reproduce it in master

      1. Create a web content structure with a select field
      2. Edit the field settings
      3. Set Name to SupportedVersions
      4. Edit the options and replace option1 with Liferay Portal 6.1 CE GA2, value1 with CE61GA2, option2 with Liferay Portal 6.1 EE GA2 and value2 with EE61GA2. Remove the option3-value3 line.
      5. Set Multiple to Yes
      6. Save changes
      7. Create a new template for the previously created structure.
      8. Select Velocity as template language
      9. Copy the template code above and save changes.
      10. Add a web content with the structure and template
      11. Mark all the values of the select field
      12. Save Changes.
      13. Display the web content in a web content display

      Current behavior
      All that's extracted and displayed on the page is:
      *CE61GA2
      *EE61GA2

      Expected Behavior
      However what should be displayed is:
      *Liferay Portal 6.1 CE GA2
      *Liferay Portal 6.1 EE GA2

      Really what's wanted is the list of human readable names - this is consistent with all the other data types available in the template which allow the user to extract the names.

      Sorting this out would greatly improve the usability of Web Content Structures and Templates where large lists of values are used. Currently the only workaround to this is to duplicate the lists in the template via a map.

      For further info see the following posts from users:
      http://www.liferay.com/community/forums/-/message_boards/message/21422305
      http://www.liferay.com/community/forums/-/message_boards/message/4907751

        Attachments

        1. example showing output .jpg
          example showing output .jpg
          14 kB
        2. Fixed.PNG
          Fixed.PNG
          20 kB
        3. master_LPS-32957_structure.txt
          1 kB
        4. master_LPS-32957_template.txt
          0.2 kB
        5. Reproduced.PNG
          Reproduced.PNG
          23 kB
        6. sample_structure
          1 kB
        7. sample_vm
          0.7 kB
        8. Selection_003.png
          Selection_003.png
          34 kB

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 36 weeks, 3 days ago

                Packages

                Version Package
                7.0.0 Beta 3