source: extensions/ContactForm/template/contact_form.tpl @ 18465

Last change on this file since 18465 was 17945, checked in by mistic100, 12 years ago
  • stores emails in database (/!\ update only from published version, not from trunk)
  • allow emails to be categorized
File size: 4.6 KB
Line 
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}
6var author = new LiveValidation('author', {ldelim} onlyOnSubmit: true });
7author.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))}
11var email = new LiveValidation('email', {ldelim} onlyOnSubmit: true });
12email.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter an 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
16{if $GROUPS}
17var group = new LiveValidation('group', {ldelim} onlyOnSubmit: true })
18group.add(Validate.Exclusion, {ldelim} within: ['-1'], failureMessage: "{'Please choose a category'|@translate}" });
19{/if}
20
21var subject = new LiveValidation('subject', {ldelim} onlyOnSubmit: true });
22subject.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a subject'|@translate}" });
23subject.add(Validate.Length, {ldelim} minimum: 4, maximum: 100,
24  tooShortMessage: "{'%s must not be less than %d characters long'|@translate|@sprintf:'':4}",
25  tooLongMessage: "{'%s must not be more than %d characters long'|@translate|@sprintf:'':100}"
26  });
27
28var content = new LiveValidation('cf_content', {ldelim} onlyOnSubmit: true });
29content.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a message'|@translate}" });
30content.add(Validate.Length, {ldelim} minimum: 20, maximum: 2000,
31  tooShortMessage: "{'%s must not be less than %d characters long'|@translate|@sprintf:'':20}",
32  tooLongMessage: "{'%s must not be more %d characters long'|@translate|@sprintf:'':2000}",
33  });
34{/footer_script}
35
36
37{* <!-- Menubar & titrePage --> *}
38{if $themeconf.name == "stripped" or $themeconf.parent == "stripped"}
39  {include file=$CONTACT_FORM_ABS_PATH|@cat:'template/themes/stripped.tpl'}
40  {assign var="clear" value="true"}
41{elseif $themeconf.name == "simple-grey" or $themeconf.parent == "simple"}
42  {include file=$CONTACT_FORM_ABS_PATH|@cat:'template/themes/simple.tpl'}
43  {assign var="clear" value="true"}
44{else}
45  {include file=$CONTACT_FORM_ABS_PATH|@cat:'template/themes/default.tpl'}
46{/if}
47
48
49{if isset($errors) or not empty($infos)}
50{include file='infos_errors.tpl'}
51{/if}
52
53{if $ContactForm_before}
54<div class="contact desc">{$ContactForm_before}</div>
55{/if}
56
57<div class="contact">
58  <form  method="post" action="{$F_ACTION}" class="filter">
59    <table>
60      <tr>
61        <td class="title"><label for="author">{'Your name'|@translate}</label></td>
62        <td>
63        {if $contact.is_logged}
64          {$contact.author}
65          <input type="hidden" name="author" value="{$contact.author}">
66        {else}
67          <input type="text" name="author" id="author" size="40" value="{$contact.author}">
68        {/if}
69        </td>
70      </tr>
71      <tr>
72        <td class="title"><label for="email">{'Your e-mail'|@translate}</label></td>
73        <td>
74        {if $contact.is_logged and !empty($contact.email)}
75          {$contact.email}
76          <input type="hidden" name="email" value="{$contact.email}">
77        {else}
78          <input type="text" name="email" id="email" size="40" value="{$contact.email}">
79        {/if}
80        </td>
81      </tr>
82      {if $GROUPS}
83      <tr>
84        <td class="title"><label for="group">{'Category'|@translate}</label></td>
85        <td>
86          <select name="group" id="group">
87            <option value="-1">------------</option>
88            {html_options options=$GROUPS selected=$contact.group}
89          </select>
90        </td>
91      </tr>
92      {/if}
93      <tr>
94        <td class="title"><label for="subject">{'Subject'|@translate}</label></td>
95        <td><input type="text" name="subject" id="subject" style="width:400px;" value="{$contact.subject}"></td>
96      </tr>
97      <tr>
98        <td class="title"><label for="cf_content">{'Message'|@translate}</label></td>
99        <td><textarea name="content" id="cf_content" rows="10" style="width:400px;">{$contact.content}</textarea></td>
100      </tr>
101      <tr>
102        <td class="title">&nbsp;</td>
103        <td><input class="submit" type="submit" name="send_mail" value="{'Send'|@translate}"></td>
104      </tr>
105    </table>
106   
107    <input type="hidden" name="key" value="{$KEY}" />
108  </form>
109</div>
110
111{if $ContactForm_after}
112<div class="contact desc">{$ContactForm_after}</div>
113{/if}
114
115{if $clear}<div style="clear: both;"></div>
116</div>{/if}
117</div>{* <!-- content --> *}
Note: See TracBrowser for help on using the repository browser.