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 $themeconf.mobile} |
---|
25 | var width = $(document).width()-30; |
---|
26 | {else} |
---|
27 | var width = jQuery('#guestbookAdd').parent().width(); |
---|
28 | {/if} |
---|
29 | |
---|
30 | {if !isset($GB_OPEN)} |
---|
31 | jQuery('#addComment').hide(); |
---|
32 | jQuery('#guestbookAdd').css('width', '180px'); |
---|
33 | jQuery('#expandForm').click(function() {ldelim} |
---|
34 | jQuery('#guestbookAdd').animate({ 'width': Math.min(width, 580) }, function() {ldelim} |
---|
35 | jQuery('#expandForm').slideUp(); |
---|
36 | jQuery('#addComment').slideDown('slow'); |
---|
37 | }); |
---|
38 | }); |
---|
39 | {else} |
---|
40 | jQuery('#guestbookAdd').css({ 'width': Math.min(width, 580) }); |
---|
41 | {/if} |
---|
42 | |
---|
43 | jQuery('#website').on('blur', function() {ldelim} |
---|
44 | var val = $(this).val(); |
---|
45 | if (val.substr(0, 4) != 'http') {ldelim} |
---|
46 | $(this).val('http://'+ val); |
---|
47 | } |
---|
48 | }); |
---|
49 | }()); |
---|
50 | {/footer_script} |
---|
51 | |
---|
52 | {if $comment_add.ACTIVATE_RATING} |
---|
53 | {combine_script id='jquery.raty' path=$GUESTBOOK_PATH|cat:'template/jquery.raty/jquery.raty.min.js'} |
---|
54 | {footer_script} |
---|
55 | jQuery('#comment_rate').raty({ldelim} |
---|
56 | path: '{$ROOT_URL}{$GUESTBOOK_PATH}template/jquery.raty/', |
---|
57 | half: true |
---|
58 | }); |
---|
59 | {/footer_script} |
---|
60 | {/if} |
---|
61 | |
---|
62 | |
---|
63 | {if isset($comment_add)} |
---|
64 | <div id="guestbookAdd"> |
---|
65 | <h4 id="expandForm">{'Sign the guestbook'|translate}</h4> |
---|
66 | <form method="post" action="{$comment_add.F_ACTION}" id="addComment" class="contact"> |
---|
67 | |
---|
68 | {if not $comment_add.IS_LOGGED or empty($comment_add.EMAIL)} |
---|
69 | <div class="col-50"> |
---|
70 | <label for="author">{'Author'|translate}* :</label> |
---|
71 | {if $comment_add.IS_LOGGED} |
---|
72 | {$comment_add.AUTHOR} |
---|
73 | <input type="hidden" name="author" value="{$comment_add.AUTHOR}"> |
---|
74 | {else} |
---|
75 | <input type="text" name="author" id="author" value="{$comment_add.AUTHOR}"> |
---|
76 | {/if} |
---|
77 | </div> |
---|
78 | <div class="col-50"> |
---|
79 | <label for="email">{'Email address'|translate}{if $comment_add.EMAIL_MANDATORY}*{/if} ({'not publicly visible'|translate}) :</label> |
---|
80 | <input type="text" name="email" id="email" value="{$comment_add.EMAIL}"> |
---|
81 | </div> |
---|
82 | {/if} |
---|
83 | {if $comment_add.ACTIVATE_RATING} |
---|
84 | <div class="col-50"> |
---|
85 | <label>{'Rate'|translate} :</label> |
---|
86 | <span id="comment_rate"></span> |
---|
87 | </div> |
---|
88 | {/if} |
---|
89 | <div class="col-50"> |
---|
90 | <label for="website">{'Website'|translate} :</label> |
---|
91 | <input type="text" name="website" id="website" value="{$comment_add.WEBSITE}"> |
---|
92 | </div> |
---|
93 | |
---|
94 | <div class="col-100"> |
---|
95 | <label for="contentid">{'Comment'|translate}* :</label> |
---|
96 | <textarea name="content" id="contentid" rows="7">{$comment_add.CONTENT}</textarea> |
---|
97 | </div> |
---|
98 | |
---|
99 | {if isset($CRYPTO)} |
---|
100 | {$CRYPTO.parsed_content} |
---|
101 | {/if} |
---|
102 | {if isset($EASYCAPTCHA)} |
---|
103 | {$EASYCAPTCHA.parsed_content} |
---|
104 | {/if} |
---|
105 | |
---|
106 | <div class="col-100"> |
---|
107 | <input type="submit" value="{'Send'|translate}"> |
---|
108 | {'* : mandatory fields'|translate} |
---|
109 | </div> |
---|
110 | |
---|
111 | <input type="hidden" name="key" value="{$comment_add.KEY}"> |
---|
112 | </form> |
---|
113 | </div> |
---|
114 | {/if} |
---|
115 | |
---|
116 | <p class="comment_count">{'There are %d messages'|translate:$COMMENT_COUNT}</p> |
---|
117 | |
---|
118 | {if isset($comments)} |
---|
119 | <div id="guestbookCommentList"> |
---|
120 | {if !empty($navbar)} |
---|
121 | <div id="pictureCommentNavBar"> |
---|
122 | {include file='navigation_bar.tpl'|get_extent:'navbar'} |
---|
123 | </div> |
---|
124 | {/if} |
---|
125 | {include file=$ABS_GUESTBOOK_PATH|cat:'template/comment_list.tpl'} |
---|
126 | </div> |
---|
127 | {/if} |
---|