source: extensions/ContactForm/themes/simple-sunset/cf_form.tpl @ 10035

Last change on this file since 10035 was 10035, checked in by plg, 9 years ago

compatibility with Piwigo 2.2 (remove "adviser", get_comment_post_key()
replaced by get_ephemeral_key(), known_script replaced by combine_script
and use of combine_css)

textarea is no more "resizable" (useless and break CSS rules)

File size: 4.0 KB
Line 
1{combine_css path="plugins/ContactForm/include/contactform.css"}
2{combine_script id="ContactForm" load="async" path="plugins/ContactForm/include/contactform.js"}
3
4{footer_script}{literal}
5jQuery().ready(function(){
6    // Resize possible for textarea
7    jQuery("#cf_message").resizable({
8        handles: "all",
9        animate: true,
10        animateDuration: "slow",
11        animateEasing: "swing",
12        preventDefault: true,
13        preserveCursor: true,
14        autoHide: true,
15        ghost: true
16      });
17  });
18jQuery().ready(function(){
19  // Resize possible for textarea
20  jQuery(".cf-input").resizable({
21        handles: "e",
22        animate: true,
23        animateDuration: "slow",
24        animateEasing: "swing",
25        preventDefault: true,
26        preserveCursor: true,
27        autoHide: true,
28        ghost: true
29      });
30  });
31
32function cf_validate() {
33  var items = new Array('cf_from_name','cf_from_mail','cf_subject','cf_message');
34  var is_mail = new Array(false,true,false,false);
35  var is_needed = new Array(
36    {/literal}{if $CF.NEED_NAME}true{else}false{/if}{literal},
37    {/literal}{if $CF.NEED_MAIL}true{else}false{/if}{literal},
38    true,true);
39  var messages = new Array(
40    '{/literal}{'cf_from_name_error'|@translate|@escape:javascript}{literal}',
41    '{/literal}{'cf_mail_format_error'|@translate|@escape:javascript}{literal}',
42    '{/literal}{'cf_subject_error'|@translate|@escape:javascript}{literal}',
43    '{/literal}{'cf_message_error'|@translate|@escape:javascript}{literal}');
44  var i;
45  for (i=0 ; i<items.length ; i++) {
46    var item = document.getElementById(items[i]);
47    var is_ok = cf_check_content(item, is_mail[i]);
48    if (!is_ok && is_needed[i]) {
49      alert(messages[i]);
50      item.focus();
51      return false;
52    }
53  }
54  return true;
55}
56{/literal}{/footer_script}
57
58<div id="subcontent" class="contact-form">
59  <form  method="post" action="{$CF.F_ACTION}" class="filter" id="contactform" onsubmit="return cf_validate();">
60  <div class="contact-form-content">
61    <table>
62      <tr>
63        <td class="contact-form-left">{'cf_from_name'|@translate}</td>
64        <td class="contact-form-right">
65        {if $CF.LOGGED}
66          <input type="text" name="cf_from_name_label" id="cf_from_name" size="40" value="{$CF.NAME}" disabled="disabled" class="cf-input-disabled">
67          <input type="hidden" name="cf_from_name" value="{$CF.NAME}" />
68        {else}
69          <input type="text" name="cf_from_name" id="cf_from_name" size="40" value="{$CF.NAME}" class="cf-input">
70        {/if}
71        </td>
72      </tr>
73      <tr>
74        <td class="contact-form-left">{'cf_from_mail'|@translate}</td>
75        <td class="contact-form-right">
76        {if $CF.LOGGED and ''!=$CF.EMAIL}
77          <input type="text" name="cf_from_mail_label" id="cf_from_mail" size="40" value="{$CF.EMAIL}" disabled="disabled" class="cf-input-disabled">
78          <input type="hidden" name="cf_from_mail" value="{$CF.EMAIL}" />
79        {else}
80          <input type="text" name="cf_from_mail" id="cf_from_mail" size="40" value="{$CF.EMAIL}" class="cf-input"></td>
81        {/if}
82        </td>
83      </tr>
84      <tr>
85        <td class="contact-form-left">{'cf_subject'|@translate}</td>
86        <td class="contact-form-right"><input type="text" name="cf_subject" id="cf_subject" size="40" value="{$CF.SUBJECT}" class="cf-input"></td>
87      </tr>
88      <tr>
89        <td class="contact-form-left" id="cf_message_label">{'cf_message'|@translate}</td>
90        <td class="contact-form-right"><textarea name="cf_message" id="cf_message" rows="10" cols="40">{$CF.MESSAGE}</textarea></td>
91      </tr>
92      <tr>
93        <td class="contact-form-left">&nbsp;</td>
94        <td class="contact-form-right"><input class="submit" type="submit" value="{'cf_submit'|@translate}"></td>
95      </tr>
96    </table>
97    <input type="hidden" name="cf_key" value="{$CF.KEY}" />
98    <input type="hidden" name="cf_id" value="{$CF.ID}" />
99  </div>
100  </form>
101</div>
Note: See TracBrowser for help on using the repository browser.