Login

Log in with OP user identifiers

OR
Private customer
Cookies missing
You cannot log into the service unless you allow cookies. Allow cookies. Read more
  1. opfi
  2. OP Länsi-Suomi
  3. Yrityspankki
  4. Paikalliset asiantuntijat tukenasi
An error occurred while processing the template.
Denied resolving class org.apache.velocity.util.ArrayListWrapper by org.apache
1## Type: Assset Publisher Display Template 
2## Name: OFINAYT224 Kuvapankki 
3## Developer: Joonas Moilanen 
4## Initial Version Date: 21-09-2015. 
5## Updated Version Date: 
6## This template is used to define the layout of OFINAYT224. It uses structure OFISMAL058. 
7 
8#set($dlService = $serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService")) 
9#set($DLAppServiceUtil = $serviceLocator.findService("com.liferay.document.library.kernel.service.DLAppService")) 
10##all texts must be localized in this order (fi, en, se) 
11#set($locales = ["fi_FI", "en_US", "sv_SE"]) 
12#set($folderFieldKey = "lokalisoitu-nimi") 
13 
14##get file entry for images 
15#macro (getFileEntryOFINAYT224 $url) 
16 
17    #set ($fileParts = "") 
18    #set ($groupIdIndex = "") 
19    #set ($groupId = 0) 
20    #set ($lastIndex = "") 
21    #set ($uuid = "") 
22    #set ($fileEntry = "") 
23 
24    #set ($fileParts = $url.split("/")) 
25 
26    ## Get groupId 
27    #set ($groupIdIndex = $fileParts.size() - 4) 
28    #set ($groupId = $getterUtil.getLong($fileParts.get($groupIdIndex))) 
29 
30    ## Get uuid 
31    #set ($lastIndex = $fileParts.size() - 1) 
32    #set ($uuid = $fileParts.get($lastIndex)) 
33    #set ($uuid = $uuid.split("\?").get(0)) 
34 
35    #set ($fileEntry = $dlService.getFileEntryByUuidAndGroupId($uuid.trim(), $groupId)) 
36 
37#end 
38 
39##setting image/tile information 
40##TODO put these in list to avoid copy paste 
41#macro(setFieldsOFINAYT224) 
42 
43    #foreach($row in $fieldsMap) 
44        #set ($fieldValuesMap = $row.getDDMFormFieldValuesMap()) 
45        #foreach($valuesRow in $fieldValuesMap) 
46            #foreach($valueRow in $valuesRow) 
47                #if ($valueRow.getName() == "nimi") 
48                    #if ($validator.isNotNull($valueRow.getValue().getString($locale))) 
49                        #set ($name = $valueRow.getValue().getString($locale)) 
50                    #end 
51                #end 
52 
53                #if ($valueRow.getName() == "kuva_alt_teksti") 
54                    #if ($validator.isNotNull($valueRow.getValue().getString($locale))) 
55                        #set ($alt = $valueRow.getValue().getString($locale)) 
56                    #end 
57                #end 
58 
59                #set($field = "") 
60                #set($field = "tehtavafi") 
61                #if ($locale == $locales.get(1)) ##en 
62                    #set($field = "tehtavaen") 
63                #end 
64                #if ($locale == $locales.get(2)) ##sv 
65                    #set($field = "tehtavasv") 
66                #end 
67 
68                #if ($valueRow.getName() == $field) 
69                    #if ($validator.isNotNull($valueRow.getValue().getString($locale))) 
70                        #set($title = $valueRow.getValue().getString($locale)) 
71                    #end 
72                #end 
73 
74                #set($field = "") 
75                #set($field = "yritysfi") 
76                #if ($locale == $locales.get(1)) ##en 
77                    #set($field = "yritysen") 
78                #end 
79                #if ($locale == $locales.get(2)) ##sv 
80                    #set($field = "yrityssv") 
81                #end 
82                #if ($valueRow.getName() == $field) 
83                    #if ($validator.isNotNull($valueRow.getValue().getString($locale))) 
84                        #set($company = $valueRow.getValue().getString($locale)) 
85                    #end 
86                #end 
87 
88                #if ($valueRow.getName() == "nro") 
89                    #if ($validator.isNotNull($valueRow.getValue().getString($locale))) 
90                        #set ($sortingIndex = $valueRow.getValue().getString($locale)) 
91                    #end 
92                #end 
93 
94            #end 
95        #end 
96    #end 
97#end 
98 
99##setting file entry 
100#macro(setFileEntryOFINAYT224 $entry) 
101    #set($url = $dlUtil.getPreviewURL($entry, $entry.getFileVersion(), $themeDisplay, "")) 
102 
103    ## Get the image File Entry 
104    #getFileEntryOFINAYT224($url) 
105 
106    #set($folder = $fileEntry.getFolder()) 
107    #set($fieldsMap = $fileEntry.getDDMFormValuesMap($fileEntry.getFileVersion().fileVersionId)) 
108#end 
109 
110#macro(getLocaleOFINAYT224 $texts) 
111    #foreach ($l in $locales) 
112        #if ($l == $locale) 
113            #set( $i = $velocityCount - 1 ) 
114            $texts.get($i) 
115        #end 
116    #end 
117#end 
118 
119#set($noResults = ["Antamallasi sanalla ei löytynyt kuvia. Vaihda sanaa ja kokeile uudestaan.", 
120                    "No images were found matching the term you entered. Try searching by another term.", 
121                    "Inga bilder hittades med det ord du gett. Byt ord och försök på nytt."]) 
122 
123## render image tile 
124#macro(renderTileOFINAYT224 $pageIndex $tileIndex) 
125 
126    ##intruducing variables needed for tile 
127    #set($alt = "") 
128    #set($name = "") 
129    #set($title = "") 
130    #set($company = "") 
131    #set($sortingIndex = "") 
132    #set($indentifier = $pageIndex+"_"+$tileIndex) 
133 
134    #setFieldsOFINAYT224() 
135 
136    <div class="opux-g-col-s-6 opux-g-col-xxl-4 op-imagebank-tile-parent"> 
137        <div class="opux-tile op-imagebank-tile" tile-index="$sortingIndex"> 
138            <div class="opux-tile-content opux-modal-header tile-header"> 
139                <p class="imagebank-desc-field imagebank-name">$name</p> 
140                <p class="imagebank-desc-field imagebank-title">$title</p> 
141                <p class="imagebank-desc-field imagebank-company">$company</p> 
142            </div> 
143            <div class="opux-tile-content opux-modal-body op-imagebank-tile-image-holder-$indentifier op-imagebank-tile__without-buttons" style="background-image:url('$url&imageThumbnail=3'); visibility: hidden;" data-index="$indentifier"> 
144                <img class="big-image big-image-$indentifier" data-index="$indentifier" src="$url&imageThumbnail=2" alt="$alt" style="display: none;"/> 
145                <img class="ghost-image ghost-image-$indentifier" src="$url&imageThumbnail=3" alt="$alt" style="display: none; max-height: 300px; margin: auto;"/> 
146            </div> 
147            <div class="opux-loading op-imagebank-tile-loader-$indentifier" style="position:absolute; bottom: 230px; left: calc(50% - 15px);"></div> 
148        </div> 
149    </div> 
150 
151#end 
152 
153## render tab content 
154#macro(renderTabContentOFINAYT224 $folderName $pageIndex) 
155 
156    <div class="op-imagebank-top-content"> 
157        ##search 
158        <div class="imagebank-search"> 
159            <form class="imagebank-search-form" action="/search" method="get"> 
160                <div class="opux-form-group"> 
161                    <div class="opux-g-col-xs-12 opux-g-col-s-8"> 
162                        <input class="opux-input imagebank-search-input" type="text" name="s" value="" autocomplete="off" placeholder="" /> 
163                        <button class="opux-icon opux-icon-search op-imagebank-search-button"></button> 
164                    </div> 
165                </div> 
166            </form> 
167        </div> 
168        <div class="imagebank-no-results" style="display: none; margin-top: 20px;"> 
169            <p>#getLocaleOFINAYT224($noResults)</p> 
170        </div> 
171    </div> 
172 
173    <div class="imagebank-tiles-holder"> 
174        #foreach ($entry in $entries) 
175            #setFileEntryOFINAYT224($entry) 
176            #set($localizedFolderName = $folder.getExpandoBridge().getAttribute($folderFieldKey)) 
177            #if ($folderName.equals($folder.name) || $localizedFolderName.get($locale) == $folderName) 
178                #renderTileOFINAYT224($pageIndex $velocityCount) 
179            #end 
180        #end 
181    </div> 
182#end 
183 
184#set($folders = []) 
185 
186## render tabs 
187## caching of macros caused problems, this is circumvented by appending the _1 to the macro's name 
188 
189## if entries found render whole content 
190#if(!$entries.isEmpty()) 
191    <div class="ofinayt224 op-imagebank op-content-css op-content-page-layout"> 
192        <div class="opux-g-row"> 
193            #foreach ($entry in $entries) 
194                #setFileEntryOFINAYT224($entry) 
195                #set($localizedFolder = $folder.getExpandoBridge().getAttribute($folderFieldKey, false)) 
196                #if(!$localizedFolder.get($locale).isEmpty() && !$localizedFolder.isEmpty() && !$folders.contains($localizedFolder)) 
197                    #set($temp = $folders.add($localizedFolder)) 
198                #else 
199                    #if(!$folders.contains($folder.name) && (($localizedFolder.get($locale).isEmpty() || $localizedFolder.isEmpty()))) 
200                        #set($temp = $folders.add($folder.name)) 
201                    #end 
202                #end 
203            #end 
204            ##tabs 
205            <ul class="opux-tabs opux-tabs-responsive opux-tabs-dynamic" role="tablist"> 
206                #foreach ($f in $folders) 
207                    #if ($f.toString().contains($locale.toString())) 
208                        <li class="opux-tabs-item #if($velocityCount == 0)opux-is-active#end"><a href="#tab_$velocityCount">$f.get($locale)</a></li> 
209                    #else 
210                        <li class="opux-tabs-item #if($velocityCount == 0)opux-is-active#end"><a href="#tab_$velocityCount">$f</a></li> 
211                    #end 
212                #end 
213            </ul> 
214 
215            ##loader 
216            <div id="imagebank-loader"> 
217                <div class="opux-loading"></div> 
218            </div> 
219 
220            ##tab containers 
221            <div class="opux-tabs-container imagebank-tabs-container" style="visibility: hidden;"> 
222                #foreach ($f in $folders) 
223                    <div class="opux-tabs-content op-imagebank-tab-content" id="tab_$velocityCount"> 
224                    #set($finalFolderName="") 
225                    #if ($f.toString().contains($locale.toString())) 
226                        #set($finalFolderName = $f.get($locale)) 
227                    #else 
228                        #set($finalFolderName = $f) 
229                    #end 
230                    #renderTabContentOFINAYT224($finalFolderName $velocityCount) 
231                    </div> 
232                #end 
233            </div> 
234 
235            ##modal template for showing big image 
236            <div id="imagebank-modal" class="opux-is-hidden" aria-hidden="true"> 
237                <div class="opux-modal-header imagebank-modal-header"></div> 
238                <div class="opux-modal-body imagebank-modal-body"></div> 
239                <div class="opux-modal-footer imagebank-modal-footer"></div> 
240            </div> 
241        </div> 
242    </div> 
243#end 
244 
245## require and init imagebank 
246<script type="text/javascript"> 
247    require(['jquery', 'imagebank'], function ($, imagebank) { 
248        $(document).ready(function() { 
249            imagebank.init(); 
250        }); 
251    }); 
252</script> 
In addition to letters and digits, you can use only a space character and character -.

Go to top of page

Customer service
Give us feedback
Use of cookies
Service charges
Call charges
Electronic signature service
Become OP's customer
Secure transactions
Use of online service
OP Media OP Koti (in Finnish) Pohjola Claim Help
facebook linkedin instagram
© OP Pohjola BIC: OKOYFIHH
Data protection Accessibility Terms of use Terms and conditions