1 | {combine_css path=$CONTACT_FORM_PATH|@cat:"template/style.css"} |
---|
2 | {combine_script id="livevalidation" load="footer" path=$CONTACT_FORM_PATH|@cat:"template/livevalidation.min.js"} |
---|
3 | |
---|
4 | {footer_script require='livevalidation'} |
---|
5 | {if $contact.mandatory_name and !$contact.is_logged} |
---|
6 | var author = new LiveValidation('author', {ldelim} onlyOnSubmit: true }); |
---|
7 | author.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a name'|@translate}" }); |
---|
8 | {/if} |
---|
9 | |
---|
10 | {if $contact.mandatory_mail and (!$contact.is_logged or empty($contact.email))} |
---|
11 | var email = new LiveValidation('email', {ldelim} onlyOnSubmit: true }); |
---|
12 | email.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter an e-mail'|@translate}" }); |
---|
13 | email.add(Validate.Email, {ldelim} failureMessage: "{'mail address must be like xxx@yyy.eee (example : jack@altern.org)'|@translate}" }); |
---|
14 | {/if} |
---|
15 | |
---|
16 | {if $GROUPS} |
---|
17 | var group = new LiveValidation('group', {ldelim} onlyOnSubmit: true }) |
---|
18 | group.add(Validate.Exclusion, {ldelim} within: ['-1'], failureMessage: "{'Please choose a category'|@translate}" }); |
---|
19 | {/if} |
---|
20 | |
---|
21 | var subject = new LiveValidation('subject', {ldelim} onlyOnSubmit: true }); |
---|
22 | subject.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a subject'|@translate}" }); |
---|
23 | subject.add(Validate.Length, {ldelim} maximum: 100, |
---|
24 | tooLongMessage: "{'%s must not be more than %d characters long'|@translate|@sprintf:'':100}" |
---|
25 | }); |
---|
26 | |
---|
27 | var content = new LiveValidation('cf_content', {ldelim} onlyOnSubmit: true }); |
---|
28 | content.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a message'|@translate}" }); |
---|
29 | content.add(Validate.Length, {ldelim} maximum: 2000, |
---|
30 | tooLongMessage: "{'%s must not be more %d characters long'|@translate|@sprintf:'':2000}", |
---|
31 | }); |
---|
32 | {/footer_script} |
---|
33 | |
---|
34 | |
---|
35 | {* <!-- Menubar & titrePage --> *} |
---|
36 | {if $themeconf.name == "stripped" or $themeconf.parent == "stripped"} |
---|
37 | {include file=$CONTACT_FORM_ABS_PATH|@cat:'template/themes/stripped.tpl'} |
---|
38 | {assign var="clear" value="true"} |
---|
39 | {elseif $themeconf.name == "simple-grey" or $themeconf.parent == "simple"} |
---|
40 | {include file=$CONTACT_FORM_ABS_PATH|@cat:'template/themes/simple.tpl'} |
---|
41 | {assign var="clear" value="true"} |
---|
42 | {else} |
---|
43 | {include file=$CONTACT_FORM_ABS_PATH|@cat:'template/themes/default.tpl'} |
---|
44 | {/if} |
---|
45 | |
---|
46 | |
---|
47 | {if isset($errors) or not empty($infos)} |
---|
48 | {include file='infos_errors.tpl'} |
---|
49 | {/if} |
---|
50 | |
---|
51 | {if $ContactForm_before} |
---|
52 | <div class="contact desc">{$ContactForm_before}</div> |
---|
53 | {/if} |
---|
54 | |
---|
55 | <div class="contact"> |
---|
56 | <form method="post" action="{$F_ACTION}"> |
---|
57 | <table> |
---|
58 | <tr> |
---|
59 | <td class="title"><label for="author">{'Your name'|@translate}</label></td> |
---|
60 | <td> |
---|
61 | {if $contact.is_logged} |
---|
62 | {$contact.author} |
---|
63 | <input type="hidden" name="author" value="{$contact.author}"> |
---|
64 | {else} |
---|
65 | <input type="text" name="author" id="author" size="40" value="{$contact.author}"> |
---|
66 | {/if} |
---|
67 | </td> |
---|
68 | </tr> |
---|
69 | <tr> |
---|
70 | <td class="title"><label for="email">{'Your e-mail'|@translate}</label></td> |
---|
71 | <td> |
---|
72 | {if $contact.is_logged and !empty($contact.email)} |
---|
73 | {$contact.email} |
---|
74 | <input type="hidden" name="email" value="{$contact.email}"> |
---|
75 | {else} |
---|
76 | <input type="text" name="email" id="email" size="40" value="{$contact.email}"> |
---|
77 | {/if} |
---|
78 | </td> |
---|
79 | </tr> |
---|
80 | {if $GROUPS} |
---|
81 | <tr> |
---|
82 | <td class="title"><label for="group">{'Category'|@translate}</label></td> |
---|
83 | <td> |
---|
84 | <select name="group" id="group"> |
---|
85 | <option value="-1">------------</option> |
---|
86 | {html_options options=$GROUPS selected=$contact.group} |
---|
87 | </select> |
---|
88 | </td> |
---|
89 | </tr> |
---|
90 | {/if} |
---|
91 | <tr> |
---|
92 | <td class="title"><label for="subject">{'Subject'|@translate}</label></td> |
---|
93 | <td><input type="text" name="subject" id="subject" style="width:400px;" value="{$contact.subject}"></td> |
---|
94 | </tr> |
---|
95 | <tr> |
---|
96 | <td class="title"><label for="cf_content">{'Message'|@translate}</label></td> |
---|
97 | <td><textarea name="content" id="cf_content" rows="10" style="width:400px;">{$contact.content}</textarea></td> |
---|
98 | </tr> |
---|
99 | <tr> |
---|
100 | <td class="title"> </td> |
---|
101 | <td> |
---|
102 | <input class="submit" type="submit" name="send_mail" value="{'Send'|@translate}"> |
---|
103 | <label><input type="checkbox" name="send_copy"> {'Send copy to my email'|@translate}</label> |
---|
104 | </td> |
---|
105 | </tr> |
---|
106 | </table> |
---|
107 | |
---|
108 | <input type="hidden" name="key" value="{$KEY}" /> |
---|
109 | </form> |
---|
110 | </div> |
---|
111 | |
---|
112 | {if $ContactForm_after} |
---|
113 | <div class="contact desc">{$ContactForm_after}</div> |
---|
114 | {/if} |
---|
115 | |
---|
116 | {if $clear}<div style="clear: both;"></div> |
---|
117 | </div>{/if} |
---|
118 | </div>{* <!-- content --> *} |
---|