Evästeet ovat välttämättömiä, jotta voit kirjautua palveluun. Salli evästeet.
Lue lisää
OP Liminka
## Type: Web Content Display Template
## Name: OFINAYT186 General title promotion
## Developer: Veli-Matti Lehikoinen
## Initial Version Date: 2014-11-13.
## Refactored & optimized by: Sebastian Nikkonen
## This template is used to define the layout of OFINAYT186. It uses structures OFISMAL006.
#set($dlService = $serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService"))
#macro (getFileEntryOFINAYT186 $url)
#set ($fileParts = "")
#set ($groupIdIndex = "")
#set ($groupId = 0)
#set ($lastIndex = "")
#set ($uuid = "")
#set ($fileEntry = "")
#set ($fileParts = $url.split("/"))
## Get groupId
#set ($groupIdIndex = $fileParts.size() - 4)
#set ($groupId = $getterUtil.getLong($fileParts.get($groupIdIndex)))
## Get uuid
#set ($lastIndex = $fileParts.size() - 1)
#set ($uuid = $fileParts.get($lastIndex))
#set ($uuid = $uuid.split("\?").get(0))
#set ($fileEntry = $dlService.getFileEntryByUuidAndGroupId($uuid.trim(), $groupId))
#end
## This macro will add image of the Document-type OFISMAL022-Kuva
## Responsive image macro will import current image and select the best option for users device.
## Image sizes are small, medium and original. Normal and small images are scaled from original
## Image is using Liferay's in-build feature. Images are named as imageThumbnail=2 (medium) and imageThumbnail=3 (small)
#macro(createResponsiveImageTagOFINAYT186 $kuva)
## retrieve alt text
#createAltOFINAYT186($kuva)
## If created using OFISMAL022
#if($alt != "")
#set($imageMimeType = $fileEntry.getMimeType())
#if(!$imageMimeType.matches(".*svg.*"))
#set($mediumSize = "&imageThumbnail=2")
#set($smallSize = "&imageThumbnail=3")
#set($imageUrl = "$kuva.getData()$smallSize"+"&i=1, $kuva.getData()$smallSize"+"&i=2 2x")
## - Picture element uses original_image as fallback
## Image mime-type is SVG (use original image)
#else
#end
#end
#end
#macro(createAltOFINAYT186 $image)
## Get the uuid and groupId from image File Entry
#getFileEntryOFINAYT186($image.getData())
## Check that the image-alt field exist and has value (this will check that the image has been created using OFISMAL022-Kuva)
## Image Alt-text is retrieved only from original image
#set ($fieldsMap = $fileEntry.getDDMFormValuesMap($fileEntry.getFileVersion().fileVersionId))
#set ($altText = "")
#foreach($row in $fieldsMap)
#set ($fieldValuesMap = $row.getDDMFormFieldValuesMap())
#foreach($valuesRow in $fieldValuesMap)
#foreach($valueRow in $valuesRow)
#if ($valueRow.getName() == "kuva_alt_text")
#if ($validator.isNotNull($valueRow.getValue().getString($locale)))
#set ($altText = $valueRow.getValue().getString($locale))
#break
#end
#end
#end
#end
#end
#end
## Link Service - External URL
#set ($customActionURL = "")
#set ($pathMain = $portalUtil.getPathMain())
#if (!$pathMain.isEmpty())
#set($customActionURL = $pathMain + "/portal/linkki?url=")
#end
## Tekstillinen linkkilista
## Monistettava osuus alkaa
#if (!$nosto_linkkiteksti.getSiblings().isEmpty())
#foreach ($cur_nosto_linkkiteksti in $nosto_linkkiteksti.getSiblings())
#if ($validator.isNotNull($cur_nosto_linkkiteksti.data))