[Linpha-cvs] SF.net SVN: linpha: [4532] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-04-13 13:19:34
|
Revision: 4532 Author: fangehrn Date: 2006-04-13 06:19:09 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4532&view=rev Log Message: ----------- * finished search feature Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/index.php trunk/linpha2/admin/settings.php trunk/linpha2/admin/settings_layout.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/modules/module.search.php trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/search.html.php trunk/linpha2/templates/default/view_img.html.php trunk/linpha2/templates/default/view_meta.html.php trunk/linpha2/templates/default/view_thumb.html.php Added Paths: ----------- trunk/linpha2/admin/settings_features.php trunk/linpha2/lib/include/calender.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-13 11:03:12 UTC (rev 4531) +++ trunk/linpha2/ChangeLog 2006-04-13 13:19:09 UTC (rev 4532) @@ -1,3 +1,7 @@ +2006-04-1* flo + * finished search feature + hope it will work with oracle... ;-) + 2006-04-12 flo * replace some recordCount() with EOF * startet implementing search feature Modified: trunk/linpha2/admin/index.php =================================================================== --- trunk/linpha2/admin/index.php 2006-04-13 11:03:12 UTC (rev 4531) +++ trunk/linpha2/admin/index.php 2006-04-13 13:19:09 UTC (rev 4532) @@ -143,10 +143,8 @@ } echo $text; ?> - <input type="radio" id="<?php echo $id; ?>01" name="<?php echo $id; ?>" value="1"<?php echo $str_enabled; ?> /> - <label for="<?php echo $id; ?>01"><?php echo i18n("Enable"); ?></label> - <input type="radio" id="<?php echo $id; ?>02" name="<?php echo $id; ?>" value="0"<?php echo $str_disabled; ?>/> - <label for="<?php echo $id; ?>02"><?php echo i18n("Disable"); ?></label> + <input type="radio" id="<?php echo $id; ?>01" name="<?php echo $id; ?>" value="1"<?php echo $str_enabled; ?> /><label for="<?php echo $id; ?>01"><?php echo i18n("Enable"); ?></label> + <input type="radio" id="<?php echo $id; ?>02" name="<?php echo $id; ?>" value="0"<?php echo $str_disabled; ?>/><label for="<?php echo $id; ?>02"><?php echo i18n("Disable"); ?></label> <br /> <?php break; Modified: trunk/linpha2/admin/settings.php =================================================================== --- trunk/linpha2/admin/settings.php 2006-04-13 11:03:12 UTC (rev 4531) +++ trunk/linpha2/admin/settings.php 2006-04-13 13:19:09 UTC (rev 4532) @@ -8,6 +8,7 @@ $array_menu = Array( 'layout' => Array('name' => 'Layout', 'link' => 'settings_layout'), + 'features' => Array('name' => 'Features', 'link' => 'settings_features'), 'others' => Array('name' => 'Others', 'link' => 'settings_others') ); @@ -18,6 +19,9 @@ case 'layout': include_once(LINPHA_DIR.'/admin/settings_layout.php'); break; + case 'features': + include_once(LINPHA_DIR.'/admin/settings_features.php'); + break; case 'others': break; } Added: trunk/linpha2/admin/settings_features.php =================================================================== --- trunk/linpha2/admin/settings_features.php (rev 0) +++ trunk/linpha2/admin/settings_features.php 2006-04-13 13:19:09 UTC (rev 4532) @@ -0,0 +1,44 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +if(!isset($cat3)) +{ + $cat3 = 'others'; +} + +$array_menu = Array( + 'others' => Array('name' => 'Others', 'link' => 'settings_features_others') +); + +print_admin_menu($array_menu,$cat3); +?> + +<form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=settings_features_'.$cat3; ?>"> +<?php + +switch($cat3) +{ +case 'others': + /** + * save settings + */ + if(isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') + { + saveConfig(Array( + 'sys_image_exif', + 'sys_image_iptc', + 'sys_image_xmp' + )); + } + + + printAdminConfig('radio',i18n("Use EXIF"),'sys_image_exif'); + printAdminConfig('radio',i18n("Use IPTC"),'sys_image_iptc'); + printAdminConfig('radio',i18n("Use XMP"),'sys_image_xmp'); + break; +} +?> +<br /><br /><hr /> +<input type="hidden" name="cmd" value="saveconfig" /> +<input type="submit" name="submit" value="<?php echo i18n("Submit"); ?>" /> +</form> \ No newline at end of file Modified: trunk/linpha2/admin/settings_layout.php =================================================================== --- trunk/linpha2/admin/settings_layout.php 2006-04-13 11:03:12 UTC (rev 4531) +++ trunk/linpha2/admin/settings_layout.php 2006-04-13 13:19:09 UTC (rev 4532) @@ -7,7 +7,7 @@ } $array_menu = Array( - 'homesite' => Array('name' => 'Home Site', 'link' => 'settings_layout_home'), + 'home' => Array('name' => 'Home Site', 'link' => 'settings_layout_home'), 'thumb' => Array('name' => 'Thumb View', 'link' => 'settings_layout_thumb'), 'others' => Array('name' => 'Others', 'link' => 'settings_layout_others') ); Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-04-13 11:03:12 UTC (rev 4531) +++ trunk/linpha2/install/sql/sql.data.php 2006-04-13 13:19:09 UTC (rev 4532) @@ -34,6 +34,7 @@ 'sys_import_autoimport' => '1', 'sys_image_exif' => '1', 'sys_image_iptc' => '0', + 'sys_image_xmp' => '0', 'sys_lang' => $_SESSION['language'], 'sys_lang_autolang' => '1', 'sys_path_album_dir' => $_SESSION['album_dir'], Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-13 11:03:12 UTC (rev 4531) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-13 13:19:09 UTC (rev 4532) @@ -338,7 +338,7 @@ break; case 'image': - $GLOBALS['linpha']->template->output['menu_More'] = Array( + $GLOBALS['linpha']->template->output['menu_More']['basket'] = Array( 'name' => i18n("Basket"), 'value' => Array( @@ -346,27 +346,37 @@ Array('name' => i18n("Open Basket"), 'value' => $open_basket_link), Array('name' => i18n("Images In Basket").': '.count($_SESSION['basket_ids']), 'value' => '#') ) - ), - Array( + ); + $GLOBALS['linpha']->template->output['menu_More']['view'] = + Array( 'name' => i18n("View"), 'value' => Array( Array('name' => i18n("Sort"), 'value' => $array_sort_orders_links) ) - ), + ); + + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) + { + $GLOBALS['linpha']->template->output['menu_More']['edit'] = Array( 'name' => i18n("Edit"), 'value' => Array( Array('name' => i18n("Rotate Left"), 'value' => '#'), Array('name' => i18n("Rotate Right"), 'value' => '#') ) - ), + ); + } + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) + { + $GLOBALS['linpha']->template->output['menu_More']['metainfo'] = Array( 'name' => i18n("Metainfo"), 'value' => Array( Array('name' => i18n("Edit Image Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') ) - ) - ); + ); + } + break; } } @@ -555,7 +565,7 @@ /** * prepare variables */ - $max_photos_per_page = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrrows'] * $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrrows']; + $max_photos_per_page = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrrows'] * $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrcols']; $this->nr_pages = ceil( $this->tot_photos / $max_photos_per_page ); if(isset($_GET['pn']) && $_GET['pn'] > 1) { Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-13 11:03:12 UTC (rev 4531) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-13 13:19:09 UTC (rev 4532) @@ -513,8 +513,28 @@ $str = addslashes($str); } return $str; -} // end function linpha_addslashes +} // end method linAddslashes +/** +* addslashes to all values of an array +* used for posted data from <select>'s +*/ +function linAddslashesArray(&$array) +{ + if(is_array($array)) + { + foreach($array AS $key=>$value) + { + $array2[$key] = LinSql::linAddslashes($value); + } + } + else + { + $array2 = Array(); + } + + return $array2; +} /** * returns an array with the full pathname of the given id Added: trunk/linpha2/lib/include/calender.php =================================================================== --- trunk/linpha2/lib/include/calender.php (rev 0) +++ trunk/linpha2/lib/include/calender.php 2006-04-13 13:19:09 UTC (rev 4532) @@ -0,0 +1,165 @@ +<?php +/* +* Copyright (c) 2004 Heiko Rutenbeck <bz...@tu...> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','../..'); } +$style['tablebg']="#B3BCDE"; + +include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); +?> +<title>Calender - LinPHA</title> +</head> +<body> +<?php + $m = (!isset($_GET['m'])) ? date("n",mktime()) : $_GET['m']; // wenn $m $y noch nicht existiert, aktuellen monat und aktuelles jahr in $m und $y schreiben + $y = (!isset($_GET['y'])) ? date("Y",mktime()) : $_GET['y']; +?> +<div align="center"> +<table bgcolor="<?php echo $style['tablebg']; ?>"> + <tr> + <td valign="top"> +<?php + /*== get what weekday the first is on ==*/ + $month_in_dec = strftime("%m",mktime(0,0,0,$m,1,$y)); + + $tmpd = getdate(mktime(0,0,0,$m,1,$y)); + $firstwday= $tmpd["wday"]; + + $lastday = mk_getLastDayofMonth($m,$y); + + $arr_month_long = Array( + '1' => i18n("January"), + '2' => i18n("February"), + '3' => i18n("March"), + '4' => i18n("April"), + '5' => i18n("May"), + '6' => i18n("June"), + '7' => i18n("July"), + '8' => i18n("August"), + '9' => i18n("September"), + '10' => i18n("October"), + '11' => i18n("November"), + '12' => i18n("December") + ); +?> +<table cellpadding=2 cellspacing=0 border=1> + <tr> + <td colspan=7 bgcolor="<?php echo $style['tablebg']; ?>"> + <table cellpadding=0 cellspacing=0 border=0 width="100%"> + <tr> + <td width="20"><a href="?m=<?php echo (($m-1)<1) ? 12 : $m-1 ; ?>&y=<?php echo (($m-1)<1) ? $y-1 : $y ; ?>&form=<?php echo $_GET['form']; ?>"><<</a></td> + <td bgcolor="<?php echo $style['tablebg']; ?>" align="center"><font size=2> + <?php echo $arr_month_long[intval($month_in_dec)]." ".$y; ?> + </font></td> + <td width="20"><a href="?m=<?php echo (($m+1)>12) ? 1 : $m+1 ; ?>&y=<?php echo (($m+1)>12) ? $y+1 : $y ; ?>&form=<?php echo $_GET['form']; ?>">>></a></td> + </tr> + </table></td> + </tr> + <tr> + <td width="22"><?php echo i18n("Sun"); ?></td> + <td width="22"><?php echo i18n("Mon"); ?></td> + <td width="22"><?php echo i18n("Tue"); ?></td> + <td width="22"><?php echo i18n("Wed"); ?></td> + <td width="22"><?php echo i18n("Thu"); ?></td> + <td width="22"><?php echo i18n("Fri"); ?></td> + <td width="22"><?php echo i18n("Sat"); ?></td> + </tr> + <?php + $d = 1; + $wday = $firstwday; + $firstweek = true; + + /*== loop through all the days of the month ==*/ + while ( $d <= $lastday) + { + + /*== set up blank days for first week ==*/ + if ($firstweek) { + print "<tr>"; + for ($i=1; $i<=$firstwday; $i++) + { print '<td><font size="2"></font></td>'; } + $firstweek = false; + } + + /*== Sunday start week with <tr> ==*/ + if ($wday==0) { print "<tr>"; } + + /*== check for event ==*/ + print "<td>"; + if($d<10) { + if($m<10) { + $tag = "$y:0$m:0$d"; + } else { + $tag = "$y:$m:0$d"; + } + } else { + if($m<10) { + $tag = "$y:0$m:$d"; + } else { + $tag = "$y:$m:$d"; + } + } + + $heute = date("Y:m:d",mktime()); // "01" bis "12" + if($tag==$heute) + { + $font1 = "<font color=\"#FF0000\">"; + $font2 = "</font>"; + } + else + { + $font1 = ""; + $font2 = ""; + } + print "<a href=\"#\" onClick=\"opener.document.getElementById('".$_GET['form']."').value='$tag',window.close();\">$font1$d$font2</a>"; + print "</td>\n"; + + /*== Saturday week with </tr> ==*/ + if ($wday==6) { print "</tr>\n"; } + + $wday++; + $wday = $wday % 7; + $d++; + } +?> +</tr> +</table> +<div align="center"><a href="#" onClick="window.close()"><?php echo i18n("Close Window"); ?></a></div> + + </td> + </tr> +</table> +</div> +</body> +</html> +<?php +/*== get the last day of the month ==*/ +function mk_getLastDayofMonth($mon,$year) +{ + for ($tday=28; $tday <= 31; $tday++) + { + $tdate = getdate(mktime(0,0,0,$mon,$tday,$year)); + if ($tdate["mon"] != $mon) + { break; } + + } + $tday--; + + return $tday; +} +?> Modified: trunk/linpha2/lib/modules/module.search.php =================================================================== --- trunk/linpha2/lib/modules/module.search.php 2006-04-13 11:03:12 UTC (rev 4531) +++ trunk/linpha2/lib/modules/module.search.php 2006-04-13 13:19:09 UTC (rev 4532) @@ -88,9 +88,9 @@ break; } } -else +elseif(!isset($_SESSION['search'])) { - $_REQUEST['b_all'] = 1; + $_REQUEST['button']['meta']['all'] = 1; } if(isset($_SESSION['search'])) @@ -229,20 +229,18 @@ $search_string .= implode("%' ".$and_or." {colname} LIKE '%",$array_strings); $search_string .= "%'"; - if(isset($_REQUEST['button']['meta']['cmt']) OR isset($_REQUEXT['button']['meta']['all'])) + if(isset($_REQUEST['button']['meta']['cmt']) OR isset($_REQUEST['button']['meta']['all'])) { $sql_buttons .= " OR ".str_replace('{colname}',PREFIX."meta_comments.meta_comment",$search_string); $need_meta_comment_table = true; } - if(isset($_REQUEST['button']['meta']['name']) OR isset($_REQUEXT['button']['meta']['all'])) + if(isset($_REQUEST['button']['meta']['name']) OR isset($_REQUEST['button']['meta']['all'])) { $sql_buttons .= " OR ".str_replace('{colname}',PREFIX."photos.name",$search_string); } - - /** - * exif/iptc + * exif/iptc/xmp */ include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); $MetaData = new MetaData(); @@ -274,7 +272,7 @@ if(isset($_REQUEST['button']['iptc'][$key]) OR isset($_REQUEST['button']['iptc']['all'])) { $sql_buttons .= " OR ".str_replace('{colname}',PREFIX."meta_iptc.".$key,$search_string); - $need_exif_table = true; + $need_iptc_table = true; } } } @@ -288,48 +286,88 @@ * categories */ $sql_categories = ''; - if(isset($_REQUEST['category'])) + if(isset($_REQUEST['select'])) { - /** - * add slashes ( and remove empty strings) - */ - $_REQUEST['category'] = addslashes_array($_REQUEST['category']); + foreach($_REQUEST['select'] AS $key=>$value) + { + $sql_categories .= " ("; - $and_or = get_and_or($_REQUEST['and_or']); - $sql_categories .= "(".C.".category LIKE '%;"; - $sql_categories .= implode(";%' ".$and_or." ".C.".category LIKE '%;",$_REQUEST['category']); - $sql_categories .= ";%'"; - $sql_categories .= ") AND "; - - $need_image_comment_table = true; + /** + * add slashes ( and remove empty strings) + */ + $value = LinSql::linAddslashesArray($value); + + $and_or = get_and_or($_REQUEST['select_and_or'][$key]); + + $num = count($value); + reset($value); + for($i = 1; list($sub_key,$sub_value) = each($value); $i++) + { + $sql_categories .= " (".PREFIX."meta_data.field_id = '".$key."' AND ".PREFIX."meta_data.meta_data LIKE '%;".$sub_value.";%') "; + + /** + * append AND/OR, but not on last item + */ + if($i < $num) + { + $sql_categories .= $and_or; + } + } + $need_metadata_table = true; + + $sql_categories .= " ) AND "; + } } //echo $sql_categories.'<br />'; /** - * exif date - */ + * date (exif) + */ $sql_exif_date = ''; - if( (isset($_REQUEST['date_from']['exif']) && $_REQUEST['date_from']['exif']!="") - OR (isset($_REQUEST['date_to']['exif']) && $_REQUEST['date_to']['exif']!="")) + if( (isset($_REQUEST['date_from_exif']) && $_REQUEST['date_from_exif']!="") + OR (isset($_REQUEST['date_to_exif']) && $_REQUEST['date_to_exif']!="")) { - if($_REQUEST['date_from']['exif']=="") { - $_REQUEST['date_from']['exif'] = "0000:00:00 00:00:00"; + if($_REQUEST['date_from_exif']=="") { + $_REQUEST['date_from_exif'] = "0000:00:00 00:00:00"; } - if($_REQUEST['date_to']['exif']=="") { - $_REQUEST['date_to']['exif'] = "4000:00:00 00:00:00"; + if($_REQUEST['date_to_exif']=="") { + $_REQUEST['date_to_exif'] = "4000:00:00 00:00:00"; } - $sql_exif_date = "(".PREFIX.".meta_exif.datetimeoriginal between ". - "'".LinSql::linAddslashes($_REQUEST['date_from']['exif'])." 00:00:00' AND ". - "'".LinSql::linAddslashes($_REQUEST['date_to']['exif'])." 23:59:59') AND "; + $sql_exif_date = "(".PREFIX."meta_exif.datetimeoriginal BETWEEN ". + "'".LinSql::linAddslashes($_REQUEST['date_from_exif'])." 00:00:00' AND ". + "'".LinSql::linAddslashes($_REQUEST['date_to_exif'])." 23:59:59') AND "; $need_exif_table = true; } //echo $sql_exif_date.'<br />'; + $sql_date = ''; + foreach($_REQUEST['date_from'] AS $key=>$value) + { + if( !empty($_REQUEST['date_from'][$key]) OR !empty($_REQUEST['date_to'][$key])) + { + if($_REQUEST['date_from'][$key]=="") { + $_REQUEST['date_from'][$key] = "0000:00:00 00:00:00"; + } + if($_REQUEST['date_to'][$key]=="") { + $_REQUEST['date_to'][$key] = "4000:00:00 00:00:00"; + } + + $sql_date .= "(".PREFIX."meta_exif.datetimeoriginal BETWEEN ". + "'".LinSql::linAddslashes($_REQUEST['date_from'][$key])." 00:00:00' AND ". + "'".LinSql::linAddslashes($_REQUEST['date_to'][$key])." 23:59:59') AND "; + + $need_exif_table = true; + } + } + + //echo $sql_date.'<br />'; + + /** * albums selected */ @@ -364,17 +402,16 @@ $sql_where = " FROM ".PREFIX."photos ". + (isset($need_metadata_table) ? "LEFT OUTER JOIN ".PREFIX."meta_data ON ".PREFIX."photos.md5sum = ".PREFIX."meta_data.md5sum " : ''). (isset($need_meta_comment_table) ? "LEFT OUTER JOIN ".PREFIX."meta_comments ON ".PREFIX."photos.md5sum = ".PREFIX."meta_comments.md5sum " : ''). - (isset($need_exif_table) ? "LEFT OUTER JOIN ".PREFIX."meta_exif ON ".PREFIX.".photos.md5sum = ".PREFIX."meta_exif.md5sum " : ''). - (isset($need_iptc_table) ? "LEFT OUTER JOIN ".PREFIX."meta_iptc ON ".PREFIX.".photos.md5sum = ".PREFIX."meta_iptc.md5sum " : ''). + (isset($need_exif_table) ? "LEFT OUTER JOIN ".PREFIX."meta_exif ON ".PREFIX."photos.md5sum = ".PREFIX."meta_exif.md5sum " : ''). + (isset($need_iptc_table) ? "LEFT OUTER JOIN ".PREFIX."meta_iptc ON ".PREFIX."photos.md5sum = ".PREFIX."meta_iptc.md5sum " : ''). "WHERE ".$sql_buttons.$sql_categories.$sql_exif_date.$sql_albums.'1=1'; $linpha->db->debug = true; $linpha->imgview->photos = $GLOBALS['linpha']->db->GetAssoc($sql_begin.$sql_where); $linpha->db->debug = false; - //echo '<br /><br /><br />'.$sql_begin.$sql_where.'<br /><br /><br />'; - if( count($linpha->imgview->photos) == 0 ) { $GLOBALS['linpha']->template->output['navigation'] = @@ -417,7 +454,7 @@ function build_album_select($with_all_albs_entry) { ?> - <select name="album_select[]" size="10" multiple="multiple"> + <select name="album_select[]" size="10" multiple="multiple" style="overflow: scroll; width: 200px;"> <?php if($with_all_albs_entry) { @@ -430,14 +467,14 @@ echo '<option value="all"'.$select.'>'.i18n("All Albums").'</option>'."\n"; } - build_album_select_sub_entry(0); + build_album_select_sub_entry(0,''); ?> </select><br /> <font size="-2">(<?php echo i18n("Multiple Select Use 'Ctrl'"); ?>)</font> <?php } -function build_album_select_sub_entry($id) +function build_album_select_sub_entry($id,$text) { $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."photos WHERE parent_id = '".$id."' AND img_type = '0' ORDER by name"); while($data = $query->FetchRow()) @@ -450,9 +487,9 @@ } else { $select = ''; } - echo '<option value="'.$data['id'].'"'.$select.'>'.htmlspecialchars($data['name'],ENT_QUOTES).'</option>'."\n"; + echo '<option value="'.$data['id'].'"'.$select.'>'.$text.'/'.htmlspecialchars($data['name'],ENT_QUOTES).'</option>'."\n"; - build_album_select_sub_entry($data['id']); + build_album_select_sub_entry($data['id'],$text.'/'.htmlspecialchars($data['name'],ENT_QUOTES)); } } ?> \ No newline at end of file Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2006-04-13 11:03:12 UTC (rev 4531) +++ trunk/linpha2/templates/default/global.html.php 2006-04-13 13:19:09 UTC (rev 4532) @@ -80,7 +80,11 @@ <li><a href="./?cat=search"><?php echo i18n("Extended Search"); ?></a></li> <li> <div> - <input type="text" name="search" value="" /> + <form method="GET" action="<?php echo LINPHA_DIR; ?>/?cat=search"> + <input type="text" name="search_text" value="" /> + <input type="hidden" name="button[meta][all]" value="1" /> + <input type="hidden" name="cmd" value="search" /> + <input type="hidden" name="cat" value="search" /> <input type="submit" name="submit" value="<?php echo i18n("Search"); ?>" /> </div> </li> Modified: trunk/linpha2/templates/default/search.html.php =================================================================== --- trunk/linpha2/templates/default/search.html.php 2006-04-13 11:03:12 UTC (rev 4531) +++ trunk/linpha2/templates/default/search.html.php 2006-04-13 13:19:09 UTC (rev 4532) @@ -1,20 +1,22 @@ <style> -.searchcolumn +.divcolumn { float: left; border: 1px solid black; - margin: 10px; + margin-left: 20px; padding: 5px; width: 300px; + min-height: 380px; } </style> -<br /><img src='<?php echo LINPHA_DIR; ?>/lib/graphics/xmag.jpg' alt="Searching Linpha"> - <font size='+1'><?php echo i18n("LinPHA Search Page"); ?></font> + +<img src="<?php echo LINPHA_DIR; ?>/lib/graphics/xmag.jpg" alt="Searching Linpha"> + <font size="+1"><?php echo i18n("LinPHA Search Page"); ?></font> <hr noshade> <?php if(isset($error)) { - echo "<div align='center'><b>"; + echo '<div align="center"><b>'; switch($error) { case 1: echo i18n("Search string to short, must be at least 2 characters long!"); break; @@ -23,151 +25,110 @@ echo "</b><br /><br /></div>"; } ?> +<div id="divmain"> + <div class="roundtop"> + <img src="<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/tl.gif'; ?>" alt="" width="15" height="15" class="corner" style="display: none" /> + </div> + <div id="main"> -<form name="searchform" method="POST" action="<?php echo LINPHA_DIR; ?>/?cat=search"> - <div class="searchcolumn"> - <!-- search text box //--> - <span class="leftmenulabel"><?php echo i18n("Search Keyword"); ?></span><br /> - <input type="text" name="search_text" style="width:180" value="<?php echo @$_REQUEST['search_text']; ?>"> - - <?php - // text and / or - if(isset($_REQUEST['text_and_or'])) +<div class="divcolumn"> + <form name="searchform" method="GET" action="<?php echo LINPHA_DIR; ?>/"> + + <input type="submit" class="button" name="sub" value=" <?php echo i18n("Search"); ?> "> + <a class="button" href="<?php echo LINPHA_DIR; ?>/?cat=search&cmd=new"><?php echo i18n("Reset"); ?></a> + <br /><br /> + + <!-- search text box //--> + <?php echo i18n("Search Keyword"); ?><br /> + <input type="text" name="search_text" style="width: 180px;" value="<?php echo @$_REQUEST['search_text']; ?>"> + + <?php + // text and / or + if(isset($_REQUEST['text_and_or'])) + { + if($_REQUEST['text_and_or']=='AND') { - if($_REQUEST['text_and_or']=='AND') - { - $txt_checked_and = " checked"; - $txt_checked_or = ""; - } else { - $txt_checked_and = ""; - $txt_checked_or = " checked"; - } - } else { $txt_checked_and = " checked"; $txt_checked_or = ""; + } else { + $txt_checked_and = ""; + $txt_checked_or = " checked"; } - ?> - <br /> - (<input type="radio" id="text_and_or_and" name="text_and_or" value="AND"<?php echo $txt_checked_and; ?>><label for="text_and_or_and"><?php echo i18n("AND"); ?></label> - <input type="radio" id="text_and_or_or" name="text_and_or" value="OR"<?php echo $txt_checked_or; ?>><label for="text_and_or_or"><?php echo i18n("OR"); ?></label>) - <br /><br /> - - <input type="checkbox" id="b_all" name="button[meta][all]" value="1"<?php echo isset($_REQUEST['button']['meta']['all']) ? ' checked' : ''; ?> onClick="check_all()"> - <label for="b_all"><b><?php echo i18n("All"); ?></b></label><br /> + } else { + $txt_checked_and = " checked"; + $txt_checked_or = ""; + } + ?> + <br /> + (<input type="radio" id="text_and_or_and" name="text_and_or" value="AND"<?php echo $txt_checked_and; ?>><label for="text_and_or_and"><?php echo i18n("AND"); ?></label> + <input type="radio" id="text_and_or_or" name="text_and_or" value="OR"<?php echo $txt_checked_or; ?>><label for="text_and_or_or"><?php echo i18n("OR"); ?></label>) + <br /><br /> + + <input type="checkbox" id="b_meta_all" name="button[meta][all]" value="1"<?php echo isset($_REQUEST['button']['meta']['all']) ? ' checked' : ''; ?> onClick="check_all('b_meta_all','meta')"><label for="b_meta_all"><b><?php echo i18n("All"); ?></b></label><br /> + <input type="checkbox" id="b_name" name="button[meta][name]" value="1"<?php echo isset($_REQUEST['button']['meta']['name']) ? ' checked' : ''; ?>><label for="b_name"><?php echo i18n("Filename"); ?></label><br /> + <input type="checkbox" id="b_cmt" name="button[meta][cmt]" value="1"<?php echo isset($_REQUEST['button']['meta']['cmt']) ? ' checked' : ''; ?>><label for="b_cmt"><?php echo i18n("Comments"); ?></label><br /> - <input type="checkbox" id="b_name" name="button[meta][name]" value="1"<?php echo isset($_REQUEST['button']['meta']['name']) ? ' checked' : ''; ?>> - <label for="b_name"><?php echo i18n("Filename"); ?></label><br /> + <?php + /** + * get text fields + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE field_type = '1' AND (flags = '5' OR flags = '7')"); + while($data = $query->FetchRow()) + { + echo '<input type="checkbox" id="b_'.$data['id'].'" name="button[meta]['.$data['id'].']" value="1"'.(isset($_REQUEST['button']['meta'][$data['id']]) ? ' checked' : '').'>'; + echo '<label for="b_'.$data['id'].'">'.$data['name'].'</label><br />'; + } - <input type="checkbox" id="b_cmt" name="button[meta][cmt]" value="1"<?php echo isset($_REQUEST['button']['meta']['cmt']) ? ' checked' : ''; ?>> - <label for="b_cmt"><?php echo i18n("Comments"); ?></label><br /> + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + $MetaData = new MetaData(); - <?php - /** - * get text fields - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE field_type = '1' AND (flags = '5' OR flags = '7')"); - while($data = $query->FetchRow()) - { - echo '<input type="checkbox" id="b_'.$data['id'].'" name="button['.$data['id'].']" value="1"'.(isset($_REQUEST['button'][$data['id']]) ? ' checked' : '').'>'; - echo ' <label for="b_'.$data['id'].'">'.$data['name'].'</label><br />'; - } - - include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - $MetaData = new MetaData(); - - /** - * Exif Informations - */ - if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) - { - $MetaData->setFields('exif'); - $exif_count = $MetaData->defined_fields['exif']; - ?> - <br /><b><?php echo i18n("Search EXIF"); ?></b><br /> - <input type="checkbox" id="b_exif_all" name="button[exif][all]" value="1"<?php echo isset($_REQUEST['b_exif_all']) ? ' checked' : ''; ?> onClick="check_all()"> - <label for="b_exif_all"><b><?php echo i18n("All"); ?></b></label><br /> - <?php - for($i=1; list($key,$value) = each($MetaData->defined_fields['exif']); $i++) - { - echo '<input type="checkbox" id="b_exif_'.$i.'" name="button[exif]['.$key.']" value="1"'; - echo isset($_REQUEST['button_exif'][$key]) ? ' checked="checked">' : '>'; - echo '<label for="b_exif_'.$i.'">'.$value.'</label><br />'; - } - } - - /** - * Iptc Informations - - if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) - { - $MetaData->setFields('iptc'); - $iptc_count = $MetaData->defined_fields['iptc']; - ?> - <br /><b><?php echo i18n("Search IPTC"); ?></b><br /> - <input type="checkbox" id="b_iptc_all" name="b_iptc_all" value="1"<?php echo isset($_REQUEST['b_iptc_all']) ? ' checked' : ''; ?> onClick="check_all()"> - <?php - echo '<b>'.i18n("All").'</b><br />'; - - for($i=1; list($key,$value) = each($MetaData->defined_fields['iptc']); $i++) - { - echo '<input type="checkbox" id="b_iptc_'.$i.'" name="b_iptc_'.$value.'" value="1"'; - echo isset($_REQUEST['b_iptc_'.$value]) ? ' checked="checked">' : '>'; - echo translateIptcSearchTags($value, "single")."<br />"; - } - }*/ - ?> - <script language="JavaScript" type="text/javascript"> - function check_all(/*start,elem_name,elem_count*/) - { - /* for(var i = 1; i <= elem_count; i++) - { - elem = document.getElementById(elem_name+i); - elemall = document.getElementById(elem_name+'all'); - if(elemall.checked == true) { - elem.checked = true; - elem.disabled = true; - } else { - if(start != 'start') { - elem.checked = false; - elem.disabled = false; - } - } - }*/ - } - // run at startup to select all after startup - //check_all('start','b_',4); - <?php - if(isset($exif_count)) - { - // echo "check_all('start','b_exif_',".$exif_count.");"; - } - if(isset($iptc_count)) - { - //echo "check_all('start','b_iptc_',".$iptc_count.");"; - } - ?> - </script> - </div> - + /** + * Exif/Iptc/Xmp Informations + */ + $array = Array('exif','iptc','xmp'); + foreach($array AS $meta_type) + { + if($GLOBALS['linpha']->sql->config->value['sys_image_'.$meta_type]) + { + $MetaData->setFields($meta_type); + $exif_count = $MetaData->defined_fields[$meta_type]; + ?> + <br /><b><?php echo i18n("Search").strtoupper($meta_type); ?></b><br /> + <input type="checkbox" id="b_<?php echo $meta_type; ?>_all" name="button[<?php echo $meta_type; ?>][all]" value="1"<?php echo isset($_REQUEST['b_'.$meta_type.'_all']) ? ' checked' : ''; ?> onClick="check_all('b_<?php echo $meta_type; ?>_all','<?php echo $meta_type; ?>')"><label for="b_<?php echo $meta_type; ?>_all"><b><?php echo i18n("All"); ?></b></label> + <a href="javascript:div_expand('div_<?php echo $meta_type; ?>');"><img border="0" src="<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/expand.gif'; ?>" /></a> + <br /> + <div id="div_<?php echo $meta_type; ?>" style="border: 1px solid black; width: 200px;"> + <?php + for($i=1; list($key,$value) = each($MetaData->defined_fields[$meta_type]); $i++) + { + echo '<input type="checkbox" id="b_'.$meta_type.'_'.$i.'" name="button['.$meta_type.']['.$key.']" value="1"'; + echo isset($_REQUEST['button'][$meta_type][$key]) ? ' checked="checked">' : '>'; + echo '<label for="b_'.$meta_type.'_'.$i.'">'.$value.'</label><br />'; + } + ?> + </div> + <?php + } + } + ?> + <br /> +</div> +<div class="divcolumn"> <!-- select album //--> - <div class="searchcolumn"> - <span class='leftmenulabel'><?php echo i18n("Search In Album"); ?></span><br /> + <b><?php echo i18n("Search In Album"); ?><b><br /> <?php build_album_select($with_all_albs_entry=true); ?> - </div> + <br /><br /> <!-- date --> - <div class="searchcolumn"> - <!-- exif date --> - <span class='leftmenulabel'><?php echo i18n("Date"); ?> - <a class='FromTo' href="javascript:void(0);" onclick="var loginWin = window.open('<?php echo LINPHA_DIR; ?>/actions/calender.php?form=searchform.date_from','Calender','height=250,width=300,scrollbars=no,menubar=no,status=no');" target="_top"><?php echo i18n("From"); ?></a> / - <a class='FromTo' href="javascript:void(0);" onclick="var loginWin = window.open('<?php echo LINPHA_DIR; ?>/actions/calender.php?form=searchform.date_to','Calender','height=250,width=250,scrollbars=no,menubar=no,status=no');" target="_top"><?php echo i18n("To"); ?></a> (Exif) - </span><br /> - - <input type='text' name='date_from[exif]' value='<?php echo @$_REQUEST['date_from']['exif']; ?>' style='width:80'> / - <input type='text' name='date_to[exif]' value='<?php echo @$_REQUEST['date_to']['exif']; ?>' style='width:80'><br /><br /> + <!-- exif date --> + <?php echo i18n("Date"); ?> (EXIF) + <a class="FromTo" href="javascript:void(0);" onclick="var loginWin = window.open('<?php echo LINPHA_DIR; ?>/lib/include/calender.php?form=date_from_exif','Calender','height=250,width=300,scrollbars=no,menubar=no,status=no');" target="_top"><?php echo i18n("From"); ?></a> / + <a class="FromTo" href="javascript:void(0);" onclick="var loginWin = window.open('<?php echo LINPHA_DIR; ?>/lib/include/calender.php?form=date_to_exif','Calender','height=250,width=250,scrollbars=no,menubar=no,status=no');" target="_top"><?php echo i18n("To"); ?></a> + </span><br /> + + <input type="text" id="date_from_exif" name="date_from_exif" value="<?php echo @$_REQUEST['date_from_exif']; ?>" style="width: 80px;"> / + <input type="text" id="date_to_exif" name="date_to_exif" value="<?php echo @$_REQUEST['date_to_exif']; ?>" style="width: 80px;"><br /><br /> - - <?php /** * get date fields @@ -177,11 +138,11 @@ { ?> <span><?php echo $data['name']; ?> - <a href="javascript:void(0);" onclick="var loginWin = window.open('<?php echo LINPHA_DIR; ?>/actions/calender.php?form=searchform.date_from','Calender','height=250,width=300,scrollbars=no,menubar=no,status=no');" target="_top"><?php echo i18n("From"); ?></a> / - <a href="javascript:void(0);" onclick="var loginWin = window.open('<?php echo LINPHA_DIR; ?>/actions/calender.php?form=searchform.date_to','Calender','height=250,width=250,scrollbars=no,menubar=no,status=no');" target="_top"><?php echo i18n("To"); ?></a> + <a href="javascript:void(0);" onclick="var loginWin = window.open('<?php echo LINPHA_DIR; ?>/lib/include/calender.php?form=date_from_<?php echo $data['id']; ?>','Calender','height=250,width=300,scrollbars=no,menubar=no,status=no');" target="_top"><?php echo i18n("From"); ?></a> / + <a href="javascript:void(0);" onclick="var loginWin = window.open('<?php echo LINPHA_DIR; ?>/lib/include/calender.php?form=date_to_<?php echo $data['id']; ?>','Calender','height=250,width=250,scrollbars=no,menubar=no,status=no');" target="_top"><?php echo i18n("To"); ?></a> </span><br /> - <input type='text' name='date_from[<?php echo $data['id']; ?>]' value='<?php echo @$_REQUEST['date_from'][$data['id']]; ?>' style='width:80'> / - <input type='text' name='date_to[<?php echo $data['id']; ?>]' value='<?php echo @$_REQUEST['date_to'][$data['id']]; ?>' style='width:80'><br /><br /> + <input type="text" id="date_from_<?php echo $data['id']; ?>" name="date_from[<?php echo $data['id']; ?>]" value="<?php echo @$_REQUEST['date_from'][$data['id']]; ?>" style="width: 80px;"> / + <input type="text" id="date_to_<?php echo $data['id']; ?>" name="date_to[<?php echo $data['id']; ?>]" value="<?php echo @$_REQUEST['date_to'][$data['id']]; ?>" style="width: 80px;"><br /><br /> <?php } ?> @@ -230,13 +191,20 @@ } ?> - <input type="radio" name="select_and_or[<?php echo $data['id']; ?>]" value="AND"<?php echo $checked_and; ?>><?php echo i18n("AND"); ?> - <input type="radio" name="select_and_or[<?php echo $data['id']; ?>]" value="OR"<?php echo $checked_or; ?>><?php echo i18n("OR"); ?><br /> + <input type="radio" id="select_and[<?php echo $data['id']; ?>]" name="select_and_or[<?php echo $data['id']; ?>]" value="AND"<?php echo $checked_and; ?>><label for="select_and[<?php echo $data['id']; ?>]"><?php echo i18n("AND"); ?></label> + <input type="radio" id="select_or[<?php echo $data['id']; ?>]" name="select_and_or[<?php echo $data['id']; ?>]" value="OR"<?php echo $checked_or; ?>><label for="select_or[<?php echo $data['id']; ?>]"><?php echo i18n("OR"); ?></label><br /> + <select name="select[<?php echo $data['id']; ?>][]" size="5" style="width: 180px;" multiple="multiple"> <?php while($sub_data = $sub_query->FetchRow()) { - echo '<option value="'.$sub_data['id'].'">'.$sub_data['name'].'</option>'; + if(isset($_REQUEST['select'][$data['id']]) && in_array($sub_data['id'],$_REQUEST['select'][$data['id']])) { + $select = ' selected'; + } else { + $select = ''; + } + + echo '<option value="'.$sub_data['id'].'"'.$select.'>'.$sub_data['name'].'</option>'; } ?> </select><br /> @@ -245,14 +213,84 @@ } } ?> - </div> - <div style="clear: both;"></div> <!-- submit //--> <div> - <input type="hidden" name="cmd" value="search"> - <input type="submit" class="button" name="sub" value=" <?php echo i18n("Search"); ?> "> - <a class="button" href="<?php echo LINPHA_DIR; ?>/?cat=search&cmd=new"><?php echo i18n("Reset"); ?></a> + <input type="hidden" name="cmd" value="search" /> + <input type="hidden" name="cat" value="search" /> </div> +</div> +<div style="clear: both;"></div> - </form> \ No newline at end of file + </form> + + </div> + + <div class="roundbottom"> + <img src="<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/bl.gif'; ?>" alt="" width="15" height="15" class="corner" style="display: none" /> + </div> +</div> + +<script language="JavaScript" type="text/javascript"> +function div_expand(tag_id) +{ + if( document.getElementById(tag_id) ) + { + if( document.getElementById(tag_id).style.display != 'none' ) + { + document.getElementById(tag_id).style.display = 'none'; + } + else + { + document.getElementById(tag_id).style.display = ''; + } + } +} + +div_expand('div_exif'); +div_expand('div_iptc'); +div_expand('div_xmp'); + + +function check_all(tag_id,section) +{ + if (!document.getElementsByTagName){ return; } + var checkboxes = document.getElementsByTagName('input'); + + elemall = document.getElementById(tag_id); + + // loop through anchors, find other images in set, and add them to imageArray + for (var i=0; i<checkboxes.length; i++){ + var checkbox = checkboxes[i]; + + var relAttribute = String(checkbox.getAttribute('name')); + + if (checkbox.getAttribute('type') && checkbox.getAttribute('type') == 'checkbox' + && (relAttribute.toLowerCase().match(section)) + && checkbox.getAttribute('id')!=tag_id) // do not disable the 'all' button! + { + if(elemall.checked == true) { + checkbox.checked = true; + checkbox.disabled = true; + } else { + checkbox.checked = false; + checkbox.disabled = false; + } + } + } +} + + +// run at startup to select all after startup +check_all('b_meta_all','meta'); +<?php +if(isset($exif_count)) +{ + // echo "check_all('start','b_exif_',".$exif_count.");"; +} +if(isset($iptc_count)) +{ + //echo "check_all('start','b_iptc_',".$iptc_count.");"; +} +?> +</script> \ No newline at end of file Modified: trunk/linpha2/templates/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/default/view_img.html.php 2006-04-13 11:03:12 UTC (rev 4531) +++ trunk/linpha2/templates/default/view_img.html.php 2006-04-13 13:19:09 UTC (rev 4532) @@ -54,7 +54,18 @@ <input type="submit" name="submit" value="<?php echo i18n("submit"); ?>" /> </form> </div> + <script language="JavaScript" type="text/javascript"> + function open_textarea() + { + document.getElementById('comment_textarea').style.display = 'block'; + document.getElementById('comment_div_text').style.display = 'none'; + + document.getElementById('comment_textarea').value = document.getElementById('comment_input_text').value; + } + </script> + <br /><br /> + <?php } /* end if checkPermission('metadata_comments') */ ?> <!-- show image comments --> <?php while($data = $GLOBALS['linpha']->template->output['image_comments']->FetchRow()) { ?> @@ -66,17 +77,6 @@ </div> <?php } ?> - <script language="JavaScript" type="text/javascript"> - function open_textarea() - { - document.getElementById('comment_textarea').style.display = 'block'; - document.getElementById('comment_div_text').style.display = 'none'; - - document.getElementById('comment_textarea').value = document.getElementById('comment_input_text').value; - } - </script> - <?php } /* end if checkPermission('metadata_comments') */ ?> - <?php } /* end if view!=meta */ ?> </div> Modified: trunk/linpha2/templates/default/view_meta.html.php =================================================================== --- trunk/linpha2/templates/default/view_meta.html.php 2006-04-13 11:03:12 UTC (rev 4531) +++ trunk/linpha2/templates/default/view_meta.html.php 2006-04-13 13:19:09 UTC (rev 4532) @@ -4,6 +4,12 @@ */ ?> +<style> +#mainimage +{ + width: 300px; +} +</style> <a href="<?php echo $GLOBALS['linpha']->template->URL_full.'&view=img'; ?>">Back to normal view</a> <h1><?php i18n("Edit Image Imformation"); ?></h1> <?php Modified: trunk/linpha2/templates/default/view_thumb.html.php =================================================================== --- trunk/linpha2/templates/default/view_thumb.html.php 2006-04-13 11:03:12 UTC (rev 4531) +++ trunk/linpha2/templates/default/view_thumb.html.php 2006-04-13 13:19:09 UTC (rev 4532) @@ -49,12 +49,12 @@ <div id="main"> <?php // javascript disabled - if( ! $GLOBALS['linpha']->imgview->use_javascript) + if( ! $GLOBALS['linpha']->imgview->use_javascript && isset($GLOBALS['linpha']->imgview->photos_show)) { for($i=1; list($key,$value) = each($GLOBALS['linpha']->imgview->photos_show); $i++) { // add clear float to last div on row - if( ($i-1) % $GLOBALS['no_js_nr_cols'] == 0) { + if( ($i-1) % $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrcols'] == 0) { $str_clear = ' clear: left;'; } else { $str_clear = ''; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |