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

Last change on this file since 23209 was 23209, checked in by mistic100, 11 years ago

rewrite config page

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_head}
137<style type="text/css">
138{foreach from=$fonts item=font}
139@font-face {ldelim} 
140  font-family: {$font} ; 
141  src: url({$CRYPTO_PATH}securimage/fonts/{$font}.ttf) format("truetype"); 
142}
143{/foreach}
144</style>
145{/html_head}
146
147
148<div class="titrePage">
149  <h2>Crypto Captcha</h2>
150</div>
151
152<form method="post" class="properties">
153<fieldset>
154  <legend>{'Configuration'|@translate}</legend>
155 
156  <ul>
157    <li>
158      <b>{'Activate on'|@translate}</b>
159      <select name="activate_on[]" multiple>
160        <option value="picture" {if $crypto.activate_on.picture}selected{/if}>{'Picture comments'|@translate}</option>
161        {if $loaded.category}<option value="category" {if $crypto.activate_on.category}selected{/if}>{'Album comments'|@translate}</option>{/if}
162        <option value="register" {if $crypto.activate_on.register}selected{/if}>{'Register form'|@translate}</option>
163        {if $loaded.contactform}<option value="contactform" {if $crypto.activate_on.contactform}selected{/if}>{'Contact form'|@translate}</option>{/if}
164        {if $loaded.guestbook}<option value="guestbook" {if $crypto.activate_on.guestbook}selected{/if}>{'Guestbook'|@translate}</option>{/if}
165      </select>
166    </li>
167    <li>
168      <b>{'Comments action'|@translate}</b>
169      <label><input type="radio" name="comments_action" value="reject" {if $crypto.comments_action == 'reject'}checked="checked"{/if}> {'Reject'|@translate}</label>
170      <label><input type="radio" name="comments_action" value="moderate" {if $crypto.comments_action == 'moderate'}checked="checked"{/if}> {'Moderate'|@translate}</label>
171    </li>
172    <li>
173      <b>{'Captcha type'|@translate}</b>
174      <label><input type="radio" name="captcha_type" class="preview" value="string" {if $crypto.captcha_type == 'string'}checked="checked"{/if}> {'Random string'|@translate}</label>
175      <label><input type="radio" name="captcha_type" class="preview" value="math" {if $crypto.captcha_type == 'math'}checked="checked"{/if}> {'Simple equation'|@translate}</label>
176    </li>
177    <!--<li>
178      <b>{'Case sensitive'|@translate}</b>
179      <label><input type="radio" name="case_sensitive" value="false" {if $crypto.case_sensitive == 'false'}checked="checked"{/if}> {'No'|@translate}</label>
180      <label><input type="radio" name="case_sensitive" value="true" {if $crypto.case_sensitive == 'true'}checked="checked"{/if}> {'Yes'|@translate}</label>
181    </li>-->
182    <li>
183      <b>{'Code lenght'|@translate}</b>
184      <label><input type="text" name="code_length" class="preview" value="{$crypto.code_length}" size="6" maxlength="2"></label>
185    </li>
186    <li>
187      <b>{'Width'|@translate}</b>
188      <label><input type="text" name="width" class="preview" value="{$crypto.width}" size="6" maxlength="3"> {'good value:'|@translate} lenght&times;30</label>
189    </li>
190    <li>
191      <b>{'Height'|@translate}</b>
192      <label><input type="text" name="height" class="preview" value="{$crypto.height}" size="6" maxlength="3"> {'good value:'|@translate} lenght&times;12</label>
193    </li>
194    <li>
195      <b>{'Button color'|@translate}</b>
196      <a class="button {if $crypto.button_color == 'dark'}selected{/if}" title="dark"><img src="{$CRYPTO_PATH}template/refresh_dark.png" alt="dark"></a>
197      <a class="button {if $crypto.button_color == 'light'}selected{/if}" title="light"><img src="{$CRYPTO_PATH}template/refresh_light.png" alt="light"></a>
198      <input type="hidden" name="button_color" value="{$crypto.button_color}">
199    </li>
200    <li>
201      <b>{'Captcha theme'|@translate}</b>
202      {foreach from=$PRESETS key=preset item=params}
203      <a class="preset {if $crypto.theme == $preset}selected{/if}" title="{$preset}"><img src="{$CRYPTO_PATH}template/presets/{$preset}.png" alt="{$preset}"></a>
204      {/foreach}
205      <input type="hidden" name="theme" value="{$crypto.theme}">
206      <a class="customize">{'Customize'|@translate}</a>
207    </li>
208  </ul>
209 
210  <fieldset {if $crypto.theme != 'custom'}style="display:none;"{/if} id="theming">
211    <legend>{'Customize'|@translate}</legend>
212   
213    <ul>
214      <li>
215        <b>{'Perturbation'|@translate}</b>
216        <label><input type="text" name="perturbation" value="{$crypto.perturbation}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 - 1</label>
217      </li>
218      <li>
219        <b>{'Background color'|@translate}</b>
220        <label><input type="text" name="image_bg_color" value="{$crypto.image_bg_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
221        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
222      </li>
223      <li>
224        <b>{'Text color'|@translate}</b>
225        <label><input type="text" name="text_color" value="{$crypto.text_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
226        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
227      </li>
228      <li>
229        <b>{'Lines density'|@translate}</b>
230        <label><input type="text" name="num_lines" value="{$crypto.num_lines}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 - 10</label>
231      </li>
232      <li>
233        <b>{'Lines color'|@translate}</b>
234        <label><input type="text" name="line_color" value="{$crypto.line_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
235        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
236      </li>
237      <li>
238        <b>{'Noise level'|@translate}</b>
239        <label><input type="text" name="noise_level" value="{$crypto.noise_level}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 - 10</label>
240      </li>
241      <li>
242        <b>{'Noise color'|@translate}</b>
243        <label><input type="text" name="noise_color" value="{$crypto.noise_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
244        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
245      </li>
246      <li>
247        <b>{'Font'|@translate}</b>
248        {foreach from=$fonts item=font}
249        <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>
250        {/foreach}
251      </li>
252    </ul>
253   
254    {'Tip: type "random" on a color field to have a random color'|@translate}
255  </fieldset>
256 
257  <ul style="margin-top:30px;">
258    <li>
259      <b>{'Preview'|@translate}</b>
260      <img id="captcha" src="{$CRYPTO_PATH}securimage/securimage_show.php" alt="CAPTCHA Image">
261      <a href="#" onClick="return false;"><img id="reload" src="{$CRYPTO_PATH}template/refresh_{$crypto.button_color}.png"></a>
262    </li>
263  </ul>
264 
265</fieldset>
266
267<p class="formButtons"><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit"></p>
268</form>
269
270<div style="text-align:right;">
271  All free fonts from <a href="http://www.dafont.com" target="_blank">dafont.com</a> |
272  Powered by : <a href="http://www.phpcaptcha.org/" target="_blank"><img src="{$CRYPTO_PATH}template/logo.png" alt="Secureimage"></a>
273</div>
Note: See TracBrowser for help on using the repository browser.