source: trunk/themes/default/template/picture.tpl @ 13870

Last change on this file since 13870 was 13870, checked in by mistic100, 12 years ago

feature 2588: use jQuery() function instead of $(), avoiding possible conflicts with other frameworks

  • Property svn:eol-style set to LF
File size: 13.7 KB
Line 
1{* Example of resizeable
2{include file='include/autosize.inc.tpl'}
3*}
4{if isset($MENUBAR)}{$MENUBAR}{/if}
5<div id="content" {if isset($MENUBAR)}class="contentWithMenu"{/if}>
6{if isset($errors) or not empty($infos)}
7{include file='infos_errors.tpl'}
8{/if}
9{if !empty($PLUGIN_PICTURE_BEFORE)}{$PLUGIN_PICTURE_BEFORE}{/if}
10
11<div id="imageHeaderBar">
12        <div class="browsePath">
13                {$SECTION_TITLE}<span class="browsePathSeparator">{$LEVEL_SEPARATOR}</span><h2>{$current.TITLE}</h2>
14        </div>
15</div>
16
17<div id="imageToolBar">
18<div class="imageNumber">{$PHOTO}</div>
19{include file='picture_nav_buttons.tpl'|@get_extent:'picture_nav_buttons'}
20<div class="actionButtons">
21
22{if count($current.unique_derivatives)>1}
23{footer_script require='jquery'}{literal}
24function changeImgSrc(url,typeSave,typeMap)
25{
26        var theImg = document.getElementById("theMainImage");
27        if (theImg)
28        {
29                theImg.removeAttribute("width");theImg.removeAttribute("height");
30                theImg.src = url;
31                theImg.useMap = "#map"+typeMap;
32        }
33        jQuery('#derivativeSwitchBox .switchCheck').css('visibility','hidden');
34        jQuery('#derivativeChecked'+typeSave).css('visibility','visible');
35        document.cookie = 'picture_deriv='+typeSave+';path={/literal}{$COOKIE_PATH}{literal}';
36}
37
38jQuery("#derivativeSwitchLink").click(function() {
39        var elt = jQuery("#derivativeSwitchBox");
40        elt.css("left", Math.min( jQuery(this).offset().left, jQuery(window).width() - elt.outerWidth(true) - 5))
41                .css("top", jQuery(this).offset().top + jQuery(this).outerHeight(true))
42                .toggle();
43});
44jQuery("#derivativeSwitchBox").on("mouseleave click", function() {
45        jQuery(this).hide();
46});
47{/literal}{/footer_script}
48{strip}<a id="derivativeSwitchLink" title="{'Photo sizes'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
49  <span class="pwg-icon pwg-icon-sizes">&nbsp;</span><span class="pwg-button-text">{'Photo sizes'|@translate}</span>
50</a>
51<div id="derivativeSwitchBox" class="switchBox">
52  <div class="switchBoxTitle">{'Photo sizes'|@translate}</div>
53  {foreach from=$current.unique_derivatives item=derivative key=derivative_type}
54  <span class="switchCheck" id="derivativeChecked{$derivative_type}"{if $derivative->get_type() ne $current.selected_derivative->get_type()} style="visibility:hidden"{/if}>&#x2714; </span>
55  <a href="javascript:changeImgSrc('{$derivative->get_url()|@escape:javascript}','{$derivative_type}','{$derivative->get_type()}')">
56    {$derivative->get_type()|@translate}<span class="derivativeSizeDetails"> ({$derivative->get_size_hr()})</span>
57  </a><br>
58  {/foreach}
59  {if isset($U_ORIGINAL)}
60  <a href="javascript:phpWGOpenWindow('{$U_ORIGINAL}','xxx','scrollbars=yes,toolbar=no,status=no,resizable=yes')" rel="nofollow">{'Original'|@translate}</a>
61  {/if}
62</div>
63{/strip}
64{/if}
65
66{strip}{if isset($U_SLIDESHOW_START)}
67        <a href="{$U_SLIDESHOW_START}" title="{'slideshow'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
68                <span class="pwg-icon pwg-icon-slideshow"> </span><span class="pwg-button-text">{'slideshow'|@translate}</span>
69        </a>
70{/if}{/strip}
71{strip}{if isset($U_METADATA)}
72        <a href="{$U_METADATA}" title="{'Show file metadata'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
73                <span class="pwg-icon pwg-icon-camera-info"> </span><span class="pwg-button-text">{'Show file metadata'|@translate}</span>
74        </a>
75{/if}{/strip}
76{strip}{if isset($current.U_DOWNLOAD)}
77        <a href="{$current.U_DOWNLOAD}" title="{'Download this file'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
78                <span class="pwg-icon pwg-icon-save"> </span><span class="pwg-button-text">{'Download'|@translate}</span>
79        </a>
80{/if}{/strip}
81{if isset($PLUGIN_PICTURE_ACTIONS)}{$PLUGIN_PICTURE_ACTIONS}{/if}
82{strip}{if isset($favorite)}
83        <a href="{$favorite.U_FAVORITE}" title="{if $favorite.IS_FAVORITE}{'delete this photo from your favorites'|@translate}{else}{'add this photo to your favorites'|@translate}{/if}" class="pwg-state-default pwg-button" rel="nofollow">
84                <span class="pwg-icon pwg-icon-favorite-{if $favorite.IS_FAVORITE}del{else}add{/if}"> </span><span class="pwg-button-text">{'Favorites'|@translate}</span>
85        </a>
86{/if}{/strip}
87{strip}{if isset($U_SET_AS_REPRESENTATIVE)}
88        <a href="{$U_SET_AS_REPRESENTATIVE}" title="{'set as album representative'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
89                <span class="pwg-icon pwg-icon-representative"> </span><span class="pwg-button-text">{'representative'|@translate}</span>
90        </a>
91{/if}{/strip}
92{strip}{if isset($U_ADMIN)}
93        <a href="{$U_ADMIN}" title="{'Modify information'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
94                <span class="pwg-icon pwg-icon-edit"> </span><span class="pwg-button-text">{'Edit'|@translate}</span>
95        </a>
96{/if}{/strip}
97{strip}{if isset($U_CADDIE)}{*caddie management BEGIN*}
98{footer_script}
99{literal}function addToCadie(aElement, rootUrl, id)
100{
101if (aElement.disabled) return;
102aElement.disabled=true;
103var y = new PwgWS(rootUrl);
104y.callService(
105        "pwg.caddie.add", {image_id: id} ,
106        {
107                onFailure: function(num, text) { alert(num + " " + text); document.location=aElement.href; },
108                onSuccess: function(result) { aElement.disabled = false; }
109        }
110        );
111}{/literal}
112{/footer_script}
113        <a href="{$U_CADDIE}" onclick="addToCadie(this, '{$ROOT_URL}', {$current.id}); return false;" title="{'Add to caddie'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
114                <span class="pwg-icon pwg-icon-caddie-add"> </span><span class="pwg-button-text">{'Caddie'|@translate}</span>
115        </a>
116{/if}{/strip}{*caddie management END*}
117</div>
118</div>{*<!-- imageToolBar -->*}
119
120<div id="theImageAndInfos">
121<div id="theImage">
122{$ELEMENT_CONTENT}
123
124{if isset($COMMENT_IMG)}
125<p class="imageComment">{$COMMENT_IMG}</p>
126{/if}
127
128{if isset($U_SLIDESHOW_STOP)}
129<p>
130        [ <a href="{$U_SLIDESHOW_STOP}">{'stop the slideshow'|@translate}</a> ]
131</p>
132{/if}
133
134</div>{*<!-- no significant white space for elegant-->
135*}<div id="infoSwitcher"></div>{*<!-- no significant white space for elegant-->
136*}<div id="imageInfos">
137{if $DISPLAY_NAV_THUMB}
138        <div class="navThumbs">
139                {if isset($previous)}
140                        <a class="navThumb" id="linkPrev" href="{$previous.U_IMG}" title="{'Previous'|@translate} : {$previous.TITLE}" rel="prev">
141                                <span class="thumbHover prevThumbHover">&nbsp;</span>
142                                <img src="{$previous.derivatives.square->get_url()}" alt="{$previous.TITLE}">
143                        </a>
144                {/if}
145                {if isset($next)}
146                        <a class="navThumb" id="linkNext" href="{$next.U_IMG}" title="{'Next'|@translate} : {$next.TITLE}" rel="next">
147                                <span class="thumbHover nextThumbHover">&nbsp;</span>
148                                <img src="{$next.derivatives.square->get_url()}" alt="{$next.TITLE}">
149                        </a>
150                {/if}
151        </div>
152{/if}
153
154<dl id="standard" class="imageInfoTable">
155{strip}
156        {if $display_info.author and isset($INFO_AUTHOR)}
157        <div id="Author" class="imageInfo">
158                <dt>{'Author'|@translate}</dt>
159                <dd>{$INFO_AUTHOR}</dd>
160        </div>
161        {/if}
162        {if $display_info.created_on and isset($INFO_CREATION_DATE)}
163        <div id="datecreate" class="imageInfo">
164                <dt>{'Created on'|@translate}</dt>
165                <dd>{$INFO_CREATION_DATE}</dd>
166        </div>
167        {/if}
168        {if $display_info.posted_on}
169        <div id="datepost" class="imageInfo">
170                <dt>{'Posted on'|@translate}</dt>
171                <dd>{$INFO_POSTED_DATE}</dd>
172        </div>
173        {/if}
174        {if $display_info.dimensions and isset($INFO_DIMENSIONS)}
175        <div id="Dimensions" class="imageInfo">
176                <dt>{'Dimensions'|@translate}</dt>
177                <dd>{$INFO_DIMENSIONS}</dd>
178        </div>
179        {/if}
180        {if $display_info.file}
181        <div id="File" class="imageInfo">
182                <dt>{'File'|@translate}</dt>
183                <dd>{$INFO_FILE}</dd>
184        </div>
185        {/if}
186        {if $display_info.filesize and isset($INFO_FILESIZE)}
187        <div id="Filesize" class="imageInfo">
188                <dt>{'Filesize'|@translate}</dt>
189                <dd>{$INFO_FILESIZE}</dd>
190        </div>
191        {/if}
192        {if $display_info.tags and isset($related_tags)}
193        <div id="Tags" class="imageInfo">
194                <dt>{'Tags'|@translate}</dt>
195                <dd>
196                {foreach from=$related_tags item=tag name=tag_loop}{if !$smarty.foreach.tag_loop.first}, {/if}<a href="{$tag.URL}">{$tag.name}</a>{/foreach}
197                </dd>
198        </div>
199        {/if}
200        {if $display_info.categories and isset($related_categories)}
201        <div id="Categories" class="imageInfo">
202                <dt>{'Albums'|@translate}</dt>
203                <dd>
204                        <ul>
205                                {foreach from=$related_categories item=cat}
206                                <li>{$cat}</li>
207                                {/foreach}
208                        </ul>
209                </dd>
210        </div>
211        {/if}
212        {if $display_info.visits}
213        <div id="Visits" class="imageInfo">
214                <dt>{'Visits'|@translate}</dt>
215                <dd>{$INFO_VISITS}</dd>
216        </div>
217        {/if}
218
219{if $display_info.rating_score and isset($rate_summary)}
220        <div id="Average" class="imageInfo">
221                <dt>{'Rating score'|@translate}</dt>
222                <dd>
223                {if $rate_summary.count}
224                        <span id="ratingScore">{$rate_summary.score}</span> <span id="ratingCount">({assign var='rate_text' value='%d rates'|@translate}{$pwg->sprintf($rate_text, $rate_summary.count)})</span>
225                {else}
226                        <span id="ratingScore">{'no rate'|@translate}</span> <span id="ratingCount"></span>
227                {/if}
228                </dd>
229        </div>
230{/if}
231
232{if isset($rating)}
233        <div id="rating" class="imageInfo">
234                <dt>
235                        <span id="updateRate">{if isset($rating.USER_RATE)}{'Update your rating'|@translate}{else}{'Rate this photo'|@translate}{/if}</span>
236                </dt>
237                <dd>
238                        <form action="{$rating.F_ACTION}" method="post" id="rateForm" style="margin:0;">
239                        <div>
240                        {foreach from=$rating.marks item=mark name=rate_loop}
241                        {if isset($rating.USER_RATE) && $mark==$rating.USER_RATE}
242                                <input type="button" name="rate" value="{$mark}" class="rateButtonSelected" title="{$mark}">
243                        {else}
244                                <input type="submit" name="rate" value="{$mark}" class="rateButton" title="{$mark}">
245                        {/if}
246                        {/foreach}
247                        {strip}{combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'}
248                        {combine_script id='rating' load='async' require='core.scripts' path='themes/default/js/rating.js'}
249                        {footer_script}
250                                var _pwgRatingAutoQueue = _pwgRatingAutoQueue||[];
251                                _pwgRatingAutoQueue.push( {ldelim}rootUrl: '{$ROOT_URL}', image_id: {$current.id},
252                                        onSuccess : function(rating) {ldelim}
253                                                var e = document.getElementById("updateRate");
254                                                if (e) e.innerHTML = "{'Update your rating'|@translate|@escape:'javascript'}";
255                                                e = document.getElementById("ratingScore");
256                                                if (e) e.innerHTML = rating.score;
257                                                e = document.getElementById("ratingCount");
258                                                if (e) e.innerHTML = "({'%d rates'|@translate|@escape:'javascript'})".replace( "%d", rating.count);
259                                        {rdelim}{rdelim} );
260                        {/footer_script}
261                        {/strip}
262                        </div>
263                        </form>
264                </dd>
265        </div>
266{/if}
267
268{if $display_info.privacy_level and isset($available_permission_levels)}
269        <div id="Privacy" class="imageInfo"><div class="relSwitchBox">
270                <dt><a id="privacyLevelLink" href="javascript:togglePrivacyLevelBox()">{'Who can see this photo?'|@translate}</a></dt>
271                <dd>
272{combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'}
273{footer_script require='jquery'}
274{literal}function setPrivacyLevel(rootUrl, id, level)
275{
276var y = new PwgWS(rootUrl);
277y.callService(
278        "pwg.images.setPrivacyLevel", {image_id: id, level:level} ,
279        {
280                method: "POST",
281                onFailure: function(num, text) { alert(num + " " + text); },
282                onSuccess: function(result) {
283                          jQuery('#privacyLevelBox .switchCheck').css('visibility','hidden');
284                          jQuery('#levelCheck'+level).css('visibility','visible');
285                }
286        }
287        );
288}
289function togglePrivacyLevelBox()
290{
291        var elt = document.getElementById("privacyLevelBox"),
292                ePos = document.getElementById("privacyLevelLink");
293        if (elt.style.display == "none")
294        {
295                elt.style.left = (ePos.offsetLeft)+"px";
296                elt.style.top = (ePos.offsetTop+ePos.offsetHeight)+"px";
297                elt.style.display="block";
298        }
299        else
300                elt.style.display="none";
301}
302{/literal}
303{/footer_script}
304
305                        <div id="privacyLevelBox" class="switchBox" onclick="togglePrivacyLevelBox()" style="display:none" onmouseout="e=event.toElement||event.relatedTarget;e.parentNode==this||e==this||togglePrivacyLevelBox()">
306                                {foreach from=$available_permission_levels item=label key=level}
307                                        <span id="levelCheck{$level}" class="switchCheck" {if $level != $current.level} style="visibility:hidden"{/if}>&#x2714; </span>
308                                        <a id="switchLevel{$level}" href="javascript:setPrivacyLevel('{$ROOT_URL}', {$current.id}, {$level})">{$label}</a><br>
309                                {/foreach}
310                        </div>
311
312                </dd>
313        </div></div>
314{/if}
315{/strip}
316</dl>
317
318{if isset($metadata)}
319<dl id="Metadata" class="imageInfoTable">
320{foreach from=$metadata item=meta}
321        <h3>{$meta.TITLE}</h3>
322        {foreach from=$meta.lines item=value key=label}
323                <div class="imageInfo">
324                        <dt>{$label}</dt>
325                        <dd>{$value}</dd>
326                </div>
327        {/foreach}
328{/foreach}
329</dl>
330{/if}
331</div>
332</div>
333
334{if isset($COMMENT_COUNT)}
335<div id="comments" {if (!isset($comment_add) && ($COMMENT_COUNT == 0))}class="noCommentContent"{else}class="commentContent"{/if}><div id="commentsSwitcher"></div>
336        <h3>{$pwg->l10n_dec('%d comment', '%d comments',$COMMENT_COUNT)}</h3>
337
338        <div id="pictureComments">
339                {if isset($comment_add)}
340                        <div id="commentAdd">
341                                <h4>{'Add a comment'|@translate}</h4>
342                                <form method="post" action="{$comment_add.F_ACTION}" id="addComment" >
343                                        {if $comment_add.SHOW_AUTHOR}
344                                                <p><label>{'Author'|@translate} :</label></p>
345                                                <p><input type="text" name="author" /></p>
346                                                <p><label>{'Comment'|@translate} :</label></p>
347                                        {/if}
348                                        <p><textarea name="content" id="contentid" rows="5" cols="50">{$comment_add.CONTENT}</textarea></p>
349                                        <p><input type="hidden" name="key" value="{$comment_add.KEY}" />
350                                                <input type="submit" value="{'Submit'|@translate}"></p>
351                                </form>
352                        </div>
353                {/if}
354                {if isset($comments)}
355                        <div id="pictureCommentList">
356                                {if (($COMMENT_COUNT > 2) || !empty($navbar))}
357                                        <div id="pictureCommentNavBar">
358                                                {if $COMMENT_COUNT > 2}
359                                                        <a href="{$COMMENTS_ORDER_URL}#comments" rel="nofollow" class="commentsOrder">{$COMMENTS_ORDER_TITLE}</a>
360                                                {/if}
361                                                {if !empty($navbar) }{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
362                                        </div>
363                                {/if}
364                                {include file='comment_list.tpl'}
365                        </div>
366                {/if}
367                <div style="clear: both;"></div>
368        </div>
369
370</div>
371{/if}{*comments*}
372
373{if !empty($PLUGIN_PICTURE_AFTER)}{$PLUGIN_PICTURE_AFTER}{/if}
374
375</div>
Note: See TracBrowser for help on using the repository browser.