[Linpha-cvs] SF.net SVN: linpha: [4546] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-04-24 20:09:10
|
Revision: 4546 Author: fangehrn Date: 2006-04-24 13:08:47 -0700 (Mon, 24 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4546&view=rev Log Message: ----------- * created import/index/create thumbnail/re-create-scripts in admin-import section Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/import.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/lib/modules/module.search.php trunk/linpha2/templates/default/search.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-18 11:18:37 UTC (rev 4545) +++ trunk/linpha2/ChangeLog 2006-04-24 20:08:47 UTC (rev 4546) @@ -1,3 +1,6 @@ +2006-04-24 flo + * created import/index/create thumbnail/re-create-scripts in admin-import section + 2006-04-18 flo * calendar: apply previous update from linpha1 + change "set date" field also automatically to custom if using the calendar Modified: trunk/linpha2/admin/import.php =================================================================== --- trunk/linpha2/admin/import.php 2006-04-18 11:18:37 UTC (rev 4545) +++ trunk/linpha2/admin/import.php 2006-04-24 20:08:47 UTC (rev 4546) @@ -1,41 +1,334 @@ <?php if(!defined('LINPHA_DIR')) { exit(1); } -include_once(LINPHA_DIR.'/lib/adodb/tohtml.inc.php'); +$array_meta = Array('exif','iptc','xmp'); -//linImport::emptyTable(); +if( isset($_POST['cmd']) && $_POST['cmd']=='import') +{ + if(!isset($_REQUEST['album_select']) OR $_REQUEST['album_select'][0]=='all') + { + $all_albums = true; + } + else + { + $all_albums = false; + } -if($linpha->sql->config->value['sys_import_autoimport']) + + /** + * import + */ + if($_REQUEST['index_import']=='index') + { + echo i18n("Running Import...").'<br />'; + if($all_albums) + { + echo i18n("Parsing All Directories...").'<br />'; + LinImport::updateDir( $parent_id = 0, $recursive = true, $dryrun = false ); + } + else + { + foreach($_REQUEST['album_select'] AS $key=>$value) + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); + echo i18n("Parsing Directory:").' '.$data['name'].'<br />'; + LinImport::updateDir( $parent_id = $value, $recursive = true, $dryrun = false ); + } + } + + if( isset($GLOBALS['linpha']->template->output['sys_log']) ) + { + echo $GLOBALS['linpha']->template->output['sys_log']; + unset($GLOBALS['linpha']->template->output['sys_log']); + } + + echo '<br />'; + } + + /** + * thumbnails + */ + /** + * @todo should we create the folder thumbnails here? + * they will be automatically created on each visit + * we would have to take care to the script backwards, + * that means first of the depest subfolder until we're on top + */ + if($_REQUEST['index_thumbnails']!='no') + { + echo i18n("Creating Thumbnails...").'<br />'; + + $thumbnail = new LinImage(); + + if($_REQUEST['index_thumbnails']=='recreate') + { + $_GET['force'] = true; + } + + if($all_albums) + { + echo i18n("Parsing All Directories...").'<br />'; + echo i18n("Create Thumbnail"); + + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); + while($data = $query->FetchRow(ADODB_FETCH_NUM)) + { + if( ! $thumbnail->createThumbnail($data[0]) ) + { + echo "Error while creating thumbnail!<br />Error: ".$thumbnail->error_msg."<br />"; + } + if( ! $thumbnail->isCached ) + { + echo " ".$data[0].","; + } + flush(); + } + + } + else + { + foreach($_REQUEST['album_select'] AS $key=>$value) + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); + echo i18n("Parsing Directory:").' '.$data['name'].'<br />'; + echo i18n("Create Thumbnail"); + + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE " . + "parent_id = '".LinSql::linAddslashes($value)."' AND " . + "img_type <> 0 AND img_type <> 9999999"); + while($data = $query->FetchRow(ADODB_FETCH_NUM)) + { + if( ! $thumbnail->createThumbnail($data[0]) ) + { + echo "Error while creating thumbnail!<br />Error: ".$thumbnail->error_msg."<br />"; + } + if( ! $thumbnail->isCached ) + { + echo " ".$data[0].","; + } + flush(); + } + } + } + + echo '<br /><br />'; + } + + + /** + * exif, iptc, xmp + */ + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + $MetaData = new MetaData(); + + foreach($array_meta AS $meta_value) + { + if( isset( $_REQUEST['index_'.$meta_value] ) ) + { + echo i18n("Indexing Files...").' ('.strtoupper($meta_value).')<br />'; + + /** + * get imgids to indexing, if reindex is selected: delete these entries first + */ + if($all_albums) + { + echo i18n("Parsing All Directories...").'<br />'; + + $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); + while($data = $query->FetchRow()) + { + if( $_REQUEST['index_'.$meta_value] != 'no') + { + $array_meta_ids[$data['id']] = $data['md5sum']; + } + + if( isset($_REQUEST['index_'.$meta_value.'_delete'])) + { + $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_".$meta_value." WHERE md5sum = '".$data['md5sum']."'"); + } + } + + } + else + { + foreach($_REQUEST['album_select'] AS $key=>$value) + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); + echo i18n("Parsing Directory:").' '.$data['name'].'<br />'; + + $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".PREFIX."photos WHERE " . + "parent_id = '".LinSql::linAddslashes($value)."' AND " . + "img_type <> 0 AND img_type <> 9999999"); + while($data = $query->FetchRow(ADODB_FETCH_NUM)) + { + if( $_REQUEST['index_'.$meta_value] != 'no') + { + $array_meta_ids[$data['id']] = $data['md5sum']; + } + + if( isset($_REQUEST['index_'.$meta_value.'_delete'])) + { + $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_".$meta_value." WHERE md5sum = '".$data['md5sum']."'"); + } + } + } + } + + /** + * parse all ids + */ + if(isset($array_meta_ids)) + { + $MetaData->setFields($meta_value); + + echo i18n("Index Image"); + + foreach($array_meta_ids AS $id=>$md5sum) + { + $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum ". + "FROM ".PREFIX."meta_exif WHERE md5sum = '".$md5sum."'"); + + if( $query->EOF) // not a single value returned + { + $full_filename = LinSql::getFullImagePath($id); + + switch($meta_value) + { + case 'exif': + include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); // used for jpeg comment + include_once(LINPHA_DIR.'/lib/classes/phpmeta/EXIF.php'); + $MetaData->saveExifData( $full_filename,$md5sum ); + break; + case 'iptc': + include_once(LINPHA_DIR.'/lib/classes/phpmeta/Photoshop_IRB.php'); + include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); + $MetaData->saveIptcData( $full_filename,$md5sum ); + break; + case 'xmp': + break; + } + + echo " ".$id.","; + flush(); + } + } + } + + echo '<br />'; + } + unset($array_meta_ids); + } +} + + +echo '<h2>'.i18n("Import").'</h2>'; +echo i18n("Select Folders For Import/Update:"); +?> +<br /> +<form action="./?cat=import" method="POST"> +<select name="album_select[]" size="10" multiple="multiple" style="width: 500px;"> +<?php buildAlbumSelect($with_all_albs_entry=true); ?> +</select> +<br /><br /> + +<?php echo i18n("Import").':'; ?> +<br /> +<input type="radio" id="index_import_no" name="index_import" value="no" /><label for="index_import_no"> <?php echo i18n("No Import"); ?></label><br /> +<input type="radio" id="index_import_index" name="index_import" value="index" checked="checked" /><label for="index_import_index"> <?php echo i18n("Import"); ?></label><br /> +<br /> + +<?php echo i18n("Thumbnails").':'; ?> +<br /> +<input type="radio" id="index_thumbnails_deletefirstreindex" name="index_thumbnails" value="recreate" /><label for="index_thumbnails_reindex"> <?php echo i18n("Re-create"); ?></label><br /> +<input type="radio" id="index_thumbnails_no" name="index_thumbnails" value="no" /><label for="index_thumbnails_no"> <?php echo i18n("No Create"); ?></label><br /> +<input type="radio" id="index_thumbnails_index" name="index_thumbnails" value="create" checked="checked" /><label for="index_thumbnails_index"> <?php echo i18n("Create"); ?></label><br /> +<br /> + +<?php +foreach($array_meta AS $value) { - LinImport::updateDir( $parent_id = 0, $recursive = true ); + if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) + { + echo strtoupper($value).":<br />"; + echo '<input type="checkbox" id="index_'.$value.'_deletefirst" name="index_'.$value.'_delete" value="delete" /><label for="index_'.$value.'_deletefirst"> '.i18n("Delete First").'</label><br />'; + echo '<input type="radio" id="index_'.$value.'_no" name="index_'.$value.'" value="no" /><label for="index_'.$value.'_no"> '.i18n("No indexing").'</label><br />'; + echo '<input type="radio" id="index_'.$value.'_index" name="index_'.$value.'" value="index" checked="checked" /><label for="index_'.$value.'_index"> '.i18n("Indexing").'</label><br />'; + echo '<br />'; + } } +?> +<input type="hidden" name="cmd" value="import"> +<input type="submit" name="submit" value="<?php echo i18n("Start"); ?>" /> +</form> +<br /><br /> +<?php + + /** - * create thumbnails + * dry-run */ +echo '<h2>'.i18n("Stuff Not Up-To-Date").'</h2>'; - $thumbnail = new LinImage(); +/** + * import + */ + if($linpha->sql->config->value['sys_import_autoimport']) + { + LinImport::updateDir( $parent_id = 0, $recursive = true, $dryrun = true ); + } /** - * first, only for images + * flush buffer */ + echo '<b>'.i18n("Following files/folders needs updating:").'</b><br />'; + if( isset($GLOBALS['linpha']->template->output['sys_log']) ) + { + echo $GLOBALS['linpha']->template->output['sys_log']; + unset($GLOBALS['linpha']->template->output['sys_log']); + } + else + { + echo i18n("Nothing, we're up-to-date!").'<br />'; + } + + echo '<br />'; + +/** + * thumbnails + */ + $thumbnail = new LinImage(); + + $num = 0; $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); while($data = $query->FetchRow(ADODB_FETCH_NUM)) { - if( ! $thumbnail->createThumbnail($data['0']) ) + + $thumbnail->mode = 'thumb'; + $thumbnail->photo_id = $data[0]; + + $thumbnail->setFileInformation(); + + if( ! $thumbnail->isCached ) { - echo "Error while creating thumbnail!<br />Error: ".$thumbnail->error_msg."<br />"; + $num++; } } + echo '<b>'.i18n("Nr Thumbnails To Create:").' '.$num.'<br />'; - /** - * @todo should we create the folder thumbnails here? - * they will be automatically created on each visit - * we would have to take care to the script backwards, - * that means first of the depest subfolder until we're on top - */ - +/** + * exif, iptc, xmp + */ + $nr_total = $GLOBALS['linpha']->db->GetRow("SELECT sum(stats_numbers) FROM ".PREFIX."photos WHERE parent_id = '0' GROUP BY parent_id"); + foreach($array_meta AS $value) + { + if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) + { + $nr_indexed = $GLOBALS['linpha']->db->GetRow("SELECT count(md5sum) FROM ".PREFIX."meta_".$value); + echo strtoupper($value).': '.i18n("Nr Images Needs Indexing:").' ' . ($nr_total[0] - $nr_indexed[0]) .' <br />'; + } + } ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-04-18 11:18:37 UTC (rev 4545) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-04-24 20:08:47 UTC (rev 4546) @@ -223,6 +223,7 @@ return $str; } + /** * linpha syslog window, shows up system info like "images added" */ @@ -236,7 +237,48 @@ $GLOBALS['linpha']->template->output['sys_log'] .= $str; } +/** + * functions to create a html select form with all albums + */ +function buildAlbumSelect($with_all_albs_entry) +{ + ?> + + <?php + if($with_all_albs_entry) + { + if(!isset($_REQUEST['album_select']) OR $_REQUEST['album_select'][0]=='all') { + $select = ' selected'; + $_REQUEST['album_select'] = Array('all'=>'all'); + } else { + $select = ''; + } + echo '<option value="all"'.$select.'>'.i18n("All Albums").'</option>'."\n"; + } + + buildAlbumSelectSubEntry(0,''); +} +function buildAlbumSelectSubEntry($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()) + { + if(!isset($_REQUEST['album_select'])) { + $_REQUEST['album_select'] = array(); + } + if(in_array($data['id'],$_REQUEST['album_select'])) { + $select = ' selected'; + } else { + $select = ''; + } + echo '<option value="'.$data['id'].'"'.$select.'>'.$text.'/'.htmlspecialchars($data['name'],ENT_QUOTES).'</option>'."\n"; + + buildAlbumSelectSubEntry($data['id'],$text.'/'.htmlspecialchars($data['name'],ENT_QUOTES)); + } +} + + /** * returns the Operating System used * used to enable/disable OS related features Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-04-18 11:18:37 UTC (rev 4545) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-04-24 20:08:47 UTC (rev 4546) @@ -30,10 +30,11 @@ public $error_msg; public $output_file; -private $photo_id, $cached_id; -private $img_type; -private $mode; -private $image_tool; +public $photo_id, $cached_id; +public $isCached; +public $img_type; +public $mode; +public $image_tool; private $src_file; private $org_width, $org_height, $img_width, $img_height; Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-18 11:18:37 UTC (rev 4545) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-24 20:08:47 UTC (rev 4546) @@ -851,10 +851,16 @@ */ for($i = $min_year; $i <= $max_year; $i++) { - $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) FROM ".PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); - if($data[0]>0) + /** + * exclude all wrong/empty/... dates + */ + if($i > 1900) { - $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_DIR.'/?cat=browse&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; + $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) FROM ".PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); + if($data[0]>0) + { + $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_DIR.'/?cat=browse&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; + } } } } @@ -1094,7 +1100,7 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum ". "FROM ".PREFIX."meta_exif WHERE md5sum = '".$this->md5sum."'"); - if( $query->EOF) // not a sigle value returned + if( $query->EOF) // not a single value returned { include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); // used for jpeg comment include_once(LINPHA_DIR.'/lib/classes/phpmeta/EXIF.php'); @@ -1111,7 +1117,7 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum ". "FROM ".PREFIX."meta_iptc WHERE md5sum = '".$this->md5sum."'"); - if( $query->EOF) // not a sigle value returned + if( $query->EOF) // not a single value returned { include_once(LINPHA_DIR.'/lib/classes/phpmeta/Photoshop_IRB.php'); include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-04-18 11:18:37 UTC (rev 4545) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-04-24 20:08:47 UTC (rev 4546) @@ -31,12 +31,10 @@ * if recursive, all sub directories are checked too! * @param int $parent_id Parent id of directory in database * @param bool $recursive scan directory recursive if true + * @param bool $dryrun do actually nothing, just report */ -function updateDir($parent_id, $recursive) +function updateDir($parent_id, $recursive, $dryrun) { - /** - * try/catch include errors (PHP5 exceptions)! - */ try { if($parent_id == 0) @@ -90,7 +88,15 @@ */ foreach($array_delete AS $key=>$value) { - LinImport::deleteEntry( $key, $dirname.'/'.$value); + if($dryrun) + { + linSysLog("Delete Entry: ".$dirname.'/'.$value."<br />"); + $deleted_keys[] = $key; + } + else + { + LinImport::deleteEntry( $key, $dirname.'/'.$value); + } } /** @@ -98,13 +104,22 @@ */ foreach($array_new AS $value) { - LinImport::addNewEntry( $parent_id , $dirname , $value, $recursive ); + if($dryrun) + { + linSysLog("New Entry: ".$dirname.'/'.$value."<br />"); + } + else + { + LinImport::addNewEntry( $parent_id , $dirname , $value, $recursive ); + } + } /** - * parse updated entries, not by default! (performance issues) + * "detect file changes", parse updated entries + * not by default! (performance issues) */ - if(isset($force_update) OR isset($_GET['force_update'])) + if( isset($_GET['force_update']) ) { foreach($array_update AS $key=>$value) { @@ -122,7 +137,14 @@ "AND parent_id = '".$parent_id."'"); while($data = $query->FetchRow(ADODB_FETCH_NUM)) { - LinImport::updateDir($data['0'], $recursive); + /** + * on dryrun, the delete process isn't done completley + * so it would appear here again, prevent this! + */ + if( !isset($deleted_keys) OR !in_array($data['0'],$deleted_keys) ) + { + LinImport::updateDir($data['0'], $recursive, $dryrun); + } } } } Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-18 11:18:37 UTC (rev 4545) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-24 20:08:47 UTC (rev 4546) @@ -306,10 +306,13 @@ /** * set isAdmin */ - $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".PREFIX."groups WHERE group_name = 'admin'"); - if(in_array($data['id'],$_SESSION['user_groups'])) + if(isset($_SESSION['user_groups']) && is_array($_SESSION['user_groups'])) { - $this->isAdmin = true; + $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".PREFIX."groups WHERE group_name = 'admin'"); + if(in_array($data['id'],$_SESSION['user_groups'])) + { + $this->isAdmin = true; + } } } } @@ -587,6 +590,9 @@ return $array_names; } +/** + * extends getFullFilenameFromId with album path and implode for direct use in file operations + */ function getFullImagePath( $photo_id ) { $array_path = $GLOBALS['linpha']->sql->getFullFilenameFromId( $photo_id ); Modified: trunk/linpha2/lib/modules/module.albums.php =================================================================== --- trunk/linpha2/lib/modules/module.albums.php 2006-04-18 11:18:37 UTC (rev 4545) +++ trunk/linpha2/lib/modules/module.albums.php 2006-04-24 20:08:47 UTC (rev 4546) @@ -62,7 +62,7 @@ */ if( $linpha->sql->config->value['sys_import_autoimport'] && $linpha->imgview->img_type == 0) { - LinImport::updateDir( $linpha->imgview->id_current, $recursive = false ); + LinImport::updateDir( $linpha->imgview->id_current, $recursive = false, $dryrun = false ); } /** Modified: trunk/linpha2/lib/modules/module.browse.php =================================================================== --- trunk/linpha2/lib/modules/module.browse.php 2006-04-18 11:18:37 UTC (rev 4545) +++ trunk/linpha2/lib/modules/module.browse.php 2006-04-24 20:08:47 UTC (rev 4546) @@ -88,19 +88,25 @@ */ for($i = $min_year; $i <= $max_year; $i++) { - $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) FROM ".PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); - if($data[0]>0) + /** + * exclude all wrong/empty/... dates + */ + if($i > 1900) { - if(isset($_GET['year']) && $i == $_GET['year']) + $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) FROM ".PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); + if($data[0]>0) { - $str_datelinks .= $i.' ('.$data[0].'), '; + if(isset($_GET['year']) && $i == $_GET['year']) + { + $str_datelinks .= $i.' ('.$data[0].'), '; + } + else + { + $str_datelinks .= '<a href="'.$url_base.'&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; + } + + $sum += $data[0]; } - else - { - $str_datelinks .= '<a href="'.$url_base.'&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; - } - - $sum += $data[0]; } } Modified: trunk/linpha2/lib/modules/module.search.php =================================================================== --- trunk/linpha2/lib/modules/module.search.php 2006-04-18 11:18:37 UTC (rev 4545) +++ trunk/linpha2/lib/modules/module.search.php 2006-04-24 20:08:47 UTC (rev 4546) @@ -467,46 +467,4 @@ include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); } - -function build_album_select($with_all_albs_entry) -{ - ?> - <select name="album_select[]" size="10" multiple="multiple" style="overflow: scroll; width: 200px;"> - <?php - if($with_all_albs_entry) - { - if(!isset($_REQUEST['album_select']) OR $_REQUEST['album_select']=='all') { - $select = ' selected'; - $_REQUEST['album_select'] = Array('all'=>'all'); - } else { - $select = ''; - } - echo '<option value="all"'.$select.'>'.i18n("All Albums").'</option>'."\n"; - } - - 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,$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()) - { - if(!isset($_REQUEST['album_select'])) { - $_REQUEST['album_select'] = array(); - } - if(in_array($data['id'],$_REQUEST['album_select'])) { - $select = ' selected'; - } else { - $select = ''; - } - echo '<option value="'.$data['id'].'"'.$select.'>'.$text.'/'.htmlspecialchars($data['name'],ENT_QUOTES).'</option>'."\n"; - - build_album_select_sub_entry($data['id'],$text.'/'.htmlspecialchars($data['name'],ENT_QUOTES)); - } -} ?> \ No newline at end of file Modified: trunk/linpha2/templates/default/search.html.php =================================================================== --- trunk/linpha2/templates/default/search.html.php 2006-04-18 11:18:37 UTC (rev 4545) +++ trunk/linpha2/templates/default/search.html.php 2006-04-24 20:08:47 UTC (rev 4546) @@ -116,7 +116,10 @@ <div class="divcolumn"> <!-- select album //--> <b><?php echo i18n("Search In Album"); ?><b><br /> - <?php build_album_select($with_all_albs_entry=true); ?> + <select name="album_select[]" size="10" multiple="multiple" style="width: 200px;"> + <?php buildAlbumSelect($with_all_albs_entry=true); ?> + </select><br /> + <font size="-2">(<?php echo i18n("Multiple Select Use 'Ctrl'"); ?>)</font> <br /><br /> <!-- date --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |