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

Last change on this file since 7957 was 7957, checked in by rvelices, 13 years ago

bug 2043: some Javascript errors in default theme (also makes the rating.js script async)

  • Property svn:eol-style set to LF
File size: 10.2 KB
Line 
1
2{* Example of resizeable *}
3{*
4{include file='include/autosize.inc.tpl'}
5*}
6
7{if isset($errors)}
8<div class="errors">
9  <ul>
10    {foreach from=$errors item=error}
11    <li>{$error}</li>
12    {/foreach}
13  </ul>
14</div>
15{/if}
16
17{if isset($infos)}
18<div class="infos">
19  <ul>
20    {foreach from=$infos item=info}
21    <li>{$info}</li>
22    {/foreach}
23  </ul>
24</div>
25{/if}
26
27{if !empty($PLUGIN_PICTURE_BEFORE)}{$PLUGIN_PICTURE_BEFORE}{/if}
28
29<div id="imageHeaderBar">
30  <div class="browsePath">
31    {$SECTION_TITLE}
32    {$LEVEL_SEPARATOR}{$current.TITLE}
33  </div>
34  <div class="imageNumber">{$PHOTO}</div>
35  {if $SHOW_PICTURE_NAME_ON_TITLE }
36  <h2>{$current.TITLE}</h2>
37  {/if}
38</div>
39
40<div id="imageToolBar">
41  <div class="randomButtons">
42    {if isset($U_SLIDESHOW_START) }
43      <a href="{$U_SLIDESHOW_START}" title="{'slideshow'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/start_slideshow.png" class="button" alt="{'slideshow'|@translate}"></a>
44    {/if}
45    {if isset($U_METADATA) }
46      <a href="{$U_METADATA}" title="{'Show file metadata'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/metadata.png" class="button" alt="metadata"></a>
47    {/if}
48    {if isset($current.U_DOWNLOAD) }
49      <a href="{$current.U_DOWNLOAD}" title="{'download this file'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/save.png" class="button" alt="{'download'|@translate}"></a>
50    {/if}
51    {if isset($PLUGIN_PICTURE_ACTIONS)}{$PLUGIN_PICTURE_ACTIONS}{/if}
52    {if isset($favorite) }
53      <a href="{$favorite.U_FAVORITE}" title="{if $favorite.IS_FAVORITE}{'delete this image from your favorites'|@translate}{else}{'add this image to your favorites'|@translate}{/if}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/{if $favorite.IS_FAVORITE}del_favorite{else}favorite{/if}.png" class="button" alt="favorite" title="{if $favorite.IS_FAVORITE}{'delete this image from your favorites'|@translate}{else}{'add this image to your favorites'|@translate}{/if}"></a>
54    {/if}
55    {if !empty($U_SET_AS_REPRESENTATIVE) }
56      <a href="{$U_SET_AS_REPRESENTATIVE}" title="{'set as album representative'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/representative.png" class="button" alt="{'representative'|@translate}"></a>
57    {/if}
58    {if isset($U_ADMIN) }
59      <a href="{$U_ADMIN}" title="{'Modify information'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/preferences.png" class="button" alt="{'edit'|@translate}"></a>
60    {/if}
61    {if isset($U_CADDIE) }{*caddie management BEGIN*}
62<script type="text/javascript">
63{literal}function addToCadie(aElement, rootUrl, id)
64{
65if (aElement.disabled) return;
66aElement.disabled=true;
67var y = new PwgWS(rootUrl);
68
69y.callService(
70  "pwg.caddie.add", {image_id: id} ,
71  {
72    onFailure: function(num, text) { alert(num + " " + text); document.location=aElement.href; },
73    onSuccess: function(result) { aElement.disabled = false; }
74  }
75  );
76}{/literal}
77</script>
78      <a href="{$U_CADDIE}" onclick="addToCadie(this, '{$ROOT_URL|@escape:'javascript'}', {$current.id}); return false;" title="{'add to caddie'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/caddie_add.png" class="button" alt="{'caddie'|@translate}"></a>
79    {/if}{*caddie management END*}
80  </div>
81  {include file='picture_nav_buttons.tpl'|@get_extent:'picture_nav_buttons'}
82</div> <!-- imageToolBar -->
83
84<div id="theImage">
85{$ELEMENT_CONTENT}
86
87{if isset($COMMENT_IMG)}
88<p>{$COMMENT_IMG}</p>
89{/if}
90
91{if isset($U_SLIDESHOW_STOP) }
92<p>
93  [ <a href="{$U_SLIDESHOW_STOP}">{'stop the slideshow'|@translate}</a> ]
94</p>
95{/if}
96
97</div>
98
99{if $DISPLAY_NAV_THUMB}
100{if isset($previous) }
101<a class="navThumb" id="linkPrev" href="{$previous.U_IMG}" title="{'Previous'|@translate} : {$previous.TITLE}" rel="prev">
102  <img src="{$previous.THUMB_SRC}" alt="{$previous.TITLE}">
103</a>
104{/if}
105{if isset($next) }
106<a class="navThumb" id="linkNext" href="{$next.U_IMG}" title="{'Next'|@translate} : {$next.TITLE}" rel="next">
107  <img src="{$next.THUMB_SRC}" alt="{$next.TITLE}">
108</a>
109{/if}
110{/if}
111
112<table id="standard" class="infoTable" summary="{'Some info about this picture'|@translate}">
113  {if $display_info.author}
114  <tr id="Author">
115    <td class="label">{'Author'|@translate}</td>
116    <td class="value">{if isset($INFO_AUTHOR)}{$INFO_AUTHOR}{else}{'N/A'|@translate}{/if}</td>
117  </tr>
118  {/if}
119  {if $display_info.created_on}
120  <tr id="datecreate">
121    <td class="label">{'Created on'|@translate}</td>
122    <td class="value">{if isset($INFO_CREATION_DATE)}{$INFO_CREATION_DATE}{else}{'N/A'|@translate}{/if}</td>
123  </tr>
124  {/if}
125  {if $display_info.posted_on}
126  <tr id="datepost">
127    <td class="label">{'Posted on'|@translate}</td>
128    <td class="value">{$INFO_POSTED_DATE}</td>
129  </tr>
130  {/if}
131  {if $display_info.dimensions}
132  <tr id="Dimensions">
133    <td class="label">{'Dimensions'|@translate}</td>
134    <td class="value">{if isset($INFO_DIMENSIONS)}{$INFO_DIMENSIONS}{else}{'N/A'|@translate}{/if}</td>
135  </tr>
136  {/if}
137  {if $display_info.file}
138  <tr id="File">
139    <td class="label">{'File'|@translate}</td>
140    <td class="value">{$INFO_FILE}</td>
141  </tr>
142  {/if}
143  {if $display_info.filesize}
144  <tr id="Filesize">
145    <td class="label">{'Filesize'|@translate}</td>
146    <td class="value">{if isset($INFO_FILESIZE)}{$INFO_FILESIZE}{else}{'N/A'|@translate}{/if}</td>
147  </tr>
148  {/if}
149  {if $display_info.tags}
150  <tr id="Tags">
151    <td class="label">{'Tags'|@translate}</td>
152    <td class="value">
153      {if isset($related_tags)}
154        {foreach from=$related_tags item=tag name=tag_loop}{if !$smarty.foreach.tag_loop.first}, {/if}
155        <a href="{$tag.URL}">{$tag.name}</a>{/foreach}
156      {/if}
157    </td>
158  </tr>
159  {/if}
160  {if $display_info.categories}
161  <tr id="Categories">
162    <td class="label">{'Albums'|@translate}</td>
163    <td class="value">
164      {if isset($related_categories)}
165      <ul>
166        {foreach from=$related_categories item=cat}
167        <li>{$cat}</li>
168        {/foreach}
169      </ul>
170      {/if}
171    </td>
172  </tr>
173  {/if}
174  {if $display_info.visits}
175  <tr id="Visits">
176    <td class="label">{'Visits'|@translate}</td>
177    <td class="value">{$INFO_VISITS}</td>
178  </tr>
179  {/if}
180
181{if $display_info.average_rate and isset($rate_summary) }
182        <tr id="Average">
183                <td class="label">{'Average rate'|@translate}</td>
184                <td class="value" id="ratingSummary">
185                {if $rate_summary.count}
186                        {assign var='rate_text' value='%.2f (rated %d times)'|@translate }
187                        {$pwg->sprintf($rate_text, $rate_summary.average, $rate_summary.count) }
188                {else}
189                        {'no rate'|@translate}
190                {/if}
191                </td>
192        </tr>
193{/if}
194 
195{if isset($rating)}
196        <tr id="rating">
197                <td class="label">
198                        <span id="updateRate">{if isset($rating.USER_RATE)}{'Update your rating'|@translate}{else}{'Rate this picture'|@translate}{/if}</span>
199                </td>
200                <td class="value">
201                        <form action="{$rating.F_ACTION}" method="post" id="rateForm" style="margin:0;">
202                        <div>&nbsp;
203                        {foreach from=$rating.marks item=mark name=rate_loop}
204                        {if !$smarty.foreach.rate_loop.first} | {/if}
205                        {if isset($rating.USER_RATE) && $mark==$rating.USER_RATE}
206                          <input type="button" name="rate" value="{$mark}" class="rateButtonSelected" title="{$mark}">
207                        {else}
208                          <input type="submit" name="rate" value="{$mark}" class="rateButton" title="{$mark}">
209                        {/if}
210                        {/foreach}
211                        <script type="text/javascript">
212                                var _pwgRatingAutoQueue = _pwgRatingAutoQueue || [];
213                                _pwgRatingAutoQueue.push(  {ldelim}rootUrl: '{$ROOT_URL|@escape:"javascript"}', image_id: {$current.id},
214                                        updateRateText: "{'Update your rating'|@translate|@escape:'javascript'}", updateRateElement: document.getElementById("updateRate"),
215                                        ratingSummaryText: "{'%.2f (rated %d times)'|@translate|@escape:'javascript'}", ratingSummaryElement: document.getElementById("ratingSummary") {rdelim} );
216                                (function () {ldelim}
217                                var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = '{$ROOT_URL}themes/default/js/rating.js';
218                                var s0 = document.getElementsByTagName('script')[0]; s0.parentNode.insertBefore(s, s0);
219                                })();
220                        </script>
221                        </div>
222                        </form>
223                </td>
224        </tr>
225{/if}
226
227{if $display_info.privacy_level and isset($available_permission_levels) }
228        <tr id="Privacy">
229                <td class="label">{'Who can see this photo?'|@translate}</td>
230                <td class="value">
231<script type="text/javascript">
232{literal}function setPrivacyLevel(selectElement, rootUrl, id, level)
233{
234selectElement.disabled = true;
235var y = new PwgWS(rootUrl);
236y.callService(
237        "pwg.images.setPrivacyLevel", {image_id: id, level:level} ,
238        {
239                method: "POST",
240                onFailure: function(num, text) { selectElement.disabled = false; alert(num + " " + text); },
241                onSuccess: function(result) { selectElement.disabled = false; }
242        }
243        );
244}{/literal}
245</script>
246        <select onchange="setPrivacyLevel(this, '{$ROOT_URL|@escape:'javascript'}', {$current.id}, this.options[selectedIndex].value)">
247                {foreach from=$available_permission_levels item=label key=level}
248                <option label="{$label}" value="{$level}"{if $level == $current.level} selected="selected"{/if}>{$label}</option>
249                {/foreach}
250        </select>
251        </td></tr>
252{/if}
253
254</table>
255
256{if isset($metadata)}
257<table id="Metadata" class="infoTable2" summary="{'Some more (technical) info about this picture'|@translate}">
258{foreach from=$metadata item=meta}
259  <tr>
260    <th colspan="2">{$meta.TITLE}</th>
261  </tr>
262  {foreach from=$meta.lines item=value key=label}
263  <tr>
264    <td class="label">{$label}</td>
265    <td class="value">{$value}</td>
266  </tr>
267  {/foreach}
268{/foreach}
269</table>
270{/if}
271
272
273<hr class="separation">
274
275{if isset($COMMENT_COUNT)}
276<div id="comments">
277  {if $COMMENT_COUNT > 0}
278                <h3>{$pwg->l10n_dec('%d comment', '%d comments',$COMMENT_COUNT)}</h3>
279  {/if}
280  {if !empty($navbar) }{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
281
282        {if isset($comments)}
283                {include file='comment_list.tpl'}
284        {/if}
285
286        {if isset($comment_add)}
287        <form  method="post" action="{$comment_add.F_ACTION}" class="filter" id="addComment">
288        <fieldset>
289                <legend>{'Add a comment'|@translate}</legend>
290                {if $comment_add.SHOW_AUTHOR}
291                <label>{'Author'|@translate}<input type="text" name="author"></label>
292                {/if}
293                <label>{'Comment'|@translate}<textarea name="content" id="contentid" rows="5" cols="80">{$comment_add.CONTENT}</textarea></label>
294                <input type="hidden" name="key" value="{$comment_add.KEY}">
295                <input class="submit" type="submit" value="{'Submit'|@translate}">
296        </fieldset>
297        </form>
298        {/if}
299</div>
300{/if} {*comments*}
301
302{if !empty($PLUGIN_PICTURE_AFTER)}{$PLUGIN_PICTURE_AFTER}{/if}
Note: See TracBrowser for help on using the repository browser.