source: extensions/CryptograPHP/template/admin.tpl @ 15996

Last change on this file since 15996 was 15996, checked in by mistic100, 12 years ago

-add support for Guestbook
-add individual activation for each module
-increase default size
-clean index.php

File size: 9.9 KB
Line 
1{combine_css path=$CRYPTO_PATH|@cat:"template/colorpicker/colorpicker.css"}
2{combine_script id="jquery.colorpicker" require="jquery" path=$CRYPTO_PATH|@cat:"template/colorpicker/colorpicker.js"}
3
4{footer_script require='jquery.colorpicker'}{literal}
5jQuery(document).ready(function() {
6  // colorpicker
7  $('.colorpicker-input')
8    .ColorPicker({
9      onSubmit: function(hsb, hex, rgb, el) {
10        $(el).val(hex);
11        $(el).ColorPickerHide();
12      },
13      onChange: function(hsb, hex, rgb, el) {
14        $(el).val(hex);
15        changeColor(el, hex);
16        changePreview();
17        setThemeCutom();
18      },
19      onBeforeShow: function () {
20        $(this).ColorPickerSetColor(this.value);
21      }
22    })
23    .bind('keyup', function(){
24      $(this).ColorPickerSetColor(this.value);
25      changeColor(this, $(this).val());
26    })
27    .each(function() {
28      changeColor(this, $(this).val());
29    });
30 
31  // apply a preset
32  $('.preset').click(function() {
33    $('.preset').removeClass('selected');
34    $(this).addClass('selected');
35    eval('apply_'+ $(this).attr('title') +'();');
36    $('.colorpicker-input').each(function() { changeColor(this, $(this).val()); });
37    $('input[name=theme]').val($(this).attr('title'));
38    changePreview();
39  });
40 
41  // display customization panel
42  $('.customize').click(function() {
43    $('#theming').toggle();
44  });
45 
46  // change theme to 'custom' if a parameter is changed
47  $('input.istheme').change(function() {
48    setThemeCutom();
49  });
50 
51  // update the preview
52  $('input.istheme, input.preview').change(function() {
53    changePreview();
54  });
55  $('#captcha').click(function() {
56    changePreview();
57  });
58 
59  // links for random color
60  $('a.random').click(function() {
61    $(this).prev('label').children('input').val('random');
62    changeColor($(this).prev('label').children('input'), 'random');
63    changePreview();
64    setThemeCutom();
65  });
66});
67
68function setThemeCutom() {
69  $('.preset').removeClass('selected');
70  $('input[name=theme]').val('custom');
71}
72
73function changePreview()
74{
75  options = new Array();
76  str = '';
77 
78  $('input[type="text"], input[type="radio"]:checked').each(function() {
79    options[$(this).attr('name')] = $(this).val();
80  });
81 
82  for (x in options) {
83    str+= '&' + x + '=' + options[x];
84  }
85  $('#captcha').attr('src', '{/literal}{$CRYPTO_PATH}{literal}securimage/securimage_preview.php?' + new Date().getTime() + str);
86}
87
88function changeColor(target, color) {
89  if (color == 'random') color = '808080';
90  if (parseInt(color, 16) > 16777215/2) {
91    $(target).css('color', '#222');
92  } else {
93    $(target).css('color', '#ddd');
94  }
95  $(target).css('background', '#'+color)
96}
97{/literal}
98
99{$PRESETS_FUNC}
100{/footer_script}
101
102{html_head}
103<style type="text/css">
104{foreach from=$fonts item=font}
105@font-face {ldelim} 
106  font-family: {$font} ; 
107  src: url({$CRYPTO_PATH}securimage/fonts/{$font}.ttf) format("truetype"); 
108}
109{/foreach}
110
111.preset img {ldelim}
112  margin:1px;
113  padding:3px;
114  border:1px solid #999;
115}
116.preset.selected img {ldelim}
117  border-color:#f70;
118}
119</style>
120{/html_head}
121
122<div class="titrePage">
123  <h2>Crypto Captcha</h2>
124</div>
125
126<form method="post" class="properties">
127<fieldset>
128  <legend>{'Configuration'|@translate}</legend>
129 
130  <ul>
131    <li>
132      <span class="property">{'Activate on'|@translate}</span>
133      <label><input type="checkbox" name="activate_on[picture]" value="1" {if $crypto.activate_on.picture}checked="checked"{/if}> {'Picture comments'|@translate}</label>
134      {if $loaded.category}<label><input type="checkbox" name="activate_on[category]" value="1" {if $crypto.activate_on.category}checked="checked"{/if}> {'Album comments'|@translate}</label>{/if}
135      <label><input type="checkbox" name="activate_on[register]" value="1" {if $crypto.activate_on.register}checked="checked"{/if}> {'Register form'|@translate}</label>
136      {if $loaded.contactform}<label><input type="checkbox" name="activate_on[contactform]" value="1" {if $crypto.activate_on.contactform}checked="checked"{/if}> {'Contact form'|@translate}</label>{/if}
137      {if $loaded.guestbook}<label><input type="checkbox" name="activate_on[guestbook]" value="1" {if $crypto.activate_on.guestbook}checked="checked"{/if}> {'Guestbook'|@translate}</label>{/if}
138    </li>
139    <li>
140      <span class="property">{'Comments action'|@translate}</span>
141      <label><input type="radio" name="comments_action" value="reject" {if $crypto.comments_action == 'reject'}checked="checked"{/if}> {'Reject'|@translate}</label>
142      <label><input type="radio" name="comments_action" value="moderate" {if $crypto.comments_action == 'moderate'}checked="checked"{/if}> {'Moderate'|@translate}</label>
143    </li>
144    <li>
145      <span class="property">{'Captcha type'|@translate}</span>
146      <label><input type="radio" name="captcha_type" class="preview" value="string" {if $crypto.captcha_type == 'string'}checked="checked"{/if}> {'Random string'|@translate}</label>
147      <label><input type="radio" name="captcha_type" class="preview" value="math" {if $crypto.captcha_type == 'math'}checked="checked"{/if}> {'Simple equation'|@translate}</label>
148    </li>
149    <!--<li>
150      <span class="property">{'Case sensitive'|@translate}</span>
151      <label><input type="radio" name="case_sensitive" value="false" {if $crypto.case_sensitive == 'false'}checked="checked"{/if}> {'No'|@translate}</label>
152      <label><input type="radio" name="case_sensitive" value="true" {if $crypto.case_sensitive == 'true'}checked="checked"{/if}> {'Yes'|@translate}</label>
153    </li>-->
154    <li>
155      <span class="property">{'Code lenght'|@translate}</span>
156      <label><input type="text" name="code_length" class="preview" value="{$crypto.code_length}" size="6" maxlength="2"></label>
157    </li>
158    <li>
159      <span class="property">{'Width'|@translate}</span>
160      <label><input type="text" name="width" class="preview" value="{$crypto.width}" size="6" maxlength="3"> {'good value:'|@translate} lenght&times;30</label>
161    </li>
162    <li>
163      <span class="property">{'Height'|@translate}</span>
164      <label><input type="text" name="height" class="preview" value="{$crypto.height}" size="6" maxlength="3"> {'good value:'|@translate} lenght&times;12</label>
165    </li>
166    <li>
167      <span class="property">{'Captcha theme'|@translate}</span>
168      <div style="display:relative;margin-left:51%;">
169        {foreach from=$presets item=preset}
170        <a class="preset {if $crypto.theme == $preset}selected{/if}" title="{$preset}"><img src="{$CRYPTO_PATH}template/presets/{$preset}.png" alt="{$preset}"></a>
171        {/foreach}
172        <br><a class="customize">{'Customize'|@translate}</a><input type="hidden" name="theme" value="{$crypto.theme}">
173      </div>
174    </li>
175  </ul>
176 
177  <fieldset {if $crypto.theme != 'custom'}style="display:none;"{/if} id="theming">
178    <legend>{'Customize'|@translate}</legend>
179   
180    <ul>
181      <li>
182        <span class="property">{'Perturbation'|@translate}</span>
183        <label><input type="text" name="perturbation" value="{$crypto.perturbation}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 - 1</label>
184      </li>
185      <li>
186        <span class="property">{'Background color'|@translate}</span>
187        <label><input type="text" name="image_bg_color" value="{$crypto.image_bg_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
188        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
189      </li>
190      <li>
191        <span class="property">{'Text color'|@translate}</span>
192        <label><input type="text" name="text_color" value="{$crypto.text_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
193        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
194      </li>
195      <li>
196        <span class="property">{'Lines density'|@translate}</span>
197        <label><input type="text" name="num_lines" value="{$crypto.num_lines}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 - 10</label>
198      </li>
199      <li>
200        <span class="property">{'Lines color'|@translate}</span>
201        <label><input type="text" name="line_color" value="{$crypto.line_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
202        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
203      </li>
204      <li>
205        <span class="property">{'Noise level'|@translate}</span>
206        <label><input type="text" name="noise_level" value="{$crypto.noise_level}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 - 10</label>
207      </li>
208      <li>
209        <span class="property">{'Noise color'|@translate}</span>
210        <label><input type="text" name="noise_color" value="{$crypto.noise_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
211        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
212      </li>
213      <li>
214        <span class="property">{'Font'|@translate}</span>
215        <div style="display:relative;margin-left:51%;">
216          {foreach from=$fonts item=font}
217          <label style="font-family:{$font};" title="{$font}"><input type="radio" name="ttf_file" value="{$font}" {if $crypto.ttf_file == $font}checked="checked"{/if} class="istheme"> {$font}</label>
218          {/foreach}
219        </div>
220      </li>
221     
222      <li>
223        <span class="property">{'Preview'|@translate}</span>
224        <label><img id="captcha" src="{$CRYPTO_PATH}securimage/securimage_show.php" alt="CAPTCHA Image"></label>
225      </li>
226    </ul>
227   
228    {'Tip: type "random" on a color field to have a random color'|@translate}
229  </fieldset>
230 
231</fieldset>
232<p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit"></p>
233</form>
234
235<div style="text-align:right;">
236  All free fonts from <a href="http://www.dafont.com" target="_blank">dafont.com</a> |
237  Powered by : <a href="http://www.phpcaptcha.org/" target="_blank"><img src="{$CRYPTO_PATH}template/logo.png" alt="Secureimage"></a>
238</div>
Note: See TracBrowser for help on using the repository browser.