مباحث فقه ـ ثمار ـ جلسه 4 (1393/11/08) تکراری 1

حصل خطأ عند معالجة القالب.
The following has evaluated to null or missing:
==> assetDisplayPageFriendlyURLProvider.getFriendlyURL("com.liferay.journal.model.JournalArticle", currentArticleResourcePrimKey, themeDisplay)  [in template "20097#20123#100768" at line 32, column 24]

----
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 friendlyURL = assetDisplayPag...  [in template "20097#20123#100768" at line 32, column 1]
----
1<#-- Retrieve the published date meta data field of the web content --> 
2<#assign displaydate = .vars['reserved-article-display-date'].data> 
3<#-- Save the original page locale for later --> 
4<#assign originalLocale = .locale> 
5 
6<#-- Set the page locale to the portals default locale --> 
7<#setting locale = localeUtil.getDefault()> 
8 
9<#-- Parse the date to a date object --> 
10<#assign displaydate = displaydate?datetime("EEE, d MMM yyyy HH:mm:ss Z")> 
11 
12<#-- Set the page locale back to the original page locale --> 
13<#--#assign locale = ''--> 
14<#assign dateFormat = "dd MM yyyy" /> 
15<#assign publishDate=dateUtil.getDate(displaydate,dateFormat,locale)/> 
16 
17 
18<#assign liferay_ui = taglibLiferayHash["/META-INF/liferay-ui.tld"] /> 
19 
20<#assign JournalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService")> 
21<#assign assetLinkLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetLinkLocalService" )> 
22<#assign assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService" )> 
23<#assign getterUtil = staticUtil["com.liferay.portal.kernel.util.GetterUtil"] /> 
24<#assign currentArticle = JournalArticleLocalService.getArticle(getterUtil.getLong(groupId),.vars['reserved-article-id'].data)> 
25<#assign currentArticleResourcePrimKey = currentArticle.getResourcePrimKey()> 
26<#assign currentArticleAssetEntry = assetEntryLocalService.getEntry("com.liferay.journal.model.JournalArticle", currentArticleResourcePrimKey)/> 
27 
28<#assign viewCount = currentArticleAssetEntry.viewCount/> 
29 
30 
31<#assign assetDisplayPageFriendlyURLProvider = serviceLocator.findService("com.liferay.asset.display.page.portlet.AssetDisplayPageFriendlyURLProvider")> 
32<#assign friendlyURL = assetDisplayPageFriendlyURLProvider.getFriendlyURL("com.liferay.journal.model.JournalArticle", currentArticleResourcePrimKey, themeDisplay)/> 
33 
34 
35<div class="single"> 
36    <div class="islamic-background" style="background-image: url(${themeDisplay.getPathThemeImages()}/pattern1.png);background-repeat: repeat-x"></div> 
37 
38    <div class="container"> 
39        <#-- date and id--> 
40        <div class="d-flex justify-content-end"> 
41            <span class="single-date"> 
42                <span class="icon-datepicker single-date-datepicker-icon"></span> 
43                <span class="js-date" data-date="${publishDate} ?? DD MM YYYY ?? dddd DD MMMM YYYY">${publishDate}</span> 
44            </span> 
45 
46            <span class="single-id"> 
47                <span>${.vars['reserved-article-id'].data}</span> 
48                <span>شناسه:</span> 
49            </span> 
50        </div> 
51 
52        <#-- title --> 
53        <a class="single-title-wrapper" href="#"> 
54            <h2 class="single-title esra-heading-two"> 
55                ${.vars['reserved-article-title'].data} 
56            </h2> 
57        </a> 
58 
59 
60 
61        <#-- audio --> 
62        <#if (audio.getData())?? && audio.getData() != ""> 
63            <div class="col col-6 mt-4 mx-auto px-0 text-center"> 
64                <audio controls class="w-100"> 
65                    <source src="${audio.getData()}" type="audio/ogg"> 
66                    <source src="${audio.getData()}" type="audio/mpeg"> 
67                    No audio support. 
68                </audio> 
69                <a href="${audio.getData()}" class="app-skyblue-button">دانلود فایل صوتی</a> 
70            </div> 
71        </#if> 
72 
73 
74        <div class="single-content"> 
75            <div class="row"> 
76 
77                <#-- lead --> 
78                <#if (lead.getData())?? && lead.getData() != ""> 
79                    <div class="col col-12"> 
80                        <span class="lead">${lead.getData()}</span> 
81                    </div> 
82                </#if> 
83 
84 
85                <#if (content.getData())?? && content.getData() != ""> 
86                <#-- content --> 
87                    <div class="col col-12"> 
88                        <div class="single-content-section"> 
89                            <div class="single-content-section-paragraph-container"> 
90                                ${content.getData()} 
91                            </div> 
92                        </div> 
93                    </div> 
94                </#if> 
95 
96                <#-- image --> 
97                <#if (image.getData())?? && image.getData() != ""> 
98                    <div class="col col-12 mt-4"> 
99                        <img  src="${image.getData()}" alt="image"> 
100                    </div> 
101                </#if> 
102 
103                <#if (image_snapshot.getData())?? && image_snapshot.getData() != ""> 
104                    <#assign poster = image_snapshot.getData()/> 
105                <#else> 
106                    <#assign poster = themeDisplay.getPathThemeImages() + '/placeholder.jpg' /> 
107                </#if> 
108 
109                <#-- video  --> 
110                <div class="single-content-video-wrapper"> 
111                    <#if (video.getData())?? && video.getData() != ""> 
112                        <div> 
113                            <video class="single-content-video" poster="${poster}" preload="none"> 
114                                <source src="${video.getData()}" type="video/mp4"> 
115                                Your browser does not support the video tag. 
116                            </video> 
117                            <div class="single-content-video-overlay"> 
118                                <div class="single-content-play-video"> 
119                                    <img src="${themeDisplay.getPathThemeImages()}/play.png" alt=""> 
120                                </div> 
121                            </div> 
122 
123                        </div> 
124                        <a href="${video.getData()}" class="app-skyblue-button">دانلود فایل تصویری</a> 
125                    </#if> 
126                </div> 
127 
128 
129                <#if (gallary.getData())?? && gallary.getData() != ""> 
130 
131                    <div class="col col-12"> 
132                        <div class="content-gallery-container"> 
133 
134 
135                            <div class="content-gallery-title-container"> 
136                                <h2 class="esra-heading-two content-gallery-title"> 
137                                    سایر تصاویر 
138                                </h2> 
139                            </div> 
140 
141                            <div class="content-gallery splide splide-${themeDisplay.getPortletDisplay().getId()}"> 
142 
143                                <div class="splide__track"> 
144                                    <ul class="splide__list"> 
145                                        <#list gallary.getSiblings() as cur_gallary> 
146                                            <#if (cur_gallary.getData())?? && cur_gallary.getData() != ""> 
147                                                <li class="splide__slide"> 
148                                                    <a href="${cur_gallary.getData()}"> 
149                                                        <div class="content-gallery-item"> 
150                                                            <div class="content-gallery-item-image-container"> 
151                                                                <img class="content-gallery-item-image" alt="${cur_gallary.getAttribute("alt")}" src="${cur_gallary.getData()}"/> 
152                                                            </div> 
153                                                        </div> 
154                                                    </a> 
155                                                </li> 
156                                            </#if> 
157                                        </#list> 
158                                    </ul> 
159                                </div> 
160                            </div> 
161                        </div> 
162                    </div> 
163                </#if> 
164 
165 
166                <div class="col col-12"> 
167                    <div class="single-content-footnote"> 
168                        <div class="single-content-print"> 
169                            <span class="icon-printer single-view-icon"></span> 
170                        </div> 
171                        <div class="single-content-share"> 
172                            <div class="share"> 
173                                <span class="app-icon icon-share"></span> 
174                                <div class="share-methods"> 
175                                    <div class="whatsapp"> 
176                                        <span class="app-icon icon-whatsapp"></span> 
177                                    </div> 
178                                    <div class="telegram"> 
179                                        <span class="app-icon icon-telegram"></span> 
180                                    </div> 
181                                    <div class="twitter"> 
182                                        <span class="app-icon icon-twiiter"></span> 
183                                    </div> 
184                                </div> 
185 
186                            </div> 
187							 
188 
189 
190                        </div> 
191						<div class="short-link">لینک کوتاه:  
192							<input type="text" value="${friendlyURL}" id="myInput"  disabled> 
193							<button onclick="myFunction()" class="app-link-button px-0">کپی</button> 
194						</div>	 
195                    </div> 
196				 
197							 
198						 
199						<script> 
200							function myFunction() { 
201							  // Get the text field 
202							  var copyText = document.getElementById("myInput"); 
203 
204							  copyText.select(); 
205							  copyText.setSelectionRange(0, 99999); // For mobile devices 
206 
207							  navigator.clipboard.writeText(copyText.value); 
208							   
209 
210
211						</script> 
212				 
213					 
214                </div> 
215 
216 
217 
218            </div> 
219        </div> 
220    </div> 
221</div> 
222 
223 
224<style> 
225 
226    body { 
227        margin: 0; 
228        padding: 0; 
229 
230
231 
232	.app-link-button { 
233	background: #dde7ea; 
234		border-radius: 7px; 
235		border: 2px solid #00bceb; 
236		font-family: IRANSans; 
237		font-style: normal; 
238		font-weight: 500; 
239		font-size: 15px; 
240		text-align: center; 
241		padding: 4px 26px; 
242		min-width: 50px; 
243		color: #00bceb; 
244		transition: 300ms; 
245		height: 32px; 
246		line-height: 1rem; 
247
248 
249	.short-link { 
250		padding: 7px 0; 
251		display: flex; 
252		right: 150px; 
253		position: absolute; 
254		top: 50%; 
255		transform: translateY(-50%); 
256		line-height: 2.5rem; 
257
258 
259	input#myInput { 
260		font-size: 12px; 
261		width: 240px; 
262		height: 34px; 
263		direction: ltr; 
264		color: #00bceb; 
265		margin: 0 7px; 
266
267 
268 
269@media only screen and (max-width: 768px) 
270
271 
272.short-link { 
273	padding: 7px 0; 
274    display: flex; 
275    right: 0; 
276    position: absolute; 
277    top: 85%; 
278    transform: translateY(-50%); 
279    line-height: 2.5rem; 
280    width: 100%; 
281
282
283    a:hover { 
284        text-decoration: none; 
285
286	 
287	a.app-skyblue-button { 
288		color: white !important; 
289
290	 
291    .single-title-wrapper { 
292        display: block; 
293        padding: 60px 0 20px 0; 
294
295 
296    .single-title { 
297        -webkit-line-clamp: 2 !important; 
298        margin: 0; 
299        padding: 0; 
300		text-align: center; 
301		font-size: 24px; 
302
303 
304	strong { 
305		font-weight: 600; 
306		color: #076f89; 
307
308 
309    .single-date, .single-id { 
310        font-style: normal; 
311        font-weight: normal; 
312        font-size: 12px; 
313        color: #0D274D; 
314        display: block; 
315        text-align: left; 
316
317 
318    .single-id { 
319        display: flex; 
320        flex-direction: row-reverse; 
321        align-items: center; 
322        margin-right: 10px; 
323
324 
325    .single-date-datepicker-icon, .single-id-icon { 
326        vertical-align: middle; 
327
328 
329    .single-id-icon { 
330        margin: 0 2px; 
331
332 
333 
334    .single-thumbnail { 
335        border-radius: 8px; 
336        overflow: hidden; 
337        box-shadow: 0 5px 15px 0 #00000026; 
338        margin: 20px 0; 
339        width: 100%; 
340        max-height: 565px; 
341
342 
343    .single-thumbnail-image { 
344        width: 100%; 
345        height: 100%; 
346        object-fit: cover; 
347        object-position: center; 
348
349 
350    .single-view { 
351        font-style: normal; 
352        font-weight: normal; 
353        font-size: 12px; 
354        color: #0D274D; 
355        text-align: left; 
356
357 
358    html.ltr .single-view { 
359        direction: rtl; 
360
361 
362    html.rtl .single-view { 
363        direction: ltr; 
364
365 
366    .single-content { 
367        width: 100%; 
368
369 
370    .lead { 
371        color: #0d274d; 
372        font-weight: bold; 
373        margin: 21px 0 0 0; 
374        display: block; 
375
376 
377    .single-content-section { 
378        width: 100%; 
379        text-align: justify; 
380        margin-top: 30px; 
381
382 
383    .single-content-section p { 
384        margin: 0; 
385        font-style: normal; 
386        font-weight: normal; 
387        font-size: 18px; 
388        line-height: 36px; 
389        /* or 200% */ 
390        color: #6A6969; 
391
392 
393 
394    .single-content-section img { 
395        border-radius: 8px; 
396        overflow: hidden; 
397
398 
399    .single-content-video-wrapper { 
400		width: 100%; 
401		height: 100%; 
402		/* height: auto; */ 
403		max-width: 768px; 
404		text-align: center; 
405		margin: auto; 
406
407 
408    .single-content-video-wrapper > div { 
409        position: relative; 
410        width: 100%; 
411        height: 100%; 
412        border-radius: 20px; 
413        overflow: hidden; 
414
415 
416    .single-content-video { 
417        width: 100%; 
418        height: 100%; 
419        padding: 0; 
420        margin: 0; 
421        object-fit: cover; 
422
423 
424    .single-content-video-overlay { 
425        width: 100%; 
426        height: 100%; 
427        position: absolute; 
428        left: 0; 
429        top: 0; 
430        background: rgba(0, 0, 0, .7); 
431        z-index: 2; 
432        display: flex; 
433        align-items: center; 
434        justify-content: center; 
435
436 
437    .single-content-play-video { 
438        width: 90px; 
439        height: 90px; 
440
441 
442    .single-content-play-video img { 
443        width: 100%; 
444        height: 100%; 
445        border: 5px solid #ffffff; 
446        border-radius: 100%; 
447        cursor: pointer; 
448
449 
450 
451    .single-content-footnote { 
452        width: 100%; 
453        display: flex; 
454        align-items: center; 
455        justify-content: space-between; 
456        flex-direction: row; 
457        padding: 45px 0 60px 0; 
458		margin:0 0 20px 0; 
459        position: relative; 
460
461 
462    .single-content-print { 
463        font-size: 30px; 
464        position: absolute; 
465        left: 0; 
466        top: 50%; 
467        transform: translateY(-50%); 
468        color: #00BCEB; 
469        cursor: pointer; 
470        display: flex; 
471        align-items: center; 
472        justify-content: center; 
473
474 
475    .single-content-share { 
476        width: 143px; 
477        height: 35px; 
478        position: absolute; 
479        right: 0; 
480        top: 50%; 
481        transform: translateY(-50%); 
482
483 
484    .single-content-share .share .share-methods { 
485        display: flex; 
486        font-size: 21px; 
487        color: #00BCEB; 
488        cursor: pointer; 
489        justify-content: space-between; 
490        align-items: center; 
491        width: 120px; 
492        height: 100%; 
493        border: 2px solid #00BCEB; 
494        padding: 3px 10px; 
495        border-radius: 10px; 
496        background: #dde7ea; 
497
498 
499    .single-content-share .share .share-methods > div { 
500        display: flex; 
501        align-items: center; 
502        justify-content: center; 
503
504 
505 
506    .single-content-created-at b { 
507        font-style: normal; 
508        font-weight: bold; 
509        font-size: 18px; 
510 
511        color: #00BCEB; 
512
513 
514    .single-content-created-at { 
515        font-size: 16px; 
516        color: #0D274D; 
517
518 
519    .single-content-created-at:before { 
520        content: 'نوشته شده'; 
521        font-size: 18px; 
522        font-weight: 700; 
523        color: #00BCEB; 
524
525 
526    .content-horizontal-line { 
527        margin-bottom: 0; 
528        margin-top: 80px; 
529
530 
531 
532    .content-gallery-title-container { 
533        margin: 45px 0; 
534
535 
536    .content-gallery-title { 
537        font-size: 28px; 
538
539 
540    .content-gallery-item { 
541        width: 100%; 
542
543 
544    .content-gallery-item-image-container { 
545        width: 100%; 
546        height: 220px; 
547        border-radius: 8px; 
548        overflow: hidden; 
549
550 
551    .content-gallery-item-image { 
552        width: 100%; 
553        height: 100%; 
554        object-fit: cover; 
555        object-position: center; 
556
557 
558 
559    .content-gallery .splide__pagination { 
560        display: none; 
561
562 
563 
564    .content-gallery button.splide__arrow { 
565        background: #00BCEB; 
566        transform: translateY(-50%) scale(.8); 
567
568 
569    .content-gallery button.splide__arrow svg { 
570        fill: white; 
571
572 
573    html.ltr .content-gallery .splide__arrow--prev { 
574        left: -16px; 
575
576 
577    html.ltr .content-gallery .splide__arrow--next { 
578        right: -16px; 
579
580 
581    html.rtl .content-gallery .splide__arrow--prev { 
582        left: unset; 
583        right: -16px; 
584
585 
586    html.rtl .content-gallery .splide__arrow--next { 
587        right: unset; 
588        left: -16px; 
589
590 
591 
592    @media only screen and (max-width: 768px) { 
593 
594        .single-title { 
595            font-size: 20px; 
596            font-weight: 700; 
597            line-height: 32px; 
598
599 
600        .single-title-wrapper { 
601            padding: 40px 0 15px 0; 
602
603 
604 
605        .single-thumbnail { 
606            margin: 10px 0; 
607            max-height: 328px; 
608
609 
610        .single-content-section p { 
611            font-size: 14px; 
612            font-weight: 400; 
613            line-height: 28px; 
614            letter-spacing: 0; 
615
616 
617        .content-gallery-title-container { 
618            margin: 25px 0; 
619
620 
621        .content-gallery-item-image-container { 
622            max-height: 200px; 
623
624 
625        .content-horizontal-line { 
626            margin-top: 55px; 
627
628 
629 
630 
631        .single-content-created-at { 
632            font-size: 15px; 
633            font-weight: 400; 
634
635 
636        .single-content-created-at:before { 
637            font-size: 16px; 
638
639 
640        .single-content-print { 
641            display: none; 
642
643 
644
645 
646 
647    @media only screen and (max-width: 576px) { 
648 
649        .single-title-wrapper { 
650            padding: 20px 0; 
651
652 
653        .single-title { 
654            font-size: 16px; 
655            font-weight: 700; 
656            line-height: 27px; 
657            letter-spacing: -0.03em; 
658            text-align: center; 
659
660 
661 
662        .content-gallery-title-container { 
663            margin: 40px 0 20px 0; 
664
665 
666 
667        .single-content-created-at { 
668            font-size: 10px; 
669            font-weight: 400; 
670
671 
672        .single-content-created-at:before { 
673            font-size: 10px; 
674            font-weight: 700; 
675            letter-spacing: 0; 
676
677 
678        .content-horizontal-line { 
679            margin-top: 35px; 
680
681 
682 
683 
684
685 
686 
687    @media print { 
688        nav { 
689            display: none; 
690
691 
692        .single-title-wrapper { 
693            text-decoration: none !important; 
694
695 
696        .content-gallery-container { 
697            display: none; 
698
699 
700        .parent-portlet-page-comments { 
701            display: none; 
702
703 
704        .related-news { 
705            display: none; 
706
707 
708        footer { 
709            display: none; 
710
711 
712 
713
714 
715</style> 
716 
717<script> 
718 
719    const gallery = document.querySelector(".splide-${themeDisplay.getPortletDisplay().getId()}"); 
720 
721    if (typeof (gallery) != 'undefined' && gallery != null) { 
722 
723        new Splide(".splide-${themeDisplay.getPortletDisplay().getId()}", { 
724            direction: document.getElementsByTagName("html")[0].getAttribute("dir"), 
725            perPage: 3, 
726            gap: 25, 
727            breakpoints: { 
728                992: { 
729                    perPage: 2, 
730                }, 
731                576: { 
732                    perPage: 1, 
733                }, 
734
735        }).mount(); 
736 
737
738 
739    const printIcon = document.querySelector('.single-content-print') || null; 
740 
741    if (typeof (printIcon) != 'undefined' && printIcon != null) { 
742 
743        printIcon.addEventListener('click', () => { 
744            window.print() 
745        }) 
746
747 
748 
749    share(); 
750 
751    function share() { 
752        const title = document.querySelector('title').innerText.trim(); 
753        const url = window.location.href.trim(); 
754        const content = title + " --- " + url; 
755 
756        const icons = document.querySelectorAll('.share-methods .app-icon'); 
757 
758        let link; 
759 
760        icons.forEach((icon) => { 
761            icon.addEventListener(('click'), (e) => { 
762                var target = e.target; 
763                var classList = target.classList; 
764                console.log(classList, classList.contains('icon-twiiter')); 
765                if (classList.contains('icon-twiiter')) { 
766                    const prefix = "https://twitter.com/intent/tweet?text="; 
767                    link = prefix + content; 
768
769                if (classList.contains('icon-telegram')) { 
770                    const prefix = "https://telegram.me/share/url?url="; 
771                    link = prefix + content; 
772
773                if (classList.contains('icon-whatsapp')) { 
774                    const prefix = "whatsapp://send?text="; 
775                    link = prefix + url; 
776
777                if (classList.contains('icon-link')) { 
778                    const prefix = ""; 
779                    link = url; 
780
781 
782                window.open(link, '_blank', 'toolbar=0,location=0,menubar=0'); 
783 
784            }) 
785        }) 
786 
787 
788
789 
790 
791    playVideo(); 
792 
793    function playVideo() { 
794 
795        const playButton = document.querySelector('.single-content-play-video') || null; 
796 
797        if (typeof (playButton) != 'undefined' && playButton != null) { 
798            playButton.addEventListener('click', () => { 
799 
800 
801                var container = document.querySelector('.single-content-video-wrapper'); 
802                var video = container.querySelector(".single-content-video"); 
803                var overlay = container.querySelector(".single-content-video-overlay"); 
804 
805                video.play(); 
806                video.setAttribute('controls', 'controls'); 
807                video.style.objectFit = 'cover'; 
808                overlay.style.display = 'none'; 
809 
810            }) 
811
812 
813
814 
815 
816</script>