Thread: [Linpha-cvs] SF.net SVN: linpha: [4919] trunk/linpha2 (Page 11)
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2008-04-08 20:41:40
|
Revision: 4919 http://linpha.svn.sourceforge.net/linpha/?rev=4919&view=rev Author: fangehrn Date: 2008-04-08 13:41:34 -0700 (Tue, 08 Apr 2008) Log Message: ----------- 2008-04-08 flo * RSS plugin - implemented PicLens compatible rss feed give it a try: https://addons.mozilla.org/de/firefox/addon/5579 Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/classes/linpha.view.album.class.php trunk/linpha2/lib/modules/module.newimg.php trunk/linpha2/templates/default/global.head.php trunk/linpha2/templates/default/home.html.php trunk/linpha2/templates/default/themes/default/css/global.css Added Paths: ----------- trunk/linpha2/lib/plugins/rss/module.rss.php trunk/linpha2/templates/default/rss.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-04-07 20:36:31 UTC (rev 4918) +++ trunk/linpha2/ChangeLog 2008-04-08 20:41:34 UTC (rev 4919) @@ -1,4 +1,9 @@ +2008-04-08 flo + * RSS plugin + - implemented PicLens compatible rss feed + give it a try: https://addons.mozilla.org/de/firefox/addon/5579 + 2008-04-07 flo * metadata - fixed admin section Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2008-04-07 20:36:31 UTC (rev 4918) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2008-04-08 20:41:34 UTC (rev 4919) @@ -222,10 +222,14 @@ ); } elseif ( strpos($menuEntry, 'plugins_') !== false ) { $menuEntry = substr($menuEntry, 8); - $this->menuFinal[ $menuEntry ] = array( - 'name' => i18n(ucfirst($menuEntry)), // this will not be detected by the language translater, but thats no problem because this plugin name is for sure somewhere else - 'link' => LINPHA_LINK.'&linCat='.$menuEntry - ); + if (isset($GLOBALS['linpha']->sql->config->value['plugins_'.$menuEntry.'_enable']) + && $GLOBALS['linpha']->sql->config->value['plugins_'.$menuEntry.'_enable']) + { + $this->menuFinal[ $menuEntry ] = array( + 'name' => i18n(ucfirst($menuEntry)), // this will not be detected by the language translater, but thats no problem because this plugin name is for sure somewhere else + 'link' => LINPHA_LINK.'&linCat='.$menuEntry + ); + } } elseif ( strpos($menuEntry, 'icon_') !== false ) { if (isset($this->menu[$menuEntry])) { $this->menuFinal[ $menuEntry ] = array( Modified: trunk/linpha2/lib/classes/linpha.view.album.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-04-07 20:36:31 UTC (rev 4918) +++ trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-04-08 20:41:34 UTC (rev 4919) @@ -1,4 +1,4 @@ -<?php +<?php /* * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> * Florian Angehrn @@ -163,7 +163,7 @@ { case 'thumb': case 'thumbdetail': - $this->viewThumb(); // will exit() when linJSON is set + $this->viewThumb(); // will exit() if linJSON is set break; case 'basket': $this->viewBasket(); @@ -565,7 +565,7 @@ $days = $GLOBALS['linpha']->sql->config->value['sys_style_home_newimagesage']; $days_in_sec = $days*60*60*24; $lower_date = time()-$days_in_sec; - $this->viewHomeSetImages('new_images','sys_style_home_newimagesnr',' AND time_add > '.LinSql::linAddslashes($lower_date)); + $this->viewHomeSetImages('new_images','sys_style_home_newimagesnr',' AND time_add > '.intval($lower_date)); /** * random images Modified: trunk/linpha2/lib/modules/module.newimg.php =================================================================== --- trunk/linpha2/lib/modules/module.newimg.php 2008-04-07 20:36:31 UTC (rev 4918) +++ trunk/linpha2/lib/modules/module.newimg.php 2008-04-08 20:41:34 UTC (rev 4919) @@ -48,16 +48,16 @@ $days_in_sec = $days*60*60*24; $lower_date = time()-$days_in_sec; - if( $GLOBALS['linpha']->sql->config->value['sys_style_home_newimagesnr'] != 0 ) + if ( $GLOBALS['linpha']->sql->config->value['sys_style_home_newimagesnr'] != 0 ) { $linpha->albumView->photos = $GLOBALS['linpha']->db->GetAssoc("SELECT ".LIN_SELECT_FIELDS." ". - "FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999 AND time_add > ".LinSql::linAddslashes($lower_date)." ". + "FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999 AND time_add > ".intval($lower_date)." ". "ORDER BY ".$linpha->albumView->orderby); } else { - $linpha->albumView->photos = Array(); + $linpha->albumView->photos = array(); } Added: trunk/linpha2/lib/plugins/rss/module.rss.php =================================================================== --- trunk/linpha2/lib/plugins/rss/module.rss.php (rev 0) +++ trunk/linpha2/lib/plugins/rss/module.rss.php 2008-04-08 20:41:34 UTC (rev 4919) @@ -0,0 +1,160 @@ +<?php +/* + * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> + * Florian Angehrn + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/** + * RSS + * @package Modules + */ + + +if (isset($_GET['rss'])) +{ + $sql = ""; + $host = "http://".$_SERVER["HTTP_HOST"]; + $link = $host.LINPHA_LINK; + $title = $GLOBALS['linpha']->sql->config->value['sys_style_layout_title']; + $urlself = $host.LINPHA_LINK.'&linCat=rss&rss='; + + $albid = intval($GLOBALS['linpha']->template->idCurrent); + + if ($_GET['rss']=='img' && $albid == 0) { + $_GET['rss'] = 'albs'; + } + + switch ($_GET['rss']) + { + case 'newimg': + + $days = $GLOBALS['linpha']->sql->config->value['sys_style_home_newimagesage']; + $days_in_sec = $days*60*60*24; + $lower_date = time()-$days_in_sec; + + $subtitle = i18n("New Images"); + $link .= '&linCat=newimg'; + $sublink = $link.'&linId='; + $urlself .= 'newimg'; + + $sql = "img_type <> '0' AND time_add > ".intval($lower_date); + break; + + case 'albs': + + $subtitle = i18n("Albums"); + $link .= '&linCat=alb'; + $sublink = $link.'&linId='; + $urlself .= 'albs'; + + $sql = "img_type = '0'"; + break; + + case 'img': + + $arrNames = LinSql::getFullFilenameFromId($albid); + $subtitle = implode('/', $arrNames); + $link .= '&linCat=alb&linId='; + $sublink = $link; + $link .= $albid; + $urlself .= 'img&linId='.$albid; + + $sql = "parent_id = '".$albid."' AND img_type <> '0'"; + break; + } + + if (!empty($sql)) { + //echo $subtitle; + //echo $sql; + + $timeBuild = $GLOBALS['linpha']->db->GetOne("SELECT max(time_add) FROM ".LIN_PREFIX."photos WHERE img_type <> '9999999' AND ".$sql); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, md5sum FROM ".LIN_PREFIX."photos WHERE img_type <> '9999999' AND ".$sql); + +//header('Content-type: application/xhtml+xml'); +header('Content-type: application/rss+xml'); +//header('Content-type: text/xml'); +echo '<?xml version="1.0" encoding="utf-8" standalone="yes"?>'."\n"; +?> +<rss version="2.0" + xmlns:media="http://search.yahoo.com/mrss/" + xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title><?php echo htmlentities($title.' - '.$subtitle, ENT_QUOTES); ?></title> + <link><?php echo $link; ?></link> + <description><?php echo htmlentities($title.' - '.$subtitle, ENT_QUOTES); ?></description> + <?php /*<language></language>*/ ?> + <?php /*<copyright></copyright>*/ ?> + <lastBuildDate><?php echo date("D, j M Y G:i:s", $timeBuild)." GMT"; /*it does not work if we use date("... T) for the timezone. + if it is CEST the RSS does not validate*/ ?></lastBuildDate> +<?php + while($data = $query->FetchRow()) + { + if (LinSql::photoIsAllowed( $data['id'] )) + { +?> + <item> + <title><?php $arrNames = LinSql::getFullFilenameFromId($data['id']); + echo htmlentities(implode('/', $arrNames), ENT_QUOTES); ?></title> + <link><?php echo $sublink.$data['id']; ?></link> + <?php /*<description>description</description>*/ ?> + <guid isPermaLink="false"><?php echo $data['id'].'_'.$data['md5sum']; ?></guid> + <media:thumbnail url="<?php echo $host.LINPHA_CLIENT.'/get_thumb.php?linId='.$data['id']; + if ($_GET['rss']=='alb') { + echo '&linRss=true'; // add this to prevent PicLens activate on home view + } + ?>"/> + <media:content url="<?php echo $host.LINPHA_CLIENT.'/get_image.php?linId='.$data['id']; ?>"/> + </item> +<?php + } + } + ?> + + <atom:link href="<?php echo $urlself; ?>" rel="self" type="application/rss+xml" /> + </channel> +</rss> +<?php + } + + exit(); +} + + + +function linBuildAlbumTree($id, $text, &$arrData) +{ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".LIN_PREFIX."photos WHERE parent_id = '".$id."' AND img_type = '0' ORDER by name"); + while($data = $query->FetchRow()) + { + $subtext = $text.'/'.htmlentities($data['name'], ENT_QUOTES); + + $arrData[] = array('id'=>$data['id'], 'name' => $subtext); + + linBuildAlbumTree($data['id'], $subtext, $arrData); + } +} + +$linpha->template->output['albumTree'] = array(); + +linBuildAlbumTree(0, '', $linpha->template->output['albumTree']); + + +$linpha->template->setModuleName('rss'); +$linpha->template->URL_full = LINPHA_LINK.'&linCat=rss'; +$linpha->template->output['title'] = i18n("LinPHA RSS Feeds"); +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); +?> \ No newline at end of file Modified: trunk/linpha2/templates/default/global.head.php =================================================================== --- trunk/linpha2/templates/default/global.head.php 2008-04-07 20:36:31 UTC (rev 4918) +++ trunk/linpha2/templates/default/global.head.php 2008-04-08 20:41:34 UTC (rev 4919) @@ -78,10 +78,10 @@ var linYUILoader = new YAHOO.util.YUILoader({ require: ["logger"/*, "menu"*/], loadOptional: true, - filter: { + /*filter: { 'searchExp': "-min\\.js", 'replaceStr': "-debug.js" - }, + },*/ onSuccess: function() { } }); linYUILoader.addModule({ @@ -104,6 +104,12 @@ </script> <?php } ?> +<?php /* RSS Plugin */ +if (isset($GLOBALS['linpha']->sql->config->value['plugins_rss_enable']) + && $GLOBALS['linpha']->sql->config->value['plugins_rss_enable']) { ?> +<link rel="alternate" href="<?php echo LINPHA_LINK.'&linCat=rss&rss=img&linId='.$linTpl->idCurrent; ?>" type="application/rss+xml" title="" /> +<?php } ?> + <?php /* menu must be after myThemePanelBase definition */ $filename = LINPHA_DIR.'/templates/'.$linTpl->template_name.'/menu.head.php'; @@ -115,4 +121,5 @@ if (file_exists($filename)) { include_once( $filename ); } + ?> \ No newline at end of file Modified: trunk/linpha2/templates/default/home.html.php =================================================================== --- trunk/linpha2/templates/default/home.html.php 2008-04-07 20:36:31 UTC (rev 4918) +++ trunk/linpha2/templates/default/home.html.php 2008-04-08 20:41:34 UTC (rev 4919) @@ -15,9 +15,9 @@ ?> <div class="linDivRandomimg"> <?php echo '<a href="'.LINPHA_LINK.'&linCat=alb&linId='.$value['id'].'">' . - '<img class="linImgRandomimg" title="'.htmlentities($value['path']).'" src="'. LINPHA_CLIENT.'/get_thumb.php?linId=' .$value['id'] .'" alt="randomimage"' . - 'width="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'"' . - 'height="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'"/></a>'; ?> + '<img class="linImgRandomimg" title="'.htmlentities($value['path']).'" src="'. LINPHA_CLIENT.'/get_thumb.php?linId=' .$value['id'] .'" alt="randomimage" ' . + 'width="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'" ' . + 'height="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'" /></a>'; ?> <br /><br /> </div> <?php @@ -37,7 +37,7 @@ <div class="linDivNewimg"> <?php echo '<a href="'.LINPHA_LINK.'&linCat=newimg&linId='.$value['id'].'">' . '<img class="linImgNewimg" title="'.htmlspecialchars($value['path'],ENT_QUOTES).'" src="'. LINPHA_CLIENT.'/get_thumb.php?linId=' .$value['id'] .'" alt="newimage" ' . - 'width="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'"' . + 'width="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'" ' . 'height="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'"/></a>'; ?> <br /><br /> </div> Added: trunk/linpha2/templates/default/rss.html.php =================================================================== --- trunk/linpha2/templates/default/rss.html.php (rev 0) +++ trunk/linpha2/templates/default/rss.html.php 2008-04-08 20:41:34 UTC (rev 4919) @@ -0,0 +1,38 @@ +<?php echo $linTpl->divRoundCorners('top','main'); ?> + +<br /> +<h1 class="linStyle"> +<img src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/rss/rss.png" alt="RSS" border="0" width="48" /> +<?php echo i18n("LinPHA RSS Feeds"); ?></h1> +<br /> + +<a href="<?php echo $linTpl->URL_full; ?>&rss=newimg"><b><?php echo i18n("New Images"); ?></b></a> +<a href="<?php echo $linTpl->URL_full; ?>&rss=newimg"> +<img src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/rss/rss.png" alt="RSS" border="0" width="20" /> +</a> +<br /><br /> + +<a href="<?php echo $linTpl->URL_full; ?>&rss=albs"><b><?php echo i18n("Albums (without images)"); ?></b></a> +<a href="<?php echo $linTpl->URL_full; ?>&rss=albs"> +<img src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/rss/rss.png" alt="RSS" border="0" width="20" /> +</a> +<br /><br /><br /> + +<b><?php echo i18n("Album including images"); ?></b> +<br /> + +<?php foreach ($linTpl->output['albumTree'] as $album) { ?> + + + <a href="<?php echo $linTpl->URL_full.'&rss=img&linId='.$album['id']; ?>"><?php echo $album['name']; ?></a> + + <a href="<?php echo $linTpl->URL_full.'&rss=img&linId='.$album['id']; ?>"> + <img src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/rss/rss.png" alt="RSS" border="0" width="12" /> + </a> + <br /> + +<?php } ?> + +<br /><br /> + +<?php echo $linTpl->divRoundCorners('bottom','main'); ?> \ No newline at end of file Modified: trunk/linpha2/templates/default/themes/default/css/global.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/global.css 2008-04-07 20:36:31 UTC (rev 4918) +++ trunk/linpha2/templates/default/themes/default/css/global.css 2008-04-08 20:41:34 UTC (rev 4919) @@ -88,7 +88,7 @@ padding: 0; }*/ #linDivMain { - position: relative; + /*position: relative; do we need this? if enable it breaks linDivRandomimg float: left in IE !! */ min-height: 300px; margin: 0; padding: 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-04-27 12:37:18
|
Revision: 4931 http://linpha.svn.sourceforge.net/linpha/?rev=4931&view=rev Author: fangehrn Date: 2008-04-27 05:37:17 -0700 (Sun, 27 Apr 2008) Log Message: ----------- 2008-04-27 flo * GPS Tab - implemented mini google map and reverse geocoding * More bug fixes - Album/Image view and Map plugin seems to be ok now (tested in FF, IE, Opera) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance_import.php trunk/linpha2/docs/dev/external_libraries.txt trunk/linpha2/lib/classes/linpha.view.album.class.php trunk/linpha2/lib/classes/linpha.view.image.class.php trunk/linpha2/lib/js/LinYUIAlbum.js trunk/linpha2/lib/js/LinYUIPage.js trunk/linpha2/lib/plugins/maps/LinMapsYUI.js trunk/linpha2/lib/plugins/maps/module.maps.php trunk/linpha2/templates/default/maps.head.php trunk/linpha2/templates/default/maps.html.php trunk/linpha2/templates/default/tabs/gps.html.php trunk/linpha2/templates/default/viewer.head.php trunk/linpha2/templates/default/viewer.html.php Added Paths: ----------- trunk/linpha2/lib/plugins/maps/LinMaps_old.js trunk/linpha2/lib/plugins/maps/class.googlemaps_old.js trunk/linpha2/lib/plugins/maps/class.maps.php trunk/linpha2/lib/plugins/maps/greversegeocoder.js Removed Paths: ------------- trunk/linpha2/lib/plugins/maps/LinMaps.js trunk/linpha2/lib/plugins/maps/class.googlemaps.js Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-04-27 09:35:57 UTC (rev 4930) +++ trunk/linpha2/ChangeLog 2008-04-27 12:37:17 UTC (rev 4931) @@ -1,4 +1,11 @@ +2008-04-27 flo + * GPS Tab + - implemented mini google map and reverse geocoding + + * More bug fixes + - Album/Image view and Map plugin seems to be ok now (tested in FF, IE, Opera) + 2008-04-26 flo * Search bug fixes * Menu bug fixes Modified: trunk/linpha2/admin/maintenance_import.php =================================================================== --- trunk/linpha2/admin/maintenance_import.php 2008-04-27 09:35:57 UTC (rev 4930) +++ trunk/linpha2/admin/maintenance_import.php 2008-04-27 12:37:17 UTC (rev 4931) @@ -197,13 +197,44 @@ } - /** - * exif, iptc, xmp - * - * if "Delete First" and "All albums" was selected, the whole table will be deleted - */ + /** + * get imgids to indexing, if reindex is selected: delete these entries first + */ + if ($all_albums) + { + echo i18n("All Directories selected").'<br />'; + + $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); + while ($data = $query->FetchRow()) + { + $array_meta_ids[$data['id']] = $data['md5sum']; + } + } + else + { + echo i18n("Directory selected:").' '; + foreach ($_REQUEST['album_select'] AS $key=>$value) + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".LIN_PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); + echo $data['name'].', '; + + $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos WHERE " . + "parent_id = '".LinSql::linAddslashes($value)."' AND " . + "img_type <> 0 AND img_type <> 9999999"); + while ($data = $query->FetchRow()) + { + $array_meta_ids[$data['id']] = $data['md5sum']; + } + } + echo '<br />'; + } + + /** + * exif, iptc, xmp + * + * if "Delete First" and "All albums" was selected, the whole table will be deleted + */ $MetaData = new LinMetaData(); - foreach($array_meta as $meta_value) { if ( isset($_REQUEST['index_'.$meta_value]) && @@ -212,38 +243,6 @@ echo '<h2 class="linStyle">'.i18n("File Indexing").' ('.strtoupper($meta_value).')</h2>'; /** - * get imgids to indexing, if reindex is selected: delete these entries first - */ - if ($all_albums) - { - echo i18n("All Directories selected").'<br />'; - - $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); - while ($data = $query->FetchRow()) - { - $array_meta_ids[$data['id']] = $data['md5sum']; - } - } - else - { - echo i18n("Directory selected:").' '; - foreach ($_REQUEST['album_select'] AS $key=>$value) - { - $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".LIN_PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); - echo $data['name'].', '; - - $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos WHERE " . - "parent_id = '".LinSql::linAddslashes($value)."' AND " . - "img_type <> 0 AND img_type <> 9999999"); - while ($data = $query->FetchRow()) - { - $array_meta_ids[$data['id']] = $data['md5sum']; - } - } - echo '<br />'; - } - - /** * delete first (if selected) */ if ( isset($_REQUEST['index_'.$meta_value.'_delete']) ) @@ -287,8 +286,43 @@ echo '<br /><br />'; } - unset($array_meta_ids); + //unset($array_meta_ids); } + + if ($GLOBALS['linpha']->sql->config->isPluginActive('maps') + && $GLOBALS['linpha']->sql->config->value['plugins_maps_enable_geotagged'] + && $GLOBALS['linpha']->sql->config->value['plugins_maps_geotagged_autoimport'] + && isset($array_meta_ids) + && $_REQUEST['index_exif'] == 'index') + { + echo '<h2 class="linStyle">'.i18n("Import Geo Data").'</h2>'; + + $table = LIN_PREFIX."plugins_maps_image_geodata"; + + foreach ($array_meta_ids as $id=>$md5sum) + { + if (LinMetaData::fileNeedsIndexing($md5sum, $table)) + { + $full_filename = LinSql::getFullImagePath($id); + + if ($MetaData->saveMetaDataToDatabase('exifgps', $table, $full_filename, $md5sum )) + { + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . + "SET geodata='1' WHERE md5sum='".$md5sum."' "); + + echo " ".$id." (GPS),"; + } + else + { + echo " ".$id.","; + } + + flush(); + } + } + + echo '<br /><br />'; + } } Modified: trunk/linpha2/docs/dev/external_libraries.txt =================================================================== --- trunk/linpha2/docs/dev/external_libraries.txt 2008-04-27 09:35:57 UTC (rev 4930) +++ trunk/linpha2/docs/dev/external_libraries.txt 2008-04-27 12:37:17 UTC (rev 4931) @@ -1,16 +1,24 @@ -- csshover.htc V1.42.060206 +Javascript: -- scriptaculous 1.8.0 (contains prototype) -- prototype 1.6.0 +//- csshover.htc V1.42.060206 +//- scriptaculous 1.8.0 (contains prototype) +//- prototype 1.6.0 - JSCookMenu CHANGES ------- fixed bug in cmEnableItem() reported here: http://sourceforge.net/tracker/index.php?func=detail&aid=1766028&group_id=149372&atid=778279 - +- Google Reverse Geocoder (greversegeocoder.js) v1.0.6 + http://nicogoeminne.googlepages.com/documentation.html + +- YUI 2.5.1 + + +PHP: + - adodb - getid3 1.7.7 Modified: trunk/linpha2/lib/classes/linpha.view.album.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-04-27 09:35:57 UTC (rev 4930) +++ trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-04-27 12:37:17 UTC (rev 4931) @@ -500,8 +500,15 @@ } if (isset($arrOpt)) { $opt = '{'; + $i = 0; foreach( $arrOpt as $key=>$value) { - $opt .= '"'.$key.'": '.$value.', '; + $opt .= '"'.$key.'": '.$value; + + if ($i != count($arrOpt)-1) { + $opt .= ', '; + } + + $i++; } $opt .= '}'; } else { Modified: trunk/linpha2/lib/classes/linpha.view.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.view.image.class.php 2008-04-27 09:35:57 UTC (rev 4930) +++ trunk/linpha2/lib/classes/linpha.view.image.class.php 2008-04-27 12:37:17 UTC (rev 4931) @@ -76,8 +76,10 @@ break; case 'gps': - $this->getImageData('gps'); - require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/gps.html.php'); + if ($GLOBALS['linpha']->sql->config->isPluginActive('maps')) { + $this->getImageData('gps'); + require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/gps.html.php'); + } break; case 'exif': $this->getImageData('exif'); @@ -281,6 +283,15 @@ } break; + case 'gps': + require_once(LINPHA_DIR.'/lib/plugins/maps/class.maps.php'); + + $data = $GLOBALS['linpha']->db->GetRow("SELECT gpslatituderef, gpslatitude, gpslongituderef, gpslongitude " . + "FROM ".LIN_PREFIX."plugins_maps_image_geodata " . + "WHERE md5sum = '".LinSql::linAddslashes($this->imgData['md5sum'])."'"); + $this->latlon = LinMaps::getExifLatLon($data); + + break; } } Modified: trunk/linpha2/lib/js/LinYUIAlbum.js =================================================================== --- trunk/linpha2/lib/js/LinYUIAlbum.js 2008-04-27 09:35:57 UTC (rev 4930) +++ trunk/linpha2/lib/js/LinYUIAlbum.js 2008-04-27 12:37:17 UTC (rev 4931) @@ -450,6 +450,7 @@ //this.indexCommentTab = idx; // used by saveComment() this.Tabs[idx++] = new YAHOO.widget.Tab(tabConf['comments']); + loadGPSimmediate = false; switch( this.currentFileType ) { @@ -457,7 +458,13 @@ this.Tabs[idx++] = new YAHOO.widget.Tab(tabConf['imageInfo']); if (this.album.Thumbs[imgIndex].opt != null && this.album.Thumbs[imgIndex].opt.gps) { - this.Tabs[idx++] = new YAHOO.widget.Tab(tabConf['gps']); + this.Tabs[idx] = new YAHOO.widget.Tab(tabConf['gps']); + this.Tabs[idx].addListener('contentChange', linLoadGPSMap); // click + + //if (tabConf['gps'].active) + // loadGPSimmediate = true; + + idx++; } if (linEXIFEnabled) { @@ -494,6 +501,15 @@ this.TabView.addTab( this.Tabs[tabIndex] ); } + // check if there's again an active tab, and if not make the first tab active + if (typeof(this.TabView.get('activeTab')) == "undefined") + { + this.TabView.set('activeIndex', 0); + } + + if (loadGPSimmediate) + linLoadGPSMap(); + for(i = 1; i <= linPreloadImages; i++) { if ( this.album.Thumbs[imgIndex+i] ) @@ -685,3 +701,46 @@ var myLinAlbum = new YAHOO.linpha.Album(); myLinAlbum.loadAlbum('local'); + +/** + * show google map + * see not in viewer.html.php why this functions cannot be directly in the gps tab + */ +function linShowGoogleMap() +{ + //linYUILoader.onSuccess = null; + + if (GBrowserIsCompatible()) { + var map = new GMap2(document.getElementById("linDivMapObject")); + var point = new GLatLng(parseFloat($("linSpanLatitude").innerHTML), parseFloat($("linSpanLongitude").innerHTML)); + + map.setCenter(point, 10); + map.addControl(new GSmallMapControl()); + + map.addOverlay( new GMarker(point, {}) ); + + var reversegeocoder = new GReverseGeocoder(map); + + GEvent.addListener(reversegeocoder, "load", linSetGeocodeLocation); + /*function(placemark) { + $("linSpanNearestLocation").innerHTML = placemark.address; + } + );*/ + + GEvent.addListener(reversegeocoder, "error", + function() { + $("linSpanNearestLocation").innerHTML = "Unable to Reverse geocode"; + } + ); + + + reversegeocoder.reverseGeocode(point); + + YAHOO.util.Event.addListener(window, "unload", GUnload); + } +} +function linSetGeocodeLocation(placemark) +{ + // not an anonymous function to be able to debug it... + $("linSpanNearestLocation").innerHTML = placemark.address; +} Modified: trunk/linpha2/lib/js/LinYUIPage.js =================================================================== --- trunk/linpha2/lib/js/LinYUIPage.js 2008-04-27 09:35:57 UTC (rev 4930) +++ trunk/linpha2/lib/js/LinYUIPage.js 2008-04-27 12:37:17 UTC (rev 4931) @@ -23,7 +23,7 @@ // onResize() YAHOO.linpha.Page.prototype.onResize = function() { - if (typeof(linOnResizeWrapper) != null) + if (typeof(linOnResizeWrapper) != "undefined") linOnResizeWrapper(); else myLinPage.setMainHeight(true); Deleted: trunk/linpha2/lib/plugins/maps/LinMaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/LinMaps.js 2008-04-27 09:35:57 UTC (rev 4930) +++ trunk/linpha2/lib/plugins/maps/LinMaps.js 2008-04-27 12:37:17 UTC (rev 4931) @@ -1,355 +0,0 @@ - -/** - * 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.showNav = true; - this.defaultMarkerZoom = linMapsDefaultMarkerZoom; - - this.markersData = false; - this.markersObj = new Array(); - this.imagesObj = new Array(); - - this.ajaxUrl = linUrlBase + '&linId=' + linIdCurrent + '&xml'; - }, - - /** - * Marker functions - */ - loadMarkers: function() - { - myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=loadMarkers',myLinMaps.showMarkers); - }, - showMarkers: function(t) - { - var i; - - 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++ ) - { - myLinMapObject.removeMarker( myLinMaps.markersObj[i] ); - } - - myLinMaps.markersObj = new Array(); - } - - /** - * draw new markers - */ - myLinMapObject.initBounds(); - - for( i = 0; i < myLinMaps.markersData.markers.length; i++ ) - { - myLinMaps.markersObj[i] = myLinMapObject.createMarker( myLinMaps.markersData.markers[i], false ); - } - - /** - * update center - * only if there is more than one marker - * prevent zooming to high - */ - if( i > 0) { - 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(); - $('linFormEditMarker').linInputLat.value = latlng.lat(); - $('linFormEditMarker').linInputLon.value = latlng.lng(); - $('linFormEditMarker').linInputZoom.value = googlemap.getZoom(); - } - }, - - saveMarker: function(t) - { - xmlAnswer = t.responseXML.documentElement; - - if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' ) - { - myLinMaps.removeEditMarker(); - - myLinMaps.loadMarkers(); - } - else - { - alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data ); - } - }, - - deleteMarker: function(markerId) - { - myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=deleteMarker&markerId='+markerId,myLinMaps.deleteMarkerFinish); - }, - deleteMarkerFinish: function(t) - { - xmlAnswer = t.responseXML.documentElement; - - if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' ) - { - var markerId = xmlAnswer.getElementsByTagName('responseData').item(0).firstChild.data; - - for( i = 0; i < myLinMaps.markersData.markers.length; i++ ) - { - if( myLinMaps.markersData.markers[i].id == markerId ) - { - myLinMapObject.removeMarker( myLinMaps.markersObj[i] ); - myLinMaps.markersObj[i] = false; - } - } - } - else - { - alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data ); - } - }, - - removeEditMarker: function() - { - myLinMapObject.removeMarker( this.editMarker ); - this.editMarker = false; - }, - - assignAlbum: function(markerId,albId) - { - myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbum&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); - }, - assignAlbumChange: function(markerId,albId) { - myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbumChange&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); - }, - assignAlbumDelete: function(markerId,albId) - { - myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbumDelete&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); - }, - assignAlbumFinish: function(t) - { - xmlAnswer = t.responseXML.documentElement; - - // recreate marker on success - if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' ) - { - myLinMaps.loadMarkers(); - } - else - { - // print error message - alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data ); - } - }, - - loadAlbums: function() - { - myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=loadAlbums',myLinMaps.showAlbums); - }, - showAlbums: function(t) - { - $('linDivMapAlbums').innerHTML = ''; - albumsData = eval('(' + t.responseText + ')'); - - for( i = 0; i < albumsData.albums.length; i++ ) - { - $('linDivMapAlbums').innerHTML += - '<a href="javascript:myLinMaps.loadImages(' + albumsData.albums[i].id + ')">' - + albumsData.albums[i].name + '</a><br />'; - } - - myLinGlobal.createPopup('linDivPopupAlbums'); - }, - - /** - * Thumbnail functions - */ - loadImages: function(albId) - { - this.startLoading(); - - myLinMapObject.closeMarkerWindows(); - - if( !this.showNav ) { - this.toggleNav(); - } - - myLinGlobal.AjaxPost(this.ajaxUrl, 'cmd=loadImages&albId='+albId,myLinMaps.showImages); - - }, - showImages: function(t) - { - myLinMaps.imagesData = eval('(' + t.responseText + ')'); - //myLinMaps.images = t.responseText.evalJSON(true); - - /** - * delete existing images - */ - $('linDivMapNav').innerHTML = ''; - if( myLinMaps.imagesObj ) - { - for( i = 0; i < myLinMaps.imagesObj.length; i++ ) - { - myLinMapObject.removeMarker( myLinMaps.imagesObj[i] ); - } - - myLinMaps.imagesObj = new Array(); - } - - - /** - * draw new markers / create thumbnails list - */ - myLinMapObject.initBounds(); - - for( i = 0; i < myLinMaps.imagesData.images.length; i++ ) - { - thumbId = myLinMaps.imagesData.images[i].id; - - var ElemImg = Builder.node('img', {src: thumbSrc + thumbId, className: 'linImgMapThumb', width: displayThumbSize, height: displayThumbSize}); - var ElemA = Builder.node('a', {id: "thumb_"+thumbId, href: 'javascript:myLinMapObject.openImage(' + i + ')'}); - var ElemDiv = Builder.node('div', {className: 'linDivMapsThumb'}); - - ElemA.appendChild( ElemImg ); - ElemDiv.appendChild( ElemA ); - $('linDivMapNav').appendChild(ElemDiv); - - if( i == 0 ) - myLinMaps.imagesObj[i] = myLinMapObject.createMarker( myLinMaps.imagesData.images[i], true ); - else - myLinMaps.imagesObj[i] = myLinMapObject.createMarker( myLinMaps.imagesData.images[i], false ); - } - - myLinMapObject.updateCenter(0); - - myLinMaps.stopLoading(); - - }, - - toggleNav: function() - { - - if( this.showNav ) - { - Element.hide('linDivMapNav'); - - // backup current margin - $('linDivMapNav').style.marginRight = $('linDivMapObject').style.marginRight; - - $('linDivMapObject').style.marginRight = '7px'; - - this.showNav = false; - } - else - { - // restore saved margin - $('linDivMapObject').style.marginRight = $('linDivMapNav').style.marginRight; - $('linDivMapNav').style.marginRight = 0; - - Element.show('linDivMapNav'); - - this.showNav = true; - } - - // update google map size - myLinMapObject.checkResize(); - }, - - - - startLoading: function() { - Element.show('linDivLoadingOuter'); - }, - stopLoading: function() { - Element.hide('linDivLoadingOuter'); - } - - - - - - - - -} // end class LinMaps - -function linOnResizeWrapper() -{ - myLinGlobal.setWindowSize(); - var newHeight = myLinGlobal.linInnerHeight - $('linDivMain').offsetTop - $('linDivMapBottom').offsetHeight - 30; - if(newHeight < 100) - { - newHeight = 100; - } - - $('linDivMapNav').style.height = newHeight + 'px'; - $('linDivMapMain').style.height = newHeight + 'px'; - - - /** - * 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 = '10px'; - $('linDivMapMain').style.height = '10px'; - - myLinGlobal.setMainHeight(); - - $('linDivMapMain').style.height = ($('linDivMain').offsetHeight - $("linDivTop").offsetHeight - $('linDivMapBottom').offsetHeight - 5) + 'px';*/ - - /** - * set also height of the navigation bar - * overflow:auto does not work in IE with height: 100% - */ - /*$('linDivMapNav').style.height = $('linDivMapMain').style.height;*/ - - // resize also google map itself - myLinMapObject.checkResize(); -} - -/** - * initLinMaps() - * - * create the class object - */ -function initLinMaps() -{ - myLinMaps.toggleNav(); - - /*if( doLoadAlbums ) - myLinMaps.loadAlbums();*/ - - //linEnableOnResize(); - //linOnResizeWrapper(); - myLinPage.enableOnResize('maps'); - - myLinMaps.loadMarkers(); -} -Event.observe(window, 'load', initLinMaps, false); -//Event.observe(body, 'load', initLinMaps, false); - -myLinMaps = new LinMaps(); -linMapObjectInit(); Modified: trunk/linpha2/lib/plugins/maps/LinMapsYUI.js =================================================================== --- trunk/linpha2/lib/plugins/maps/LinMapsYUI.js 2008-04-27 09:35:57 UTC (rev 4930) +++ trunk/linpha2/lib/plugins/maps/LinMapsYUI.js 2008-04-27 12:37:17 UTC (rev 4931) @@ -70,6 +70,13 @@ myLinMapObject.updateCenter( 0 ); } } + + if (startupAlbum != -1) + { + myLinMaps.loadImages(startupAlbum); + startupAlbum = -1; + } + }; YAHOO.linpha.Maps.prototype.updateEditMarker = function() @@ -233,7 +240,7 @@ { thumbId = myLinMaps.imagesData.images[i].id; - var ElemImg = Builder.node('img', {src: thumbSrc + thumbId, className: 'linImgMapThumb', width: displayThumbSize, height: displayThumbSize}); + var ElemImg = Builder.node('img', {src: thumbSrc + thumbId, border: 0 /*required for IE*/, className: 'linImgMapThumb', width: displayThumbSize, height: displayThumbSize}); var ElemA = Builder.node('a', {id: "thumb_"+thumbId, href: 'javascript:myLinMapObject.openImage(' + i + ')'}); var ElemDiv = Builder.node('div', {className: 'linDivMapsThumb'}); Copied: trunk/linpha2/lib/plugins/maps/LinMaps_old.js (from rev 4924, trunk/linpha2/lib/plugins/maps/LinMaps.js) =================================================================== --- trunk/linpha2/lib/plugins/maps/LinMaps_old.js (rev 0) +++ trunk/linpha2/lib/plugins/maps/LinMaps_old.js 2008-04-27 12:37:17 UTC (rev 4931) @@ -0,0 +1,355 @@ + +/** + * 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.showNav = true; + this.defaultMarkerZoom = linMapsDefaultMarkerZoom; + + this.markersData = false; + this.markersObj = new Array(); + this.imagesObj = new Array(); + + this.ajaxUrl = linUrlBase + '&linId=' + linIdCurrent + '&xml'; + }, + + /** + * Marker functions + */ + loadMarkers: function() + { + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=loadMarkers',myLinMaps.showMarkers); + }, + showMarkers: function(t) + { + var i; + + 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++ ) + { + myLinMapObject.removeMarker( myLinMaps.markersObj[i] ); + } + + myLinMaps.markersObj = new Array(); + } + + /** + * draw new markers + */ + myLinMapObject.initBounds(); + + for( i = 0; i < myLinMaps.markersData.markers.length; i++ ) + { + myLinMaps.markersObj[i] = myLinMapObject.createMarker( myLinMaps.markersData.markers[i], false ); + } + + /** + * update center + * only if there is more than one marker + * prevent zooming to high + */ + if( i > 0) { + 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(); + $('linFormEditMarker').linInputLat.value = latlng.lat(); + $('linFormEditMarker').linInputLon.value = latlng.lng(); + $('linFormEditMarker').linInputZoom.value = googlemap.getZoom(); + } + }, + + saveMarker: function(t) + { + xmlAnswer = t.responseXML.documentElement; + + if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' ) + { + myLinMaps.removeEditMarker(); + + myLinMaps.loadMarkers(); + } + else + { + alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data ); + } + }, + + deleteMarker: function(markerId) + { + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=deleteMarker&markerId='+markerId,myLinMaps.deleteMarkerFinish); + }, + deleteMarkerFinish: function(t) + { + xmlAnswer = t.responseXML.documentElement; + + if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' ) + { + var markerId = xmlAnswer.getElementsByTagName('responseData').item(0).firstChild.data; + + for( i = 0; i < myLinMaps.markersData.markers.length; i++ ) + { + if( myLinMaps.markersData.markers[i].id == markerId ) + { + myLinMapObject.removeMarker( myLinMaps.markersObj[i] ); + myLinMaps.markersObj[i] = false; + } + } + } + else + { + alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data ); + } + }, + + removeEditMarker: function() + { + myLinMapObject.removeMarker( this.editMarker ); + this.editMarker = false; + }, + + assignAlbum: function(markerId,albId) + { + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbum&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); + }, + assignAlbumChange: function(markerId,albId) { + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbumChange&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); + }, + assignAlbumDelete: function(markerId,albId) + { + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbumDelete&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); + }, + assignAlbumFinish: function(t) + { + xmlAnswer = t.responseXML.documentElement; + + // recreate marker on success + if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' ) + { + myLinMaps.loadMarkers(); + } + else + { + // print error message + alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data ); + } + }, + + loadAlbums: function() + { + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=loadAlbums',myLinMaps.showAlbums); + }, + showAlbums: function(t) + { + $('linDivMapAlbums').innerHTML = ''; + albumsData = eval('(' + t.responseText + ')'); + + for( i = 0; i < albumsData.albums.length; i++ ) + { + $('linDivMapAlbums').innerHTML += + '<a href="javascript:myLinMaps.loadImages(' + albumsData.albums[i].id + ')">' + + albumsData.albums[i].name + '</a><br />'; + } + + myLinGlobal.createPopup('linDivPopupAlbums'); + }, + + /** + * Thumbnail functions + */ + loadImages: function(albId) + { + this.startLoading(); + + myLinMapObject.closeMarkerWindows(); + + if( !this.showNav ) { + this.toggleNav(); + } + + myLinGlobal.AjaxPost(this.ajaxUrl, 'cmd=loadImages&albId='+albId,myLinMaps.showImages); + + }, + showImages: function(t) + { + myLinMaps.imagesData = eval('(' + t.responseText + ')'); + //myLinMaps.images = t.responseText.evalJSON(true); + + /** + * delete existing images + */ + $('linDivMapNav').innerHTML = ''; + if( myLinMaps.imagesObj ) + { + for( i = 0; i < myLinMaps.imagesObj.length; i++ ) + { + myLinMapObject.removeMarker( myLinMaps.imagesObj[i] ); + } + + myLinMaps.imagesObj = new Array(); + } + + + /** + * draw new markers / create thumbnails list + */ + myLinMapObject.initBounds(); + + for( i = 0; i < myLinMaps.imagesData.images.length; i++ ) + { + thumbId = myLinMaps.imagesData.images[i].id; + + var ElemImg = Builder.node('img', {src: thumbSrc + thumbId, className: 'linImgMapThumb', width: displayThumbSize, height: displayThumbSize}); + var ElemA = Builder.node('a', {id: "thumb_"+thumbId, href: 'javascript:myLinMapObject.openImage(' + i + ')'}); + var ElemDiv = Builder.node('div', {className: 'linDivMapsThumb'}); + + ElemA.appendChild( ElemImg ); + ElemDiv.appendChild( ElemA ); + $('linDivMapNav').appendChild(ElemDiv); + + if( i == 0 ) + myLinMaps.imagesObj[i] = myLinMapObject.createMarker( myLinMaps.imagesData.images[i], true ); + else + myLinMaps.imagesObj[i] = myLinMapObject.createMarker( myLinMaps.imagesData.images[i], false ); + } + + myLinMapObject.updateCenter(0); + + myLinMaps.stopLoading(); + + }, + + toggleNav: function() + { + + if( this.showNav ) + { + Element.hide('linDivMapNav'); + + // backup current margin + $('linDivMapNav').style.marginRight = $('linDivMapObject').style.marginRight; + + $('linDivMapObject').style.marginRight = '7px'; + + this.showNav = false; + } + else + { + // restore saved margin + $('linDivMapObject').style.marginRight = $('linDivMapNav').style.marginRight; + $('linDivMapNav').style.marginRight = 0; + + Element.show('linDivMapNav'); + + this.showNav = true; + } + + // update google map size + myLinMapObject.checkResize(); + }, + + + + startLoading: function() { + Element.show('linDivLoadingOuter'); + }, + stopLoading: function() { + Element.hide('linDivLoadingOuter'); + } + + + + + + + + +} // end class LinMaps + +function linOnResizeWrapper() +{ + myLinGlobal.setWindowSize(); + var newHeight = myLinGlobal.linInnerHeight - $('linDivMain').offsetTop - $('linDivMapBottom').offsetHeight - 30; + if(newHeight < 100) + { + newHeight = 100; + } + + $('linDivMapNav').style.height = newHeight + 'px'; + $('linDivMapMain').style.height = newHeight + 'px'; + + + /** + * 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 = '10px'; + $('linDivMapMain').style.height = '10px'; + + myLinGlobal.setMainHeight(); + + $('linDivMapMain').style.height = ($('linDivMain').offsetHeight - $("linDivTop").offsetHeight - $('linDivMapBottom').offsetHeight - 5) + 'px';*/ + + /** + * set also height of the navigation bar + * overflow:auto does not work in IE with height: 100% + */ + /*$('linDivMapNav').style.height = $('linDivMapMain').style.height;*/ + + // resize also google map itself + myLinMapObject.checkResize(); +} + +/** + * initLinMaps() + * + * create the class object + */ +function initLinMaps() +{ + myLinMaps.toggleNav(); + + /*if( doLoadAlbums ) + myLinMaps.loadAlbums();*/ + + //linEnableOnResize(); + //linOnResizeWrapper(); + myLinPage.enableOnResize('maps'); + + myLinMaps.loadMarkers(); +} +Event.observe(window, 'load', initLinMaps, false); +//Event.observe(body, 'load', initLinMaps, false); + +myLinMaps = new LinMaps(); +linMapObjectInit(); Deleted: trunk/linpha2/lib/plugins/maps/class.googlemaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2008-04-27 09:35:57 UTC (rev 4930) +++ trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2008-04-27 12:37:17 UTC (rev 4931) @@ -1,270 +0,0 @@ - -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()); - - 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); - GEvent.addListener(googlemap, "zoomend", myLinMaps.updateEditMarker); - }, - - initBounds: function() - { - this.bounds = new GLatLngBounds(); - }, - updateCenter: function( zoom ) - { - if( zoom == 0 ) { - zoom = googlemap.getBoundsZoomLevel(this.bounds); - } - - googlemap.setCenter(this.bounds.getCenter(), zoom); - }, - - createMarker: function( markerNode, markerType, openMarker ) - { - /*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}*/ - - /** - * - 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); - - switch(markerNode.type) { - case 'album': - var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/blue-dot.png") - break; - case 'marker': - var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/purple-dot.png") - break; - case 'albumWithImg': - var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/green-dot.png") - break; - case 'images': - var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/yellow-dot.png") - break; - default: - var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/blue-dot.png") - break; - } - icon.iconSize = new GSize(32, 32); - var marker = new GMarker(point, icon); - - GEvent.addListener(marker, "click", function() { - marker.openInfoWindowHtml( linGetMarkerHtml(markerNode) ); - }); - - googlemap.addOverlay( marker ); - - this.bounds.extend(point); - - if( openMarker ) { - GEvent.trigger(marker, 'click'); - } - - return marker; - }, - - createEditMarker: function( center ) - { - myLinMaps.editMarker = new GMarker(center, {draggable: true}); - - var inputForm = document.createElement("form"); - inputForm.setAttribute("action",""); - inputForm.setAttribute("method","POST"); - inputForm.setAttribute("id","linFormEditMarker"); - inputForm.onsubmit = function() {myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, Form.serialize(this),myLinMaps.saveMarker); return false;}; - inputForm.innerHTML = $('linDivEditMarker').innerHTML; - - myLinMaps.editMarker.bindInfoWindow( inputForm ); // The marker.bindInfoWindow*() methods create GEvent listeners that perform the corresponding marker.openInfoWindow*() calls when the marker is clicked. - - GEvent.addListener(myLinMaps.editMarker, "drag", function() { - myLinMaps.updateEditMarker(); - }); - - /*GEvent.addListener(marker, "dragstart", function() { - map.closeInfoWindow(); - });*/ - - GEvent.addListener(myLinMaps.editMarker, "dragend", function() { - GEvent.trigger(myLinMaps.editMarker, 'click'); - }); - - googlemap.addOverlay( myLinMaps.editMarker ); - GEvent.trigger(myLinMaps.editMarker, 'click'); - myLinMaps.updateEditMarker(); - }, - - closeMarkerWindows: function() { - googlemap.closeInfoWindow(); - }, - - removeMarker: function( marker) - { - googlemap.removeOverlay( marker ); - }, - - openImage: function(imgIndex) - { - GEvent.trigger(myLinMaps.imagesObj[imgIndex], 'click'); - }, - - checkResize: function() - { - //alert("typeof googlemap.checkResize: " + typeof googlemap.checkResize ); - if( typeof googlemap.checkResize != "undefined" ) { - googlemap.checkResize(); - } - }, - - geocodeAddress: function(address) - { - if( myLinMaps.editMarker ) - { - googlemap.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); -} Copied: trunk/linpha2/lib/plugins/maps/class.googlemaps_old.js (from rev 4923, trunk/linpha2/lib/plugins/maps/class.googlemaps.js) =================================================================== --- trunk/linpha2/lib/plugins/maps/class.googlemaps_old.js (rev 0) +++ trunk/linpha2/lib/plugins/maps/class.googlemaps_old.js 2008-04-27 12:37:17 UTC (rev 4931) @@ -0,0 +1,270 @@ + +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()); + + 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); + GEvent.addListener(googlemap, "zoomend", myLinMaps.updateEditMarker); + }, + + initBounds: function() + { + this.bounds = new GLatLngBounds(); + }, + updateCenter: function( zoom ) + { + if( zoom == 0 ) { + zoom = googlemap.getBoundsZoomLevel(this.bounds); + } + + googlemap.setCenter(this.bounds.getCenter(), zoom); + }, + + createMarker: function( markerNode, markerType, openMarker ) + { + /*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}*/ + + /** + * + 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); + + switch(markerNode.type) { + case 'album': + var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/blue-dot.png") + break; + case 'marker': + var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/purple-dot.png") + break; + case 'albumWithImg': + var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/green-dot.png") + break; + case 'images': + var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/yellow-dot.png") + break; + default: + var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/blue-dot.png") + break; + } + icon.iconSize = new GSize(32, 32); + var marker = new GMarker(point, icon); + + GEvent.addListener(marker, "click", function() { + marker.openInfoWindowHtml( linGetMarkerHtml(markerNode) ); + }); + + googlemap.addOverlay( marker ); + + this.bounds.extend(point); + + if( openMarker ) { + GEvent.trigger(marker, 'click'); + } + + return marker; + }, + + createEditMarker: function( center ) + { + myLinMaps.editMarker = new GMarker(center, {draggable: true}); + + var inputForm = document.createElement("form"); + inputForm.setAttribute("action",""); + inputForm.setAttribute("method","POST"); + inputForm.setAttribute("id","linFormEditMarker"); + inputForm.onsubmit = function() {myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, Form.serialize(this),myLinMaps.saveMarker); return false;}; + inputForm.innerHTML = $('linDivEditMarker').innerHTML; + + myLinMaps.editMarker.bindInfoWindow( inputForm ); // The marker.bindInfoWindow*() methods create GEvent listeners that perform the corresponding marker.openInfoWindow*() calls when the marker is clicked. + + GEvent.addListener(myLinMaps.editMarker, "drag", function() { + myLinMaps.updateEditMarker(); + }); + + /*GEvent.addListener(marker, "dragstart", function() { + map.closeInfoWindow(); + });*/ + + GEvent.addListener(myLinMaps.editMarker, "dragend", function() { + GEvent.trigger(myLinMaps.editMarker, 'click'); + }); + + googlemap.addOverlay( myLinMaps.editMarker ); + GEvent.trigger(myLinMaps.editMarker, 'click'); + myLinMaps.updateEditMarker(); + }, + + closeMarkerWindows: function() { + googlemap.closeInfoWindow(); + }, + + removeMarker: function( marker) + { + googlemap.removeOverlay( marker ); + }, + + openImage: function(imgIndex) + { + GEvent.trigger(myLinMaps.imagesObj[imgIndex], 'click'); + }, + + checkResize: function() + { + //alert("typeof googlemap.checkResize: " + typeof googlemap.checkResize ); + if( typeof googlemap.checkResize != "undefined" ) { + googlemap.checkResize(); + } + }, + + geocodeAddress: function(address) + { + if( myLinMaps.editMarker ) + { + googlemap.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); +} 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 2008-04-27 12:37:17 UTC (rev 4931) @@ -0,0 +1,94 @@ +<?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 holds database related methods + * @package Database + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + +class LinMaps +{ +function __construct() +{ + +} + +static 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'])*/ + if (strpos($LatLon['gpslatitude'], '(') === false) // do this check dynamically to be able to turn on/off exiftool without re-indexing all images + { + 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) + { + error_log("USING PJMT",'','0'); + $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 Added: trunk/linpha2/lib/plugins/maps/greversegeocoder.js =================================================================== --- trunk/linpha2/lib/plugins/maps/greversegeocoder.js (rev 0) +++ trunk/linpha2/lib/plugins/maps/greversegeocoder.js 2008-04-27 12:37:17 UTC (rev 4931) @@ -0,0 +1,398 @@ +/* + Copyright 2007-2008 Nico Goeminne (nic...@gm...) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* + * Class GReverseGeocoder v1.0.6 + * + * This class is used to obtain reverse geocodes (addresses) for user specified points. + * It does not use any caching mechanisme and is limited to 10 000 request per day. + * It uses both GDirections as GClientGeocoder. The default country is set to "Belguim". + * The country could be set using the GReverseGeocoder.setBaseCountrybefore method + * before any reverse geocoding is attempted. + * + * All data is obtained by use of the Google Maps API only! + * Therefore Reverse Geocoding is only supported for those countries in which Google Maps + * supports Geocoding (GClientGeocoder) and Driving Directions (GDirections). + * As a result only street level results are returned. (No house numbers) + */ + + /* Change Log 5/01/08 + * + * - Changed getStreet() function + * Now numbered roads are parsed correctly + * - Added the getPlacemarkProperty(placemark,propertyname) function + * The helper function is useful to investigate the resulting placemark. + * Since the placemark structure depends on the used data provider, the structure + * and property names may be different. This method searches the placemark for a certain + * property name. For example, if one needs the postal code: + * + * GEvent.addListener(reversegeocoder, "load", + * function(placemark) { + * var postalcodenumber = reversegeocoder.getPlacemarkProperty(placemark,"PostalCodeNumber"); + * if (postalcodenumber != null) alert("Postal Code Number: " + postalcodenumber); + * else alert("Postal Code Number Unknown"); + * } + * ); + * + */ + + /* Change Log 18/11/07 + * + * - Removed setBaseCountry() function + * The user of the script doesn't have to set the country anymore, + * instead the geocoder is provided by a bounding box (works in the 2.x api - fixed by google) + * - Reported lng bug to google + */ + + +/* + * Creates a new instance of a reversegeocoder. + * Note that the reverseGeocode() method initiates a new query, + * which in turn triggers a "load" event once the query has finished loading. + * + * Additionally, the object contains thwo event listeners which you can intercept: + * "load": This event is triggered when the results of a reverse geocode query issued via + * GReverseGeocoder.reverseGeocode() are available. Note that the reverseGeocode() method + * initiates a new query, which in turn triggers a "load" event once the query has finished + * loading. + * "error": This event is triggered if a reverse geocode request results in an error. + * Callers can use GReverseGeocoder.getStatus() to get more information about the error. + * In GReverseGeocoder v1.0 the getStatus() method proxies the GDirections.getStatus() behavior. + */ +function GReverseGeocoder(map) { + // we don't actually need the map variable but to be sure the Google Map API + // is loaded + this.map=map; + this.gdirections = new GDirections(); + this.geocoder = new GClientGeocoder(); + this.lastpoint=null; + this.closestonroad=null; + this.experimental=false; + this.ad=""; + this.step=10; + this.start=1; + this.gdirectionsrefine = new GDirections(); + GEvent.bind(this.gdirections, "error", this, this.handleError); + GEvent.bind(this.gdirections, "load", this, this.processDirection); + GEvent.bind(this.gdirectionsrefine, "error", this, this.handleError); + GEvent.bind(this.gdirectionsrefine, "load", this, this.processDirectionRefine); +} + +/* + * This method issues a new reverse geocode query. + * The parameter is a GLatLng point. + * If successful the Placemark object is passed to the user-specified + * listener. + * + * E.g. var listener = GEvent.addListener(reversegeocoder,"load", + * function(placemark){ + * alert("The reverse geocoded address is " + placemark.address); + * } + * ); + */ +GReverseGeocoder.prototype.reverseGeocode = function(point){ + this.lastpoint = point; + this.closestonroad = null; + this.gdirections.clear(); + this.gdirections.loadFromWaypoints([point.toUrlValue(6),point.toUrlValue(6)],{getSteps: true, locale: "GB", getPolyline:true}); +} + +/* + * Returns the status of the reverse geocode request. + * In GReverseGeocoder v1.0 the getStatus() method proxies the GDirections.getStatus() behavior. + * The returned object has the following form: { code: 200 request: "directions" } + * The status code can take any of the values defined in GGeoStatusCode. (Since Google Map API 2.81) + */ +GReverseGeocoder.prototype.getStatus = function(){ + return this.gdirections.getStatus(); +} + + +/* + * Private implementation methods + */ + +/* + * This method is called when a GDirection error occurs, + * or if the GReverseGeocoder does not find an address. + */ +GReverseGeocoder.prototype.handleError = function() { + GEvent.trigger(this, "error"); +} + +/* + * This method first gets the closest street using GDirections, + * then tries to find addresses by combinating that street + * with the supplied country using the GClientGeocoder. + * This can result in multiple addresses and is filtered + * by the GReverseGeocoder.getBestMatchingPlacemark() method. + */ +GReverseGeocoder.prototype.processDirection = function() { + var source = this; + // snap to road + if ( this.gdirections.getPolyline() != null){ + this.closestonroad=this.gdirections.getPolyline().getVertex(0);; + } + + var nrroutes = this.gdirections.getNumRoutes(); + if (nrroutes != 0) { + var route = this.gdirections.getRoute(0); + var nrsteps = route.getNumSteps(); + if (nrsteps != 0) { + var step = route.getStep(0); + var street = step.getDescriptionHtml(); + /* v102 */ + street = this.getStreet(street); + var sw = new GLatLng(Number(this.lastpoint.lat()) - 0.01, Number(this.lastpoint.lng()) - 0.01); + var ne = new GLatLng(Number(this.lastpoint.lat()) + 0.01, Number(this.lastpoint.lng()) + 0.01); + var bounds = new GLatLngBounds(sw, ne); + this.geocoder.setViewport(bounds); + /* end change */ + this.geocoder.getLocations(street, + function(response) { + var placemark = source.getBestMatchingPlacemark(response); + if (placemark != null) { + if(source.experimental) { + source.ad = placemark.address; + source.step=10; + source.start=1; + source.houseNumberSearch(); + } + else { + GEvent.trigger(source, "load", placemark); + } + } + else{ + source.handleError(); + } + } + ); + } + } +} + +/* + * Finds the closest address towards the original point + * form the resultset obtained by the GClientGeocoder request. + * In GReverseGeocoder v1.0 an address is considered only if + * it is... [truncated message content] |
From: <fan...@us...> - 2008-05-05 22:01:05
|
Revision: 4933 http://linpha.svn.sourceforge.net/linpha/?rev=4933&view=rev Author: fangehrn Date: 2008-05-05 15:00:41 -0700 (Mon, 05 May 2008) Log Message: ----------- 2008-05-05 flo * Viewer - show initial loading icon * Basket - fixed bugs Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/lib/classes/linpha.view.album.class.php trunk/linpha2/lib/classes/linpha.view.image.class.php trunk/linpha2/lib/js/LinYUIAlbum.js trunk/linpha2/lib/modules/module.basket.php trunk/linpha2/templates/default/basket.html.php trunk/linpha2/templates/default/global.head.php trunk/linpha2/templates/default/themes/default/css/viewer.css trunk/linpha2/templates/default/viewer.html.php Removed Paths: ------------- trunk/linpha2/templates/default/view_img.head.php trunk/linpha2/templates/default/view_img.html.php trunk/linpha2/templates/default/view_meta.html.php trunk/linpha2/templates/default/view_thumb.head.php trunk/linpha2/templates/default/view_thumb.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-04-27 21:51:22 UTC (rev 4932) +++ trunk/linpha2/ChangeLog 2008-05-05 22:00:41 UTC (rev 4933) @@ -1,4 +1,11 @@ +2008-05-05 flo + * Viewer + - show initial loading icon + + * Basket + - fixed bugs + 2008-04-27 flo * GPS Tab - implemented mini google map and reverse geocoding Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2008-04-27 21:51:22 UTC (rev 4932) +++ trunk/linpha2/docs/dev/TODO.txt 2008-05-05 22:00:41 UTC (rev 4933) @@ -7,7 +7,6 @@ - add common interface for thumb order (ORDER by..) to prevent "LinPHA New_images.PHP SQL Injection Vulnerability" etc. -- escape exif data (see Common Tasks UTF8) - optimize DB querys (index) - if GDLib is not installed, the rounded corner stuff does not work @@ -19,14 +18,14 @@ - should enable browsers cache for the thumbnails and maybe also for the images -- compress javascripts (prototype and scriptaculous) - they are now nearly 200KB big - - re-add getId3 as fallback if exiftool is not available (video thumbnail and video playback) ## Big Todos +- Thumb view + - details view (is this really needed) + - basket - Installer - OSX testing @@ -79,6 +78,11 @@ DONE ############################################################################ +- compress javascripts (prototype and scriptaculous) + they are now nearly 200KB big + +- escape exif data (see Common Tasks UTF8) + - 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() Modified: trunk/linpha2/lib/classes/linpha.view.album.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-04-27 21:51:22 UTC (rev 4932) +++ trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-05-05 22:00:41 UTC (rev 4933) @@ -1,4 +1,4 @@ -<?php +<?php /* * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> * Florian Angehrn @@ -321,9 +321,9 @@ array( 'name' => i18n("Basket"), 'link' => array( - array('name' => i18n("Add All To Basket"), 'link' => 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base.'&admin_cmd=basket_add_all&linId="+linIdCurrent'), - array('name' => i18n("Add To Basket"), 'link' => 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base.'&admin_cmd=basket_add_this&linId="+linIdCurrent'), - array('name' => i18n("Switch To Basket View"), 'link' => 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base.'&view=basket&linId="+linIdCurrent'), + //array('name' => i18n("Add All To Basket"), 'link' => 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base.'&admin_cmd=basket_add_all&linId="+linIdCurrent'), + array('name' => i18n("Add To Basket"), 'link' => 'javascript:myLinAlbum.addToBasket("no_checkout")'), + //array('name' => i18n("Switch To Basket View"), 'link' => 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base.'&view=basket&linId="+linIdCurrent'), array('name' => i18n("Open Basket"), 'link' => LINPHA_LINK.'&linCat=basket') ) ); @@ -415,18 +415,15 @@ */ if( $GLOBALS['linpha']->sql->checkPermission('basket_download')) { - $GLOBALS['linpha']->template->menu['icon_download'] = 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=download&linId="+linIdCurrent'; + $GLOBALS['linpha']->template->menu['icon_download'] = 'javascript:myLinAlbum.basketDownload()'; } if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) { - $GLOBALS['linpha']->template->menu['icon_print'] = 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=print&linId="+linIdCurrent'; + $GLOBALS['linpha']->template->menu['icon_print'] = 'javascript:myLinAlbum.basketPrint()'; } if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) { - $GLOBALS['linpha']->template->menu['icon_mail'] = 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=mail&linId="+linIdCurrent'; + $GLOBALS['linpha']->template->menu['icon_mail'] = 'javascript:myLinAlbum.basketMail()'; } /** Modified: trunk/linpha2/lib/classes/linpha.view.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.view.image.class.php 2008-04-27 21:51:22 UTC (rev 4932) +++ trunk/linpha2/lib/classes/linpha.view.image.class.php 2008-05-05 22:00:41 UTC (rev 4933) @@ -43,14 +43,22 @@ return; } - if ( !isset($_GET['linTab']) || empty($_GET['linTab']) ) - { - return; + if (!LinSql::photoIsAllowed($GLOBALS['linpha']->template->idCurrent)) { + die(LIN_STR_ACCESSDENIED); } $this->imgData = $GLOBALS['linpha']->db->GetRow("SELECT * FROM ".LIN_PREFIX."photos " . "WHERE id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); + if(isset($_REQUEST['linCmd'])) { + $this->imageCommands(); + } + + if ( !isset($_GET['linTab']) || empty($_GET['linTab']) ) + { + return; + } + $this->indexFile(); // normally at least one tab per image is called switch($_GET['linTab']) @@ -327,19 +335,15 @@ return false; } - - - - /** * method for special admin commands, like rotating images, import stuff etc. * @uses LinImgview::buildImgView() */ -function adminCommands() +function imageCommands() { - switch($_GET['admin_cmd']) + switch($_REQUEST['linCmd']) { - case 'recreate': + case 'Recreate': if($GLOBALS['linpha']->sql->isAdmin()) { $thumbnail = new LinImage(); @@ -347,83 +351,74 @@ $thumbnail->createThumbnail($GLOBALS['linpha']->template->idCurrent); } break; - case 'force_import': // called in viewImg - LinImport::updateEntry( $GLOBALS['linpha']->template->idCurrent , dirname($this->src_file) , $this->filename ); + case 'ForceImport': // called in viewImg + if($GLOBALS['linpha']->sql->isAdmin()) { + if (!isset($this->src_file)) { + $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); + } + LinImport::updateEntry( $GLOBALS['linpha']->template->idCurrent , dirname($this->src_file) , $this->imgData['name'] ); + } break; - case 'rotate_left': - if($GLOBALS['linpha']->sql->isAdmin()) - { + + case 'RotateLeft': + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { LinImage::rotateImageByMenuCall('-90', $GLOBALS['linpha']->template->idCurrent); } break; - case 'rotate_right': - if($GLOBALS['linpha']->sql->isAdmin()) - { + case 'RotateRight': + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { LinImage::rotateImageByMenuCall('90', $GLOBALS['linpha']->template->idCurrent); } break; - case 'basket_add_all': - case 'basket_add_all_with_checkout': - /** - * coming from imgview, mode=viewThumb - * the permission check with photoIsAllowed() is done while checking out - */ - foreach($this->photos_filtered AS $value) - { - if($value['img_type']!=0) - { - $_SESSION['basket_ids'][] = $value['id']; - } - } - - if($_GET['admin_cmd'] == 'basket_add_all_with_checkout') - { - header("Location: ".LINPHA_LINK."&linCat=basket&checkout_as=".$_GET['checkout_as']); - exit(); - } - break; - case 'basket_add_this': - case 'basket_add_this_with_checkout': - /** - * coming from imgview, mode=viewImg - */ - $_SESSION['basket_ids'][] = $GLOBALS['linpha']->template->idCurrent; - if($_GET['admin_cmd'] == 'basket_add_this_with_checkout') - { - header("Location: ".LINPHA_LINK."&linCat=basket&checkout_as=".$_GET['checkout_as']); - exit(); - } - break; + case 'AddToBasket': + LinViewImage::addToBasket(); + break; } - - - /** - * doing some special commands - * - * should be done after viewImg(), because adminCommands() (force_import) uses some image informations - */ - if(isset($_GET['admin_cmd'])) { - $this->adminCommands(); - } +} + +static function addToBasket() +{ + foreach ($_POST['linImgIds'] as $imgId) + { + $query = $GLOBALS['linpha']->db->Execute("SELECT img_type FROM ".LIN_PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($imgId)."'"); - if(isset($_GET['linMsg'])) + if (!$query->EOF) { - switch($_GET['linMsg']) + $data = $query->FetchRow(); + + if ($data['img_type'] != '0' && $data['img_type'] != '9999999') { - case 'basket_added': linSysLog(i18n("Images Added To Basket.")); break; + if (LinSql::photoIsAllowed($imgId)) { + $_SESSION['basket_ids'][] = $imgId; + } } } + } + + /*$fileType = $GLOBALS['linpha']->db->GetOne("SELECT img_type FROM ".LIN_PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); + + switch ($fileType) + { + case '0': + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos " . + "WHERE parent_id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."' " . + "AND img_type != '0' AND img_type != '9999999'"); + while($data = $query->FetchRow()) { + if (LinSql::photoIsAllowed($data['id'])) { + $_SESSION['basket_ids'][] = $data['id']; + } + } + break; + case '9999999': + break; + default: + $_SESSION['basket_ids'][] = $GLOBALS['linpha']->template->idCurrent; + break; + }*/ } - - - - - - - - - } // end class LinViewImage -?> +?> \ No newline at end of file Modified: trunk/linpha2/lib/js/LinYUIAlbum.js =================================================================== --- trunk/linpha2/lib/js/LinYUIAlbum.js 2008-04-27 21:51:22 UTC (rev 4932) +++ trunk/linpha2/lib/js/LinYUIAlbum.js 2008-05-05 22:00:41 UTC (rev 4933) @@ -180,9 +180,10 @@ if (this.mode == 'image') { (new YAHOO.util.Element('linDivThumbs')).removeClass("linDivThumbsSmall"); // would give an warning if the class does not exist } - this.mode = 'thumb'; + this.mode = "thumb"; - YAHOO.util.Dom.setStyle('linDivThumbs', "display", "block"); + YAHOO.util.Dom.setStyle("linDivLoadingAlbum", "display", "none"); + YAHOO.util.Dom.setStyle("linDivThumbs", "display", "block"); }; // openImage() @@ -694,6 +695,68 @@ myLinAlbum.panelViewAt.render( /*document.body*/ "linPanelContainer" ); }; +// basketDownload() +YAHOO.linpha.Album.prototype.basketDownload = function() { + this.addToBasket('download'); +} +// basketMail() +YAHOO.linpha.Album.prototype.basketMail = function() { + this.addToBasket('mail'); +} +// basketPrint() +YAHOO.linpha.Album.prototype.basketPrint = function() { + this.addToBasket('print'); +} +// addToBasket() +YAHOO.linpha.Album.prototype.addToBasket = function(checkout) { + YAHOO.util.Dom.setStyle("linDivLoadingAlbum", "display", "block"); + + if (this.mode == "image") { + postdata = "linImgIds[]="+linIdCurrent; + } else if (this.mode == "thumb") { + postdata = ""; + for(imgId in this.ThumbIds) { + postdata += "linImgIds[]="+imgId+"&"; + } + } else { + return; + } + + switch (checkout) + { + case "no_checkout": + myLinGlobal.asyncRequest('POST', LINPHA_LINK+'&linCat=image&linCmd=AddToBasket&linId='+linIdCurrent, this.addToBasketFinish, this, postdata); + break; + case "download": + myLinGlobal.asyncRequest('POST', LINPHA_LINK+'&linCat=image&linCmd=AddToBasket&linId='+linIdCurrent, this.basketDownloadFinish, this, postdata); + break; + case "mail": + myLinGlobal.asyncRequest('POST', LINPHA_LINK+'&linCat=image&linCmd=AddToBasket&linId='+linIdCurrent, this.basketMailFinish, this, postdata); + break; + case "print": + myLinGlobal.asyncRequest('POST', LINPHA_LINK+'&linCat=image&linCmd=AddToBasket&linId='+linIdCurrent, this.basketPrintFinish, this, postdata); + break; + } +} +// addToBasketFinish() +YAHOO.linpha.Album.prototype.addToBasketFinish = function(t) { + YAHOO.util.Dom.setStyle("linDivLoadingAlbum", "display", "none"); +} +// basketDownloadFinish() +YAHOO.linpha.Album.prototype.basketDownloadFinish = function(t) { + YAHOO.util.Dom.setStyle("linDivLoadingAlbum", "display", "none"); + location.href = LINPHA_LINK+"&linCat=basket&checkout_as=download"; +} +// basketMailFinish() +YAHOO.linpha.Album.prototype.basketMailFinish = function(t) { + YAHOO.util.Dom.setStyle("linDivLoadingAlbum", "display", "none"); + location.href = LINPHA_LINK+"&linCat=basket&checkout_as=mail"; +} +// basketPrintFinish() +YAHOO.linpha.Album.prototype.basketPrintFinish = function(t) { + YAHOO.util.Dom.setStyle("linDivLoadingAlbum", "display", "none"); + location.href = LINPHA_LINK+"&linCat=basket&checkout_as=print"; +} myLinPage.enableOnResize('thumb'); Modified: trunk/linpha2/lib/modules/module.basket.php =================================================================== --- trunk/linpha2/lib/modules/module.basket.php 2008-04-27 21:51:22 UTC (rev 4932) +++ trunk/linpha2/lib/modules/module.basket.php 2008-05-05 22:00:41 UTC (rev 4933) @@ -54,7 +54,6 @@ /** * do the final checkout */ - try { /** @@ -62,7 +61,7 @@ */ if(! $GLOBALS['linpha']->sql->checkPermission('basket_'.$_REQUEST['checkout_as'])) { - throw new Exception(i18n("No Access")); + throw new Exception(LIN_STR_ACCESSDENIED); } /** @@ -80,7 +79,7 @@ { if(! $GLOBALS['linpha']->sql->photoIsAllowed($value)) { - throw new Exception(i18n("No Access")); + throw new Exception(LIN_STR_ACCESSDENIED); } } @@ -110,12 +109,12 @@ break; - case 'add_selected': - /** + /*case 'add_selected': + * add ids to session * coming from imgview, mode=viewBasket * the permission check with photoIsAllowed() is done while checking out - */ + if( isset( $_POST['img_id'] ) ) { @@ -126,7 +125,7 @@ } Header("Location: ".linConvertAmp($_SESSION['ref_url_full'])."&linMsg=basket_added"); - exit(); + exit();*/ case 'remove_all': /** Modified: trunk/linpha2/templates/default/basket.html.php =================================================================== --- trunk/linpha2/templates/default/basket.html.php 2008-04-27 21:51:22 UTC (rev 4932) +++ trunk/linpha2/templates/default/basket.html.php 2008-05-05 22:00:41 UTC (rev 4933) @@ -83,19 +83,19 @@ <table> <tr> <td width="170"><?php echo i18n("Recipient"); ?>:</td> - <td><input type="text" name="mail_address" value="<?php echo $mail_address; ?>" style="width: 175px;" /></td> + <td><input type="text" name="mail_address" value="<?php echo $mail_address; ?>" style="width: 235px;" /></td> </tr> <tr> <td><?php echo i18n("Sender"); ?>:</td> - <td><input type="text" name="sender_address" value="<?php echo $sender_address; ?>" style="width: 175px;" /></td> + <td><input type="text" name="sender_address" value="<?php echo $sender_address; ?>" style="width: 235px;" /></td> </tr> <tr> <td><?php echo i18n("Subject"); ?>:</td> - <td><input type="text" name="subject" value="<?php echo $subject; ?>" style="width: 175px;" /></td> + <td><input type="text" name="subject" value="<?php echo $subject; ?>" style="width: 235px;" /></td> </tr> <tr> <td><?php echo i18n("Message"); ?>:</td> - <td><textarea name="text_message" style="width: 175px;" rows="5" cols="40"><?php echo $text_message; ?></textarea></td> + <td><textarea name="text_message" style="width: 235px;" rows="5" cols="40"><?php echo $text_message; ?></textarea></td> </tr> <tr> <td><?php echo i18n("Mail Format"); ?>:</td> Modified: trunk/linpha2/templates/default/global.head.php =================================================================== --- trunk/linpha2/templates/default/global.head.php 2008-04-27 21:51:22 UTC (rev 4932) +++ trunk/linpha2/templates/default/global.head.php 2008-05-05 22:00:41 UTC (rev 4933) @@ -72,8 +72,8 @@ <?php if (linUseAjax()) { ?> <!-- Load the YUI Loader script: --> -<!--<script src="http://yui.yahooapis.com/2.5.0/build/yuiloader/yuiloader-beta-min.js"></script> --> -<script src="http://yui.yahooapis.com/2.5.1/build/yuiloader/yuiloader-beta-debug.js"></script> +<script src="http://yui.yahooapis.com/2.5.0/build/yuiloader/yuiloader-beta-min.js"></script> +<!--<script src="http://yui.yahooapis.com/2.5.1/build/yuiloader/yuiloader-beta-debug.js"></script>--> <script type="text/javascript" language="Javascript"> var linYUILoader = new YAHOO.util.YUILoader({ require: ["logger"], // , "menu" Modified: trunk/linpha2/templates/default/themes/default/css/viewer.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/viewer.css 2008-04-27 21:51:22 UTC (rev 4932) +++ trunk/linpha2/templates/default/themes/default/css/viewer.css 2008-05-05 22:00:41 UTC (rev 4933) @@ -32,6 +32,10 @@ text-align: left; } +#linDivLoadingAlbum { + padding-left: 45%; + padding-top: 30px; +} #linDivLoading { /*position: absolute; left: 50%; Deleted: trunk/linpha2/templates/default/view_img.head.php =================================================================== --- trunk/linpha2/templates/default/view_img.head.php 2008-04-27 21:51:22 UTC (rev 4932) +++ trunk/linpha2/templates/default/view_img.head.php 2008-05-05 22:00:41 UTC (rev 4933) @@ -1,39 +0,0 @@ - -<script language="JavaScript" type="text/javascript"> -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 startImgHeight = <?php echo $GLOBALS['linpha']->imgview->img_height; ?>; -var firstImgId = <?php echo $GLOBALS['linpha']->imgview->photos_filtered[0]['id']; /* @todo needs updating on change of sort order */ ?>; -var lastImgId = <?php echo $GLOBALS['linpha']->imgview->photos_filtered[ count($GLOBALS['linpha']->imgview->photos_filtered)-1 ]['id']; /* @todo needs updating on change of sort order */ ?>; -var useEffects = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_useeffects']; ?>; -var linSlideshowHtml = '<?php -/** - * @todo is it somehow possible to cache the slideshow divs? - * for example in external .js file? (that would have to be generated from a php file...) - */ -$fragment = 'slideshow'; ob_start(); -include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); -$string = ob_get_clean(); $string = str_replace("\n","",$string); $string = str_replace("\r","",$string); $string = str_replace("\t","",$string); -echo $string; -?>'; -</script> - -<script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/scriptaculous.js?load=effects,builder"></script> -<script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinImage.js"> </script> - - -<!-- YUI Dependencies --> -<!-- Sam Skin CSS for TabView --> -<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.0/build/tabview/assets/skins/sam/tabview.css"> - -<!-- JavaScript Dependencies for Tabview: --> -<script type="text/javascript" src="http://yui.yahooapis.com/2.5.0/build/yahoo-dom-event/yahoo-dom-event.js"></script> -<script type="text/javascript" src="http://yui.yahooapis.com/2.5.0/build/element/element-beta-min.js"></script> - -<!-- OPTIONAL: Connection (required for dynamic loading of data) --> -<script type="text/javascript" src="http://yui.yahooapis.com/2.5.0/build/connection/connection-min.js"></script> - -<!-- Source file for TabView --> -<script type="text/javascript" src="http://yui.yahooapis.com/2.5.0/build/tabview/tabview-min.js"></script> Deleted: trunk/linpha2/templates/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/default/view_img.html.php 2008-04-27 21:51:22 UTC (rev 4932) +++ trunk/linpha2/templates/default/view_img.html.php 2008-05-05 22:00:41 UTC (rev 4933) @@ -1,193 +0,0 @@ - -<!-- navigation --> -<?php if(isset($linTpl->output['navigation']) && !empty($linTpl->output['navigation'])) { ?> - <?php echo $linTpl->divRoundCorners('top','main'); ?> - - <div id="linDivNavigation"> - <?php echo $linTpl->output['navigation']; ?> - </div> - - <?php echo $linTpl->divRoundCorners('bottom','main'); ?> -<?php } ?> - -<!-- thumbnails --> -<?php echo $linTpl->divRoundCorners('top','main'); ?> - - <div id="linDivThumbnavi"> - <div id="linDivThumbnavi_Prev"></div> - <div id="linDivThumbnavi_Current"></div> - <div id="linDivThumbnavi_Next"></div> - </div> - -<?php echo $linTpl->divRoundCorners('bottom','main'); ?> - -<!-- main --> -<?php echo $linTpl->divRoundCorners('top','main'); ?> - <div id="linDivMain" class="yui-skin-sam"> - <div id="linDivloading"> - <img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/loading.gif"> - </div> - - <noscript><h1 class="linStyle"><?php echo i18n("If you have just disabled Javascript, you will need to restart your browser."); ?></h1></noscript> - - <!-- show image --> - <div id="linDivMainimage"> - <img id="linImgMainimage" style="display: none;"> - </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> - <div id="linDivVideoLink"> - <a href="<?php echo LINPHA_LINK.'linCat=video&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Play Video"); ?></a> - <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> - <?php /*<a id="linHrefInfoLink" href="javascript:myLinImage.showImgInfo()" style="color: black;">Info</a>*/ ?> - </div> - - - <br /><br /> - - <div id="linDivTabs" class="yui-navset"> - <ul class="yui-nav"> - <li class="selected"><a href=""><em><?php echo i18n("Comments"); ?></em></a></li> - </ul> - <div class="yui-content" style="height: 200px; overflow: auto;"> - <div><p> - <!-- comments --> - <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> - <!-- show add comment form --> - <div id="linDivAddComment"> - <form action="" method="POST" onsubmit="myLinGlobal.AjaxPost(linUrlBase + '&linId=' + IdCurrent + '&xml', 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> - </p></div> - - - </div> - </div> - - - <script type="text/javascript"> - var myTabs = new YAHOO.widget.TabView("linDivTabs"); - - myTabs.addTab( new YAHOO.widget.Tab({ - label: '<?php echo i18n("Image Info"); ?>', - content: '<div id="linDivMeta"></div>' - })); - myTabs.addTab( new YAHOO.widget.Tab({ - label: '<?php echo i18n("GPS Info"); ?>', - content: 'GPS' - })); - myTabs.addTab( new YAHOO.widget.Tab({ - label: '<?php echo i18n("EXIF"); ?>', - content: 'EXIF' - })); - myTabs.addTab( new YAHOO.widget.Tab({ - label: '<?php echo i18n("ITPC/XMP"); ?>', - content: 'ITPC/XMP' - })); - - - myTabs.addTab( new YAHOO.widget.Tab({ - label: '<?php echo i18n("Edit Meta Data"); ?>', - content: 'edit' - })); - myTabs.addTab( new YAHOO.widget.Tab({ - label: '<?php echo i18n("Edit ITPC/XMP"); ?>', - content: 'edit' - })); - - - myTabs.addTab( new YAHOO.widget.Tab({ - label: '<?php echo i18n("Video Info"); ?>', - content: '<div id="linDivMeta"></div>' - })); - - /* - <li><a href=""><em><?php echo i18n("Rating"); ?></em></a></li> - <li><a href=""><em><?php echo i18n("Fileinfo"); ?></em></a></li> - <li><a href=""><em><?php echo i18n("GPS Info"); ?></em></a></li> - <li><a href=""><em><?php echo i18n("EXIF"); ?></em></a></li> - <li><a href=""><em><?php echo i18n("IPTC/XMP"); ?></em></a></li> - - <div><p><?php echo i18n("Rating"); ?></p></div> - - <div><p> - <?php echo i18n("Fileinfo"); ?> - <div id="linDivMeta"></div> - - - </p></div> - - <div><p><?php echo i18n("GPS Info"); ?></p></div> - - <div><p> - <?php echo i18n("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> - </p></div> - - <div><p><?php echo i18n("IPTC/XMP"); ?></p></div> - - */ - /*alert( myTabs ); - alert( myTabs.get(0) ); - alert( myTabs.get(0).set('content','hiho') );*/ - //var tab0 = myTabs.get(0); - //alert(tab0); - //tabView.removeTab(tabView.get('activeTab')); - </script> - - - <div id="container"></div> - - <script type="text/javascript"> - /*var tabView = new YAHOO.widget.TabView(); - - tabView.addTab( new YAHOO.widget.Tab({ - label: 'lorem', - content: '<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat.</p>', - active: true - })); - - tabView.addTab( new YAHOO.widget.Tab({ - label: 'ipsum', - content: '<ul><li><a href="#">Lorem ipsum dolor sit amet.</a></li><li><a href="#">Lorem ipsum dolor sit amet.</a></li><li><a href="#">Lorem ipsum dolor sit amet.</a></li><li><a href="#">Lorem ipsum dolor sit amet.</a></li></ul>' - - })); - - tabView.addTab( new YAHOO.widget.Tab({ - label: 'dolor', - content: '<form action="#"><fieldset><legend>Lorem Ipsum</legend><label for="foo"> <input id="foo" name="foo"></label><input type="submit" value="submit"></fieldset></form>' - })); - - tabView.appendTo('container');*/ - - //tabView.removeTab(tabView.get('activeTab')); - //tabView.getTab(0).set('content','hiho'); - //tabView.getTab(0).set('disabled',true); - //tabView.getTab(0).set('contentVisible',false); - - </script> - - </div> - -<?php echo $linTpl->divRoundCorners('bottom','main'); ?> \ No newline at end of file Deleted: trunk/linpha2/templates/default/view_meta.html.php =================================================================== Deleted: trunk/linpha2/templates/default/view_thumb.head.php =================================================================== --- trunk/linpha2/templates/default/view_thumb.head.php 2008-04-27 21:51:22 UTC (rev 4932) +++ trunk/linpha2/templates/default/view_thumb.head.php 2008-05-05 22:00:41 UTC (rev 4933) @@ -1,13 +0,0 @@ -<script language="JavaScript" type="text/javascript"> -var linTotPhotos = <?php echo $GLOBALS['linpha']->imgview->tot_photos; ?>; -var linStartupPage = 1; -var linTnSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>; -var linPhotosPerPage = 'auto'; -var linViewMode = '<?php echo $_SESSION['mode_thumbview']; ?>'; -var linNrTextLines = <?php echo $GLOBALS['linpha']->imgview->nr_text_lines; ?>; -<?php echo $linTpl->output['files_db']."\n"; ?> -</script> - -<script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/scriptaculous.js?load=builder"></script> -<script type="text/javascript" language="javascript" src="<?php echo $linTpl->themeFile('DefsThumbView.js'); ?>"></script> -<script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinThumbnails.js"></script> Deleted: trunk/linpha2/templates/default/view_thumb.html.php =================================================================== --- trunk/linpha2/templates/default/view_thumb.html.php 2008-04-27 21:51:22 UTC (rev 4932) +++ trunk/linpha2/templates/default/view_thumb.html.php 2008-05-05 22:00:41 UTC (rev 4933) @@ -1,29 +0,0 @@ - -<!-- navigation --> -<?php if(isset($linTpl->output['navigation']) && !empty($linTpl->output['navigation'])) { ?> - <?php echo $linTpl->divRoundCorners('top','main'); ?> - - <div id="linDivNavigation"> - <?php echo $linTpl->output['navigation']; ?> - </div> - - <?php echo $linTpl->divRoundCorners('bottom','main'); ?> -<?php } ?> - -<!-- main --> -<?php echo $linTpl->divRoundCorners('top','main'); ?> - - <div id="linDivPagenrOuter"> - <div id="linDivPagenr"> - <div id="linDivPagenrLeft" class="linDivPagenrAll"><?php echo $linTpl->output['page_nr_left']; ?></div> - <div id="linDivPagenrMiddle" class="linDivPagenrAll linDivPagenrMiddle"><?php echo $linTpl->output['page_nr']; ?></div> - <div id="linDivPagenrRight" class="linDivPagenrAll"><?php echo $linTpl->output['page_nr_right']; ?></div> - </div> - </div> - - <div id="linDivMain"> - <noscript><h1 class="linStyle"><?php echo i18n("If you have just disabled Javascript, you will have to restart your browser."); ?></h1></noscript> - </div> - <div style="clear: both;"></div> - -<?php echo $linTpl->divRoundCorners('bottom','main'); ?> Modified: trunk/linpha2/templates/default/viewer.html.php =================================================================== --- trunk/linpha2/templates/default/viewer.html.php 2008-04-27 21:51:22 UTC (rev 4932) +++ trunk/linpha2/templates/default/viewer.html.php 2008-05-05 22:00:41 UTC (rev 4933) @@ -19,6 +19,7 @@ <div id="linDivNav" style="display: none;">nav</div> <div><?php /* Internet Explorer requires this extra div */ ?> + <div id="linDivLoadingAlbum"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/loading.gif"></div> <div id="linDivImage" style="display: none;"> <div id="linDivMainImage" ondblclick="myLinNavigation.fullscreenStart()"> @@ -34,7 +35,7 @@ <div id="linDivOtherInfo" style="display: none;"> </div> </div> - <div id="linDivThumbs" style="display: none;">thumb</div> + <div id="linDivThumbs" style="display: none;"></div> </div> <div style="clear: both"></div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-05-06 22:32:28
|
Revision: 4936 http://linpha.svn.sourceforge.net/linpha/?rev=4936&view=rev Author: fangehrn Date: 2008-05-06 15:32:23 -0700 (Tue, 06 May 2008) Log Message: ----------- 2008-05-06 flo * ExifTool/Metadata - added check during installation - cleanups - bug fixes Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/install/lib.requirements.php trunk/linpha2/install/step10_postsettings.php trunk/linpha2/install/step2_requirements.php trunk/linpha2/lib/classes/linpha.admin.class.php trunk/linpha2/lib/classes/linpha.exiftool.class.php trunk/linpha2/lib/classes/linpha.filesys.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.pjmt.class.php trunk/linpha2/lib/classes/linpha.view.album.class.php trunk/linpha2/lib/classes/linpha.view.image.class.php trunk/linpha2/lib/include/metadata_iptc_edit.php trunk/linpha2/lib/include/metadata_xmp_edit.php trunk/linpha2/lib/js/LinYUIAlbum.js trunk/linpha2/templates/default/tabs/editXmp.html.php trunk/linpha2/templates/default/tabs/xmp.html.php trunk/linpha2/templates/default/viewer.head.php trunk/linpha2/templates/default/viewer.html.php Added Paths: ----------- trunk/linpha2/templates/default/tabs/editIptc.html.php trunk/linpha2/templates/default/tabs/iptc.html.php Removed Paths: ------------- trunk/linpha2/templates/default/tabs/editIptcXmp.html.php trunk/linpha2/templates/default/tabs/iptcXmp.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/ChangeLog 2008-05-06 22:32:23 UTC (rev 4936) @@ -1,4 +1,10 @@ +2008-05-06 flo + * ExifTool/Metadata + - added check during installation + - cleanups + - bug fixes + 2008-05-05 flo * Viewer - show initial loading icon Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/docs/dev/TODO.txt 2008-05-06 22:32:23 UTC (rev 4936) @@ -23,6 +23,9 @@ ## Big Todos +- Rounded corners not working as expected + (there's a max width/heigth) + - Thumb view - details view (is this really needed) - basket Modified: trunk/linpha2/install/lib.requirements.php =================================================================== --- trunk/linpha2/install/lib.requirements.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/install/lib.requirements.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -134,6 +134,12 @@ return $array; } +function installCheckExifTool() +{ + require_once(LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'); + $exiftool = new LinExifTool(); + return $exiftool->getExifToolVersion(); +} function installCheckConvert() { Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/install/step10_postsettings.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -147,7 +147,7 @@ <br /> <?php -if($_SESSION['sys_import_has_perl'] || LIN_OS == 'win') +if($_SESSION['sys_import_exiftool_avail']) { 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.")." "; Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/install/step2_requirements.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -221,27 +221,57 @@ { print_line_middle($perl_version); print_line_right(success_msg()); - $perl_ok = 1; + $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.") ); + print_line_info( i18n_install("Perl was NOT found on this server. However, no need to panic as LinPHA will even work without. But you cannot use the ExifTool for reading/writing image metadata.") ); // please do not add linebreaks to translation strings. The would not get detected! $perl_ok = 0; } - echo "\t".'<input type="hidden" name="sys_import_has_perl" value="'.$perl_ok.'">'."\n"; + 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"; + } + else + { + $perl_ok = 1; + } - /** - * 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.'">'; + if ($perl_ok) + { + print_line_left("ExifTool"); + + $exiftool_version = installCheckExifTool(); + + if($exiftool_version) + { + print_line_middle($exiftool_version); + print_line_right(success_msg()); + $exiftool_ok = 1; + } + else + { + print_line_middle( i18n_install("Not Supported") ); + print_line_right(warning_msg()); + print_line_info( i18n_install("ExifTool is not supported on your system. You will not be able to have full support for reading/writing image metadata.") ); + $exiftool_ok = 0; + } + + /** + * 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="'.$exiftool_ok.'">'; + } + else + { + echo "\t".'<input type="hidden" name="sys_import_exiftool_avail" value="0">'; + } - // @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 */ Modified: trunk/linpha2/lib/classes/linpha.admin.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.admin.class.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/lib/classes/linpha.admin.class.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -338,6 +338,7 @@ 'sys_import_exif', 'sys_import_exif_autorot', 'sys_import_use_exiftool', + 'sys_import_exiftool_avail', 'sys_image_exif', 'sys_image_iptc', 'sys_image_xmp', Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -28,7 +28,7 @@ if(!defined('LINPHA_DIR')) { exit(1); } -class LinExifTool extends LinMetaData +class LinExifTool /*extends LinMetaData // this makes no sense! flo */ { public $exiftool, $filename; @@ -63,6 +63,23 @@ } } } + + public function getExifToolVersion() + { + $array_output = array(); $return_value = ''; // don't do this inside exec() !!!!!!!!!! it will overwrite the returned content !! + + LinFilesys::linExec($this->exiftool.' -ver', $array_output, $return_value); + + if ($return_value != 0) { + return false; + } + + if (!isset($array_output[0]) || empty($array_output[0]) || $array_output[0] == '0') { + return false; + } + + return $array_output[0]; + } /** * This method extracts the Thumbnail from EXIF/Composite section. @@ -82,6 +99,7 @@ /** * Buffer output of passthru and save to $thumb var */ + session_write_close(); // see LinFilesys::linExec() why this is absolutely required! ob_start(); passthru($this->exiftool.' '.$parameters.' "'.$filename.'"'); $thumb = ob_get_contents(); @@ -95,20 +113,9 @@ { $got_thumb = true; } - else - { - $got_thumb = false; - } } - - if($got_thumb) - { - return true; - } - else - { - return false; - } + + return $got_thumb; } /** @@ -192,10 +199,15 @@ $temp = explode("\t", $row); $key = trim($temp['0']); - $value = $temp['1']; + if (isset($temp['1'])) { + $value = $temp['1']; + } else { + $value = ""; + } + /** - * normalize tag names + * normalize tag names to be compatible EXIF standard * http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html */ switch($key) @@ -360,6 +372,79 @@ return $image_date; } + public function saveModifiedMetaData($filename, $metaTag, $meta_array) + { + $parameter = "-codedcharacterset=UTF8 " . + "-overwrite_original " . // No Backup we do take care of it our own :-) + "-n "; // Read numbers + + /** + * Update all images in folder with given MetaData, + * therefore we need to fake file to dirname instead + */ + if (isset($_POST['linRecursiveUpdate'])) + { + $file = dirname($filename); + $parameter .= "-r " . // Recursive + "-ext jpeg " . // Filetype + "-ext jpg " . + "-ext tif " . + "-ext tiff "; + } + else + { + $file = $filename; + } + + /** + * Go ahead write MetaData + */ + foreach($meta_array as $name => $value) + { + if(strlen(trim($value)) >= 1) + { + $name = str_replace("_", "-", $name); + $parameter .= "-$metaTag:$name='$value' "; + } + } + + //echo '<pre>', print_r($meta_array), '</pre>'; + //echo "PARA :".$parameter; + + /** + * Finally fire up exiftool + */ + $array_output = array(); $return_value = false; + LinFilesys::linExec($this->exiftool.' '.$parameter.' "'.$file.'"', $array_output, $return_value); + + if ($return_value != 0) + { + linSysLog(i18n("Error: Saving XMP/IPTC data failed.")); + linLog(LOG_TYPE_META, LOG_ERR, 'meta_data', "Error: Saving XMP/IPTC data failed for: ".$filename); + return false; + } + + /** + * Copy XMP to IPTC if needed + */ + if(isset($_POST['linXmp2Iptc'])) + { + $options = "-TagsFromFile "; + $arguments = LINPHA_DIR.'/lib/exiftool/xmp2iptc.args'; + + $array_output = array(); $return_value = false; + LinFilesys::linExec($this->exiftool.' '.$options.' "'.$file.'" -@ '.$arguments.' "'.$file.'"', $array_output, $return_value); + + if ($return_value != 0) + { + linLog(LOG_TYPE_META, LOG_ERR, 'meta_data', "Error: Copy XMP to IPTC failed for: ".$filename); + // no return false because previous exec() worked fine and then we need to re-import the file + } + } + + return true; + } + /** * Define array with allowed IPTC/XMP tags and human readable translation * @param none Modified: trunk/linpha2/lib/classes/linpha.filesys.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.filesys.class.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/lib/classes/linpha.filesys.class.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -166,6 +166,9 @@ session_write_close(); exec( $str, $array_output, $return_value ); + + // untested, may work... (here they use it: http://framework.zend.com/manual/de/zend.session.advanced_usage.html) + //session_start(); } /** Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -378,194 +378,71 @@ * @return none * @author flo, bzrudi */ - public function saveModifiedMetaData() + public function saveModifiedMetaData($filename, $metaTag) { - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { + if (!$GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { + return false; + } + + if (!file_exists($filename)) { + return false; + } + + $meta_array = $GLOBALS['_POST']; + + /** + * Important! + * Remove other POST data from this array, because we just + * take all values and this will generate unexpected results!!! + * We got problems because $_POST['linMetaField'] is an array. + */ + unset ($meta_array['linCmd']); + unset ($meta_array['linMetaField']); + unset ($meta_array['submit']); + unset ($meta_array['linDoBackup']); + unset ($meta_array['linRecursiveUpdate']); + unset ($meta_array['linXmp2Iptc']); + + /** + * See if we should create file backup first. If it went wrong, + * exit with $write_ok = false + */ + if (isset($_POST['linDoBackup'])) { + if (LinFilesys::backupFile($filename)) { + $write_ok = true; + } else { + $write_ok = false; + } + } else { /** - * Write IPTC/XMP MetaData to file + * If user wants no backup, make at least sure file is + * writeable, or break later */ - if(isset($_POST['linCmd']) - && isset ($GLOBALS['linpha']->imgview->src_file) - && file_exists($GLOBALS['linpha']->imgview->src_file)) - { - global $meta_array; - $meta_array = $GLOBALS['_POST']; - - /** - * Important! - * Remove other POST data from this array, because we just - * take all values and this will generate unexpected results!!! - * We got problems because $_POST['linMetaField'] is an array. - */ - unset ($meta_array['linCmd']); - unset ($meta_array['linMetaField']); - unset ($meta_array['submit']); - - /** - * Prevent notices from unset checkboxes and make sure to - * set to false if unset - */ - if(!isset($meta_array['linDoBackup'])) - { - /** - * If user wants no backup, make at least sure file is - * writeable, or break later - */ - if(is_writable($GLOBALS['linpha']->imgview->src_file)) - { - $write_ok = true; - } - else - { - $write_ok = false; - } - $meta_array['linDoBackup'] = false; - } - - /** - * Apply MetaData to all files in folder - */ - if(!isset($meta_array['linRecursiveUpdate'])) - { - $recursive_update = false; - } - else - { - $recursive_update = true; - } - - /** - * See if we should create file backup first. If it went wrong, - * exit with $write_ok = false - */ - if($meta_array['linDoBackup']) - { - if(LinFilesys - ::backupFile($GLOBALS['linpha']->imgview->src_file)) - { - $write_ok = true; - } - else - { - $write_ok = false; - } - } - - /** - * If the backup went wrong or file isn't writable, trying - * to write MetaData would most probably also fail, so skip it - */ - if($write_ok) - { - /** - * Fire up exiftool - */ - LinMetaData::__construct(); - $file = $GLOBALS['linpha']->imgview->src_file; - $exiftool = $this->objMetaTool->exiftool; - - /** - * Prevent exiftool from backing up file, as we do take - * care of it our own :-) - */ - $parameter = "-overwrite_original " . // No Backup - "-n "; // Read numbers - - /** - * Update all images in folder with given MetaData, - * therefore we need to fake file to dirname instead - */ - if($recursive_update) - { - $file = dirname($GLOBALS['linpha']->imgview->src_file); - $parameter .= "-r " . // Recursive - "-ext jpeg " . // Filetype - "-ext jpg " . - "-ext tif " . - "-ext tiff "; - } - - /** - * Apply XMP MetaData to IPTC Segment? - */ - if(!isset($meta_array['linXmp2Iptc'])) - { - $xmp2iptc = false; - } - else - { - $xmp2iptc = true; - } - - unset ($meta_array['linDoBackup']); - unset ($meta_array['linRecursiveUpdate']); - unset ($meta_array['linXmp2Iptc']); - - - /** - * Go ahead write MetaData - */ - if($_POST['linCmd'] == 'linInsertMetaIptc') - { - $metaTag = 'iptc'; - } - elseif($_POST['linCmd'] == 'linInsertMetaXmp') - { - $metaTag = 'xmp'; - } - - foreach($meta_array AS $name => $value) - { - if(strlen(trim($value)) >= 1) - { - $name = str_replace("_", "-", $name); - $parameter .= "-$metaTag:$name='$value' "; - } - } - - //echo '<pre>', print_r($meta_array), '</pre>'; - //echo "PARA :".$parameter; - - /** - * Finally fire up exiftool - * TODO: take care of response status - */ - $array_output = array(); $return_value = false; - LinFilesys::linExec($exiftool.' '.$parameter.' "'.$file.'"', $array_output, $return_value); - - /** - * Copy XMP to IPTC if needed - */ - if($xmp2iptc) - { - $options = "-TagsFromFile "; - $arguments = - LINPHA_DIR.'/lib/exiftool/xmp2iptc.args'; - - $array_output = array(); $return_value = false; - LinFilesys::linExec($exiftool.' '.$options.' "'.$file.'" -@ '.$arguments.' "'.$file.'"', $array_output, $return_value); - } - - /** - * force read data from file again if write was successful - */ - unset ($meta_array); - LinImport:: - updateEntry($GLOBALS['linpha']->template->idCurrent, - dirname($GLOBALS['linpha']->imgview->src_file), - basename($GLOBALS['linpha']->imgview->src_file)); - } - else - { - linSysLog(sprintf(i18n("Error: Processing of: %s failed, please check write permissions"), - $GLOBALS['linpha']->imgview->src_file)); - linLog(LOG_TYPE_META, LOG_ERR, 'meta_data', "Error: " . - "Processing failed for: ".' ' . - $GLOBALS['linpha']->imgview->src_file); - } + if(is_writable($filename)) { + $write_ok = true; + } else { + $write_ok = false; } } + + /** + * If the backup went wrong or file isn't writable, trying + * to write MetaData would most probably also fail, so skip it + */ + if (!$write_ok) + { + linSysLog(LIN_STR_CHKFILEPERM); + linLog(LOG_TYPE_META, LOG_ERR, 'meta_data', "Error: Processing failed for: ".$filename); + return false; + } + + if ($this->objMetaTool->saveModifiedMetaData($filename, $metaTag, $meta_array)) { + /** + * force read data from file again if write was successful + */ + LinImport::updateEntry($GLOBALS['linpha']->template->idCurrent, + dirname($filename), basename($filename)); + } } /** @@ -576,7 +453,7 @@ * @return none * @author flo */ - public function saveModifiedMetaDataLinpha($md5sum) + public static function saveModifiedMetaDataLinpha($md5sum) { if(isset($_POST['linMetaField']) && is_array($_POST['linMetaField'])) { Modified: trunk/linpha2/lib/classes/linpha.pjmt.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -27,7 +27,7 @@ if(!defined('LINPHA_DIR')) { exit(1); } -class LinPjmtTool extends LinMetaData +class LinPjmtTool /*extends LinMetaData // this makes no sense! flo */ { /** * Constructor @@ -244,6 +244,12 @@ return $image_date; } + public function saveModifiedMetaData($filename, $metaTag, $meta_array) + { + // not implemented + return false; + } + /** * Define array with allowed EXIF tags and human readable translation * @param none Modified: trunk/linpha2/lib/classes/linpha.view.album.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -1,4 +1,4 @@ -<?php +<?php /* * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> * Florian Angehrn Modified: trunk/linpha2/lib/classes/linpha.view.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.view.image.class.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/lib/classes/linpha.view.image.class.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -50,10 +50,14 @@ $this->imgData = $GLOBALS['linpha']->db->GetRow("SELECT * FROM ".LIN_PREFIX."photos " . "WHERE id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); - if(isset($_REQUEST['linCmd'])) { + if (isset($_REQUEST['linCmd'])) { $this->imageCommands(); } + if (isset($_REQUEST['linSaveIptcXmp'])) { + $this->saveIptcXmp($_REQUEST['linSaveIptcXmp']); + } + if ( !isset($_GET['linTab']) || empty($_GET['linTab']) ) { return; @@ -93,10 +97,14 @@ $this->getImageData('exif'); require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/exif.html.php'); break; - case 'iptcXmp': - $this->getImageData('iptcXmp'); - require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/iptcXmp.html.php'); + case 'iptc': + $this->getImageData('iptc'); + require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/iptc.html.php'); break; + case 'xmp': + $this->getImageData('xmp'); + require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/xmp.html.php'); + break; case 'editMeta': @@ -112,34 +120,56 @@ require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/editMeta.html.php'); break; - case 'editIptcXmp': + case 'editIptc': if (!LinIdentify::isSupportedImage($this->imgData['img_type'])) { return; } + + if (!$GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { + return; + } - $filename = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); // also used in metadata_[iptc,xmp]_edit.php + if (!$GLOBALS['linpha']->sql->config->value['sys_import_use_exiftool']) { + echo i18n("Error: Cannot edit IPTC: ExifTool is not enabled."); + return; + } - if ($GLOBALS['linpha']->sql->config->value['sys_image_iptc'] || $GLOBALS['linpha']->sql->config->value['sys_image_xmp']) { - if (isset ($GLOBALS['linpha']->imgview->src_file) && file_exists($GLOBALS['linpha']->imgview->src_file)) { - if (is_writable($filename)) { - $meta_edit_possible = true; - } else { - $meta_edit_possible = false; - } - } else { - $meta_edit_possible = false; - } - - if (!$meta_edit_possible) - { - echo LIN_STR_CHKFILEPERM; - return; - } + $filename = $this->getFullFilename(); // also used in metadata_[iptc,xmp]_edit.php + + if (!file_exists($filename) || !is_writable($filename)) { + echo LIN_STR_CHKFILEPERM; + return; } - require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/editIptcXmp.html.php'); + require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/editIptc.html.php'); + break; + case 'editXmp': + + if (!LinIdentify::isSupportedImage($this->imgData['img_type'])) { + return; + } + + if (!$GLOBALS['linpha']->sql->config->value['sys_image_xmp']) { + return; + } + + if (!$GLOBALS['linpha']->sql->config->value['sys_import_use_exiftool']) { + echo i18n("Error: Cannot edit IPTC: ExifTool is not enabled."); + return; + } + + $filename = $this->getFullFilename(); // also used in metadata_[iptc,xmp]_edit.php + + if (!file_exists($filename) || !is_writable($filename)) { + echo LIN_STR_CHKFILEPERM; + return; + } + + require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/editXmp.html.php'); + break; + } /*echo '{'."\n"; @@ -164,6 +194,7 @@ echo '}'."\n";*/ } + /** * Indexes the specified file with EXIF/IPTC/XMP/GPS data * @param string $filename filename to index @@ -183,15 +214,11 @@ if ($GLOBALS['linpha']->sql->config->value['sys_image_'.$value] && LinMetaData::fileNeedsIndexing($this->imgData['md5sum'], $table)) { - if (!isset($metadata)) { - $metadata = new LinMetaData(); + if (!isset($this->metadata)) { + $this->metadata = new LinMetaData(); } - if (!isset($this->src_file)) { - $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); - } - - $metadata->saveMetaDataToDatabase($value, $table, $this->src_file, $this->imgData['md5sum'] ); + $this->metadata->saveMetaDataToDatabase($value, $table, $this->getFullFilename(), $this->imgData['md5sum'] ); } } @@ -212,16 +239,12 @@ if (LinMetaData::fileNeedsIndexing($this->imgData['md5sum'], $table)) { - if (!isset($metadata)) { - $metadata = new LinMetaData(); + if (!isset($this->metadata)) { + $this->metadata = new LinMetaData(); } - if (!isset($this->src_file)) { - $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); - } - //$MetaData->singleImportGeoData($md5sum, $filename); - if ($metadata->saveMetaDataToDatabase('exifgps', $table, $this->src_file, $this->imgData['md5sum'] )) + if ($this->metadata->saveMetaDataToDatabase('exifgps', $table, $this->getFullFilename(), $this->imgData['md5sum'] )) { $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . "SET geodata='1' WHERE md5sum='".$this->imgData['md5sum']."' "); @@ -304,6 +327,14 @@ } +function getFullFilename() +{ + if (!isset($this->src_file)) { + $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); + } + return $this->src_file; +} + function saveImageComment() { /** @@ -341,40 +372,37 @@ */ function imageCommands() { - switch($_REQUEST['linCmd']) - { - case 'Recreate': - if($GLOBALS['linpha']->sql->isAdmin()) - { - $thumbnail = new LinImage(); - $_GET['force'] = true; - $thumbnail->createThumbnail($GLOBALS['linpha']->template->idCurrent); - } - break; - case 'ForceImport': // called in viewImg - if($GLOBALS['linpha']->sql->isAdmin()) { - if (!isset($this->src_file)) { - $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); - } - LinImport::updateEntry( $GLOBALS['linpha']->template->idCurrent , dirname($this->src_file) , $this->imgData['name'] ); - } - break; + switch($_REQUEST['linCmd']) + { + case 'Recreate': + if($GLOBALS['linpha']->sql->isAdmin()) + { + $thumbnail = new LinImage(); + $_GET['force'] = true; + $thumbnail->createThumbnail($GLOBALS['linpha']->template->idCurrent); + } + break; + case 'ForceImport': // called in viewImg + if($GLOBALS['linpha']->sql->isAdmin()) { + LinImport::updateEntry( $GLOBALS['linpha']->template->idCurrent , dirname($this->getFullFilename()) , $this->imgData['name'] ); + } + break; - case 'RotateLeft': - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { - LinImage::rotateImageByMenuCall('-90', $GLOBALS['linpha']->template->idCurrent); - } - break; - case 'RotateRight': - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { - LinImage::rotateImageByMenuCall('90', $GLOBALS['linpha']->template->idCurrent); - } - break; - - case 'AddToBasket': - LinViewImage::addToBasket(); - break; - } + case 'RotateLeft': + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { + LinImage::rotateImageByMenuCall('-90', $GLOBALS['linpha']->template->idCurrent); + } + break; + case 'RotateRight': + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { + LinImage::rotateImageByMenuCall('90', $GLOBALS['linpha']->template->idCurrent); + } + break; + + case 'AddToBasket': + LinViewImage::addToBasket(); + break; + } } static function addToBasket() @@ -420,5 +448,18 @@ }*/ } +function saveIptcXmp($what) +{ + if (!isset($this->metadata)) { + $this->metadata = new LinMetaData(); + } + + if ($what == 'iptc') { + $this->metadata->saveModifiedMetaData($this->getFullFilename(), 'iptc'); + } elseif ($what == 'xmp') { + $this->metadata->saveModifiedMetaData($this->getFullFilename(), 'xmp'); + } +} + } // end class LinViewImage ?> \ No newline at end of file Modified: trunk/linpha2/lib/include/metadata_iptc_edit.php =================================================================== --- trunk/linpha2/lib/include/metadata_iptc_edit.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/lib/include/metadata_iptc_edit.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -46,53 +46,25 @@ /** * We are going to save all IPTC data UTF8 encoded in database + * @TODO is this still needed since we are using everything in UTF8? */ include_once(LINPHA_DIR.'/lib/pjmt/Unicode.php'); $MetaData = new LinMetaData(); -$MetaData->setMetaFields('iptc'); $file_data = $MetaData->objMetaTool->readMetaDataFromFile('iptc', $filename); +$file_data = array_change_key_case($file_data, CASE_LOWER); - /** - * User may have selected all fields, so there are no available fields left - * create emtpy array to prevent notices... - */ -$iptc_avail = $MetaData->available_fields['iptc']; -if(!is_array($iptc_avail)) -{ - $iptc_avail = array(); -} - - -/** - * User may have selected not even a single field for now, so there are no - * selected fields, create emtpy array to prevent notices... - */ -$iptc_defined = $MetaData->defined_fields['iptc']; -if(!is_array($iptc_defined)) -{ - $iptc_defined = array(); -} - - -/** - * Merge both arrays to make all fields avail - */ -$iptc_array = $iptc_avail + $iptc_defined; - -/** * Now output the actual HTML form */ -foreach($iptc_array AS $name => $value) +foreach(LinMetaData::$metaTags['iptc'] as $name => $description) { - $lower_array = array_change_key_case($file_data, CASE_LOWER); - $name = str_replace("_", "-", $name); + $name = str_replace("_", "-", $name); // ?? - if(isset($lower_array[$name])) + if(isset($file_data[$name])) { - $file_iptc = HTML_UTF8_Escape(trim($lower_array[$name])); + $file_iptc = HTML_UTF8_Escape(trim($file_data[$name])); } else { @@ -126,7 +98,7 @@ } echo "<tr>" . - "<td>$value</td>" . + "<td>$description</td>" . "<td> ". "<select name='$name' style='width:350px; size='1' class='linForms'>" . @@ -140,7 +112,7 @@ case 'specialinstructions': echo "<tr>" . - "<td>$value</td>" . + "<td>$description</td>" . "<td> ". "<textarea style='width:350px; height:50px;' class='linForms' name='$name' maxlength='255'>$file_iptc</textarea>" . @@ -152,7 +124,7 @@ case 'caption-abstract': echo "<tr>" . - "<td>$value</td>" . + "<td>$description</td>" . "<td> ". "<textarea style='width:350px; height:60px;' class='linForms' name='$name' maxlength='1999'>$file_iptc</textarea>" . @@ -163,7 +135,7 @@ default: echo "<tr>" . - "<td>$value</td>" . + "<td>$description</td>" . "<td> ". "<input style='width:350' class='linForms' name='$name' type='text' value='".$file_iptc."'>" . @@ -172,5 +144,4 @@ } } /* vi: set ts=4 sw=4 sts=4 */ -?> - +?> \ No newline at end of file Modified: trunk/linpha2/lib/include/metadata_xmp_edit.php =================================================================== --- trunk/linpha2/lib/include/metadata_xmp_edit.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/lib/include/metadata_xmp_edit.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -43,46 +43,25 @@ <tr><td colspan = "3"><hr /></td></tr> <?php -$MetaData = new LinMetaData(); -$MetaData->setMetaFields('xmp'); -$file_data = $MetaData->objMetaTool->readMetaDataFromFile('xmp', $filename); - /** - * User may have selected all fields, so there are no available fields left - * create emtpy array to prevent notices... + * We are going to save all IPTC data UTF8 encoded in database + * @TODO is this still needed since we are using everything in UTF8? */ -$xmp_avail = $MetaData->available_fields['xmp']; -if(!is_array($xmp_avail)) -{ - $xmp_avail = array(); -} +include_once(LINPHA_DIR.'/lib/pjmt/Unicode.php'); -/** - * User may have selected not even a single field for now, so there are no - * selected fields, create emtpy array to prevent notices... - */ -$xmp_defined = $MetaData->defined_fields['xmp']; -if(!is_array($xmp_defined)) -{ - $xmp_defined = array(); -} -/** - * Merge both arrays to make all fields avail - */ -$xmp_array = $xmp_avail + $xmp_defined; +$MetaData = new LinMetaData(); +$file_data = $MetaData->objMetaTool->readMetaDataFromFile('xmp', $filename); +$file_data = array_change_key_case($file_data, CASE_LOWER); - /** * Now output the actual HTML form */ -foreach($xmp_array AS $name => $value) +foreach(LinMetaData::$metaTags['xmp'] as $name => $description) { - $lower_array = array_change_key_case($file_data, CASE_LOWER); - - if(isset($lower_array[$name])) + if(isset($file_data[$name])) { - $file_xmp = $lower_array[$name]; + $file_xmp = HTML_UTF8_Escape(trim($file_data[$name])); } else { @@ -109,7 +88,7 @@ echo "<tr>" . - "<td>$value</td>" . + "<td>$description</td>" . "<td> ". "<select name='$name' style='width:350px; size='1' class='linForms'>" . @@ -129,7 +108,7 @@ default: echo "<tr>" . - "<td>$value</td>" . + "<td>$description</td>" . "<td> ". "<input name='$name' style='width:350px;' class='linForms' type='text' value='".$file_xmp."'>" . Modified: trunk/linpha2/lib/js/LinYUIAlbum.js =================================================================== --- trunk/linpha2/lib/js/LinYUIAlbum.js 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/lib/js/LinYUIAlbum.js 2008-05-06 22:32:23 UTC (rev 4936) @@ -472,16 +472,24 @@ this.Tabs[idx++] = new YAHOO.widget.Tab(tabConf['exif']); } - if (linITPCXMPEnabled) { - this.Tabs[idx++] = new YAHOO.widget.Tab(tabConf['iptcXmp']); + if (linITPCEnabled) { + this.Tabs[idx++] = new YAHOO.widget.Tab(tabConf['iptc']); } + if (linXMPEnabled) { + this.Tabs[idx++] = new YAHOO.widget.Tab(tabConf['xmp']); + } + if (linPermMetaEdit) { this.Tabs[idx++] = new YAHOO.widget.Tab(tabConf['editMeta']); - if (linITPCXMPEnabled) { - this.Tabs[idx++] = new YAHOO.widget.Tab(tabConf['editIptcXmp']); + if (linITPCEnabled) { + this.Tabs[idx++] = new YAHOO.widget.Tab(tabConf['editIptc']); } + + if (linXMPEnabled) { + this.Tabs[idx++] = new YAHOO.widget.Tab(tabConf['editXmp']); + } } break; case 2: // video @@ -758,7 +766,17 @@ location.href = LINPHA_LINK+"&linCat=basket&checkout_as=print"; } +// saveIptcXmp() +YAHOO.linpha.Album.prototype.saveIptcXmp = function(what, formElem) { + YAHOO.util.Connect.setForm(formElem); + myLinGlobal.asyncRequest("POST", LINPHA_LINK+'linCat=image&linSaveIptcXmp='+what+'&linId='+linIdCurrent, this.saveIptcXmpFinish, this, null); +} +// saveIptcXmpFinish() +YAHOO.linpha.Album.prototype.saveIptcXmpFinish = function(t) { +} + + myLinPage.enableOnResize('thumb'); var myLinAlbum = new YAHOO.linpha.Album(); Copied: trunk/linpha2/templates/default/tabs/editIptc.html.php (from rev 4935, trunk/linpha2/templates/default/tabs/editIptcXmp.html.php) =================================================================== --- trunk/linpha2/templates/default/tabs/editIptc.html.php (rev 0) +++ trunk/linpha2/templates/default/tabs/editIptc.html.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -0,0 +1,33 @@ +<?php if(!defined('LINPHA_DIR')) { exit(1); } ?> + +<div id="linDivMetaIptc"> +<?php if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { ?> + <br /> + <form action="<?php echo $linTpl->URL_full; ?>" method="POST" onsubmit="myLinAlbum.saveIptcXmp('iptc',this); return false;"> + <table border="0"> + <?php + include(LINPHA_DIR.'/lib/include/metadata_iptc_edit.php'); + ?> + <tr> + <td colspan="2"> + <br /> + <input type="hidden" name="linCmd" value="linInsertMetaIptc" /> + <input type="submit" class="linButton" name="submit" value="<?php echo LIN_STR_SUBMIT; ?>" /> + </td> + </tr> + </table> + </form> + <br /> + <br /> + <p>Powered by: <a href="http://owl.phy.queensu.ca/~phil/exiftool/" >ExifTool</a></p> + <?php +} else { + echo i18n("IPTC Is Currently Disabled.").'<br /><br />'; + if($GLOBALS['linpha']->sql->isAdmin()) { + echo '<a href="'.LINPHA_CLIENT.'/admin/?cat=metadata_define_iptc">'.i18n("Enable IPTC").'</a>'; + echo '<br /><br />'; + } +} ?> +</div> + + \ No newline at end of file Deleted: trunk/linpha2/templates/default/tabs/editIptcXmp.html.php =================================================================== --- trunk/linpha2/templates/default/tabs/editIptcXmp.html.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/templates/default/tabs/editIptcXmp.html.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -1,62 +0,0 @@ -<?php if(!defined('LINPHA_DIR')) { exit(1); } ?> - -<div id="linDivMetaIptc"> -<?php if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { ?> - <br /> - <form action="<?php echo $linTpl->URL_full; ?>" method="POST" onsubmit="myLinAlbum.saveIptcXmp(this); return false;"> - <table border="0"> - <?php - include(LINPHA_DIR.'/lib/include/metadata_iptc_edit.php'); - ?> - <tr> - <td colspan="2"> - <br /> - <input type="hidden" name="linCmd" value="linInsertMetaIptc" /> - <input type="submit" class="linButton" name="submit" value="<?php echo LIN_STR_SUBMIT; ?>" /> - </td> - </tr> - </table> - </form> - <br /> - <br /> - <p>Powered by: <a href="http://owl.phy.queensu.ca/~phil/exiftool/" >ExifTool</a></p> - <?php -} else { - echo i18n("IPTC Is Currently Disabled.").'<br /><br />'; - if($GLOBALS['linpha']->sql->isAdmin()) { - echo '<a href="'.LINPHA_CLIENT.'/admin/?cat=metadata_define_iptc">'.i18n("Enable IPTC").'</a>'; - echo '<br /><br />'; - } -} ?> -</div> - -<div id="linDivMetaXmp"> -<?php if($GLOBALS['linpha']->sql->config->value['sys_image_xmp']) { ?> - <br /> - <form action="<?php echo $linTpl->URL_full; ?>" method="POST" onsubmit="myLinAlbum.saveIptcXmp(this); return false;"> - <table border="0"> - <?php - include(LINPHA_DIR.'/lib/include/metadata_xmp_edit.php'); - ?> - <tr> - <td colspan="2"> - <br /> - <input type="hidden" name="linCmd" value="linInsertMetaXmp" /> - <input type="submit" class="linButton" name="submit" value="<?php echo LIN_STR_SUBMIT; ?>" /> - </td> - </tr> - </table> - </form> - <br /> - <br /> - <p>Powered by: <a href="http://owl.phy.queensu.ca/~phil/exiftool/" >ExifTool</a></p> - <?php -} else { - echo i18n("XMP Is Currently Disabled.").'<br /><br />'; - if($GLOBALS['linpha']->sql->isAdmin()) { - echo '<a href="'.LINPHA_CLIENT.'/admin/?cat=metadata_define_xmp">'.i18n("Enable XMP").'</a>'; - echo '<br /><br />'; - } -} ?> -</div> - \ No newline at end of file Modified: trunk/linpha2/templates/default/tabs/editXmp.html.php =================================================================== --- trunk/linpha2/templates/default/tabs/editXmp.html.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/templates/default/tabs/editXmp.html.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -1,39 +1,9 @@ <?php if(!defined('LINPHA_DIR')) { exit(1); } ?> -<div id="linDivMetaIptc"> -<?php if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { ?> - <br /> - <form action="<?php echo $linTpl->URL_full; ?>" method="POST" onsubmit="myLinAlbum.saveIptcXmp(this); return false;"> - <table border="0"> - <?php - include(LINPHA_DIR.'/lib/include/metadata_iptc_edit.php'); - ?> - <tr> - <td colspan="2"> - <br /> - <input type="hidden" name="linCmd" value="linInsertMetaIptc" /> - <input type="submit" class="linButton" name="submit" value="<?php echo LIN_STR_SUBMIT; ?>" /> - </td> - </tr> - </table> - </form> - <br /> - <br /> - <p>Powered by: <a href="http://owl.phy.queensu.ca/~phil/exiftool/" >ExifTool</a></p> - <?php -} else { - echo i18n("IPTC Is Currently Disabled.").'<br /><br />'; - if($GLOBALS['linpha']->sql->isAdmin()) { - echo '<a href="'.LINPHA_CLIENT.'/admin/?cat=metadata_define_iptc">'.i18n("Enable IPTC").'</a>'; - echo '<br /><br />'; - } -} ?> -</div> - <div id="linDivMetaXmp"> <?php if($GLOBALS['linpha']->sql->config->value['sys_image_xmp']) { ?> <br /> - <form action="<?php echo $linTpl->URL_full; ?>" method="POST" onsubmit="myLinAlbum.saveIptcXmp(this); return false;"> + <form action="<?php echo $linTpl->URL_full; ?>" method="POST" onsubmit="myLinAlbum.saveIptcXmp('xmp',this); return false;"> <table border="0"> <?php include(LINPHA_DIR.'/lib/include/metadata_xmp_edit.php'); Copied: trunk/linpha2/templates/default/tabs/iptc.html.php (from rev 4935, trunk/linpha2/templates/default/tabs/iptcXmp.html.php) =================================================================== --- trunk/linpha2/templates/default/tabs/iptc.html.php (rev 0) +++ trunk/linpha2/templates/default/tabs/iptc.html.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -0,0 +1,3 @@ +<?php if(!defined('LINPHA_DIR')) { exit(1); } ?> + +IPTC Deleted: trunk/linpha2/templates/default/tabs/iptcXmp.html.php =================================================================== --- trunk/linpha2/templates/default/tabs/iptcXmp.html.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/templates/default/tabs/iptcXmp.html.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -1,3 +0,0 @@ -<?php if(!defined('LINPHA_DIR')) { exit(1); } ?> - -IPTC/XMP Modified: trunk/linpha2/templates/default/tabs/xmp.html.php =================================================================== --- trunk/linpha2/templates/default/tabs/xmp.html.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/templates/default/tabs/xmp.html.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -1,3 +1,3 @@ <?php if(!defined('LINPHA_DIR')) { exit(1); } ?> -IPTC/XMP +XMP Modified: trunk/linpha2/templates/default/viewer.head.php =================================================================== --- trunk/linpha2/templates/default/viewer.head.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/templates/default/viewer.head.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -10,8 +10,8 @@ var linMaxImgHeight = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; ?>; var linPermMetaEdit = <?php echo ($GLOBALS['linpha']->sql->checkPermission('metadata_edit') ? 'true' : 'false'); ?>; var linEXIFEnabled = <?php echo ($GLOBALS['linpha']->sql->config->value['sys_image_exif'] ? 'true': 'false'); ?>; -var linITPCXMPEnabled = <?php echo ( ($GLOBALS['linpha']->sql->config->value['sys_image_iptc'] - || $GLOBALS['linpha']->sql->config->value['sys_image_xmp']) ? 'true': 'false'); ?>; +var linITPCEnabled = <?php echo ($GLOBALS['linpha']->sql->config->value['sys_image_iptc'] ? 'true': 'false'); ?>; +var linXMPEnabled = <?php echo ($GLOBALS['linpha']->sql->config->value['sys_image_xmp'] ? 'true': 'false'); ?>; var linUseEffects = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_useeffects']; ?>; var linTnSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>; var linTnSizeSmall = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display_small']; ?>; @@ -49,18 +49,4 @@ linYUILoader.insert(); - -/*linYUILoader.addModule({ - name: "LinGoogleMaps", - type: "js", - fullpath: "http://maps.google.com/maps?file=api&v=2&key=<?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_google_key']; ?>", - varName: "LinGoogleMaps" -}); -linYUILoader.addModule({ - name: "LinGoogleMapsReverseGeocoder", - type: "js", - fullpath: LINPHA_CLIENT + "/lib/plugins/maps/greversegeocoder.js", - varName: "LinGoogleMapsReverseGeocoder" -});*/ - </script> \ No newline at end of file Modified: trunk/linpha2/templates/default/viewer.html.php =================================================================== --- trunk/linpha2/templates/default/viewer.html.php 2008-05-06 21:11:59 UTC (rev 4935) +++ trunk/linpha2/templates/default/viewer.html.php 2008-05-06 22:32:23 UTC (rev 4936) @@ -63,9 +63,11 @@ linTabs['imageInfo'] = { label: '<?php echo i18n("Image Info"); ?>', cacheData: true, active: false }; linTabs['gps'] = { label: '<?php echo i18n("GPS Info"); ?>', cacheData: true, active: false }; linTabs['exif'] = { label: '<?php echo i18n("EXIF"); ?>', cacheData: true, active: false }; -linTabs['iptcXmp'] = { label: '<?php echo i18n("ITPC/XMP"); ?>', cacheData: true, active: false }; +linTabs['iptc'] = { label: '<?php echo i18n("ITPC"); ?>', cacheData: true, active: false }; +linTabs['xmp'] = { label: '<?php echo i18n("XMP"); ?>', cacheData: true, active: false }; linTabs['editMeta'] = { label: '<?php echo i18n("Edit Meta Data"); ?>', cacheData: true, active: false }; -linTabs['editIptcXmp'] = { label: '<?php echo i18n("Edit ITPC/XMP"); ?>', cacheData: true, active: false }; +linTabs['editIptc'] = { label: '<?php echo i18n("Edit ITPC"); ?>', cacheData: true, active: false }; +linTabs['editXmp'] = { label: '<?php echo i18n("Edit XMP"); ?>', cacheData: true, active: false }; linTabs['videoInfo'] = { label: '<?php echo i18n("Video Info"); ?>', cacheData: true, active: false }; <?php @@ -74,6 +76,8 @@ * inside the tabview control. There is a dispatcher as a YUI Plugin (http://www.bubbling-library.com/eng/api/docs/plugins/dispatcher). * But in my opinion its to big (~26KB) for just doing that... */ +if ($GLOBALS['linpha']->sql->config->isPluginActive('maps')) +{ ?> function linLoadGPSMap() { @@ -110,4 +114,7 @@ } ?> } +<?php +} +?> </script> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |