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

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

fix email validation

File size: 4.7 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{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 $comment_add.EMAIL_MANDATORY and (!$comment_add.IS_LOGGED or empty($comment_add.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
32jQuery("#website").on('blur', function() {ldelim}
33  var val = $(this).val();
34  if (val.substr(0, 4) != 'http') {ldelim}
35    $(this).val('http://'+ val);
36  }
37});
38{/footer_script}
39
40{if $comment_add.ACTIVATE_RATING}
41  {combine_script id="jquery.raty" path=$GUESTBOOK_PATH|@cat:"template/jquery.raty/jquery.raty.min.js"}
42  {footer_script}
43  jQuery("#comment_rate").raty({ldelim}
44    path: "{$ROOT_URL}{$GUESTBOOK_PATH}template/jquery.raty/",
45    half: true
46  });
47  {/footer_script}
48{/if}
49
50
51{* <!-- Menubar & titrePage --> *}
52{if $themeconf.name == "stripped" or $themeconf.parent == "stripped"}
53  {include file=$ABS_GUESTBOOK_PATH|@cat:'template/themes/stripped.tpl'}
54  {assign var="clear" value="true"}
55{elseif $themeconf.name == "simple-grey" or $themeconf.parent == "simple"}
56  {include file=$ABS_GUESTBOOK_PATH|@cat:'template/themes/simple.tpl'}
57  {assign var="clear" value="true"}
58{else}
59  {include file=$ABS_GUESTBOOK_PATH|@cat:'template/themes/default.tpl'}
60{/if}
61
62{if isset($errors) or not empty($infos)}
63{include file='infos_errors.tpl'}
64{/if}
65
66
67{if isset($comment_add)}
68<div id="guestbookAdd">
69  <h4 id="expandForm">{'Sign the guestbook'|@translate}</h4>
70  <form method="post" action="{$comment_add.F_ACTION}" id="addComment" class="contact">
71    <table>
72    {if not $comment_add.IS_LOGGED or empty($comment_add.EMAIL)}
73      <tr>
74        <td>
75          <label for="author">{'Author'|@translate}* :</label>
76        {if $comment_add.IS_LOGGED}
77          {$comment_add.AUTHOR}
78          <input type="hidden" name="author" value="{$comment_add.AUTHOR}">
79        {else}
80          <input type="text" name="author" id="author" value="{$comment_add.AUTHOR}">
81        {/if}
82        </td>
83        <td>
84          <label for="email">{'Email address'|@translate}{if $comment_add.EMAIL_MANDATORY}*{/if} ({'not publicly visible'|@translate}) :</label>
85          <input type="text" name="email" id="email" value="{$comment_add.EMAIL}">
86        </td>
87      </tr>
88    {/if}
89      <tr>
90      {if $comment_add.ACTIVATE_RATING}
91        <td>
92          <label>{'Rate'|@translate} :</label>
93          <span id="comment_rate"></span>
94        </td>
95      {/if}
96        <td>
97          <label for="website">{'Website'|@translate} :</label>
98          <input type="text" name="website" id="website" value="{$comment_add.WEBSITE}">
99        </td>
100      </tr>
101      <tr>
102        <td colspan="2">
103          <label for="contentid">{'Comment'|@translate}* :</label>
104          <textarea name="content" id="contentid" rows="7">{$comment_add.CONTENT}</textarea>
105        </td>
106      </tr>
107      <tr>
108        <td colspan="2">
109          <input type="submit" value="{'Send'|@translate}">
110          {'* : mandatory fields'|@translate}
111        </td>
112      </tr>
113    </table>
114   
115    <input type="hidden" name="key" value="{$comment_add.KEY}">
116  </form>
117</div>
118{/if}
119
120<p class="comment_count">{'There are %d messages'|@translate|@sprintf:$COMMENT_COUNT}</p>
121
122{if isset($comments)}
123<div id="guestbookCommentList">
124  {if !empty($navbar)}
125    <div id="pictureCommentNavBar">
126      {include file='navigation_bar.tpl'|@get_extent:'navbar'}
127    </div>
128  {/if}
129  {include file=$ABS_GUESTBOOK_PATH|@cat:'template/comment_list.tpl'}
130</div>
131{/if}
132
133{if $clear}<div style="clear: both;"></div>
134</div>{/if}
135</div>{* <!-- content --> *}
Note: See TracBrowser for help on using the repository browser.