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