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

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

change reload icon with color choice (dark or light), separate HTML and PHP

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