1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Plugin Name : Look_Like_GBO 2 | |
---|
4 | // | Plugin Version : 2.0 | |
---|
5 | // | File Version : 0.1 | |
---|
6 | // | Plugin Version author : Ex-FTB | |
---|
7 | // | Plugin description : | |
---|
8 | // | Ce plugin permet d'afficher les miniatures au survol des boutons | |
---|
9 | // | de navigation. This plugin allows display thumbnail under buton | |
---|
10 | // +-----------------------------------------------------------------------+ |
---|
11 | // | This program is free software; you can redistribute it and/or modify | |
---|
12 | // | it under the terms of the GNU General Public License as published by | |
---|
13 | // | the Free Software Foundation | |
---|
14 | // | | |
---|
15 | // | This program is distributed in the hope that it will be useful, but | |
---|
16 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
17 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
18 | // | General Public License for more details. | |
---|
19 | // | | |
---|
20 | // | You should have received a copy of the GNU General Public License | |
---|
21 | // | along with this program; if not, write to the Free Software | |
---|
22 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
23 | // | USA. | |
---|
24 | // +-----------------------------------------------------------------------+ |
---|
25 | |
---|
26 | // *************************************** |
---|
27 | // ** Plugin Administration panel setup ** |
---|
28 | // *************************************** |
---|
29 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
30 | include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); |
---|
31 | $my_base_url = get_admin_plugin_menu_link(__FILE__); |
---|
32 | // Setup plugin Language |
---|
33 | load_language('plugin.lang', LLGBO_PATH); |
---|
34 | // +-----------------------------------------------------------------------+ |
---|
35 | // | Tabssheet |
---|
36 | // +-----------------------------------------------------------------------+ |
---|
37 | if (!isset($_GET['tab'])) |
---|
38 | { $page['tab'] = 'manage';} |
---|
39 | else |
---|
40 | {$page['tab'] = $_GET['tab'];} |
---|
41 | |
---|
42 | $tabsheet = new tabsheet(); |
---|
43 | $tabsheet->add('manage', |
---|
44 | l10n('llgbo_M_manage'), |
---|
45 | $my_base_url.'&tab=manage'); |
---|
46 | $tabsheet->add('tooltip', |
---|
47 | l10n('llgbo_M_tooltip'), |
---|
48 | $my_base_url.'&tab=tooltip'); |
---|
49 | If ($page['tab'] == 'manage') |
---|
50 | {if (!isset($_POST['llgbo_frame']) ) |
---|
51 | {$conf['LLGBO_SETTINGS'][0] = 'false';} |
---|
52 | else |
---|
53 | {$conf['LLGBO_SETTINGS'][0]= $_POST['llgbo_frame'];}} |
---|
54 | |
---|
55 | if ($conf['LLGBO_SETTINGS'][0] == 'true') |
---|
56 | {$tabsheet->add('frame', |
---|
57 | l10n('llgbo_M_frame'), |
---|
58 | $my_base_url.'&tab=frame');} |
---|
59 | |
---|
60 | |
---|
61 | |
---|
62 | $tabsheet->assign(); |
---|
63 | if ($page['tab'] == 'manage') |
---|
64 | {$template->set_filenames( array('llgbo_admin_content' => dirname(__FILE__).'/llgbo_adminsettings.tpl') );} |
---|
65 | if ($page['tab'] == 'tooltip') |
---|
66 | {$template->set_filenames( array('llgbo_admin_content' => dirname(__FILE__).'/llgbo_admintooltip.tpl') );} |
---|
67 | if ($page['tab'] == 'frame' ) |
---|
68 | {$template->set_filenames( array('llgbo_admin_content' => dirname(__FILE__).'/llgbo_adminframe.tpl') );} |
---|
69 | $tabsheet->select($page['tab']); |
---|
70 | /* ****************************************************** */ |
---|
71 | /* Plugin template initialisation for admin panel display */ |
---|
72 | /* ****************************************************** */ |
---|
73 | global $template , $conf,$lang; |
---|
74 | {$template->assign( 'LLGBO_VERSION' , LLGBO_INFO_VERSION);} |
---|
75 | $me = get_plugin_data($plugin_id); |
---|
76 | $template->clear_assign('LLGBOINFO'); |
---|
77 | // Load configuration settings from database |
---|
78 | |
---|
79 | |
---|
80 | $template->append('head_elements', |
---|
81 | '<script type="text/javascript" src="./plugins/look_like_gbo2/farbtastic/farbtastic.js"></script> |
---|
82 | <link rel="stylesheet" type="text/css" |
---|
83 | href="./plugins/look_like_gbo2/farbtastic/farbtastic.css" /> |
---|
84 | <link rel="stylesheet" type="text/css" |
---|
85 | href="./plugins/look_like_gbo2/css/look_like_gbo2_admin.css" /> |
---|
86 | <! --- LLGBO tooltip css--> |
---|
87 | <style type="text/css"> |
---|
88 | #toolTip {background:'.$conf['LLGBO_TOOLTIP'][3].';color:'.$conf['LLGBO_TOOLTIP'][5].';border:'.$conf['LLGBO_TOOLTIP'][1].'px solid '.$conf['LLGBO_TOOLTIP'][2].';padding:5px;min-height:1em;-moz-border-radius:5px} |
---|
89 | #toolTip p {margin:0;padding:0;color:'.$conf['LLGBO_TOOLTIP'][5].';font-size:0.8em;font-family:Verdana,Arial,Helvetica,sans-serif;text-align:left} |
---|
90 | #toolTip title {color:'.$conf['LLGBO_TOOLTIP'][4].';text-align:center;padding:0 0 3px 0;font-weight:bold} |
---|
91 | </style>'); |
---|
92 | |
---|
93 | |
---|
94 | // Update configuration settings in database |
---|
95 | ////// SETTINGS |
---|
96 | if (($page['tab'] == 'manage') or ( !isset($_GET['tab']))){ |
---|
97 | if ( isset($_POST['submit']) ) |
---|
98 | { |
---|
99 | if (!isset($_POST['llgbo_frame'])) {$_POST['llgbo_frame'] = 'false';} |
---|
100 | if (!isset($_POST['llgbo_tooltip'])) {$_POST['llgbo_tooltip'] = 'false';} |
---|
101 | if (!isset($_POST['llgbo_exifunderbt'])) {$_POST['llgbo_exifunderbt'] = 'false';} |
---|
102 | if (!isset($_POST['llgbo_usemap'])) {$_POST['llgbo_usemap'] = 'false';} |
---|
103 | if (!isset($_POST['llgbo_usemap_thumb'])) {$_POST['llgbo_usemap_thumb'] = 'false';} |
---|
104 | if (!isset($_POST['llgbo_title_frame'])) {$_POST['llgbo_title_frame'] = 'false';} |
---|
105 | if (!isset($_POST['llgbo_header'])) {$_POST['llgbo_header'] = 'false';} |
---|
106 | if (!isset($_POST['llgbo_maintain_header'])) {$_POST['llgbo_maintain_header'] = '';} |
---|
107 | if (!isset($_POST['llgbo_allinfo'])) {$_POST['llgbo_allinfo'] = 'false';} |
---|
108 | if (!isset($_POST['llgbo_default_navthumb'])) {$_POST['llgbo_default_navthumb'] = 'false';} //9 } |
---|
109 | $param_llgbo = array($_POST['llgbo_frame'], |
---|
110 | $_POST['llgbo_tooltip'], $_POST['llgbo_exifunderbt'], |
---|
111 | $_POST['llgbo_usemap'], $_POST['llgbo_usemap_thumb'], |
---|
112 | $_POST['llgbo_title_frame'], $_POST['llgbo_header'], |
---|
113 | $_POST['llgbo_maintain_header'], $_POST['llgbo_allinfo'], |
---|
114 | $_POST['llgbo_default_navthumb'] |
---|
115 | ); |
---|
116 | $llgbo_new_value = implode ("," , $param_llgbo); |
---|
117 | $query = ' |
---|
118 | UPDATE ' . CONFIG_TABLE . ' |
---|
119 | SET value="'.$llgbo_new_value. '" |
---|
120 | WHERE param="LLGBO" |
---|
121 | LIMIT 1'; |
---|
122 | pwg_query($query); |
---|
123 | $template->assign('LLGBOINFO','llgbo_info'); |
---|
124 | $conf['LLGBO_SETTINGS'] = explode ("," ,$llgbo_new_value); |
---|
125 | } |
---|
126 | |
---|
127 | // Reload settings for correct display after update |
---|
128 | if ($conf['LLGBO_SETTINGS'][0] == 'true') |
---|
129 | {$template->assign( 'LLGBO_FRAME' , 'true');} else {$template->assign( 'LLGBO_FRAME' , 'false');} |
---|
130 | if ($conf['LLGBO_SETTINGS'][1] == 'true') |
---|
131 | {$template->assign( 'LLGBO_TOOLTIP_DISP' , 'true');} else {$template->assign( 'LLGBO_TOOLTIP_DISP' , "false");} |
---|
132 | if ($conf['LLGBO_SETTINGS'][2] == 'true') |
---|
133 | {$template->assign('LLGBO_EXIFUNDERBT' , 'true');} else {$template->assign( 'LLGBO_EXIFUNDERBT' , "false");} |
---|
134 | if ($conf['LLGBO_SETTINGS'][3] == 'true') |
---|
135 | {$template->assign( array( 'LLGBO_USEMAP' => 'true'));} else { $template->assign( array( 'LLGBO_USEMAP' => "false"));} |
---|
136 | if ($conf['LLGBO_SETTINGS'][4] == 'true') |
---|
137 | {$template->assign( array( 'LLGBO_USEMAP_THUMB' => 'true'));} else { $template->assign( array( 'LLGBO_USEMAP_THUMB' => "false"));} |
---|
138 | if ($conf['LLGBO_SETTINGS'][5] == 'true') |
---|
139 | {$template->assign( array( 'LLGBO_TITLE_FRAME' => 'true'));} else { $template->assign( array( 'LLGBO_TITLE_FRAME' => "false"));} |
---|
140 | if ($conf['LLGBO_SETTINGS'][6] == 'true') |
---|
141 | {$template->assign( array( 'LLGBO_HEADER' => 'true'));} else { $template->assign( array( 'LLGBO_HEADER' => "false"));} |
---|
142 | $template->assign(array( 'LLGBO_MAINTAIN_HEADER' => $conf['LLGBO_SETTINGS'][7])); |
---|
143 | if ($conf['LLGBO_SETTINGS'][8] == 'true') |
---|
144 | {$template->assign(array( 'LLGBO_ALLINFO' => 'true'));} else { $template->assign( array( 'LLGBO_ALLINFO' => "false"));} |
---|
145 | if ($conf['LLGBO_SETTINGS'][9] == 'true') |
---|
146 | {$template->assign(array( 'LLGBO_DEFAULT_NAVTHUMB' => 'true'));} else { $template->assign(array( 'LLGBO_DEFAULT_NAVTHUMB' => "false"));} |
---|
147 | } |
---|
148 | /////////////////////////////////////////////////////////////////////////////////////// |
---|
149 | //// TOOLTIP |
---|
150 | /////////////////////////////////////////////////////////////////////////////////////// |
---|
151 | if ($page['tab'] == 'tooltip') { |
---|
152 | if ( isset($_POST['save']) or isset($_POST['preview'])) |
---|
153 | { |
---|
154 | if (!isset($_POST['llgbo_tooltip_width'])) {$_POST['llgbo_tooltip_width'] = '150';} |
---|
155 | if (!isset($_POST['llgbo_tooltip_size'])) {$_POST['llgbo_tooltip_size'] = '2';} |
---|
156 | if (!isset($_POST['llgbo_tooltip_bordercolor'])) {$_POST['llgbo_tooltip_bordercolor'] = '#fff';} |
---|
157 | if (!isset($_POST['llgbo_tooltip_backgroundcolor'])) {$_POST['llgbo_tooltip_backgroundcolor'] = '#000';} |
---|
158 | if (!isset($_POST['llgbo_tooltip_titlecolor'])) {$_POST['llgbo_tooltip_titlecolor'] = '#c92';} |
---|
159 | if (!isset($_POST['llgbo_tooltip_color'])) {$_POST['llgbo_tooltip_color'] = '#dadada';} |
---|
160 | |
---|
161 | $param_llgbo_tooltip = array( |
---|
162 | $_POST['llgbo_tooltip_width'], $_POST['llgbo_tooltip_size'] , |
---|
163 | $_POST['llgbo_tooltip_bordercolor'], $_POST['llgbo_tooltip_backgroundcolor'], |
---|
164 | $_POST['llgbo_tooltip_titlecolor'], $_POST['llgbo_tooltip_color']); |
---|
165 | $llgbo_newtooltip_value = implode ("," , $param_llgbo_tooltip); |
---|
166 | |
---|
167 | if ( isset($_POST['save']) ) |
---|
168 | { $query = ' |
---|
169 | UPDATE ' . CONFIG_TABLE . ' |
---|
170 | SET value="'.$llgbo_newtooltip_value.'" |
---|
171 | WHERE param="LLGBOTOOLTIP" |
---|
172 | LIMIT 1'; |
---|
173 | pwg_query($query); |
---|
174 | $template->assign('LLGBOINFO','llgbo_info'); |
---|
175 | } |
---|
176 | $conf['LLGBO_TOOLTIP'] = explode ("," ,$llgbo_newtooltip_value); |
---|
177 | } |
---|
178 | // Reload settings for correct display after update |
---|
179 | if (isset($conf['LLGBO_TOOLTIP'][0])) {$template->assign(array( 'LLGBO_TOOLTIP_WIDTH' => $conf['LLGBO_TOOLTIP'][0]));} |
---|
180 | if (isset($conf['LLGBO_TOOLTIP'][1])) {$template->assign(array( 'LLGBO_TOOLTIP_SIZE' => $conf['LLGBO_TOOLTIP'][1]));} |
---|
181 | if (isset($conf['LLGBO_TOOLTIP'][2])) {$template->assign(array( 'LLGBO_TOOLTIP_BORDERCOLOR' => $conf['LLGBO_TOOLTIP' ][2]));} |
---|
182 | if (isset($conf['LLGBO_TOOLTIP'][3])) {$template->assign(array( 'LLGBO_TOOLTIP_BACKGROUNDCOLOR' => $conf['LLGBO_TOOLTIP'][3]));} |
---|
183 | if (isset($conf['LLGBO_TOOLTIP'][4])) {$template->assign(array( 'LLGBO_TOOLTIP_TITLECOLOR' => $conf['LLGBO_TOOLTIP'][4]));} |
---|
184 | if (isset($conf['LLGBO_TOOLTIP'][5])) {$template->assign(array( 'LLGBO_TOOLTIP_COLOR' => $conf['LLGBO_TOOLTIP'][5]));} |
---|
185 | } |
---|
186 | |
---|
187 | /////////////////////////////////////////////// |
---|
188 | ///// FRAME |
---|
189 | ///////////////////////////////////////////////// |
---|
190 | if ($page['tab'] == 'frame') { |
---|
191 | if ( isset($_POST['save']) or isset($_POST['preview'])) |
---|
192 | { |
---|
193 | if (!isset($_POST['llgbo_title_frame_color'])) {$_POST['llgbo_title_frame_color'] = '#16195f';} |
---|
194 | for ($i = 0 ;$i < 16 ; $i++) |
---|
195 | { if (!isset($_POST['llgbo_frame_bdcolor'.$i])) {$_POST['llgbo_frame_bdcolor'.$i] = '#fff' ;} |
---|
196 | if (!isset($_POST['llgbo_frame_bdsize'.$i])) {$_POST['llgbo_frame_bdsize'.$i] = '1' ;} |
---|
197 | } |
---|
198 | |
---|
199 | $param_llgbo_frame = array( |
---|
200 | $_POST['llgbo_title_frame_color'], |
---|
201 | $_POST['llgbo_frame_bdcolor0'], $_POST['llgbo_frame_bdsize0'], |
---|
202 | $_POST['llgbo_frame_bdcolor1'], $_POST['llgbo_frame_bdsize1'], |
---|
203 | $_POST['llgbo_frame_bdcolor2'], $_POST['llgbo_frame_bdsize2'], |
---|
204 | $_POST['llgbo_frame_bdcolor3'], $_POST['llgbo_frame_bdsize3'], |
---|
205 | $_POST['llgbo_frame_bdcolor4'], $_POST['llgbo_frame_bdsize4'], |
---|
206 | $_POST['llgbo_frame_bdcolor5'], $_POST['llgbo_frame_bdsize5'], |
---|
207 | $_POST['llgbo_frame_bdcolor6'], $_POST['llgbo_frame_bdsize6'], |
---|
208 | $_POST['llgbo_frame_bdcolor7'], $_POST['llgbo_frame_bdsize7'], |
---|
209 | $_POST['llgbo_frame_bdcolor8'], $_POST['llgbo_frame_bdsize8'], |
---|
210 | $_POST['llgbo_frame_bdcolor9'], $_POST['llgbo_frame_bdsize9'], |
---|
211 | $_POST['llgbo_frame_bdcolor10'], $_POST['llgbo_frame_bdsize10'], |
---|
212 | $_POST['llgbo_frame_bdcolor11'], $_POST['llgbo_frame_bdsize11'], |
---|
213 | $_POST['llgbo_frame_bdcolor12'], $_POST['llgbo_frame_bdsize12'], |
---|
214 | $_POST['llgbo_frame_bdcolor13'], $_POST['llgbo_frame_bdsize13'], |
---|
215 | $_POST['llgbo_frame_bdcolor14'], $_POST['llgbo_frame_bdsize14'], |
---|
216 | $_POST['llgbo_frame_bdcolor15'], $_POST['llgbo_frame_bdsize15'] |
---|
217 | ); |
---|
218 | $llgbo_newframe_value = implode ("," , $param_llgbo_frame); |
---|
219 | |
---|
220 | if ( isset($_POST['save']) ) |
---|
221 | { |
---|
222 | $query = ' |
---|
223 | UPDATE ' . CONFIG_TABLE . ' |
---|
224 | SET value="'.$llgbo_newframe_value.'" |
---|
225 | WHERE param="LLGBOFRAME" |
---|
226 | LIMIT 1'; |
---|
227 | pwg_query($query); |
---|
228 | $template->assign('LLGBOINFO','llgbo_info'); |
---|
229 | } |
---|
230 | $conf['LLGBO_FRAME'] = explode ("," ,$llgbo_newframe_value ); |
---|
231 | |
---|
232 | } |
---|
233 | // FRAME |
---|
234 | if (isset($conf['LLGBO_FRAME'][0])) {$template->assign(array( 'LLGBO_TITLE_FRAME_COLOR' => $conf['LLGBO_FRAME'][0]));} |
---|
235 | for ($i = 0 ;$i < 16 ; $i++) |
---|
236 | { $x = 1 + ( 2 * $i); |
---|
237 | if (isset($conf['LLGBO_FRAME'][$x])) {$template->assign(array( 'LLGBO_FRAME_BDCOLOR'.$i => $conf['LLGBO_FRAME'][$x]));} |
---|
238 | if (isset($conf['LLGBO_FRAME'][$x+1])) {$template->assign(array( 'LLGBO_FRAME_BDSIZE'.$i => $conf['LLGBO_FRAME'][$x+1]));} |
---|
239 | } |
---|
240 | /// re draw frame after update |
---|
241 | Draw_frame(); |
---|
242 | } |
---|
243 | |
---|
244 | $template->assign_var_from_handle( 'ADMIN_CONTENT', 'llgbo_admin_content'); |
---|
245 | ////////////////////////// |
---|
246 | function Draw_frame() |
---|
247 | {global $conf ,$template; |
---|
248 | $bd = 0; |
---|
249 | $frame_begin =''; |
---|
250 | $frame_end=''; |
---|
251 | |
---|
252 | for ($i = 0 ;$i < 16 ; $i++) |
---|
253 | { $x = 1 + ( 2 * $i); |
---|
254 | |
---|
255 | if ((isset($conf['LLGBO_FRAME'][$x+1])) and ($conf['LLGBO_FRAME'][$x+1] > 0)) |
---|
256 | { $frame_begin = '<div id="gbo'.$i.'" style="border: '.$conf['LLGBO_FRAME'][$x+1].'px solid '.$conf['LLGBO_FRAME'][$x].'">'."\n".$frame_begin; |
---|
257 | $frame_end = $frame_end .' </div>'; } |
---|
258 | |
---|
259 | } |
---|
260 | $template->assign('FRAME_BEGIN', $frame_begin); |
---|
261 | $template->assign('FRAME_END', $frame_end); |
---|
262 | } |
---|
263 | ?> |
---|