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

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

display 'Invalid captcha' error even if the comment is already rejected

File size: 9.1 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 
[14527]31  // apply a preset
[12617]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'));
[14527]38    changePreview();
[12617]39  });
40 
[14527]41  // display customization panel
[12617]42  $('.customize').click(function() {
[14527]43    $('#theming').toggle();
[12617]44  });
45 
[14527]46  // change theme to 'custom' if a parameter is changed
[12617]47  $('input.istheme').change(function() {
[14527]48    setThemeCutom();
[12617]49  });
[14527]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  });
[12617]66});
67
[14527]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
[12617]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}
[14527]110
[12617]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>
[14527]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>
[12617]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>
[14527]149      <label><input type="text" name="code_length" class="preview" value="{$crypto.code_length}" size="6" maxlength="2"></label>
[12617]150    </li>
151    <li>
152      <span class="property">{'Width'|@translate}</span>
[14527]153      <label><input type="text" name="width" class="preview" value="{$crypto.width}" size="6" maxlength="3"> {'good value:'|@translate} lenght&times;20</label>
[12617]154    </li>
155    <li>
156      <span class="property">{'Height'|@translate}</span>
[14527]157      <label><input type="text" name="height" class="preview" value="{$crypto.height}" size="6" maxlength="3"> {'good value:'|@translate} width/4</label>
[12617]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>
[14527]176        <label><input type="text" name="perturbation" value="{$crypto.perturbation}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 - 1</label>
[12617]177      </li>
178      <li>
179        <span class="property">{'Background color'|@translate}</span>
[14527]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>
[12617]182      </li>
183      <li>
184        <span class="property">{'Text color'|@translate}</span>
[14527]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>
[12617]187      </li>
188      <li>
189        <span class="property">{'Lines density'|@translate}</span>
[14527]190        <label><input type="text" name="num_lines" value="{$crypto.num_lines}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 - 10</label>
[12617]191      </li>
192      <li>
193        <span class="property">{'Lines color'|@translate}</span>
[14527]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>
[12617]196      </li>
197      <li>
198        <span class="property">{'Noise level'|@translate}</span>
[14527]199        <label><input type="text" name="noise_level" value="{$crypto.noise_level}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 - 10</label>
[12617]200      </li>
201      <li>
202        <span class="property">{'Noise color'|@translate}</span>
[14527]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>
[12617]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</fieldset>
[15118]225<p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit"></p>
[12617]226</form>
227
228<div style="text-align:right;">
229  All free fonts from <a href="http://www.dafont.com" target="_blank">dafont.com</a> |
230  Powered by : <a href="http://www.phpcaptcha.org/" target="_blank"><img src="{$CRYPTO_PATH}template/logo.png" alt="Secureimage"></a>
231</div>
Note: See TracBrowser for help on using the repository browser.