Tiskové zprávy 2018

Při zpracování šablony došlo k chybě.
Java method "com.liferay.portal.json.JSONFactoryImpl.createJSONObject(String)" threw an exception when invoked on com.liferay.portal.json.JSONFactoryImpl object "com.liferay.portal.json.JSONFactoryImpl@d09167d"; see cause exception in the Java stack trace.

----
FTL stack trace ("~" means nesting-related):
	- Failed at: imageUUID = jsonFactoryUtil.createJSO...  [in template "20115#20151#545461" at line 84, column 41]
----
1<style> 
2.asseco-theme.body__wrapper a.list-type-switch-item { 
3    text-decoration: none;      
4
5</style> 
6 
7<#assign 
8    LayoutLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService") 
9     
10    baseUrl = themeDisplay.getPathFriendlyURLPublic() + themeDisplay.getScopeGroup().getFriendlyURL() 
11    layoutUrl = layout.getFriendlyURL(locale) 
12 
13    layouts = LayoutLocalService.getLayouts(themeDisplay.getScopeGroupId(), false, layout.getLayoutId()) 
14/> 
15 
16<#if layoutUrl == "/tiskove-zpravy-mpsv"> 
17    <div class="box__inner"> 
18        <div class="row"> 
19            <div class="col-xs-12 col-sm-7 col-md-6"> 
20    	        <h1 class="before-perex">Tiskové zprávy</h1> 
21	        </div> 
22            <div class="col-xs-12 col-sm-5 col-md-6 mt-a-5"> 
23		        <div class="dropdown-label">Filtrování dle roku</div> 
24		        <div class="dropdown"> 
25		            <button class="dropdown__selected" title="Dropdown" aria-haspopup="true" aria-expanded="true" tabindex="0"> 
26                        <span>Vyberte ze seznamu...</span> 
27                    </button> 
28		            <ul class="dropdown__menu" role="menu" aria-hidden="false"> 
29                        <#list layouts as layout> 
30                            <#assign 
31                                layoutUrl = layout.getFriendlyURL(locale) 
32                                layoutName = layout.getName(locale) 
33                            /> 
34                            <li class="dropdown__item" role="presentation"> 
35                                <a href="${baseUrl}${layoutUrl}" class="dropdown__link" role="menuitem" title="${layoutName}"> 
36                                    <span>${layoutName}</span> 
37                                </a> 
38                            </li> 
39                        </#list> 
40		            </ul> 
41	            </div> 
42	        </div> 
43        </div> 
44    </div> 
45    <hr> 
46</#if> 
47<div class="box__block news-block"> 
48    <div class="row"> 
49        <div class="col-xs-12"> 
50            <div class="list-type-switch"> 
51			    <a href="javascript:changeToDlazdice()" id="dlazdice-link" class="list-type-switch-item active" aria-label="Dlaždice"> 
52			        <span class="mpsv-icons-view-module"></span> 
53			    </a> 
54		        <a href="javascript:changeToSeznam()" id="seznam-link" class="list-type-switch-item" aria-label="Seznam"> 
55		            <span class="mpsv-icons-view-list"></span> 
56		        </a> 
57			</div> 
58            <div id="tiskove-zpravy" class="list__wrapper items-tiles"> 
59                <#if entries?has_content> 
60                    <div class="list news-list"> 
61				        <#list entries as curEntry> 
62                     
63                            <#if curEntry.getAssetRenderer()??> 
64                     
65	                            <#assign  
66	                                renderer = curEntry.getAssetRenderer() 
67	                                journalArticle = renderer.getArticle() 
68	                                link = renderer.getURLViewInContext(renderRequest, renderResponse, '') 
69	                     
70	                                title = curEntry.getTitle(locale) 
71	                             
72	                                summary =  journalArticle.getDescription(locale) 
73	                             
74                                    doc = saxReaderUtil.read(journalArticle.getContent()) 
75                                    obrazek = doc.valueOf("//dynamic-element[@name='obrazek']/dynamic-content/text()") 
76                                     
77                                    obrazekUrl = '' 
78                                /> 
79                                 
80                                <#if !obrazek?has_content> 
81                                    <#assign obrazekUrl = "/documents/20142/511219/logo_OK.png/59f031fe-9840-0440-07a3-cc4f13145331" /> 
82                                <#else> 
83                                    <#assign  
84                                        imageUUID = jsonFactoryUtil.createJSONObject(obrazek).getString("uuid")  
85                                        siteId =  themeDisplay.getSiteGroupId() 
86                                        obrazekUrl = "/documents/${siteId}/${imageUUID}" /> 
87                                </#if> 
88                                 
89                                <#if !summary?has_content> 
90                                    <#assign  
91                                        summary =  doc.valueOf("//dynamic-element[@name='obsah']/dynamic-content/text()")?replace('<\\/?[^p\\/].*?>', '', 'r') 
92                                        res = summary?matches("<.*?>(.*)</.*?>") 
93                                    /> 
94                                    <#if res?size gt 0> 
95                                        <#list 1 .. res?size as x> 
96                                            <#assign text = res[(x-1)]?groups[1] /> 
97                                            <#if text?has_content && text != "&nbsp;"> 
98                                                <#assign summary = text /> 
99                                                <#break> 
100                                            </#if> 
101                                        </#list> 
102                                    </#if> 
103                                </#if> 
104                         
105	                            <a href="${link}" class="list__item" aria-label="${title}"> 
106    							    <div class="list__item-holder" role="article"> 
107								        <#if obrazek?has_content> 
108										    <div class="list__image"> 
109										        <img alt="${title}" src="${obrazekUrl}"> 
110										    </div> 
111										</#if> 
112										<div class="tiles-content"> 
113										    <h3 class="list__title" >${stringUtil.shorten(title, 50)}</h3> 
114										    <p class="list__text" >${stringUtil.shorten(summary, 180)}</p> 
115										</div> 
116										<div class="list-content hidden"> 
117    										<h3 class="list__title">${title}</h3> 
118    										 
119    										<p class="list__text">${summary}</p> 
120										</div> 
121										<div class="list__controls"> 
122											<span class="with-icon with-icon--smaller">Zjistit více</span> 
123										    <p class="list__place-date-time">${journalArticle.getDisplayDate()?string("d. M. yyyy")}</p> 
124										</div> 
125								    </div> 
126								</a> 
127							 
128						    </#if>	 
129							 
130                        </#list> 
131                    </div> 
132                </#if> 
133            </div> 
134        </div> 
135    </div> 
136</div> 
137 
138<script type="text/javascript"> 
139 
140  function changeToDlazdice() { 
141    $('#tiskove-zpravy').removeClass('items-list'); 
142    $('#tiskove-zpravy').addClass('items-tiles'); 
143    $('#seznam-link').removeClass('active'); 
144    $('#dlazdice-link').addClass('active'); 
145    $('.list__image').removeClass('hidden'); 
146    $('.tiles-content').removeClass('hidden'); 
147    $('.list-content').addClass('hidden'); 
148
149   
150  function changeToSeznam() { 
151    $('#tiskove-zpravy').removeClass('items-tiles'); 
152    $('#tiskove-zpravy').addClass('items-list'); 
153    $('#dlazdice-link').removeClass('active'); 
154    $('#seznam-link').addClass('active'); 
155    $('.list__image').addClass('hidden'); 
156    $('.tiles-content').addClass('hidden'); 
157    $('.list-content').removeClass('hidden'); 
158
159</script>