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

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

update for 2.4
deactivated for smartpocket, now compatible with simple and stripped on ContactForm
live update of preview on admin page

File size: 9.1 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">{'Comments action'|@translate}</span>
133      <label><input type="radio" name="comments_action" value="inactive" {if $crypto.comments_action == 'inactive'}checked="checked"{/if}> {'No captcha'|@translate}</label>
134      <label><input type="radio" name="comments_action" value="reject" {if $crypto.comments_action == 'reject'}checked="checked"{/if}> {'Reject'|@translate}</label>
135      <label><input type="radio" name="comments_action" value="moderate" {if $crypto.comments_action == 'moderate'}checked="checked"{/if}> {'Moderate'|@translate}</label>
136    </li>
137    <li>
138      <span class="property">{'Captcha type'|@translate}</span>
139      <label><input type="radio" name="captcha_type" class="preview" value="string" {if $crypto.captcha_type == 'string'}checked="checked"{/if}> {'Random string'|@translate}</label>
140      <label><input type="radio" name="captcha_type" class="preview" value="math" {if $crypto.captcha_type == 'math'}checked="checked"{/if}> {'Simple equation'|@translate}</label>
141    </li>
142    <!--<li>
143      <span class="property">{'Case sensitive'|@translate}</span>
144      <label><input type="radio" name="case_sensitive" value="false" {if $crypto.case_sensitive == 'false'}checked="checked"{/if}> {'No'|@translate}</label>
145      <label><input type="radio" name="case_sensitive" value="true" {if $crypto.case_sensitive == 'true'}checked="checked"{/if}> {'Yes'|@translate}</label>
146    </li>-->
147    <li>
148      <span class="property">{'Code lenght'|@translate}</span>
149      <label><input type="text" name="code_length" class="preview" value="{$crypto.code_length}" size="6" maxlength="2"></label>
150    </li>
151    <li>
152      <span class="property">{'Width'|@translate}</span>
153      <label><input type="text" name="width" class="preview" value="{$crypto.width}" size="6" maxlength="3"> {'good value:'|@translate} lenght&times;20</label>
154    </li>
155    <li>
156      <span class="property">{'Height'|@translate}</span>
157      <label><input type="text" name="height" class="preview" value="{$crypto.height}" size="6" maxlength="3"> {'good value:'|@translate} width/4</label>
158    </li>
159    <li>
160      <span class="property">{'Captcha theme'|@translate}</span>
161      <div style="display:relative;margin-left:51%;">
162        {foreach from=$presets item=preset}
163        <a class="preset {if $crypto.theme == $preset}selected{/if}" title="{$preset}"><img src="{$CRYPTO_PATH}template/presets/{$preset}.png" alt="{$preset}"></a>
164        {/foreach}
165        <br><a class="customize">{'Customize'|@translate}</a><input type="hidden" name="theme" value="{$crypto.theme}">
166      </div>
167    </li>
168  </ul>
169 
170  <fieldset {if $crypto.theme != 'custom'}style="display:none;"{/if} id="theming">
171    <legend>{'Customize'|@translate}</legend>
172   
173    <ul>
174      <li>
175        <span class="property">{'Perturbation'|@translate}</span>
176        <label><input type="text" name="perturbation" value="{$crypto.perturbation}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 - 1</label>
177      </li>
178      <li>
179        <span class="property">{'Background color'|@translate}</span>
180        <label><input type="text" name="image_bg_color" value="{$crypto.image_bg_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
181        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
182      </li>
183      <li>
184        <span class="property">{'Text color'|@translate}</span>
185        <label><input type="text" name="text_color" value="{$crypto.text_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
186        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
187      </li>
188      <li>
189        <span class="property">{'Lines density'|@translate}</span>
190        <label><input type="text" name="num_lines" value="{$crypto.num_lines}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 - 10</label>
191      </li>
192      <li>
193        <span class="property">{'Lines color'|@translate}</span>
194        <label><input type="text" name="line_color" value="{$crypto.line_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
195        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
196      </li>
197      <li>
198        <span class="property">{'Noise level'|@translate}</span>
199        <label><input type="text" name="noise_level" value="{$crypto.noise_level}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 - 10</label>
200      </li>
201      <li>
202        <span class="property">{'Noise color'|@translate}</span>
203        <label><input type="text" name="noise_color" value="{$crypto.noise_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
204        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
205      </li>
206      <li>
207        <span class="property">{'Font'|@translate}</span>
208        <div style="display:relative;margin-left:51%;">
209          {foreach from=$fonts item=font}
210          <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>
211          {/foreach}
212        </div>
213      </li>
214     
215      <li>
216        <span class="property">{'Preview'|@translate}</span>
217        <label><img id="captcha" src="{$CRYPTO_PATH}securimage/securimage_show.php" alt="CAPTCHA Image"></label>
218      </li>
219    </ul>
220   
221    {'Tip: type "random" on a color field to have a random color'|@translate}
222  </fieldset>
223 
224  <p class="bottomButtons">
225    <input class="submit" type="submit" value="{'Submit'|@translate}" name="submit">
226  </p>
227</fieldset>
228</form>
229
230<div style="text-align:right;">
231  All free fonts from <a href="http://www.dafont.com" target="_blank">dafont.com</a> |
232  Powered by : <a href="http://www.phpcaptcha.org/" target="_blank"><img src="{$CRYPTO_PATH}template/logo.png" alt="Secureimage"></a>
233</div>
Note: See TracBrowser for help on using the repository browser.