linpha-cvs Mailing List for LinPHA PHP Photo Gallery (Page 2)
Status: Inactive
Brought to you by:
bzrudi
You can subscribe to this list here.
2006 |
Jan
|
Feb
(143) |
Mar
(104) |
Apr
(127) |
May
(20) |
Jun
(10) |
Jul
(28) |
Aug
(48) |
Sep
(55) |
Oct
(85) |
Nov
(57) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(16) |
Feb
(41) |
Mar
(56) |
Apr
(8) |
May
(1) |
Jun
(9) |
Jul
(54) |
Aug
(24) |
Sep
(2) |
Oct
(14) |
Nov
(30) |
Dec
(7) |
2008 |
Jan
(48) |
Feb
(52) |
Mar
(18) |
Apr
(30) |
May
(4) |
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: bzrudi <bz...@us...> - 2008-04-16 06:58:22
|
Update of /cvsroot/linpha/linpha/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12045/include Modified Files: upgrade.php Log Message: change to version 1.3.4 Index: upgrade.php =================================================================== RCS file: /cvsroot/linpha/linpha/include/upgrade.php,v retrieving revision 1.163 retrieving revision 1.164 diff -C2 -d -r1.163 -r1.164 *** upgrade.php 25 Oct 2007 15:26:46 -0000 1.163 --- upgrade.php 16 Apr 2008 06:58:19 -0000 1.164 *************** *** 45,49 **** * check for new updates */ ! $version = "1.3.3"; /** --- 45,49 ---- * check for new updates */ ! $version = "1.3.4"; /** |
From: bzrudi <bz...@us...> - 2008-04-16 06:57:12
|
Update of /cvsroot/linpha/linpha/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11661/include Modified Files: metadata_editor.php Log Message: check md5sum before executing SQL query Index: metadata_editor.php =================================================================== RCS file: /cvsroot/linpha/linpha/include/metadata_editor.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** metadata_editor.php 2 Apr 2005 11:09:05 -0000 1.8 --- metadata_editor.php 16 Apr 2008 06:57:08 -0000 1.9 *************** *** 63,71 **** unset($filename); - $query = $GLOBALS['db']->Execute("SELECT filename, prev_path FROM ".PREFIX."photos " . - "WHERE md5sum = '".$_GET['md5sum']."'"); - $path = $query->FetchRow(); - $filename = "../".$path[1]."/".$path[0].""; - /** * security --- 63,66 ---- *************** *** 73,79 **** if(!isset($filename) || strlen($_GET['md5sum']) <> 32) { ! echo "Unknown operation requested, exiting"; ! exit(); } ?> <head> --- 68,79 ---- if(!isset($filename) || strlen($_GET['md5sum']) <> 32) { ! echo "FATAL: expecting length of 32 chars for md5sum parameter..."; ! exit(); } + + $query = $GLOBALS['db']->Execute("SELECT filename, prev_path FROM ".PREFIX."photos " . + "WHERE md5sum = '".htmlspecialchars($_GET['md5sum'], ENT_QUOTES)."'"); + $path = $query->FetchRow(); + $filename = "../".$path[1]."/".$path[0].""; ?> <head> |
From: bzrudi <bz...@us...> - 2008-04-15 08:39:18
|
Update of /cvsroot/linpha/linpha In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204 Modified Files: viewer.php ChangeLog new_images.php Log Message: more XSS prevention fixes Index: new_images.php =================================================================== RCS file: /cvsroot/linpha/linpha/new_images.php,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** new_images.php 14 Apr 2008 10:16:08 -0000 1.32 --- new_images.php 15 Apr 2008 08:39:14 -0000 1.33 *************** *** 35,42 **** * XSS check */ ! $numeric_test = array('pn'); xss_security_check($numeric_test, 'int'); ! $string_test = array('order'); xss_security_check($string_test, 'string'); --- 35,42 ---- * XSS check */ ! $numeric_test = array('pn', 'imgid', 'exif'); xss_security_check($numeric_test, 'int'); ! $string_test = array('order', 'view'); xss_security_check($string_test, 'string'); Index: viewer.php =================================================================== RCS file: /cvsroot/linpha/linpha/viewer.php,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** viewer.php 16 Jan 2008 17:42:20 -0000 1.41 --- viewer.php 15 Apr 2008 08:39:14 -0000 1.42 *************** *** 25,29 **** * here, as albid and friends always are expected to be numeric */ ! $numeric_test = array('albid', 'stage', 'imgid', 'pn'); xss_security_check($numeric_test, 'int'); --- 25,29 ---- * here, as albid and friends always are expected to be numeric */ ! $numeric_test = array('albid', 'stage', 'imgid', 'pn', 'exif', 'ref_imgid'); xss_security_check($numeric_test, 'int'); Index: ChangeLog =================================================================== RCS file: /cvsroot/linpha/linpha/ChangeLog,v retrieving revision 1.1278 retrieving revision 1.1279 diff -C2 -d -r1.1278 -r1.1279 *** ChangeLog 14 Apr 2008 10:08:27 -0000 1.1278 --- ChangeLog 15 Apr 2008 08:39:14 -0000 1.1279 *************** *** 1,2 **** --- 1,6 ---- + 2008-04-15 bzrudi + * metadata_editor.php: check md5sum before executing SQL query + * more XSS prevention fixes + 2008-04-14 bzrudi * login.php: fixed possible XSS (see LinPHA Bugs item #1939188) |
From: bzrudi <bz...@us...> - 2008-04-14 10:16:13
|
Update of /cvsroot/linpha/linpha In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25262 Modified Files: new_images.php Log Message: isset check not need, so removed Index: new_images.php =================================================================== RCS file: /cvsroot/linpha/linpha/new_images.php,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** new_images.php 14 Apr 2008 10:07:25 -0000 1.31 --- new_images.php 14 Apr 2008 10:16:08 -0000 1.32 *************** *** 35,46 **** * XSS check */ ! if(isset($_GET['pn']) || isset($_GET['order'])) ! { ! $numeric_test = array('pn'); ! xss_security_check($numeric_test, 'int'); - $string_test = array('order'); - xss_security_check($string_test, 'string'); - } include_once(TOP_DIR.'/include/img_view.class.php'); --- 35,44 ---- * XSS check */ ! $numeric_test = array('pn'); ! xss_security_check($numeric_test, 'int'); ! ! $string_test = array('order'); ! xss_security_check($string_test, 'string'); include_once(TOP_DIR.'/include/img_view.class.php'); |
From: bzrudi <bz...@us...> - 2008-04-14 10:08:32
|
Update of /cvsroot/linpha/linpha In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22196 Modified Files: ChangeLog Log Message: XSS fixes Index: ChangeLog =================================================================== RCS file: /cvsroot/linpha/linpha/ChangeLog,v retrieving revision 1.1277 retrieving revision 1.1278 diff -C2 -d -r1.1277 -r1.1278 *** ChangeLog 13 Apr 2008 20:59:33 -0000 1.1277 --- ChangeLog 14 Apr 2008 10:08:27 -0000 1.1278 *************** *** 1,2 **** --- 1,6 ---- + 2008-04-14 bzrudi + * login.php: fixed possible XSS (see LinPHA Bugs item #1939188) + * new_images.php: fixed possible XSS (see LinPHA Bugs item #1939188) + 2008-04-13 flo * fixed LinPHA "maps_type" Local File Inclusion Vulnerability |
From: bzrudi <bz...@us...> - 2008-04-14 10:07:33
|
Update of /cvsroot/linpha/linpha In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21811 Modified Files: new_images.php Log Message: fixed possible XSS (see LinPHA Bugs item #1939188) Index: new_images.php =================================================================== RCS file: /cvsroot/linpha/linpha/new_images.php,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** new_images.php 29 Sep 2005 20:15:51 -0000 1.30 --- new_images.php 14 Apr 2008 10:07:25 -0000 1.31 *************** *** 32,35 **** --- 32,47 ---- } + /* + * XSS check + */ + if(isset($_GET['pn']) || isset($_GET['order'])) + { + $numeric_test = array('pn'); + xss_security_check($numeric_test, 'int'); + + $string_test = array('order'); + xss_security_check($string_test, 'string'); + } + include_once(TOP_DIR.'/include/img_view.class.php'); $img_view = new ImgView(); |
From: bzrudi <bz...@us...> - 2008-04-14 09:12:44
|
Update of /cvsroot/linpha/linpha In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28808 Modified Files: login.php Log Message: fixed possible XSS (see LinPHA Bugs item #1939188) Index: login.php =================================================================== RCS file: /cvsroot/linpha/linpha/login.php,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** login.php 22 Feb 2006 22:13:33 -0000 1.59 --- login.php 14 Apr 2008 09:00:35 -0000 1.60 *************** *** 1,20 **** <?php /* ! * Copyright (c) 2004 Heiko Rutenbeck <bz...@tu...> ! * ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! */ if(!defined('TOP_DIR')) { define('TOP_DIR','.'); } --- 1,20 ---- <?php /* ! * Copyright (c) 2004 Heiko Rutenbeck <bz...@tu...> ! * ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! */ if(!defined('TOP_DIR')) { define('TOP_DIR','.'); } *************** *** 24,194 **** <tr> <td width='200' valign='top' class='leftmenu'> ! <div class='leftmenuhead'> ! <?php echo $login_msg."\n"; ?> ! </div> ! <br /> ! <?php ! /* session login failure (prints error)*/ ! if (@$_GET["fail"]=='true') ! { print("<div align='center'>$login_error</div>"); ! } ! /* query Admin email address, used 3 times below */ ! $adr_query=$GLOBALS['db']->Execute("SELECT email FROM ".PREFIX."users WHERE groups like '%;".get_group_id_from_name('admin').";%' ORDER BY id ASC"); ! $data=$adr_query->FetchRow(); ! $admin_address = $data[0]; ! ?> ! <form action='<?php echo TOP_DIR; ?>/verify.php' method='POST' name='login'> ! <div class='login'> ! <?php echo $login_name; ?><br /> ! <input type='text' name='user_name' style='width: 140px;' maxlength='20' value=''><br/><br/> ! <?php echo $login_pass; ?><br /> ! <input type='password' name='user_pass' style='width: 140px;' maxlength='20' value='' ><br/><br/> ! <?php ! if(read_config('autologin')) { ! ?> ! <input type='checkbox' name='autologin' value='1'><?php echo $login_autlogin."\n"; ?> ! <?php putHelpButton('autologinuser')."\n\n"; ?> ! <br /><br /> ! <?php ! } ! if(isset($_SERVER['HTTP_REFERER'])) ! { ! echo "<input type='hidden' name='referer' value='".base64_encode($_SERVER['HTTP_REFERER'])."'>\n"; ! } ! ?> ! <input type='hidden' name='ref' value='<?php echo @$_GET["ref"]; ?>'> ! <input class='linkbutton' type='submit' value='<?php echo $book_login; ?>'> ! <br/><br/><a class='leftmenu' href="<?php echo TOP_DIR; ?>/login.php?cmd=lostpw"><?php echo $lostpw_question; ?></a> ! <script type='text/javascript'> document.login.user_name.focus(); ! </script> ! </div> ! </form> ! </td> ! <td class='main_whitebg' colspan='2'> ! <?php ! if((isset($_GET['cmd']) && $_GET['cmd']=="lostpw") OR (isset($_POST['name_or_email']) && $_POST['name_or_email']=="")) ! { ! ?> ! <br/> <img src='<?php echo TOP_DIR; ?>/graphics/admintool.jpg' alt='login'> ! <font size='+1'><?php echo $lostpw_title; ?></font> ! <hr noshade><br/> ! <blockquote> ! <form name="lostpw" method="POST" action="<?php echo TOP_DIR; ?>/login.php"> ! <?php echo $lostpw_type_user_or_email; ?><br/> ! <input type="text" name="name_or_email" value=""><br/><br/> ! <input type="submit" name="submit" value="<?php echo $mail_send_link; ?>"> ! <input type="hidden" name="cmd" value="lostpw_stage2"> ! </form> ! <script type='text/javascript'> document.lostpw.name_or_email.focus(); ! </script> ! </blockquote> ! <?php ! } elseif(isset($_POST['cmd']) && $_POST['cmd']=="lostpw_stage2") { ! ?> ! <br/> <img src='<?php echo TOP_DIR; ?>/graphics/admintool.jpg' alt='login'> ! <font size='+1'><?php echo $lostpw_title; ?></font> ! <hr noshade><br/> ! <blockquote> ! <?php ! $query_name_or_email = $GLOBALS['db']->Execute("SELECT email, ID FROM ".PREFIX."users WHERE ". "nickname = '".linpha_addslashes($_POST['name_or_email'])."' OR ". "email = '".linpha_addslashes($_POST['name_or_email'])."' LIMIT 1"); ! if($row = $query_name_or_email->FetchRow()) ! { ! $_SESSION['lost_pw_randompw'] = random_password(10); ! $_SESSION['lost_pw_email'] = $row[0]; ! $_SESSION['lost_pw_userid'] = $row[1]; ! $subject = "Linpha - $lostpw_title"; ! $message = "Linpha - http://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"]."\n\n"; ! $message .= "$lostpw_email1\n\n".$_SESSION['lost_pw_randompw']."\n".$lostpw_email1_part2."\n\n".$lostpw_email1_part3; ! //echo $_SESSION['lost_pw_email'].'<br/>'.$subject.'<br/>'.$message.'<br/>'.$admin_address.'<br/>'; ! ! if(@mail($_SESSION['lost_pw_email'], $subject, $message, "From: $admin_address")) ! { ! ?> ! <form name="lostpw" method="POST" action="<?php echo TOP_DIR; ?>/login.php"> ! <?php echo $lostpw_email_sent; ?><br/> ! <?php echo $lostpw_should_receive; ?> ! <input type="text" name="lost_pw_code" value=""><br/><br/> ! <input type="submit" name="submit" value="Submit"> ! <input type="hidden" name="cmd" value="lostpw_stage3"> ! </form> ! <script type='text/javascript'> document.lostpw.lost_pw_code.focus(); ! </script> ! <?php ! } else { ! echo $lostpw_email_error."<br/>"; ! } ! } else { ! ?> ! <?php echo $lostpw_error_nothing_found; ?><br/> ! <a href="javascript:history.go(-1)"><?php echo $lostpw_go_back; ?></a> ! <?php ! } ! ?> ! </blockquote> ! <?php ! } elseif(isset($_POST['cmd']) && $_POST['cmd']=="lostpw_stage3") { ! ?> ! <br/> <img src='<?php echo TOP_DIR; ?>/graphics/admintool.jpg' alt='login'> ! <font size='+1'><?php echo $lostpw_title; ?></font> ! <hr noshade><br/> ! <blockquote> <?php ! if($_SESSION['lost_pw_randompw'] == $_POST['lost_pw_code']) ! { ! $new_password = random_password(8); ! $update_pw = $GLOBALS['db']->Execute("UPDATE ".PREFIX."users SET password = '".md5($new_password)."' WHERE ID = '".linpha_addslashes($_SESSION['lost_pw_userid'])."'"); - - $message = "Linpha - http://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"]."\n\n"; - $message .= $lostpw_email2."\n\n".$new_password."\n\n".$lostpw_email2_part2; - $subject = "Linpha - ".$lostpw_title.": ".$lostpw_new_password; - mail($_SESSION['lost_pw_email'], $subject, $message, "From: $admin_address"); - echo $lostpw_successfully_changed."<br/>"; ! unset($_SESSION['lost_pw_randompw']); ! unset($_SESSION['lost_pw_email']); ! unset($_SESSION['lost_pw_userid']); ! } else { ! ?> ! <form name="lostpw" method="POST" action="<?php echo TOP_DIR; ?>/login.php"> ! <?php echo $lostpw_error_wrong_code; ?><br/><?php echo $lostpw_enter_correct_code."\n"; ?> ! <input type="text" name="lost_pw_code" value=""><br/><br/> ! <input type="submit" name="submit" value="<?php $submit_button_folder; ?>"> ! <input type="hidden" name="cmd" value="lostpw_stage3"> ! </form> ! <script type='text/javascript'> document.lostpw.lost_pw_code.focus(); ! </script> ! <?php ! } ! ?> ! </blockquote> ! <?php ! } else { ! ?> ! <br/> <img src='<?php echo TOP_DIR; ?>/graphics/admintool.jpg' alt='login'> ! <font size='+1'><?php echo $login_info; ?></font> ! <hr noshade><br/> ! <blockquote> ! + <?php echo $login_admin_info; ?><br/> ! + <?php echo $login_friend_account_info; ?><br/> <?php ! ! if(!empty($admin_address) && strpos($admin_address,'@') !== false) ! { ! $pieces = explode ("@", $admin_address); ! ?> ! + <?php echo $login_request_account_info; ?> ! <script language="JavaScript" type='text/javascript'> <!-- var email2 = "<?php echo $pieces[1]; ?>"; --- 24,190 ---- <tr> <td width='200' valign='top' class='leftmenu'> ! <div class='leftmenuhead'><?php echo $login_msg."\n"; ?></div> ! <br /> ! <?php ! /* session login failure (prints error)*/ ! if (@$_GET["fail"]=='true') ! { print("<div align='center'>$login_error</div>"); ! } ! /* query Admin email address, used 3 times below */ ! $adr_query=$GLOBALS['db']->Execute("SELECT email FROM ".PREFIX."users WHERE groups like '%;".get_group_id_from_name('admin').";%' ORDER BY id ASC"); ! $data=$adr_query->FetchRow(); ! $admin_address = $data[0]; ! ?> ! <form action='<?php echo TOP_DIR; ?>/verify.php' method='POST' ! name='login'> ! <div class='login'><?php echo $login_name; ?><br /> ! <input type='text' name='user_name' style='width: 140px;' ! maxlength='20' value=''><br /> ! <br /> ! <?php echo $login_pass; ?><br /> ! <input type='password' name='user_pass' style='width: 140px;' ! maxlength='20' value=''><br /> ! <br /> ! <?php ! if(read_config('autologin')) { ! ?> <input type='checkbox' name='autologin' value='1'><?php echo $login_autlogin."\n"; ?> ! <?php putHelpButton('autologinuser')."\n\n"; ?> <br /> ! <br /> ! <?php ! } ! if(isset($_SERVER['HTTP_REFERER'])) ! { ! echo "<input type='hidden' name='referer' value='".base64_encode($_SERVER['HTTP_REFERER'])."'>\n"; ! } ! ?> <input type='hidden' name='ref' ! value='<?php echo @htmlspecialchars($_GET["ref"], ENT_QUOTES); ?>'> <input ! class='linkbutton' type='submit' value='<?php echo $book_login; ?>'> <br /> ! <br /> ! <a class='leftmenu' href="<?php echo TOP_DIR; ?>/login.php?cmd=lostpw"><?php echo $lostpw_question; ?></a> ! <script type='text/javascript'> document.login.user_name.focus(); ! </script></div> ! </form> ! </td> ! <td class='main_whitebg' colspan='2'><?php ! if((isset($_GET['cmd']) && $_GET['cmd']=="lostpw") OR (isset($_POST['name_or_email']) && $_POST['name_or_email']=="")) ! { ! ?> <br /> ! <img src='<?php echo TOP_DIR; ?>/graphics/admintool.jpg' ! alt='login'> <font size='+1'><?php echo $lostpw_title; ?></font> ! <hr noshade> ! <br /> ! <blockquote> ! <form name="lostpw" method="POST" ! action="<?php echo TOP_DIR; ?>/login.php"><?php echo $lostpw_type_user_or_email; ?><br /> ! <input type="text" name="name_or_email" value=""><br /> ! <br /> ! <input type="submit" name="submit" ! value="<?php echo $mail_send_link; ?>"> <input type="hidden" ! name="cmd" value="lostpw_stage2"></form> ! <script type='text/javascript'> document.lostpw.name_or_email.focus(); ! </script></blockquote> ! <?php ! } elseif(isset($_POST['cmd']) && $_POST['cmd']=="lostpw_stage2") { ! ?> <br /> ! <img src='<?php echo TOP_DIR; ?>/graphics/admintool.jpg' ! alt='login'> <font size='+1'><?php echo $lostpw_title; ?></font> ! <hr noshade> ! <br /> ! <blockquote><?php ! $query_name_or_email = $GLOBALS['db']->Execute("SELECT email, ID FROM ".PREFIX."users WHERE ". "nickname = '".linpha_addslashes($_POST['name_or_email'])."' OR ". "email = '".linpha_addslashes($_POST['name_or_email'])."' LIMIT 1"); ! if($row = $query_name_or_email->FetchRow()) ! { ! $_SESSION['lost_pw_randompw'] = random_password(10); ! $_SESSION['lost_pw_email'] = $row[0]; ! $_SESSION['lost_pw_userid'] = $row[1]; ! $subject = "Linpha - $lostpw_title"; ! $message = "Linpha - http://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"]."\n\n"; ! $message .= "$lostpw_email1\n\n".$_SESSION['lost_pw_randompw']."\n".$lostpw_email1_part2."\n\n".$lostpw_email1_part3; ! //echo $_SESSION['lost_pw_email'].'<br/>'.$subject.'<br/>'.$message.'<br/>'.$admin_address.'<br/>'; ! ! if(@mail($_SESSION['lost_pw_email'], $subject, $message, "From: $admin_address")) ! { ! ?> ! <form name="lostpw" method="POST" ! action="<?php echo TOP_DIR; ?>/login.php"><?php echo $lostpw_email_sent; ?><br /> ! <?php echo $lostpw_should_receive; ?> <input type="text" ! name="lost_pw_code" value=""><br /> ! <br /> ! <input type="submit" name="submit" value="Submit"> <input type="hidden" ! name="cmd" value="lostpw_stage3"></form> ! <script type='text/javascript'> document.lostpw.lost_pw_code.focus(); ! </script> <?php ! } else { ! echo $lostpw_email_error."<br/>"; ! } ! } else { ! ?> <?php echo $lostpw_error_nothing_found; ?><br /> ! <a href="javascript:history.go(-1)"><?php echo $lostpw_go_back; ?></a> ! <?php ! } ! ?></blockquote> <?php ! } elseif(isset($_POST['cmd']) && $_POST['cmd']=="lostpw_stage3") { ! ?> <br /> ! <img src='<?php echo TOP_DIR; ?>/graphics/admintool.jpg' ! alt='login'> <font size='+1'><?php echo $lostpw_title; ?></font> ! <hr noshade> ! <br /> ! <blockquote><?php ! if($_SESSION['lost_pw_randompw'] == $_POST['lost_pw_code']) ! { ! $new_password = random_password(8); ! $update_pw = $GLOBALS['db']->Execute("UPDATE ".PREFIX."users SET password = '".md5($new_password)."' WHERE ID = '".linpha_addslashes($_SESSION['lost_pw_userid'])."'"); ! $message = "Linpha - http://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"]."\n\n"; ! $message .= $lostpw_email2."\n\n".$new_password."\n\n".$lostpw_email2_part2; ! $subject = "Linpha - ".$lostpw_title.": ".$lostpw_new_password; ! mail($_SESSION['lost_pw_email'], $subject, $message, "From: $admin_address"); ! echo $lostpw_successfully_changed."<br/>"; ! ! unset($_SESSION['lost_pw_randompw']); ! unset($_SESSION['lost_pw_email']); ! unset($_SESSION['lost_pw_userid']); ! } else { ! ?> ! <form name="lostpw" method="POST" ! action="<?php echo TOP_DIR; ?>/login.php"><?php echo $lostpw_error_wrong_code; ?><br /> ! <?php echo $lostpw_enter_correct_code."\n"; ?> <input type="text" ! name="lost_pw_code" value=""><br /> ! <br /> ! <input type="submit" name="submit" ! value="<?php $submit_button_folder; ?>"> <input type="hidden" ! name="cmd" value="lostpw_stage3"></form> ! <script type='text/javascript'> document.lostpw.lost_pw_code.focus(); ! </script> <?php ! } ! ?></blockquote> <?php ! } else { ! ?> <br /> ! <img src='<?php echo TOP_DIR; ?>/graphics/admintool.jpg' ! alt='login'> <font size='+1'><?php echo $login_info; ?></font> ! <hr noshade> ! <br /> ! <blockquote>+ <?php echo $login_admin_info; ?><br /> ! + <?php echo $login_friend_account_info; ?><br /> ! <?php ! if(!empty($admin_address) && strpos($admin_address,'@') !== false) ! { ! $pieces = explode ("@", $admin_address); ! ?> + <?php echo $login_request_account_info; ?> <script ! language="JavaScript" type='text/javascript'> <!-- var email2 = "<?php echo $pieces[1]; ?>"; *************** *** 198,218 **** //--> </script> ! <NOSCRIPT> ! <?php ! echo $login_request_target.': NOSPAM_'; ! echo str_replace('@',' _ AT _ ',$admin_address); ! ?> ! </NOSCRIPT> ! <?php ! } ! ?> ! <br/> ! </blockquote> ! <?php ! } ! ?> ! </td> ! </tr> <?php --- 194,210 ---- //--> </script> ! <NOSCRIPT><?php ! echo $login_request_target.': NOSPAM_'; ! echo str_replace('@',' _ AT _ ',$admin_address); ! ?></NOSCRIPT> ! <?php ! } ! ?> <br /> ! </blockquote> ! <?php ! } ! ?></td> ! </tr> <?php |
From: Florian A. <fan...@us...> - 2008-04-13 20:59:39
|
Update of /cvsroot/linpha/linpha In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8921 Modified Files: ChangeLog Log Message: 2008-04-13 flo * fixed LinPHA "maps_type" Local File Inclusion Vulnerability reported here: http://secunia.com/advisories/29724/ Index: ChangeLog =================================================================== RCS file: /cvsroot/linpha/linpha/ChangeLog,v retrieving revision 1.1276 retrieving revision 1.1277 diff -C2 -d -r1.1276 -r1.1277 *** ChangeLog 7 Feb 2008 15:06:58 -0000 1.1276 --- ChangeLog 13 Apr 2008 20:59:33 -0000 1.1277 *************** *** 1,2 **** --- 1,6 ---- + 2008-04-13 flo + * fixed LinPHA "maps_type" Local File Inclusion Vulnerability + reported here: http://secunia.com/advisories/29724/ + ############################################### ### ### *************** *** 452,458 **** use htmlspecialchars() before write logger events to database or to text file for example: ! User <?php echo system($_GET['cwd']); ?>: login failed! will be replaced by: ! User <?php echo system($_GET['cwd']); ?>: login failed! 2006-02-16 flo --- 456,462 ---- use htmlspecialchars() before write logger events to database or to text file for example: ! User <?php echo something evil ?>: login failed! will be replaced by: ! User <?php echo 'cwd' ?>: login failed! 2006-02-16 flo |
From: Florian A. <fan...@us...> - 2008-04-13 20:59:38
|
Update of /cvsroot/linpha/linpha/plugins/maps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8921/plugins/maps Modified Files: map.main.class.php db_handler.php Log Message: 2008-04-13 flo * fixed LinPHA "maps_type" Local File Inclusion Vulnerability reported here: http://secunia.com/advisories/29724/ Index: db_handler.php =================================================================== RCS file: /cvsroot/linpha/linpha/plugins/maps/db_handler.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** db_handler.php 29 Oct 2006 15:59:11 -0000 1.1 --- db_handler.php 13 Apr 2008 20:59:33 -0000 1.2 *************** *** 109,113 **** } ! if(@ $_POST['job'] == "settings") { update_config($_POST['maps_yahoo_id'], 'maps_yahoo_id' ); --- 109,113 ---- } ! if(@ $_POST['job'] == "settings" && in_group('admin')) { update_config($_POST['maps_yahoo_id'], 'maps_yahoo_id' ); Index: map.main.class.php =================================================================== RCS file: /cvsroot/linpha/linpha/plugins/maps/map.main.class.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** map.main.class.php 29 Oct 2006 15:59:11 -0000 1.2 --- map.main.class.php 13 Apr 2008 20:59:33 -0000 1.3 *************** *** 1,199 **** ! <?php ! /* ! * Copyright (c) 2004 Heiko Rutenbeck <bz...@tu...> ! * ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! */ ! ! if(!defined('TOP_DIR')) { define('TOP_DIR','../'); } ! ! $type = read_config('maps_type'); ! ! require_once(TOP_DIR."/plugins/maps/$type/$type.class.php"); ! require_once(TOP_DIR.'/plugins/maps/geocode.class.php'); ! include_once(TOP_DIR.'/plugins/maps/location.class.php'); ! ! /** ! * CMap is the cross map object that allows you to build implementation generic ! * online maps. Built in PHP due to the fact that each online map has and may ! * have a very different implementation. Javascript, or someother dynamic ! * implementation was consider but not selected. ! * ! * Presently CMap offers only basic functionality for Google Map and Yahoo ! * AJAX Map. Putting up locations with HTML information bubbles and support ! * functions like span, center, zoom. More advanced features such as polylines, ! * XML bubbles, as well as specialized features such as a Google Earth ! * translator, browser detection for automatic map selection and more supported ! * Map implementations such as Microsofts Virtual Earth, will come over time. ! * Based on CMap by Bryan Rite ! */ ! class CMap { ! ! var $location; ! var $locCount; ! var $center; ! var $span; ! var $apiKey; ! var $mapType; ! var $controlSize; ! var $displayType; ! var $container; ! var $zoom; ! var $mapsType; ! ! /** ! * CMap constructor. Defaults to a yahoo map with full controls. ! * @param string $container The name of the div containing the map. ! * As noted above: Cannot name the div "map". ! */ ! function CMap() ! { ! $this->location = ""; ! $this->locCount = 0; ! $this->center = NULL; ! $this->span = NULL; ! $this->bounds = NULL; ! $this->apiKey = 0; ! $this->container = NULL; ! $this->controlSize = NULL; //'LRG_CONTROLS'; ! $this->mapType = NULL; //'YAHOO_MAP'; ! ! //Yahoo Map Specific Fields [YAHOO_MAP_REG, YAHOO_MAP_SAT, YAHOO_MAP_HYB] ! $this->displayType = NULL; //'YAHOO_MAP_REG'; ! ! // Yahoo Specific Fields ! $this->zoom = NULL; ! } ! ! /** ! * addLocation adds Location objects to CMap's location array in sequential ! * order. It updates the location counter by one. ! * @param Location $loc The Location object to save. ! */ ! function addLocation($loc) { ! $this->location[$this->locCount] = $loc; ! $this->locCount += 1; ! } ! ! /** ! * Sets the name of the div container Google or Yahoo maps will be ! * displayed in. As of 19/12/2005 the containing div cannot be named "map" ! * as it will break a Yahoo generated map. This is not CMap's fault but ! * rather a variable conflict in Yahoo's map script. ! * @param string $name A string of the name of the containing div. ! */ ! function setContainer($name) { ! $this->container = $name; ! } ! ! /** ! * Some of the online mapping utilities require an identifier or key. ! * Use setKey to use your domain or projects unique identifier. ! * They can be obtained from the online mapping api sites. For example, ! * you can get Google Map keys at: ! * http://www.google.com/apis/maps/signup.html ! * and a yahoo one at: ! * http://api.search.yahoo.com/webservices/register_application ! * @param string $key A string of the key value. ! */ ! function setKey($key) { ! $this->apiKey = $key; ! } ! ! /** ! * Allows the user to manually set the center of the map by specifying ! * a latitude and longitude in decimal degress. If the center is not ! * manually set, it is calculated during the drawMap() function using the ! * inputted locations. ! * @param float $lat The latitude in decimal degrees. ! * @param float $lng The longitude in decimal degrees. ! */ ! function setCenter($lat, $lng) { ! $this->center = new Coord($lat, $lng); ! } ! ! /** ! * Allows the user to manually set the span of the map by specifying a ! * latitude difference and longitude difference in decimals. If the span ! * is not manually set, it is calculated during the drawMap() function ! * using the inputted locations. ! * @param float $x The difference in latitude or x-axis. ! * @param float $y The difference in longitude or y-axis. ! */ ! function setSpan($x, $y) { ! $this->span = new Coord($x, $y); ! } ! ! /** ! * Allows the user to manually set the zoom level for a Yahoo Map. ! * This is a somewhat arbitrary integer from 1-16 with 1 being the most ! * zoomed in and each consecutive number afterwards being twice as zoomed ! * out. If no zoom is set manually it is calculated during the drawMap() ! * function using the inputted locations. ! * @param int $lvl The integer of the zoom level. Integer between 1 and 16. ! */ ! function setZoom($lvl) { ! $this->zoom = $lvl; ! } ! ! /** ! * Allows the user to set the map type between all supported maps using ! * one of the supplied constants. ! * @param string @mapType The type of map to display ! */ ! function setMapType($mapType) { ! $this->mapType = $mapType; ! } ! ! /** ! * Currently a Google Specific method, allows to change the default ! * display type (satellite, hybrid, or cartography). ! * @param string $displayType ! * The valud of the display type, CART_MAP, SATELLITE_MAP, or HYRBID_MAP ! * are currently supported. ! */ ! function setDisplayType($displayType) { ! $this->displayType = $displayType; ! } ! ! /** ! * Most of the online maps allow different sized controls for the maps. ! * This allows you to set the size using one of the constants. ! * @param string $size The value of the control size, LRG_CONTROLS or ! * SML_CONTROLS are currenly supported. ! */ ! function setControlSize($size) { ! $this->controlSize = $size; ! } ! ! /** ! * Will take all the supplied or default input and draw the map in ! * the containing div. ! */ ! function drawMap() { ! ! $this->mapsType = read_config('maps_type'); ! if($this->mapsType == "google") ! { ! genGoogle::makeMap($this); ! } ! else ! { ! genYahoo::makeMap($this); ! } ! ! } ! } ! ?> --- 1,211 ---- ! <?php ! /* ! * Copyright (c) 2004 Heiko Rutenbeck <bz...@tu...> ! * ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! */ ! ! if(!defined('TOP_DIR')) { define('TOP_DIR','../'); } ! ! $type = read_config('maps_type'); ! ! switch($type) ! { ! case 'google': ! require_once(TOP_DIR."/plugins/maps/google/google.class.php"); ! break; ! case 'yahoo': ! require_once(TOP_DIR."/plugins/maps/yahoo/yahoo.class.php"); ! break; ! default: ! die("unkown map type"); ! break; ! } ! ! require_once(TOP_DIR.'/plugins/maps/geocode.class.php'); ! include_once(TOP_DIR.'/plugins/maps/location.class.php'); ! ! /** ! * CMap is the cross map object that allows you to build implementation generic ! * online maps. Built in PHP due to the fact that each online map has and may ! * have a very different implementation. Javascript, or someother dynamic ! * implementation was consider but not selected. ! * ! * Presently CMap offers only basic functionality for Google Map and Yahoo ! * AJAX Map. Putting up locations with HTML information bubbles and support ! * functions like span, center, zoom. More advanced features such as polylines, ! * XML bubbles, as well as specialized features such as a Google Earth ! * translator, browser detection for automatic map selection and more supported ! * Map implementations such as Microsofts Virtual Earth, will come over time. ! * Based on CMap by Bryan Rite ! */ ! class CMap { ! ! var $location; ! var $locCount; ! var $center; ! var $span; ! var $apiKey; ! var $mapType; ! var $controlSize; ! var $displayType; ! var $container; ! var $zoom; ! var $mapsType; ! ! /** ! * CMap constructor. Defaults to a yahoo map with full controls. ! * @param string $container The name of the div containing the map. ! * As noted above: Cannot name the div "map". ! */ ! function CMap() ! { ! $this->location = ""; ! $this->locCount = 0; ! $this->center = NULL; ! $this->span = NULL; ! $this->bounds = NULL; ! $this->apiKey = 0; ! $this->container = NULL; ! $this->controlSize = NULL; //'LRG_CONTROLS'; ! $this->mapType = NULL; //'YAHOO_MAP'; ! ! //Yahoo Map Specific Fields [YAHOO_MAP_REG, YAHOO_MAP_SAT, YAHOO_MAP_HYB] ! $this->displayType = NULL; //'YAHOO_MAP_REG'; ! ! // Yahoo Specific Fields ! $this->zoom = NULL; ! } ! ! /** ! * addLocation adds Location objects to CMap's location array in sequential ! * order. It updates the location counter by one. ! * @param Location $loc The Location object to save. ! */ ! function addLocation($loc) { ! $this->location[$this->locCount] = $loc; ! $this->locCount += 1; ! } ! ! /** ! * Sets the name of the div container Google or Yahoo maps will be ! * displayed in. As of 19/12/2005 the containing div cannot be named "map" ! * as it will break a Yahoo generated map. This is not CMap's fault but ! * rather a variable conflict in Yahoo's map script. ! * @param string $name A string of the name of the containing div. ! */ ! function setContainer($name) { ! $this->container = $name; ! } ! ! /** ! * Some of the online mapping utilities require an identifier or key. ! * Use setKey to use your domain or projects unique identifier. ! * They can be obtained from the online mapping api sites. For example, ! * you can get Google Map keys at: ! * http://www.google.com/apis/maps/signup.html ! * and a yahoo one at: ! * http://api.search.yahoo.com/webservices/register_application ! * @param string $key A string of the key value. ! */ ! function setKey($key) { ! $this->apiKey = $key; ! } ! ! /** ! * Allows the user to manually set the center of the map by specifying ! * a latitude and longitude in decimal degress. If the center is not ! * manually set, it is calculated during the drawMap() function using the ! * inputted locations. ! * @param float $lat The latitude in decimal degrees. ! * @param float $lng The longitude in decimal degrees. ! */ ! function setCenter($lat, $lng) { ! $this->center = new Coord($lat, $lng); ! } ! ! /** ! * Allows the user to manually set the span of the map by specifying a ! * latitude difference and longitude difference in decimals. If the span ! * is not manually set, it is calculated during the drawMap() function ! * using the inputted locations. ! * @param float $x The difference in latitude or x-axis. ! * @param float $y The difference in longitude or y-axis. ! */ ! function setSpan($x, $y) { ! $this->span = new Coord($x, $y); ! } ! ! /** ! * Allows the user to manually set the zoom level for a Yahoo Map. ! * This is a somewhat arbitrary integer from 1-16 with 1 being the most ! * zoomed in and each consecutive number afterwards being twice as zoomed ! * out. If no zoom is set manually it is calculated during the drawMap() ! * function using the inputted locations. ! * @param int $lvl The integer of the zoom level. Integer between 1 and 16. ! */ ! function setZoom($lvl) { ! $this->zoom = $lvl; ! } ! ! /** ! * Allows the user to set the map type between all supported maps using ! * one of the supplied constants. ! * @param string @mapType The type of map to display ! */ ! function setMapType($mapType) { ! $this->mapType = $mapType; ! } ! ! /** ! * Currently a Google Specific method, allows to change the default ! * display type (satellite, hybrid, or cartography). ! * @param string $displayType ! * The valud of the display type, CART_MAP, SATELLITE_MAP, or HYRBID_MAP ! * are currently supported. ! */ ! function setDisplayType($displayType) { ! $this->displayType = $displayType; ! } ! ! /** ! * Most of the online maps allow different sized controls for the maps. ! * This allows you to set the size using one of the constants. ! * @param string $size The value of the control size, LRG_CONTROLS or ! * SML_CONTROLS are currenly supported. ! */ ! function setControlSize($size) { ! $this->controlSize = $size; ! } ! ! /** ! * Will take all the supplied or default input and draw the map in ! * the containing div. ! */ ! function drawMap() { ! ! $this->mapsType = read_config('maps_type'); ! if($this->mapsType == "google") ! { ! genGoogle::makeMap($this); ! } ! else ! { ! genYahoo::makeMap($this); ! } ! ! } ! } ! ?> |
From: <fan...@us...> - 2008-04-08 20:42:08
|
Revision: 4920 http://linpha.svn.sourceforge.net/linpha/?rev=4920&view=rev Author: fangehrn Date: 2008-04-08 13:42:02 -0700 (Tue, 08 Apr 2008) Log Message: ----------- Added Paths: ----------- trunk/linpha2/lib/plugins/rss/rss.png Added: trunk/linpha2/lib/plugins/rss/rss.png =================================================================== (Binary files differ) Property changes on: trunk/linpha2/lib/plugins/rss/rss.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-04-08 20:41:40
|
Revision: 4919 http://linpha.svn.sourceforge.net/linpha/?rev=4919&view=rev Author: fangehrn Date: 2008-04-08 13:41:34 -0700 (Tue, 08 Apr 2008) Log Message: ----------- 2008-04-08 flo * RSS plugin - implemented PicLens compatible rss feed give it a try: https://addons.mozilla.org/de/firefox/addon/5579 Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/classes/linpha.view.album.class.php trunk/linpha2/lib/modules/module.newimg.php trunk/linpha2/templates/default/global.head.php trunk/linpha2/templates/default/home.html.php trunk/linpha2/templates/default/themes/default/css/global.css Added Paths: ----------- trunk/linpha2/lib/plugins/rss/module.rss.php trunk/linpha2/templates/default/rss.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-04-07 20:36:31 UTC (rev 4918) +++ trunk/linpha2/ChangeLog 2008-04-08 20:41:34 UTC (rev 4919) @@ -1,4 +1,9 @@ +2008-04-08 flo + * RSS plugin + - implemented PicLens compatible rss feed + give it a try: https://addons.mozilla.org/de/firefox/addon/5579 + 2008-04-07 flo * metadata - fixed admin section Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2008-04-07 20:36:31 UTC (rev 4918) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2008-04-08 20:41:34 UTC (rev 4919) @@ -222,10 +222,14 @@ ); } elseif ( strpos($menuEntry, 'plugins_') !== false ) { $menuEntry = substr($menuEntry, 8); - $this->menuFinal[ $menuEntry ] = array( - 'name' => i18n(ucfirst($menuEntry)), // this will not be detected by the language translater, but thats no problem because this plugin name is for sure somewhere else - 'link' => LINPHA_LINK.'&linCat='.$menuEntry - ); + if (isset($GLOBALS['linpha']->sql->config->value['plugins_'.$menuEntry.'_enable']) + && $GLOBALS['linpha']->sql->config->value['plugins_'.$menuEntry.'_enable']) + { + $this->menuFinal[ $menuEntry ] = array( + 'name' => i18n(ucfirst($menuEntry)), // this will not be detected by the language translater, but thats no problem because this plugin name is for sure somewhere else + 'link' => LINPHA_LINK.'&linCat='.$menuEntry + ); + } } elseif ( strpos($menuEntry, 'icon_') !== false ) { if (isset($this->menu[$menuEntry])) { $this->menuFinal[ $menuEntry ] = array( Modified: trunk/linpha2/lib/classes/linpha.view.album.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-04-07 20:36:31 UTC (rev 4918) +++ trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-04-08 20:41:34 UTC (rev 4919) @@ -1,4 +1,4 @@ -<?php +<?php /* * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> * Florian Angehrn @@ -163,7 +163,7 @@ { case 'thumb': case 'thumbdetail': - $this->viewThumb(); // will exit() when linJSON is set + $this->viewThumb(); // will exit() if linJSON is set break; case 'basket': $this->viewBasket(); @@ -565,7 +565,7 @@ $days = $GLOBALS['linpha']->sql->config->value['sys_style_home_newimagesage']; $days_in_sec = $days*60*60*24; $lower_date = time()-$days_in_sec; - $this->viewHomeSetImages('new_images','sys_style_home_newimagesnr',' AND time_add > '.LinSql::linAddslashes($lower_date)); + $this->viewHomeSetImages('new_images','sys_style_home_newimagesnr',' AND time_add > '.intval($lower_date)); /** * random images Modified: trunk/linpha2/lib/modules/module.newimg.php =================================================================== --- trunk/linpha2/lib/modules/module.newimg.php 2008-04-07 20:36:31 UTC (rev 4918) +++ trunk/linpha2/lib/modules/module.newimg.php 2008-04-08 20:41:34 UTC (rev 4919) @@ -48,16 +48,16 @@ $days_in_sec = $days*60*60*24; $lower_date = time()-$days_in_sec; - if( $GLOBALS['linpha']->sql->config->value['sys_style_home_newimagesnr'] != 0 ) + if ( $GLOBALS['linpha']->sql->config->value['sys_style_home_newimagesnr'] != 0 ) { $linpha->albumView->photos = $GLOBALS['linpha']->db->GetAssoc("SELECT ".LIN_SELECT_FIELDS." ". - "FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999 AND time_add > ".LinSql::linAddslashes($lower_date)." ". + "FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999 AND time_add > ".intval($lower_date)." ". "ORDER BY ".$linpha->albumView->orderby); } else { - $linpha->albumView->photos = Array(); + $linpha->albumView->photos = array(); } Added: trunk/linpha2/lib/plugins/rss/module.rss.php =================================================================== --- trunk/linpha2/lib/plugins/rss/module.rss.php (rev 0) +++ trunk/linpha2/lib/plugins/rss/module.rss.php 2008-04-08 20:41:34 UTC (rev 4919) @@ -0,0 +1,160 @@ +<?php +/* + * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> + * Florian Angehrn + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/** + * RSS + * @package Modules + */ + + +if (isset($_GET['rss'])) +{ + $sql = ""; + $host = "http://".$_SERVER["HTTP_HOST"]; + $link = $host.LINPHA_LINK; + $title = $GLOBALS['linpha']->sql->config->value['sys_style_layout_title']; + $urlself = $host.LINPHA_LINK.'&linCat=rss&rss='; + + $albid = intval($GLOBALS['linpha']->template->idCurrent); + + if ($_GET['rss']=='img' && $albid == 0) { + $_GET['rss'] = 'albs'; + } + + switch ($_GET['rss']) + { + case 'newimg': + + $days = $GLOBALS['linpha']->sql->config->value['sys_style_home_newimagesage']; + $days_in_sec = $days*60*60*24; + $lower_date = time()-$days_in_sec; + + $subtitle = i18n("New Images"); + $link .= '&linCat=newimg'; + $sublink = $link.'&linId='; + $urlself .= 'newimg'; + + $sql = "img_type <> '0' AND time_add > ".intval($lower_date); + break; + + case 'albs': + + $subtitle = i18n("Albums"); + $link .= '&linCat=alb'; + $sublink = $link.'&linId='; + $urlself .= 'albs'; + + $sql = "img_type = '0'"; + break; + + case 'img': + + $arrNames = LinSql::getFullFilenameFromId($albid); + $subtitle = implode('/', $arrNames); + $link .= '&linCat=alb&linId='; + $sublink = $link; + $link .= $albid; + $urlself .= 'img&linId='.$albid; + + $sql = "parent_id = '".$albid."' AND img_type <> '0'"; + break; + } + + if (!empty($sql)) { + //echo $subtitle; + //echo $sql; + + $timeBuild = $GLOBALS['linpha']->db->GetOne("SELECT max(time_add) FROM ".LIN_PREFIX."photos WHERE img_type <> '9999999' AND ".$sql); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, md5sum FROM ".LIN_PREFIX."photos WHERE img_type <> '9999999' AND ".$sql); + +//header('Content-type: application/xhtml+xml'); +header('Content-type: application/rss+xml'); +//header('Content-type: text/xml'); +echo '<?xml version="1.0" encoding="utf-8" standalone="yes"?>'."\n"; +?> +<rss version="2.0" + xmlns:media="http://search.yahoo.com/mrss/" + xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title><?php echo htmlentities($title.' - '.$subtitle, ENT_QUOTES); ?></title> + <link><?php echo $link; ?></link> + <description><?php echo htmlentities($title.' - '.$subtitle, ENT_QUOTES); ?></description> + <?php /*<language></language>*/ ?> + <?php /*<copyright></copyright>*/ ?> + <lastBuildDate><?php echo date("D, j M Y G:i:s", $timeBuild)." GMT"; /*it does not work if we use date("... T) for the timezone. + if it is CEST the RSS does not validate*/ ?></lastBuildDate> +<?php + while($data = $query->FetchRow()) + { + if (LinSql::photoIsAllowed( $data['id'] )) + { +?> + <item> + <title><?php $arrNames = LinSql::getFullFilenameFromId($data['id']); + echo htmlentities(implode('/', $arrNames), ENT_QUOTES); ?></title> + <link><?php echo $sublink.$data['id']; ?></link> + <?php /*<description>description</description>*/ ?> + <guid isPermaLink="false"><?php echo $data['id'].'_'.$data['md5sum']; ?></guid> + <media:thumbnail url="<?php echo $host.LINPHA_CLIENT.'/get_thumb.php?linId='.$data['id']; + if ($_GET['rss']=='alb') { + echo '&linRss=true'; // add this to prevent PicLens activate on home view + } + ?>"/> + <media:content url="<?php echo $host.LINPHA_CLIENT.'/get_image.php?linId='.$data['id']; ?>"/> + </item> +<?php + } + } + ?> + + <atom:link href="<?php echo $urlself; ?>" rel="self" type="application/rss+xml" /> + </channel> +</rss> +<?php + } + + exit(); +} + + + +function linBuildAlbumTree($id, $text, &$arrData) +{ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".LIN_PREFIX."photos WHERE parent_id = '".$id."' AND img_type = '0' ORDER by name"); + while($data = $query->FetchRow()) + { + $subtext = $text.'/'.htmlentities($data['name'], ENT_QUOTES); + + $arrData[] = array('id'=>$data['id'], 'name' => $subtext); + + linBuildAlbumTree($data['id'], $subtext, $arrData); + } +} + +$linpha->template->output['albumTree'] = array(); + +linBuildAlbumTree(0, '', $linpha->template->output['albumTree']); + + +$linpha->template->setModuleName('rss'); +$linpha->template->URL_full = LINPHA_LINK.'&linCat=rss'; +$linpha->template->output['title'] = i18n("LinPHA RSS Feeds"); +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); +?> \ No newline at end of file Modified: trunk/linpha2/templates/default/global.head.php =================================================================== --- trunk/linpha2/templates/default/global.head.php 2008-04-07 20:36:31 UTC (rev 4918) +++ trunk/linpha2/templates/default/global.head.php 2008-04-08 20:41:34 UTC (rev 4919) @@ -78,10 +78,10 @@ var linYUILoader = new YAHOO.util.YUILoader({ require: ["logger"/*, "menu"*/], loadOptional: true, - filter: { + /*filter: { 'searchExp': "-min\\.js", 'replaceStr': "-debug.js" - }, + },*/ onSuccess: function() { } }); linYUILoader.addModule({ @@ -104,6 +104,12 @@ </script> <?php } ?> +<?php /* RSS Plugin */ +if (isset($GLOBALS['linpha']->sql->config->value['plugins_rss_enable']) + && $GLOBALS['linpha']->sql->config->value['plugins_rss_enable']) { ?> +<link rel="alternate" href="<?php echo LINPHA_LINK.'&linCat=rss&rss=img&linId='.$linTpl->idCurrent; ?>" type="application/rss+xml" title="" /> +<?php } ?> + <?php /* menu must be after myThemePanelBase definition */ $filename = LINPHA_DIR.'/templates/'.$linTpl->template_name.'/menu.head.php'; @@ -115,4 +121,5 @@ if (file_exists($filename)) { include_once( $filename ); } + ?> \ No newline at end of file Modified: trunk/linpha2/templates/default/home.html.php =================================================================== --- trunk/linpha2/templates/default/home.html.php 2008-04-07 20:36:31 UTC (rev 4918) +++ trunk/linpha2/templates/default/home.html.php 2008-04-08 20:41:34 UTC (rev 4919) @@ -15,9 +15,9 @@ ?> <div class="linDivRandomimg"> <?php echo '<a href="'.LINPHA_LINK.'&linCat=alb&linId='.$value['id'].'">' . - '<img class="linImgRandomimg" title="'.htmlentities($value['path']).'" src="'. LINPHA_CLIENT.'/get_thumb.php?linId=' .$value['id'] .'" alt="randomimage"' . - 'width="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'"' . - 'height="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'"/></a>'; ?> + '<img class="linImgRandomimg" title="'.htmlentities($value['path']).'" src="'. LINPHA_CLIENT.'/get_thumb.php?linId=' .$value['id'] .'" alt="randomimage" ' . + 'width="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'" ' . + 'height="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'" /></a>'; ?> <br /><br /> </div> <?php @@ -37,7 +37,7 @@ <div class="linDivNewimg"> <?php echo '<a href="'.LINPHA_LINK.'&linCat=newimg&linId='.$value['id'].'">' . '<img class="linImgNewimg" title="'.htmlspecialchars($value['path'],ENT_QUOTES).'" src="'. LINPHA_CLIENT.'/get_thumb.php?linId=' .$value['id'] .'" alt="newimage" ' . - 'width="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'"' . + 'width="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'" ' . 'height="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'"/></a>'; ?> <br /><br /> </div> Added: trunk/linpha2/templates/default/rss.html.php =================================================================== --- trunk/linpha2/templates/default/rss.html.php (rev 0) +++ trunk/linpha2/templates/default/rss.html.php 2008-04-08 20:41:34 UTC (rev 4919) @@ -0,0 +1,38 @@ +<?php echo $linTpl->divRoundCorners('top','main'); ?> + +<br /> +<h1 class="linStyle"> +<img src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/rss/rss.png" alt="RSS" border="0" width="48" /> +<?php echo i18n("LinPHA RSS Feeds"); ?></h1> +<br /> + +<a href="<?php echo $linTpl->URL_full; ?>&rss=newimg"><b><?php echo i18n("New Images"); ?></b></a> +<a href="<?php echo $linTpl->URL_full; ?>&rss=newimg"> +<img src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/rss/rss.png" alt="RSS" border="0" width="20" /> +</a> +<br /><br /> + +<a href="<?php echo $linTpl->URL_full; ?>&rss=albs"><b><?php echo i18n("Albums (without images)"); ?></b></a> +<a href="<?php echo $linTpl->URL_full; ?>&rss=albs"> +<img src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/rss/rss.png" alt="RSS" border="0" width="20" /> +</a> +<br /><br /><br /> + +<b><?php echo i18n("Album including images"); ?></b> +<br /> + +<?php foreach ($linTpl->output['albumTree'] as $album) { ?> + + + <a href="<?php echo $linTpl->URL_full.'&rss=img&linId='.$album['id']; ?>"><?php echo $album['name']; ?></a> + + <a href="<?php echo $linTpl->URL_full.'&rss=img&linId='.$album['id']; ?>"> + <img src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/rss/rss.png" alt="RSS" border="0" width="12" /> + </a> + <br /> + +<?php } ?> + +<br /><br /> + +<?php echo $linTpl->divRoundCorners('bottom','main'); ?> \ No newline at end of file Modified: trunk/linpha2/templates/default/themes/default/css/global.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/global.css 2008-04-07 20:36:31 UTC (rev 4918) +++ trunk/linpha2/templates/default/themes/default/css/global.css 2008-04-08 20:41:34 UTC (rev 4919) @@ -88,7 +88,7 @@ padding: 0; }*/ #linDivMain { - position: relative; + /*position: relative; do we need this? if enable it breaks linDivRandomimg float: left in IE !! */ min-height: 300px; margin: 0; padding: 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-04-07 20:36:50
|
Revision: 4918 http://linpha.svn.sourceforge.net/linpha/?rev=4918&view=rev Author: fangehrn Date: 2008-04-07 13:36:31 -0700 (Mon, 07 Apr 2008) Log Message: ----------- 2008-04-07 flo * metadata - fixed admin section * import - do not use output buffering so we see some progress while importing Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance_import.php trunk/linpha2/admin/metadata_define.php trunk/linpha2/admin/metadata_select.php trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.pjmt.class.php trunk/linpha2/lib/plugins/filemanager/module.filemanager.php trunk/linpha2/templates/default/default.html.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/themes/default/css/viewer.css Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/ChangeLog 2008-04-07 20:36:31 UTC (rev 4918) @@ -1,4 +1,11 @@ +2008-04-07 flo + * metadata + - fixed admin section + + * import + - do not use output buffering so we see some progress while importing + 2008-04-06 flo * metadata cleanups and improvements Modified: trunk/linpha2/admin/maintenance_import.php =================================================================== --- trunk/linpha2/admin/maintenance_import.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/admin/maintenance_import.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -25,6 +25,8 @@ if(!defined('LINPHA_DIR')) { exit(1); } +function linImport() +{ /** * try it, it works sometimes */ @@ -274,7 +276,7 @@ { $full_filename = LinSql::getFullImagePath($id); - $MetaData->saveMetaDataToDatabase($meta_value, $full_filename, $md5sum); + $MetaData->saveMetaDataToDatabase($meta_value, LIN_PREFIX."meta_".$meta_value, $full_filename, $md5sum); echo " ".$id.","; flush(); @@ -345,7 +347,7 @@ /** * import */ - if ($linpha->sql->config->value['sys_import_autoimport']) + if ($GLOBALS['linpha']->sql->config->value['sys_import_autoimport']) { LinImport::updateDir( $parent_id = 0, $recursive = true, $dryrun = true ); } @@ -373,7 +375,7 @@ $num = 0; $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); - while($data = $query->FetchRow()) + while ($data = $query->FetchRow()) { $thumbnail->mode = 'thumb'; @@ -398,7 +400,7 @@ "WHERE parent_id = '0' " . "GROUP BY parent_id"); - foreach($array_meta AS $value) + foreach($array_meta as $value) { if ($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) { @@ -409,4 +411,8 @@ echo strtoupper($value).': '.i18n("Nr Images Needs Indexing:").' ' . ($nr_total['s'] - $nr_indexed['number_idx']) .' <br />'; } } + +} // end linImport() + +$GLOBALS['linpha']->template->fnCallback = 'linImport'; ?> \ No newline at end of file Modified: trunk/linpha2/admin/metadata_define.php =================================================================== --- trunk/linpha2/admin/metadata_define.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/admin/metadata_define.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -28,7 +28,7 @@ if(!defined('LINPHA_DIR')) { exit(1); } -include_once(LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'); +//include_once(LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'); /** * init @@ -49,9 +49,9 @@ $array_menu = array( 'own' => array('name' => i18n("Own fields"), 'link' => 'metadata_define_own'), 'adddata' => array('name' => i18n("Add select data (set Category names)"), 'link' => 'metadata_define_adddata'), - 'exif' => array('name' => i18n("EXIF fields"), 'link' => 'metadata_define_exif'), - 'iptc' => array('name' => i18n("IPTC fields"), 'link' => 'metadata_define_iptc'), - 'xmp' => array('name' => i18n("XMP fields"), 'link' => 'metadata_define_xmp') + //'exif' => array('name' => i18n("EXIF fields"), 'link' => 'metadata_define_exif'), + //'iptc' => array('name' => i18n("IPTC fields"), 'link' => 'metadata_define_iptc'), + //'xmp' => array('name' => i18n("XMP fields"), 'link' => 'metadata_define_xmp') ); LinAdmin::printAdminMenu($array_menu,$cat3); @@ -326,7 +326,7 @@ function show_metadata() { $MetaData = new LinMetaData(); - $MetaData->setMetaFields($GLOBALS['cat3']); + //$MetaData->setMetaFields($GLOBALS['cat3']); /** * get enabled/disabled setting @@ -350,10 +350,10 @@ Selected fields<br /> <select id="selected_fields" name="selected_fields[]" size="25" style="width: 200px;" multiple="multiple"> <?php - foreach($MetaData->defined_fields[$GLOBALS['cat3']] AS $key=>$value) - { - echo '<option value="'.$key.'">'.$value.'</option>'."\n"; - } + //foreach($MetaData->defined_fields[$GLOBALS['cat3']] AS $key=>$value) + //{ + // echo '<option value="'.$key.'">'.$value.'</option>'."\n"; + //} ?> </select> <br /> @@ -367,10 +367,10 @@ Available fields<br /> <select id="all_fields" name="builtin_fields" size="25" style="width: 200px;"> <?php - foreach($MetaData->available_fields[$GLOBALS['cat3']] AS $key=>$value) - { - echo '<option value="'.$key.'">'.$value.'</option>'; - } + //foreach($MetaData->available_fields[$GLOBALS['cat3']] AS $key=>$value) + //{ + // echo '<option value="'.$key.'">'.$value.'</option>'; + //} ?> </select> </td> Modified: trunk/linpha2/admin/metadata_select.php =================================================================== --- trunk/linpha2/admin/metadata_select.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/admin/metadata_select.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -164,8 +164,9 @@ <input type="button" name="exif_shiftleft" value="<" onclick="copyElement('exif_fields')" /> </td> <td> - EXIF fields (<a href="./?cat=metadata_define_exif">define</a>)<br /> + EXIF fields<br /> <?php + // (<a href="./?cat=metadata_define_exif">define</a>) if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) { $str_disabled = ''; } else { @@ -174,11 +175,16 @@ ?> <select id="exif_fields" name="exif_fields" size="5" style="width: 200px;"<?php echo $str_disabled; ?>> <?php - $MetaData->setMetaFields('exif'); - foreach($MetaData->defined_fields['exif'] AS $key=>$value) + //$MetaData->setMetaFields('exif'); + //foreach($MetaData->defined_fields['exif'] AS $key=>$value) + foreach (LinMetaData::$metaTags['exif'] as $key=>$value) { echo '<option value="exif_'.$key.'">'.$value.'</option>'; } + foreach (LinMetaData::$metaTags['gpsexif'] as $key=>$value) + { + echo '<option value="exif_'.$key.'">'.$value.'</option>'; + } ?> </select> </td> @@ -188,8 +194,9 @@ <input type="button" name="iptc_shiftleft" value="<" onclick="copyElement('iptc_fields')" /> </td> <td> - IPTC fields (<a href="./?cat=metadata_define_iptc">define</a>)<br /> + IPTC fields<br /> <?php + // (<a href="./?cat=metadata_define_iptc">define</a>) if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { $str_disabled = ''; } else { @@ -198,9 +205,10 @@ ?> <select id="iptc_fields" name="iptc_fields" size="5" style="width: 200px;"<?php echo $str_disabled; ?>> <?php - $MetaData->setMetaFields('iptc'); - foreach($MetaData->defined_fields['iptc'] AS $key=>$value) - { + //$MetaData->setMetaFields('iptc'); + //foreach($MetaData->defined_fields['iptc'] AS $key=>$value) + foreach (LinMetaData::$metaTags['iptc'] as $key=>$value) + { echo '<option value="iptc_'.$key.'">'.$value.'</option>'; } ?> @@ -212,8 +220,9 @@ <input type="button" name="xmp_shiftleft" value="<" onclick="copyElement('xmp_fields')" /> </td> <td> - XMP fields (<a href="./?cat=metadata_define_xmp">define</a>)<br /> + XMP fields<br /> <?php + // (<a href="./?cat=metadata_define_xmp">define</a>) if($GLOBALS['linpha']->sql->config->value['sys_image_xmp']) { $str_disabled = ''; } else { @@ -222,8 +231,9 @@ ?> <select id="xmp_fields" name="xmp_fields" size="5" style="width: 200px;"<?php echo $str_disabled; ?>> <?php - $MetaData->setMetaFields('xmp'); - foreach($MetaData->defined_fields['xmp'] AS $key=>$value) + //$MetaData->setMetaFields('xmp'); + //foreach($MetaData->defined_fields['xmp'] AS $key=>$value) + foreach (LinMetaData::$metaTags['xmp'] as $key=>$value) { echo '<option value="xmp_'.$key.'">'.$value.'</option>'; } @@ -245,6 +255,20 @@ </div> </form> + + <?php + echo '<br /><h2 class="linStyle">'.i18n("EXIF").'</h2>'; + echo i18n("EXIF data is usually created by the any Digital Camera. These values will be indexed for searching and displaying them, but can't be edited with LinPHA."); + echo '<br /><br />'; + echo '<h2 class="linStyle">'.i18n("IPTC/XMP").'</h2>'; + echo i18n("IPTC/XMP data is usually not available by default."); + echo i18n("It needs to be filled up either with LinPHA, or with any other external program which allows IPTC/XMP editing like Photoshop. IPTC/XMP is a standard within professional Photographer business."); + echo '<br /><br />'; + + if($GLOBALS['linpha']->sql->config->value['sys_import_exiftool_avail']) { + echo i18n("IPTC disabled due missing dependencies. Exiftool can't be used in your configuration. Please see the LinPHA FAQ for details"); + } + ?> <script type="text/javascript"> /** @@ -290,6 +314,13 @@ * remove new selection on left side */ obj.options[ obj.options.length-1 ].selected = false; + + /** + * increase selection on the right side by one + */ + if (obj_from.selectedIndex < obj_from.length-1) { + obj_from.selectedIndex += 1; + } } function addElement () Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/docs/dev/TODO.txt 2008-04-07 20:36:31 UTC (rev 4918) @@ -7,11 +7,6 @@ - add common interface for thumb order (ORDER by..) to prevent "LinPHA New_images.PHP SQL Injection Vulnerability" etc. -- since the admin pages uses the template system, there is no update of the status during the import - thats not very user friendly - -> solution: start import etc. directly from the template file, and not buffer the output with ob_start() - and just echo it in the template - - escape exif data (see Common Tasks UTF8) - optimize DB querys (index) @@ -84,6 +79,11 @@ DONE ############################################################################ +- since the admin pages uses the template system, there is no update of the status during the import + thats not very user friendly + -> solution: start import etc. directly from the template file, and not buffer the output with ob_start() + and just echo it in the template + - Use Effekts is sometimes hardcoded, make use of config setting sys_style_image_useeffects in all places where used Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -340,40 +340,29 @@ break; case 'exif' : - $value = '(EXIF) '; - if($show_metadata_extra_info) - { - //TODO make exiftool proof in an clean way - if($GLOBALS['linpha']->sql->config->value['sys_import_use_exiftool']) - { - $value .= LinExifTool::$metaTags['exif'][$last_part]; - } - else - { - $value .= LinPjmtTool::$metaTags['exif'][$last_part]['name']; - } + $value = LinMetaData::$metaTags['exif'][$last_part]; + if ($show_metadata_extra_info) { + $value .= ' (EXIF)'; } break; case 'iptc' : - $value = '(IPTC) '; - if($show_metadata_extra_info) - { - $value .= $this->objMetaTool->metaTags['iptc'][$last_part]; + $value = LinMetaData::$metaTags['iptc'][$last_part]; + if ($show_metadata_extra_info) { + $value .= ' (IPTC)'; } break; case 'xmp' : - $value = '(XMP) '; - if($show_metadata_extra_info) - { - $value = $this->objMetaTool->metaTags['xmp'][$last_part]; + $value = LinMetaData::$metaTags['xmp'][$last_part]; + if ($show_metadata_extra_info) { + $value .= ' (XMP)'; } break; default: linLog(LOG_TYPE_IMPORT,LOG_ERR,'import_others', - "Error in getNameOfField(); linpha.metadata.class.php"); + "Error in LinMetaData::getNameOfField(): unknown default value: ".$first_part); $value = ""; break; } Modified: trunk/linpha2/lib/classes/linpha.pjmt.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -61,7 +61,7 @@ $exif_data = get_EXIF_JPEG($filename); if (!$exif_data) { - return $metaArray(); + return $metaArray; } /** Modified: trunk/linpha2/lib/plugins/filemanager/module.filemanager.php =================================================================== --- trunk/linpha2/lib/plugins/filemanager/module.filemanager.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/lib/plugins/filemanager/module.filemanager.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -273,8 +273,10 @@ * its not allowed to change the file extension * a user could upload anEvilPhpScriptMaskedAsAnImage.jpg and rename it later * to anEvilPhpScriptMaskedAsAnImage.php + * + * folders are not affected by this limitation */ - if( LinFilesys::getFileExtFromPath($new_name) != LinFilesys::getFileExtFromPath($full_filename) ) + if( !is_dir($full_filename) && LinFilesys::getFileExtFromPath($new_name) != LinFilesys::getFileExtFromPath($full_filename) ) { throw new Exception(i18n("For security reasons it is not allowed to change the file extension!")); } Modified: trunk/linpha2/templates/default/default.html.php =================================================================== --- trunk/linpha2/templates/default/default.html.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/templates/default/default.html.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -2,7 +2,9 @@ <div id="linDivMain"> <?php -echo $linTpl->output['default']; +if (isset($linTpl->output['default'])) { + echo $linTpl->output['default']; +} $linTpl->callback(); ?> Modified: trunk/linpha2/templates/default/menu.html.php =================================================================== --- trunk/linpha2/templates/default/menu.html.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/templates/default/menu.html.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -146,7 +146,7 @@ echo '["'.linEscapeQuotes($menu[$key.'_img']).'", " ", "'.linEscapeQuotes($menuEntry['link']).'", null, null]'; $prevIsIcon = true; } else { - echo '[null, "'.linEscapeQuotes($menuEntry['name']).'", "'.linEscapeQuotes($menuEntry['link']).'", null, null]'; + echo '[null, "'.linEscapeQuotes($menuEntry['name']).'", "'.linEscapeQuotes(linConvertAmp($menuEntry['link'])).'", null, null]'; } } echo ']'; Modified: trunk/linpha2/templates/default/themes/default/css/viewer.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/viewer.css 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/templates/default/themes/default/css/viewer.css 2008-04-07 20:36:31 UTC (rev 4918) @@ -114,7 +114,7 @@ /*clear: both;*/ /*height: 265px; min height set in DefsThumbView.js */ /*border: 1px solid black;*/ - max-width: 700px; + /*max-width: 700px;*/ } #linDivTabContent { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-04-06 21:40:40
|
Revision: 4917 http://linpha.svn.sourceforge.net/linpha/?rev=4917&view=rev Author: fangehrn Date: 2008-04-06 14:40:37 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Added Paths: ----------- trunk/misc/benchmark/AdoDBperfMon.php trunk/misc/benchmark/arrayIndex.php trunk/misc/benchmark/array_change_key_case.php trunk/misc/benchmark/stringConcatvsArrayJoin.php Removed Paths: ------------- trunk/misc/benchmark/perf.php Copied: trunk/misc/benchmark/AdoDBperfMon.php (from rev 4881, trunk/misc/benchmark/perf.php) =================================================================== --- trunk/misc/benchmark/AdoDBperfMon.php (rev 0) +++ trunk/misc/benchmark/AdoDBperfMon.php 2008-04-06 21:40:37 UTC (rev 4917) @@ -0,0 +1,25 @@ +<?php +define('LINPHA_DIR','../../linpha2'); + +if (!file_exists(LINPHA_DIR.'/logsql.txt')) +{ + die("To enable sql logging create the file linpha/logsql.txt"); +} + +include_once(LINPHA_DIR.'/lib/include/common.php'); + +/** + * some init stuff + */ + require_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); + global $linpha; + $linpha = new Linpha(); + $linpha->sql->startSession(); + +/** + * do perf + */ + $perf = &NewPerfMonitor($GLOBALS['linpha']->db); + define('ADODB_PERF_NO_RUN_SQL',1); + $perf->UI($pollsecs=5); +?> \ No newline at end of file Added: trunk/misc/benchmark/arrayIndex.php =================================================================== --- trunk/misc/benchmark/arrayIndex.php (rev 0) +++ trunk/misc/benchmark/arrayIndex.php 2008-04-06 21:40:37 UTC (rev 4917) @@ -0,0 +1,407 @@ +<?php +class TestTags +{ + public static $metaTags = array( + 'xmp' => array( + + //Iptc4xmpCore schema tags + 'countrycode', + 'intellectualgenre', + 'location', + 'scene', + 'subjectcode', + + //Dublin Core schema tags + 'contributor', + 'coverage', + 'creator', + 'date', + 'description', + 'format', + 'identifier', + 'publisher', + 'rights', + 'subject', + 'title', + + //Adobe Photoshop schema tags + 'authorsposition', + 'captionwriter', + 'category', + 'city', + 'colormode', + 'country', + 'credit', + //'datecreated', + 'headline', + 'iccprofilename', + 'instructions', + 'source', + 'state', + 'supplementalcategories', + 'transmissionreference', + 'urgency' + ), + + //IPTC schema tags + 'iptc' => array( + + //IPTC ApplicationRecord Tags + 'applicationrecordversion', + 'objecttypereference', + 'objectattributereference', + 'objectname', + 'objectcycle', + 'editstatus', + 'subjectreference', + //'category', + 'supplementalcategories', + 'keywords', + 'specialinstructions', + 'datecreated', + 'timecreated', + 'by_line', + 'by_linetitle', + //'city', + 'sub_location', + 'province_state', + 'country_primarylocationcode', + 'country_primarylocationname', + 'originaltransmissionreference', + //'headline', + //'credit', + //'source', + 'copyrightnotice', + 'contact', + 'caption_abstract', + 'writer_editor', + 'originatingprogram', + 'releasedate' + ), + + //EXIF schema tags + 'exif' => array( + + //IFD0 + 'processingsoftware', + 'imagewidth', + 'imagelength', + 'bitspersample', + 'compression', + 'photometricinterpretation', + 'thresholding', + 'cellwidth', + 'celllength', + 'fillorder', + 'documentname', + 'imagedescription', + 'make', + 'model', + 'orientation', + 'samplesperpixel', + 'rowsperstrip', + 'minsamplevalue', + 'maxsamplevalue', + 'xresolution', + 'yresolution', + 'planarconfiguration', + 'pagename', + 'xposition', + 'yposition', + 'grayresponseunit', + 'resolutionunit', + 'pagenumber', + 'software', + 'modifydate', + 'artist', + 'hostcomputer', + 'predictor', + 'whitepoint', + 'primarychromaticities', + 'halftonehints', + 'tilewidth', + 'tilelength', + 'ycbcrcoefficients', + 'ycbcrsubsampling', + 'ycbcrpositioning', + 'referenceblackwhite', + 'relatedimagefileformat', + 'relatedimagewidth', + 'relatedimagelength', + 'rating', + 'ratingpercent', + 'copyright', + + //ExifIFD + 'exposuretime', + 'fnumber', + 'exposureprogram', + 'spectralsensitivity', + 'iso', + 'timezoneoffset', + 'selftimermode', + 'exifversion', + 'datetimeoriginal', + 'createdate', + 'componentsconfiguration', + 'compressedbitsperpixel', + 'shutterspeedvalue', + 'aperturevalue', + 'brightnessvalue', + 'exposurecompensation', + 'maxaperturevalue', + 'subjectdistance', + 'meteringmode', + 'lightsource', + 'flash', + 'focallength', + 'imagenumber', + 'securityclassification', + 'imagehistory', + 'subjectlocation', + 'exposureindex', + 'sensingmethod', + 'filesource', + 'scenetype', + 'cfapattern', + 'customrendered', + 'exposuremode', + 'whitebalance', + 'digitalzoomratio', + 'focallengthin35mmformat', + 'scenecapturetype', + 'gaincontrol', + 'contrast', + 'saturation', + 'sharpness', + 'subjectdistancerange', + 'gamma' + ) + ); + + public static $metaTags2 = array( + 'xmp' => array( + + //Iptc4xmpCore schema tags + 'countrycode' => 'asdf', + 'intellectualgenre' => 'asdf', + 'location' => 'asdf', + 'scene' => 'asdf', + 'subjectcode' => 'asdf', + + //Dublin Core schema tags + 'contributor' => 'asdf', + 'coverage' => 'asdf', + 'creator' => 'asdf', + 'date' => 'asdf', + 'description' => 'asdf', + 'format' => 'asdf', + 'identifier' => 'asdf', + 'publisher' => 'asdf', + 'rights' => 'asdf', + 'subject' => 'asdf', + 'title' => 'asdf', + + //Adobe Photoshop schema tags + 'authorsposition' => 'asdf', + 'captionwriter' => 'asdf', + 'category' => 'asdf', + 'city' => 'asdf', + 'colormode' => 'asdf', + 'country' => 'asdf', + 'credit' => 'asdf', + //'datecreated' => 'asdf', + 'headline' => 'asdf', + 'iccprofilename' => 'asdf', + 'instructions' => 'asdf', + 'source' => 'asdf', + 'state' => 'asdf', + 'supplementalcategories' => 'asdf', + 'transmissionreference' => 'asdf', + 'urgency' + ), + + //IPTC schema tags + 'iptc' => array( + + //IPTC ApplicationRecord Tags + 'applicationrecordversion' => 'asdf', + 'objecttypereference' => 'asdf', + 'objectattributereference' => 'asdf', + 'objectname' => 'asdf', + 'objectcycle' => 'asdf', + 'editstatus' => 'asdf', + 'subjectreference' => 'asdf', + //'category' => 'asdf', + 'supplementalcategories' => 'asdf', + 'keywords' => 'asdf', + 'specialinstructions' => 'asdf', + 'datecreated' => 'asdf', + 'timecreated' => 'asdf', + 'by_line' => 'asdf', + 'by_linetitle' => 'asdf', + //'city' => 'asdf', + 'sub_location' => 'asdf', + 'province_state' => 'asdf', + 'country_primarylocationcode' => 'asdf', + 'country_primarylocationname' => 'asdf', + 'originaltransmissionreference' => 'asdf', + //'headline' => 'asdf', + //'credit' => 'asdf', + //'source' => 'asdf', + 'copyrightnotice' => 'asdf', + 'contact' => 'asdf', + 'caption_abstract' => 'asdf', + 'writer_editor' => 'asdf', + 'originatingprogram' => 'asdf', + 'releasedate' + ), + + //EXIF schema tags + 'exif' => array( + + //IFD0 + 'processingsoftware' => 'asdf', + 'imagewidth' => 'asdf', + 'imagelength' => 'asdf', + 'bitspersample' => 'asdf', + 'compression' => 'asdf', + 'photometricinterpretation' => 'asdf', + 'thresholding' => 'asdf', + 'cellwidth' => 'asdf', + 'celllength' => 'asdf', + 'fillorder' => 'asdf', + 'documentname' => 'asdf', + 'imagedescription' => 'asdf', + 'make' => 'asdf', + 'model' => 'asdf', + 'orientation' => 'asdf', + 'samplesperpixel' => 'asdf', + 'rowsperstrip' => 'asdf', + 'minsamplevalue' => 'asdf', + 'maxsamplevalue' => 'asdf', + 'xresolution' => 'asdf', + 'yresolution' => 'asdf', + 'planarconfiguration' => 'asdf', + 'pagename' => 'asdf', + 'xposition' => 'asdf', + 'yposition' => 'asdf', + 'grayresponseunit' => 'asdf', + 'resolutionunit' => 'asdf', + 'pagenumber' => 'asdf', + 'software' => 'asdf', + 'modifydate' => 'asdf', + 'artist' => 'asdf', + 'hostcomputer' => 'asdf', + 'predictor' => 'asdf', + 'whitepoint' => 'asdf', + 'primarychromaticities' => 'asdf', + 'halftonehints' => 'asdf', + 'tilewidth' => 'asdf', + 'tilelength' => 'asdf', + 'ycbcrcoefficients' => 'asdf', + 'ycbcrsubsampling' => 'asdf', + 'ycbcrpositioning' => 'asdf', + 'referenceblackwhite' => 'asdf', + 'relatedimagefileformat' => 'asdf', + 'relatedimagewidth' => 'asdf', + 'relatedimagelength' => 'asdf', + 'rating' => 'asdf', + 'ratingpercent' => 'asdf', + 'copyright' => 'asdf', + + //ExifIFD + 'exposuretime' => 'asdf', + 'fnumber' => 'asdf', + 'exposureprogram' => 'asdf', + 'spectralsensitivity' => 'asdf', + 'iso' => 'asdf', + 'timezoneoffset' => 'asdf', + 'selftimermode' => 'asdf', + 'exifversion' => 'asdf', + 'datetimeoriginal' => 'asdf', + 'createdate' => 'asdf', + 'componentsconfiguration' => 'asdf', + 'compressedbitsperpixel' => 'asdf', + 'shutterspeedvalue' => 'asdf', + 'aperturevalue' => 'asdf', + 'brightnessvalue' => 'asdf', + 'exposurecompensation' => 'asdf', + 'maxaperturevalue' => 'asdf', + 'subjectdistance' => 'asdf', + 'meteringmode' => 'asdf', + 'lightsource' => 'asdf', + 'flash' => 'asdf', + 'focallength' => 'asdf', + 'imagenumber' => 'asdf', + 'securityclassification' => 'asdf', + 'imagehistory' => 'asdf', + 'subjectlocation' => 'asdf', + 'exposureindex' => 'asdf', + 'sensingmethod' => 'asdf', + 'filesource' => 'asdf', + 'scenetype' => 'asdf', + 'cfapattern' => 'asdf', + 'customrendered' => 'asdf', + 'exposuremode' => 'asdf', + 'whitebalance' => 'asdf', + 'digitalzoomratio' => 'asdf', + 'focallengthin35mmformat' => 'asdf', + 'scenecapturetype' => 'asdf', + 'gaincontrol' => 'asdf', + 'contrast' => 'asdf', + 'saturation' => 'asdf', + 'sharpness' => 'asdf', + 'subjectdistancerange' => 'asdf', + 'gamma' => 'asdf' + ) + ); +} + + +$startTime = microtime(true); + +for($n2 = 0, $i = 0; $i < 10000; $i++) +{ + if (isset(TestTags::$metaTags['exif']['sharpness'])) + { + $n2++; + } +} + +$endTime = microtime(true); +echo ($endTime - $startTime).'<br />'; + + +$startTime = microtime(true); + +for($n1 = 0, $i = 0; $i < 10000; $i++) +{ + if (in_array('sharpness', TestTags::$metaTags['exif'])) + { + $n1++; + } +} + +$endTime = microtime(true); +echo ($endTime - $startTime).'<br />'; + + + + +/** +0.0324549674988 +0.242530107498 + +0.0326819419861 +0.156526088715 + +0.0325179100037 +0.155251026154 + +0.0322420597076 +0.151906013489 + */ + + +?> \ No newline at end of file Added: trunk/misc/benchmark/array_change_key_case.php =================================================================== --- trunk/misc/benchmark/array_change_key_case.php (rev 0) +++ trunk/misc/benchmark/array_change_key_case.php 2008-04-06 21:40:37 UTC (rev 4917) @@ -0,0 +1,137 @@ +<?php + +$array = array( + + //IFD0 + 'processingsoftware', + 'imagewidth', + 'imagelength', + 'bitspersample', + 'compression', + 'photometricinterpretation', + 'thresAholding', + 'cellwidth', + 'celllength', + 'fillorder', + 'documentname', + 'imagedescription', + 'make', + 'model', + 'orientation', + 'samplesperpixel', + 'rowsperstrip', + 'minsamplevalue', + 'maxsamplevalue', + 'xresoDlution', + 'yresolution', + 'planarconfiguration', + 'pagename', + 'xposition', + 'yposition', + 'grayresponseunit', + 'resolutionunit', + 'pagenumber', + 'software', + 'modifFydate', + 'artist', + 'hostcomputer', + 'preEdictor', + 'whitepoint', + 'primarychromaticities', + 'halfFtonehints', + 'tilewidth', + 'tilelength', + 'ycbcrcoefficients', + 'ycbcrsEubsampling', + 'ycbcrpositioning', + 'referenceblackwhite', + 'relateDdimagefileformat', + 'relatedimagewidth', + 'relateCdimagelength', + 'rating', + 'ratingpercent', + 'copyright', + + //ExifIFD + 'exposuretime', + 'fnumber', + 'exposureprogram', + 'spectralsensitivity', + 'iso', + 'timezoneoffset', + 'selftimermode', + 'exifversion', + 'datetimeoriginal', + 'createdate', + 'componentsconfiguration', + 'compressedbitsperpixel', + 'shutterspeedvalue', + 'aperturevalue', + 'brightnessvalue', + 'exposurecompensation', + 'maxaperturevalue', + 'subjectdistance', + 'meteringmode', + 'lightsource', + 'flash', + 'focallength', + 'imagenumber', + 'securityclassification', + 'imagehistory', + 'subjectlocation', + 'exposureindex', + 'sensingmethod', + 'filesource', + 'scenetype', + 'cfapattern', + 'customrendered', + 'exposuremode', + 'whitebalance', + 'digitalzoomratio', + 'focallengthin35mmformat', + 'scenecapturetype', + 'gaincontrol', + 'contrast', + 'saturation', + 'sharpness', + 'subjectdistancerange', + 'gamma' + ); + +$startTime = microtime(true); +for ($i = 0; $i < 1000; $i++) +{ + $lowerDataArray = array_change_key_case($array, CASE_LOWER); + foreach ($lowerDataArray as $key => $value) + { + $str2 = $key; + } +} +$endTime = microtime(true); +echo ($endTime - $startTime).'<br />'; + + +$startTime = microtime(true); +for ($i = 0; $i < 1000; $i++) +{ + foreach ($lowerDataArray as $key => $value) + { + $key = strtolower($key); + $str2 = $key; + } +} +$endTime = microtime(true); +echo ($endTime - $startTime).'<br />'; + +/** +0.0651071071625 +0.119043111801 + +0.0651071071625 +0.119043111801 + +0.0670680999756 +0.122123003006 + */ + +?> \ No newline at end of file Deleted: trunk/misc/benchmark/perf.php =================================================================== --- trunk/misc/benchmark/perf.php 2008-04-06 21:38:41 UTC (rev 4916) +++ trunk/misc/benchmark/perf.php 2008-04-06 21:40:37 UTC (rev 4917) @@ -1,25 +0,0 @@ -<?php -define('LINPHA_DIR','../../linpha2'); - -if (!file_exists(LINPHA_DIR.'/logsql.txt')) -{ - die("To enable sql logging create the file linpha/logsql.txt"); -} - -include_once(LINPHA_DIR.'/lib/include/common.php'); - -/** - * some init stuff - */ - require_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); - global $linpha; - $linpha = new Linpha(); - $linpha->sql->startSession(); - -/** - * do perf - */ - $perf = &NewPerfMonitor($GLOBALS['linpha']->db); - define('ADODB_PERF_NO_RUN_SQL',1); - $perf->UI($pollsecs=5); -?> \ No newline at end of file Added: trunk/misc/benchmark/stringConcatvsArrayJoin.php =================================================================== --- trunk/misc/benchmark/stringConcatvsArrayJoin.php (rev 0) +++ trunk/misc/benchmark/stringConcatvsArrayJoin.php 2008-04-06 21:40:37 UTC (rev 4917) @@ -0,0 +1,52 @@ +<?php +$startTime = microtime(true); +$str1 = ''; +for($i = 0; $i < 100000; $i++) +{ + $str1 .= 'test'; +} +$str2 = $str1; +$endTime = microtime(true); +echo ($endTime - $startTime).'<br />'; + + +$startTime = microtime(true); +$array = array(); +for($i = 0; $i < 100000; $i++) +{ + $array[] = 'test'; +} +$str2 = implode('', $array); + +$endTime = microtime(true); +echo ($endTime - $startTime).'<br />'; + + +$startTime = microtime(true); +$array = array(); +for($i = 0; $i < 100000; $i++) +{ + $array[] = 'test'; +} +$str2 = implode(', ', $array); + +$endTime = microtime(true); +echo ($endTime - $startTime).'<br />'; + +/** +0.0420918464661 +0.0726561546326 +0.0897808074951 + +0.0410449504852 +0.0717570781708 +0.0952560901642 + +0.0391261577606 +0.075886964798 +0.0970549583435 + +interesting... +in javascript, its exactly the opposite + */ +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-04-06 21:38:46
|
Revision: 4916 http://linpha.svn.sourceforge.net/linpha/?rev=4916&view=rev Author: fangehrn Date: 2008-04-06 14:38:41 -0700 (Sun, 06 Apr 2008) Log Message: ----------- 2008-04-06 flo * metadata cleanups and improvements Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance_import.php trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/lib/classes/linpha.exiftool.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.pjmt.class.php trunk/linpha2/lib/classes/linpha.view.album.class.php trunk/linpha2/lib/classes/linpha.view.image.class.php trunk/linpha2/lib/include/sql/sql.data.php trunk/linpha2/lib/include/sql/sql.tables.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-04-02 20:54:22 UTC (rev 4915) +++ trunk/linpha2/ChangeLog 2008-04-06 21:38:41 UTC (rev 4916) @@ -1,4 +1,7 @@ +2008-04-06 flo + * metadata cleanups and improvements + 2008-04-02 flo * adapted static album/image view to fit new layout Modified: trunk/linpha2/admin/maintenance_import.php =================================================================== --- trunk/linpha2/admin/maintenance_import.php 2008-04-02 20:54:22 UTC (rev 4915) +++ trunk/linpha2/admin/maintenance_import.php 2008-04-06 21:38:41 UTC (rev 4916) @@ -31,13 +31,13 @@ ini_set("max_execution_time", "6000"); -$array_meta = Array('exif','iptc','xmp'); +$array_meta = array('exif','iptc','xmp'); -if( isset($_POST['cmd']) && $_POST['cmd']=='import') +if ( isset($_POST['cmd']) && $_POST['cmd']=='import') { echo '<h1 class="linStyle">'.i18n("Running Import...").'</h1>'; - if(!isset($_REQUEST['album_select']) OR $_REQUEST['album_select'][0]=='all') + if (!isset($_REQUEST['album_select']) OR $_REQUEST['album_select'][0]=='all') { $all_albums = true; } @@ -50,17 +50,17 @@ /** * import */ - if($_REQUEST['index_import']=='index') + if ($_REQUEST['index_import']=='index') { echo '<h2 class="linStyle">'.i18n("Directory Import").'</h2>'; - if($all_albums) + if ($all_albums) { echo i18n("Parsing All Directories...").'<br />'; LinImport::updateDir( $parent_id = 0, $recursive = true, $dryrun = false ); } else { - foreach($_REQUEST['album_select'] AS $key=>$value) + foreach ($_REQUEST['album_select'] AS $key=>$value) { $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".LIN_PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); echo i18n("Parsing Directory:").' '.$data['name'].'<br />'; @@ -68,7 +68,7 @@ } } - if( isset($GLOBALS['linpha']->template->output['sys_log']) ) + if ( isset($GLOBALS['linpha']->template->output['sys_log']) ) { echo $GLOBALS['linpha']->template->output['sys_log']; unset($GLOBALS['linpha']->template->output['sys_log']); @@ -86,13 +86,13 @@ * we would have to take care to the script backwards, * that means first of the depest subfolder until we're on top */ - if($_REQUEST['index_thumbnails']!='no' OR isset($_REQUEST['index_thumbnails_delete'])) + if ($_REQUEST['index_thumbnails']!='no' OR isset($_REQUEST['index_thumbnails_delete'])) { echo '<h2 class="linStyle">'.i18n("Thumbnails").'</h2>'; $thumbnail = new LinImage(); - if($_REQUEST['index_thumbnails']=='recreate') + if ($_REQUEST['index_thumbnails']=='recreate') { $_GET['force'] = true; } @@ -100,17 +100,17 @@ /** * all albums selected */ - if($all_albums) + if ($all_albums) { /** * delete thumbnails */ - if( isset($_REQUEST['index_thumbnails_delete']) ) + if ( isset($_REQUEST['index_thumbnails_delete']) ) { echo i18n("Delete All Existing Thumbnails...").'<br />'; $thumbcachepath = LinSql::getPath('cache').'/thumb'; LinFilesys::rm_rf( $thumbcachepath ); // all subfolders will automatically be recreated on each image access - if(file_exists($thumbcachepath)) + if (file_exists($thumbcachepath)) { echo i18n("Warning while deleting file/folder, check permissions!").'<br />'; } @@ -123,7 +123,7 @@ /** * set query string for create/recreate thumbnails */ - if($_REQUEST['index_thumbnails']!='no') + if ($_REQUEST['index_thumbnails']!='no') { echo '<h3>'.i18n("Parsing All Directories...").'</h3><br />'; $createthumbquery = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos WHERE img_type <> '0' AND img_type <> '9999999'"); @@ -146,13 +146,13 @@ /** * delete thumbnails */ - if( isset($_REQUEST['index_thumbnails_delete']) ) + if ( isset($_REQUEST['index_thumbnails_delete']) ) { echo i18n("Delete Thumbnails"); $query = $GLOBALS['linpha']->db->Execute($sql); while($data = $query->FetchRow()) { - if( LinImage::deleteCachedThumbnail($data['id'], $data['img_type'])) + if ( LinImage::deleteCachedThumbnail($data['id'], $data['img_type'])) { echo " ".$data['id'].","; } @@ -163,7 +163,7 @@ /** * set query string for create/recreate thumbnails */ - if($_REQUEST['index_thumbnails']!='no') + if ($_REQUEST['index_thumbnails']!='no') { $createthumbquery = $GLOBALS['linpha']->db->Execute($sql); } @@ -173,16 +173,16 @@ /** * now create thumbnails, $query has been set previously */ - if($_REQUEST['index_thumbnails']!='no') + if ($_REQUEST['index_thumbnails']!='no') { echo i18n("Create Thumbnail"); while($data = $createthumbquery->FetchRow()) { - if( ! $thumbnail->createThumbnail($data['id']) ) + if ( ! $thumbnail->createThumbnail($data['id']) ) { echo i18n("Error While Creating Thumbnail!")."<br />Error: ".$thumbnail->error_msg."<br />"; } - if( ! $thumbnail->isCached ) // thumbnail wasn't cached -> now created! + if ( ! $thumbnail->isCached ) // thumbnail wasn't cached -> now created! { echo " ".$data['id'].","; } @@ -202,9 +202,9 @@ */ $MetaData = new LinMetaData(); - foreach($array_meta AS $meta_value) + foreach($array_meta as $meta_value) { - if( isset( $_REQUEST['index_'.$meta_value] ) && + if ( isset($_REQUEST['index_'.$meta_value]) && ( $_REQUEST['index_'.$meta_value] == 'index' OR isset($_REQUEST['index_'.$meta_value.'_delete']) ) ) { echo '<h2 class="linStyle">'.i18n("File Indexing").' ('.strtoupper($meta_value).')</h2>'; @@ -212,12 +212,12 @@ /** * get imgids to indexing, if reindex is selected: delete these entries first */ - if($all_albums) + if ($all_albums) { echo i18n("All Directories selected").'<br />'; $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); - while($data = $query->FetchRow()) + while ($data = $query->FetchRow()) { $array_meta_ids[$data['id']] = $data['md5sum']; } @@ -225,7 +225,7 @@ else { echo i18n("Directory selected:").' '; - foreach($_REQUEST['album_select'] AS $key=>$value) + foreach ($_REQUEST['album_select'] AS $key=>$value) { $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".LIN_PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); echo $data['name'].', '; @@ -233,7 +233,7 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos WHERE " . "parent_id = '".LinSql::linAddslashes($value)."' AND " . "img_type <> 0 AND img_type <> 9999999"); - while($data = $query->FetchRow()) + while ($data = $query->FetchRow()) { $array_meta_ids[$data['id']] = $data['md5sum']; } @@ -244,17 +244,17 @@ /** * delete first (if selected) */ - if( isset($_REQUEST['index_'.$meta_value.'_delete']) ) + if ( isset($_REQUEST['index_'.$meta_value.'_delete']) ) { - if( $all_albums ) + if ( $all_albums ) { echo i18n("Delete all index data").'<br />'; $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."meta_".$meta_value); } - elseif( isset($array_meta_ids) ) + elseif (isset($array_meta_ids)) { echo i18n("Delete index data of selected directories").'<br />'; - foreach($array_meta_ids AS $id=>$md5sum) + foreach ($array_meta_ids AS $id=>$md5sum) { $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."meta_".$meta_value." WHERE md5sum = '".$md5sum."'"); } @@ -264,31 +264,17 @@ /** * index image, parse all saved ids */ - if( isset($array_meta_ids) && $_REQUEST['index_'.$meta_value] == 'index' ) + if ( isset($array_meta_ids) && $_REQUEST['index_'.$meta_value] == 'index' ) { echo i18n("Index Image"); - foreach($array_meta_ids AS $id=>$md5sum) + foreach ($array_meta_ids as $id=>$md5sum) { - $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum ". - "FROM ".LIN_PREFIX."meta_exif WHERE md5sum = '".$md5sum."'"); - - if( $query->EOF) // not a single value returned + if (LinMetaData::fileNeedsIndexing($md5sum, LIN_PREFIX."meta_".$meta_value)) { $full_filename = LinSql::getFullImagePath($id); - - switch($meta_value) - { - case 'exif': - $MetaData->saveData('exif',$full_filename,$md5sum); - break; - case 'iptc': - $MetaData->saveData('iptc',$full_filename,$md5sum); - break; - case 'xmp': - $MetaData->saveData('xmp',$full_filename,$md5sum); - break; - } + + $MetaData->saveMetaDataToDatabase($meta_value, $full_filename, $md5sum); echo " ".$id.","; flush(); @@ -333,7 +319,7 @@ <?php foreach($array_meta AS $value) { - if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) + if ($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) { echo strtoupper($value).":<br />"; echo '<input type="checkbox" id="index_'.$value.'_deletefirst" name="index_'.$value.'_delete" value="delete" /><label for="index_'.$value.'_deletefirst"> '.i18n("Delete First").'</label><br />'; @@ -359,7 +345,7 @@ /** * import */ - if($linpha->sql->config->value['sys_import_autoimport']) + if ($linpha->sql->config->value['sys_import_autoimport']) { LinImport::updateDir( $parent_id = 0, $recursive = true, $dryrun = true ); } @@ -368,7 +354,7 @@ * flush buffer */ echo '<b>'.i18n("Following files/folders needs updating:").'</b><br />'; - if( isset($GLOBALS['linpha']->template->output['sys_log']) ) + if ( isset($GLOBALS['linpha']->template->output['sys_log']) ) { echo $GLOBALS['linpha']->template->output['sys_log']; unset($GLOBALS['linpha']->template->output['sys_log']); @@ -395,7 +381,7 @@ $thumbnail->setFileInformation(); - if( ! $thumbnail->isCached ) + if ( ! $thumbnail->isCached ) { $num++; } @@ -414,7 +400,7 @@ foreach($array_meta AS $value) { - if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) + if ($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) { $nr_indexed = $GLOBALS['linpha']->db->GetRow("SELECT count(md5sum) " . "AS number_idx " . Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2008-04-02 20:54:22 UTC (rev 4915) +++ trunk/linpha2/docs/dev/TODO.txt 2008-04-06 21:38:41 UTC (rev 4916) @@ -27,10 +27,11 @@ - compress javascripts (prototype and scriptaculous) they are now nearly 200KB big +- re-add getId3 as fallback if exiftool is not available + (video thumbnail and video playback) + ## Big Todos -- Use Effekts is sometimes hardcoded, make use of config - setting sys_style_image_useeffects in all places where used - Installer - OSX testing @@ -58,6 +59,7 @@ Open questions ############################################################################ + - thumbnail size, set a max size (for example 150px), to be able to switch the size on fly @@ -82,6 +84,9 @@ DONE ############################################################################ +- Use Effekts is sometimes hardcoded, make use of config + setting sys_style_image_useeffects in all places where used + - Switch to strict mode - we should changed html type to strict mode: old: Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-04-02 20:54:22 UTC (rev 4915) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-04-06 21:38:41 UTC (rev 4916) @@ -143,11 +143,31 @@ */ public function readMetaDataFromFile($metatype, $filename) { - $meta =""; - $return=""; + $meta = ""; + $return = ""; $metaArray = array(); + + /** + * used inputs: iptc, xmp, exif, exifgps + * use the switch statement to be sure that no invalid input is used + */ + switch($metatype) + { + case 'iptc': + $metatypeInput = 'iptc'; + break; + case 'xmp': + $metatypeInput = 'xmp'; + break; + case 'exifgps': + $metatypeInput = 'gps'; + break; + default: + $metatypeInput = 'exif'; + break; + } - $parameters = "-$metatype:all " . // Get all Tag Information + $parameters = "-$metatypeInput:all " . // Get all Tag Information "-s " . // Print tag names instead of descr. "-t " . // Use tab \t as delimiter "-fast " . // Do not read to EOF @@ -167,61 +187,47 @@ * Create usable array information by cycling and splitting * all information */ - foreach($meta as $value) + foreach($meta as $row) { - $temp = explode("\t", $value); - $metaArray[trim($temp['0'])] = @trim($temp['1']); - } - - return $metaArray; - } - - /** - * Save all MetaData to database - * @param string $filename filename to parse for MetaData - * @param string $md5sum md5sum of file - * @param string $tag save EXIF, IPTC or XMP MetaData - */ - public function saveMetaData($filename, $md5sum, $tag) - { - - $dataArray = LinExifTool::readMetaDataFromFile($tag, $filename); - - //echo '<pre>', print_r($dataArray), '</pre>'; - - - $str_columns = "md5sum, "; - $str_values = "'" . $md5sum . "', "; - - if(is_array($dataArray)) - { + $temp = explode("\t", $row); + + $key = trim($temp['0']); + $value = $temp['1']; + /** - * Lower array data to make it compareable to LinExifTool::$metaTags + * normalize tag names + * http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html */ - $lowerDataArray = array_change_key_case($dataArray, 'LOWER_CASE'); - - /** - * Search for valid and filled tags - */ - foreach($this->defined_fields[$tag] AS $key => $value) + switch($key) { - if(array_key_exists($key, $lowerDataArray)) - { - $str_columns .= str_replace("_", "-", $key) . ', '; - $str_values .= "'".trim($lowerDataArray[$key])."', "; - //$str_values .= "'".HTML_UTF8_Escape(trim($lowerDataArray[$key]))."', "; - } + case "Comment": + $key = "JPEGComment"; + break; + case "ModifyDate": + $key = "DateTime"; + break; + case "CreateDate": + $key = "DateTimeDigitized"; + break; + case "ISO": + $key = "ISOSpeedRatings"; + break; + case "ExifImageWidth": + $key = "PixelXDimension"; + break; + case "ExifImageHeight": + $key = "PixelYDimension"; + break; + case "FocalLengthIn35mmFormat": + $key = "FocalLengthIn35mmFilm"; + break; } + + + $metaArray[$key] = $value; + } - /** - * Remove last two signs (the comma and the space) which we add to much - */ - $str_columns = substr($str_columns, 0, strlen($str_columns) - 2); - $str_values = substr($str_values, 0, strlen($str_values) - 2); - - $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_$tag " . - "(" . $str_columns . ") VALUES (" . $str_values . ")"); - } + return $metaArray; } /** @@ -291,7 +297,7 @@ * @return array fileds already selected to be used (defined_fields) * and also available fields from $metaTags (available_fields) * @author bzrudi,flo - */ + public function setMetaFields($metatype) { @@ -300,7 +306,7 @@ * without the md5sum entry. * MetaColumns() returns the keys always uppercase independent * of ADODB_ASSOC_CASE setting, so strtolower() them. - */ + $array = $GLOBALS['linpha']->db->MetaColumns(LIN_PREFIX."meta_".$metatype); $this->defined_fields[$metatype] = array (); @@ -317,7 +323,7 @@ /** * Create available_fields, mostly used in admin section where one will * setup the MetaData fields to index. - */ + foreach (LinExifTool::$metaTags[$metatype] AS $key => $value) { if (!isset ($this->defined_fields[$metatype][$key])) @@ -325,7 +331,7 @@ $this->available_fields[$metatype][$key] = $value; } } - } + }*/ /** * Just get DateTimeOriginal from EXIF header @@ -359,186 +365,185 @@ * @param none * @return none * @author bzrudi - */ + public static $metaTags = array( 'xmp' => array( - //Iptc4xmpCore schema tags - 'countrycode' => 'Country Code', - 'intellectualgenre' => 'Intellectual Genre', - 'location' => 'Location', - 'scene' => 'Scene', - 'subjectcode' => 'Subject Code', - - //Dublin Core schema tags - 'contributor' => 'Contributor', - 'coverage' => 'Coverage', - 'creator' => 'Creator', - 'date' => 'Date', - 'description' => 'Description', - 'format' => 'Format', - 'identifier' => 'Identifier', - 'publisher' => 'Publisher', - 'rights' => 'Rights', - 'subject' => 'Subject', - 'title' => 'Title', - - //Adobe Photoshop schema tags - 'authorsposition' => 'Authors Position', - 'captionwriter' => 'Caption Writer', - 'category' => 'Category', - 'city' => 'City', - 'colormode' => 'Color Mode', - 'country' => 'Country', - 'credit' => 'Credit', - //'datecreated' => 'DateCreated', - 'headline' => 'Headline', - 'iccprofilename' => 'ICC Profile Name', - 'instructions' => 'Instructions', - 'source' => 'Source', - 'state' => 'State', - 'supplementalcategories' => 'Supplemental Categories', - 'transmissionreference' => 'Transmission Reference', - 'urgency' => 'Urgency' - + //Iptc4xmpCore schema tags + 'countrycode' => '', + 'intellectualgenre' => '', + 'location' => '', + 'scene' => '', + 'subjectcode' => '', + + //Dublin Core schema tags + 'contributor' => '', + 'coverage' => '', + 'creator' => '', + 'date' => '', + 'description' => '', + 'format' => '', + 'identifier' => '', + 'publisher' => '', + 'rights' => '', + 'subject' => '', + 'title' => '', + + //Adobe Photoshop schema tags + 'authorsposition' => '', + 'captionwriter' => '', + 'category' => '', + 'city' => '', + 'colormode' => '', + 'country' => '', + 'credit' => '', + //'datecreated' => '', + 'headline' => '', + 'iccprofilename' => '', + 'instructions' => '', + 'source' => '', + 'state' => '', + 'supplementalcategories' => '', + 'transmissionreference' => '', + 'urgency' => '' ), //IPTC schema tags 'iptc' => array( - //IPTC ApplicationRecord Tags - 'applicationrecordversion' => 'Application Record Version', - 'objecttypereference' => 'Object Type Reference', - 'objectattributereference' => 'Object Attribute Reference', - 'objectname' => 'Object Name', - 'objectcycle' => 'Object Cycle', - 'editstatus' => 'Edit Status', - 'subjectreference' => 'Subject Reference', - //'category' => 'Category', - 'supplementalcategories' => 'Supplemental Categories', - 'keywords' => 'Keywords', - 'specialinstructions' => 'Special Instructions', - 'datecreated' => 'Date Created', - 'timecreated' => 'Time Created', - 'by_line' => 'By-line', - 'by_linetitle' => 'By-line Title', - //'city' => 'City', - 'sub_location' => 'Sub-location', - 'province_state' => 'Province-State', - 'country_primarylocationcode' => 'Country-Primary Location Code', - 'country_primarylocationname' => 'Country-Primary Location Name', - 'originaltransmissionreference' => 'Original Transmission Reference', - //'headline' => 'Headline', - //'credit' => 'Credit', - //'source' => 'Source', - 'copyrightnotice' => 'Copyright Notice', - 'contact' => 'Contact', - 'caption_abstract' => 'Caption-Abstract', - 'writer_editor' => 'Writer-Editor', - 'originatingprogram' => 'Originating Program', - 'releasedate' => 'Release Date' + //IPTC ApplicationRecord Tags + 'applicationrecordversion' => '', + 'objecttypereference' => '', + 'objectattributereference' => '', + 'objectname' => '', + 'objectcycle' => '', + 'editstatus' => '', + 'subjectreference' => '', + //'category' => '', + 'supplementalcategories' => '', + 'keywords' => '', + 'specialinstructions' => '', + 'datecreated' => '', + 'timecreated' => '', + 'by_line' => '', + 'by_linetitle' => '', + //'city' => '', + 'sub_location' => '', + 'province_state' => '', + 'country_primarylocationcode' => '', + 'country_primarylocationname' => '', + 'originaltransmissionreference' => '', + //'headline' => '', + //'credit' => '', + //'source' => '', + 'copyrightnotice' => '', + 'contact' => '', + 'caption_abstract' => '', + 'writer_editor' => '', + 'originatingprogram' => '', + 'releasedate' => '' ), //EXIF schema tags 'exif' => array( - //IFD0 - 'processingsoftware' => 'Processing Software', - 'imagewidth' => 'Image Width', - 'imagelength' => 'Image Length', - 'bitspersample' => 'Bits Per Sample', - 'compression' => 'Compression', - 'photometricinterpretation' => 'Photometric Interpretation', - 'thresholding' => 'Thresholding', - 'cellwidth' => 'Cell Width', - 'celllength' => 'Cell Length', - 'fillorder' => 'Fill Order', - 'documentname' => 'Document Name', - 'imagedescription' => 'Image Description', - 'make' => 'Maker', - 'model' => 'Model', - 'orientation' => 'Orientation', - 'samplesperpixel' => 'Samples Per Pixel', - 'rowsperstrip' => 'Rows Per Strip', - 'minsamplevalue' => 'Min Sample Value', - 'maxsamplevalue' => 'Max Sample Value', - 'xresolution' => 'X Resolution', - 'yresolution' => 'Y Resolution', - 'planarconfiguration' => 'Planar Configuration', - 'pagename' => 'Page Name', - 'xposition' => 'X Position', - 'yposition' => 'Y Position', - 'grayresponseunit' => 'Gray Response Unit', - 'resolutionunit' => 'Resolution Unit', - 'pagenumber' => 'Page Number', - 'software' => 'Software', - 'modifydate' => 'Modify Date', - 'artist' => 'Artist', - 'hostcomputer' => 'Host Computer', - 'predictor' => 'Predictor', - 'whitepoint' => 'White Point', - 'primarychromaticities' => 'Primary Chromaticities', - 'halftonehints' => 'Halftone Hints', - 'tilewidth' => 'Tile Width', - 'tilelength' => 'Tile Length', - 'ycbcrcoefficients' => 'YCbCr Coefficients', - 'ycbcrsubsampling' => 'YCbCr Sub Sampling', - 'ycbcrpositioning' => 'YCbCr Positioning', - 'referenceblackwhite' => 'Reference Black White', - 'relatedimagefileformat' => 'Related Image File Format', - 'relatedimagewidth' => 'Related Image Width', - 'relatedimagelength' => 'Related Image Length', - 'rating' => 'Rating', - 'ratingpercent' => 'Rating Percent', - 'copyright' => 'Copyright', - - //ExifIFD - 'exposuretime' => 'Exposure Time', - 'fnumber' => 'F Number', - 'exposureprogram' => 'Exposure Program', - 'spectralsensitivity' => 'Spectral Sensitivity', - 'iso' => 'ISO', - 'timezoneoffset' => 'Time Zone Offset', - 'selftimermode' => 'Self Timer Mode', - 'exifversion' => 'Exif Version', - 'datetimeoriginal' => 'Date Time Original', - 'createdate' => 'Create Date', - 'componentsconfiguration' => 'Components Configuration', - 'compressedbitsperpixel' => 'Compressed Bits Per Pixel', - 'shutterspeedvalue' => 'Shutter Speed Value', - 'aperturevalue' => 'Aperture Value', - 'brightnessvalue' => 'Brightness Value', - 'exposurecompensation' => 'Exposure Compensation', - 'maxaperturevalue' => 'Max Aperture Value', - 'subjectdistance' => 'Subject Distance', - 'meteringmode' => 'Metering Mode', - 'lightsource' => 'Light Source', - 'flash' => 'Flash', - 'focallength' => 'Focal Length', - 'imagenumber' => 'Image Number', - 'securityclassification' => 'Security Classification', - 'imagehistory' => 'Image History', - 'subjectlocation' => 'Subject Location', - 'exposureindex' => 'Exposure Index', - 'sensingmethod' => 'Sensing Method', - 'filesource' => 'File Source', - 'scenetype' => 'Scene Type', - 'cfapattern' => 'CFA Pattern', - 'customrendered' => 'Custom Rendered', - 'exposuremode' => 'Exposure Mode', - 'whitebalance' => 'White Balance', - 'digitalzoomratio' => 'Digital Zoom Ratio', - 'focallengthin35mmformat' => 'Focal Length In 35mm Format', - 'scenecapturetype' => 'Scene Capture Type', - 'gaincontrol' => 'Gain Control', - 'contrast' => 'Contrast', - 'saturation' => 'Saturation', - 'sharpness' => 'Sharpness', - 'subjectdistancerange' => 'Subject Distance Range', - 'gamma' => 'Gamma' + //IFD0 + 'processingsoftware' => '', + 'imagewidth' => '', + 'imagelength' => '', + 'bitspersample' => '', + 'compression' => '', + 'photometricinterpretation' => '', + 'thresholding' => '', + 'cellwidth' => '', + 'celllength' => '', + 'fillorder' => '', + 'documentname' => '', + 'imagedescription' => '', + 'make' => '', + 'model' => '', + 'orientation' => '', + 'samplesperpixel' => '', + 'rowsperstrip' => '', + 'minsamplevalue' => '', + 'maxsamplevalue' => '', + 'xresolution' => '', + 'yresolution' => '', + 'planarconfiguration' => '', + 'pagename' => '', + 'xposition' => '', + 'yposition' => '', + 'grayresponseunit' => '', + 'resolutionunit' => '', + 'pagenumber' => '', + 'software' => '', + 'modifydate' => '', + 'artist' => '', + 'hostcomputer' => '', + 'predictor' => '', + 'whitepoint' => '', + 'primarychromaticities' => '', + 'halftonehints' => '', + 'tilewidth' => '', + 'tilelength' => '', + 'ycbcrcoefficients' => '', + 'ycbcrsubsampling' => '', + 'ycbcrpositioning' => '', + 'referenceblackwhite' => '', + 'relatedimagefileformat' => '', + 'relatedimagewidth' => '', + 'relatedimagelength' => '', + 'rating' => '', + 'ratingpercent' => '', + 'copyright' => '', + + //ExifIFD + 'exposuretime' => '', + 'fnumber' => '', + 'exposureprogram' => '', + 'spectralsensitivity' => '', + 'iso' => '', + 'timezoneoffset' => '', + 'selftimermode' => '', + 'exifversion' => '', + 'datetimeoriginal' => '', + 'createdate' => '', + 'componentsconfiguration' => '', + 'compressedbitsperpixel' => '', + 'shutterspeedvalue' => '', + 'aperturevalue' => '', + 'brightnessvalue' => '', + 'exposurecompensation' => '', + 'maxaperturevalue' => '', + 'subjectdistance' => '', + 'meteringmode' => '', + 'lightsource' => '', + 'flash' => '', + 'focallength' => '', + 'imagenumber' => '', + 'securityclassification' => '', + 'imagehistory' => '', + 'subjectlocation' => '', + 'exposureindex' => '', + 'sensingmethod' => '', + 'filesource' => '', + 'scenetype' => '', + 'cfapattern' => '', + 'customrendered' => '', + 'exposuremode' => '', + 'whitebalance' => '', + 'digitalzoomratio' => '', + 'focallengthin35mmformat' => '', + 'scenecapturetype' => '', + 'gaincontrol' => '', + 'contrast' => '', + 'saturation' => '', + 'sharpness' => '', + 'subjectdistancerange' => '', + 'gamma' => '' ) - ); + );*/ } /* vi: set ts=4 sw=4 sts=4 */ -?> +?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-04-02 20:54:22 UTC (rev 4915) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-04-06 21:38:41 UTC (rev 4916) @@ -30,7 +30,8 @@ class LinMetaData { - public $defined_fields, $available_fields, $objMetaTool; + //public $defined_fields, $available_fields, + public $objMetaTool; private $cachedFieldNames, $cachedFieldIds, $cachedSelectedFieldNames; @@ -41,12 +42,12 @@ { if($GLOBALS['linpha']->sql->config->value['sys_import_use_exiftool']) { - include_once LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'; + require_once LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'; $this->objMetaTool = new LinExifTool(); } else { - include_once LINPHA_DIR.'/lib/classes/linpha.pjmt.class.php'; + require_once LINPHA_DIR.'/lib/classes/linpha.pjmt.class.php'; $this->objMetaTool = new LinPjmtTool(); } } @@ -706,7 +707,7 @@ /** * This method is used to setup the initial most useful defaults for the * MetaData tables EXIF/IPTC/XMP during creation and provides default - * Geodata (GPS) Tgas for the maps plugin + * Geodata (GPS) Tags for the maps plugin * @param string exif,iptc,xmp,gps * @return array with metadata information * @author bzrudi,flo @@ -766,43 +767,6 @@ ); break; - case 'gps': - return array ( - 'gpsversionid', - 'gpslatituderef', - 'gpslatitude', - 'gpslongituderef', - 'gpslongitude', - 'gpsaltituderef', - 'gpsaltitude', - 'gpstimestamp', - 'gpssatellites', - 'gpsstatus', - 'gpsmeasuremode', - 'gpsdop', - 'gpsspeedref', - 'gpsspeed', - 'gpstrackref', - 'gpstrack', - 'gpsimgdirectionref', - 'gpsimgdirection', - 'gpsmapdatum', - 'gpsdestlatituderef', - 'gpsdestlatitude', - 'gpsdestlongituderef', - 'gpsdestlongitude', - 'gpsdestbearingref', - 'gpsdestbearing', - 'gpsdestdistanceref', - 'gpsdestdistance', - 'gpsprocessingmethod', - 'gpsareainformation', - 'gpsdatestamp', - 'gpsdatetime', - 'gpsposition', - ); - break; - default: return array(); break; @@ -814,13 +778,13 @@ * @param string $metatype exif,iptc,xmp * @return none * @author bzrudi - */ + public function setMetaFields($metatype) { $this->objMetaTool->setMetaFields($metatype); $this->defined_fields = $this->objMetaTool->defined_fields; $this->available_fields = $this->objMetaTool->available_fields; - } + }*/ /** * This method is used to create any required MEtaData table @@ -828,9 +792,8 @@ * @param string $metatype exif,iptc,xmp * @return none * @author bzrudi,flo - * TODO cleanup + set required indexes! */ - public function createMetaDataTable($array, $metatype) + /*public function createMetaDataTable($array, $metatype) { if (!is_array($array)) { @@ -858,9 +821,8 @@ $value = str_replace("-", "_", strtolower($value)); $str .= strtolower($value) . " VARCHAR(255), "; } - /** - * remove last 2 signs (the comma and the space) - */ + + // remove last 2 signs (the comma and the space) $str = substr($str, 0, strlen($str) - 2) . ")"; } elseif (LIN_DB_TYPE == "postgres") @@ -874,13 +836,11 @@ $str .= "$value" . " TEXT, "; } - /** - * remove last 2 signs (the comma and the space) - */ + // remove last 2 signs (the comma and the space) $str = substr($str, 0, strlen($str) - 2) . ")"; } return $str; - } + }*/ /** * Save all Image GeoData (GPS) to database. @@ -895,6 +855,7 @@ */ public function massImportGeoData() { + $arrayGPSTags = $this->getDefaultMetaTags('gps'); $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos @@ -905,152 +866,96 @@ while($data = $query->FetchRow()) { $filename = LinSql::getFullImagePath($data['id']); - $dataArray = $this->objMetaTool->readMetaDataFromFile('exif', $filename); - - //echo '<pre>', print_r($dataArray), '</pre>'; - - $str_columns = "md5sum, "; - $str_values = "'".$data['id']."', "; - - if(is_array($dataArray)) + + if ($this->saveMetaDataToDatabase('exifgps', $filename, $data['md5sum'] )) { - /** - * Lower array data to make it compareable to $metaTags - */ - $lowerDataArray = array_change_key_case($dataArray, 'LOWER_CASE'); - - //echo '<pre>', print_r($lowerDataArray), '</pre>'; - - foreach($this->getDefaultMetaTags('gps') AS $key => $value) - { - if(array_key_exists($value, $lowerDataArray)) - { - - $str_columns .= str_replace("_", "-", $value) . ', '; - $str_values .= "'".trim($lowerDataArray[$value])."', "; - } - } - /** - * Remove last two signs (the comma and the space) which we add to much - */ - $str_columns = substr($str_columns, 0, strlen($str_columns) - 2); - $str_values = substr($str_values, 0, strlen($str_values) - 2); - - $GLOBALS['linpha']->db->Execute("INSERT INTO ".LIN_PREFIX."plugins_maps_image_geodata " . - "(" . $str_columns . ") VALUES (" . $str_values . ")"); - $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . - "SET geodata='1' WHERE md5sum='".$data['md5sum']."' "); + "SET geodata='1' WHERE md5sum='".$data['md5sum']."' "); } } } /** - * Save single Image GeoData (GPS) to database during import. - * Used in maps plugin if enabled. Other than massImportGeoData() we just - * get all "geodata" for a single image only. - * @param none - * @return none - * @author bzrudi + * Parse GPX data from file */ - public function singleImportGeoData($md5sum, $filename) + public function parseGpxFile($filename) { - /* - * Prevent double entries and prevent warnings + $parser = new GpxParser($filename); + } + + static public function fileNeedsIndexing($md5sum, $db_table) + { + /** + * Prevent double entries. We do this check at very first position + * to improve performance! */ $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum " . - "FROM ".LIN_PREFIX."plugins_maps_image_geodata " . - "WHERE md5sum = '".$md5sum."' "); + "FROM " . $db_table . " " . + "WHERE md5sum = '" . $md5sum . "'"); - if($query->EOF) - { - $dataArray = $this->objMetaTool->readMetaDataFromFile('exif', $filename); - - $str_columns = "md5sum, "; - $str_values = "'".$md5sum."', "; - - if(is_array($dataArray)) - { - /** - * Lower array data to make it compareable to $metaTags - */ - - $lowerDataArray = array_change_key_case($dataArray, 'LOWER_CASE'); - - foreach($this->getDefaultMetaTags('gps') AS $key => $value) - { - if(array_key_exists($value, $lowerDataArray)) - { - $str_columns .= str_replace("_", "-", $value) . ', '; - $str_values .= "'".trim($lowerDataArray[$value])."', "; - } - } - - /** - * Remove last two signs (the comma and the space) which we add to much - */ - $str_columns = substr($str_columns, 0, strlen($str_columns) - 2); - $str_values = substr($str_values, 0, strlen($str_values) - 2); - - $GLOBALS['linpha']->db->Execute("INSERT INTO ".LIN_PREFIX."plugins_maps_image_geodata " . - "(" . $str_columns . ") VALUES (" . $str_values . ")"); - - $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . - "SET geodata='1' WHERE md5sum='".$md5sum."' "); - } - } + return $query->EOF; } /** - * Parse GPX data from file + * Save all MetaData to database + * @param string $tag save EXIF, IPTC or XMP MetaData + * @param string $filename filename to parse for MetaData + * @param string $md5sum md5sum of file + * @return none + * @author bzrudi, flo */ - public function parseGpxFile($filename) + public function saveMetaDataToDatabase($tag, $db_table, $filename, $md5sum) { - $parser = new GpxParser($filename); + $dataArray = $this->objMetaTool->readMetaDataFromFile($tag, $filename); - } - - /** - * Simple wrapper method for saveMetaData() - * @param string $what meta type exif,iptc,xmp - * @param string $filename filename - * @param string $md5sum md5sum of image - * @return none - * @author bzrudi,flo - */ - public function saveData($what, $filename, $md5sum) { + //echo '<pre>', print_r($dataArray), '</pre>'; + + if (!is_array($dataArray)) { + return false; + } + + $columns[] = "md5sum"; + $values[] = "'" . $md5sum . "'"; + /** - * Prevent double entries. We do this check at very first position - * to improve performance! - * Also we do not setMetaFields in the __contruct() because they may - * never be used + * Lower array data to make it compareable to LinExifTool::$metaTags + * this is about two times faster than calling strtolow($key) in the loop! */ - $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum " . - "FROM " . LIN_PREFIX . "meta_" . $what . " " . - "WHERE md5sum = '" . $md5sum . "'"); + $lowerDataArray = array_change_key_case($dataArray, CASE_LOWER); - if($query->EOF) // not a single value returned + /** + * Search for valid and filled tags + */ + $hasData = false; + //foreach ($this->defined_fields[$tag] as $key => $value) + foreach ($lowerDataArray as $key => $value) { - /** - * define tags to index if not already done - */ - if(!isset ($this->defined_fields[$what])) + //if (array_key_exists($key, $lowerDataArray)) + if (isset(LinMetaData::$metaTags[$tag][$key])) { - $this->objMetaTool->setMetaFields($what); + //$columns .= str_replace("_", "-", $key) . ', '; // why? (flo) + $columns[] = $key; + + $value = trim($lowerDataArray[$key]); + if (!empty($value)) { + $hasData = true; + } + $values[] = "'".LinSql::linAddslashes($value)."'"; + //$str_values .= "'".HTML_UTF8_Escape(trim($lowerDataArray[$key]))."', "; } - switch($what) - { - case 'exif': - $this->objMetaTool->saveMetaData($filename, $md5sum, $what); - break; - case 'iptc': - $this->objMetaTool->saveMetaData($filename, $md5sum, $what); - break; - case 'xmp': - $this->objMetaTool->saveMetaData($filename, $md5sum, $what); - break; - } } + + $str_columns = implode(', ', $columns); + $str_values = implode(', ', $values); + + /** + * insert empty record even if we have no data to prevent call to this function + * on every image view + */ + $GLOBALS['linpha']->db->Execute("INSERT into ". $db_table . + "(" . $str_columns . ") VALUES (" . $str_values . ")"); + + return $hasData; } /** @@ -1187,7 +1092,239 @@ $image_date = $this->objMetaTool->getDateTimeOriginal($filename); return $image_date; } + + /** + * Define array with allowed IPTC/XMP tags and human readable translation + * This array should correspond with the sql definition in include/sql/sql.tables.php + * @param none + * @return none + * @author bzrudi flo + */ + public static $metaTags = array( + 'xmp' => array( + + //Iptc4xmpCore schema tags + 'countrycode' => 'Country Code', + 'intellectualgenre' => 'Intellectual Genre', + 'location' => 'Location', + 'scene' => 'Scene', + 'subjectcode' => 'Subject Code', + + //Dublin Core schema tags + 'contributor' => 'Contributor', + 'coverage' => 'Coverage', + 'creator' => 'Creator', + 'date' => 'Date', + 'description' => 'Description', + 'format' => 'Format', + 'identifier' => 'Identifier', + 'publisher' => 'Publisher', + 'rights' => 'Rights', + 'subject' => 'Subject', + 'title' => 'Title', + + //Adobe Photoshop schema tags + 'authorsposition' => 'Authors Position', + 'captionwriter' => 'Caption Writer', + 'category' => 'Category', + 'city' => 'City', + 'colormode' => 'Color Mode', + 'country' => 'Country', + 'credit' => 'Credit', + //'datecreated' => 'DateCreated', + 'headline' => 'Headline', + 'iccprofilename' => 'ICC Profile Name', + 'instructions' => 'Instructions', + 'source' => 'Source', + 'state' => 'State', + 'supplementalcategories' => 'Supplemental Categories', + 'transmissionreference' => 'Transmission Reference', + 'urgency' => 'Urgency' + ), + + //IPTC schema tags + 'iptc' => array( + + //IPTC ApplicationRecord Tags + 'applicationrecordversion' => 'Application Record Version', + 'objecttypereference' => 'Object Type Reference', + 'objectattributereference' => 'Object Attribute Reference', + 'objectname' => 'Object Name', + 'objectcycle' => 'Object Cycle', + 'editstatus' => 'Edit Status', + 'subjectreference' => 'Subject Reference', + //'category' => 'Category', + 'supplementalcategories' => 'Supplemental Categories', + 'keywords' => 'Keywords', + 'specialinstructions' => 'Special Instructions', + 'datecreated' => 'Date Created', + 'timecreated' => 'Time Created', + 'by_line' => 'By-line', + 'by_linetitle' => 'By-line Title', + //'city' => 'City', + 'sub_location' => 'Sub-location', + 'province_state' => 'Province-State', + 'country_primarylocationcode' => 'Country-Primary Location Code', + 'country_primarylocationname' => 'Country-Primary Location Name', + 'originaltransmissionreference' => 'Original Transmission Reference', + //'headline' => 'Headline', + //'credit' => 'Credit', + //'source' => 'Source', + 'copyrightnotice' => 'Copyright Notice', + 'contact' => 'Contact', + 'caption_abstract' => 'Caption-Abstract', + 'writer_editor' => 'Writer-Editor', + 'originatingprogram' => 'Originating Program', + 'releasedate' => 'Release Date' + ), + + //EXIF schema tags + 'exif' => array( + + //IFD0 + 'processingsoftware' => 'Processing Software', + 'imagewidth' => 'Image Width', + 'imagelength' => 'Image Length', + 'bitspersample' => 'Bits Per Sample', + 'compression' => 'Compression', + 'photometricinterpretation' => 'Photometric Interpretation', + 'thresholding' => 'Thresholding', + 'cellwidth' => 'Cell Width', + 'celllength' => 'Cell Length', + 'fillorder' => 'Fill Order', + 'documentname' => 'Document Name', + 'imagedescription' => 'Image Description', + 'make' => 'Maker', + 'model' => 'Model', + 'orientation' => 'Orientation', + 'samplesperpixel' => 'Samples Per Pixel', + 'rowsperstrip' => 'Rows Per Strip', + 'minsamplevalue' => 'Min Sample Value', + 'maxsamplevalue' => 'Max Sample Value', + 'xresolution' => 'X Resolution', + 'yresolution' => 'Y Resolution', + 'planarconfiguration' => 'Planar Configuration', + 'pagename' => 'Page Name', + 'xposition' => 'X Position', + 'yposition' => 'Y Position', + 'grayresponseunit' => 'Gray Response Unit', + 'resolutionunit' => 'Resolution Unit', + 'pagenumber' => 'Page Number', + 'software' => 'Software', + 'artist' => 'Artist', + 'hostcomputer' => 'Host Computer', + 'predictor' => 'Predictor', + 'whitepoint' => 'White Point', + 'primarychromaticities' => 'Primary Chromaticities', + 'halftonehints' => 'Halftone Hints', + 'tilewidth' => 'Tile Width', + 'tilelength' => 'Tile Length', + 'ycbcrcoefficients' => 'YCbCr Coefficients', + 'ycbcrsubsampling' => 'YCbCr Sub Sampling', + 'ycbcrpositioning' => 'YCbCr Positioning', + 'referenceblackwhite' => 'Reference Black White', + 'relatedimagefileformat' => 'Related Image File Format', + 'relatedimagewidth' => 'Related Image Width', + 'relatedimagelength' => 'Related Image Length', + 'rating' => 'Rating', + 'ratingpercent' => 'Rating Percent', + 'copyright' => 'Copyright', + + //ExifIFD + 'exposuretime' => 'Exposure Time', + 'fnumber' => 'F Number', + 'exposureprogram' => 'Exposure Program', + 'spectralsensitivity' => 'Spectral Sensitivity', + 'isospeedratings' => 'ISO Speed Ratings', + 'timezoneoffset' => 'Time Zone Offset', + 'selftimermode' => 'Self Timer Mode', + 'exifversion' => 'Exif Version', + 'flashpixversion' => 'FlashPix Version', + 'colorspace' => 'Color Space', + 'pixelxdimension' => 'Pixel X Dimension', + 'pixelydimension' => 'Pixel Y Dimension', + 'datetime' => 'Date Time (Modify Date)', + 'datetimeoriginal' => 'Date Time Original', + 'datetimedigitized' => 'Date Time Digitized (Create Date)', + 'componentsconfiguration' => 'Components Configuration', + 'compressedbitsperpixel' => 'Compressed Bits Per Pixel', + 'shutterspeedvalue' => 'Shutter Speed Value', + 'aperturevalue' => 'Aperture Value', + 'brightnessvalue' => 'Brightness Value', + 'exposurebiasvalue' => 'Exposure Bias Value', + 'exposurecompensation' => 'Exposure Compensation', + 'maxaperturevalue' => 'Max Aperture Value', + 'subjectdistance' => 'Subject Distance', + 'meteringmode' => 'Metering Mode', + 'lightsource' => 'Light Source', + 'flash' => 'Flash', + 'focallength' => 'Focal Length', + 'imagenumber' => 'Image Number', + 'securityclassification' => 'Security Classification', + 'focalplanexresolution' => 'Focal Plane X Resolution', + 'focalplaneyresolution' => 'Foca Plane Y Resolution', + 'focalplaneresolutionunit' => 'Focal Plane Resolution Unit', + 'imagehistory' => 'Image History', + 'subjectlocation' => 'Subject Location', + 'exposureindex' => 'Exposure Index', + 'sensingmethod' => 'Sensing Method', + 'filesource' => 'File Source', + 'scenetype' => 'Scene Type', + 'cfapattern' => 'CFA Pattern', + 'customrendered' => 'Custom Rendered', + 'exposuremode' => 'Exposure Mode', + 'whitebalance' => 'White Balance', + 'digitalzoomratio' => 'Digital Zoom Ratio', + 'focallengthin35mmfilm' => 'Focal Length In 35mm Format', + 'scenecapturetype' => 'Scene Capture Type', + 'gaincontrol' => 'Gain Control', + 'contrast' => 'Contrast', + 'saturation' => 'Saturation', + 'sharpness' => 'Sharpness', + 'subjectdistancerange' => 'Subject Distance Range', + 'gamma' => 'Gamma', + 'relatedsoundfile' => 'Related Sound File', + 'usercomment' => 'User Comment', + 'jpegcomment' => 'JPEG Comment' + ), + + 'exifgps' => array ( + 'gpsversionid' => 'GPS Version ID', + 'gpslatituderef' => 'GPS Latitude Ref', + 'gpslatitude' => 'GPS Latitude', + 'gpslongituderef' => 'GPS Longitude Ref', + 'gpslongitude' => 'GPS Longitude', + 'gpsaltituderef' => 'GPS Altitude Ref', + 'gpsaltitude' => 'GPS Altitude', + 'gpstimestamp' => 'GPS Timestamp', + 'gpssatellites' => 'GPS Satellites', + 'gpsstatus' => 'GPS Status', + 'gpsmeasuremode' => 'GPS Measure Mode', + 'gpsdop' => 'GPS DOP', + 'gpsspeedref' => 'GPS Speed Ref', + 'gpsspeed' => 'GPS Speed', + 'gpstrackref' => 'GPS Track Ref', + 'gpstrack' => 'GPS Track', + 'gpsimgdirectionref' => 'GPS Img Direction Ref', + 'gpsimgdirection' => 'GPS Img Direction', + 'gpsmapdatum' => 'GPS Map Datum', + 'gpsdestlatituderef' => 'GPS Dest Latitude Ref', + 'gpsdestlatitude' => 'GPS Dest Latitude', + 'gpsdestlongituderef' => 'GPS Dest Longitude Ref', + 'gpsdestlongitude' => 'GPS Dest Longitude', + 'gpsdestbearingref' => 'GPS Dest Bearing Ref', + 'gpsdestbearing' => 'GPS Dest Bearing', + 'gpsdestdistanceref' => 'GPS Dest Distance Ref', + 'gpsdestdistance' => 'GPS Dest Distance', + 'gpsprocessingmethod' => 'GPS Processing Method', + 'gpsareainformation' => 'GPS Area Information', + 'gpsdatestamp' => 'GPS DateStamp', + 'gpsdatetime' => 'GPS DateTime', + 'gpsposition' => 'GPS Position', + 'gpsdifferential' => 'GPS Differential' + ) + ); } /* vi: set ts=4 sw=4 sts=4 */ -?> +?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.pjmt.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-04-02 20:54:22 UTC (rev 4915) +++ trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-04-06 21:38:41 UTC (rev 4916) @@ -34,19 +34,24 @@ */ function __construct() { - } /** - * This method reads all available GeoData Information from image. - * @param string $metatype exi - * @param string $filename - * @return array Array with all available Tag informations - * @author bzrudi - * @todo respect exec return status, don't use filename as input (security) + * This method reads all available exif/gps/iptc/xmp information from image. + * @param string $filename filename to parse for MetaData + * @param string $md5sum md5sum of file + * @param string $tag save IPTC or XMP MetaData */ public function readMetaDataFromFile($metatype, $filename) { + $metaArray = array(); + + if (!isset(LinPjmtTool::$metaTags[$metatype])) + { + // TODO IPTC and XMP currently not implemented + return $metaArray; + } + include_once (LINPHA_DIR . '/lib/pjmt/JPEG.php'); include_once (LINPHA_DIR . '/lib/pjmt/EXIF.php'); @@ -54,165 +59,89 @@ * get exif info from file */ $exif_data = get_EXIF_JPEG($filename); - - if($exif_data) + if (!$exif_data) { - /** - * search for valid tags - */ - foreach($this->getDefaultMetaTags('gps') AS $key => $value) + return $metaArray(); + } + + /** + * special tags + */ + // Canon Owner Name append to Artist + if (isset($exif_data['Makernote_Tag']['Decoded Data']) + && is_array($exif_data['Makernote_Tag']['Decoded Data']) // sometimes 'Decoded Data' is an empty string + && isset($exif_data['Makernote_Tag']['Decoded Data'][0][9]['Text Value'])) + { + $owner = $exif_data['Makernote_Tag']['Decoded Data'][0][9]['Text Value']; + if (isset($exif_data[0][315]['Text Value'])) { - if(!empty(LinPjmtTool::$metaTags['exif'][$value]['pathvalue'])) - { - /** - * there are currently only entries at level deep 2 and 5 - * in the array - */ - $ap = explode('/', - LinPjmtTool::$metaTags['exif'][$value]['pathvalue']); - - switch(count($ap)) - { - case 2 : - if(isset($exif_data[$ap[0]][$ap[1]]['Text Value'])) - { - //echo "DATA:".$exif_data[$ap[0]][$ap[1]]['Text Value']."<br>"; - $dataArray[$value] = - LinSql::linAddslashes(trim($exif_data[$ap[0]][$ap[1]]['Text Value'])); - } - break; - case 5 : - if(isset($exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value'])) - { - //echo "DATA2".$exif_data... [truncated message content] |
From: <fan...@us...> - 2008-04-02 20:55:33
|
Revision: 4915 http://linpha.svn.sourceforge.net/linpha/?rev=4915&view=rev Author: fangehrn Date: 2008-04-02 13:54:22 -0700 (Wed, 02 Apr 2008) Log Message: ----------- 2008-04-02 flo * adapted static album/image view to fit new layout Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.view.album.class.php trunk/linpha2/lib/include/sql/sql.data.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/lib/modules/module.newimg.php trunk/linpha2/lib/modules/module.search.php trunk/linpha2/templates/default/static.view_img.html.php trunk/linpha2/templates/default/static.view_thumb.html.php trunk/linpha2/templates/default/themes/default/css/filemanager.css Added Paths: ----------- trunk/linpha2/lib/classes/linpha.static.view.album.class.php trunk/linpha2/templates/default/themes/default/css/static.view_img.css trunk/linpha2/templates/default/themes/default/css/static.view_thumb.css Removed Paths: ------------- trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/templates/default/themes/default/css/view_img.css trunk/linpha2/templates/default/themes/default/css/view_thumb.css Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-04-01 20:40:02 UTC (rev 4914) +++ trunk/linpha2/ChangeLog 2008-04-02 20:54:22 UTC (rev 4915) @@ -1,4 +1,7 @@ +2008-04-02 flo + * adapted static album/image view to fit new layout + 2008-04-01 flo * improved menu handling (enable/disable items) * implemented "view at" function Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2008-04-01 20:40:02 UTC (rev 4914) +++ trunk/linpha2/lib/classes/linpha.class.php 2008-04-02 20:54:22 UTC (rev 4915) @@ -103,9 +103,22 @@ } } +function createAlbumViewObj() +{ + if (linUseAjax()) + { + require_once(LINPHA_DIR . '/lib/classes/linpha.view.album.class.php'); + return new LinViewAlbum(); + } + else + { + require_once(LINPHA_DIR . '/lib/classes/linpha.static.view.album.class.php'); + return new LinViewAlbumStatic(); + } +} + } // end class Linpha - /** * handle common language strings * prefer Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2008-04-01 20:40:02 UTC (rev 4914) +++ trunk/linpha2/lib/classes/linpha.functions.php 2008-04-02 20:54:22 UTC (rev 4915) @@ -247,7 +247,7 @@ $str = '<a href="'.$link.'0">></a> '; $array_files = $GLOBALS['linpha']->sql->getFullFilenameFromId( $id ); - foreach($array_files AS $key=>$value) + foreach($array_files as $key=>$value) { if($value != "") { Deleted: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-04-01 20:40:02 UTC (rev 4914) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-04-02 20:54:22 UTC (rev 4915) @@ -1,1418 +0,0 @@ -<?php -/* -* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> -* Florian Angehrn -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/** - * This class takes care of all different views (thumb view, menus...) - * @package Image - */ - -if(!defined('LINPHA_DIR')) { exit(1); } - -define('LIN_SELECT_FIELDS', - "".LIN_PREFIX."photos.id AS id2, " . - "".LIN_PREFIX."photos.id AS id, ".LIN_PREFIX."photos.name AS name, " . - "".LIN_PREFIX."photos.img_type AS img_type, ".LIN_PREFIX."photos.md5sum AS md5sum, " . - "".LIN_PREFIX."photos.width AS width, ".LIN_PREFIX."photos.height AS height, " . - "".LIN_PREFIX."photos.filesize AS filesize, " . - "".LIN_PREFIX."photos.time_add AS time_add, ".LIN_PREFIX."photos.time_mod AS time_mod, " . - "".LIN_PREFIX."photos.time_exif AS time_exif, ".LIN_PREFIX."photos.stats_numbers AS stats_numbers, " . - "".LIN_PREFIX."photos.stats_views AS stats_views, ".LIN_PREFIX."photos.stats_downloads AS stats_downloads" -); - -class LinImgview { - -public $mode; // 'home', 'thumb', 'image' -public $modulename; // 'albums', 'browse', ... -public $tot_photos; -public $photos; -public $photos_filtered; -public $id_parent, $img_type, $filename, $md5sum, $org_width, $org_height; -private $nr_pages, $current_page; // only used if javascript disabled -private $newCommentAdded = false; // used for ajax - -/** - * constructor - */ -function __construct() -{ - -} - -/** - * set current view and set fileinfos of $GLOBALS['linpha']->template->idCurrent ($_GET['linId']) - * @param string $modulname (album, browse, search, ...) - */ -function setCurrentView($modulename) -{ - $this->modulename = $modulename; - - $this->orderby = linGetSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_others_sortorder']); - - if( $GLOBALS['linpha']->template->idCurrent == 0 ) - { - /** - * on top view, reset current view - */ - if($this->modulename=='albums') - { - $this->mode = 'home'; - $this->orderby = linGetSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_home_firstsortorder']); - } - else // $this->modulename=='browse' | 'search' , others will come.. - { - $this->mode = 'thumb'; - - if( ! isset($_SESSION['mode_thumbview']) ) - { - $_SESSION['mode_thumbview'] = 'thumb'; - } - } - } - else - { - /** - * set file informations - */ - $current_data = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum, width, height FROM ".LIN_PREFIX."photos " . - "WHERE id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); - /** - * check for valid id - */ - - if( isset($current_data['id']) ) - { - $this->img_type = $current_data['img_type']; - $this->filename = $current_data['name']; - $this->md5sum = $current_data['md5sum']; - $this->org_width = $current_data['width']; - $this->org_height = $current_data['height']; - - /** - * switch between thumb_view and img_view - */ - if( $this->img_type == 0) - { - $this->mode = 'thumb'; - $this->id_parent = $current_data['id']; // use current_id as parent_id, because we want to see the content of the actual folder! - - if(! isset($_SESSION['mode_thumbview']) ) - { - $_SESSION['mode_thumbview'] = 'thumb'; - } - } - else - { - $this->mode = 'image'; - $this->id_parent = $current_data['parent_id']; // use parent_id on image view - - if( ! isset($_SESSION['mode_imageview']) ) - { - $_SESSION['mode_imageview'] = 'img'; - } - } - } - else // no valid id supplied - { - $this->mode = 'home'; - $GLOBALS['linpha']->template->idCurrent = 0; - } - } - - if($this->mode == 'thumb' && isset($_GET['view'])) - { - $_SESSION['mode_thumbview'] = $_GET['view']; - } - if($this->mode == 'image' && isset($_GET['view'])) - { - $_SESSION['mode_imageview'] = $_GET['view']; - } - - /** - * set id_parent to a default value - */ - if( ! isset( $this->id_parent) ) - { - $this->id_parent = $GLOBALS['linpha']->template->idCurrent; - } -} - -/** - * main function to prepare desired layout view - */ -function buildImgView() -{ - $this->filterPhotosNotPermitted(); - - /** - * set mode specific things - */ - switch($this->mode) - { - case 'home': - $this->viewHome(); - break; - case 'thumb': - switch($_SESSION['mode_thumbview']) - { - case 'thumb': - case 'thumbdetail': - $this->viewThumb(); - break; - case 'basket': - $this->viewBasket(); - break; - case 'albmeta': - $this->viewAlbMeta(); - break; - } - break; - case 'image': - switch($_SESSION['mode_imageview']) - { - case 'img': - $this->viewImg(); /* will exit in xml mode */ - break; - case 'meta': - $this->viewMeta(); - break; - } - break; - } - - /** - * doing some special commands - * - * should be done after viewImg(), because adminCommands() (force_import) uses some image informations - */ - if(isset($_GET['admin_cmd'])) { - $this->adminCommands(); - } - - if(isset($_GET['linMsg'])) - { - switch($_GET['linMsg']) - { - case 'basket_added': linSysLog(i18n("Images Added To Basket.")); break; - } - } - - /** - * set ref urls - * used in basket and ajax reloadmenu - */ - $_SESSION['ref_url_full'] = $GLOBALS['linpha']->template->URL_full; - $_SESSION['ref_url_base'] = $GLOBALS['linpha']->template->URL_base; - $_SESSION['ref_modulename'] = $this->modulename; - - /** - * set admin menu and more menu - * - this should be done after adminCommands, because of - * "nr images in basket" is changed in adminCommands() - * - * - this should be done after viewImg(), because of $org_width and $org_height in "View at" - */ - $this->setMenu(); - - /** - * at this point, there should be absolute no output - */ - include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); -} - -/** - * filter out files and folders not permitted and escape filename - * all other values dont have to be escaped - * (currently at least, have a look at LIN_SELECT_FIELDS) - */ -function filterPhotosNotPermitted() -{ - $this->photos_filtered = Array(); - - if(isset($this->photos)) - { - foreach($this->photos AS $key=>$value) - { - if( ! ($this->mode == 'image' && $value['img_type']== '0' ) ) // exclude subfolders from img_view - { - if( LinSql::photoIsAllowed( $value['id'] ) ) - { - /** - * escape name here - * -> we do not have to do it in the templates - */ - $value['name'] = htmlspecialchars($value['name'],ENT_QUOTES); - $this->photos_filtered[] = $value; - - //print_r($value); - } - } - } - } - - unset($this->photos); -} - -/** - * create optional top menu - */ -function setMenu() -{ - - - /** - * Menu Admin - */ - if($GLOBALS['linpha']->sql->isAdmin()) - { - $GLOBALS['linpha']->template->menu['admin']['import'] = - array( - 'name' => i18n("Import"), - 'link' => array( - array('name' => i18n("Start Import Of This Folder/File"), 'link' => LINPHA_CLIENT.'/admin/?cat=maintenance_import&album_select[]='.$this->id_parent), - array('name' => i18n("Detect File Changes"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=force_import') - ) - ); - - $GLOBALS['linpha']->template->menu['admin']['permissions'] = - array( - 'name' => i18n("Permissions"), - 'link' => array( - array('name' => i18n("Set Permissions"), 'link' => LINPHA_CLIENT.'/admin/?cat=permissions_view&cmd=edit&linId='.$GLOBALS['linpha']->template->idCurrent) - ) - ); - - - if($this->mode == 'thumb' || $this->mode == 'image') - { - /** - * append to "admin - import" entry - */ - $GLOBALS['linpha']->template->menu['admin']['import']['link'][] = array( - 'name' => i18n("Recreate This Thumbnail"), - 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' - ); - } - } - - /** - * Menu More - */ - if($this->mode != 'home') - { - /** - * more than one time used stuff - */ - $array = linGetSortOrders(); - foreach($array as $value) // i18n() already called - { - $array_sort_orders_links[] = array('name' => $value, 'link' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); - } - - $open_basket_link = LINPHA_LINK.'&linCat=basket'; - - switch($this->mode) - { - case 'thumb': - - $GLOBALS['linpha']->template->menu['more']['basket'] = - array( - 'name' => i18n("Basket"), - 'link' => array( - array('name' => i18n("Add All To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all'), - array('name' => i18n("Switch To Basket View"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), - array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) - ) - ); - - if( linUseAjax() ) - { - $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectsizes']); - foreach($array as $value) - { - $array_tn_sizes_links[] = array('name' => $value.' '.i18n("Pixel"), 'link' => 'javascript:myLinThumbnails.setTnSize('.$value.')'); - } - - $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectnrimages']); - foreach($array as $value) - { - $array_nr_links[] = array('name' => $value, 'link' =>"javascript:myLinThumbnails.setNrImages('".$value."')"); - } - - $array_views_links[] = array('name' => i18n("Normal"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumb'); - $array_views_links[] = array('name' => i18n("Detail"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumbdetail'); - - $GLOBALS['linpha']->template->menu['more']['view'] = - array( - 'name' => i18n("View"), - 'link' => array( - array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), - array('name' => i18n("View"), 'link' => $array_views_links), - array('name' => i18n("Thumb Size"), 'link' => $array_tn_sizes_links), - array('name' => i18n("Thumb Nr"), 'link' => $array_nr_links) - ) - ); - } - else - { - $GLOBALS['linpha']->template->menu['more']['view'] = - array( - 'name' => i18n("View"), - 'link' => array( - array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), - ) - ); - } - - if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) - { - $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; - } - - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - $GLOBALS['linpha']->template->menu['more']['metainfo'] = - array( - 'name' => i18n("Metainfo"), - 'link' => array( - array('name' => i18n("Edit Album Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=albmeta'), - ) - ); - } - break; - case 'image': - - $GLOBALS['linpha']->template->menu['more']['basket'] = - array( - 'name' => i18n("Basket"), - 'link' => array( - array('name' => i18n("Add To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this'), - array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) - ) - ); - $GLOBALS['linpha']->template->menu['more']['view'] = - array( - 'name' => i18n("View"), - 'link' => array( - array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), - array('name' => i18n("View at"), 'link' => - array( - array('name' => '640x480', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=640&height=480', 'target' => '_blank'), - array('name' => '800x600', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=800&height=600', 'target' => '_blank'), - array('name' => '1024x768', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1024&height=768', 'target' => '_blank'), - array('name' => '1280x800', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=800', 'target' => '_blank'), - array('name' => '1280x960', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=960', 'target' => '_blank'), - array('name' => '1280x1024', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=1024', 'target' => '_blank'), - array('name' => '1600x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1600&height=1200', 'target' => '_blank'), - array('name' => '1920x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1920&height=1200', 'target' => '_blank'), - array('id' => 'linLiViewAtFullscreen', 'name' => $this->org_width.'x'.$this->org_height.' ('.i18n("Fullscreen").')', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width='.$this->org_width.'&height='.$this->org_height, 'target' => '_blank'), - ) - ) - ) - ); - - - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['name'] = i18n("Rotate Left"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; - $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['name'] = i18n("Rotate Right"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; - } - - if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) - { - $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; - } - - - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - $GLOBALS['linpha']->template->menu['more']['metainfo'] = - array( - 'name' => i18n("Metainfo"), - 'link' => array( - array('name' => i18n("Edit Image Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=meta') - ) - ); - } - - break; - } - } - - /** - * Icons - */ - if($this->mode == 'thumb') - { - /** - * basket icons - */ - if( $GLOBALS['linpha']->sql->checkPermission('basket_download')) - { - $GLOBALS['linpha']->template->menu['icon_download'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=download'; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) - { - $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=print'; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) - { - $GLOBALS['linpha']->template->menu['icon_mail'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=mail'; - } - /** - * slideshow icon - */ - if( linUseAjax() ) { - $GLOBALS['linpha']->template->menu['icon_slideshow'] = 'javascript:myLinThumbnails.loadSlideshow()'; - } - } - elseif($this->mode == 'image') - { - /** - * basket icons - */ - if( $GLOBALS['linpha']->sql->checkPermission('download')) - { - $GLOBALS['linpha']->template->menu['icon_download'] = LINPHA_LINK.'&linCat=download&linId='.$GLOBALS['linpha']->template->idCurrent; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) - { - $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_this_with_checkout&checkout_as=print'; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) - { - $GLOBALS['linpha']->template->menu['icon_mail'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_this_with_checkout&checkout_as=mail'; - } - - /** - * slideshow icon - */ - if( linUseAjax() ) { - $GLOBALS['linpha']->template->menu['icon_slideshow'] = 'javascript:myLinThumbnails.fullscreenStart()'; - } - } -} - -/** - * method for special admin commands, like rotating images, import stuff etc. - * @uses LinImgview::buildImgView() - */ -function adminCommands() -{ - switch($_GET['admin_cmd']) - { - case 'recreate': - if($GLOBALS['linpha']->sql->isAdmin()) - { - $thumbnail = new LinImage(); - $_GET['force'] = true; - $thumbnail->createThumbnail($GLOBALS['linpha']->template->idCurrent); - } - break; - case 'force_import': // called in viewImg - LinImport::updateEntry( $GLOBALS['linpha']->template->idCurrent , dirname($this->src_file) , $this->filename ); - break; - case 'rotate_left': - if($GLOBALS['linpha']->sql->isAdmin()) - { - LinImage::rotateImageByMenuCall('-90', $GLOBALS['linpha']->template->idCurrent); - } - break; - case 'rotate_right': - if($GLOBALS['linpha']->sql->isAdmin()) - { - LinImage::rotateImageByMenuCall('90', $GLOBALS['linpha']->template->idCurrent); - } - break; - case 'basket_add_all': - case 'basket_add_all_with_checkout': - /** - * coming from imgview, mode=viewThumb - * the permission check with photoIsAllowed() is done while checking out - */ - foreach($this->photos_filtered AS $value) - { - if($value['img_type']!=0) - { - $_SESSION['basket_ids'][] = $value['id']; - } - } - - if($_GET['admin_cmd'] == 'basket_add_all_with_checkout') - { - header("Location: ".LINPHA_LINK."&linCat=basket&checkout_as=".$_GET['checkout_as']); - exit(); - } - break; - case 'basket_add_this': - case 'basket_add_this_with_checkout': - /** - * coming from imgview, mode=viewImg - */ - $_SESSION['basket_ids'][] = $GLOBALS['linpha']->template->idCurrent; - - if($_GET['admin_cmd'] == 'basket_add_this_with_checkout') - { - header("Location: ".LINPHA_LINK."&linCat=basket&checkout_as=".$_GET['checkout_as']); - exit(); - } - break; - } -} - -/** - * define thumbnail view - */ -function viewThumb() -{ - $this->viewThumbSetSubFolders(); - - /** - * create thumbnail info text (filename, description, etc.) - */ - $i=0; - - foreach($this->photos_filtered AS $key=>$photo_value) - { - if($_SESSION['mode_thumbview'] == 'thumbdetail') { - $flag_nr = 14; // flag nr of thumbdetail - } else { - $flag_nr = 13; // flag nr of thumb - } - - $array_image_infos = LinMetaData::readInformations($photo_value,$flag_nr); - - $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] = ''; - $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['after'] = ''; - $index = 'before'; - $i=0; - foreach($array_image_infos AS $value) - { - /** - * got thumbnail, switch to index after - */ - if($value['value']=='thumbnail') - { - $index = 'after'; - } - else - { - $i++; - if($index == 'before') - { - $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] .= $value['value'].'<br />'; // $value['value'] is already escaped - } - elseif($index == 'after') - { - $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['after'] .= $value['value'].'<br />'; // $value['value'] is already escaped - } - } - } - - $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['title'] = $photo_value['name']; // $photo_value['name'] is already escaped - } - - $this->nr_text_lines = $i; // used in LinThumbnails.js to calculate the space for the thumb height - - /** - * switch between javascript - */ - if( linUseAjax() ) - { - /** - * create javascript object containing all thumb informations - */ - - $GLOBALS['linpha']->template->setModuleName('view_thumb'); - - $GLOBALS['linpha']->template->output['page_nr_left'] = ''; - $GLOBALS['linpha']->template->output['page_nr_right'] = ''; - $GLOBALS['linpha']->template->output['page_nr'] = ''; - - - /** - * create files db - * this is a normal javascript array - * just another kind of definition... - */ - $GLOBALS['linpha']->template->output['files_db'] = 'var linImgIds = ['."\n"; - if($this->tot_photos > 0) // check if not all entries were folders - { - foreach($this->photos_filtered AS $key=>$value) - { - if( ( $GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] && $value['img_type'] != 0 ) - OR !$GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] ) - { - $before = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['before']; - $after = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['after']; - $title = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['title']; - - $array_files_db[] = '{ id: "'.$value['id'].'", before: "'.str_replace('"','\"',$before).'", after: "'.str_replace('"','\"',$after).'", title: "'.str_replace('"','\"',$title).'" }'; - } - } - - $GLOBALS['linpha']->template->output['files_db'] .= implode($array_files_db,", \n"); - - } - $GLOBALS['linpha']->template->output['files_db'] .= "\n".'];'; - } - else - { - $GLOBALS['linpha']->template->setModuleName('static.view_thumb'); - $GLOBALS['linpha']->template->overrideModule('css','view_thumb'); - - $this->viewThumbNojs(); - } -} - -/** - * thumbnail view with javascript disabled (static) - * @uses LinImgView::viewThumb() - */ -function viewThumbNojs() -{ - /** - * prepare variables - */ - $max_photos_per_page = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrrows'] * $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrcols']; - $this->nr_pages = ceil( $this->tot_photos / $max_photos_per_page ); - if(isset($_GET['pn']) && $_GET['pn'] > 1) - { - $this->current_page = $_GET['pn']; - } - else - { - $_GET['pn'] = 1; - $this->current_page = 1; - } - - - $this->viewThumbNojsWritePageNumbers(); - - /** - * create array $this->photos_show which contains only the photos of the current page - */ - if($this->tot_photos > 0) // only if not all entries were folders - { - $img_nr = 1; - $i = 0; - $startup_img_nr = ($this->current_page - 1)*$max_photos_per_page; - - foreach($this->photos_filtered AS $value) - { - if($i >= $startup_img_nr && $img_nr <= $max_photos_per_page // add images only while in current page - && ( ( $GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] && $value['img_type'] != 0 ) // add images only if no folder because they are shown separate - OR !$GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] ) ) // add folders only if they are not shown separate - { - $this->photos_show[] = $value; - $img_nr++; - } - $i++; - } - } -} - -/** - * setup page numbers (only used if static) - */ -function viewThumbNojsWritePageNumbers() -{ - /** - * writing page numbers - */ - $start_nr = 1; - - /** - * write left and right '...' if more than 10 pages - */ - $left_dots = ""; - $right_dots = ""; - if($this->nr_pages > 10) - { - $start_nr = $_GET['pn']; - - if($_GET['pn'] >= $this->nr_pages-5) // we reached end of album - { - $start_nr = $this->nr_pages-10; - $left_dots = "... "; - } - elseif($start_nr <=5 ) // we are at the beginning - { - $this->nr_pages = 10; - $start_nr = 1; - $right_dots = " ..."; - } - else - { - $this->nr_pages = $start_nr+5; - $start_nr -= 5; - if($_GET['pn']!="6") : $left_dots="... "; endif; - $right_dots=" ..."; - } - } - - $GLOBALS['linpha']->template->output['page_nr'] = $left_dots; - - for($i=$start_nr; $i <= $this->nr_pages; $i++) - { - if($i == $this->current_page) - { - $GLOBALS['linpha']->template->output['page_nr'] .= $i.' '; - } - else - { - $GLOBALS['linpha']->template->output['page_nr'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.$i.'">'.$i.'</a> '; - } - } - - $GLOBALS['linpha']->template->output['page_nr'] .= $right_dots; - - /** - * write starting ' << ' and ' < ' - */ - if($this->current_page != 1) - { - $GLOBALS['linpha']->template->output['page_nr_left'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn=1"><<</a> ' . - '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page-1).'"><</a> '; - } - else - { - $GLOBALS['linpha']->template->output['page_nr_left'] = '<< <'; - } - - /** - * write ending '>' and '>>' - */ - if($this->current_page != $this->nr_pages && $this->nr_pages != 0) // need check nr_pages != 0 because we don't need links if nr_pages == 0! - { - $GLOBALS['linpha']->template->output['page_nr_right'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page+1).'">></a> ' . - '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->nr_pages).'">>></a> '; - } - else - { - $GLOBALS['linpha']->template->output['page_nr_right'] = '> >>'; - } -} - -/** - * print sub folders AND calculate tot_photos - * @todo should we show subfolders separate..? - * i think this is useless if we can set automatically view = thumbdetail - */ -function viewThumbSetSubFolders() -{ - $output_folders = ''; - $nr_folders = 0; - - if( ! isset($GLOBALS['linpha']->template->output['navigation'] ) ) - { - $GLOBALS['linpha']->template->output['navigation'] = ''; - } - - if($GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate']) - { - foreach($this->photos_filtered AS $key=>$value) - { - if($value['img_type'] == 0) - { - $GLOBALS['linpha']->template->output['navigation'] .= '<a href="'.LINPHA_LINK.'&linCat=alb&linId='.$value['id'].'">'.$value['name'].'</a><br />'; - $nr_folders++; - } - } - } - - /** - * set tot_photos - * subtract number of folders if they are shown separate - */ - $this->tot_photos = count($this->photos_filtered) - $nr_folders; -} - -/** - * setup detailed thumbdetail view - */ -function viewThumbdetail() -{ - $GLOBALS['linpha']->template->setModuleName('view_thumbdetail'); -} - -/** - * setup main/home view layout - */ -function viewHome() -{ - $GLOBALS['linpha']->template->setModuleName('home'); - - /** - * set welcome text - */ - if($GLOBALS['linpha']->sql->config->value['sys_style_home_usedefaultwelcometext']) - { - $GLOBALS['linpha']->template->output['welcome'] = '<h1 class="linStyle">'.i18n("Welcome").'</h1>'. - i18n("Hi, this is the home of \"The PHP Photo Archive\" <a href=\"http://linpha.sf.net\">aka LinPHA</a>.").'<br />'; - } - else - { - $data = $GLOBALS['linpha']->db->GetRow("SELECT meta_comment FROM ".LIN_PREFIX."meta_comments WHERE md5sum='welcometext'"); - if(isset($data['meta_comment'])) - { - $GLOBALS['linpha']->template->output['welcome'] = $data['meta_comment']; - } - else - { - $GLOBALS['linpha']->template->output['welcome'] = ''; - } - } - - /** - * new images - */ - $days = $GLOBALS['linpha']->sql->config->value['sys_style_home_newimagesage']; - $days_in_sec = $days*60*60*24; - $lower_date = time()-$days_in_sec; - $this->viewHomeSetImages('new_images','sys_style_home_newimagesnr',' AND time_add > '.LinSql::linAddslashes($lower_date)); - - /** - * random images - */ - $this->viewHomeSetImages('random_images','sys_style_home_nrrandomimages',''); - - /** - * browse by date - */ - $this->viewHomeSetBrowseByDate(); - - /** - * album informations - */ - foreach($this->photos_filtered AS $photo_key=>$photo_value) - { - $array_image_infos = LinMetaData::readInformations($photo_value,$flag_nr=12); - - $this->photos_filtered[$photo_key]['album_infos'] = ''; - foreach($array_image_infos AS $key=>$value) - { - if($key == 'builtin_stats_numbers') - { - $this->photos_filtered[$photo_key]['album_infos'] .= $value['value'].' '.i18n("Photos").'<br />'; - } - elseif($key == 'builtin_first_comment') - { - $this->photos_filtered[$photo_key]['album_infos'] .= '<div class="linDivFolderComment">'.$value['value']; - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { - $this->photos_filtered[$photo_key]['album_infos'] .= ' <a href="'.$GLOBALS['linpha']->template->URL_base.'&linId='.$photo_value['id'].'&view=albmeta'.'">Edit</a>'; - } - $this->photos_filtered[$photo_key]['album_infos'] .= '</div>'; - } - else - { - $this->photos_filtered[$photo_key]['album_infos'] .= $value['value'].'<br />'; - } - } - } -} - -/** - * setup browse by date feature - */ -function viewHomeSetBrowseByDate() -{ - if($GLOBALS['linpha']->sql->config->value['sys_style_home_showbrowsebydate']) - { - $GLOBALS['linpha']->template->output['browse_by_date'] = ''; - - $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal) AS min , max(datetimeoriginal) AS max " . - "FROM ".LIN_PREFIX."meta_exif"); - if(isset($data['min']) && isset($data['max']) && !empty($data['min']) && !empty($data['max']) ) - { - /** - * get min and max year - */ - $min_year = substr($data['min'],0,4); - $max_year = substr($data['max'],0,4); - /** - * get years between - */ - for($i = $min_year; $i <= $max_year; $i++) - { - /** - * exclude all wrong/empty/... dates - */ - if($i > 1900) - { - $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) AS datetime FROM ".LIN_PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); - if($data['datetime']>0) - { - $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_LINK.'&linCat=browse&year='.$i.'">'.$i.'</a> ('.$data['datetime'].'), '; - } - } - } - } - } -} - -/** - * setup random and new imgages view - */ -function viewHomeSetImages($key,$optionname,$sql) -{ - $GLOBALS['linpha']->template->output[$key] = array(); - - if($GLOBALS['linpha']->sql->config->value[$optionname] != 0) - { - switch(LIN_DB_TYPE) - { - case 'mysql': - $str_random = 'rand()'; - break; - case 'postgres': - $str_random = 'random()'; - break; - case 'sqlite': - $str_random = 'random()'; - break; - case 'oci8po': - $str_random = $GLOBALS['linpha']->db->random; - break; - } - - $nr_images = $GLOBALS['linpha']->sql->config->value[$optionname]; - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999".$sql." ORDER BY ".$str_random); - - for($i = 1; $i <= $nr_images ; ) - { - $data = $query->FetchRow(); - if(isset($data['id'])) - { - $path = LinSql::getFullImagePath( $data['id'] ); - - if(file_exists($path) && LinSql::photoIsAllowed($data['id'])) - { - $GLOBALS['linpha']->template->output[$key][] = array('id'=>$data['id'],'path'=>$path); - $i++; - } - } - else - { - break; - } - } - } -} - -/** - * setup basket view - */ -function viewBasket() -{ - $GLOBALS['linpha']->template->setModuleName('view_basket'); - $GLOBALS['linpha']->template->overrideModule('css','view_thumb'); // used the same css definitions as view_thumb - - $this->viewThumbSetSubFolders(); - $this->viewThumbNojs(); -} - -/** - * setup comment view - */ -function viewAlbMeta() -{ - $GLOBALS['linpha']->template->setModuleName('view_albmeta'); - - /** - * save data - */ - if( isset( $_POST['cmd'] ) && $_POST['cmd']=="add_comment") - { - /** - * check if comment exists - * - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT id " . - "FROM ".LIN_PREFIX."meta_comments " . - "WHERE md5sum = '".LinSql::linAddslashes($this->md5sum)."'"); - - if( $query->EOF ) // insert - { - $GLOBALS['linpha']->db->Execute( - "INSERT into ".LIN_PREFIX."meta_comments " . - "(meta_time, md5sum, meta_author, meta_comment) " . - "VALUES " . - "('".time()."', '".LinSql::linAddslashes($this->md5sum)."', " . - "'".LinSql::linAddslashes($_POST['author'])."', '".LinSql::linAddslashes($_POST['comment'])."')" - ); - } - else // update - { - $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."meta_comments SET ". - "meta_time = '".time()."', ". - "meta_author = '".LinSql::linAddslashes($_POST['author'])."', " . - "meta_comment = '".LinSql::linAddslashes($_POST['comment'])."' " . - "WHERE md5sum = '".LinSql::linAddslashes($this->md5sum)."'"); - } - } - - /** - * get data - */ - $data = $GLOBALS['linpha']->db->GetRow( - "SELECT id, meta_time, meta_author, meta_comment " . - "FROM ".LIN_PREFIX."meta_comments " . - "WHERE md5sum = '".$this->md5sum."'" - ); - if(isset($data['meta_author'])) - { - $GLOBALS['linpha']->template->output['comment_author'] = $data['meta_author']; - } - else - { - $GLOBALS['linpha']->template->output['comment_author'] = $_SESSION['user_name']; - } - - if(isset($data['meta_comment'])) - { - $GLOBALS['linpha']->template->output['comment_text'] = $data['meta_comment']; - } - else - { - $GLOBALS['linpha']->template->output['comment_text'] = ''; - } - - /** - * save modified MetaData - */ - LinMetaData::saveModifiedMetaData(); -} - -/** - * setup image view - */ -function viewImg() -{ - $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); - - if( LinIdentify::isVideo( $this->img_type )) // in video mode, the video thumbnail is shown instead of the image - { - $this->img_width = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; - $this->img_height = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; - } - else - { - $max_width = $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; - $max_height = $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; - $array = LinImage::scaleToFit($this->org_width,$this->org_height,$max_width,$max_height); - - $this->img_width = $array['w']; - $this->img_height = $array['h']; - } - - $this->viewImgCommon(); - $this->viewImgComments(); - - if( linUseAjax() ) - { - $GLOBALS['linpha']->template->setModuleName('view_img'); - - if(isset($_GET['xml'])) - { - $this->viewImgXml(); - exit(); - } - } - else - { - $GLOBALS['linpha']->template->setModuleName('static.view_img'); - $GLOBALS['linpha']->template->overrideModule('css','view_img'); - } -} - -/** - * generate xml data for ajax image view - */ -function viewImgXml() -{ - header('Content-type: text/xml'); - echo '<?xml version="1.0" ?>'."\n"; - ?> -<root> -<imgid><?php echo $GLOBALS['linpha']->template->idCurrent; ?></imgid> -<filetype><?php echo LinIdentify::getShortFileType( $this->img_type ); ?></filetype> -<imgwidth><?php echo $this->org_width; ?></imgwidth> -<imgheight><?php echo $this->org_height; ?></imgheight> -<imgnr><?php printf(i18n("Image %s of %s"),$this->current_key+1,count($this->photos_filtered)); ?></imgnr> -<title><?php /* oh, what an evil hack */ echo str_replace('<','<',$GLOBALS['linpha']->template->linpha_title." :: ".$GLOBALS['linpha']->template->output['title']); ?></title> -<?php - if(isset($this->xmldata['prev_thumb'])) { - foreach($this->xmldata['prev_thumb'] AS $value) - { - echo '<prevthumb>'.$value.'</prevthumb>'."\n"; - } - } - if(isset($this->xmldata['next_thumb'])) { - foreach($this->xmldata['next_thumb'] AS $value) - { - echo '<nextthumb>'.$value.'</nextthumb>'."\n"; - } - } - - foreach($GLOBALS['linpha']->template->output['image_infos'] AS $value) - { ?> -<meta> - <name><?php echo $value['name']; ?></name><value><?php echo htmlspecialchars($value['value']); ?></value> -</meta> -<?php - } - - if($this->newCommentAdded) - { - echo '<commentadded>'.i18n("Comment successfully added.").'</commentadded>'."\n"; - } - - while($data = $GLOBALS['linpha']->template->output['image_comments']->FetchRow()) - { ?> -<comment> - <time><?php echo htmlspecialchars(linStrftime($data['meta_time'])); ?></time> - <author><?php echo htmlspecialchars($data['meta_author'],ENT_QUOTES); ?></author> - <text><?php echo str_replace('<','<',linHtmlTag($data['meta_comment'],ENT_QUOTES) ); ?></text> -</comment> -<?php } ?> -</root> - -<?php - -} // end viewImgAjax() - -/** - * stuff used in viewImg() and viewMeta() - */ -function viewImgCommon() -{ - $this->viewImgSetPrevNextThumb(); - - $this->viewImgStoreImageInformation(); - - $GLOBALS['linpha']->template->output['image_infos'] = - LinMetaData::readInformations($this->photos_filtered[$this->current_key], - $flag_nr=10); - -} - -/** - * get/save image comments - */ -function viewImgComments() -{ - /** - * image comments - */ - if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) - { - /** - * save comment - */ - if( isset( $_POST['cmd'] ) && $_POST['cmd']=='add_comment' - && isset($_POST['inputAddCommentAuthor']) - && !empty($_POST['inputAddCommentAuthor']) - && ((isset($_POST['inputAddCommentText']) && !empty($_POST['inputAddCommentText'])) - || (isset($_POST['inputAddCommentTextarea']) && !empty($_POST['inputAddCommentTextarea'])))) - { - if( !empty($_POST['inputAddCommentTextarea'])) { - $comment = $_POST['inputAddCommentTextarea']; - } else { - $comment = $_POST['inputAddCommentText']; - } - - $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_comments (meta_time, md5sum, meta_author, meta_comment)" . - "VALUES ('".time()."','".$GLOBALS['linpha']->imgview->md5sum."','".LinSql::linAddslashes($_POST['inputAddCommentAuthor'])."'," . - "'".LinSql::linAddslashes($comment)."')"); - $this->newCommentAdded = true; // used for ajax - } - - /** - * get comments - */ - $GLOBALS['linpha']->template->output['image_comments'] = $GLOBALS['linpha']->db->Execute("SELECT id, meta_time, meta_author, meta_comment FROM ".LIN_PREFIX."meta_comments " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); - } -} - -/** - * store image informations in database if s - */ -function viewImgStoreImageInformation() -{ - $array_meta = array('exif','iptc','xmp'); - foreach($array_meta AS $value) - { - if(!isset($MetaData)) - { - $MetaData = new LinMetaData(); - } - - /** - * read exif/iptc/xmp from file if no entry - */ - if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) - { - $MetaData->saveData($value, $this->src_file, $this->md5sum ); - } - - /** - * Read image geodata. This depends on the maps plugin. So we only - * run this additionally import if maps plugin is enabled and admin - * selected "autoimport". - * This should prevent all others from suffering performance issues - * during import - */ - if(isset($GLOBALS['linpha']->sql->config->value['plugins_maps_enable']) - && $GLOBALS['linpha']->sql->config->value['plugins_maps_enable_geotagged'] - && $GLOBALS['linpha']->sql->config->value['plugins_maps_geotagged_autoimport']) - { - $MetaData->singleImportGeoData($this->md5sum, $this->src_file); - error_log("DOING GEODATA AUTOIMPORT",'',0); - } - } -} - -/** - * generate html code for the prev/next thumbnail - */ -function viewImgThumbHtml($key,$class) -{ - $id = $this->photos_filtered[$key]['id']; - $name = $this->photos_filtered[$key]['name']; - - $str = '<div class="linDivThumbnavi_'.$class.'">' - . '<a href="'.$GLOBALS['linpha']->template->URL_base.'&linId='.$id.'">' - . '<img class="linImgThumbnavi_'.$class.'" src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$id.'" /></a>' - . '<br />'.$name.'</div>'."\n"; - - return $str; -} - -/** - * set prev/next thumb for img_view and meta_view - */ -function viewImgSetPrevNextThumb() -{ - $nr_prev_next_thumbs = $GLOBALS['linpha']->sql->config->value['sys_style_image_nrprevnextthumbs']; - - /** - * search current key in array - */ - foreach($this->photos_filtered AS $key=>$value) - { - if($value['id'] == $GLOBALS['linpha']->template->idCurrent) - { - $this->current_key = $key; - break; - } - } - - /** - * ooh, something went wrong - */ - if(!isset($this->current_key)) - { - $this->current_key = 0; - } - - /** - * set prev thumbs - */ - $GLOBALS['linpha']->template->output['prev_thumb'] = ''; - for($i=$nr_prev_next_thumbs; $i > 0; $i--) - { - if($this->current_key >= $i) - { - if(isset($_GET['xml'])) - { - $this->xmldata['prev_thumb'][] = $this->photos_filtered[$this->current_key - $i]['id']; - } - else - { - $GLOBALS['linpha']->template->output['prev_thumb'] .= $this->viewImgThumbHtml( $this->current_key - $i , 'PrevNext' ); - } - } - } - - /** - * set next thumbs - */ - $GLOBALS['linpha']->template->output['next_thumb'] = ''; - for($i=0; $i < $nr_prev_next_thumbs; $i++) - { - if($this->current_key < ( count($this->photos_filtered) - ($i+1) ) ) - { - if(isset($_GET['xml'])) - { - $this->xmldata['next_thumb'][] = $this->photos_filtered[$this->current_key + ($i+1)]['id']; - } - else - { - $GLOBALS['linpha']->template->output['next_thumb'] .= $this->viewImgThumbHtml( $this->current_key + ($i+1) , 'PrevNext' ); - } - } - } - - - /** - * set current image and thumb - */ - if(isset($_GET['xml'])) - { - } - else - { - $GLOBALS['linpha']->template->output['current_thumb'] = $this->viewImgThumbHtml( $this->current_key , 'Current' ); - } -} - -/** - * setup MetaData view - */ -function viewMeta() -{ - $GLOBALS['linpha']->template->setModuleName('static.view_img'); - $GLOBALS['linpha']->template->overrideModule('css','view_img'); - - $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); - - /** - * save modified MetaData - */ - LinMetaData::saveModifiedMetaData(); - - $this->viewImgCommon(); -} - -} // end class linImgview -?> Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-04-01 20:40:02 UTC (rev 4914) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-04-02 20:54:22 UTC (rev 4915) @@ -79,7 +79,7 @@ } } - foreach ($this->cachedSelectedFieldNames AS $field_name) + foreach ($this->cachedSelectedFieldNames as $field_name) { $name = LinMetaData::getNameOfField($field_name, false); $value = ''; @@ -107,9 +107,9 @@ case 'dimension' : $value = $array_src_infos['width'] . 'x' . $array_src_infos['height']; break; - case 'thumbnail' : + /*case 'thumbnail' : $value = 'thumbnail'; - break; + break;*/ case 'time_add' : $name = i18n("Date Added"); $value = linStrftime($array_src_infos['time_add']); Copied: trunk/linpha2/lib/classes/linpha.static.view.album.class.php (from rev 4909, trunk/linpha2/lib/classes/linpha.imgview.class.php) =================================================================== --- trunk/linpha2/lib/classes/linpha.static.view.album.class.php (rev 0) +++ trunk/linpha2/lib/classes/linpha.static.view.album.class.php 2008-04-02 20:54:22 UTC (rev 4915) @@ -0,0 +1,494 @@ +<?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * This class takes care of all different views (thumb view, menus...) + * @package Image + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + +require_once(LINPHA_DIR . '/lib/classes/linpha.view.album.class.php'); + +class LinViewAlbumStatic extends LinViewAlbum { + +public $mode; // 'home', 'thumb', 'image' +public $modulename; // 'albums', 'browse', ... +public $tot_photos; +public $photos; +public $photos_filtered; +public $idParent, $img_type, $filename, $md5sum, $org_width, $org_height; +private $nr_pages, $current_page; // only used if javascript disabled + +/** + * constructor + */ +function __construct() +{ +} + +/** + * set current view and set fileinfos of $GLOBALS['linpha']->template->idCurrent ($_GET['linId']) + * @param string $modulname (album, browse, search, ...) + */ +function setCurrentView($modulename) +{ + $this->modulename = $modulename; + + + if( $GLOBALS['linpha']->template->idCurrent == 0 ) + { + /** + * on top view, reset current view + */ + if($this->modulename=='albums') + { + $this->mode = 'home'; + } + else // $this->modulename=='browse' | 'search' , others will come.. + { + $this->mode = 'thumb'; + } + } + else + { + /** + * set file informations + */ + $current_data = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum, width, height FROM ".LIN_PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); + /** + * check for valid id + */ + + if( isset($current_data['id']) ) + { + $this->img_type = $current_data['img_type']; + $this->filename = $current_data['name']; + $this->md5sum = $current_data['md5sum']; + $this->org_width = $current_data['width']; + $this->org_height = $current_data['height']; + + /** + * switch between thumb_view and img_view + */ + if( $this->img_type == 0) + { + $this->mode = 'thumb'; + $this->idParent = $current_data['id']; // use current_id as parent_id, because we want to see the content of the actual folder! + } + else + { + $this->mode = 'image'; + $this->idParent = $current_data['parent_id']; // use parent_id on image view + } + } + else // no valid id supplied + { + $this->mode = 'home'; + $GLOBALS['linpha']->template->idCurrent = 0; + } + } + + if ($this->mode == 'thumb' && !isset($_SESSION['mode_thumbview'])) + { + $_SESSION['mode_thumbview'] = 'thumb'; + } + + $this->setSortOrder(); + + /** + * set idParent to a default value + */ + if (!isset( $this->idParent)) + { + $this->idParent = $GLOBALS['linpha']->template->idCurrent; + } +} + +/** + * main function to prepare desired layout view + */ +function buildImgView() +{ + $this->filterPhotosNotPermitted(); + + /** + * set mode specific things + */ + switch($this->mode) + { + case 'home': + $this->viewHome(); + break; + case 'thumb': + $this->viewThumb(); + break; + case 'image': + $this->viewImg(); + break; + } + + /** + * at this point, there should be absolute no output + */ + require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); +} + +/** + * setup main/home view layout + */ +function viewHome() +{ + parent::viewHome(); +} + + +/** + * define thumbnail view + */ +function viewThumb() +{ + $this->tot_photos = count($this->photos_filtered); + + /** + * create thumbnail info text (filename, description, etc.) + */ + $i=0; + + foreach($this->photos_filtered as $key=>$photo_value) + { + if($_SESSION['mode_thumbview'] == 'thumbdetail') { + $flag_nr = 14; // flag nr of thumbdetail + } else { + $flag_nr = 13; // flag nr of thumb + } + + $array_image_infos = LinMetaData::readInformations($photo_value,$flag_nr); + + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']] = ''; + $i=0; + foreach($array_image_infos as $value) + { + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']] .= $value['value'].'<br />'; // $value['value'] is already escaped + } + + $GLOBALS['linpha']->template->output['thumb_title'][$photo_value['id']] = $photo_value['name']; // $photo_value['name'] is already escaped + } + + $GLOBALS['linpha']->template->setModuleName('static.view_thumb'); + + $this->viewThumbNojs(); +} + +/** + * thumbnail view with javascript disabled (static) + * @uses LinImgView::viewThumb() + */ +function viewThumbNojs() +{ + /** + * prepare variables + */ + $max_photos_per_page = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrrows'] * $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrcols']; + $this->nr_pages = ceil( $this->tot_photos / $max_photos_per_page ); + if(isset($_GET['pn']) && $_GET['pn'] > 1) + { + $this->current_page = $_GET['pn']; + } + else + { + $_GET['pn'] = 1; + $this->current_page = 1; + } + + + $this->viewThumbNojsWritePageNumbers(); + + /** + * create array $this->photos_show which contains only the photos of the current page + */ + if ($this->tot_photos > 0) // only if not all entries were folders + { + $img_nr = 1; + $i = 0; + $startup_img_nr = ($this->current_page - 1)*$max_photos_per_page; + + foreach ($this->photos_filtered as $value) + { + if ($i >= $startup_img_nr && $img_nr <= $max_photos_per_page) // add images only while in current page + { + $this->photos_show[] = $value; + $img_nr++; + } + $i++; + } + } +} + +/** + * setup page numbers (only used if static) + */ +function viewThumbNojsWritePageNumbers() +{ + /** + * writing page numbers + */ + $start_nr = 1; + + /** + * write left and right '...' if more than 10 pages + */ + $left_dots = ""; + $right_dots = ""; + if($this->nr_pages > 10) + { + $start_nr = $_GET['pn']; + + if($_GET['pn'] >= $this->nr_pages-5) // we reached end of album + { + $start_nr = $this->nr_pages-10; + $left_dots = "... "; + } + elseif($start_nr <=5 ) // we are at the beginning + { + $this->nr_pages = 10; + $start_nr = 1; + $right_dots = " ..."; + } + else + { + $this->nr_pages = $start_nr+5; + $start_nr -= 5; + if($_GET['pn']!="6") : $left_dots="... "; endif; + $right_dots=" ..."; + } + } + + $GLOBALS['linpha']->template->output['page_nr'] = $left_dots; + + for($i=$start_nr; $i <= $this->nr_pages; $i++) + { + if($i == $this->current_page) + { + $GLOBALS['linpha']->template->output['page_nr'] .= $i.' '; + } + else + { + $GLOBALS['linpha']->template->output['page_nr'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.$i.'">'.$i.'</a> '; + } + } + + $GLOBALS['linpha']->template->output['page_nr'] .= $right_dots; + + /** + * write starting ' << ' and ' < ' + */ + if($this->current_page != 1) + { + $GLOBALS['linpha']->template->output['page_nr_left'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn=1"><<</a> ' . + '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page-1).'"><</a> '; + } + else + { + $GLOBALS['linpha']->template->output['page_nr_left'] = '<< <'; + } + + /** + * write ending '>' and '>>' + */ + if($this->current_page != $this->nr_pages && $this->nr_pages != 0) // need check nr_pages != 0 because we don't need links if nr_pages == 0! + { + $GLOBALS['linpha']->template->output['page_nr_right'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page+1).'">></a> ' . + '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->nr_pages).'">>></a> '; + } + else + { + $GLOBALS['linpha']->template->output['page_nr_right'] = '> >>'; + } +} + + + + +/** + * setup image view + */ +function viewImg() +{ + $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); + + if( LinIdentify::isVideo( $this->img_type )) // in video mode, the video thumbnail is shown instead of the image + { + $this->img_width = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; + $this->img_height = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; + } + else + { + $max_width = $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; + $max_height = $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; + $array = LinImage::scaleToFit($this->org_width,$this->org_height,$max_width,$max_height); + + $this->img_width = $array['w']; + $this->img_height = $array['h']; + } + + $this->viewImgSetPrevNextThumb(); + $this->viewImgComments(); + + + $GLOBALS['linpha']->template->output['image_infos'] = LinMetaData::readInformations( + $this->photos_filtered[$this->current_key], $flag_nr=10); + + $GLOBALS['linpha']->template->setModuleName('static.view_img'); +} + +/** + * set prev/next thumb for img_view and meta_view + */ +function viewImgSetPrevNextThumb() +{ + $nr_prev_next_thumbs = $GLOBALS['linpha']->sql->config->value['sys_style_image_nrprevnextthumbs']; + + /** + * search current key in array + */ + foreach ($this->photos_filtered as $key=>$value) + { + if ($value['id'] == $GLOBALS['linpha']->template->idCurrent) + { + $this->current_key = $key; + break; + } + } + + /** + * ooh, something went wrong + */ + if (!isset($this->current_key)) + { + $this->current_key = 0; + } + + /** + * set prev thumbs + */ + $GLOBALS['linpha']->template->output['prev_thumb'] = ''; + for($i=$nr_prev_next_thumbs; $i > 0; $i--) + { + if($this->current_key >= $i) + { + $GLOBALS['linpha']->template->output['prev_thumb'] .= $this->viewImgThumbHtml( $this->current_key - $i , 'PrevNext' ); + } + } + + /** + * set next thumbs + */ + $GLOBALS['linpha']->template->output['next_thumb'] = ''; + for($i=0; $i < $nr_prev_next_thumbs; $i++) + { + if($this->current_key < ( count($this->photos_filtered) - ($i+1) ) ) + { + $GLOBALS['linpha']->template->output['next_thumb'] .= $this->viewImgThumbHtml( $this->current_key + ($i+1) , 'PrevNext' ); + } + } + + /** + * set current image and thumb + */ + $GLOBALS['linpha']->template->output['current_thumb'] = $this->viewImgThumbHtml( $this->current_key , 'Current' ); +} + +/** + * generate html code for the prev/next thumbnail + */ +function viewImgThumbHtml($key,$class) +{ + $id = $this->photos_filtered[$key]['id']; + $name = $this->photos_filtered[$key]['name']; + + $str = '<div class="linDivThumbnavi_'.$class.'">' + . '<a href="'.$GLOBALS['linpha']->template->URL_base.'&linId='.$id.'">' + . '<img class="linImgThumbnavi_'.$class.'" src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$id.'" /></a>' + . '<br />'.$name.'</div>'."\n"; + + return $str; +} + +/** + * get/save image comments + */ +function viewImgComments() +{ + /** + * image comments + */ + if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) + { + /** + * save comment + */ + if( isset( $_POST['cmd'] ) && $... [truncated message content] |
From: <fan...@us...> - 2008-04-01 20:40:16
|
Revision: 4914 http://linpha.svn.sourceforge.net/linpha/?rev=4914&view=rev Author: fangehrn Date: 2008-04-01 13:40:02 -0700 (Tue, 01 Apr 2008) Log Message: ----------- 2008-04-01 flo * improved menu handling (enable/disable items) * implemented "view at" function Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.view.album.class.php trunk/linpha2/lib/js/LinYUIAlbum.js trunk/linpha2/templates/default/global.head.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/themes/default/css/viewer.css trunk/linpha2/templates/default/viewer.head.php trunk/linpha2/templates/default/viewer.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/ChangeLog 2008-04-01 20:40:02 UTC (rev 4914) @@ -1,4 +1,8 @@ +2008-04-01 flo + * improved menu handling (enable/disable items) + * implemented "view at" function + 2008-03-30 flo * JSCookMenu fixed bug in cmEnableItem() reported here: http://sourceforge.net/tracker/index.php?func=detail&aid=1766028&group_id=149372&atid=778279 Modified: trunk/linpha2/lib/classes/linpha.view.album.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-04-01 20:40:02 UTC (rev 4914) @@ -156,6 +156,8 @@ } else { $this->orderby = $this->getSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_others_sortorder'], $str_asc); } + + $GLOBALS['linpha']->template->output['sort_order_asc'] = $str_asc; } if ($this->mode == 'thumb') Modified: trunk/linpha2/lib/js/LinYUIAlbum.js =================================================================== --- trunk/linpha2/lib/js/LinYUIAlbum.js 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/lib/js/LinYUIAlbum.js 2008-04-01 20:40:02 UTC (rev 4914) @@ -19,6 +19,8 @@ this.TabView = null; this.Tabs = new Array(); //this.activeTabLabel = null; + + this.panelViewAt = null; }; // initHistoryManager() @@ -107,24 +109,26 @@ } if (!this.initialized) { + this.updateSortMenu(linSortOrder); this.initHistoryManager(); // this will call showAlbum() or showImage() this.initialized = true; - } - - if (this.mode == 'thumb') { + } else if (this.mode == 'thumb') { this.showAlbum(); } else if (this.mode == 'image') { this.showAlbum(); this.changeImage(linIdCurrent); - } - + } } // openAlbum() YAHOO.linpha.Album.prototype.openAlbum = function() { + + YAHOO.log("openAlbum()"); + try { YAHOO.util.History.navigate("linphaViewer", "album"); } catch (e) { + YAHOO.log("openAlbum(): opera fallback"); this.showAlbum(); // opera fallback } }; @@ -136,7 +140,7 @@ YAHOO.util.Dom.setStyle('linDivThumbs', "display", "none"); myLinPage.setTitle(this.album.TitleUrl); - cmDisableItem(myMenu[6][8], "ThemePanel") // disable menu entry "Image" + cmDisableItem(myMenu[6][8], "ThemePanel") // disable menu entry "Image" (i don't know how to get the image menu entry dynamically) htmlstr = []; @@ -161,6 +165,14 @@ YAHOO.util.Dom.setStyle('linDivTabs', "display", "none"); YAHOO.util.Dom.setStyle('linDivImage', "display", "none"); //YAHOO.util.Dom.setStyle('linDivNav', "display", "block"); + + if (linStartupId != 0) + { + this.mode = 'thumb'; // important to prevent endless loop + this.openImage(linStartupId); // no changeImage() !! history manager has to be updated, otherwise future calls to openAlbum() would not work + linStartupId = 0; + return; + } myLinPage.setResizeMode('thumb'); @@ -170,11 +182,6 @@ } this.mode = 'thumb'; - if (linStartupId != 0) { - this.changeImage(linStartupId); - } - - YAHOO.util.Dom.setStyle('linDivThumbs', "display", "block"); }; @@ -216,7 +223,7 @@ myLinPage.setTitle(this.album.TitleUrl + ' > <a href="javascript:myLinAlbum.openImage('+imgId+')">' + this.album.Thumbs[this.currentIndex].title + '</a>' ); - cmEnableItem(myMenu[6][8], "ThemePanel") // enable menu entry "Image" + cmEnableItem(myMenu[6][8], "ThemePanel") // enable menu entry "Image" (i don't know how to get the image menu entry dynamically) /** * hide elements @@ -227,12 +234,12 @@ YAHOO.util.Dom.setStyle('linDivOtherInfo', "display", "none"); // handle coming from thumb (or init) - if (this.mode != 'image') { - + if (this.mode != 'image') + { + YAHOO.util.Dom.setStyle('linDivThumbs', "display", "none"); YAHOO.util.Dom.setStyle('linDivDescription', "display", "none"); YAHOO.util.Dom.setStyle('linImgMainImage', "display", "none"); - YAHOO.util.Dom.setStyle('linDivThumbs', "display", "none"); this.mode = 'image'; //YAHOO.util.Dom.setStyle('linDivThumbs', "display", "none"); @@ -602,10 +609,77 @@ YAHOO.linpha.Album.prototype.changeSortOrder = function(order) { this.loadAlbum( '&linOrderBy='+order ); - //cmDisableItem(myMenu[11], 'linMenu') - //cmGetMenuItem(myMenu[11]) + // setTimeout is required because the menu is at the moment still open and will change his css classes when it closes + if (order=="ASC") { + setTimeout("myLinAlbum.updateSortMenu(\"ASC\");", 1000); + } else if(order=="DESC") { + setTimeout("myLinAlbum.updateSortMenu(\"DESC\");", 1000); + } }; +// updateSortMenu() +YAHOO.linpha.Album.prototype.updateSortMenu = function(order) { + + // enable/disable menu entry "Sort - ASC/DESC" (i don't know how to get the image menu entry dynamically) + + YAHOO.log(order); + if (order=="ASC") + { + cmDisableItem(myMenu[6][6][5], "ThemePanel"); + cmEnableItem(myMenu[6][6][6], "ThemePanel"); + } + else if(order=="DESC") + { + cmEnableItem(myMenu[6][6][5], "ThemePanel"); + cmDisableItem(myMenu[6][6][6], "ThemePanel"); + } +} + +// viewImageAt() +YAHOO.linpha.Album.prototype.viewImageAt = function(width, height) { + //alert( width + ' ' + height ); + + /*linYUILoader.onSuccess = function(width, height) { + var panel = new YAHOO.widget.Panel("panelViewAt", { width: "320px" } ); + panel.setHeader("Panel #2 from Script"); + panel.setBody("This is a dynamically generated Panel. " + width + ' ' + height + ' ' + linIdCurrent); + panel.setFooter("End of Panel #2"); + panel.render( "linPanelContainer" ); + };*/ + /*"this.viewImageAtShow("+width+", "+height+")";*/ + + this.viewAtWidth = width; + this.viewAtHeight = height; + linYUILoader.onSuccess = this.viewImageAtShow; + + linYUILoader.require(["dragdrop", "container"]); + linYUILoader.insert(); +}; +// viewImageAtShow() +YAHOO.linpha.Album.prototype.viewImageAtShow = function() { + linYUILoader.onSuccess = null; + //alert( myLinAlbum.viewAtWidth + ' ' + myLinAlbum.viewAtHeight + ' ' + linIdCurrent ); + + if (myLinAlbum.panelViewAt != null) { + document.getElementById("linPanelContainer").innerHTML = ""; + } + + myLinAlbum.panelViewAt = new YAHOO.widget.Panel("linPanelViewAt", { close: true, visible: true, + x: YAHOO.util.Dom.getDocumentScrollLeft()+80, y: YAHOO.util.Dom.getDocumentScrollTop()+130, monitorresize: false /*zindex: 200*/ } ); + myLinAlbum.panelViewAt.setHeader(myLinAlbum.album.Thumbs[myLinAlbum.ThumbIds[linIdCurrent]].title); + myLinAlbum.panelViewAt.setBody("<img src=\""+linImageSrc+linIdCurrent+"&width="+myLinAlbum.viewAtWidth+"&height="+myLinAlbum.viewAtHeight+"\" />" ); + + if (myLinAlbum.viewAtWidth == 0) { + myLinAlbum.panelViewAt.setFooter(myLinAlbum.album.Thumbs[myLinAlbum.ThumbIds[linIdCurrent]].w + +"x"+myLinAlbum.album.Thumbs[myLinAlbum.ThumbIds[linIdCurrent]].h); + } else { + myLinAlbum.panelViewAt.setFooter(myLinAlbum.viewAtWidth+"x"+myLinAlbum.viewAtHeight); + } + myLinAlbum.panelViewAt.render( /*document.body*/ "linPanelContainer" ); +}; + + + myLinPage.enableOnResize('thumb'); var myLinAlbum = new YAHOO.linpha.Album(); Modified: trunk/linpha2/templates/default/global.head.php =================================================================== --- trunk/linpha2/templates/default/global.head.php 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/templates/default/global.head.php 2008-04-01 20:40:02 UTC (rev 4914) @@ -72,7 +72,8 @@ <?php if (linUseAjax()) { ?> <!-- Load the YUI Loader script: --> -<script src="http://yui.yahooapis.com/2.5.0/build/yuiloader/yuiloader-beta-min.js"></script> +<!--<script src="http://yui.yahooapis.com/2.5.0/build/yuiloader/yuiloader-beta-min.js"></script> --> +<script src="http://yui.yahooapis.com/2.5.0/build/yuiloader/yuiloader-beta.js"></script> <script type="text/javascript" language="Javascript"> var linYUILoader = new YAHOO.util.YUILoader({ require: ["logger"/*, "menu"*/], Modified: trunk/linpha2/templates/default/menu.html.php =================================================================== --- trunk/linpha2/templates/default/menu.html.php 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/templates/default/menu.html.php 2008-04-01 20:40:02 UTC (rev 4914) @@ -8,7 +8,7 @@ <!-- var myMenu = <?php linSetMenuJS(); ?>; linReplaceJSCookObjects(myMenu); -cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); +cmDraw('linDivMenu', myMenu, 'hbr', cmThemePanel); function linReloadMenu(formElem) { @@ -19,10 +19,10 @@ function linRedrawMenu(t) { try { - //myMenuReload = eval('(' + t.responseText + ')'); - myMenuReload = YAHOO.lang.JSON.parse(t.responseText); - linReplaceJSCookObjects(myMenuReload); - cmDraw ('linDivMenu', myMenuReload, 'hbr', cmThemePanel); + //myMenu = eval('(' + t.responseText + ')'); + myMenu = YAHOO.lang.JSON.parse(t.responseText); + linReplaceJSCookObjects(myMenu); + cmDraw('linDivMenu', myMenu, 'hbr', cmThemePanel); } catch (e) { alert("Error reloading menu (" + e + ")"); Modified: trunk/linpha2/templates/default/themes/default/css/viewer.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/viewer.css 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/templates/default/themes/default/css/viewer.css 2008-04-01 20:40:02 UTC (rev 4914) @@ -121,6 +121,26 @@ /*height: 200px; min height set in DefsThumbView.js */ overflow: auto; } + +/** + * view at panel + */ +#linPanelContainer { + width: 660px; /* required */ + font-size: 0; /* for IE */ +} +#linPanelViewAt .hd { + font-size: medium; +} +#linPanelViewAt .bd { + width: 668px; + height: 495px; + overflow: auto; + font-size: medium; +} +#linPanelViewAt .ft { + font-size: medium; +} /** * slideshow Modified: trunk/linpha2/templates/default/viewer.head.php =================================================================== --- trunk/linpha2/templates/default/viewer.head.php 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/templates/default/viewer.head.php 2008-04-01 20:40:02 UTC (rev 4914) @@ -18,6 +18,7 @@ var linTnSizeOther = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; ?>; var linPreloadImages = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_nrPreloadImages']; ?>; var linStartupId = <?php echo (isset($linTpl->output['startup_id']) ? $linTpl->output['startup_id'] : 0); ?>; +var linSortOrder = '<?php echo $linTpl->output['sort_order_asc']; ?>'; var linAlbum = <?php echo $linTpl->output['thumb_list']."\n"; ?>; if (linUseEffects) { Modified: trunk/linpha2/templates/default/viewer.html.php =================================================================== --- trunk/linpha2/templates/default/viewer.html.php 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/templates/default/viewer.html.php 2008-04-01 20:40:02 UTC (rev 4914) @@ -1,3 +1,5 @@ +<div id="linPanelContainer" class="yui-skin-sam"></div> + <!-- navigation --> <?php if(isset($linTpl->output['navigation']) && !empty($linTpl->output['navigation'])) { ?> <?php echo $linTpl->divRoundCorners('top','main'); ?> @@ -50,7 +52,7 @@ <ul id="linUlTabNav" class="yui-nav"></ul> <div id="linDivTabContent" class="yui-content"></div> </div> - + </div> <?php echo $linTpl->divRoundCorners('bottom','main'); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-30 22:08:10
|
Revision: 4913 http://linpha.svn.sourceforge.net/linpha/?rev=4913&view=rev Author: fangehrn Date: 2008-03-30 15:08:03 -0700 (Sun, 30 Mar 2008) Log Message: ----------- 2008-03-30 flo * JSCookMenu fixed bug in cmEnableItem() reported here: http://sourceforge.net/tracker/index.php?func=detail&aid=1766028&group_id=149372&atid=778279 * Disable submenu "image" in thumb mode * search, newimg, browse: changed to new AlbumView class * added transparency to search image 2008-03-18 flo * implemented order by feature 2008-03-15 flo * fixed some IE bugs everything should now work fine on firefox/opera/IE 2008-03-13 flo * finished fullscreen/slideshow/navigation 2008-03-09 flo * re-design thumb and image view Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/permissions_readwrite.php trunk/linpha2/docs/dev/external_libraries.txt trunk/linpha2/index.php trunk/linpha2/lib/classes/adodb-exceptions.inc.php trunk/linpha2/lib/classes/linpha.admin.class.php trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.identify.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/classes/linpha.view.album.class.php trunk/linpha2/lib/classes/linpha.view.image.class.php trunk/linpha2/lib/include/calendar.php trunk/linpha2/lib/include/metadata_info_show.php trunk/linpha2/lib/include/sql/sql.data.php trunk/linpha2/lib/js/LinThumbnails.js trunk/linpha2/lib/js/LinYUIAlbum.js trunk/linpha2/lib/js/LinYUIAlbumNavigation.js trunk/linpha2/lib/js/LinYUIGlobal.js trunk/linpha2/lib/js/LinYUIPage.js trunk/linpha2/lib/lang/lang.German.php trunk/linpha2/lib/modules/module.ajax.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/lib/modules/module.download.php trunk/linpha2/lib/modules/module.image.php trunk/linpha2/lib/modules/module.newimg.php trunk/linpha2/lib/modules/module.panorama.php trunk/linpha2/lib/modules/module.search.php trunk/linpha2/lib/modules/module.settings.php trunk/linpha2/lib/plugins/example/module.example.php trunk/linpha2/lib/plugins/filemanager/module.filemanager.php trunk/linpha2/lib/plugins/filemanager/sql/sql.data.php trunk/linpha2/templates/default/fragments.php trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/home.html.php trunk/linpha2/templates/default/menu.head.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/search.html.php trunk/linpha2/templates/default/slideshow.js.php trunk/linpha2/templates/default/tabs/comments.html.php trunk/linpha2/templates/default/tabs/exif.html.php trunk/linpha2/templates/default/themes/default/DefsThumbView.js trunk/linpha2/templates/default/themes/default/css/global.css trunk/linpha2/templates/default/themes/default/menu/theme.css Added Paths: ----------- trunk/linpha2/lib/graphics/xmag.png trunk/linpha2/lib/graphics/xmag_big.png trunk/linpha2/lib/modules/module.viewer.php trunk/linpha2/templates/default/global.head.php trunk/linpha2/templates/default/tabs/editIptcXmp.html.php trunk/linpha2/templates/default/tabs/editMeta.html.php trunk/linpha2/templates/default/themes/default/css/viewer.css trunk/linpha2/templates/default/viewer.head.php trunk/linpha2/templates/default/viewer.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/ChangeLog 2008-03-30 22:08:03 UTC (rev 4913) @@ -1,4 +1,17 @@ +2008-03-30 flo + * JSCookMenu fixed bug in cmEnableItem() reported here: + http://sourceforge.net/tracker/index.php?func=detail&aid=1766028&group_id=149372&atid=778279 + + * Disable submenu "image" in thumb mode + * search, newimg, browse: + changed to new AlbumView class + + * added transparency to search image + +2008-03-18 flo + * implemented order by feature + 2008-03-15 flo * fixed some IE bugs everything should now work fine on firefox/opera/IE Modified: trunk/linpha2/admin/permissions_readwrite.php =================================================================== --- trunk/linpha2/admin/permissions_readwrite.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/admin/permissions_readwrite.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -3,36 +3,45 @@ if($cat2 == 'view') { - $sql_perm_type = 'read'; + $sql_perm_type = 'read'; } elseif($cat2 == 'write') { - $sql_perm_type = 'write'; - - ?> - <br /><hr /><br /> - <form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_'.$cat2; ?>"> - <?php - if(isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') - { - $LinAdmin->saveConfig( - Array( - 'plugins_filemanager_userEnable' - ) - ); - } - - $LinAdmin->printAdminConfig('radio',$LinAdmin->getDescriptionByOptionName('plugins_filemanager_userEnable'),'plugins_filemanager_userEnable',$LinAdmin->option_value_system['plugins_filemanager_userEnable']); - - ?> - <input type="hidden" name="cmd" value="saveconfig" /> - <input type="submit" name="submit" value="<?php echo i18n("Submit"); ?>" /> - </form> - <br /><hr /><br /> - <?php + if (!isset($GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable'])) { + ?> + <a href="./?cat=settings_plugins"><?php echo i18n("Enable Filemanager Plugin") ?></a> + <?php + } else { + + $sql_perm_type = 'write'; + + ?> + <br /><hr /><br /> + <form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_'.$cat2; ?>"> + <?php + if(isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') + { + $LinAdmin->saveConfig( + array( + 'plugins_filemanager_userEnable' + ) + ); + } + + $LinAdmin->printAdminConfig('radio',$LinAdmin->getDescriptionByOptionName('plugins_filemanager_userEnable'),'plugins_filemanager_userEnable',$LinAdmin->option_value_system['plugins_filemanager_userEnable']); + + ?> + <input type="hidden" name="cmd" value="saveconfig" /> + <input type="submit" name="submit" value="<?php echo i18n("Submit"); ?>" /> + </form> + <br /><hr /><br /> + <?php + } } -if($cat2 == 'view' OR ($cat2 == 'write' AND $GLOBALS['linpha']->sql->config->value['plugins_filemanager_userEnable'] )) +if($cat2 == 'view' || ($cat2 == 'write' + && isset($GLOBALS['linpha']->sql->config->value['plugins_filemanager_userEnable']) + && $GLOBALS['linpha']->sql->config->value['plugins_filemanager_userEnable'] )) { /** @@ -193,8 +202,8 @@ <input type="hidden" name="photo_id" value="<?php echo $linpha->template->idCurrent; ?>" /> <input type="hidden" name="parent_id" value="<?php echo $parent_id; ?>" /> <input type="hidden" name="cmd" value="save_permissions" /> - <input type="submit" name="submit" value="save" /> - <a href="<?php echo LINPHA_DIR.'/admin/?cat=permissions_'.$cat2.'&parent_id='.$parent_id; ?>">cancel</a> + <input type="submit" name="submit" value="<?php echo i18n("Save"); ?>" /> + <a href="<?php echo LINPHA_DIR.'/admin/?cat=permissions_'.$cat2.'&parent_id='.$parent_id; ?>"><?php echo i18n("Cancel"); ?></a> </form> <br /><br /> <?php @@ -248,7 +257,7 @@ * exclude files */ if($data['img_type'] == 0 // show folders - || ($GLOBALS['view_mode']=='files' && $GLOBALS['cat2']=='read') // show files if we not on top (and it doesnt make sense to give write permissions to the file itself) + || ($GLOBALS['view_mode']=='files' && $GLOBALS['cat2']=='view') // show files if we not on top (and it doesnt make sense to give write permissions to the file itself) || ( $data['img_type'] != 0 && $i == 0 ) ) // show files which have permissions explicitly set (not inherited) { echo '<tr><td>'; Modified: trunk/linpha2/docs/dev/external_libraries.txt =================================================================== --- trunk/linpha2/docs/dev/external_libraries.txt 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/docs/dev/external_libraries.txt 2008-03-30 22:08:03 UTC (rev 4913) @@ -4,6 +4,13 @@ - scriptaculous 1.8.0 (contains prototype) - prototype 1.6.0 +- JSCookMenu + CHANGES + ------- + fixed bug in cmEnableItem() reported here: + http://sourceforge.net/tracker/index.php?func=detail&aid=1766028&group_id=149372&atid=778279 + + - adodb - getid3 1.7.7 Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/index.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -59,9 +59,6 @@ case 'newimg': require_once(LINPHA_DIR.'/lib/modules/module.newimg.php'); break; -case 'metadata': - require_once(LINPHA_DIR.'/lib/include/metadata_info_show.php'); - break; case 'video': require_once(LINPHA_DIR.'/lib/modules/module.video.php'); break; Modified: trunk/linpha2/lib/classes/adodb-exceptions.inc.php =================================================================== --- trunk/linpha2/lib/classes/adodb-exceptions.inc.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/adodb-exceptions.inc.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -1,82 +1,82 @@ -<?php - -/** - * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. - * Released under both BSD license and Lesser GPL library license. - * Whenever there is any discrepancy between the two licenses, - * the BSD license will take precedence. - * - * Set tabs to 4 for best viewing. - * - * Latest version is available at http://php.weblogs.com - * - * Exception-handling code using PHP5 exceptions (try-catch-throw). - */ - - -if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR); -define('ADODB_ERROR_HANDLER','adodb_throw'); - -class ADODB_Exception extends Exception { -var $dbms; -var $fn; -var $sql = ''; -var $params = ''; -var $host = ''; -var $database = ''; - - function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) - { - switch($fn) { - case 'EXECUTE': - $this->sql = $p1; - $this->params = $p2; - $s = "$dbms error: [$errno: $errmsg] in $fn(\"$p1\")\n"; - break; - - case 'PCONNECT': - case 'CONNECT': - $user = $thisConnection->user; - $s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)\n"; - break; - default: - $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n"; - break; - } - - $this->dbms = $dbms; - if ($thisConnection) { - $this->host = $thisConnection->host; - $this->database = $thisConnection->database; - } - $this->fn = $fn; - $this->msg = $errmsg; - - if (!is_numeric($errno)) $errno = -1; - parent::__construct($s,$errno); - } -} - -/** -* Default Error Handler. This will be called with the following params -* -* @param $dbms the RDBMS you are connecting to -* @param $fn the name of the calling function (in uppercase) -* @param $errno the native error number from the database -* @param $errmsg the native error msg from the database -* @param $p1 $fn specific parameter - see below -* @param $P2 $fn specific parameter - see below -*/ - -function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) -{ -global $ADODB_EXCEPTION; - - if (error_reporting() == 0) return; // obey @ protocol - if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION; - else $errfn = 'ADODB_EXCEPTION'; - throw new $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection); -} - - +<?php + +/** + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * Released under both BSD license and Lesser GPL library license. + * Whenever there is any discrepancy between the two licenses, + * the BSD license will take precedence. + * + * Set tabs to 4 for best viewing. + * + * Latest version is available at http://php.weblogs.com + * + * Exception-handling code using PHP5 exceptions (try-catch-throw). + */ + + +if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR); +define('ADODB_ERROR_HANDLER','adodb_throw'); + +class ADODB_Exception extends Exception { +var $dbms; +var $fn; +var $sql = ''; +var $params = ''; +var $host = ''; +var $database = ''; + + function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) + { + switch($fn) { + case 'EXECUTE': + $this->sql = $p1; + $this->params = $p2; + $s = "$dbms error: [$errno: $errmsg] in $fn(\"$p1\")\n"; + break; + + case 'PCONNECT': + case 'CONNECT': + $user = $thisConnection->user; + $s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)\n"; + break; + default: + $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n"; + break; + } + + $this->dbms = $dbms; + if ($thisConnection) { + $this->host = $thisConnection->host; + $this->database = $thisConnection->database; + } + $this->fn = $fn; + $this->msg = $errmsg; + + if (!is_numeric($errno)) $errno = -1; + parent::__construct($s,$errno); + } +} + +/** +* Default Error Handler. This will be called with the following params +* +* @param $dbms the RDBMS you are connecting to +* @param $fn the name of the calling function (in uppercase) +* @param $errno the native error number from the database +* @param $errmsg the native error msg from the database +* @param $p1 $fn specific parameter - see below +* @param $P2 $fn specific parameter - see below +*/ + +function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) +{ +global $ADODB_EXCEPTION; + + if (error_reporting() == 0) return; // obey @ protocol + if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION; + else $errfn = 'ADODB_EXCEPTION'; + throw new $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection); +} + + ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.admin.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.admin.class.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.admin.class.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -91,7 +91,8 @@ 'plugins_rss' => i18n("RSS"), 'plugins_watermark' => i18n("Watermark"), - + 'plugins_filemanager_userEnable' => i18n("Enable filemanager for non-admin users"), + 'plugins_log_filename' => i18n("Log to this filename"), 'plugins_log_syslog_enable' => i18n("Send important messages to syslog"), 'plugins_log_syslog_add_events' => i18n("Additional log events sent to syslog"), Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.class.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -25,15 +25,15 @@ if(!defined('LINPHA_DIR')) { exit(1); } -include_once(LINPHA_DIR.'/lib/classes/linpha.sql.class.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.template.class.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.sql.class.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.template.class.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.image.class.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.filesys.class.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.import.class.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.identify.class.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.functions.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.image.class.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.filesys.class.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.import.class.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.identify.class.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.functions.php'); class Linpha { @@ -125,7 +125,6 @@ define('LIN_STR_ACCESSDENIED', i18n("Error: Access denied") ); define('LIN_STR_NOVALIDDATA', i18n("Error: No valid data") ); -define('LIN_STR_CHKFILEPERM', i18n("Check file permissions") ); +define('LIN_STR_CHKFILEPERM', i18n("Error: File not writable. Please check the file permissions.") ); - ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.functions.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -239,6 +239,8 @@ /** * print a nice navigation line with links on each entry + * + * @uses filemanager, basket */ function linSetNavigationLine( $id, $link ) { @@ -306,34 +308,8 @@ } } -/** - * returns an array with the sort orders - */ -function linGetSortOrders() -{ - return Array( - 'nameasc' => i18n("Name Asc"), - 'namedesc' => i18n("Name Desc"), - 'dateasc' => i18n("Date Asc"), - 'datedesc' => i18n("Date Desc") - ); -} /** - * return the correct sql order string - */ -function linGetSqlSortOrder($order) -{ - switch($order) - { - case 'nameasc': return "name ASC"; - case 'namedesc': return "name DESC"; - case 'dateasc': return "time_add ASC"; - case 'datedesc': return "time_add DESC"; - } -} - -/** * explode string to array and remove first and last entry of array because they are empty */ function linExplodeAndSlice($del,$string) @@ -353,6 +329,18 @@ } /** + * Javascript strings must be surrounded with double quotes + * (-> there is no need to escape single quotes) + * + * @param string $str + * @return escape string + */ +function linEscapeQuotes($str) +{ + return str_replace('"','\\"', $str); +} + +/** * some functions to calculate the page rendering time * this is very useful while trying to speed up LinPHA :-) */ @@ -496,14 +484,7 @@ */ function linUseAjax() { - if( isset($_SESSION['use_js']) && ! isset($_SESSION['disable_ajax']) ) - { - return true; - } - else - { - return false; - } + return isset($_SESSION['linUseAjax']) && ! isset($_SESSION['linDisableAjax']); } Modified: trunk/linpha2/lib/classes/linpha.identify.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.identify.class.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.identify.class.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -101,12 +101,14 @@ function getShortFileType( $img_type ) { - if( LinIdentify::isSupportedImage( $img_type )) { + if (LinIdentify::isSupportedImage( $img_type )) { return 1; - } elseif( LinIdentify::isVideo( $img_type )) { + } elseif (LinIdentify::isVideo( $img_type )) { return 2; - } else { + } elseif ($img_type==0) { return 0; + } else { + return LinIdentify::$ImageTypes['unsupported']; } } @@ -280,12 +282,10 @@ $type = trim($type); $type = strtolower($type); - $imagetypes = LinIdentify::getImagetypeTranslationArray(); - - if(array_key_exists($type,$imagetypes)) { - $orgtype = $imagetypes[$type]; + if(array_key_exists($type,LinIdentify::$ImageTypes)) { + $orgtype = LinIdentify::$ImageTypes[$type]; } else { - $orgtype = $imagetypes['unsupported']; + $orgtype = LinIdentify::$ImageTypes['unsupported']; } /** @@ -343,26 +343,23 @@ function getImagetypeFromFilename($filename) { $ext = LinFilesys::getFileExtFromPath($filename); - $imagetypes = LinIdentify::getImagetypeTranslationArray(); - if(array_key_exists($ext,$imagetypes)) { - return $imagetypes[$ext]; + if(array_key_exists($ext,LinIdentify::$ImageTypes)) { + return LinIdentify::$ImageTypes[$ext]; } else { - return $imagetypes['unsupported']; + return LinIdentify::$ImageTypes['unsupported']; } } /** - * gets an array with all imagetypes, fileext are the keys, imagetype the values + * array with all imagetypes, fileext are the keys, imagetype the values * see http://ch.php.net/manual/de/function.exif-imagetype.php * * @author flo * @return array keys=>value, fileext=>imagetype * @uses get_imagetype_from_filename(),convert_imagetype() */ -function getImagetypeTranslationArray() -{ - $array = Array( +static $ImageTypes = array( // getimagesize starts here 'gif' => 1, @@ -553,8 +550,6 @@ 'unsupported' => 9999999 ); - return $array; -} // end function getImagetypeTranslationArray() -} // end class linIdentify +} // end class LinIdentify ?> Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -393,16 +393,6 @@ if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { /** - * Write "own" linpha MetaData fields - */ - if(isset($_POST['linCmd']) - && $_POST['linCmd'] == 'linInsertMetaLinpha') - { - LinMetaData::saveModifiedMetaDataLinpha(); - linSysLog(i18n("Successfully updated data.")); - } - - /** * Write IPTC/XMP MetaData to file */ if(isset($_POST['linCmd']) @@ -596,22 +586,21 @@ * @return none * @author flo */ - public function saveModifiedMetaDataLinpha() + public function saveModifiedMetaDataLinpha($md5sum) { - if(isset($_POST['linMetaField']) - && is_array($_POST['linMetaField'])) + if(isset($_POST['linMetaField']) && is_array($_POST['linMetaField'])) { /** * Delete existing entries */ $query = $GLOBALS['linpha']->db->Execute("DELETE FROM " . "".LIN_PREFIX."meta_data " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); + "WHERE md5sum = '".$md5sum."'"); /** * Insert new entries */ - foreach($_POST['linMetaField'] AS $key => $value) + foreach($_POST['linMetaField'] as $key => $value) { if(is_array($value)) // coming from a select (categories etc.) { @@ -622,7 +611,7 @@ { $GLOBALS['linpha']->db->Execute("INSERT " . "INTO ".LIN_PREFIX."meta_data (field_id, md5sum, meta_data) " . - "VALUES ('".LinSql::linAddslashes($key)."','".$GLOBALS['linpha']->imgview->md5sum."','".LinSql::linAddslashes($value)."')"); + "VALUES ('".LinSql::linAddslashes($key)."','".$md5sum."','".LinSql::linAddslashes($value)."')"); } } } @@ -631,7 +620,7 @@ /** * */ - public function showEditMetaData() + public function showEditMetaData($md5sum) { /** * set meta linpha @@ -653,8 +642,8 @@ $GLOBALS['linpha']->template->output['meta_linpha'] .= '</td><td>'; $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data FROM " . LIN_PREFIX . "meta_data " . - "WHERE md5sum = '" . $GLOBALS['linpha']->imgview->md5sum . "'" . - "AND field_id = '" . $data['id'] . "'"); + "WHERE md5sum = '" . $md5sum . "'" . + "AND field_id = '" . $data['id'] . "'"); switch ($data['field_type']) { case 1 : @@ -701,7 +690,7 @@ $GLOBALS['linpha']->template->output['meta_linpha'] .= '<option value="' . $cat_data['id'] . '"' . $checked . '>' . htmlspecialchars($cat_data['name'], ENT_QUOTES) . '</option>' . "\n"; } $GLOBALS['linpha']->template->output['meta_linpha'] .= '</select>' . "\n" . - '<br /><span style="font-size: smaller;">' . i18n("For Multiple Select Use CTRL") . '</span>'; + '<br /><span style="font-size: smaller;">' . i18n("For Multiple Select Use CTRL") . '</span>'; if ($GLOBALS['linpha']->sql->isAdmin()) { $GLOBALS['linpha']->template->output['meta_linpha'] .= '<br /><span style="font-size: smaller;"><a href="' . LINPHA_CLIENT . '/admin/?cat=metadata_define_adddata">' . i18n("Add More Options") . '</a><br /><br /></span>'; @@ -712,29 +701,6 @@ $GLOBALS['linpha']->template->output['meta_linpha'] .= '</td></tr>'; } - - /** - * set meta IPTC - */ - if ($GLOBALS['linpha']->sql->config->value['sys_image_iptc'] || $GLOBALS['linpha']->sql->config->value['sys_image_xmp']) { - if (isset ($GLOBALS['linpha']->imgview->src_file) && file_exists($GLOBALS['linpha']->imgview->src_file)) { - if (is_writable($GLOBALS['linpha']->imgview->src_file)) { - $meta_edit_possible = true; - $filename = $GLOBALS['linpha']->imgview->src_file; // used in IPTC Edit_File_Info.php - } else { - $meta_edit_possible = false; - } - } else { - $meta_edit_possible = false; - } - } - /** - * build the meta data view - */ - $fragment = 'edit_meta'; - global $linTpl; - include (LINPHA_DIR . '/templates/' . $this->template_name . '/fragments.php'); - } /** Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -449,7 +449,7 @@ * this must be after login stuff * template requires login information */ - $GLOBALS['linpha']->template = new linTemplate(); + $GLOBALS['linpha']->template = new LinTemplate(); global $linTpl; $linTpl = $GLOBALS['linpha']->template; // this is just a reference Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -101,6 +101,13 @@ $this->idCurrent = 0; } } + + /** + * check ajax compatibility + */ + if (isset($_GET['linUseAjax'])) { + $_SESSION['linUseAjax'] = true; + } /** * Initial menu entries @@ -110,8 +117,8 @@ if( isset($GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable']) && $GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable'] == 1 ) { - $GLOBALS['linpha']->template->menu['settings']['filemanager'] = - array('name' => i18n("Filemanager"), 'link' => LINPHA_LINK.'&linCat=filemanager'); + $this->menu['settings']['filemanager'] = + array('name' => i18n("Filemanager"), 'link' => 'javascript:location.href="'.LINPHA_LINK.'&linCat=filemanager&linId="+linIdCurrent'); } } @@ -123,7 +130,6 @@ 'admin' => i18n("Admin"), 'settings' => i18n("Settings") ); - } /** @@ -140,106 +146,19 @@ if (file_exists($filename)) { include_once( $filename ); } - break; case 'menu': $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/menu.html.php'; if (file_exists($filename)) { include_once( $filename ); } - break; case 'head': -/** - * do some common definitions in head - */ - -/** - * Prepare http url - */ -$urlParams = array( - 'bg' => ''.$this->bgcolor.'', - 'bodybg' => ''.$this->bodybgcolor.'', - 'font' => ''.$this->fontcolor.'', - 'albumsbg' => ''.$this->albumsbgcolor.'', - 'links' => ''.$this->linkscolor.'', - 'linkshover' => ''.$this->linkshovercolor.'', - 'forms' => ''.$this->formscolor.'' - ); -/** - * colorsettings.php - */ -?> -<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.'/templates/'. - $this->template_name.'/themes/default/colorsettings.php?'. - http_build_query($urlParams);?>" type="text/css" /> -<?php -$filename = '/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/colorsettings.php'; -if ($this->layout_name != 'default' && file_exists(LINPHA_DIR.$filename)) { ?> -<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.$filename.'?'. - http_build_query($urlParams); ?>" type="text/css" /> -<?php } -/** - * global.css - */ -?> -<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.'/templates/'. - $this->template_name.'/themes/default/css/global.css'; ?>" type="text/css" /> -<?php -$filename = '/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/css/global.css'; -if ($this->layout_name != 'default' && file_exists(LINPHA_DIR.$filename)) { ?> -<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.$filename; ?>" type="text/css" /> -<?php } -/** - * body css - */ -?> -<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.'/templates/'. - $this->template_name.'/themes/default/css/'.$this->css_name.'.css'; ?>" type="text/css" /> -<?php -$filename = '/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/css/'.$this->css_name.'.css'; -if ($this->layout_name != 'default' && file_exists(LINPHA_DIR.$filename)) { ?> -<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.$filename; ?>" type="text/css" /> -<?php } - -/** - * javascript - */ -?> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/prototype.js"></script> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinGlobal.js"></script> -<script type="text/javascript" language="JavaScript"> -var LINPHA_LINK = '<?php echo LINPHA_LINK; ?>'; -var LINPHA_CLIENT = '<?php echo LINPHA_CLIENT; ?>'; -var linUrlBase = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; -var startIdCurrent = <?php echo $this->idCurrent; ?>; -var IdCurrent = startIdCurrent; -var myThemePanelBase = '<?php echo $this->themeFile('menu/'); ?>'; -<?php -if(! isset($_SESSION['use_js']) && ! isset($_SESSION['disable_ajax'])) { - //echo "var checkAjaxCompatibility = true;"."\n"; - echo "myLinGlobal.checkAjaxCompatibility();"."\n"; -} /*else { - echo "var checkAjaxCompatibility = false;"."\n"; -}*/ -?> -</script> -<?php -/* menu must be after myThemePanelBase definition */ -$filename = LINPHA_DIR.'/templates/'.$this->template_name.'/menu.head.php'; -if (file_exists($filename)) { - include_once( $filename ); -} -?> - -<?php - $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/'.$this->head_name.'.head.php'; - if (file_exists($filename)) { - include_once( $filename ); - } - + $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/global.head.php'; + if (file_exists($filename)) { + include_once( $filename ); + } break; - } } @@ -355,41 +274,54 @@ } } + /** + * important: javascript strings must be surround by double quotes + * single quotes will produce an error when parsing JSON data !! + */ function createJSCookMenu() { foreach ($this->menu as $key=>$arrayMenuEntry) { if (strpos($key,'icon_')===false) { if (empty($this->menuFinal[$key]['link'])) { - $this->menuJSCook[$key][] = "[null, '".$this->arrayDefaultMenuEntries[$key]."', null, null, null, "."\n"; + $this->menuJSCook[$key][] = '[null, "'.$this->arrayDefaultMenuEntries[$key].'", null, null, null, ' . "\n"; } else { $link = linConvertAmp($this->menuFinal[$key]['link']); - $link = str_replace("'",'\\\'', $link); - $this->menuJSCook[$key][] = "[null, '".$this->arrayDefaultMenuEntries[$key]."', '".$link."', null, null, "."\n"; + $this->menuJSCook[$key][] = '[null, "'.$this->arrayDefaultMenuEntries[$key].'", "'.linEscapeQuotes($link).'", null, null, ' . "\n"; } $this->createJSCookMenuEntry($key, $arrayMenuEntry); - $this->menuJSCook[$key][] = "]"; + $this->menuJSCook[$key][] = ']'; } } } + /** + * important: javascript strings must be surround by double quotes + * single quotes will produce an error when parsing JSON data !! + */ function createJSCookMenuEntry($key, &$arrayMenuEntry) { //print_r($arrayMenuEntry); foreach ($arrayMenuEntry as $arraySubMenuEntry) { - $this->menuJSCook[$key][] = "[null, '".htmlentities($arraySubMenuEntry['name'], ENT_QUOTES)."', "; - if (is_array($arraySubMenuEntry['link'])) { - $this->menuJSCook[$key][] = "null, null, null, "."\n"; - $this->createJSCookMenuEntry($key, $arraySubMenuEntry['link']); - } else { - $link = linConvertAmp($arraySubMenuEntry['link']); - $link = str_replace("'",'\\\'', $link); - $this->menuJSCook[$key][] = "'".$link."', null, null,"; + if ($arraySubMenuEntry['name']=='split') + { + $this->menuJSCook[$key][] = '"_cmSplit",' . "\n"; } - - $this->menuJSCook[$key][] = "],"."\n"; + else + { + $this->menuJSCook[$key][] = '[null, "'.htmlentities($arraySubMenuEntry['name'], ENT_QUOTES).'", '; + if (is_array($arraySubMenuEntry['link'])) { + $this->menuJSCook[$key][] = 'null, null, null, ' . "\n"; + $this->createJSCookMenuEntry($key, $arraySubMenuEntry['link']); + } else { + $link = linConvertAmp($arraySubMenuEntry['link']); + $this->menuJSCook[$key][] = '"'.linEscapeQuotes($link).'", null, null,'; + } + + $this->menuJSCook[$key][] = '],' . "\n"; + } } /* [null, 'More', null, null, 'Some more options', @@ -443,6 +375,8 @@ $class = 'linCornMain'; } elseif($type=='album') { $class = 'linCornFolder'; + } elseif($type=='slideshow') { + $class = 'linCornSlideshow'; } else { $class = ''; } Modified: trunk/linpha2/lib/classes/linpha.view.album.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -1,4 +1,4 @@ -<?php +<?php /* * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> * Florian Angehrn @@ -26,26 +26,31 @@ if(!defined('LINPHA_DIR')) { exit(1); } define('LIN_SELECT_FIELDS', - "".LIN_PREFIX."photos.id AS id2, " . - "".LIN_PREFIX."photos.id AS id, ".LIN_PREFIX."photos.name AS name, " . - "".LIN_PREFIX."photos.img_type AS img_type, ".LIN_PREFIX."photos.md5sum AS md5sum, " . - "".LIN_PREFIX."photos.width AS width, ".LIN_PREFIX."photos.height AS height, " . - "".LIN_PREFIX."photos.filesize AS filesize, " . - "".LIN_PREFIX."photos.time_add AS time_add, ".LIN_PREFIX."photos.time_mod AS time_mod, " . - "".LIN_PREFIX."photos.time_exif AS time_exif, ".LIN_PREFIX."photos.stats_numbers AS stats_numbers, " . - "".LIN_PREFIX."photos.stats_views AS stats_views, ".LIN_PREFIX."photos.stats_downloads AS stats_downloads" + "".LIN_PREFIX."photos.id AS id2, " . /* first field used as array key by AdoDB::GetAssoc() */ + "".LIN_PREFIX."photos.id AS id, " . + "".LIN_PREFIX."photos.name AS name, " . + "".LIN_PREFIX."photos.img_type AS img_type, " . + "".LIN_PREFIX."photos.md5sum AS md5sum, " . + "".LIN_PREFIX."photos.width AS width, " . + "".LIN_PREFIX."photos.height AS height, " . + "".LIN_PREFIX."photos.filesize AS filesize, " . + "".LIN_PREFIX."photos.time_add AS time_add, " . + "".LIN_PREFIX."photos.time_mod AS time_mod, " . + "".LIN_PREFIX."photos.time_exif AS time_exif, " . + "".LIN_PREFIX."photos.stats_numbers AS stats_numbers, " . + "".LIN_PREFIX."photos.stats_views AS stats_views, " . + "".LIN_PREFIX."photos.stats_downloads AS stats_downloads, " . + "".LIN_PREFIX."photos.geodata AS geodata" ); -class LinImgview { +class LinViewAlbum { public $mode; // 'home', 'thumb', 'image' public $modulename; // 'albums', 'browse', ... -public $tot_photos; public $photos; public $photos_filtered; -public $id_parent, $img_type, $filename, $md5sum, $org_width, $org_height; -private $nr_pages, $current_page; // only used if javascript disabled -private $newCommentAdded = false; // used for ajax +public $folderData; +public $title; /** * constructor @@ -61,96 +66,106 @@ */ function setCurrentView($modulename) { - $this->modulename = $modulename; - - $this->orderby = linGetSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_others_sortorder']); - - if( $GLOBALS['linpha']->template->idCurrent == 0 ) - { - /** - * on top view, reset current view - */ - if($this->modulename=='albums') - { - $this->mode = 'home'; - $this->orderby = linGetSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_home_firstsortorder']); - } - else // $this->modulename=='browse' | 'search' , others will come.. - { - $this->mode = 'thumb'; + $this->modulename = $modulename; + + if( $GLOBALS['linpha']->template->idCurrent == 0 ) + { + /** + * on top view, reset current view + */ + if($this->modulename=='albums') + { + $this->mode = 'home'; + } + else // $this->modulename=='browse' | 'search' , others will come.. + { + $this->mode = 'thumb'; - if( ! isset($_SESSION['mode_thumbview']) ) - { - $_SESSION['mode_thumbview'] = 'thumb'; - } - } - } - else - { - /** - * set file informations - */ - $current_data = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum, width, height FROM ".LIN_PREFIX."photos " . - "WHERE id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); - /** - * check for valid id - */ - - if( isset($current_data['id']) ) - { - $this->img_type = $current_data['img_type']; - $this->filename = $current_data['name']; - $this->md5sum = $current_data['md5sum']; - $this->org_width = $current_data['width']; - $this->org_height = $current_data['height']; + if( ! isset($_SESSION['mode_thumbview']) ) + { + $_SESSION['mode_thumbview'] = 'thumb'; + } + } + } + else + { + /** + * set file informations + */ + $this->folderData = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum, width, height FROM ".LIN_PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); + /** + * check for valid id + */ + + if( isset($this->folderData['id']) ) + { + if ($this->folderData['img_type'] != 0) // id of an image + { + $this->folderData = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum, width, height FROM ".LIN_PREFIX."photos " . + "WHERE id = '".$this->folderData['parent_id']."'"); + + if( isset($this->folderData['id']) && $this->folderData['img_type'] == 0 ) + { + $this->mode = 'thumb'; + $GLOBALS['linpha']->template->output['startup_id'] = $GLOBALS['linpha']->template->idCurrent; + $GLOBALS['linpha']->template->idCurrent = $this->folderData['id']; + } + else // no valid id supplied + { + $this->mode = 'home'; + $GLOBALS['linpha']->template->idCurrent = 0; + } + } + else + { + $this->mode = 'thumb'; + } + } + else // no valid id supplied + { + $this->mode = 'home'; + $GLOBALS['linpha']->template->idCurrent = 0; + } + } + + if ($this->mode == 'home') { + $this->orderby = $this->getSqlSortOrder( + $GLOBALS['linpha']->sql->config->value['sys_style_home_firstsortorder'], + $GLOBALS['linpha']->sql->config->value['sys_style_home_firstsortorder_asc'] + ); + } else { + if (isset($_GET['linOrderBy'])) { + if ($_GET['linOrderBy'] == 'ASC') { + $_SESSION['sort_order_asc'] = 'ASC'; + } else if ($_GET['linOrderBy'] == 'DESC') { + $_SESSION['sort_order_asc'] = 'DESC'; + } else { + $_SESSION['sort_order'] = $_GET['linOrderBy']; + } + } + + if (isset($_SESSION['sort_order_asc'])) { + $str_asc = $_SESSION['sort_order_asc']; + } else { + $str_asc = $GLOBALS['linpha']->sql->config->value['sys_style_others_sortorder_asc']; + } + + if (isset($_SESSION['sort_order'])) { + $this->orderby = $this->getSqlSortOrder($_SESSION['sort_order'], $str_asc); + } else { + $this->orderby = $this->getSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_others_sortorder'], $str_asc); + } + } - /** - * switch between thumb_view and img_view - */ - if( $this->img_type == 0) - { - $this->mode = 'thumb'; - $this->id_parent = $current_data['id']; // use current_id as parent_id, because we want to see the content of the actual folder! - - if(! isset($_SESSION['mode_thumbview']) ) - { - $_SESSION['mode_thumbview'] = 'thumb'; - } - } - else - { - $this->mode = 'image'; - $this->id_parent = $current_data['parent_id']; // use parent_id on image view - - if( ! isset($_SESSION['mode_imageview']) ) - { - $_SESSION['mode_imageview'] = 'img'; - } - } - } - else // no valid id supplied - { - $this->mode = 'home'; - $GLOBALS['linpha']->template->idCurrent = 0; - } - } - - if($this->mode == 'thumb' && isset($_GET['view'])) - { - $_SESSION['mode_thumbview'] = $_GET['view']; - } - if($this->mode == 'image' && isset($_GET['view'])) - { - $_SESSION['mode_imageview'] = $_GET['view']; - } - - /** - * set id_parent to a default value - */ - if( ! isset( $this->id_parent) ) - { - $this->id_parent = $GLOBALS['linpha']->template->idCurrent; - } + if ($this->mode == 'thumb') + { + if (isset($_GET['view'])) { + $_SESSION['mode_thumbview'] = $_GET['view']; + } elseif (! isset($_SESSION['mode_thumbview']) ) { + $_SESSION['mode_thumbview'] = 'thumb'; + } + } } /** @@ -158,82 +173,54 @@ */ function buildImgView() { - $this->filterPhotosNotPermitted(); + $this->filterPhotosNotPermitted(); - /** - * set mode specific things - */ - switch($this->mode) - { - case 'home': - $this->viewHome(); - break; - case 'thumb': - switch($_SESSION['mode_thumbview']) - { - case 'thumb': - case 'thumbdetail': - $this->viewThumb(); - break; - case 'basket': - $this->viewBasket(); - break; - case 'albmeta': - $this->viewAlbMeta(); - break; - } - break; - case 'image': - switch($_SESSION['mode_imageview']) - { - case 'img': - $this->viewImg(); /* will exit in xml mode */ - break; - case 'meta': - $this->viewMeta(); - break; - } - break; - } - - /** - * doing some special commands - * - * should be done after viewImg(), because adminCommands() (force_import) uses some image informations - */ - if(isset($_GET['admin_cmd'])) { - $this->adminCommands(); - } - - if(isset($_GET['linMsg'])) - { - switch($_GET['linMsg']) - { - case 'basket_added': linSysLog(i18n("Images Added To Basket.")); break; - } - } - - /** - * set ref urls - * used in basket and ajax reloadmenu - */ - $_SESSION['ref_url_full'] = $GLOBALS['linpha']->template->URL_full; - $_SESSION['ref_url_base'] = $GLOBALS['linpha']->template->URL_base; - $_SESSION['ref_modulename'] = $this->modulename; + /** + * set mode specific things + */ + switch($this->mode) + { + case 'home': + $this->viewHome(); + break; + case 'thumb': + switch($_SESSION['mode_thumbview']) + { + case 'thumb': + case 'thumbdetail': + $this->viewThumb(); // will exit() when linJSON is set + break; + case 'basket': + $this->viewBasket(); + break; + case 'albmeta': + $this->viewAlbMeta(); + break; + } + break; + } + + /** + * set ref urls + * used in basket and ajax reloadmenu + */ + $_SESSION['ref_url_full'] = $GLOBALS['linpha']->template->URL_full; + $_SESSION['ref_url_base'] = $GLOBALS['linpha']->template->URL_base; + $_SESSION['ref_modulename'] = $this->modulename; - /** - * set admin menu and more menu - * - this should be done after adminCommands, because of - * "nr images in basket" is changed in adminCommands() - * - * - this should be done after viewImg(), because of $org_width and $org_height in "View at" - */ - $this->setMenu(); + /** + * set admin menu and more menu + * - this should be done after adminCommands, because of + * "nr images in basket" is changed in adminCommands() + * + * - this should be done after viewImg(), because of $org_width and $org_height in "View at" + */ + $this->setMenu(); - /** - * at this point, there should be absolute no output - */ - include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); + /** + * at this point, there should be absolute no output + */ + include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); } /** @@ -243,30 +230,27 @@ */ function filterPhotosNotPermitted() { - $this->photos_filtered = Array(); + $this->photos_filtered = Array(); - if(isset($this->photos)) - { - foreach($this->photos AS $key=>$value) - { - if( ! ($this->mode == 'image' && $value['img_type']== '0' ) ) // exclude subfolders from img_view - { - if( LinSql::photoIsAllowed( $value['id'] ) ) - { - /** - * escape name here - * -> we do not have to do it in the templates - */ - $value['name'] = htmlspecialchars($value['name'],ENT_QUOTES); - $this->photos_filtered[] = $value; - - //print_r($value); - } - } - } - } - - unset($this->photos); + if(isset($this->photos)) + { + foreach($this->photos AS $key=>$data) + { + if( LinSql::photoIsAllowed( $data['id'] ) ) + { + /** + * escape name here + * -> we do not have to do it in the templates + */ + $data['name'] = htmlentities($data['name'],ENT_QUOTES); + $this->photos_filtered[] = $data; + + //print_r($value); + } + } + } + + unset($this->photos); } /** @@ -274,318 +258,173 @@ */ function setMenu() { + /** + * Menu Admin + */ + if($GLOBALS['linpha']->sql->isAdmin()) + { + $GLOBALS['linpha']->template->menu['admin']['import'] = + array( + 'name' => i18n("Import"), + 'link' => array( + array('name' => i18n("Start Import Of This Folder/File"), 'link' => 'javascript:location.href="'.LINPHA_CLIENT.'/admin/?cat=maintenance_import&album_select[]="+linIdCurrent'), + array('name' => i18n("Detect File Changes"), 'link' => 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base.'&admin_cmd=force_import&linId="+linIdCurrent') + ) + ); - - /** - * Menu Admin - */ - if($GLOBALS['linpha']->sql->isAdmin()) - { - $GLOBALS['linpha']->template->menu['admin']['import'] = - array( - 'name' => i18n("Import"), - 'link' => array( - array('name' => i18n("Start Import Of This Folder/File"), 'link' => LINPHA_CLIENT.'/admin/?cat=maintenance_import&album_select[]='.$this->id_parent), - array('name' => i18n("Detect File Changes"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=force_import') - ) - ); + $GLOBALS['linpha']->template->menu['admin']['permissions'] = + array( + 'name' => i18n("Permissions"), + 'link' => array( + array('name' => i18n("Set Permissions"), 'link' => 'javascript:location.href="'.LINPHA_CLIENT.'/admin/?cat=permissions_view&cmd=edit&linId="+linIdCurrent') + ) + ); - $GLOBALS['linpha']->template->menu['admin']['permissions'] = - array( - 'name' => i18n("Permissions"), - 'link' => array( - array('name' => i18n("Set Permissions"), 'link' => LINPHA_CLIENT.'/admin/?cat=permissions_view&cmd=edit&linId='.$GLOBALS['linpha']->template->idCurrent) - ) - ); - - - if($this->mode == 'thumb' || $this->mode == 'image') - { - /** - * append to "admin - import" entry - */ - $GLOBALS['linpha']->template->menu['admin']['import']['link'][] = array( - 'name' => i18n("Recreate This Thumbnail"), - 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' - ); - } - } - - /** - * Menu More - */ - if($this->mode != 'home') - { - /** - * more than one time used stuff - */ - $array = linGetSortOrders(); - foreach($array as $value) // i18n() already called - { - $array_sort_orders_links[] = array('name' => $value, 'link' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); - } - - $open_basket_link = LINPHA_LINK.'&linCat=basket'; - - switch($this->mode) - { - case 'thumb': - - $GLOBALS['linpha']->template->menu['more']['basket'] = - array( - 'name' => i18n("Basket"), - 'link' => array( - array('name' => i18n("Add All To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all'), - array('name' => i18n("Switch To Basket View"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), - array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) - ) - ); - - if( linUseAjax() ) - { - $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectsizes']); - foreach($array as $value) - { - $array_tn_sizes_links[] = array('name' => $value.' '.i18n("Pixel"), 'link' => 'javascript:myLinThumbnails.setTnSize('.$value.')'); - } - - $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectnrimages']); - foreach($array as $value) - { - $array_nr_links[] = array('name' => $value, 'link' =>"javascript:myLinThumbnails.setNrImages('".$value."')"); - } - - $array_views_links[] = array('name' => i18n("Normal"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumb'); - $array_views_links[] = array('name' => i18n("Detail"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumbdetail'); - - $GLOBALS['linpha']->template->menu['more']['view'] = - array( - 'name' => i18n("View"), - 'link' => array( - array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), - array('name' => i18n("View"), 'link' => $array_views_links), - array('name' => i18n("Thumb Size"), 'link' => $array_tn_sizes_links), - array('name' => i18n("Thumb Nr"), 'link' => $array_nr_links) - ) - ); - } - else - { - $GLOBALS['linpha']->template->menu['more']['view'] = - array( - 'name' => i18n("View"), - 'link' => array( - array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), - ) - ); - } - - if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) - { - $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; - } - - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - $GLOBALS['linpha']->template->menu['more']['metainfo'] = - array( - 'name' => i18n("Metainfo"), - 'link' => array( - array('name' => i18n("Edit Album Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=albmeta'), - ) - ); - } - break; - case 'image': - - $GLOBALS['linpha']->template->menu['more']['basket'] = - array( - 'name' => i18n("Basket"), - 'link' => array( - array('name' => i18n("Add To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this'), - array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) - ) - ); - $GLOBALS['linpha']->template->menu['more']['view'] = - array( - 'name' => i18n("View"), - 'link' => array( - array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), - array('name' => i18n("View at"), 'link' => - array( - array('name' => '640x480', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=640&height=480', 'target' => '_blank'), - array('name' => '800x600', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=800&height=600', 'target' => '_blank'), - array('name' => '1024x768', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1024&height=768', 'target' => '_blank'), - array('name' => '1280x800', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=800', 'target' => '_blank'), - array('name' => '1280x960', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=960', 'target' => '_blank'), - array('name' => '1280x1024', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=1024', 'target' => '_blank'), - array('name' => '1600x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1600&height=1200', 'target' => '_blank'), - array('name' => '1920x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1920&height=1200', 'target' => '_blank'), - array('id' => 'linLiViewAtFullscreen', 'name' => $this->org_width.'x'.$this->org_height.' ('.i18n("Fullscreen").')', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width='.$this->org_width.'&height='.$this->org_height, 'target' => '_blank'), - ) - ) - ) - ); - - - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['name'] = i18n("Rotate Left"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; - $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['name'] = i18n("Rotate Right"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; - } - - if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) - { - $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; - } - - - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - $GLOBALS['linpha']->template->menu['more']['metainfo'] = - array( - 'name' => i18n("Metainfo"), - 'link' => array( - array('name' => i18n("Edit Image Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=meta') - ) - ); - } - - break; - } - } - - /** - * Icons - */ - if($this->mode == 'thumb') - { - /** - * basket icons - */ - if( $GLOBALS['linpha']->sql->checkPermission('basket_download')) + + if($this->mode != 'home') { - $GLOBALS['linpha']->template->menu['icon_download'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=download'; + /** + * append to "admin - import" entry + */ + $GLOBALS['linpha']->template->menu['admin']['import']['link'][] = array( + 'name' => i18n("Recreate This Thumbnail"), + 'link' => 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base.'&admin_cmd=recreate&linId="+linIdCurrent' + ); } - if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) + } + + /** + * Menu More + */ + if($this->mode != 'home') + { + $array_sort_orders_links[] = array('name' => i18n("Ascending"), 'link' => "javascript:myLinAlbum.changeSortOrder('ASC')"); + $array_sort_orders_links[] = array('name' => i18n("Descending"), 'link' => "javascript:myLinAlbum.changeSortOrder('DESC')"); + $array_sort_orders_links[] = array('name' => 'split', 'link' => ""); + + $array = $this->getSortOrders(); + foreach($array as $key=>$value) // i18n() already called { - $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=print'; + $array_sort_orders_links[] = array('name' => $value, 'link' => "javascript:myLinAlbum.changeSortOrder('".$key."')"); // $GLOBALS['linpha']->template->URL_full.'&order_by=' } - if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) + + $GLOBALS['linpha']->template->menu['more']['basket'] = + array( + 'name' => i18n("Basket"), + 'link' => array( + array('name' => i18n("Add All To Basket"), 'link' => 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base.'&admin_cmd=basket_add_all&linId="+linIdCurrent'), + array('name' => i18n("Add To Basket"), 'link' => 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base.'&admin_cmd=basket_add_this&linId="+linIdCurrent'), + array('name' => i18n("Switch To Basket View"), 'link' => 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base.'&view=basket&linId="+linIdCurrent'), + array('name' => i18n("Open Basket"), 'link' => LINPHA_LINK.'&linCat=baske... [truncated message content] |
From: <fan...@us...> - 2008-03-30 21:55:16
|
Revision: 4912 http://linpha.svn.sourceforge.net/linpha/?rev=4912&view=rev Author: fangehrn Date: 2008-03-30 14:55:12 -0700 (Sun, 30 Mar 2008) Log Message: ----------- * JSCookMenu fixed bug in cmEnableItem() reported here: http://sourceforge.net/tracker/index.php?func=detail&aid=1766028&group_id=149372&atid=778279 Modified Paths: -------------- trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js Added Paths: ----------- trunk/linpha2/lib/js/JSCookMenu/JSCookMenuWithEffects.js trunk/linpha2/lib/js/JSCookMenu/JSCookMenuWithEffects.yui.js Removed Paths: ------------- trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.yui.js Modified: trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js =================================================================== --- trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js 2008-03-29 16:23:55 UTC (rev 4911) +++ trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js 2008-03-30 21:55:12 UTC (rev 4912) @@ -720,10 +720,10 @@ if (!menuItem) return; if (item.menu) - menu.className = prefix + 'MainItem'; + menuItem.className = prefix + 'MainItem'; else - menu.className = prefix + 'MenuItem'; - item.isDisabled = true; + menuItem.className = prefix + 'MenuItem'; + item.isDisabled = false; } ////////////////////////////////////////////////////////////////////// Deleted: trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.yui.js =================================================================== --- trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.yui.js 2008-03-29 16:23:55 UTC (rev 4911) +++ trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.yui.js 2008-03-30 21:55:12 UTC (rev 4912) @@ -1,104 +0,0 @@ -var _cmNodeProperties={prefix:"",mainFolderLeft:"",mainFolderRight:"",mainItemLeft:"",mainItemRight:"",folderLeft:"",folderRight:"",itemLeft:"",itemRight:"",mainSpacing:0,subSpacing:0,delay:500,zIndexStart:1000,zIndexInc:5,subMenuHeader:null,subMenuFooter:null,offsetHMainAdjust:[0,0],offsetVMainAdjust:[0,0],offsetSubAdjust:[0,0],clickOpen:1,effect:null};var _cmIDCount=0;var _cmIDName="cmSubMenuID";var _cmTimeOut=null;var _cmCurrentItem=null;var _cmNoAction=new Object();var _cmNoClick=new Object();var _cmSplit=new Object();var _cmMenuList=new Array();var _cmItemList=new Array();var _cmFrameList=new Array();var _cmFrameListSize=0;var _cmFrameIDCount=0;var _cmFrameMasking=true;/*@cc_on - @if (@_jscript_version >= 5.6) - if (_cmFrameMasking) - { - var v = navigator.appVersion; - var i = v.indexOf ("MSIE "); - if (i >= 0) - { - if (parseInt (navigator.appVersion.substring (i + 5)) >= 7) - _cmFrameMasking = false; - } - } - @end -@*/var _cmClicked=false;var _cmHideObjects=0;function cmClone(A){var B=new Object();for(v in A){B[v]=A[v]}return B}function cmAllocMenu(G,F,B,A,C){var D=new Object();D.div=G;D.menu=F;D.orient=B;D.nodeProperties=A;D.prefix=C;var E=_cmMenuList.length;_cmMenuList[E]=D;return E}function cmAllocFrame(){if(_cmFrameListSize>0){return cmGetObject(_cmFrameList[--_cmFrameListSize])}var A=document.createElement("iframe");var B=_cmFrameIDCount++;A.id="cmFrame"+B;A.frameBorder="0";A.style.display="none";A.src="javascript:false";document.body.appendChild(A);A.style.filter="alpha(opacity=0)";A.style.zIndex=99;A.style.position="absolute";A.style.border="0";A.scrolling="no";return A}function cmFreeFrame(A){_cmFrameList[_cmFrameListSize++]=A.id}function cmNewID(){return _cmIDName+(++_cmIDCount)}function cmActionItem(J,I,H,D,A){_cmItemList[_cmItemList.length]=J;var F=_cmItemList.length-1;H=(!H)?"null":("'"+H+"'");var E=D.nodeProperties.clickOpen;var G=(E==3)||(E==2&&I);var C="this,"+I+","+H+","+A+","+F;var B;if(G){B=' onmouseover="cmItemMouseOver('+C+',false)" onmousedown="cmItemMouseDownOpenSub ('+C+')"'}else{B=' onmouseover="cmItemMouseOverOpenSub ('+C+')" onmousedown="cmItemMouseDown ('+C+')"'}return B+' onmouseout="cmItemMouseOut ('+C+')" onmouseup="cmItemMouseUp ('+C+')"'}function cmNoClickItem(D,B,A,E,G){_cmItemList[_cmItemList.length]=D;var C=_cmItemList.length-1;A=(!A)?"null":("'"+A+"'");var F="this,"+B+","+A+","+G+","+C;return' onmouseover="cmItemMouseOver ('+F+')" onmouseout="cmItemMouseOut ('+F+')"'}function cmNoActionItem(A){return A[1]}function cmSplitItem(prefix,isMain,vertical){var classStr="cm"+prefix;if(isMain){classStr+="Main";if(vertical){classStr+="HSplit"}else{classStr+="VSplit"}}else{classStr+="HSplit"}return eval(classStr)}function cmDrawSubMenu(G,J,B,N,D,E,A){var K='<div class="'+J+'SubMenu" id="'+B+'" style="z-index: '+D+';position: absolute; top: 0px; left: 0px;">';if(N.subMenuHeader){K+=N.subMenuHeader}K+='<table summary="sub menu" id="'+B+'Table" cellspacing="'+N.subSpacing+'" class="'+J+'SubMenuTable">';var I="";var M;var L;var C;var H;var F;for(H=5;H<G.length;++H){M=G[H];if(!M){continue}if(M==_cmSplit){M=cmSplitItem(J,0,true)}M.parentItem=G;M.subMenuID=B;C=(M.length>5);L=C?cmNewID():null;K+='<tr class="'+J+'MenuItem"';if(M[0]!=_cmNoClick){K+=cmActionItem(M,0,L,E,A)}else{K+=cmNoClickItem(M,0,L,E,A)}K+=">";if(M[0]==_cmNoAction||M[0]==_cmNoClick){K+=cmNoActionItem(M);K+="</tr>";continue}F=J+"Menu";F+=C?"Folder":"Item";K+='<td class="'+F+'Left">';if(M[0]!=null){K+=M[0]}else{K+=C?N.folderLeft:N.itemLeft}K+='</td><td class="'+F+'Text">'+M[1];K+='</td><td class="'+F+'Right">';if(C){K+=N.folderRight;I+=cmDrawSubMenu(M,J,L,N,D+N.zIndexInc,E,A)}else{K+=N.itemRight}K+="</td></tr>"}K+="</table>";if(N.subMenuFooter){K+=N.subMenuFooter}K+="</div>"+I;return K}function cmDraw(B,C,H,P,L){var J=cmGetObject(B);if(!L){L=P.prefix}if(!L){L=""}if(!P){P=_cmNodeProperties}if(!H){H="hbr"}var A=cmAllocMenu(B,C,H,P,L);var F=_cmMenuList[A];if(!P.delay){P.delay=_cmNodeProperties.delay}if(!P.clickOpen){P.clickOpen=_cmNodeProperties.clickOpen}if(!P.zIndexStart){P.zIndexStart=_cmNodeProperties.zIndexStart}if(!P.zIndexInc){P.zIndexInc=_cmNodeProperties.zIndexInc}if(!P.offsetHMainAdjust){P.offsetHMainAdjust=_cmNodeProperties.offsetHMainAdjust}if(!P.offsetVMainAdjust){P.offsetVMainAdjust=_cmNodeProperties.offsetVMainAdjust}if(!P.offsetSubAdjust){P.offsetSubAdjust=_cmNodeProperties.offsetSubAdjust}F.cmFrameMasking=_cmFrameMasking;var M='<table summary="main menu" class="'+L+'Menu" cellspacing="'+P.mainSpacing+'">';var K="";var E;if(H.charAt(0)=="h"){M+="<tr>";E=false}else{E=true}var I;var O;var N;var D;var G;for(I=0;I<C.length;++I){O=C[I];if(!O){continue}O.menu=C;O.subMenuID=B;M+=E?"<tr":"<td";M+=' class="'+L+'MainItem"';D=(O.length>5);N=D?cmNewID():null;M+=cmActionItem(O,1,N,F,A)+">";if(O==_cmSplit){O=cmSplitItem(L,1,E)}if(O[0]==_cmNoAction||O[0]==_cmNoClick){M+=cmNoActionItem(O);M+=E?"</tr>":"</td>";continue}G=L+"Main"+(D?"Folder":"Item");M+=E?"<td":"<span";M+=' class="'+G+'Left">';M+=(O[0]==null)?(D?P.mainFolderLeft:P.mainItemLeft):O[0];M+=E?"</td>":"</span>";M+=E?"<td":"<span";M+=' class="'+G+'Text">';M+=O[1];M+=E?"</td>":"</span>";M+=E?"<td":"<span";M+=' class="'+G+'Right">';M+=D?P.mainFolderRight:P.mainItemRight;M+=E?"</td>":"</span>";M+=E?"</tr>":"</td>";if(D){K+=cmDrawSubMenu(O,L,N,P,P.zIndexStart,F,A)}}if(!E){M+="</tr>"}M+="</table>"+K;J.innerHTML=M}function cmDrawFromText(H,C,B,E){var F=cmGetObject(H);var G=null;for(var D=F.firstChild;D;D=D.nextSibling){if(!D.tagName){continue}var A=D.tagName.toLowerCase();if(A!="ul"&&A!="ol"){continue}G=cmDrawFromTextSubMenu(D);break}if(G){cmDraw(H,G,C,B,E)}}function cmDrawFromTextSubMenu(H){var D=new Array();for(var G=H.firstChild;G;G=G.nextSibling){if(!G.tagName||G.tagName.toLowerCase()!="li"){continue}if(G.firstChild==null){D[D.length]=_cmSplit;continue}var F=new Array();var E=G.firstChild;var C=false;for(;E;E=E.nextSibling){if(!E.tagName){continue}if(E.className=="cmNoClick"){F[0]=_cmNoClick;F[1]=getActionHTML(E);C=true;break}if(E.className=="cmNoAction"){F[0]=_cmNoAction;F[1]=getActionHTML(E);C=true;break}var A=E.tagName.toLowerCase();if(A!="span"){continue}if(!E.firstChild){F[0]=null}else{F[0]=E.innerHTML}E=E.nextSibling;break}if(C){D[D.length]=F;continue}if(!E){continue}for(;E;E=E.nextSibling){if(!E.tagName){continue}var A=E.tagName.toLowerCase();if(A=="a"){F[1]=E.innerHTML;F[2]=E.href;F[3]=E.target;F[4]=E.title;if(F[4]==""){F[4]=null}}else{if(A=="span"||A=="div"){F[1]=E.innerHTML;F[2]=null;F[3]=null;F[4]=null}}break}for(;E;E=E.nextSibling){if(!E.tagName){continue}var A=E.tagName.toLowerCase();if(A!="ul"&&A!="ol"){continue}var B=cmDrawFromTextSubMenu(E);for(i=0;i<B.length;++i){F[i+5]=B[i]}break}D[D.length]=F}return D}function getActionHTML(C){var A="<td></td><td></td><td></td>";var B;for(B=C.firstChild;B;B=B.nextSibling){if(B.tagName&&B.tagName.toLowerCase()=="table"){break}}if(!B){return A}for(B=B.firstChild;B;B=B.nextSibling){if(B.tagName&&B.tagName.toLowerCase()=="tbody"){break}}if(!B){return A}for(B=B.firstChild;B;B=B.nextSibling){if(B.tagName&&B.tagName.toLowerCase()=="tr"){break}}if(!B){return A}return B.innerHTML}function cmGetMenuItem(D){if(!D.subMenuID){return null}var A=cmGetObject(D.subMenuID);if(D.menu){var E=D.menu;A=A.firstChild.firstChild.firstChild.firstChild;var B;for(B=0;B<E.length;++B){if(E[B]==D){return A}A=A.nextSibling}}else{if(D.parentItem){var E=D.parentItem;var C=cmGetObject(D.subMenuID+"Table");if(!C){return null}A=C.firstChild.firstChild;var B;for(B=5;B<E.length;++B){if(E[B]==D){return A}A=A.nextSibling}}}return null}function cmDisableItem(B,C){if(!B){return }var A=cmGetMenuItem(B);if(!A){return }if(B.menu){A.className=C+"MainItemDisabled"}else{A.className=C+"MenuItemDisabled"}B.isDisabled=true}function cmEnableItem(B,C){if(!B){return }var A=cmGetMenuItem(B);if(!A){return }if(B.menu){menu.className=C+"MainItem"}else{menu.className=C+"MenuItem"}B.isDisabled=true}function cmItemMouseOver(D,L,K,A,F,N){if(!N&&_cmClicked){cmItemMouseOverOpenSub(D,L,K,A,F);return }clearTimeout(_cmTimeOut);if(_cmItemList[F].isDisabled){return }var E=_cmMenuList[A].prefix;if(!D.cmMenuID){D.cmMenuID=A;D.cmIsMain=L}var B=cmGetThisMenu(D,E);if(!B.cmItems){B.cmItems=new Array()}var C;for(C=0;C<B.cmItems.length;++C){if(B.cmItems[C]==D){break}}if(C==B.cmItems.length){B.cmItems[C]=D}if(_cmCurrentItem){if(_cmCurrentItem==D||_cmCurrentItem==B){var M=_cmItemList[F];cmSetStatus(M);return }var H=_cmMenuList[_cmCurrentItem.cmMenuID];var J=H.prefix;var I=cmGetThisMenu(_cmCurrentItem,J);if(I!=B.cmParentMenu){if(_cmCurrentItem.cmIsMain){_cmCurrentItem.className=J+"MainItem"}else{_cmCurrentItem.className=J+"MenuItem"}if(I.id!=K){cmHideMenu(I,B,H)}}}_cmCurrentItem=D;cmResetMenu(B,E);var M=_cmItemList[F];var G=cmIsDefaultItem(M);if(G){if(L){D.className=E+"MainItemHover"}else{D.className=E+"MenuItemHover"}}cmSetStatus(M)}function cmItemMouseOverOpenSub(E,I,H,A,G){clearTimeout(_cmTimeOut);if(_cmItemList[G].isDisabled){return }cmItemMouseOver(E,I,H,A,G,true);if(H){var D=cmGetObject(H);var B=_cmMenuList[A];var C=B.orient;var F=B.prefix;cmShowSubMenu(E,I,D,B)}}function cmItemMouseOut(D,B,A,F,C){var E=_cmMenuList[F].nodeProperties.delay;_cmTimeOut=window.setTimeout("cmHideMenuTime ()",E);window.defaultStatus=""}function cmItemMouseDown(E,B,A,F,C){if(_cmItemList[C].isDisabled){return }if(cmIsDefaultItem(_cmItemList[C])){var D=_cmMenuList[F].prefix;if(E.cmIsMain){E.className=D+"MainItemActive"}else{E.className=D+"MenuItemActive"}}}function cmItemMouseDownOpenSub(F,B,A,G,D){if(_cmItemList[D].isDisabled){return }_cmClicked=true;cmItemMouseDown(F,B,A,G,D);if(A){var C=cmGetObject(A);var E=_cmMenuList[G];cmShowSubMenu(F,B,C,E)}}function cmItemMouseUp(E,K,J,A,G){if(_cmItemList[G].isDisabled){return }var L=_cmItemList[G];var I=null,H="_self";if(L.length>2){I=L[2]}if(L.length>3&&L[3]){H=L[3]}if(I!=null){_cmClicked=false;window.open(I,H)}var D=_cmMenuList[A];var F=D.prefix;var C=cmGetThisMenu(E,F);var B=(L.length>5);if(!B){if(cmIsDefaultItem(L)){if(E.cmIsMain){E.className=F+"MainItem"}else{E.className=F+"MenuItem"}}cmHideMenu(C,null,D)}else{if(cmIsDefaultItem(L)){if(E.cmIsMain){E.className=F+"MainItemHover"}else{E.className=F+"MenuItemHover"}}}}function cmMoveSubMenu(obj,isMain,subMenu,menuInfo){var orient=menuInfo.orient;var offsetAdjust;if(isMain){if(orient.charAt(0)=="h"){offsetAdjust=menuInfo.nodeProperties.offsetHMainAdjust}else{offsetAdjust=menuInfo.nodeProperties.offsetVMainAdjust}}else{offsetAdjust=menuInfo.nodeProperties.offsetSubAdjust}if(!isMain&&orient.charAt(0)=="h"){orient="v"+orient.charAt(1)+orient.charAt(2)}var mode=String(orient);var p=subMenu.offsetParent;var subMenuWidth=cmGetWidth(subMenu);var horiz=cmGetHorizontalAlign(obj,mode,p,subMenuWidth);if(mode.charAt(0)=="h"){if(mode.charAt(1)=="b"){subMenu.style.top=(cmGetYAt(obj,p)+cmGetHeight(obj)+offsetAdjust[1])+"px"}else{subMenu.style.top=(cmGetYAt(obj,p)-cmGetHeight(subMenu)-offsetAdjust[1])+"px"}if(horiz=="r"){subMenu.style.left=(cmGetXAt(obj,p)+offsetAdjust[0])+"px"}else{subMenu.style.left=(cmGetXAt(obj,p)+cmGetWidth(obj)-subMenuWidth-offsetAdjust[0])+"px"}}else{if(horiz=="r"){subMenu.style.left=(cmGetXAt(obj,p)+cmGetWidth(obj)+offsetAdjust[0])+"px"}else{subMenu.style.left=(cmGetXAt(obj,p)-subMenuWidth-offsetAdjust[0])+"px"}if(mode.charAt(1)=="b"){subMenu.style.top=(cmGetYAt(obj,p)+offsetAdjust[1])+"px"}else{subMenu.style.top=(cmGetYAt(obj,p)+cmGetHeight(obj)-cmGetHeight(subMenu)+offsetAdjust[1])+"px"}}/*@cc_on - @if (@_jscript_version >= 5.5) - if (menuInfo.cmFrameMasking) - { - if (!subMenu.cmFrameObj) - { - var frameObj = cmAllocFrame (); - subMenu.cmFrameObj = frameObj; - } - - var frameObj = subMenu.cmFrameObj; - frameObj.style.zIndex = subMenu.style.zIndex - 1; - frameObj.style.left = (cmGetX (subMenu) - cmGetX (frameObj.offsetParent)) + 'px'; - frameObj.style.top = (cmGetY (subMenu) - cmGetY (frameObj.offsetParent)) + 'px'; - frameObj.style.width = cmGetWidth (subMenu) + 'px'; - frameObj.style.height = cmGetHeight (subMenu) + 'px'; - frameObj.style.display = 'block'; - } - @end - @*/if(horiz!=orient.charAt(2)){orient=orient.charAt(0)+orient.charAt(1)+horiz}return orient}function cmGetHorizontalAlign(F,G,E,C){var H=G.charAt(2);if(!(document.body)){return H}var A=document.body;var B;var D;if(window.innerWidth){B=window.pageXOffset;D=window.innerWidth+B}else{if(A.clientWidth){B=A.clientLeft;D=A.clientWidth+B}else{return H}}if(G.charAt(0)=="h"){if(H=="r"&&(cmGetXAt(F)+C)>D){H="l"}if(H=="l"&&(cmGetXAt(F)+cmGetWidth(F)-C)<B){H="r"}return H}else{if(H=="r"&&(cmGetXAt(F,E)+cmGetWidth(F)+C)>D){H="l"}if(H=="l"&&(cmGetXAt(F,E)-C)<B){H="r"}return H}}function cmShowSubMenu(obj,isMain,subMenu,menuInfo){var prefix=menuInfo.prefix;if(!subMenu.cmParentMenu){var thisMenu=cmGetThisMenu(obj,prefix);subMenu.cmParentMenu=thisMenu;if(!thisMenu.cmSubMenu){thisMenu.cmSubMenu=new Array()}thisMenu.cmSubMenu[thisMenu.cmSubMenu.length]=subMenu}var effectInstance=subMenu.cmEffect;if(effectInstance){effectInstance.showEffect(true)}else{var orient=cmMoveSubMenu(obj,isMain,subMenu,menuInfo);subMenu.cmOrient=orient;var forceShow=false;if(subMenu.style.visibility!="visible"&&menuInfo.nodeProperties.effect){try{effectInstance=menuInfo.nodeProperties.effect.getInstance(subMenu,orient);effectInstance.showEffect(false)}catch(e){forceShow=true;subMenu.cmEffect=null}}else{forceShow=true}if(forceShow){subMenu.style.visibility="visible";/*@cc_on - @if (@_jscript_version >= 5.5) - if (subMenu.cmFrameObj) - subMenu.cmFrameObj.style.display = 'block'; - @end - @*/}}if(!_cmHideObjects){_cmHideObjects=2;try{if(window.opera){if(parseInt(navigator.appVersion)<9){_cmHideObjects=1}}}catch(e){}}if(_cmHideObjects==1){if(!subMenu.cmOverlap){subMenu.cmOverlap=new Array()}cmHideControl("IFRAME",subMenu);cmHideControl("OBJECT",subMenu)}}function cmResetMenu(D,C){if(D.cmItems){var B;var E;var A=D.cmItems;for(B=0;B<A.length;++B){if(A[B].cmIsMain){if(A[B].className==(C+"MainItemDisabled")){continue}}else{if(A[B].className==(C+"MenuItemDisabled")){continue}}if(A[B].cmIsMain){E=C+"MainItem"}else{E=C+"MenuItem"}if(A[B].className!=E){A[B].className=E}}}}function cmHideMenuTime(){_cmClicked=false;if(_cmCurrentItem){var B=_cmMenuList[_cmCurrentItem.cmMenuID];var A=B.prefix;cmHideMenu(cmGetThisMenu(_cmCurrentItem,A),null,B);_cmCurrentItem=null}}function cmHideThisMenu(thisMenu,menuInfo){var effectInstance=thisMenu.cmEffect;if(effectInstance){effectInstance.hideEffect(true)}else{thisMenu.style.visibility="hidden";thisMenu.style.top="0px";thisMenu.style.left="0px";thisMenu.cmOrient=null;/*@cc_on - @if (@_jscript_version >= 5.5) - if (thisMenu.cmFrameObj) - { - var frameObj = thisMenu.cmFrameObj; - frameObj.style.display = 'none'; - frameObj.style.width = '1px'; - frameObj.style.height = '1px'; - thisMenu.cmFrameObj = null; - cmFreeFrame (frameObj); - } - @end - @*/}cmShowControl(thisMenu);thisMenu.cmItems=null}function cmHideMenu(E,D,C){var B=C.prefix;var F=B+"SubMenu";if(E.cmSubMenu){var A;for(A=0;A<E.cmSubMenu.length;++A){cmHideSubMenu(E.cmSubMenu[A],C)}}while(E&&E!=D){cmResetMenu(E,B);if(E.className==F){cmHideThisMenu(E,C)}else{break}E=cmGetThisMenu(E.cmParentMenu,B)}}function cmHideSubMenu(D,C){if(D.style.visibility=="hidden"){return }if(D.cmSubMenu){var A;for(A=0;A<D.cmSubMenu.length;++A){cmHideSubMenu(D.cmSubMenu[A],C)}}var B=C.prefix;cmResetMenu(D,B);cmHideThisMenu(D,C)}function cmHideControl(D,E){var J=cmGetX(E);var I=cmGetY(E);var K=E.offsetWidth;var H=E.offsetHeight;var G;for(G=0;G<document.all.tags(D).length;++G){var F=document.all.tags(D)[G];if(!F||!F.offsetParent){continue}var B=cmGetX(F);var A=cmGetY(F);var C=F.offsetWidth;var L=F.offsetHeight;if(B>(J+K)||(B+C)<J){continue}if(A>(I+H)||(A+L)<I){continue}if(F.style.visibility=="hidden"){continue}E.cmOverlap[E.cmOverlap.length]=F;F.style.visibility="hidden"}}function cmShowControl(A){if(A.cmOverlap){var B;for(B=0;B<A.cmOverlap.length;++B){A.cmOverlap[B].style.visibility=""}}A.cmOverlap=null}function cmGetThisMenu(D,C){var B=C+"SubMenu";var A=C+"Menu";while(D){if(D.className==B||D.className==A){return D}D=D.parentNode}return null}function cmTimeEffect(C,A,B){window.setTimeout('cmCallEffect("'+C+'",'+A+")",B)}function cmCallEffect(D,A){var C=cmGetObject(D);if(!C||!C.cmEffect){return }try{if(A){C.cmEffect.showEffect(false)}else{C.cmEffect.hideEffect(false)}}catch(B){}}function cmIsDefaultItem(A){if(A==_cmSplit||A[0]==_cmNoAction||A[0]==_cmNoClick){return false}return true}function cmGetObject(A){if(document.all){return document.all[A]}return document.getElementById(A)}function cmGetWidth(B){var A=B.offsetWidth;if(A>0||!cmIsTRNode(B)){return A}if(!B.firstChild){return 0}return B.lastChild.offsetLeft-B.firstChild.offsetLeft+cmGetWidth(B.lastChild)}function cmGetHeight(B){var A=B.offsetHeight;if(A>0||!cmIsTRNode(B)){return A}if(!B.firstChild){return 0}return B.firstChild.offsetHeight}function cmGetX(B){if(!B){return 0}var A=0;do{A+=B.offsetLeft;B=B.offsetParent}while(B);return A}function cmGetXAt(B,C){var A=0;while(B&&B!=C){A+=B.offsetLeft;B=B.offsetParent}if(B==C){return A}return A-cmGetX(C)}function cmGetY(A){if(!A){return 0}var B=0;do{B+=A.offsetTop;A=A.offsetParent}while(A);return B}function cmIsTRNode(B){var A=B.tagName;return A=="TR"||A=="tr"||A=="Tr"||A=="tR"}function cmGetYAt(B,D){var C=0;if(!B.offsetHeight&&cmIsTRNode(B)){var A=B.parentNode.firstChild;B=B.firstChild;C-=A.firstChild.offsetTop}while(B&&B!=D){C+=B.offsetTop;B=B.offsetParent}if(B==D){return C}return C-cmGetY(D)}function cmSetStatus(A){var B="";if(A.length>4){B=(A[4]!=null)?A[4]:(A[2]?A[2]:B)}else{if(A.length>2){B=(A[2]?A[2]:B)}}window.defaultStatus=B}function cmGetProperties(B){if(B==undefined){return"undefined"}if(B==null){return"null"}var C=B+":\n";var A;for(A in B){C+=A+" = "+B[A]+"; "}return C}function CMSpecialEffectInstance(A,B){A.show=true;A.menu=B;B.cmEffect=A;this.effect=A}CMSpecialEffectInstance.prototype.canShow=function(A){if(A){if(this.effect.show){return false}this.effect.show=true}else{if(!this.effect.show){return false}}return true};CMSpecialEffectInstance.prototype.canHide=function(B){var A=this.effect;if(B){if(!A.show){return false}A.show=false}else{if(A.show){return false}}return true};CMSpecialEffectInstance.prototype.startShowing=function(){var menu=this.effect.menu;menu.style.visibility="visible";/*@cc_on - @if (@_jscript_version >= 5.5) - if (menu.cmFrameObj) - { - var frameObj = menu.cmFrameObj; - frameObj.style.display = 'block'; - } - @end - @*/};CMSpecialEffectInstance.prototype.finishShowing=function(){};CMSpecialEffectInstance.prototype.finishHiding=function(){var menu=this.effect.menu;menu.style.visibility="hidden";menu.style.top="0px";menu.style.left="0px";/*@cc_on - @if (@_jscript_version >= 5.5) - if (menu.cmFrameObj) - { - var frameObj = menu.cmFrameObj; - frameObj.style.display = 'none'; - frameObj.style.top = '0px'; - frameObj.style.left = '0px'; - menu.cmFrameObj = null; - cmFreeFrame (frameObj); - } - @end - @*/menu.cmEffect=null;menu.cmOrient=null;this.effect.menu=null};function CMSlidingEffectInstance(menu,orient,speed){this.base=new CMSpecialEffectInstance(this,menu);menu.style.overflow="hidden";this.x=menu.offsetLeft;this.y=menu.offsetTop;if(orient.charAt(0)=="h"){this.slideOrient="h";this.slideDir=orient.charAt(1)}else{this.slideOrient="v";this.slideDir=orient.charAt(2)}this.speed=speed;this.fullWidth=menu.offsetWidth;this.fullHeight=menu.offsetHeight;this.percent=0;/*@cc_on - @if (@_jscript_version >= 5.5) - if (menu.cmFrameObj) - { - var frameObj = menu.cmFrameObj; - this.frameX = frameObj.offsetLeft; - this.frameY = frameObj.offsetTop; - this.frameWidth = frameObj.offsetWidth; - this.frameHeight = frameObj.offsetHeight; - } - @end - @*/}CMSlidingEffectInstance.prototype.showEffect=function(B){if(!this.base.canShow(B)){return }var A=this.percent;if(this.slideOrient=="h"){this.slideMenuV()}else{this.slideMenuH()}if(A==0){this.base.startShowing()}if(A<100){this.percent+=this.speed;cmTimeEffect(this.menu.id,this.show,10)}else{if(this.show){this.base.finishShowing()}}};CMSlidingEffectInstance.prototype.hideEffect=function(B){if(!this.base.canHide(B)){return }var A=this.percent;if(this.slideOrient=="h"){this.slideMenuV()}else{this.slideMenuH()}if(A>0){this.percent-=this.speed;cmTimeEffect(this.menu.id,this.show,10)}else{if(!this.show){this.menu.style.clip="auto";this.base.finishHiding()}}};CMSlidingEffectInstance.prototype.slideMenuH=function(){var percent=this.percent;if(percent<0){percent=0}if(percent>100){percent=100}var fullWidth=this.fullWidth;var fullHeight=this.fullHeight;var x=this.x;var space=percent*fullWidth/100;var menu=this.menu;if(this.slideDir=="l"){menu.style.left=(x+fullWidth-space)+"px";menu.style.clip="rect(0px "+space+"px "+fullHeight+"px 0px)"}else{menu.style.left=(x-fullWidth+space)+"px";menu.style.clip="rect(0px "+fullWidth+"px "+fullHeight+"px "+(fullWidth-space)+"px)"}/*@cc_on - @if (@_jscript_version >= 5.5) - if (menu.cmFrameObj) - { - var frameObj = menu.cmFrameObj; - if (this.slideDir == 'l') - frameObj.style.left = (this.frameX + fullWidth - space) + 'px'; - frameObj.style.width = space + 'px'; - } - @end - @*/};CMSlidingEffectInstance.prototype.slideMenuV=function(){var percent=this.percent;if(percent<0){percent=0}if(percent>100){percent=100}var fullWidth=this.fullWidth;var fullHeight=this.fullHeight;var y=this.y;var space=percent*fullHeight/100;var menu=this.menu;if(this.slideDir=="b"){menu.style.top=(y-fullHeight+space)+"px";menu.style.clip="rect("+(fullHeight-space)+"px "+fullWidth+"px "+fullHeight+"px 0px)"}else{menu.style.top=(y+fullHeight-space)+"px";menu.style.clip="rect(0px "+fullWidth+"px "+space+"px 0px)"}/*@cc_on - @if (@_jscript_version >= 5.5) - if (menu.cmFrameObj) - { - var frameObj = menu.cmFrameObj; - if (this.slideDir == 'u') - frameObj.style.top = (this.frameX - space) + 'px'; - frameObj.style.height = space + 'px'; - } - @end - @*/};function CMSlidingEffect(A){if(!A){A=10}else{if(A<=0){A=10}else{if(A>=100){A=100}}}this.speed=A}CMSlidingEffect.prototype.getInstance=function(B,A){return new CMSlidingEffectInstance(B,A,this.speed)};function CMFadingEffectInstance(C,A,B){this.base=new CMSpecialEffectInstance(this,C);C.style.overflow="hidden";this.showSpeed=A;this.hideSpeed=B;this.opacity=0}CMFadingEffectInstance.prototype.showEffect=function(C){if(!this.base.canShow(C)){return }var B=this.menu;var A=this.opacity;this.setOpacity();if(A==0){this.base.startShowing()}if(A<100){this.opacity+=10;cmTimeEffect(B.id,this.show,this.showSpeed)}else{if(this.show){this.base.finishShowing()}}};CMFadingEffectInstance.prototype.hideEffect=function(C){if(!this.base.canHide(C)){return }var B=this.menu;var A=this.opacity;this.setOpacity();if(this.opacity>0){this.opacity-=10;cmTimeEffect(B.id,this.show,this.hideSpeed)}else{if(!this.show){this.base.finishHiding()}}};CMFadingEffectInstance.prototype.setOpacity=function(){this.menu.style.opacity=this.opacity/100;/*@cc_on - this.menu.style.filter = 'alpha(opacity=' + this.opacity + ')'; - //this.menu.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + this.opacity + ')'; - @*/};function CMFadingEffect(A,B){this.showSpeed=A;this.hideSpeed=B}CMFadingEffect.prototype.getInstance=function(B,A){return new CMFadingEffectInstance(B,this.showSpeed,this.hideSpeed)}; \ No newline at end of file Added: trunk/linpha2/lib/js/JSCookMenu/JSCookMenuWithEffects.js =================================================================== --- trunk/linpha2/lib/js/JSCookMenu/JSCookMenuWithEffects.js (rev 0) +++ trunk/linpha2/lib/js/JSCookMenu/JSCookMenuWithEffects.js 2008-03-30 21:55:12 UTC (rev 4912) @@ -0,0 +1,2044 @@ +/* + JSCookMenu v2.0.3 (c) Copyright 2002-2006 by Heng Yuan + + http://jscook.sourceforge.net/JSCookMenu/ + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +// default node properties +var _cmNodeProperties = +{ + // theme prefix + prefix: '', + + // main menu display attributes + // + // Note. When the menu bar is horizontal, + // mainFolderLeft and mainFolderRight are + // put in <span></span>. When the menu + // bar is vertical, they would be put in + // a separate TD cell. + + // HTML code to the left of the folder item + mainFolderLeft: '', + // HTML code to the right of the folder item + mainFolderRight: '', + // HTML code to the left of the regular item + mainItemLeft: '', + // HTML code to the right of the regular item + mainItemRight: '', + + // sub menu display attributes + + // HTML code to the left of the folder item + folderLeft: '', + // HTML code to the right of the folder item + folderRight: '', + // HTML code to the left of the regular item + itemLeft: '', + // HTML code to the right of the regular item + itemRight: '', + // cell spacing for main menu + mainSpacing: 0, + // cell spacing for sub menus + subSpacing: 0, + + // optional settings + // If not set, use the default + + // auto disappear time for submenus in milli-seconds + delay: 500, + + // 1st layer sub menu starting index + zIndexStart: 1000, + // z-index incremental step for subsequent layers + zIndexInc: 5, + + // sub menu header appears before the sub menu table + subMenuHeader: null, + // sub menu header appears after the sub menu table + subMenuFooter: null, + + // submenu location adjustments + // + // offsetHMainAdjust for adjusting the first submenu + // of a 'hbr' menu. + // offsetVMainAdjust for adjusting the first submenu + // of a 'vbr' menu. + // offsetSubAdjust for subsequent level of submenus + // + offsetHMainAdjust: [0, 0], + offsetVMainAdjust: [0, 0], + offsetSubAdjust: [0, 0], + + // act on click to open sub menu + // not yet implemented + // 0 : use default behavior + // 1 : hover open in all cases + // 2 : click on main, hover on sub + // 3 : click open in all cases (illegal as of 1.5) + clickOpen: 1, + + // special effects on open/closing a sub menu + effect: null +}; + +// Globals +var _cmIDCount = 0; +var _cmIDName = 'cmSubMenuID'; // for creating submenu id + +var _cmTimeOut = null; // how long the menu would stay +var _cmCurrentItem = null; // the current menu item being selected; + +var _cmNoAction = new Object (); // indicate that the item cannot be hovered. +var _cmNoClick = new Object (); // similar to _cmNoAction but does not respond to mouseup/mousedown events +var _cmSplit = new Object (); // indicate that the item is a menu split + +var _cmMenuList = new Array (); // a list of the current menus +var _cmItemList = new Array (); // a simple list of items + +var _cmFrameList = new Array (); // a pool of reusable iframes +var _cmFrameListSize = 0; // keep track of the actual size +var _cmFrameIDCount = 0; // keep track of the frame id +var _cmFrameMasking = true; // use the frame masking + +// disable iframe masking for IE7 +/*@cc_on + @if (@_jscript_version >= 5.6) + if (_cmFrameMasking) + { + var v = navigator.appVersion; + var i = v.indexOf ("MSIE "); + if (i >= 0) + { + if (parseInt (navigator.appVersion.substring (i + 5)) >= 7) + _cmFrameMasking = false; + } + } + @end +@*/ + +var _cmClicked = false; // for onClick + +// flag for turning on off hiding objects +// +// 0: automatic +// 1: hiding +// 2: no hiding +var _cmHideObjects = 0; + +// Utility function to do a shallow copy a node property +function cmClone (nodeProperties) +{ + var returnVal = new Object (); + for (v in nodeProperties) + returnVal[v] = nodeProperties[v]; + return returnVal; +} + +// +// store the new menu information into a structure to retrieve it later +// +function cmAllocMenu (id, menu, orient, nodeProperties, prefix) +{ + var info = new Object (); + info.div = id; + info.menu = menu; + info.orient = orient; + info.nodeProperties = nodeProperties; + info.prefix = prefix; + var menuID = _cmMenuList.length; + _cmMenuList[menuID] = info; + return menuID; +} + +// +// request a frame +// +function cmAllocFrame () +{ + if (_cmFrameListSize > 0) + return cmGetObject (_cmFrameList[--_cmFrameListSize]); + var frameObj = document.createElement ('iframe'); + var id = _cmFrameIDCount++; + frameObj.id = 'cmFrame' + id; + frameObj.frameBorder = '0'; + frameObj.style.display = 'none'; + frameObj.src = 'javascript:false'; + document.body.appendChild (frameObj); + frameObj.style.filter = 'alpha(opacity=0)'; + frameObj.style.zIndex = 99; + frameObj.style.position = 'absolute'; + frameObj.style.border = '0'; + frameObj.scrolling = 'no'; + return frameObj; +} + +// +// make a frame resuable later +// +function cmFreeFrame (frameObj) +{ + _cmFrameList[_cmFrameListSize++] = frameObj.id; +} + +////////////////////////////////////////////////////////////////////// +// +// Drawing Functions and Utility Functions +// +////////////////////////////////////////////////////////////////////// + +// +// produce a new unique id +// +function cmNewID () +{ + return _cmIDName + (++_cmIDCount); +} + +// +// return the property string for the menu item +// +function cmActionItem (item, isMain, idSub, menuInfo, menuID) +{ + _cmItemList[_cmItemList.length] = item; + var index = _cmItemList.length - 1; + idSub = (!idSub) ? 'null' : ('\'' + idSub + '\''); + + var clickOpen = menuInfo.nodeProperties.clickOpen; + var onClick = (clickOpen == 3) || (clickOpen == 2 && isMain); + + var param = 'this,' + isMain + ',' + idSub + ',' + menuID + ',' + index; + + var returnStr; + if (onClick) + returnStr = ' onmouseover="cmItemMouseOver(' + param + ',false)" onmousedown="cmItemMouseDownOpenSub (' + param + ')"'; + else + returnStr = ' onmouseover="cmItemMouseOverOpenSub (' + param + ')" onmousedown="cmItemMouseDown (' + param + ')"'; + return returnStr + ' onmouseout="cmItemMouseOut (' + param + ')" onmouseup="cmItemMouseUp (' + param + ')"'; +} + +// +// this one is used by _cmNoClick to only take care of onmouseover and onmouseout +// events which are associated with menu but not actions associated with menu clicking/closing +// +function cmNoClickItem (item, isMain, idSub, menuInfo, menuID) +{ + // var index = _cmItemList.push (item) - 1; + _cmItemList[_cmItemList.length] = item; + var index = _cmItemList.length - 1; + idSub = (!idSub) ? 'null' : ('\'' + idSub + '\''); + + var param = 'this,' + isMain + ',' + idSub + ',' + menuID + ',' + index; + + return ' onmouseover="cmItemMouseOver (' + param + ')" onmouseout="cmItemMouseOut (' + param + ')"'; +} + +function cmNoActionItem (item) +{ + return item[1]; +} + +function cmSplitItem (prefix, isMain, vertical) +{ + var classStr = 'cm' + prefix; + if (isMain) + { + classStr += 'Main'; + if (vertical) + classStr += 'HSplit'; + else + classStr += 'VSplit'; + } + else + classStr += 'HSplit'; + return eval (classStr); +} + +// +// draw the sub menu recursively +// +function cmDrawSubMenu (subMenu, prefix, id, nodeProperties, zIndexStart, menuInfo, menuID) +{ + var str = '<div class="' + prefix + 'SubMenu" id="' + id + '" style="z-index: ' + zIndexStart + ';position: absolute; top: 0px; left: 0px;">'; + if (nodeProperties.subMenuHeader) + str += nodeProperties.subMenuHeader; + + str += '<table summary="sub menu" id="' + id + 'Table" cellspacing="' + nodeProperties.subSpacing + '" class="' + prefix + 'SubMenuTable">'; + + var strSub = ''; + + var item; + var idSub; + var hasChild; + + var i; + + var classStr; + + for (i = 5; i < subMenu.length; ++i) + { + item = subMenu[i]; + if (!item) + continue; + + if (item == _cmSplit) + item = cmSplitItem (prefix, 0, true); + item.parentItem = subMenu; + item.subMenuID = id; + + hasChild = (item.length > 5); + idSub = hasChild ? cmNewID () : null; + + str += '<tr class="' + prefix + 'MenuItem"'; + if (item[0] != _cmNoClick) + str += cmActionItem (item, 0, idSub, menuInfo, menuID); + else + str += cmNoClickItem (item, 0, idSub, menuInfo, menuID); + str += '>' + + if (item[0] == _cmNoAction || item[0] == _cmNoClick) + { + str += cmNoActionItem (item); + str += '</tr>'; + continue; + } + + classStr = prefix + 'Menu'; + classStr += hasChild ? 'Folder' : 'Item'; + + str += '<td class="' + classStr + 'Left">'; + + if (item[0] != null) + str += item[0]; + else + str += hasChild ? nodeProperties.folderLeft : nodeProperties.itemLeft; + + str += '</td><td class="' + classStr + 'Text">' + item[1]; + + str += '</td><td class="' + classStr + 'Right">'; + + if (hasChild) + { + str += nodeProperties.folderRight; + strSub += cmDrawSubMenu (item, prefix, idSub, nodeProperties, zIndexStart + nodeProperties.zIndexInc, menuInfo, menuID); + } + else + str += nodeProperties.itemRight; + str += '</td></tr>'; + } + + str += '</table>'; + + if (nodeProperties.subMenuFooter) + str += nodeProperties.subMenuFooter; + str += '</div>' + strSub; + return str; +} + +// +// The function that builds the menu inside the specified element id. +// +// id id of the element +// orient orientation of the menu in [hv][ub][lr] format +// menu the menu object to be drawn +// nodeProperties properties for the theme +// prefix prefix of the theme +// +function cmDraw (id, menu, orient, nodeProperties, prefix) +{ + var obj = cmGetObject (id); + + if (!prefix) + prefix = nodeProperties.prefix; + if (!prefix) + prefix = ''; + if (!nodeProperties) + nodeProperties = _cmNodeProperties; + if (!orient) + orient = 'hbr'; + + var menuID = cmAllocMenu (id, menu, orient, nodeProperties, prefix); + var menuInfo = _cmMenuList[menuID]; + + // setup potentially missing properties + if (!nodeProperties.delay) + nodeProperties.delay = _cmNodeProperties.delay; + if (!nodeProperties.clickOpen) + nodeProperties.clickOpen = _cmNodeProperties.clickOpen; + if (!nodeProperties.zIndexStart) + nodeProperties.zIndexStart = _cmNodeProperties.zIndexStart; + if (!nodeProperties.zIndexInc) + nodeProperties.zIndexInc = _cmNodeProperties.zIndexInc; + if (!nodeProperties.offsetHMainAdjust) + nodeProperties.offsetHMainAdjust = _cmNodeProperties.offsetHMainAdjust; + if (!nodeProperties.offsetVMainAdjust) + nodeProperties.offsetVMainAdjust = _cmNodeProperties.offsetVMainAdjust; + if (!nodeProperties.offsetSubAdjust) + nodeProperties.offsetSubAdjust = _cmNodeProperties.offsetSubAdjust; + // save user setting on frame masking + menuInfo.cmFrameMasking = _cmFrameMasking; + + var str = '<table summary="main menu" class="' + prefix + 'Menu" cellspacing="' + nodeProperties.mainSpacing + '">'; + var strSub = ''; + + var vertical; + + // draw the main menu items + if (orient.charAt (0) == 'h') + { + str += '<tr>'; + vertical = false; + } + else + { + vertical = true; + } + + var i; + var item; + var idSub; + var hasChild; + + var classStr; + + for (i = 0; i < menu.length; ++i) + { + item = menu[i]; + + if (!item) + continue; + + item.menu = menu; + item.subMenuID = id; + + str += vertical ? '<tr' : '<td'; + str += ' class="' + prefix + 'MainItem"'; + + hasChild = (item.length > 5); + idSub = hasChild ? cmNewID () : null; + + str += cmActionItem (item, 1, idSub, menuInfo, menuID) + '>'; + + if (item == _cmSplit) + item = cmSplitItem (prefix, 1, vertical); + + if (item[0] == _cmNoAction || item[0] == _cmNoClick) + { + str += cmNoActionItem (item); + str += vertical? '</tr>' : '</td>'; + continue; + } + + classStr = prefix + 'Main' + (hasChild ? 'Folder' : 'Item'); + + str += vertical ? '<td' : '<span'; + str += ' class="' + classStr + 'Left">'; + + str += (item[0] == null) ? (hasChild ? nodeProperties.mainFolderLeft : nodeProperties.mainItemLeft) + : item[0]; + str += vertical ? '</td>' : '</span>'; + + str += vertical ? '<td' : '<span'; + str += ' class="' + classStr + 'Text">'; + str += item[1]; + + str += vertical ? '</td>' : '</span>'; + + str += vertical ? '<td' : '<span'; + str += ' class="' + classStr + 'Right">'; + + str += hasChild ? nodeProperties.mainFolderRight : nodeProperties.mainItemRight; + + str += vertical ? '</td>' : '</span>'; + + str += vertical ? '</tr>' : '</td>'; + + if (hasChild) + strSub += cmDrawSubMenu (item, prefix, idSub, nodeProperties, nodeProperties.zIndexStart, menuInfo, menuID); + } + if (!vertical) + str += '</tr>'; + str += '</table>' + strSub; + obj.innerHTML = str; +} + +// +// The function builds the menu inside the specified element id. +// +// This function is similar to cmDraw except that menu is taken from HTML node +// rather a javascript tree. This feature allows links to be scanned by search +// bots. +// +// This function basically converts HTML node to a javascript tree, and then calls +// cmDraw to draw the actual menu, replacing the hidden menu tree. +// +// Format: +// <div id="menu"> +// <ul style="visibility: hidden"> +// <li><span>icon</span><a href="link" title="description">main menu text</a> +// <ul> +// <li><span>icon</span><a href="link" title="description">submenu item</a> +// </li> +// </ul> +// </li> +// </ul> +// </div> +// +function cmDrawFromText (id, orient, nodeProperties, prefix) +{ + var domMenu = cmGetObject (id); + var menu = null; + for (var currentDomItem = domMenu.firstChild; currentDomItem; currentDomItem = currentDomItem.nextSibling) + { + if (!currentDomItem.tagName) + continue; + var tag = currentDomItem.tagName.toLowerCase (); + if (tag != 'ul' && tag != 'ol') + continue; + menu = cmDrawFromTextSubMenu (currentDomItem); + break; + } + if (menu) + cmDraw (id, menu, orient, nodeProperties, prefix); +} + +// +// a recursive function that build menu tree structure +// +function cmDrawFromTextSubMenu (domMenu) +{ + var items = new Array (); + for (var currentDomItem = domMenu.firstChild; currentDomItem; currentDomItem = currentDomItem.nextSibling) + { + if (!currentDomItem.tagName || currentDomItem.tagName.toLowerCase () != 'li') + continue; + if (currentDomItem.firstChild == null) + { + items[items.length] = _cmSplit; + continue; + } + var item = new Array (); + var currentItem = currentDomItem.firstChild; + var hasAction = false; + for (; currentItem; currentItem = currentItem.nextSibling) + { + // scan for span or div tag + if (!currentItem.tagName) + continue; + if (currentItem.className == 'cmNoClick') + { + item[0] = _cmNoClick; + item[1] = getActionHTML (currentItem); + hasAction = true; + break; + } + if (currentItem.className == 'cmNoAction') + { + item[0] = _cmNoAction; + item[1] = getActionHTML (currentItem); + hasAction = true; + break; + } + var tag = currentItem.tagName.toLowerCase (); + if (tag != 'span') + continue; + if (!currentItem.firstChild) + item[0] = null; + else + item[0] = currentItem.innerHTML; + currentItem = currentItem.nextSibling; + break; + } + if (hasAction) + { + items[items.length] = item; + continue; + } + if (!currentItem) + continue; + for (; currentItem; currentItem = currentItem.nextSibling) + { + if (!currentItem.tagName) + continue; + var tag = currentItem.tagName.toLowerCase (); + if (tag == 'a') + { + item[1] = currentItem.innerHTML; + item[2] = currentItem.href; + item[3] = currentItem.target; + item[4] = currentItem.title; + if (item[4] == '') + item[4] = null; + } + else if (tag == 'span' || tag == 'div') + { + item[1] = currentItem.innerHTML; + item[2] = null; + item[3] = null; + item[4] = null; + } + break; + } + + for (; currentItem; currentItem = currentItem.nextSibling) + { + // scan for span tag + if (!currentItem.tagName) + continue; + var tag = currentItem.tagName.toLowerCase (); + if (tag != 'ul' && tag != 'ol') + continue; + var subMenuItems = cmDrawFromTextSubMenu (currentItem); + for (i = 0; i < subMenuItems.length; ++i) + item[i + 5] = subMenuItems[i]; + break; + } + items[items.length] = item; + } + return items; +} + +// +// obtain the actual action item's action, which is inside a +// table. The first row should be it +// +function getActionHTML (htmlNode) +{ + var returnVal = '<td></td><td></td><td></td>'; + var currentDomItem; + // find the table first + for (currentDomItem = htmlNode.firstChild; currentDomItem; currentDomItem = currentDomItem.nextSibling) + { + if (currentDomItem.tagName && currentDomItem.tagName.toLowerCase () == 'table') + break; + } + if (!currentDomItem) + return returnVal; + // skip over tbody + for (currentDomItem = currentDomItem.firstChild; currentDomItem; currentDomItem = currentDomItem.nextSibling) + { + if (currentDomItem.tagName && currentDomItem.tagName.toLowerCase () == 'tbody') + break; + } + if (!currentDomItem) + return returnVal; + // get the first tr + for (currentDomItem = currentDomItem.firstChild; currentDomItem; currentDomItem = currentDomItem.nextSibling) + { + if (currentDomItem.tagName && currentDomItem.tagName.toLowerCase () == 'tr') + break; + } + if (!currentDomItem) + return returnVal; + return currentDomItem.innerHTML; +} + +// +// get the DOM object associated with the item +// +function cmGetMenuItem (item) +{ + if (!item.subMenuID) + return null; + var subMenu = cmGetObject (item.subMenuID); + // we are dealing with a main menu item + if (item.menu) + { + var menu = item.menu; + // skip over table, tbody, tr, reach td + subMenu = subMenu.firstChild.firstChild.firstChild.firstChild; + var i; + for (i = 0; i < menu.length; ++i) + { + if (menu[i] == item) + return subMenu; + subMenu = subMenu.nextSibling; + } + } + else if (item.parentItem) // sub menu item + { + var menu = item.parentItem; + var table = cmGetObject (item.subMenuID + 'Table'); + if (!table) + return null; + // skip over table, tbody, reach tr + subMenu = table.firstChild.firstChild; + var i; + for (i = 5; i < menu.length; ++i) + { + if (menu[i] == item) + return subMenu; + subMenu = subMenu.nextSibling; + } + } + return null; +} + +// +// disable a menu item +// +function cmDisableItem (item, prefix) +{ + if (!item) + return; + var menuItem = cmGetMenuItem (item); + if (!menuItem) + return; + if (item.menu) + menuItem.className = prefix + 'MainItemDisabled'; + else + menuItem.className = prefix + 'MenuItemDisabled'; + item.isDisabled = true; +} + +// +// enable a menu item +// +function cmEnableItem (item, prefix) +{ + if (!item) + return; + var menuItem = cmGetMenuItem (item); + if (!menuItem) + return; + if (item.menu) + menuItem.className = prefix + 'MainItem'; + else + menuItem.className = prefix + 'MenuItem'; + item.isDisabled = false; +} + +////////////////////////////////////////////////////////////////////// +// +// Mouse Event Handling Functions +// +////////////////////////////////////////////////////////////////////// + +// +// action should be taken for mouse moving in to the menu item +// +// Here we just do things concerning this menu item, w/o opening sub menus. +// +function cmItemMouseOver (obj, isMain, idSub, menuID, index, calledByOpenSub) +{ + if (!calledByOpenSub && _cmClicked) + { + cmItemMouseOverOpenSub (obj, isMain, idSub, menuID, index); + return; + } + + clearTimeout (_cmTimeOut); + + if (_cmItemList[index].isDisabled) + return; + + var prefix = _cmMenuList[menuID].prefix; + + if (!obj.cmMenuID) + { + obj.cmMenuID = menuID; + obj.cmIsMain = isMain; + } + + var thisMenu = cmGetThisMenu (obj, prefix); + + // insert obj into cmItems if cmItems doesn't have obj + if (!thisMenu.cmItems) + thisMenu.cmItems = new Array (); + var i; + for (i = 0; i < thisMenu.cmItems.length; ++i) + { + if (thisMenu.cmItems[i] == obj) + break; + } + if (i == thisMenu.cmItems.length) + { + //thisMenu.cmItems.push (obj); + thisMenu.cmItems[i] = obj; + } + + // hide the previous submenu that is not this branch + if (_cmCurrentItem) + { + // occationally, we get this case when user + // move the mouse slowly to the border + if (_cmCurrentItem == obj || _cmCurrentItem == thisMenu) + { + var item = _cmItemList[index]; + cmSetStatus (item); + return; + } + + var thatMenuInfo = _cmMenuList[_cmCurrentItem.cmMenuID]; + var thatPrefix = thatMenuInfo.prefix; + var thatMenu = cmGetThisMenu (_cmCurrentItem, thatPrefix); + + if (thatMenu != thisMenu.cmParentMenu) + { + if (_cmCurrentItem.cmIsMain) + _cmCurrentItem.className = thatPrefix + 'MainItem'; + else + _cmCurrentItem.className = thatPrefix + 'MenuItem'; + if (thatMenu.id != idSub) + cmHideMenu (thatMenu, thisMenu, thatMenuInfo); + } + } + + // okay, set the current menu to this obj + _cmCurrentItem = obj; + + // just in case, reset all items in this menu to MenuItem + cmResetMenu (thisMenu, prefix); + + var item = _cmItemList[index]; + var isDefaultItem = cmIsDefaultItem (item); + + if (isDefaultItem) + { + if (isMain) + obj.className = prefix + 'MainItemHover'; + else + obj.className = prefix + 'MenuItemHover'; + } + + cmSetStatus (item); +} + +// +// action should be taken for mouse moving in to the menu item +// +// This function also opens sub menu +// +function cmItemMouseOverOpenSub (obj, isMain, idSub, menuID, index) +{ + clearTimeout (_cmTimeOut); + + if (_cmItemList[index].isDisabled) + return; + + cmItemMouseOver (obj, isMain, idSub, menuID, index, true); + + if (idSub) + { + var subMenu = cmGetObject (idSub); + var menuInfo = _cmMenuList[menuID]; + var orient = menuInfo.orient; + var prefix = menuInfo.prefix; + cmShowSubMenu (obj, isMain, subMenu, menuInfo); + } +} + +// +// action should be taken for mouse moving out of the menu item +// +function cmItemMouseOut (obj, isMain, idSub, menuID, index) +{ + var delayTime = _cmMenuList[menuID].nodeProperties.delay; + _cmTimeOut = window.setTimeout ('cmHideMenuTime ()', delayTime); + window.defaultStatus = ''; +} + +// +// action should be taken for mouse button down at a menu item +// +function cmItemMouseDown (obj, isMain, idSub, menuID, index) +{ + if (_cmItemList[index].isDisabled) + return; + + if (cmIsDefaultItem (_cmItemList[index])) + { + var prefix = _cmMenuList[menuID].prefix; + if (obj.cmIsMain) + obj.className = prefix + 'MainItemActive'; + else + obj.className = prefix + 'MenuItemActive'; + } +} + +// +// action should be taken for mouse button down at a menu item +// this is one also opens submenu if needed +// +function cmItemMouseDownOpenSub (obj, isMain, idSub, menuID, index) +{ + if (_cmItemList[index].isDisabled) + return; + + _cmClicked = true; + cmItemMouseDown (obj, isMain, idSub, menuID, index); + + if (idSub) + { + var subMenu = cmGetObject (idSub); + var menuInfo = _cmMenuList[menuID]; + cmShowSubMenu (obj, isMain, subMenu, menuInfo); + } +} + +// +// action should be taken for mouse button up at a menu item +// +function cmItemMouseUp (obj, isMain, idSub, menuID, index) +{ + if (_cmItemList[index].isDisabled) + return; + + var item = _cmItemList[index]; + + var link = null, target = '_self'; + + if (item.length > 2) + link = item[2]; + if (item.length > 3 && item[3]) + target = item[3]; + + if (link != null) + { + _cmClicked = false; + window.open (link, target); + } + + var menuInfo = _cmMenuList[menuID]; + var prefix = menuInfo.prefix; + var thisMenu = cmGetThisMenu (obj, prefix); + + var hasChild = (item.length > 5); + if (!hasChild) + { + if (cmIsDefaultItem (item)) + { + if (obj.cmIsMain) + obj.className = prefix + 'MainItem'; + else + obj.className = prefix + 'MenuItem'; + } + cmHideMenu (thisMenu, null, menuInfo); + } + else + { + if (cmIsDefaultItem (item)) + { + if (obj.cmIsMain) + obj.className = prefix + 'MainItemHover'; + else + obj.className = prefix + 'MenuItemHover'; + } + } +} + +////////////////////////////////////////////////////////////////////// +// +// Mouse Event Support Utility Functions +// +////////////////////////////////////////////////////////////////////// + +// +// move submenu to the appropriate location +// +function cmMoveSubMenu (obj, isMain, subMenu, menuInfo) +{ + var orient = menuInfo.orient; + + var offsetAdjust; + + if (isMain) + { + if (orient.charAt (0) == 'h') + offsetAdjust = menuInfo.nodeProperties.offsetHMainAdjust; + else + offsetAdjust = menuInfo.nodeProperties.offsetVMainAdjust; + } + else + offsetAdjust = menuInfo.nodeProperties.offsetSubAdjust; + + if (!isMain && orient.charAt (0) == 'h') + orient = 'v' + orient.charAt (1) + orient.charAt (2); + + var mode = String (orient); + var p = subMenu.offsetParent; + var subMenuWidth = cmGetWidth (subMenu); + var horiz = cmGetHorizontalAlign (obj, mode, p, subMenuWidth); + if (mode.charAt (0) == 'h') + { + if (mode.charAt (1) == 'b') + subMenu.style.top = (cmGetYAt (obj, p) + cmGetHeight (obj) + offsetAdjust[1]) + 'px'; + else + subMenu.style.top = (cmGetYAt (obj, p) - cmGetHeight (subMenu) - offsetAdjust[1]) + 'px'; + if (horiz == 'r') + subMenu.style.left = (cmGetXAt (obj, p) + offsetAdjust[0]) + 'px'; + else + subMenu.style.left = (cmGetXAt (obj, p) + cmGetWidth (obj) - subMenuWidth - offsetAdjust[0]) + 'px'; + } + else + { + if (horiz == 'r') + subMenu.style.left = (cmGetXAt (obj, p) + cmGetWidth (obj) + offsetAdjust[0]) + 'px'; + else + subMenu.style.left = (cmGetXAt (obj, p) - subMenuWidth - offsetAdjust[0]) + 'px'; + if (mode.charAt (1) == 'b') + subMenu.style.top = (cmGetYAt (obj, p) + offsetAdjust[1]) + 'px'; + else + subMenu.style.top = (cmGetYAt (obj, p) + cmGetHeight (obj) - cmGetHeight (subMenu) + offsetAdjust[1]) + 'px'; + } + + // IE specific iframe masking method + /*@cc_on + @if (@_jscript_version >= 5.5) + if (menuInfo.cmFrameMasking) + { + if (!subMenu.cmFrameObj) + { + var frameObj = cmAllocFrame (); + subMenu.cmFrameObj = frameObj; + } + + var frameObj = subMenu.cmFrameObj; + frameObj.style.zIndex = subMenu.style.zIndex - 1; + frameObj.style.left = (cmGetX (subMenu) - cmGetX (frameObj.offsetParent)) + 'px'; + frameObj.style.top = (cmGetY (subMenu) - cmGetY (frameObj.offsetParent)) + 'px'; + frameObj.style.width = cmGetWidth (subMenu) + 'px'; + frameObj.style.height = cmGetHeight (subMenu) + 'px'; + frameObj.style.display = 'block'; + } + @end + @*/ + if (horiz != orient.charAt (2)) + orient = orient.charAt (0) + orient.charAt (1) + horiz; + return orient; +} + +// +// automatically re-adjust the menu position based on available screen size. +// +function cmGetHorizontalAlign (obj, mode, p, subMenuWidth) +{ + var horiz = mode.charAt (2); + if (!(document.body)) + return horiz; + var body = document.body; + var browserLeft; + var browserRight; + if (window.innerWidth) + { + // DOM window attributes + browserLeft = window.pageXOffset; + browserRight = window.innerWidth + browserLeft; + } + else if (body.clientWidth) + { + // IE attributes + browserLeft = body.clientLeft; + browserRight = body.clientWidth + browserLeft; + } + else + return horiz; + if (mode.charAt (0) == 'h') + { + if (horiz == 'r' && (cmGetXAt (obj) + subMenuWidth) > browserRight) + horiz = 'l'; + if (horiz == 'l' && (cmGetXAt (obj) + cmGetWidth (obj) - subMenuWidth) < browserLeft) + horiz = 'r'; + return horiz; + } + else + { + if (horiz == 'r' && (cmGetXAt (obj, p) + cmGetWidth (obj) + subMenuWidth) > browserRight) + horiz = 'l'; + if (horiz == 'l' && (cmGetXAt (obj, p) - subMenuWidth) < browserLeft) + horiz = 'r'; + return horiz; + } +} + +// +// show the subMenu w/ specified orientation +// also move it to the correct coordinates +// +function cmShowSubMenu (obj, isMain, subMenu, menuInfo) +{ + var prefix = menuInfo.prefix; + + if (!subMenu.cmParentMenu) + { + // establish the tree w/ back edge + var thisMenu = cmGetThisMenu (obj, prefix); + subMenu.cmParentMenu = thisMenu; + if (!thisMenu.cmSubMenu) + thisMenu.cmSubMenu = new Array (); + thisMenu.cmSubMenu[thisMenu.cmSubMenu.length] = subMenu; + } + + var effectInstance = subMenu.cmEffect; + if (effectInstance) + effectInstance.showEffect (true); + else + { + // position the sub menu only if we are not already showing the submenu + var orient = cmMoveSubMenu (obj, isMain, subMenu, menuInfo); + subMenu.cmOrient = orient; + + var forceShow = false; + if (subMenu.style.visibility != 'visible' && menuInfo.nodeProperties.effect) + { + try + { + effectInstance = menuInfo.nodeProperties.effect.getInstance (subMenu, orient); + effectInstance.showEffect (false); + } + catch (e) + { + forceShow = true; + subMenu.cmEffect = null; + } + } + else + forceShow = true; + + if (forceShow) + { + subMenu.style.visibility = 'visible'; + /*@cc_on + @if (@_jscript_version >= 5.5) + if (subMenu.cmFrameObj) + subMenu.cmFrameObj.style.display = 'block'; + @end + @*/ + } + } + + if (!_cmHideObjects) + { + _cmHideObjects = 2; // default = not hide, may change behavior later + try + { + if (window.opera) + { + if (parseInt (navigator.appVersion) < 9) + _cmHideObjects = 1; + } + } + catch (e) + { + } + } + + if (_cmHideObjects == 1) + { + if (!subMenu.cmOverlap) + subMenu.cmOverlap = new Array (); + cmHideControl ("IFRAME", subMenu); + cmHideControl ("OBJECT", subMenu); + } +} + +// +// reset all the menu items to class MenuItem in thisMenu +// +function cmResetMenu (thisMenu, prefix) +{ + if (thisMenu.cmItems) + { + var i; + var str; + var items = thisMenu.cmItems; + for (i = 0; i < items.length; ++i) + { + if (items[i].cmIsMain) + { + if (items[i].className == (prefix + 'MainItemDisabled')) + continue; + } + else + { + if (items[i].className == (prefix + 'MenuItemDisabled')) + continue; + } + if (items[i].cmIsMain) + str = prefix + 'MainItem'; + else + str = prefix + 'MenuItem'; + if (items[i].className != str) + items[i].className = str; + } + } +} + +// +// called by the timer to hide the menu +// +function cmHideMenuTime () +{ + _cmClicked = false; + if (_cmCurrentItem) + { + var menuInfo = _cmMenuList[_cmCurrentItem.cmMenuID]; + var prefix = menuInfo.prefix; + cmHideMenu (cmGetThisMenu (_cmCurrentItem, prefix), null, menuInfo); + _cmCurrentItem = null; + } +} + +// +// Only hides this menu +// +function cmHideThisMenu (thisMenu, menuInfo) +{ + var effectInstance = thisMenu.cmEffect; + if (effectInstance) + effectInstance.hideEffect (true); + else + { + thisMenu.style.visibility = 'hidden'; + thisMenu.style.top = '0px'; + thisMenu.style.left = '0px'; + thisMenu.cmOrient = null; + /*@cc_on + @if (@_jscript_version >= 5.5) + if (thisMenu.cmFrameObj) + { + var frameObj = thisMenu.cmFrameObj; + frameObj.style.display = 'none'; + frameObj.style.width = '1px'; + frameObj.style.height = '1px'; + thisMenu.cmFrameObj = null; + cmFreeFrame (frameObj); + } + @end + @*/ + } + + cmShowControl (thisMenu); + thisMenu.cmItems = null; +} + +// +// hide thisMenu, children of thisMenu, as well as the ancestor +// of thisMenu until currentMenu is encountered. currentMenu +// will not be hidden +// +function cmHideMenu (thisMenu, currentMenu, menuInfo) +{ + var prefix = menuInfo.prefix; + var str = prefix + 'SubMenu'; + + // hide the down stream menus + if (thisMenu.cmSubMenu) + { + var i; + for (i = 0; i < thisMenu.cmSubMenu.length; ++i) + { + cmHideSubMenu (thisMenu.cmSubMenu[i], menuInfo); + } + } + + // hide the upstream menus + while (thisMenu && thisMenu != currentMenu) + { + cmResetMenu (thisMenu, prefix); + if (thisMenu.className == str) + { + cmHideThisMenu (thisMenu, menuInfo); + } + else + break; + thisMenu = cmGetThisMenu (thisMenu.cmParentMenu, prefix); + } +} + +// +// hide thisMenu as well as its sub menus if thisMenu is not +// already hidden +// +function cmHideSubMenu (thisMenu, menuInfo) +{ + if (thisMenu.style.visibility == 'hidden') + return; + if (thisMenu.cmSubMenu) + { + var i; + for (i = 0; i < thisMenu.cmSubMenu.length; ++i) + { + cmHideSubMenu (thisMenu.cmSubMenu[i], menuInfo); + } + } + var prefix = menuInfo.prefix; + cmResetMenu (thisMenu, prefix); + cmHideThisMenu (thisMenu, menuInfo); +} + +// +// hide a control such as IFRAME +// +function cmHideControl (tagName, subMenu) +{ + var x = cmGetX (subMenu); + var y = cmGetY (subMenu); + var w = subMenu.offsetWidth; + var h = subMenu.offsetHeight; + + var i; + for (i = 0; i < document.all.tags(tagName).length; ++i) + { + var obj = document.all.tags(tagName)[i]; + if (!obj || !obj.offsetParent) + continue; + + // check if the object and the subMenu overlap + + var ox = cmGetX (obj); + var oy = cmGetY (obj); + var ow = obj.offsetWidth; + var oh = obj.offsetHeight; + + if (ox > (x + w) || (ox + ow) < x) + continue; + if (oy > (y + h) || (oy + oh) < y) + continue; + + // if object is already made hidden by a different + // submenu then we dont want to put it on overlap list of + // of a submenu a second time. + // - bug fixed by Felix Zaslavskiy + if(obj.style.visibility == 'hidden') + continue; + + //subMenu.cmOverlap.push (obj); + subMenu.cmOverlap[subMenu.cmOverlap.length] = obj; + obj.style.visibility = 'hidden'; + } +} + +// +// show the control hidden by the subMenu +// +function cmShowControl (subMenu) +{ + if (subMenu.cmOverlap) + { + var i; + for (i = 0; i < subMenu.cmOverlap.length; ++i) + subMenu.cmOverlap[i].style.visibility = ""; + } + subMenu.cmOverlap = null; +} + +// +// returns the main menu or the submenu table where this obj (menu item) +// is in +// +function cmGetThisMenu (obj, prefix) +{ + var str1 = prefix + 'SubMenu'; + var str2 = prefix + 'Menu'; + while (obj) + { + if (obj.className == str1 || obj.className == str2) + return obj; + obj = obj.parentNode; + } + return null; +} + +// +// A special effect function to hook the menu which contains +// special effect object to the timer. +// +function cmTimeEffect (menuID, show, delayTime) +{ + window.setTimeout ('cmCallEffect("' + menuID + '",' + show + ')', delayTime); +} + +// +// A special effect function. Called by timer. +// +function cmCallEffect (menuID, show) +{ + var menu = cmGetObject (menuID); + if (!menu || !menu.cmEffect) + return; + try + { + if (show) + menu.cmEffect... [truncated message content] |
From: <fan...@us...> - 2008-03-29 16:24:03
|
Revision: 4911 http://linpha.svn.sourceforge.net/linpha/?rev=4911&view=rev Author: fangehrn Date: 2008-03-29 09:23:55 -0700 (Sat, 29 Mar 2008) Log Message: ----------- this did not work, merge back to original (JSCookMenu contains at this moment no changes from our side) Modified Paths: -------------- trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.yui.js Modified: trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js =================================================================== --- trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js 2008-03-29 16:15:56 UTC (rev 4910) +++ trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js 2008-03-29 16:23:55 UTC (rev 4911) @@ -299,7 +299,7 @@ if (!item) continue; - if (item == "_cmSplit") + if (item == _cmSplit) item = cmSplitItem (prefix, 0, true); item.parentItem = subMenu; item.subMenuID = id; @@ -308,13 +308,13 @@ idSub = hasChild ? cmNewID () : null; str += '<tr class="' + prefix + 'MenuItem"'; - if (item[0] != "_cmNoClick") + if (item[0] != _cmNoClick) str += cmActionItem (item, 0, idSub, menuInfo, menuID); else str += cmNoClickItem (item, 0, idSub, menuInfo, menuID); str += '>' - if (item[0] == _cmNoAction || item[0] == "_cmNoClick") + if (item[0] == _cmNoAction || item[0] == _cmNoClick) { str += cmNoActionItem (item); str += '</tr>'; @@ -437,10 +437,10 @@ str += cmActionItem (item, 1, idSub, menuInfo, menuID) + '>'; - if (item == "_cmSplit") + if (item == _cmSplit) item = cmSplitItem (prefix, 1, vertical); - if (item[0] == _cmNoAction || item[0] == "_cmNoClick") + if (item[0] == _cmNoAction || item[0] == _cmNoClick) { str += cmNoActionItem (item); str += vertical? '</tr>' : '</td>'; @@ -532,7 +532,7 @@ continue; if (currentDomItem.firstChild == null) { - items[items.length] = "_cmSplit"; + items[items.length] = _cmSplit; continue; } var item = new Array (); @@ -545,7 +545,7 @@ continue; if (currentItem.className == 'cmNoClick') { - item[0] = "_cmNoClick"; + item[0] = _cmNoClick; item[1] = getActionHTML (currentItem); hasAction = true; break; @@ -1392,7 +1392,7 @@ // function cmIsDefaultItem (item) { - if (item == "_cmSplit" || item[0] == _cmNoAction || item[0] == "_cmNoClick") + if (item == _cmSplit || item[0] == _cmNoAction || item[0] == _cmNoClick) return false; return true; } Modified: trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.yui.js =================================================================== --- trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.yui.js 2008-03-29 16:15:56 UTC (rev 4910) +++ trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.yui.js 2008-03-29 16:23:55 UTC (rev 4911) @@ -11,7 +11,7 @@ } } @end -@*/var _cmClicked=false;var _cmHideObjects=0;function cmClone(A){var B=new Object();for(v in A){B[v]=A[v]}return B}function cmAllocMenu(G,F,B,A,C){var D=new Object();D.div=G;D.menu=F;D.orient=B;D.nodeProperties=A;D.prefix=C;var E=_cmMenuList.length;_cmMenuList[E]=D;return E}function cmAllocFrame(){if(_cmFrameListSize>0){return cmGetObject(_cmFrameList[--_cmFrameListSize])}var A=document.createElement("iframe");var B=_cmFrameIDCount++;A.id="cmFrame"+B;A.frameBorder="0";A.style.display="none";A.src="javascript:false";document.body.appendChild(A);A.style.filter="alpha(opacity=0)";A.style.zIndex=99;A.style.position="absolute";A.style.border="0";A.scrolling="no";return A}function cmFreeFrame(A){_cmFrameList[_cmFrameListSize++]=A.id}function cmNewID(){return _cmIDName+(++_cmIDCount)}function cmActionItem(J,I,H,D,A){_cmItemList[_cmItemList.length]=J;var F=_cmItemList.length-1;H=(!H)?"null":("'"+H+"'");var E=D.nodeProperties.clickOpen;var G=(E==3)||(E==2&&I);var C="this,"+I+","+H+","+A+","+F;var B;if(G){B=' onmouseover="cmItemMouseOver('+C+',false)" onmousedown="cmItemMouseDownOpenSub ('+C+')"'}else{B=' onmouseover="cmItemMouseOverOpenSub ('+C+')" onmousedown="cmItemMouseDown ('+C+')"'}return B+' onmouseout="cmItemMouseOut ('+C+')" onmouseup="cmItemMouseUp ('+C+')"'}function cmNoClickItem(D,B,A,E,G){_cmItemList[_cmItemList.length]=D;var C=_cmItemList.length-1;A=(!A)?"null":("'"+A+"'");var F="this,"+B+","+A+","+G+","+C;return' onmouseover="cmItemMouseOver ('+F+')" onmouseout="cmItemMouseOut ('+F+')"'}function cmNoActionItem(A){return A[1]}function cmSplitItem(prefix,isMain,vertical){var classStr="cm"+prefix;if(isMain){classStr+="Main";if(vertical){classStr+="HSplit"}else{classStr+="VSplit"}}else{classStr+="HSplit"}return eval(classStr)}function cmDrawSubMenu(G,J,B,N,D,E,A){var K='<div class="'+J+'SubMenu" id="'+B+'" style="z-index: '+D+';position: absolute; top: 0px; left: 0px;">';if(N.subMenuHeader){K+=N.subMenuHeader}K+='<table summary="sub menu" id="'+B+'Table" cellspacing="'+N.subSpacing+'" class="'+J+'SubMenuTable">';var I="";var M;var L;var C;var H;var F;for(H=5;H<G.length;++H){M=G[H];if(!M){continue}if(M=="_cmSplit"){M=cmSplitItem(J,0,true)}M.parentItem=G;M.subMenuID=B;C=(M.length>5);L=C?cmNewID():null;K+='<tr class="'+J+'MenuItem"';if(M[0]!="_cmNoClick"){K+=cmActionItem(M,0,L,E,A)}else{K+=cmNoClickItem(M,0,L,E,A)}K+=">";if(M[0]==_cmNoAction||M[0]=="_cmNoClick"){K+=cmNoActionItem(M);K+="</tr>";continue}F=J+"Menu";F+=C?"Folder":"Item";K+='<td class="'+F+'Left">';if(M[0]!=null){K+=M[0]}else{K+=C?N.folderLeft:N.itemLeft}K+='</td><td class="'+F+'Text">'+M[1];K+='</td><td class="'+F+'Right">';if(C){K+=N.folderRight;I+=cmDrawSubMenu(M,J,L,N,D+N.zIndexInc,E,A)}else{K+=N.itemRight}K+="</td></tr>"}K+="</table>";if(N.subMenuFooter){K+=N.subMenuFooter}K+="</div>"+I;return K}function cmDraw(B,C,H,P,L){var J=cmGetObject(B);if(!L){L=P.prefix}if(!L){L=""}if(!P){P=_cmNodeProperties}if(!H){H="hbr"}var A=cmAllocMenu(B,C,H,P,L);var F=_cmMenuList[A];if(!P.delay){P.delay=_cmNodeProperties.delay}if(!P.clickOpen){P.clickOpen=_cmNodeProperties.clickOpen}if(!P.zIndexStart){P.zIndexStart=_cmNodeProperties.zIndexStart}if(!P.zIndexInc){P.zIndexInc=_cmNodeProperties.zIndexInc}if(!P.offsetHMainAdjust){P.offsetHMainAdjust=_cmNodeProperties.offsetHMainAdjust}if(!P.offsetVMainAdjust){P.offsetVMainAdjust=_cmNodeProperties.offsetVMainAdjust}if(!P.offsetSubAdjust){P.offsetSubAdjust=_cmNodeProperties.offsetSubAdjust}F.cmFrameMasking=_cmFrameMasking;var M='<table summary="main menu" class="'+L+'Menu" cellspacing="'+P.mainSpacing+'">';var K="";var E;if(H.charAt(0)=="h"){M+="<tr>";E=false}else{E=true}var I;var O;var N;var D;var G;for(I=0;I<C.length;++I){O=C[I];if(!O){continue}O.menu=C;O.subMenuID=B;M+=E?"<tr":"<td";M+=' class="'+L+'MainItem"';D=(O.length>5);N=D?cmNewID():null;M+=cmActionItem(O,1,N,F,A)+">";if(O=="_cmSplit"){O=cmSplitItem(L,1,E)}if(O[0]==_cmNoAction||O[0]=="_cmNoClick"){M+=cmNoActionItem(O);M+=E?"</tr>":"</td>";continue}G=L+"Main"+(D?"Folder":"Item");M+=E?"<td":"<span";M+=' class="'+G+'Left">';M+=(O[0]==null)?(D?P.mainFolderLeft:P.mainItemLeft):O[0];M+=E?"</td>":"</span>";M+=E?"<td":"<span";M+=' class="'+G+'Text">';M+=O[1];M+=E?"</td>":"</span>";M+=E?"<td":"<span";M+=' class="'+G+'Right">';M+=D?P.mainFolderRight:P.mainItemRight;M+=E?"</td>":"</span>";M+=E?"</tr>":"</td>";if(D){K+=cmDrawSubMenu(O,L,N,P,P.zIndexStart,F,A)}}if(!E){M+="</tr>"}M+="</table>"+K;J.innerHTML=M}function cmDrawFromText(H,C,B,E){var F=cmGetObject(H);var G=null;for(var D=F.firstChild;D;D=D.nextSibling){if(!D.tagName){continue}var A=D.tagName.toLowerCase();if(A!="ul"&&A!="ol"){continue}G=cmDrawFromTextSubMenu(D);break}if(G){cmDraw(H,G,C,B,E)}}function cmDrawFromTextSubMenu(H){var D=new Array();for(var G=H.firstChild;G;G=G.nextSibling){if(!G.tagName||G.tagName.toLowerCase()!="li"){continue}if(G.firstChild==null){D[D.length]="_cmSplit";continue}var F=new Array();var E=G.firstChild;var C=false;for(;E;E=E.nextSibling){if(!E.tagName){continue}if(E.className=="cmNoClick"){F[0]="_cmNoClick";F[1]=getActionHTML(E);C=true;break}if(E.className=="cmNoAction"){F[0]=_cmNoAction;F[1]=getActionHTML(E);C=true;break}var A=E.tagName.toLowerCase();if(A!="span"){continue}if(!E.firstChild){F[0]=null}else{F[0]=E.innerHTML}E=E.nextSibling;break}if(C){D[D.length]=F;continue}if(!E){continue}for(;E;E=E.nextSibling){if(!E.tagName){continue}var A=E.tagName.toLowerCase();if(A=="a"){F[1]=E.innerHTML;F[2]=E.href;F[3]=E.target;F[4]=E.title;if(F[4]==""){F[4]=null}}else{if(A=="span"||A=="div"){F[1]=E.innerHTML;F[2]=null;F[3]=null;F[4]=null}}break}for(;E;E=E.nextSibling){if(!E.tagName){continue}var A=E.tagName.toLowerCase();if(A!="ul"&&A!="ol"){continue}var B=cmDrawFromTextSubMenu(E);for(i=0;i<B.length;++i){F[i+5]=B[i]}break}D[D.length]=F}return D}function getActionHTML(C){var A="<td></td><td></td><td></td>";var B;for(B=C.firstChild;B;B=B.nextSibling){if(B.tagName&&B.tagName.toLowerCase()=="table"){break}}if(!B){return A}for(B=B.firstChild;B;B=B.nextSibling){if(B.tagName&&B.tagName.toLowerCase()=="tbody"){break}}if(!B){return A}for(B=B.firstChild;B;B=B.nextSibling){if(B.tagName&&B.tagName.toLowerCase()=="tr"){break}}if(!B){return A}return B.innerHTML}function cmGetMenuItem(D){if(!D.subMenuID){return null}var A=cmGetObject(D.subMenuID);if(D.menu){var E=D.menu;A=A.firstChild.firstChild.firstChild.firstChild;var B;for(B=0;B<E.length;++B){if(E[B]==D){return A}A=A.nextSibling}}else{if(D.parentItem){var E=D.parentItem;var C=cmGetObject(D.subMenuID+"Table");if(!C){return null}A=C.firstChild.firstChild;var B;for(B=5;B<E.length;++B){if(E[B]==D){return A}A=A.nextSibling}}}return null}function cmDisableItem(B,C){if(!B){return }var A=cmGetMenuItem(B);if(!A){return }if(B.menu){A.className=C+"MainItemDisabled"}else{A.className=C+"MenuItemDisabled"}B.isDisabled=true}function cmEnableItem(B,C){if(!B){return }var A=cmGetMenuItem(B);if(!A){return }if(B.menu){menu.className=C+"MainItem"}else{menu.className=C+"MenuItem"}B.isDisabled=true}function cmItemMouseOver(D,L,K,A,F,N){if(!N&&_cmClicked){cmItemMouseOverOpenSub(D,L,K,A,F);return }clearTimeout(_cmTimeOut);if(_cmItemList[F].isDisabled){return }var E=_cmMenuList[A].prefix;if(!D.cmMenuID){D.cmMenuID=A;D.cmIsMain=L}var B=cmGetThisMenu(D,E);if(!B.cmItems){B.cmItems=new Array()}var C;for(C=0;C<B.cmItems.length;++C){if(B.cmItems[C]==D){break}}if(C==B.cmItems.length){B.cmItems[C]=D}if(_cmCurrentItem){if(_cmCurrentItem==D||_cmCurrentItem==B){var M=_cmItemList[F];cmSetStatus(M);return }var H=_cmMenuList[_cmCurrentItem.cmMenuID];var J=H.prefix;var I=cmGetThisMenu(_cmCurrentItem,J);if(I!=B.cmParentMenu){if(_cmCurrentItem.cmIsMain){_cmCurrentItem.className=J+"MainItem"}else{_cmCurrentItem.className=J+"MenuItem"}if(I.id!=K){cmHideMenu(I,B,H)}}}_cmCurrentItem=D;cmResetMenu(B,E);var M=_cmItemList[F];var G=cmIsDefaultItem(M);if(G){if(L){D.className=E+"MainItemHover"}else{D.className=E+"MenuItemHover"}}cmSetStatus(M)}function cmItemMouseOverOpenSub(E,I,H,A,G){clearTimeout(_cmTimeOut);if(_cmItemList[G].isDisabled){return }cmItemMouseOver(E,I,H,A,G,true);if(H){var D=cmGetObject(H);var B=_cmMenuList[A];var C=B.orient;var F=B.prefix;cmShowSubMenu(E,I,D,B)}}function cmItemMouseOut(D,B,A,F,C){var E=_cmMenuList[F].nodeProperties.delay;_cmTimeOut=window.setTimeout("cmHideMenuTime ()",E);window.defaultStatus=""}function cmItemMouseDown(E,B,A,F,C){if(_cmItemList[C].isDisabled){return }if(cmIsDefaultItem(_cmItemList[C])){var D=_cmMenuList[F].prefix;if(E.cmIsMain){E.className=D+"MainItemActive"}else{E.className=D+"MenuItemActive"}}}function cmItemMouseDownOpenSub(F,B,A,G,D){if(_cmItemList[D].isDisabled){return }_cmClicked=true;cmItemMouseDown(F,B,A,G,D);if(A){var C=cmGetObject(A);var E=_cmMenuList[G];cmShowSubMenu(F,B,C,E)}}function cmItemMouseUp(E,K,J,A,G){if(_cmItemList[G].isDisabled){return }var L=_cmItemList[G];var I=null,H="_self";if(L.length>2){I=L[2]}if(L.length>3&&L[3]){H=L[3]}if(I!=null){_cmClicked=false;window.open(I,H)}var D=_cmMenuList[A];var F=D.prefix;var C=cmGetThisMenu(E,F);var B=(L.length>5);if(!B){if(cmIsDefaultItem(L)){if(E.cmIsMain){E.className=F+"MainItem"}else{E.className=F+"MenuItem"}}cmHideMenu(C,null,D)}else{if(cmIsDefaultItem(L)){if(E.cmIsMain){E.className=F+"MainItemHover"}else{E.className=F+"MenuItemHover"}}}}function cmMoveSubMenu(obj,isMain,subMenu,menuInfo){var orient=menuInfo.orient;var offsetAdjust;if(isMain){if(orient.charAt(0)=="h"){offsetAdjust=menuInfo.nodeProperties.offsetHMainAdjust}else{offsetAdjust=menuInfo.nodeProperties.offsetVMainAdjust}}else{offsetAdjust=menuInfo.nodeProperties.offsetSubAdjust}if(!isMain&&orient.charAt(0)=="h"){orient="v"+orient.charAt(1)+orient.charAt(2)}var mode=String(orient);var p=subMenu.offsetParent;var subMenuWidth=cmGetWidth(subMenu);var horiz=cmGetHorizontalAlign(obj,mode,p,subMenuWidth);if(mode.charAt(0)=="h"){if(mode.charAt(1)=="b"){subMenu.style.top=(cmGetYAt(obj,p)+cmGetHeight(obj)+offsetAdjust[1])+"px"}else{subMenu.style.top=(cmGetYAt(obj,p)-cmGetHeight(subMenu)-offsetAdjust[1])+"px"}if(horiz=="r"){subMenu.style.left=(cmGetXAt(obj,p)+offsetAdjust[0])+"px"}else{subMenu.style.left=(cmGetXAt(obj,p)+cmGetWidth(obj)-subMenuWidth-offsetAdjust[0])+"px"}}else{if(horiz=="r"){subMenu.style.left=(cmGetXAt(obj,p)+cmGetWidth(obj)+offsetAdjust[0])+"px"}else{subMenu.style.left=(cmGetXAt(obj,p)-subMenuWidth-offsetAdjust[0])+"px"}if(mode.charAt(1)=="b"){subMenu.style.top=(cmGetYAt(obj,p)+offsetAdjust[1])+"px"}else{subMenu.style.top=(cmGetYAt(obj,p)+cmGetHeight(obj)-cmGetHeight(subMenu)+offsetAdjust[1])+"px"}}/*@cc_on +@*/var _cmClicked=false;var _cmHideObjects=0;function cmClone(A){var B=new Object();for(v in A){B[v]=A[v]}return B}function cmAllocMenu(G,F,B,A,C){var D=new Object();D.div=G;D.menu=F;D.orient=B;D.nodeProperties=A;D.prefix=C;var E=_cmMenuList.length;_cmMenuList[E]=D;return E}function cmAllocFrame(){if(_cmFrameListSize>0){return cmGetObject(_cmFrameList[--_cmFrameListSize])}var A=document.createElement("iframe");var B=_cmFrameIDCount++;A.id="cmFrame"+B;A.frameBorder="0";A.style.display="none";A.src="javascript:false";document.body.appendChild(A);A.style.filter="alpha(opacity=0)";A.style.zIndex=99;A.style.position="absolute";A.style.border="0";A.scrolling="no";return A}function cmFreeFrame(A){_cmFrameList[_cmFrameListSize++]=A.id}function cmNewID(){return _cmIDName+(++_cmIDCount)}function cmActionItem(J,I,H,D,A){_cmItemList[_cmItemList.length]=J;var F=_cmItemList.length-1;H=(!H)?"null":("'"+H+"'");var E=D.nodeProperties.clickOpen;var G=(E==3)||(E==2&&I);var C="this,"+I+","+H+","+A+","+F;var B;if(G){B=' onmouseover="cmItemMouseOver('+C+',false)" onmousedown="cmItemMouseDownOpenSub ('+C+')"'}else{B=' onmouseover="cmItemMouseOverOpenSub ('+C+')" onmousedown="cmItemMouseDown ('+C+')"'}return B+' onmouseout="cmItemMouseOut ('+C+')" onmouseup="cmItemMouseUp ('+C+')"'}function cmNoClickItem(D,B,A,E,G){_cmItemList[_cmItemList.length]=D;var C=_cmItemList.length-1;A=(!A)?"null":("'"+A+"'");var F="this,"+B+","+A+","+G+","+C;return' onmouseover="cmItemMouseOver ('+F+')" onmouseout="cmItemMouseOut ('+F+')"'}function cmNoActionItem(A){return A[1]}function cmSplitItem(prefix,isMain,vertical){var classStr="cm"+prefix;if(isMain){classStr+="Main";if(vertical){classStr+="HSplit"}else{classStr+="VSplit"}}else{classStr+="HSplit"}return eval(classStr)}function cmDrawSubMenu(G,J,B,N,D,E,A){var K='<div class="'+J+'SubMenu" id="'+B+'" style="z-index: '+D+';position: absolute; top: 0px; left: 0px;">';if(N.subMenuHeader){K+=N.subMenuHeader}K+='<table summary="sub menu" id="'+B+'Table" cellspacing="'+N.subSpacing+'" class="'+J+'SubMenuTable">';var I="";var M;var L;var C;var H;var F;for(H=5;H<G.length;++H){M=G[H];if(!M){continue}if(M==_cmSplit){M=cmSplitItem(J,0,true)}M.parentItem=G;M.subMenuID=B;C=(M.length>5);L=C?cmNewID():null;K+='<tr class="'+J+'MenuItem"';if(M[0]!=_cmNoClick){K+=cmActionItem(M,0,L,E,A)}else{K+=cmNoClickItem(M,0,L,E,A)}K+=">";if(M[0]==_cmNoAction||M[0]==_cmNoClick){K+=cmNoActionItem(M);K+="</tr>";continue}F=J+"Menu";F+=C?"Folder":"Item";K+='<td class="'+F+'Left">';if(M[0]!=null){K+=M[0]}else{K+=C?N.folderLeft:N.itemLeft}K+='</td><td class="'+F+'Text">'+M[1];K+='</td><td class="'+F+'Right">';if(C){K+=N.folderRight;I+=cmDrawSubMenu(M,J,L,N,D+N.zIndexInc,E,A)}else{K+=N.itemRight}K+="</td></tr>"}K+="</table>";if(N.subMenuFooter){K+=N.subMenuFooter}K+="</div>"+I;return K}function cmDraw(B,C,H,P,L){var J=cmGetObject(B);if(!L){L=P.prefix}if(!L){L=""}if(!P){P=_cmNodeProperties}if(!H){H="hbr"}var A=cmAllocMenu(B,C,H,P,L);var F=_cmMenuList[A];if(!P.delay){P.delay=_cmNodeProperties.delay}if(!P.clickOpen){P.clickOpen=_cmNodeProperties.clickOpen}if(!P.zIndexStart){P.zIndexStart=_cmNodeProperties.zIndexStart}if(!P.zIndexInc){P.zIndexInc=_cmNodeProperties.zIndexInc}if(!P.offsetHMainAdjust){P.offsetHMainAdjust=_cmNodeProperties.offsetHMainAdjust}if(!P.offsetVMainAdjust){P.offsetVMainAdjust=_cmNodeProperties.offsetVMainAdjust}if(!P.offsetSubAdjust){P.offsetSubAdjust=_cmNodeProperties.offsetSubAdjust}F.cmFrameMasking=_cmFrameMasking;var M='<table summary="main menu" class="'+L+'Menu" cellspacing="'+P.mainSpacing+'">';var K="";var E;if(H.charAt(0)=="h"){M+="<tr>";E=false}else{E=true}var I;var O;var N;var D;var G;for(I=0;I<C.length;++I){O=C[I];if(!O){continue}O.menu=C;O.subMenuID=B;M+=E?"<tr":"<td";M+=' class="'+L+'MainItem"';D=(O.length>5);N=D?cmNewID():null;M+=cmActionItem(O,1,N,F,A)+">";if(O==_cmSplit){O=cmSplitItem(L,1,E)}if(O[0]==_cmNoAction||O[0]==_cmNoClick){M+=cmNoActionItem(O);M+=E?"</tr>":"</td>";continue}G=L+"Main"+(D?"Folder":"Item");M+=E?"<td":"<span";M+=' class="'+G+'Left">';M+=(O[0]==null)?(D?P.mainFolderLeft:P.mainItemLeft):O[0];M+=E?"</td>":"</span>";M+=E?"<td":"<span";M+=' class="'+G+'Text">';M+=O[1];M+=E?"</td>":"</span>";M+=E?"<td":"<span";M+=' class="'+G+'Right">';M+=D?P.mainFolderRight:P.mainItemRight;M+=E?"</td>":"</span>";M+=E?"</tr>":"</td>";if(D){K+=cmDrawSubMenu(O,L,N,P,P.zIndexStart,F,A)}}if(!E){M+="</tr>"}M+="</table>"+K;J.innerHTML=M}function cmDrawFromText(H,C,B,E){var F=cmGetObject(H);var G=null;for(var D=F.firstChild;D;D=D.nextSibling){if(!D.tagName){continue}var A=D.tagName.toLowerCase();if(A!="ul"&&A!="ol"){continue}G=cmDrawFromTextSubMenu(D);break}if(G){cmDraw(H,G,C,B,E)}}function cmDrawFromTextSubMenu(H){var D=new Array();for(var G=H.firstChild;G;G=G.nextSibling){if(!G.tagName||G.tagName.toLowerCase()!="li"){continue}if(G.firstChild==null){D[D.length]=_cmSplit;continue}var F=new Array();var E=G.firstChild;var C=false;for(;E;E=E.nextSibling){if(!E.tagName){continue}if(E.className=="cmNoClick"){F[0]=_cmNoClick;F[1]=getActionHTML(E);C=true;break}if(E.className=="cmNoAction"){F[0]=_cmNoAction;F[1]=getActionHTML(E);C=true;break}var A=E.tagName.toLowerCase();if(A!="span"){continue}if(!E.firstChild){F[0]=null}else{F[0]=E.innerHTML}E=E.nextSibling;break}if(C){D[D.length]=F;continue}if(!E){continue}for(;E;E=E.nextSibling){if(!E.tagName){continue}var A=E.tagName.toLowerCase();if(A=="a"){F[1]=E.innerHTML;F[2]=E.href;F[3]=E.target;F[4]=E.title;if(F[4]==""){F[4]=null}}else{if(A=="span"||A=="div"){F[1]=E.innerHTML;F[2]=null;F[3]=null;F[4]=null}}break}for(;E;E=E.nextSibling){if(!E.tagName){continue}var A=E.tagName.toLowerCase();if(A!="ul"&&A!="ol"){continue}var B=cmDrawFromTextSubMenu(E);for(i=0;i<B.length;++i){F[i+5]=B[i]}break}D[D.length]=F}return D}function getActionHTML(C){var A="<td></td><td></td><td></td>";var B;for(B=C.firstChild;B;B=B.nextSibling){if(B.tagName&&B.tagName.toLowerCase()=="table"){break}}if(!B){return A}for(B=B.firstChild;B;B=B.nextSibling){if(B.tagName&&B.tagName.toLowerCase()=="tbody"){break}}if(!B){return A}for(B=B.firstChild;B;B=B.nextSibling){if(B.tagName&&B.tagName.toLowerCase()=="tr"){break}}if(!B){return A}return B.innerHTML}function cmGetMenuItem(D){if(!D.subMenuID){return null}var A=cmGetObject(D.subMenuID);if(D.menu){var E=D.menu;A=A.firstChild.firstChild.firstChild.firstChild;var B;for(B=0;B<E.length;++B){if(E[B]==D){return A}A=A.nextSibling}}else{if(D.parentItem){var E=D.parentItem;var C=cmGetObject(D.subMenuID+"Table");if(!C){return null}A=C.firstChild.firstChild;var B;for(B=5;B<E.length;++B){if(E[B]==D){return A}A=A.nextSibling}}}return null}function cmDisableItem(B,C){if(!B){return }var A=cmGetMenuItem(B);if(!A){return }if(B.menu){A.className=C+"MainItemDisabled"}else{A.className=C+"MenuItemDisabled"}B.isDisabled=true}function cmEnableItem(B,C){if(!B){return }var A=cmGetMenuItem(B);if(!A){return }if(B.menu){menu.className=C+"MainItem"}else{menu.className=C+"MenuItem"}B.isDisabled=true}function cmItemMouseOver(D,L,K,A,F,N){if(!N&&_cmClicked){cmItemMouseOverOpenSub(D,L,K,A,F);return }clearTimeout(_cmTimeOut);if(_cmItemList[F].isDisabled){return }var E=_cmMenuList[A].prefix;if(!D.cmMenuID){D.cmMenuID=A;D.cmIsMain=L}var B=cmGetThisMenu(D,E);if(!B.cmItems){B.cmItems=new Array()}var C;for(C=0;C<B.cmItems.length;++C){if(B.cmItems[C]==D){break}}if(C==B.cmItems.length){B.cmItems[C]=D}if(_cmCurrentItem){if(_cmCurrentItem==D||_cmCurrentItem==B){var M=_cmItemList[F];cmSetStatus(M);return }var H=_cmMenuList[_cmCurrentItem.cmMenuID];var J=H.prefix;var I=cmGetThisMenu(_cmCurrentItem,J);if(I!=B.cmParentMenu){if(_cmCurrentItem.cmIsMain){_cmCurrentItem.className=J+"MainItem"}else{_cmCurrentItem.className=J+"MenuItem"}if(I.id!=K){cmHideMenu(I,B,H)}}}_cmCurrentItem=D;cmResetMenu(B,E);var M=_cmItemList[F];var G=cmIsDefaultItem(M);if(G){if(L){D.className=E+"MainItemHover"}else{D.className=E+"MenuItemHover"}}cmSetStatus(M)}function cmItemMouseOverOpenSub(E,I,H,A,G){clearTimeout(_cmTimeOut);if(_cmItemList[G].isDisabled){return }cmItemMouseOver(E,I,H,A,G,true);if(H){var D=cmGetObject(H);var B=_cmMenuList[A];var C=B.orient;var F=B.prefix;cmShowSubMenu(E,I,D,B)}}function cmItemMouseOut(D,B,A,F,C){var E=_cmMenuList[F].nodeProperties.delay;_cmTimeOut=window.setTimeout("cmHideMenuTime ()",E);window.defaultStatus=""}function cmItemMouseDown(E,B,A,F,C){if(_cmItemList[C].isDisabled){return }if(cmIsDefaultItem(_cmItemList[C])){var D=_cmMenuList[F].prefix;if(E.cmIsMain){E.className=D+"MainItemActive"}else{E.className=D+"MenuItemActive"}}}function cmItemMouseDownOpenSub(F,B,A,G,D){if(_cmItemList[D].isDisabled){return }_cmClicked=true;cmItemMouseDown(F,B,A,G,D);if(A){var C=cmGetObject(A);var E=_cmMenuList[G];cmShowSubMenu(F,B,C,E)}}function cmItemMouseUp(E,K,J,A,G){if(_cmItemList[G].isDisabled){return }var L=_cmItemList[G];var I=null,H="_self";if(L.length>2){I=L[2]}if(L.length>3&&L[3]){H=L[3]}if(I!=null){_cmClicked=false;window.open(I,H)}var D=_cmMenuList[A];var F=D.prefix;var C=cmGetThisMenu(E,F);var B=(L.length>5);if(!B){if(cmIsDefaultItem(L)){if(E.cmIsMain){E.className=F+"MainItem"}else{E.className=F+"MenuItem"}}cmHideMenu(C,null,D)}else{if(cmIsDefaultItem(L)){if(E.cmIsMain){E.className=F+"MainItemHover"}else{E.className=F+"MenuItemHover"}}}}function cmMoveSubMenu(obj,isMain,subMenu,menuInfo){var orient=menuInfo.orient;var offsetAdjust;if(isMain){if(orient.charAt(0)=="h"){offsetAdjust=menuInfo.nodeProperties.offsetHMainAdjust}else{offsetAdjust=menuInfo.nodeProperties.offsetVMainAdjust}}else{offsetAdjust=menuInfo.nodeProperties.offsetSubAdjust}if(!isMain&&orient.charAt(0)=="h"){orient="v"+orient.charAt(1)+orient.charAt(2)}var mode=String(orient);var p=subMenu.offsetParent;var subMenuWidth=cmGetWidth(subMenu);var horiz=cmGetHorizontalAlign(obj,mode,p,subMenuWidth);if(mode.charAt(0)=="h"){if(mode.charAt(1)=="b"){subMenu.style.top=(cmGetYAt(obj,p)+cmGetHeight(obj)+offsetAdjust[1])+"px"}else{subMenu.style.top=(cmGetYAt(obj,p)-cmGetHeight(subMenu)-offsetAdjust[1])+"px"}if(horiz=="r"){subMenu.style.left=(cmGetXAt(obj,p)+offsetAdjust[0])+"px"}else{subMenu.style.left=(cmGetXAt(obj,p)+cmGetWidth(obj)-subMenuWidth-offsetAdjust[0])+"px"}}else{if(horiz=="r"){subMenu.style.left=(cmGetXAt(obj,p)+cmGetWidth(obj)+offsetAdjust[0])+"px"}else{subMenu.style.left=(cmGetXAt(obj,p)-subMenuWidth-offsetAdjust[0])+"px"}if(mode.charAt(1)=="b"){subMenu.style.top=(cmGetYAt(obj,p)+offsetAdjust[1])+"px"}else{subMenu.style.top=(cmGetYAt(obj,p)+cmGetHeight(obj)-cmGetHeight(subMenu)+offsetAdjust[1])+"px"}}/*@cc_on @if (@_jscript_version >= 5.5) if (menuInfo.cmFrameMasking) { @@ -47,7 +47,7 @@ cmFreeFrame (frameObj); } @end - @*/}cmShowControl(thisMenu);thisMenu.cmItems=null}function cmHideMenu(E,D,C){var B=C.prefix;var F=B+"SubMenu";if(E.cmSubMenu){var A;for(A=0;A<E.cmSubMenu.length;++A){cmHideSubMenu(E.cmSubMenu[A],C)}}while(E&&E!=D){cmResetMenu(E,B);if(E.className==F){cmHideThisMenu(E,C)}else{break}E=cmGetThisMenu(E.cmParentMenu,B)}}function cmHideSubMenu(D,C){if(D.style.visibility=="hidden"){return }if(D.cmSubMenu){var A;for(A=0;A<D.cmSubMenu.length;++A){cmHideSubMenu(D.cmSubMenu[A],C)}}var B=C.prefix;cmResetMenu(D,B);cmHideThisMenu(D,C)}function cmHideControl(D,E){var J=cmGetX(E);var I=cmGetY(E);var K=E.offsetWidth;var H=E.offsetHeight;var G;for(G=0;G<document.all.tags(D).length;++G){var F=document.all.tags(D)[G];if(!F||!F.offsetParent){continue}var B=cmGetX(F);var A=cmGetY(F);var C=F.offsetWidth;var L=F.offsetHeight;if(B>(J+K)||(B+C)<J){continue}if(A>(I+H)||(A+L)<I){continue}if(F.style.visibility=="hidden"){continue}E.cmOverlap[E.cmOverlap.length]=F;F.style.visibility="hidden"}}function cmShowControl(A){if(A.cmOverlap){var B;for(B=0;B<A.cmOverlap.length;++B){A.cmOverlap[B].style.visibility=""}}A.cmOverlap=null}function cmGetThisMenu(D,C){var B=C+"SubMenu";var A=C+"Menu";while(D){if(D.className==B||D.className==A){return D}D=D.parentNode}return null}function cmTimeEffect(C,A,B){window.setTimeout('cmCallEffect("'+C+'",'+A+")",B)}function cmCallEffect(D,A){var C=cmGetObject(D);if(!C||!C.cmEffect){return }try{if(A){C.cmEffect.showEffect(false)}else{C.cmEffect.hideEffect(false)}}catch(B){}}function cmIsDefaultItem(A){if(A=="_cmSplit"||A[0]==_cmNoAction||A[0]=="_cmNoClick"){return false}return true}function cmGetObject(A){if(document.all){return document.all[A]}return document.getElementById(A)}function cmGetWidth(B){var A=B.offsetWidth;if(A>0||!cmIsTRNode(B)){return A}if(!B.firstChild){return 0}return B.lastChild.offsetLeft-B.firstChild.offsetLeft+cmGetWidth(B.lastChild)}function cmGetHeight(B){var A=B.offsetHeight;if(A>0||!cmIsTRNode(B)){return A}if(!B.firstChild){return 0}return B.firstChild.offsetHeight}function cmGetX(B){if(!B){return 0}var A=0;do{A+=B.offsetLeft;B=B.offsetParent}while(B);return A}function cmGetXAt(B,C){var A=0;while(B&&B!=C){A+=B.offsetLeft;B=B.offsetParent}if(B==C){return A}return A-cmGetX(C)}function cmGetY(A){if(!A){return 0}var B=0;do{B+=A.offsetTop;A=A.offsetParent}while(A);return B}function cmIsTRNode(B){var A=B.tagName;return A=="TR"||A=="tr"||A=="Tr"||A=="tR"}function cmGetYAt(B,D){var C=0;if(!B.offsetHeight&&cmIsTRNode(B)){var A=B.parentNode.firstChild;B=B.firstChild;C-=A.firstChild.offsetTop}while(B&&B!=D){C+=B.offsetTop;B=B.offsetParent}if(B==D){return C}return C-cmGetY(D)}function cmSetStatus(A){var B="";if(A.length>4){B=(A[4]!=null)?A[4]:(A[2]?A[2]:B)}else{if(A.length>2){B=(A[2]?A[2]:B)}}window.defaultStatus=B}function cmGetProperties(B){if(B==undefined){return"undefined"}if(B==null){return"null"}var C=B+":\n";var A;for(A in B){C+=A+" = "+B[A]+"; "}return C}function CMSpecialEffectInstance(A,B){A.show=true;A.menu=B;B.cmEffect=A;this.effect=A}CMSpecialEffectInstance.prototype.canShow=function(A){if(A){if(this.effect.show){return false}this.effect.show=true}else{if(!this.effect.show){return false}}return true};CMSpecialEffectInstance.prototype.canHide=function(B){var A=this.effect;if(B){if(!A.show){return false}A.show=false}else{if(A.show){return false}}return true};CMSpecialEffectInstance.prototype.startShowing=function(){var menu=this.effect.menu;menu.style.visibility="visible";/*@cc_on + @*/}cmShowControl(thisMenu);thisMenu.cmItems=null}function cmHideMenu(E,D,C){var B=C.prefix;var F=B+"SubMenu";if(E.cmSubMenu){var A;for(A=0;A<E.cmSubMenu.length;++A){cmHideSubMenu(E.cmSubMenu[A],C)}}while(E&&E!=D){cmResetMenu(E,B);if(E.className==F){cmHideThisMenu(E,C)}else{break}E=cmGetThisMenu(E.cmParentMenu,B)}}function cmHideSubMenu(D,C){if(D.style.visibility=="hidden"){return }if(D.cmSubMenu){var A;for(A=0;A<D.cmSubMenu.length;++A){cmHideSubMenu(D.cmSubMenu[A],C)}}var B=C.prefix;cmResetMenu(D,B);cmHideThisMenu(D,C)}function cmHideControl(D,E){var J=cmGetX(E);var I=cmGetY(E);var K=E.offsetWidth;var H=E.offsetHeight;var G;for(G=0;G<document.all.tags(D).length;++G){var F=document.all.tags(D)[G];if(!F||!F.offsetParent){continue}var B=cmGetX(F);var A=cmGetY(F);var C=F.offsetWidth;var L=F.offsetHeight;if(B>(J+K)||(B+C)<J){continue}if(A>(I+H)||(A+L)<I){continue}if(F.style.visibility=="hidden"){continue}E.cmOverlap[E.cmOverlap.length]=F;F.style.visibility="hidden"}}function cmShowControl(A){if(A.cmOverlap){var B;for(B=0;B<A.cmOverlap.length;++B){A.cmOverlap[B].style.visibility=""}}A.cmOverlap=null}function cmGetThisMenu(D,C){var B=C+"SubMenu";var A=C+"Menu";while(D){if(D.className==B||D.className==A){return D}D=D.parentNode}return null}function cmTimeEffect(C,A,B){window.setTimeout('cmCallEffect("'+C+'",'+A+")",B)}function cmCallEffect(D,A){var C=cmGetObject(D);if(!C||!C.cmEffect){return }try{if(A){C.cmEffect.showEffect(false)}else{C.cmEffect.hideEffect(false)}}catch(B){}}function cmIsDefaultItem(A){if(A==_cmSplit||A[0]==_cmNoAction||A[0]==_cmNoClick){return false}return true}function cmGetObject(A){if(document.all){return document.all[A]}return document.getElementById(A)}function cmGetWidth(B){var A=B.offsetWidth;if(A>0||!cmIsTRNode(B)){return A}if(!B.firstChild){return 0}return B.lastChild.offsetLeft-B.firstChild.offsetLeft+cmGetWidth(B.lastChild)}function cmGetHeight(B){var A=B.offsetHeight;if(A>0||!cmIsTRNode(B)){return A}if(!B.firstChild){return 0}return B.firstChild.offsetHeight}function cmGetX(B){if(!B){return 0}var A=0;do{A+=B.offsetLeft;B=B.offsetParent}while(B);return A}function cmGetXAt(B,C){var A=0;while(B&&B!=C){A+=B.offsetLeft;B=B.offsetParent}if(B==C){return A}return A-cmGetX(C)}function cmGetY(A){if(!A){return 0}var B=0;do{B+=A.offsetTop;A=A.offsetParent}while(A);return B}function cmIsTRNode(B){var A=B.tagName;return A=="TR"||A=="tr"||A=="Tr"||A=="tR"}function cmGetYAt(B,D){var C=0;if(!B.offsetHeight&&cmIsTRNode(B)){var A=B.parentNode.firstChild;B=B.firstChild;C-=A.firstChild.offsetTop}while(B&&B!=D){C+=B.offsetTop;B=B.offsetParent}if(B==D){return C}return C-cmGetY(D)}function cmSetStatus(A){var B="";if(A.length>4){B=(A[4]!=null)?A[4]:(A[2]?A[2]:B)}else{if(A.length>2){B=(A[2]?A[2]:B)}}window.defaultStatus=B}function cmGetProperties(B){if(B==undefined){return"undefined"}if(B==null){return"null"}var C=B+":\n";var A;for(A in B){C+=A+" = "+B[A]+"; "}return C}function CMSpecialEffectInstance(A,B){A.show=true;A.menu=B;B.cmEffect=A;this.effect=A}CMSpecialEffectInstance.prototype.canShow=function(A){if(A){if(this.effect.show){return false}this.effect.show=true}else{if(!this.effect.show){return false}}return true};CMSpecialEffectInstance.prototype.canHide=function(B){var A=this.effect;if(B){if(!A.show){return false}A.show=false}else{if(A.show){return false}}return true};CMSpecialEffectInstance.prototype.startShowing=function(){var menu=this.effect.menu;menu.style.visibility="visible";/*@cc_on @if (@_jscript_version >= 5.5) if (menu.cmFrameObj) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-29 16:16:12
|
Revision: 4910 http://linpha.svn.sourceforge.net/linpha/?rev=4910&view=rev Author: fangehrn Date: 2008-03-29 09:15:56 -0700 (Sat, 29 Mar 2008) Log Message: ----------- trying to come around with some special jscookmenu objects Modified Paths: -------------- trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.yui.js Modified: trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js =================================================================== --- trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js 2008-03-16 14:44:09 UTC (rev 4909) +++ trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js 2008-03-29 16:15:56 UTC (rev 4910) @@ -299,7 +299,7 @@ if (!item) continue; - if (item == _cmSplit) + if (item == "_cmSplit") item = cmSplitItem (prefix, 0, true); item.parentItem = subMenu; item.subMenuID = id; @@ -308,13 +308,13 @@ idSub = hasChild ? cmNewID () : null; str += '<tr class="' + prefix + 'MenuItem"'; - if (item[0] != _cmNoClick) + if (item[0] != "_cmNoClick") str += cmActionItem (item, 0, idSub, menuInfo, menuID); else str += cmNoClickItem (item, 0, idSub, menuInfo, menuID); str += '>' - if (item[0] == _cmNoAction || item[0] == _cmNoClick) + if (item[0] == _cmNoAction || item[0] == "_cmNoClick") { str += cmNoActionItem (item); str += '</tr>'; @@ -437,10 +437,10 @@ str += cmActionItem (item, 1, idSub, menuInfo, menuID) + '>'; - if (item == _cmSplit) + if (item == "_cmSplit") item = cmSplitItem (prefix, 1, vertical); - if (item[0] == _cmNoAction || item[0] == _cmNoClick) + if (item[0] == _cmNoAction || item[0] == "_cmNoClick") { str += cmNoActionItem (item); str += vertical? '</tr>' : '</td>'; @@ -532,7 +532,7 @@ continue; if (currentDomItem.firstChild == null) { - items[items.length] = _cmSplit; + items[items.length] = "_cmSplit"; continue; } var item = new Array (); @@ -545,7 +545,7 @@ continue; if (currentItem.className == 'cmNoClick') { - item[0] = _cmNoClick; + item[0] = "_cmNoClick"; item[1] = getActionHTML (currentItem); hasAction = true; break; @@ -1392,7 +1392,7 @@ // function cmIsDefaultItem (item) { - if (item == _cmSplit || item[0] == _cmNoAction || item[0] == _cmNoClick) + if (item == "_cmSplit" || item[0] == _cmNoAction || item[0] == "_cmNoClick") return false; return true; } Modified: trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.yui.js =================================================================== --- trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.yui.js 2008-03-16 14:44:09 UTC (rev 4909) +++ trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.yui.js 2008-03-29 16:15:56 UTC (rev 4910) @@ -11,7 +11,7 @@ } } @end -@*/var _cmClicked=false;var _cmHideObjects=0;function cmClone(A){var B=new Object();for(v in A){B[v]=A[v]}return B}function cmAllocMenu(G,F,B,A,C){var D=new Object();D.div=G;D.menu=F;D.orient=B;D.nodeProperties=A;D.prefix=C;var E=_cmMenuList.length;_cmMenuList[E]=D;return E}function cmAllocFrame(){if(_cmFrameListSize>0){return cmGetObject(_cmFrameList[--_cmFrameListSize])}var A=document.createElement("iframe");var B=_cmFrameIDCount++;A.id="cmFrame"+B;A.frameBorder="0";A.style.display="none";A.src="javascript:false";document.body.appendChild(A);A.style.filter="alpha(opacity=0)";A.style.zIndex=99;A.style.position="absolute";A.style.border="0";A.scrolling="no";return A}function cmFreeFrame(A){_cmFrameList[_cmFrameListSize++]=A.id}function cmNewID(){return _cmIDName+(++_cmIDCount)}function cmActionItem(J,I,H,D,A){_cmItemList[_cmItemList.length]=J;var F=_cmItemList.length-1;H=(!H)?"null":("'"+H+"'");var E=D.nodeProperties.clickOpen;var G=(E==3)||(E==2&&I);var C="this,"+I+","+H+","+A+","+F;var B;if(G){B=' onmouseover="cmItemMouseOver('+C+',false)" onmousedown="cmItemMouseDownOpenSub ('+C+')"'}else{B=' onmouseover="cmItemMouseOverOpenSub ('+C+')" onmousedown="cmItemMouseDown ('+C+')"'}return B+' onmouseout="cmItemMouseOut ('+C+')" onmouseup="cmItemMouseUp ('+C+')"'}function cmNoClickItem(D,B,A,E,G){_cmItemList[_cmItemList.length]=D;var C=_cmItemList.length-1;A=(!A)?"null":("'"+A+"'");var F="this,"+B+","+A+","+G+","+C;return' onmouseover="cmItemMouseOver ('+F+')" onmouseout="cmItemMouseOut ('+F+')"'}function cmNoActionItem(A){return A[1]}function cmSplitItem(prefix,isMain,vertical){var classStr="cm"+prefix;if(isMain){classStr+="Main";if(vertical){classStr+="HSplit"}else{classStr+="VSplit"}}else{classStr+="HSplit"}return eval(classStr)}function cmDrawSubMenu(G,J,B,N,D,E,A){var K='<div class="'+J+'SubMenu" id="'+B+'" style="z-index: '+D+';position: absolute; top: 0px; left: 0px;">';if(N.subMenuHeader){K+=N.subMenuHeader}K+='<table summary="sub menu" id="'+B+'Table" cellspacing="'+N.subSpacing+'" class="'+J+'SubMenuTable">';var I="";var M;var L;var C;var H;var F;for(H=5;H<G.length;++H){M=G[H];if(!M){continue}if(M==_cmSplit){M=cmSplitItem(J,0,true)}M.parentItem=G;M.subMenuID=B;C=(M.length>5);L=C?cmNewID():null;K+='<tr class="'+J+'MenuItem"';if(M[0]!=_cmNoClick){K+=cmActionItem(M,0,L,E,A)}else{K+=cmNoClickItem(M,0,L,E,A)}K+=">";if(M[0]==_cmNoAction||M[0]==_cmNoClick){K+=cmNoActionItem(M);K+="</tr>";continue}F=J+"Menu";F+=C?"Folder":"Item";K+='<td class="'+F+'Left">';if(M[0]!=null){K+=M[0]}else{K+=C?N.folderLeft:N.itemLeft}K+='</td><td class="'+F+'Text">'+M[1];K+='</td><td class="'+F+'Right">';if(C){K+=N.folderRight;I+=cmDrawSubMenu(M,J,L,N,D+N.zIndexInc,E,A)}else{K+=N.itemRight}K+="</td></tr>"}K+="</table>";if(N.subMenuFooter){K+=N.subMenuFooter}K+="</div>"+I;return K}function cmDraw(B,C,H,P,L){var J=cmGetObject(B);if(!L){L=P.prefix}if(!L){L=""}if(!P){P=_cmNodeProperties}if(!H){H="hbr"}var A=cmAllocMenu(B,C,H,P,L);var F=_cmMenuList[A];if(!P.delay){P.delay=_cmNodeProperties.delay}if(!P.clickOpen){P.clickOpen=_cmNodeProperties.clickOpen}if(!P.zIndexStart){P.zIndexStart=_cmNodeProperties.zIndexStart}if(!P.zIndexInc){P.zIndexInc=_cmNodeProperties.zIndexInc}if(!P.offsetHMainAdjust){P.offsetHMainAdjust=_cmNodeProperties.offsetHMainAdjust}if(!P.offsetVMainAdjust){P.offsetVMainAdjust=_cmNodeProperties.offsetVMainAdjust}if(!P.offsetSubAdjust){P.offsetSubAdjust=_cmNodeProperties.offsetSubAdjust}F.cmFrameMasking=_cmFrameMasking;var M='<table summary="main menu" class="'+L+'Menu" cellspacing="'+P.mainSpacing+'">';var K="";var E;if(H.charAt(0)=="h"){M+="<tr>";E=false}else{E=true}var I;var O;var N;var D;var G;for(I=0;I<C.length;++I){O=C[I];if(!O){continue}O.menu=C;O.subMenuID=B;M+=E?"<tr":"<td";M+=' class="'+L+'MainItem"';D=(O.length>5);N=D?cmNewID():null;M+=cmActionItem(O,1,N,F,A)+">";if(O==_cmSplit){O=cmSplitItem(L,1,E)}if(O[0]==_cmNoAction||O[0]==_cmNoClick){M+=cmNoActionItem(O);M+=E?"</tr>":"</td>";continue}G=L+"Main"+(D?"Folder":"Item");M+=E?"<td":"<span";M+=' class="'+G+'Left">';M+=(O[0]==null)?(D?P.mainFolderLeft:P.mainItemLeft):O[0];M+=E?"</td>":"</span>";M+=E?"<td":"<span";M+=' class="'+G+'Text">';M+=O[1];M+=E?"</td>":"</span>";M+=E?"<td":"<span";M+=' class="'+G+'Right">';M+=D?P.mainFolderRight:P.mainItemRight;M+=E?"</td>":"</span>";M+=E?"</tr>":"</td>";if(D){K+=cmDrawSubMenu(O,L,N,P,P.zIndexStart,F,A)}}if(!E){M+="</tr>"}M+="</table>"+K;J.innerHTML=M}function cmDrawFromText(H,C,B,E){var F=cmGetObject(H);var G=null;for(var D=F.firstChild;D;D=D.nextSibling){if(!D.tagName){continue}var A=D.tagName.toLowerCase();if(A!="ul"&&A!="ol"){continue}G=cmDrawFromTextSubMenu(D);break}if(G){cmDraw(H,G,C,B,E)}}function cmDrawFromTextSubMenu(H){var D=new Array();for(var G=H.firstChild;G;G=G.nextSibling){if(!G.tagName||G.tagName.toLowerCase()!="li"){continue}if(G.firstChild==null){D[D.length]=_cmSplit;continue}var F=new Array();var E=G.firstChild;var C=false;for(;E;E=E.nextSibling){if(!E.tagName){continue}if(E.className=="cmNoClick"){F[0]=_cmNoClick;F[1]=getActionHTML(E);C=true;break}if(E.className=="cmNoAction"){F[0]=_cmNoAction;F[1]=getActionHTML(E);C=true;break}var A=E.tagName.toLowerCase();if(A!="span"){continue}if(!E.firstChild){F[0]=null}else{F[0]=E.innerHTML}E=E.nextSibling;break}if(C){D[D.length]=F;continue}if(!E){continue}for(;E;E=E.nextSibling){if(!E.tagName){continue}var A=E.tagName.toLowerCase();if(A=="a"){F[1]=E.innerHTML;F[2]=E.href;F[3]=E.target;F[4]=E.title;if(F[4]==""){F[4]=null}}else{if(A=="span"||A=="div"){F[1]=E.innerHTML;F[2]=null;F[3]=null;F[4]=null}}break}for(;E;E=E.nextSibling){if(!E.tagName){continue}var A=E.tagName.toLowerCase();if(A!="ul"&&A!="ol"){continue}var B=cmDrawFromTextSubMenu(E);for(i=0;i<B.length;++i){F[i+5]=B[i]}break}D[D.length]=F}return D}function getActionHTML(C){var A="<td></td><td></td><td></td>";var B;for(B=C.firstChild;B;B=B.nextSibling){if(B.tagName&&B.tagName.toLowerCase()=="table"){break}}if(!B){return A}for(B=B.firstChild;B;B=B.nextSibling){if(B.tagName&&B.tagName.toLowerCase()=="tbody"){break}}if(!B){return A}for(B=B.firstChild;B;B=B.nextSibling){if(B.tagName&&B.tagName.toLowerCase()=="tr"){break}}if(!B){return A}return B.innerHTML}function cmGetMenuItem(D){if(!D.subMenuID){return null}var A=cmGetObject(D.subMenuID);if(D.menu){var E=D.menu;A=A.firstChild.firstChild.firstChild.firstChild;var B;for(B=0;B<E.length;++B){if(E[B]==D){return A}A=A.nextSibling}}else{if(D.parentItem){var E=D.parentItem;var C=cmGetObject(D.subMenuID+"Table");if(!C){return null}A=C.firstChild.firstChild;var B;for(B=5;B<E.length;++B){if(E[B]==D){return A}A=A.nextSibling}}}return null}function cmDisableItem(B,C){if(!B){return }var A=cmGetMenuItem(B);if(!A){return }if(B.menu){A.className=C+"MainItemDisabled"}else{A.className=C+"MenuItemDisabled"}B.isDisabled=true}function cmEnableItem(B,C){if(!B){return }var A=cmGetMenuItem(B);if(!A){return }if(B.menu){menu.className=C+"MainItem"}else{menu.className=C+"MenuItem"}B.isDisabled=true}function cmItemMouseOver(D,L,K,A,F,N){if(!N&&_cmClicked){cmItemMouseOverOpenSub(D,L,K,A,F);return }clearTimeout(_cmTimeOut);if(_cmItemList[F].isDisabled){return }var E=_cmMenuList[A].prefix;if(!D.cmMenuID){D.cmMenuID=A;D.cmIsMain=L}var B=cmGetThisMenu(D,E);if(!B.cmItems){B.cmItems=new Array()}var C;for(C=0;C<B.cmItems.length;++C){if(B.cmItems[C]==D){break}}if(C==B.cmItems.length){B.cmItems[C]=D}if(_cmCurrentItem){if(_cmCurrentItem==D||_cmCurrentItem==B){var M=_cmItemList[F];cmSetStatus(M);return }var H=_cmMenuList[_cmCurrentItem.cmMenuID];var J=H.prefix;var I=cmGetThisMenu(_cmCurrentItem,J);if(I!=B.cmParentMenu){if(_cmCurrentItem.cmIsMain){_cmCurrentItem.className=J+"MainItem"}else{_cmCurrentItem.className=J+"MenuItem"}if(I.id!=K){cmHideMenu(I,B,H)}}}_cmCurrentItem=D;cmResetMenu(B,E);var M=_cmItemList[F];var G=cmIsDefaultItem(M);if(G){if(L){D.className=E+"MainItemHover"}else{D.className=E+"MenuItemHover"}}cmSetStatus(M)}function cmItemMouseOverOpenSub(E,I,H,A,G){clearTimeout(_cmTimeOut);if(_cmItemList[G].isDisabled){return }cmItemMouseOver(E,I,H,A,G,true);if(H){var D=cmGetObject(H);var B=_cmMenuList[A];var C=B.orient;var F=B.prefix;cmShowSubMenu(E,I,D,B)}}function cmItemMouseOut(D,B,A,F,C){var E=_cmMenuList[F].nodeProperties.delay;_cmTimeOut=window.setTimeout("cmHideMenuTime ()",E);window.defaultStatus=""}function cmItemMouseDown(E,B,A,F,C){if(_cmItemList[C].isDisabled){return }if(cmIsDefaultItem(_cmItemList[C])){var D=_cmMenuList[F].prefix;if(E.cmIsMain){E.className=D+"MainItemActive"}else{E.className=D+"MenuItemActive"}}}function cmItemMouseDownOpenSub(F,B,A,G,D){if(_cmItemList[D].isDisabled){return }_cmClicked=true;cmItemMouseDown(F,B,A,G,D);if(A){var C=cmGetObject(A);var E=_cmMenuList[G];cmShowSubMenu(F,B,C,E)}}function cmItemMouseUp(E,K,J,A,G){if(_cmItemList[G].isDisabled){return }var L=_cmItemList[G];var I=null,H="_self";if(L.length>2){I=L[2]}if(L.length>3&&L[3]){H=L[3]}if(I!=null){_cmClicked=false;window.open(I,H)}var D=_cmMenuList[A];var F=D.prefix;var C=cmGetThisMenu(E,F);var B=(L.length>5);if(!B){if(cmIsDefaultItem(L)){if(E.cmIsMain){E.className=F+"MainItem"}else{E.className=F+"MenuItem"}}cmHideMenu(C,null,D)}else{if(cmIsDefaultItem(L)){if(E.cmIsMain){E.className=F+"MainItemHover"}else{E.className=F+"MenuItemHover"}}}}function cmMoveSubMenu(obj,isMain,subMenu,menuInfo){var orient=menuInfo.orient;var offsetAdjust;if(isMain){if(orient.charAt(0)=="h"){offsetAdjust=menuInfo.nodeProperties.offsetHMainAdjust}else{offsetAdjust=menuInfo.nodeProperties.offsetVMainAdjust}}else{offsetAdjust=menuInfo.nodeProperties.offsetSubAdjust}if(!isMain&&orient.charAt(0)=="h"){orient="v"+orient.charAt(1)+orient.charAt(2)}var mode=String(orient);var p=subMenu.offsetParent;var subMenuWidth=cmGetWidth(subMenu);var horiz=cmGetHorizontalAlign(obj,mode,p,subMenuWidth);if(mode.charAt(0)=="h"){if(mode.charAt(1)=="b"){subMenu.style.top=(cmGetYAt(obj,p)+cmGetHeight(obj)+offsetAdjust[1])+"px"}else{subMenu.style.top=(cmGetYAt(obj,p)-cmGetHeight(subMenu)-offsetAdjust[1])+"px"}if(horiz=="r"){subMenu.style.left=(cmGetXAt(obj,p)+offsetAdjust[0])+"px"}else{subMenu.style.left=(cmGetXAt(obj,p)+cmGetWidth(obj)-subMenuWidth-offsetAdjust[0])+"px"}}else{if(horiz=="r"){subMenu.style.left=(cmGetXAt(obj,p)+cmGetWidth(obj)+offsetAdjust[0])+"px"}else{subMenu.style.left=(cmGetXAt(obj,p)-subMenuWidth-offsetAdjust[0])+"px"}if(mode.charAt(1)=="b"){subMenu.style.top=(cmGetYAt(obj,p)+offsetAdjust[1])+"px"}else{subMenu.style.top=(cmGetYAt(obj,p)+cmGetHeight(obj)-cmGetHeight(subMenu)+offsetAdjust[1])+"px"}}/*@cc_on +@*/var _cmClicked=false;var _cmHideObjects=0;function cmClone(A){var B=new Object();for(v in A){B[v]=A[v]}return B}function cmAllocMenu(G,F,B,A,C){var D=new Object();D.div=G;D.menu=F;D.orient=B;D.nodeProperties=A;D.prefix=C;var E=_cmMenuList.length;_cmMenuList[E]=D;return E}function cmAllocFrame(){if(_cmFrameListSize>0){return cmGetObject(_cmFrameList[--_cmFrameListSize])}var A=document.createElement("iframe");var B=_cmFrameIDCount++;A.id="cmFrame"+B;A.frameBorder="0";A.style.display="none";A.src="javascript:false";document.body.appendChild(A);A.style.filter="alpha(opacity=0)";A.style.zIndex=99;A.style.position="absolute";A.style.border="0";A.scrolling="no";return A}function cmFreeFrame(A){_cmFrameList[_cmFrameListSize++]=A.id}function cmNewID(){return _cmIDName+(++_cmIDCount)}function cmActionItem(J,I,H,D,A){_cmItemList[_cmItemList.length]=J;var F=_cmItemList.length-1;H=(!H)?"null":("'"+H+"'");var E=D.nodeProperties.clickOpen;var G=(E==3)||(E==2&&I);var C="this,"+I+","+H+","+A+","+F;var B;if(G){B=' onmouseover="cmItemMouseOver('+C+',false)" onmousedown="cmItemMouseDownOpenSub ('+C+')"'}else{B=' onmouseover="cmItemMouseOverOpenSub ('+C+')" onmousedown="cmItemMouseDown ('+C+')"'}return B+' onmouseout="cmItemMouseOut ('+C+')" onmouseup="cmItemMouseUp ('+C+')"'}function cmNoClickItem(D,B,A,E,G){_cmItemList[_cmItemList.length]=D;var C=_cmItemList.length-1;A=(!A)?"null":("'"+A+"'");var F="this,"+B+","+A+","+G+","+C;return' onmouseover="cmItemMouseOver ('+F+')" onmouseout="cmItemMouseOut ('+F+')"'}function cmNoActionItem(A){return A[1]}function cmSplitItem(prefix,isMain,vertical){var classStr="cm"+prefix;if(isMain){classStr+="Main";if(vertical){classStr+="HSplit"}else{classStr+="VSplit"}}else{classStr+="HSplit"}return eval(classStr)}function cmDrawSubMenu(G,J,B,N,D,E,A){var K='<div class="'+J+'SubMenu" id="'+B+'" style="z-index: '+D+';position: absolute; top: 0px; left: 0px;">';if(N.subMenuHeader){K+=N.subMenuHeader}K+='<table summary="sub menu" id="'+B+'Table" cellspacing="'+N.subSpacing+'" class="'+J+'SubMenuTable">';var I="";var M;var L;var C;var H;var F;for(H=5;H<G.length;++H){M=G[H];if(!M){continue}if(M=="_cmSplit"){M=cmSplitItem(J,0,true)}M.parentItem=G;M.subMenuID=B;C=(M.length>5);L=C?cmNewID():null;K+='<tr class="'+J+'MenuItem"';if(M[0]!="_cmNoClick"){K+=cmActionItem(M,0,L,E,A)}else{K+=cmNoClickItem(M,0,L,E,A)}K+=">";if(M[0]==_cmNoAction||M[0]=="_cmNoClick"){K+=cmNoActionItem(M);K+="</tr>";continue}F=J+"Menu";F+=C?"Folder":"Item";K+='<td class="'+F+'Left">';if(M[0]!=null){K+=M[0]}else{K+=C?N.folderLeft:N.itemLeft}K+='</td><td class="'+F+'Text">'+M[1];K+='</td><td class="'+F+'Right">';if(C){K+=N.folderRight;I+=cmDrawSubMenu(M,J,L,N,D+N.zIndexInc,E,A)}else{K+=N.itemRight}K+="</td></tr>"}K+="</table>";if(N.subMenuFooter){K+=N.subMenuFooter}K+="</div>"+I;return K}function cmDraw(B,C,H,P,L){var J=cmGetObject(B);if(!L){L=P.prefix}if(!L){L=""}if(!P){P=_cmNodeProperties}if(!H){H="hbr"}var A=cmAllocMenu(B,C,H,P,L);var F=_cmMenuList[A];if(!P.delay){P.delay=_cmNodeProperties.delay}if(!P.clickOpen){P.clickOpen=_cmNodeProperties.clickOpen}if(!P.zIndexStart){P.zIndexStart=_cmNodeProperties.zIndexStart}if(!P.zIndexInc){P.zIndexInc=_cmNodeProperties.zIndexInc}if(!P.offsetHMainAdjust){P.offsetHMainAdjust=_cmNodeProperties.offsetHMainAdjust}if(!P.offsetVMainAdjust){P.offsetVMainAdjust=_cmNodeProperties.offsetVMainAdjust}if(!P.offsetSubAdjust){P.offsetSubAdjust=_cmNodeProperties.offsetSubAdjust}F.cmFrameMasking=_cmFrameMasking;var M='<table summary="main menu" class="'+L+'Menu" cellspacing="'+P.mainSpacing+'">';var K="";var E;if(H.charAt(0)=="h"){M+="<tr>";E=false}else{E=true}var I;var O;var N;var D;var G;for(I=0;I<C.length;++I){O=C[I];if(!O){continue}O.menu=C;O.subMenuID=B;M+=E?"<tr":"<td";M+=' class="'+L+'MainItem"';D=(O.length>5);N=D?cmNewID():null;M+=cmActionItem(O,1,N,F,A)+">";if(O=="_cmSplit"){O=cmSplitItem(L,1,E)}if(O[0]==_cmNoAction||O[0]=="_cmNoClick"){M+=cmNoActionItem(O);M+=E?"</tr>":"</td>";continue}G=L+"Main"+(D?"Folder":"Item");M+=E?"<td":"<span";M+=' class="'+G+'Left">';M+=(O[0]==null)?(D?P.mainFolderLeft:P.mainItemLeft):O[0];M+=E?"</td>":"</span>";M+=E?"<td":"<span";M+=' class="'+G+'Text">';M+=O[1];M+=E?"</td>":"</span>";M+=E?"<td":"<span";M+=' class="'+G+'Right">';M+=D?P.mainFolderRight:P.mainItemRight;M+=E?"</td>":"</span>";M+=E?"</tr>":"</td>";if(D){K+=cmDrawSubMenu(O,L,N,P,P.zIndexStart,F,A)}}if(!E){M+="</tr>"}M+="</table>"+K;J.innerHTML=M}function cmDrawFromText(H,C,B,E){var F=cmGetObject(H);var G=null;for(var D=F.firstChild;D;D=D.nextSibling){if(!D.tagName){continue}var A=D.tagName.toLowerCase();if(A!="ul"&&A!="ol"){continue}G=cmDrawFromTextSubMenu(D);break}if(G){cmDraw(H,G,C,B,E)}}function cmDrawFromTextSubMenu(H){var D=new Array();for(var G=H.firstChild;G;G=G.nextSibling){if(!G.tagName||G.tagName.toLowerCase()!="li"){continue}if(G.firstChild==null){D[D.length]="_cmSplit";continue}var F=new Array();var E=G.firstChild;var C=false;for(;E;E=E.nextSibling){if(!E.tagName){continue}if(E.className=="cmNoClick"){F[0]="_cmNoClick";F[1]=getActionHTML(E);C=true;break}if(E.className=="cmNoAction"){F[0]=_cmNoAction;F[1]=getActionHTML(E);C=true;break}var A=E.tagName.toLowerCase();if(A!="span"){continue}if(!E.firstChild){F[0]=null}else{F[0]=E.innerHTML}E=E.nextSibling;break}if(C){D[D.length]=F;continue}if(!E){continue}for(;E;E=E.nextSibling){if(!E.tagName){continue}var A=E.tagName.toLowerCase();if(A=="a"){F[1]=E.innerHTML;F[2]=E.href;F[3]=E.target;F[4]=E.title;if(F[4]==""){F[4]=null}}else{if(A=="span"||A=="div"){F[1]=E.innerHTML;F[2]=null;F[3]=null;F[4]=null}}break}for(;E;E=E.nextSibling){if(!E.tagName){continue}var A=E.tagName.toLowerCase();if(A!="ul"&&A!="ol"){continue}var B=cmDrawFromTextSubMenu(E);for(i=0;i<B.length;++i){F[i+5]=B[i]}break}D[D.length]=F}return D}function getActionHTML(C){var A="<td></td><td></td><td></td>";var B;for(B=C.firstChild;B;B=B.nextSibling){if(B.tagName&&B.tagName.toLowerCase()=="table"){break}}if(!B){return A}for(B=B.firstChild;B;B=B.nextSibling){if(B.tagName&&B.tagName.toLowerCase()=="tbody"){break}}if(!B){return A}for(B=B.firstChild;B;B=B.nextSibling){if(B.tagName&&B.tagName.toLowerCase()=="tr"){break}}if(!B){return A}return B.innerHTML}function cmGetMenuItem(D){if(!D.subMenuID){return null}var A=cmGetObject(D.subMenuID);if(D.menu){var E=D.menu;A=A.firstChild.firstChild.firstChild.firstChild;var B;for(B=0;B<E.length;++B){if(E[B]==D){return A}A=A.nextSibling}}else{if(D.parentItem){var E=D.parentItem;var C=cmGetObject(D.subMenuID+"Table");if(!C){return null}A=C.firstChild.firstChild;var B;for(B=5;B<E.length;++B){if(E[B]==D){return A}A=A.nextSibling}}}return null}function cmDisableItem(B,C){if(!B){return }var A=cmGetMenuItem(B);if(!A){return }if(B.menu){A.className=C+"MainItemDisabled"}else{A.className=C+"MenuItemDisabled"}B.isDisabled=true}function cmEnableItem(B,C){if(!B){return }var A=cmGetMenuItem(B);if(!A){return }if(B.menu){menu.className=C+"MainItem"}else{menu.className=C+"MenuItem"}B.isDisabled=true}function cmItemMouseOver(D,L,K,A,F,N){if(!N&&_cmClicked){cmItemMouseOverOpenSub(D,L,K,A,F);return }clearTimeout(_cmTimeOut);if(_cmItemList[F].isDisabled){return }var E=_cmMenuList[A].prefix;if(!D.cmMenuID){D.cmMenuID=A;D.cmIsMain=L}var B=cmGetThisMenu(D,E);if(!B.cmItems){B.cmItems=new Array()}var C;for(C=0;C<B.cmItems.length;++C){if(B.cmItems[C]==D){break}}if(C==B.cmItems.length){B.cmItems[C]=D}if(_cmCurrentItem){if(_cmCurrentItem==D||_cmCurrentItem==B){var M=_cmItemList[F];cmSetStatus(M);return }var H=_cmMenuList[_cmCurrentItem.cmMenuID];var J=H.prefix;var I=cmGetThisMenu(_cmCurrentItem,J);if(I!=B.cmParentMenu){if(_cmCurrentItem.cmIsMain){_cmCurrentItem.className=J+"MainItem"}else{_cmCurrentItem.className=J+"MenuItem"}if(I.id!=K){cmHideMenu(I,B,H)}}}_cmCurrentItem=D;cmResetMenu(B,E);var M=_cmItemList[F];var G=cmIsDefaultItem(M);if(G){if(L){D.className=E+"MainItemHover"}else{D.className=E+"MenuItemHover"}}cmSetStatus(M)}function cmItemMouseOverOpenSub(E,I,H,A,G){clearTimeout(_cmTimeOut);if(_cmItemList[G].isDisabled){return }cmItemMouseOver(E,I,H,A,G,true);if(H){var D=cmGetObject(H);var B=_cmMenuList[A];var C=B.orient;var F=B.prefix;cmShowSubMenu(E,I,D,B)}}function cmItemMouseOut(D,B,A,F,C){var E=_cmMenuList[F].nodeProperties.delay;_cmTimeOut=window.setTimeout("cmHideMenuTime ()",E);window.defaultStatus=""}function cmItemMouseDown(E,B,A,F,C){if(_cmItemList[C].isDisabled){return }if(cmIsDefaultItem(_cmItemList[C])){var D=_cmMenuList[F].prefix;if(E.cmIsMain){E.className=D+"MainItemActive"}else{E.className=D+"MenuItemActive"}}}function cmItemMouseDownOpenSub(F,B,A,G,D){if(_cmItemList[D].isDisabled){return }_cmClicked=true;cmItemMouseDown(F,B,A,G,D);if(A){var C=cmGetObject(A);var E=_cmMenuList[G];cmShowSubMenu(F,B,C,E)}}function cmItemMouseUp(E,K,J,A,G){if(_cmItemList[G].isDisabled){return }var L=_cmItemList[G];var I=null,H="_self";if(L.length>2){I=L[2]}if(L.length>3&&L[3]){H=L[3]}if(I!=null){_cmClicked=false;window.open(I,H)}var D=_cmMenuList[A];var F=D.prefix;var C=cmGetThisMenu(E,F);var B=(L.length>5);if(!B){if(cmIsDefaultItem(L)){if(E.cmIsMain){E.className=F+"MainItem"}else{E.className=F+"MenuItem"}}cmHideMenu(C,null,D)}else{if(cmIsDefaultItem(L)){if(E.cmIsMain){E.className=F+"MainItemHover"}else{E.className=F+"MenuItemHover"}}}}function cmMoveSubMenu(obj,isMain,subMenu,menuInfo){var orient=menuInfo.orient;var offsetAdjust;if(isMain){if(orient.charAt(0)=="h"){offsetAdjust=menuInfo.nodeProperties.offsetHMainAdjust}else{offsetAdjust=menuInfo.nodeProperties.offsetVMainAdjust}}else{offsetAdjust=menuInfo.nodeProperties.offsetSubAdjust}if(!isMain&&orient.charAt(0)=="h"){orient="v"+orient.charAt(1)+orient.charAt(2)}var mode=String(orient);var p=subMenu.offsetParent;var subMenuWidth=cmGetWidth(subMenu);var horiz=cmGetHorizontalAlign(obj,mode,p,subMenuWidth);if(mode.charAt(0)=="h"){if(mode.charAt(1)=="b"){subMenu.style.top=(cmGetYAt(obj,p)+cmGetHeight(obj)+offsetAdjust[1])+"px"}else{subMenu.style.top=(cmGetYAt(obj,p)-cmGetHeight(subMenu)-offsetAdjust[1])+"px"}if(horiz=="r"){subMenu.style.left=(cmGetXAt(obj,p)+offsetAdjust[0])+"px"}else{subMenu.style.left=(cmGetXAt(obj,p)+cmGetWidth(obj)-subMenuWidth-offsetAdjust[0])+"px"}}else{if(horiz=="r"){subMenu.style.left=(cmGetXAt(obj,p)+cmGetWidth(obj)+offsetAdjust[0])+"px"}else{subMenu.style.left=(cmGetXAt(obj,p)-subMenuWidth-offsetAdjust[0])+"px"}if(mode.charAt(1)=="b"){subMenu.style.top=(cmGetYAt(obj,p)+offsetAdjust[1])+"px"}else{subMenu.style.top=(cmGetYAt(obj,p)+cmGetHeight(obj)-cmGetHeight(subMenu)+offsetAdjust[1])+"px"}}/*@cc_on @if (@_jscript_version >= 5.5) if (menuInfo.cmFrameMasking) { @@ -47,7 +47,7 @@ cmFreeFrame (frameObj); } @end - @*/}cmShowControl(thisMenu);thisMenu.cmItems=null}function cmHideMenu(E,D,C){var B=C.prefix;var F=B+"SubMenu";if(E.cmSubMenu){var A;for(A=0;A<E.cmSubMenu.length;++A){cmHideSubMenu(E.cmSubMenu[A],C)}}while(E&&E!=D){cmResetMenu(E,B);if(E.className==F){cmHideThisMenu(E,C)}else{break}E=cmGetThisMenu(E.cmParentMenu,B)}}function cmHideSubMenu(D,C){if(D.style.visibility=="hidden"){return }if(D.cmSubMenu){var A;for(A=0;A<D.cmSubMenu.length;++A){cmHideSubMenu(D.cmSubMenu[A],C)}}var B=C.prefix;cmResetMenu(D,B);cmHideThisMenu(D,C)}function cmHideControl(D,E){var J=cmGetX(E);var I=cmGetY(E);var K=E.offsetWidth;var H=E.offsetHeight;var G;for(G=0;G<document.all.tags(D).length;++G){var F=document.all.tags(D)[G];if(!F||!F.offsetParent){continue}var B=cmGetX(F);var A=cmGetY(F);var C=F.offsetWidth;var L=F.offsetHeight;if(B>(J+K)||(B+C)<J){continue}if(A>(I+H)||(A+L)<I){continue}if(F.style.visibility=="hidden"){continue}E.cmOverlap[E.cmOverlap.length]=F;F.style.visibility="hidden"}}function cmShowControl(A){if(A.cmOverlap){var B;for(B=0;B<A.cmOverlap.length;++B){A.cmOverlap[B].style.visibility=""}}A.cmOverlap=null}function cmGetThisMenu(D,C){var B=C+"SubMenu";var A=C+"Menu";while(D){if(D.className==B||D.className==A){return D}D=D.parentNode}return null}function cmTimeEffect(C,A,B){window.setTimeout('cmCallEffect("'+C+'",'+A+")",B)}function cmCallEffect(D,A){var C=cmGetObject(D);if(!C||!C.cmEffect){return }try{if(A){C.cmEffect.showEffect(false)}else{C.cmEffect.hideEffect(false)}}catch(B){}}function cmIsDefaultItem(A){if(A==_cmSplit||A[0]==_cmNoAction||A[0]==_cmNoClick){return false}return true}function cmGetObject(A){if(document.all){return document.all[A]}return document.getElementById(A)}function cmGetWidth(B){var A=B.offsetWidth;if(A>0||!cmIsTRNode(B)){return A}if(!B.firstChild){return 0}return B.lastChild.offsetLeft-B.firstChild.offsetLeft+cmGetWidth(B.lastChild)}function cmGetHeight(B){var A=B.offsetHeight;if(A>0||!cmIsTRNode(B)){return A}if(!B.firstChild){return 0}return B.firstChild.offsetHeight}function cmGetX(B){if(!B){return 0}var A=0;do{A+=B.offsetLeft;B=B.offsetParent}while(B);return A}function cmGetXAt(B,C){var A=0;while(B&&B!=C){A+=B.offsetLeft;B=B.offsetParent}if(B==C){return A}return A-cmGetX(C)}function cmGetY(A){if(!A){return 0}var B=0;do{B+=A.offsetTop;A=A.offsetParent}while(A);return B}function cmIsTRNode(B){var A=B.tagName;return A=="TR"||A=="tr"||A=="Tr"||A=="tR"}function cmGetYAt(B,D){var C=0;if(!B.offsetHeight&&cmIsTRNode(B)){var A=B.parentNode.firstChild;B=B.firstChild;C-=A.firstChild.offsetTop}while(B&&B!=D){C+=B.offsetTop;B=B.offsetParent}if(B==D){return C}return C-cmGetY(D)}function cmSetStatus(A){var B="";if(A.length>4){B=(A[4]!=null)?A[4]:(A[2]?A[2]:B)}else{if(A.length>2){B=(A[2]?A[2]:B)}}window.defaultStatus=B}function cmGetProperties(B){if(B==undefined){return"undefined"}if(B==null){return"null"}var C=B+":\n";var A;for(A in B){C+=A+" = "+B[A]+"; "}return C}function CMSpecialEffectInstance(A,B){A.show=true;A.menu=B;B.cmEffect=A;this.effect=A}CMSpecialEffectInstance.prototype.canShow=function(A){if(A){if(this.effect.show){return false}this.effect.show=true}else{if(!this.effect.show){return false}}return true};CMSpecialEffectInstance.prototype.canHide=function(B){var A=this.effect;if(B){if(!A.show){return false}A.show=false}else{if(A.show){return false}}return true};CMSpecialEffectInstance.prototype.startShowing=function(){var menu=this.effect.menu;menu.style.visibility="visible";/*@cc_on + @*/}cmShowControl(thisMenu);thisMenu.cmItems=null}function cmHideMenu(E,D,C){var B=C.prefix;var F=B+"SubMenu";if(E.cmSubMenu){var A;for(A=0;A<E.cmSubMenu.length;++A){cmHideSubMenu(E.cmSubMenu[A],C)}}while(E&&E!=D){cmResetMenu(E,B);if(E.className==F){cmHideThisMenu(E,C)}else{break}E=cmGetThisMenu(E.cmParentMenu,B)}}function cmHideSubMenu(D,C){if(D.style.visibility=="hidden"){return }if(D.cmSubMenu){var A;for(A=0;A<D.cmSubMenu.length;++A){cmHideSubMenu(D.cmSubMenu[A],C)}}var B=C.prefix;cmResetMenu(D,B);cmHideThisMenu(D,C)}function cmHideControl(D,E){var J=cmGetX(E);var I=cmGetY(E);var K=E.offsetWidth;var H=E.offsetHeight;var G;for(G=0;G<document.all.tags(D).length;++G){var F=document.all.tags(D)[G];if(!F||!F.offsetParent){continue}var B=cmGetX(F);var A=cmGetY(F);var C=F.offsetWidth;var L=F.offsetHeight;if(B>(J+K)||(B+C)<J){continue}if(A>(I+H)||(A+L)<I){continue}if(F.style.visibility=="hidden"){continue}E.cmOverlap[E.cmOverlap.length]=F;F.style.visibility="hidden"}}function cmShowControl(A){if(A.cmOverlap){var B;for(B=0;B<A.cmOverlap.length;++B){A.cmOverlap[B].style.visibility=""}}A.cmOverlap=null}function cmGetThisMenu(D,C){var B=C+"SubMenu";var A=C+"Menu";while(D){if(D.className==B||D.className==A){return D}D=D.parentNode}return null}function cmTimeEffect(C,A,B){window.setTimeout('cmCallEffect("'+C+'",'+A+")",B)}function cmCallEffect(D,A){var C=cmGetObject(D);if(!C||!C.cmEffect){return }try{if(A){C.cmEffect.showEffect(false)}else{C.cmEffect.hideEffect(false)}}catch(B){}}function cmIsDefaultItem(A){if(A=="_cmSplit"||A[0]==_cmNoAction||A[0]=="_cmNoClick"){return false}return true}function cmGetObject(A){if(document.all){return document.all[A]}return document.getElementById(A)}function cmGetWidth(B){var A=B.offsetWidth;if(A>0||!cmIsTRNode(B)){return A}if(!B.firstChild){return 0}return B.lastChild.offsetLeft-B.firstChild.offsetLeft+cmGetWidth(B.lastChild)}function cmGetHeight(B){var A=B.offsetHeight;if(A>0||!cmIsTRNode(B)){return A}if(!B.firstChild){return 0}return B.firstChild.offsetHeight}function cmGetX(B){if(!B){return 0}var A=0;do{A+=B.offsetLeft;B=B.offsetParent}while(B);return A}function cmGetXAt(B,C){var A=0;while(B&&B!=C){A+=B.offsetLeft;B=B.offsetParent}if(B==C){return A}return A-cmGetX(C)}function cmGetY(A){if(!A){return 0}var B=0;do{B+=A.offsetTop;A=A.offsetParent}while(A);return B}function cmIsTRNode(B){var A=B.tagName;return A=="TR"||A=="tr"||A=="Tr"||A=="tR"}function cmGetYAt(B,D){var C=0;if(!B.offsetHeight&&cmIsTRNode(B)){var A=B.parentNode.firstChild;B=B.firstChild;C-=A.firstChild.offsetTop}while(B&&B!=D){C+=B.offsetTop;B=B.offsetParent}if(B==D){return C}return C-cmGetY(D)}function cmSetStatus(A){var B="";if(A.length>4){B=(A[4]!=null)?A[4]:(A[2]?A[2]:B)}else{if(A.length>2){B=(A[2]?A[2]:B)}}window.defaultStatus=B}function cmGetProperties(B){if(B==undefined){return"undefined"}if(B==null){return"null"}var C=B+":\n";var A;for(A in B){C+=A+" = "+B[A]+"; "}return C}function CMSpecialEffectInstance(A,B){A.show=true;A.menu=B;B.cmEffect=A;this.effect=A}CMSpecialEffectInstance.prototype.canShow=function(A){if(A){if(this.effect.show){return false}this.effect.show=true}else{if(!this.effect.show){return false}}return true};CMSpecialEffectInstance.prototype.canHide=function(B){var A=this.effect;if(B){if(!A.show){return false}A.show=false}else{if(A.show){return false}}return true};CMSpecialEffectInstance.prototype.startShowing=function(){var menu=this.effect.menu;menu.style.visibility="visible";/*@cc_on @if (@_jscript_version >= 5.5) if (menu.cmFrameObj) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-16 14:44:12
|
Revision: 4909 http://linpha.svn.sourceforge.net/linpha/?rev=4909&view=rev Author: fangehrn Date: 2008-03-16 07:44:09 -0700 (Sun, 16 Mar 2008) Log Message: ----------- Added Paths: ----------- trunk/linpha2/lib/classes/linpha.view.album.class.php Copied: trunk/linpha2/lib/classes/linpha.view.album.class.php (from rev 4908, trunk/linpha2/lib/classes/linpha.imgview.class.php) =================================================================== --- trunk/linpha2/lib/classes/linpha.view.album.class.php (rev 0) +++ trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-03-16 14:44:09 UTC (rev 4909) @@ -0,0 +1,1418 @@ +<?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * This class takes care of all different views (thumb view, menus...) + * @package Image + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + +define('LIN_SELECT_FIELDS', + "".LIN_PREFIX."photos.id AS id2, " . + "".LIN_PREFIX."photos.id AS id, ".LIN_PREFIX."photos.name AS name, " . + "".LIN_PREFIX."photos.img_type AS img_type, ".LIN_PREFIX."photos.md5sum AS md5sum, " . + "".LIN_PREFIX."photos.width AS width, ".LIN_PREFIX."photos.height AS height, " . + "".LIN_PREFIX."photos.filesize AS filesize, " . + "".LIN_PREFIX."photos.time_add AS time_add, ".LIN_PREFIX."photos.time_mod AS time_mod, " . + "".LIN_PREFIX."photos.time_exif AS time_exif, ".LIN_PREFIX."photos.stats_numbers AS stats_numbers, " . + "".LIN_PREFIX."photos.stats_views AS stats_views, ".LIN_PREFIX."photos.stats_downloads AS stats_downloads" +); + +class LinImgview { + +public $mode; // 'home', 'thumb', 'image' +public $modulename; // 'albums', 'browse', ... +public $tot_photos; +public $photos; +public $photos_filtered; +public $id_parent, $img_type, $filename, $md5sum, $org_width, $org_height; +private $nr_pages, $current_page; // only used if javascript disabled +private $newCommentAdded = false; // used for ajax + +/** + * constructor + */ +function __construct() +{ + +} + +/** + * set current view and set fileinfos of $GLOBALS['linpha']->template->idCurrent ($_GET['linId']) + * @param string $modulname (album, browse, search, ...) + */ +function setCurrentView($modulename) +{ + $this->modulename = $modulename; + + $this->orderby = linGetSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_others_sortorder']); + + if( $GLOBALS['linpha']->template->idCurrent == 0 ) + { + /** + * on top view, reset current view + */ + if($this->modulename=='albums') + { + $this->mode = 'home'; + $this->orderby = linGetSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_home_firstsortorder']); + } + else // $this->modulename=='browse' | 'search' , others will come.. + { + $this->mode = 'thumb'; + + if( ! isset($_SESSION['mode_thumbview']) ) + { + $_SESSION['mode_thumbview'] = 'thumb'; + } + } + } + else + { + /** + * set file informations + */ + $current_data = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum, width, height FROM ".LIN_PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); + /** + * check for valid id + */ + + if( isset($current_data['id']) ) + { + $this->img_type = $current_data['img_type']; + $this->filename = $current_data['name']; + $this->md5sum = $current_data['md5sum']; + $this->org_width = $current_data['width']; + $this->org_height = $current_data['height']; + + /** + * switch between thumb_view and img_view + */ + if( $this->img_type == 0) + { + $this->mode = 'thumb'; + $this->id_parent = $current_data['id']; // use current_id as parent_id, because we want to see the content of the actual folder! + + if(! isset($_SESSION['mode_thumbview']) ) + { + $_SESSION['mode_thumbview'] = 'thumb'; + } + } + else + { + $this->mode = 'image'; + $this->id_parent = $current_data['parent_id']; // use parent_id on image view + + if( ! isset($_SESSION['mode_imageview']) ) + { + $_SESSION['mode_imageview'] = 'img'; + } + } + } + else // no valid id supplied + { + $this->mode = 'home'; + $GLOBALS['linpha']->template->idCurrent = 0; + } + } + + if($this->mode == 'thumb' && isset($_GET['view'])) + { + $_SESSION['mode_thumbview'] = $_GET['view']; + } + if($this->mode == 'image' && isset($_GET['view'])) + { + $_SESSION['mode_imageview'] = $_GET['view']; + } + + /** + * set id_parent to a default value + */ + if( ! isset( $this->id_parent) ) + { + $this->id_parent = $GLOBALS['linpha']->template->idCurrent; + } +} + +/** + * main function to prepare desired layout view + */ +function buildImgView() +{ + $this->filterPhotosNotPermitted(); + + /** + * set mode specific things + */ + switch($this->mode) + { + case 'home': + $this->viewHome(); + break; + case 'thumb': + switch($_SESSION['mode_thumbview']) + { + case 'thumb': + case 'thumbdetail': + $this->viewThumb(); + break; + case 'basket': + $this->viewBasket(); + break; + case 'albmeta': + $this->viewAlbMeta(); + break; + } + break; + case 'image': + switch($_SESSION['mode_imageview']) + { + case 'img': + $this->viewImg(); /* will exit in xml mode */ + break; + case 'meta': + $this->viewMeta(); + break; + } + break; + } + + /** + * doing some special commands + * + * should be done after viewImg(), because adminCommands() (force_import) uses some image informations + */ + if(isset($_GET['admin_cmd'])) { + $this->adminCommands(); + } + + if(isset($_GET['linMsg'])) + { + switch($_GET['linMsg']) + { + case 'basket_added': linSysLog(i18n("Images Added To Basket.")); break; + } + } + + /** + * set ref urls + * used in basket and ajax reloadmenu + */ + $_SESSION['ref_url_full'] = $GLOBALS['linpha']->template->URL_full; + $_SESSION['ref_url_base'] = $GLOBALS['linpha']->template->URL_base; + $_SESSION['ref_modulename'] = $this->modulename; + + /** + * set admin menu and more menu + * - this should be done after adminCommands, because of + * "nr images in basket" is changed in adminCommands() + * + * - this should be done after viewImg(), because of $org_width and $org_height in "View at" + */ + $this->setMenu(); + + /** + * at this point, there should be absolute no output + */ + include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); +} + +/** + * filter out files and folders not permitted and escape filename + * all other values dont have to be escaped + * (currently at least, have a look at LIN_SELECT_FIELDS) + */ +function filterPhotosNotPermitted() +{ + $this->photos_filtered = Array(); + + if(isset($this->photos)) + { + foreach($this->photos AS $key=>$value) + { + if( ! ($this->mode == 'image' && $value['img_type']== '0' ) ) // exclude subfolders from img_view + { + if( LinSql::photoIsAllowed( $value['id'] ) ) + { + /** + * escape name here + * -> we do not have to do it in the templates + */ + $value['name'] = htmlspecialchars($value['name'],ENT_QUOTES); + $this->photos_filtered[] = $value; + + //print_r($value); + } + } + } + } + + unset($this->photos); +} + +/** + * create optional top menu + */ +function setMenu() +{ + + + /** + * Menu Admin + */ + if($GLOBALS['linpha']->sql->isAdmin()) + { + $GLOBALS['linpha']->template->menu['admin']['import'] = + array( + 'name' => i18n("Import"), + 'link' => array( + array('name' => i18n("Start Import Of This Folder/File"), 'link' => LINPHA_CLIENT.'/admin/?cat=maintenance_import&album_select[]='.$this->id_parent), + array('name' => i18n("Detect File Changes"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=force_import') + ) + ); + + $GLOBALS['linpha']->template->menu['admin']['permissions'] = + array( + 'name' => i18n("Permissions"), + 'link' => array( + array('name' => i18n("Set Permissions"), 'link' => LINPHA_CLIENT.'/admin/?cat=permissions_view&cmd=edit&linId='.$GLOBALS['linpha']->template->idCurrent) + ) + ); + + + if($this->mode == 'thumb' || $this->mode == 'image') + { + /** + * append to "admin - import" entry + */ + $GLOBALS['linpha']->template->menu['admin']['import']['link'][] = array( + 'name' => i18n("Recreate This Thumbnail"), + 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' + ); + } + } + + /** + * Menu More + */ + if($this->mode != 'home') + { + /** + * more than one time used stuff + */ + $array = linGetSortOrders(); + foreach($array as $value) // i18n() already called + { + $array_sort_orders_links[] = array('name' => $value, 'link' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); + } + + $open_basket_link = LINPHA_LINK.'&linCat=basket'; + + switch($this->mode) + { + case 'thumb': + + $GLOBALS['linpha']->template->menu['more']['basket'] = + array( + 'name' => i18n("Basket"), + 'link' => array( + array('name' => i18n("Add All To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all'), + array('name' => i18n("Switch To Basket View"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), + array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) + ) + ); + + if( linUseAjax() ) + { + $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectsizes']); + foreach($array as $value) + { + $array_tn_sizes_links[] = array('name' => $value.' '.i18n("Pixel"), 'link' => 'javascript:myLinThumbnails.setTnSize('.$value.')'); + } + + $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectnrimages']); + foreach($array as $value) + { + $array_nr_links[] = array('name' => $value, 'link' =>"javascript:myLinThumbnails.setNrImages('".$value."')"); + } + + $array_views_links[] = array('name' => i18n("Normal"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumb'); + $array_views_links[] = array('name' => i18n("Detail"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumbdetail'); + + $GLOBALS['linpha']->template->menu['more']['view'] = + array( + 'name' => i18n("View"), + 'link' => array( + array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), + array('name' => i18n("View"), 'link' => $array_views_links), + array('name' => i18n("Thumb Size"), 'link' => $array_tn_sizes_links), + array('name' => i18n("Thumb Nr"), 'link' => $array_nr_links) + ) + ); + } + else + { + $GLOBALS['linpha']->template->menu['more']['view'] = + array( + 'name' => i18n("View"), + 'link' => array( + array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), + ) + ); + } + + if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) + { + $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; + } + + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) + { + $GLOBALS['linpha']->template->menu['more']['metainfo'] = + array( + 'name' => i18n("Metainfo"), + 'link' => array( + array('name' => i18n("Edit Album Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=albmeta'), + ) + ); + } + break; + case 'image': + + $GLOBALS['linpha']->template->menu['more']['basket'] = + array( + 'name' => i18n("Basket"), + 'link' => array( + array('name' => i18n("Add To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this'), + array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) + ) + ); + $GLOBALS['linpha']->template->menu['more']['view'] = + array( + 'name' => i18n("View"), + 'link' => array( + array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), + array('name' => i18n("View at"), 'link' => + array( + array('name' => '640x480', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=640&height=480', 'target' => '_blank'), + array('name' => '800x600', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=800&height=600', 'target' => '_blank'), + array('name' => '1024x768', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1024&height=768', 'target' => '_blank'), + array('name' => '1280x800', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=800', 'target' => '_blank'), + array('name' => '1280x960', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=960', 'target' => '_blank'), + array('name' => '1280x1024', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=1024', 'target' => '_blank'), + array('name' => '1600x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1600&height=1200', 'target' => '_blank'), + array('name' => '1920x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1920&height=1200', 'target' => '_blank'), + array('id' => 'linLiViewAtFullscreen', 'name' => $this->org_width.'x'.$this->org_height.' ('.i18n("Fullscreen").')', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width='.$this->org_width.'&height='.$this->org_height, 'target' => '_blank'), + ) + ) + ) + ); + + + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) + { + $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['name'] = i18n("Rotate Left"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; + $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['name'] = i18n("Rotate Right"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; + } + + if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) + { + $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; + } + + + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) + { + $GLOBALS['linpha']->template->menu['more']['metainfo'] = + array( + 'name' => i18n("Metainfo"), + 'link' => array( + array('name' => i18n("Edit Image Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=meta') + ) + ); + } + + break; + } + } + + /** + * Icons + */ + if($this->mode == 'thumb') + { + /** + * basket icons + */ + if( $GLOBALS['linpha']->sql->checkPermission('basket_download')) + { + $GLOBALS['linpha']->template->menu['icon_download'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_all_with_checkout&checkout_as=download'; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) + { + $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_all_with_checkout&checkout_as=print'; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) + { + $GLOBALS['linpha']->template->menu['icon_mail'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_all_with_checkout&checkout_as=mail'; + } + /** + * slideshow icon + */ + if( linUseAjax() ) { + $GLOBALS['linpha']->template->menu['icon_slideshow'] = 'javascript:myLinThumbnails.loadSlideshow()'; + } + } + elseif($this->mode == 'image') + { + /** + * basket icons + */ + if( $GLOBALS['linpha']->sql->checkPermission('download')) + { + $GLOBALS['linpha']->template->menu['icon_download'] = LINPHA_LINK.'&linCat=download&linId='.$GLOBALS['linpha']->template->idCurrent; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) + { + $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_this_with_checkout&checkout_as=print'; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) + { + $GLOBALS['linpha']->template->menu['icon_mail'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_this_with_checkout&checkout_as=mail'; + } + + /** + * slideshow icon + */ + if( linUseAjax() ) { + $GLOBALS['linpha']->template->menu['icon_slideshow'] = 'javascript:myLinThumbnails.fullscreenStart()'; + } + } +} + +/** + * method for special admin commands, like rotating images, import stuff etc. + * @uses LinImgview::buildImgView() + */ +function adminCommands() +{ + switch($_GET['admin_cmd']) + { + case 'recreate': + if($GLOBALS['linpha']->sql->isAdmin()) + { + $thumbnail = new LinImage(); + $_GET['force'] = true; + $thumbnail->createThumbnail($GLOBALS['linpha']->template->idCurrent); + } + break; + case 'force_import': // called in viewImg + LinImport::updateEntry( $GLOBALS['linpha']->template->idCurrent , dirname($this->src_file) , $this->filename ); + break; + case 'rotate_left': + if($GLOBALS['linpha']->sql->isAdmin()) + { + LinImage::rotateImageByMenuCall('-90', $GLOBALS['linpha']->template->idCurrent); + } + break; + case 'rotate_right': + if($GLOBALS['linpha']->sql->isAdmin()) + { + LinImage::rotateImageByMenuCall('90', $GLOBALS['linpha']->template->idCurrent); + } + break; + case 'basket_add_all': + case 'basket_add_all_with_checkout': + /** + * coming from imgview, mode=viewThumb + * the permission check with photoIsAllowed() is done while checking out + */ + foreach($this->photos_filtered AS $value) + { + if($value['img_type']!=0) + { + $_SESSION['basket_ids'][] = $value['id']; + } + } + + if($_GET['admin_cmd'] == 'basket_add_all_with_checkout') + { + header("Location: ".LINPHA_LINK."&linCat=basket&checkout_as=".$_GET['checkout_as']); + exit(); + } + break; + case 'basket_add_this': + case 'basket_add_this_with_checkout': + /** + * coming from imgview, mode=viewImg + */ + $_SESSION['basket_ids'][] = $GLOBALS['linpha']->template->idCurrent; + + if($_GET['admin_cmd'] == 'basket_add_this_with_checkout') + { + header("Location: ".LINPHA_LINK."&linCat=basket&checkout_as=".$_GET['checkout_as']); + exit(); + } + break; + } +} + +/** + * define thumbnail view + */ +function viewThumb() +{ + $this->viewThumbSetSubFolders(); + + /** + * create thumbnail info text (filename, description, etc.) + */ + $i=0; + + foreach($this->photos_filtered AS $key=>$photo_value) + { + if($_SESSION['mode_thumbview'] == 'thumbdetail') { + $flag_nr = 14; // flag nr of thumbdetail + } else { + $flag_nr = 13; // flag nr of thumb + } + + $array_image_infos = LinMetaData::readInformations($photo_value,$flag_nr); + + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] = ''; + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['after'] = ''; + $index = 'before'; + $i=0; + foreach($array_image_infos AS $value) + { + /** + * got thumbnail, switch to index after + */ + if($value['value']=='thumbnail') + { + $index = 'after'; + } + else + { + $i++; + if($index == 'before') + { + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] .= $value['value'].'<br />'; // $value['value'] is already escaped + } + elseif($index == 'after') + { + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['after'] .= $value['value'].'<br />'; // $value['value'] is already escaped + } + } + } + + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['title'] = $photo_value['name']; // $photo_value['name'] is already escaped + } + + $this->nr_text_lines = $i; // used in LinThumbnails.js to calculate the space for the thumb height + + /** + * switch between javascript + */ + if( linUseAjax() ) + { + /** + * create javascript object containing all thumb informations + */ + + $GLOBALS['linpha']->template->setModuleName('view_thumb'); + + $GLOBALS['linpha']->template->output['page_nr_left'] = ''; + $GLOBALS['linpha']->template->output['page_nr_right'] = ''; + $GLOBALS['linpha']->template->output['page_nr'] = ''; + + + /** + * create files db + * this is a normal javascript array + * just another kind of definition... + */ + $GLOBALS['linpha']->template->output['files_db'] = 'var linImgIds = ['."\n"; + if($this->tot_photos > 0) // check if not all entries were folders + { + foreach($this->photos_filtered AS $key=>$value) + { + if( ( $GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] && $value['img_type'] != 0 ) + OR !$GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] ) + { + $before = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['before']; + $after = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['after']; + $title = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['title']; + + $array_files_db[] = '{ id: "'.$value['id'].'", before: "'.str_replace('"','\"',$before).'", after: "'.str_replace('"','\"',$after).'", title: "'.str_replace('"','\"',$title).'" }'; + } + } + + $GLOBALS['linpha']->template->output['files_db'] .= implode($array_files_db,", \n"); + + } + $GLOBALS['linpha']->template->output['files_db'] .= "\n".'];'; + } + else + { + $GLOBALS['linpha']->template->setModuleName('static.view_thumb'); + $GLOBALS['linpha']->template->overrideModule('css','view_thumb'); + + $this->viewThumbNojs(); + } +} + +/** + * thumbnail view with javascript disabled (static) + * @uses LinImgView::viewThumb() + */ +function viewThumbNojs() +{ + /** + * prepare variables + */ + $max_photos_per_page = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrrows'] * $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrcols']; + $this->nr_pages = ceil( $this->tot_photos / $max_photos_per_page ); + if(isset($_GET['pn']) && $_GET['pn'] > 1) + { + $this->current_page = $_GET['pn']; + } + else + { + $_GET['pn'] = 1; + $this->current_page = 1; + } + + + $this->viewThumbNojsWritePageNumbers(); + + /** + * create array $this->photos_show which contains only the photos of the current page + */ + if($this->tot_photos > 0) // only if not all entries were folders + { + $img_nr = 1; + $i = 0; + $startup_img_nr = ($this->current_page - 1)*$max_photos_per_page; + + foreach($this->photos_filtered AS $value) + { + if($i >= $startup_img_nr && $img_nr <= $max_photos_per_page // add images only while in current page + && ( ( $GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] && $value['img_type'] != 0 ) // add images only if no folder because they are shown separate + OR !$GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] ) ) // add folders only if they are not shown separate + { + $this->photos_show[] = $value; + $img_nr++; + } + $i++; + } + } +} + +/** + * setup page numbers (only used if static) + */ +function viewThumbNojsWritePageNumbers() +{ + /** + * writing page numbers + */ + $start_nr = 1; + + /** + * write left and right '...' if more than 10 pages + */ + $left_dots = ""; + $right_dots = ""; + if($this->nr_pages > 10) + { + $start_nr = $_GET['pn']; + + if($_GET['pn'] >= $this->nr_pages-5) // we reached end of album + { + $start_nr = $this->nr_pages-10; + $left_dots = "... "; + } + elseif($start_nr <=5 ) // we are at the beginning + { + $this->nr_pages = 10; + $start_nr = 1; + $right_dots = " ..."; + } + else + { + $this->nr_pages = $start_nr+5; + $start_nr -= 5; + if($_GET['pn']!="6") : $left_dots="... "; endif; + $right_dots=" ..."; + } + } + + $GLOBALS['linpha']->template->output['page_nr'] = $left_dots; + + for($i=$start_nr; $i <= $this->nr_pages; $i++) + { + if($i == $this->current_page) + { + $GLOBALS['linpha']->template->output['page_nr'] .= $i.' '; + } + else + { + $GLOBALS['linpha']->template->output['page_nr'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.$i.'">'.$i.'</a> '; + } + } + + $GLOBALS['linpha']->template->output['page_nr'] .= $right_dots; + + /** + * write starting ' << ' and ' < ' + */ + if($this->current_page != 1) + { + $GLOBALS['linpha']->template->output['page_nr_left'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn=1"><<</a> ' . + '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page-1).'"><</a> '; + } + else + { + $GLOBALS['linpha']->template->output['page_nr_left'] = '<< <'; + } + + /** + * write ending '>' and '>>' + */ + if($this->current_page != $this->nr_pages && $this->nr_pages != 0) // need check nr_pages != 0 because we don't need links if nr_pages == 0! + { + $GLOBALS['linpha']->template->output['page_nr_right'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page+1).'">></a> ' . + '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->nr_pages).'">>></a> '; + } + else + { + $GLOBALS['linpha']->template->output['page_nr_right'] = '> >>'; + } +} + +/** + * print sub folders AND calculate tot_photos + * @todo should we show subfolders separate..? + * i think this is useless if we can set automatically view = thumbdetail + */ +function viewThumbSetSubFolders() +{ + $output_folders = ''; + $nr_folders = 0; + + if( ! isset($GLOBALS['linpha']->template->output['navigation'] ) ) + { + $GLOBALS['linpha']->template->output['navigation'] = ''; + } + + if($GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate']) + { + foreach($this->photos_filtered AS $key=>$value) + { + if($value['img_type'] == 0) + { + $GLOBALS['linpha']->template->output['navigation'] .= '<a href="'.LINPHA_LINK.'&linCat=alb&linId='.$value['id'].'">'.$value['name'].'</a><br />'; + $nr_folders++; + } + } + } + + /** + * set tot_photos + * subtract number of folders if they are shown separate + */ + $this->tot_photos = count($this->photos_filtered) - $nr_folders; +} + +/** + * setup detailed thumbdetail view + */ +function viewThumbdetail() +{ + $GLOBALS['linpha']->template->setModuleName('view_thumbdetail'); +} + +/** + * setup main/home view layout + */ +function viewHome() +{ + $GLOBALS['linpha']->template->setModuleName('home'); + + /** + * set welcome text + */ + if($GLOBALS['linpha']->sql->config->value['sys_style_home_usedefaultwelcometext']) + { + $GLOBALS['linpha']->template->output['welcome'] = '<h1 class="linStyle">'.i18n("Welcome").'</h1>'. + i18n("Hi, this is the home of \"The PHP Photo Archive\" <a href=\"http://linpha.sf.net\">aka LinPHA</a>.").'<br />'; + } + else + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT meta_comment FROM ".LIN_PREFIX."meta_comments WHERE md5sum='welcometext'"); + if(isset($data['meta_comment'])) + { + $GLOBALS['linpha']->template->output['welcome'] = $data['meta_comment']; + } + else + { + $GLOBALS['linpha']->template->output['welcome'] = ''; + } + } + + /** + * new images + */ + $days = $GLOBALS['linpha']->sql->config->value['sys_style_home_newimagesage']; + $days_in_sec = $days*60*60*24; + $lower_date = time()-$days_in_sec; + $this->viewHomeSetImages('new_images','sys_style_home_newimagesnr',' AND time_add > '.LinSql::linAddslashes($lower_date)); + + /** + * random images + */ + $this->viewHomeSetImages('random_images','sys_style_home_nrrandomimages',''); + + /** + * browse by date + */ + $this->viewHomeSetBrowseByDate(); + + /** + * album informations + */ + foreach($this->photos_filtered AS $photo_key=>$photo_value) + { + $array_image_infos = LinMetaData::readInformations($photo_value,$flag_nr=12); + + $this->photos_filtered[$photo_key]['album_infos'] = ''; + foreach($array_image_infos AS $key=>$value) + { + if($key == 'builtin_stats_numbers') + { + $this->photos_filtered[$photo_key]['album_infos'] .= $value['value'].' '.i18n("Photos").'<br />'; + } + elseif($key == 'builtin_first_comment') + { + $this->photos_filtered[$photo_key]['album_infos'] .= '<div class="linDivFolderComment">'.$value['value']; + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { + $this->photos_filtered[$photo_key]['album_infos'] .= ' <a href="'.$GLOBALS['linpha']->template->URL_base.'&linId='.$photo_value['id'].'&view=albmeta'.'">Edit</a>'; + } + $this->photos_filtered[$photo_key]['album_infos'] .= '</div>'; + } + else + { + $this->photos_filtered[$photo_key]['album_infos'] .= $value['value'].'<br />'; + } + } + } +} + +/** + * setup browse by date feature + */ +function viewHomeSetBrowseByDate() +{ + if($GLOBALS['linpha']->sql->config->value['sys_style_home_showbrowsebydate']) + { + $GLOBALS['linpha']->template->output['browse_by_date'] = ''; + + $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal) AS min , max(datetimeoriginal) AS max " . + "FROM ".LIN_PREFIX."meta_exif"); + if(isset($data['min']) && isset($data['max']) && !empty($data['min']) && !empty($data['max']) ) + { + /** + * get min and max year + */ + $min_year = substr($data['min'],0,4); + $max_year = substr($data['max'],0,4); + /** + * get years between + */ + for($i = $min_year; $i <= $max_year; $i++) + { + /** + * exclude all wrong/empty/... dates + */ + if($i > 1900) + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) AS datetime FROM ".LIN_PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); + if($data['datetime']>0) + { + $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_LINK.'&linCat=browse&year='.$i.'">'.$i.'</a> ('.$data['datetime'].'), '; + } + } + } + } + } +} + +/** + * setup random and new imgages view + */ +function viewHomeSetImages($key,$optionname,$sql) +{ + $GLOBALS['linpha']->template->output[$key] = array(); + + if($GLOBALS['linpha']->sql->config->value[$optionname] != 0) + { + switch(LIN_DB_TYPE) + { + case 'mysql': + $str_random = 'rand()'; + break; + case 'postgres': + $str_random = 'random()'; + break; + case 'sqlite': + $str_random = 'random()'; + break; + case 'oci8po': + $str_random = $GLOBALS['linpha']->db->random; + break; + } + + $nr_images = $GLOBALS['linpha']->sql->config->value[$optionname]; + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999".$sql." ORDER BY ".$str_random); + + for($i = 1; $i <= $nr_images ; ) + { + $data = $query->FetchRow(); + if(isset($data['id'])) + { + $path = LinSql::getFullImagePath( $data['id'] ); + + if(file_exists($path) && LinSql::photoIsAllowed($data['id'])) + { + $GLOBALS['linpha']->template->output[$key][] = array('id'=>$data['id'],'path'=>$path); + $i++; + } + } + else + { + break; + } + } + } +} + +/** + * setup basket view + */ +function viewBasket() +{ + $GLOBALS['linpha']->template->setModuleName('view_basket'); + $GLOBALS['linpha']->template->overrideModule('css','view_thumb'); // used the same css definitions as view_thumb + + $this->viewThumbSetSubFolders(); + $this->viewThumbNojs(); +} + +/** + * setup comment view + */ +function viewAlbMeta() +{ + $GLOBALS['linpha']->template->setModuleName('view_albmeta'); + + /** + * save data + */ + if( isset( $_POST['cmd'] ) && $_POST['cmd']=="add_comment") + { + /** + * check if comment exists + * + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT id " . + "FROM ".LIN_PREFIX."meta_comments " . + "WHERE md5sum = '".LinSql::linAddslashes($this->md5sum)."'"); + + if( $query->EOF ) // insert + { + $GLOBALS['linpha']->db->Execute( + "INSERT into ".LIN_PREFIX."meta_comments " . + "(meta_time, md5sum, meta_author, meta_comment) " . + "VALUES " . + "('".time()."', '".LinSql::linAddslashes($this->md5sum)."', " . + "'".LinSql::linAddslashes($_POST['author'])."', '".LinSql::linAddslashes($_POST['comment'])."')" + ); + } + else // update + { + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."meta_comments SET ". + "meta_time = '".time()."', ". + "meta_author = '".LinSql::linAddslashes($_POST['author'])."', " . + "meta_comment = '".LinSql::linAddslashes($_POST['comment'])."' " . + "WHERE md5sum = '".LinSql::linAddslashes($this->md5sum)."'"); + } + } + + /** + * get data + */ + $data = $GLOBALS['linpha']->db->GetRow( + "SELECT id, meta_time, meta_author, meta_comment " . + "FROM ".LIN_PREFIX."meta_comments " . + "WHERE md5sum = '".$this->md5sum."'" + ); + if(isset($data['meta_author'])) + { + $GLOBALS['linpha']->template->output['comment_author'] = $data['meta_author']; + } + else + { + $GLOBALS['linpha']->template->output['comment_author'] = $_SESSION['user_name']; + } + + if(isset($data['meta_comment'])) + { + $GLOBALS['linpha']->template->output['comment_text'] = $data['meta_comment']; + } + else + { + $GLOBALS['linpha']->template->output['comment_text'] = ''; + } + + /** + * save modified MetaData + */ + LinMetaData::saveModifiedMetaData(); +} + +/** + * setup image view + */ +function viewImg() +{ + $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); + + if( LinIdentify::isVideo( $this->img_type )) // in video mode, the video thumbnail is shown instead of the image + { + $this->img_width = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; + $this->img_height = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; + } + else + { + $max_width = $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; + $max_height = $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; + $array = LinImage::scaleToFit($this->org_width,$this->org_height,$max_width,$max_height); + + $this->img_width = $array['w']; + $this->img_height = $array['h']; + } + + $this->viewImgCommon(); + $this->viewImgComments(); + + if( linUseAjax() ) + { + $GLOBALS['linpha']->template->setModuleName('view_img'); + + if(isset($_GET['xml'])) + { + $this->viewImgXml(); + exit(); + } + } + else + { + $GLOBALS['linpha']->template->setModuleName('static.view_img'); + $GLOBALS['linpha']->template->overrideModule('css','view_img'); + } +} + +/** + * generate xml data for ajax image view + */ +function viewImgXml() +{ + header('Content-type: text/xml'); + echo '<?xml version="1.0" ?>'."\n"; + ?> +<root> +<imgid><?php echo $GLOBALS['linpha']->template->idCurrent; ?></imgid> +<filetype><?php echo LinIdentify::getShortFileType( $this->img_type ); ?></filetype> +<imgwidth><?php echo $this->org_width; ?></imgwidth> +<imgheight><?php echo $this->org_height; ?></imgheight> +<imgnr><?php printf(i18n("Image %s of %s"),$this->current_key+1,count($this->photos_filtered)); ?></imgnr> +<title><?php /* oh, what an evil hack */ echo str_replace('<','<',$GLOBALS['linpha']->template->linpha_title." :: ".$GLOBALS['linpha']->template->output['title']); ?></title> +<?php + if(isset($this->xmldata['prev_thumb'])) { + foreach($this->xmldata['prev_thumb'] AS $value) + { + echo '<prevthumb>'.$value.'</prevthumb>'."\n"; + } + } + if(isset($this->xmldata['next_thumb'])) { + foreach($this->xmldata['next_thumb'] AS $value) + { + echo '<nextthumb>'.$value.'</nextthumb>'."\n"; + } + } + + foreach($GLOBALS['linpha']->template->output['image_infos'] AS $value) + { ?> +<meta> + <name><?php echo $value['name']; ?></name><value><?php echo htmlspecialchars($value['value']); ?></value> +</meta> +<?php + } + + if($this->newCommentAdded) + { + echo '<commentadded>'.i18n("Comment successfully added.").'</commentadded>'."\n"; + } + + while($data = $GLOBALS['linpha']->template->output['image_comments']->FetchRow()) + { ?> +<comment> + <time><?php echo htmlspecialchars(linStrftime($data['meta_time'])); ?></time> + <author><?php echo htmlspecialchars($data['meta_author'],ENT_QUOTES); ?></author> + <text><?php echo str_replace('<','<',linHtmlTag($data['meta_comment'],ENT_QUOTES) ); ?></text> +</comment> +<?php } ?> +</root> + +<?php + +} // end viewImgAjax() + +/** + * stuff used in viewImg() and viewMeta() + */ +function viewImgCommon() +{ + $this->viewImgSetPrevNextThumb(); + + $this->viewImgStoreImageInformation(); + + $GLOBALS['linpha']->template->output['image_infos'] = + LinMetaData::readInformations($this->photos_filtered[$this->current_key], + $flag_nr=10); + +} + +/** + * get/save image comments + */ +function viewImgComments() +{ + /** + * image comments + */ + if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) + { + /** + * save comment + */ + if( isset( $_POST['cmd'] ) && $_POST['cmd']=='add_comment' + && isset($_POST['inputAddCommentAuthor']) + && !empty($_POST['inputAddCommentAuthor']) + && ((isset($_POST['inputAddCommentText']) && !empty($_POST['inputAddCommentText'])) + || (isset($_POST['inputAddCommentTextarea']) && !empty($_POST['inputAddCommentTextarea'])))) + { + if( !empty($_POST['inputAddCommentTextarea'])) { + $comment = $_POST['inputAddCommentTextarea']; + } else { + $comment = $_POST['inputAddCommentText']; + } + + $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_comments (meta_time, md5sum, meta_author, meta_comment)" . + "VALUES ('".time()."','".$GLOBALS['linpha']->imgview->md5sum."','".LinSql::linAddslashes($_POST['inputAddCommentAuthor'])."'," . + "'".LinSql::linAddslashes($comment)."')"); + $this->newCommentAdded = true; // used for ajax + } + + /** + * get comments + */ + $GLOBALS['linpha']->template->output['image_comments'] = $GLOBALS['linpha']->db->Execute("SELECT id, meta_time, meta_author, meta_comment FROM ".LIN_PREFIX."meta_comments " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); + } +} + +/** + * store image informations in database if s + */ +function viewImgStoreImageInformation() +{ + $array_meta = array('exif','iptc','xmp'); + foreach($array_meta AS $value) + { + if(!isset($MetaData)) + { + $MetaData = new LinMetaData(); + } + + /** + * read exif/iptc/xmp from file if no entry + */ + if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) + { + $MetaData->saveData($value, $this->src_file, $this->md5sum ); + } + + /** + * Read image geodata. This depends on the maps plugin. So we only + * run this additionally import if maps plugin is enabled and admin + * selected "autoimport". + * This should prevent all others from suffering performance issues + * during import + */ + if(isset($GLOBALS['linpha']->sql->config->value['plugins_maps_enable']) + && $GLOBALS['linpha']->sql->config->value['plugins_maps_enable_geotagged'] + && $GLOBALS['linpha']->sql->config->value['plugins_maps_geotagged_autoimport']) + { + $MetaData->singleImportGeoData($this->md5sum, $this->src_file); + error_log("DOING GEODATA AUTOIMPORT",'',0); + } + } +} + +/** + * generate html code for the prev/next thumbnail + */ +function viewImgThumbHtml($key,$class) +{ + $id = $this->photos_filtered[$key]['id']; + $name = $this->photos_filtered[$key]['name']; + + $str = '<div class="linDivThumbnavi_'.$class.'">' + . '<a href="'.$GLOBALS['linpha']->template->URL_base.'&linId='.$id.'">' + . '<img class="linImgThumbnavi_'.$class.'" src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$id.'" /></a>' + . '<br />'.$name.'</div>'."\n"; + + return $str; +} + +/** + * set prev/next thumb for img_view and meta_view + */ +function viewImgSetPrevNextThumb() +{ + $nr_prev_next_thumbs = $GLOBALS['linpha']->sql->config->value['sys_style_image_nrprevnextthumbs']; + + /** + * search current key in array + */ + foreach($this->photos_filtered AS $key=>$value) + { + if($value['id'] == $GLOBALS['linpha']->template->idCurrent) + { + $this->current_key = $key; + break; + } + } + + /** + * ooh, something went wrong + */ + if(!isset($this->current_key)) + { + $this->current_key = 0; + } + + /** + * set prev thumbs + */ + $GLOBALS['linpha']->template->output['prev_thumb'] = ''; + for($i=$nr_prev_next_thumbs; $i > 0; $i--) + { + if($this->current_key >= $i) + { + if(isset($_GET['xml'])) + { + $this->xmldata['prev_thumb'][] = $this->photos_filtered[$this->current_key - $i]['id']; + } + else + { + $GLOBALS['linpha']->template->output['prev_thumb'] .= $this->viewImgThumbHtml( $this->current_key - $i , 'PrevNext' ); + } + } + } + + /** + * set next thumbs + */ + $GLOBALS['linpha']->template->output['next_thumb'] = ''; + for($i=0; $i < $nr_prev_next_thumbs; $i++) + { + if($this->current_key < ( count($this->photos_filtered) - ($i+1) ) ) + { + if(isset($_GET['xml'])) + { + $this->xmldata['next_thumb'][] = $this->photos_filtered[$this->current_key + ($i+1)]['id']; + } + else + { + $GLOBALS['linpha']->template->output['next_thumb'] .= $this->viewImgThumbHtml( $this->current_key + ($i+1) , 'PrevNext' ); + } + } + } + + + /** + * set current image and thumb + */ + if(isset($_GET['xml'])) + { + } + else + { + $GLOBALS['linpha']->template->output['current_thumb'] = $this->viewImgThumbHtml( $this->current_key , 'Current' ); + } +} + +/** + * setup MetaData view + */ +function viewMeta() +{ + $GLOBALS['linpha']->template->setModuleName('static.view_img'); + $GLOBALS['linpha']->template->overrideModule('css','view_img'); + + $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); + + /** + * save modified MetaData + */ + LinMetaData::saveModifiedMetaData(); + + $this->viewImgCommon(); +} + +} // end class linImgview +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-16 08:53:32
|
Revision: 4908 http://linpha.svn.sourceforge.net/linpha/?rev=4908&view=rev Author: fangehrn Date: 2008-03-16 01:53:26 -0700 (Sun, 16 Mar 2008) Log Message: ----------- 2008-03-15 flo * fixed some IE bugs everything should now work fine on firefox/opera/IE 2008-03-13 flo * finished fullscreen/slideshow/navigation 2008-03-09 flo * re-design thumb and image view Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-03-16 08:53:04 UTC (rev 4907) +++ trunk/linpha2/ChangeLog 2008-03-16 08:53:26 UTC (rev 4908) @@ -1,4 +1,14 @@ +2008-03-15 flo + * fixed some IE bugs + everything should now work fine on firefox/opera/IE + +2008-03-13 flo + * finished fullscreen/slideshow/navigation + +2008-03-09 flo + * re-design thumb and image view + 2008-03-07 flo * started using YUI tabview (oh this was easy) * fixed some bugs Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2008-03-16 08:53:04 UTC (rev 4907) +++ trunk/linpha2/index.php 2008-03-16 08:53:26 UTC (rev 4908) @@ -53,6 +53,9 @@ case 'ajax': require_once(LINPHA_DIR.'/lib/modules/module.ajax.php'); break; +case 'image': + require_once(LINPHA_DIR.'/lib/modules/module.image.php'); + break; case 'newimg': require_once(LINPHA_DIR.'/lib/modules/module.newimg.php'); break; @@ -74,7 +77,7 @@ case 'viewer': require_once(LINPHA_DIR.'/lib/modules/module.viewer.php'); break; - case 'empty': +case 'empty': require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-16 08:53:10
|
Revision: 4907 http://linpha.svn.sourceforge.net/linpha/?rev=4907&view=rev Author: fangehrn Date: 2008-03-16 01:53:04 -0700 (Sun, 16 Mar 2008) Log Message: ----------- 2008-03-15 flo * fixed some IE bugs everything should now work fine on firefox/opera/IE 2008-03-13 flo * finished fullscreen/slideshow/navigation 2008-03-09 flo * re-design thumb and image view Modified Paths: -------------- trunk/linpha2/templates/default/slideshow.js.php trunk/linpha2/templates/default/themes/default/colorsettings.php trunk/linpha2/templates/misc/box.php trunk/linpha2/templates/misc/box_test.php trunk/linpha2/templates/misc/roundCorners.css Added Paths: ----------- trunk/linpha2/templates/default/tabs/ trunk/linpha2/templates/default/tabs/comments.html.php trunk/linpha2/templates/default/tabs/exif.html.php trunk/linpha2/templates/default/tabs/gps.html.php trunk/linpha2/templates/default/tabs/imageInfo.html.php trunk/linpha2/templates/default/tabs/iptcXmp.html.php trunk/linpha2/templates/default/tabs/videoInfo.html.php Modified: trunk/linpha2/templates/default/slideshow.js.php =================================================================== --- trunk/linpha2/templates/default/slideshow.js.php 2008-03-16 08:52:25 UTC (rev 4906) +++ trunk/linpha2/templates/default/slideshow.js.php 2008-03-16 08:53:04 UTC (rev 4907) @@ -1,205 +1,80 @@ <?php +define('LINPHA_DIR','../..'); +include_once(LINPHA_DIR.'/lib/include/common.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); +$linpha = new Linpha(); // define LINPHA_CLIENT +$linpha->sql->startSession(); // load language strings and enable template class -switch($fragment) -{ -/** - * the slideshow controls - */ -case 'slideshow': - ?> - <div id="linDivSlideshowControls"> - <div style="float: left; margin-left: 10px; "> - <a href="javascript:myLinImage.moveFirst()"><img id="linSsImgFirst" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_first.gif" width="25" height="25" border="0" alt="First" title="<?php echo i18n("First"); ?>" /></a> - <a href="javascript:myLinImage.movePrev()"><img id="linSsImgPrev" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_previous.gif" width="25" height="25" border="0" alt="Previous" title="<?php echo i18n("Previous"); ?>" /></a> - <a href="javascript:myLinImage.slideshowStartStop()"><img id="linSsImgStart" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_play.gif" width="25" height="25" border="0" alt="Play" title="<?php echo i18n("Play/Pause"); ?>" /></a> - <!--<a href="javascript:myLinImage.slideshowStop()"><img id="linSsImgStop" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_stop.gif" width="25" height="25" border="0" alt="Stop" title="<?php echo i18n("Stop"); ?>" /></a>--> - <a href="javascript:myLinImage.moveNext()"><img id="linSsImgNext" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_next.gif" width="25" height="25" border="0" alt="Next" title="<?php echo i18n("Next"); ?>" /></a> - <a href="javascript:myLinImage.moveLast()"><img id="linSsImgLast" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_last.gif" width="25" height="25" border="0" alt="Last" title="<?php echo i18n("Last"); ?>" /></a> - </div> - - <div style="float: left; margin-left: 40px; "> - <select id="linSsDelay" name="delay" size="1" class="linForms" onchange="myLinImage.slideshowChangeDelay()" title="<?php echo i18n("Delay"); ?>"> - <option value="3">3 s</option> - <option value="4">4 s</option> - <option value="5" selected="selected">5 s</option> - <option value="10">10 s</option> - <option value="15">15 s</option> - <option value="30">30 s</option> - <option value="45">45 s</option> - <option value="60">60 s</option> - </select> - </div> - - <div style="float: left; margin-left: 10px; "> - <a href="javascript:myLinImage.slideshowChangeLoop()"><img id="linSsImgLoop" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_loop.gif" width="25" height="25" border="0" alt="Loop" title="<?php echo i18n("Enable/disable Loop"); ?>" /></a> - <!--<a href="javascript:myLinImage.slideshowChangeLoop()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_noloop.gif" width="25" height="25" border="0" /></a>--> - <a href="javascript:myLinImage.slideshowChangeRandom()"><img id="linSsImgRandom" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_norandom.gif" width="25" height="25" border="0" alt="Random" title="<?php echo i18n("Enable/disable Random Play Order"); ?>" /></a> - <!--<a href="javascript:myLinImage.slideshowChangeRandom()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_random.gif" width="25" height="25" border="0" /></a>--> - </div> - - <div id="linDivSlideshowImgNr" style="float: left; margin-left: 40px; "></div> - - <div id="linDivSlideshowExit" style="float: left; margin-left: 40px; "> - <a href="javascript:myLinImage.fullscreenStop()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_stop.gif" width="25" height="25" border="0" alt="Exit" title="<?php echo i18n("Exit Fullscreen"); ?>" ></a> - </div> - - <div style="clear: both;"></div> - </div> - <?php echo $linTpl->divRoundCorners('bottom','alpha'); ?> -<?php -break; +header('Content-type: text/javascript'); - /** - * view meta + * force caching in browser + * works in firefox and internet explorer */ -case 'edit_meta': - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { ?> - - <?php - /** - * @todo thats not the correct way including css files... :-/ - */ - ?> - <link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'.$this->template_name.'/themes/default/css/admin.css'; ?>' type='text/css'> +header("Last-Modified: " . gmdate("D, d M Y H:i:s",gmmktime (0,0,0,1,1,2000))); // Date in the past +header("Expires: Mon, 26 Jul 2100 05:00:00 GMT"); // In other words... never expire the image +header("Cache-Control: max-age=10000000, s-maxage=1000000, proxy-revalidate, must-revalidate"); - <?php if($GLOBALS['linpha']->imgview->img_type!=0) { ?> - <ul class="linUlMenu"> - <li><a id="linAMetaLinpha" href="javascript:showMetaLinpha()">LinPHA MetaData</a></li> - <li><a id="linAMetaIptc" href="javascript:showMetaIptc()">IPTC MetaData</a></li> - <li><a id="linAMetaXmp" href="javascript:showMetaXmp()">XMP MetaData</a></li> - </ul> - <?php } /* end if img_type!=0 */ ?> - - <div id="linDivMetaLinpha"> - <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> - <table border="0" style="float: left;"> - <?php echo $linTpl->output['meta_linpha']; ?> - <tr> - <td rowspan="2"> - <br /> - <input type="hidden" name="linCmd" value="linInsertMetaLinpha" /> - <input type="submit" class="linButton" name="submit" value="<?php echo i18n("Submit"); ?>" /> - </td> - </tr> - </table> - </form> - </div> - - <?php if($GLOBALS['linpha']->imgview->img_type!=0) { ?> - <div id="linDivMetaIptc"> - <?php if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { - echo '<br />'; - if($meta_edit_possible) { ?> - <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> - <table border="0"> - <?php - include(LINPHA_DIR.'/lib/include/metadata_iptc_edit.php'); - ?> - <tr> - <td rowspan="2"> - <br /> - <input type="hidden" name="linCmd" value="linInsertMetaIptc" /> - <input type="submit" class="linButton" name="submit" value="<?php echo i18n("Submit"); ?>" /> - </td> - </tr> - </form> - </table> - <br> - <br> - <p>Powered by: <a href="http://owl.phy.queensu.ca/~phil/exiftool/" >ExifTool</a></p> - <?php - } else { - echo i18n("Error: File not writable. Please check the file permissions."); /* @todo use unified language string */ - } - } else { - echo i18n("IPTC Is Currently Disabled.").'<br /><br />'; - if($GLOBALS['linpha']->sql->isAdmin()) { - echo '<a href="'.LINPHA_CLIENT.'/admin/?cat=metadata_define_iptc">'.i18n("Enable IPTC").'</a>'; - echo '<br /><br />'; - } - } ?> - </div> - <?php } /* end if img_type!=0 */ ?> - <?php if($GLOBALS['linpha']->imgview->img_type!=0) { ?> - <div id="linDivMetaXmp"> - <?php if($GLOBALS['linpha']->sql->config->value['sys_image_xmp']) { - echo '<br />'; - if($meta_edit_possible) { ?> - <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> - <table border="0"> - <?php - include(LINPHA_DIR.'/lib/include/metadata_xmp_edit.php'); - ?> - <tr> - <td rowspan="2"> - <br /> - <input type="hidden" name="linCmd" value="linInsertMetaXmp" /> - <input type="submit" class="linButton" name="submit" value="<?php echo i18n("Submit"); ?>" /> - </td> - </tr> - </form> - </table> - <br> - <br> - <p>Powered by: <a href="http://owl.phy.queensu.ca/~phil/exiftool/" >ExifTool</a></p> - <?php - } else { - echo i18n("Error: File not writable. Please check the file permissions."); /* @todo use unified language string */ - } - } else { - echo i18n("XMP Is Currently Disabled.").'<br /><br />'; - if($GLOBALS['linpha']->sql->isAdmin()) { - echo '<a href="'.LINPHA_CLIENT.'/admin/?cat=metadata_define_xmp">'.i18n("Enable XMP").'</a>'; - echo '<br /><br />'; - } - } ?> - </div> - <?php } /* end if img_type!=0 */ ?> - </form> - - <div style="clear: both;"></div> - <?php if($GLOBALS['linpha']->imgview->img_type!=0) { ?> - <script language="JavaScript" type="text/javascript"> - <!-- - function showMetaLinpha() - { - $('linAMetaLinpha').className = 'current'; - $('linAMetaIptc').className = ''; - $('linAMetaXmp').className = ''; - Element.hide('linDivMetaIptc'); - Element.hide('linDivMetaXmp'); - Element.show('linDivMetaLinpha'); - } - function showMetaIptc() - { - $('linAMetaLinpha').className = ''; - $('linAMetaXmp').className = ''; - $('linAMetaIptc').className = 'current'; - Element.hide('linDivMetaLinpha'); - Element.hide('linDivMetaXmp'); - Element.show('linDivMetaIptc'); - } - function showMetaXmp() - { - $('linAMetaLinpha').className = ''; - $('linAMetaIptc').className = ''; - $('linAMetaXmp').className = 'current'; - Element.hide('linDivMetaLinpha'); - Element.hide('linDivMetaIptc'); - Element.show('linDivMetaXmp'); - } - showMetaLinpha(); - --> - </script> - <?php } /* end if img_type!=0 */ ?> - - <?php } /* end if checkPermission('metadata_edit') */ ?> - - <?php -break; -} +ob_start(); ?> +<div id="linDivImageSlideshow" style="display: none"> + <div id="linDivMainImageSlideshow" style="width: <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; ?>px; height: <?php + echo $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; ?>px;"> + <div id="linDivLoadingSlideshow"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/loading.gif"></div> + <img id="linImgMainImageSlideshow" src="" /> + <div id="linDivDescriptionSlideshow"></div> + </div> +</div> +<div id="linDivSlideshowControlsOuter" style="display: none"> + <?php echo $linTpl->divRoundCorners('top','slideshow'); ?> + <div id="linDivSlideshowControls"> + <div style="float: left; margin-left: 10px; "> + <a href="javascript:myLinAlbum.moveFirst()"><img id="linSsImgFirst" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_first.gif" width="25" height="25" border="0" alt="First" title="<?php echo i18n("First"); ?>" /></a> + <a href="javascript:myLinAlbum.movePrev()"><img id="linSsImgPrev" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_previous.gif" width="25" height="25" border="0" alt="Previous" title="<?php echo i18n("Previous"); ?>" /></a> + <a href="javascript:myLinAlbum.slideshowStartStop()"><img id="linSsImgStart" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_play.gif" width="25" height="25" border="0" alt="Play" title="<?php echo i18n("Play/Pause"); ?>" /></a> + <!--<a href="javascript:myLinAlbum.slideshowStop()"><img id="linSsImgStop" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_stop.gif" width="25" height="25" border="0" alt="Stop" title="<?php echo i18n("Stop"); ?>" /></a>--> + <a href="javascript:myLinAlbum.moveNext()"><img id="linSsImgNext" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_next.gif" width="25" height="25" border="0" alt="Next" title="<?php echo i18n("Next"); ?>" /></a> + <a href="javascript:myLinAlbum.moveLast()"><img id="linSsImgLast" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_last.gif" width="25" height="25" border="0" alt="Last" title="<?php echo i18n("Last"); ?>" /></a> + </div> + + <div style="float: left; margin-left: 40px; "> + <select id="linSsDelay" name="delay" size="1" class="linForms" onchange="myLinAlbum.slideshowChangeDelay()" title="<?php echo i18n("Delay"); ?>"> + <option value="3">3 s</option> + <option value="4">4 s</option> + <option value="5" selected="selected">5 s</option> + <option value="10">10 s</option> + <option value="15">15 s</option> + <option value="30">30 s</option> + <option value="45">45 s</option> + <option value="60">60 s</option> + </select> + </div> + + <div style="float: left; margin-left: 10px; "> + <a href="javascript:myLinAlbum.slideshowChangeLoop()"><img id="linSsImgLoop" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_loop.gif" width="25" height="25" border="0" alt="Loop" title="<?php echo i18n("Enable/disable Loop"); ?>" /></a> + <!--<a href="javascript:myLinAlbum.slideshowChangeLoop()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_noloop.gif" width="25" height="25" border="0" /></a>--> + <a href="javascript:myLinAlbum.slideshowChangeRandom()"><img id="linSsImgRandom" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_norandom.gif" width="25" height="25" border="0" alt="Random" title="<?php echo i18n("Enable/disable Random Play Order"); ?>" /></a> + <!--<a href="javascript:myLinAlbum.slideshowChangeRandom()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_random.gif" width="25" height="25" border="0" /></a>--> + </div> + + <?php /*<div id="linDivSlideshowImgNr" style="float: left; margin-left: 40px; "></div>*/ ?> + + <div id="linDivSlideshowExit" style="float: left; margin-left: 40px; "> + <a href="javascript:myLinAlbum.fullscreenStop()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_stop.gif" width="25" height="25" border="0" alt="Exit" title="<?php echo i18n("Exit Fullscreen"); ?>" ></a> + </div> + + <div style="clear: both;"></div> + </div> + <?php echo $linTpl->divRoundCorners('bottom','slideshow'); ?> +</div> +<?php +$string = ob_get_clean(); + +$string = str_replace("\n","",$string); +$string = str_replace("\r","",$string); +$string = str_replace("\t","",$string); +echo "var linSlideshowHtml = '".$string."'"; +?> \ No newline at end of file Added: trunk/linpha2/templates/default/tabs/comments.html.php =================================================================== --- trunk/linpha2/templates/default/tabs/comments.html.php (rev 0) +++ trunk/linpha2/templates/default/tabs/comments.html.php 2008-03-16 08:53:04 UTC (rev 4907) @@ -0,0 +1,40 @@ +<?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> + +<?php if (isset($linTpl->output['sys_log'])) { ?> + <?php echo $linTpl->output['sys_log']; ?><br /><br /> +<?php } ?> + +<!-- show add comment form --> +<div id="linDivAddComment"> +<?php /* myLinGlobal.AjaxPost(linUrlBase + '&linId=' + IdCurrent + '&xml', Form.serialize(this),myLinImage.saveComment) */ ?> +<form action="" method="POST" onsubmit="myLinAlbum.saveComment(this); return false;"> +<?php echo i18n("Add Comment"); ?>:<br /> +<div id="linDivAddCommentText"> + <input type="text" id="linInputAddCommentText" class="linForms" name="inputAddCommentText" value="" tabindex="1" style="width: 300px" /> + <a href="javascript:myLinAlbum.openTextarea()">(+)</a> +</div> +<div id="linDivAddCommentTextarea" style="display: none;"> + <textarea id="linInputAddCommentTextarea" class="linForms" name="inputAddCommentTextarea" tabindex="1" rows="8" style="width: 300px"></textarea> + <a href="javascript:myLinAlbum.closeTextarea()">(-)</a> +</div> + +<div style="display: block; float: left; width: 66px;"><?php echo i18n("Name"); ?>:</div> +<input type="text" class="linForms" name="inputAddCommentAuthor" value="" tabindex="2" size="10" style="width: 150px" maxlength="255" /> + +<input type="hidden" name="linCmd" value="addComment" /> +<input type="submit" name="submit" class="linButton" value="<?php echo i18n("Submit"); ?>" tabindex="3" style="width: 80px" /> +</form> +</div> + +<br /> +<?php } /* end if checkPermission('metadata_comments') */ ?> + +<!-- show image comments --> +<div id="linDivComments"> + <?php foreach($this->comments as $comment) { ?> + <?php echo $comment['time'].' '.i18n("by").' '.$comment['author']; ?> + <hr /> + <?php echo $comment['text']; ?> + <br /><br /> + <?php } ?> +</div> Added: trunk/linpha2/templates/default/tabs/exif.html.php =================================================================== --- trunk/linpha2/templates/default/tabs/exif.html.php (rev 0) +++ trunk/linpha2/templates/default/tabs/exif.html.php 2008-03-16 08:53:04 UTC (rev 4907) @@ -0,0 +1,9 @@ +Exif +<table id="linTableMeta"> +<?php +foreach($this->exif as $data) +{ + echo '<tr><td class="linTdMetaLeftColumn">'.$data['name'].'</strong></td><td>'.$data['value'].'</td></tr>'; +} +?> +</table> Added: trunk/linpha2/templates/default/tabs/gps.html.php =================================================================== --- trunk/linpha2/templates/default/tabs/gps.html.php (rev 0) +++ trunk/linpha2/templates/default/tabs/gps.html.php 2008-03-16 08:53:04 UTC (rev 4907) @@ -0,0 +1 @@ +GPS Added: trunk/linpha2/templates/default/tabs/imageInfo.html.php =================================================================== --- trunk/linpha2/templates/default/tabs/imageInfo.html.php (rev 0) +++ trunk/linpha2/templates/default/tabs/imageInfo.html.php 2008-03-16 08:53:04 UTC (rev 4907) @@ -0,0 +1,8 @@ +<table id="linTableMeta"> +<?php +foreach($this->imageInfo as $data) +{ + echo '<tr><td class="linTdMetaLeftColumn">'.$data['name'].'</strong></td><td>'.$data['value'].'</td></tr>'; +} +?> +</table> Added: trunk/linpha2/templates/default/tabs/iptcXmp.html.php =================================================================== --- trunk/linpha2/templates/default/tabs/iptcXmp.html.php (rev 0) +++ trunk/linpha2/templates/default/tabs/iptcXmp.html.php 2008-03-16 08:53:04 UTC (rev 4907) @@ -0,0 +1 @@ +IPTC/XMP Added: trunk/linpha2/templates/default/tabs/videoInfo.html.php =================================================================== --- trunk/linpha2/templates/default/tabs/videoInfo.html.php (rev 0) +++ trunk/linpha2/templates/default/tabs/videoInfo.html.php 2008-03-16 08:53:04 UTC (rev 4907) @@ -0,0 +1,9 @@ +Video +<table id="linTableMeta"> +<?php +foreach($this->videoInfo as $data) +{ + echo '<tr><td class="linTdMetaLeftColumn">'.$data['name'].'</strong></td><td>'.$data['value'].'</td></tr>'; +} +?> +</table> Modified: trunk/linpha2/templates/default/themes/default/colorsettings.php =================================================================== --- trunk/linpha2/templates/default/themes/default/colorsettings.php 2008-03-16 08:52:25 UTC (rev 4906) +++ trunk/linpha2/templates/default/themes/default/colorsettings.php 2008-03-16 08:53:04 UTC (rev 4907) @@ -57,8 +57,8 @@ * round corners */ .linCornMain { - min-width:20em; - max-width:3000px; + min-width: 20em; + max-width: 3000px; } .linCornMain .linCornC, /* C = content */ @@ -71,8 +71,8 @@ .linCornFolder { - min-width:20em; - max-width:800px; + min-width: 20em; + max-width: 800px; } .linCornFolder .linCornC, /* C = content */ @@ -81,3 +81,17 @@ .linCornFolder .linCornB div { background:transparent url(../../../misc/box.php?col=<?php echo $_GET['albumsbg']; ?>&w=900&h=200) no-repeat top right; } + + + .linCornSlideshow { + width: 400px; + } + + .linCornSlideshow .linCornC, /* C = content */ + .linCornSlideshow .linCornT, /* T = Top */ + .linCornSlideshow .linCornB, /* B = Bottom */ + .linCornSlideshow .linCornB div { + background:transparent url(../../../misc/box.php?col=<?php echo $_GET['bg']; ?>&w=415&h=100&t=bottom) no-repeat top right; + } + + \ No newline at end of file Modified: trunk/linpha2/templates/misc/box.php =================================================================== --- trunk/linpha2/templates/misc/box.php 2008-03-16 08:52:25 UTC (rev 4906) +++ trunk/linpha2/templates/misc/box.php 2008-03-16 08:53:04 UTC (rev 4907) @@ -7,8 +7,15 @@ $rad = (isset($_GET['r']) ? intval($_GET['r']) : 15); $width = (isset($_GET['w']) ? intval($_GET['w']) : 2100); $height = (isset($_GET['h']) ? intval($_GET['h']) : 1300); + +if (isset($_GET['t']) && $_GET['t']=='top') { + $type = 'top'; +} elseif (isset($_GET['t']) && $_GET['t']=='bottom') { + $type = 'bottom'; +} else { + $type = 'both'; +} - // create image $image = imagecreate($width, $height); $img_corners = imagecreate(2*$rad+1, 2*$rad+1); @@ -28,16 +35,32 @@ // fill image imagefilledrectangle ($image, 0, $rad, $width-1, $height-$rad-1, $color ); -imagefilledrectangle ($image, $rad, 0, $width-$rad-1, $rad-1, $color ); -imagefilledrectangle ($image, $rad, $height-$rad, $width-$rad-1, $height, $color ); + +if ($type=='bottom') { + imagefilledrectangle ($image, 0, 0, $width-1, $rad-1, $color ); +} else { + imagefilledrectangle ($image, $rad, 0, $width-$rad-1, $rad-1, $color ); +} +if ($type=='top') { + imagefilledrectangle ($image, 0, $height-$rad, $width-1, $height, $color ); +} else { + imagefilledrectangle ($image, $rad, $height-$rad, $width-$rad-1, $height, $color ); +} // draw and copy circle imagefilledellipse($img_corners, $rad, $rad, ($rad*2)+1, ($rad*2)+1, $color); -imagecopy($image, $img_corners, 0, 0, 0, 0, $rad, $rad); -imagecopy($image, $img_corners, $width-$rad, 0, $rad+1, 0, $rad, $rad); -imagecopy($image, $img_corners, 0, $height-$rad, 0, $rad+1, $rad, $rad); -imagecopy($image, $img_corners, $width-$rad, $height-$rad, $rad+1, $rad+1, $rad, $rad); +if ($type=='both' || $type=='top') +{ + imagecopy($image, $img_corners, 0, 0, 0, 0, $rad, $rad); + imagecopy($image, $img_corners, $width-$rad, 0, $rad+1, 0, $rad, $rad); +} +if ($type=='both' || $type=='bottom') +{ + imagecopy($image, $img_corners, 0, $height-$rad, 0, $rad+1, $rad, $rad); + imagecopy($image, $img_corners, $width-$rad, $height-$rad, $rad+1, $rad+1, $rad, $rad); +} + // flush image header('Content-type: image/gif'); Modified: trunk/linpha2/templates/misc/box_test.php =================================================================== --- trunk/linpha2/templates/misc/box_test.php 2008-03-16 08:52:25 UTC (rev 4906) +++ trunk/linpha2/templates/misc/box_test.php 2008-03-16 08:53:04 UTC (rev 4907) @@ -3,4 +3,6 @@ <img src="box.php?col=87CEFA&w=200&h=100" /><br /><br /> <img src="box.php?col=red&r=5&w=50&h=25" /><br /><br /> <img src="box.php?col=lightcyan&w=30&h=150" /><br /><br /> +<img src="box.php?col=87CEFA&w=200&h=100&t=top" /><br /><br /> +<img src="box.php?col=87CEFA&w=200&h=100&t=bottom" /><br /><br /> <img src="box.php" /><br /><br /> Modified: trunk/linpha2/templates/misc/roundCorners.css =================================================================== --- trunk/linpha2/templates/misc/roundCorners.css 2008-03-16 08:52:25 UTC (rev 4906) +++ trunk/linpha2/templates/misc/roundCorners.css 2008-03-16 08:53:04 UTC (rev 4907) @@ -2,7 +2,7 @@ .linCorn { position:relative; margin:0px auto; - z-index:1; + /*z-index:1;*/ margin-left:15px; /* default, width of left corner */ margin-bottom:0.5em; /* spacing under dialog */ } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-16 08:52:26
|
Revision: 4906 http://linpha.svn.sourceforge.net/linpha/?rev=4906&view=rev Author: fangehrn Date: 2008-03-16 01:52:25 -0700 (Sun, 16 Mar 2008) Log Message: ----------- 2008-03-15 flo * fixed some IE bugs everything should now work fine on firefox/opera/IE 2008-03-13 flo * finished fullscreen/slideshow/navigation 2008-03-09 flo * re-design thumb and image view Added Paths: ----------- trunk/linpha2/lib/modules/module.image.php Added: trunk/linpha2/lib/modules/module.image.php =================================================================== --- trunk/linpha2/lib/modules/module.image.php (rev 0) +++ trunk/linpha2/lib/modules/module.image.php 2008-03-16 08:52:25 UTC (rev 4906) @@ -0,0 +1,32 @@ +<?php +/* + * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> + * Florian Angehrn + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/** + * Image Tabs (Ajax) + * @package Modules + */ +if(!defined('LINPHA_DIR')) { exit(1); } + +require_once(LINPHA_DIR.'/lib/classes/linpha.view.image.class.php'); +new LinViewImage(); + +exit(); // important if linpha is included from another webpage + +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-16 08:52:07
|
Revision: 4905 http://linpha.svn.sourceforge.net/linpha/?rev=4905&view=rev Author: fangehrn Date: 2008-03-16 01:52:02 -0700 (Sun, 16 Mar 2008) Log Message: ----------- 2008-03-15 flo * fixed some IE bugs everything should now work fine on firefox/opera/IE 2008-03-13 flo * finished fullscreen/slideshow/navigation 2008-03-09 flo * re-design thumb and image view Modified Paths: -------------- trunk/linpha2/lib/include/sql/sql.data.php trunk/linpha2/lib/include/sql/sql.tables.php Modified: trunk/linpha2/lib/include/sql/sql.data.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.data.php 2008-03-16 08:51:49 UTC (rev 4904) +++ trunk/linpha2/lib/include/sql/sql.data.php 2008-03-16 08:52:02 UTC (rev 4905) @@ -75,6 +75,7 @@ 'sys_style_thumb_size_max' => '200', 'sys_style_thumb_size_display' => '150', + 'sys_style_thumb_size_display_small' => '60', 'sys_style_thumb_showsubfoldersseparate' => '0', 'sys_style_thumb_selectsizes' => '50,75,100,150,200,250,300,400,500', 'sys_style_thumb_selectnrimages' => 'auto,10,25,50,100,200,all', Modified: trunk/linpha2/lib/include/sql/sql.tables.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.tables.php 2008-03-16 08:51:49 UTC (rev 4904) +++ trunk/linpha2/lib/include/sql/sql.tables.php 2008-03-16 08:52:02 UTC (rev 4905) @@ -360,7 +360,7 @@ "md5sum C(32) NOTNULL INDEX idx_meco_md5, " . "meta_time I(10) DEFAULT 0, " . "meta_author C(255) DEFAULT '', " . - "meta_comment I DEFAULT 0", + "meta_comment X DEFAULT 0", LIN_PREFIX.'meta_data' => "id I AUTO KEY, " . This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |