1 | <?php |
---|
2 | load_plugin_lang('convert_pan'); |
---|
3 | |
---|
4 | switch ($PLUGIN_ACTION) { |
---|
5 | // Affichage simple de la configuration |
---|
6 | case 'read_config': |
---|
7 | $PAGE['content'] .= ' |
---|
8 | <table> |
---|
9 | <tr> |
---|
10 | <td>'.l10n('convert_pan.DetectMode').' :</td> |
---|
11 | <td>'.$plugin_config['DetectMode'].'</td> |
---|
12 | </tr>'; |
---|
13 | |
---|
14 | if ($plugin_config['DetectMode'] == 'name') { |
---|
15 | $PAGE['content'] .= ' |
---|
16 | <tr> |
---|
17 | <td>'.l10n('convert_pan.NAMEpanorama').' :</td> |
---|
18 | <td>'.$plugin_config['NAMEpanorama'].'</td> |
---|
19 | </tr>'; |
---|
20 | } else if ($plugin_config['DetectMode'] == 'ratio') { |
---|
21 | $PAGE['content'] .= ' |
---|
22 | <tr> |
---|
23 | <td>'.l10n('convert_pan.RatioPan').' :</td> |
---|
24 | <td>'.$plugin_config['RatioPan'].'</td> |
---|
25 | </tr>'; |
---|
26 | } |
---|
27 | |
---|
28 | $PAGE['content'] .= ' |
---|
29 | <tr> |
---|
30 | <td>'.l10n('convert_pan.DIMpanorama').' :</td> |
---|
31 | <td>'.$plugin_config['DIMpanorama'].' px</td> |
---|
32 | </tr> |
---|
33 | <tr> |
---|
34 | <td>'.l10n('convert_pan.RatioPanThumb').' :</td> |
---|
35 | <td>'.$plugin_config['RatioPanThumb'].'</td> |
---|
36 | </tr> |
---|
37 | </table>'; |
---|
38 | break; |
---|
39 | |
---|
40 | // Actions avant enregistrement |
---|
41 | case 'save_config': |
---|
42 | $_POST['Plugins']['convert_pan']['NAMEpanorama'] = delete_special_car($_POST['Plugins']['convert_pan']['NAMEpanorama']); |
---|
43 | |
---|
44 | if (!is_decimal($_POST['Plugins']['convert_pan']['DIMpanorama'])) { |
---|
45 | $_POST['Plugins']['convert_pan']['DIMpanorama'] = 500; |
---|
46 | $ERRORS['conf'][] = array(l10n('convert_pan.DIMpanorama'), 'must_be_integer'); |
---|
47 | } |
---|
48 | if (!is_decimal($_POST['Plugins']['convert_pan']['RatioPanThumb'])) { |
---|
49 | $_POST['Plugins']['convert_pan']['RatioPanThumb'] = 1.7; |
---|
50 | $ERRORS['conf'][] = array(l10n('convert_pan.RatioPanThumb'), 'must_be_decimal'); |
---|
51 | } |
---|
52 | if (!is_decimal($_POST['Plugins']['convert_pan']['RatioPan'])) { |
---|
53 | $_POST['Plugins']['convert_pan']['RatioPan'] = 2.85; |
---|
54 | $ERRORS['conf'][] = array(l10n('convert_pan.RatioPan'), 'must_be_decimal'); |
---|
55 | } |
---|
56 | |
---|
57 | break; |
---|
58 | |
---|
59 | // Formulaire d'édition |
---|
60 | case 'edit_config': |
---|
61 | $PAGE['content'] .= ' |
---|
62 | <script type="text/javascript"> |
---|
63 | function ToggleConfig(sel, section){ |
---|
64 | var obj = $("#convert_pan-tr-"+section); |
---|
65 | if(sel.checked){ |
---|
66 | obj.show(); |
---|
67 | }else{ |
---|
68 | obj.hide(); |
---|
69 | } |
---|
70 | } |
---|
71 | </script> |
---|
72 | |
---|
73 | <table> |
---|
74 | <tr> |
---|
75 | <td>'.l10n('convert_pan.DetectMode').' :</td> |
---|
76 | <td> |
---|
77 | <input type="radio" id="convert_pan-radio-name" name="Plugins[convert_pan][DetectMode]" value="name" onchange="ToggleConfig(this,\'name\');" '.(($plugin_config['DetectMode']=='name')?'checked="checked"':'').'/> |
---|
78 | <label for="convert_pan-radio-name">'.l10n('convert_pan.DetectMode.name').'</label> |
---|
79 | <input type="radio" id="convert_pan.radio.ratio" name="Plugins[convert_pan][DetectMode]" value="ratio" onchange="ToggleConfig(this,\'ratio\');" '.(($plugin_config['DetectMode']=='ratio')?'checked="checked"':'').'/> |
---|
80 | <label for="convert_pan-radio-ratio">'.l10n('convert_pan.DetectMode.ratio').'</label> |
---|
81 | </td> |
---|
82 | </tr> |
---|
83 | <tr id="convert_pan-tr-name"> |
---|
84 | <td>'.l10n('convert_pan.NAMEpanorama').' :</td> |
---|
85 | <td><input type="text" name="Plugins[convert_pan][NAMEpanorama]" value="'.$plugin_config['NAMEpanorama'].'" size="6"/></td> |
---|
86 | </tr> |
---|
87 | <tr id="convert_pan-tr-ratio"> |
---|
88 | <td>'.l10n('convert_pan.RatioPan').' :</td> |
---|
89 | <td><input type="text" name="Plugins[convert_pan][RatioPan]" value="'.$plugin_config['RatioPan'].'" size="3"/>px</td> |
---|
90 | </tr> |
---|
91 | |
---|
92 | <tr> |
---|
93 | <td>'.l10n('convert_pan.DIMpanorama').' :</td> |
---|
94 | <td> |
---|
95 | <input type="text" name="Plugins[convert_pan][DIMpanorama]" value="'.$plugin_config['DIMpanorama'].'" size="3"/>px |
---|
96 | <i>'.l10n('convert_pan.unactive').'</i> |
---|
97 | </td> |
---|
98 | </tr> |
---|
99 | <tr> |
---|
100 | <td>'.l10n('convert_pan.RatioPanThumb').' :</td> |
---|
101 | <td> |
---|
102 | <input type="text" name="Plugins[convert_pan][RatioPanThumb]" value="'.$plugin_config['RatioPanThumb'].'" size="3"/> |
---|
103 | <i>'.l10n('convert_pan.unactive').'</i> |
---|
104 | </td> |
---|
105 | </tr> |
---|
106 | </table> |
---|
107 | |
---|
108 | <script type="text/javascript"> |
---|
109 | ToggleConfig(document.forms[0].elements["Plugins[convert_pan][DetectMode]"][0], "name"); |
---|
110 | ToggleConfig(document.forms[0].elements["Plugins[convert_pan][DetectMode]"][1], "ratio"); |
---|
111 | </script>'; |
---|
112 | break; |
---|
113 | } |
---|
114 | ?> |
---|