source: extensions/GuestBook/template/guestbook.tpl @ 26065

Last change on this file since 26065 was 26065, checked in by mistic100, 7 years ago

update for Piwigo 2.6 + code clean

File size: 4.2 KB
Line 
1{combine_css path=$GUESTBOOK_PATH|cat:'template/style.css'}
2{combine_script id='livevalidation' load='footer' path=$GUESTBOOK_PATH|cat:'template/livevalidation.min.js'}
3
4{footer_script require='jquery,livevalidation'}
5(function() {
6  {if !$comment_add.IS_LOGGED}
7  var author = new LiveValidation('author', {ldelim} onlyOnSubmit: true });
8  author.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter your username'|translate}" });
9  {/if}
10
11  {if $comment_add.EMAIL_MANDATORY and (!$comment_add.IS_LOGGED or empty($comment_add.EMAIL))}
12  var email = new LiveValidation('email', {ldelim} onlyOnSubmit: true });
13  email.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter your e-mail'|translate}" });
14  email.add(Validate.Email, {ldelim} failureMessage: "{'mail address must be like xxx@yyy.eee (example : jack@altern.org)'|translate}" });
15  {/if}
16
17  var website = new LiveValidation('website', {ldelim} onlyOnSubmit: true });
18  website.add(Validate.Format, {ldelim} pattern: /^https?:\/\/[^\s\/$.?#].[^\s]*$/i,
19    failureMessage: "{'invalid website address'|translate}"});
20
21  var content = new LiveValidation('contentid', {ldelim} onlyOnSubmit: true });
22  content.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a message'|translate}" });
23 
24  {if !isset($GB_OPEN)}
25  jQuery('#addComment').hide();
26  jQuery('#guestbookAdd').css('width', '180px');
27  jQuery('#expandForm').click(function() {ldelim}
28    jQuery('#guestbookAdd').animate({ldelim}'width': '550px'}, function() {ldelim}
29      jQuery('#expandForm').slideUp();
30      jQuery('#addComment').slideDown('slow');
31    });
32  });
33  {/if}
34
35  jQuery('#website').on('blur', function() {ldelim}
36    var val = $(this).val();
37    if (val.substr(0, 4) != 'http') {ldelim}
38      $(this).val('http://'+ val);
39    }
40  });
41}());
42{/footer_script}
43
44{if $comment_add.ACTIVATE_RATING}
45  {combine_script id='jquery.raty' path=$GUESTBOOK_PATH|cat:'template/jquery.raty/jquery.raty.min.js'}
46  {footer_script}
47  jQuery('#comment_rate').raty({ldelim}
48    path: '{$ROOT_URL}{$GUESTBOOK_PATH}template/jquery.raty/',
49    half: true
50  });
51  {/footer_script}
52{/if}
53
54
55{if isset($comment_add)}
56<div id="guestbookAdd">
57  <h4 id="expandForm">{'Sign the guestbook'|translate}</h4>
58  <form method="post" action="{$comment_add.F_ACTION}" id="addComment" class="contact">
59    <table>
60    {if not $comment_add.IS_LOGGED or empty($comment_add.EMAIL)}
61      <tr>
62        <td>
63          <label for="author">{'Author'|translate}* :</label>
64        {if $comment_add.IS_LOGGED}
65          {$comment_add.AUTHOR}
66          <input type="hidden" name="author" value="{$comment_add.AUTHOR}">
67        {else}
68          <input type="text" name="author" id="author" value="{$comment_add.AUTHOR}">
69        {/if}
70        </td>
71        <td>
72          <label for="email">{'Email address'|translate}{if $comment_add.EMAIL_MANDATORY}*{/if} ({'not publicly visible'|translate}) :</label>
73          <input type="text" name="email" id="email" value="{$comment_add.EMAIL}">
74        </td>
75      </tr>
76    {/if}
77      <tr>
78      {if $comment_add.ACTIVATE_RATING}
79        <td>
80          <label>{'Rate'|translate} :</label>
81          <span id="comment_rate"></span>
82        </td>
83      {/if}
84        <td>
85          <label for="website">{'Website'|translate} :</label>
86          <input type="text" name="website" id="website" value="{$comment_add.WEBSITE}">
87        </td>
88      </tr>
89      <tr>
90        <td colspan="2">
91          <label for="contentid">{'Comment'|translate}* :</label>
92          <textarea name="content" id="contentid" rows="7">{$comment_add.CONTENT}</textarea>
93        </td>
94      </tr>
95      <tr>
96        <td colspan="2">
97          <input type="submit" value="{'Send'|translate}">
98          {'* : mandatory fields'|translate}
99        </td>
100      </tr>
101    </table>
102   
103    <input type="hidden" name="key" value="{$comment_add.KEY}">
104  </form>
105</div>
106{/if}
107
108<p class="comment_count">{'There are %d messages'|translate:$COMMENT_COUNT}</p>
109
110{if isset($comments)}
111<div id="guestbookCommentList">
112  {if !empty($navbar)}
113    <div id="pictureCommentNavBar">
114      {include file='navigation_bar.tpl'|get_extent:'navbar'}
115    </div>
116  {/if}
117  {include file=$ABS_GUESTBOOK_PATH|cat:'template/comment_list.tpl'}
118</div>
119{/if}
Note: See TracBrowser for help on using the repository browser.