Landkarte
Fehler bei der Verarbeitung der Vorlage.
The FreeMarker value exists, but has nothing inside it; the TemplateModel object (class: freemarker.ext.beans.StringModel) has returned a null instead of a String. This is possibly a bug in the non-FreeMarker code that builds the data-model. The blamed expression: ==> featureCollectionJSONObject [in template "20100#20127#38990" at line 120, column 19] ---- FTL stack trace ("~" means nesting-related): - Failed at: @liferay_map["map-display"] name="Map... [in template "20100#20127#38990" at line 118, column 1] ----
1<#assign
2 group = themeDisplay.getScopeGroup()
3
4 mapsAPIProvider = group.getLiveParentTypeSettingsProperty("mapsAPIProvider")!""
5
6 companyPortletPreferences = prefsPropsUtil.getPreferences(companyId)
7/>
8
9<#if validator.isNull(mapsAPIProvider)>
10 <#assign mapsAPIProvider = companyPortletPreferences.getValue("mapsAPIProvider", "Google") />
11</#if>
12
13<#assign featureCollectionJSONObject = jsonFactoryUtil.createJSONObject() />
14
15<@liferay.silently featureCollectionJSONObject.put("type", "FeatureCollection") />
16
17<#assign featureJSONArray = jsonFactoryUtil.createJSONArray() />
18
19<#list entries as entry>
20 <#assign
21 assetRenderer = entry.getAssetRenderer()
22
23 ddmFormValuesReader = assetRenderer.getDDMFormValuesReader()
24
25 ddmFormFieldValues = ddmFormValuesReader.getDDMFormFieldValues("geolocation")
26
27 coordinatesJSONObjects = []
28 />
29
30 <#list ddmFormFieldValues as ddmFormFieldValue>
31 <#assign
32 value = ddmFormFieldValue.getValue()
33
34 coordinatesJSONObject = jsonFactoryUtil.createJSONObject(value.getString(locale))
35
36 coordinatesJSONObjects = coordinatesJSONObjects + [coordinatesJSONObject]
37 />
38 </#list>
39
40 <#list coordinatesJSONObjects as coordinatesJSONObject>
41 <#assign featureJSONObject = jsonFactoryUtil.createJSONObject() />
42
43 <@liferay.silently featureJSONObject.put("type", "Feature") />
44
45 <#assign geometryJSONObject = jsonFactoryUtil.createJSONObject() />
46
47 <@liferay.silently geometryJSONObject.put("type", "Point") />
48
49 <#assign coordinatesJSONArray = [coordinatesJSONObject.getDouble("lng"), coordinatesJSONObject.getDouble("lat")] />
50
51 <@liferay.silently geometryJSONObject.put("coordinates", coordinatesJSONArray) />
52
53 <@liferay.silently featureJSONObject.put("geometry", geometryJSONObject) />
54
55 <#assign propertiesJSONObject = jsonFactoryUtil.createJSONObject() />
56
57 <@liferay.silently propertiesJSONObject.put("title", assetRenderer.getTitle(locale)) />
58
59 <#assign entryAbstract>
60 <@getAbstract asset=entry />
61 </#assign>
62
63 <@liferay.silently propertiesJSONObject.put("abstract", entryAbstract) />
64
65 <#if stringUtil.equals(mapsAPIProvider, "Google")>
66 <#assign
67 images = {
68 "com.liferay.document.library.kernel.model.DLFileEntry": "${themeDisplay.getProtocol()}://maps.google.com/mapfiles/ms/icons/green-dot.png",
69 "com.liferay.portlet.dynamicdatalists.model.DDLRecord": "${themeDisplay.getProtocol()}://maps.google.com/mapfiles/ms/icons/red-dot.png",
70 "com.liferay.journal.model.JournalArticle": "${themeDisplay.getProtocol()}://maps.google.com/mapfiles/ms/icons/blue-dot.png",
71 "default": "${themeDisplay.getProtocol()}://maps.google.com/mapfiles/ms/icons/yellow-dot.png"
72 }
73 />
74
75 <#if images?keys?seq_contains(entry.getClassName())>
76 <@liferay.silently propertiesJSONObject.put("icon", images[entry.getClassName()]) />
77 <#else>
78 <@liferay.silently propertiesJSONObject.put("icon", images["default"]) />
79 </#if>
80 </#if>
81
82 <@liferay.silently featureJSONObject.put("properties", propertiesJSONObject) />
83
84 <@liferay.silently featureJSONArray.put(featureJSONObject) />
85 </#list>
86</#list>
87
88<@liferay.silently featureCollectionJSONObject.put("features", featureJSONArray) />
89
90<style type="text/css">
91 .asset-entry-abstract {
92 min-width: 400px;
93 }
94
95 .leaflet-popup .asset-entry-abstract {
96 display: inline-block;
97 }
98
99 .asset-entry-abstract .asset-entry-abstract-image {
100 display: block;
101 float: left;
102 height: 128px;
103 margin-right: 1em;
104 text-align: center;
105 }
106
107 .asset-entry-abstract .asset-entry-abstract-image img {
108 display: block;
109 margin: 0 auto;
110 max-height: 100%;
111 }
112
113 .asset-entry-abstract .taglib-icon {
114 float: right;
115 }
116</style>
117
118<@liferay_map["map-display"]
119 name='Map'
120 points="${featureCollectionJSONObject}"
121/>
122
123<@liferay_aui.script use="liferay-map-base">
124 Liferay.componentReady('<@portlet.namespace />Map').then(
125 function(map) {
126 map.on(
127 'featureClick',
128 function(event) {
129 var feature = event.feature;
130
131 map.openDialog(
132 {
133 content: feature.getProperty('abstract'),
134 marker: feature.getMarker(),
135 position: feature.getGeometry().get('location')
136 }
137 );
138 }
139 );
140 }
141 );
142</@liferay_aui.script>
143
144<#macro getAbstract asset>
145 <div class="asset-entry-abstract" id="<@portlet.namespace />assetEntryAbstract">
146 <#assign
147 showEditURL = paramUtil.getBoolean(renderRequest, "showEditURL", true)
148
149 assetRenderer = asset.getAssetRenderer()
150 />
151
152 <#if showEditURL && assetRenderer.hasEditPermission(permissionChecker)>
153 <#assign
154 editPortletURL = assetRenderer.getURLEdit(renderRequest, renderResponse, windowStateFactory.getWindowState("NORMAL"), themeDisplay.getURLCurrent())
155 />
156
157 <@liferay_ui.icon
158 image="edit"
159 label=true
160 message="edit"
161 url=editPortletURL.toString()
162 />
163 </#if>
164
165 <#if assetRenderer.getThumbnailPath(renderRequest)??>
166 <div class="asset-entry-abstract-image">
167 <img src="${assetRenderer.getThumbnailPath(renderRequest)}" />
168 </div>
169 </#if>
170
171 <#assign assetURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, assetRenderer, asset, !stringUtil.equals(assetLinkBehavior, "showFullContent")) />
172
173 <div class="asset-entry-abstract-content">
174 <h3><a href="${assetURL}">${assetRenderer.getTitle(locale)}</a></h3>
175
176 <div>
177 ${assetRenderer.getSummary(renderRequest, renderResponse)}
178 </div>
179 </div>
180
181 <div class="asset-entry-abstract-footer">
182 <a href="${assetURL}">${languageUtil.get(locale, "read-more")} »</a>
183 </div>
184 </div>
185</#macro>