source: extensions/gally/gally-black-graphite/template/comment_list.tpl @ 8534

Last change on this file since 8534 was 8534, checked in by grum, 13 years ago

New theme for gally's themes

  • Property svn:executable set to *
File size: 4.0 KB
Line 
1{*
2 The comment list is defined inside a tabsheet made with the jQuery $().tabs()
3 With jQuery 1.2.6 (don't know how other release manage this) all the anchors <A> tags are considered as a tab.
4 So, can't use <A href="link"> because href is modified by the jQuery function.
5 Links are managed by an event onclick="document.location='link';"
6*}
7
8<script type="text/javascript">
9{literal}
10  function editInside(url, text, imageId, key, index)
11  {
12    $('#editInside'+index).get(0).appendChild($("#formEditInside").get(0));
13    $("#formEditInside").css('display', 'block');
14    $('#feiKey').val(key);
15    $('#feiImageId').val(imageId);
16    $('#contentEditId').val(text);
17    $('#editComment').attr('action', url);
18
19  }
20{/literal}
21
22</script>
23
24
25<div id="formEditInside" style="display:none;">
26  <form  method='post' action='' class='filter' id='editComment'>
27    <fieldset>
28      <legend>{'Edit a comment'|@translate}</legend>
29      <textarea name='content' id='contentEditId' rows='5' cols='80'></textarea></label><br>
30      <input type='hidden' name='key' id='feiKey' value=''>
31      <input type='hidden' name='image_id' id='feiImageId' value=''>
32      <input class='submit' type='submit' value='{"Submit"|@translate}'>
33    </fieldset>
34  </form>
35</div>
36
37<ul class="commentList">
38{foreach from=$comments item=comment name=comment_loop}
39<li>
40  <div class="commentDetail">
41    {if isset($comment.TN_SRC)}
42    <div class="illustration">
43      <a href="{$comment.U_PICTURE}">
44        <img src="{$comment.TN_SRC}" alt="{$comment.ALT}" />
45      </a>
46    </div>
47    {/if}
48    <div class="description">
49      {if isset($comment.U_DELETE) or isset($comment.U_VALIDATE) or isset($comment.U_EDIT) }
50      <ul class="actions" style="float:right">
51        {if isset($comment.U_DELETE)}
52        <li>
53          <span class="button id_delete" onclick="document.location='{$comment.U_DELETE}';" title="{'delete this comment'|@translate}"></span>
54        </li>
55        {/if}
56
57        {if isset($comment.U_EDIT) and !isset($comment.IN_EDIT)}
58        <li>
59          {php}
60            /*
61              this php code is used to calculate the key need to be allowed to
62              edit the comment, and determine the picture number if necessary
63              (theses properties are not in the template var because with the
64              default template, Piwigo reloads the page for editing an item :
65              this template is abble to edit an item without reloading the page)
66            */
67            global $conf;
68            $comment=$this->get_template_vars('comment');
69            $current=$this->get_template_vars('current');
70            if(!array_key_exists('image_id', $comment))
71            {
72              if(isset($current['id']))
73              {
74                $comment['IMAGE_ID']=$current['id'];
75              }
76              else
77              {
78                preg_match('#picture\.php\?/(\d+)/category/#i', $comment['U_PICTURE'], $result);
79                if(isset($result[1]))
80                {
81                  $comment['IMAGE_ID']=$result[1];
82                }
83              }
84            }
85            $now=time();
86            $comment['KEY']=$now.":".hash_hmac('md5', $now.':'.$comment['IMAGE_ID'], $conf['secret_key']);
87            $this->assign_by_ref('comment', $comment);
88          {/php}
89          <span class="button id_edit" onclick="editInside('{$comment.U_EDIT}#edit_comment}', '{$comment.CONTENT|@escape}', {$comment.IMAGE_ID|@default:$current.id}, '{$comment.KEY}', {$smarty.foreach.comment_loop.index});" title="{'edit this comment'|@translate}"></span>
90
91        </li>
92        {/if}
93
94        {if isset($comment.U_VALIDATE)}
95        <li>
96          <span class="button id_validate" onclick="document.location='{$comment.U_VALIDATE}';" title="{'validate this comment'|@translate}"></span>
97        </li>
98        {/if}
99      </ul>
100      {/if}
101      <span class="author">{$comment.AUTHOR}</span> - <span class="date">{$comment.DATE}</span>
102
103      <div id="editInside{$smarty.foreach.comment_loop.index}">
104        <blockquote>{$comment.CONTENT}</blockquote>
105      </div>
106
107    </div>
108  </div>
109</li>
110
111{/foreach}
112</ul>
Note: See TracBrowser for help on using the repository browser.