Revision 1035
Added by Matthias over 15 years ago
trunk/CHANGELOG | ||
---|---|---|
11 | 11 |
! = Update/Change |
12 | 12 |
|
13 | 13 |
------------------------------------- 2.8.0 ------------------------------------- |
14 |
06-July-2009 Matthias Gallas |
|
15 |
+ Added new functions to admin dir (Thanks Argos and Ruud) |
|
16 |
! Updated install and upgrade-script |
|
17 |
! Adapted wb_theme and classic_theme to changed admin dir files |
|
14 | 18 |
04-July-2009 Dietrich Roland Pehlke |
15 |
! FCK-Editor Modul: Droplet Select: change "page_list_block" to "droplets_list_block", also "cmbPages" to "cmbDroplets" |
|
16 |
as we are listen droplets not pages. |
|
17 |
! Remove unneeded empty lines and spaces/blanks; minor cosmetic changes in the source to keep the string more readable. |
|
19 |
! FCK-Editor Modul: Droplet Select: change "page_list_block" to "droplets_list_block", |
|
20 |
also "cmbPages" to "cmbDroplets" as we are listen droplets not pages. |
|
21 |
! Remove unneeded empty lines and spaces/blanks; |
|
22 |
minor cosmetic changes in the source to keep the string more readable. |
|
18 | 23 |
04-July-2009 Matthias Gallas |
19 | 24 |
! Replaced droplet icon for FCKEditor Toolbar (thanks to Stefek) |
20 | 25 |
# Fixed two bugs in droplets-plugin for FCKEditor (thanks to Aldus) |
trunk/wb/upgrade-script.php | ||
---|---|---|
204 | 204 |
|
205 | 205 |
|
206 | 206 |
/********************************************************** |
207 |
* - Adding mediasettings to settings table |
|
208 |
*/ |
|
209 |
echo "<br />Adding mediasettings to settings table<br />"; |
|
210 |
$cfg = array( |
|
211 |
'mediasettings' => '' |
|
212 |
); |
|
213 |
foreach($cfg as $key=>$value) { |
|
214 |
db_add_key_value($key, $value); |
|
215 |
} |
|
216 |
|
|
217 |
|
|
218 |
/********************************************************** |
|
207 | 219 |
* - Add field "redirect_type" to table "mod_menu_link" |
208 | 220 |
*/ |
209 | 221 |
echo "<br />Adding field redirect_type to mod_menu_link table<br />"; |
trunk/wb/admin/media/setparameter.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, Ryan Djurovich |
|
9 |
|
|
10 |
Website Baker is free software; you can redistribute it and/or modify |
|
11 |
it under the terms of the GNU General Public License as published by |
|
12 |
the Free Software Foundation; either version 2 of the License, or |
|
13 |
(at your option) any later version. |
|
14 |
|
|
15 |
Website Baker is distributed in the hope that it will be useful, |
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
GNU General Public License for more details. |
|
19 |
|
|
20 |
You should have received a copy of the GNU General Public License |
|
21 |
along with Website Baker; if not, write to the Free Software |
|
22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
|
|
24 |
*/ |
|
25 |
|
|
26 |
require('../../config.php'); |
|
27 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
28 |
$admin = new admin('Media', 'media', false); |
|
29 |
// Include the WB functions file |
|
30 |
require_once(WB_PATH.'/framework/functions.php'); |
|
31 |
|
|
32 |
//Save post vars to the parameters file |
|
33 |
if ( !is_null($admin->get_post_escaped("save"))) { |
|
34 |
//Check for existing settings entry, if not existing, create a record first! |
|
35 |
if (!$database->query ( "SELECT * FROM ".TABLE_PREFIX."settings where `name`='mediasettings'" )) { |
|
36 |
$database->query ( "INSERT INTO ".TABLE_PREFIX."settings (`name`,`value`) VALUES ('mediasettings','')" ); |
|
37 |
} |
|
38 |
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY); |
|
39 |
$dirs[] = WB_PATH.MEDIA_DIRECTORY; |
|
40 |
foreach($dirs AS $name) { |
|
41 |
$r = str_replace(WB_PATH, '', $name); |
|
42 |
$r = str_replace('/','_',$r); |
|
43 |
$w = (int)$admin->get_post_escaped($r.'-w'); |
|
44 |
$h = (int)$admin->get_post_escaped($r.'-h'); |
|
45 |
$pathsettings[$r]['width']=$w; |
|
46 |
$pathsettings[$r]['height']=$h; |
|
47 |
} |
|
48 |
$pathsettings['global']['admin_only'] = ($admin->get_post_escaped('admin_only')!=''?'checked':''); |
|
49 |
$pathsettings['global']['show_thumbs'] = ($admin->get_post_escaped('show_thumbs')!=''?'checked':''); |
|
50 |
$fieldSerialized = serialize($pathsettings); |
|
51 |
$database->query ( "UPDATE ".TABLE_PREFIX."settings SET `value` = '$fieldSerialized' WHERE `name`='mediasettings'" ); |
|
52 |
header ("Location: browse.php"); |
|
53 |
} |
|
54 |
|
|
55 |
include ('parameters.php'); |
|
56 |
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) { |
|
57 |
echo "Sorry, settings not available"; |
|
58 |
exit(); |
|
59 |
} |
|
60 |
|
|
61 |
// Read data to display |
|
62 |
$caller = "setparameter"; |
|
63 |
|
|
64 |
$template = new Template(THEME_PATH.'/templates'); |
|
65 |
$template->set_file('page', 'setparameter.htt'); |
|
66 |
$template->set_block('page', 'main_block', 'main'); |
|
67 |
if ($_SESSION['GROUP_ID'] != 1) { |
|
68 |
$template->set_var('DISPLAY_ADMIN', 'hide'); |
|
69 |
} |
|
70 |
$template->set_var(array( |
|
71 |
'TEXT_HEADER' => 'Set maximum imagesize for a folder</b><br><small><i>(resizing on new uploads only)</i></small>', |
|
72 |
'SAVE_TEXT' => $TEXT['SAVE'], |
|
73 |
'BACK' => $TEXT['BACK'] |
|
74 |
) |
|
75 |
); |
|
76 |
|
|
77 |
|
|
78 |
$template->set_block('main_block', 'list_block', 'list'); |
|
79 |
$row_bg_color = ''; |
|
80 |
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY); |
|
81 |
$dirs[] = WB_PATH.MEDIA_DIRECTORY; |
|
82 |
|
|
83 |
$array_lowercase = array_map('strtolower', $dirs); |
|
84 |
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs); |
|
85 |
|
|
86 |
foreach($dirs AS $name) { |
|
87 |
$relative = str_replace(WB_PATH, '', $name); |
|
88 |
$safepath = str_replace('/','_',$relative); |
|
89 |
$cur_width = $cur_height = ''; |
|
90 |
if (isset($pathsettings[$safepath]['width'])) $cur_width = $pathsettings[$safepath]['width']; |
|
91 |
if (isset($pathsettings[$safepath]['height'])) $cur_height = $pathsettings[$safepath]['height']; |
|
92 |
$cur_width = ($cur_width ? (int)$cur_width : '-'); |
|
93 |
$cur_height = ($cur_height ? (int)$cur_height : '-'); |
|
94 |
|
|
95 |
if($row_bg_color == 'DEDEDE') $row_bg_color = 'EEEEEE'; |
|
96 |
else $row_bg_color = 'DEDEDE'; |
|
97 |
|
|
98 |
$template->set_var(array( |
|
99 |
'ADMIN_URL' => ADMIN_URL, |
|
100 |
'PATH_NAME' => $relative, |
|
101 |
'WIDTH' => $TEXT['WIDTH'], |
|
102 |
'HEIGHT' => $TEXT['HEIGHT'], |
|
103 |
'FIELD_NAME_W' => $safepath.'-w', |
|
104 |
'FIELD_NAME_H' => $safepath.'-h', |
|
105 |
'CUR_WIDTH' => $cur_width, |
|
106 |
'CUR_HEIGHT' => $cur_height, |
|
107 |
'SETTINGS' => $TEXT['SETTINGS'], |
|
108 |
'ADMIN_ONLY' => 'Settings for administrator only', |
|
109 |
'ADMIN_ONLY_SELECTED' => $pathsettings['global']['admin_only'], |
|
110 |
'NO_SHOW_THUMBS' => 'Hide thumbnails', |
|
111 |
'NO_SHOW_THUMBS_SELECTED' => $pathsettings['global']['show_thumbs'], |
|
112 |
'ROW_BG_COLOR' => $row_bg_color |
|
113 |
) |
|
114 |
); |
|
115 |
$template->parse('list', 'list_block', true); |
|
116 |
} |
|
117 |
|
|
118 |
$template->parse('main', 'main_block', false); |
|
119 |
$template->pparse('output', 'page'); |
|
120 |
|
|
121 |
|
|
122 |
?> |
|
0 | 123 |
trunk/wb/admin/media/resize_img.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, Ryan Djurovich |
|
9 |
|
|
10 |
Website Baker is free software; you can redistribute it and/or modify |
|
11 |
it under the terms of the GNU General Public License as published by |
|
12 |
the Free Software Foundation; either version 2 of the License, or |
|
13 |
(at your option) any later version. |
|
14 |
|
|
15 |
Website Baker is distributed in the hope that it will be useful, |
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
GNU General Public License for more details. |
|
19 |
|
|
20 |
You should have received a copy of the GNU General Public License |
|
21 |
along with Website Baker; if not, write to the Free Software |
|
22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
|
|
24 |
*/ |
|
25 |
|
|
26 |
/** |
|
27 |
* Image Resizer. |
|
28 |
* @author : Harish Chauhan |
|
29 |
* @copyright : Freeware |
|
30 |
* About :This PHP script will resize the given image and can show on the fly or save as image file. |
|
31 |
* |
|
32 |
*/ |
|
33 |
|
|
34 |
|
|
35 |
define("HAR_AUTO_NAME",1); |
|
36 |
Class RESIZEIMAGE |
|
37 |
{ |
|
38 |
var $imgFile=""; |
|
39 |
var $imgWidth=0; |
|
40 |
var $imgHeight=0; |
|
41 |
var $imgType=""; |
|
42 |
var $imgAttr=""; |
|
43 |
var $type=NULL; |
|
44 |
var $_img=NULL; |
|
45 |
var $_error=""; |
|
46 |
|
|
47 |
/** |
|
48 |
* Constructor |
|
49 |
* |
|
50 |
* @param [String $imgFile] Image File Name |
|
51 |
* @return RESIZEIMAGE (Class Object) |
|
52 |
*/ |
|
53 |
|
|
54 |
function RESIZEIMAGE($imgFile="") |
|
55 |
{ |
|
56 |
if (!function_exists("imagecreate")) |
|
57 |
{ |
|
58 |
$this->_error="Error: GD Library is not available."; |
|
59 |
return false; |
|
60 |
} |
|
61 |
|
|
62 |
$this->type=Array(1 => 'GIF', 2 => 'JPG', 3 => 'PNG', 4 => 'SWF', 5 => 'PSD', 6 => 'BMP', 7 => 'TIFF', 8 => 'TIFF', 9 => 'JPC', 10 => 'JP2', 11 => 'JPX', 12 => 'JB2', 13 => 'SWC', 14 => 'IFF', 15 => 'WBMP', 16 => 'XBM'); |
|
63 |
if(!empty($imgFile)) |
|
64 |
$this->setImage($imgFile); |
|
65 |
} |
|
66 |
/** |
|
67 |
* Error occured while resizing the image. |
|
68 |
* |
|
69 |
* @return String |
|
70 |
*/ |
|
71 |
function error() |
|
72 |
{ |
|
73 |
return $this->_error; |
|
74 |
} |
|
75 |
|
|
76 |
/** |
|
77 |
* Set image file name |
|
78 |
* |
|
79 |
* @param String $imgFile |
|
80 |
* @return void |
|
81 |
*/ |
|
82 |
function setImage($imgFile) |
|
83 |
{ |
|
84 |
$this->imgFile=$imgFile; |
|
85 |
return $this->_createImage(); |
|
86 |
} |
|
87 |
/** |
|
88 |
* |
|
89 |
* @return void |
|
90 |
*/ |
|
91 |
function close() |
|
92 |
{ |
|
93 |
return @imagedestroy($this->_img); |
|
94 |
} |
|
95 |
/** |
|
96 |
* Resize a image to given width and height and keep it's current width and height ratio |
|
97 |
* |
|
98 |
* @param Number $imgwidth |
|
99 |
* @param Numnber $imgheight |
|
100 |
* @param String $newfile |
|
101 |
*/ |
|
102 |
function resize_limitwh($imgwidth,$imgheight,$newfile=NULL) |
|
103 |
{ |
|
104 |
$image_per = 100; |
|
105 |
list($width, $height, $type, $attr) = @getimagesize($this->imgFile); |
|
106 |
if($width > $imgwidth && $imgwidth > 0) |
|
107 |
$image_per = (double)(($imgwidth * 100) / $width); |
|
108 |
|
|
109 |
if(floor(($height * $image_per)/100)>$imgheight && $imgheight > 0) |
|
110 |
$image_per = (double)(($imgheight * 100) / $height); |
|
111 |
|
|
112 |
$this->resize_percentage($image_per,$newfile); |
|
113 |
|
|
114 |
} |
|
115 |
/** |
|
116 |
* Resize an image to given percentage. |
|
117 |
* |
|
118 |
* @param Number $percent |
|
119 |
* @param String $newfile |
|
120 |
* @return Boolean |
|
121 |
*/ |
|
122 |
function resize_percentage($percent=100,$newfile=NULL) |
|
123 |
{ |
|
124 |
$newWidth=($this->imgWidth*$percent)/100; |
|
125 |
$newHeight=($this->imgHeight*$percent)/100; |
|
126 |
return $this->resize($newWidth,$newHeight,$newfile); |
|
127 |
} |
|
128 |
/** |
|
129 |
* Resize an image to given X and Y percentage. |
|
130 |
* |
|
131 |
* @param Number $xpercent |
|
132 |
* @param Number $ypercent |
|
133 |
* @param String $newfile |
|
134 |
* @return Boolean |
|
135 |
*/ |
|
136 |
function resize_xypercentage($xpercent=100,$ypercent=100,$newfile=NULL) |
|
137 |
{ |
|
138 |
$newWidth=($this->imgWidth*$xpercent)/100; |
|
139 |
$newHeight=($this->imgHeight*$ypercent)/100; |
|
140 |
return $this->resize($newWidth,$newHeight,$newfile); |
|
141 |
} |
|
142 |
|
|
143 |
/** |
|
144 |
* Resize an image to given width and height |
|
145 |
* |
|
146 |
* @param Number $width |
|
147 |
* @param Number $height |
|
148 |
* @param String $newfile |
|
149 |
* @return Boolean |
|
150 |
*/ |
|
151 |
function resize($width,$height,$newfile=NULL) |
|
152 |
{ |
|
153 |
if(empty($this->imgFile)) |
|
154 |
{ |
|
155 |
$this->_error="File name is not initialised."; |
|
156 |
return false; |
|
157 |
} |
|
158 |
if($this->imgWidth<=0 || $this->imgHeight<=0) |
|
159 |
{ |
|
160 |
$this->_error="Could not resize given image"; |
|
161 |
return false; |
|
162 |
} |
|
163 |
if($width<=0) |
|
164 |
$width=$this->imgWidth; |
|
165 |
if($height<=0) |
|
166 |
$height=$this->imgHeight; |
|
167 |
|
|
168 |
return $this->_resize($width,$height,$newfile); |
|
169 |
} |
|
170 |
|
|
171 |
/** |
|
172 |
* Get the image attributes |
|
173 |
* @access Private |
|
174 |
* |
|
175 |
*/ |
|
176 |
function _getImageInfo() |
|
177 |
{ |
|
178 |
@list($this->imgWidth,$this->imgHeight,$type,$this->imgAttr)=@getimagesize($this->imgFile); |
|
179 |
$this->imgType=$this->type[$type]; |
|
180 |
} |
|
181 |
|
|
182 |
/** |
|
183 |
* Create the image resource |
|
184 |
* @access Private |
|
185 |
* @return Boolean |
|
186 |
*/ |
|
187 |
function _createImage() |
|
188 |
{ |
|
189 |
$this->_getImageInfo($this->imgFile); |
|
190 |
if($this->imgType=='GIF') |
|
191 |
{ |
|
192 |
$this->_img=@imagecreatefromgif($this->imgFile); |
|
193 |
} |
|
194 |
elseif($this->imgType=='JPG') |
|
195 |
{ |
|
196 |
$this->_img=@imagecreatefromjpeg($this->imgFile); |
|
197 |
} |
|
198 |
elseif($this->imgType=='PNG') |
|
199 |
{ |
|
200 |
$this->_img=@imagecreatefrompng($this->imgFile); |
|
201 |
} |
|
202 |
if(!$this->_img || !@is_resource($this->_img)) |
|
203 |
{ |
|
204 |
$this->_error="Error loading ".$this->imgFile; |
|
205 |
return false; |
|
206 |
} |
|
207 |
return true; |
|
208 |
} |
|
209 |
|
|
210 |
/** |
|
211 |
* Function is used to resize the image |
|
212 |
* |
|
213 |
* @access Private |
|
214 |
* @param Number $width |
|
215 |
* @param Number $height |
|
216 |
* @param String $newfile |
|
217 |
* @return Boolean |
|
218 |
*/ |
|
219 |
function _resize($width,$height,$newfile=NULL) |
|
220 |
{ |
|
221 |
if (!function_exists("imagecreate")) |
|
222 |
{ |
|
223 |
$this->_error="Error: GD Library is not available."; |
|
224 |
return false; |
|
225 |
} |
|
226 |
|
|
227 |
$newimg=@imagecreatetruecolor($width,$height); |
|
228 |
//imagecolortransparent( $newimg, imagecolorat( $newimg, 0, 0 ) ); |
|
229 |
|
|
230 |
if($this->imgType=='GIF' || $this->imgType=='PNG') |
|
231 |
{ |
|
232 |
/** Code to keep transparency of image **/ |
|
233 |
$colorcount = imagecolorstotal($this->_img); |
|
234 |
if ($colorcount == 0) $colorcount = 256; |
|
235 |
imagetruecolortopalette($newimg,true,$colorcount); |
|
236 |
imagepalettecopy($newimg,$this->_img); |
|
237 |
$transparentcolor = imagecolortransparent($this->_img); |
|
238 |
imagefill($newimg,0,0,$transparentcolor); |
|
239 |
imagecolortransparent($newimg,$transparentcolor); |
|
240 |
} |
|
241 |
|
|
242 |
@imagecopyresampled ( $newimg, $this->_img, 0,0,0,0, $width, $height, $this->imgWidth,$this->imgHeight); |
|
243 |
|
|
244 |
|
|
245 |
|
|
246 |
if($newfile===HAR_AUTO_NAME) |
|
247 |
{ |
|
248 |
if(@preg_match("/\..*+$/",@basename($this->imgFile),$matches)) |
|
249 |
$newfile=@substr_replace($this->imgFile,"_har",-@strlen($matches[0]),0); |
|
250 |
} |
|
251 |
elseif(!empty($newfile)) |
|
252 |
{ |
|
253 |
if(!@preg_match("/\..*+$/",@basename($newfile))) |
|
254 |
{ |
|
255 |
if(@preg_match("/\..*+$/",@basename($this->imgFile),$matches)) |
|
256 |
$newfile=$newfile.$matches[0]; |
|
257 |
} |
|
258 |
} |
|
259 |
|
|
260 |
if($this->imgType=='GIF') |
|
261 |
{ |
|
262 |
if(!empty($newfile)) |
|
263 |
@imagegif($newimg,$newfile); |
|
264 |
else |
|
265 |
{ |
|
266 |
@header("Content-type: image/gif"); |
|
267 |
@imagegif($newimg); |
|
268 |
} |
|
269 |
} |
|
270 |
elseif($this->imgType=='JPG') |
|
271 |
{ |
|
272 |
if(!empty($newfile)) |
|
273 |
@imagejpeg($newimg,$newfile,85); |
|
274 |
else |
|
275 |
{ |
|
276 |
@header("Content-type: image/jpeg"); |
|
277 |
@imagejpeg($newimg); |
|
278 |
} |
|
279 |
} |
|
280 |
elseif($this->imgType=='PNG') |
|
281 |
{ |
|
282 |
if(!empty($newfile)) |
|
283 |
@imagepng($newimg,$newfile); |
|
284 |
else |
|
285 |
{ |
|
286 |
@header("Content-type: image/png"); |
|
287 |
@imagepng($newimg); |
|
288 |
} |
|
289 |
} |
|
290 |
@imagedestroy($newimg); |
|
291 |
} |
|
292 |
} |
|
293 |
?> |
|
0 | 294 |
trunk/wb/admin/media/thumb.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, Ryan Djurovich |
|
9 |
|
|
10 |
Website Baker is free software; you can redistribute it and/or modify |
|
11 |
it under the terms of the GNU General Public License as published by |
|
12 |
the Free Software Foundation; either version 2 of the License, or |
|
13 |
(at your option) any later version. |
|
14 |
|
|
15 |
Website Baker is distributed in the hope that it will be useful, |
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
GNU General Public License for more details. |
|
19 |
|
|
20 |
You should have received a copy of the GNU General Public License |
|
21 |
along with Website Baker; if not, write to the Free Software |
|
22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
|
|
24 |
*/ |
|
25 |
|
|
26 |
require('../../config.php'); |
|
27 |
include_once('resize_img.php'); |
|
28 |
if (isset($_GET['img']) && isset($_GET['t'])) { |
|
29 |
$image = addslashes($_GET['img']); |
|
30 |
$type = addslashes($_GET['t']); |
|
31 |
$media = WB_PATH.MEDIA_DIRECTORY; |
|
32 |
$img=new RESIZEIMAGE($media.$image); |
|
33 |
if ($img->imgWidth) { |
|
34 |
if ($type == 1) { |
|
35 |
$img->resize_limitwh(50,50); |
|
36 |
} else if ($type == 2) { |
|
37 |
$img->resize_limitwh(200,200); |
|
38 |
} |
|
39 |
$img->close(); |
|
40 |
} else { |
|
41 |
header ("Content-type: image/jpeg"); |
|
42 |
readfile ( "nopreview.jpg" ); |
|
43 |
} |
|
44 |
} |
|
45 |
?> |
|
0 | 46 |
trunk/wb/admin/media/browse.php | ||
---|---|---|
34 | 34 |
// Byte convert for filesize |
35 | 35 |
function byte_convert($bytes) { |
36 | 36 |
$symbol = array('B', 'KB', 'MB', 'GB', 'TB'); |
37 |
$exp = 0;
|
|
38 |
$converted_value = 0;
|
|
39 |
if( $bytes > 0 ) {
|
|
40 |
$exp = floor( log($bytes)/log(1024) );
|
|
41 |
$converted_value = ( $bytes/pow(1024,floor($exp)) );
|
|
42 |
}
|
|
43 |
return sprintf( '%.2f '.$symbol[$exp], $converted_value );
|
|
37 |
$exp = 0;
|
|
38 |
$converted_value = 0;
|
|
39 |
if( $bytes > 0 ) {
|
|
40 |
$exp = floor( log($bytes)/log(1024) );
|
|
41 |
$converted_value = ( $bytes/pow(1024,floor($exp)) );
|
|
42 |
}
|
|
43 |
return sprintf( '%.2f '.$symbol[$exp], $converted_value );
|
|
44 | 44 |
} |
45 | 45 |
|
46 | 46 |
// Get file extension |
... | ... | |
116 | 116 |
$template->set_block('main_block', 'list_block', 'list'); |
117 | 117 |
if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) { |
118 | 118 |
// Loop through the files and dirs an add to list |
119 |
while(false !== ($file = readdir($handle))) {
|
|
119 |
while(false !== ($file = readdir($handle))) {
|
|
120 | 120 |
if(substr($file, 0, 1) != '.' AND $file != '.svn' AND $file != 'index.php') { |
121 | 121 |
if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) { |
122 | 122 |
if(!isset($home_folders[$directory.'/'.$file])) { |
... | ... | |
143 | 143 |
'LINK_TARGET' => '', |
144 | 144 |
'ROW_BG_COLOR' => $row_bg_color, |
145 | 145 |
'FILETYPE_ICON' => THEME_URL.'/images/folder_16.png', |
146 |
'MOUSEOVER' => '', |
|
147 |
'IMAGEDETAIL' => '', |
|
146 | 148 |
'SIZE' => '', |
147 | 149 |
'DATE' => '', |
148 | 150 |
'PREVIEW' => '' |
... | ... | |
174 | 176 |
$preview = ''; |
175 | 177 |
} |
176 | 178 |
$temp_id++; |
179 |
$imgdetail = ''; |
|
180 |
$icon = THEME_URL.'/images/blank.gif'; |
|
181 |
$tooltip = ''; |
|
182 |
$pathsettings['global']['show_thumbs'] = ''; |
|
183 |
if (!$pathsettings['global']['show_thumbs']) { |
|
184 |
$info = getimagesize(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name); |
|
185 |
if ($info[0]) { |
|
186 |
$imgdetail = fsize(filesize(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name)).', '.$info[0].'x'.$info[1].'px'; |
|
187 |
$icon = 'thumb.php?t=1&img='.$directory.'/'.$name; |
|
188 |
$tooltip = ShowTip('thumb.php?t=2&img='.$directory.'/'.$name,$imgdetail); |
|
189 |
} |
|
190 |
} |
|
177 | 191 |
$template->set_var(array( |
178 | 192 |
'NAME' => $name, |
179 | 193 |
'NAME_SLASHED' => addslashes($name), |
... | ... | |
181 | 195 |
'LINK' => WB_URL.MEDIA_DIRECTORY.$directory.'/'.$name, |
182 | 196 |
'LINK_TARGET' => '_blank', |
183 | 197 |
'ROW_BG_COLOR' => $row_bg_color, |
198 |
'ICON' => $icon, |
|
184 | 199 |
'FILETYPE_ICON' => THEME_URL.'/images/files/'.$filetypeicon.'.png', |
200 |
'MOUSEOVER' => $tooltip, |
|
201 |
'IMAGEDETAIL' => $imgdetail, |
|
185 | 202 |
'SIZE' => $bytes, |
186 | 203 |
'DATE' => $date, |
187 | 204 |
'PREVIEW' => $preview |
... | ... | |
226 | 243 |
'TEXT_TYPE' => $TEXT['TYPE'], |
227 | 244 |
'TEXT_UP' => $TEXT['UP'], |
228 | 245 |
'NONE_FOUND' => $MESSAGE['MEDIA']['NONE_FOUND'], |
246 |
'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'], |
|
229 | 247 |
'CONFIRM_DELETE' => $MESSAGE['MEDIA']['CONFIRM_DELETE'] |
230 | 248 |
) |
231 | 249 |
); |
... | ... | |
234 | 252 |
$template->parse('main', 'main_block', false); |
235 | 253 |
$template->pparse('output', 'page'); |
236 | 254 |
|
255 |
function ShowTip($name,$detail='') { |
|
256 |
$ext = strtolower(end(explode(".", $name))); |
|
257 |
if (strpos('.gif.jpg.jpeg.png.bmp.',$ext) ) |
|
258 |
return 'onmouseover="overlib(\'<img src=\\\''.$name.'\\\' width=\\\'200\\\'><br/><center>'.$detail.'</center>\',VAUTO, WIDTH, 200)" onmouseout="nd()" ' ; |
|
259 |
else |
|
260 |
return ''; |
|
261 |
} |
|
262 |
|
|
263 |
function fsize($size) { |
|
264 |
if($size == 0) return("0 Bytes"); |
|
265 |
$filesizename = array(" Bytes", "kB", "MB", "GB", "TB"); |
|
266 |
return round($size/pow(1024, ($i = floor(log($size, 1024)))), 1) . $filesizename[$i]; |
|
267 |
} |
|
237 | 268 |
?> |
trunk/wb/admin/media/parameters.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, Ryan Djurovich |
|
9 |
|
|
10 |
Website Baker is free software; you can redistribute it and/or modify |
|
11 |
it under the terms of the GNU General Public License as published by |
|
12 |
the Free Software Foundation; either version 2 of the License, or |
|
13 |
(at your option) any later version. |
|
14 |
|
|
15 |
Website Baker is distributed in the hope that it will be useful, |
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
GNU General Public License for more details. |
|
19 |
|
|
20 |
You should have received a copy of the GNU General Public License |
|
21 |
along with Website Baker; if not, write to the Free Software |
|
22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
|
|
24 |
*/ |
|
25 |
|
|
26 |
function __unserialize($sObject) { // found in php manual :-) |
|
27 |
$__ret =preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $sObject ); |
|
28 |
return unserialize($__ret); |
|
29 |
} |
|
30 |
$pathsettings = array(); |
|
31 |
$query = $database->query ( "SELECT * FROM ".TABLE_PREFIX."settings where `name`='mediasettings'" ); |
|
32 |
if ($query && $query->numRows() > 0) { |
|
33 |
$settings = $query->fetchRow(); |
|
34 |
$pathsettings = __unserialize($settings['value']); |
|
35 |
} else { |
|
36 |
$database->query ( "INSERT INTO ".TABLE_PREFIX."settings (`name`,`value`) VALUES ('mediasettings','')" ); |
|
37 |
} |
|
38 |
|
|
39 |
?> |
|
0 | 40 |
trunk/wb/admin/media/index.php | ||
---|---|---|
27 | 27 |
require('../../config.php'); |
28 | 28 |
require_once(WB_PATH.'/framework/class.admin.php'); |
29 | 29 |
$admin = new admin('Media', 'media'); |
30 |
include ('parameters.php'); |
|
30 | 31 |
|
31 | 32 |
// Setup template object |
32 | 33 |
$template = new Template(THEME_PATH.'/templates'); |
... | ... | |
41 | 42 |
|
42 | 43 |
// Insert values |
43 | 44 |
$template->set_block('main_block', 'dir_list_block', 'dir_list'); |
44 |
foreach(directory_list(WB_PATH.MEDIA_DIRECTORY) AS $name) { |
|
45 |
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY); |
|
46 |
$array_lowercase = array_map('strtolower', $dirs); |
|
47 |
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs); |
|
48 |
foreach($dirs AS $name) { |
|
45 | 49 |
if(!isset($home_folders[str_replace(WB_PATH.MEDIA_DIRECTORY, '', $name)])) { |
46 | 50 |
$template->set_var('NAME', str_replace(WB_PATH, '', $name)); |
47 | 51 |
$template->parse('dir_list', 'dir_list_block', true); |
... | ... | |
55 | 59 |
if($admin->get_permission('media_upload') != true) { |
56 | 60 |
$template->set_var('DISPLAY_UPLOAD', 'hide'); |
57 | 61 |
} |
62 |
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) { // Only show admin the settings link |
|
63 |
$template->set_var('DISPLAY_SETTINGS', 'hide'); |
|
64 |
} |
|
58 | 65 |
|
59 | 66 |
// Insert language headings |
60 | 67 |
$template->set_var(array( |
... | ... | |
67 | 74 |
$template->set_var(array( |
68 | 75 |
'MEDIA_DIRECTORY' => MEDIA_DIRECTORY, |
69 | 76 |
'TEXT_NAME' => $TEXT['TITLE'], |
77 |
'TEXT_RELOAD' => $TEXT['RELOAD'], |
|
70 | 78 |
'TEXT_TARGET_FOLDER' => $TEXT['TARGET_FOLDER'], |
71 | 79 |
'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING'], |
72 | 80 |
'TEXT_FILES' => $TEXT['FILES'], |
73 | 81 |
'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'], |
74 | 82 |
'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'], |
83 |
'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'], |
|
84 |
'OPTIONS' => $TEXT['OPTION'], |
|
75 | 85 |
'TEXT_UNZIP_FILE' => $TEXT['UNZIP_FILE'], |
76 | 86 |
'TEXT_DELETE_ZIP' => $TEXT['DELETE_ZIP'] |
77 | 87 |
) |
trunk/wb/admin/media/overlib.js | ||
---|---|---|
1 |
//\///// |
|
2 |
//\ overLIB 4.21 - You may not remove or change this notice. |
|
3 |
//\ Copyright Erik Bosrup 1998-2004. All rights reserved. |
|
4 |
//\ |
|
5 |
//\ Contributors are listed on the homepage. |
|
6 |
//\ This file might be old, always check for the latest version at: |
|
7 |
//\ http://www.bosrup.com/web/overlib/ |
|
8 |
//\ |
|
9 |
//\ Please read the license agreement (available through the link above) |
|
10 |
//\ before using overLIB. Direct any licensing questions to erik@bosrup.com. |
|
11 |
//\ |
|
12 |
//\ Do not sell this as your own work or remove this copyright notice. |
|
13 |
//\ For full details on copying or changing this script please read the |
|
14 |
//\ license agreement at the link above. Please give credit on sites that |
|
15 |
//\ use overLIB and submit changes of the script so other people can use |
|
16 |
//\ them as well. |
|
17 |
// $Revision: 1.119 $ $Date: 2005/07/02 23:41:44 $ |
|
18 |
//\///// |
|
19 |
//\mini |
|
20 |
|
|
21 |
//////// |
|
22 |
// PRE-INIT |
|
23 |
// Ignore these lines, configuration is below. |
|
24 |
//////// |
|
25 |
var olLoaded = 0;var pmStart = 10000000; var pmUpper = 10001000; var pmCount = pmStart+1; var pmt=''; var pms = new Array(); var olInfo = new Info('4.21', 1); |
|
26 |
var FREPLACE = 0; var FBEFORE = 1; var FAFTER = 2; var FALTERNATE = 3; var FCHAIN=4; |
|
27 |
var olHideForm=0; // parameter for hiding SELECT and ActiveX elements in IE5.5+ |
|
28 |
var olHautoFlag = 0; // flags for over-riding VAUTO and HAUTO if corresponding |
|
29 |
var olVautoFlag = 0; // positioning commands are used on the command line |
|
30 |
var hookPts = new Array(), postParse = new Array(), cmdLine = new Array(), runTime = new Array(); |
|
31 |
// for plugins |
|
32 |
registerCommands('donothing,inarray,caparray,sticky,background,noclose,caption,left,right,center,offsetx,offsety,fgcolor,bgcolor,textcolor,capcolor,closecolor,width,border,cellpad,status,autostatus,autostatuscap,height,closetext,snapx,snapy,fixx,fixy,relx,rely,fgbackground,bgbackground,padx,pady,fullhtml,above,below,capicon,textfont,captionfont,closefont,textsize,captionsize,closesize,timeout,function,delay,hauto,vauto,closeclick,wrap,followmouse,mouseoff,closetitle,cssoff,compatmode,cssclass,fgclass,bgclass,textfontclass,captionfontclass,closefontclass'); |
|
33 |
|
|
34 |
//////// |
|
35 |
// DEFAULT CONFIGURATION |
|
36 |
// Settings you want everywhere are set here. All of this can also be |
|
37 |
// changed on your html page or through an overLIB call. |
|
38 |
//////// |
|
39 |
if (typeof ol_fgcolor=='undefined') var ol_fgcolor="#CCCCFF"; |
|
40 |
if (typeof ol_bgcolor=='undefined') var ol_bgcolor="#333399"; |
|
41 |
if (typeof ol_textcolor=='undefined') var ol_textcolor="#000000"; |
|
42 |
if (typeof ol_capcolor=='undefined') var ol_capcolor="#FFFFFF"; |
|
43 |
if (typeof ol_closecolor=='undefined') var ol_closecolor="#9999FF"; |
|
44 |
if (typeof ol_textfont=='undefined') var ol_textfont="Verdana,Arial,Helvetica"; |
|
45 |
if (typeof ol_captionfont=='undefined') var ol_captionfont="Verdana,Arial,Helvetica"; |
|
46 |
if (typeof ol_closefont=='undefined') var ol_closefont="Verdana,Arial,Helvetica"; |
|
47 |
if (typeof ol_textsize=='undefined') var ol_textsize="1"; |
|
48 |
if (typeof ol_captionsize=='undefined') var ol_captionsize="1"; |
|
49 |
if (typeof ol_closesize=='undefined') var ol_closesize="1"; |
|
50 |
if (typeof ol_width=='undefined') var ol_width="200"; |
|
51 |
if (typeof ol_border=='undefined') var ol_border="1"; |
|
52 |
if (typeof ol_cellpad=='undefined') var ol_cellpad=2; |
|
53 |
if (typeof ol_offsetx=='undefined') var ol_offsetx=10; |
|
54 |
if (typeof ol_offsety=='undefined') var ol_offsety=10; |
|
55 |
if (typeof ol_text=='undefined') var ol_text="Default Text"; |
|
56 |
if (typeof ol_cap=='undefined') var ol_cap=""; |
|
57 |
if (typeof ol_sticky=='undefined') var ol_sticky=0; |
|
58 |
if (typeof ol_background=='undefined') var ol_background=""; |
|
59 |
if (typeof ol_close=='undefined') var ol_close="Close"; |
|
60 |
if (typeof ol_hpos=='undefined') var ol_hpos=RIGHT; |
|
61 |
if (typeof ol_status=='undefined') var ol_status=""; |
|
62 |
if (typeof ol_autostatus=='undefined') var ol_autostatus=0; |
|
63 |
if (typeof ol_height=='undefined') var ol_height=-1; |
|
64 |
if (typeof ol_snapx=='undefined') var ol_snapx=0; |
|
65 |
if (typeof ol_snapy=='undefined') var ol_snapy=0; |
|
66 |
if (typeof ol_fixx=='undefined') var ol_fixx=-1; |
|
67 |
if (typeof ol_fixy=='undefined') var ol_fixy=-1; |
|
68 |
if (typeof ol_relx=='undefined') var ol_relx=null; |
|
69 |
if (typeof ol_rely=='undefined') var ol_rely=null; |
|
70 |
if (typeof ol_fgbackground=='undefined') var ol_fgbackground=""; |
|
71 |
if (typeof ol_bgbackground=='undefined') var ol_bgbackground=""; |
|
72 |
if (typeof ol_padxl=='undefined') var ol_padxl=1; |
|
73 |
if (typeof ol_padxr=='undefined') var ol_padxr=1; |
|
74 |
if (typeof ol_padyt=='undefined') var ol_padyt=1; |
|
75 |
if (typeof ol_padyb=='undefined') var ol_padyb=1; |
|
76 |
if (typeof ol_fullhtml=='undefined') var ol_fullhtml=0; |
|
77 |
if (typeof ol_vpos=='undefined') var ol_vpos=BELOW; |
|
78 |
if (typeof ol_aboveheight=='undefined') var ol_aboveheight=0; |
|
79 |
if (typeof ol_capicon=='undefined') var ol_capicon=""; |
|
80 |
if (typeof ol_frame=='undefined') var ol_frame=self; |
|
81 |
if (typeof ol_timeout=='undefined') var ol_timeout=0; |
|
82 |
if (typeof ol_function=='undefined') var ol_function=null; |
|
83 |
if (typeof ol_delay=='undefined') var ol_delay=0; |
|
84 |
if (typeof ol_hauto=='undefined') var ol_hauto=0; |
|
85 |
if (typeof ol_vauto=='undefined') var ol_vauto=0; |
|
86 |
if (typeof ol_closeclick=='undefined') var ol_closeclick=0; |
|
87 |
if (typeof ol_wrap=='undefined') var ol_wrap=0; |
|
88 |
if (typeof ol_followmouse=='undefined') var ol_followmouse=1; |
|
89 |
if (typeof ol_mouseoff=='undefined') var ol_mouseoff=0; |
|
90 |
if (typeof ol_closetitle=='undefined') var ol_closetitle='Close'; |
|
91 |
if (typeof ol_compatmode=='undefined') var ol_compatmode=0; |
|
92 |
if (typeof ol_css=='undefined') var ol_css=CSSOFF; |
|
93 |
if (typeof ol_fgclass=='undefined') var ol_fgclass=""; |
|
94 |
if (typeof ol_bgclass=='undefined') var ol_bgclass=""; |
|
95 |
if (typeof ol_textfontclass=='undefined') var ol_textfontclass=""; |
|
96 |
if (typeof ol_captionfontclass=='undefined') var ol_captionfontclass=""; |
|
97 |
if (typeof ol_closefontclass=='undefined') var ol_closefontclass=""; |
|
98 |
|
|
99 |
//////// |
|
100 |
// ARRAY CONFIGURATION |
|
101 |
//////// |
|
102 |
|
|
103 |
// You can use these arrays to store popup text here instead of in the html. |
|
104 |
if (typeof ol_texts=='undefined') var ol_texts = new Array("Text 0", "Text 1"); |
|
105 |
if (typeof ol_caps=='undefined') var ol_caps = new Array("Caption 0", "Caption 1"); |
|
106 |
|
|
107 |
//////// |
|
108 |
// END OF CONFIGURATION |
|
109 |
// Don't change anything below this line, all configuration is above. |
|
110 |
//////// |
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
//////// |
|
117 |
// INIT |
|
118 |
//////// |
|
119 |
// Runtime variables init. Don't change for config! |
|
120 |
var o3_text=""; |
|
121 |
var o3_cap=""; |
|
122 |
var o3_sticky=0; |
|
123 |
var o3_background=""; |
|
124 |
var o3_close="Close"; |
|
125 |
var o3_hpos=RIGHT; |
|
126 |
var o3_offsetx=2; |
|
127 |
var o3_offsety=2; |
|
128 |
var o3_fgcolor=""; |
|
129 |
var o3_bgcolor=""; |
|
130 |
var o3_textcolor=""; |
|
131 |
var o3_capcolor=""; |
|
132 |
var o3_closecolor=""; |
|
133 |
var o3_width=100; |
|
134 |
var o3_border=1; |
|
135 |
var o3_cellpad=2; |
|
136 |
var o3_status=""; |
|
137 |
var o3_autostatus=0; |
|
138 |
var o3_height=-1; |
|
139 |
var o3_snapx=0; |
|
140 |
var o3_snapy=0; |
|
141 |
var o3_fixx=-1; |
|
142 |
var o3_fixy=-1; |
|
143 |
var o3_relx=null; |
|
144 |
var o3_rely=null; |
|
145 |
var o3_fgbackground=""; |
|
146 |
var o3_bgbackground=""; |
|
147 |
var o3_padxl=0; |
|
148 |
var o3_padxr=0; |
|
149 |
var o3_padyt=0; |
|
150 |
var o3_padyb=0; |
|
151 |
var o3_fullhtml=0; |
|
152 |
var o3_vpos=BELOW; |
|
153 |
var o3_aboveheight=0; |
|
154 |
var o3_capicon=""; |
|
155 |
var o3_textfont="Verdana,Arial,Helvetica"; |
|
156 |
var o3_captionfont="Verdana,Arial,Helvetica"; |
|
157 |
var o3_closefont="Verdana,Arial,Helvetica"; |
|
158 |
var o3_textsize="1"; |
|
159 |
var o3_captionsize="1"; |
|
160 |
var o3_closesize="1"; |
|
161 |
var o3_frame=self; |
|
162 |
var o3_timeout=0; |
|
163 |
var o3_timerid=0; |
|
164 |
var o3_allowmove=0; |
|
165 |
var o3_function=null; |
|
166 |
var o3_delay=0; |
|
167 |
var o3_delayid=0; |
|
168 |
var o3_hauto=0; |
|
169 |
var o3_vauto=0; |
|
170 |
var o3_closeclick=0; |
|
171 |
var o3_wrap=0; |
|
172 |
var o3_followmouse=1; |
|
173 |
var o3_mouseoff=0; |
|
174 |
var o3_closetitle=''; |
|
175 |
var o3_compatmode=0; |
|
176 |
var o3_css=CSSOFF; |
|
177 |
var o3_fgclass=""; |
|
178 |
var o3_bgclass=""; |
|
179 |
var o3_textfontclass=""; |
|
180 |
var o3_captionfontclass=""; |
|
181 |
var o3_closefontclass=""; |
|
182 |
|
|
183 |
// Display state variables |
|
184 |
var o3_x = 0; |
|
185 |
var o3_y = 0; |
|
186 |
var o3_showingsticky = 0; |
|
187 |
var o3_removecounter = 0; |
|
188 |
|
|
189 |
// Our layer |
|
190 |
var over = null; |
|
191 |
var fnRef, hoveringSwitch = false; |
|
192 |
var olHideDelay; |
|
193 |
|
|
194 |
// Decide browser version |
|
195 |
var isMac = (navigator.userAgent.indexOf("Mac") != -1); |
|
196 |
var olOp = (navigator.userAgent.toLowerCase().indexOf('opera') > -1 && document.createTextNode); // Opera 7 |
|
197 |
var olNs4 = (navigator.appName=='Netscape' && parseInt(navigator.appVersion) == 4); |
|
198 |
var olNs6 = (document.getElementById) ? true : false; |
|
199 |
var olKq = (olNs6 && /konqueror/i.test(navigator.userAgent)); |
|
200 |
var olIe4 = (document.all) ? true : false; |
|
201 |
var olIe5 = false; |
|
202 |
var olIe55 = false; // Added additional variable to identify IE5.5+ |
|
203 |
var docRoot = 'document.body'; |
|
204 |
|
|
205 |
// Resize fix for NS4.x to keep track of layer |
|
206 |
if (olNs4) { |
|
207 |
var oW = window.innerWidth; |
|
208 |
var oH = window.innerHeight; |
|
209 |
window.onresize = function() { if (oW != window.innerWidth || oH != window.innerHeight) location.reload(); } |
|
210 |
} |
|
211 |
|
|
212 |
// Microsoft Stupidity Check(tm). |
|
213 |
if (olIe4) { |
|
214 |
var agent = navigator.userAgent; |
|
215 |
if (/MSIE/.test(agent)) { |
|
216 |
var versNum = parseFloat(agent.match(/MSIE[ ](\d\.\d+)\.*/i)[1]); |
|
217 |
if (versNum >= 5){ |
|
218 |
olIe5=true; |
|
219 |
olIe55=(versNum>=5.5&&!olOp) ? true : false; |
|
220 |
if (olNs6) olNs6=false; |
|
221 |
} |
|
222 |
} |
|
223 |
if (olNs6) olIe4 = false; |
|
224 |
} |
|
225 |
|
|
226 |
// Check for compatability mode. |
|
227 |
if (document.compatMode && document.compatMode == 'CSS1Compat') { |
|
228 |
docRoot= ((olIe4 && !olOp) ? 'document.documentElement' : docRoot); |
|
229 |
} |
|
230 |
|
|
231 |
// Add window onload handlers to indicate when all modules have been loaded |
|
232 |
// For Netscape 6+ and Mozilla, uses addEventListener method on the window object |
|
233 |
// For IE it uses the attachEvent method of the window object and for Netscape 4.x |
|
234 |
// it sets the window.onload handler to the OLonload_handler function for Bubbling |
|
235 |
if(window.addEventListener) window.addEventListener("load",OLonLoad_handler,false); |
|
236 |
else if (window.attachEvent) window.attachEvent("onload",OLonLoad_handler); |
|
237 |
|
|
238 |
var capExtent; |
|
239 |
|
|
240 |
//////// |
|
241 |
// PUBLIC FUNCTIONS |
|
242 |
//////// |
|
243 |
|
|
244 |
// overlib(arg0,...,argN) |
|
245 |
// Loads parameters into global runtime variables. |
|
246 |
function overlib() { |
|
247 |
if (!olLoaded || isExclusive(overlib.arguments)) return true; |
|
248 |
if (olCheckMouseCapture) olMouseCapture(); |
|
249 |
if (over) { |
|
250 |
over = (typeof over.id != 'string') ? o3_frame.document.all['overDiv'] : over; |
|
251 |
cClick(); |
|
252 |
} |
|
253 |
|
|
254 |
// Load defaults to runtime. |
|
255 |
olHideDelay=0; |
|
256 |
o3_text=ol_text; |
|
257 |
o3_cap=ol_cap; |
|
258 |
o3_sticky=ol_sticky; |
|
259 |
o3_background=ol_background; |
|
260 |
o3_close=ol_close; |
|
261 |
o3_hpos=ol_hpos; |
|
262 |
o3_offsetx=ol_offsetx; |
|
263 |
o3_offsety=ol_offsety; |
|
264 |
o3_fgcolor=ol_fgcolor; |
|
265 |
o3_bgcolor=ol_bgcolor; |
|
266 |
o3_textcolor=ol_textcolor; |
|
267 |
o3_capcolor=ol_capcolor; |
|
268 |
o3_closecolor=ol_closecolor; |
|
269 |
o3_width=ol_width; |
|
270 |
o3_border=ol_border; |
|
271 |
o3_cellpad=ol_cellpad; |
|
272 |
o3_status=ol_status; |
|
273 |
o3_autostatus=ol_autostatus; |
|
274 |
o3_height=ol_height; |
|
275 |
o3_snapx=ol_snapx; |
|
276 |
o3_snapy=ol_snapy; |
|
277 |
o3_fixx=ol_fixx; |
|
278 |
o3_fixy=ol_fixy; |
|
279 |
o3_relx=ol_relx; |
|
280 |
o3_rely=ol_rely; |
|
281 |
o3_fgbackground=ol_fgbackground; |
|
282 |
o3_bgbackground=ol_bgbackground; |
|
283 |
o3_padxl=ol_padxl; |
|
284 |
o3_padxr=ol_padxr; |
|
285 |
o3_padyt=ol_padyt; |
|
286 |
o3_padyb=ol_padyb; |
|
287 |
o3_fullhtml=ol_fullhtml; |
|
288 |
o3_vpos=ol_vpos; |
|
289 |
o3_aboveheight=ol_aboveheight; |
|
290 |
o3_capicon=ol_capicon; |
|
291 |
o3_textfont=ol_textfont; |
|
292 |
o3_captionfont=ol_captionfont; |
|
293 |
o3_closefont=ol_closefont; |
|
294 |
o3_textsize=ol_textsize; |
|
295 |
o3_captionsize=ol_captionsize; |
|
296 |
o3_closesize=ol_closesize; |
|
297 |
o3_timeout=ol_timeout; |
|
298 |
o3_function=ol_function; |
|
299 |
o3_delay=ol_delay; |
|
300 |
o3_hauto=ol_hauto; |
|
301 |
o3_vauto=ol_vauto; |
|
302 |
o3_closeclick=ol_closeclick; |
|
303 |
o3_wrap=ol_wrap; |
|
304 |
o3_followmouse=ol_followmouse; |
|
305 |
o3_mouseoff=ol_mouseoff; |
|
306 |
o3_closetitle=ol_closetitle; |
|
307 |
o3_css=ol_css; |
|
308 |
o3_compatmode=ol_compatmode; |
|
309 |
o3_fgclass=ol_fgclass; |
|
310 |
o3_bgclass=ol_bgclass; |
|
311 |
o3_textfontclass=ol_textfontclass; |
|
312 |
o3_captionfontclass=ol_captionfontclass; |
|
313 |
o3_closefontclass=ol_closefontclass; |
|
314 |
|
|
315 |
setRunTimeVariables(); |
|
316 |
|
|
317 |
fnRef = ''; |
|
318 |
|
|
319 |
// Special for frame support, over must be reset... |
|
320 |
o3_frame = ol_frame; |
|
321 |
|
|
322 |
if(!(over=createDivContainer())) return false; |
|
323 |
|
|
324 |
parseTokens('o3_', overlib.arguments); |
|
325 |
if (!postParseChecks()) return false; |
|
326 |
|
|
327 |
if (o3_delay == 0) { |
|
328 |
return runHook("olMain", FREPLACE); |
|
329 |
} else { |
|
330 |
o3_delayid = setTimeout("runHook('olMain', FREPLACE)", o3_delay); |
|
331 |
return false; |
|
332 |
} |
|
333 |
} |
|
334 |
|
|
335 |
// Clears popups if appropriate |
|
336 |
function nd(time) { |
|
337 |
if (olLoaded && !isExclusive()) { |
|
338 |
hideDelay(time); // delay popup close if time specified |
|
339 |
|
|
340 |
if (o3_removecounter >= 1) { o3_showingsticky = 0 }; |
|
341 |
|
|
342 |
if (o3_showingsticky == 0) { |
|
343 |
o3_allowmove = 0; |
|
344 |
if (over != null && o3_timerid == 0) runHook("hideObject", FREPLACE, over); |
|
345 |
} else { |
|
346 |
o3_removecounter++; |
|
347 |
} |
|
348 |
} |
|
349 |
|
|
350 |
return true; |
|
351 |
} |
|
352 |
|
|
353 |
// The Close onMouseOver function for stickies |
|
354 |
function cClick() { |
|
355 |
if (olLoaded) { |
|
356 |
runHook("hideObject", FREPLACE, over); |
|
357 |
o3_showingsticky = 0; |
|
358 |
} |
|
359 |
return false; |
|
360 |
} |
|
361 |
|
|
362 |
// Method for setting page specific defaults. |
|
363 |
function overlib_pagedefaults() { |
|
364 |
parseTokens('ol_', overlib_pagedefaults.arguments); |
|
365 |
} |
|
366 |
|
|
367 |
|
|
368 |
//////// |
|
369 |
// OVERLIB MAIN FUNCTION |
|
370 |
//////// |
|
371 |
|
|
372 |
// This function decides what it is we want to display and how we want it done. |
|
373 |
function olMain() { |
|
374 |
var layerhtml, styleType; |
|
375 |
runHook("olMain", FBEFORE); |
|
376 |
|
|
377 |
if (o3_background!="" || o3_fullhtml) { |
|
378 |
// Use background instead of box. |
|
379 |
layerhtml = runHook('ol_content_background', FALTERNATE, o3_css, o3_text, o3_background, o3_fullhtml); |
|
380 |
} else { |
|
381 |
// They want a popup box. |
|
382 |
styleType = (pms[o3_css-1-pmStart] == "cssoff" || pms[o3_css-1-pmStart] == "cssclass"); |
|
383 |
|
|
384 |
// Prepare popup background |
|
385 |
if (o3_fgbackground != "") o3_fgbackground = "background=\""+o3_fgbackground+"\""; |
|
386 |
if (o3_bgbackground != "") o3_bgbackground = (styleType ? "background=\""+o3_bgbackground+"\"" : o3_bgbackground); |
|
387 |
|
|
388 |
// Prepare popup colors |
|
389 |
if (o3_fgcolor != "") o3_fgcolor = (styleType ? "bgcolor=\""+o3_fgcolor+"\"" : o3_fgcolor); |
|
390 |
if (o3_bgcolor != "") o3_bgcolor = (styleType ? "bgcolor=\""+o3_bgcolor+"\"" : o3_bgcolor); |
|
391 |
|
|
392 |
// Prepare popup height |
|
393 |
if (o3_height > 0) o3_height = (styleType ? "height=\""+o3_height+"\"" : o3_height); |
|
394 |
else o3_height = ""; |
|
395 |
|
|
396 |
// Decide which kinda box. |
|
397 |
if (o3_cap=="") { |
|
398 |
// Plain |
|
399 |
layerhtml = runHook('ol_content_simple', FALTERNATE, o3_css, o3_text); |
|
400 |
} else { |
|
401 |
// With caption |
|
402 |
if (o3_sticky) { |
|
403 |
// Show close text |
|
404 |
layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, o3_close); |
|
405 |
} else { |
|
406 |
// No close text |
|
407 |
layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, ""); |
|
408 |
} |
|
409 |
} |
|
410 |
} |
|
411 |
|
|
412 |
// We want it to stick! |
|
413 |
if (o3_sticky) { |
|
414 |
if (o3_timerid > 0) { |
|
415 |
clearTimeout(o3_timerid); |
|
416 |
o3_timerid = 0; |
|
417 |
} |
|
418 |
o3_showingsticky = 1; |
|
419 |
o3_removecounter = 0; |
|
420 |
} |
|
421 |
|
|
422 |
// Created a separate routine to generate the popup to make it easier |
|
423 |
// to implement a plugin capability |
|
424 |
if (!runHook("createPopup", FREPLACE, layerhtml)) return false; |
|
425 |
|
|
426 |
// Prepare status bar |
|
427 |
if (o3_autostatus > 0) { |
|
428 |
o3_status = o3_text; |
|
429 |
if (o3_autostatus > 1) o3_status = o3_cap; |
|
430 |
} |
|
431 |
|
|
432 |
// When placing the layer the first time, even stickies may be moved. |
|
433 |
o3_allowmove = 0; |
|
434 |
|
|
435 |
// Initiate a timer for timeout |
|
436 |
if (o3_timeout > 0) { |
|
437 |
if (o3_timerid > 0) clearTimeout(o3_timerid); |
|
438 |
o3_timerid = setTimeout("cClick()", o3_timeout); |
|
439 |
} |
|
440 |
|
|
441 |
// Show layer |
|
442 |
runHook("disp", FREPLACE, o3_status); |
|
443 |
runHook("olMain", FAFTER); |
|
444 |
|
|
445 |
return (olOp && event && event.type == 'mouseover' && !o3_status) ? '' : (o3_status != ''); |
|
446 |
} |
|
447 |
|
|
448 |
//////// |
|
449 |
// LAYER GENERATION FUNCTIONS |
|
450 |
//////// |
|
451 |
// These functions just handle popup content with tags that should adhere to the W3C standards specification. |
|
452 |
|
|
453 |
// Makes simple table without caption |
|
454 |
function ol_content_simple(text) { |
|
455 |
var cpIsMultiple = /,/.test(o3_cellpad); |
|
456 |
var txt = '<table width="'+o3_width+ '" border="0" cellpadding="'+o3_border+'" cellspacing="0" '+(o3_bgclass ? 'class="'+o3_bgclass+'"' : o3_bgcolor+' '+o3_height)+'><tr><td><table width="100%" border="0" '+((olNs4||!cpIsMultiple) ? 'cellpadding="'+o3_cellpad+'" ' : '')+'cellspacing="0" '+(o3_fgclass ? 'class="'+o3_fgclass+'"' : o3_fgcolor+' '+o3_fgbackground+' '+o3_height)+'><tr><td valign="TOP"'+(o3_textfontclass ? ' class="'+o3_textfontclass+'">' : ((!olNs4&&cpIsMultiple) ? ' style="'+setCellPadStr(o3_cellpad)+'">' : '>'))+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize))+'</td></tr></table></td></tr></table>'; |
|
457 |
|
|
458 |
set_background(""); |
|
459 |
return txt; |
|
460 |
} |
|
461 |
|
|
462 |
// Makes table with caption and optional close link |
|
463 |
function ol_content_caption(text,title,close) { |
|
464 |
var nameId, txt, cpIsMultiple = /,/.test(o3_cellpad); |
|
465 |
var closing, closeevent; |
|
466 |
|
|
467 |
closing = ""; |
|
468 |
closeevent = "onmouseover"; |
|
469 |
if (o3_closeclick == 1) closeevent = (o3_closetitle ? "title='" + o3_closetitle +"'" : "") + " onclick"; |
|
470 |
if (o3_capicon != "") { |
|
471 |
nameId = ' hspace = \"5\"'+' align = \"middle\" alt = \"\"'; |
|
472 |
if (typeof o3_dragimg != 'undefined' && o3_dragimg) nameId =' hspace=\"5\"'+' name=\"'+o3_dragimg+'\" id=\"'+o3_dragimg+'\" align=\"middle\" alt=\"Drag Enabled\" title=\"Drag Enabled\"'; |
|
473 |
o3_capicon = '<img src=\"'+o3_capicon+'\"'+nameId+' />'; |
|
474 |
} |
|
475 |
|
|
476 |
if (close != "") |
|
477 |
closing = '<td '+(!o3_compatmode && o3_closefontclass ? 'class="'+o3_closefontclass : 'align="RIGHT')+'"><a href="javascript:return '+fnRef+'cClick();"'+((o3_compatmode && o3_closefontclass) ? ' class="' + o3_closefontclass + '" ' : ' ')+closeevent+'="return '+fnRef+'cClick();">'+(o3_closefontclass ? '' : wrapStr(0,o3_closesize,'close'))+close+(o3_closefontclass ? '' : wrapStr(1,o3_closesize,'close'))+'</a></td>'; |
|
478 |
txt = '<table width="'+o3_width+ '" border="0" cellpadding="'+o3_border+'" cellspacing="0" '+(o3_bgclass ? 'class="'+o3_bgclass+'"' : o3_bgcolor+' '+o3_bgbackground+' '+o3_height)+'><tr><td><table width="100%" border="0" cellpadding="2" cellspacing="0"><tr><td'+(o3_captionfontclass ? ' class="'+o3_captionfontclass+'">' : '>')+(o3_captionfontclass ? '' : '<b>'+wrapStr(0,o3_captionsize,'caption'))+o3_capicon+title+(o3_captionfontclass ? '' : wrapStr(1,o3_captionsize)+'</b>')+'</td>'+closing+'</tr></table><table width="100%" border="0" '+((olNs4||!cpIsMultiple) ? 'cellpadding="'+o3_cellpad+'" ' : '')+'cellspacing="0" '+(o3_fgclass ? 'class="'+o3_fgclass+'"' : o3_fgcolor+' '+o3_fgbackground+' '+o3_height)+'><tr><td valign="TOP"'+(o3_textfontclass ? ' class="'+o3_textfontclass+'">' :((!olNs4&&cpIsMultiple) ? ' style="'+setCellPadStr(o3_cellpad)+'">' : '>'))+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize)) + '</td></tr></table></td></tr></table>'; |
|
479 |
|
|
480 |
set_background(""); |
|
481 |
return txt; |
|
482 |
} |
|
483 |
|
|
484 |
// Sets the background picture,padding and lots more. :) |
|
485 |
function ol_content_background(text,picture,hasfullhtml) { |
|
486 |
if (hasfullhtml) { |
|
487 |
txt=text; |
|
488 |
} else { |
|
489 |
txt='<table width="'+o3_width+'" border="0" cellpadding="0" cellspacing="0" height="'+o3_height+'"><tr><td colspan="3" height="'+o3_padyt+'"></td></tr><tr><td width="'+o3_padxl+'"></td><td valign="TOP" width="'+(o3_width-o3_padxl-o3_padxr)+(o3_textfontclass ? '" class="'+o3_textfontclass : '')+'">'+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize))+'</td><td width="'+o3_padxr+'"></td></tr><tr><td colspan="3" height="'+o3_padyb+'"></td></tr></table>'; |
|
490 |
} |
|
491 |
|
|
492 |
set_background(picture); |
|
493 |
return txt; |
|
494 |
} |
|
495 |
|
|
496 |
// Loads a picture into the div. |
|
497 |
function set_background(pic) { |
|
498 |
if (pic == "") { |
|
499 |
if (olNs4) { |
|
500 |
over.background.src = null; |
|
501 |
} else if (over.style) { |
|
502 |
over.style.backgroundImage = "none"; |
|
503 |
} |
|
504 |
} else { |
|
505 |
if (olNs4) { |
|
506 |
over.background.src = pic; |
|
507 |
} else if (over.style) { |
|
508 |
over.style.width=o3_width + 'px'; |
|
509 |
over.style.backgroundImage = "url("+pic+")"; |
|
510 |
} |
|
511 |
} |
|
512 |
} |
|
513 |
|
|
514 |
//////// |
|
515 |
// HANDLING FUNCTIONS |
|
516 |
//////// |
|
517 |
var olShowId=-1; |
|
518 |
|
|
519 |
// Displays the popup |
|
520 |
function disp(statustext) { |
|
521 |
runHook("disp", FBEFORE); |
|
522 |
|
|
523 |
if (o3_allowmove == 0) { |
|
524 |
runHook("placeLayer", FREPLACE); |
|
525 |
(olNs6&&olShowId<0) ? olShowId=setTimeout("runHook('showObject', FREPLACE, over)", 1) : runHook("showObject", FREPLACE, over); |
|
526 |
o3_allowmove = (o3_sticky || o3_followmouse==0) ? 0 : 1; |
|
527 |
} |
|
528 |
|
|
529 |
runHook("disp", FAFTER); |
|
530 |
|
|
531 |
if (statustext != "") self.status = statustext; |
|
532 |
} |
|
533 |
|
|
534 |
// Creates the actual popup structure |
|
535 |
function createPopup(lyrContent){ |
|
536 |
runHook("createPopup", FBEFORE); |
|
537 |
|
|
538 |
if (o3_wrap) { |
|
539 |
var wd,ww,theObj = (olNs4 ? over : over.style); |
|
540 |
theObj.top = theObj.left = ((olIe4&&!olOp) ? 0 : -10000) + (!olNs4 ? 'px' : 0); |
|
541 |
layerWrite(lyrContent); |
|
542 |
wd = (olNs4 ? over.clip.width : over.offsetWidth); |
|
543 |
if (wd > (ww=windowWidth())) { |
|
544 |
lyrContent=lyrContent.replace(/\ /g, ' '); |
|
545 |
o3_width=ww; |
|
546 |
o3_wrap=0; |
|
547 |
} |
|
548 |
} |
|
549 |
|
|
550 |
layerWrite(lyrContent); |
|
551 |
|
|
552 |
// Have to set o3_width for placeLayer() routine if o3_wrap is turned on |
|
553 |
if (o3_wrap) o3_width=(olNs4 ? over.clip.width : over.offsetWidth); |
|
554 |
|
|
555 |
runHook("createPopup", FAFTER, lyrContent); |
|
556 |
|
|
557 |
return true; |
|
558 |
} |
|
559 |
|
|
560 |
// Decides where we want the popup. |
|
561 |
function placeLayer() { |
|
562 |
var placeX, placeY, widthFix = 0; |
|
563 |
|
|
564 |
// HORIZONTAL PLACEMENT, re-arranged to work in Safari |
|
565 |
if (o3_frame.innerWidth) widthFix=18; |
|
566 |
iwidth = windowWidth(); |
|
567 |
|
|
568 |
// Horizontal scroll offset |
|
569 |
winoffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollLeft') : o3_frame.pageXOffset; |
|
570 |
|
|
571 |
placeX = runHook('horizontalPlacement',FCHAIN,iwidth,winoffset,widthFix); |
|
572 |
|
|
573 |
// VERTICAL PLACEMENT, re-arranged to work in Safari |
|
574 |
if (o3_frame.innerHeight) { |
|
575 |
iheight=o3_frame.innerHeight; |
|
576 |
} else if (eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientHeight=='number'")&&eval('o3_frame.'+docRoot+'.clientHeight')) { |
|
577 |
iheight=eval('o3_frame.'+docRoot+'.clientHeight'); |
|
578 |
} |
|
579 |
|
|
580 |
// Vertical scroll offset |
|
581 |
scrolloffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollTop') : o3_frame.pageYOffset; |
|
582 |
placeY = runHook('verticalPlacement',FCHAIN,iheight,scrolloffset); |
|
583 |
|
|
584 |
// Actually move the object. |
|
585 |
repositionTo(over, placeX, placeY); |
|
586 |
} |
|
587 |
|
|
588 |
// Moves the layer |
|
589 |
function olMouseMove(e) { |
|
590 |
var e = (e) ? e : event; |
|
591 |
|
|
592 |
if (e.pageX) { |
|
593 |
o3_x = e.pageX; |
|
594 |
o3_y = e.pageY; |
|
595 |
} else if (e.clientX) { |
|
596 |
o3_x = eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft'); |
|
597 |
o3_y = eval('e.clientY+o3_frame.'+docRoot+'.scrollTop'); |
|
598 |
} |
|
599 |
|
|
600 |
if (o3_allowmove == 1) runHook("placeLayer", FREPLACE); |
|
601 |
|
|
602 |
// MouseOut handler |
|
603 |
if (hoveringSwitch && !olNs4 && runHook("cursorOff", FREPLACE)) { |
|
604 |
(olHideDelay ? hideDelay(olHideDelay) : cClick()); |
|
605 |
hoveringSwitch = !hoveringSwitch; |
|
606 |
} |
|
607 |
} |
|
608 |
|
|
609 |
// Fake function for 3.0 users. |
|
610 |
function no_overlib() { return ver3fix; } |
|
611 |
|
|
612 |
// Capture the mouse and chain other scripts. |
|
613 |
function olMouseCapture() { |
|
614 |
capExtent = document; |
|
615 |
var fN, str = '', l, k, f, wMv, sS, mseHandler = olMouseMove; |
|
616 |
var re = /function[ ]*(\w*)\(/; |
|
617 |
|
|
618 |
wMv = (!olIe4 && window.onmousemove); |
|
619 |
if (document.onmousemove || wMv) { |
|
620 |
if (wMv) capExtent = window; |
|
621 |
f = capExtent.onmousemove.toString(); |
|
622 |
fN = f.match(re); |
|
623 |
if (fN == null) { |
|
624 |
str = f+'(e); '; |
|
625 |
} else if (fN[1] == 'anonymous' || fN[1] == 'olMouseMove' || (wMv && fN[1] == 'onmousemove')) { |
|
626 |
if (!olOp && wMv) { |
|
627 |
l = f.indexOf('{')+1; |
|
628 |
k = f.lastIndexOf('}'); |
|
629 |
sS = f.substring(l,k); |
|
630 |
if ((l = sS.indexOf('(')) != -1) { |
|
631 |
sS = sS.substring(0,l).replace(/^\s+/,'').replace(/\s+$/,''); |
|
632 |
if (eval("typeof " + sS + " == 'undefined'")) window.onmousemove = null; |
|
633 |
else str = sS + '(e);'; |
|
634 |
} |
|
635 |
} |
|
636 |
if (!str) { |
|
637 |
olCheckMouseCapture = false; |
|
638 |
return; |
|
639 |
} |
|
640 |
} else { |
|
641 |
if (fN[1]) str = fN[1]+'(e); '; |
|
642 |
else { |
|
643 |
l = f.indexOf('{')+1; |
|
644 |
k = f.lastIndexOf('}'); |
|
645 |
str = f.substring(l,k) + '\n'; |
|
646 |
} |
|
647 |
} |
|
648 |
str += 'olMouseMove(e); '; |
|
649 |
mseHandler = new Function('e', str); |
|
650 |
} |
|
651 |
|
|
652 |
capExtent.onmousemove = mseHandler; |
|
653 |
if (olNs4) capExtent.captureEvents(Event.MOUSEMOVE); |
|
654 |
} |
|
655 |
|
|
656 |
//////// |
|
657 |
// PARSING FUNCTIONS |
|
658 |
//////// |
|
659 |
|
|
660 |
// Does the actual command parsing. |
|
661 |
function parseTokens(pf, ar) { |
|
662 |
// What the next argument is expected to be. |
|
663 |
var v, i, mode=-1, par = (pf != 'ol_'); |
|
664 |
var fnMark = (par && !ar.length ? 1 : 0); |
|
665 |
|
|
666 |
for (i = 0; i < ar.length; i++) { |
|
667 |
if (mode < 0) { |
|
668 |
// Arg is maintext,unless its a number between pmStart and pmUpper |
|
669 |
// then its a command. |
|
670 |
if (typeof ar[i] == 'number' && ar[i] > pmStart && ar[i] < pmUpper) { |
|
671 |
fnMark = (par ? 1 : 0); |
|
672 |
i--; // backup one so that the next block can parse it |
|
673 |
} else { |
|
674 |
switch(pf) { |
|
675 |
case 'ol_': |
|
676 |
ol_text = ar[i].toString(); |
|
677 |
break; |
|
678 |
default: |
|
679 |
o3_text=ar[i].toString(); |
|
680 |
} |
|
681 |
} |
|
682 |
mode = 0; |
|
683 |
} else { |
|
684 |
// Note: NS4 doesn't like switch cases with vars. |
|
685 |
if (ar[i] >= pmCount || ar[i]==DONOTHING) { continue; } |
|
686 |
if (ar[i]==INARRAY) { fnMark = 0; eval(pf+'text=ol_texts['+ar[++i]+'].toString()'); continue; } |
|
687 |
if (ar[i]==CAPARRAY) { eval(pf+'cap=ol_caps['+ar[++i]+'].toString()'); continue; } |
|
688 |
if (ar[i]==STICKY) { if (pf!='ol_') eval(pf+'sticky=1'); continue; } |
|
689 |
if (ar[i]==BACKGROUND) { eval(pf+'background="'+ar[++i]+'"'); continue; } |
|
690 |
if (ar[i]==NOCLOSE) { if (pf!='ol_') opt_NOCLOSE(); continue; } |
|
691 |
if (ar[i]==CAPTION) { eval(pf+"cap='"+escSglQuote(ar[++i])+"'"); continue; } |
|
692 |
if (ar[i]==CENTER || ar[i]==LEFT || ar[i]==RIGHT) { eval(pf+'hpos='+ar[i]); if(pf!='ol_') olHautoFlag=1; continue; } |
|
693 |
if (ar[i]==OFFSETX) { eval(pf+'offsetx='+ar[++i]); continue; } |
|
694 |
if (ar[i]==OFFSETY) { eval(pf+'offsety='+ar[++i]); continue; } |
|
695 |
if (ar[i]==FGCOLOR) { eval(pf+'fgcolor="'+ar[++i]+'"'); continue; } |
|
696 |
if (ar[i]==BGCOLOR) { eval(pf+'bgcolor="'+ar[++i]+'"'); continue; } |
|
697 |
if (ar[i]==TEXTCOLOR) { eval(pf+'textcolor="'+ar[++i]+'"'); continue; } |
|
698 |
if (ar[i]==CAPCOLOR) { eval(pf+'capcolor="'+ar[++i]+'"'); continue; } |
|
699 |
if (ar[i]==CLOSECOLOR) { eval(pf+'closecolor="'+ar[++i]+'"'); continue; } |
|
700 |
if (ar[i]==WIDTH) { eval(pf+'width='+ar[++i]); continue; } |
|
701 |
if (ar[i]==BORDER) { eval(pf+'border='+ar[++i]); continue; } |
|
702 |
if (ar[i]==CELLPAD) { i=opt_MULTIPLEARGS(++i,ar,(pf+'cellpad')); continue; } |
|
703 |
if (ar[i]==STATUS) { eval(pf+"status='"+escSglQuote(ar[++i])+"'"); continue; } |
|
704 |
if (ar[i]==AUTOSTATUS) { eval(pf +'autostatus=('+pf+'autostatus == 1) ? 0 : 1'); continue; } |
|
705 |
if (ar[i]==AUTOSTATUSCAP) { eval(pf +'autostatus=('+pf+'autostatus == 2) ? 0 : 2'); continue; } |
|
706 |
if (ar[i]==HEIGHT) { eval(pf+'height='+pf+'aboveheight='+ar[++i]); continue; } // Same param again. |
|
707 |
if (ar[i]==CLOSETEXT) { eval(pf+"close='"+escSglQuote(ar[++i])+"'"); continue; } |
|
708 |
if (ar[i]==SNAPX) { eval(pf+'snapx='+ar[++i]); continue; } |
|
709 |
if (ar[i]==SNAPY) { eval(pf+'snapy='+ar[++i]); continue; } |
|
710 |
if (ar[i]==FIXX) { eval(pf+'fixx='+ar[++i]); continue; } |
|
711 |
if (ar[i]==FIXY) { eval(pf+'fixy='+ar[++i]); continue; } |
|
712 |
if (ar[i]==RELX) { eval(pf+'relx='+ar[++i]); continue; } |
|
713 |
if (ar[i]==RELY) { eval(pf+'rely='+ar[++i]); continue; } |
|
714 |
if (ar[i]==FGBACKGROUND) { eval(pf+'fgbackground="'+ar[++i]+'"'); continue; } |
|
715 |
if (ar[i]==BGBACKGROUND) { eval(pf+'bgbackground="'+ar[++i]+'"'); continue; } |
|
716 |
if (ar[i]==PADX) { eval(pf+'padxl='+ar[++i]); eval(pf+'padxr='+ar[++i]); continue; } |
|
717 |
if (ar[i]==PADY) { eval(pf+'padyt='+ar[++i]); eval(pf+'padyb='+ar[++i]); continue; } |
|
718 |
if (ar[i]==FULLHTML) { if (pf!='ol_') eval(pf+'fullhtml=1'); continue; } |
|
719 |
if (ar[i]==BELOW || ar[i]==ABOVE) { eval(pf+'vpos='+ar[i]); if (pf!='ol_') olVautoFlag=1; continue; } |
|
720 |
if (ar[i]==CAPICON) { eval(pf+'capicon="'+ar[++i]+'"'); continue; } |
|
721 |
if (ar[i]==TEXTFONT) { eval(pf+"textfont='"+escSglQuote(ar[++i])+"'"); continue; } |
|
722 |
if (ar[i]==CAPTIONFONT) { eval(pf+"captionfont='"+escSglQuote(ar[++i])+"'"); continue; } |
|
723 |
if (ar[i]==CLOSEFONT) { eval(pf+"closefont='"+escSglQuote(ar[++i])+"'"); continue; } |
|
724 |
if (ar[i]==TEXTSIZE) { eval(pf+'textsize="'+ar[++i]+'"'); continue; } |
|
725 |
if (ar[i]==CAPTIONSIZE) { eval(pf+'captionsize="'+ar[++i]+'"'); continue; } |
|
726 |
if (ar[i]==CLOSESIZE) { eval(pf+'closesize="'+ar[++i]+'"'); continue; } |
|
727 |
if (ar[i]==TIMEOUT) { eval(pf+'timeout='+ar[++i]); continue; } |
|
728 |
if (ar[i]==FUNCTION) { if (pf=='ol_') { if (typeof ar[i+1]!='number') { v=ar[++i]; ol_function=(typeof v=='function' ? v : null); }} else {fnMark = 0; v = null; if (typeof ar[i+1]!='number') v = ar[++i]; opt_FUNCTION(v); } continue; } |
|
729 |
if (ar[i]==DELAY) { eval(pf+'delay='+ar[++i]); continue; } |
|
730 |
if (ar[i]==HAUTO) { eval(pf+'hauto=('+pf+'hauto == 0) ? 1 : 0'); continue; } |
|
731 |
if (ar[i]==VAUTO) { eval(pf+'vauto=('+pf+'vauto == 0) ? 1 : 0'); continue; } |
|
732 |
if (ar[i]==CLOSECLICK) { eval(pf +'closeclick=('+pf+'closeclick == 0) ? 1 : 0'); continue; } |
|
733 |
if (ar[i]==WRAP) { eval(pf +'wrap=('+pf+'wrap == 0) ? 1 : 0'); continue; } |
|
734 |
if (ar[i]==FOLLOWMOUSE) { eval(pf +'followmouse=('+pf+'followmouse == 1) ? 0 : 1'); continue; } |
Also available in: Unified diff
- Added new functions to admin dir (Thanks Argos and Ruud)
- Updated install and upgrade-script
- Adapted wb_theme and classic_theme to changed admin dir files