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

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

update for Piwigo 2.6 + code clean

File size: 4.2 KB
RevLine 
[26065]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'}
[20181]3
[25214]4{footer_script require='jquery,livevalidation'}
[26065]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}
[16347]10
[26065]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}
[20181]16
[26065]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}"});
[20181]20
[26065]21  var content = new LiveValidation('contentid', {ldelim} onlyOnSubmit: true });
22  content.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a message'|translate}" });
[20181]23 
[26065]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    });
[20181]32  });
[26065]33  {/if}
[25214]34
[26065]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}());
[20181]42{/footer_script}
43
[16347]44{if $comment_add.ACTIVATE_RATING}
[26065]45  {combine_script id='jquery.raty' path=$GUESTBOOK_PATH|cat:'template/jquery.raty/jquery.raty.min.js'}
[16347]46  {footer_script}
[26065]47  jQuery('#comment_rate').raty({ldelim}
48    path: '{$ROOT_URL}{$GUESTBOOK_PATH}template/jquery.raty/',
[16347]49    half: true
50  });
51  {/footer_script}
52{/if}
53
54
55{if isset($comment_add)}
56<div id="guestbookAdd">
[26065]57  <h4 id="expandForm">{'Sign the guestbook'|translate}</h4>
[20181]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>
[26065]63          <label for="author">{'Author'|translate}* :</label>
[20181]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>
[26065]72          <label for="email">{'Email address'|translate}{if $comment_add.EMAIL_MANDATORY}*{/if} ({'not publicly visible'|translate}) :</label>
[20181]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>
[26065]80          <label>{'Rate'|translate} :</label>
[20181]81          <span id="comment_rate"></span>
82        </td>
83      {/if}
84        <td>
[26065]85          <label for="website">{'Website'|translate} :</label>
[20181]86          <input type="text" name="website" id="website" value="{$comment_add.WEBSITE}">
87        </td>
88      </tr>
89      <tr>
90        <td colspan="2">
[26065]91          <label for="contentid">{'Comment'|translate}* :</label>
[20181]92          <textarea name="content" id="contentid" rows="7">{$comment_add.CONTENT}</textarea>
93        </td>
94      </tr>
95      <tr>
96        <td colspan="2">
[26065]97          <input type="submit" value="{'Send'|translate}">
98          {'* : mandatory fields'|translate}
[20181]99        </td>
100      </tr>
101    </table>
102   
103    <input type="hidden" name="key" value="{$comment_add.KEY}">
104  </form>
[16347]105</div>
106{/if}
107
[26065]108<p class="comment_count">{'There are %d messages'|translate:$COMMENT_COUNT}</p>
[16347]109
110{if isset($comments)}
111<div id="guestbookCommentList">
112  {if !empty($navbar)}
113    <div id="pictureCommentNavBar">
[26065]114      {include file='navigation_bar.tpl'|get_extent:'navbar'}
[16347]115    </div>
116  {/if}
[26065]117  {include file=$ABS_GUESTBOOK_PATH|cat:'template/comment_list.tpl'}
[16347]118</div>
119{/if}
Note: See TracBrowser for help on using the repository browser.