1 | {combine_css path=$CONTACT_FORM_PATH|cat:"admin/template/style.css"} |
---|
2 | |
---|
3 | <div class="titrePage"> |
---|
4 | <h2>Contact Form</h2> |
---|
5 | </div> |
---|
6 | |
---|
7 | <form method="post" action="{$CONTACT_FORM_ADMIN}-emails" class="properties"> |
---|
8 | <table class="table2" id="emails"> |
---|
9 | <tr class="throw"> |
---|
10 | <th>{'Name'|translate}</th> |
---|
11 | <th>{'Email address'|translate}</th> |
---|
12 | <th>{'Category'|translate}</th> |
---|
13 | <th>{'Active'|translate}</th> |
---|
14 | <th>{'Delete'|translate}</th> |
---|
15 | </tr> |
---|
16 | {counter start=0 assign=i} |
---|
17 | {foreach from=$EMAILS item=entry} |
---|
18 | <tr class="{if $i is odd}row1{else}row2{/if}"> |
---|
19 | <td> |
---|
20 | <input type="text" name="emails[{$i}][name]" value="{$entry.name|escape:html}" size="20"> |
---|
21 | </td> |
---|
22 | <td> |
---|
23 | <input type="text" name="emails[{$i}][email]" value="{$entry.email}" size="30"> |
---|
24 | </td> |
---|
25 | <td> |
---|
26 | <select name="emails[{$i}][group_name]" class="groups"> |
---|
27 | <option value="-1">------------</option> |
---|
28 | {html_options values=$GROUPS output=$GROUPS selected=$entry.group_name} |
---|
29 | </select> |
---|
30 | </td> |
---|
31 | <td style="text-align:center;"> |
---|
32 | <input type="checkbox" name="emails[{$i}][active]" value="1" {if $entry.active}checked="checked"{/if}> |
---|
33 | </td> |
---|
34 | <td style="text-align:center;"> |
---|
35 | <input type="checkbox" name="emails[{$i}][delete]" value="1" class="delete"> |
---|
36 | </td> |
---|
37 | </tr> |
---|
38 | {counter} |
---|
39 | {/foreach} |
---|
40 | <tr class="{if $i is odd}row1{else}row2{/if}" id="addEntryContainer"> |
---|
41 | <td colspan="2" style="text-align:center;"> |
---|
42 | <a id="addEntry">{'+ Add an email'|translate}</a> |
---|
43 | </td> |
---|
44 | <td> |
---|
45 | <a id="addGroup">{'+ Add a category'|translate}</a> |
---|
46 | </td> |
---|
47 | <td colspan="2" style="text-align:center;"> |
---|
48 | <input type="submit" name="save_emails" value="{'Submit'|translate}" class="submit"> |
---|
49 | </td> |
---|
50 | </tr> |
---|
51 | </table> |
---|
52 | {footer_script}var entry = {$i};{/footer_script} |
---|
53 | </form> |
---|
54 | |
---|
55 | <div class="infos tip"> |
---|
56 | <b>{'Tip'|translate}:</b> |
---|
57 | {'Each category is displayed as a distinct "service" on the contact form (example: "Technical", "Commercial", "General question"). Using categories is not mandatory.'|translate} |
---|
58 | </div> |
---|
59 | |
---|
60 | |
---|
61 | {footer_script} |
---|
62 | var group_options = new Array; |
---|
63 | {foreach from=$GROUPS item=entry} |
---|
64 | group_options[group_options.length] = '<option value="{$entry|escape:javascript}">{$entry|escape:javascript}</option>'; |
---|
65 | {/foreach} |
---|
66 | |
---|
67 | var doBlink = function(obj,start,finish) { |
---|
68 | jQuery(obj).fadeOut(300).fadeIn(300); |
---|
69 | if(start!=finish) { |
---|
70 | start=start+1; doBlink(obj,start,finish); |
---|
71 | } |
---|
72 | }; |
---|
73 | jQuery.fn.blink = function(start,finish) { |
---|
74 | return this.each(function() { |
---|
75 | doBlink(this,start,finish); |
---|
76 | }); |
---|
77 | }; |
---|
78 | |
---|
79 | jQuery(document).on('change', '.delete', function() { |
---|
80 | if ($(this).is(':checked')) { |
---|
81 | $(this).parents('tr').addClass('delete'); |
---|
82 | } |
---|
83 | else { |
---|
84 | $(this).parents('tr').removeClass('delete'); |
---|
85 | } |
---|
86 | }); |
---|
87 | |
---|
88 | jQuery('#addEntry').click(function() { |
---|
89 | entry++; |
---|
90 | i = entry; |
---|
91 | |
---|
92 | content = |
---|
93 | '<tr class="row'+ (i%2+1) +'">'+ |
---|
94 | '<td>'+ |
---|
95 | '<input type="text" name="emails['+ i +'][name]" size="20">'+ |
---|
96 | '</td>'+ |
---|
97 | '<td>'+ |
---|
98 | '<input type="text" name="emails['+ i +'][email]" size="30">'+ |
---|
99 | '</td>'+ |
---|
100 | '<td>'+ |
---|
101 | '<select name="emails['+ i +'][group_name]" class="groups">'+ |
---|
102 | '<option value="-1">------------</option>'; |
---|
103 | for (var j in group_options) { |
---|
104 | content+= group_options[j]; |
---|
105 | } |
---|
106 | content+= '</select>'+ |
---|
107 | '</td>'+ |
---|
108 | '<td style="text-align:center;">'+ |
---|
109 | '<input type="checkbox" name="emails['+ i +'][active]" value="1" checked="checked">'+ |
---|
110 | '</td>'+ |
---|
111 | '<td style="text-align:center;">'+ |
---|
112 | '<input type="checkbox" name="emails['+ i +'][delete]" value="1" class="delete">'+ |
---|
113 | '</td>'+ |
---|
114 | '</tr>' |
---|
115 | $('#emails').append(content); |
---|
116 | |
---|
117 | $('#addEntryContainer') |
---|
118 | .removeClass('row1 row2') |
---|
119 | .addClass('row'+ Math.abs(i%2-2)) |
---|
120 | .appendTo($('#emails')); |
---|
121 | }); |
---|
122 | |
---|
123 | jQuery('#addGroup').click(function() { |
---|
124 | name = prompt("{'Name'|translate}:"); |
---|
125 | if (name != null && name != "") { |
---|
126 | name = name.replace(new RegExp('"','g'),"'"); |
---|
127 | content = '<option value="'+ name +'">'+ name +'</option>'; |
---|
128 | group_options[group_options.length] = content; |
---|
129 | $("select.groups").append(content).blink(1,2); |
---|
130 | } |
---|
131 | }); |
---|
132 | {/footer_script} |
---|