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

Last change on this file since 23320 was 23320, checked in by mistic100, 11 years ago

feature:2928 Factorize JS code for switchBox
switchBox("selector for link", "selector for box");

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