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

DDL - Display Template - File Upload field doesn't display image in dynamic data list display portlet

Details

    • Bug
    • Status: Closed
    • Resolution: Won't Fix
    • 6.2.0 CE M5
    • 6.2.0 CE M5
    • None
    • Tomcat 7.0.34 + MySQL 5. Portal 6.2.x GIT ID: d2be211bdf40330cfb354d66d01a98e4279698d2.
    • 5
    • Regression Bug

    Description

      This doesn't show up in ee-6.1.x. I used the same template, and the image showed up fine in ee-6.1.x.

      I also tried this in FTL and it didn't work with that either.

      Steps to reproduce:

      1. Add a data definition with a file upload and change the field name to "file_upload"
      2. Add a display template to the data definition.
        • Use velocity and enter the following (a shortened version of the template from this blog post)
        • #set ($ddlRecordService = $serviceLocator.findService('com.liferay.portlet.dynamicdatalists.service.DDLRecordLocalService'))
           
          #set ($recordSetId = $getterUtil.getInteger($reserved_record_set_id.data, 0))
            
          #set ($records = $ddlRecordService.getRecords($recordSetId))
           
          #foreach($record in $records)
          #set ($fields = $record.getFields())
          #set ($file_uploadField = $fields.get("file_upload"))
          
          #set ($file_uploadJSONObject = $jsonFactoryUtil.createJSONObject($file_uploadField.value))
           
          #set ($fileName = $file_uploadField.getName())
          #set ($className = $file_uploadJSONObject.getString("className"))
          #set ($classPK = $file_uploadJSONObject.getString("classPK"))
          
          <div>
          <img height="100" src='/documents/ddm/${className}/${classPK}/${fileName}' width="100" />
          </div>
          
          #end
      3. Add a list that uses the created data definition
      4. Add a record to the definition
      5. Add a dynamic data lists portlet and select the list and select the template created in step 2
        • The image will not show up in the portlet. On a previous try, I managed to get a stacktrace in the console, but I now can't reproduce that stacktrace.

      These are the things I printed out and what ended up showing up.

      $fields = [email protected]
      $file_uploadField = [email protected]
      $file_uploadJSONObject = {"name":"Document_2.png","path":"ddm/com.liferay.portlet.dynamicdatalists.model.DDLRecord/10426/1.0/file_upload","className":"com.liferay.portlet.dynamicdatalists.model.DDLRecord","classPK":"10426"}
      $fileName = file_upload
      $className = com.liferay.portlet.dynamicdatalists.model.DDLRecord
      $classPK = [a five digit number]

      Expected result:
      The image will show up in the portlet.

      Actual result:
      The image does not show up.

      Attachments

        Activity

          People

            brian.chiu Brian Chiu (Inactive)
            brian.chiu Brian Chiu (Inactive)
            Marta Elicegui Marta Elicegui
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              9 years, 30 weeks, 5 days ago

              Packages

                Version Package
                6.2.0 CE M5