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

Last change on this file since 24143 was 24143, checked in by mistic100, 7 years ago

"random" must not be translated

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