Documents
Documents
View documents
Below is an overview of all documents that are linked to the active subscriptions belonging to your organization and / or your account.
CLM Customer Contacts
Asset Publisher
An error occurred while processing the template.
The following has evaluated to null or missing:
==> download.isShareLink [in template "10131#10164#7494021" at line 30, column 36]
----
Tip: It's the step after the last dot that caused this error, not those before it.
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #assign isShareLink = download.isShar... [in template "10131#10164#7494021" at line 30, column 13]
----
1<!--container-->
2<#assign parserUtils = serviceLocator.findService("nl.deltares.portal.utils.DsdParserUtils") />
3<#assign downloadUtils = serviceLocator.findService("nl.deltares.portal.utils.DownloadUtils") />
4
5<#assign baseUrl = "/o/download" />
6<#assign buttonText = languageUtil.get(locale, "download.download")/>
7<#assign showButtons = themeDisplay.isSignedIn() />
8<#if entries?has_content>
9
10 <div id="messageBox" />
11 <#if showButtons>
12 <#if is_sanctioned?? && is_sanctioned >
13 <#assign showButtons = false />
14 <div class="lfr-status-alert-label" >${languageUtil.get(locale, "download.restriction.country")} ${sanctionCountry}
15 </div>
16 </#if>
17 <#else>
18 <div class="lfr-status-info-label" >
19 <div id="login_link"> </div>
20 </div>
21 </#if>
22
23 <ul class="c-downloads-list clear-list">
24 <#list entries as entry>
25 <#assign assetRenderer = entry.getAssetRenderer() />
26 <#assign journalArticle = assetRenderer.getArticle() />
27 <#assign download = parserUtils.toDsdArticle(journalArticle, locale) />
28
29 <#assign multipleDownloadUrls = downloadUtils.hasMultipleDownloadUrls() />
30 <#assign isShareLink = download.isShareLink() />
31 <li class="list-group-item list-group-item-flex">
32 <div class="col-12 px-3">
33 <h4>
34 <strong>${download.getFileName()}</strong>
35 </h4>
36 <div>
37 ${download.getFileTopicName()} | ${download.getFileTypeName()} | ${download.getFileSize()}
38
39 <#if showButtons >
40 <#assign directDownload = download.isDirectDownload() />
41 <#if directDownload >
42 <br>
43 <br>
44 <strong>Select the download region closest to your location.</strong>
45 </#if>
46 <span class="d-block" style="float:right; margin-top:-1.5em;">
47
48
49 <#if directDownload >
50 <#assign fileName = download.getFileName() />
51 <#assign filePath = download.getFilePath() />
52 <#assign articleId = journalArticle.getArticleId() />
53 <span class="d-block" style="float:right">
54 <#if multipleDownloadUrls && !isShareLink >
55 <div class="dropdown">
56 <button class="dropbtn">${buttonText}</button>
57 <div class="dropdown-content">
58 <#assign countryCodes = downloadUtils.getDownloadServerCountryCodes() >
59 <#list countryCodes as countryCode >
60 <#if countryCode=="de" >
61 <#assign countryName = "europe" />
62 <#else>
63 <#assign countryName = downloadUtils.getDownloadServerCountryName(countryCode) />
64 </#if>
65 <a href="#" onclick="processClickEvent(
66 '${baseUrl}', '${countryCode}', '${fileName}', '${filePath}', '${articleId}', '${themeDisplay.getScopeGroupId()}', false)"
67 class="btn-lg btn-primary"
68 role="button"
69 aria-pressed="true"
70 style="display:block; min-width:230px; text-align:left;">
71 server: ${countryName}
72 </a>
73 </#list>
74 </div>
75 </div>
76 <#else>
77 <a href="#" onclick="processClickEvent('${baseUrl}', '', '${fileName}', '${filePath}', '${articleId}', '${themeDisplay.getScopeGroupId()}', ${isShareLink?c})"
78 class="btn-lg btn-primary" role="button" aria-pressed="true">
79 ${buttonText}
80 </a>
81 </#if>
82 </span>
83 <#else>
84 <a href="#" data-article-id="${download.getArticleId()}"
85 class="btn-lg btn-primary add-download-to-cart"
86 role="button" aria-pressed="true" style="color:#fff" >
87 ${languageUtil.get(locale, "shopping.cart.add")}
88 </a>
89 </#if>
90
91 </span>
92 </#if>
93 </div>
94 </div>
95 </li>
96 </#list>
97 </ul>
98</#if>
99
100<script>
101
102 function processClickEvent(baseUrl, countryCode, fileName, filePath, articleId, groupId, isShareLink){
103 logStarted(fileName);
104 if (isShareLink){
105 downloadFile(filePath, fileName)
106 registerClick(baseUrl, fileName, filePath, articleId, groupId);
107 } else {
108 createShareLink(baseUrl, countryCode, fileName, filePath, articleId, groupId);
109 }
110 }
111 function createShareLink(baseUrl, countryCode, fileName, filePath, articleId, groupId){
112
113 shareLinkUrl = baseUrl + "/createShareLink/"
114
115 let pAuth = Liferay.authToken;
116 fetch(shareLinkUrl + '?p_auth=' + pAuth,
117 {
118 method: "POST",
119 headers: {
120 'Content-Type': 'application/json'
121 },
122 body: JSON.stringify({
123 fileName : fileName,
124 filePath : filePath,
125 downloadId: articleId,
126 groupId: groupId,
127 countryCode: countryCode
128 })
129 }).then( response => {
130 const contentType = response.headers.get('content-type');
131 if (contentType && contentType.includes('application/json')) {
132 return response.json();
133 } else {
134 throw new Error(response.status + ':' + response.statusText)
135 }
136 })
137 .then(data => {
138 if (data.errorMessage){
139 logError(fileName, data.errorMessage)
140 } else {
141 downloadFile(data.url, fileName);
142 logSuccess(fileName)
143 }
144 }).catch(error => {
145 logError(fileName, error);
146 });
147 }
148
149 function registerClick(baseUrl, fileName, shareLink, articleId, groupId){
150 let pAuth = Liferay.authToken;
151
152 registerUrl = baseUrl + "/register/"
153 fetch(registerUrl + '?p_auth=' + pAuth, {
154 method: "POST",
155 headers: {
156 'Content-Type': 'application/json'
157 },
158 data: JSON.stringify({
159 fileName: fileName,
160 fileShare: shareLink,
161 downloadId: articleId,
162 groupId: groupId
163 })
164 }).then( response => {
165 if (!response.ok) logError(fileName);
166 }).catch(error => {
167 logError(fileName, error);
168 });
169
170 }
171
172 function logStarted(fileName) {
173
174 let alertEl = document.getElementById("download-alert");
175 if (!alertEl) {
176 alertEl = document.createElement("div");
177 document.getElementById("messageBox").appendChild(alertEl);
178 alertEl.innerHTML =
179 '<div id="download-alert" class="alert alert-dismissible hidden" role="alert">' +
180 ' <button aria-label="Close" class="close" data-dismiss="alert" type="button">' +
181 ' <span id="download-alert-icon">' +
182 ' <svg aria-hidden="true" class="lexicon-icon lexicon-icon-times" focusable="false" viewBox="0 0 512 512">' +
183 ' <path class="lexicon-icon-outline" d="M301.1,256.1L502.3,54.9c30.1-30.1-16.8-73.6-45.2-45.2L255.9,210.8L54.6,9.7C24.6-20.4-19,26.5,9.4,54.9l201.2,201.2L9.3,457.3c-28.9,28.9,15.8,74.6,45.2,45.2l201.3-201.2l201.3,201.2c28.9,28.9,74.2-16.3,45.2-45.2L301.1,256.1z"></path>' +
184 ' </svg>' +
185 ' </span>' +
186 ' <span class="sr-only">Close</span>' +
187 ' </button>' +
188 ' <div id="download-alert-message" ></div>' +
189 '</div>';
190 }
191 alertEl.classList.replace("hidden", "alert-success");
192 let messageEl = document.getElementById("download-alert-message");
193 messageEl.innerHTML = "<strong class=\"lead\">Started download process for file:</strong><br/>" + fileName +
194 "<br/><p>A new tab with a link to the download will open shortly.</p>"
195 }
196
197 function downloadFile(url, fileName){
198 const aElement = document.createElement('a');
199 aElement.href = url;
200 aElement.style.display = 'none';
201 aElement.download = fileName;
202 aElement.target = '_blank';
203 document.body.appendChild(aElement);
204 aElement.click();
205 }
206
207 function logSuccess(fileName) {
208 let alertEl = document.getElementById("download-alert");
209 alertEl.classList.remove("hidden");
210 alertEl.classList.remove("alert-warning")
211 alertEl.classList.add("alert-success");
212 let messageEl = document.getElementById("download-alert-message");
213 messageEl.innerHTML = "<strong class=\"lead\">Finished download process for file:</strong><br/>" + fileName
214 }
215
216 function logError(fileName, error) {
217 let alertEl = document.getElementById("download-alert");
218 alertEl.classList.remove("hidden");
219 alertEl.classList.remove("alert-success")
220 alertEl.classList.add("alert-warning");
221 let messageEl = document.getElementById("download-alert-message");
222 messageEl.innerHTML = "<strong class=\"lead\">Error downloading file:</strong><br/>" + fileName + "<br/>Error: " + error
223
224 }
225
226 if (!Liferay.ThemeDisplay.isSignedIn()){
227
228 var homeUrl = Liferay.ThemeDisplay.getCDNHost();
229 var path = Liferay.ThemeDisplay.getLayoutRelativeURL();
230 var langPath = path.substring(0, path.lastIndexOf('/'));
231 if (langPath.includes('/web')){
232 langPath = langPath.substring(0, path.lastIndexOf('/web'));
233 }
234 document.getElementById('login_link').innerHTML =
235 "<b>You must log in before you can download software. </b><a href=" + homeUrl + langPath + "/c/portal/login >Click here to log in</a>"
236 }
237
238
239
240</script>