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

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

impove display, add LiveValidation

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