1 | <?php |
---|
2 | switch ($PLUGIN_ACTION) { |
---|
3 | // Affichage simple de la configuration |
---|
4 | case 'read_config': |
---|
5 | load_plugin_lang('create_custom_thumbs'); |
---|
6 | |
---|
7 | $plugin_config['FRAMEparams']['color1'] = nice_hex_color($plugin_config['FRAMEparams']['color1']); |
---|
8 | $plugin_config['FRAMEparams']['color2'] = nice_hex_color($plugin_config['FRAMEparams']['color2']); |
---|
9 | |
---|
10 | $PAGE_CONTENT[0] .= '<table> |
---|
11 | <tr> |
---|
12 | <td>'.l10n('create_custom_thumbs.DIMthumbnailV').' :</td> |
---|
13 | <td>'.bool_to_string($plugin_config['DIMthumbnailV']).'</td> |
---|
14 | </tr> |
---|
15 | <tr> |
---|
16 | <td>'.l10n('create_custom_thumbs.FRAMEparams').' 1 :</td> |
---|
17 | <td> |
---|
18 | #'.$plugin_config['FRAMEparams']['color1'].' |
---|
19 | <span class="color-display" style="background-color:#'.nice_hex_color($plugin_config['FRAMEparams']['color1']).';"> </span> |
---|
20 | '.$plugin_config['FRAMEparams']['size1'].'px |
---|
21 | </td> |
---|
22 | </tr> |
---|
23 | <tr> |
---|
24 | <td>'.l10n('create_custom_thumbs.FRAMEparams').' 2 :</td> |
---|
25 | <td> |
---|
26 | #'.$plugin_config['FRAMEparams']['color2'].' |
---|
27 | <span class="color-display" style="background-color:#'.nice_hex_color($plugin_config['FRAMEparams']['color2']).';"> </span> |
---|
28 | '.$plugin_config['FRAMEparams']['size2'].'px |
---|
29 | </td> |
---|
30 | </tr> |
---|
31 | </table>'; |
---|
32 | break; |
---|
33 | |
---|
34 | |
---|
35 | // Actions avant enregistrement |
---|
36 | case 'save_config': |
---|
37 | $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['color1'] = str_replace('#','', $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['color1']); |
---|
38 | $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['color2'] = str_replace('#','', $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['color2']); |
---|
39 | |
---|
40 | if (!is_decimal($_POST['Plugins']['create_custom_thumbs']['DIMthumbnailV'])) { |
---|
41 | $_POST['Plugins']['create_custom_thumbs']['DIMthumbnailV'] = 0; |
---|
42 | $Errors['ErrorConfig'] = 'notice'; |
---|
43 | } |
---|
44 | if (!is_decimal($_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['size1'])) { |
---|
45 | $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['size1'] = 0; |
---|
46 | $Errors['ErrorConfig'] = 'notice'; |
---|
47 | } |
---|
48 | if (!is_decimal($_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['size2'])) { |
---|
49 | $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['size2'] = 0; |
---|
50 | $Errors['ErrorConfig'] = 'notice'; |
---|
51 | } |
---|
52 | |
---|
53 | break; |
---|
54 | |
---|
55 | |
---|
56 | // Formulaire d'édition |
---|
57 | case 'edit_config': |
---|
58 | load_plugin_lang('create_custom_thumbs'); |
---|
59 | |
---|
60 | $plugin_config['FRAMEparams']['color1'] = nice_hex_color($plugin_config['FRAMEparams']['color1']); |
---|
61 | $plugin_config['FRAMEparams']['color2'] = nice_hex_color($plugin_config['FRAMEparams']['color2']); |
---|
62 | |
---|
63 | $PAGE_CONTENT[0] .='<table> |
---|
64 | <tr> |
---|
65 | <td>'.l10n('create_custom_thumbs.DIMthumbnailV').' :</td> |
---|
66 | <td> |
---|
67 | <input type="text" name="Plugins[create_custom_thumbs][DIMthumbnailV]" value="'.$plugin_config['DIMthumbnailV'].'" size="3"/> |
---|
68 | <i>'.l10n('create_custom_thumbs.unactive').'</i> |
---|
69 | </td> |
---|
70 | </tr> |
---|
71 | <tr> |
---|
72 | <td>'.l10n('create_custom_thumbs.FRAMEparams').' 1 :</td> |
---|
73 | <td> |
---|
74 | <input type="text" id="CCT-color1" name="Plugins[create_custom_thumbs][FRAMEparams][color1]" value="'.$plugin_config['FRAMEparams']['color1'].'" size="6"/> |
---|
75 | <input type="text" name="Plugins[create_custom_thumbs][FRAMEparams][size1]" value="'.$plugin_config['FRAMEparams']['size1'].'" size="1"/>px |
---|
76 | <i>'.l10n('create_custom_thumbs.unactive').'</i> |
---|
77 | </td> |
---|
78 | </tr> |
---|
79 | <tr> |
---|
80 | <td>'.l10n('create_custom_thumbs.FRAMEparams').' 2 :</td> |
---|
81 | <td> |
---|
82 | <input type="text" id="CCT-color2" name="Plugins[create_custom_thumbs][FRAMEparams][color2]" value="'.$plugin_config['FRAMEparams']['color2'].'" size="6"/> |
---|
83 | <input type="text" name="Plugins[create_custom_thumbs][FRAMEparams][size2]" value="'.$plugin_config['FRAMEparams']['size2'].'" size="1"/>px |
---|
84 | <i>'.l10n('create_custom_thumbs.unactive').'</i> |
---|
85 | </td> |
---|
86 | </tr> |
---|
87 | <script type="text/javascript"> |
---|
88 | $("#CCT-color1").ColorPicker({ |
---|
89 | onSubmit: function(hsb, hex, rgb, el) { $(el).val(hex); $(el).ColorPickerHide(); }, |
---|
90 | onChange: function(hsb, hex, rgb, el) { $("#CCT-color1").val(hex); }, |
---|
91 | onBeforeShow: function () { $(this).ColorPickerSetColor(this.value); } |
---|
92 | }) .bind("keyup", function(){ $(this).ColorPickerSetColor(this.value); }); |
---|
93 | $("#CCT-color2").ColorPicker({ |
---|
94 | onSubmit: function(hsb, hex, rgb, el) { $(el).val(hex); (el).ColorPickerHide(); }, |
---|
95 | onChange: function(hsb, hex, rgb, el) { $("#CCT-color2").val(hex); }, |
---|
96 | onBeforeShow: function () { $(this).ColorPickerSetColor(this.value); } |
---|
97 | }) .bind("keyup", function(){ $(this).ColorPickerSetColor(this.value); }); |
---|
98 | </script> |
---|
99 | </table>'; |
---|
100 | break; |
---|
101 | } |
---|
102 | ?> |
---|