Thread: [Linpha-cvs] SF.net SVN: linpha: [4726] trunk/linpha2 (Page 8)
Status: Inactive
Brought to you by:
bzrudi
From: <bz...@us...> - 2007-07-05 14:53:32
|
Revision: 4726 http://svn.sourceforge.net/linpha/?rev=4726&view=rev Author: bzrudi Date: 2007-07-05 07:53:30 -0700 (Thu, 05 Jul 2007) Log Message: ----------- "Added Exiftool configuration support to Installer." Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/layout.css trunk/linpha2/install/lib.requirements.php trunk/linpha2/install/step10_postsettings.php trunk/linpha2/install/step11_finish.php trunk/linpha2/install/step2_requirements.php trunk/linpha2/install/step3_dbtype.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-07-04 15:52:20 UTC (rev 4725) +++ trunk/linpha2/ChangeLog 2007-07-05 14:53:30 UTC (rev 4726) @@ -1,3 +1,8 @@ +2007-07-04 bzrudi + * Added Exiftool configuration support to Installer. Checks also for Perl and + OS. Needs Windows testing! + TODO: Save path to perl in DB + 2007-07-03 bzrudi * Added support for ignored filetypes stored in DB * Some fixes to make embedded thumbnails work better using exiftool Modified: trunk/linpha2/install/layout.css =================================================================== --- trunk/linpha2/install/layout.css 2007-07-04 15:52:20 UTC (rev 4725) +++ trunk/linpha2/install/layout.css 2007-07-05 14:53:30 UTC (rev 4726) @@ -72,9 +72,14 @@ .box3 { float: left; - width: 30%; + width: 33%; } +.box4 { + float: left; + width: 95%; + text-align: left; +} .license { width: 95%; height: 360px; Modified: trunk/linpha2/install/lib.requirements.php =================================================================== --- trunk/linpha2/install/lib.requirements.php 2007-07-04 15:52:20 UTC (rev 4725) +++ trunk/linpha2/install/lib.requirements.php 2007-07-05 14:53:30 UTC (rev 4726) @@ -22,6 +22,123 @@ /** * @package Installation */ + +function installCheckPerl() +{ + +$array_path = installGetPATH('PATH'); +$array_lookfor = installGetPATH(Array('/bin','/usr/bin','/usr/local/bin','/sw/bin')); + + /** + * need a special check if safe_mode is on + * because we can't check anymore with file_exists() since php 4.3.9 even if the file is in + * allowed dirs (see http://bugs.php.net/bug.php?id=30259) + * + * try to execute in every location + */ + if(ini_get('safe_mode')) + { + foreach($array_path AS $value) + { + if( !isset($array) ) + { + $arr=array(); $return_var=''; // do not this directly in exec() ! + exec($value.'/perl -help',$arr,$return_var); + + if(isset($return_var) && $return_var == 0) + { + $array = Array(1, '', ''); + } + } + } + + // search file in other locations + foreach($array_lookfor AS $value) + { + if( !isset($array) ) + { + $arr=array(); + $return_var=''; // don't do this directly in exec() ! + exec($value.'/perl -help',$arr,$return_var); + + if(isset($return_var) && $return_var == 0) + { + $array = Array(1, '', ''); + } + } + } + } + else + { + /** + * search file in PATH + * + * if convert is found in the path variable, don't store the full path + * because if the path changes, we get problems (for example under windows: + * c:/program files/imagemagick-5.8.... changes to c:/program files/imagemagick-6.0.0) + */ + foreach($array_path AS $value) + { + if( !isset($array) && file_exists($value.'/perl') ) + { + $array = Array(1, '',''); + } + } + + // search file in other locations + foreach($array_lookfor AS $value) + { + if( !isset($array) && file_exists($value.'/perl') ) + { + $array = Array(1, $value.'/',''); + } + } + } + + if(!isset($array) ) + { + $array = Array(0,'',''); + return $array; + } + + /** + * now, we do an improved check + */ + $arr=array(); + $return_var=''; // don't do this directly in exec() ! + exec($array[1].'perl --version',$arr,$return_var); + + if(isset($return_var) && $return_var == 0) + { + $needle = 'perl, '; + $pos = strpos($arr[1],$needle); + + if($pos === false) + { + /** + * wrong convert found ?! + * @todo we should now set use_convert to '0' ?! + */ + $version = ''; + } + else + { + $version = substr($arr[1],$pos+strlen($needle),6); + } + + $array[2] = $version; + } + else + { + /** + * convert not found... + */ + $array = array(0,'',''); + } + + return $array; +} + function installCheckConvert() { if( LIN_OS == 'win' ) { Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2007-07-04 15:52:20 UTC (rev 4725) +++ trunk/linpha2/install/step10_postsettings.php 2007-07-05 14:53:30 UTC (rev 4726) @@ -51,13 +51,13 @@ $linpha = new Linpha(); $linpha->sql->dbConnect(); -echo success_msg(); +echo success_msg(); // TODO: we should check for success before stating it ;-) /** * add new linpha admin user */ echo "<br /><br />"; -echo "<h2>".i18n_install("Setup Linpha Admin User")."</h2>"; +echo "<h2>".i18n_install("Setup Linpha Admin User")."</h2><hr>"; ?> <div class="boxalign"> <?php echo i18n_install("Admin Username").":"; ?> @@ -77,17 +77,16 @@ name="admin_email"> </div> <br /> -<br /> + <?php - $query = $linpha->db->Execute("SELECT option_value FROM ".LIN_PREFIX."config " . "WHERE option_name='sys_im_use_imagemagick'"); $data = $query->FetchRow(ADODB_FETCH_NUM); if(false === $data[0]) { - echo "<h2>".i18n_install("Please Choose Thumbnail Quality")."</h2>"; + echo "<h2>".i18n_install("Please Choose Thumbnail Quality")."</h2><hr>"; ?> <div align="center"> <div class="box2"> @@ -101,12 +100,13 @@ </div> </div> <?php - echo i18n_install("Warning: High Quality Requires CPU > 1 GHz"); + echo i18n_install("Warning: High Quality Requires CPU > 1 GHz")."<br />"; } ?> -<br /><br /> +<br /> + <?php -echo "<h2>".i18n_install("Please Choose Default Thumbnail Size")."</h2>"; +echo "<h2>".i18n_install("Please Choose Default Thumbnail Size")."</h2><hr>"; ?> <div align="center"> @@ -125,12 +125,41 @@ <div class="box3"> <input type='radio' name='sys_style_tn_size' value='150'> 150 pixel<br /> - <img src='./graphics/thumb150px.jpg' /> + <img src='./graphics/thumb150px.jpg'> </div> </div> -<br /><br /><br /><br /> +<br /> + <?php +if($_SESSION['sys_import_has_perl'] || LIN_OS == 'win') +{ +echo "<h2>".i18n_install("Make Use Of Exiftool?")."</h2><hr>"; +echo i18n_install("Exiftool is an advanced manipulaion library for MetaData information like XMP/IPTC and friends.")." "; +echo i18n_install("If you are unsure what it's all about, it's save to say no here.")."<br /><br />"; +?> +<div align="center"> + <div class="box4"> + <input type='radio' name='sys_import_use_exiftool' value='1'> + <?php echo i18n_install("Yes"); ?> + <input type='radio' name='sys_import_use_exiftool' value='0' checked=checked> + <?php echo i18n_install("No"); ?> + <?php echo i18n_install("Enable Exiftool"); ?> + </div> + + <div class="box4"> + <input type='radio' name='sys_import_use_emb_thumb' value='1'> + <?php echo i18n_install("Yes"); ?> + <input type='radio' name='sys_import_use_emb_thumb' value='0' checked=checked> + <?php echo i18n_install("No"); ?> + <?php echo i18n_install("Extract Embedded Thumbnails"); ?> + + </div> +</div> +<br /><br /><br /> +<?php } ?> + +<?php $array_check = array( 'check01' => 'text', 'check02' => 'text' Modified: trunk/linpha2/install/step11_finish.php =================================================================== --- trunk/linpha2/install/step11_finish.php 2007-07-04 15:52:20 UTC (rev 4725) +++ trunk/linpha2/install/step11_finish.php 2007-07-05 14:53:30 UTC (rev 4726) @@ -105,6 +105,50 @@ $error_nr = 1; } +/** + * exiftool + */ + if( isset( $_POST['sys_import_use_exiftool'] ) ) + { + echo "<br />".i18n_install("Saving Exiftool Options...").' '; + $result = $linpha->db->Execute("UPDATE ".LIN_PREFIX."config " . + "SET option_value = '".LinSql::linAddslashes($_POST['sys_import_use_exiftool'])."' " . + "WHERE option_name = 'sys_import_use_exiftool'"); + if(!$result) + { + echo failed_msg(); + $error_nr = 1; + } + else + { + echo success_msg(); + } + + if($_POST['sys_import_use_exiftool'] == true && $result == true) + { + $result = $linpha->db->Execute("UPDATE ".LIN_PREFIX."config " . + "SET option_value = '".LinSql::linAddslashes($_POST['sys_import_use_emb_thumb'])."' " . + "WHERE option_name = 'sys_import_use_emb_thumb'"); + if(!$result) + { + echo failed_msg(); + $error_nr = 1; + } + else + { + echo success_msg(); + } + } + } + else + { + echo failed_msg(); + echo "<br />".i18n_install("Error - Wrong Value For Exiftool Received!"); + $error_nr = 1; + } + + + if(isset($error_nr)) { echo "</form>"; Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2007-07-04 15:52:20 UTC (rev 4725) +++ trunk/linpha2/install/step2_requirements.php 2007-07-05 14:53:30 UTC (rev 4726) @@ -118,6 +118,7 @@ /** * checking imagemagick */ + print_line_left("ImageMagick"); list($convert_avail, $convert_path, $convert_version) = installCheckConvert(); @@ -201,7 +202,33 @@ } +/** + * checking for perl (only on UNIX like OS) We need it for Exiftool, but + * not on M$ OS, so silently ignore it. + */ + if( LIN_OS != 'win' ) + { + print_line_left("Perl"); + list($perl_avail, $perl_path, $perl_version) = installCheckPerl(); + if($perl_avail) + { + print_line_middle($perl_version); + print_line_right(success_msg()); + $perl_ok = 1; + } + else + { + print_line_middle( i18n_install("Not Found") ); + print_line_right(warning_msg()); + print_line_info( i18n_install("Perl was NOT found on this server. However, no need to panic as LinPHA will even work without.") ); + $perl_ok = 0; + } + + echo "\t".'<input type="hidden" name="sys_import_has_perl" value="'.$perl_ok.'">'."\n"; + // @TODO make perl path avail in config + //echo "\t".'<input type="hidden" name="sys_import_perl_path" value="'.$perl_path.'">'."\n"; + } /** * check GD only if IM not available */ @@ -397,7 +424,7 @@ print_line_right(warning_msg()); print_line_info( i18n_install("Cannot determine wether the /albums and /var folders are protected from outside!"). - i18n_install("Please see <a href=\"http://linpha.sourceforge.net/wiki/index.php/Secure_LinPHA\">here</a> for more details.") + i18n_install("Please see <a href=\"http://linpha.sourceforge.net/wiki/index.php/Secure_LinPHA\" target=\"_blank\">here</a> for more details.") ); } @@ -462,7 +489,7 @@ function print_line_middle($str) { ?> - <td width="50"><?php echo $str; ?></td> + <td width="70"><?php echo $str; ?></td> <?php } Modified: trunk/linpha2/install/step3_dbtype.php =================================================================== --- trunk/linpha2/install/step3_dbtype.php 2007-07-04 15:52:20 UTC (rev 4725) +++ trunk/linpha2/install/step3_dbtype.php 2007-07-05 14:53:30 UTC (rev 4726) @@ -34,7 +34,7 @@ $_SESSION['language'] = $_POST['language']; } -$array = array('sys_im_bracket_support','sys_im_use_convert','sys_im_convert_path'); +$array = array('sys_im_bracket_support','sys_im_use_convert','sys_im_convert_path','sys_import_has_perl'); foreach($array AS $value) { if(isset($_POST[$value])) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2007-07-05 15:22:12
|
Revision: 4727 http://svn.sourceforge.net/linpha/?rev=4727&view=rev Author: bzrudi Date: 2007-07-05 08:22:08 -0700 (Thu, 05 Jul 2007) Log Message: ----------- "cosmetics" Modified Paths: -------------- trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/install/step11_finish.php Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2007-07-05 14:53:30 UTC (rev 4726) +++ trunk/linpha2/docs/dev/TODO.txt 2007-07-05 15:22:08 UTC (rev 4727) @@ -4,7 +4,6 @@ ## Small Todos -- save file ignore list in the database - 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() @@ -52,7 +51,6 @@ -> otherwise it would be possible to overwrite the current installation, (and to delete cache folders) - DONT add feature to drop tables if they already exists - add Usage link after installation has been successfully finished - - take care of exiftool support - Plugins (copy from linpha1) - Guestbook, first apply patch with security image @@ -112,6 +110,7 @@ - what if the user specify wrongly the album folder as the cache folder...?? - what if a hacker gets access to the install and specify '/' as cache folder...?? -> only delete content of tmp, cache and sql folders if they are not changed (default values) + - take care of exiftool support - Basket (finish) - Support for the Icons - Search (copy from linpha1) @@ -120,7 +119,8 @@ - get_image.php (Image View, Image Cache) - User/Group System (copy from linpha1) - Permissions -- check automatically if a file was changed by an external program and update md5sum etc. +- save file ignore list in the database + - check automatically if a file was changed by an external program and update md5sum etc. - check how much faster it is to have thumbnails stored on filesystem and not in db - use of get_ride_of_magicquotes() in all files Modified: trunk/linpha2/install/step11_finish.php =================================================================== --- trunk/linpha2/install/step11_finish.php 2007-07-05 14:53:30 UTC (rev 4726) +++ trunk/linpha2/install/step11_finish.php 2007-07-05 15:22:08 UTC (rev 4727) @@ -134,10 +134,6 @@ echo failed_msg(); $error_nr = 1; } - else - { - echo success_msg(); - } } } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2007-07-05 17:46:16
|
Revision: 4729 http://svn.sourceforge.net/linpha/?rev=4729&view=rev Author: bzrudi Date: 2007-07-05 10:46:10 -0700 (Thu, 05 Jul 2007) Log Message: ----------- "Add option to change background color for field inputs and add lightgrey color example" Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/settings_layout.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/lib/classes/linpha.admin.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/templates/default/themes/default/colorsettings.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-07-05 15:30:47 UTC (rev 4728) +++ trunk/linpha2/ChangeLog 2007-07-05 17:46:10 UTC (rev 4729) @@ -2,6 +2,10 @@ * Added Exiftool configuration support to Installer. Checks also for Perl and OS. Needs Windows testing! TODO: Save path to perl in DB + * Add option to change background color for field inputs in admin layout + section and add simple "lightgrey" color option. I'm sorry but I was + somewhat sick of the orange and blue colors :-) (I know there are more + important things to do) 2007-07-03 bzrudi * Added support for ignored filetypes stored in DB Modified: trunk/linpha2/admin/settings_layout.php =================================================================== --- trunk/linpha2/admin/settings_layout.php 2007-07-05 15:30:47 UTC (rev 4728) +++ trunk/linpha2/admin/settings_layout.php 2007-07-05 17:46:10 UTC (rev 4729) @@ -27,7 +27,8 @@ $color_examples = array( '' => '', 'blue' => 'blue', - 'orange' => 'orange' + 'orange' => 'orange', + 'lightgrey' => 'lightgrey' ); $color_examples_values = array( @@ -39,6 +40,15 @@ 'links' => '005388', 'linkshover' => '666666', ), + 'lightgrey' => array( + 'bodybg' => 'FFFFFF', + 'elembg' => 'CCCCCC', + 'font' => '000000', + 'albumsbg' => 'DDDDDD', + 'links' => '005388', + 'linkshover' => '666666', + 'fieldscolor' => 'fieldscolor' + ), 'orange' => array( 'bodybg' => 'FFFFFF', 'elembg' => 'F09000', @@ -59,6 +69,8 @@ $_POST['sys_style_layout_color_albumsbg'] = $color_examples_values[ $_POST['select_examples'] ]['albumsbg']; $_POST['sys_style_layout_color_links'] = $color_examples_values[ $_POST['select_examples'] ]['links']; $_POST['sys_style_layout_color_linkshover'] = $color_examples_values[ $_POST['select_examples'] ]['linkshover']; + $_POST['sys_style_layout_color_fields'] = $color_examples_values[ $_POST['select_examples'] ]['fieldscolor']; + } else { @@ -69,6 +81,8 @@ $_POST['sys_style_layout_color_albumsbg'] = LinWatermark::getHtmlFromAll($_POST['sys_style_layout_color_albumsbg']); $_POST['sys_style_layout_color_links'] = LinWatermark::getHtmlFromAll($_POST['sys_style_layout_color_links']); $_POST['sys_style_layout_color_linkshover'] = LinWatermark::getHtmlFromAll($_POST['sys_style_layout_color_linkshover']); + $_POST['sys_style_layout_color_fields'] = LinWatermark::getHtmlFromAll($_POST['sys_style_layout_color_fields']); + } $LinAdmin->saveConfig(Array( @@ -83,6 +97,7 @@ 'sys_style_layout_color_albumsbg', 'sys_style_layout_color_links', 'sys_style_layout_color_linkshover', + 'sys_style_layout_color_fields', )); } @@ -106,6 +121,8 @@ document.getElementsByName('sys_style_layout_color_albumsbg')[0].disabled = false; document.getElementsByName('sys_style_layout_color_links')[0].disabled = false; document.getElementsByName('sys_style_layout_color_linkshover')[0].disabled = false; + document.getElementsByName('sys_style_layout_color_fields')[0].disabled = false; + } else // disable { @@ -115,6 +132,8 @@ document.getElementsByName('sys_style_layout_color_albumsbg')[0].disabled = true; document.getElementsByName('sys_style_layout_color_links')[0].disabled = true; document.getElementsByName('sys_style_layout_color_linkshover')[0].disabled = true; + document.getElementsByName('sys_style_layout_color_fields')[0].disabled = true; + } } </script> @@ -128,6 +147,7 @@ $LinAdmin->printAdminConfig('text',$LinAdmin->getDescriptionByOptionName('sys_style_layout_color_albumsbg'),'sys_style_layout_color_albumsbg',$LinAdmin->option_value_system['sys_style_layout_color_albumsbg']); $LinAdmin->printAdminConfig('text',$LinAdmin->getDescriptionByOptionName('sys_style_layout_color_links'),'sys_style_layout_color_links',$LinAdmin->option_value_system['sys_style_layout_color_links']); $LinAdmin->printAdminConfig('text',$LinAdmin->getDescriptionByOptionName('sys_style_layout_color_linkshover'),'sys_style_layout_color_linkshover',$LinAdmin->option_value_system['sys_style_layout_color_linkshover']); + $LinAdmin->printAdminConfig('text',$LinAdmin->getDescriptionByOptionName('sys_style_layout_color_fields'),'sys_style_layout_color_fields',$LinAdmin->option_value_system['sys_style_layout_color_fields']); break; case 'home': Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2007-07-05 15:30:47 UTC (rev 4728) +++ trunk/linpha2/install/sql/sql.data.php 2007-07-05 17:46:10 UTC (rev 4729) @@ -85,6 +85,7 @@ 'sys_style_layout_color_albumsbg' => 'D5FCF4', 'sys_style_layout_color_links' => '005388', 'sys_style_layout_color_linkshover' => '666666', + 'sys_style_layout_color_fields' => 'CCCCCC', 'sys_style_layout_theme' => 'default', 'sys_style_layout_template' => 'default', @@ -132,6 +133,7 @@ 'sys_style_layout_color_albumsbg' => 'D5FCF4', 'sys_style_layout_color_links' => '005388', 'sys_style_layout_color_linkshover' => '666666', + 'sys_style_layout_color_fields' => 'CCCCCC', 'sys_style_layout_theme' => 'default', 'sys_style_layout_template' => 'default', Modified: trunk/linpha2/lib/classes/linpha.admin.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.admin.class.php 2007-07-05 15:30:47 UTC (rev 4728) +++ trunk/linpha2/lib/classes/linpha.admin.class.php 2007-07-05 17:46:10 UTC (rev 4729) @@ -1,390 +1,391 @@ -<?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 provides functions for edit configs etc. - * @package Admin - */ -class LinAdmin -{ - -public $options; -public $options_value_system; -public $description_array; - -/** - * constructor - */ -function __construct() -{ - /** - * get system option names and values and save in array for easier access - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' ORDER by option_name"); - while($data = $query->FetchRow()) - { - $this->options[] = $data['option_name']; - $this->option_value_system[$data['option_name']] = $data['option_value']; - } - - $this->description_array = array( - 'sys_image_exif' => i18n("Use EXIF"), - 'sys_image_iptc' => i18n("Use IPTC"), - 'sys_image_xmp' => i18n("Use XMP"), - 'sys_lang_autolang' => i18n("Language Auto Detection"), - 'sys_lang' => i18n("Default Language (if auto detections fails or if it is disabled)"), - - 'sys_style_home_nrrandomimages' => i18n("Nr Of Random Images (0 to disable)"), - 'sys_style_home_showbrowsebydate' => i18n("Show Browse By Date"), - 'sys_style_home_showalbums' => i18n("Show Albums On Home Site"), - 'sys_style_home_firstsortorder' => i18n("Sort Order Of First Level Albums"), - - 'sys_style_image_nrprevnextthumbs' => i18n("Nr Of Previous/Next Thumbnails"), - 'sys_style_image_width' => i18n("Max Image Width"), - 'sys_style_image_height' => i18n("Max Image Height"), - - 'sys_style_thumb_showsubfoldersseparate' => i18n("Show Subfolders Separate"), - 'sys_style_thumb_nojsnrcols' => i18n("Nr Cols if Javascript deactivated"), - 'sys_style_thumb_nojsnrrows' => i18n("Nr Rows if Javascript deactivated"), - 'sys_style_thumb_size_display' => i18n("Thumb size"), - - 'sys_style_others_sortorder' => i18n("Sort order"), - - 'sys_style_layout_title' => i18n("Linpha Title"), - 'sys_style_layout_template' => i18n("Template"), - 'sys_style_layout_theme' => i18n("Theme"), - 'sys_style_layout_color_bodybg' => i18n("Main Background Color"), - 'sys_style_layout_color_elembg' => i18n("Elements Background Color"), - 'sys_style_layout_color_font' => i18n("Fonts Color"), - 'sys_style_layout_color_albumsbg' => i18n("Albums Background Color"), - 'sys_style_layout_color_links' => i18n("Links Color"), - 'sys_style_layout_color_linkshover' => i18n("Links Hover Color"), - - '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"), - 'plugins_log_email_enable' => i18n("Send important messages by email"), - 'plugins_log_email_add_events' => i18n("Additional log events sent by email"), - 'plugins_log_email_to' => i18n("Recipient"), - 'plugins_log_email_headers' => i18n("Extra headers"), - 'plugins_log_email_subject' => i18n("Subject"), - - 'plugins_filemanager_enable' => i18n("Enable Filemanager For Non-Admin Users"), - ); -} - -function printAdminMenu($array_menu,$active) -{ - ?> - <ul class="linUlMenu"> - <?php - foreach($array_menu AS $key=>$value) - { - if($value['link']=='linpha_home') - { - echo '<li><a href="../">'.$value['name'].'</a></li>'; - } - else - { - if($active==$key) - { - echo '<li><a href="./?cat='.$value['link'].'" class="current">'.$value['name'].'</a></li>'; - } - else - { - echo '<li><a href="./?cat='.$value['link'].'">'.$value['name'].'</a></li>'; - } - } - } - ?> - </ul> - <?php -} - -function printAdminConfig($type,$text,$id,$value,$settings=array()) -{ - ?> - <div style="width: 600px; border: 1px solid black; padding: 5px; margin-bottom: 5px;"> - <div align="left" style="float: left;"> - <?php - switch($type) - { - case 'radio': - if($value) - { - $str_enabled = ' checked="checked"'; - $str_disabled = ''; - } - else - { - $str_enabled = ''; - $str_disabled = ' checked="checked"'; - } - echo $text; - ?> - </div> - <div align="right"> - <input type="radio" id="<?php echo $id; ?>01" name="<?php echo $id; ?>" value="1"<?php echo $str_enabled; ?> /><label for="<?php echo $id; ?>01"><?php echo i18n("Enable"); ?></label> - <input type="radio" id="<?php echo $id; ?>02" name="<?php echo $id; ?>" value="0"<?php echo $str_disabled; ?>/><label for="<?php echo $id; ?>02"><?php echo i18n("Disable"); ?></label> - <?php - break; - case 'text': - case 'password': - echo $text; - ?> - </div> - <div align="right"> - <input type="<?php echo $type; ?>" name="<?php echo $id; ?>" value="<?php echo htmlspecialchars($value, ENT_QUOTES); ?>" class="linForms" maxlength="255" style="width: 200px;" /> - <?php - - break; - case 'select': - echo $text; - ?> - </div> - <div align="right"> - <select name="<?php echo $id; ?>" size="1"<?php echo (isset($settings['input_settings']) ? $settings['input_settings'] : '' ); ?> class="linForms"> - <?php - foreach($settings['options'] AS $option_key=>$option_value) - { - if($option_key == $value) - { - $selected = ' selected="selected"'; - } - else - { - $selected = ''; - } - echo '<option value="'.$option_key.'"'.$selected.'>'.$option_value.'</option>'; - } - ?> - </select> - <?php - break; - } - ?> - </div> - </div> - <?php -} - -function saveConfig($array,$userid=0) -{ - foreach($array AS $value) - { - /** - * does this config name exists? - */ - if(isset($GLOBALS['linpha']->sql->config->value[$value]) && - isset($_POST[$value])) - { - $GLOBALS['linpha']->sql->config->updateConfig($value,$_POST[$value],$userid); - } - } - - linSysLog(i18n("Settings saved.")); - - /** - * update config array - */ - $GLOBALS['linpha']->sql->config->reloadConfig(); - - /** - * update system config array, used in admin/settings*.php - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' ORDER by option_name"); - while($data = $query->FetchRow()) - { - $this->option_value_system[$data['option_name']] = $data['option_value']; - } -} - -/** - * thanks to http://www.ilovejackdaniels.com/php/email-address-validation/ - */ -function checkValidEmailAddress($email) -{ - // First, we check that there's one @ symbol, and that the lengths are right - if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { - // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. - return false; - } - // Split it into sections to make life easier - $email_array = explode("@", $email); - $local_array = explode(".", $email_array[0]); - for ($i = 0; $i < sizeof($local_array); $i++) { - if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { - return false; - } - } - if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name - $domain_array = explode(".", $email_array[1]); - if (sizeof($domain_array) < 2) { - return false; // Not enough parts to domain - } - for ($i = 0; $i < sizeof($domain_array); $i++) { - if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { - return false; - } - } - } - return true; -} - -/*function getOptions() -{ - return array( - 'sys_db_version', - 'sys_im_bracket_support', - 'sys_im_imagemagick_path', - 'sys_im_use_imagemagick', - 'sys_im_video_thumbnail', - - 'sys_import_autoimport', - 'sys_import_exif', - 'sys_import_exif_autorot', - - 'sys_image_exif', - 'sys_image_iptc', - 'sys_image_xmp', - 'sys_lang', - 'sys_lang_autolang', - 'sys_path_album_dir', - 'sys_path_cache_dir', - 'sys_path_tmp_dir', - - 'sys_basket_mail_max_size', - 'sys_basket_download_limit', - - 'sys_style_sortorder', - 'sys_style_template', - 'sys_style_home_showbrowsebydate', - 'sys_style_home_nrrandomimages', - 'sys_style_home_showalbums', - 'sys_style_home_usedefaultwelcometext', - 'sys_style_home_firstsortorder', - 'sys_style_thumb_size_max', - 'sys_style_thumb_size_display', - 'sys_style_thumb_showsubfoldersseparate', - 'sys_style_thumb_selectsizes', - 'sys_style_thumb_selectnrimages', - 'sys_style_thumb_nojsnrrows', - 'sys_style_thumb_nojsnrcols', - 'sys_style_image_quality', - 'sys_style_image_width', - 'sys_style_image_height', - 'sys_style_image_nrprevnextthumbs', - - 'sys_user_autologin' - ); -}*/ - -/** - * a list of all settings which are enable/disable - * to show radio buttons instead of text field - */ -function getRadioOptions() -{ - return array( - 'sys_im_bracket_support', - 'sys_im_use_imagemagick', - 'sys_im_video_thumbnail', - 'sys_import_use_emb_thumb', - 'sys_import_autoimport', - 'sys_import_exif', - 'sys_import_exif_autorot', - 'sys_import_use_exiftool', - 'sys_image_exif', - 'sys_image_iptc', - 'sys_image_xmp', - 'sys_lang_autolang', - 'sys_style_home_showbrowsebydate', - 'sys_style_home_showalbums', - 'sys_style_home_usedefaultwelcometext', - 'sys_style_thumb_showsubfoldersseparate', - 'sys_style_image_useeffects', - 'sys_user_autologin', - 'plugins_log_syslog_enable', - 'plugins_log_email_enable', - 'plugins_filemanager_enable' - ); -} - -function getDescriptionByOptionName( $option_name ) -{ - if( isset( $this->description_array[ $option_name ] ) ) - { - return $this->description_array[ $option_name ]; - } -} - -function getTemplates() -{ - $templatesdir = LINPHA_DIR."/templates"; - - $file_handle = opendir($templatesdir); - $all_themes = array(); - - while( ($file = readdir($file_handle)) !== false ) - { - if($file != "." && $file != ".." && $file != ".svn" && - is_dir($templatesdir.'/'.$file) && - file_exists($templatesdir.'/'.$file.'/global.html.php') && // do at least this check - file_exists($templatesdir.'/'.$file.'/themes') // do at least this check - ) - { - $all_themes[$file] = $file; - } - } - - closedir($file_handle); - - /* Sort theme files aphabetically */ - asort($all_themes); - - return $all_themes; -} - -function getThemes($template) -{ - $templatesdir = LINPHA_DIR."/templates/".$template."/themes"; - - $file_handle = opendir($templatesdir); - $all_themes = array(); - - while( ($file = readdir($file_handle)) !== false ) - { - if($file != "." && $file != ".." && $file != ".svn" && is_dir($templatesdir.'/'.$file)) - { - $all_themes[$file] = $file; - } - } - - closedir($file_handle); - - /* Sort theme files aphabetically */ - asort($all_themes); - - return $all_themes; -} - -} // end class LinAdmin - +<?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 provides functions for edit configs etc. + * @package Admin + */ +class LinAdmin +{ + +public $options; +public $options_value_system; +public $description_array; + +/** + * constructor + */ +function __construct() +{ + /** + * get system option names and values and save in array for easier access + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' ORDER by option_name"); + while($data = $query->FetchRow()) + { + $this->options[] = $data['option_name']; + $this->option_value_system[$data['option_name']] = $data['option_value']; + } + + $this->description_array = array( + 'sys_image_exif' => i18n("Use EXIF"), + 'sys_image_iptc' => i18n("Use IPTC"), + 'sys_image_xmp' => i18n("Use XMP"), + 'sys_lang_autolang' => i18n("Language Auto Detection"), + 'sys_lang' => i18n("Default Language (if auto detections fails or if it is disabled)"), + + 'sys_style_home_nrrandomimages' => i18n("Nr Of Random Images (0 to disable)"), + 'sys_style_home_showbrowsebydate' => i18n("Show Browse By Date"), + 'sys_style_home_showalbums' => i18n("Show Albums On Home Site"), + 'sys_style_home_firstsortorder' => i18n("Sort Order Of First Level Albums"), + + 'sys_style_image_nrprevnextthumbs' => i18n("Nr Of Previous/Next Thumbnails"), + 'sys_style_image_width' => i18n("Max Image Width"), + 'sys_style_image_height' => i18n("Max Image Height"), + + 'sys_style_thumb_showsubfoldersseparate' => i18n("Show Subfolders Separate"), + 'sys_style_thumb_nojsnrcols' => i18n("Nr Cols if Javascript deactivated"), + 'sys_style_thumb_nojsnrrows' => i18n("Nr Rows if Javascript deactivated"), + 'sys_style_thumb_size_display' => i18n("Thumb size"), + + 'sys_style_others_sortorder' => i18n("Sort order"), + + 'sys_style_layout_title' => i18n("Linpha Title"), + 'sys_style_layout_template' => i18n("Template"), + 'sys_style_layout_theme' => i18n("Theme"), + 'sys_style_layout_color_bodybg' => i18n("Main Background Color"), + 'sys_style_layout_color_elembg' => i18n("Elements Background Color"), + 'sys_style_layout_color_font' => i18n("Fonts Color"), + 'sys_style_layout_color_albumsbg' => i18n("Albums Background Color"), + 'sys_style_layout_color_links' => i18n("Links Color"), + 'sys_style_layout_color_linkshover' => i18n("Links Hover Color"), + 'sys_style_layout_color_fields' => i18n("Color Of Input and Select fields"), + + '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"), + 'plugins_log_email_enable' => i18n("Send important messages by email"), + 'plugins_log_email_add_events' => i18n("Additional log events sent by email"), + 'plugins_log_email_to' => i18n("Recipient"), + 'plugins_log_email_headers' => i18n("Extra headers"), + 'plugins_log_email_subject' => i18n("Subject"), + + 'plugins_filemanager_enable' => i18n("Enable Filemanager For Non-Admin Users"), + ); +} + +function printAdminMenu($array_menu,$active) +{ + ?> + <ul class="linUlMenu"> + <?php + foreach($array_menu AS $key=>$value) + { + if($value['link']=='linpha_home') + { + echo '<li><a href="../">'.$value['name'].'</a></li>'; + } + else + { + if($active==$key) + { + echo '<li><a href="./?cat='.$value['link'].'" class="current">'.$value['name'].'</a></li>'; + } + else + { + echo '<li><a href="./?cat='.$value['link'].'">'.$value['name'].'</a></li>'; + } + } + } + ?> + </ul> + <?php +} + +function printAdminConfig($type,$text,$id,$value,$settings=array()) +{ + ?> + <div style="width: 600px; border: 1px solid black; padding: 5px; margin-bottom: 5px;"> + <div align="left" style="float: left;"> + <?php + switch($type) + { + case 'radio': + if($value) + { + $str_enabled = ' checked="checked"'; + $str_disabled = ''; + } + else + { + $str_enabled = ''; + $str_disabled = ' checked="checked"'; + } + echo $text; + ?> + </div> + <div align="right"> + <input type="radio" id="<?php echo $id; ?>01" name="<?php echo $id; ?>" value="1"<?php echo $str_enabled; ?> /><label for="<?php echo $id; ?>01"><?php echo i18n("Enable"); ?></label> + <input type="radio" id="<?php echo $id; ?>02" name="<?php echo $id; ?>" value="0"<?php echo $str_disabled; ?>/><label for="<?php echo $id; ?>02"><?php echo i18n("Disable"); ?></label> + <?php + break; + case 'text': + case 'password': + echo $text; + ?> + </div> + <div align="right"> + <input type="<?php echo $type; ?>" name="<?php echo $id; ?>" value="<?php echo htmlspecialchars($value, ENT_QUOTES); ?>" class="linForms" maxlength="255" style="width: 200px;" /> + <?php + + break; + case 'select': + echo $text; + ?> + </div> + <div align="right"> + <select name="<?php echo $id; ?>" size="1"<?php echo (isset($settings['input_settings']) ? $settings['input_settings'] : '' ); ?> class="linForms"> + <?php + foreach($settings['options'] AS $option_key=>$option_value) + { + if($option_key == $value) + { + $selected = ' selected="selected"'; + } + else + { + $selected = ''; + } + echo '<option value="'.$option_key.'"'.$selected.'>'.$option_value.'</option>'; + } + ?> + </select> + <?php + break; + } + ?> + </div> + </div> + <?php +} + +function saveConfig($array,$userid=0) +{ + foreach($array AS $value) + { + /** + * does this config name exists? + */ + if(isset($GLOBALS['linpha']->sql->config->value[$value]) && + isset($_POST[$value])) + { + $GLOBALS['linpha']->sql->config->updateConfig($value,$_POST[$value],$userid); + } + } + + linSysLog(i18n("Settings saved.")); + + /** + * update config array + */ + $GLOBALS['linpha']->sql->config->reloadConfig(); + + /** + * update system config array, used in admin/settings*.php + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' ORDER by option_name"); + while($data = $query->FetchRow()) + { + $this->option_value_system[$data['option_name']] = $data['option_value']; + } +} + +/** + * thanks to http://www.ilovejackdaniels.com/php/email-address-validation/ + */ +function checkValidEmailAddress($email) +{ + // First, we check that there's one @ symbol, and that the lengths are right + if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { + // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. + return false; + } + // Split it into sections to make life easier + $email_array = explode("@", $email); + $local_array = explode(".", $email_array[0]); + for ($i = 0; $i < sizeof($local_array); $i++) { + if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { + return false; + } + } + if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name + $domain_array = explode(".", $email_array[1]); + if (sizeof($domain_array) < 2) { + return false; // Not enough parts to domain + } + for ($i = 0; $i < sizeof($domain_array); $i++) { + if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { + return false; + } + } + } + return true; +} + +/*function getOptions() +{ + return array( + 'sys_db_version', + 'sys_im_bracket_support', + 'sys_im_imagemagick_path', + 'sys_im_use_imagemagick', + 'sys_im_video_thumbnail', + + 'sys_import_autoimport', + 'sys_import_exif', + 'sys_import_exif_autorot', + + 'sys_image_exif', + 'sys_image_iptc', + 'sys_image_xmp', + 'sys_lang', + 'sys_lang_autolang', + 'sys_path_album_dir', + 'sys_path_cache_dir', + 'sys_path_tmp_dir', + + 'sys_basket_mail_max_size', + 'sys_basket_download_limit', + + 'sys_style_sortorder', + 'sys_style_template', + 'sys_style_home_showbrowsebydate', + 'sys_style_home_nrrandomimages', + 'sys_style_home_showalbums', + 'sys_style_home_usedefaultwelcometext', + 'sys_style_home_firstsortorder', + 'sys_style_thumb_size_max', + 'sys_style_thumb_size_display', + 'sys_style_thumb_showsubfoldersseparate', + 'sys_style_thumb_selectsizes', + 'sys_style_thumb_selectnrimages', + 'sys_style_thumb_nojsnrrows', + 'sys_style_thumb_nojsnrcols', + 'sys_style_image_quality', + 'sys_style_image_width', + 'sys_style_image_height', + 'sys_style_image_nrprevnextthumbs', + + 'sys_user_autologin' + ); +}*/ + +/** + * a list of all settings which are enable/disable + * to show radio buttons instead of text field + */ +function getRadioOptions() +{ + return array( + 'sys_im_bracket_support', + 'sys_im_use_imagemagick', + 'sys_im_video_thumbnail', + 'sys_import_use_emb_thumb', + 'sys_import_autoimport', + 'sys_import_exif', + 'sys_import_exif_autorot', + 'sys_import_use_exiftool', + 'sys_image_exif', + 'sys_image_iptc', + 'sys_image_xmp', + 'sys_lang_autolang', + 'sys_style_home_showbrowsebydate', + 'sys_style_home_showalbums', + 'sys_style_home_usedefaultwelcometext', + 'sys_style_thumb_showsubfoldersseparate', + 'sys_style_image_useeffects', + 'sys_user_autologin', + 'plugins_log_syslog_enable', + 'plugins_log_email_enable', + 'plugins_filemanager_enable' + ); +} + +function getDescriptionByOptionName( $option_name ) +{ + if( isset( $this->description_array[ $option_name ] ) ) + { + return $this->description_array[ $option_name ]; + } +} + +function getTemplates() +{ + $templatesdir = LINPHA_DIR."/templates"; + + $file_handle = opendir($templatesdir); + $all_themes = array(); + + while( ($file = readdir($file_handle)) !== false ) + { + if($file != "." && $file != ".." && $file != ".svn" && + is_dir($templatesdir.'/'.$file) && + file_exists($templatesdir.'/'.$file.'/global.html.php') && // do at least this check + file_exists($templatesdir.'/'.$file.'/themes') // do at least this check + ) + { + $all_themes[$file] = $file; + } + } + + closedir($file_handle); + + /* Sort theme files aphabetically */ + asort($all_themes); + + return $all_themes; +} + +function getThemes($template) +{ + $templatesdir = LINPHA_DIR."/templates/".$template."/themes"; + + $file_handle = opendir($templatesdir); + $all_themes = array(); + + while( ($file = readdir($file_handle)) !== false ) + { + if($file != "." && $file != ".." && $file != ".svn" && is_dir($templatesdir.'/'.$file)) + { + $all_themes[$file] = $file; + } + } + + closedir($file_handle); + + /* Sort theme files aphabetically */ + asort($all_themes); + + return $all_themes; +} + +} // end class LinAdmin + ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2007-07-05 15:30:47 UTC (rev 4728) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2007-07-05 17:46:10 UTC (rev 4729) @@ -54,6 +54,8 @@ $this->albumsbgcolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_albumsbg']; $this->linkscolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_links']; $this->linkshovercolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_linkshover']; + $this->fieldscolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_fields']; + } /** @@ -83,13 +85,13 @@ <!-- colorsettings.php --> <link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'.$this->template_name.'/themes/default/colorsettings.php'. '?bg='.$this->bgcolor.'&bodybg='.$this->bodybgcolor.'&font='.$this->fontcolor. - '&albumsbg='.$this->albumsbgcolor.'&links='.$this->linkscolor.'&linkshover='.$this->linkshovercolor; ?>' type='text/css'> + '&albumsbg='.$this->albumsbgcolor.'&links='.$this->linkscolor.'&linkshover='.$this->linkshovercolor.'&fieldscolor='.$this->fieldscolor; ?>' type='text/css'> <?php if($this->layout_name != 'default' && file_exists(LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/colorsettings.php')) { ?> <link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'.$this->template_name.'/themes/'.$this->layout_name."/colorsettings.php?bg=". $this->bgcolor."&bodybg=".$this->bodybgcolor."&font=".$this->fontcolor. - "&albumsbg=".$this->albumsbgcolor."&links=".$this->linkscolor."&linkshover=".$this->linkshovercolor; ?>' type='text/css'> + "&albumsbg=".$this->albumsbgcolor."&links=".$this->linkscolor."&linkshover=".$this->linkshovercolor.'&fieldscolor='.$this->fieldscolor; ?>' type='text/css'> <?php } ?> <!-- global.css --> Modified: trunk/linpha2/templates/default/themes/default/colorsettings.php =================================================================== --- trunk/linpha2/templates/default/themes/default/colorsettings.php 2007-07-05 15:30:47 UTC (rev 4728) +++ trunk/linpha2/templates/default/themes/default/colorsettings.php 2007-07-05 17:46:10 UTC (rev 4729) @@ -1,70 +1,70 @@ -<?php -header("Content-Type: text/css"); - -/** - * force caching in browser - * works in firefox and internet explorer - */ -Header("Last-Modified: " . gmdate("D, d M Y H:i:s",mktime (0,0,0,1,1,2000)) . " GMT"); // 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"); - - -/* - * Created on 26.10.2006 - * - * To change the template for this generated file go to - * Window - Preferences - PHPeclipse - PHP - Code Templates - */ -?> - -/** - * background color - * #linDivThumbNavi amd #divSlideshowControlsInner used in view_img.html.php - */ - body { - background-color: #<?php echo $_GET['bodybg']; ?>; - } - - #linDivMainOuter, #linDivMetaStaticOuter, #linDivNavigationOuter, .linButton, #linDivThumbnaviOuter, #linDivSlideshowControls, .roundAlphabottomInner { - background-color: #<?php echo $_GET['bg']; ?>; - } - -/** - * font color - */ - body, #linDivMenu ul a, #linDivMenu ul span, #linDivMenu ul div { - color: #<?php echo $_GET['font']; ?>; - } - -/** - * albums color - */ - .linDivFolder { - background-color: #<?php echo $_GET['albumsbg']; ?>; - } - -/** - * link/form colors - */ - a:link, a:visited, .linButton { - color: #<?php echo $_GET['links']; ?>; - } - a:hover, .linButton:hover { - color: #<?php echo $_GET['linkshover']; ?>; - } - - .linForms { - background-color: #d5eeff; - border: 1px solid grey; - } - -/** - * menu - */ - #linDivMenu ul a:hover, #linDivMenu ul span:hover { - background: #bbbbbb; - } - #linDivMenu ul ul, .linInputMenu { - background-color: #eeeeee; - } +<?php +header("Content-Type: text/css"); + +/** + * force caching in browser + * works in firefox and internet explorer + */ +Header("Last-Modified: " . gmdate("D, d M Y H:i:s",mktime (0,0,0,1,1,2000)) . " GMT"); // 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"); + + +/* + * Created on 26.10.2006 + * + * To change the template for this generated file go to + * Window - Preferences - PHPeclipse - PHP - Code Templates + */ +?> + +/** + * background color + * #linDivThumbNavi amd #divSlideshowControlsInner used in view_img.html.php + */ + body { + background-color: #<?php echo $_GET['bodybg']; ?>; + } + + #linDivMainOuter, #linDivMetaStaticOuter, #linDivNavigationOuter, .linButton, #linDivThumbnaviOuter, #linDivSlideshowControls, .roundAlphabottomInner { + background-color: #<?php echo $_GET['bg']; ?>; + } + +/** + * font color + */ + body, #linDivMenu ul a, #linDivMenu ul span, #linDivMenu ul div { + color: #<?php echo $_GET['font']; ?>; + } + +/** + * albums color + */ + .linDivFolder { + background-color: #<?php echo $_GET['albumsbg']; ?>; + } + +/** + * link/form colors + */ + a:link, a:visited, .linButton { + color: #<?php echo $_GET['links']; ?>; + } + a:hover, .linButton:hover { + color: #<?php echo $_GET['linkshover']; ?>; + } + + .linForms { + background-color: #<?php echo $_GET['fieldscolor']; ?>; + border: 1px solid grey; + } + +/** + * menu + */ + #linDivMenu ul a:hover, #linDivMenu ul span:hover { + background: #bbbbbb; + } + #linDivMenu ul ul, .linInputMenu { + background-color: #eeeeee; + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2007-07-06 18:29:07
|
Revision: 4734 http://svn.sourceforge.net/linpha/?rev=4734&view=rev Author: bzrudi Date: 2007-07-06 11:29:01 -0700 (Fri, 06 Jul 2007) Log Message: ----------- "make use of http_build_query() whenever we have more than 3 arguments! " Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.template.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-07-06 13:49:56 UTC (rev 4733) +++ trunk/linpha2/ChangeLog 2007-07-06 18:29:01 UTC (rev 4734) @@ -1,4 +1,7 @@ -2007-07-04 bzrudi +2007-07-06 bzrudi + * Bumped Exiftool to latest stable 6.90 (windows bin 6.92) + +2007-07-05 bzrudi * Added Exiftool configuration support to Installer. Checks also for Perl and OS. Needs Windows testing! TODO: Save path to perl in DB Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2007-07-06 13:49:56 UTC (rev 4733) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2007-07-06 18:29:01 UTC (rev 4734) @@ -82,32 +82,66 @@ ?> <!-- css includes --> +<?php +/** + * Prepare http url + */ +$urlParams = array( + 'bg' => ''.$this->bgcolor.'', + 'bodybg' => ''.$this->bodybgcolor.'', + 'font' => ''.$this->fontcolor.'', + 'albumsbg' => ''.$this->albumsbgcolor.'', + 'links' => ''.$this->linkscolor.'', + 'linkshover' => ''.$this->linkshovercolor.'', + 'fieldscolor' => ''.$this->fieldscolor.'' + ); +?> <!-- colorsettings.php --> -<link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'.$this->template_name.'/themes/default/colorsettings.php'. - '?bg='.$this->bgcolor.'&bodybg='.$this->bodybgcolor.'&font='.$this->fontcolor. - '&albumsbg='.$this->albumsbgcolor.'&links='.$this->linkscolor.'&linkshover='.$this->linkshovercolor.'&fieldscolor='.$this->fieldscolor; ?>' type='text/css'> + +<link rel='stylesheet' + href='<?php echo LINPHA_CLIENT.'/templates/'. + $this->template_name.'/themes/default/colorsettings.php?'. + http_build_query($urlParams);?>' type='text/css'> + <?php if($this->layout_name != 'default' && - file_exists(LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/colorsettings.php')) -{ ?> -<link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'.$this->template_name.'/themes/'.$this->layout_name."/colorsettings.php?bg=". - $this->bgcolor."&bodybg=".$this->bodybgcolor."&font=".$this->fontcolor. - "&albumsbg=".$this->albumsbgcolor."&links=".$this->linkscolor."&linkshover=".$this->linkshovercolor.'&fieldscolor='.$this->fieldscolor; ?>' type='text/css'> + file_exists(LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'. + $this->layout_name.'/colorsettings.php')) + { ?> + + <link rel='stylesheet' + href='<?php echo LINPHA_CLIENT.'/templates/'. + $this->template_name.'/themes/'.$this->layout_name."/colorsettings.php?". + 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'> + +<link rel='stylesheet' + href='<?php echo LINPHA_CLIENT.'/templates/'. + $this->template_name.'/themes/default/css/global.css'; ?>' type='text/css'> + <?php if($this->layout_name != 'default' && - file_exists(LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/css/global.css')) -{ ?> -<link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/css/global.css'; ?>' type='text/css'> + file_exists(LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'. + $this->layout_name.'/css/global.css')) + { ?> + <link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'. + $this->template_name.'/themes/'.$this->layout_name.'/css/global.css'; ?>' + 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'> + +<link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'. + $this->template_name.'/themes/default/css/'.$this->css_name.'.css'; ?>' + type='text/css'> + <?php if($this->layout_name != 'default' && - file_exists(LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/css/'.$this->css_name.'.css')) -{ ?> -<link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/css/'.$this->css_name.'.css'; ?>' type='text/css'> + file_exists(LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'. + $this->layout_name.'/css/'.$this->css_name.'.css')) + { ?> + <link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'. + $this->template_name.'/themes/'.$this->layout_name.'/css/'. + $this->css_name.'.css'; ?>' type='text/css'> <?php } ?> <!--[if IE]> @@ -351,21 +385,51 @@ $alignleft = 'bl'; $alignright = 'br'; } - + + /** + * Prepare http url + */ + $lcornerParam = array( + 'color' => ''.$color.'', + 'bgcolor' => ''.$bgcolor.'', + 'size' => ''.$size.'', + 'align' => ''.$alignleft.'' + ); + + $rcornerParam = array( + 'color' => ''.$color.'', + 'bgcolor' => ''.$bgcolor.'', + 'size' => ''.$size.'', + 'align' => ''.$alignright.'' + ); + if(empty($alpha)) // default { - $str = '<div style="background: url('.LINPHA_CLIENT.'/templates/misc/roundcorners.php?color='.$color.'&bgcolor='.$bgcolor.'&size='.$size.'&align='.$alignright.') no-repeat top right;">'; - $str .= '<img src="'.LINPHA_CLIENT.'/templates/misc/roundcorners.php?color='.$color.'&bgcolor='.$bgcolor.'&size='.$size.'&align='.$alignleft.'" alt="" width="'.$size.'" height="'.$size.'" />'; - $str .= '</div>'; + $str = '<div style="background: + url('.LINPHA_CLIENT.'/templates/misc/roundcorners.php?'. + http_build_query($rcornerParam).') no-repeat top right;">'; + + $str .= '<img src="'.LINPHA_CLIENT.'/templates/misc/roundcorners.php?'. + http_build_query($lcornerParam).'" + alt="" width="'.$size.'" height="'.$size.'" />'; + + $str .= '</div>'; } - else // currently only used in slideshow, does not work well in internet explorer + else // currently only used in slideshow, sucks with IE { - $str = '<div style="position: relative; background: url('.LINPHA_CLIENT.'/templates/misc/roundcorners.php?color='.$color.'&bgcolor='.$bgcolor.'&size='.$size.'&alpha&align='.$alignright.') no-repeat top right;">'; + $str = '<div style="position: relative; background: + url('.LINPHA_CLIENT.'/templates/misc/roundcorners.php?'. + http_build_query($rcornerParam).'&alpha) no-repeat top right;">'; + $str .= '<div class="roundAlphabottomInner"> </div>'; - $str .= '<img src="'.LINPHA_CLIENT.'/templates/misc/roundcorners.php?color='.$color.'&bgcolor='.$bgcolor.'&size='.$size.'&align='.$alignleft.'&alpha" alt="" width="'.$size.'" height="'.$size.'" class="AlphaCorner" />'; + + $str .= '<img src="'.LINPHA_CLIENT.'/templates/misc/roundcorners.php?'. + http_build_query($lcornerParam).'&alpha" + alt="" width="'.$size.'" height="'.$size.'" class="AlphaCorner" />'; + $str .= '</div>'; } - + return $str; } @@ -382,4 +446,4 @@ } } // end class linTemplate -?> \ 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: <bz...@us...> - 2007-07-10 09:43:47
|
Revision: 4736 http://svn.sourceforge.net/linpha/?rev=4736&view=rev Author: bzrudi Date: 2007-07-10 02:43:45 -0700 (Tue, 10 Jul 2007) Log Message: ----------- minor exiftool changes and EOL M$ to Unix conversion Modified Paths: -------------- trunk/linpha2/docs/dev/external_libraries.txt trunk/linpha2/lib/classes/linpha.exiftool.class.php trunk/linpha2/lib/classes/pjmt/JPEG.php trunk/linpha2/templates/default/fragments.php Modified: trunk/linpha2/docs/dev/external_libraries.txt =================================================================== --- trunk/linpha2/docs/dev/external_libraries.txt 2007-07-06 18:31:05 UTC (rev 4735) +++ trunk/linpha2/docs/dev/external_libraries.txt 2007-07-10 09:43:45 UTC (rev 4736) @@ -23,6 +23,9 @@ CHANGES ------- + JPEG.php + line 94 removed "This probably is not a JPEG file" echo. we take care + of it ourself during import. EXIF.php - changed '<?' to '<?php' Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2007-07-06 18:31:05 UTC (rev 4735) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2007-07-10 09:43:45 UTC (rev 4736) @@ -120,8 +120,8 @@ "-s " . // Print tag names instead of descr. "-t " . // Use tab \t as delimiter "-fast " . // Do not read to EOF - "-n " . // Read numbers instead of words - "-m "; //Ignore minor errors + //"-n " . // Read numbers instead of words + "-m "; // Ignore minor errors LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $meta, $return); @@ -206,9 +206,9 @@ $return = ""; $meta = ""; $filename = "".$dirname."/".$filename.""; - $parameters = "-exif:datetimeoriginal " . // Get date tag - "-exif:orientation " . // Get orientation tag - "-s -n -t"; // Print tag name tab seper. + $parameters = "-exif:datetimeoriginal " . // Get date tag + "-exif:orientation " . // Get orientation tag + "-s -n -t "; // Print tag name tab seper. LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $meta, $return); Modified: trunk/linpha2/lib/classes/pjmt/JPEG.php =================================================================== --- trunk/linpha2/lib/classes/pjmt/JPEG.php 2007-07-06 18:31:05 UTC (rev 4735) +++ trunk/linpha2/lib/classes/pjmt/JPEG.php 2007-07-10 09:43:45 UTC (rev 4736) @@ -1,973 +1,973 @@ -<?php - -/****************************************************************************** -* -* Filename: JPEG.php -* -* Description: Provides functions for reading and writing information to/from -* JPEG format files -* -* Author: Evan Hunter -* -* Date: 23/7/2004 -* -* Project: PHP JPEG Metadata Toolkit -* -* Revision: 1.10 -* -* Changes: 1.00 -> 1.10 : changed put_jpeg_header_data to check if the data -* being written exists -* -* URL: http://electronics.ozhiker.com -* -* Copyright: Copyright Evan Hunter 2004 -* -* License: This file is part of the PHP JPEG Metadata Toolkit. -* -* The PHP JPEG Metadata Toolkit 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. -* -* The PHP JPEG Metadata Toolkit 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 the PHP JPEG Metadata Toolkit; if not, -* write to the Free Software Foundation, Inc., 59 Temple -* Place, Suite 330, Boston, MA 02111-1307 USA -* -* If you require a different license for commercial or other -* purposes, please contact the author: ev...@oz... -* -******************************************************************************/ - - - - -/****************************************************************************** -* -* Function: get_jpeg_header_data -* -* Description: Reads all the JPEG header segments from an JPEG image file into an -* array -* -* Parameters: filename - the filename of the file to JPEG file to read -* -* Returns: headerdata - Array of JPEG header segments -* FALSE - if headers could not be read -* -******************************************************************************/ - -function get_jpeg_header_data( $filename ) -{ - - // prevent refresh from aborting file operations and hosing file - ignore_user_abort(true); - - - // Attempt to open the jpeg file - the at symbol supresses the error message about - // not being able to open files. The file_exists would have been used, but it - // does not work with files fetched over http or ftp. - $filehnd = @fopen($filename, 'rb'); - - // Check if the file opened successfully - if ( ! $filehnd ) - { - // Could't open the file - exit - echo "<p>Could not open file $filename</p>\n"; - return FALSE; - } - - - // Read the first two characters - $data = network_safe_fread( $filehnd, 2 ); - - // Check that the first two characters are 0xFF 0xDA (SOI - Start of image) - if ( $data != "\xFF\xD8" ) - { - // No SOI (FF D8) at start of file - This probably isn't a JPEG file - close file and return; - echo "<p>This probably is not a JPEG file</p>\n"; - fclose($filehnd); - return FALSE; - } - - - // Read the third character - $data = network_safe_fread( $filehnd, 2 ); - - // Check that the third character is 0xFF (Start of first segment header) - if ( $data{0} != "\xFF" ) - { - // NO FF found - close file and return - JPEG is probably corrupted - fclose($filehnd); - return FALSE; - } - - // Flag that we havent yet hit the compressed image data - $hit_compressed_image_data = FALSE; - - - // Cycle through the file until, one of: 1) an EOI (End of image) marker is hit, - // 2) we have hit the compressed image data (no more headers are allowed after data) - // 3) or end of file is hit - - while ( ( $data{1} != "\xD9" ) && (! $hit_compressed_image_data) && ( ! feof( $filehnd ) )) - { - // Found a segment to look at. - // Check that the segment marker is not a Restart marker - restart markers don't have size or data after them - if ( ( ord($data{1}) < 0xD0 ) || ( ord($data{1}) > 0xD7 ) ) - { - // Segment isn't a Restart marker - // Read the next two bytes (size) - $sizestr = network_safe_fread( $filehnd, 2 ); - - // convert the size bytes to an integer - $decodedsize = unpack ("nsize", $sizestr); - - // Save the start position of the data - $segdatastart = ftell( $filehnd ); - - // Read the segment data with length indicated by the previously read size - $segdata = network_safe_fread( $filehnd, $decodedsize['size'] - 2 ); - - - // Store the segment information in the output array - $headerdata[] = array( "SegType" => ord($data{1}), - "SegName" => $GLOBALS[ "JPEG_Segment_Names" ][ ord($data{1}) ], - "SegDesc" => $GLOBALS[ "JPEG_Segment_Descriptions" ][ ord($data{1}) ], - "SegDataStart" => $segdatastart, - "SegData" => $segdata ); - } - - // If this is a SOS (Start Of Scan) segment, then there is no more header data - the compressed image data follows - if ( $data{1} == "\xDA" ) - { - // Flag that we have hit the compressed image data - exit loop as no more headers available. - $hit_compressed_image_data = TRUE; - } - else - { - // Not an SOS - Read the next two bytes - should be the segment marker for the next segment - $data = network_safe_fread( $filehnd, 2 ); - - // Check that the first byte of the two is 0xFF as it should be for a marker - if ( $data{0} != "\xFF" ) - { - // NO FF found - close file and return - JPEG is probably corrupted - fclose($filehnd); - return FALSE; - } - } - } - - // Close File - fclose($filehnd); - // Alow the user to abort from now on - ignore_user_abort(false); - - // Return the header data retrieved - return $headerdata; -} - - -/****************************************************************************** -* End of Function: get_jpeg_header_data -******************************************************************************/ - - - - -/****************************************************************************** -* -* Function: put_jpeg_header_data -* -* Description: Writes JPEG header data into a JPEG file. Takes an array in the -* same format as from get_jpeg_header_data, and combines it with -* the image data of an existing JPEG file, to create a new JPEG file -* WARNING: As this function will replace all JPEG headers, -* including SOF etc, it is best to read the jpeg headers -* from a file, alter them, then put them back on the same -* file. If a SOF segment wer to be transfered from one -* file to another, the image could become unreadable unless -* the images were idenical size and configuration -* -* -* Parameters: old_filename - the JPEG file from which the image data will be retrieved -* new_filename - the name of the new JPEG to create (can be same as old_filename) -* jpeg_header_data - a JPEG header data array in the same format -* as from get_jpeg_header_data -* -* Returns: TRUE - on Success -* FALSE - on Failure -* -******************************************************************************/ - -function put_jpeg_header_data( $old_filename, $new_filename, $jpeg_header_data ) -{ - - // Change: added check to ensure data exists, as of revision 1.10 - // Check if the data to be written exists - if ( $jpeg_header_data == FALSE ) - { - // Data to be written not valid - abort - return FALSE; - } - - // extract the compressed image data from the old file - $compressed_image_data = get_jpeg_image_data( $old_filename ); - - // Check if the extraction worked - if ( ( $compressed_image_data === FALSE ) || ( $compressed_image_data === NULL ) ) - { - // Couldn't get image data from old file - return FALSE; - } - - - // Cycle through new headers - foreach ($jpeg_header_data as $segno => $segment) - { - // Check that this header is smaller than the maximum size - if ( strlen($segment['SegData']) > 0xfffd ) - { - // Could't open the file - exit - echo "<p>A Header is too large to fit in JPEG segment</p>\n"; - return FALSE; - } - } - - ignore_user_abort(true); ## prevent refresh from aborting file operations and hosing file - - - // Attempt to open the new jpeg file - $newfilehnd = @fopen($new_filename, 'wb'); - // Check if the file opened successfully - if ( ! $newfilehnd ) - { - // Could't open the file - exit - echo "<p>Could not open file $new_filename</p>\n"; - return FALSE; - } - - // Write SOI - fwrite( $newfilehnd, "\xFF\xD8" ); - - // Cycle through new headers, writing them to the new file - foreach ($jpeg_header_data as $segno => $segment) - { - - // Write segment marker - fwrite( $newfilehnd, sprintf( "\xFF%c", $segment['SegType'] ) ); - - // Write segment size - fwrite( $newfilehnd, pack( "n", strlen($segment['SegData']) + 2 ) ); - - // Write segment data - fwrite( $newfilehnd, $segment['SegData'] ); - } - - // Write the compressed image data - fwrite( $newfilehnd, $compressed_image_data ); - - // Write EOI - fwrite( $newfilehnd, "\xFF\xD9" ); - - // Close File - fclose($newfilehnd); - - // Alow the user to abort from now on - ignore_user_abort(false); - - - return TRUE; - -} - -/****************************************************************************** -* End of Function: put_jpeg_header_data -******************************************************************************/ - - - -/****************************************************************************** -* -* Function: get_jpeg_Comment -* -* Description: Retreives the contents of the JPEG Comment (COM = 0xFFFE) segment if one -* exists -* -* Parameters: jpeg_header_data - the JPEG header data, as retrieved -* from the get_jpeg_header_data function -* -* Returns: string - Contents of the Comment segement -* FALSE - if the comment segment couldnt be found -* -******************************************************************************/ - -function get_jpeg_Comment( $jpeg_header_data ) -{ - //Cycle through the header segments until COM is found or we run out of segments - $i = 0; - while ( ( $i < count( $jpeg_header_data) ) && ( $jpeg_header_data[$i]['SegName'] != "COM" ) ) - { - $i++; - } - - // Check if a COM segment has been found - if ( $i < count( $jpeg_header_data) ) - { - // A COM segment was found, return it's contents - return $jpeg_header_data[$i]['SegData']; - } - else - { - // No COM segment found - return FALSE; - } -} - -/****************************************************************************** -* End of Function: get_jpeg_Comment -******************************************************************************/ - - -/****************************************************************************** -* -* Function: put_jpeg_Comment -* -* Description: Creates a new JPEG Comment segment from a string, and inserts -* this segment into the supplied JPEG header array -* -* Parameters: jpeg_header_data - a JPEG header data array in the same format -* as from get_jpeg_header_data, into which the -* new Comment segment will be put -* $new_Comment - a string containing the new Comment -* -* Returns: jpeg_header_data - the JPEG header data array with the new -* JPEG Comment segment added -* -******************************************************************************/ - -function put_jpeg_Comment( $jpeg_header_data, $new_Comment ) -{ - //Cycle through the header segments - for( $i = 0; $i < count( $jpeg_header_data ); $i++ ) - { - // If we find an COM header, - if ( strcmp ( $jpeg_header_data[$i]['SegName'], "COM" ) == 0 ) - { - // Found a preexisting Comment block - Replace it with the new one and return. - $jpeg_header_data[$i]['SegData'] = $new_Comment; - return $jpeg_header_data; - } - } - - - - // No preexisting Comment block found, find where to put it by searching for the highest app segment - $i = 0; - while ( ( $i < count( $jpeg_header_data ) ) && ( $jpeg_header_data[$i]["SegType"] >= 0xE0 ) ) - { - $i++; - } - - - // insert a Comment segment new at the position found of the header data. - array_splice($jpeg_header_data, $i , 0, array( array( "SegType" => 0xFE, - "SegName" => $GLOBALS[ "JPEG_Segment_Names" ][ 0xFE ], - "SegDesc" => $GLOBALS[ "JPEG_Segment_Descriptions" ][ 0xFE ], - "SegData" => $new_Comment ) ) ); - return $jpeg_header_data; -} - -/****************************************************************************** -* End of Function: put_jpeg_Comment -******************************************************************************/ - - - - -/****************************************************************************** -* -* Function: Interpret_Comment_to_HTML -* -* Description: Generates html showing the contents of any JPEG Comment segment -* -* Parameters: jpeg_header_data - the JPEG header data, as retrieved -* from the get_jpeg_header_data function -* -* Returns: output - the HTML -* -******************************************************************************/ - -function Interpret_Comment_to_HTML( $jpeg_header_data ) -{ - // Create a string to receive the output - $output = ""; - - // read the comment segment - $comment = get_jpeg_Comment( $jpeg_header_data ); - - // Check if the comment segment was valid - if ( $comment !== FALSE ) - { - // Comment exists - add it to the output - $output .= "<h2 class=\"JPEG_Comment_Main_Heading\">JPEG Comment</h2>\n"; - $output .= "<p class=\"JPEG_Comment_Text\">$comment</p>\n"; - } - - // Return the result - return $output; -} - -/****************************************************************************** -* End of Function: Interpret_Comment_to_HTML -******************************************************************************/ - - - - -/****************************************************************************** -* -* Function: get_jpeg_intrinsic_values -* -* Description: Retreives information about the intrinsic characteristics of the -* jpeg image, such as Bits per Component, Height and Width. -* -* Parameters: jpeg_header_data - the JPEG header data, as retrieved -* from the get_jpeg_header_data function -* -* Returns: array - An array containing the intrinsic JPEG values -* FALSE - if the comment segment couldnt be found -* -******************************************************************************/ - -function get_jpeg_intrinsic_values( $jpeg_header_data ) -{ - // Create a blank array for the output - $Outputarray = array( ); - - //Cycle through the header segments until Start Of Frame (SOF) is found or we run out of segments - $i = 0; - while ( ( $i < count( $jpeg_header_data) ) && ( substr( $jpeg_header_data[$i]['SegName'], 0, 3 ) != "SOF" ) ) - { - $i++; - } - - // Check if a SOF segment has been found - if ( substr( $jpeg_header_data[$i]['SegName'], 0, 3 ) == "SOF" ) - { - // SOF segment was found, extract the information - - $data = $jpeg_header_data[$i]['SegData']; - - // First byte is Bits per component - $Outputarray['Bits per Component'] = ord( $data{0} ); - - // Second and third bytes are Image Height - $Outputarray['Image Height'] = ord( $data{ 1 } ) * 256 + ord( $data{ 2 } ); - - // Forth and fifth bytes are Image Width - $Outputarray['Image Width'] = ord( $data{ 3 } ) * 256 + ord( $data{ 4 } ); - - // Sixth byte is number of components - $numcomponents = ord( $data{ 5 } ); - - // Following this is a table containing information about the components - for( $i = 0; $i < $numcomponents; $i++ ) - { - $Outputarray['Components'][] = array ( 'Component Identifier' => ord( $data{ 6 + $i * 3 } ), - 'Horizontal Sampling Factor' => ( ord( $data{ 7 + $i * 3 } ) & 0xF0 ) / 16, - 'Vertical Sampling Factor' => ( ord( $data{ 7 + $i * 3 } ) & 0x0F ), - 'Quantization table destination selector' => ord( $data{ 8 + $i * 3 } ) ); - } - } - else - { - // Couldn't find Start Of Frame segment, hence can't retrieve info - return FALSE; - } - - return $Outputarray; -} - - -/****************************************************************************** -* End of Function: get_jpeg_intrinsic_values -******************************************************************************/ - - - - - -/****************************************************************************** -* -* Function: Interpret_intrinsic_values_to_HTML -* -* Description: Generates html showing some of the intrinsic JPEG values which -* were retrieved with the get_jpeg_intrinsic_values function -* -* Parameters: values - the JPEG intrinsic values, as read from get_jpeg_intrinsic_values -* -* Returns: OutputStr - A string containing the HTML -* -******************************************************************************/ - -function Interpret_intrinsic_values_to_HTML( $values ) -{ - // Check values are valid - if ( $values != FALSE ) - { - // Write Heading - $OutputStr = "<h2 class=\"JPEG_Intrinsic_Main_Heading\">Intrinsic JPEG Information</h2>\n"; - - // Create Table - $OutputStr .= "<table class=\"JPEG_Intrinsic_Table\" border=1>\n"; - - // Put image height and width into table - $OutputStr .= "<tr class=\"JPEG_Intrinsic_Table_Row\"><td class=\"JPEG_Intrinsic_Caption_Cell\">Image Height</td><td class=\"JPEG_Intrinsic_Value_Cell\">" . $values['Image Height'] . " pixels</td></tr>\n"; - $OutputStr .= "<tr class=\"JPEG_Intrinsic_Table_Row\"><td class=\"JPEG_Intrinsic_Caption_Cell\">Image Width</td><td class=\"JPEG_Intrinsic_Value_Cell\">" . $values['Image Width'] . " pixels</td></tr>\n"; - - // Put colour depth into table - if ( count( $values['Components'] ) == 1 ) - { - $OutputStr .= "<tr class=\"JPEG_Intrinsic_Table_Row\"><td class=\"JPEG_Intrinsic_Caption_Cell\">Colour Depth</td><td class=\"JPEG_Intrinsic_Value_Cell\">" . $values['Bits per Component'] . " bit Monochrome</td></tr>\n"; - } - else - { - $OutputStr .= "<tr class=\"JPEG_Intrinsic_Table_Row\"><td class=\"JPEG_Intrinsic_Caption_Cell\">Colour Depth</td><td class=\"JPEG_Intrinsic_Value_Cell\">" . ($values['Bits per Component'] * count( $values['Components'] ) ) . " bit</td></tr>\n"; - } - - // Close Table - $OutputStr .= "</table>\n"; - - // Return html - return $OutputStr; - } -} - -/****************************************************************************** -* End of Function: Interpret_intrinsic_values_to_HTML -******************************************************************************/ - - - - - - - -/****************************************************************************** -* -* Function: get_jpeg_image_data -* -* Description: Retrieves the compressed image data part of the JPEG file -* -* Parameters: filename - the filename of the JPEG file to read -* -* Returns: compressed_data - A string containing the compressed data -* FALSE - if retrieval failed -* -******************************************************************************/ - -function get_jpeg_image_data( $filename ) -{ - - // prevent refresh from aborting file operations and hosing file - ignore_user_abort(true); - - // Attempt to open the jpeg file - $filehnd = @fopen($filename, 'rb'); - - // Check if the file opened successfully - if ( ! $filehnd ) - { - // Could't open the file - exit - return FALSE; - } - - - // Read the first two characters - $data = network_safe_fread( $filehnd, 2 ); - - // Check that the first two characters are 0xFF 0xDA (SOI - Start of image) - if ( $data != "\xFF\xD8" ) - { - // No SOI (FF D8) at start of file - close file and return; - fclose($filehnd); - return FALSE; - } - - - - // Read the third character - $data = network_safe_fread( $filehnd, 2 ); - - // Check that the third character is 0xFF (Start of first segment header) - if ( $data{0} != "\xFF" ) - { - // NO FF found - close file and return - fclose($filehnd); - return; - } - - // Flag that we havent yet hit the compressed image data - $hit_compressed_image_data = FALSE; - - - // Cycle through the file until, one of: 1) an EOI (End of image) marker is hit, - // 2) we have hit the compressed image data (no more headers are allowed after data) - // 3) or end of file is hit - - while ( ( $data{1} != "\xD9" ) && (! $hit_compressed_image_data) && ( ! feof( $filehnd ) )) - { - // Found a segment to look at. - // Check that the segment marker is not a Restart marker - restart markers don't have size or data after them - if ( ( ord($data{1}) < 0xD0 ) || ( ord($data{1}) > 0xD7 ) ) - { - // Segment isn't a Restart marker - // Read the next two bytes (size) - $sizestr = network_safe_fread( $filehnd, 2 ); - - // convert the size bytes to an integer - $decodedsize = unpack ("nsize", $sizestr); - - // Read the segment data with length indicated by the previously read size - $segdata = network_safe_fread( $filehnd, $decodedsize['size'] - 2 ); - } - - // If this is a SOS (Start Of Scan) segment, then there is no more header data - the compressed image data follows - if ( $data{1} == "\xDA" ) - { - // Flag that we have hit the compressed image data - exit loop after reading the data - $hit_compressed_image_data = TRUE; - - // read the rest of the file in - // Can't use the filesize function to work out - // how much to read, as it won't work for files being read by http or ftp - // So instead read 1Mb at a time till EOF - - $compressed_data = ""; - do - { - $compressed_data .= network_safe_fread( $filehnd, 1048576 ); - } while( ! feof( $filehnd ) ); - - // Strip off EOI and anything after - $EOI_pos = strpos( $compressed_data, "\xFF\xD9" ); - $compressed_data = substr( $compressed_data, 0, $EOI_pos ); - } - else - { - // Not an SOS - Read the next two bytes - should be the segment marker for the next segment - $data = network_safe_fread( $filehnd, 2 ); - - // Check that the first byte of the two is 0xFF as it should be for a marker - if ( $data{0} != "\xFF" ) - { - // Problem - NO FF foundclose file and return"; - fclose($filehnd); - return; - } - } - } - - // Close File - fclose($filehnd); - - // Alow the user to abort from now on - ignore_user_abort(false); - - - // Return the compressed data if it was found - if ( $hit_compressed_image_data ) - { - return $compressed_data; - } - else - { - return FALSE; - } -} - - -/****************************************************************************** -* End of Function: get_jpeg_image_data -******************************************************************************/ - - - - - - - -/****************************************************************************** -* -* Function: Generate_JPEG_APP_Segment_HTML -* -* Description: Generates html showing information about the Application (APP) -* segments which are present in the JPEG file -* -* Parameters: jpeg_header_data - the JPEG header data, as retrieved -* from the get_jpeg_header_data function -* -* Returns: output - A string containing the HTML -* -******************************************************************************/ - -function Generate_JPEG_APP_Segment_HTML( $jpeg_header_data ) -{ - if ( $jpeg_header_data == FALSE ) - { - return ""; - } - - - // Write Heading - $output = "<h2 class=\"JPEG_APP_Segments_Main_Heading\">Application Metadata Segments</h2>\n"; - - // Create table - $output .= "<table class=\"JPEG_APP_Segments_Table\" border=1>\n"; - - - // Cycle through each segment in the array - - foreach( $jpeg_header_data as $jpeg_header ) - { - - // Check if the segment is a APP segment - - if ( ( $jpeg_header['SegType'] >= 0xE0 ) && ( $jpeg_header['SegType'] <= 0xEF ) ) - { - // This is an APP segment - - // Read APP Segment Name - a Null terminated string at the start of the segment - $seg_name = strtok($jpeg_header['SegData'], "\x00"); - - // Some Segment names are either too long or not meaningfull, so - // we should clean them up - - if ( $seg_name == "http://ns.adobe.com/xap/1.0/" ) - { - $seg_name = "XAP/RDF (\"http://ns.adobe.com/xap/1.0/\")"; - } - elseif ( $seg_name == "Photoshop 3.0" ) - { - $seg_name = "Photoshop IRB (\"Photoshop 3.0\")"; - } - elseif ( ( strncmp ( $seg_name, "[picture info]", 14) == 0 ) || - ( strncmp ( $seg_name, "\x0a\x09\x09\x09\x09[picture info]", 19) == 0 ) ) - { - $seg_name = "[picture info]"; - } - elseif ( strncmp ( $seg_name, "Type=", 5) == 0 ) - { - $seg_name = "Epson Info"; - } - elseif ( ( strncmp ( $seg_name, "HHHHHHHHHHHHHHH", 15) == 0 ) || - ( strncmp ( $seg_name, "@s33", 5) == 0 ) ) - { - $seg_name = "HP segment full of \"HHHHH\""; - } - - - // Clean the segment name so it doesn't cause problems with HTML - $seg_name = htmlentities( $seg_name ); - - // Output a Table row containing this APP segment - $output .= "<tr class=\"JPEG_APP_Segments_Table_Row\"><td class=\"JPEG_APP_Segments_Caption_Cell\">$seg_name</td><td class=\"JPEG_APP_Segments_Type_Cell\">" . $jpeg_header['SegName'] . "</td><td class=\"JPEG_APP_Segments_Size_Cell\" align=\"right\">" . strlen( $jpeg_header['SegData']). " bytes</td></tr>\n"; - } - } - - // Close the table - $output .= "</table>\n"; - - // Return the HTML - return $output; -} - - -/****************************************************************************** -* End of Function: Generate_JPEG_APP_Segment_HTML -******************************************************************************/ - - - - -/****************************************************************************** -* -* Function: network_safe_fread -* -* Description: Retrieves data from a file. This function is required since -* the fread function will not always return the requested number -* of characters when reading from a network stream or pipe -* -* Parameters: file_handle - the handle of a file to read from -* length - the number of bytes requested -* -* Returns: data - the data read from the file. may be less than the number -* requested if EOF was hit -* -******************************************************************************/ - -function network_safe_fread( $file_handle, $length ) -{ - // Create blank string to receive data - $data = ""; - - // Keep reading data from the file until either EOF occurs or we have - // retrieved the requested number of bytes - - while ( ( !feof( $file_handle ) ) && ( strlen($data) < $length ) ) - { - $data .= fread( $file_handle, $length-strlen($data) ); - } - - // return the data read - return $data; -} - -/****************************************************************************** -* End of Function: network_safe_fread -******************************************************************************/ - - - - -/****************************************************************************** -* Global Variable: JPEG_Segment_Names -* -* Contents: The names of the JPEG segment markers, indexed by their marker number -* -******************************************************************************/ - -$GLOBALS[ "JPEG_Segment_Names" ] = array( - -0xC0 => "SOF0", 0xC1 => "SOF1", 0xC2 => "SOF2", 0xC3 => "SOF4", -0xC5 => "SOF5", 0xC6 => "SOF6", 0xC7 => "SOF7", 0xC8 => "JPG", -0xC9 => "SOF9", 0xCA => "SOF10", 0xCB => "SOF11", 0xCD => "SOF13", -0xCE => "SOF14", 0xCF => "SOF15", -0xC4 => "DHT", 0xCC => "DAC", - -0xD0 => "RST0", 0xD1 => "RST1", 0xD2 => "RST2", 0xD3 => "RST3", -0xD4 => "RST4", 0xD5 => "RST5", 0xD6 => "RST6", 0xD7 => "RST7", - -0xD8 => "SOI", 0xD9 => "EOI", 0xDA => "SOS", 0xDB => "DQT", -0xDC => "DNL", 0xDD => "DRI", 0xDE => "DHP", 0xDF => "EXP", - -0xE0 => "APP0", 0xE1 => "APP1", 0xE2 => "APP2", 0xE3 => "APP3", -0xE4 => "APP4", 0xE5 => "APP5", 0xE6 => "APP6", 0xE7 => "APP7", -0xE8 => "APP8", 0xE9 => "APP9", 0xEA => "APP10", 0xEB => "APP11", -0xEC => "APP12", 0xED => "APP13", 0xEE => "APP14", 0xEF => "APP15", - - -0xF0 => "JPG0", 0xF1 => "JPG1", 0xF2 => "JPG2", 0xF3 => "JPG3", -0xF4 => "JPG4", 0xF5 => "JPG5", 0xF6 => "JPG6", 0xF7 => "JPG7", -0xF8 => "JPG8", 0xF9 => "JPG9", 0xFA => "JPG10", 0xFB => "JPG11", -0xFC => "JPG12", 0xFD => "JPG13", - -0xFE => "COM", 0x01 => "TEM", 0x02 => "RES", - -); - -/****************************************************************************** -* End of Global Variable: JPEG_Segment_Names -******************************************************************************/ - - -/****************************************************************************** -* Global Variable: JPEG_Segment_Descriptions -* -* Contents: The descriptions of the JPEG segment markers, indexed by their marker number -* -******************************************************************************/ - -$GLOBALS[ "JPEG_Segment_Descriptions" ] = array( - -/* JIF Marker byte pairs in JPEG Interchange Format sequence */ -0xC0 => "Start Of Frame (SOF) Huffman - Baseline DCT", -0xC1 => "Start Of Frame (SOF) Huffman - Extended sequential DCT", -0xC2 => "Start Of Frame Huffman - Progressive DCT (SOF2)", -0xC3 => "Start Of Frame Huffman - Spatial (sequential) lossless (SOF3)", -0xC5 => "Start Of Frame Huffman - Differential sequential DCT (SOF5)", -0xC6 => "Start Of Frame Huffman - Differential progressive DCT (SOF6)", -0xC7 => "Start Of Frame Huffman - Differential spatial (SOF7)", -0xC8 => "Start Of Frame Arithmetic - Reserved for JPEG extensions (JPG)", -0xC9 => "Start Of Frame Arithmetic - Extended sequential DCT (SOF9)", -0xCA => "Start Of Frame Arithmetic - Progressive DCT (SOF10)", -0xCB => "Start Of Frame Arithmetic - Spatial (sequential) lossless (SOF11)", -0xCD => "Start Of Frame Arithmetic - Differential sequential DCT (SOF13)", -0xCE => "Start Of Frame Arithmetic - Differential progressive DCT (SOF14)", -0xCF => "Start Of Frame Arithmetic - Differential spatial (SOF15)", -0xC4 => "Define Huffman Table(s) (DHT)", -0xCC => "Define Arithmetic coding conditioning(s) (DAC)", - -0xD0 => "Restart with modulo 8 count 0 (RST0)", -0xD1 => "Restart with modulo 8 count 1 (RST1)", -0xD2 => "Restart with modulo 8 count 2 (RST2)", -0xD3 => "Restart with modulo 8 count 3 (RST3)", -0xD4 => "Restart with modulo 8 count 4 (RST4)", -0xD5 => "Restart with modulo 8 count 5 (RST5)", -0xD6 => "Restart with modulo 8 count 6 (RST6)", -0xD7 => "Restart with modulo 8 count 7 (RST7)", - -0xD8 => "Start of Image (SOI)", -0xD9 => "End of Image (EOI)", -0xDA => "Start of Scan (SOS)", -0xDB => "Define quantization Table(s) (DQT)", -0xDC => "Define Number of Lines (DNL)", -0xDD => "Define Restart Interval (DRI)", -0xDE => "Define Hierarchical progression (DHP)", -0xDF => "Expand Reference Component(s) (EXP)", - -0xE0 => "Application Field 0 (APP0) - usually JFIF or JFXX", -0xE1 => "Application Field 1 (APP1) - usually EXIF or XMP/RDF", -0xE2 => "Application Field 2 (APP2) - usually Flashpix", -0xE3 => "Application Field 3 (APP3)", -0xE4 => "Application Field 4 (APP4)", -0xE5 => "Application Field 5 (APP5)", -0xE6 => "Application Field 6 (APP6)", -0xE7 => "Application Field 7 (APP7)", - -0xE8 => "Application Field 8 (APP8)", -0xE9 => "Application Field 9 (APP9)", -0xEA => "Application Field 10 (APP10)", -0xEB => "Application Field 11 (APP11)", -0xEC => "Application Field 12 (APP12) - usually [picture info]", -0xED => "Application Field 13 (APP13) - usually photoshop IRB / IPTC", -0xEE => "Application Field 14 (APP14)", -0xEF => "Application Field 15 (APP15)", - - -0xF0 => "Reserved for JPEG extensions (JPG0)", -0xF1 => "Reserved for JPEG extensions (JPG1)", -0xF2 => "Reserved for JPEG extensions (JPG2)", -0xF3 => "Reserved for JPEG extensions (JPG3)", -0xF4 => "Reserved for JPEG extensions (JPG4)", -0xF5 => "Reserved for JPEG extensions (JPG5)", -0xF6 => "Reserved for JPEG extensions (JPG6)", -0xF7 => "Reserved for JPEG extensions (JPG7)", -0xF8 => "Reserved for JPEG extensions (JPG8)", -0xF9 => "Reserved for JPEG extensions (JPG9)", -0xFA => "Reserved for JPEG extensions (JPG10)", -0xFB => "Reserved for JPEG extensions (JPG11)", -0xFC => "Reserved for JPEG extensions (JPG12)", -0xFD => "Reserved for JPEG extensions (JPG13)", - -0xFE => "Comment (COM)", -0x01 => "For temp private use arith code (TEM)", -0x02 => "Reserved (RES)", - -); - -/****************************************************************************** -* End of Global Variable: JPEG_Segment_Descriptions -******************************************************************************/ - - - +<?php + +/****************************************************************************** +* +* Filename: JPEG.php +* +* Description: Provides functions for reading and writing information to/from +* JPEG format files +* +* Author: Evan Hunter +* +* Date: 23/7/2004 +* +* Project: PHP JPEG Metadata Toolkit +* +* Revision: 1.10 +* +* Changes: 1.00 -> 1.10 : changed put_jpeg_header_data to check if the data +* being written exists +* +* URL: http://electronics.ozhiker.com +* +* Copyright: Copyright Evan Hunter 2004 +* +* License: This file is part of the PHP JPEG Metadata Toolkit. +* +* The PHP JPEG Metadata Toolkit 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. +* +* The PHP JPEG Metadata Toolkit 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 the PHP JPEG Metadata Toolkit; if not, +* write to the Free Software Foundation, Inc., 59 Temple +* Place, Suite 330, Boston, MA 02111-1307 USA +* +* If you require a different license for commercial or other +* purposes, please contact the author: ev...@oz... +* +******************************************************************************/ + + + + +/****************************************************************************** +* +* Function: get_jpeg_header_data +* +* Description: Reads all the JPEG header segments from an JPEG image file into an +* array +* +* Parameters: filename - the filename of the file to JPEG file to read +* +* Returns: headerdata - Array of JPEG header segments +* FALSE - if headers could not be read +* +******************************************************************************/ + +function get_jpeg_header_data( $filename ) +{ + + // prevent refresh from aborting file operations and hosing file + ignore_user_abort(true); + + + // Attempt to open the jpeg file - the at symbol supresses the error message about + // not being able to open files. The file_exists would have been used, but it + // does not work with files fetched over http or ftp. + $filehnd = @fopen($filename, 'rb'); + + // Check if the file opened successfully + if ( ! $filehnd ) + { + // Could't open the file - exit + echo "<p>Could not open file $filename</p>\n"; + return FALSE; + } + + + // Read the first two characters + $data = network_safe_fread( $filehnd, 2 ); + + // Check that the first two characters are 0xFF 0xDA (SOI - Start of image) + if ( $data != "\xFF\xD8" ) + { + // No SOI (FF D8) at start of file - This probably isn't a JPEG file - close file and return; + //echo "<p>This probably is not a JPEG file</p>\n"; + fclose($filehnd); + return FALSE; + } + + + // Read the third character + $data = network_safe_fread( $filehnd, 2 ); + + // Check that the third character is 0xFF (Start of first segment header) + if ( $data{0} != "\xFF" ) + { + // NO FF found - close file and return - JPEG is probably corrupted + fclose($filehnd); + return FALSE; + } + + // Flag that we havent yet hit the compressed image data + $hit_compressed_image_data = FALSE; + + + // Cycle through the file until, one of: 1) an EOI (End of image) marker is hit, + // 2) we have hit the compressed image data (no more headers are allowed after data) + // 3) or end of file is hit + + while ( ( $data{1} != "\xD9" ) && (! $hit_compressed_image_data) && ( ! feof( $filehnd ) )) + { + // Found a segment to look at. + // Check that the segment marker is not a Restart marker - restart markers don't have size or data after them + if ( ( ord($data{1}) < 0xD0 ) || ( ord($data{1}) > 0xD7 ) ) + { + // Segment isn't a Restart marker + // Read the next two bytes (size) + $sizestr = network_safe_fread( $filehnd, 2 ); + + // convert the size bytes to an integer + $decodedsize = unpack ("nsize", $sizestr); + + // Save the start position of the data + $segdatastart = ftell( $filehnd ); + + // Read the segment data with length indicated by the previously read size + $segdata = network_safe_fread( $filehnd, $decodedsize['size'] - 2 ); + + + // Store the segment information in the output array + $headerdata[] = array( "SegType" => ord($data{1}), + "SegName" => $GLOBALS[ "JPEG_Segment_Names" ][ ord($data{1}) ], + "SegDesc" => $GLOBALS[ "JPEG_Segment_Descriptions" ][ ord($data{1}) ], + "SegDataStart" => $segdatastart, + "SegData" => $segdata ); + } + + // If this is a SOS (Start Of Scan) segment, then there is no more header data - the compressed image data follows + if ( $data{1} == "\xDA" ) + { + // Flag that we have hit the compressed image data - exit loop as no more headers available. + $hit_compressed_image_data = TRUE; + } + else + { + // Not an SOS - Read the next two bytes - should be the segment marker for the next segment + $data = network_safe_fread( $filehnd, 2 ); + + // Check that the first byte of the two is 0xFF as it should be for a marker + if ( $data{0} != "\xFF" ) + { + // NO FF found - close file and return - JPEG is probably corrupted + fclose($filehnd); + return FALSE; + } + } + } + + // Close File + fclose($filehnd); + // Alow the user to abort from now on + ignore_user_abort(false); + + // Return the header data retrieved + return $headerdata; +} + + +/****************************************************************************** +* End of Function: get_jpeg_header_data +******************************************************************************/ + + + + +/****************************************************************************** +* +* Function: put_jpeg_header_data +* +* Description: Writes JPEG header data into a JPEG file. Takes an array in the +* same format as from get_jpeg_header_data, and combines it with +* the image data of an existing JPEG file, to create a new JPEG file +* WARNING: As this function will replace all JPEG headers, +* including SOF etc, it is best to read the jpeg headers +* from a file, alter them, then put them back on the same +* file. If a SOF segment wer to be transfered from one +* file to another, the image could become unreadable unless +* the images were idenical size and configuration +* +* +* Parameters: old_filename - the JPEG file from which the image data will be retrieved +* new_filename - the name of the new JPEG to create (can be same as old_filename) +* jpeg_header_data - a JPEG header data array in the same format +* as from get_jpeg_header_data +* +* Returns: TRUE - on Success +* FALSE - on Failure +* +******************************************************************************/ + +function put_jpeg_header_data( $old_filename, $new_filename, $jpeg_header_data ) +{ + + // Change: added check to ensure data exists, as of revision 1.10 + // Check if the data to be written exists + if ( $jpeg_header_data == FALSE ) + { + // Data to be written not valid - abort + return FALSE; + } + + // extract the compressed image data from the old file + $compressed_image_data = get_jpeg_image_data( $old_filename ); + + // Check if the extraction worked + if ( ( $compressed_image_data === FALSE ) || ( $compressed_image_data === NULL ) ) + { + // Couldn't get image data from old file + return FALSE; + } + + + // Cycle through new headers + foreach ($jpeg_header_data as $segno => $segment) + { + // Check that this header is smaller than the maximum size + if ( strlen($segment['SegData']) > 0xfffd ) + { + // Could't open the file - exit + echo "<p>A Header is too large to fit in JPEG segment</p>\n"; + return FALSE; + } + } + + ignore_user_abort(true); ## prevent refresh from aborting file operations and hosing file + + + // Attempt to open the new jpeg file + $newfilehnd = @fopen($new_filename, 'wb'); + // Check if the file opened successfully + if ( ! $newfilehnd ) + { + // Could't open the file - exit + echo "<p>Could not open file $new_filename</p>\n"; + return FALSE; + } + + // Write SOI + fwrite( $newfilehnd, "\xFF\xD8" ); + + // Cycle through new headers, writing them to the new file + foreach ($jpeg_header_data as $segno => $segment) + { + + // Write segment marker + fwrite( $newfilehnd, sprintf( "\xFF%c", $segment['SegType'] ) ); + + // Write segment size + fwrite( $newfilehnd, pack( "n", strlen($segment['SegData']) + 2 ) ); + + // Write segment data + fwrite( $newfilehnd, $segment['SegData'] ); + } + + // Write the compressed image data + fwrite( $newfilehnd, $compressed_image_data ); + + // Write EOI + fwrite( $newfilehnd, "\xFF\xD9" ); + + // Close File + fclose($newfilehnd); + + // Alow the user to abort from now on + ignore_user_abort(false); + + + return TRUE; + +} + +/****************************************************************************** +* End of Function: put_jpeg_header_data +******************************************************************************/ + + + +/****************************************************************************** +* +* Function: get_jpeg_Comment +* +* Description: Retreives the contents of the JPEG Comment (COM = 0xFFFE) segment if one +* exists +* +* Parameters: jpeg_header_data - the JPEG header data, as retrieved +* from the get_jpeg_header_data function +* +* Returns: string - Contents of the Comment segement +* FALSE - if the comment segment couldnt be found +* +******************************************************************************/ + +function get_jpeg_Comment( $jpeg_header_data ) +{ + //Cycle through the header segments until COM is found or we run out of segments + $i = 0; + while ( ( $i < count( $jpeg_header_data) ) && ( $jpeg_header_data[$i]['SegName'] != "COM" ) ) + { + $i++; + } + + // Check if a COM segment has been found + if ( $i < count( $jpeg_header_data) ) + { + // A COM segment was found, return it's contents + return $jpeg_header_data[$i]['SegData']; + } + else + { + // No COM segment found + return FALSE; + } +} + +/****************************************************************************** +* End of Function: get_jpeg_Comment +******************************************************************************/ + + +/****************************************************************************** +* +* Function: put_jpeg_Comment +* +* Description: Creates a new JPEG Comment segment from a string, and inserts +* this segment into the supplied JPEG header array +* +* Parameters: jpeg_header_data - a JPEG header data array in the same format +* as from get_jpeg_header_data, into which the +* new Comment segment will be put +* $new_Comment - a string containing the new Comment +* +* Returns: jpeg_header_data - the JPEG header data array with the new +* JPEG Comment segment added +* +******************************************************************************/ + +function put_jpeg_Comment( $jpeg_header_data, $new_Comment ) +{ + //Cycle through the header segments + for( $i = 0; $i < count( $jpeg_header_data ); $i++ ) + { + // If we find an COM header, + if ( strcmp ( $jpeg_header_data[$i]['SegName'], "COM" ) == 0 ) + { + // Found a preexisting Comment block - Replace it with the new one and return. + $jpeg_header_data[$i]['SegData'] = $new_Comment; + return $jpeg_header_data; + } + } + + + + // No preexisting Comment block found, find where to put it by searching for the highest app segment + $i = 0; + while ( ( $i < count( $jpeg_header_data ) ) && ( $jpeg_header_data[$i]["SegType"] >= 0xE0 ) ) + { + $i++; + } + + + // insert a Comment segment new at the position found of the header data. + array_splice($jpeg_header_data, $i , 0, array( array( "SegType" => 0xFE, + "SegName" => $GLOBALS[ "JPEG_Segment_Names" ][ 0xFE ], + "SegDesc" => $GLOBALS[ "JPEG_Segment_Descriptions" ][ 0xFE ], + "SegData" => $new_Comment ) ) ); + return $jpeg_header_data; +} + +/****************************************************************************** +* End of Function: put_jpeg_Comment +******************************************************************************/ + + + + +/****************************************************************************** +* +* Function: Interpret_Comment_to_HTML +* +* Description: Generates html showing the contents of any JPEG Comment segment +* +* Parameters: jpeg_header_data - the JPEG header data, as retrieved +* from the get_jpeg_header_data function +* +* Returns: output - the HTML +* +******************************************************************************/ + +function Interpret_Comment_to_HTML( $jpeg_header_data ) +{ + // Create a string to receive the output + $output = ""; + + // read the comment segment + $comment = get_jpeg_Comment( $jpeg_header_data ); + + // Check if the comment segment was valid + if ( $comment !== FALSE ) + { + // Comment exists - add it to the output + $output .= "<h2 class=\"JPEG_Comment_Main_Heading\">JPEG Comment</h2>\n"; + $output .= "<p class=\"JPEG_Comment_Text\">$comment</p>\n"; + } + + // Return the result + return $output; +} + +/****************************************************************************** +* End of Function: Interpret_Comment_to_HTML +******************************************************************************/ + + + + +/****************************************************************************** +* +* Function: get_jpeg_intrinsic_values +* +* Description: Retreives information about the intrinsic characteristics of the +* jpeg image, such as Bits per Component, Height and Width. +* +* Parameters: jpeg_header_data - the JPEG header data, as retrieved +* from the get_jpeg_header_data function +* +* Returns: array - An array containing the intrinsic JPEG values +* FALSE - if the comment segment couldnt be found +* +******************************************************************************/ + +function get_jpeg_intrinsic_values( $jpeg_header_data ) +{ + // Create a blank array for the output + $Outputarray = array( ); + + //Cycle through the header segments until Start Of Frame (SOF) is found or we run out of segments + $i = 0; + while ( ( $i < count( $jpeg_header_data) ) && ( substr( $jpeg_header_data[$i]['SegName'], 0, 3 ) != "SOF" ) ) + { + $i++; + } + + // Check if a SOF segment has been found + if ( substr( $jpeg_header_data[$i]['SegName'], 0, 3 ) == "SOF" ) + { + // SOF segment was found, extract the information + + $data = $jpeg_header_data[$i]['SegData']; + + // First byte is Bits per component + $Outputarray['Bits per Component'] = ord( $data{0} ); + + // Second and third bytes are Image Height + $Outputarray['Image Height'] = ord( $data{ 1 } ) * 256 + ord( $data{ 2 } ); + + // Forth and fifth bytes are Image Width + $Outputarray['Image Width'] = ord( $data{ 3 } ) * 256 + ord( $data{ 4 } ); + + // Sixth byte is number of components + $numcomponents = ord( $data{ 5 } ); + + // Following this is a table containing information about the components + ... [truncated message content] |
From: <bz...@us...> - 2007-07-10 19:16:41
|
Revision: 4737 http://svn.sourceforge.net/linpha/?rev=4737&view=rev Author: bzrudi Date: 2007-07-10 12:16:37 -0700 (Tue, 10 Jul 2007) Log Message: ----------- Make use of exiftool for video width and height. As getID3 often fails it seems to be no problem. So getid3 is to be removed Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/step11_finish.php trunk/linpha2/install/step2_requirements.php trunk/linpha2/install/step3_dbtype.php trunk/linpha2/lib/classes/linpha.exiftool.class.php trunk/linpha2/lib/modules/module.video.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/ChangeLog 2007-07-10 19:16:37 UTC (rev 4737) @@ -1,3 +1,8 @@ +2007-07-10 bzrudi + * Make use exiftool for video information, so we can remove getid3 completely. + I don't like to keep it just to get width and height. + * TODO: save width and height during video import, it's currently missing! + 2007-07-06 bzrudi * Bumped Exiftool to latest stable 6.90 (windows bin 6.92) * Make use of http_build_query() whenever we have more than three args! Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/index.php 2007-07-10 19:16:37 UTC (rev 4737) @@ -70,6 +70,9 @@ case 'empty': require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); break; +default: + require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); + break; } -?> \ No newline at end of file +?> Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/install/sql/sql.data.php 2007-07-10 19:16:37 UTC (rev 4737) @@ -38,6 +38,7 @@ 'sys_import_exif_autorot' => '1', 'sys_import_use_exiftool' => '0', 'sys_import_use_emb_thumb' => '0', + 'sys_import_exiftool_avail' => '0', 'sys_import_files_ignored' => 'Thumbs.db,ZbThumbnail.info,_vti_cnf,_derived,Picasa.ini,Cdlabel.alb', 'sys_import_fileext_ignored' => 'thm,doc,txt', Modified: trunk/linpha2/install/step11_finish.php =================================================================== --- trunk/linpha2/install/step11_finish.php 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/install/step11_finish.php 2007-07-10 19:16:37 UTC (rev 4737) @@ -136,9 +136,24 @@ } } } + +/** + * exiftool available value + */ + +if(isset($_POST['sys_import_exiftool_avail'])) +{ + $result = $linpha->db->Execute("UPDATE ".LIN_PREFIX."config " . + "SET option_value = '".LinSql::linAddslashes($_POST['sys_import_exiftool_avail'])."' " . + "WHERE option_name = 'sys_import_exiftool_avail'"); + if(!$result) + { + echo failed_msg(); + $error_nr = 1; + } +} - if(isset($error_nr)) { echo "</form>"; Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/install/step2_requirements.php 2007-07-10 19:16:37 UTC (rev 4737) @@ -226,7 +226,14 @@ } echo "\t".'<input type="hidden" name="sys_import_has_perl" value="'.$perl_ok.'">'."\n"; - // @TODO make perl path avail in config + + /** + * even if user decided to not make use of exiftool, we set + * sys_import_exiftool_avail = true , as we need it for video infos later + */ + echo "\t".'<input type="hidden" name="sys_import_exiftool_avail" value="'.$perl_ok.'">'; + + // @TODO make perl path avail in config //echo "\t".'<input type="hidden" name="sys_import_perl_path" value="'.$perl_path.'">'."\n"; } /** Modified: trunk/linpha2/install/step3_dbtype.php =================================================================== --- trunk/linpha2/install/step3_dbtype.php 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/install/step3_dbtype.php 2007-07-10 19:16:37 UTC (rev 4737) @@ -34,7 +34,12 @@ $_SESSION['language'] = $_POST['language']; } -$array = array('sys_im_bracket_support','sys_im_use_convert','sys_im_convert_path','sys_import_has_perl'); +$array = array('sys_im_bracket_support', + 'sys_im_use_convert', + 'sys_im_convert_path', + 'sys_import_has_perl', + 'sys_import_exiftool_avail'); + foreach($array AS $value) { if(isset($_POST[$value])) Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2007-07-10 19:16:37 UTC (rev 4737) @@ -125,10 +125,11 @@ LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $meta, $return); - /*echo $this->exiftool.' '.$parameters.' "'.$filename.'"'; + /* + echo $this->exiftool.' '.$parameters.' "'.$filename.'"'; echo '<pre>', print_r($meta), '</pre>'; - exit();*/ - + exit(); + */ /** * Create usable array information by cycling and splitting * all information Modified: trunk/linpha2/lib/modules/module.video.php =================================================================== --- trunk/linpha2/lib/modules/module.video.php 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/lib/modules/module.video.php 2007-07-10 19:16:37 UTC (rev 4737) @@ -1,227 +1,236 @@ -<?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. - */ - -/** - * Video - * @package Modules - * @todo use unified error messages - */ -if(!defined('LINPHA_DIR')) { exit(1); } - -if( $linpha->template->idCurrent == 0 ) -{ - echo i18n("No valid id supplied!"); - exit(1); -} - -$fullfilename = LinSql::getFullImagePath($linpha->template->idCurrent); - -/** - * check for valid filename - */ -if( $fullfilename === FALSE OR !file_exists($fullfilename) ) -{ - echo i18n("No valid id supplied!"); - exit(1); -} - -/** - * get file informations - */ -$data = $GLOBALS['linpha']->db->GetRow("SELECT img_type FROM ".LIN_PREFIX."photos " . - "WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); - -$img_type = $data['img_type']; -$filename = basename($fullfilename); - - -/** - * check file permissions - */ -if( !LinSql::photoIsAllowed( $linpha->template->idCurrent, 'read' ) ) -{ - echo i18n("No permission!"); - linLog(LOG_TYPE_BASKET, LOG_ERR, 'accessdenied', 'No permission to access the file '.$linpha->template->idCurrent); - exit(1); -} - -if( !LinIdentify::isVideo($img_type) ) -{ - echo i18n("This is not a video!"); - exit(1); -} - -/** - * statistics - * count video views - */ - /** - * @todo - $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . - "SET stats_downloads = stats_downloads + 1 WHERE md5sum='".$md5sum."'"); - - include_once(TOP_DIR.'/plugins/stats/stats.class.php'); - linStats('download',$md5sum); - */ - -/** - * get width and height of video - */ - include_once(LINPHA_DIR.'/lib/classes/getid3/getid3.php'); - define('GETID3_HELPERAPPSDIR', LINPHA_DIR); // needs to be set to a valid dir, otherwise it doesn't work under windows - $getID3 = new getID3; - $file_info = $getID3->analyze($fullfilename); - - if( isset($file_info['video']['resolution_x']) AND $file_info['video']['resolution_x'] != 0) - { - $file_width = $file_info['video']['resolution_x']; - } - - if( isset($file_info['video']['resolution_y']) AND $file_info['video']['resolution_y'] != 0) - { - $file_height = $file_info['video']['resolution_y']; - } - - - - - -ob_start(); - - /* - http://www.public.iastate.edu/~rdalhoff/embedvideo.html - - Real Video - <OBJECT CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" - HEIGHT="160" WIDTH="220"> - <PARAM NAME="SRC" - VALUE="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm"> - <PARAM NAME="CONTROLS" VALUE="ImageWindow"> - <PARAM NAME="CONSOLE" VALUE="video1"> - <embed src="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm?embed" - width="220" height="160" controls="ImageWindow" - nojava="true" center="true" console="Carol1"> - </embed> - </OBJECT> - <br> - <OBJECT CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" - HEIGHT="100" WIDTH="220"> - <PARAM NAME="SRC" VALUE="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm"> - <PARAM NAME="CONTROLS" VALUE="all"> - <PARAM NAME="CONSOLE" VALUE="video1"> - <embed src="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm?embed" - width="220" height="100" nojava="true" controls="All" console="Carol1"> - - </embed> - </OBJECT> - - Quicktime - <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" - codebase="http://www.apple.com/qtactivex/qtplugin.cab" - width="240" height="180"> - <param name="src" value="carol6-ref.mov"> - <param name="loop" value="false"> - <param name="autoplay" value="false"> - <param name="controller" value="true"> - <embed - height="180" - width="240" - src="carol6-ref.mov" - name="Get QuickTime" - loop="false" - cache="true" - controller="true" autoplay="false" - pluginspage="http://www.apple.com/quicktime/download/"> - </embed> - </object> - - - Old Linpha1 (quicktime) - <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="<?php echo $this->stage_height; ?>" width="<?php echo $this->stage_width; ?>"> - <param name="bgcolor" value="#a3a3a3"> - <param name="src" value="<?php echo TOP_DIR."/actions/file_download.php?imgid=".$_GET['imgid']; ?>"> - <param name="autoplay" value="false"> - <param name="controller" value="true"> - <embed - height="<?php echo $this->stage_height; ?>" - width="<?php echo $this->stage_width; ?>" - pluginspage="http://www.apple.com/quicktime/download/" - src="<?php echo TOP_DIR."/actions/file_download.php?imgid=".$_GET['imgid']; ?>" - type="video/quicktime" - controller="true" - autoplay="false"> - </object> - - New Linpha1 (mediaplayer, new version can also play quicktime files) - <embed type="application/x-mplayer2" - src="<?php echo TOP_DIR."/actions/file_download.php?imgid=".$_GET['imgid']."&ignore=true"; ?>" - width="<?php echo $this->stage_width; ?>" - height="<?php echo ($this->stage_height + 45); ?>" - transparentatstart="true" - autostart="true" - animationatstart="true" - showcontrols="true" - showaudiocontrols="true" - showpositioncontrols="true" - autosize="false" - showstatusbar="true" - displaysize="true" - hspace="4"> - </embed> - - Somewhere found (does not work in firefox unless we add type="application/x-mplayer2") - <embed - src="7.wmv" - width=400 - height=369 - autoplay=true - controller=true - loop=false - showstatusbar=true> - </embed> - */ -?> -<div style="text-align: center;"> - <h2 class="linStyle"><?php - $array_path = LinSql::getFullFilenameFromId( $linpha->template->idCurrent ); - echo implode(' / ',$array_path); - ?></h3> - <embed type="application/x-mplayer2" src="<?php echo LINPHA_LINK.'linCat=download&linId='.$linpha->template->idCurrent; ?>" - width="<?php echo $file_width; ?>" height="<?php echo ($file_height+45); ?>" - autoplay="true" controller="true" loop="false" showstatusbar="false"> - </embed> - <br /> - <a href="javascript:window.close()"><?php echo i18n("Close"); ?></a> - <?php - echo '<a href="'.LINPHA_LINK.'&linCat=download&linId='.$linpha->template->idCurrent.'&isDownload=true">'.i18n("Download").'</a>'; - ?> -</div> - -<?php -$linpha->template->output['default'] = ob_get_clean(); - -$linpha->template->setModuleName('default'); -//$linpha->template->overrideModule('css','filemanager'); -$linpha->template->URL_full = LINPHA_LINK.'&linCat=video&linId='.$linpha->template->idCurrent; -$linpha->template->hideMenu = true; -$linpha->template->hideTitle = true; -$linpha->template->output['title'] = i18n("Video"); -include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); -?> +<?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. + */ + +/** + * Video + * @package Modules + * @todo use unified error messages + */ +if(!defined('LINPHA_DIR')) { exit(1); } + +if( $linpha->template->idCurrent == 0 ) +{ + echo i18n("No valid id supplied!"); + exit(1); +} + +$fullfilename = LinSql::getFullImagePath($linpha->template->idCurrent); + +/** + * check for valid filename + */ +if( $fullfilename === FALSE OR !file_exists($fullfilename) ) +{ + echo i18n("No valid id supplied!"); + exit(1); +} + +/** + * get file informations + */ +$data = $GLOBALS['linpha']->db->GetRow("SELECT img_type FROM ".LIN_PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); + +$img_type = $data['img_type']; +$filename = basename($fullfilename); + + +/** + * check file permissions + */ +if( !LinSql::photoIsAllowed( $linpha->template->idCurrent, 'read' ) ) +{ + echo i18n("No permission!"); + linLog(LOG_TYPE_BASKET, LOG_ERR, 'accessdenied', 'No permission to access the file '.$linpha->template->idCurrent); + exit(1); +} + +if( !LinIdentify::isVideo($img_type) ) +{ + echo i18n("This is not a video!"); + exit(1); +} + +/** + * statistics + * count video views + */ + /** + * @todo + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . + "SET stats_downloads = stats_downloads + 1 WHERE md5sum='".$md5sum."'"); + + include_once(TOP_DIR.'/plugins/stats/stats.class.php'); + linStats('download',$md5sum); + */ + +/** + * get width and height of video + */ +if($GLOBALS['linpha']->sql->config->value['sys_import_exiftool_avail']) +{ + include_once(LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'); + + $exiftool = new LinExifTool; + + $file_info = $exiftool->readMetaDataFromFile("all",$fullfilename); + + if( isset($file_info['ImageWidth']) AND $file_info['ImageWidth'] != 0) + { + $file_width = $file_info['ImageWidth']; + } + + if( isset($file_info['ImageHeight']) AND $file_info['ImageHeight'] != 0) + { + $file_height = $file_info['ImageHeight']; + } +} +else +{ + /** + * Just Hardcode width and height if exiftool not avail, + * better than no result and should work. + */ + $file_width = "320"; + $file_height = "240"; +} + +ob_start(); + + /* + http://www.public.iastate.edu/~rdalhoff/embedvideo.html + + Real Video + <OBJECT CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" + HEIGHT="160" WIDTH="220"> + <PARAM NAME="SRC" + VALUE="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm"> + <PARAM NAME="CONTROLS" VALUE="ImageWindow"> + <PARAM NAME="CONSOLE" VALUE="video1"> + <embed src="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm?embed" + width="220" height="160" controls="ImageWindow" + nojava="true" center="true" console="Carol1"> + </embed> + </OBJECT> + <br> + <OBJECT CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" + HEIGHT="100" WIDTH="220"> + <PARAM NAME="SRC" VALUE="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm"> + <PARAM NAME="CONTROLS" VALUE="all"> + <PARAM NAME="CONSOLE" VALUE="video1"> + <embed src="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm?embed" + width="220" height="100" nojava="true" controls="All" console="Carol1"> + + </embed> + </OBJECT> + + Quicktime + <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" + codebase="http://www.apple.com/qtactivex/qtplugin.cab" + width="240" height="180"> + <param name="src" value="carol6-ref.mov"> + <param name="loop" value="false"> + <param name="autoplay" value="false"> + <param name="controller" value="true"> + <embed + height="180" + width="240" + src="carol6-ref.mov" + name="Get QuickTime" + loop="false" + cache="true" + controller="true" autoplay="false" + pluginspage="http://www.apple.com/quicktime/download/"> + </embed> + </object> + + + Old Linpha1 (quicktime) + <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="<?php echo $this->stage_height; ?>" width="<?php echo $this->stage_width; ?>"> + <param name="bgcolor" value="#a3a3a3"> + <param name="src" value="<?php echo TOP_DIR."/actions/file_download.php?imgid=".$_GET['imgid']; ?>"> + <param name="autoplay" value="false"> + <param name="controller" value="true"> + <embed + height="<?php echo $this->stage_height; ?>" + width="<?php echo $this->stage_width; ?>" + pluginspage="http://www.apple.com/quicktime/download/" + src="<?php echo TOP_DIR."/actions/file_download.php?imgid=".$_GET['imgid']; ?>" + type="video/quicktime" + controller="true" + autoplay="false"> + </object> + + New Linpha1 (mediaplayer, new version can also play quicktime files) + <embed type="application/x-mplayer2" + src="<?php echo TOP_DIR."/actions/file_download.php?imgid=".$_GET['imgid']."&ignore=true"; ?>" + width="<?php echo $this->stage_width; ?>" + height="<?php echo ($this->stage_height + 45); ?>" + transparentatstart="true" + autostart="true" + animationatstart="true" + showcontrols="true" + showaudiocontrols="true" + showpositioncontrols="true" + autosize="false" + showstatusbar="true" + displaysize="true" + hspace="4"> + </embed> + + Somewhere found (does not work in firefox unless we add type="application/x-mplayer2") + <embed + src="7.wmv" + width=400 + height=369 + autoplay=true + controller=true + loop=false + showstatusbar=true> + </embed> + */ +?> +<div style="text-align: center;"> + <h2 class="linStyle"><?php + $array_path = LinSql::getFullFilenameFromId( $linpha->template->idCurrent ); + echo implode(' / ',$array_path); + ?></h2> + <embed type="application/x-mplayer2" src="<?php echo LINPHA_LINK.'linCat=download&linId='.$linpha->template->idCurrent; ?>" + width="<?php echo $file_width; ?>" height="<?php echo ($file_height+45); ?>" + autoplay="true" controller="true" loop="false" showstatusbar="false"> + </embed> + <br /> + <a href="javascript:window.close()"><?php echo i18n("Close"); ?></a> + <?php + echo '<a href="'.LINPHA_LINK.'&linCat=download&linId='.$linpha->template->idCurrent.'&isDownload=true">'.i18n("Download").'</a>'; + ?> +</div> + +<?php +$linpha->template->output['default'] = ob_get_clean(); + +$linpha->template->setModuleName('default'); +//$linpha->template->overrideModule('css','filemanager'); +$linpha->template->URL_full = LINPHA_LINK.'&linCat=video&linId='.$linpha->template->idCurrent; +$linpha->template->hideMenu = true; +$linpha->template->hideTitle = true; +$linpha->template->output['title'] = i18n("Video"); +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2007-07-10 19:42:23
|
Revision: 4739 http://svn.sourceforge.net/linpha/?rev=4739&view=rev Author: bzrudi Date: 2007-07-10 12:42:22 -0700 (Tue, 10 Jul 2007) Log Message: ----------- fixed sys_image_exiftool_avail var, was not set correctly Modified Paths: -------------- trunk/linpha2/install/step11_finish.php trunk/linpha2/lib/classes/linpha.exiftool.class.php Modified: trunk/linpha2/install/step11_finish.php =================================================================== --- trunk/linpha2/install/step11_finish.php 2007-07-10 19:18:54 UTC (rev 4738) +++ trunk/linpha2/install/step11_finish.php 2007-07-10 19:42:22 UTC (rev 4739) @@ -141,10 +141,10 @@ * exiftool available value */ -if(isset($_POST['sys_import_exiftool_avail'])) +if(isset($_SESSION['sys_import_exiftool_avail'])) { $result = $linpha->db->Execute("UPDATE ".LIN_PREFIX."config " . - "SET option_value = '".LinSql::linAddslashes($_POST['sys_import_exiftool_avail'])."' " . + "SET option_value = '".LinSql::linAddslashes($_SESSION['sys_import_exiftool_avail'])."' " . "WHERE option_name = 'sys_import_exiftool_avail'"); if(!$result) { Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2007-07-10 19:18:54 UTC (rev 4738) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2007-07-10 19:42:22 UTC (rev 4739) @@ -125,11 +125,11 @@ LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $meta, $return); - /* + echo $this->exiftool.' '.$parameters.' "'.$filename.'"'; echo '<pre>', print_r($meta), '</pre>'; exit(); - */ + /** * Create usable array information by cycling and splitting * all information This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2007-07-11 15:46:36
|
Revision: 4742 http://svn.sourceforge.net/linpha/?rev=4742&view=rev Author: bzrudi Date: 2007-07-11 07:34:04 -0700 (Wed, 11 Jul 2007) Log Message: ----------- moved pjmt Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.pjmt.class.php trunk/linpha2/lib/include/metadata_info_show.php trunk/linpha2/lib/include/metadata_iptc_edit.php Removed Paths: ------------- trunk/linpha2/lib/classes/pjmt/ Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-07-10 21:08:45 UTC (rev 4741) +++ trunk/linpha2/ChangeLog 2007-07-11 14:34:04 UTC (rev 4742) @@ -1,3 +1,7 @@ +2007-07-11 bzrudi + * Moved /lib/classes/pjmt/ -> /lib/pjmt/ as it's not a class lib at all + * Moved /lib/classes/exiftool/ -> /lib/exiftool/ + 2007-07-10 bzrudi * Make use exiftool for video information, so we can remove getid3 completely. I don't like to keep it just to get width and height. Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2007-07-10 21:08:45 UTC (rev 4741) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2007-07-11 14:34:04 UTC (rev 4742) @@ -472,24 +472,24 @@ $dummy_thumbnail = LINPHA_DIR.'/lib/graphics/avi_mov.gif'; $this->img_thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; $this->img_quality = 75; + $this->imageTool->orgWidth = 320; + $this->imageTool->orgHeight = 240; + $found_thumbnail = false; /** - * check if we can get a thumbnail - */ - $found_thumbnail = false; - - /** * check if there exists a .thm file * (video thumbnail of Canon videos) */ $pos = strrpos($this->src_file,'.'); $start = substr($this->src_file,0,$pos); $thm_file = $start.'.thm'; + if(file_exists($thm_file)) { - list($this->org_width, $this->org_height, $file_type) = LinIdentify::linGetImageSize($thm_file); - $this->src_file = $thm_file; - + list($this->org_width, $this->org_height, $file_type) = + LinIdentify::linGetImageSize($thm_file); + + $this->src_file = $thm_file; $this->imageTool->orgWidth = $this->org_width; $this->imageTool->orgHeight = $this->org_height; $this->imageTool->imgType = $file_type; @@ -512,7 +512,16 @@ if($objExifTool->getEmbeddedThumbnail($this->src_file, $this->output_file)) { - $found_thumbnail = true; + /** + * get width and height from thumb + + list($this->org_width, $this->org_height, $file_type) = + LinIdentify::linGetImageSize($this->src_file); + + $this->imageTool->orgWidth = $this->org_width; + $this->imageTool->orgHeight = $this->org_height; + */ + $found_thumbnail = true; } else // try getting at least codec for imagemagick { @@ -543,14 +552,12 @@ { $found_thumbnail = false; } - } } else { $found_thumbnail = false; } - } } else @@ -581,6 +588,7 @@ $this->imageTool->orgWidth = $this->img_thumbsize; // only used with gdlib $this->imageTool->orgHeight = $this->img_thumbsize; // only used with gdlib + //$this->imageTool->createImage($this->output_file,$this->output_file,$this->imageTool->orgWidth,$this->imageTool->orgHeight,$this->rotate,$watermark=1); $this->imageTool->createImage($this->output_file,$this->output_file,$this->img_thumbsize,$this->img_thumbsize,$this->rotate,$watermark=1); } else Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2007-07-10 21:08:45 UTC (rev 4741) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2007-07-11 14:34:04 UTC (rev 4742) @@ -488,7 +488,7 @@ //list($time_exif, $rotate) = //$MetaData->getBasicMeta($dirname, $filename); - include_once( LINPHA_DIR.'/lib/classes/pjmt/EXIF.php' ); + include_once( LINPHA_DIR.'/lib/pjmt/EXIF.php' ); $meta = get_EXIF_JPEG($dirname.'/'.$filename); /** Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2007-07-10 21:08:45 UTC (rev 4741) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2007-07-11 14:34:04 UTC (rev 4742) @@ -19,7 +19,7 @@ */ if (!defined('LINPHA_DIR')) { exit (1); } -include_once LINPHA_DIR.'/lib/classes/pjmt/Unicode.php'; +include_once LINPHA_DIR.'/lib/pjmt/Unicode.php'; /** * This is the baseclass to handle all the EXIF/IPTC/XMP stuff used in LinPHA Modified: trunk/linpha2/lib/classes/linpha.pjmt.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.pjmt.class.php 2007-07-10 21:08:45 UTC (rev 4741) +++ trunk/linpha2/lib/classes/linpha.pjmt.class.php 2007-07-11 14:34:04 UTC (rev 4742) @@ -43,8 +43,8 @@ */ public function saveMetaData($filename, $md5sum, $metatype) { - include_once (LINPHA_DIR . '/lib/classes/pjmt/JPEG.php'); - include_once (LINPHA_DIR . '/lib/classes/pjmt/EXIF.php'); + include_once (LINPHA_DIR . '/lib/pjmt/JPEG.php'); + include_once (LINPHA_DIR . '/lib/pjmt/EXIF.php'); $str_columns = "md5sum, "; $str_values = "'" . $md5sum . "', "; @@ -194,7 +194,7 @@ **/ public function getBasicMeta($dirname, $filename) { - include_once( LINPHA_DIR.'/lib/classes/pjmt/EXIF.php' ); + include_once( LINPHA_DIR.'/lib/pjmt/EXIF.php' ); $date = ""; $meta = get_EXIF_JPEG($dirname.'/'.$filename); Modified: trunk/linpha2/lib/include/metadata_info_show.php =================================================================== --- trunk/linpha2/lib/include/metadata_info_show.php 2007-07-10 21:08:45 UTC (rev 4741) +++ trunk/linpha2/lib/include/metadata_info_show.php 2007-07-11 14:34:04 UTC (rev 4742) @@ -1,274 +1,274 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -/** - * check permissions - */ -if( !LinSql::photoIsAllowed( $GLOBALS['linpha']->template->idCurrent, $sql_perm_type = 'read' ) ) -{ - echo i18n("Access Denied!"); - exit(); -} - -/** - * valid id? - */ -$data = $GLOBALS['linpha']->db->GetRow( - "SELECT id, img_type FROM ".LIN_PREFIX."photos " . - "WHERE id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'" -); - -if( ! isset($data['id']) ) -{ - echo i18n("Access Denied!"); - exit(); -} - -/** - * only images - */ -if( ! LinIdentify::isSupportedImage($data['img_type'])) -{ - echo i18n("This Is Not An Image!"); - exit; -} - -$filename = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); -$filenameShow = implode( '/', LinSql::getFullFilenameFromId( $GLOBALS['linpha']->template->idCurrent ) ); - -?> -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> - -<!--*************************************************************************** -* -* Filename: Example.php -* -* Description: An example of how the PHP JPEG Metadata Toolkit can be used to -* display JPEG Metadata. -* -* Author: Evan Hunter -* -* Date: 30/7/2004 -* -* Project: PHP JPEG Metadata Toolkit -* -* Revision: 1.11 -* -* Changes: 1.00 -> 1.10 : Changed name of GET parameter from 'filename' to 'jpeg_fname' -* to stop script-kiddies using the google command 'allinurl:*.php?filename=*' -* to find servers to attack -* Changed behavior when no filename is given, to be cleaner -* 1.10 -> 1.11 : Changed displayed toolkit version numbers to reference Toolkit_Version.php -* Changed this example file to be easily relocatable -* -* URL: http://electronics.ozhiker.com -* -* Copyright: Copyright Evan Hunter 2004 -* -* License: This file is part of the PHP JPEG Metadata Toolkit. -* -* The PHP JPEG Metadata Toolkit 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. -* -* The PHP JPEG Metadata Toolkit 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 the PHP JPEG Metadata Toolkit; if not, -* write to the Free Software Foundation, Inc., 59 Temple -* Place, Suite 330, Boston, MA 02111-1307 USA -* -* If you require a different license for commercial or other -* purposes, please contact the author: ev...@oz... -* -***************************************************************************--> - - <head> - - <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> - <STYLE TYPE="text/css" MEDIA="screen, print, projection"> - <!-- - - BODY { background-color:#505050; color:#F0F0F0 } - a { color:orange } - .EXIF_Main_Heading { color:red } - .EXIF_Secondary_Heading{ color: orange} - .EXIF_Table { border-collapse: collapse ; border: 1px solid #909000} - .EXIF_Table tbody td{border-width: 1px; border-style:solid; border-color: #909000;} - - --> - </STYLE> - - - <?php - // Turn off Error Reporting - error_reporting ( 0 ); - - // Change: Allow this example file to be easily relocatable - as of version 1.11 - /**$Toolkit_Dir = "./"; // Ensure dir name includes trailing slash*/ - - // Hide any unknown EXIF tags - $GLOBALS['HIDE_UNKNOWN_TAGS'] = TRUE; - - /**include $Toolkit_Dir . 'Toolkit_Version.php'; // Change: added as of version 1.11 - include $Toolkit_Dir . 'JPEG.php'; // Change: Allow this example file to be easily relocatable - as of version 1.11 - include $Toolkit_Dir . 'JFIF.php'; - include $Toolkit_Dir . 'PictureInfo.php'; - include $Toolkit_Dir . 'XMP.php'; - include $Toolkit_Dir . 'Photoshop_IRB.php'; - include $Toolkit_Dir . 'EXIF.php';*/ - - include_once(LINPHA_DIR.'/lib/classes/pjmt/Toolkit_Version.php'); // Change: added as of version 1.11 - include_once(LINPHA_DIR.'/lib/classes/pjmt/JPEG.php'); // Change: Allow this example file to be easily relocatable - as of version 1.11 - include_once(LINPHA_DIR.'/lib/classes/pjmt/JFIF.php'); - include_once(LINPHA_DIR.'/lib/classes/pjmt/PictureInfo.php'); - include_once(LINPHA_DIR.'/lib/classes/pjmt/XMP.php'); - include_once(LINPHA_DIR.'/lib/classes/pjmt/Photoshop_IRB.php'); - include_once(LINPHA_DIR.'/lib/classes/pjmt/EXIF.php'); - - /** - // Retrieve the JPEG image filename from the http url request - if ( ( !array_key_exists( 'jpeg_fname', $GLOBALS['HTTP_GET_VARS'] ) ) || - ( $GLOBALS['HTTP_GET_VARS']['jpeg_fname'] == "" ) ) - { - echo "<title>No image filename defined</title>\n"; - echo "</head>\n"; - echo "<body>\n"; - echo "<p>No image filename defined - use GET method with field: jpeg_fname</p>\n"; - echo "<p><a href=\"http://www.ozhiker.com/electronics/pjmt/\" >PHP JPEG Metadata Toolkit version " . $GLOBALS['Toolkit_Version'] . ", Copyright (C) 2004 Evan Hunter</a></p>\n"; // Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11 - echo "</body>\n"; - exit( ); - } - else - { - $filename = $GLOBALS['HTTP_GET_VARS']['jpeg_fname']; - }*/ - - - // Output the title - echo "<title>Metadata details for $filenameShow</title>"; - - // Retrieve the header information - $jpeg_header_data = get_jpeg_header_data( $filename ); - - ?> - - </head> - - <body> - - <p>Interpreted using: <a href="http://www.ozhiker.com/electronics/pjmt/" >PHP JPEG Metadata Toolkit version <?php echo $GLOBALS['Toolkit_Version'] ?>, Copyright (C) 2004 Evan Hunter</a></p> <!-- Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11 --> - <br> - <br> - - <h1><B><U>Metadata for "<?php echo $filenameShow; ?>"</U></B></h1> - <br> - - <?php - /** - <!-- Output a link allowing user to edit the Photoshop File Info - Change: Allow this example file to be easily relocatable - as of version 1.11 - --> - <?php $relative_filename = get_relative_path( $filename, $Toolkit_Dir ); ?> - <h4><a href="<?php echo $Toolkit_Dir."Edit_File_Info_Example.php?jpeg_fname=$relative_filename"; ?>" >Click here to edit the Photoshop File Info for this file</a></h4> - <br> - */ - ?> - - - - <!-- Output the information about the APP segments --> - <?php echo Generate_JPEG_APP_Segment_HTML( $jpeg_header_data ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the Intrinsic JPEG Information --> - <?php echo Interpret_intrinsic_values_to_HTML( get_jpeg_intrinsic_values( $jpeg_header_data ) ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the JPEG Comment --> - <?php echo Interpret_Comment_to_HTML( $jpeg_header_data ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the JPEG File Interchange Format Information --> - <?php echo Interpret_JFIF_to_HTML( get_JFIF( $jpeg_header_data ), $filename ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the JFIF Extension Information --> - <?php echo Interpret_JFXX_to_HTML( get_JFXX( $jpeg_header_data ), $filename ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the Picture Info Text --> - <?php echo Interpret_App12_Pic_Info_to_HTML( $jpeg_header_data ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the EXIF Information --> - <?php echo Interpret_EXIF_to_HTML( get_EXIF_JPEG( $filename ), $filename ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the XMP Information --> - <?php echo Interpret_XMP_to_HTML( read_XMP_array_from_text( get_XMP_text( $jpeg_header_data ) ) ); ?> - <BR> - <HR> - <BR> - - <!-- Output the Photoshop IRB (including the IPTC-NAA info --> - <?php echo Interpret_IRB_to_HTML( get_Photoshop_IRB( $jpeg_header_data ), $filename ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the Meta Information --> - <?php echo Interpret_EXIF_to_HTML( get_Meta_JPEG( $filename ), $filename ); ?> - - <BR> - <HR> - <BR> - - <?php - /** - <!-- Display the original image --> - - <h2>Original Image</h2> - <?php echo "<img src=\"$filename\">"; ?> - */ - ?> - - - <BR> - <BR> - <BR> - <p>Interpreted using:</p> - <p><a href="http://www.ozhiker.com/electronics/pjmt/" >PHP JPEG Metadata Toolkit version <?php echo $GLOBALS['Toolkit_Version'] ?>, Copyright (C) 2004 Evan Hunter</a></p> <!-- Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11 --> - - </body> - +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +/** + * check permissions + */ +if( !LinSql::photoIsAllowed( $GLOBALS['linpha']->template->idCurrent, $sql_perm_type = 'read' ) ) +{ + echo i18n("Access Denied!"); + exit(); +} + +/** + * valid id? + */ +$data = $GLOBALS['linpha']->db->GetRow( + "SELECT id, img_type FROM ".LIN_PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'" +); + +if( ! isset($data['id']) ) +{ + echo i18n("Access Denied!"); + exit(); +} + +/** + * only images + */ +if( ! LinIdentify::isSupportedImage($data['img_type'])) +{ + echo i18n("This Is Not An Image!"); + exit; +} + +$filename = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); +$filenameShow = implode( '/', LinSql::getFullFilenameFromId( $GLOBALS['linpha']->template->idCurrent ) ); + +?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> + +<!--*************************************************************************** +* +* Filename: Example.php +* +* Description: An example of how the PHP JPEG Metadata Toolkit can be used to +* display JPEG Metadata. +* +* Author: Evan Hunter +* +* Date: 30/7/2004 +* +* Project: PHP JPEG Metadata Toolkit +* +* Revision: 1.11 +* +* Changes: 1.00 -> 1.10 : Changed name of GET parameter from 'filename' to 'jpeg_fname' +* to stop script-kiddies using the google command 'allinurl:*.php?filename=*' +* to find servers to attack +* Changed behavior when no filename is given, to be cleaner +* 1.10 -> 1.11 : Changed displayed toolkit version numbers to reference Toolkit_Version.php +* Changed this example file to be easily relocatable +* +* URL: http://electronics.ozhiker.com +* +* Copyright: Copyright Evan Hunter 2004 +* +* License: This file is part of the PHP JPEG Metadata Toolkit. +* +* The PHP JPEG Metadata Toolkit 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. +* +* The PHP JPEG Metadata Toolkit 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 the PHP JPEG Metadata Toolkit; if not, +* write to the Free Software Foundation, Inc., 59 Temple +* Place, Suite 330, Boston, MA 02111-1307 USA +* +* If you require a different license for commercial or other +* purposes, please contact the author: ev...@oz... +* +***************************************************************************--> + + <head> + + <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> + <STYLE TYPE="text/css" MEDIA="screen, print, projection"> + <!-- + + BODY { background-color:#505050; color:#F0F0F0 } + a { color:orange } + .EXIF_Main_Heading { color:red } + .EXIF_Secondary_Heading{ color: orange} + .EXIF_Table { border-collapse: collapse ; border: 1px solid #909000} + .EXIF_Table tbody td{border-width: 1px; border-style:solid; border-color: #909000;} + + --> + </STYLE> + + + <?php + // Turn off Error Reporting + error_reporting ( 0 ); + + // Change: Allow this example file to be easily relocatable - as of version 1.11 + /**$Toolkit_Dir = "./"; // Ensure dir name includes trailing slash*/ + + // Hide any unknown EXIF tags + $GLOBALS['HIDE_UNKNOWN_TAGS'] = TRUE; + + /**include $Toolkit_Dir . 'Toolkit_Version.php'; // Change: added as of version 1.11 + include $Toolkit_Dir . 'JPEG.php'; // Change: Allow this example file to be easily relocatable - as of version 1.11 + include $Toolkit_Dir . 'JFIF.php'; + include $Toolkit_Dir . 'PictureInfo.php'; + include $Toolkit_Dir . 'XMP.php'; + include $Toolkit_Dir . 'Photoshop_IRB.php'; + include $Toolkit_Dir . 'EXIF.php';*/ + + include_once(LINPHA_DIR.'/lib/pjmt/Toolkit_Version.php'); // Change: added as of version 1.11 + include_once(LINPHA_DIR.'/lib/pjmt/JPEG.php'); // Change: Allow this example file to be easily relocatable - as of version 1.11 + include_once(LINPHA_DIR.'/lib/pjmt/JFIF.php'); + include_once(LINPHA_DIR.'/lib/pjmt/PictureInfo.php'); + include_once(LINPHA_DIR.'/lib/pjmt/XMP.php'); + include_once(LINPHA_DIR.'/lib/pjmt/Photoshop_IRB.php'); + include_once(LINPHA_DIR.'/lib/pjmt/EXIF.php'); + + /** + // Retrieve the JPEG image filename from the http url request + if ( ( !array_key_exists( 'jpeg_fname', $GLOBALS['HTTP_GET_VARS'] ) ) || + ( $GLOBALS['HTTP_GET_VARS']['jpeg_fname'] == "" ) ) + { + echo "<title>No image filename defined</title>\n"; + echo "</head>\n"; + echo "<body>\n"; + echo "<p>No image filename defined - use GET method with field: jpeg_fname</p>\n"; + echo "<p><a href=\"http://www.ozhiker.com/electronics/pjmt/\" >PHP JPEG Metadata Toolkit version " . $GLOBALS['Toolkit_Version'] . ", Copyright (C) 2004 Evan Hunter</a></p>\n"; // Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11 + echo "</body>\n"; + exit( ); + } + else + { + $filename = $GLOBALS['HTTP_GET_VARS']['jpeg_fname']; + }*/ + + + // Output the title + echo "<title>Metadata details for $filenameShow</title>"; + + // Retrieve the header information + $jpeg_header_data = get_jpeg_header_data( $filename ); + + ?> + + </head> + + <body> + + <p>Interpreted using: <a href="http://www.ozhiker.com/electronics/pjmt/" >PHP JPEG Metadata Toolkit version <?php echo $GLOBALS['Toolkit_Version'] ?>, Copyright (C) 2004 Evan Hunter</a></p> <!-- Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11 --> + <br> + <br> + + <h1><B><U>Metadata for "<?php echo $filenameShow; ?>"</U></B></h1> + <br> + + <?php + /** + <!-- Output a link allowing user to edit the Photoshop File Info + Change: Allow this example file to be easily relocatable - as of version 1.11 + --> + <?php $relative_filename = get_relative_path( $filename, $Toolkit_Dir ); ?> + <h4><a href="<?php echo $Toolkit_Dir."Edit_File_Info_Example.php?jpeg_fname=$relative_filename"; ?>" >Click here to edit the Photoshop File Info for this file</a></h4> + <br> + */ + ?> + + + + <!-- Output the information about the APP segments --> + <?php echo Generate_JPEG_APP_Segment_HTML( $jpeg_header_data ); ?> + + <BR> + <HR> + <BR> + + <!-- Output the Intrinsic JPEG Information --> + <?php echo Interpret_intrinsic_values_to_HTML( get_jpeg_intrinsic_values( $jpeg_header_data ) ); ?> + + <BR> + <HR> + <BR> + + <!-- Output the JPEG Comment --> + <?php echo Interpret_Comment_to_HTML( $jpeg_header_data ); ?> + + <BR> + <HR> + <BR> + + <!-- Output the JPEG File Interchange Format Information --> + <?php echo Interpret_JFIF_to_HTML( get_JFIF( $jpeg_header_data ), $filename ); ?> + + <BR> + <HR> + <BR> + + <!-- Output the JFIF Extension Information --> + <?php echo Interpret_JFXX_to_HTML( get_JFXX( $jpeg_header_data ), $filename ); ?> + + <BR> + <HR> + <BR> + + <!-- Output the Picture Info Text --> + <?php echo Interpret_App12_Pic_Info_to_HTML( $jpeg_header_data ); ?> + + <BR> + <HR> + <BR> + + <!-- Output the EXIF Information --> + <?php echo Interpret_EXIF_to_HTML( get_EXIF_JPEG( $filename ), $filename ); ?> + + <BR> + <HR> + <BR> + + <!-- Output the XMP Information --> + <?php echo Interpret_XMP_to_HTML( read_XMP_array_from_text( get_XMP_text( $jpeg_header_data ) ) ); ?> + <BR> + <HR> + <BR> + + <!-- Output the Photoshop IRB (including the IPTC-NAA info --> + <?php echo Interpret_IRB_to_HTML( get_Photoshop_IRB( $jpeg_header_data ), $filename ); ?> + + <BR> + <HR> + <BR> + + <!-- Output the Meta Information --> + <?php echo Interpret_EXIF_to_HTML( get_Meta_JPEG( $filename ), $filename ); ?> + + <BR> + <HR> + <BR> + + <?php + /** + <!-- Display the original image --> + + <h2>Original Image</h2> + <?php echo "<img src=\"$filename\">"; ?> + */ + ?> + + + <BR> + <BR> + <BR> + <p>Interpreted using:</p> + <p><a href="http://www.ozhiker.com/electronics/pjmt/" >PHP JPEG Metadata Toolkit version <?php echo $GLOBALS['Toolkit_Version'] ?>, Copyright (C) 2004 Evan Hunter</a></p> <!-- Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11 --> + + </body> + </html> \ No newline at end of file Modified: trunk/linpha2/lib/include/metadata_iptc_edit.php =================================================================== --- trunk/linpha2/lib/include/metadata_iptc_edit.php 2007-07-10 21:08:45 UTC (rev 4741) +++ trunk/linpha2/lib/include/metadata_iptc_edit.php 2007-07-11 14:34:04 UTC (rev 4742) @@ -47,7 +47,7 @@ /** * We are going to save all IPTC data UTF8 encoded in database */ -include_once(LINPHA_DIR.'/lib/classes/pjmt/Unicode.php'); +include_once(LINPHA_DIR.'/lib/pjmt/Unicode.php'); $MetaData = new LinMetaData(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2007-07-11 18:07:37
|
Revision: 4746 http://svn.sourceforge.net/linpha/?rev=4746&view=rev Author: bzrudi Date: 2007-07-11 11:07:34 -0700 (Wed, 11 Jul 2007) Log Message: ----------- "Show all Metadata" link now does respect exiftool. Modified Paths: -------------- trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.exiftool.class.php trunk/linpha2/lib/include/metadata_info_show.php trunk/linpha2/templates/default/view_img.html.php Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2007-07-11 14:47:04 UTC (rev 4745) +++ trunk/linpha2/index.php 2007-07-11 18:07:34 UTC (rev 4746) @@ -55,7 +55,7 @@ case 'newimg': require_once(LINPHA_DIR.'/lib/modules/module.newimg.php'); break; -case 'exif': +case 'metadata': require_once(LINPHA_DIR.'/lib/include/metadata_info_show.php'); break; case 'video': Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2007-07-11 14:47:04 UTC (rev 4745) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2007-07-11 18:07:34 UTC (rev 4746) @@ -101,7 +101,28 @@ } } + /** + * This method formats an html page containing all known MetaData infos + * + * @param string $filename + * @return html formatted page + */ + public function printHtmlPage($filename) + { + $meta =""; + $return = array(); + $parameters = "-g ". + "-h "; + + LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $return); + + foreach($return as $value) + { + echo $value; + } + } + /** * This method reads all available MetaData (Group) Information from image. * @param string $metatype iptc, xmp, exif, makernotes... Modified: trunk/linpha2/lib/include/metadata_info_show.php =================================================================== --- trunk/linpha2/lib/include/metadata_info_show.php 2007-07-11 14:47:04 UTC (rev 4745) +++ trunk/linpha2/lib/include/metadata_info_show.php 2007-07-11 18:07:34 UTC (rev 4746) @@ -36,6 +36,31 @@ $filename = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); $filenameShow = implode( '/', LinSql::getFullFilenameFromId( $GLOBALS['linpha']->template->idCurrent ) ); +/** + * If exiftool avail, make use of it! + */ +if($GLOBALS['linpha']->sql->config->value['sys_import_exiftool_avail']) +{ + ?> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> + <html> + <head></head> + <body> + <?php + + include_once(LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'); + $objExifTool = new LinExifTool(); + + $objExifTool->printHtmlPage($filename); + + ?> + + </body> + </html> +<?php +} +else +{ ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> @@ -271,4 +296,7 @@ </body> -</html> \ No newline at end of file +</html> +<?php +} +?> Modified: trunk/linpha2/templates/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/default/view_img.html.php 2007-07-11 14:47:04 UTC (rev 4745) +++ trunk/linpha2/templates/default/view_img.html.php 2007-07-11 18:07:34 UTC (rev 4746) @@ -42,7 +42,7 @@ <div id="linDivMetaOuter" style="display: none;"> <div id="linDivMeta"></div> - <div id="linDivExifLink" class="linDivMetaLinks"><a href="<?php echo LINPHA_LINK.'linCat=exif&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a></div> + <div id="linDivExifLink" class="linDivMetaLinks"><a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a></div> <div id="linDivVideoLink" class="linDivMetaLinks"> <a href="<?php echo LINPHA_LINK.'linCat=video&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Play Video"); ?></a> <br /><br /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2007-07-11 18:20:16
|
Revision: 4748 http://svn.sourceforge.net/linpha/?rev=4748&view=rev Author: bzrudi Date: 2007-07-11 11:20:15 -0700 (Wed, 11 Jul 2007) Log Message: ----------- Added "Show All MetaData" link support even for videos Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/include/metadata_info_show.php trunk/linpha2/templates/default/view_img.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-07-11 18:08:11 UTC (rev 4747) +++ trunk/linpha2/ChangeLog 2007-07-11 18:20:15 UTC (rev 4748) @@ -5,6 +5,7 @@ use it instead of pjmt. * Renamed "linCat=exif" in links to "linCat=metadata", as we get more than just exif, thanks to exiftool :-) + * "Show all Metadata" support for video files 2007-07-10 bzrudi * Make use exiftool for video information, so we can remove getid3 completely. Modified: trunk/linpha2/lib/include/metadata_info_show.php =================================================================== --- trunk/linpha2/lib/include/metadata_info_show.php 2007-07-11 18:08:11 UTC (rev 4747) +++ trunk/linpha2/lib/include/metadata_info_show.php 2007-07-11 18:20:15 UTC (rev 4748) @@ -1,4 +1,23 @@ <?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. +*/ + if(!defined('LINPHA_DIR')) { exit(1); } /** @@ -25,12 +44,15 @@ } /** - * only images + * only images, but only if we stuck with pjmt exiftool does it :-) */ -if( ! LinIdentify::isSupportedImage($data['img_type'])) +if(!$GLOBALS['linpha']->sql->config->value['sys_import_exiftool_avail']) { - echo i18n("This Is Not An Image!"); - exit; + if( ! LinIdentify::isSupportedImage($data['img_type'])) + { + echo i18n("This Is Not An Image!"); + exit; + } } $filename = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); Modified: trunk/linpha2/templates/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/default/view_img.html.php 2007-07-11 18:08:11 UTC (rev 4747) +++ trunk/linpha2/templates/default/view_img.html.php 2007-07-11 18:20:15 UTC (rev 4748) @@ -45,7 +45,9 @@ <div id="linDivExifLink" class="linDivMetaLinks"><a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a></div> <div id="linDivVideoLink" class="linDivMetaLinks"> <a href="<?php echo LINPHA_LINK.'linCat=video&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Play Video"); ?></a> - <br /><br /> + <br /> + <a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a> + <br /> <a href="<?php echo LINPHA_LINK.'linCat=download&linId='.$linTpl->idCurrent; ?>&isDownload=true" onclick="javascript:myLinImage.updateLinId(this)"><?php echo i18n("Download Video"); ?></a> </div> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2007-07-12 12:34:19
|
Revision: 4749 http://svn.sourceforge.net/linpha/?rev=4749&view=rev Author: bzrudi Date: 2007-07-12 05:34:14 -0700 (Thu, 12 Jul 2007) Log Message: ----------- rerwite linGetImageSize() to make videos and other filetypes work again like PDF BMP... Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.identify.class.php trunk/linpha2/lib/classes/linpha.image.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-07-11 18:20:15 UTC (rev 4748) +++ trunk/linpha2/ChangeLog 2007-07-12 12:34:14 UTC (rev 4749) @@ -1,3 +1,7 @@ +2007-07-12 bzrudi + * Rewrite linGetImageSize() to make videos and other filetypes like pdf + work again and another bunch of cleanups and fixes + 2007-07-11 bzrudi * Moved /lib/classes/pjmt/ -> /lib/pjmt/ as it's not a class lib at all * Moved /lib/classes/exiftool/ -> /lib/exiftool/ @@ -10,7 +14,6 @@ 2007-07-10 bzrudi * Make use exiftool for video information, so we can remove getid3 completely. I don't like to keep it just to get width and height. - * TODO: save width and height during video import, it's currently missing! * Removed getid3 from svn 2007-07-06 bzrudi Modified: trunk/linpha2/lib/classes/linpha.identify.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.identify.class.php 2007-07-11 18:20:15 UTC (rev 4748) +++ trunk/linpha2/lib/classes/linpha.identify.class.php 2007-07-12 12:34:14 UTC (rev 4749) @@ -114,10 +114,6 @@ * This function extends PHP's getimagesize() function. This include's * support for TIFF like files with PHP < 4.2.0 and others * - * @todo bzrudi: is this still necesarry using php > 5.x ??? - * @todo flo: yes i think so, imagemagick supports much more images than the gdlib - * but i don't now about the detectTiffType() stuff - * * @author bzrudi,flo * @param string $path path to image * @return array array(width,height,type,img_string) @@ -128,51 +124,75 @@ $ext = LinFilesys::getFileExtFromPath($path); - /** - * $g[2] doesn't exists: -> image type is for example TIFF, but it also can be AVI etc. - * -> use identify from imagemagick to determine the imagetype - * - * but first, check if it is a video, because imagemagick's identify really sucks in detecting videos - * (segmentation faults and wait times about 2 minutes for each file!) - * test results: - * version 5.4.4, 5.5.6, 5.5.7 slow (for one AVI file 2 minutes) - * 6.0.0 works fine - * 6.0.7 segmentation fault - */ - if( !$g[2] ) + //linLog(LOG_TYPE_IMPORT,LOG_INFO,'image',"Got Image Type: ".$g['2']); + if( !$g['2'] ) { $org_type = LinIdentify::convertImagetype($ext); - if(LinIdentify::isVideo($org_type)) + $identify_path = $GLOBALS['linpha']->sql->config->value['sys_im_imagemagick_path'] ."identify"; + + //linLog(LOG_TYPE_IMPORT,LOG_INFO,'image',"No Image Type, asking LinIdentify - GOT: ".$org_type); + + if(!isset($org_type)) { - $g[2] = $org_type; + $g['2'] = "9999999"; } - else + else { - $identify_path = $GLOBALS['linpha']->sql->config->value['sys_im_imagemagick_path'] ."identify"; + $g['2'] = $org_type; + } + + if($org_type == '160') //pdf needs identify to get width and height + { + //linLog(LOG_TYPE_IMPORT,LOG_INFO,'image',"Got PDF ".$g['2']); if( $GLOBALS['linpha']->sql->config->value['sys_im_use_imagemagick'] ) { /** * $array_output[0] contains something like '2272 1704 JPEG' */ - LinFilesys::linExec ( $identify_path.' -format "%w %h %m" '.linEscapeString($path), $array_output = Array(), $return_value = 0); + $array_output = Array(); + $return_value = 0; + LinFilesys::linExec ( $identify_path.' -format "%w %h %m" '.linEscapeString($path), $array_output, $return_value); - if($return_value == 0) // identify succeed + if(isset($array_output['0'])) { - if(isset($array_output[0])) - { - print_r($array_output); - exit(); - - $g = explode( " ", $array_output[0] ); - - $g[2] = LinIdentify::convertImagetype($g[2],$path); - } + $file_info = explode( " ", $array_output['0'] ); + $g['0'] = $file_info['0']; + $g['1'] = $file_info['1']; } } } + + /** + * If ImageMagick is avail and type is set to 9999999, try to get infos + * using identify as a last resort + */ + if( $GLOBALS['linpha']->sql->config->value['sys_im_use_imagemagick'] + && $g['2'] == '9999999' ) + { + /** + * $array_output[0] contains something like '2272 1704 JPEG' + */ + $array_output = Array(); + $return_value = 0; + LinFilesys::linExec ( $identify_path.' -format "%w %h %m" '.linEscapeString($path), $array_output, $return_value); + + if(isset($array_output['0'])) + { + $img_info = explode( " ", $array_output['0'] ); + $g['0'] = $img_info['0']; + $g['1'] = $img_info['1']; + $g['2'] = strtolower($img_info['2']); + + } + + } } - else // getimagesize detects mpg and mp4 as type 15, but type 15 is wbmp (look at the mimetype returned by getimagesize), pay attention... + else { + /** + * getimagesize detects mpg and mp4 as type 15, but type 15 is wbmp + * (look at the mimetype returned by getimagesize), pay attention... + */ if($g[2] == 15) { if(LinIdentify::convertImagetype($ext) == 1000) // 1000 = mpg, mpeg, mpe, ... @@ -188,18 +208,24 @@ /** * still don't have an imagetype, take imagetype by fileextension - * @todo what should we do now, getimagesize and identify doesn't handle this files as images and we doesn't know the image height and width, i think they therefore can't convert/handle this file, so we should declare it as unsupported. But we need still a check if it is a video or something other, so we can't remove get_imagetype_from_filename(). That means we should check if get_imagetype_from_filename() returned a value lesser than 1000 and if so, delete it! what do others mean?! flo + * @todo what should we do now, getimagesize and identify doesn't handle + * this files as images and we doesn't know the image height and width, + * i think they therefore can't convert/handle this file, so we should + * declare it as unsupported. But we need still a check if it is a video + * or something other, so we can't remove get_imagetype_from_filename(). + * That means we should check if get_imagetype_from_filename() returned + * a value lesser than 1000 and if so, delete it! what do others mean?! flo */ - if( !$g[2] ) + if( !$g['2'] ) { $type = LinIdentify::getImagetypeFromFilename($path); if($type < 1000) { - $g[2] = LinIdentify::convertImagetype('unsupported'); + $g['2'] = LinIdentify::convertImagetype('unsupported'); } else { - $g[2] = $type; + $g['2'] = $type; } } @@ -208,17 +234,17 @@ * set to not empty to prevent erros on commands like * list($org_width,$org_height,$org_type) = linpha_getimagesize($img2rotate); */ - if(!isset($g[0])) + if(!isset($g['0'])) { - $g[0] = 0; + $g['0'] = '0'; } - if(!isset($g[1])) + if(!isset($g['1'])) { - $g[1] = 0; + $g['1'] = '0'; } - $g[3] = 'width="'.$g[0].'" height="'.$g[1].'"'; + $g['3'] = 'width="'.$g['0'].'" height="'.$g['1'].'"'; return $g; } @@ -404,7 +430,7 @@ 'pcl w' => 157, 'pcx' => 158, 'pdb' => 159, -// 'pdf' => 160, this type shouldn't be handled as image + 'pdf' => 160, 'pfa' => 161, 'pfb' => 162, 'pgm' => 163, Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2007-07-11 18:20:15 UTC (rev 4748) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2007-07-12 12:34:14 UTC (rev 4749) @@ -469,12 +469,12 @@ function createThumbnailVideo() { - $dummy_thumbnail = LINPHA_DIR.'/lib/graphics/avi_mov.gif'; + $dummy_thumbnail = LINPHA_DIR.'/lib/graphics/video.jpg'; $this->img_thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; $this->img_quality = 75; - $this->imageTool->orgWidth = 320; - $this->imageTool->orgHeight = 240; - $found_thumbnail = false; + //$this->imageTool->orgWidth = 320; + //$this->imageTool->orgHeight = 240; + $video_thumbnail_created = false; /** * check if there exists a .thm file @@ -496,10 +496,10 @@ $this->imageTool->img_thumbsize = $this->img_thumbsize; $this->imageTool->imgQuality = 75; $this->imageTool->createThumbnail($this->src_file,$this->output_file,$this->rotate); - $found_thumbnail = true; + $video_thumbnail_created = true; } - if(!$found_thumbnail) + if(!$video_thumbnail_created) { /** * try getting thumbnail with exiftool if requested @@ -521,7 +521,7 @@ $this->imageTool->orgWidth = $this->org_width; $this->imageTool->orgHeight = $this->org_height; */ - $found_thumbnail = true; + $video_thumbnail_created = true; } else // try getting at least codec for imagemagick { @@ -546,31 +546,36 @@ if($return_value == 0 && file_exists($this->output_file)) /* && empty($array_output[0]) */ { - $found_thumbnail = true; + $video_thumbnail_created = true; } else { - $found_thumbnail = false; + $video_thumbnail_created = false; } } } else { - $found_thumbnail = false; + $video_thumbnail_created = false; } } } else { - $found_thumbnail = false; + $video_thumbnail_created = false; } } /** * copy the video icon in the lower right corner */ - if($found_thumbnail) + if($video_thumbnail_created) { + /** + * watermark currently broken - image scaling wrong and distorted + * also - so disable temporary (flo?) + */ + /* include_once(LINPHA_DIR.'/lib/plugins/watermark/func.watermark.php'); $this->imageTool->wm_config = Array( 'wm_watermark' => 2, @@ -581,18 +586,20 @@ 'wm_horizontal' => 5, 'wm_vertical' => 5 ); - + */ /** * warning: session will be closed! */ - $this->imageTool->orgWidth = $this->img_thumbsize; // only used with gdlib - $this->imageTool->orgHeight = $this->img_thumbsize; // only used with gdlib + //$this->imageTool->orgWidth = $this->img_thumbsize; // only used with gdlib + //$this->imageTool->orgHeight = $this->img_thumbsize; // only used with gdlib - //$this->imageTool->createImage($this->output_file,$this->output_file,$this->imageTool->orgWidth,$this->imageTool->orgHeight,$this->rotate,$watermark=1); - $this->imageTool->createImage($this->output_file,$this->output_file,$this->img_thumbsize,$this->img_thumbsize,$this->rotate,$watermark=1); + //$this->imageTool->createImage($this->output_file,$this->output_file,$this->img_thumbsize,$this->img_thumbsize,$this->rotate,$watermark=1); } else { + /** + * use default video icon + */ $this->output_file = $dummy_thumbnail; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2007-07-12 16:21:14
|
Revision: 4751 http://svn.sourceforge.net/linpha/?rev=4751&view=rev Author: bzrudi Date: 2007-07-12 09:20:55 -0700 (Thu, 12 Jul 2007) Log Message: ----------- removed - not neede as it just hold sample data Modified Paths: -------------- trunk/linpha2/ChangeLog Removed Paths: ------------- trunk/linpha2/lib/exiftool/t/ Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-07-12 13:46:18 UTC (rev 4750) +++ trunk/linpha2/ChangeLog 2007-07-12 16:20:55 UTC (rev 4751) @@ -1,7 +1,10 @@ 2007-07-12 bzrudi * Rewrite linGetImageSize() to make videos and other filetypes like pdf work again and another bunch of cleanups and fixes - + * linpha.image.class.php temporary disable video thumbnail watermark as it's + broken. (distorted and wrong size) TODO: flo!? + * Remove exiftool/t/ dir. Not needed as it contains just sample data. + 2007-07-11 bzrudi * Moved /lib/classes/pjmt/ -> /lib/pjmt/ as it's not a class lib at all * Moved /lib/classes/exiftool/ -> /lib/exiftool/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2007-07-13 08:31:41
|
Revision: 4752 http://svn.sourceforge.net/linpha/?rev=4752&view=rev Author: bzrudi Date: 2007-07-13 01:31:36 -0700 (Fri, 13 Jul 2007) Log Message: ----------- make installer really abort on error, no longer support 'continue at own risk' makes no sense here. Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/step2_requirements.php trunk/linpha2/lib/classes/linpha.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-07-12 16:20:55 UTC (rev 4751) +++ trunk/linpha2/ChangeLog 2007-07-13 08:31:36 UTC (rev 4752) @@ -1,3 +1,8 @@ +2007-07-13 bzrudi + * Make installer really abort when detecting serious problem. No longer + support "Continue at own risk", as it make absolutely no sense. + * + 2007-07-12 bzrudi * Rewrite linGetImageSize() to make videos and other filetypes like pdf work again and another bunch of cleanups and fixes @@ -3,5 +8,5 @@ * linpha.image.class.php temporary disable video thumbnail watermark as it's broken. (distorted and wrong size) TODO: flo!? - * Remove exiftool/t/ dir. Not needed as it contains just sample data. + * Removed /lib/exiftool/t/ dir. Not needed as it contains just sample data. 2007-07-11 bzrudi @@ -522,8 +527,7 @@ 2006-04-29 flo * filemanager: implementing upload only images and videos, escape filenames correct - (-> create a folder and file called "<script>" and you will find things which needs to be escaped) - + 2006-04-28 flo * filemanager: implemeting move, copy, change permissions, upload Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2007-07-12 16:20:55 UTC (rev 4751) +++ trunk/linpha2/install/step2_requirements.php 2007-07-13 08:31:36 UTC (rev 4752) @@ -27,6 +27,9 @@ include_once(LINPHA_DIR.'/install/header.php'); include_once(LINPHA_DIR.'/install/lib.requirements.php'); include_once(LINPHA_DIR.'/install/header_html.php'); + +$requirements_failed = false; + ?> <script language="JavaScript" type='text/javascript'> @@ -77,7 +80,7 @@ { print_line_right(failed_msg()); print_line_info( sprintf(i18n_install("PHP Version >= %s is required"),'5.0.0') ); - $error = 1; + $requirements_failed = true; } @@ -100,7 +103,7 @@ print_line_middle( i18n_install("NONE") ); print_line_right(failed_msg()); print_line_info( i18n_install("Enable at least support for one Database in your PHP configuration file (php.ini)") ); - $error = 1; + $requirements_failed = true; } else { @@ -251,7 +254,7 @@ { print_line_middle( i18n_install("Not Found") ); print_line_right(failed_msg()); - $error = 1; + $requirements_failed = true; } print_line_left( i18n_install("GD JPEG Support") ); @@ -261,7 +264,7 @@ print_line_right(failed_msg()); print_line_info( i18n_install("Your GD Library lacks JPEG support, LinPHA will not support JPEG Images!") ); - $error = 1; + $requirements_failed = true; } else { @@ -398,7 +401,7 @@ print_line_middle( i18n_install("No") ); print_line_right(failed_msg()); print_line_info( sprintf(i18n_install("Please make sure the directory %s is writeable!"),'/linpha/var/') ); - $error = 1; + $requirements_failed = 1; } /** @@ -437,7 +440,7 @@ /** - * show footer of table requirements + * show footer of table requirementslib.install.php */ print_foot(); @@ -461,11 +464,12 @@ <?php -if(isset($error)) +if($requirements_failed) { - echo "<h2>".i18n_install("!!! INSTALLATION ABORTED !!!")."</h2><br />"; - echo i18n_install("There was at least one serious error - continue at your own risk"); - echo "<br /><br />"; + echo "<strong>".i18n_install("!!! INSTALLATION ABORTED !!!")."</strong><br />"; + echo i18n_install("Installer detected at least one serious problem. Please click the status info links above for more information."); + echo "<br />"; + exit(); } include_once(LINPHA_DIR.'/install/footer.php'); Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2007-07-12 16:20:55 UTC (rev 4751) +++ trunk/linpha2/lib/classes/linpha.class.php 2007-07-13 08:31:36 UTC (rev 4752) @@ -36,8 +36,9 @@ class Linpha { - public $db, $sql, $template; +public $db, $sql, $template; + function __construct() { $this->sql = new LinSql(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2007-07-13 08:47:23
|
Revision: 4753 http://svn.sourceforge.net/linpha/?rev=4753&view=rev Author: bzrudi Date: 2007-07-13 01:47:19 -0700 (Fri, 13 Jul 2007) Log Message: ----------- hopefully fixed install issue error MySQL5 on M$ Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/sql/sql.mysql.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-07-13 08:31:36 UTC (rev 4752) +++ trunk/linpha2/ChangeLog 2007-07-13 08:47:19 UTC (rev 4753) @@ -1,7 +1,7 @@ 2007-07-13 bzrudi * Make installer really abort when detecting serious problem. No longer support "Continue at own risk", as it make absolutely no sense. - * + * Hopefully fixed some install issues on MySQL windows (strict mode) 2007-07-12 bzrudi * Rewrite linGetImageSize() to make videos and other filetypes like pdf Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2007-07-13 08:31:36 UTC (rev 4752) +++ trunk/linpha2/install/sql/sql.mysql.php 2007-07-13 08:47:19 UTC (rev 4753) @@ -36,8 +36,8 @@ "password VARCHAR(32) NOT NULL default '' , " . "user_email VARCHAR(255) NOT NULL default '' , " . "display_name VARCHAR(255) NOT NULL default '' , " . - "stats_downloads INT NOT NULL , " . - "stats_downloads_size INT NOT NULL, " . + "stats_downloads INT default '0', " . + "stats_downloads_size INT default '0', " . "PRIMARY KEY (id) " . ")", "CREATE TABLE ".$linpha_tables['groups']." ( ". @@ -47,8 +47,8 @@ ")", "CREATE TABLE ".$linpha_tables['user_group']." ( ". "id INT NOT NULL AUTO_INCREMENT, " . - "group_id INT NOT NULL, " . - "user_id INT NOT NULL, " . + "group_id INT NOT NULL default '0', " . + "user_id INT NOT NULL default '0', " . "PRIMARY KEY (id) " . ")", "CREATE TABLE ".$linpha_tables['permissions']." ( ". @@ -62,7 +62,7 @@ "id INT NOT NULL AUTO_INCREMENT, " . "parent_id INT NOT NULL default '0', " . "img_type INT NOT NULL default '0', " . - "name VARCHAR(255) NOT NULL, " . + "name VARCHAR(255) NOT NULL default '', " . "md5sum VARCHAR(32) NOT NULL default '', " . "width INT NOT NULL default '0', " . "height INT NOT NULL default '0', " . This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2007-07-13 17:21:26
|
Revision: 4755 http://svn.sourceforge.net/linpha/?rev=4755&view=rev Author: bzrudi Date: 2007-07-13 10:20:47 -0700 (Fri, 13 Jul 2007) Log Message: ----------- Installer rework and lots of eyecandy ;-) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/gnu.css trunk/linpha2/install/header.php trunk/linpha2/install/header_html.php trunk/linpha2/install/index.php trunk/linpha2/install/layout.css trunk/linpha2/install/lib.install.php trunk/linpha2/install/look.css trunk/linpha2/install/step2_requirements.php trunk/linpha2/install/step3_dbtype.php trunk/linpha2/install/step4_selectdirectories.php trunk/linpha2/install/step5_getlogin.php trunk/linpha2/install/step6_selectdatabase.php trunk/linpha2/install/step7_selectprefix.php trunk/linpha2/install/step8_testing.php trunk/linpha2/install/step9_createtables.php Added Paths: ----------- trunk/linpha2/install/graphics/createtables.png trunk/linpha2/install/graphics/dbtest.png trunk/linpha2/install/graphics/directories.png trunk/linpha2/install/graphics/finish.png trunk/linpha2/install/graphics/gnu.png trunk/linpha2/install/graphics/important.png trunk/linpha2/install/graphics/login.png trunk/linpha2/install/graphics/phppg.png trunk/linpha2/install/graphics/settings.png trunk/linpha2/install/graphics/start.png Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/ChangeLog 2007-07-13 17:20:47 UTC (rev 4755) @@ -1,4 +1,6 @@ 2007-07-13 bzrudi + * Major redesign and cleanups in Installer and a lot of eyecandy. + Please test and report any issues, errors, warnings, layout quirks! * Make installer really abort when detecting serious problem. No longer support "Continue at own risk", as it make absolutely no sense. * Hopefully fixed some install issues on MySQL windows (strict mode) Modified: trunk/linpha2/install/gnu.css =================================================================== --- trunk/linpha2/install/gnu.css 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/install/gnu.css 2007-07-13 17:20:47 UTC (rev 4755) @@ -1,4 +1,5 @@ html, body { + font-size: 80%; background-color: #FFFFFF; color: #000000; font-family: sans-serif; Added: trunk/linpha2/install/graphics/createtables.png =================================================================== (Binary files differ) Property changes on: trunk/linpha2/install/graphics/createtables.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/install/graphics/dbtest.png =================================================================== (Binary files differ) Property changes on: trunk/linpha2/install/graphics/dbtest.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/install/graphics/directories.png =================================================================== (Binary files differ) Property changes on: trunk/linpha2/install/graphics/directories.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/install/graphics/finish.png =================================================================== (Binary files differ) Property changes on: trunk/linpha2/install/graphics/finish.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/install/graphics/gnu.png =================================================================== (Binary files differ) Property changes on: trunk/linpha2/install/graphics/gnu.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/install/graphics/important.png =================================================================== (Binary files differ) Property changes on: trunk/linpha2/install/graphics/important.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/install/graphics/login.png =================================================================== (Binary files differ) Property changes on: trunk/linpha2/install/graphics/login.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/install/graphics/phppg.png =================================================================== (Binary files differ) Property changes on: trunk/linpha2/install/graphics/phppg.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/install/graphics/settings.png =================================================================== (Binary files differ) Property changes on: trunk/linpha2/install/graphics/settings.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/install/graphics/start.png =================================================================== (Binary files differ) Property changes on: trunk/linpha2/install/graphics/start.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Modified: trunk/linpha2/install/header.php =================================================================== --- trunk/linpha2/install/header.php 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/install/header.php 2007-07-13 17:20:47 UTC (rev 4755) @@ -88,7 +88,7 @@ $title_str[0] = i18n_install("Welcome"); $title_str[1] = i18n_install("Accept GPL"); -$title_str[2] = i18n_install("Requirements Check"); +$title_str[2] = i18n_install("Requirements"); $title_str[3] = i18n_install("Database Type"); $title_str[4] = i18n_install("Directories"); $title_str[5] = i18n_install("Database Login"); Modified: trunk/linpha2/install/header_html.php =================================================================== --- trunk/linpha2/install/header_html.php 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/install/header_html.php 2007-07-13 17:20:47 UTC (rev 4755) @@ -37,10 +37,118 @@ <body> <div class="main"> +<div class="header"> +<?php +$end = count($files)-1; +$step = $key+1; +$finalstep = $end+1; +switch($step) +{ + case '1': + + echo "<img class='header_icons' src='./graphics/start.png'>"; + echo "<p class='header_info'>"; + echo i18n_install("Welcome To LinPHA2 Installation Wizzard"); + echo "</p><p class='header_subinfo'>"; + echo i18n_install("Step $step of $finalstep"); + echo "</p>"; + break; + case '2': + echo "<img class='header_icons' src='./graphics/gnu.png'>"; + echo "<p class='header_info'>"; + echo i18n_install("Accept The GNU General Public License"); + echo "</p><p class='header_subinfo'>"; + echo i18n_install("Step $step of $finalstep"); + echo "</p>"; + break; + case '3': + echo "<img class='header_icons' src='./graphics/important.png'>"; + echo "<p class='header_info'>"; + echo i18n_install("Checking for Required Software"); + echo "</p><p class='header_subinfo'>"; + echo i18n_install("Step $step of $finalstep"); + echo "</p>"; + break; + case '4': + echo "<img class='header_icons' src='./graphics/phppg.png'>"; + echo "<p class='header_info'>"; + echo i18n_install("Select Type Of Database To Use"); + echo "</p><p class='header_subinfo'>"; + echo i18n_install("Step $step of $finalstep"); + echo "</p>"; + break; + case '5': + echo "<img class='header_icons' src='./graphics/directories.png'>"; + echo "<p class='header_info'>"; + echo i18n_install("Define LinPHA Storage And Album Directories"); + echo "</p><p class='header_subinfo'>"; + echo i18n_install("Step $step of $finalstep"); + echo "</p>"; + break; + case '6': + echo "<img class='header_icons' src='./graphics/login.png'>"; + echo "<p class='header_info'>"; + echo i18n_install("Directories Testing And Database Login"); + echo "</p><p class='header_subinfo'>"; + echo i18n_install("Step $step of $finalstep"); + echo "</p>"; + break; + case '7': + echo "<img class='header_icons' src='./graphics/phppg.png'>"; + echo "<p class='header_info'>"; + echo i18n_install("Connection Test And Database Selection"); + echo "</p><p class='header_subinfo'>"; + echo i18n_install("Step $step of $finalstep"); + echo "</p>"; + break; + case '8': + echo "<img class='header_icons' src='./graphics/phppg.png'>"; + echo "<p class='header_info'>"; + echo i18n_install("Database Table Prefix Selection"); + echo "</p><p class='header_subinfo'>"; + echo i18n_install("Step $step of $finalstep"); + echo "</p>"; + break; + case '9': + echo "<img class='header_icons' src='./graphics/phppg.png'>"; + echo "<p class='header_info'>"; + echo i18n_install("Running Database Tests And Checking Permissions"); + echo "</p><p class='header_subinfo'>"; + echo i18n_install("Step $step of $finalstep"); + echo "</p>"; + break; + case '10': + echo "<img class='header_icons' src='./graphics/createtables.png'>"; + echo "<p class='header_info'>"; + echo i18n_install("Creating Database Tables And Writing Config Files"); + echo "</p><p class='header_subinfo'>"; + echo i18n_install("Step $step of $finalstep"); + echo "</p>"; + break; + case '11': + echo "<img class='header_icons' src='./graphics/settings.png'>"; + echo "<p class='header_info'>"; + echo i18n_install("Setup LinPHA Admin And Initial Settings"); + echo "</p><p class='header_subinfo'>"; + echo i18n_install("Step $step of $finalstep"); + echo "</p>"; + break; + case '12': + echo "<img class='header_icons' src='./graphics/finish.png'>"; + echo "<p class='header_info'>"; + echo i18n_install("Finishing LinPHA2 Setup"); + echo "</p><p class='header_subinfo'>"; + echo i18n_install("Step $step of $finalstep"); + echo "</p>"; + break; + +} +?> + +</div> <div class="leftside"> -<br /><br /> <?php -$end = count($files)-1; + for($i = 0; $i <= $end; $i++ ) { if($i == $key) @@ -53,7 +161,8 @@ } echo '<div class="leftsidebox'.$style.'">'; - switch($i) + echo $title_str[$i]; + /* switch($i) { case 0: echo i18n_install("Welcome"); @@ -65,14 +174,12 @@ echo $title_str[$i]; break; } +*/ echo "</div>"; } ?> -<br /><br /> - - <div class="button button_back"> <form method="POST" name="back_form" action="<?php echo $back_file; ?>"> <input type="submit" name="submit_button" value="<?php echo i18n_install("Back"); ?>"<?php echo $show_back_button ? '' : ' disabled="disabled"'; ?>> @@ -83,8 +190,7 @@ </div> <div class="rightside"> -<h1><?php echo $title_str[$key]; ?></h1> -<br /> + <?php if($show_next_button) Modified: trunk/linpha2/install/index.php =================================================================== --- trunk/linpha2/install/index.php 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/install/index.php 2007-07-13 17:20:47 UTC (rev 4755) @@ -28,13 +28,11 @@ include_once(LINPHA_DIR.'/install/header.php'); include_once(LINPHA_DIR.'/install/header_html.php'); -echo i18n_install("Welcome To LinPHA2 Installation"); +//echo "<br /><br />"; -echo "<br /><br /><br />"; - echo i18n_install("Please Select Your Preferred Language"); -echo "<br /><select name='language' size='1'>"; +echo "<br /><br /><select name='language' size='1'>"; $options = linGetAvailableLanguageFiles('install/lang' , $withEnglish=true); if(is_array($options)) Modified: trunk/linpha2/install/layout.css =================================================================== --- trunk/linpha2/install/layout.css 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/install/layout.css 2007-07-13 17:20:47 UTC (rev 4755) @@ -7,36 +7,73 @@ } table { + width: 605px; } td { text-align: center; } +th { + background-color: #1e489c; + color: #CCCCCC; + border: 1px solid #000000; +} + .main { - } +.header { + background-image: url('./graphics/header_bg.jpg'); + position: absolute; + width: 780px; + height: 80px; + float: left; + border: 1px solid #000000; + margin: 0px; + padding: 0px; + } +.header_icons { + position: absolute; + margin-top: 8px; + margin-left: 45px; +} + +.header_info { + position: absolute; + margin-top: 8px; + margin-left: 160px; +} + +.header_subinfo { + position: absolute; + margin-top: 45px; + margin-left: 160px; +} + .leftside { - position: relative; + position: absolute; + width: 150px; - height: 480px; + height: 430px; float: left; - margin: 0px; + margin-top: 82px; padding: 5px; } .rightside { - position: relative; - width: 600px; - min-height: 480px; + position: absolute; + width: 610px; + min-height: 427px; float: left; - margin: 0px; + margin-top: 82px; + margin-left: 160px; padding: 5px; + padding-top: 8px; } .button { @@ -48,13 +85,14 @@ } .button_back { - text-align: right; - right: 10px; + text-align: left; + left: 10px; } .button_next { + float: right; text-align: left; - left: 10px; + right: 10px; } .leftsidebox { @@ -81,8 +119,8 @@ text-align: left; } .license { - width: 95%; - height: 360px; + width: 610px; + height: 350px; } .boxalign { Modified: trunk/linpha2/install/lib.install.php =================================================================== --- trunk/linpha2/install/lib.install.php 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/install/lib.install.php 2007-07-13 17:20:47 UTC (rev 4755) @@ -331,7 +331,7 @@ try { $init_ok = true; - echo "<h2>".i18n_install("Checking Directory Permissions")."</h2><br />"; + echo "<h1>".i18n_install("Checking Directory Permissions")."</h1><hr>"; /** * checking album directory @@ -342,12 +342,12 @@ if( is_writable( $dirs['album'] ) ) { echo success_msg(); - echo '<br /> ('.$_SESSION['album_dir'].' => '.installLinRealpath( $dirs['album'] ).')'; + //echo '<br /> ('.$_SESSION['album_dir'].' => '.installLinRealpath( $dirs['album'] ).')'; } else { echo warning_msg(); - echo '<br /> ('.$_SESSION['album_dir'].' => '.installLinRealpath( $dirs['album'] ).')'; + //echo '<br /> ('.$_SESSION['album_dir'].' => '.installLinRealpath( $dirs['album'] ).')'; echo "<br />".i18n_install("Album Directory Not Writable. Some Features May Not Work")."<br />"; } } @@ -357,13 +357,13 @@ } - echo "<br /><br />"; - echo i18n_install("Creating Required Directories...").' '; + //echo "<br />"; + //echo i18n_install("Creating Required Directories...").' '; $array = array('sql','cache','tmp'); foreach($array AS $value) { - echo "<br /><br />".i18n_install("Checking Directory:")." ".$value."..."; + echo "<br />".i18n_install("Checking Directory:")." ".$value."..."." "; if( file_exists( $dirs[$value] ) ) { @@ -373,11 +373,11 @@ */ if( $_SESSION[$value.'_dir'] == 'var/'.$value) { - echo warning_msg(); - echo "<br />".i18n_install("Directory Already Exists - Trying To Delete...").' '; + //echo warning_msg(); + //echo "<br />".i18n_install("Directory Already Exists - Trying To Delete...").' '; if( installRm_rf( $dirs[$value] ) ) { - echo success_msg(); + //echo success_msg(); } else { @@ -390,7 +390,7 @@ } } - echo "<br /> ".i18n_install("Trying To Create Directory...").' '; + //echo "<br /> ".i18n_install("Trying To Create Directory...").' '; if( installMkdir_p( $dirs[$value] ) ) { echo success_msg(); @@ -405,16 +405,16 @@ throw new Exception(failed_msg()."<br />".i18n_install("Cannot create folder, please check permissions!")); } - echo '<br /> ('.$_SESSION[$value.'_dir'].' => '.installLinRealpath( $dirs[$value] ).')<br />'; + //echo '<br /> ('.$_SESSION[$value.'_dir'].' => '.installLinRealpath( $dirs[$value] ).')<br />'; } } catch(Exception $error) { echo $error -> getMessage(); - echo '<br /> ('.$_SESSION[$value.'_dir'].' => '.installLinRealpath( $dirs[$value] ).')<br />'; + //echo '<br /> ('.$_SESSION[$value.'_dir'].' => '.installLinRealpath( $dirs[$value] ).')<br />'; $init_ok = false; } - +echo "<br /><br />"; return $init_ok; } Modified: trunk/linpha2/install/look.css =================================================================== --- trunk/linpha2/install/look.css 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/install/look.css 2007-07-13 17:20:47 UTC (rev 4755) @@ -1,16 +1,16 @@ body { - font-size: 12pt; + font-size: 10pt; color: #000000; text-decoration: none; } h1 { - font-size: 16pt; + font-size: 14pt; text-decoration: bold; } h2 { - font-size: 14pt; + font-size: 12pt; text-decoration: bold; } @@ -31,6 +31,18 @@ .main { } +.header_info { + font-size: 14pt; + text-decoration: bold; + color: #CCCCCC; +} + +.header_subinfo { + font-size: 10pt; + text-decoration: bold; + color: #CCCCCC; +} + .leftside { background: #e2e2e2; border-right: 0px; Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/install/step2_requirements.php 2007-07-13 17:20:47 UTC (rev 4755) @@ -479,11 +479,11 @@ ?> <div align="center"> -<table width="95%"> +<table> <tr> - <td> </td> - <td><?php echo i18n_install("Result"); ?></td> - <td><?php echo i18n_install("Status"); ?></td> + <th><?php echo i18n_install("Test"); ?></th> + <th><?php echo i18n_install("Result"); ?></th> + <th><?php echo i18n_install("Status"); ?></th> </tr> <?php } Modified: trunk/linpha2/install/step3_dbtype.php =================================================================== --- trunk/linpha2/install/step3_dbtype.php 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/install/step3_dbtype.php 2007-07-13 17:20:47 UTC (rev 4755) @@ -69,6 +69,10 @@ 'oci8po' => "Oracle" ); +$db_support_missing = false; + +echo "<h1>"."$title_str[$key]"."</h1>"."<hr>"; + /** * check for supported databases * define disabled and checked variables @@ -99,23 +103,31 @@ } echo '<input type="radio" id="sql'.$key.'" name="sql_dbtype" value="'.$key.'"'.$disabled.$checked.'>' . - '<label for="sql'.$key.'">'.$array_databases_names[$key].'</label><br />'; + '<label for="sql'.$key.'">'.$array_databases_names[$key].'</label>'; if(!function_exists($value)) { - echo '<b>'.i18n_install("No Support In PHP Config (php.ini)").'</b><br />'; + echo " "; + echo "<strong><font color='red'>*</font></strong>"; + $db_support_missing = true; } echo '<br />'."\n\n"; + + if($db_support_missing == true) + { + echo "<br />"."<strong><font color='red'>*</font></strong>"." "; + echo i18n_install("Not Activated In PHP Configuration (php.ini)"); + } } ?> <br /><br /> -<h1><?php echo i18n_install("Select Installation Mode"); ?></h1> -<br /> +<h1><?php echo i18n_install("Select Installation Mode"); ?></h1><hr> + <input type='radio' name='install_mode' value='automatic' checked="checked"> <?php echo i18n_install("Automatic mode"); ?> -<br /><br /> +<br /> <input type='radio' name='install_mode' value='manual'> <?php echo i18n_install("Manual Mode (Experts Only)"); ?> Modified: trunk/linpha2/install/step4_selectdirectories.php =================================================================== --- trunk/linpha2/install/step4_selectdirectories.php 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/install/step4_selectdirectories.php 2007-07-13 17:20:47 UTC (rev 4755) @@ -74,7 +74,7 @@ <br /><br /> <br /> -<h2 style="color: red;"><?php echo i18n_install("Warning: All directories below will be deleted if they exists !!"); ?></h2> +<h2 style="color: red;"><?php echo i18n_install("Warning: All Directories Below Will Be Deleted If Exists !"); ?></h2><hr> <br /> <div class="boxalign"> Modified: trunk/linpha2/install/step5_getlogin.php =================================================================== --- trunk/linpha2/install/step5_getlogin.php 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/install/step5_getlogin.php 2007-07-13 17:20:47 UTC (rev 4755) @@ -82,9 +82,9 @@ } } ?> -<br /><br /> + +<h1><?php echo $title_str[$key]; ?></h1> <hr /> -<h1><?php echo $title_str[$key]; ?></h1> <br /> <?php if($_SESSION['sql_dbtype'] == 'mysql') Modified: trunk/linpha2/install/step6_selectdatabase.php =================================================================== --- trunk/linpha2/install/step6_selectdatabase.php 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/install/step6_selectdatabase.php 2007-07-13 17:20:47 UTC (rev 4755) @@ -64,7 +64,7 @@ { case "mysql": echo i18n_install("Testing Server Connection")."<br /><br />"; - echo i18n_install("Connecting MySQL-Server..."); + echo i18n_install("Connecting MySQL-Server... "); $link = @mysql_connect($_SESSION['sql_hostname'].":".$_SESSION['sql_dbport'], $_SESSION['sql_username'], $_SESSION['sql_password']); @@ -164,7 +164,7 @@ $checked_dontcreate = ''; } - echo i18n_install("You Are Allowed To Create A New Database (Recommended)"); + echo i18n_install("Create A New Database (Recommended)"); ?> <br /> <input type="radio" id="radio_db1" name="create_database" @@ -187,7 +187,7 @@ { echo i18n_install("Install Into Existing Database:").' '; ?> - <br /> + <select name="sql_dbname_installinto"<?php if($_SESSION['allowed_to_create_db'] == true) { @@ -220,7 +220,7 @@ } else { - echo i18n_install("Name Of Database To Use (Must Allready Exist):"); + echo i18n_install("Name Of Database To Use (Must Already Exist):"); } ?> <br /> Modified: trunk/linpha2/install/step7_selectprefix.php =================================================================== --- trunk/linpha2/install/step7_selectprefix.php 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/install/step7_selectprefix.php 2007-07-13 17:20:47 UTC (rev 4755) @@ -68,7 +68,7 @@ switch($_SESSION['sql_dbtype']) { case "mysql": - echo "<h2>".i18n_install("Checking Database")."</h2><br />"; + echo i18n_install("Connecting MySQL Server")."<br />"; $link = @mysql_connect($_SESSION['sql_hostname'].":".$_SESSION['sql_dbport'], $_SESSION['sql_username'], $_SESSION['sql_password']); @@ -109,7 +109,6 @@ break; case "postgres": - echo i18n_install("Testing Server Connection")."<br /><br />"; echo i18n_install("Connecting PostgreSQL-Server...").' '; $link = pg_connect("host=".$_SESSION['sql_hostname']." " . @@ -142,7 +141,6 @@ exit(); } - echo i18n_install("Testing File Connection")."<br /><br />"; echo i18n_install("Connecting SQLite Database...").' '; if(file_exists(LINPHA_DIR.'/'.$_SESSION['sql_dir'].'/'.$_SESSION['sql_dbname'])) @@ -171,7 +169,6 @@ } break; case "oci8po": - echo i18n_install("Testing Server Connection")."<br /><br />"; echo i18n_install("Connecting ORACLE-Server...").' '; /** * make already use of ADBDO as native oci_connet() sucks @@ -211,13 +208,12 @@ if($_SESSION['sql_dbtype'] != "sqlite") { ?> - <br /><br /> <hr> <br /> - <?php echo i18n_install("Please Enter Database Prefix For Linpha Tables (Default: linpha_)").": <br />" ?> + <?php echo i18n_install("Please Enter Database Prefix For Linpha Tables (Default: linpha2_)").": <br />" ?> <input type="text" id="check01" onKeyup="checkForm()" name="sql_prefix" value="<?php echo isset($_SESSION['sql_prefix']) ? - $_SESSION['sql_prefix'] : 'linpha_' ; ?>"> + $_SESSION['sql_prefix'] : 'linpha2_' ; ?>"> <?php $array_check = array( Modified: trunk/linpha2/install/step8_testing.php =================================================================== --- trunk/linpha2/install/step8_testing.php 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/install/step8_testing.php 2007-07-13 17:20:47 UTC (rev 4755) @@ -61,7 +61,7 @@ * switching to AdoDB * connect to db and check if connection was succesfull */ - echo i18n_install("Switching To AdoDB...").' '; + echo i18n_install("Switching To AdoDB..").' '; $_SESSION['installmode1'] = true; $_SESSION['installmode2'] = true; @@ -70,19 +70,18 @@ $linpha = new Linpha(); $linpha->sql->dbConnect(); - echo success_msg(); + echo success_msg(); -echo '<br /><br /><hr /><br />'; +echo '<br />'; + /** * checking prefix if not any table already exists */ if($_SESSION['sql_dbtype'] != "sqlite") { ?> - <h2><?php echo i18n_install("Checking Table Prefix"); ?></h2><br /> - <?php echo i18n_install("Checking For Existing Tables...").' '; ?> <?php $array_tables = $linpha->db->MetaTables(); @@ -121,7 +120,7 @@ echo success_msg(); } } - echo '<br /><hr /><br />'; + echo '<br />'; } /** @@ -146,7 +145,7 @@ { echo warning_msg(); echo "<br />".i18n_install("Failed To Create New LinPHA User"); - echo "<br />".i18n_install("Seems you are not allowed to create new Database users using given defaults."); + echo "<br />".i18n_install("Seems you are not allowed to create new Database users using given defaults.")."<br />"; echo ' ('.i18n_install("NOTE: Installation should still work").')'; } else @@ -155,7 +154,7 @@ { echo warning_msg(); echo "<br />".i18n_install("Failed To Create New LinPHA User"); - echo "<br />".i18n_install("Seems you are not allowed to create new Database users using given defaults."); + echo "<br />".i18n_install("Seems you are not allowed to create new Database users using given defaults.")."<br />"; echo ' ('.i18n_install("NOTE: Installation should still work").')'; } else @@ -168,7 +167,7 @@ { echo warning_msg(); echo "<br />".i18n_install("Failed To Create New LinPHA User"); - echo "<br />".i18n_install("Seems you are not allowed to create new Database users using given defaults."); + echo "<br />".i18n_install("Seems you are not allowed to create new Database users using given defaults.")."<br />"; echo ' ('.i18n_install("NOTE: Installation should still work").')'; } else Modified: trunk/linpha2/install/step9_createtables.php =================================================================== --- trunk/linpha2/install/step9_createtables.php 2007-07-13 09:06:52 UTC (rev 4754) +++ trunk/linpha2/install/step9_createtables.php 2007-07-13 17:20:47 UTC (rev 4755) @@ -124,7 +124,7 @@ /** * insert data */ - echo "<br /><br />".i18n_install("Inserting Table Data...").' '; + echo "<br />".i18n_install("Inserting Table Data...").' '; include_once(LINPHA_DIR.'/install/sql/sql.data.php'); foreach($sql_queries AS $value) { @@ -154,7 +154,7 @@ /** * create cache directories */ - echo "<br /><br />".i18n_install("Creating Cache Directories...").' '; + echo "<br />".i18n_install("Creating Cache Directories...").' '; mkdir(installGetFullPath( $_SESSION['cache_dir'] ).'/img', 0700); mkdir(installGetFullPath( $_SESSION['cache_dir'] ).'/thumb', 0700); @@ -166,7 +166,7 @@ /** * create config.dir.php file */ - echo "<br /><br />".sprintf( i18n_install("Creating %s File..."),'config.dir.php').' '; + echo "<br />".sprintf( i18n_install("Creating %s File..."),'config.dir.php').' '; $fp = fopen(LINPHA_DIR."/var/config.dir.php","w+"); if($fp) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2007-08-18 16:28:19
|
Revision: 4762 http://linpha.svn.sourceforge.net/linpha/?rev=4762&view=rev Author: fangehrn Date: 2007-08-18 09:28:16 -0700 (Sat, 18 Aug 2007) Log Message: ----------- 2007-08-18 flo * adding google maps support - added gmapper class (http://gmapper.ajax-info.de/) - added basic map at ../linpha2/?&linCat=map Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/include/common.php Added Paths: ----------- trunk/linpha2/lib/plugins/maps/gmapper1/ trunk/linpha2/lib/plugins/maps/gmapper1/143.png trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.clean.js trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.js trunk/linpha2/lib/plugins/maps/gmapper1/class.gmapper.php trunk/linpha2/lib/plugins/maps/gmapper1/dash.png trunk/linpha2/lib/plugins/maps/gmapper1/docs/ trunk/linpha2/lib/plugins/maps/gmapper1/docs/gmap.html trunk/linpha2/lib/plugins/maps/gmapper1/docs/stylesheet.css trunk/linpha2/lib/plugins/maps/gmapper1/gelb.png trunk/linpha2/lib/plugins/maps/gmapper1/gruen.png trunk/linpha2/lib/plugins/maps/gmapper1/img/ trunk/linpha2/lib/plugins/maps/gmapper1/img/dir_105.png trunk/linpha2/lib/plugins/maps/gmapper1/img/dir_111.png trunk/linpha2/lib/plugins/maps/gmapper1/img/dir_30.png trunk/linpha2/lib/plugins/maps/gmapper1/img/dir_45.png trunk/linpha2/lib/plugins/maps/gmapper1/img/dir_60.png trunk/linpha2/lib/plugins/maps/gmapper1/img/dir_72.png trunk/linpha2/lib/plugins/maps/gmapper1/img/dir_75.png trunk/linpha2/lib/plugins/maps/gmapper1/img/dir_90.png trunk/linpha2/lib/plugins/maps/gmapper1/img/dir_93.png trunk/linpha2/lib/plugins/maps/gmapper1/rot.png trunk/linpha2/lib/plugins/maps/module.exampleMap.php trunk/linpha2/templates/default/map.head.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-08-09 08:34:51 UTC (rev 4761) +++ trunk/linpha2/ChangeLog 2007-08-18 16:28:16 UTC (rev 4762) @@ -1,3 +1,8 @@ +2007-08-18 flo + * adding google maps support + - added gmapper class (http://gmapper.ajax-info.de/) + - added basic map at ../linpha2/?&linCat=map + 2007-07-13 bzrudi * Major redesign and cleanups in Installer and a lot of eyecandy. Please test and report any issues, errors, warnings, layout quirks! Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2007-08-09 08:34:51 UTC (rev 4761) +++ trunk/linpha2/index.php 2007-08-18 16:28:16 UTC (rev 4762) @@ -67,6 +67,9 @@ case 'download': require_once(LINPHA_DIR.'/lib/modules/module.download.php'); break; +case 'map': + require_once(LINPHA_DIR.'/lib/plugins/maps/module.exampleMap.php'); + break; case 'empty': require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); break; Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2007-08-09 08:34:51 UTC (rev 4761) +++ trunk/linpha2/lib/classes/linpha.class.php 2007-08-18 16:28:16 UTC (rev 4762) @@ -45,6 +45,15 @@ /** * some defines + * + * LINPHA_DIR is used in PHP contex to include other php files + * LINPHA_LINK is used in HTML contex for URLs + * LINPHA_CLIENT is used in HTML context for images and javascript includes + * + * we have to difference LINPHA_LINK and LINPHA_CLIENT because LINPHA_LINK does not + * point always to the linpha directory, e.g. when linpha is included in another + * website + * */ if(!defined('LINPHA_LINK')) { Modified: trunk/linpha2/lib/include/common.php =================================================================== --- trunk/linpha2/lib/include/common.php 2007-08-09 08:34:51 UTC (rev 4761) +++ trunk/linpha2/lib/include/common.php 2007-08-18 16:28:16 UTC (rev 4762) @@ -11,7 +11,7 @@ * - lib/include/calendar.php, lib/lang/language.php, * - install/index.php, install/step* */ - define('LINPHA_VERSION','2.0 alpha 1'); + define('LINPHA_VERSION','2.0 alpha 2'); /** * Magic Quotes stuff Added: trunk/linpha2/lib/plugins/maps/gmapper1/143.png =================================================================== (Binary files differ) Property changes on: trunk/linpha2/lib/plugins/maps/gmapper1/143.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.clean.js =================================================================== --- trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.clean.js (rev 0) +++ trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.clean.js 2007-08-18 16:28:16 UTC (rev 4762) @@ -0,0 +1,180 @@ +function createMarker(point, image) +{ + var icon = new GIcon(); + icon.image = image[0]; + icon.iconSize = new GSize(image[1], image[2]); + subt = image[2] / 100 * 11; + subt = Math.ceil(subt); + var anchor = image[2] - subt; + icon.iconAnchor= new GPoint(10, anchor); + //{icon: icon, draggable: true} + var marker = new GMarker(point,icon); + return marker; +} + +function createMapMarker(point,image) +{ + var icon = new GIcon(); + icon.image = image[0]; + icon.iconSize = new GSize(image[1], image[2]); + subt = image[2] / 100 * 11; + subt = Math.ceil(subt); + var anchor = image[2] - subt; + icon.iconAnchor= new GPoint(10, anchor); + var infoanchor = image[2] / 3; + infoanchor = Math.floor(infoanchor); + icon.infoWindowAnchor = new GPoint(infoanchor, 2); + var marker = new GMarker(point,icon); + GEvent.addListener(marker, "click", function() {map.showMapBlowup(marker.getPoint());}); + return marker; +} + + +function createTabMarker(point, tabs,image) +{ + var icon = new GIcon(); + icon.image = image[0]; + icon.iconSize = new GSize(image[1], image[2]); + subt = image[2] / 100 * 11; + subt = Math.ceil(subt); + var anchor = image[2] - subt; + icon.iconAnchor= new GPoint(10, anchor); + var infoanchor = image[2] / 3; + icon.infoWindowAnchor = new GPoint(infoanchor, 2); + var marker = new GMarker(point,icon); + GEvent.addListener(marker, "click", function() { + marker.openInfoWindowTabsHtml(tabs); + }); + return marker; +} + +function createLinkMarker(point, link,image) +{ + var icon = new GIcon(); + icon.image = image[0]; + icon.iconSize = new GSize(image[1], image[2]); + subt = image[2] / 100 * 11; + subt = Math.ceil(subt); + var anchor = image[2] - subt; + icon.iconAnchor= new GPoint(10, anchor); + var infoanchor = image[2] / 3; + icon.infoWindowAnchor = new GPoint(infoanchor, 2); + var marker = new GMarker(point,icon); + + GEvent.addListener(marker, "click", function() { + window.location.href = link; + }); + return marker; +} + +function createOtherMarker(point, number,image) +{ + var icon = new GIcon(); + icon.image = image[0]; + icon.iconSize = new GSize(image[1], image[2]); + subt = image[2] / 100 * 11; + subt = Math.ceil(subt); + var anchor = image[2] - subt; + icon.iconAnchor= new GPoint(10, anchor); + var infoanchor = image[2] / 3; + infoanchor = Math.floor(infoanchor); + icon.infoWindowAnchor = new GPoint(infoanchor, 2); + var marker = new GMarker(point,icon); + var html = number; + GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);}); + return marker; +} + + var arrowIcon = new GIcon(); + arrowIcon.iconSize = new GSize(24,24); + arrowIcon.shadowSize = new GSize(1,1); + arrowIcon.iconAnchor = new GPoint(12,12); + arrowIcon.infoWindowAnchor = new GPoint(0,0); + var degreesPerRadian = 180.0 / Math.PI; + function bearing( from, to ) { + var lat1 = from.latRadians(); + var lon1 = from.lngRadians(); + var lat2 = to.latRadians(); + var lon2 = to.lngRadians(); + + var angle = - Math.atan2( Math.sin( lon1 - lon2 ) * Math.cos( lat2 ), Math.cos( lat1 ) * Math.sin( lat2 ) - Math.sin( lat1 ) * Math.cos( lat2 ) * Math.cos( lon1 - lon2 ) ); + if ( angle < 0.0 ) + angle += Math.PI * 2.0; + + angle = angle * degreesPerRadian; + angle = angle.toFixed(1); + + return angle; + } + + function arrowHead(points) { + var p1=points[points.length-1]; + var p2=points[points.length-2]; + var dir = bearing(p2,p1); + var dir = Math.round(dir/3) * 3; + while (dir >= 120) {dir -= 120;} + arrowIcon.image = "/img/dir_"+dir+".png"; + map.addOverlay(new GMarker(p1, arrowIcon)); + } + + function midArrows(points) { + for (var i=1; i < points.length-1; i++) { + var p1=points[i-1]; + var p2=points[i+1]; + var dir = bearing(p1,p2); + + var dir = Math.round(dir/3) * 3; + while (dir >= 120) {dir -= 120;} + arrowIcon.image = "/img/dir_"+dir+".png"; + map.addOverlay(new GMarker(points[i], arrowIcon)); + } + } + + function geocodeAddress(address,typ,marker,zoom) { + geocoder.getLatLng( + address, + function(point) { + if (!point) { + alert(address + " nicht gefunden"); + } else { + var lat = point.lat(); + var lng = point.lng(); + map.setCenter(point,zoom); + if(typ == "otherMarker") + { + marker = createOtherMarker(point,address,marker); + } + else if(typ == "marker") + { + marker = createMarker(point,marker); + } + else if(typ == "mapMarker") + { + marker = createMapMarker(point,marker); + } + map.addOverlay(marker); + } + } + ); +} + + function getAdress() + { + var adress = document.getElementById('adresse').value; + return adress; + } + + function tilechk() + { + paragraphs = map.getContainer().getElementsByTagName('p').length; + if(paragraphs>4) + { + map.zoomOut(false,true); + } + } + function wheelevent(e) + { + if (!e) e = window.event; + if (e.preventDefault) e.preventDefault(); + e.returnValue = false; + } \ No newline at end of file Added: trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.js =================================================================== --- trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.js (rev 0) +++ trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.js 2007-08-18 16:28:16 UTC (rev 4762) @@ -0,0 +1 @@ +function createMarker(_1,_2){var _3=new GIcon();_3.image=_2[0];_3.iconSize=new GSize(_2[1],_2[2]);subt=_2[2]/100*11;subt=Math.ceil(subt);var _4=_2[2]-subt;_3.iconAnchor=new GPoint(10,_4);var _5=new GMarker(_1,_3);return _5;}function createMapMarker(_6,_7){var _8=new GIcon();_8.image=_7[0];_8.iconSize=new GSize(_7[1],_7[2]);subt=_7[2]/100*11;subt=Math.ceil(subt);var _9=_7[2]-subt;_8.iconAnchor=new GPoint(10,_9);var _a=_7[2]/3;_a=Math.floor(_a);_8.infoWindowAnchor=new GPoint(_a,2);var _b=new GMarker(_6,_8);GEvent.addListener(_b,"click",function(){map.showMapBlowup(_b.getPoint());});return _b;}function createTabMarker(_c,_d,_e){var _f=new GIcon();_f.image=_e[0];_f.iconSize=new GSize(_e[1],_e[2]);subt=_e[2]/100*11;subt=Math.ceil(subt);var _10=_e[2]-subt;_f.iconAnchor=new GPoint(10,_10);var _11=_e[2]/3;_f.infoWindowAnchor=new GPoint(_11,2);var _12=new GMarker(_c,_f);GEvent.addListener(_12,"click",function(){_12.openInfoWindowTabsHtml(_d);});return _12;}function createLinkMarker(_13,_14,_15){var _16=new GIcon();_16.image=_15[0];_16.iconSize=new GSize(_15[1],_15[2]);subt=_15[2]/100*11;subt=Math.ceil(subt);var _17=_15[2]-subt;_16.iconAnchor=new GPoint(10,_17);var _18=_15[2]/3;_16.infoWindowAnchor=new GPoint(_18,2);var _19=new GMarker(_13,_16);GEvent.addListener(_19,"click",function(){window.location.href=_14;});return _19;}function createOtherMarker(_1a,_1b,_1c){var _1d=new GIcon();_1d.image=_1c[0];_1d.iconSize=new GSize(_1c[1],_1c[2]);subt=_1c[2]/100*11;subt=Math.ceil(subt);var _1e=_1c[2]-subt;_1d.iconAnchor=new GPoint(10,_1e);var _1f=_1c[2]/3;_1f=Math.floor(_1f);_1d.infoWindowAnchor=new GPoint(_1f,2);var _20=new GMarker(_1a,_1d);var _21=_1b;GEvent.addListener(_20,"click",function(){_20.openInfoWindowHtml(_21);});return _20;}var arrowIcon=new GIcon();arrowIcon.iconSize=new GSize(24,24);arrowIcon.shadowSize=new GSize(1,1);arrowIcon.iconAnchor=new GPoint(12,12);arrowIcon.infoWindowAnchor=new GPoint(0,0);var degreesPerRadian=180/Math.PI;function bearing(_22,to){var _24=_22.latRadians();var _25=_22.lngRadians();var _26=to.latRadians();var _27=to.lngRadians();var _28=-Math.atan2(Math.sin(_25-_27)*Math.cos(_26),Math.cos(_24)*Math.sin(_26)-Math.sin(_24)*Math.cos(_26)*Math.cos(_25-_27));if(_28<0){_28+=Math.PI*2;}_28=_28*degreesPerRadian;_28=_28.toFixed(1);return _28;}function arrowHead(_29){var p1=_29[_29.length-1];var p2=_29[_29.length-2];var dir=bearing(p2,p1);var dir=Math.round(dir/3)*3;while(dir>=120){dir-=120;}arrowIcon.image="/img/dir_"+dir+".png";map.addOverlay(new GMarker(p1,arrowIcon));}function midArrows(_2e){for(var i=1;i<_2e.length-1;i++){var p1=_2e[i-1];var p2=_2e[i+1];var dir=bearing(p1,p2);var dir=Math.round(dir/3)*3;while(dir>=120){dir-=120;}arrowIcon.image="/img/dir_"+dir+".png";map.addOverlay(new GMarker(_2e[i],arrowIcon));}}function geocodeAddress(_34,typ,_36,_37){geocoder.getLatLng(_34,function(_38){if(!_38){alert(_34+" nicht gefunden");}else{var lat=_38.lat();var lng=_38.lng();map.setCenter(_38,_37);if(typ=="otherMarker"){_36=createOtherMarker(_38,_34,_36);}else{if(typ=="marker"){_36=createMarker(_38,_36);}else{if(typ=="mapMarker"){_36=createMapMarker(_38,_36);}}}map.addOverlay(_36);}});}function getAdress(){var _3b=document.getElementById("adresse").value;return _3b;}function tilechk(){paragraphs=map.getContainer().getElementsByTagName("p").length;if(paragraphs>4){map.zoomOut(false,true);}}function wheelevent(e){if(!e){e=window.event;}if(e.preventDefault){e.preventDefault();}e.returnValue=false;} \ No newline at end of file Added: trunk/linpha2/lib/plugins/maps/gmapper1/class.gmapper.php =================================================================== --- trunk/linpha2/lib/plugins/maps/gmapper1/class.gmapper.php (rev 0) +++ trunk/linpha2/lib/plugins/maps/gmapper1/class.gmapper.php 2007-08-18 16:28:16 UTC (rev 4762) @@ -0,0 +1,745 @@ +<?php +/** + * + * @author Philipp Kiszka <in...@o-...> + * @name Gmapper + * @version 1.0 + * @link http://gmapper.ajax-info.de + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + */ +class gmap { + // Google Maps API Key + var $key; + /** + * Der Konstruktor nimmt den Google Maps API Key als Parameter entgegen. + * Dies ist die empfohlene Methode, den API Key einzubinden. + * + * @param string $mapkey Google Maps API Key + */ + function gmap($mapkey = "") + { + $this->key = $mapkey; + } + /** + * Erzeugt JS Code im HEAD Bereich der Seite. + * DEPRECATED: + * API Key sollte jetzt im Konstruktor der Klasse \xFCbergeben werden. + * Beispiel: + * $karte = new gmap("API KEY"); + * + * @param string $key Google Maps API Key + * @return bool + */ + function headjs($key = "") + { + if (!$key) { + $key = $this->key; + } + echo "<script src=\"http://maps.google.com/maps?file=api&v=2&key=$key\" type=\"text/javascript\" language=\"javascript\"></script>\n + <style type=\"text/css\">\n + v\:* {\n + behavior:url(#default#VML);\n + }\n + </style>"; + if ($key) { + return true; + } else { + return false; + } + } + + /** + * Platziert die Karte + * + * @param int $width Breite der Karte + * @param int $height H\xF6he der Karte + * @return bool + */ + function mapdiv($height, $width) + { + $width = $width . "px"; + $height = $height . "px"; + echo "<div id = \"gmapper_map\" style = \"width:$width;height:$height;\" ></div>"; + if ($height and $width) { + return true; + } else { + return false; + } + } + + /** + * Erzeugt die Kartendarstellung + * + * @param int $zoom Initiale Zoomstufe + * @param int $lat Initialer Breitengrad + * @param int $lng Initialer L\xE4ngengrad + * @param string $typ Kartentyp (normal,satellit,hybrid) Default: normal + * @param int $min_zoom Minimal m\xF6gliche Zoomstufe + * @param int $max_zoom Maximal M\xF6gliche Zoomstufe + * @param string $navcontrol Typ der Kartennavigation (small,large) Default: large + * @param int $overview Schaltet die \xDCbersichtskarte an oder aus. + * @param int $mousezoom Schaltet den Mouserad Zoom an oder aus. + * @param int $tilecheck Schaltet den Check nach Tile-Grafiken beim Zoomen an und aus (Default: an) + * @return bool + */ + function map($zoom, $lat, $lng, $typ = "normal", $min_zoom = 0, $max_zoom = 0, $navcontrol = "large", $overview = 0, $mousezoom = 1, $tilecheck = 1) + { + $width = $width . "px"; + $height = $height . "px"; + $lat2 = $lat - 0.1; + if ($typ == "normal") { + $typstr = "G_NORMAL_MAP"; + } elseif ($typ == "satellit") { + $typstr = "G_SATELLITE_MAP"; + } elseif ($typ == "hybrid") { + $typstr = "G_HYBRID_MAP"; + } + if ($navcontrol == "large") { + $controlstr = "GLargeMapControl()"; + } elseif ($navcontrol == "small") { + $controlstr = "GSmallMapControl()"; + } + echo "<script type=\"text/javascript\">\n + //<![CDATA[\n + var map = new GMap2(document.getElementById(\"gmapper_map\"));\n + var geocoder = new GClientGeocoder();\n"; + if ($mousezoom) { + echo "map.enableScrollWheelZoom();\n + var mapdiv = document.getElementById(\"gmapper_map\");\n + GEvent.addDomListener(mapdiv, \"DOMMouseScroll\", wheelevent);\n + mapdiv.onmousewheel = wheelevent;\n "; + } + if ($overview) { + echo "map.addControl(new GOverviewMapControl());\n"; + } + echo " + map.addControl(new $controlstr);\n + map.addControl(new GMapTypeControl());\n"; + if ($min_zoom > 0 and $max_zoom > 0) { + echo " + var mt = map.getMapTypes(); + for (var i=0; i<mt.length; i++) { + mt[i].getMinimumResolution = function() {return $min_zoom;} + mt[i].getMaximumResolution = function() {return $max_zoom;} + }"; + } + echo " + var mycontrol = new GMapTypeControl(); + map.addControl(mycontrol);\n + map.setCenter(new GLatLng( $lat,$lng),$zoom);\n + new GKeyboardHandler(map);\n + map.enableDoubleClickZoom();\n + map.enableContinuousZoom();\n + map.setMapType($typstr); + + \n"; + if ($tilecheck == 1) { + echo "var interval = setInterval(\"tilechk()\",500);"; + } + echo " + //]]>\n + </script>"; + return true; + } + + /** + * Zeigt den Kartenmasstab an. + * + * @return bool + */ + function showScale() + { + echo "map.addControl(new GScaleControl());\n"; + return true; + } + /** + * Sperrt das Drag / Pan der Karte. Die Karte wird so auf den Viewport fixiert. + * + * @return bool + */ + + function lockMap() + { + echo "map.disableDragging(); map.hideControls();\n"; + return true; + } + /** + * Erzeugt den JS Code im BODY der Seite. + * + * @return bool + */ + function bodyjs() + { + echo " + <script type=\"text/javascript\" src = \"bodyjs.js\"></script>\n"; + return true; + } + + /** + * Erzeugt ben\xF6tigten JS Code im Seitenfuss + * + * @return bool + */ + function footjs() + { + echo "//]]>\n</script>"; + return true; + } + /** + * Ende des Markerbereichs + * + * @return bool + */ + function markend() + { + echo "//]]>\n</script>"; + return true; + } + /** + * Start des Markerbereichs + * + * @return bool + */ + function markstart() + { + echo "<script type=\"text/javascript\">\n + //<![CDATA[\n"; + return true; + } + /** + * Erzeugt einen einfachen Marker. + * + * @param int $lat Breitengrad des Markers + * @param int $lng L\xE4ngengrad des Markers + * @param string $img Steuerung der Grafik + * @return bool + */ + function marker($lat, $lng, $img = "143.png") + { + if ($lat and $lng) { + $dims = getimagesize($img); + echo "var image = new Array(\"$img\",$dims[0],$dims[1]);\n"; + echo "var point = new GLatLng(\"$lat\",\"$lng\");\n"; + echo "var marker = createMarker(point, image);\n"; + echo "var to = point;\n"; + echo "map.addOverlay(marker);\n"; + echo "\n"; + return true; + } else { + return false; + } + } + /** + * Erzeugt einen Marker mit Infopopup und verschiedenen Grafiken + * + * @param int $lat Breitengrad des Markers + * @param int $lng L\xE4ngengrad des Markers + * @param string $html HTML Code f\xFCr das Infopopup + * @param string $img Steuerung der Grafik + * @return bool + */ + function otherMarker($lat, $lng, $html = "", $img = "143.png") + { + $dims = getimagesize($img); + if ($lat and $lng) { + echo "var image = new Array(\"$img\",$dims[0],$dims[1]);\n"; + echo "var point = new GLatLng(\"$lat\",\"$lng\");\n"; + echo "var marker = createOtherMarker(point, '$html',image);\n"; + + echo "map.addOverlay(marker);\n"; + echo "\n"; + return true; + } else { + return false; + } + } + /** + * Erzeugt einen Marker mit mehreren Tabs im Infopopup + * + * @param int $lat Breitengrad des Markers + * @param int $lng L\xE4ngengrad des Markers + * @param array $tabs Merhdimensionales Array mit den einzelnen Tabs + * @param string $img Steuerung der Grafik + * @return bool + */ + function tabMarker($lat, $lng, $tabs, $img = "143.png") + { + if ($lat and $lng) { + $dims = getimagesize($img); + echo "var image = new Array(\"$img\",$dims[0],$dims[1]);\n"; + echo "var infoTabs = [\n"; + foreach($tabs as $tab) { + $str .= " + new GInfoWindowTab(\"$tab[0]\", \"$tab[1]\"),\n"; + } + $str = substr($str, 0, strlen($str)-2); + echo $str; + echo "\n];\n"; + echo "var point = new GLatLng(\"$lat\",\"$lng\");\n"; + echo "var marker = createTabMarker(point, infoTabs,image);\n"; + echo "map.addOverlay(marker);\n"; + echo "\n"; + return true; + } else { + return false; + } + } + /** + * Erzeugt einen Marker der auf den in $link angegeben URL verweist. + * + * @param int $lat Breitengrad des Markers + * @param int $lng L\xE4ngengrad des Markers + * @param string $link Merhdimensionales Array mit den einzelnen Tabs + * @param string $img Steuerung der Grafik + * @return bool + */ + function linkMarker($lat, $lng, $link, $img = "143.png") + { + if ($lat and $lng) { + $dims = getimagesize($img); + echo "var image = new Array(\"$img\",$dims[0],$dims[1]);\n"; + echo "var point = new GLatLng(\"$lat\",\"$lng\");\n"; + echo "var marker = createLinkMarker(point, '$link',image);\n"; + echo "map.addOverlay(marker);\n"; + echo "\n"; + return true; + } else { + return false; + } + } + /** + * Erzeugt einen Marker dessen Infopopup eine Detailkarte enth\xE4lt + * + * @param int $lat Breitengrad des Markers + * @param int $lng L\xE4ngengrad des Markers + * @param string $img Steuerung der Grafik + * @return bool + */ + function mapMarker($lat, $lng, $img = "143.png") + { + if ($lat and $lng) { + $dims = getimagesize($img); + echo "var image = new Array(\"$img\",$dims[0],$dims[1]);\n"; + echo "var point = new GLatLng(\"$lat\",\"$lng\");\n"; + echo "var marker = createMapMarker(point,image);\n"; + echo "map.addOverlay(marker);\n"; + echo "\n"; + return true; + } else { + return false; + } + } + /** + * Erzeugt ein Geocoding Request und gibt eine Polyline, sowie Ortsliste zur\xFCck + * + * @param string $start Startort + * @param string $end Endort + * @param string $startmarker Markergrafik des Startorts + * @param string $endmarker Markergrafik des Endorts + * @param int $zoombounds Zoom und Center so setzen, dass sowohl Start als auch Zielort sichtbar sind. + * @param string $textbox Name des HTML Elements in dem die Wegliste ausgegeben wird (Element ID) + * @return bool + */ + function directions($start, $end, $startmarker = "143.png", $endmarker = "143.png", $zoombounds = 0, $textbox = "") + { + $dims = getimagesize($startmarker); + $dims2 = getimagesize($endmarker); + echo "var dire = new GDirections(); + GEvent.addListener(dire, \"load\", gload); + dire.load(\"from: $start to: $end\",{getPolyline:true,getSteps:true}); + function gload() + { + var distanz = dire.getDistance().meters; + distanz = distanz / 1000; + distanz = Math.round(distanz); + var poly = dire.getPolyline(); + var bounds = dire.getBounds(); + var route = dire.getRoute(0); + var step1 = route.getStep(0).getLatLng(); + var step_last = route.getEndLatLng();"; + if ($zoombounds) { + echo "map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));"; + } + echo " + map.addOverlay(poly); + var image = new Array(\"$startmarker\",\"$dims[0]\",\"$dims[1]\"); + var marker = createMapMarker(step1, image); + map.addOverlay(marker); + var image = new Array(\"$endmarker\",\"$dims2[0]\",\"$dims2[1]\"); + var marker = createMapMarker(step_last, image); + map.addOverlay(marker);"; + if ($textbox != "") { + echo "var steps = route.getNumSteps(); + document.getElementById('$textbox').innerHTML = '<b>Entfernung:</b> ' + distanz + ' Km<br>'; + for(i=0;i<=steps;i++) + { + mystep = route.getStep(i) + if(mystep) + { + o = i + 1; + shtml = mystep.getDescriptionHtml(); + document.getElementById('$textbox').innerHTML += o + '. ' + shtml + '<br>'; + } + }"; + } + echo "}"; + return true; + } + + /** + * Erzeugt ein Bounds Objekt + * + * @return bool + */ + function bounds() + { + echo "var bounds = new GLatLngBounds();\n"; + return true; + } + /** + * Erweitert ein vorhandenes Bounds Objekt um den zuletzt hinzugef\xFCgten Punkt. + * + * @return bool + */ + function boundsExtend() + { + echo "bounds.extend(point)\n"; + return true; + } + /** + * Setzt den Kartenzoom "To bounds". + * + * @return bool + */ + function zoomToBounds() + { + echo "map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));\n"; + return true; + } + + /** + * Erzeugt eine Linie zwischen mehreren Punkten + * + * @param array $punkte Erwartet ein Mehrdimensionales Array mit lat/lng der einzelnen Punkte + * @param string $color Die Farbe der Linie als Hexcode + * @param int $breite Die Breite der Linie + * @param int $transparent Transparenz an / aus + * @param string $arrows Richtungspfeile. "all" = \xFCberall, mid = "nur auf der Wegstrecke" , "end = "nur am "Ende" + * @param int $geodetic Legt fest ob "geod\xE4sische" Polylines gezeichnet werden. Diese ber\xFCcksichtigen die Erdkr\xFCmmung. + * @return bool + */ + function polyline($punkte, $color = "#FF0000", $breite = 1, $transparent = 0, $arrows = "", $geodetic = 0) + { + $polystr = ""; + $pts = "["; + + ?> + var polyline = new GPolyline([ + <?php + foreach($punkte as $punkt) { + $pts .= "new GLatLng($punkt[0],$punkt[1]),"; + $polystr .= "new GLatLng($punkt[0],$punkt[1]),\n"; + } + $polystr = substr($polystr, 0, strlen($polystr)-2); + $pts = substr($pts, 0, strlen($pts)-1); + $pts .= "]"; + + echo " + $polystr],'$color',$breite,$transparent"; + if ($geodetic == 1) { + echo ",{geodesic:true}"; + } + echo ");\n + map.addOverlay(polyline);\n"; + if ($arrows == "end") { + echo "arrowHead($pts);\n"; + } elseif ($arrows == "mid") { + echo "midArrows($pts);\n"; + } elseif ($arrows == "all") { + echo "arrowHead($pts);\n + midArrows($pts);\n"; + } + + return true; + } + + /** + * Ermittelt die L\xE4nge einer Polyline in Metern. + * + * @param array $punkte das Array aus dem die Polyline erstellt wurde. + * @return int $entfernung + */ + function getDistance($koord) + { + if (!is_array($koord)) { + return false; + } + + $ent = 0; + $welt = 6378.137; // Erdradius, ca. Angabe + + foreach($koord as $key => $fetch) { + if (isset($koord[$key + 1])) { + $erste_breite = $koord[$key][0]; // lat + $erste_laenge = $koord[$key][1]; // lon + $erste_breite_rad = deg2rad($erste_breite); + $erste_laenge_rad = deg2rad($erste_laenge); + + $zweite_breite = $koord[$key + 1][0]; // lat + $zweite_laenge = $koord[$key + 1][1]; // lon + $zweite_breite_rad = deg2rad($zweite_breite); + $zweite_laenge_rad = deg2rad($zweite_laenge); + + $dis = acos( + (sin($erste_breite_rad) * sin($zweite_breite_rad)) + + (cos($erste_breite_rad) * cos($zweite_breite_rad) * + cos($zweite_laenge_rad - $erste_laenge_rad))) * $welt; + + $ent = $ent + $dis; + } + } + $entfernung = $ent * 1000; + return round($entfernung, 0); + } + + /** + * Nimmt eine Adresse entgegen und erzeugt einen Marker. + * + * @param string $adress Zu suchende Adresse + * @param string $typ legt den Markertyp fest (marker,otherMarker,mapMarker) + * @param string $img legt die Markergrafik fest + * @param int $zoom legt den Kartenzoom fest (Default: 14) + * @return array + */ + function geocode($adress, $typ = 'marker', $img = "143.png", $zoom = 14) + { + if ($adress) { + $dims = getimagesize($img); + echo "var image = new Array('$img',$dims[0],$dims[1]);\n"; + if ($adress == "getAdress()") { + echo "geocodeAddress($adress,'$typ',image,$zoom);\n"; + } else { + echo "geocodeAddress('$adress','$typ',image,$zoom);\n"; + } + return true; + } else { + return false; + } + } + /** + * F\xFChrt ein Geocoding Request mit dem Google Geocoder aus. + * Die Anfrage sollte so aufgebaut sein: <strasse> <plz> <stadt> <land> + * + * @param string $input Geocoding Anfrage + * @param string $key Google Maps API Key (nur f\xFCr R\xFCckw\xE4rtskompatibilit\xE4t) + * @return array $point + */ + function getGeoPoint($input, $key = "") + { + if (!$key) { + $key = $this->key; + } + $input = urlencode($input); + $address = "http://maps.google.com/maps/geo?q=$input&key=$key&output=csv"; + $point = file_get_contents($address); + $point = explode(",", $point); + $point = array($point[2], $point[3]); + if (!empty($point)) { + return $point; + } else { + return false; + } + } + /** + * Parsed KML Dateien und gibt sie auf der Karte aus + * + * @param string $url Zu parsende Datei (erwartet immer eine URL !) + * @return bool + */ + function parseKml($url) + { + if ($url) { + echo "var geoXml = new GGeoXml(\"$url\");\n + map.addOverlay(geoXml);\n"; + return true; + } else { + return true; + } + } + + /** + * Parsed XML Dateien und gibt Geopunkte als Array zur\xFCck + * + * @param string $file Zu parsende Datei + * @return array + */ + function parseGxml($file) + { + $parser = new XMLParser($file, 'file', 1); + $tree = $parser->getTree(); + $points = array(); + foreach($tree[MARKERS][MARKER] as $marker) { + $lat = $marker[ATTRIBUTES][LAT]; + $lng = $marker[ATTRIBUTES][LNG]; + $arr = array($lat, $lng); + array_push($points, $arr); + } + if (!empty($points)) { + return $points; + } else { + return false; + } + } + /** + * Parsed XML Dateien und gibt Marker als Array zur\xFCck. + * + * @param string $file Zu parsende Datei + * @return array + */ + function xmlMapPoints($file) + { + $parser = new XMLParser($file, 'file', 1); + $tree = $parser->getTree(); + $points = array(); + foreach($tree[MAP][MARKERS][MARKER] as $marker) { + $lat = $marker[ATTRIBUTES][LAT]; + $lng = $marker[ATTRIBUTES][LNG]; + $img = $marker[ATTRIBUTES][IMAGE]; + $link = $marker[ATTRIBUTES][LINK]; + $arr = array($lat, $lng, $link, $img); + array_push($points, $arr); + } + return $points; + } + + /** + * Erzeugt die Kartendarstellung aus einer XML Datei + * + * @param string $file XML Datei + * @return bool + */ + function xmlMap($file) + { + $parser = new XMLParser($file, 'file', 1); + $tree = $parser->getTree(); + $lat = $tree[MAP][STARTLAT][VALUE]; + $lng = $tree[MAP][STARTLONG][VALUE]; + $width = $tree[MAP][WIDTH][VALUE]; + $height = $tree[MAP][HEIGHT][VALUE]; + $min_zoom = $tree[MAP][MINZOOM][VALUE]; + $typ = $tree[MAP][MAPTYPE][VALUE]; + $zoom = $tree[MAP][STARTZOOM][VALUE]; + if (!$min_zoom) { + $min_zoom = 1; + } + $max_zoom = $tree[MAP][MAXZOOM][VALUE]; + if (!$max_zoom) { + $max_zoom = 17; + } + $navcontrol = $tree[MAP][NAVCONTROL][VALUE]; + + $width = $width . "px"; + $height = $height . "px"; + + if ($typ == "normal") { + $typstr = "G_NORMAL_MAP"; + } elseif ($typ == "satellit") { + $typstr = "G_SATELLITE_MAP"; + } elseif ($typ == "hybrid") { + $typstr = "G_HYBRID_MAP"; + } + if ($navcontrol == "large") { + $controlstr = "GLargeMapControl()"; + } elseif ($navcontrol == "small") { + $controlstr = "GSmallMapControl()"; + } + echo " + <script type=\"text/javascript\"> + + var map = new GMap2(document.getElementById(\"gmapper_map\"));\n + map.addControl(new $controlstr);\n + map.addControl(new GMapTypeControl());\n + map.enableDoubleClickZoom();\n + map.enableContinuousZoom();\n + var mt = map.getMapTypes();\n + for (var i=0; i<mt.length; i++) { + mt[i].getMinimumResolution = function() {return $min_zoom;} + mt[i].getMaximumResolution = function() {return $max_zoom;} + } + map.addControl(new GMapTypeControl());\n + map.setCenter(new GLatLng( $lat,$lng),$zoom);\n + + map.setMapType($typstr);\n + </script>"; + return true; + } + // Ende Gmapper +} +// XML Parser Code +class XMLParser { + var $data; + var $vals; + var $collapse_dups; + var $index_numeric; + function XMLParser($data_source, $data_source_type = 'file', $collapse_dups = 0, $index_numeric = 0) + { + $this->collapse_dups = $collapse_dups; + $this->index_numeric = $index_numeric; + $this->data = ''; + if (file_exists($data_source)) + $this->data = implode('', file($data_source)); + else { + $fp = fopen($data_source, 'r'); + while (!feof($fp)) + $this->data .= fread($fp, 1000); + fclose($fp); + } + } + function getTree() + { + $parser = xml_parser_create('ISO-8859-1'); + xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); + xml_parse_into_struct($parser, $this->data, $vals, $index); + xml_parser_free($parser); + $i = -1; + return $this->getchildren($vals, $i); + } + function buildtag($thisvals, $vals, &$i, $type) + { + if (isset($thisvals['attributes'])) + $tag['ATTRIBUTES'] = $thisvals['attributes']; + if ($type === 'complete') + $tag['VALUE'] = $thisvals['value']; + else + $tag = array_merge($tag, $this->getchildren($vals, $i)); + + return $tag; + } + function getchildren($vals, &$i) + { + $children = array(); // Contains node data + if ($i > -1 && isset($vals[$i]['value'])) + $children['VALUE'] = $vals[$i]['value']; + while (++$i < count($vals)) { + $type = $vals[$i]['type']; + if ($type === 'cdata') + $children['VALUE'] .= $vals[$i]['value']; + elseif ($type === 'complete' || $type === 'open') { + $tag = $this->buildtag($vals[$i], $vals, $i, $type); + if ($this->index_numeric) { + $tag['TAG'] = $vals[$i]['tag']; + $children[] = $tag; + } else + $children[$vals[$i]['tag']][] = $tag; + } elseif ($type === 'close') + break; + } + if ($this->collapse_dups) + foreach($children as $key => $value) + if (is_array($value) && (count($value) == 1)) + $children[$key] = $value[0]; + return $children; + } + } + + ?> \ No newline at end of file Added: trunk/linpha2/lib/plugins/maps/gmapper1/dash.png =================================================================== (Binary files differ) Property changes on: trunk/linpha2/lib/plugins/maps/gmapper1/dash.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/lib/plugins/maps/gmapper1/docs/gmap.html =================================================================== --- trunk/linpha2/lib/plugins/maps/gmapper1/docs/gmap.html (rev 0) +++ trunk/linpha2/lib/plugins/maps/gmapper1/docs/gmap.html 2007-08-18 16:28:16 UTC (rev 4762) @@ -0,0 +1,1148 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <!-- template designed by Marco Von Ballmoos --> + <title>Docs For Class gmap</title> + <link rel="stylesheet" href="stylesheet.css" /> + + <script language="javascript" type="text/javascript"> + var imgPlus = new Image(); + var imgMinus = new Image(); + imgPlus.src = "../media/images/plus.png"; + imgMinus.src = "../media/images/minus.png"; + + function showNode(Node){ + switch(navigator.family){ + case 'nn4': + // Nav 4.x code fork... + var oTable = document.layers["span" + Node]; + var oImg = document.layers["img" + Node]; + break; + case 'ie4': + // IE 4/5 code fork... + var oTable = document.all["span" + Node]; + var oImg = document.all["img" + Node]; + break; + case 'gecko': + // Standards Compliant code fork... + var oTable = document.getElementById("span" + Node); + var oImg = document.getElementById("img" + Node); + break; + } + oImg.src = imgMinus.src; + oTable.style.display = "block"; + } + + function hideNode(Node){ + switch(navigator.family){ + case 'nn4': + // Nav 4.x code fork... + var oTable = document.layers["span" + Node]; + var oImg = document.layers["img" + Node]; + break; + case 'ie4': + // IE 4/5 code fork... + var oTable = document.all["span" + Node]; + var oImg = document.all["img" + Node]; + break; + case 'gecko': + // Standards Compliant code fork... + var oTable = document.getElementById("span" + Node); + var oImg = document.getElementById("img" + Node); + break; + } + oImg.src = imgPlus.src; + oTable.style.display = "none"; + } + + function nodeIsVisible(Node){ + switch(navigator.family){ + case 'nn4': + // Nav 4.x code fork... + var oTable = document.layers["span" + Node]; + break; + case 'ie4': + // IE 4/5 code fork... + var oTable = document.all["span" + Node]; + break; + case 'gecko': + // Standards Compliant code fork... + var oTable = document.getElementById("span" + Node); + break; + } + return (oTable && oTable.style.display == "block"); + } + + function toggleNodeVisibility(Node){ + if (nodeIsVisible(Node)){ + hideNode(Node); + }else{ + showNode(Node); + } + } + </script> + </head> + <body> + <div class="page-body"> + +<h2 class="class-name">Class gmap</h2> + +<a name="sec-description"></a> +<div class="info-box"> + <div class="info-box-title">Description</div> + <div class="nav-bar"> + <span class="disabled">Description</span> | + <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>) + | <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>) + + </div> + <div class="info-box-body"> + <!-- ========== Info from phpDoc block ========= --> + <ul class="tags"> + <li><span class="field">author:</span> Philipp Kiszka <<a href="mailto:in...@o-...">in...@o-...</a>></li> + <li><span class="field">version:</span> 1.0</li> + <li><span class="field">link:</span> <a href="http://gmapper.ajax-info.de">http://gmapper.ajax-info.de</a></li> + <li><span class="field">name:</span> Gmapper</li> + <li><span class="field">license:</span> <a href="http://opensource.org/licenses/gpl-license.php">GNU Public License</a></li> + </ul> + <p class="notes"> + Located in <a class="field" href="_class.gmapper.php.html">/class.gmapper.php</a> (line <span class="field">10</span>) + </p> + + + <pre></pre> + + </div> +</div> + + + + <a name="sec-var-summary"></a> + <div class="info-box"> + <div class="info-box-title">Variable Summary</span></div> + <div class="nav-bar"> + <a href="#sec-description">Description</a> | + <span class="disabled">Vars</span> (<a href="#sec-vars">details</a>) + | + <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>) + + </div> + <div class="info-box-body"> + <div class="var-summary"> + <div class="var-title"> + <span class="var-type">mixed</span> + <a href="#$key" title="details" class="var-name">$key</a> + </div> + </div> + </div> + </div> + + <a name="sec-method-summary"></a> + <div class="info-box"> + <div class="info-box-title">Method Summary</span></div> + <div class="nav-bar"> + <a href="#sec-description">Description</a> | + <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>) + + | + <span class="disabled">Methods</span> (<a href="#sec-methods">details</a>) + </div> + <div class="info-box-body"> + <div class="method-summary"> + + <div class="method-definition"> + <span class="method-result">gmap</span> + <a href="#gmap" title="details" class="method-name">gmap</a> + ([<span class="var-type">string</span> <span class="var-name">$mapkey</span> = <span class="var-default">""</span>]) + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#bodyjs" title="details" class="method-name">bodyjs</a> + () + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#bounds" title="details" class="method-name">bounds</a> + () + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#boundsExtend" title="details" class="method-name">boundsExtend</a> + () + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#directions" title="details" class="method-name">directions</a> + (<span class="var-type">string</span> <span class="var-name">$start</span>, <span class="var-type">string</span> <span class="var-name">$end</span>, [<span class="var-type">string</span> <span class="var-name">$startmarker</span> = <span class="var-default">"143.png"</span>], [<span class="var-type">string</span> <span class="var-name">$endmarker</span> = <span class="var-default">"143.png"</span>], [<span class="var-type">int</span> <span class="var-name">$zoombounds</span> = <span class="var-default">0</span>], [<span class="var-type">string</span> <span class="var-name">$textbox</span> = <span class="var-default">""</span>]) + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#footjs" title="details" class="method-name">footjs</a> + () + </div> + + <div class="method-definition"> + <span class="method-result">array</span> + <a href="#geocode" title="details" class="method-name">geocode</a> + (<span class="var-type">string</span> <span class="var-name">$adress</span>, [<span class="var-type">string</span> <span class="var-name">$typ</span> = <span class="var-default">'marker'</span>], [<span class="var-type">string</span> <span class="var-name">$img</span> = <span class="var-default">"143.png"</span>], [<span class="var-type">int</span> <span class="var-name">$zoom</span> = <span class="var-default">14</span>]) + </div> + + <div class="method-definition"> + <span class="method-result">int</span> + <a href="#getDistance" title="details" class="method-name">getDistance</a> + (<span class="var-type"></span> <span class="var-name">$koord</span>, <span class="var-type">array</span> <span class="var-name">$punkte</span>) + </div> + + <div class="method-definition"> + <span class="method-result">array</span> + <a href="#getGeoPoint" title="details" class="method-name">getGeoPoint</a> + (<span class="var-type">string</span> <span class="var-name">$input</span>, [<span class="var-type">string</span> <span class="var-name">$key</span> = <span class="var-default">""</span>]) + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#headjs" title="details" class="method-name">headjs</a> + ([<span class="var-type">string</span> <span class="var-name">$key</span> = <span class="var-default">""</span>]) + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#linkMarker" title="details" class="method-name">linkMarker</a> + (<span class="var-type">int</span> <span class="var-name">$lat</span>, <span class="var-type">int</span> <span class="var-name">$lng</span>, <span class="var-type">string</span> <span class="var-name">$link</span>, [<span class="var-type">string</span> <span class="var-name">$img</span> = <span class="var-default">"143.png"</span>]) + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#lockMap" title="details" class="method-name">lockMap</a> + () + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#map" title="details" class="method-name">map</a> + (<span class="var-type">int</span> <span class="var-name">$zoom</span>, <span class="var-type">int</span> <span class="var-name">$lat</span>, <span class="var-type">int</span> <span class="var-name">$lng</span>, [<span class="var-type">string</span> <span class="var-name">$typ</span> = <span class="var-default">"normal"</span>], [<span class="var-type">int</span> <span class="var-name">$min_zoom</span> = <span class="var-default">0</span>], [<span class="var-type">int</span> <span class="var-name">$max_zoom</span> = <span class="var-default">0</span>], [<span class="var-type">string</span> <span class="var-name">$navcontrol</span> = <span class="var-default">"large"</span>], [<span class="var-type">int</span> <span class="var-name">$overview</span> = <span class="var-default">0</span>], [<span class="var-type">int</span> <span class="var-name">$mousezoom</span> = <span class="var-default">1</span>], [<span class="var-type">int</span> <span class="var-name">$tilecheck</span> = <span class="var-default">1</span>]) + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#mapdiv" title="details" class="method-name">mapdiv</a> + (<span class="var-type">int</span> <span class="var-name">$height</span>, <span class="var-type">int</span> <span class="var-name">$width</span>) + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#mapMarker" title="details" class="method-name">mapMarker</a> + (<span class="var-type">int</span> <span class="var-name">$lat</span>, <span class="var-type">int</span> <span class="var-name">$lng</span>, [<span class="var-type">string</span> <span class="var-name">$img</span> = <span class="var-default">"143.png"</span>]) + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#markend" title="details" class="method-name">markend</a> + () + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#marker" title="details" class="method-name">marker</a> + (<span class="var-type">int</span> <span class="var-name">$lat</span>, <span class="var-type">int</span> <span class="var-name">$lng</span>, [<span class="var-type">string</span> <span class="var-name">$img</span> = <span class="var-default">"143.png"</span>]) + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#markstart" title="details" class="method-name">markstart</a> + () + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#otherMarker" title="details" class="method-name">otherMarker</a> + (<span class="var-type">int</span> <span class="var-name">$lat</span>, <span class="var-type">int</span> <span class="var-name">$lng</span>, [<span class="var-type">string</span> <span class="var-name">$html</span> = <span class="var-default">""</span>], [<span class="var-type">string</span> <span class="var-name">$img</span> = <span class="var-default">"143.png"</span>]) + </div> + + <div class="method-definition"> + <span class="method-result">array</span> + <a href="#parseGxml" title="details" class="method-name">parseGxml</a> + (<span class="var-type">string</span> <span class="var-name">$file</span>) + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#parseKml" title="details" class="method-name">parseKml</a> + (<span class="var-type">string</span> <span class="var-name">$url</span>) + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#polyline" title="details" class="method-name">polyline</a> + (<span class="var-type">array</span> <span class="var-name">$punkte</span>, [<span class="var-type">string</span> <span class="var-name">$color</span> = <span class="var-default">"#FF0000"</span>], [<span class="var-type">int</span> <span class="var-name">$breite</span> = <span class="var-default">1</span>], [<span class="var-type">int</span> <span class="var-name">$transparent</span> = <span class="var-default">0</span>], [<span class="var-type">string</span> <span class="var-name">$arrows</span> = <span class="var-default">""</span>], [<span class="var-type">int</span> <span class="var-name">$geodetic</span> = <span class="var-default">0</span>]) + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#showScale" title="details" class="method-name">showScale</a> + () + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#tabMarker" title="details" class="method-name">tabMarker</a> + (<span class="var-type">int</span> <span class="var-name">$lat</span>, <span class="var-type">int</span> <span class="var-name">$lng</span>, <span class="var-type">array</span> <span class="var-name">$tabs</span>, [<span class="var-type">string</span> <span class="var-name">$img</span> = <span class="var-default">"143.png"</span>]) + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#xmlMap" title="details" class="method-name">xmlMap</a> + (<span class="var-type">string</span> <span class="var-name">$file</span>) + </div> + + <div class="method-definition"> + <span class="method-result">array</span> + <a href="#xmlMapPoints" title="details" class="method-name">xmlMapPoints</a> + (<span class="var-type">string</span> <span class="var-name">$file</span>) + </div> + + <div class="method-definition"> + <span class="method-result">bool</span> + <a href="#zoomToBounds" title="details" class="method-name">zoomToBounds</a> + () + </div> + </div> + </div> + </div> + + <a name="sec-vars"></a> + <div class="info-box"> + <div class="info-box-title">Variables</div> + <div class="nav-bar"> + <a href="#sec-description">Description</a> | + <a href="#sec-var-summary">Vars</a> (<span class="disabled">details</span>) + + + | + <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>) + + </div> + <div class="info-box-body"> + <a name="var$key" id="$key"><!-- --></A> +<div class="evenrow"> + + <div class="var-header"> + <span class="var-title"> + <span class="var-type">mixed</span> + <span class="var-name">$key</span> + (line <span class="line-number">12</span>) + </span> + </div> + + <!-- ========== Info from phpDoc block ========= --> + + + + + +</div> + + </div> + </div> + + <a name="sec-methods"></a> + <div class="info-box"> + <div class="info-box-title">Methods</div> + <div class="nav-bar"> + <a href="#sec-description">Description</a> | + <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>) + <a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>) + + </div> + <div class="info-box-body"> + <A NAME='method_detail'></A> +<a name="methodgmap" id="gmap"><!-- --></a> +<div class="oddrow"> + + <div class="method-header"> + <span class="method-title">Constructor gmap</span> (line <span class="line-number">19</span>) + </div> + + <!-- ========== Info from phpDoc block ========= --> +<p class="short-description">Der Konstruktor nimmt den Google Maps API Key als Parameter entgegen.</p> +<p class="description"><p>Dies ist die empfohlene Methode, den API Key einzubinden.</p></p> + + <div class="method-signature"> + <span class="method-result">gmap</span> + <span class="method-name"> + gmap + </span> + ([<span class="var-type">string</span> <span class="var-name">$mapkey</span> = <span class="var-default">""</span>]) + </div> + + <ul class="parameters"> + <li> + <span class="var-type">string</span> + <span class="var-name">$mapkey</span><span class="var-description">: Google Maps API Key</span> </li> + </ul> + + + </div> +<a name="methodbodyjs" id="bodyjs"><!-- --></a> +<div class="evenrow"> + + <div class="method-header"> + <span class="method-title">bodyjs</span> (line <span class="line-number">171</span>) + </div> + + <!-- ========== Info from phpDoc block ========= --> +<p class="short-description">Erzeugt den JS Code im BODY der Seite.</p> + + <div class="method-signature"> + <span class="method-result">bool</span> + <span class="method-name"> + bodyjs + </span> + () + </div> + + + + </div> +<a name="methodbounds" id="bounds"><!-- --></a> +<div class="oddrow"> + + <div class="method-header"> + <span class="method-title">bounds</span> (line <span class="line-number">394</span>) + </div> + + <!-- ========== Info from phpDoc block ========= --> +<p class="short-description">Erzeugt ein Bounds Objekt</p> + + <div class="method-signature"> + <span class="method-result">bool</span> + <span class="method-name"> + bounds + </span> + () + </div> + + + + </div> +<a name="methodboundsExtend" id="boundsExtend"><!-- --></a> +<div class="evenrow"> + + <div class="method-header"> + <span class="method-title">boundsExtend</span> (line <span class="line-number">404</span>) + </div> + + <!-- ========== Info from phpDoc block ========= --> +<p class="short-description">Erweitert ein vorhandenes Bounds Objekt um den zuletzt hinzugef\xFCgten Punkt.</p> + + <div class="method-signature"> + <span class="method-result">bool</span> + <span class="method-name"> + boundsExtend + </span> + () + </div> + + + + </div> +<a name="methoddirections" id="directions"><!-- --></a> +<div class="oddrow"> + + <div class="method-header"> + <span class="method-title">directions</span> (line <span class="line-number">343</span>) + </div> + + <!-- ========== Info from phpDoc block ========= --> +<p class="short-description">Erzeugt ein Geocoding Request und gibt eine Polyline, sowie Ortsliste zur\xFCck</p> + + <div class="method-signature"> + <span class="method-result">bool</span> + <span class="method-name"> + directions + </span> + (<span class="var-type">string</span> <span class="var-name">$start</span>, <span class="var-type">string</span> <span class="var-name">$end</span>, [<span class="var-type">string</span> <span class="var-name">$startmarker</span> = <span class="var-default">"143.png"</span>], [<span class="var-type">string</span> <span class="var-name">$endmarker</span> = <span class="var-default">"143.png"</span>], [<span class="var-type">int</span> <span class="var-name">$zoombounds</span> = <span class="var-default">0</span>], [<span class="var-type">string</span> <span class="var-name">$textbox</span> = <span class="var-default">""</span>]) + </div> + + <ul class="parameters"> + <li> + <span class="var-type">string</span> + <span class="var-name">$start</span><span class="var-description">: Startort</span> </li> + <li> + <span class="var-type">string</span> + <span class="var-name">$end</span><span class="var-description">: Endort</span> </li> + <li> + <span class="var-type">string</span> + <span class="var-name">$startmarker</span><span cl... [truncated message content] |
From: <fan...@us...> - 2007-08-18 17:37:15
|
Revision: 4763 http://linpha.svn.sourceforge.net/linpha/?rev=4763&view=rev Author: fangehrn Date: 2007-08-18 10:37:12 -0700 (Sat, 18 Aug 2007) Log Message: ----------- 2007-08-18 flo * adding google maps support - modified gmapper class to fix relativ path problems - added some test markers Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/external_libraries.txt trunk/linpha2/lib/plugins/maps/gmapper1/class.gmapper.php trunk/linpha2/lib/plugins/maps/module.exampleMap.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-08-18 16:28:16 UTC (rev 4762) +++ trunk/linpha2/ChangeLog 2007-08-18 17:37:12 UTC (rev 4763) @@ -2,6 +2,8 @@ * adding google maps support - added gmapper class (http://gmapper.ajax-info.de/) - added basic map at ../linpha2/?&linCat=map + - modified gmapper class to fix relativ path problems + - added some test markers 2007-07-13 bzrudi * Major redesign and cleanups in Installer and a lot of eyecandy. Modified: trunk/linpha2/docs/dev/external_libraries.txt =================================================================== --- trunk/linpha2/docs/dev/external_libraries.txt 2007-08-18 16:28:16 UTC (rev 4762) +++ trunk/linpha2/docs/dev/external_libraries.txt 2007-08-18 17:37:12 UTC (rev 4763) @@ -19,6 +19,18 @@ - ptviewer 3.1.2 (http://webuser.hs-furtwangen.de/~dersch/) +- gmapper 1.0 + to avoid relative path problems: + marker(), otherMarker(), tabMarker(), linkMarker(), mapMarker(), directions(), geocode(): + replaced all + marker( ... , $img = "143.png" , ... ) + $dims = getimagesize($img); + echo "var image = new Array(\"$img\",$dims[0],$dims[1]);\n"; + with + marker( ... , $markerImage , ... ) + echo "var image = new Array(\"$markerImage[0]\",$markerImage[1],$markerImage[2]);\n"; + + - PHP_JPEG_Metadata_Toolkit_1.11 CHANGES Modified: trunk/linpha2/lib/plugins/maps/gmapper1/class.gmapper.php =================================================================== --- trunk/linpha2/lib/plugins/maps/gmapper1/class.gmapper.php 2007-08-18 16:28:16 UTC (rev 4762) +++ trunk/linpha2/lib/plugins/maps/gmapper1/class.gmapper.php 2007-08-18 17:37:12 UTC (rev 4763) @@ -214,11 +214,10 @@ * @param string $img Steuerung der Grafik * @return bool */ - function marker($lat, $lng, $img = "143.png") + function marker($lat, $lng, $markerImage) // $img = "143.png" { if ($lat and $lng) { - $dims = getimagesize($img); - echo "var image = new Array(\"$img\",$dims[0],$dims[1]);\n"; + echo "var image = new Array(\"$markerImage[0]\",$markerImage[1],$markerImage[2]);\n"; echo "var point = new GLatLng(\"$lat\",\"$lng\");\n"; echo "var marker = createMarker(point, image);\n"; echo "var to = point;\n"; @@ -238,11 +237,10 @@ * @param string $img Steuerung der Grafik * @return bool */ - function otherMarker($lat, $lng, $html = "", $img = "143.png") + function otherMarker($lat, $lng, $html = "", $markerImage) // $img = "143.png" { - $dims = getimagesize($img); if ($lat and $lng) { - echo "var image = new Array(\"$img\",$dims[0],$dims[1]);\n"; + echo "var image = new Array(\"$markerImage[0]\",$markerImage[1],$markerImage[2]);\n"; echo "var point = new GLatLng(\"$lat\",\"$lng\");\n"; echo "var marker = createOtherMarker(point, '$html',image);\n"; @@ -262,11 +260,10 @@ * @param string $img Steuerung der Grafik * @return bool */ - function tabMarker($lat, $lng, $tabs, $img = "143.png") + function tabMarker($lat, $lng, $tabs, $markerImage) // $img = "143.png" { if ($lat and $lng) { - $dims = getimagesize($img); - echo "var image = new Array(\"$img\",$dims[0],$dims[1]);\n"; + echo "var image = new Array(\"$markerImage[0]\",$markerImage[1],$markerImage[2]);\n"; echo "var infoTabs = [\n"; foreach($tabs as $tab) { $str .= " @@ -293,11 +290,10 @@ * @param string $img Steuerung der Grafik * @return bool */ - function linkMarker($lat, $lng, $link, $img = "143.png") + function linkMarker($lat, $lng, $link, $markerImage) // $img = "143.png" { if ($lat and $lng) { - $dims = getimagesize($img); - echo "var image = new Array(\"$img\",$dims[0],$dims[1]);\n"; + echo "var image = new Array(\"$markerImage[0]\",$markerImage[1],$markerImage[2]);\n"; echo "var point = new GLatLng(\"$lat\",\"$lng\");\n"; echo "var marker = createLinkMarker(point, '$link',image);\n"; echo "map.addOverlay(marker);\n"; @@ -315,11 +311,10 @@ * @param string $img Steuerung der Grafik * @return bool */ - function mapMarker($lat, $lng, $img = "143.png") + function mapMarker($lat, $lng, $markerImage) // $img = "143.png" { if ($lat and $lng) { - $dims = getimagesize($img); - echo "var image = new Array(\"$img\",$dims[0],$dims[1]);\n"; + echo "var image = new Array(\"$markerImage[0]\",$markerImage[1],$markerImage[2]);\n"; echo "var point = new GLatLng(\"$lat\",\"$lng\");\n"; echo "var marker = createMapMarker(point,image);\n"; echo "map.addOverlay(marker);\n"; @@ -340,10 +335,8 @@ * @param string $textbox Name des HTML Elements in dem die Wegliste ausgegeben wird (Element ID) * @return bool */ - function directions($start, $end, $startmarker = "143.png", $endmarker = "143.png", $zoombounds = 0, $textbox = "") + function directions($start, $end, $startMarker, $endMarker, $zoombounds = 0, $textbox = "") // $startmarker = "143.png", $endmarker = "143.png" { - $dims = getimagesize($startmarker); - $dims2 = getimagesize($endmarker); echo "var dire = new GDirections(); GEvent.addListener(dire, \"load\", gload); dire.load(\"from: $start to: $end\",{getPolyline:true,getSteps:true}); @@ -362,10 +355,10 @@ } echo " map.addOverlay(poly); - var image = new Array(\"$startmarker\",\"$dims[0]\",\"$dims[1]\"); + var image = new Array(\"$startMarker[0]\",\"$startMarker[1]\",\"$startMarker[2]\"); var marker = createMapMarker(step1, image); map.addOverlay(marker); - var image = new Array(\"$endmarker\",\"$dims2[0]\",\"$dims2[1]\"); + var image = new Array(\"$endMarker[0]\",\"$endMarker[1]\",\"$endMarker[2]\"); var marker = createMapMarker(step_last, image); map.addOverlay(marker);"; if ($textbox != "") { @@ -511,11 +504,10 @@ * @param int $zoom legt den Kartenzoom fest (Default: 14) * @return array */ - function geocode($adress, $typ = 'marker', $img = "143.png", $zoom = 14) + function geocode($adress, $typ = 'marker', $markerImage, $zoom = 14) // $img = "143.png" { if ($adress) { - $dims = getimagesize($img); - echo "var image = new Array('$img',$dims[0],$dims[1]);\n"; + echo "var image = new Array('$markerImage[0]',$markerImage[1],$markerImage[2]);\n"; if ($adress == "getAdress()") { echo "geocodeAddress($adress,'$typ',image,$zoom);\n"; } else { Modified: trunk/linpha2/lib/plugins/maps/module.exampleMap.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-08-18 16:28:16 UTC (rev 4762) +++ trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-08-18 17:37:12 UTC (rev 4763) @@ -6,14 +6,14 @@ ob_start(); ?> -<div id="gmapper_map" style="width: 600px; height: 600px;"></div> +<div id="gmapper_map" style="height: 800px;"></div> -<input type = "text" id = "adresse" size = "30"><br> -<input type = "button" onclick = "<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("getAdress()", "otherMarker", "dash.png"); ?>" value = "Geocode"> <br> -Content after<br> -<a href = "#" onclick = "<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("Berlin", "otherMarker", "143.png"); ?>">Berlin</a><br> -<a href = "#" onclick = "<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("M\xFCnchen", "otherMarker", "rot.png", 10); ?>">München</a><br> -<a href = "#" onclick = "<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("K\xF6lner Dom", "otherMarker", "gruen.png", 17); ?>">Kölner Dom</a> +<input type="text" id="adresse" size="30"> +<input type="button" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("getAdress()", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/dash.png",32,32)); ?>" value="Geocode"> <br> +<br /><br /> +<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("Berlin", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/143.png",20,34)); ?>">Berlin</a><br> +<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("Muenchen", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/rot.png",20,34), 10); ?>">München</a><br> +<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("Koelner Dom", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34), 17); ?>">Kölner Dom</a> <?php $GLOBALS['linpha']->template->output['googleMap']->map( @@ -29,6 +29,16 @@ $tilecheck = 1 ); +$GLOBALS['linpha']->template->output['googleMap']->markstart(); +$tabs = array( + array('Tab 1', 'Content1'), + array('Tab 2', 'Lorem Ipsum Dolor sit amet Lorem Ipsum <br>Lorem Ispum'), + array('Tab 3', 'Lorem Ipsum Dolor sit amet Lorem Ipsum ') + ); +$GLOBALS['linpha']->template->output['googleMap']->tabMarker('52.6', '11.9' , $tabs, array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34)); +$GLOBALS['linpha']->template->output['googleMap']->markend(); + + /*$gpoint = $GLOBALS['linpha']->template->output['googleMap']->getGeoPoint("Saarbr\xFCcken Saarland Deutschland"); // Wir f\xFCgen einige Marker hinzu $GLOBALS['linpha']->template->output['googleMap']->markstart(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2007-08-19 14:48:17
|
Revision: 4764 http://linpha.svn.sourceforge.net/linpha/?rev=4764&view=rev Author: fangehrn Date: 2007-08-19 07:47:57 -0700 (Sun, 19 Aug 2007) Log Message: ----------- 2007-08-19 flo * adding google maps support - modified gmapper class: increased the number of paragraphs "no image at this zoomlevel" used to auto zoom out - show thumbnails on google maps Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/external_libraries.txt trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.js trunk/linpha2/lib/plugins/maps/module.exampleMap.php trunk/linpha2/templates/default/map.head.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-08-18 17:37:12 UTC (rev 4763) +++ trunk/linpha2/ChangeLog 2007-08-19 14:47:57 UTC (rev 4764) @@ -1,3 +1,9 @@ +2007-08-19 flo + * adding google maps support + - modified gmapper class: increased the number of paragraphs "no image at this zoomlevel" + used to auto zoom out + - show thumbnails on google maps + 2007-08-18 flo * adding google maps support - added gmapper class (http://gmapper.ajax-info.de/) Modified: trunk/linpha2/docs/dev/external_libraries.txt =================================================================== --- trunk/linpha2/docs/dev/external_libraries.txt 2007-08-18 17:37:12 UTC (rev 4763) +++ trunk/linpha2/docs/dev/external_libraries.txt 2007-08-19 14:47:57 UTC (rev 4764) @@ -20,7 +20,7 @@ - ptviewer 3.1.2 (http://webuser.hs-furtwangen.de/~dersch/) - gmapper 1.0 - to avoid relative path problems: + - to avoid relative path problems: marker(), otherMarker(), tabMarker(), linkMarker(), mapMarker(), directions(), geocode(): replaced all marker( ... , $img = "143.png" , ... ) @@ -29,7 +29,7 @@ with marker( ... , $markerImage , ... ) echo "var image = new Array(\"$markerImage[0]\",$markerImage[1],$markerImage[2]);\n"; - + - increased the number of paragraphs "no image at this zoomlevel" used to auto zoom out - PHP_JPEG_Metadata_Toolkit_1.11 Modified: trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.js =================================================================== --- trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.js 2007-08-18 17:37:12 UTC (rev 4763) +++ trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.js 2007-08-19 14:47:57 UTC (rev 4764) @@ -1 +1 @@ -function createMarker(_1,_2){var _3=new GIcon();_3.image=_2[0];_3.iconSize=new GSize(_2[1],_2[2]);subt=_2[2]/100*11;subt=Math.ceil(subt);var _4=_2[2]-subt;_3.iconAnchor=new GPoint(10,_4);var _5=new GMarker(_1,_3);return _5;}function createMapMarker(_6,_7){var _8=new GIcon();_8.image=_7[0];_8.iconSize=new GSize(_7[1],_7[2]);subt=_7[2]/100*11;subt=Math.ceil(subt);var _9=_7[2]-subt;_8.iconAnchor=new GPoint(10,_9);var _a=_7[2]/3;_a=Math.floor(_a);_8.infoWindowAnchor=new GPoint(_a,2);var _b=new GMarker(_6,_8);GEvent.addListener(_b,"click",function(){map.showMapBlowup(_b.getPoint());});return _b;}function createTabMarker(_c,_d,_e){var _f=new GIcon();_f.image=_e[0];_f.iconSize=new GSize(_e[1],_e[2]);subt=_e[2]/100*11;subt=Math.ceil(subt);var _10=_e[2]-subt;_f.iconAnchor=new GPoint(10,_10);var _11=_e[2]/3;_f.infoWindowAnchor=new GPoint(_11,2);var _12=new GMarker(_c,_f);GEvent.addListener(_12,"click",function(){_12.openInfoWindowTabsHtml(_d);});return _12;}function createLinkMarker(_13,_14,_15){var _16=new GIcon();_16.image=_15[0];_16.iconSize=new GSize(_15[1],_15[2]);subt=_15[2]/100*11;subt=Math.ceil(subt);var _17=_15[2]-subt;_16.iconAnchor=new GPoint(10,_17);var _18=_15[2]/3;_16.infoWindowAnchor=new GPoint(_18,2);var _19=new GMarker(_13,_16);GEvent.addListener(_19,"click",function(){window.location.href=_14;});return _19;}function createOtherMarker(_1a,_1b,_1c){var _1d=new GIcon();_1d.image=_1c[0];_1d.iconSize=new GSize(_1c[1],_1c[2]);subt=_1c[2]/100*11;subt=Math.ceil(subt);var _1e=_1c[2]-subt;_1d.iconAnchor=new GPoint(10,_1e);var _1f=_1c[2]/3;_1f=Math.floor(_1f);_1d.infoWindowAnchor=new GPoint(_1f,2);var _20=new GMarker(_1a,_1d);var _21=_1b;GEvent.addListener(_20,"click",function(){_20.openInfoWindowHtml(_21);});return _20;}var arrowIcon=new GIcon();arrowIcon.iconSize=new GSize(24,24);arrowIcon.shadowSize=new GSize(1,1);arrowIcon.iconAnchor=new GPoint(12,12);arrowIcon.infoWindowAnchor=new GPoint(0,0);var degreesPerRadian=180/Math.PI;function bearing(_22,to){var _24=_22.latRadians();var _25=_22.lngRadians();var _26=to.latRadians();var _27=to.lngRadians();var _28=-Math.atan2(Math.sin(_25-_27)*Math.cos(_26),Math.cos(_24)*Math.sin(_26)-Math.sin(_24)*Math.cos(_26)*Math.cos(_25-_27));if(_28<0){_28+=Math.PI*2;}_28=_28*degreesPerRadian;_28=_28.toFixed(1);return _28;}function arrowHead(_29){var p1=_29[_29.length-1];var p2=_29[_29.length-2];var dir=bearing(p2,p1);var dir=Math.round(dir/3)*3;while(dir>=120){dir-=120;}arrowIcon.image="/img/dir_"+dir+".png";map.addOverlay(new GMarker(p1,arrowIcon));}function midArrows(_2e){for(var i=1;i<_2e.length-1;i++){var p1=_2e[i-1];var p2=_2e[i+1];var dir=bearing(p1,p2);var dir=Math.round(dir/3)*3;while(dir>=120){dir-=120;}arrowIcon.image="/img/dir_"+dir+".png";map.addOverlay(new GMarker(_2e[i],arrowIcon));}}function geocodeAddress(_34,typ,_36,_37){geocoder.getLatLng(_34,function(_38){if(!_38){alert(_34+" nicht gefunden");}else{var lat=_38.lat();var lng=_38.lng();map.setCenter(_38,_37);if(typ=="otherMarker"){_36=createOtherMarker(_38,_34,_36);}else{if(typ=="marker"){_36=createMarker(_38,_36);}else{if(typ=="mapMarker"){_36=createMapMarker(_38,_36);}}}map.addOverlay(_36);}});}function getAdress(){var _3b=document.getElementById("adresse").value;return _3b;}function tilechk(){paragraphs=map.getContainer().getElementsByTagName("p").length;if(paragraphs>4){map.zoomOut(false,true);}}function wheelevent(e){if(!e){e=window.event;}if(e.preventDefault){e.preventDefault();}e.returnValue=false;} \ No newline at end of file +function createMarker(_1,_2){var _3=new GIcon();_3.image=_2[0];_3.iconSize=new GSize(_2[1],_2[2]);subt=_2[2]/100*11;subt=Math.ceil(subt);var _4=_2[2]-subt;_3.iconAnchor=new GPoint(10,_4);var _5=new GMarker(_1,_3);return _5;}function createMapMarker(_6,_7){var _8=new GIcon();_8.image=_7[0];_8.iconSize=new GSize(_7[1],_7[2]);subt=_7[2]/100*11;subt=Math.ceil(subt);var _9=_7[2]-subt;_8.iconAnchor=new GPoint(10,_9);var _a=_7[2]/3;_a=Math.floor(_a);_8.infoWindowAnchor=new GPoint(_a,2);var _b=new GMarker(_6,_8);GEvent.addListener(_b,"click",function(){map.showMapBlowup(_b.getPoint());});return _b;}function createTabMarker(_c,_d,_e){var _f=new GIcon();_f.image=_e[0];_f.iconSize=new GSize(_e[1],_e[2]);subt=_e[2]/100*11;subt=Math.ceil(subt);var _10=_e[2]-subt;_f.iconAnchor=new GPoint(10,_10);var _11=_e[2]/3;_f.infoWindowAnchor=new GPoint(_11,2);var _12=new GMarker(_c,_f);GEvent.addListener(_12,"click",function(){_12.openInfoWindowTabsHtml(_d);});return _12;}function createLinkMarker(_13,_14,_15){var _16=new GIcon();_16.image=_15[0];_16.iconSize=new GSize(_15[1],_15[2]);subt=_15[2]/100*11;subt=Math.ceil(subt);var _17=_15[2]-subt;_16.iconAnchor=new GPoint(10,_17);var _18=_15[2]/3;_16.infoWindowAnchor=new GPoint(_18,2);var _19=new GMarker(_13,_16);GEvent.addListener(_19,"click",function(){window.location.href=_14;});return _19;}function createOtherMarker(_1a,_1b,_1c){var _1d=new GIcon();_1d.image=_1c[0];_1d.iconSize=new GSize(_1c[1],_1c[2]);subt=_1c[2]/100*11;subt=Math.ceil(subt);var _1e=_1c[2]-subt;_1d.iconAnchor=new GPoint(10,_1e);var _1f=_1c[2]/3;_1f=Math.floor(_1f);_1d.infoWindowAnchor=new GPoint(_1f,2);var _20=new GMarker(_1a,_1d);var _21=_1b;GEvent.addListener(_20,"click",function(){_20.openInfoWindowHtml(_21);});return _20;}var arrowIcon=new GIcon();arrowIcon.iconSize=new GSize(24,24);arrowIcon.shadowSize=new GSize(1,1);arrowIcon.iconAnchor=new GPoint(12,12);arrowIcon.infoWindowAnchor=new GPoint(0,0);var degreesPerRadian=180/Math.PI;function bearing(_22,to){var _24=_22.latRadians();var _25=_22.lngRadians();var _26=to.latRadians();var _27=to.lngRadians();var _28=-Math.atan2(Math.sin(_25-_27)*Math.cos(_26),Math.cos(_24)*Math.sin(_26)-Math.sin(_24)*Math.cos(_26)*Math.cos(_25-_27));if(_28<0){_28+=Math.PI*2;}_28=_28*degreesPerRadian;_28=_28.toFixed(1);return _28;}function arrowHead(_29){var p1=_29[_29.length-1];var p2=_29[_29.length-2];var dir=bearing(p2,p1);var dir=Math.round(dir/3)*3;while(dir>=120){dir-=120;}arrowIcon.image="/img/dir_"+dir+".png";map.addOverlay(new GMarker(p1,arrowIcon));}function midArrows(_2e){for(var i=1;i<_2e.length-1;i++){var p1=_2e[i-1];var p2=_2e[i+1];var dir=bearing(p1,p2);var dir=Math.round(dir/3)*3;while(dir>=120){dir-=120;}arrowIcon.image="/img/dir_"+dir+".png";map.addOverlay(new GMarker(_2e[i],arrowIcon));}}function geocodeAddress(_34,typ,_36,_37){geocoder.getLatLng(_34,function(_38){if(!_38){alert(_34+" nicht gefunden");}else{var lat=_38.lat();var lng=_38.lng();map.setCenter(_38,_37);if(typ=="otherMarker"){_36=createOtherMarker(_38,_34,_36);}else{if(typ=="marker"){_36=createMarker(_38,_36);}else{if(typ=="mapMarker"){_36=createMapMarker(_38,_36);}}}map.addOverlay(_36);}});}function getAdress(){var _3b=document.getElementById("adresse").value;return _3b;}function tilechk(){paragraphs=map.getContainer().getElementsByTagName("p").length;if(paragraphs>10){map.zoomOut(false,true);}}function wheelevent(e){if(!e){e=window.event;}if(e.preventDefault){e.preventDefault();}e.returnValue=false;} \ No newline at end of file Modified: trunk/linpha2/lib/plugins/maps/module.exampleMap.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-08-18 17:37:12 UTC (rev 4763) +++ trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-08-19 14:47:57 UTC (rev 4764) @@ -5,17 +5,23 @@ $GLOBALS['linpha']->template->output['googleMap'] = new gmap($key); ob_start(); + ?> <div id="gmapper_map" style="height: 800px;"></div> <input type="text" id="adresse" size="30"> -<input type="button" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("getAdress()", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/dash.png",32,32)); ?>" value="Geocode"> <br> +<input type="button" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "getAdress()", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/dash.png",32,32)); ?>" value="Geocode"> <br> <br /><br /> -<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("Berlin", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/143.png",20,34)); ?>">Berlin</a><br> -<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("Muenchen", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/rot.png",20,34), 10); ?>">München</a><br> -<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("Koelner Dom", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34), 17); ?>">Kölner Dom</a> +<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Berlin", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/143.png",20,34)); ?>">Berlin</a><br> +<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Muenchen", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/rot.png",20,34), 10); ?>">München</a><br> +<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Koelner Dom", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34), 17); ?>">Kölner Dom</a> <?php + $GLOBALS['linpha']->template->output['googleMap']->map( $zoom = 4, $lat = '49.980067', @@ -30,15 +36,42 @@ ); $GLOBALS['linpha']->template->output['googleMap']->markstart(); + $tabs = array( array('Tab 1', 'Content1'), array('Tab 2', 'Lorem Ipsum Dolor sit amet Lorem Ipsum <br>Lorem Ispum'), array('Tab 3', 'Lorem Ipsum Dolor sit amet Lorem Ipsum ') ); $GLOBALS['linpha']->template->output['googleMap']->tabMarker('52.6', '11.9' , $tabs, array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34)); + + + + +$query = $GLOBALS['linpha']->db->Execute("SELECT id, gpslatituderef,gpslatitude,gpslongituderef,gpslongitude " . + "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . + "WHERE gpslatituderef IS NOT NULL " . + "AND gpslatitude IS NOT NULL " . + "AND gpslongituderef IS NOT NULL " . + "AND gpslongitude IS NOT NULL"); +while($data = $query->FetchRow()) +{ + $latlon = parsePJMTLatLon($data); + $GLOBALS['linpha']->template->output['googleMap']->otherMarker( + $latlon['gpslatitude'], + $latlon['gpslongitude'] , + '<img src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$data['id'].'" />', + array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gelb.png",20,34) + ); +} + + + + $GLOBALS['linpha']->template->output['googleMap']->markend(); + + /*$gpoint = $GLOBALS['linpha']->template->output['googleMap']->getGeoPoint("Saarbr\xFCcken Saarland Deutschland"); // Wir f\xFCgen einige Marker hinzu $GLOBALS['linpha']->template->output['googleMap']->markstart(); @@ -84,4 +117,32 @@ $linpha->template->URL_full = LINPHA_LINK.'&linCat=map'; $linpha->template->output['title'] = i18n("Google Maps"); include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); + +function parsePJMTLatLon(&$LatLon) +{ + /*Array + ( + [md5sum] => 084a9633ae7544e35ff1faad6cb05564 + [gpslatituderef] => N + [gpslatitude] => 469762048/16777216 (28),285212672/16777216 (17),820803480/16777216 (48.9236998558) (Degrees Minutes Seconds North or South) + [gpslongituderef] => W + [gpslongitude] => 1879048192/134217728 (14),1207959552/134217728 (9),472055494/16777216 (28.1367000341) (Degrees Minutes Seconds East or West) + )*/ + + // use '?' to be \x84non-greedy\x93 (http://de.wikipedia.org/wiki/Regul%C3%A4rer_Ausdruck#Gieriges_Verhalten) + + + foreach(array('gpslatitude','gpslongitude') as $value) + { + $arrHits = array(); + preg_match_all('/\((.*?)\)/', $LatLon[ $value ], $arrHits); + + $return[ $value ] = $arrHits[1][0] + ($arrHits[1][1] * 1/60) + ($arrHits[1][2] * 1/60 * 1/60); + if( $LatLon[ $value.'ref'] == 'S' OR $LatLon[ $value.'ref'] == 'W' ) + { + $return[ $value ] *= -1; + } + } + return $return; +} ?> \ No newline at end of file Modified: trunk/linpha2/templates/default/map.head.php =================================================================== --- trunk/linpha2/templates/default/map.head.php 2007-08-18 17:37:12 UTC (rev 4763) +++ trunk/linpha2/templates/default/map.head.php 2007-08-19 14:47:57 UTC (rev 4764) @@ -2,5 +2,6 @@ $linTpl->output['googleMap']->headjs(); // <body onunload="GUnload()"> +// window.addEventListener("resize", function() {showZooms()}, false); ?> <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/gmapper1/bodyjs.js"></script> \ 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...> - 2007-08-19 22:48:55
|
Revision: 4765 http://linpha.svn.sourceforge.net/linpha/?rev=4765&view=rev Author: fangehrn Date: 2007-08-19 15:48:44 -0700 (Sun, 19 Aug 2007) Log Message: ----------- - auto height and width for google map - started adding thumb navigation Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/js/LinGlobal.js trunk/linpha2/lib/js/LinThumbnails.js trunk/linpha2/lib/plugins/maps/module.exampleMap.php trunk/linpha2/templates/default/map.head.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-08-19 14:47:57 UTC (rev 4764) +++ trunk/linpha2/ChangeLog 2007-08-19 22:48:44 UTC (rev 4765) @@ -2,7 +2,12 @@ * adding google maps support - modified gmapper class: increased the number of paragraphs "no image at this zoomlevel" used to auto zoom out + would be better if it is somehow possible to find out the number of the small map images + and only zoom out if all small images are not shown, it is now sometimes very annoying + when auto zoom out happens while zooming in -> turned off tilecheck completly - show thumbnails on google maps + - auto height and width for google map + - started adding thumb navigation 2007-08-18 flo * adding google maps support Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2007-08-19 14:47:57 UTC (rev 4764) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2007-08-19 22:48:44 UTC (rev 4765) @@ -699,7 +699,6 @@ * because if we try to get infos from an id which doesn't exist anymore * we would run in an endless loop */ - if($i == 1000) { linSysLog(i18n("Error: cannot get informations, you want to run the database cleanup script")); Modified: trunk/linpha2/lib/js/LinGlobal.js =================================================================== --- trunk/linpha2/lib/js/LinGlobal.js 2007-08-19 14:47:57 UTC (rev 4764) +++ trunk/linpha2/lib/js/LinGlobal.js 2007-08-19 22:48:44 UTC (rev 4765) @@ -167,6 +167,7 @@ * * sets two variables with the scroll offset * takes care of browser incompatibilites + * @uses linSyslog() */ setScrollSize: function() { @@ -211,3 +212,23 @@ //Event.observe(window, 'load', initLinGlobal, false); initLinGlobal(); + + +/** + * on resize functions + */ +function linEnableOnResize() +{ + Event.observe(window, 'resize', linOnResizeCreateTrigger, false); +} + +/** + * resizeWindow, use this wrapper function because internet explorer triggers the resize event to fast + * + * linOnResizeWrapper() must be defined where it's actually used (LinThumbnails.js, LinMapView.js) + */ +function linOnResizeCreateTrigger() +{ + clearTimeout(this.timerResize); + this.timerResize = setTimeout(linOnResizeWrapper,250); +} Modified: trunk/linpha2/lib/js/LinThumbnails.js =================================================================== --- trunk/linpha2/lib/js/LinThumbnails.js 2007-08-19 14:47:57 UTC (rev 4764) +++ trunk/linpha2/lib/js/LinThumbnails.js 2007-08-19 22:48:44 UTC (rev 4765) @@ -384,28 +384,10 @@ { location.href = linUrlBase + '&linId=' + linImgIds[0]['id'] + '&slideshow'; }, - - /** - * resizeWindow, use this wrapper function because internet explorer triggers the resize event to fast - */ - resizeWindow: function () - { - clearTimeout(this.timerResize); - this.timerResize = setTimeout(linThumbnailsWrapper,250); - } } -/** - * linThumbnailsWrapper() - * - * use this wrapper function if called from setTimeout() - * because 'this.' would not work otherwise - */ -function linThumbnailsWrapper() -{ - myLinThumbnails.displayThumbs(); -} + /** * initLinThumbnails() * @@ -414,9 +396,14 @@ function initLinThumbnails() { myLinThumbnails = new LinThumbnails(); - Event.observe(window, 'resize', myLinThumbnails.resizeWindow, false); - + + linEnableOnResize(); myLinThumbnails.displayThumbs(); } +function linOnResizeWrapper() +{ + myLinThumbnails.displayThumbs(); +} + Event.observe(window, 'load', initLinThumbnails, false); Modified: trunk/linpha2/lib/plugins/maps/module.exampleMap.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-08-19 14:47:57 UTC (rev 4764) +++ trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-08-19 22:48:44 UTC (rev 4765) @@ -1,115 +1,149 @@ <?php require_once(LINPHA_DIR."/lib/plugins/maps/gmapper1/class.gmapper.php"); -$key = "ABQIAAAAAXCMfho4_sqSSh0VqMB80xT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSfO_6bbb_ScfT_zPgcnJMKyGltOg"; // key for http://localhost -$GLOBALS['linpha']->template->output['googleMap'] = new gmap($key); +if(isset($_GET['albId'])) { + $albId = intval($_GET['albId']); +} -ob_start(); - -?> -<div id="gmapper_map" style="height: 800px;"></div> - -<input type="text" id="adresse" size="30"> -<input type="button" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "getAdress()", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/dash.png",32,32)); ?>" value="Geocode"> <br> -<br /><br /> -<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "Berlin", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/143.png",20,34)); ?>">Berlin</a><br> -<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "Muenchen", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/rot.png",20,34), 10); ?>">München</a><br> -<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "Koelner Dom", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34), 17); ?>">Kölner Dom</a> - -<?php - -$GLOBALS['linpha']->template->output['googleMap']->map( - $zoom = 4, - $lat = '49.980067', - $lng = '10.8731', - $type = "hybrid", - $min_zoom = 1, - $max_zoom = 23, - $navcontrol = "large", - $overview = 1, - $mousezoom = 1, - $tilecheck = 1 -); - -$GLOBALS['linpha']->template->output['googleMap']->markstart(); - -$tabs = array( - array('Tab 1', 'Content1'), - array('Tab 2', 'Lorem Ipsum Dolor sit amet Lorem Ipsum <br>Lorem Ispum'), - array('Tab 3', 'Lorem Ipsum Dolor sit amet Lorem Ipsum ') - ); -$GLOBALS['linpha']->template->output['googleMap']->tabMarker('52.6', '11.9' , $tabs, array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34)); - - - - -$query = $GLOBALS['linpha']->db->Execute("SELECT id, gpslatituderef,gpslatitude,gpslongituderef,gpslongitude " . +$query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, P.name, gpslatituderef,gpslatitude,gpslongituderef,gpslongitude " . "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . "WHERE gpslatituderef IS NOT NULL " . "AND gpslatitude IS NOT NULL " . "AND gpslongituderef IS NOT NULL " . - "AND gpslongitude IS NOT NULL"); + "AND gpslongitude IS NOT NULL "); while($data = $query->FetchRow()) { - $latlon = parsePJMTLatLon($data); - $GLOBALS['linpha']->template->output['googleMap']->otherMarker( - $latlon['gpslatitude'], - $latlon['gpslongitude'] , - '<img src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$data['id'].'" />', - array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gelb.png",20,34) - ); + $arrImg[] = $data; + $parentIds[ $data['parent_id'] ] = true; } +$key = "ABQIAAAAAXCMfho4_sqSSh0VqMB80xT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSfO_6bbb_ScfT_zPgcnJMKyGltOg"; // key for http://localhost +$GLOBALS['linpha']->template->output['googleMap'] = new gmap($key); +/** + * here starts the output + */ +ob_start(); -$GLOBALS['linpha']->template->output['googleMap']->markend(); +?> + <div id="linDivMapTop"> + <?php + echo i18n("Please select the album to show in Google Maps:"); + echo '<br /><br /><a href="'.LINPHA_LINK.'&linCat=map&albId=0">'.i18n("All albums").'</a><br />'; + + foreach($parentIds as $id=>$value) + { + echo '<a href="'.LINPHA_LINK.'&linCat=map&albId='.$id.'">'; + echo implode( '/', LinSql::getFullFilenameFromId($id) ); + echo '</a><br />'; + } + ?> + <br /> + </div> + + <div id="linDivMapMain" style="height: 475px;"> + <div id="linDivMapNav" style="width: 155px; height: 475px; float: right; overflow: auto; padding-left: 2px; padding-right: 1px;"> + Nav + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + </div> + <div style="width: 5px; height: 100%; float: right; cursor: e-resize; background-color: grey; border: 1px solid black;" ondblClick="linToggleNav();"></div> + <div id="gmapper_map" style="height: 100%; margin-right: 165px; "></div> + </div> + + <div id="linDivMapBottom"> + <input type="text" id="adresse" size="30"> + <input type="button" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "getAdress()", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/dash.png",32,32)); ?>" value="Geocode"> <br> + <br /><br /> + <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Berlin", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/143.png",20,34)); ?>">Berlin</a><br /> + <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Muenchen", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/rot.png",20,34), 10); ?>">München</a><br /> + <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Koelner Dom", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34), 17); ?>">Kölner Dom</a> + </div> +<?php + $GLOBALS['linpha']->template->output['googleMap']->map( + $zoom = 4, + $lat = '49.9801', + $lng = '10.8731', + $type = "hybrid", + $min_zoom = 1, + $max_zoom = 23, + $navcontrol = "large", + $overview = 1, + $mousezoom = 1, + $tilecheck = 0 + ); +if(isset($albId)) +{ + $GLOBALS['linpha']->template->output['googleMap']->markstart(); + $GLOBALS['linpha']->template->output['googleMap']->bounds(); + //$GLOBALS['linpha']->template->output['googleMap']->lockMap(); not needed + + foreach($arrImg as $data) + { + if($albId == 0 OR $albId == $data['parent_id']) + { + $latlon = parsePJMTLatLon($data); + $GLOBALS['linpha']->template->output['googleMap']->otherMarker( + $latlon['gpslatitude'], + $latlon['gpslongitude'] , + '<img src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$data['id'].'" width="'. + $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" height="'. + $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" /><br />'.$data['name'], + array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gelb.png",20,34) + ); + $GLOBALS['linpha']->template->output['googleMap']->boundsExtend(); + } + } + + $GLOBALS['linpha']->template->output['googleMap']->zoomToBounds(); + $GLOBALS['linpha']->template->output['googleMap']->markend(); + /*$gpoint = $GLOBALS['linpha']->template->output['googleMap']->getGeoPoint("Saarbr\xFCcken Saarland Deutschland"); + // Wir f\xFCgen einige Marker hinzu + $GLOBALS['linpha']->template->output['googleMap']->markstart(); + $GLOBALS['linpha']->template->output['googleMap']->marker($gpoint[0], $gpoint[1], "dash.png"); + $GLOBALS['linpha']->template->output['googleMap']->mapMarker('52.5', '13', "dash.png"); + $GLOBALS['linpha']->template->output['googleMap']->mapMarker('48', '11', "gruen.png"); + $GLOBALS['linpha']->template->output['googleMap']->marker('47.5', '13', "gelb.png"); + // Marker mit Infoblase + $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51.5', '12' , 'Text hier', "gelb.png"); + $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51', '10' , 'Hallo Welt!'); + $tabs = array( + array('Tab 1', 'Content1'), + array('Tab 2', 'Lorem Ipsum Dolor sit amet Lorem Ipsum <br>Lorem Ispum'), + array('Tab 3', 'Lorem Ipsum Dolor sit amet Lorem Ipsum ') + ); + $GLOBALS['linpha']->template->output['googleMap']->tabMarker('52.6', '11.9' , $tabs, "gruen.png"); + $GLOBALS['linpha']->template->output['googleMap']->linkMarker('51.0', '6.5' , "http://www.gothic-singles.de", "rot.png"); + // Array mit Punkten zwischen denen eine Linie gezeichnet wird. + $punkte = array( + array('53.5', '12.7'), + array('52.5', '13'), + array('51.5', '12'), + array('51', '10'), + array('48', '11'), + array('47.5', '13') + ); + // Linie erzeugen + $GLOBALS['linpha']->template->output['googleMap']->polyline($punkte, '#FF00FF', 4, 1, "", 1); + $dist = $GLOBALS['linpha']->template->output['googleMap']->getDistance($punkte); + $GLOBALS['linpha']->template->output['googleMap']->markend(); + echo "L\xE4nge der Linie: $dist Meter"; + */ +} -/*$gpoint = $GLOBALS['linpha']->template->output['googleMap']->getGeoPoint("Saarbr\xFCcken Saarland Deutschland"); -// Wir f\xFCgen einige Marker hinzu -$GLOBALS['linpha']->template->output['googleMap']->markstart(); -$GLOBALS['linpha']->template->output['googleMap']->marker($gpoint[0], $gpoint[1], "dash.png"); -$GLOBALS['linpha']->template->output['googleMap']->mapMarker('52.5', '13', "dash.png"); -$GLOBALS['linpha']->template->output['googleMap']->mapMarker('48', '11', "gruen.png"); -$GLOBALS['linpha']->template->output['googleMap']->marker('47.5', '13', "gelb.png"); -// Marker mit Infoblase -$GLOBALS['linpha']->template->output['googleMap']->otherMarker('51.5', '12' , 'Text hier', "gelb.png"); -$GLOBALS['linpha']->template->output['googleMap']->otherMarker('51', '10' , 'Hallo Welt!'); -$tabs = array( - array('Tab 1', 'Content1'), - array('Tab 2', 'Lorem Ipsum Dolor sit amet Lorem Ipsum <br>Lorem Ispum'), - array('Tab 3', 'Lorem Ipsum Dolor sit amet Lorem Ipsum ') - ); -$GLOBALS['linpha']->template->output['googleMap']->tabMarker('52.6', '11.9' , $tabs, "gruen.png"); -$GLOBALS['linpha']->template->output['googleMap']->linkMarker('51.0', '6.5' , "http://www.gothic-singles.de", "rot.png"); -// Array mit Punkten zwischen denen eine Linie gezeichnet wird. -$punkte = array( - array('53.5', '12.7'), - array('52.5', '13'), - array('51.5', '12'), - array('51', '10'), - array('48', '11'), - array('47.5', '13') - ); -// Linie erzeugen -$GLOBALS['linpha']->template->output['googleMap']->polyline($punkte, '#FF00FF', 4, 1, "", 1); -$dist = $GLOBALS['linpha']->template->output['googleMap']->getDistance($punkte); -$GLOBALS['linpha']->template->output['googleMap']->markend(); -echo "L\xE4nge der Linie: $dist Meter"; -*/ - - - - $linpha->template->output['default'] = ob_get_clean(); $linpha->template->setModuleName('default'); @@ -129,12 +163,11 @@ [gpslongitude] => 1879048192/134217728 (14),1207959552/134217728 (9),472055494/16777216 (28.1367000341) (Degrees Minutes Seconds East or West) )*/ - // use '?' to be \x84non-greedy\x93 (http://de.wikipedia.org/wiki/Regul%C3%A4rer_Ausdruck#Gieriges_Verhalten) - - foreach(array('gpslatitude','gpslongitude') as $value) { $arrHits = array(); + + // use '?' to be \x84non-greedy\x93 (http://de.wikipedia.org/wiki/Regul%C3%A4rer_Ausdruck#Gieriges_Verhalten) preg_match_all('/\((.*?)\)/', $LatLon[ $value ], $arrHits); $return[ $value ] = $arrHits[1][0] + ($arrHits[1][1] * 1/60) + ($arrHits[1][2] * 1/60 * 1/60); Modified: trunk/linpha2/templates/default/map.head.php =================================================================== --- trunk/linpha2/templates/default/map.head.php 2007-08-19 14:47:57 UTC (rev 4764) +++ trunk/linpha2/templates/default/map.head.php 2007-08-19 22:48:44 UTC (rev 4765) @@ -1,7 +1,75 @@ <?php $linTpl->output['googleMap']->headjs(); +?> +<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/gmapper1/bodyjs.js"></script> +<script language="JavaScript" type="text/javascript"> -// <body onunload="GUnload()"> -// window.addEventListener("resize", function() {showZooms()}, false); -?> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/gmapper1/bodyjs.js"></script> \ No newline at end of file +var linNavIsHidden = false; +function linToggleNav() +{ + + if( linNavIsHidden ) + { + // restore save margin + $('gmapper_map').style.marginRight = $('linDivMapNav').style.marginRight; + $('linDivMapNav').style.marginRight = 0; + + Element.show('linDivMapNav'); + + linNavIsHidden = false; + } + else + { + Element.hide('linDivMapNav'); + + // backup current margin + $('linDivMapNav').style.marginRight = $('gmapper_map').style.marginRight; + + $('gmapper_map').style.marginRight = 7; + + linNavIsHidden = true; + } + + // update google map size + map.checkResize(); +} + + + +function linOnResizeWrapper() +{ + /** + * tempoarely set the map heigth to a small value (zero does not work!) + * in IE setMainHeight() would not work while reducing the window size + * because IE takes always as much space as he actually needs ignoring + * the height attribute + */ + + $('linDivMapNav').style.height = 10; + $('linDivMapMain').style.height = 10; + + myLinGlobal.setMainHeight(); + + $('linDivMapMain').style.height = $('linDivMain').offsetHeight - $('linDivMapTop').offsetHeight - $('linDivMapBottom').offsetHeight - 5; + + /** + * set also height of the navigation bar + * overflow:auto does not work in IE with height: 100% + */ + $('linDivMapNav').style.height = $('linDivMapMain').style.height; + + // resize google map itself also + map.checkResize(); +} + +function initLinMap() +{ + linEnableOnResize(); + linOnResizeWrapper(); +} +Event.observe(window, 'load', initLinMap, false); + +// prevent memory leaks in internet explorer +Event.observe(window, 'unload', GUnload, false); +</script> + \ 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...> - 2007-08-20 22:19:11
|
Revision: 4766 http://linpha.svn.sourceforge.net/linpha/?rev=4766&view=rev Author: fangehrn Date: 2007-08-20 15:19:07 -0700 (Mon, 20 Aug 2007) Log Message: ----------- 2007-08-20 flo * google maps - added some basic marker/geocode functions Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/plugins/maps/module.exampleMap.php trunk/linpha2/templates/default/map.head.php Added Paths: ----------- trunk/linpha2/lib/plugins/maps/LinMaps.js Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-08-19 22:48:44 UTC (rev 4765) +++ trunk/linpha2/ChangeLog 2007-08-20 22:19:07 UTC (rev 4766) @@ -1,3 +1,7 @@ +2007-08-20 flo + * google maps + - added some basic marker/geocode functions + 2007-08-19 flo * adding google maps support - modified gmapper class: increased the number of paragraphs "no image at this zoomlevel" Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2007-08-19 22:48:44 UTC (rev 4765) +++ trunk/linpha2/index.php 2007-08-20 22:19:07 UTC (rev 4766) @@ -67,12 +67,20 @@ case 'download': require_once(LINPHA_DIR.'/lib/modules/module.download.php'); break; +case 'empty': + require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); + break; + + +// plugins case 'map': + /** + * @todo check if plugin enabled + */ require_once(LINPHA_DIR.'/lib/plugins/maps/module.exampleMap.php'); break; -case 'empty': - require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); - break; + + default: require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); break; Added: trunk/linpha2/lib/plugins/maps/LinMaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/LinMaps.js (rev 0) +++ trunk/linpha2/lib/plugins/maps/LinMaps.js 2007-08-20 22:19:07 UTC (rev 4766) @@ -0,0 +1,213 @@ + +/** + * class and global definitions + */ +var LinMaps = Class.create(); +var myLinMaps; + +LinMaps.prototype = +{ + /** + * initialize() + * Constructor runs on completion of the DOM loading. + */ + initialize: function() + { + this.editMarker = false; + this.navIsHidden = false; + this.defaultMarkerZoom = 10; + }, + + /** + * Marker functions + */ + loadMarkers: function() + { + + }, + geocodeAddress: function(address) + { + if( this.editMarker ) + { + map.removeOverlay( this.editMarker ) + } + + if( address == '' ) + { + this.createEditMarker( map.getCenter() ); + } + else + { + geocoder.getLatLng( + address, + function(point) + { + if(!point) + { + alert(address + " not found"); + } + else + { + map.setCenter(point, myLinMaps.defaultMarkerZoom); + myLinMaps.createEditMarker( point ); + + $('linInputMarkerName').value = address; + } + } + ); + } + }, + createEditMarker: function( center ) + { + this.editMarker = new GMarker(center, {draggable: true}); + + /*GEvent.addListener(marker, "dragstart", function() { + map.closeInfoWindow(); + });*/ + + /*GEvent.addListener(marker, "dragend", function() { + marker.openInfoWindowHtml("Just bouncing along..."); + });*/ + + GEvent.addListener(this.editMarker, "drag", function() { + myLinMaps.updateEditMarker(); + }); + + map.addOverlay( this.editMarker ); + + this.updateEditMarker(); + }, + updateEditMarker: function() + { + if( this.editMarker ) + { + latlng = this.editMarker.getPoint(); + $('linInputLat').value = latlng.lat(); + $('linInputLon').value = latlng.lng(); + } + else + { + $('linInputMarkerName').value = ''; + $('linInputLat').value = ''; + $('linInputLon').value = ''; + } + }, + saveMarker: function(t) + { + xmlAnswer = t.responseXML.documentElement; + + if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' ) + { + map.removeOverlay( myLinMaps.editMarker ); + myLinMaps.editMarker = false; + myLinMaps.updateEditMarker(); + + myLinMaps.loadMarkers(); + } + else + { + alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data ); + } + }, + + + /** + * Thumbnail functions + */ + toggleNav: function() + { + + if( this.navIsHidden ) + { + // restore save margin + $('gmapper_map').style.marginRight = $('linDivMapNav').style.marginRight; + $('linDivMapNav').style.marginRight = 0; + + Element.show('linDivMapNav'); + + this.navIsHidden = false; + } + else + { + Element.hide('linDivMapNav'); + + // backup current margin + $('linDivMapNav').style.marginRight = $('gmapper_map').style.marginRight; + + $('gmapper_map').style.marginRight = 7; + + this.navIsHidden = true; + } + + // update google map size + map.checkResize(); + } + + + + + + + + +} // end class LinMaps + +function linOnResizeWrapper() +{ + myLinGlobal.setWindowSize(); + var newHeight = myLinGlobal.linInnerHeight - $('linDivMain').offsetTop - 80; + if(newHeight < 100) + { + newHeight = 100; + } + + $('linDivMapNav').style.height = newHeight; + $('linDivMapMain').style.height = newHeight; + + + /** + * tempoarely set the map heigth to a small value (zero does not work!) + * in IE setMainHeight() would not work while reducing the window size + * because IE takes always as much space as he actually needs ignoring + * the height attribute + */ + + /*$('linDivMapNav').style.height = 10; + $('linDivMapMain').style.height = 10; + + myLinGlobal.setMainHeight(); + + $('linDivMapMain').style.height = $('linDivMain').offsetHeight - $('linDivMapTop').offsetHeight - $('linDivMapBottom').offsetHeight - 5;*/ + + /** + * set also height of the navigation bar + * overflow:auto does not work in IE with height: 100% + */ + /*$('linDivMapNav').style.height = $('linDivMapMain').style.height;*/ + + // resize google map itself also + map.checkResize(); +} + +/** + * initLinMaps() + * + * create the class object + */ +function initLinMaps() +{ + myLinMaps = new LinMaps(); + + linEnableOnResize(); + linOnResizeWrapper(); + +} + +//initLinMaps(); +Event.observe(window, 'load', initLinMaps, false); + +// prevent memory leaks in internet explorer +Event.observe(window, 'unload', GUnload, false); + + + Modified: trunk/linpha2/lib/plugins/maps/module.exampleMap.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-08-19 22:48:44 UTC (rev 4765) +++ trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-08-20 22:19:07 UTC (rev 4766) @@ -1,6 +1,80 @@ <?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. + */ + +/** + * Google Maps + * @package Plugins + */ +if(!defined('LINPHA_DIR')) { exit(1); } + + require_once(LINPHA_DIR."/lib/plugins/maps/gmapper1/class.gmapper.php"); +if(isset($_GET['xml'])) +{ + header('Content-type: text/xml'); + echo '<?xml version="1.0" ?>'."\n"; + echo '<root>'."\n"; + + if(isset($_POST['cmd'])) + { + switch($_POST['cmd']) + { + case 'loadMarker': + break; + + case 'saveMarker': + + if( !isset($_POST['linInputMarkerName']) OR empty($_POST['linInputMarkerName'])) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: no title specified").'</responseMsg>'."\n"; + } + elseif( !isset($_POST['linInputLat']) OR empty($_POST['linInputLat']) + OR !isset($_POST['linInputLon']) OR empty($_POST['linInputLon'])) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: Missing Lat/Lon values").'</responseMsg>'."\n"; + } + else + { + /** + * @todo save marker in db + */ + /* + $_POST['linInputMarkerName'] + floatval($_POST['linInputLat']) + floatval($_POST['linInputLon']) + */ + + echo '<responseCode>success</responseCode>'."\n"; + } + + break; + } + } + + echo '</root>'."\n"; + exit(); +} + if(isset($_GET['albId'])) { $albId = intval($_GET['albId']); } @@ -27,20 +101,7 @@ ob_start(); ?> - <div id="linDivMapTop"> - <?php - echo i18n("Please select the album to show in Google Maps:"); - echo '<br /><br /><a href="'.LINPHA_LINK.'&linCat=map&albId=0">'.i18n("All albums").'</a><br />'; - - foreach($parentIds as $id=>$value) - { - echo '<a href="'.LINPHA_LINK.'&linCat=map&albId='.$id.'">'; - echo implode( '/', LinSql::getFullFilenameFromId($id) ); - echo '</a><br />'; - } - ?> - <br /> - </div> + <div id="linDivMapTop"></div> <div id="linDivMapMain" style="height: 475px;"> <div id="linDivMapNav" style="width: 155px; height: 475px; float: right; overflow: auto; padding-left: 2px; padding-right: 1px;"> @@ -56,6 +117,31 @@ </div> <div id="linDivMapBottom"> + + <input type="text" id="linInputAddress" size="30"> + <input type="button" onclick="myLinMaps.geocodeAddress( $('linInputAddress').value )" value="<?php echo i18n("Geocode"); ?>"> + <br /><br /> + + <div id="linDivEditMarker" style="border: 1px solid black; width: 550px; padding: 3px;"> + <form action="" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;"> + <label for="linInputMarkerName" style="display: block; float: left; width: 150px;">Marker Name: + </label><input type="text" id="linInputMarkerName" name="linInputMarkerName" size="30" /><br /> + <label for="linInputLat" style="display: block; float: left; width: 150px;">Lat + </label><input type="text" id="linInputLat" name="linInputLat" size="10" /><br /> + <label for="linInputLon" style="display: block; float: left; width: 150px;">Lon: + </label><input type="text" id="linInputLon" name="linInputLon" size="10" /><br /> + <input type="submit" value="<?php echo i18n("Save"); ?>" /> + <input type="hidden" name="cmd" value="saveMarker" /> + </form> + </div> + + + + <br /><br /><br /> + + + <?php + /* <input type="text" id="adresse" size="30"> <input type="button" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( "getAdress()", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/dash.png",32,32)); ?>" value="Geocode"> <br> @@ -66,7 +152,58 @@ "Muenchen", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/rot.png",20,34), 10); ?>">München</a><br /> <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( "Koelner Dom", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34), 17); ?>">Kölner Dom</a> + + */ + + + + + + echo i18n("Please select the album to show in Google Maps:"); + echo '<br /><br /><a href="'.LINPHA_LINK.'&linCat=map&albId=0">'.i18n("All albums").'</a><br />'; + + foreach($parentIds as $id=>$value) + { + echo '<a href="'.LINPHA_LINK.'&linCat=map&albId='.$id.'">'; + echo implode( '/', LinSql::getFullFilenameFromId($id) ); + echo '</a><br />'; + } + ?> + <br /> + + <div> + Legend:<br /> + (red) current marker<br /> + (yellow) location marker<br /> + (blue) location marker with assigned albums<br /> + (green) location marker with assigned images (GPS)<br /> + (pink) images<br /> + </div> + + <div> + Create marker:<br /> + 1. Enter address or just press "Geocode"<br /> + 2. Drag the marker to fine adjust<br /> + 3. Check marker name<br /> + 4. Press "Save"<br /> + <br /> + Assign albums:<br /> + 1. Click on a marker<br /> + 2. Press "Assign album"<br /> + 3. Choose album and press "Save"<br /> + 4. Repeat for multiple albums<br /> + <br /> + Assign images to an album marker:<br /> + This is done automatically. But it's required that your images have the + GPS information stored inside. You will need a GPS Data Logger to do this + automatically. It is also possible do it manually. Robogeo is a tool, but + it is not free. + </div> + + </div> + + <?php $GLOBALS['linpha']->template->output['googleMap']->map( $zoom = 4, @@ -149,6 +286,7 @@ $linpha->template->setModuleName('default'); $linpha->template->overrideModule('head','map'); $linpha->template->URL_full = LINPHA_LINK.'&linCat=map'; +$linpha->template->URL_base = LINPHA_LINK.'&linCat=map'; $linpha->template->output['title'] = i18n("Google Maps"); include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); Modified: trunk/linpha2/templates/default/map.head.php =================================================================== --- trunk/linpha2/templates/default/map.head.php 2007-08-19 22:48:44 UTC (rev 4765) +++ trunk/linpha2/templates/default/map.head.php 2007-08-20 22:19:07 UTC (rev 4766) @@ -2,74 +2,13 @@ $linTpl->output['googleMap']->headjs(); ?> <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/gmapper1/bodyjs.js"></script> -<script language="JavaScript" type="text/javascript"> - -var linNavIsHidden = false; -function linToggleNav() -{ - - if( linNavIsHidden ) - { - // restore save margin - $('gmapper_map').style.marginRight = $('linDivMapNav').style.marginRight; - $('linDivMapNav').style.marginRight = 0; - - Element.show('linDivMapNav'); - - linNavIsHidden = false; - } - else - { - Element.hide('linDivMapNav'); - - // backup current margin - $('linDivMapNav').style.marginRight = $('gmapper_map').style.marginRight; - - $('gmapper_map').style.marginRight = 7; - - linNavIsHidden = true; - } - - // update google map size - map.checkResize(); -} - - - -function linOnResizeWrapper() -{ - /** - * tempoarely set the map heigth to a small value (zero does not work!) - * in IE setMainHeight() would not work while reducing the window size - * because IE takes always as much space as he actually needs ignoring - * the height attribute - */ - - $('linDivMapNav').style.height = 10; - $('linDivMapMain').style.height = 10; - - myLinGlobal.setMainHeight(); - - $('linDivMapMain').style.height = $('linDivMain').offsetHeight - $('linDivMapTop').offsetHeight - $('linDivMapBottom').offsetHeight - 5; - - /** - * set also height of the navigation bar - * overflow:auto does not work in IE with height: 100% - */ - $('linDivMapNav').style.height = $('linDivMapMain').style.height; - - // resize google map itself also - map.checkResize(); -} - -function initLinMap() -{ - linEnableOnResize(); - linOnResizeWrapper(); -} -Event.observe(window, 'load', initLinMap, false); - -// prevent memory leaks in internet explorer -Event.observe(window, 'unload', GUnload, false); -</script> - \ No newline at end of file +<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/LinMaps.js"></script> +<script language="JavaScript" type="text/javascript"> +var xmlUrl = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; +var imageSrc = '<?php echo LINPHA_CLIENT.'/get_image.php?linId='; ?>'; +var thumbSrc = '<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='; ?>'; +var maxImageWidth = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; ?>; +var maxImageHeight = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; ?>; +var maxThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; ?>; +var displayThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>; +</script> \ 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: <bz...@us...> - 2007-08-23 19:14:20
|
Revision: 4767 http://linpha.svn.sourceforge.net/linpha/?rev=4767&view=rev Author: bzrudi Date: 2007-08-23 12:14:12 -0700 (Thu, 23 Aug 2007) Log Message: ----------- "Make Exiftool work with GPS EXIF data" Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/metadata_define.php trunk/linpha2/lib/classes/linpha.exiftool.class.php trunk/linpha2/lib/include/metadata_info_show.php trunk/linpha2/lib/plugins/maps/gpx.php trunk/linpha2/lib/plugins/maps/module.exampleMap.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-08-20 22:19:07 UTC (rev 4766) +++ trunk/linpha2/ChangeLog 2007-08-23 19:14:12 UTC (rev 4767) @@ -1,3 +1,6 @@ +2007-08-23 bzrudi + * Make Exiftool work with GPS EXIF data + 2007-08-20 flo * google maps - added some basic marker/geocode functions Modified: trunk/linpha2/admin/metadata_define.php =================================================================== --- trunk/linpha2/admin/metadata_define.php 2007-08-20 22:19:07 UTC (rev 4766) +++ trunk/linpha2/admin/metadata_define.php 2007-08-23 19:14:12 UTC (rev 4767) @@ -83,7 +83,7 @@ show_metadata(); break; case 'iptc': - if($GLOBALS['linpha']->sql->config->value['sys_import_use_exiftool']) + if($GLOBALS['linpha']->sql->config->value['sys_import_exiftool_avail']) { 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 " . Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2007-08-20 22:19:07 UTC (rev 4766) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2007-08-23 19:14:12 UTC (rev 4767) @@ -111,8 +111,8 @@ { $meta =""; $return = array(); - $parameters = "-g ". - "-h "; + $parameters = "-g ". //Group by Tags + "-h "; //Enable HTML output LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $return); @@ -141,11 +141,13 @@ "-s " . // Print tag names instead of descr. "-t " . // Use tab \t as delimiter "-fast " . // Do not read to EOF - //"-n " . // Read numbers instead of words + "-a " . // Allow duplicates + "-c %.10f " . // GPS formatting to float instead of words "-m "; // Ignore minor errors LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $meta, $return); + /* echo $this->exiftool.' '.$parameters.' "'.$filename.'"'; echo '<pre>', print_r($meta), '</pre>'; @@ -176,7 +178,7 @@ $dataArray = LinExifTool::readMetaDataFromFile($tag, $filename); -// echo '<pre>', print_r($dataArray), '</pre>'; + //echo '<pre>', print_r($dataArray), '</pre>'; $str_columns = "md5sum, "; $str_values = "'" . $md5sum . "', "; @@ -220,7 +222,7 @@ * * @param string $dirname, $filename * @return array $time_exif (unix timestamp) - * $rotate (degrees to rotate) + * $rotate (degrees to rotate) otherMarker * @author bzrudi,flo **/ public function getBasicMeta($dirname, $filename) @@ -498,15 +500,44 @@ 'saturation' => 'Saturation', 'sharpness' => 'Sharpness', 'subjectdistancerange' => 'Subject Distance Range', - 'gamma' => 'Gamma' + 'gamma' => 'Gamma', + + //GPS + '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 Time Stamp', + 'gpssatellites' => 'GPS Satellites', + 'gpsstatus' => 'GPS Status', + 'gpsmeasuremode' => 'GPS Measure Mode', + 'gpsdop' => 'GPS DOP', + 'gpsspeedref' => 'GPS Speed Ref', + 'gpsspeed' => 'GPS Speed', + 'gpstrackref' => 'GPS Track', + '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 Date Stamp', + 'gpsdatetime' => 'GPS Date Time', + 'gpsposition' => 'GPS Position' //not definied in exiftool!? ) ); } -//$test = new LinExifTool(); -//$test->readMetaDataFromFile('xmp'); - - - /* vi: set ts=4 sw=4 sts=4 */ ?> Modified: trunk/linpha2/lib/include/metadata_info_show.php =================================================================== --- trunk/linpha2/lib/include/metadata_info_show.php 2007-08-20 22:19:07 UTC (rev 4766) +++ trunk/linpha2/lib/include/metadata_info_show.php 2007-08-23 19:14:12 UTC (rev 4767) @@ -44,7 +44,7 @@ } /** - * only images, but only if we stuck with pjmt exiftool does it :-) + * only images, but only if we stuck with pjmt, exiftool does it :-) */ if(!$GLOBALS['linpha']->sql->config->value['sys_import_exiftool_avail']) { @@ -57,7 +57,7 @@ $filename = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); $filenameShow = implode( '/', LinSql::getFullFilenameFromId( $GLOBALS['linpha']->template->idCurrent ) ); - + /** * If exiftool avail, make use of it! */ @@ -97,7 +97,7 @@ * Author: Evan Hunter * * Date: 30/7/2004 -* +*file:////opt/ZendStudio-5.5.0/docs/PHPmanual/ * Project: PHP JPEG Metadata Toolkit * * Revision: 1.11 Modified: trunk/linpha2/lib/plugins/maps/gpx.php =================================================================== --- trunk/linpha2/lib/plugins/maps/gpx.php 2007-08-20 22:19:07 UTC (rev 4766) +++ trunk/linpha2/lib/plugins/maps/gpx.php 2007-08-23 19:14:12 UTC (rev 4767) @@ -1,4 +1,4 @@ - +<?php /** * This method parses an XML file (currently in Garmin GPX format) and saves * all available information in the DB Modified: trunk/linpha2/lib/plugins/maps/module.exampleMap.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-08-20 22:19:07 UTC (rev 4766) +++ trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-08-23 19:14:12 UTC (rev 4767) @@ -1,319 +1,348 @@ -<?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. - */ - -/** - * Google Maps - * @package Plugins - */ -if(!defined('LINPHA_DIR')) { exit(1); } - - -require_once(LINPHA_DIR."/lib/plugins/maps/gmapper1/class.gmapper.php"); - -if(isset($_GET['xml'])) -{ - header('Content-type: text/xml'); - echo '<?xml version="1.0" ?>'."\n"; - echo '<root>'."\n"; - - if(isset($_POST['cmd'])) - { - switch($_POST['cmd']) - { - case 'loadMarker': - break; - - case 'saveMarker': - - if( !isset($_POST['linInputMarkerName']) OR empty($_POST['linInputMarkerName'])) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.i18n("Error: no title specified").'</responseMsg>'."\n"; - } - elseif( !isset($_POST['linInputLat']) OR empty($_POST['linInputLat']) - OR !isset($_POST['linInputLon']) OR empty($_POST['linInputLon'])) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.i18n("Error: Missing Lat/Lon values").'</responseMsg>'."\n"; - } - else - { - /** - * @todo save marker in db - */ - /* - $_POST['linInputMarkerName'] - floatval($_POST['linInputLat']) - floatval($_POST['linInputLon']) - */ - - echo '<responseCode>success</responseCode>'."\n"; - } - - break; - } - } - - echo '</root>'."\n"; - exit(); -} - -if(isset($_GET['albId'])) { - $albId = intval($_GET['albId']); -} - -$query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, P.name, gpslatituderef,gpslatitude,gpslongituderef,gpslongitude " . - "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . - "WHERE gpslatituderef IS NOT NULL " . - "AND gpslatitude IS NOT NULL " . - "AND gpslongituderef IS NOT NULL " . - "AND gpslongitude IS NOT NULL "); -while($data = $query->FetchRow()) -{ - $arrImg[] = $data; - $parentIds[ $data['parent_id'] ] = true; -} - -$key = "ABQIAAAAAXCMfho4_sqSSh0VqMB80xT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSfO_6bbb_ScfT_zPgcnJMKyGltOg"; // key for http://localhost -$GLOBALS['linpha']->template->output['googleMap'] = new gmap($key); - - -/** - * here starts the output - */ -ob_start(); - -?> - <div id="linDivMapTop"></div> - - <div id="linDivMapMain" style="height: 475px;"> - <div id="linDivMapNav" style="width: 155px; height: 475px; float: right; overflow: auto; padding-left: 2px; padding-right: 1px;"> - Nav - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - </div> - <div style="width: 5px; height: 100%; float: right; cursor: e-resize; background-color: grey; border: 1px solid black;" ondblClick="linToggleNav();"></div> - <div id="gmapper_map" style="height: 100%; margin-right: 165px; "></div> - </div> - - <div id="linDivMapBottom"> - - <input type="text" id="linInputAddress" size="30"> - <input type="button" onclick="myLinMaps.geocodeAddress( $('linInputAddress').value )" value="<?php echo i18n("Geocode"); ?>"> - <br /><br /> - - <div id="linDivEditMarker" style="border: 1px solid black; width: 550px; padding: 3px;"> - <form action="" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;"> - <label for="linInputMarkerName" style="display: block; float: left; width: 150px;">Marker Name: - </label><input type="text" id="linInputMarkerName" name="linInputMarkerName" size="30" /><br /> - <label for="linInputLat" style="display: block; float: left; width: 150px;">Lat - </label><input type="text" id="linInputLat" name="linInputLat" size="10" /><br /> - <label for="linInputLon" style="display: block; float: left; width: 150px;">Lon: - </label><input type="text" id="linInputLon" name="linInputLon" size="10" /><br /> - <input type="submit" value="<?php echo i18n("Save"); ?>" /> - <input type="hidden" name="cmd" value="saveMarker" /> - </form> - </div> - - - - <br /><br /><br /> - - - <?php - /* - <input type="text" id="adresse" size="30"> - <input type="button" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "getAdress()", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/dash.png",32,32)); ?>" value="Geocode"> <br> - <br /><br /> - <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "Berlin", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/143.png",20,34)); ?>">Berlin</a><br /> - <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "Muenchen", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/rot.png",20,34), 10); ?>">München</a><br /> - <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "Koelner Dom", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34), 17); ?>">Kölner Dom</a> - - */ - - - - - - echo i18n("Please select the album to show in Google Maps:"); - echo '<br /><br /><a href="'.LINPHA_LINK.'&linCat=map&albId=0">'.i18n("All albums").'</a><br />'; - - foreach($parentIds as $id=>$value) - { - echo '<a href="'.LINPHA_LINK.'&linCat=map&albId='.$id.'">'; - echo implode( '/', LinSql::getFullFilenameFromId($id) ); - echo '</a><br />'; - } - ?> - <br /> - - <div> - Legend:<br /> - (red) current marker<br /> - (yellow) location marker<br /> - (blue) location marker with assigned albums<br /> - (green) location marker with assigned images (GPS)<br /> - (pink) images<br /> - </div> - - <div> - Create marker:<br /> - 1. Enter address or just press "Geocode"<br /> - 2. Drag the marker to fine adjust<br /> - 3. Check marker name<br /> - 4. Press "Save"<br /> - <br /> - Assign albums:<br /> - 1. Click on a marker<br /> - 2. Press "Assign album"<br /> - 3. Choose album and press "Save"<br /> - 4. Repeat for multiple albums<br /> - <br /> - Assign images to an album marker:<br /> - This is done automatically. But it's required that your images have the - GPS information stored inside. You will need a GPS Data Logger to do this - automatically. It is also possible do it manually. Robogeo is a tool, but - it is not free. - </div> - - - </div> - - -<?php - $GLOBALS['linpha']->template->output['googleMap']->map( - $zoom = 4, - $lat = '49.9801', - $lng = '10.8731', - $type = "hybrid", - $min_zoom = 1, - $max_zoom = 23, - $navcontrol = "large", - $overview = 1, - $mousezoom = 1, - $tilecheck = 0 - ); -if(isset($albId)) -{ - $GLOBALS['linpha']->template->output['googleMap']->markstart(); - $GLOBALS['linpha']->template->output['googleMap']->bounds(); - //$GLOBALS['linpha']->template->output['googleMap']->lockMap(); not needed - - foreach($arrImg as $data) - { - if($albId == 0 OR $albId == $data['parent_id']) - { - $latlon = parsePJMTLatLon($data); - $GLOBALS['linpha']->template->output['googleMap']->otherMarker( - $latlon['gpslatitude'], - $latlon['gpslongitude'] , - '<img src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$data['id'].'" width="'. - $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" height="'. - $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" /><br />'.$data['name'], - array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gelb.png",20,34) - ); - $GLOBALS['linpha']->template->output['googleMap']->boundsExtend(); - } - } - - $GLOBALS['linpha']->template->output['googleMap']->zoomToBounds(); - $GLOBALS['linpha']->template->output['googleMap']->markend(); - - /*$gpoint = $GLOBALS['linpha']->template->output['googleMap']->getGeoPoint("Saarbr\xFCcken Saarland Deutschland"); - // Wir f\xFCgen einige Marker hinzu - $GLOBALS['linpha']->template->output['googleMap']->markstart(); - $GLOBALS['linpha']->template->output['googleMap']->marker($gpoint[0], $gpoint[1], "dash.png"); - $GLOBALS['linpha']->template->output['googleMap']->mapMarker('52.5', '13', "dash.png"); - $GLOBALS['linpha']->template->output['googleMap']->mapMarker('48', '11', "gruen.png"); - $GLOBALS['linpha']->template->output['googleMap']->marker('47.5', '13', "gelb.png"); - // Marker mit Infoblase - $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51.5', '12' , 'Text hier', "gelb.png"); - $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51', '10' , 'Hallo Welt!'); - $tabs = array( - array('Tab 1', 'Content1'), - array('Tab 2', 'Lorem Ipsum Dolor sit amet Lorem Ipsum <br>Lorem Ispum'), - array('Tab 3', 'Lorem Ipsum Dolor sit amet Lorem Ipsum ') - ); - $GLOBALS['linpha']->template->output['googleMap']->tabMarker('52.6', '11.9' , $tabs, "gruen.png"); - $GLOBALS['linpha']->template->output['googleMap']->linkMarker('51.0', '6.5' , "http://www.gothic-singles.de", "rot.png"); - // Array mit Punkten zwischen denen eine Linie gezeichnet wird. - $punkte = array( - array('53.5', '12.7'), - array('52.5', '13'), - array('51.5', '12'), - array('51', '10'), - array('48', '11'), - array('47.5', '13') - ); - // Linie erzeugen - $GLOBALS['linpha']->template->output['googleMap']->polyline($punkte, '#FF00FF', 4, 1, "", 1); - $dist = $GLOBALS['linpha']->template->output['googleMap']->getDistance($punkte); - $GLOBALS['linpha']->template->output['googleMap']->markend(); - echo "L\xE4nge der Linie: $dist Meter"; - */ -} - - - - - -$linpha->template->output['default'] = ob_get_clean(); - -$linpha->template->setModuleName('default'); -$linpha->template->overrideModule('head','map'); -$linpha->template->URL_full = LINPHA_LINK.'&linCat=map'; -$linpha->template->URL_base = LINPHA_LINK.'&linCat=map'; -$linpha->template->output['title'] = i18n("Google Maps"); -include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); - -function parsePJMTLatLon(&$LatLon) -{ - /*Array - ( - [md5sum] => 084a9633ae7544e35ff1faad6cb05564 - [gpslatituderef] => N - [gpslatitude] => 469762048/16777216 (28),285212672/16777216 (17),820803480/16777216 (48.9236998558) (Degrees Minutes Seconds North or South) - [gpslongituderef] => W - [gpslongitude] => 1879048192/134217728 (14),1207959552/134217728 (9),472055494/16777216 (28.1367000341) (Degrees Minutes Seconds East or West) - )*/ - - foreach(array('gpslatitude','gpslongitude') as $value) - { - $arrHits = array(); - - // use '?' to be \x84non-greedy\x93 (http://de.wikipedia.org/wiki/Regul%C3%A4rer_Ausdruck#Gieriges_Verhalten) - preg_match_all('/\((.*?)\)/', $LatLon[ $value ], $arrHits); - - $return[ $value ] = $arrHits[1][0] + ($arrHits[1][1] * 1/60) + ($arrHits[1][2] * 1/60 * 1/60); - if( $LatLon[ $value.'ref'] == 'S' OR $LatLon[ $value.'ref'] == 'W' ) - { - $return[ $value ] *= -1; - } - } - return $return; -} -?> \ No newline at end of file +<?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. + */ + +/** + * Google Maps + * @package Plugins + */ +if(!defined('LINPHA_DIR')) { exit(1); } + +error_reporting(E_ALL); +require_once(LINPHA_DIR."/lib/plugins/maps/gmapper1/class.gmapper.php"); + +if(isset($_GET['xml'])) +{ + header('Content-type: text/xml'); + echo '<?xml version="1.0" ?>'."\n"; + echo '<root>'."\n"; + + if(isset($_POST['cmd'])) + { + switch($_POST['cmd']) + { + case 'loadMarker': + break; + + case 'saveMarker': + + if( !isset($_POST['linInputMarkerName']) OR empty($_POST['linInputMarkerName'])) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: no title specified").'</responseMsg>'."\n"; + } + elseif( !isset($_POST['linInputLat']) OR empty($_POST['linInputLat']) + OR !isset($_POST['linInputLon']) OR empty($_POST['linInputLon'])) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: Missing Lat/Lon values").'</responseMsg>'."\n"; + } + else + { + /** + * @todo save marker in db + */ + /* + $_POST['linInputMarkerName'] + floatval($_POST['linInputLat']) + floatval($_POST['linInputLon']) + */ + + echo '<responseCode>success</responseCode>'."\n"; + } + + break; + } + } + + echo '</root>'."\n"; + exit(); +} + +if(isset($_GET['albId'])) { + $albId = intval($_GET['albId']); +} + +$query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, P.name, gpslatituderef,gpslatitude,gpslongituderef,gpslongitude " . + "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . + "WHERE gpslatituderef IS NOT NULL " . + "AND gpslatitude IS NOT NULL " . + "AND gpslongituderef IS NOT NULL " . + "AND gpslongitude IS NOT NULL "); +while($data = $query->FetchRow()) +{ + $arrImg[] = $data; + $parentIds[ $data['parent_id'] ] = true; +} + +$key = "ABQIAAAAAXCMfho4_sqSSh0VqMB80xT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSfO_6bbb_ScfT_zPgcnJMKyGltOg"; // key for http://localhost +$GLOBALS['linpha']->template->output['googleMap'] = new gmap($key); + + +/** + * here starts the output + */ +ob_start(); + +?> + <div id="linDivMapTop"></div> + + <div id="linDivMapMain" style="height: 475px;"> + <div id="linDivMapNav" style="width: 155px; height: 475px; float: right; overflow: auto; padding-left: 2px; padding-right: 1px;"> + Nav + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + </div> + <div style="width: 5px; height: 100%; float: right; cursor: e-resize; background-color: grey; border: 1px solid black;" ondblClick="linToggleNav();"></div> + <div id="gmapper_map" style="height: 100%; margin-right: 165px; "></div> + </div> + + <div id="linDivMapBottom"> + + <input type="text" id="linInputAddress" size="30"> + <input type="button" onclick="myLinMaps.geocodeAddress( $('linInputAddress').value )" value="<?php echo i18n("Geocode"); ?>"> + <br /><br /> + + <div id="linDivEditMarker" style="border: 1px solid black; width: 550px; padding: 3px;"> + <form action="" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;"> + <label for="linInputMarkerName" style="display: block; float: left; width: 150px;">Marker Name: + </label><input type="text" id="linInputMarkerName" name="linInputMarkerName" size="30" /><br /> + <label for="linInputLat" style="display: block; float: left; width: 150px;">Lat + </label><input type="text" id="linInputLat" name="linInputLat" size="10" /><br /> + <label for="linInputLon" style="display: block; float: left; width: 150px;">Lon: + </label><input type="text" id="linInputLon" name="linInputLon" size="10" /><br /> + <input type="submit" value="<?php echo i18n("Save"); ?>" /> + <input type="hidden" name="cmd" value="saveMarker" /> + </form> + </div> + + + + <br /><br /><br /> + + + <?php + /* + <input type="text" id="adresse" size="30"> + <input type="button" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "getAdress()", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/dash.png",32,32)); ?>" value="Geocode"> <br> + <br /><br /> + <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Berlin", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/143.png",20,34)); ?>">Berlin</a><br /> + <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Muenchen", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/rot.png",20,34), 10); ?>">München</a><br /> + <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Koelner Dom", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34), 17); ?>">Kölner Dom</a> + + */ + + + + + + echo i18n("Please select the album to show in Google Maps:"); + echo '<br /><br /><a href="'.LINPHA_LINK.'&linCat=map&albId=0">'.i18n("All albums").'</a><br />'; + + foreach($parentIds as $id=>$value) + { + echo '<a href="'.LINPHA_LINK.'&linCat=map&albId='.$id.'">'; + echo implode( '/', LinSql::getFullFilenameFromId($id) ); + echo '</a><br />'; + } + ?> + <br /> + + <div> + Legend:<br /> + (red) current marker<br /> + (yellow) location marker<br /> + (blue) location marker with assigned albums<br /> + (green) location marker with assigned images (GPS)<br /> + (pink) images<br /> + </div> + + <div> + Create marker:<br /> + 1. Enter address or just press "Geocode"<br /> + 2. Drag the marker to fine adjust<br /> + 3. Check marker name<br /> + 4. Press "Save"<br /> + <br /> + Assign albums:<br /> + 1. Click on a marker<br /> + 2. Press "Assign album"<br /> + 3. Choose album and press "Save"<br /> + 4. Repeat for multiple albums<br /> + <br /> + Assign images to an album marker:<br /> + This is done automatically. But it's required that your images have the + GPS information stored inside. You will need a GPS Data Logger to do this + automatically. It is also possible do it manually. Robogeo is a tool, but + it is not free. + </div> + + + </div> + + +<?php + $GLOBALS['linpha']->template->output['googleMap']->map( + $zoom = 4, + $lat = '49.9801', + $lng = '10.8731', + $type = "hybrid", + $min_zoom = 1, + $max_zoom = 23, + $navcontrol = "large", + $overview = 1, + $mousezoom = 1, + $tilecheck = 0 + ); +if(isset($albId)) +{ + $GLOBALS['linpha']->template->output['googleMap']->markstart(); + $GLOBALS['linpha']->template->output['googleMap']->bounds(); + //$GLOBALS['linpha']->template->output['googleMap']->lockMap(); not needed + + foreach($arrImg as $data) + { + if($albId == 0 OR $albId == $data['parent_id']) + { + $latlon = getExifLatLon($data); + $GLOBALS['linpha']->template->output['googleMap']->otherMarker( + $latlon['gpslatitude'], + $latlon['gpslongitude'] , + '<img src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$data['id'].'" width="'. + $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" height="'. + $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" /><br />'.$data['name'], + array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gelb.png",20,34) + ); + $GLOBALS['linpha']->template->output['googleMap']->boundsExtend(); + } + } + + $GLOBALS['linpha']->template->output['googleMap']->zoomToBounds(); + $GLOBALS['linpha']->template->output['googleMap']->markend(); + + /*$gpoint = $GLOBALS['linpha']->template->output['googleMap']->getGeoPoint("Saarbr�cken Saarland Deutschland"); + // Wir f�gen einige Marker hinzu + $GLOBALS['linpha']->template->output['googleMap']->markstart(); + $GLOBALS['linpha']->template->output['googleMap']->marker($gpoint[0], $gpoint[1], "dash.png"); + $GLOBALS['linpha']->template->output['googleMap']->mapMarker('52.5', '13', "dash.png"); + $GLOBALS['linpha']->template->output['googleMap']->mapMarker('48', '11', "gruen.png"); + $GLOBALS['linpha']->template->output['googleMap']->marker('47.5', '13', "gelb.png"); + // Marker mit Infoblase + $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51.5', '12' , 'Text hier', "gelb.png"); + $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51', '10' , 'Hallo Welt!'); + $tabs = array( + array('Tab 1', 'Content1'), + array('Tab 2', 'Lorem Ipsum Dolor sit amet Lorem Ipsum <br>Lorem Ispum'), + array('Tab 3', 'Lorem Ipsum Dolor sit amet Lorem Ipsum ') + ); + $GLOBALS['linpha']->template->output['googleMap']->tabMarker('52.6', '11.9' , $tabs, "gruen.png"); + $GLOBALS['linpha']->template->output['googleMap']->linkMarker('51.0', '6.5' , "http://www.gothic-singles.de", "rot.png"); + // Array mit Punkten zwischen denen eine Linie gezeichnet wird. + $punkte = array( + array('53.5', '12.7'), + array('52.5', '13'), + array('51.5', '12'), + array('51', '10'), + array('48', '11'), + array('47.5', '13') + ); + // Linie erzeugen + $GLOBALS['linpha']->template->output['googleMap']->polyline($punkte, '#FF00FF', 4, 1, "", 1); + $dist = $GLOBALS['linpha']->template->output['googleMap']->getDistance($punkte); + $GLOBALS['linpha']->template->output['googleMap']->markend(); + echo "L�nge der Linie: $dist Meter"; + */ +} + + + + + +$linpha->template->output['default'] = ob_get_clean(); + +$linpha->template->setModuleName('default'); +$linpha->template->overrideModule('head','map'); +$linpha->template->URL_full = LINPHA_LINK.'&linCat=map'; +$linpha->template->URL_base = LINPHA_LINK.'&linCat=map'; +$linpha->template->output['title'] = i18n("Google Maps"); +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); + +function getExifLatLon(&$LatLon) +{ + /*Array PJMT + ( + [md5sum] => 084a9633ae7544e35ff1faad6cb05564 + [gpslatituderef] => N + [gpslatitude] => 469762048/16777216 (28),285212672/16777216 (17),820803480/16777216 (48.9236998558) (Degrees Minutes Seconds North or South) + [gpslongituderef] => W + [gpslongitude] => 1879048192/134217728 (14),1207959552/134217728 (9),472055494/16777216 (28.1367000341) (Degrees Minutes Seconds East or West) + ) + /*Array Exiftool + ( + [md5sum] => 084a9633ae7544e35ff1faad6cb05564 + [gpslatituderef] => North + [gpslatitude] => 46.9762048 + [gpslongituderef] => West + [gpslongitude] => 18.79048192 + )*/ + + /** + * Exiftool saves lat and lon as float + */ + if($GLOBALS['linpha']->sql->config->value['sys_import_use_exiftool'] + && $GLOBALS['linpha']->sql->config->value['sys_import_exiftool_avail']) + { + foreach(array('gpslatitude','gpslongitude') as $value) + { + if( $LatLon[$value.'ref'] == 'South' OR $LatLon[$value.'ref'] == 'West' ) + { + $return[ $value ] = $LatLon[$value]*-1; + } + else + { + $return[$value] = $LatLon[$value]; + } + } + } + else + { + foreach(array('gpslatitude','gpslongitude') as $value) + { + $arrHits = array(); + + // use '?' to be �non-greedy� (http://de.wikipedia.org/wiki/Regul%C3%A4rer_Ausdruck#Gieriges_Verhalten) + preg_match_all('/\((.*?)\)/', $LatLon[ $value ], $arrHits); + + $return[ $value ] = $arrHits[1][0] + ($arrHits[1][1] * 1/60) + ($arrHits[1][2] * 1/60 * 1/60); + if( $LatLon[ $value.'ref'] == 'S' OR $LatLon[ $value.'ref'] == 'W' ) + { + $return[ $value ] *= -1; + } + } + } +return $return; +} +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2007-09-01 22:55:31
|
Revision: 4768 http://linpha.svn.sourceforge.net/linpha/?rev=4768&view=rev Author: fangehrn Date: 2007-09-01 15:55:23 -0700 (Sat, 01 Sep 2007) Log Message: ----------- 2007-09-01 flo * worked some more on the maps plugin - save and load markers is now working Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/index.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/sql/sql.mysql.php trunk/linpha2/install/sql/sql.tables.php trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/plugins/maps/LinMaps.js trunk/linpha2/lib/plugins/maps/module.exampleMap.php trunk/linpha2/templates/default/map.head.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/ChangeLog 2007-09-01 22:55:23 UTC (rev 4768) @@ -1,3 +1,7 @@ +2007-09-01 flo + * worked some more on the maps plugin + - save and load markers is now working + 2007-08-23 bzrudi * Make Exiftool work with GPS EXIF data Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/docs/dev/TODO.txt 2007-09-01 22:55:23 UTC (rev 4768) @@ -37,6 +37,8 @@ - should enable browsers cache for the thumbnails and maybe also for the images +- fix error handler + ## Big Todos - Common Tasks @@ -54,6 +56,8 @@ -> otherwise it would be possible to overwrite the current installation, (and to delete cache folders) - DONT add feature to drop tables if they already exists - add Usage link after installation has been successfully finished + - dont create tables which start with plugins_ automatically + provide plugin interface to create such tables while activating plugin - Plugins (copy from linpha1) - Guestbook, first apply patch with security image Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/index.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -73,7 +73,7 @@ // plugins -case 'map': +case 'maps': /** * @todo check if plugin enabled */ @@ -86,4 +86,4 @@ break; } -?> +?> \ No newline at end of file Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/install/sql/sql.data.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -107,7 +107,9 @@ 'plugins_log_email_subject' => 'Linpha Log', 'plugins_filemanager_enable' => '0', - 'plugins_filemanager_nruploads' => '5' + 'plugins_filemanager_nruploads' => '5', + + 'plugins_maps_defaultMarkerZoom' => '10', ); $options_user_overrideable = Array( Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/install/sql/sql.mysql.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -144,6 +144,16 @@ "md5sum VARCHAR(32) NOT NULL default '', " . "meta_data VARCHAR(255) NOT NULL default '', " . "PRIMARY KEY (id) " . + ")", + "CREATE TABLE ".$linpha_tables['plugins_maps_markers']." ( ". + "id INT NOT NULL AUTO_INCREMENT, " . + "albId INT NOT NULL default '0', " . + "albPath VARCHAR(255) NOT NULL default '', " . + "markerName VARCHAR(255) NOT NULL default '', " . + "markerLat VARCHAR(255) NOT NULL default '', " . + "markerLon VARCHAR(255) NOT NULL default '', " . + "markerZoom INT NOT NULL default '0', " . + "PRIMARY KEY (id) " . ")" ); ?> Modified: trunk/linpha2/install/sql/sql.tables.php =================================================================== --- trunk/linpha2/install/sql/sql.tables.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/install/sql/sql.tables.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -35,6 +35,7 @@ "meta_iptc" => "meta_iptc", "meta_xmp" => "meta_xmp", "meta_comments" => "meta_comments", - "meta_data" => "meta_data" + "meta_data" => "meta_data", + "plugins_maps_markers" => "plugins_maps_markers" ); ?> Modified: trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -30,6 +30,7 @@ */ function ADODB_Error_Handler($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection) { + echo 'hi'; if (error_reporting() == 0) return; // obey @ protocol switch($fn) { case 'EXECUTE': Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -55,8 +55,11 @@ } else { + /** + * this seems to does not work correctly anymore error_reporting(0); include_once(LINPHA_DIR.'/lib/adodb/adodb-errorhandler.inc.php'); + */ $sql_dir = ''; include(LINPHA_DIR.'/var/config.dir.php'); // no include_once if we reconnect from another directory... Modified: trunk/linpha2/lib/plugins/maps/LinMaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/LinMaps.js 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/lib/plugins/maps/LinMaps.js 2007-09-01 22:55:23 UTC (rev 4768) @@ -15,7 +15,11 @@ { this.editMarker = false; this.navIsHidden = false; - this.defaultMarkerZoom = 10; + this.defaultMarkerZoom = linMapsDefaultZoomSize; + + this.markersData = false; + this.markersObj = false; + this.bounds = false; }, /** @@ -23,8 +27,67 @@ */ loadMarkers: function() { + myLinGlobal.AjaxPost('cmd=loadMarkers',myLinMaps.showMarkers); + }, + showMarkers: function(t) + { + myLinMaps.markersData = eval('(' + t.responseText + ')'); + //myLinMaps.markers = t.responseText.evalJSON(true); + + /** + * delete existing markers + */ + if( myLinMaps.markersObj ) + { + for( i = 0; i < myLinMaps.markersObj.length; i++ ) + { + map.removeOverlay( myLinMaps.markersObj[i] ); + } + + myLinMaps.markersObj = false; + } + + /** + * draw new markers + */ + myLinMaps.bounds = new GLatLngBounds(); + for( i = 0; i < myLinMaps.markersData.markers.length; i++ ) + { + myLinMaps.markersObj[i] = myLinMaps.createMarker( myLinMaps.markersData.markers[i] ); + } + + map.setCenter(myLinMaps.bounds.getCenter(), map.getBoundsZoomLevel(myLinMaps.bounds)); + }, + + createMarker: function( markerNode ) + { + /*var icon = new GIcon(); + icon.image = image[0]; + icon.iconSize = new GSize(image[1], image[2]); + subt = image[2] / 100 * 11; + subt = Math.ceil(subt); + var anchor = image[2] - subt; + icon.iconAnchor= new GPoint(10, anchor); + //{icon: icon, draggable: true}*/ + + //alert( markerNode.id + ' ' + markerNode.name + ' ' + markerNode.lat + ' ' + markerNode.lon); + + var point = new GLatLng( markerNode.lat, markerNode.lon); + var marker = new GMarker(point/*, icon*/); + + GEvent.addListener(marker, "click", function() { + marker.openInfoWindowHtml( '<b>' + markerNode.name + '</b><br />' + markerNode.id ); + }); + + map.addOverlay( marker ); + + this.bounds.extend(point); + + return marker; + }, + geocodeAddress: function(address) { if( this.editMarker ) @@ -79,17 +142,19 @@ }, updateEditMarker: function() { - if( this.editMarker ) + if( myLinMaps.editMarker ) // marker activated, use myLinMaps. instead of this. when fired from GEvent class { - latlng = this.editMarker.getPoint(); + latlng = myLinMaps.editMarker.getPoint(); $('linInputLat').value = latlng.lat(); $('linInputLon').value = latlng.lng(); + $('linInputZoom').value = map.getZoom(); } else { $('linInputMarkerName').value = ''; $('linInputLat').value = ''; $('linInputLon').value = ''; + $('linInputZoom').value = ''; } }, saveMarker: function(t) @@ -201,6 +266,9 @@ linEnableOnResize(); linOnResizeWrapper(); + GEvent.addListener(map, "zoomend", myLinMaps.updateEditMarker); + + myLinMaps.loadMarkers(); } //initLinMaps(); Modified: trunk/linpha2/lib/plugins/maps/module.exampleMap.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -1,295 +1,352 @@ -<?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. - */ - -/** - * Google Maps - * @package Plugins - */ -if(!defined('LINPHA_DIR')) { exit(1); } - -error_reporting(E_ALL); -require_once(LINPHA_DIR."/lib/plugins/maps/gmapper1/class.gmapper.php"); - -if(isset($_GET['xml'])) -{ - header('Content-type: text/xml'); - echo '<?xml version="1.0" ?>'."\n"; - echo '<root>'."\n"; - - if(isset($_POST['cmd'])) - { - switch($_POST['cmd']) - { - case 'loadMarker': - break; - - case 'saveMarker': - - if( !isset($_POST['linInputMarkerName']) OR empty($_POST['linInputMarkerName'])) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.i18n("Error: no title specified").'</responseMsg>'."\n"; - } - elseif( !isset($_POST['linInputLat']) OR empty($_POST['linInputLat']) - OR !isset($_POST['linInputLon']) OR empty($_POST['linInputLon'])) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.i18n("Error: Missing Lat/Lon values").'</responseMsg>'."\n"; - } - else - { - /** - * @todo save marker in db - */ - /* - $_POST['linInputMarkerName'] - floatval($_POST['linInputLat']) - floatval($_POST['linInputLon']) - */ - - echo '<responseCode>success</responseCode>'."\n"; - } - - break; - } - } - - echo '</root>'."\n"; - exit(); -} - -if(isset($_GET['albId'])) { - $albId = intval($_GET['albId']); -} - -$query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, P.name, gpslatituderef,gpslatitude,gpslongituderef,gpslongitude " . - "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . - "WHERE gpslatituderef IS NOT NULL " . - "AND gpslatitude IS NOT NULL " . - "AND gpslongituderef IS NOT NULL " . - "AND gpslongitude IS NOT NULL "); -while($data = $query->FetchRow()) -{ - $arrImg[] = $data; - $parentIds[ $data['parent_id'] ] = true; -} - -$key = "ABQIAAAAAXCMfho4_sqSSh0VqMB80xT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSfO_6bbb_ScfT_zPgcnJMKyGltOg"; // key for http://localhost -$GLOBALS['linpha']->template->output['googleMap'] = new gmap($key); - - -/** - * here starts the output - */ -ob_start(); - -?> - <div id="linDivMapTop"></div> - - <div id="linDivMapMain" style="height: 475px;"> - <div id="linDivMapNav" style="width: 155px; height: 475px; float: right; overflow: auto; padding-left: 2px; padding-right: 1px;"> - Nav - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - </div> - <div style="width: 5px; height: 100%; float: right; cursor: e-resize; background-color: grey; border: 1px solid black;" ondblClick="linToggleNav();"></div> - <div id="gmapper_map" style="height: 100%; margin-right: 165px; "></div> - </div> - - <div id="linDivMapBottom"> - - <input type="text" id="linInputAddress" size="30"> - <input type="button" onclick="myLinMaps.geocodeAddress( $('linInputAddress').value )" value="<?php echo i18n("Geocode"); ?>"> - <br /><br /> - - <div id="linDivEditMarker" style="border: 1px solid black; width: 550px; padding: 3px;"> - <form action="" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;"> - <label for="linInputMarkerName" style="display: block; float: left; width: 150px;">Marker Name: - </label><input type="text" id="linInputMarkerName" name="linInputMarkerName" size="30" /><br /> - <label for="linInputLat" style="display: block; float: left; width: 150px;">Lat - </label><input type="text" id="linInputLat" name="linInputLat" size="10" /><br /> - <label for="linInputLon" style="display: block; float: left; width: 150px;">Lon: - </label><input type="text" id="linInputLon" name="linInputLon" size="10" /><br /> - <input type="submit" value="<?php echo i18n("Save"); ?>" /> - <input type="hidden" name="cmd" value="saveMarker" /> - </form> - </div> - - - - <br /><br /><br /> - - - <?php - /* - <input type="text" id="adresse" size="30"> - <input type="button" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "getAdress()", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/dash.png",32,32)); ?>" value="Geocode"> <br> - <br /><br /> - <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "Berlin", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/143.png",20,34)); ?>">Berlin</a><br /> - <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "Muenchen", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/rot.png",20,34), 10); ?>">München</a><br /> - <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "Koelner Dom", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34), 17); ?>">Kölner Dom</a> - - */ - - - - - - echo i18n("Please select the album to show in Google Maps:"); - echo '<br /><br /><a href="'.LINPHA_LINK.'&linCat=map&albId=0">'.i18n("All albums").'</a><br />'; - - foreach($parentIds as $id=>$value) - { - echo '<a href="'.LINPHA_LINK.'&linCat=map&albId='.$id.'">'; - echo implode( '/', LinSql::getFullFilenameFromId($id) ); - echo '</a><br />'; - } - ?> - <br /> - - <div> - Legend:<br /> - (red) current marker<br /> - (yellow) location marker<br /> - (blue) location marker with assigned albums<br /> - (green) location marker with assigned images (GPS)<br /> - (pink) images<br /> - </div> - - <div> - Create marker:<br /> - 1. Enter address or just press "Geocode"<br /> - 2. Drag the marker to fine adjust<br /> - 3. Check marker name<br /> - 4. Press "Save"<br /> - <br /> - Assign albums:<br /> - 1. Click on a marker<br /> - 2. Press "Assign album"<br /> - 3. Choose album and press "Save"<br /> - 4. Repeat for multiple albums<br /> - <br /> - Assign images to an album marker:<br /> - This is done automatically. But it's required that your images have the - GPS information stored inside. You will need a GPS Data Logger to do this - automatically. It is also possible do it manually. Robogeo is a tool, but - it is not free. - </div> - - - </div> - - -<?php - $GLOBALS['linpha']->template->output['googleMap']->map( - $zoom = 4, - $lat = '49.9801', - $lng = '10.8731', - $type = "hybrid", - $min_zoom = 1, - $max_zoom = 23, - $navcontrol = "large", - $overview = 1, - $mousezoom = 1, - $tilecheck = 0 - ); -if(isset($albId)) -{ - $GLOBALS['linpha']->template->output['googleMap']->markstart(); - $GLOBALS['linpha']->template->output['googleMap']->bounds(); - //$GLOBALS['linpha']->template->output['googleMap']->lockMap(); not needed - - foreach($arrImg as $data) - { - if($albId == 0 OR $albId == $data['parent_id']) - { - $latlon = getExifLatLon($data); - $GLOBALS['linpha']->template->output['googleMap']->otherMarker( - $latlon['gpslatitude'], - $latlon['gpslongitude'] , - '<img src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$data['id'].'" width="'. - $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" height="'. - $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" /><br />'.$data['name'], - array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gelb.png",20,34) - ); - $GLOBALS['linpha']->template->output['googleMap']->boundsExtend(); - } - } - - $GLOBALS['linpha']->template->output['googleMap']->zoomToBounds(); - $GLOBALS['linpha']->template->output['googleMap']->markend(); - - /*$gpoint = $GLOBALS['linpha']->template->output['googleMap']->getGeoPoint("Saarbr�cken Saarland Deutschland"); - // Wir f�gen einige Marker hinzu - $GLOBALS['linpha']->template->output['googleMap']->markstart(); - $GLOBALS['linpha']->template->output['googleMap']->marker($gpoint[0], $gpoint[1], "dash.png"); - $GLOBALS['linpha']->template->output['googleMap']->mapMarker('52.5', '13', "dash.png"); - $GLOBALS['linpha']->template->output['googleMap']->mapMarker('48', '11', "gruen.png"); - $GLOBALS['linpha']->template->output['googleMap']->marker('47.5', '13', "gelb.png"); - // Marker mit Infoblase - $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51.5', '12' , 'Text hier', "gelb.png"); - $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51', '10' , 'Hallo Welt!'); - $tabs = array( - array('Tab 1', 'Content1'), - array('Tab 2', 'Lorem Ipsum Dolor sit amet Lorem Ipsum <br>Lorem Ispum'), - array('Tab 3', 'Lorem Ipsum Dolor sit amet Lorem Ipsum ') - ); - $GLOBALS['linpha']->template->output['googleMap']->tabMarker('52.6', '11.9' , $tabs, "gruen.png"); - $GLOBALS['linpha']->template->output['googleMap']->linkMarker('51.0', '6.5' , "http://www.gothic-singles.de", "rot.png"); - // Array mit Punkten zwischen denen eine Linie gezeichnet wird. - $punkte = array( - array('53.5', '12.7'), - array('52.5', '13'), - array('51.5', '12'), - array('51', '10'), - array('48', '11'), - array('47.5', '13') - ); - // Linie erzeugen - $GLOBALS['linpha']->template->output['googleMap']->polyline($punkte, '#FF00FF', 4, 1, "", 1); - $dist = $GLOBALS['linpha']->template->output['googleMap']->getDistance($punkte); - $GLOBALS['linpha']->template->output['googleMap']->markend(); - echo "L�nge der Linie: $dist Meter"; - */ -} - - - - - -$linpha->template->output['default'] = ob_get_clean(); - -$linpha->template->setModuleName('default'); -$linpha->template->overrideModule('head','map'); -$linpha->template->URL_full = LINPHA_LINK.'&linCat=map'; -$linpha->template->URL_base = LINPHA_LINK.'&linCat=map'; -$linpha->template->output['title'] = i18n("Google Maps"); -include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); - +<?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. + */ + +/** + * Google Maps + * @package Plugins + */ +if(!defined('LINPHA_DIR')) { exit(1); } + +require_once(LINPHA_DIR."/lib/plugins/maps/gmapper1/class.gmapper.php"); +$urlFull = LINPHA_LINK.'&linCat=maps'; + +if(isset($_GET['xml'])) +{ + if(isset($_POST['cmd'])) + { + switch($_POST['cmd']) + { + case 'loadMarkers': + + echo '{ "markers": [' . "\n"; + + $query = $GLOBALS['linpha']->db->Execute( + "SELECT id, albId, albPath, markerName, markerLat, markerLon, markerZoom " . + "FROM ".LIN_PREFIX."plugins_maps_markers" + ); + + while($data = $query->FetchRow()) + { + echo '{"id": '.$data['id'].', "albId": '.$data['albId'].', "path": "'.htmlspecialchars($data['albPath'],ENT_QUOTES).'", ' . + '"name": "'.htmlspecialchars($data['markerName'],ENT_QUOTES).'", ' . + '"lat": '.$data['markerLat'].', "lon": '.$data['markerLon'].', ' . + '"zoom": '.$data['markerZoom'].'},'. "\n"; + } + + /* + ?> + { + "markers": [ + {"id": 1, "path": "../../asd", "name": "my sweet home 1", "lat": 47.487868258751625, "lon": 9.388654232025146, "zoom": 17}, + {"id": 2, "path": "../../asd2", "name": "my sweet home 2", "lat": 47.587868258751625, "lon": 9.388654232025146, "zoom": 10}, + {"id": 3, "path": "../../asd3", "name": "my sweet home 3", "lat": 47.687868258751625, "lon": 9.388654232025146, "zoom": 15}, + ] + } + <?php + */ + + echo '] }' . "\n"; + + break; + + case 'saveMarker': + case 'editMarker': + + header('Content-type: text/xml'); + echo '<?xml version="1.0" ?>'."\n"; + echo '<root>'."\n"; + + if( !isset($_POST['linInputMarkerName']) OR empty($_POST['linInputMarkerName'])) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: no title specified").'</responseMsg>'."\n"; + } + elseif( !isset($_POST['linInputLat']) OR empty($_POST['linInputLat']) + OR !isset($_POST['linInputLon']) OR empty($_POST['linInputLon'])) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: Missing Lat/Lon values").'</responseMsg>'."\n"; + } + else + { + if( !isset($_POST['linInputZoom']) OR empty($_POST['linInputZoom']) ) + { + $_POST['linInputZoom'] = $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; + } + + if( $_POST['cmd'] == 'saveMarker' ) + { + $GLOBALS['linpha']->db->Execute("INSERT INTO ".LIN_PREFIX."plugins_maps_markers " . + "(markerName, markerLat, markerLon, markerZoom) " . + "VALUES (" . + "'".LinSql::linAddslashes($_POST['linInputMarkerName'])."', " . + "'".floatval($_POST['linInputLat'])."', " . + "'".floatval($_POST['linInputLon'])."', " . + "'".intval($_POST['linInputZoom'])."')" + ); + } + else // edit Marker + { + if( !isset($_POST['linInputMarkerId']) OR empty($_POST['linInputMarkerId']) ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: No valid marker").'</responseMsg>'."\n"; + } + } + + echo '<responseCode>success</responseCode>'."\n"; + } + + echo '</root>'."\n"; + + break; + } + } + + exit(); +} + +if(isset($_GET['albId'])) { + $albId = intval($_GET['albId']); +} + +$query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, P.name, gpslatituderef,gpslatitude,gpslongituderef,gpslongitude " . + "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . + "WHERE gpslatituderef IS NOT NULL " . + "AND gpslatitude IS NOT NULL " . + "AND gpslongituderef IS NOT NULL " . + "AND gpslongitude IS NOT NULL "); +while($data = $query->FetchRow()) +{ + $arrImg[] = $data; + $parentIds[ $data['parent_id'] ] = true; +} + +$key = "ABQIAAAAAXCMfho4_sqSSh0VqMB80xT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSfO_6bbb_ScfT_zPgcnJMKyGltOg"; // key for http://localhost +$GLOBALS['linpha']->template->output['googleMap'] = new gmap($key); + +/** + * here starts the output + */ +ob_start(); + +?> + <div id="linDivMapTop"></div> + + <div id="linDivMapMain" style="height: 475px;"> + <div id="linDivMapNav" style="width: 155px; height: 475px; float: right; overflow: auto; padding-left: 2px; padding-right: 1px;"> + Nav + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + </div> + <div style="width: 5px; height: 100%; float: right; cursor: e-resize; background-color: grey; border: 1px solid black;" ondblClick="linToggleNav();"></div> + <div id="gmapper_map" style="height: 100%; margin-right: 165px; "></div> + </div> + + <div id="linDivMapBottom"> + + <input type="text" id="linInputAddress" size="30"> + <input type="button" onclick="myLinMaps.geocodeAddress( $('linInputAddress').value )" value="<?php echo i18n("Geocode"); ?>"> + <br /><br /> + + <div id="linDivEditMarker" style="border: 1px solid black; width: 550px; padding: 3px;"> + <form action="<?php /* <?php echo $urlFull; ?>&xml */ + ?>" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;"> + <label for="linInputMarkerName" style="display: block; float: left; width: 150px;">Marker Name: + </label><input type="text" id="linInputMarkerName" name="linInputMarkerName" size="30" /><br /> + <label for="linInputLat" style="display: block; float: left; width: 150px;">Lat + </label><input type="text" id="linInputLat" name="linInputLat" size="10" /><br /> + <label for="linInputLon" style="display: block; float: left; width: 150px;">Lon: + </label><input type="text" id="linInputLon" name="linInputLon" size="10" /><br /> + <label for="linInputZoom" style="display: block; float: left; width: 150px;">Zoom: + </label><input type="text" id="linInputZoom" name="linInputZoom" size="10" /><br /> + + <input type="submit" value="<?php echo i18n("Save"); ?>" /> + <input type="hidden" name="cmd" value="saveMarker" /> + </form> + </div> + + + + <br /><br /><br /> + + + <?php + /* + <input type="text" id="adresse" size="30"> + <input type="button" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "getAdress()", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/dash.png",32,32)); ?>" value="Geocode"> <br> + <br /><br /> + <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Berlin", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/143.png",20,34)); ?>">Berlin</a><br /> + <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Muenchen", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/rot.png",20,34), 10); ?>">München</a><br /> + <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Koelner Dom", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34), 17); ?>">Kölner Dom</a> + + */ + + + + + + echo i18n("Please select the album to show in Google Maps:"); + echo '<br /><br /><a href="'.LINPHA_LINK.'&linCat=maps&albId=0">'.i18n("All albums").'</a><br />'; + + foreach($parentIds as $id=>$value) + { + echo '<a href="'.LINPHA_LINK.'&linCat=maps&albId='.$id.'">'; + echo implode( '/', LinSql::getFullFilenameFromId($id) ); + echo '</a><br />'; + } + ?> + <br /> + + <div> + Legend:<br /> + (red) current marker<br /> + (yellow) location marker<br /> + (blue) location marker with assigned albums<br /> + (green) location marker with assigned images (GPS)<br /> + (pink) images<br /> + </div> + + <div> + Create marker:<br /> + 1. Enter address or just press "Geocode"<br /> + 2. Drag the marker to fine adjust<br /> + 3. Check marker name<br /> + 4. Press "Save"<br /> + <br /> + Assign albums:<br /> + 1. Click on a marker<br /> + 2. Press "Assign album"<br /> + 3. Choose album and press "Save"<br /> + 4. Repeat for multiple albums<br /> + <br /> + Assign images to an album marker:<br /> + This is done automatically. But it's required that your images have the + GPS information stored inside. You will need a GPS Data Logger to do this + automatically. It is also possible do it manually. Robogeo is a tool, but + it is not free. + </div> + + <div> + Not assigned images:<br /> + albums/album1 (22 images)<br /> + </div> + + + </div> + + +<?php + $GLOBALS['linpha']->template->output['googleMap']->map( + $zoom = 4, + $lat = '49.9801', + $lng = '10.8731', + $type = "hybrid", + $min_zoom = 1, + $max_zoom = 23, + $navcontrol = "large", + $overview = 1, + $mousezoom = 1, + $tilecheck = 0 + ); +if(isset($albId)) +{ + $GLOBALS['linpha']->template->output['googleMap']->markstart(); + $GLOBALS['linpha']->template->output['googleMap']->bounds(); + //$GLOBALS['linpha']->template->output['googleMap']->lockMap(); not needed + + foreach($arrImg as $data) + { + if($albId == 0 OR $albId == $data['parent_id']) + { + $latlon = getExifLatLon($data); + $GLOBALS['linpha']->template->output['googleMap']->otherMarker( + $latlon['gpslatitude'], + $latlon['gpslongitude'] , + '<img src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$data['id'].'" width="'. + $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" height="'. + $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" /><br />'.$data['name'], + array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gelb.png",20,34) + ); + $GLOBALS['linpha']->template->output['googleMap']->boundsExtend(); + } + } + + $GLOBALS['linpha']->template->output['googleMap']->zoomToBounds(); + $GLOBALS['linpha']->template->output['googleMap']->markend(); + + /*$gpoint = $GLOBALS['linpha']->template->output['googleMap']->getGeoPoint("Saarbr\xFCcken Saarland Deutschland"); + // Wir f\xFCgen einige Marker hinzu + $GLOBALS['linpha']->template->output['googleMap']->markstart(); + $GLOBALS['linpha']->template->output['googleMap']->marker($gpoint[0], $gpoint[1], "dash.png"); + $GLOBALS['linpha']->template->output['googleMap']->mapMarker('52.5', '13', "dash.png"); + $GLOBALS['linpha']->template->output['googleMap']->mapMarker('48', '11', "gruen.png"); + $GLOBALS['linpha']->template->output['googleMap']->marker('47.5', '13', "gelb.png"); + // Marker mit Infoblase + $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51.5', '12' , 'Text hier', "gelb.png"); + $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51', '10' , 'Hallo Welt!'); + $tabs = array( + array('Tab 1', 'Content1'), + array('Tab 2', 'Lorem Ipsum Dolor sit amet Lorem Ipsum <br>Lorem Ispum'), + array('Tab 3', 'Lorem Ipsum Dolor sit amet Lorem Ipsum ') + ); + $GLOBALS['linpha']->template->output['googleMap']->tabMarker('52.6', '11.9' , $tabs, "gruen.png"); + $GLOBALS['linpha']->template->output['googleMap']->linkMarker('51.0', '6.5' , "http://www.gothic-singles.de", "rot.png"); + // Array mit Punkten zwischen denen eine Linie gezeichnet wird. + $punkte = array( + array('53.5', '12.7'), + array('52.5', '13'), + array('51.5', '12'), + array('51', '10'), + array('48', '11'), + array('47.5', '13') + ); + // Linie erzeugen + $GLOBALS['linpha']->template->output['googleMap']->polyline($punkte, '#FF00FF', 4, 1, "", 1); + $dist = $GLOBALS['linpha']->template->output['googleMap']->getDistance($punkte); + $GLOBALS['linpha']->template->output['googleMap']->markend(); + echo "L\xE4nge der Linie: $dist Meter"; + */ +} + + + + + +$linpha->template->output['default'] = ob_get_clean(); + +$linpha->template->setModuleName('default'); +$linpha->template->overrideModule('head','map'); +$linpha->template->URL_full = $urlFull; +$linpha->template->URL_base = $urlFull; +$linpha->template->output['title'] = i18n("Google Maps"); +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); + + function getExifLatLon(&$LatLon) { /*Array PJMT @@ -345,4 +402,4 @@ } return $return; } -?> +?> \ No newline at end of file Modified: trunk/linpha2/templates/default/map.head.php =================================================================== --- trunk/linpha2/templates/default/map.head.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/templates/default/map.head.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -11,4 +11,6 @@ var maxImageHeight = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; ?>; var maxThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; ?>; var displayThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>; + +var linMapsDefaultZoomSize = <?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; ?>; </script> \ 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: <bz...@us...> - 2007-10-09 16:18:11
|
Revision: 4771 http://linpha.svn.sourceforge.net/linpha/?rev=4771&view=rev Author: bzrudi Date: 2007-10-09 09:18:08 -0700 (Tue, 09 Oct 2007) Log Message: ----------- "Add new Option to Installer 'Install Location'" Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/step10_postsettings.php trunk/linpha2/install/step11_finish.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-10-09 15:35:23 UTC (rev 4770) +++ trunk/linpha2/ChangeLog 2007-10-09 16:18:08 UTC (rev 4771) @@ -1,5 +1,11 @@ 2007-10-09 bzrudi * Make Exiftool work with MAC OS!? ;-) + * Add new Option to Installer 'Install Location' from where you choose + if LinPHA will be installad public (Internet), or just local (Intranet). + This helps us to decide which operations to allow later. Think of image + tagging, rotating, deleting and so on. IMHO all this should be disabled + on public servers by default. + Config entry for this 'sys_public_installation' isn't used anywhere for now 2007-09-01 flo * worked some more on the maps plugin Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2007-10-09 15:35:23 UTC (rev 4770) +++ trunk/linpha2/install/step10_postsettings.php 2007-10-09 16:18:08 UTC (rev 4771) @@ -78,7 +78,22 @@ </div> <br /> +<?php +echo "<h2>".i18n_install("Please Choose LinPHA2 Install Location")."</h2><hr>"; +echo i18n_install("Internet - Public available over the Internet.")."<br />"; +echo i18n_install("Intranet - Running In A Secure Local Network")."<br /><br />"; +?> +<div align="center"> + <div class="box4"> + <input type='radio' name='sys_public_installation' value='1' checked=checked> + <?php echo i18n_install("Internet"); ?> + <input type='radio' name='sys_public_installation' value='0' > + <?php echo i18n_install("Intranet"); ?> + </div> +</div> +<br /> + <?php $query = $linpha->db->Execute("SELECT option_value FROM ".LIN_PREFIX."config " . "WHERE option_name='sys_im_use_imagemagick'"); Modified: trunk/linpha2/install/step11_finish.php =================================================================== --- trunk/linpha2/install/step11_finish.php 2007-10-09 15:35:23 UTC (rev 4770) +++ trunk/linpha2/install/step11_finish.php 2007-10-09 16:18:08 UTC (rev 4771) @@ -79,7 +79,34 @@ echo success_msg(); } + /** + * save installation type internet/intranet + */ +echo "<br />".i18n_install("Saving Install Type (Internet/Intranet) To Database...").' '; +if( isset( $_POST['sys_public_installation'] ) ) +{ + $result = $linpha->db->Execute("INSERT INTO ".LIN_PREFIX."config " . + "(option_value, option_name) VALUES " . + "('".LinSql::linAddslashes('sys_public_installation')."', " . + "'".LinSql::linAddslashes($_POST['sys_public_installation'])."')"); + if(!$result) + { + echo failed_msg(); + } + else + { + echo success_msg(); + } +} +else +{ + echo failed_msg(); + echo "<br />".i18n_install("Error - No Value Specified!"); + $error_nr = 1; +} + +/** * save thumbnails default size */ echo "<br />".i18n_install("Saving Thumbnail Size To Database...").' '; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2007-10-28 20:36:22
|
Revision: 4775 http://linpha.svn.sourceforge.net/linpha/?rev=4775&view=rev Author: fangehrn Date: 2007-10-28 13:36:19 -0700 (Sun, 28 Oct 2007) Log Message: ----------- some parts of linpha are maybe broken for the moment... 2007-10-08 flo * fixed bug in admin meta define exif (javascript error) * maps plugin - removed gmapper classes, using now own classes (its much easier) - splitted map functions -> it's now possible to add easily other map providers - added loadAlbums, loadImages, assignAlbum functions (AJAX) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/metadata_define.php trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/docs/dev/important stuff.txt trunk/linpha2/install/sql/sql.data.php trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/js/LinGlobal.js trunk/linpha2/lib/js/LinImage.js trunk/linpha2/lib/plugins/maps/LinMaps.js trunk/linpha2/lib/plugins/maps/module.exampleMap.php trunk/linpha2/templates/default/map.head.php trunk/linpha2/templates/default/view_img.html.php Added Paths: ----------- trunk/linpha2/lib/plugins/maps/class.googlemaps.js trunk/linpha2/lib/plugins/maps/class.maps.php trunk/linpha2/templates/default/maps.html.php trunk/linpha2/templates/default/themes/default/css/maps.css Property Changed: ---------------- trunk/linpha2/ Property changes on: trunk/linpha2 ___________________________________________________________________ Name: svn:ignore - .project project.index + .project project.index .cache .settings Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/ChangeLog 2007-10-28 20:36:19 UTC (rev 4775) @@ -1,3 +1,4 @@ + 2007-10-09 bzrudi * Make Exiftool work with MAC OS!? ;-) * Add new Option to Installer 'Install Location' from where you choose @@ -7,6 +8,14 @@ on public servers by default. Config entry for this 'sys_public_installation' isn't used anywhere for now +2007-10-08 flo + * fixed bug in admin meta define exif (javascript error) + * maps plugin + - removed gmapper classes, using now own classes (its much easier) + - splitted map functions + -> it's now possible to add easily other map providers + - added loadAlbums, loadImages, assignAlbum functions (AJAX) + 2007-09-01 flo * worked some more on the maps plugin - save and load markers is now working Modified: trunk/linpha2/admin/metadata_define.php =================================================================== --- trunk/linpha2/admin/metadata_define.php 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/admin/metadata_define.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -431,6 +431,10 @@ { obj_from.selectedIndex = obj_from.selectedIndex - 1; } + else if( old_index > obj_from.length -1 ) + { + obj_from.selectedIndex = obj_from.length -1; + } else { obj_from.selectedIndex = old_index; Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/docs/dev/TODO.txt 2007-10-28 20:36:19 UTC (rev 4775) @@ -15,14 +15,6 @@ - escape exif data (see Common Tasks UTF8) - optimize DB querys (index) -- how to handle common language strings like "Successfully updated data.", "Submit", "Access denied", "Check file permissions" ?? - i suggest using define('LIN_STR_SUBMIT', "Submit"); in the language file - and use it this way: echo i18n( LIN_STR_SUBMIT ); - or use: - define('LIN_STR_SUBMIT', i18n("Submit") ); - echo LIN_STR_SUBMIT; - ? - - if GDLib is not installed, the rounded corner stuff does not work -> create for each installed theme and/or example in the admin page rounded corners by hand and save them to /lib/graphics -> in roundedcorners.php add a check if function_exists 'imagejpeg' and if not, take them from /lib/graphics @@ -41,6 +33,21 @@ ## Big Todos +- Switch to strict mode + - we should changed html type to strict mode: + old: + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> + <html> + + new: + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> + + the xmlns:v="urn:schemas-microsoft-com:vml" is required for google maps + + - but then we need to adapt the linpha styles because some stuff will not work anymore + - Common Tasks - Switch to UTF8 as default - Use Effekts is sometimes hardcoded, make use of config @@ -78,6 +85,15 @@ DONE ==== +- how to handle common language strings like "Successfully updated data.", "Submit", "Access denied", "Check file permissions" ?? + i suggest using define('LIN_STR_SUBMIT', "Submit"); in the language file + and use it this way: echo i18n( LIN_STR_SUBMIT ); + or use: + define('LIN_STR_SUBMIT', i18n("Submit") ); + echo LIN_STR_SUBMIT; + ? + implemented in linpha.class.php + - Videos - Video thumbnail (what about ffmpeg?) - switch between quicktime and mplayer? Modified: trunk/linpha2/docs/dev/important stuff.txt =================================================================== --- trunk/linpha2/docs/dev/important stuff.txt 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/docs/dev/important stuff.txt 2007-10-28 20:36:19 UTC (rev 4775) @@ -1,4 +1,27 @@ +- adodb eof + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM meta_fields WHERE flags = '7'"); + if( ! $query->EOF ) -> on or more results + if( $query->EOF ) -> no results + +- trycatch + try + { + if(!isset( $_GET['id'] ) ) + { + throw new Exception("no id supplied!"); + } + } + catch(Exception $error) + { + echo "Error: ".$error -> getMessage(); + } + +- $GLOBALS['linpha']->sql->config->value['sys_'] + +- if possible, use common strings: LIN_STR_SUBMIT, LIN_STR_ACCESSDENIED, LIN_STR_SUCCUPDATEDDATA, LIN_STR_CHKFILEPERM + + exec(): - if we use exec($str, $array_output=array(), $return_value=''); it will always return empty $array_output and $return_value @@ -14,9 +37,6 @@ - if you need to get all outputs you have to append 2>&1 under windows you cannot override stdout, but it does not produce an error - - - - filesize($tmp_file) may return zero if clearstatcache() is not executed! clearstatcache(); @@ -26,23 +46,3 @@ - is_writable() does not work correctly under windows, it returns just the readonly attribute see http://bugs.php.net/bug.php?id=27609 for details see http://ch2.php.net/is_writable for alternative implementations - -- adodb eof - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM meta_fields WHERE flags = '7'"); - if( ! $query->EOF ) -> on or more results - if( $query->EOF ) -> no results - -- trycatch - try - { - if(!isset( $_GET['id'] ) ) - { - throw new Exception("no id supplied!"); - } - } - catch(Exception $error) - { - echo "Error: ".$error -> getMessage(); - } - -- $GLOBALS['linpha']->sql->config->value['sys_'] \ No newline at end of file Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/install/sql/sql.data.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -110,6 +110,9 @@ 'plugins_filemanager_nruploads' => '5', 'plugins_maps_defaultMarkerZoom' => '10', + 'plugins_maps_mapType' => 'google', + 'plugins_maps_google_key' => 'ABQIAAAAAXCMfho4_sqSSh0VqMB80xT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSfO_6bbb_ScfT_zPgcnJMKyGltOg', // key for http://localhost + ); $options_user_overrideable = Array( @@ -188,7 +191,10 @@ "VALUES ('stats', '')"; $sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . "VALUES ('download', '')"; +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . + "VALUES ('plugins_maps_setMarkers', '')"; + /** * MetaData * see http://linpha.sourceforge.net/wiki/index.php/Tables_linpha_meta_fields for the definition Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/lib/classes/linpha.class.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -104,4 +104,23 @@ } // end class Linpha + +/** + * handle common language strings + * prefer + * define('LIN_STR_SUBMIT', i18n("Submit") ); + * echo LIN_STR_SUBMIT; + * + * instead of + * define('LIN_STR_SUBMIT', "Submit"); + * echo i18n(LIN_STR_SUBMIT); + * + * to keep the update language file routine working + */ +define('LIN_STR_SUBMIT', i18n("Submit") ); +define('LIN_STR_ACCESSDENIED', i18n("Error: Access denied") ); +define('LIN_STR_SUCCUPDATEDDATA', i18n("Successfully updated data") ); +define('LIN_STR_CHKFILEPERM', i18n("Check file permissions") ); + + ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -159,8 +159,8 @@ </style> <![endif]--> -<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" 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; ?>'; @@ -168,10 +168,12 @@ var startIdCurrent = <?php echo $this->idCurrent; ?>; var IdCurrent = startIdCurrent; <?php -if(! isset($_SESSION['use_js']) && ! isset($_SESSION['disable_ajax'])) -{ - echo "myLinGlobal.checkAjaxCompatibility();"."\n"; -} +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> Modified: trunk/linpha2/lib/js/LinGlobal.js =================================================================== --- trunk/linpha2/lib/js/LinGlobal.js 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/lib/js/LinGlobal.js 2007-10-28 20:36:19 UTC (rev 4775) @@ -19,6 +19,8 @@ this.linInnerHeight = 0; this.linPageXOffset = 0; this.linPageYOffset = 0; + + this.tabs = new Array(); }, /** @@ -195,6 +197,40 @@ txt += "URL: " + url + "\n"; txt += "Line: " + line; alert(txt); + }, + + /** + * menu tab functions + */ + openTab: function( className, tabNr ) { + divElems = document.getElementsByTagName('div'); + for(i = 0, n = 0; i < divElems.length; i++) + { + if( divElems[i].className == className ) + { + if(n == tabNr && + typeof this.tabs[ className ]!='undefined' && + typeof this.tabs[ className ][ tabNr ]!='undefined' && + this.tabs[ className ][ tabNr ]!='disabled') + { + divElems[i].style.display = ''; + } else { + divElems[i].style.display = 'none'; + } + + n++; + } + } + }, + disableTab: function( className, tabNr, elemAId ) { + this.tabs[ className ][ tabNr ] = 'disabled'; + $(elemAId).style.color = 'grey'; + }, + enableTab: function( className, tabNr, elemAId ) { + alert(className + ' ' + typeof this.tabs[ className ] + ' ' + this.tabs[ className ]); + //this.tabs[ className ][ tabNr ] = ''; + //this.tabs.className.tabNr = ''; + $(elemAId).style.color = ''; } } @@ -208,6 +244,10 @@ myLinGlobal = new LinGlobal(); Event.observe(window, 'error', myLinGlobal.fOnError, false); + + /*if( checkAjaxCompatibility ) { + myLinGlobal.checkAjaxCompatibility(); + }*/ } //Event.observe(window, 'load', initLinGlobal, false); Modified: trunk/linpha2/lib/js/LinImage.js =================================================================== --- trunk/linpha2/lib/js/LinImage.js 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/lib/js/LinImage.js 2007-10-28 20:36:19 UTC (rev 4775) @@ -14,8 +14,8 @@ */ initialize: function() { - this.imgInfoColorNotActive = $('linDivInfoLink').style.color; - this.imgInfoColorActive = $('linHrefInfoLink').style.color; + /*this.imgInfoColorNotActive = $('linDivInfoLink').style.color; + this.imgInfoColorActive = $('linHrefInfoLink').style.color;*/ this.imgInfoShowHide = 'hide'; @@ -37,11 +37,7 @@ this.currentFileType; // 1 = image, 2 = video, 3 = others this.curLocationHash; - this.timerResize; - - this.testarray = new Array(); - this.testarray[0] = 'test 2'; - + //this.timerResize; }, @@ -59,6 +55,7 @@ this.curLocationHash = location.hash; // update current Hash, this value is periodically checked to reload the image if neccessary + // do not load the data again if it is already cached if(this.preloadXmlFinished[imgId] && typeof this.xmlDoc[imgId] != "undefined" ) // use typeof to work in IE { this.changeImage(); @@ -213,7 +210,7 @@ /** * hide elements during transition */ - this.hideImgInfoNow(); // hide meta text immediately + this.hideImgInfoNow(); // hide text info link immediately Element.hide('linImgMainimage'); // hide mainimage while changing image to prevent flicker Element.hide('linDivInfoLink'); @@ -228,7 +225,7 @@ Element.show('linDivloading'); } - $('linImgMainimage').style.marginLeft = 0; + //$('linImgMainimage').style.marginLeft = 0; // restore left margin, set when viewing videos /** * calc image width and height @@ -262,7 +259,7 @@ break; case '2': // video - $('linImgMainimage').style.marginLeft = 200; + //$('linImgMainimage').style.marginLeft = 200; /** * show video thumbnail @@ -480,17 +477,23 @@ this.setImageInfoLink(); // show the "info" link, must be called after Appear('linImgMainimage') Element.hide('linDivVideoLink'); - Element.show('linDivExifLink'); + //Element.show('linDivExifLink'); + //$('linAMetaExif').href = '#' + $('linAMetaExif').href; + myLinGlobal.enableTab( 'linDivTab', 3, 'linAMetaExif' ); break; case '2': // video Element.show('linDivVideoLink'); - Element.hide('linDivExifLink'); + //Element.hide('linDivExifLink'); + //$('linAMetaExif').href = $('linAMetaExif').href.substring(1); + //$('linAMetaExif').href = '#' + $('linAMetaExif').href; - $('linDivMetaOuter').style.top = $('linImgMainimage').offsetTop; + myLinGlobal.disableTab( 'linDivTab', 3, 'linAMetaExif' ); + + /*$('linDivMetaOuter').style.top = $('linImgMainimage').offsetTop; $('linDivMetaOuter').style.height = $('linImgMainimage').offsetHeight; // 'auto' - Element.show('linDivMetaOuter'); + Element.show('linDivMetaOuter');*/ break; } @@ -781,7 +784,9 @@ /** * reload image with new position and size */ - this.resizeWindow(); + //this.resizeWindow(); + //linOnResizeCreateTrigger(); + linOnResizeWrapper(); }, fullscreenStop: function() { @@ -901,6 +906,7 @@ }, /** + * DEPRECATED * showImgInfo() * * fade out the image, show the meta infos, sets the color of the "Info" link to another @@ -941,12 +947,12 @@ }, hideImgInfoNow: function() { - Element.hide('linDivMetaOuter'); + //Element.hide('linDivMetaOuter'); Element.hide('linHrefPanoLink'); Element.setOpacity('linDivMainimage',1); this.imgInfoShowHide = 'hide'; - $('linHrefInfoLink').style.color = this.imgInfoColorActive; + //$('linHrefInfoLink').style.color = this.imgInfoColorActive; }, /** @@ -1082,11 +1088,11 @@ /** * resizeWindow, use this wrapper function because internet explorer triggers the resize event to fast */ - resizeWindow: function () + /*resizeWindow: function () { clearTimeout(this.timerResize); this.timerResize = setTimeout(linImageWrapper,250); - } + }*/ } /** @@ -1095,7 +1101,7 @@ * use this wrapper function if called from setTimeout() * because 'this.' would not work otherwise */ -function linImageWrapper() +function linOnResizeWrapper() { if(myLinImage.fullscreenActive) { @@ -1123,7 +1129,6 @@ function initLinImage() { $('linDivMainimage').style.height = startImgHeight; // initial sets correct height at begin and not after the image is loaded - $('linImgMainimage').style.height = startImgHeight; // initial sets correct height at begin and not after the image is loaded myLinImage = new LinImage(); /** @@ -1186,7 +1191,7 @@ // setMainHeight(); // defined in LinGlobal.js // window.onresize = onWindowResize; // Event.observe(window, 'resize', onWindowResize, false); - Event.observe(window, 'resize', myLinImage.resizeWindow, false); + Event.observe(window, 'resize', linOnResizeCreateTrigger, false); } } Modified: trunk/linpha2/lib/plugins/maps/LinMaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/LinMaps.js 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/lib/plugins/maps/LinMaps.js 2007-10-28 20:36:19 UTC (rev 4775) @@ -14,12 +14,11 @@ initialize: function() { this.editMarker = false; - this.navIsHidden = false; - this.defaultMarkerZoom = linMapsDefaultZoomSize; + this.showNav = true; + this.defaultMarkerZoom = linMapsDefaultMarkerZoom; this.markersData = false; this.markersObj = false; - this.bounds = false; }, /** @@ -41,7 +40,7 @@ { for( i = 0; i < myLinMaps.markersObj.length; i++ ) { - map.removeOverlay( myLinMaps.markersObj[i] ); + myLinMapObject.removeMarker( myLinMaps.markersObj[i] ); } myLinMaps.markersObj = false; @@ -50,129 +49,120 @@ /** * draw new markers */ - myLinMaps.bounds = new GLatLngBounds(); + myLinMapObject.initBounds(); for( i = 0; i < myLinMaps.markersData.markers.length; i++ ) { - myLinMaps.markersObj[i] = myLinMaps.createMarker( myLinMaps.markersData.markers[i] ); + myLinMaps.markersObj[i] = myLinMapObject.createMarker( myLinMaps.markersData.markers[i] ); } - map.setCenter(myLinMaps.bounds.getCenter(), map.getBoundsZoomLevel(myLinMaps.bounds)); - + myLinMapObject.updateCenter(); }, - - createMarker: function( markerNode ) + + saveMarker: function(t) { - /*var icon = new GIcon(); - icon.image = image[0]; - icon.iconSize = new GSize(image[1], image[2]); - subt = image[2] / 100 * 11; - subt = Math.ceil(subt); - var anchor = image[2] - subt; - icon.iconAnchor= new GPoint(10, anchor); - //{icon: icon, draggable: true}*/ + xmlAnswer = t.responseXML.documentElement; - //alert( markerNode.id + ' ' + markerNode.name + ' ' + markerNode.lat + ' ' + markerNode.lon); - - var point = new GLatLng( markerNode.lat, markerNode.lon); - var marker = new GMarker(point/*, icon*/); - - GEvent.addListener(marker, "click", function() { - marker.openInfoWindowHtml( '<b>' + markerNode.name + '</b><br />' + markerNode.id ); - }); + if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' ) + { + myLinMapObject.removeMarker( myLinMaps.editMarker ); + + myLinMaps.editMarker = false; + myLinMaps.updateEditMarker(); - map.addOverlay( marker ); - - this.bounds.extend(point); - - return marker; + myLinMaps.loadMarkers(); + } + else + { + alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data ); + } }, - geocodeAddress: function(address) + assignAlbum: function(albId) { - if( this.editMarker ) - { - map.removeOverlay( this.editMarker ) - } + alert( albId ); + myLinGlobal.AjaxPost('cmd=assignAlbum&albId='+albId,myLinMaps.assignAlbumFinish); + }, + assignAlbumFinsih: function(t) + { + }, + + loadAlbums: function() + { + myLinGlobal.AjaxPost('cmd=loadAlbums',myLinMaps.showAlbums); + }, + showAlbums: function(t) + { + $('linDivMapAlbums').innerHTML = ''; + albumsData = eval('(' + t.responseText + ')'); - if( address == '' ) + for( i = 0; i < albumsData.albums.length; i++ ) { - this.createEditMarker( map.getCenter() ); + $('linDivMapAlbums').innerHTML += + '<a href="javascript:myLinMaps.loadImages(' + albumsData.albums[i].id + ')">' + + albumsData.albums[i].name + '</a><br />'; } - else - { - geocoder.getLatLng( - address, - function(point) - { - if(!point) - { - alert(address + " not found"); - } - else - { - map.setCenter(point, myLinMaps.defaultMarkerZoom); - myLinMaps.createEditMarker( point ); - - $('linInputMarkerName').value = address; - } - } - ); + }, + + loadImages: function(albId) + { + if( !this.showNav ) { + this.toggleNav(); } + + myLinGlobal.AjaxPost('cmd=loadImages&albId='+albId,myLinMaps.showImages); + }, - createEditMarker: function( center ) + showImages: function(t) { - this.editMarker = new GMarker(center, {draggable: true}); + myLinMaps.imagesData = eval('(' + t.responseText + ')'); + //myLinMaps.images = t.responseText.evalJSON(true); + + /** + * draw new markers / create thumbnails list + */ + $('linDivMapNav').innerHTML = ''; + //myLinMapObject.initBounds(); - /*GEvent.addListener(marker, "dragstart", function() { - map.closeInfoWindow(); - });*/ - - /*GEvent.addListener(marker, "dragend", function() { - marker.openInfoWindowHtml("Just bouncing along..."); - });*/ + for( i = 0; i < myLinMaps.imagesData.images.length; i++ ) + { + thumbId = myLinMaps.imagesData.images[i].id; - GEvent.addListener(this.editMarker, "drag", function() { - myLinMaps.updateEditMarker(); - }); + var ElemImg = Builder.node('img', {src: thumbSrc + thumbId, width: displayThumbSize, height: displayThumbSize}); + var ElemA = Builder.node('a', {href: 'javascript:myLinMaps.openImage(' + i + ')'}); + var ElemDiv = Builder.node('div', {className: 'linDivMapsThumb'}); + + ElemA.appendChild( ElemImg ); + ElemDiv.appendChild( ElemA ); + $('linDivMapNav').appendChild(ElemDiv); + + //myLinMaps.imagesObj[i] = myLinMapObject.createMarker( myLinMaps.imagesData.images[i] ); + + } - map.addOverlay( this.editMarker ); + myLinMapObject.updateCenter(); - this.updateEditMarker(); }, - updateEditMarker: function() + + openImage: function(imgIndex) { - if( myLinMaps.editMarker ) // marker activated, use myLinMaps. instead of this. when fired from GEvent class - { - latlng = myLinMaps.editMarker.getPoint(); - $('linInputLat').value = latlng.lat(); - $('linInputLon').value = latlng.lng(); - $('linInputZoom').value = map.getZoom(); - } - else - { - $('linInputMarkerName').value = ''; - $('linInputLat').value = ''; - $('linInputLon').value = ''; - $('linInputZoom').value = ''; - } + alert( myLinMaps.imagesData.images[imgIndex].lat + ' ' + myLinMaps.imagesData.images[imgIndex].lon); }, - saveMarker: function(t) + + getMarkerInfo: function( markerNode ) // maybe use markerId oder markerIndex (but that could be unsafe) { - xmlAnswer = t.responseXML.documentElement; + var infoStr = '<b>' + markerNode.name + '</b><br />' + markerNode.id; - if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' ) + if( markerNode.albId == 0 ) { - map.removeOverlay( myLinMaps.editMarker ); - myLinMaps.editMarker = false; - myLinMaps.updateEditMarker(); - - myLinMaps.loadMarkers(); + infoStr += "assign"; } else { - alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data ); + infoStr += "change assigned album"; } + + return infoStr; }, @@ -182,30 +172,30 @@ toggleNav: function() { - if( this.navIsHidden ) + if( this.showNav ) { - // restore save margin - $('gmapper_map').style.marginRight = $('linDivMapNav').style.marginRight; - $('linDivMapNav').style.marginRight = 0; + Element.hide('linDivMapNav'); - Element.show('linDivMapNav'); + // backup current margin + $('linDivMapNav').style.marginRight = $('linDivMapObject').style.marginRight; + + $('linDivMapObject').style.marginRight = 7; - this.navIsHidden = false; + this.showNav = false; } else { - Element.hide('linDivMapNav'); + // restore saved margin + $('linDivMapObject').style.marginRight = $('linDivMapNav').style.marginRight; + $('linDivMapNav').style.marginRight = 0; - // backup current margin - $('linDivMapNav').style.marginRight = $('gmapper_map').style.marginRight; - - $('gmapper_map').style.marginRight = 7; + Element.show('linDivMapNav'); - this.navIsHidden = true; + this.showNav = true; } // update google map size - map.checkResize(); + myLinMapObject.checkResize(); } @@ -220,7 +210,7 @@ function linOnResizeWrapper() { myLinGlobal.setWindowSize(); - var newHeight = myLinGlobal.linInnerHeight - $('linDivMain').offsetTop - 80; + var newHeight = myLinGlobal.linInnerHeight - $('linDivMain').offsetTop - $('linDivMapBottom').offsetHeight - 30; if(newHeight < 100) { newHeight = 100; @@ -251,7 +241,7 @@ /*$('linDivMapNav').style.height = $('linDivMapMain').style.height;*/ // resize google map itself also - map.checkResize(); + myLinMapObject.checkResize(); } /** @@ -261,21 +251,17 @@ */ function initLinMaps() { - myLinMaps = new LinMaps(); + myLinMaps.toggleNav(); + if( doLoadAlbums ) + myLinMaps.loadAlbums(); + linEnableOnResize(); linOnResizeWrapper(); - - GEvent.addListener(map, "zoomend", myLinMaps.updateEditMarker); - + myLinMaps.loadMarkers(); } - -//initLinMaps(); Event.observe(window, 'load', initLinMaps, false); -// prevent memory leaks in internet explorer -Event.observe(window, 'unload', GUnload, false); - - - +myLinMaps = new LinMaps(); +linMapObjectInit(); Added: trunk/linpha2/lib/plugins/maps/class.googlemaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/class.googlemaps.js (rev 0) +++ trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2007-10-28 20:36:19 UTC (rev 4775) @@ -0,0 +1,213 @@ + +var LinMapObject = Class.create(); +var myLinMapObject; + +var googlemap = false; // the main google map object +var geocoder = false; // the main google geocoder object + +LinMapObject.prototype = +{ + /** + * initialize() + * Constructor runs on completion of the DOM loading. + */ + initialize: function() + { + this.bounds = false; + }, + + createMap: function() + { + var mapType = 'hybrid'; // 'normal', 'satellite' + var mapLargeControl = 1; + var mapMouseZoom = 1; + var mapOverview = 1; + var mapMinZoom = 1; + var mapMaxZoom = 23; + var mapDefaultZoom = 4; + var mapDefaultLat = '49.9801'; + var mapDefaultLng = '10.8731'; + + geocoder = new GClientGeocoder(); + googlemap = new google.maps.Map2(document.getElementById("linDivMapObject")); + + googlemap.setCenter(new google.maps.LatLng(mapDefaultLat, mapDefaultLng), mapDefaultZoom); + + switch(mapType) { + case 'normal': + googlemap.setMapType(G_NORMAL_MAP); + break; + case 'satellite': + googlemap.setMapType(G_SATELLITE_MAP); + break; + case 'hybrid': + googlemap.setMapType(G_HYBRID_MAP); + break; + } + + + if(mapMouseZoom) { + googlemap.enableScrollWheelZoom(); + var mapdiv = document.getElementById("linDivMapObject"); + GEvent.addDomListener(mapdiv, "DOMMouseScroll", linMapWheelevent); + mapdiv.onmousewheel = linMapWheelevent; + } + if(mapOverview) { + googlemap.addControl(new GOverviewMapControl()); + } + + if(mapLargeControl) { + googlemap.addControl(new GLargeMapControl()); + } else { + googlemap.addControl(new GSmallMapControl()); + } + + googlemap.addControl(new GMapTypeControl()); + googlemap.setCenter(new GLatLng(mapDefaultLat,mapDefaultLng), mapDefaultZoom); + + var mycontrol = new GMapTypeControl(); + googlemap.addControl(mycontrol); + new GKeyboardHandler(googlemap); + googlemap.enableDoubleClickZoom(); + googlemap.enableContinuousZoom(); + + + // prevent memory leaks in internet explorer + Event.observe(window, 'unload', GUnload, false); + }, + + initBounds: function() + { + this.bounds = new GLatLngBounds(); + }, + updateCenter: function() + { + googlemap.setCenter(this.bounds.getCenter(), googlemap.getBoundsZoomLevel(this.bounds)); + }, + + createMarker: function( markerNode ) + { + /*var icon = new GIcon(); + icon.image = image[0]; + icon.iconSize = new GSize(image[1], image[2]); + subt = image[2] / 100 * 11; + subt = Math.ceil(subt); + var anchor = image[2] - subt; + icon.iconAnchor= new GPoint(10, anchor); + //{icon: icon, draggable: true}*/ + + //alert( markerNode.id + ' ' + markerNode.name + ' ' + markerNode.lat + ' ' + markerNode.lon); + + var point = new GLatLng( markerNode.lat, markerNode.lon); + var marker = new GMarker(point/*, icon*/); + + GEvent.addListener(marker, "click", function() { + marker.openInfoWindowHtml( myLinMaps.getMarkerInfo( markerNode ) ); + }); + + googlemap.addOverlay( marker ); + + this.bounds.extend(point); + + return marker; + }, + + createEditMarker: function( center ) + { + this.editMarker = new GMarker(center, {draggable: true}); + + /*GEvent.addListener(marker, "dragstart", function() { + map.closeInfoWindow(); + });*/ + + /*GEvent.addListener(marker, "dragend", function() { + marker.openInfoWindowHtml("Just bouncing along..."); + });*/ + + GEvent.addListener(this.editMarker, "drag", function() { + myLinMapObject.updateEditMarker(); + }); + + googlemap.addOverlay( this.editMarker ); + + this.updateEditMarker(); + }, + + updateEditMarker: function() + { + if( myLinMaps.editMarker ) // marker activated, use myLinMaps. instead of this. when fired from GEvent class + { + latlng = myLinMaps.editMarker.getPoint(); + $('linInputLat').value = latlng.lat(); + $('linInputLon').value = latlng.lng(); + $('linInputZoom').value = map.getZoom(); + } + else + { + $('linInputMarkerName').value = ''; + $('linInputLat').value = ''; + $('linInputLon').value = ''; + $('linInputZoom').value = ''; + } + }, + + removeMarker: function( marker) + { + googlemap.removeOverlay( marker ); + }, + + checkResize: function() + { + //alert("typeof googlemap.checkResize: " + typeof googlemap.checkResize ); + if( typeof googlemap.checkResize != "undefined" ) { + googlemap.checkResize(); + } + }, + + geocodeAddress: function(address) + { + if( myLinMaps.editMarker ) + { + map.removeOverlay( myLinMaps.editMarker ); + } + + if( address == '' ) + { + this.createEditMarker( googlemap.getCenter() ); + } + else + { + geocoder.getLatLng( + address, + function(point) + { + if(!point) { + alert(address + " not found"); + } else { + googlemap.setCenter(point, myLinMaps.defaultMarkerZoom); + myLinMapObject.createEditMarker( point ); + $('linInputMarkerName').value = address; + } + } + ); + } + } +} + + +function linMapWheelevent(e) +{ + if (!e) e = window.event; + if (e.preventDefault) e.preventDefault(); + e.returnValue = false; +} + +function linMapObjectInit() +{ + myLinMapObject = new LinMapObject(); + + google.load("maps", "2.x"); + google.setOnLoadCallback(myLinMapObject.createMap); + + ///GEvent.addListener(googlemap, "zoomend", myLinMapObject.updateEditMarker); +} Added: trunk/linpha2/lib/plugins/maps/class.maps.php =================================================================== --- trunk/linpha2/lib/plugins/maps/class.maps.php (rev 0) +++ trunk/linpha2/lib/plugins/maps/class.maps.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -0,0 +1,20 @@ +<?php + +class LinMaps +{ +function printHeader() +{ + +} + + function createMap() + { + } + + function addMarker() + { + + } +} + +?> \ No newline at end of file Modified: trunk/linpha2/lib/plugins/maps/module.exampleMap.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -24,14 +24,14 @@ */ if(!defined('LINPHA_DIR')) { exit(1); } -require_once(LINPHA_DIR."/lib/plugins/maps/gmapper1/class.gmapper.php"); -$urlFull = LINPHA_LINK.'&linCat=maps'; - +/** + * xml load/save stuff + */ if(isset($_GET['xml'])) { - if(isset($_POST['cmd'])) + if(isset($_REQUEST['cmd'])) // $_POST { - switch($_POST['cmd']) + switch($_REQUEST['cmd']) // $_POST { case 'loadMarkers': @@ -50,17 +50,11 @@ '"zoom": '.$data['markerZoom'].'},'. "\n"; } - /* - ?> - { - "markers": [ + /* ?> { "markers": [ {"id": 1, "path": "../../asd", "name": "my sweet home 1", "lat": 47.487868258751625, "lon": 9.388654232025146, "zoom": 17}, {"id": 2, "path": "../../asd2", "name": "my sweet home 2", "lat": 47.587868258751625, "lon": 9.388654232025146, "zoom": 10}, {"id": 3, "path": "../../asd3", "name": "my sweet home 3", "lat": 47.687868258751625, "lon": 9.388654232025146, "zoom": 15}, - ] - } - <?php - */ + ] } <?php */ echo '] }' . "\n"; @@ -72,10 +66,15 @@ header('Content-type: text/xml'); echo '<?xml version="1.0" ?>'."\n"; echo '<root>'."\n"; - - if( !isset($_POST['linInputMarkerName']) OR empty($_POST['linInputMarkerName'])) + + if( !$GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) { echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.LIN_STR_ACCESSDENIED.'</responseMsg>'."\n"; + } + elseif( !isset($_POST['linInputMarkerName']) OR empty($_POST['linInputMarkerName'])) + { + echo '<responseCode>failed</responseCode>'."\n"; echo '<responseMsg>'.i18n("Error: no title specified").'</responseMsg>'."\n"; } elseif( !isset($_POST['linInputLat']) OR empty($_POST['linInputLat']) @@ -117,233 +116,126 @@ echo '</root>'."\n"; break; - } - } + case 'assignAlbum': - exit(); -} - -if(isset($_GET['albId'])) { - $albId = intval($_GET['albId']); -} - -$query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, P.name, gpslatituderef,gpslatitude,gpslongituderef,gpslongitude " . - "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . - "WHERE gpslatituderef IS NOT NULL " . - "AND gpslatitude IS NOT NULL " . - "AND gpslongituderef IS NOT NULL " . - "AND gpslongitude IS NOT NULL "); -while($data = $query->FetchRow()) -{ - $arrImg[] = $data; - $parentIds[ $data['parent_id'] ] = true; -} - -$key = "ABQIAAAAAXCMfho4_sqSSh0VqMB80xT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSfO_6bbb_ScfT_zPgcnJMKyGltOg"; // key for http://localhost -$GLOBALS['linpha']->template->output['googleMap'] = new gmap($key); - -/** - * here starts the output - */ -ob_start(); - -?> - <div id="linDivMapTop"></div> - - <div id="linDivMapMain" style="height: 475px;"> - <div id="linDivMapNav" style="width: 155px; height: 475px; float: right; overflow: auto; padding-left: 2px; padding-right: 1px;"> - Nav - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - </div> - <div style="width: 5px; height: 100%; float: right; cursor: e-resize; background-color: grey; border: 1px solid black;" ondblClick="linToggleNav();"></div> - <div id="gmapper_map" style="height: 100%; margin-right: 165px; "></div> - </div> - - <div id="linDivMapBottom"> - - <input type="text" id="linInputAddress" size="30"> - <input type="button" onclick="myLinMaps.geocodeAddress( $('linInputAddress').value )" value="<?php echo i18n("Geocode"); ?>"> - <br /><br /> - - <div id="linDivEditMarker" style="border: 1px solid black; width: 550px; padding: 3px;"> - <form action="<?php /* <?php echo $urlFull; ?>&xml */ - ?>" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;"> - <label for="linInputMarkerName" style="display: block; float: left; width: 150px;">Marker Name: - </label><input type="text" id="linInputMarkerName" name="linInputMarkerName" size="30" /><br /> - <label for="linInputLat" style="display: block; float: left; width: 150px;">Lat - </label><input type="text" id="linInputLat" name="linInputLat" size="10" /><br /> - <label for="linInputLon" style="display: block; float: left; width: 150px;">Lon: - </label><input type="text" id="linInputLon" name="linInputLon" size="10" /><br /> - <label for="linInputZoom" style="display: block; float: left; width: 150px;">Zoom: - </label><input type="text" id="linInputZoom" name="linInputZoom" size="10" /><br /> + header('Content-type: text/xml'); + echo '<?xml version="1.0" ?>'."\n"; + echo '<root>'."\n"; - <input type="submit" value="<?php echo i18n("Save"); ?>" /> - <input type="hidden" name="cmd" value="saveMarker" /> - </form> - </div> + if( !$GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.LIN_STR_ACCESSDENIED.'</responseMsg>'."\n"; + } + elseif( !isset($_REQUEST['markerId']) OR !isset($_REQUEST['albId']) ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: No valid data").'</responseMsg>'."\n"; + } + else + { + $markerId = intval($_REQUEST['markerId']); + $albId = intval($_REQUEST['albId']); + + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."plugins_maps_markers " . + "SET albId = '".LinSql::linAddslashes($albId)."' WHERE id='".LinSql::linAddslashes($markerId)."'"); + + echo '<responseCode>success</responseCode>'."\n"; + } + echo '</root>'."\n"; - <br /><br /><br /> + break; + + case 'loadAlbums': - - <?php - /* - <input type="text" id="adresse" size="30"> - <input type="button" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "getAdress()", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/dash.png",32,32)); ?>" value="Geocode"> <br> - <br /><br /> - <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "Berlin", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/143.png",20,34)); ?>">Berlin</a><br /> - <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "Muenchen", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/rot.png",20,34), 10); ?>">München</a><br /> - <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "Koelner Dom", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34), 17); ?>">Kölner Dom</a> - - */ - - - - - - echo i18n("Please select the album to show in Google Maps:"); - echo '<br /><br /><a href="'.LINPHA_LINK.'&linCat=maps&albId=0">'.i18n("All albums").'</a><br />'; + echo '{ "albums": [' . "\n"; - foreach($parentIds as $id=>$value) + $query = $GLOBALS['linpha']->db->Execute("SELECT DISTINCT P.parent_id " . + "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . + "WHERE gpslatituderef IS NOT NULL " . + "AND gpslatitude IS NOT NULL " . + "AND gpslongituderef IS NOT NULL " . + "AND gpslongitude IS NOT NULL "); + + echo '{"id": 0, "name": "'.i18n("All albums").'"},'."\n"; + + if( !$query ) { - echo '<a href="'.LINPHA_LINK.'&linCat=maps&albId='.$id.'">'; - echo implode( '/', LinSql::getFullFilenameFromId($id) ); - echo '</a><br />'; + //echo "Error: Please enable EXIF GPS fields!"; } - ?> - <br /> - - <div> - Legend:<br /> - (red) current marker<br /> - (yellow) location marker<br /> - (blue) location marker with assigned albums<br /> - (green) location marker with assigned images (GPS)<br /> - (pink) images<br /> - </div> + else + { + while($data = $query->FetchRow()) + { + echo '{"id": '.$data['parent_id'].', "name": "'. + htmlspecialchars( implode( '/', LinSql::getFullFilenameFromId($data['parent_id']) ),ENT_QUOTES).'"},'. + "\n"; + } + } - <div> - Create marker:<br /> - 1. Enter address or just press "Geocode"<br /> - 2. Drag the marker to fine adjust<br /> - 3. Check marker name<br /> - 4. Press "Save"<br /> - <br /> - Assign albums:<br /> - 1. Click on a marker<br /> - 2. Press "Assign album"<br /> - 3. Choose album and press "Save"<br /> - 4. Repeat for multiple albums<br /> - <br /> - Assign images to an album marker:<br /> - This is done automatically. But it's required that your images have the - GPS information stored inside. You will need a GPS Data Logger to do this - automatically. It is also possible do it manually. Robogeo is a tool, but - it is not free. - </div> + echo '] }' . "\n"; - <div> - Not assigned images:<br /> - albums/album1 (22 images)<br /> - </div> + break; + case 'loadImages': + + if( !isset($_REQUEST['albId']) ) { + break; + } + + $albId = intval($_REQUEST['albId']); + + if($albId == 0) { + $filterStr = ""; + } else { + $filterStr = "AND P.parent_id = '".$albId."'"; + } - - </div> - - -<?php - $GLOBALS['linpha']->template->output['googleMap']->map( - $zoom = 4, - $lat = '49.9801', - $lng = '10.8731', - $type = "hybrid", - $min_zoom = 1, - $max_zoom = 23, - $navcontrol = "large", - $overview = 1, - $mousezoom = 1, - $tilecheck = 0 - ); -if(isset($albId)) -{ - $GLOBALS['linpha']->template->output['googleMap']->markstart(); - $GLOBALS['linpha']->template->output['googleMap']->bounds(); - //$GLOBALS['linpha']->template->output['googleMap']->lockMap(); not needed - - foreach($arrImg as $data) - { - if($albId == 0 OR $albId == $data['parent_id']) + $query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, P.name, gpslatituderef,gpslatitude,gpslongituderef,gpslongitude " . + "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . + "WHERE gpslatituderef IS NOT NULL " . + "AND gpslatitude IS NOT NULL " . + "AND gpslongituderef IS NOT NULL " . + "AND gpslongitude IS NOT NULL " . + $filterStr); + + echo '{ "images": [' . "\n"; + + if( !$query ) { - $latlon = getExifLatLon($data); - $GLOBALS['linpha']->template->output['googleMap']->otherMarker( - $latlon['gpslatitude'], - $latlon['gpslongitude'] , - '<img src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$data['id'].'" width="'. - $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" height="'. - $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" /><br />'.$data['name'], - array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gelb.png",20,34) - ); - $GLOBALS['linpha']->template->output['googleMap']->boundsExtend(); + //echo "Error: Please enable EXIF GPS fields!"; } + else + { + while($data = $query->FetchRow()) + { + $latlon = getExifLatLon($data); + + echo '{"id": '.$data['id'].', "parent_id": '.$data['parent_id'].', ' . + '"name": "'.htmlspecialchars( $data['name'] ,ENT_QUOTES).'", ' . + '"lat": '.$latlon['gpslatitude'].', "lon": '.$latlon['gpslongitude'] . + "},\n"; + } + } + + echo '] }' . "\n"; + + break; } - - $GLOBALS['linpha']->template->output['googleMap']->zoomToBounds(); - $GLOBALS['linpha']->template->output['googleMap']->markend(); + } - /*$gpoint = $GLOBALS['linpha']->template->output['googleMap']->getGeoPoint("Saarbr\xFCcken Saarland Deutschland"); - // Wir f\xFCgen einige Marker hinzu - $GLOBALS['linpha']->template->output['googleMap']->markstart(); - $GLOBALS['linpha']->template->output['googleMap']->marker($gpoint[0], $gpoint[1], "dash.png"); - $GLOBALS['linpha']->template->output['googleMap']->mapMarker('52.5', '13', "dash.png"); - $GLOBALS['linpha']->template->output['googleMap']->mapMarker('48', '11', "gruen.png"); - $GLOBALS['linpha']->template->output['googleMap']->marker('47.5', '13', "gelb.png"); - // Marker mit Infoblase - $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51.5', '12' , 'Text hier', "gelb.png"); - $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51', '10' , 'Hallo Welt!'); - $tabs = array( - array('Tab 1', 'Content1'), - array('Tab 2', 'Lorem Ipsum Dolor sit amet Lorem Ipsum <br>Lorem Ispum'), - array('Tab 3', 'Lorem Ipsum Dolor sit amet Lorem Ipsum ') - ); - $GLOBALS['linpha']->template->output['googleMap']->tabMarker('52.6', '11.9' , $tabs, "gruen.png"); - $GLOBALS['linpha']->template->output['googleMap']->linkMarker('51.0', '6.5' , "http://www.gothic-singles.de", "rot.png"); - // Array mit Punkten zwischen denen eine Linie gezeichnet wird. - $punkte = array( - array('53.5', '12.7'), - array('52.5', '13'), - array('51.5', '12'), - array('51', '10'), - array('48', '11'), - array('47.5', '13') - ); - // Linie erzeugen - $GLOBALS['linpha']->template->output['googleMap']->polyline($punkte, '#FF00FF', 4, 1, "", 1); - $dist = $GLOBALS['linpha']->template->output['googleMap']->getDistance($punkte); - $GLOBALS['linpha']->template->output['googleMap']->markend(); - echo "L\xE4nge der Linie: $dist Meter"; - */ + exit(); } +$urlFull = LINPHA_LINK.'&linCat=maps'; - - -$linpha->template->output['default'] = ob_get_clean(); - -$linpha->template->setModuleName('default'); +$linpha->template->setModuleName('maps'); $linpha->template->overrideModule('head','map'); $linpha->template->URL_full = $urlFull; $linpha->template->URL_base = $urlFull; -$linpha->template->output['title'] = i18n("Google Maps"); +$linpha->template->output['title'] = i18n("Maps"); include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); Modified: trunk/linpha2/templates/default/map.head.php =================================================================== --- trunk/linpha2/templates/default/map.head.php 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/templates/default/map.head.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -1,8 +1,4 @@ -<?php -$linTpl->output['googleMap']->headjs(); -?> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/gmapper1/bodyjs.js"></script> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/LinMaps.js"></script> +<script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/scriptaculous.js?load=effects,builder,dragdrop"></script> <script language="JavaScript" type="text/javascript"> var xmlUrl = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; var imageSrc = '<?php echo LINPHA_CLIENT.'/get_image.php?linId='; ?>'; @@ -12,5 +8,39 @@ var maxThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; ?>; var displayThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>; -var linMapsDefaultZoomSize = <?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; ?>; -</script> \ No newline at end of file +var linMapsDefaultMarkerZoom = <?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; ?>; +</script> + +<?php +if( $GLOBALS['linpha']->sql->config->value['plugins_maps_mapType'] == 'google' ) +{ + ?> + <script type="text/javascript" src="http://www.google.com/jsapi?key=<?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_google_key']; ?>"></script> + <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/class.googlemaps.js"></script> + <?php + + /** + * @todo + * google recommends using this kind of html header: + * <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> + * but without strict mode we need this css stuff to get polylines also working + * http://www.google.com/apis/maps/documentation/#XHTML_and_VML + ?> + <style type="text/css"> + v\:* { + behavior:url(#default#VML); + } + </style> + <?php + */ +} +elseif( $linTpl->output['mapType'] == 'xyz' ) +{ + ?> + <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/class.xyz.js"></script> + <?php +} +?> +<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/LinMaps.js"></script> Added: trunk/linpha2/templates/default/maps.html.php =================================================================== --- trunk/linpha2/templates/default/maps.html.php (rev 0) +++ trunk/linpha2/templates/default/maps.html.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -0,0 +1,112 @@ + +<div id="linDivMainOuter"> + <?php echo $linTpl->divRoundCorners('top'); ?> + <div id="linDivMain"> + + +<div id="linDivMapTop"></div> + +<div id="linDivMapMain"> + <div id="linDivMapNav"></div> + <div id="linDivMapResizeBorder" ondblClick="myLinMaps.toggleNav();"></div> + <div id="linDivMapObject"></div> +</div> + +<div id="linDivMapBottom"> + <input type="text" id="linInputAddress" size="30"> + <input type="button" onclick="myLinMapObject.geocodeAddress( $('linInputAddress').value )" value="<?php echo i18n("Geocode"); ?>"> +</div> + +<div id="linDivEditMarker" style="display: none"> + <form action="<?php /* <?php echo $urlFull; ?>&xml */ + ?>" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;"> + <label for="linInputMarkerName" class="linInputEditMarker">Marker Name: + </label><input type="text" id="linInputMarkerName" name="linInputMarkerName" size="30" /><br /> + <label for="linInputLat" class="linInputEditMarker">Lat + </label><input type="text" id="linInputLat" name="linInputLat" size="10" /><br /> + <label for="linInputLon" class="linInputEditMarker">Lon: + </label><input type="text" id="linInputLon" name="linInputLon" size="10" /><br /> + <label for="linInputZoom" class="linInputEditMarker">Zoom: + </label><input type="text" id="linInputZoom" name="linInputZoom" size="10" /><br /> + + <input type="submit" value="<?php echo i18n("Save"); ?>" /> + <input type="hidden" name="cmd" value="saveMarker" /> + </form> +</div> +<script type="text/javascript"> +//new Draggable('linDivEditMarker',{revert:false}); +</script> + +<?php +if( $GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) +{ +?> + <div> + <?php echo i18n("Please select the album to show in Google Maps:"); ?> + <div id="linDivMapAlbums"></div> + </div> + <script type="text/javascript"> + var doLoadAlbums = true; + </script> + + + <div id="linDivMapListOfAllAlbums"> + <form> + <select name="linInputAlbum" style="width: 250px;"> + <?php linBuildAlbumSelect($with_all_albs_entry=false); ?> + </select><br /> + <input type="button" value="<?php echo i18n("Assign Album"); ?>" onclick="myLinMaps.assignAlbum(this.form.linInputAlbum.value)"> + </form> + </div> + + + <br /> + + <div> + Legend:<br /> + (red) current marker<br /> + (yellow) location marker<br /> + (blue) location marker with assigned albums<br /> + (green) location marker with assigned images (GPS)<br /> + (pink) images<br /> + </div> + + <div> + Create marker:<br /> + 1. Enter address or just press "Geocode"<br /> + 2. Drag the marker to fine adjust<br /> + 3. Check marker name<br /> + 4. Press "Save"<br /> + <br /> + Assign albums:<br /> + 1. Click on a marker<br /> + 2. Press "Assign album"<br /> + 3. Choose album and press "Save"<br /> + 4. Repeat for multiple albums<br /> + <br /> + Assign images to an album marker:<br /> + This is done automatically. But it's required that your images have the + GPS information stored inside. You will need a GPS Data Logger to do this + automatically. It is also possible do it manually. Robogeo is a tool, but + it is not free. + </div> + + <div> + Not assigned images:<br /> + albums/album1 (22 images)<br /> + </div> +<?php +} +else +{ +?> + <script type="text/javascript"> + var doLoadAlbums = false; + </script> +<?php +} +?> + + </div> + <?php echo $linTpl->divRoundCorners('bottom'); ?> +</div> \ No newline at end of file Added: trunk/linpha2/templates/default/themes/default/css/maps.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/maps.css (rev 0) +++ trunk/linpha2/templates/default/themes/default/css/maps.css 2007-10-28 20:36:19 UTC (rev 4775) @@ -0,0 +1,39 @@ +#linDivMapMain { + height: 675px; +} + +#linDivMapObject { + height: 100%; + margin-right: 180px; +} + +#linDivMapResizeBorder { + width: 5px; + height: 100%; + float: right; + cursor: e-resize; + background-color: grey; + border: 1px solid black; +} + +#linDivMapNav { + width: 170px; + height: 675px; + float: right; + overflow: auto; + padding-left: 2px; + padding-right: 1px; +} + + +#linDivEditMarker { + border: 1px solid black; + width: 550px; + padding: 3px; +} + +.linInputEditMarker { + display: block; + float: left; + width: 150px; +} \ No newline at end of file Modified: trunk/linpha2/templates/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/default/view_img.html.php 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/templates/default/view_img.html.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -40,52 +40,74 @@ <img id="linImgMainimage" style="display: none;"> </div> - <div id="linDivMetaOuter" style="display: none;"> - <div id="linDivMeta"></div> - <div id="linDivExifLink" class="linDivMetaLinks"><a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a></div> - <div id="linDivVideoLink" class="linDivMetaLinks"> - <a href="<?php echo LINPHA_LINK.'linCat=video&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Play Video"); ?></a> - <br /> - <a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a> - <br /> - <a href="<?php echo LINPHA_LINK.'linCat=download&linId='.$linTpl->idCurrent; ?>&isDownload=true" onclick="javascript:myLinImage.updateLinId(this)"><?php echo i18n("Download Video"); ?></a> - </div> - </div> - <div id="linDivInfoLink" style="display: none; color: grey;"> <a id="linHrefPanoLink" href="<?php echo LINPHA_LINK.'linCat=panorama&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank" style="color: black;"><?php echo i18n("Panorama"); ?></a> - <a id="linHrefInfoLink" href="javascript:myLinImage.showImgInfo()" style="color: black;">Info</a> + <?php /*<a id="linHrefInfoLink" href="javascript:myLinImage.showImgInfo()" style="color: black;">Info</a>*/ ?> </div> <br /><br /> - <!-- comments --> - <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> - <!-- show add comment form --> - <div id="linDivAddComment"> - <form action="" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinImage.saveComment); 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:myLinImage.openTextarea()">(+)</a> + <div id="linDivTabs"> + <a href="javascript:myLinGlobal.openTab('linDivTab',0)">Comments</a> | + <a href="javascript:myLinGlobal.openTab('linDivTab',1)">Rating</a> | + <a href="javascript:myLinGlobal.openTab('linDivTab',2)">Info</a> | + <a id="linAMetaExif" href="javascript:myLinGlobal.openTab('linDivTab',3)">EXIF</a> + <br /><br /> + + <div class="linDivTab"> + <!-- comments --> + <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> + <!-- show add comment form --> + <div id="linDivAddComment"> + <form action="" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinImage.saveComment); 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:myLinImage.openTextarea()">(+)</a> + </div> + <div id="linDivAddCommentTextarea" style="display: none;"> + <textarea id="linInputAddCommentTextarea" class="linForms" name="inputAddCommentTextarea" tabindex="1" rows="10" style="width: 300px"></textarea> + </div> + + <?php echo i18n("Name"); ?>: <input type="text" class="linForms" name="inputAddCommentAuthor" value="" tabindex="2" size="10" style="width: 100px" maxlength="255" /> + + <input type="hidden" name="cmd" value="add_comment" /> + <input type="submit" name="submit" class="linButton" value="<?php echo i18n("Submit"); ?>" tabindex="2" /> + </form> + </div> + + <br /> + <?php } /* end if checkPermission('metadata_comments') */ ?> + + <!-- show image comments --> + <div id="linDivComments"></div> + </div> + <div class="linDivTab"> + Rating + </div> + <div class="linDivTab"> + Info + <div id="linDivMeta"></div> + + <div id="linDivVideoLink" class="linDivMetaLinks"> + <a href="<?php echo LINPHA_LINK.'linCat=video&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Play Video"); ?></a> + <br /> + <a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a> + <br /> + <a href="<?php echo LINPHA_LINK.'linCat=download&linId='.$linTpl->idCurrent; ?>&isDownload=true" onclick="javascript:myLinImage.updateLinId(this)"><?php echo i18n("Download Video"); ?></a> + </div> + + </div> + <div class="linDivTab"> + EXIF + + <div id="linDivExifLink" class="linDivMetaLinks"><a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a></div> + </div> + <script type="text/javascript"> + myLinGlobal.openTab('linDivTab',0); + </script> </div> - <div id="linDivAddCommentTextarea" style="display: none;"> - <textarea id="linInputAddCommentTextarea" class="linForms" name="inputAddCommentTextarea" tabindex="1" rows="10" style="width: 300px"></textarea> - </div> - - <?php echo i18n("Name"); ?>: <input type="text" class="linForms" name="inputAddCommentAuthor" value="" tabindex="2" size="10" style="width: 100px" maxlength="255" /> - - <input type="hidden" name="cmd" value="add_comment" /> - <input type="submit" name="submit" class="linButton" value="<?php echo i18n("Submit"); ?>" tabindex="2" /> - </form> - </div> - - <br /> - <?php } /* end if checkPermission('metadata_comments') */ ?> - - <!-- show image comments --> - <div id="linDivComments"></div> </div> <?php echo $linTpl->divRoundCorners('bottom'); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2007-10-30 22:19:57
|
Revision: 4776 http://linpha.svn.sourceforge.net/linpha/?rev=4776&view=rev Author: fangehrn Date: 2007-10-30 15:19:50 -0700 (Tue, 30 Oct 2007) Log Message: ----------- 2007-10-30 flo * working some more on the map plugin create markers is now working Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/plugins/maps/LinMaps.js trunk/linpha2/lib/plugins/maps/class.googlemaps.js trunk/linpha2/templates/default/maps.html.php trunk/linpha2/templates/default/themes/default/css/maps.css Added Paths: ----------- trunk/linpha2/lib/plugins/maps/module.maps.php trunk/linpha2/templates/default/maps.head.php Removed Paths: ------------- trunk/linpha2/lib/plugins/maps/class.maps.php trunk/linpha2/lib/plugins/maps/gmapper1/ trunk/linpha2/lib/plugins/maps/module.exampleMap.php trunk/linpha2/templates/default/map.head.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-10-28 20:36:19 UTC (rev 4775) +++ trunk/linpha2/ChangeLog 2007-10-30 22:19:50 UTC (rev 4776) @@ -1,4 +1,8 @@ +2007-10-30 flo + * working some more on the map plugin + create markers is now working + 2007-10-09 bzrudi * Make Exiftool work with MAC OS!? ;-) * Add new Option to Installer 'Install Location' from where you choose Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2007-10-28 20:36:19 UTC (rev 4775) +++ trunk/linpha2/index.php 2007-10-30 22:19:50 UTC (rev 4776) @@ -77,7 +77,7 @@ /** * @todo check if plugin enabled */ - require_once(LINPHA_DIR.'/lib/plugins/maps/module.exampleMap.php'); + require_once(LINPHA_DIR.'/lib/plugins/maps/module.maps.php'); break; Modified: trunk/linpha2/lib/plugins/maps/LinMaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/LinMaps.js 2007-10-28 20:36:19 UTC (rev 4775) +++ trunk/linpha2/lib/plugins/maps/LinMaps.js 2007-10-30 22:19:50 UTC (rev 4776) @@ -30,6 +30,8 @@ }, showMarkers: function(t) { + var i; + myLinMaps.markersData = eval('(' + t.responseText + ')'); //myLinMaps.markers = t.responseText.evalJSON(true); @@ -56,19 +58,43 @@ myLinMaps.markersObj[i] = myLinMapObject.createMarker( myLinMaps.markersData.markers[i] ); } - myLinMapObject.updateCenter(); + /** + * update center + * only if there is more than one marker + * prevent zooming to high + */ + if( i == 1 ) { + myLinMapObject.updateCenter( myLinMaps.markersData.markers[0].zoom ); + } else { + myLinMapObject.updateCenter( 0 ); + } }, + updateEditMarker: function() + { + if( myLinMaps.editMarker ) // marker activated, use myLinMaps. instead of "this." when fired from GEvent class + { + latlng = myLinMaps.editMarker.getPoint(); + $('linInputLat').value = latlng.lat(); + $('linInputLon').value = latlng.lng(); + $('linInputZoom').value = googlemap.getZoom(); + } + else + { + $('linInputMarkerName').value = ''; + $('linInputLat').value = ''; + $('linInputLon').value = ''; + $('linInputZoom').value = ''; + } + }, + saveMarker: function(t) { xmlAnswer = t.responseXML.documentElement; if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' ) { - myLinMapObject.removeMarker( myLinMaps.editMarker ); - - myLinMaps.editMarker = false; - myLinMaps.updateEditMarker(); + myLinMaps.removeEditMarker(); myLinMaps.loadMarkers(); } @@ -78,8 +104,18 @@ } }, - assignAlbum: function(albId) + removeEditMarker: function() { + myLinMapObject.removeMarker( this.editMarker ); + + this.editMarker = false; + this.updateEditMarker(); + + //Element.hide('linDivEditMarker'); + }, + + assignAlbum: function(markerId,albId) + { alert( albId ); myLinGlobal.AjaxPost('cmd=assignAlbum&albId='+albId,myLinMaps.assignAlbumFinish); }, @@ -140,7 +176,7 @@ } - myLinMapObject.updateCenter(); + //myLinMapObject.updateCenter(); }, @@ -149,21 +185,12 @@ alert( myLinMaps.imagesData.images[imgIndex].lat + ' ' + myLinMaps.imagesData.images[imgIndex].lon); }, - getMarkerInfo: function( markerNode ) // maybe use markerId oder markerIndex (but that could be unsafe) +/* getMarkerInfo: function( markerNode ) // maybe use markerId oder markerIndex (but that could be unsafe) { - var infoStr = '<b>' + markerNode.name + '</b><br />' + markerNode.id; + var infoStr = '<b>' + markerNode.name + '</b><br />' + markerNode.text; - if( markerNode.albId == 0 ) - { - infoStr += "assign"; - } - else - { - infoStr += "change assigned album"; - } - return infoStr; - }, + },*/ /** Modified: trunk/linpha2/lib/plugins/maps/class.googlemaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2007-10-28 20:36:19 UTC (rev 4775) +++ trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2007-10-30 22:19:50 UTC (rev 4776) @@ -74,15 +74,20 @@ // prevent memory leaks in internet explorer Event.observe(window, 'unload', GUnload, false); + GEvent.addListener(googlemap, "zoomend", myLinMaps.updateEditMarker); }, initBounds: function() { this.bounds = new GLatLngBounds(); }, - updateCenter: function() + updateCenter: function( zoom ) { - googlemap.setCenter(this.bounds.getCenter(), googlemap.getBoundsZoomLevel(this.bounds)); + if( zoom == 0 ) { + zoom = googlemap.getBoundsZoomLevel(this.bounds); + } + + googlemap.setCenter(this.bounds.getCenter(), zoom); }, createMarker: function( markerNode ) @@ -96,13 +101,47 @@ icon.iconAnchor= new GPoint(10, anchor); //{icon: icon, draggable: true}*/ + /** + * + http://www.google.com/intl/de_ALL/mapfiles/marker.png + http://www.google.com/intl/de_ALL/mapfiles/shadow50.png + + http://maps.google.com/mapfiles/ms/micons/red.png + http://maps.google.com/mapfiles/ms/micons/blue.png + http://maps.google.com/mapfiles/ms/micons/green.png + http://maps.google.com/mapfiles/ms/micons/lightblue.png + http://maps.google.com/mapfiles/ms/micons/yellow.png + http://maps.google.com/mapfiles/ms/micons/purple.png + http://maps.google.com/mapfiles/ms/micons/pink.png + + http://maps.google.com/mapfiles/ms/micons/red-dot.png + http://maps.google.com/mapfiles/ms/micons/blue-dot.png + http://maps.google.com/mapfiles/ms/micons/green-dot.png + http://maps.google.com/mapfiles/ms/micons/ltblue-dot.png + http://maps.google.com/mapfiles/ms/micons/yellow-dot.png + http://maps.google.com/mapfiles/ms/micons/purple-dot.png + http://maps.google.com/mapfiles/ms/micons/pink-dot.png + + http://maps.google.com/mapfiles/ms/micons/pushpin_shadow.png + http://maps.google.com/mapfiles/ms/micons/blue-pushpin.png + http://maps.google.com/mapfiles/ms/micons/red-pushpin.png + http://maps.google.com/mapfiles/ms/micons/grn-pushpin.png + http://maps.google.com/mapfiles/ms/micons/ltblu-pushpin.png + http://maps.google.com/mapfiles/ms/micons/ylw-pushpin.png + http://maps.google.com/mapfiles/ms/micons/purple-pushpin.png + http://maps.google.com/mapfiles/ms/micons/pink-pushpin.png + * + */ + //alert( markerNode.id + ' ' + markerNode.name + ' ' + markerNode.lat + ' ' + markerNode.lon); var point = new GLatLng( markerNode.lat, markerNode.lon); - var marker = new GMarker(point/*, icon*/); + var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/blue-dot.png") + icon.iconSize = new GSize(32, 32); + var marker = new GMarker(point, icon); GEvent.addListener(marker, "click", function() { - marker.openInfoWindowHtml( myLinMaps.getMarkerInfo( markerNode ) ); + marker.openInfoWindowHtml( /*myLinMaps.getMarkerInfo( markerNode )*/ '<b>' + markerNode.name + '</b><br />' + markerNode.text ); }); googlemap.addOverlay( marker ); @@ -114,43 +153,33 @@ createEditMarker: function( center ) { - this.editMarker = new GMarker(center, {draggable: true}); + myLinMaps.editMarker = new GMarker(center, {draggable: true}); + var inputForm = document.createElement("form"); + inputForm.setAttribute("action",""); + inputForm.setAttribute("method","POST"); + inputForm.onsubmit = function() {myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;}; + inputForm.innerHTML = $('linDivEditMarker').innerHTML; + + myLinMaps.editMarker.bindInfoWindow( inputForm ); + + GEvent.addListener(myLinMaps.editMarker, "drag", function() { + myLinMaps.updateEditMarker(); + }); + /*GEvent.addListener(marker, "dragstart", function() { map.closeInfoWindow(); });*/ - /*GEvent.addListener(marker, "dragend", function() { - marker.openInfoWindowHtml("Just bouncing along..."); - });*/ - - GEvent.addListener(this.editMarker, "drag", function() { - myLinMapObject.updateEditMarker(); + GEvent.addListener(myLinMaps.editMarker, "dragend", function() { + GEvent.trigger(myLinMaps.editMarker, 'click'); }); - - googlemap.addOverlay( this.editMarker ); - this.updateEditMarker(); + googlemap.addOverlay( myLinMaps.editMarker ); + GEvent.trigger(myLinMaps.editMarker, 'click'); + myLinMaps.updateEditMarker(); }, - updateEditMarker: function() - { - if( myLinMaps.editMarker ) // marker activated, use myLinMaps. instead of this. when fired from GEvent class - { - latlng = myLinMaps.editMarker.getPoint(); - $('linInputLat').value = latlng.lat(); - $('linInputLon').value = latlng.lng(); - $('linInputZoom').value = map.getZoom(); - } - else - { - $('linInputMarkerName').value = ''; - $('linInputLat').value = ''; - $('linInputLon').value = ''; - $('linInputZoom').value = ''; - } - }, - removeMarker: function( marker) { googlemap.removeOverlay( marker ); @@ -208,6 +237,4 @@ google.load("maps", "2.x"); google.setOnLoadCallback(myLinMapObject.createMap); - - ///GEvent.addListener(googlemap, "zoomend", myLinMapObject.updateEditMarker); } Deleted: trunk/linpha2/lib/plugins/maps/class.maps.php =================================================================== --- trunk/linpha2/lib/plugins/maps/class.maps.php 2007-10-28 20:36:19 UTC (rev 4775) +++ trunk/linpha2/lib/plugins/maps/class.maps.php 2007-10-30 22:19:50 UTC (rev 4776) @@ -1,20 +0,0 @@ -<?php - -class LinMaps -{ -function printHeader() -{ - -} - - function createMap() - { - } - - function addMarker() - { - - } -} - -?> \ No newline at end of file Deleted: trunk/linpha2/lib/plugins/maps/module.exampleMap.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-10-28 20:36:19 UTC (rev 4775) +++ trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-10-30 22:19:50 UTC (rev 4776) @@ -1,297 +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. - */ - -/** - * Google Maps - * @package Plugins - */ -if(!defined('LINPHA_DIR')) { exit(1); } - -/** - * xml load/save stuff - */ -if(isset($_GET['xml'])) -{ - if(isset($_REQUEST['cmd'])) // $_POST - { - switch($_REQUEST['cmd']) // $_POST - { - case 'loadMarkers': - - echo '{ "markers": [' . "\n"; - - $query = $GLOBALS['linpha']->db->Execute( - "SELECT id, albId, albPath, markerName, markerLat, markerLon, markerZoom " . - "FROM ".LIN_PREFIX."plugins_maps_markers" - ); - - while($data = $query->FetchRow()) - { - echo '{"id": '.$data['id'].', "albId": '.$data['albId'].', "path": "'.htmlspecialchars($data['albPath'],ENT_QUOTES).'", ' . - '"name": "'.htmlspecialchars($data['markerName'],ENT_QUOTES).'", ' . - '"lat": '.$data['markerLat'].', "lon": '.$data['markerLon'].', ' . - '"zoom": '.$data['markerZoom'].'},'. "\n"; - } - - /* ?> { "markers": [ - {"id": 1, "path": "../../asd", "name": "my sweet home 1", "lat": 47.487868258751625, "lon": 9.388654232025146, "zoom": 17}, - {"id": 2, "path": "../../asd2", "name": "my sweet home 2", "lat": 47.587868258751625, "lon": 9.388654232025146, "zoom": 10}, - {"id": 3, "path": "../../asd3", "name": "my sweet home 3", "lat": 47.687868258751625, "lon": 9.388654232025146, "zoom": 15}, - ] } <?php */ - - echo '] }' . "\n"; - - break; - - case 'saveMarker': - case 'editMarker': - - header('Content-type: text/xml'); - echo '<?xml version="1.0" ?>'."\n"; - echo '<root>'."\n"; - - if( !$GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.LIN_STR_ACCESSDENIED.'</responseMsg>'."\n"; - } - elseif( !isset($_POST['linInputMarkerName']) OR empty($_POST['linInputMarkerName'])) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.i18n("Error: no title specified").'</responseMsg>'."\n"; - } - elseif( !isset($_POST['linInputLat']) OR empty($_POST['linInputLat']) - OR !isset($_POST['linInputLon']) OR empty($_POST['linInputLon'])) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.i18n("Error: Missing Lat/Lon values").'</responseMsg>'."\n"; - } - else - { - if( !isset($_POST['linInputZoom']) OR empty($_POST['linInputZoom']) ) - { - $_POST['linInputZoom'] = $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; - } - - if( $_POST['cmd'] == 'saveMarker' ) - { - $GLOBALS['linpha']->db->Execute("INSERT INTO ".LIN_PREFIX."plugins_maps_markers " . - "(markerName, markerLat, markerLon, markerZoom) " . - "VALUES (" . - "'".LinSql::linAddslashes($_POST['linInputMarkerName'])."', " . - "'".floatval($_POST['linInputLat'])."', " . - "'".floatval($_POST['linInputLon'])."', " . - "'".intval($_POST['linInputZoom'])."')" - ); - } - else // edit Marker - { - if( !isset($_POST['linInputMarkerId']) OR empty($_POST['linInputMarkerId']) ) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.i18n("Error: No valid marker").'</responseMsg>'."\n"; - } - } - - echo '<responseCode>success</responseCode>'."\n"; - } - - echo '</root>'."\n"; - - break; - case 'assignAlbum': - - header('Content-type: text/xml'); - echo '<?xml version="1.0" ?>'."\n"; - echo '<root>'."\n"; - - if( !$GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.LIN_STR_ACCESSDENIED.'</responseMsg>'."\n"; - } - elseif( !isset($_REQUEST['markerId']) OR !isset($_REQUEST['albId']) ) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.i18n("Error: No valid data").'</responseMsg>'."\n"; - } - else - { - $markerId = intval($_REQUEST['markerId']); - $albId = intval($_REQUEST['albId']); - - $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."plugins_maps_markers " . - "SET albId = '".LinSql::linAddslashes($albId)."' WHERE id='".LinSql::linAddslashes($markerId)."'"); - - echo '<responseCode>success</responseCode>'."\n"; - } - - echo '</root>'."\n"; - - - break; - - case 'loadAlbums': - - echo '{ "albums": [' . "\n"; - - $query = $GLOBALS['linpha']->db->Execute("SELECT DISTINCT P.parent_id " . - "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . - "WHERE gpslatituderef IS NOT NULL " . - "AND gpslatitude IS NOT NULL " . - "AND gpslongituderef IS NOT NULL " . - "AND gpslongitude IS NOT NULL "); - - echo '{"id": 0, "name": "'.i18n("All albums").'"},'."\n"; - - if( !$query ) - { - //echo "Error: Please enable EXIF GPS fields!"; - } - else - { - while($data = $query->FetchRow()) - { - echo '{"id": '.$data['parent_id'].', "name": "'. - htmlspecialchars( implode( '/', LinSql::getFullFilenameFromId($data['parent_id']) ),ENT_QUOTES).'"},'. - "\n"; - } - } - - echo '] }' . "\n"; - - break; - case 'loadImages': - - if( !isset($_REQUEST['albId']) ) { - break; - } - - $albId = intval($_REQUEST['albId']); - - if($albId == 0) { - $filterStr = ""; - } else { - $filterStr = "AND P.parent_id = '".$albId."'"; - } - - $query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, P.name, gpslatituderef,gpslatitude,gpslongituderef,gpslongitude " . - "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . - "WHERE gpslatituderef IS NOT NULL " . - "AND gpslatitude IS NOT NULL " . - "AND gpslongituderef IS NOT NULL " . - "AND gpslongitude IS NOT NULL " . - $filterStr); - - echo '{ "images": [' . "\n"; - - if( !$query ) - { - //echo "Error: Please enable EXIF GPS fields!"; - } - else - { - while($data = $query->FetchRow()) - { - $latlon = getExifLatLon($data); - - echo '{"id": '.$data['id'].', "parent_id": '.$data['parent_id'].', ' . - '"name": "'.htmlspecialchars( $data['name'] ,ENT_QUOTES).'", ' . - '"lat": '.$latlon['gpslatitude'].', "lon": '.$latlon['gpslongitude'] . - "},\n"; - } - } - - echo '] }' . "\n"; - - break; - } - } - - exit(); -} - - -$urlFull = LINPHA_LINK.'&linCat=maps'; - -$linpha->template->setModuleName('maps'); -$linpha->template->overrideModule('head','map'); -$linpha->template->URL_full = $urlFull; -$linpha->template->URL_base = $urlFull; -$linpha->template->output['title'] = i18n("Maps"); -include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); - - -function getExifLatLon(&$LatLon) -{ - /*Array PJMT - ( - [md5sum] => 084a9633ae7544e35ff1faad6cb05564 - [gpslatituderef] => N - [gpslatitude] => 469762048/16777216 (28),285212672/16777216 (17),820803480/16777216 (48.9236998558) (Degrees Minutes Seconds North or South) - [gpslongituderef] => W - [gpslongitude] => 1879048192/134217728 (14),1207959552/134217728 (9),472055494/16777216 (28.1367000341) (Degrees Minutes Seconds East or West) - ) - /*Array Exiftool - ( - [md5sum] => 084a9633ae7544e35ff1faad6cb05564 - [gpslatituderef] => North - [gpslatitude] => 46.9762048 - [gpslongituderef] => West - [gpslongitude] => 18.79048192 - )*/ - - /** - * Exiftool saves lat and lon as float - */ - if($GLOBALS['linpha']->sql->config->value['sys_import_use_exiftool'] - && $GLOBALS['linpha']->sql->config->value['sys_import_exiftool_avail']) - { - foreach(array('gpslatitude','gpslongitude') as $value) - { - if( $LatLon[$value.'ref'] == 'South' OR $LatLon[$value.'ref'] == 'West' ) - { - $return[ $value ] = $LatLon[$value]*-1; - } - else - { - $return[$value] = $LatLon[$value]; - } - } - } - else - { - foreach(array('gpslatitude','gpslongitude') as $value) - { - $arrHits = array(); - - // use '?' to be �non-greedy� (http://de.wikipedia.org/wiki/Regul%C3%A4rer_Ausdruck#Gieriges_Verhalten) - preg_match_all('/\((.*?)\)/', $LatLon[ $value ], $arrHits); - - $return[ $value ] = $arrHits[1][0] + ($arrHits[1][1] * 1/60) + ($arrHits[1][2] * 1/60 * 1/60); - if( $LatLon[ $value.'ref'] == 'S' OR $LatLon[ $value.'ref'] == 'W' ) - { - $return[ $value ] *= -1; - } - } - } -return $return; -} -?> \ No newline at end of file Copied: trunk/linpha2/lib/plugins/maps/module.maps.php (from rev 4775, trunk/linpha2/lib/plugins/maps/module.exampleMap.php) =================================================================== --- trunk/linpha2/lib/plugins/maps/module.maps.php (rev 0) +++ trunk/linpha2/lib/plugins/maps/module.maps.php 2007-10-30 22:19:50 UTC (rev 4776) @@ -0,0 +1,315 @@ +<?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. + */ + +/** + * Google Maps + * @package Plugins + */ +if(!defined('LINPHA_DIR')) { exit(1); } + +/** + * xml load/save stuff + */ +if(isset($_GET['xml'])) +{ + if(isset($_REQUEST['cmd'])) // $_POST + { + switch($_REQUEST['cmd']) // $_POST + { + case 'loadMarkers': + + echo '{ "markers": [' . "\n"; + + $query = $GLOBALS['linpha']->db->Execute( + "SELECT id, albId, albPath, markerName, markerLat, markerLon, markerZoom " . + "FROM ".LIN_PREFIX."plugins_maps_markers" + ); + + if( $GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) { + $allowed = true; + } else { + $allowed = false; + } + + while($data = $query->FetchRow()) + { + $path = htmlspecialchars($data['albPath'],ENT_QUOTES); + + if($allowed) { + if( $data['albId'] != 0 ) { + $text = '<a href=\'javascript:myLinMaps.assignAlbumChange('.$data['id'].','.$data['albId'].')\'>'.i18n("Change Assigned Album").'</a>'; + } else { + $text = '<a href=\'javascript:myLinMaps.assignAlbum('.$data['id'].',0)\'>'.i18n("Assign Album").'</a>'; + } + } else { + $text = $path; + } + + echo '{"id": '.$data['id'].', "albId": '.$data['albId'].', "path": "'.$path.'", ' . + '"name": "'.htmlspecialchars($data['markerName'],ENT_QUOTES).'", ' . + '"lat": '.$data['markerLat'].', "lon": '.$data['markerLon'].', ' . + '"zoom": '.$data['markerZoom'].', "text": "'.$text.'"},'. "\n"; + } + + /* ?> { "markers": [ + {"id": 1, "path": "../../asd", "name": "my sweet home 1", "lat": 47.487868258751625, "lon": 9.388654232025146, "zoom": 17}, + {"id": 2, "path": "../../asd2", "name": "my sweet home 2", "lat": 47.587868258751625, "lon": 9.388654232025146, "zoom": 10}, + {"id": 3, "path": "../../asd3", "name": "my sweet home 3", "lat": 47.687868258751625, "lon": 9.388654232025146, "zoom": 15}, + ] } <?php */ + + echo '] }' . "\n"; + + break; + + case 'saveMarker': + case 'editMarker': + + header('Content-type: text/xml'); + echo '<?xml version="1.0" ?>'."\n"; + echo '<root>'."\n"; + + if( !$GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.LIN_STR_ACCESSDENIED.'</responseMsg>'."\n"; + } + elseif( !isset($_POST['linInputMarkerName']) OR empty($_POST['linInputMarkerName'])) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: no title specified").'</responseMsg>'."\n"; + } + elseif( !isset($_POST['linInputLat']) OR empty($_POST['linInputLat']) + OR !isset($_POST['linInputLon']) OR empty($_POST['linInputLon'])) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: Missing Lat/Lon values").'</responseMsg>'."\n"; + } + else + { + if( !isset($_POST['linInputZoom']) OR empty($_POST['linInputZoom']) ) + { + $_POST['linInputZoom'] = $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; + } + + if( $_POST['cmd'] == 'saveMarker' ) + { + $GLOBALS['linpha']->db->Execute("INSERT INTO ".LIN_PREFIX."plugins_maps_markers " . + "(markerName, markerLat, markerLon, markerZoom) " . + "VALUES (" . + "'".LinSql::linAddslashes($_POST['linInputMarkerName'])."', " . + "'".floatval($_POST['linInputLat'])."', " . + "'".floatval($_POST['linInputLon'])."', " . + "'".intval($_POST['linInputZoom'])."')" + ); + } + else // edit Marker + { + if( !isset($_POST['linInputMarkerId']) OR empty($_POST['linInputMarkerId']) ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: No valid marker").'</responseMsg>'."\n"; + } + } + + echo '<responseCode>success</responseCode>'."\n"; + } + + echo '</root>'."\n"; + + break; + case 'assignAlbum': + + header('Content-type: text/xml'); + echo '<?xml version="1.0" ?>'."\n"; + echo '<root>'."\n"; + + if( !$GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.LIN_STR_ACCESSDENIED.'</responseMsg>'."\n"; + } + elseif( !isset($_REQUEST['markerId']) OR !isset($_REQUEST['albId']) ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: No valid data").'</responseMsg>'."\n"; + } + else + { + $markerId = intval($_REQUEST['markerId']); + $albId = intval($_REQUEST['albId']); + + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."plugins_maps_markers " . + "SET albId = '".LinSql::linAddslashes($albId)."' WHERE id='".LinSql::linAddslashes($markerId)."'"); + + echo '<responseCode>success</responseCode>'."\n"; + } + + echo '</root>'."\n"; + + + break; + + case 'loadAlbums': + + echo '{ "albums": [' . "\n"; + + $query = $GLOBALS['linpha']->db->Execute("SELECT DISTINCT P.parent_id " . + "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . + "WHERE gpslatituderef IS NOT NULL " . + "AND gpslatitude IS NOT NULL " . + "AND gpslongituderef IS NOT NULL " . + "AND gpslongitude IS NOT NULL "); + + echo '{"id": 0, "name": "'.i18n("All albums").'"},'."\n"; + + if( !$query ) + { + //echo "Error: Please enable EXIF GPS fields!"; + } + else + { + while($data = $query->FetchRow()) + { + echo '{"id": '.$data['parent_id'].', "name": "'. + htmlspecialchars( implode( '/', LinSql::getFullFilenameFromId($data['parent_id']) ),ENT_QUOTES).'"},'. + "\n"; + } + } + + echo '] }' . "\n"; + + break; + case 'loadImages': + + if( !isset($_REQUEST['albId']) ) { + break; + } + + $albId = intval($_REQUEST['albId']); + + if($albId == 0) { + $filterStr = ""; + } else { + $filterStr = "AND P.parent_id = '".$albId."'"; + } + + $query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, P.name, gpslatituderef,gpslatitude,gpslongituderef,gpslongitude " . + "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . + "WHERE gpslatituderef IS NOT NULL " . + "AND gpslatitude IS NOT NULL " . + "AND gpslongituderef IS NOT NULL " . + "AND gpslongitude IS NOT NULL " . + $filterStr); + + echo '{ "images": [' . "\n"; + + if( !$query ) + { + //echo "Error: Please enable EXIF GPS fields!"; + } + else + { + while($data = $query->FetchRow()) + { + $latlon = getExifLatLon($data); + + echo '{"id": '.$data['id'].', "parent_id": '.$data['parent_id'].', ' . + '"name": "'.htmlspecialchars( $data['name'] ,ENT_QUOTES).'", ' . + '"lat": '.$latlon['gpslatitude'].', "lon": '.$latlon['gpslongitude'] . + "},\n"; + } + } + + echo '] }' . "\n"; + + break; + } + } + + exit(); +} + + +$urlFull = LINPHA_LINK.'&linCat=maps'; + +$linpha->template->setModuleName('maps'); +//$linpha->template->overrideModule('head','map'); +$linpha->template->URL_full = $urlFull; +$linpha->template->URL_base = $urlFull; +$linpha->template->output['title'] = i18n("Maps"); +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); + + +function getExifLatLon(&$LatLon) +{ + /*Array PJMT + ( + [md5sum] => 084a9633ae7544e35ff1faad6cb05564 + [gpslatituderef] => N + [gpslatitude] => 469762048/16777216 (28),285212672/16777216 (17),820803480/16777216 (48.9236998558) (Degrees Minutes Seconds North or South) + [gpslongituderef] => W + [gpslongitude] => 1879048192/134217728 (14),1207959552/134217728 (9),472055494/16777216 (28.1367000341) (Degrees Minutes Seconds East or West) + ) + /*Array Exiftool + ( + [md5sum] => 084a9633ae7544e35ff1faad6cb05564 + [gpslatituderef] => North + [gpslatitude] => 46.9762048 + [gpslongituderef] => West + [gpslongitude] => 18.79048192 + )*/ + + /** + * Exiftool saves lat and lon as float + */ + if($GLOBALS['linpha']->sql->config->value['sys_import_use_exiftool'] + && $GLOBALS['linpha']->sql->config->value['sys_import_exiftool_avail']) + { + foreach(array('gpslatitude','gpslongitude') as $value) + { + if( $LatLon[$value.'ref'] == 'South' OR $LatLon[$value.'ref'] == 'West' ) + { + $return[ $value ] = $LatLon[$value]*-1; + } + else + { + $return[$value] = $LatLon[$value]; + } + } + } + else + { + foreach(array('gpslatitude','gpslongitude') as $value) + { + $arrHits = array(); + + // use '?' to be �non-greedy� (http://de.wikipedia.org/wiki/Regul%C3%A4rer_Ausdruck#Gieriges_Verhalten) + preg_match_all('/\((.*?)\)/', $LatLon[ $value ], $arrHits); + + $return[ $value ] = $arrHits[1][0] + ($arrHits[1][1] * 1/60) + ($arrHits[1][2] * 1/60 * 1/60); + if( $LatLon[ $value.'ref'] == 'S' OR $LatLon[ $value.'ref'] == 'W' ) + { + $return[ $value ] *= -1; + } + } + } +return $return; +} +?> \ No newline at end of file Deleted: trunk/linpha2/templates/default/map.head.php =================================================================== --- trunk/linpha2/templates/default/map.head.php 2007-10-28 20:36:19 UTC (rev 4775) +++ trunk/linpha2/templates/default/map.head.php 2007-10-30 22:19:50 UTC (rev 4776) @@ -1,46 +0,0 @@ -<script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/scriptaculous.js?load=effects,builder,dragdrop"></script> -<script language="JavaScript" type="text/javascript"> -var xmlUrl = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; -var imageSrc = '<?php echo LINPHA_CLIENT.'/get_image.php?linId='; ?>'; -var thumbSrc = '<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='; ?>'; -var maxImageWidth = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; ?>; -var maxImageHeight = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; ?>; -var maxThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; ?>; -var displayThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>; - -var linMapsDefaultMarkerZoom = <?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; ?>; -</script> - -<?php -if( $GLOBALS['linpha']->sql->config->value['plugins_maps_mapType'] == 'google' ) -{ - ?> - <script type="text/javascript" src="http://www.google.com/jsapi?key=<?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_google_key']; ?>"></script> - <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/class.googlemaps.js"></script> - <?php - - /** - * @todo - * google recommends using this kind of html header: - * <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> - * but without strict mode we need this css stuff to get polylines also working - * http://www.google.com/apis/maps/documentation/#XHTML_and_VML - ?> - <style type="text/css"> - v\:* { - behavior:url(#default#VML); - } - </style> - <?php - */ -} -elseif( $linTpl->output['mapType'] == 'xyz' ) -{ - ?> - <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/class.xyz.js"></script> - <?php -} -?> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/LinMaps.js"></script> Copied: trunk/linpha2/templates/default/maps.head.php (from rev 4775, trunk/linpha2/templates/default/map.head.php) =================================================================== --- trunk/linpha2/templates/default/maps.head.php (rev 0) +++ trunk/linpha2/templates/default/maps.head.php 2007-10-30 22:19:50 UTC (rev 4776) @@ -0,0 +1,46 @@ +<script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/scriptaculous.js?load=effects,builder,dragdrop"></script> +<script language="JavaScript" type="text/javascript"> +var xmlUrl = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; +var imageSrc = '<?php echo LINPHA_CLIENT.'/get_image.php?linId='; ?>'; +var thumbSrc = '<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='; ?>'; +var maxImageWidth = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; ?>; +var maxImageHeight = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; ?>; +var maxThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; ?>; +var displayThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>; + +var linMapsDefaultMarkerZoom = <?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; ?>; +</script> + +<?php +if( $GLOBALS['linpha']->sql->config->value['plugins_maps_mapType'] == 'google' ) +{ + ?> + <script type="text/javascript" src="http://www.google.com/jsapi?key=<?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_google_key']; ?>"></script> + <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/class.googlemaps.js"></script> + <?php + + /** + * @todo + * google recommends using this kind of html header: + * <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> + * but without strict mode we need this css stuff to get polylines also working + * http://www.google.com/apis/maps/documentation/#XHTML_and_VML + ?> + <style type="text/css"> + v\:* { + behavior:url(#default#VML); + } + </style> + <?php + */ +} +elseif( $linTpl->output['mapType'] == 'xyz' ) +{ + ?> + <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/class.xyz.js"></script> + <?php +} +?> +<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/LinMaps.js"></script> Modified: trunk/linpha2/templates/default/maps.html.php =================================================================== --- trunk/linpha2/templates/default/maps.html.php 2007-10-28 20:36:19 UTC (rev 4775) +++ trunk/linpha2/templates/default/maps.html.php 2007-10-30 22:19:50 UTC (rev 4776) @@ -13,35 +13,19 @@ </div> <div id="linDivMapBottom"> + <form action="" style="margin: 0;"> <input type="text" id="linInputAddress" size="30"> <input type="button" onclick="myLinMapObject.geocodeAddress( $('linInputAddress').value )" value="<?php echo i18n("Geocode"); ?>"> + </form> </div> -<div id="linDivEditMarker" style="display: none"> - <form action="<?php /* <?php echo $urlFull; ?>&xml */ - ?>" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;"> - <label for="linInputMarkerName" class="linInputEditMarker">Marker Name: - </label><input type="text" id="linInputMarkerName" name="linInputMarkerName" size="30" /><br /> - <label for="linInputLat" class="linInputEditMarker">Lat - </label><input type="text" id="linInputLat" name="linInputLat" size="10" /><br /> - <label for="linInputLon" class="linInputEditMarker">Lon: - </label><input type="text" id="linInputLon" name="linInputLon" size="10" /><br /> - <label for="linInputZoom" class="linInputEditMarker">Zoom: - </label><input type="text" id="linInputZoom" name="linInputZoom" size="10" /><br /> - - <input type="submit" value="<?php echo i18n("Save"); ?>" /> - <input type="hidden" name="cmd" value="saveMarker" /> - </form> -</div> -<script type="text/javascript"> -//new Draggable('linDivEditMarker',{revert:false}); -</script> - + <?php if( $GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) { ?> <div> + <br /> <?php echo i18n("Please select the album to show in Google Maps:"); ?> <div id="linDivMapAlbums"></div> </div> @@ -50,6 +34,8 @@ </script> +<div style="display: none"> + <div id="linDivMapListOfAllAlbums"> <form> <select name="linInputAlbum" style="width: 250px;"> @@ -58,8 +44,8 @@ <input type="button" value="<?php echo i18n("Assign Album"); ?>" onclick="myLinMaps.assignAlbum(this.form.linInputAlbum.value)"> </form> </div> - - + + <br /> <div> @@ -95,6 +81,7 @@ Not assigned images:<br /> albums/album1 (22 images)<br /> </div> +</div> <?php } else @@ -109,4 +96,29 @@ </div> <?php echo $linTpl->divRoundCorners('bottom'); ?> -</div> \ No newline at end of file +</div> + + +<div id="linDivEditMarker" style="display: none;"> + <form action="<?php /* <?php echo $urlFull; ?>&xml */ + ?>" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;"> + <fieldset><legend><?php echo i18n("Create New Marker"); ?></legend> + <label for="linInputMarkerName" class="linInputEditMarker"><?php echo i18n("Marker Name"); ?>: + </label><input type="text" id="linInputMarkerName" name="linInputMarkerName" size="31" /><br /> + <label for="linInputLat" class="linInputEditMarker"><?php echo i18n("Lat/Lon/Zoom"); ?>: + </label><input type="text" id="linInputLat" name="linInputLat" size="10" /> + <input type="text" id="linInputLon" name="linInputLon" size="10" /> + <input type="text" id="linInputZoom" name="linInputZoom" size="1" /> + + <br /><br /> + <input type="submit" value="<?php echo i18n("Save"); ?>" /> + <input type="button" value="<?php echo i18n("Cancel"); ?>" onclick="myLinMaps.removeEditMarker()"/> + <input type="hidden" name="cmd" value="saveMarker" /> + + </fieldset> + </form> +</div> +<script type="text/javascript"> +//new Draggable('linDivEditMarker',{revert:false}); +</script> + Modified: trunk/linpha2/templates/default/themes/default/css/maps.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/maps.css 2007-10-28 20:36:19 UTC (rev 4775) +++ trunk/linpha2/templates/default/themes/default/css/maps.css 2007-10-30 22:19:50 UTC (rev 4776) @@ -27,13 +27,24 @@ #linDivEditMarker { + + position: absolute; + top: 150px; + left: 150px; + border: 1px solid black; - width: 550px; + width: 375px; padding: 3px; + margin: 0; + + background-color: white; } +#linDivEditMarker form { + margin: 0; +} .linInputEditMarker { display: block; float: left; - width: 150px; + width: 125px; } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |