[Linpha-cvs] SF.net SVN: linpha: [4411] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-03-13 22:27:56
|
Revision: 4411 Author: fangehrn Date: 2006-03-13 14:27:31 -0800 (Mon, 13 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4411&view=rev Log Message: ----------- * add image infos Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/image_fields_define.php trunk/linpha2/admin/image_fields_define_post.php trunk/linpha2/admin/image_fields_select.php trunk/linpha2/admin/permissions.php trunk/linpha2/db_data.sql trunk/linpha2/db_mysql.sql trunk/linpha2/lib/classes/linpha.filesys.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.other.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/linpha2.specs.txt trunk/linpha2/templates/main_css/global.css trunk/linpha2/templates/main_css/view_img.css trunk/linpha2/templates/main_html/view_img.html.php trunk/linpha2/templates/main_html/view_meta.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/ChangeLog 2006-03-13 22:27:31 UTC (rev 4411) @@ -1,3 +1,6 @@ +2006-03-13 flo + * add image infos + 2006-03-12 flo * saving exif/iptc infos on image view Modified: trunk/linpha2/admin/image_fields_define.php =================================================================== --- trunk/linpha2/admin/image_fields_define.php 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/admin/image_fields_define.php 2006-03-13 22:27:31 UTC (rev 4411) @@ -61,7 +61,10 @@ </tr> <?php - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type, enabled FROM ".PREFIX."meta_fields WHERE builtin = '1'"); + /** + * get builtin fields + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type, flags FROM ".PREFIX."meta_fields WHERE flags = '5' OR flags = '6' "); while($data = $query->FetchRow()) { echo '<tr><td>'; @@ -70,9 +73,9 @@ echo $GLOBALS['array_field_types'][$data['field_type']]; echo '</td><td>'; - echo '<input type="radio" name="builtin['.$data['id'].']" value="1"'. ( $data['enabled'] ? ' checked="checked"' : '') .' />'; + echo '<input type="radio" name="builtin['.$data['id'].']" value="1"'. ( $data['flags']==5 ? ' checked="checked"' : '') .' />'; echo '</td><td>'; - echo '<input type="radio" name="builtin['.$data['id'].']" value="0"'. ( $data['enabled'] ? '' : ' checked="checked"') .' />'; + echo '<input type="radio" name="builtin['.$data['id'].']" value="0"'. ( $data['flags']==6 ? ' checked="checked"' : '') .' />'; echo '</td></tr>'; } @@ -112,7 +115,10 @@ <br /> <?php - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type, enabled FROM ".PREFIX."meta_fields WHERE builtin = '0'"); + /** + * get own fields + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type, flags FROM ".PREFIX."meta_fields WHERE flags = '7' OR flags = '8'"); if($query->RecordCount()>0) { ?> @@ -140,12 +146,12 @@ <td><?php echo $GLOBALS['array_field_types'][$data['field_type']]; ?></td> <td> <?php - echo '<input type="radio" name="builtin['.$data['id'].']" value="1"'. ( $data['enabled'] ? ' checked="checked"' : '') .' />'; + echo '<input type="radio" name="builtin['.$data['id'].']" value="1"'. ( $data['flags']==7 ? ' checked="checked"' : '') .' />'; ?> </td> <td> <?php - echo '<input type="radio" name="builtin['.$data['id'].']" value="0"'. ( $data['enabled'] ? '' : ' checked="checked"') .' />'; + echo '<input type="radio" name="builtin['.$data['id'].']" value="0"'. ( $data['flags']==8 ? ' checked="checked"' : '') .' />'; ?> </td> <td> Modified: trunk/linpha2/admin/image_fields_define_post.php =================================================================== --- trunk/linpha2/admin/image_fields_define_post.php 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/admin/image_fields_define_post.php 2006-03-13 22:27:31 UTC (rev 4411) @@ -7,20 +7,33 @@ foreach($_POST['builtin'] AS $key=>$value) { - $linpha->db->Execute("UPDATE ".PREFIX."meta_fields SET enabled = '".linSql::linAddslashes($value)."' ". + if($value) { + $flag = 5; + } else { + $flag = 6; + } + + $linpha->db->Execute("UPDATE ".PREFIX."meta_fields SET " . + "flags = '".$flag."' ". "WHERE id = '".linSql::linAddslashes($key)."'"); } break; case 'add_new': - $linpha->db->Execute("INSERT into ".PREFIX."meta_fields (name, field_type, builtin, enabled) " . - "VALUES ('".linSql::linAddslashes($_POST['new_name'])."', '".linSql::linAddslashes($_POST['new_type'])."', '0', '1') "); + $linpha->db->Execute("INSERT into ".PREFIX."meta_fields (name, field_type, flags) " . + "VALUES ('".linSql::linAddslashes($_POST['new_name'])."', '".linSql::linAddslashes($_POST['new_type'])."', '7') "); break; case 'change_field': + if(linSql::linAddslashes($_POST['builtin'][$_POST['id']])) { + $flag = 7; + } else { + $flag = 8; + } + $linpha->db->Execute("UPDATE ".PREFIX."meta_fields SET " . "name = '".linSql::linAddslashes($_POST['new_name'])."', ". - "enabled = '".linSql::linAddslashes($_POST['builtin'][$_POST['id']])."' ". + "flags = '".$flag."' ". "WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); break; case 'delete': Modified: trunk/linpha2/admin/image_fields_select.php =================================================================== --- trunk/linpha2/admin/image_fields_select.php 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/admin/image_fields_select.php 2006-03-13 22:27:31 UTC (rev 4411) @@ -17,7 +17,7 @@ /** * delete all existing entries in database */ - $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_fields WHERE builtin = '10'"); + $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_fields WHERE flags = '10'"); /** * write new entrys @@ -26,7 +26,7 @@ { foreach($_POST['select_image_fields'] AS $value) { - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_fields (name, builtin)" . + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_fields (name, flags)" . " VALUES ('".linSql::linAddslashes($value)."','10')"); } } @@ -53,7 +53,7 @@ Selected fields<br /> <select id="select_image_fields" name="select_image_fields[]" size="25" style="width: 200px;" multiple="multiple"> <?php - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE builtin = '10' ORDER by id"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE flags = '10' ORDER by id"); while($data = $query->FetchRow()) { echo '<option value="'.$data['name'].'">'.$MetaData->getNameOfField($data['name'],true).'</option>'; @@ -77,7 +77,7 @@ <select id="image_fields" name="image_fields" size="7" style="width: 200px;"> <?php $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields " . - "WHERE builtin = '2'"); + "WHERE flags = '1'"); while($data = $query->FetchRow()) { echo '<option value="id_'.$data['id'].'">'.$MetaData->array_special_fields[$data['name']].'</option>'; @@ -95,7 +95,7 @@ <select id="own_fields" name="own_fields" size="7" style="width: 200px;"> <?php $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields " . - "WHERE (builtin = '1' OR builtin = '0') AND enabled = '1'"); + "WHERE flags = '5' OR flags = '7'"); while($data = $query->FetchRow()) { echo '<option value="id_'.$data['id'].'">'.$data['name'].'</option>'; Modified: trunk/linpha2/admin/permissions.php =================================================================== --- trunk/linpha2/admin/permissions.php 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/admin/permissions.php 2006-03-13 22:27:31 UTC (rev 4411) @@ -224,7 +224,7 @@ { global $array_groups; - $array = linFilesys::explodeAndSlice(';',$perm); + $array = explodeAndSlice(';',$perm); $str = ''; foreach($array AS $value) Modified: trunk/linpha2/db_data.sql =================================================================== --- trunk/linpha2/db_data.sql 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/db_data.sql 2006-03-13 22:27:31 UTC (rev 4411) @@ -47,20 +47,20 @@ -- --- Daten f\xFCr Tabelle `linpha_meta_fields` +-- Daten f?r Tabelle `linpha_meta_fields` -- TRUNCATE `linpha_meta_fields`; -INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `builtin`, `enabled`) VALUES (1, 'description', 1, 1, 1); -INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `builtin`, `enabled`) VALUES (2, 'category', 2, 1, 1); -INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `builtin`, `enabled`) VALUES (3, 'persons', 2, 1, 1); -INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `builtin`, `enabled`) VALUES (4, 'date', 3, 1, 1); -INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `builtin`, `enabled`) VALUES (6, 'filename', 0, 2, 0); -INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `builtin`, `enabled`) VALUES (7, 'imagesize', 0, 2, 0); -INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `builtin`, `enabled`) VALUES (8, 'dimension', 0, 2, 0); -INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `builtin`, `enabled`) VALUES ('id_6', 0, 10, 0); -INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `builtin`, `enabled`) VALUES ('id_7', 0, 10, 0); -INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `builtin`, `enabled`) VALUES ('id_8', 0, 10, 0); -INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `builtin`, `enabled`) VALUES ('id_1', 0, 10, 0); -INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `builtin`, `enabled`) VALUES ('id_2', 0, 10, 0); -INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `builtin`, `enabled`) VALUES ('id_3', 0, 10, 0); -INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `builtin`, `enabled`) VALUES ('exif_datetimeoriginal', 0, 10, 0); +INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `flags`) VALUES (1, 'description', 1, 5); +INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `flags`) VALUES (2, 'category', 2, 5); +INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `flags`) VALUES (3, 'persons', 2, 5); +INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `flags`) VALUES (4, 'date', 3, 5); +INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `flags`) VALUES (6, 'filename', 0, 1); +INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `flags`) VALUES (7, 'imagesize', 0, 1); +INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `flags`) VALUES (8, 'dimension', 0, 1); +INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `flags`) VALUES ('id_6', 0, 10); +INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `flags`) VALUES ('id_7', 0, 10); +INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `flags`) VALUES ('id_8', 0, 10); +INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `flags`) VALUES ('id_1', 0, 10); +INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `flags`) VALUES ('id_2', 0, 10); +INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `flags`) VALUES ('id_3', 0, 10); +INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `flags`) VALUES ('exif_datetimeoriginal', 0, 10); Modified: trunk/linpha2/db_mysql.sql =================================================================== --- trunk/linpha2/db_mysql.sql 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/db_mysql.sql 2006-03-13 22:27:31 UTC (rev 4411) @@ -84,8 +84,7 @@ id int(11) NOT NULL auto_increment, name varchar(255) NOT NULL default '', field_type int(11) NOT NULL default '0', - builtin int(11) NOT NULL default '0', - enabled int(11) NOT NULL default '0', + flags int(11) NOT NULL default '0', PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; @@ -148,3 +147,17 @@ `comment` text NOT NULL, PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + + +-- +-- Tabellenstruktur f?r Tabelle `linpha_meta_data` +-- + +DROP TABLE IF EXISTS linpha_meta_data; +CREATE TABLE IF NOT EXISTS linpha_meta_data ( + id int(11) NOT NULL auto_increment, + field_id int(11) NOT NULL default '0', + md5sum varchar(32) NOT NULL default '', + meta_data varchar(255) NOT NULL default '', + PRIMARY KEY (id) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.filesys.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.filesys.class.php 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/lib/classes/linpha.filesys.class.php 2006-03-13 22:27:31 UTC (rev 4411) @@ -157,18 +157,5 @@ return $str; } -/** - * explode string to array and remove first and last entry of array because they are empty - * - * should be moved to "others" - */ -function explodeAndSlice($del,$string) -{ - $array = explode($del,$string); - $array = array_slice($array,1,-1); - - return $array; -} - } // end class linFile ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-13 22:27:31 UTC (rev 4411) @@ -17,8 +17,6 @@ $no_js_nr_rows = 3; $no_js_nr_cols = 4; - - class linImgview { public $view; @@ -94,9 +92,6 @@ case 'meta': $this->view = 'meta_view'; break; - case 'comment': - $this->view = 'comment_view'; - break; default: $this->view = 'thumb_view'; } @@ -294,166 +289,7 @@ } } - - /** - * img_view - */ - /** - * generate output for view "img_view" - */ - function viewImg_view() - { - $GLOBALS['linpha']->template->setModuleName('view_img'); - - /** - * search current key in array - */ - foreach($this->photos_filtered AS $key=>$value) - { - if($value['id'] == $this->id_current) - { - $current_key = $key; - break; - } - } - - /** - * set prev thumbs - */ - $this->output['prev_thumb'] = ''; - for($i=$GLOBALS['nr_prev_next_thumbs']; $i > 0; $i--) - { - if($current_key >= $i) - { - $this->output['prev_thumb'] .= $this->viewImg_viewThumbHtml( $current_key - $i , 'prevnext' ); - } - } - - /** - * set next thumbs - */ - $this->output['next_thumb'] = ''; - for($i=0; $i < $GLOBALS['nr_prev_next_thumbs']; $i++) - { - if($current_key < ( count($this->photos_filtered) - ($i+1) ) ) - { - $this->output['next_thumb'] .= $this->viewImg_viewThumbHtml($current_key + ($i+1) ,'prevnext'); - } - } - - - /** - * set current thumb and image - */ - $this->output['image'] = '<img class="mainimage" src="'.LINPHA_DIR.'/get_thumb.php?id=' - . $this->photos_filtered[$current_key]['id'] . '" />' - . '<br />'.$this->photos_filtered[$current_key]['name']; - - $this->output['current_thumb'] = $this->viewImg_viewThumbHtml( $current_key , 'current' ); - - - - /** - * set navigation line - */ - $this->output['navigation'] .= ' <a href="'.$this->link_url.'&id='.$this->photos_filtered[$current_key]['id'].'">' - .$this->photos_filtered[$current_key]['name'].'</a>'; - - /** - * set image informations - */ - include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - $MetaData = new MetaData(); - $MetaData->setFields('exif'); - $MetaData->setFields('iptc'); - - $array_files = $GLOBALS['linpha']->sql->getFullFilenameFromId( $this->id_current ); - $this->full_filename = $this->album_dir.implode('/',$array_files); - - /** - * read exif and iptc from file - */ - if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) - { - /** - * check if exif information are already in db - * if not, read exif information from file and store it in the db - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum ". - "FROM ".PREFIX."meta_exif WHERE md5sum = '".$this->md5sum."'"); - $num = $query->RecordCount(); - if($num == 0) - { - include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); // used for jpeg comment - include_once(LINPHA_DIR.'/lib/classes/phpmeta/EXIF.php'); - $MetaData->saveExifData(LINPHA_DIR.'/'.$this->full_filename,$this->md5sum); - } - } - - if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) - { - /** - * check if there is already IPTC info in db if not, get IPTC - * information from file and store it in the db - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum ". - "FROM ".PREFIX."meta_iptc WHERE md5sum = '".$this->md5sum."'"); - $num = $query->RecordCount(); - if($num == 0) - { - include_once(LINPHA_DIR.'/lib/classes/phpmeta/Photoshop_IRB.php'); - include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); - $MetaData->saveIptcData(LINPHA_DIR.'/'.$this->full_filename,$this->md5sum); - } - } - - - /** - * read image information from database - */ - $this->output['image_infos'] = ''; - $query = $GLOBALS['linpha']->db->Execute("SELECT name FROM ".PREFIX."meta_fields WHERE builtin = '10' ORDER by id"); - while($data = $query->FetchRow()) - { - $name = $MetaData->getNameOfField( $data['name'], false ); - - $pos = strpos($key,'_'); - $first_part = substr($key,0,$pos); - $last_part = substr($key,$pos+1); - switch($first_part) - { - case 'id': // builtin and own fields and special fields like filename, imagesize and dimension - break; - case 'exif': - break; - case 'iptc': - break; - } - $value = ''; - - $this->output['image_infos'] .= $name.': '.$value.' <br />'; - } - - } - - /** - * generate html code for the prev/next thumbnail - */ - function viewImg_viewThumbHtml($key,$class) - { - $id = $this->photos_filtered[$key]['id']; - $name = $this->photos_filtered[$key]['name']; - - $str = '<div class="div_'.$class.'thumb">' - . '<a href="'.$this->link_url.'&id='.$id.'">' - . '<img class="img_'.$class.'thumb" src="'.LINPHA_DIR.'/get_thumb.php?id='.$id.'" /></a>' - . '<br />'.$name.'</div>'."\n"; - - return $str; - } - -/** * thumb_view */ function viewThumb_View() @@ -691,19 +527,178 @@ } /** - * comment_view + ***** image view */ - function viewComment_view() + + /** + * img_view + */ + function viewImg_view() { - $GLOBALS['linpha']->template->setModuleName('view_comment'); + $GLOBALS['linpha']->template->setModuleName('view_img'); + + $this->viewImgCommon(); + + + $array_files = $GLOBALS['linpha']->sql->getFullFilenameFromId( $this->id_current ); + $this->full_filename = $this->album_dir.implode('/',$array_files); + + /** + * set image informations + */ + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + $MetaData = new MetaData(); + $MetaData->setFields('exif'); + $MetaData->setFields('iptc'); + + /** + * read exif and iptc from file + */ + if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) + { + /** + * check if exif information are already in db + * if not, read exif information from file and store it in the db + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum ". + "FROM ".PREFIX."meta_exif WHERE md5sum = '".$this->md5sum."'"); + $num = $query->RecordCount(); + if($num == 0) + { + include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); // used for jpeg comment + include_once(LINPHA_DIR.'/lib/classes/phpmeta/EXIF.php'); + $MetaData->saveExifData(LINPHA_DIR.'/'.$this->full_filename,$this->md5sum); + } + } + + if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) + { + /** + * check if there is already IPTC info in db if not, get IPTC + * information from file and store it in the db + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum ". + "FROM ".PREFIX."meta_iptc WHERE md5sum = '".$this->md5sum."'"); + $num = $query->RecordCount(); + if($num == 0) + { + include_once(LINPHA_DIR.'/lib/classes/phpmeta/Photoshop_IRB.php'); + include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); + $MetaData->saveIptcData(LINPHA_DIR.'/'.$this->full_filename,$this->md5sum); + } + } + + /** + * read image information from database + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT name FROM ".PREFIX."meta_fields WHERE flags = '10' ORDER by id"); + while($data = $query->FetchRow()) + { + $name = $MetaData->getNameOfField( $data['name'], false ); + + $pos = strpos($data['name'],'_'); + $first_part = substr($data['name'],0,$pos); + $last_part = substr($data['name'],$pos+1); + switch($first_part) + { + case 'id': // builtin and own fields and special fields like filename, imagesize and dimension + break; + case 'exif': + break; + case 'iptc': + break; + } + $value = ''; + + $this->output['image_infos'][$data['name']] = Array('name' => $name, 'value' => $value); + } + } -/** - * meta_view - */ + /** + * generate html code for the prev/next thumbnail + */ + function viewImg_viewThumbHtml($key,$class) + { + $id = $this->photos_filtered[$key]['id']; + $name = $this->photos_filtered[$key]['name']; + + $str = '<div class="div_'.$class.'thumb">' + . '<a href="'.$this->link_url.'&id='.$id.'">' + . '<img class="img_'.$class.'thumb" src="'.LINPHA_DIR.'/get_thumb.php?id='.$id.'" /></a>' + . '<br />'.$name.'</div>'."\n"; + + return $str; + } + + /** + * meta_view + */ function viewMeta_view() { $GLOBALS['linpha']->template->setModuleName('view_meta'); + $GLOBALS['linpha']->template->overrideModule('css','view_img'); // used the same css definitions as view_img + + $this->viewImgCommon(); } + + function viewImgCommon() + { + + /** + * search current key in array + */ + foreach($this->photos_filtered AS $key=>$value) + { + if($value['id'] == $this->id_current) + { + $this->current_key = $key; + break; + } + } + + /** + * set prev thumbs + */ + $this->output['prev_thumb'] = ''; + for($i=$GLOBALS['nr_prev_next_thumbs']; $i > 0; $i--) + { + if($this->current_key >= $i) + { + $this->output['prev_thumb'] .= $this->viewImg_viewThumbHtml( $this->current_key - $i , 'prevnext' ); + } + } + + /** + * set next thumbs + */ + $this->output['next_thumb'] = ''; + for($i=0; $i < $GLOBALS['nr_prev_next_thumbs']; $i++) + { + if($this->current_key < ( count($this->photos_filtered) - ($i+1) ) ) + { + $this->output['next_thumb'] .= $this->viewImg_viewThumbHtml($this->current_key + ($i+1) ,'prevnext'); + } + } + + + /** + * set current thumb and image + */ + $this->output['image'] = '<img class="mainimage" src="'.LINPHA_DIR.'/get_thumb.php?id=' + . $this->photos_filtered[$this->current_key]['id'] . '" />' + . '<br />'.$this->photos_filtered[$this->current_key]['name']; + + $this->output['current_thumb'] = $this->viewImg_viewThumbHtml( $this->current_key , 'current' ); + + + + /** + * set navigation line + */ + $this->output['navigation'] .= ' <a href="'.$this->link_url.'&id='.$this->photos_filtered[$this->current_key]['id'].'">' + .$this->photos_filtered[$this->current_key]['name'].'</a>'; + } + } // end class linImgview ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.other.php =================================================================== --- trunk/linpha2/lib/classes/linpha.other.php 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/lib/classes/linpha.other.php 2006-03-13 22:27:31 UTC (rev 4411) @@ -186,4 +186,17 @@ } } +/** + * explode string to array and remove first and last entry of array because they are empty + * + * should be moved to "others" + */ +function explodeAndSlice($del,$string) +{ + $array = explode($del,$string); + $array = array_slice($array,1,-1); + + return $array; +} + ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-03-13 22:27:31 UTC (rev 4411) @@ -250,7 +250,7 @@ /** * create array with all groups, user is member of */ - $group_member_of = linFilesys::explodeAndSlice(";",$_SESSION["user_groups"]); + $group_member_of = explodeAndSlice(";",$_SESSION["user_groups"]); /** * admin's have permissions for all groups @@ -273,7 +273,7 @@ function photoIsAllowed( $photo_id ) { list($stage,$perm) = linSql::getPerm( $photo_id ); - $array_photo_perm = linFilesys::explodeAndSlice(';',$perm); + $array_photo_perm = explodeAndSlice(';',$perm); foreach($array_photo_perm AS $value) { Modified: trunk/linpha2/linpha2.specs.txt =================================================================== --- trunk/linpha2/linpha2.specs.txt 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/linpha2.specs.txt 2006-03-13 22:27:31 UTC (rev 4411) @@ -115,12 +115,12 @@ linpha_perm_users linpha_perm_groups -linpha_meta_image_desc -linpha_meta_image_comments -linpha_meta_album_comments +linpha_meta_comments linpha_meta_category linpha_meta_exif linpha_meta_iptc +linpha_meta_fields +linpha_meta_data linpha_plugins linpha_plugins_log @@ -167,6 +167,25 @@ gb_* Plugin Guestbook log_* Plugin Logger ... + + +linpha_meta_fields +------------------ + id + name + field_type + 1 => 'text', + 2 => 'select', + 3 => 'date' + flags + 1 => special fields, fields which cannot be filled: filename, imagesize, dimension + 5 => builtin enabled, description, category, persons, date + 6 => builtin disabled, + 7 => own enabled, + 8 => own disabled, + 10 => image fields selected, fields selected in image info + 11 => video fields selected, fields selected in video info + 12 => album fields selected, fields selected in album info Part 11. image infos (exif/iptc/etc.) Modified: trunk/linpha2/templates/main_css/global.css =================================================================== --- trunk/linpha2/templates/main_css/global.css 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/templates/main_css/global.css 2006-03-13 22:27:31 UTC (rev 4411) @@ -4,6 +4,19 @@ margin: 0px; } +a:link { + color: #666666; + text-decoration: underline; +} +a:visited { + color:#666666; + text-decoration: underline; +} +a:hover { + color:#0080D0; + text-decoration: underline; +} + .header { background-color: #ffd5ee; border: 1px solid #f09; @@ -18,10 +31,7 @@ height: 70px; } -/** - * used if .header is position:fixed - */ -.header2 { +.header2 { /* used if .header is position:fixed */ /*margin: 10px; height: 80px;*/ /*visibility: hidden;*/ Modified: trunk/linpha2/templates/main_css/view_img.css =================================================================== --- trunk/linpha2/templates/main_css/view_img.css 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/templates/main_css/view_img.css 2006-03-13 22:27:31 UTC (rev 4411) @@ -1,26 +1,13 @@ - a:link { - color: #666666; - text-decoration: underline; - } - a:visited { - color:#666666; - text-decoration: underline; - } - a:hover { - color:#0080D0; - text-decoration: underline; - } - - .mainimage { - width: 350px; - height: auto; - } - - .main { - text-align: center; - } +.mainimage { + width: 350px; + height: auto; +} +.main { + text-align: center; +} + /** * navigation stuff */ Modified: trunk/linpha2/templates/main_html/view_img.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_img.html.php 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/templates/main_html/view_img.html.php 2006-03-13 22:27:31 UTC (rev 4411) @@ -1,5 +1,10 @@ <div class="left"> - <?php echo $GLOBALS['linpha']->imgview->output['image_infos']; ?> + <?php + foreach($GLOBALS['linpha']->imgview->output['image_infos'] AS $value) + { + echo $value['name'].': '.$value['value'].'<br />'; + } + ?> </div> Modified: trunk/linpha2/templates/main_html/view_meta.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_meta.html.php 2006-03-12 22:57:02 UTC (rev 4410) +++ trunk/linpha2/templates/main_html/view_meta.html.php 2006-03-13 22:27:31 UTC (rev 4411) @@ -0,0 +1,141 @@ +<?php +if(isset($_POST['cmd']) && $_POST['cmd']=='insert_metadata') +{ + if(isset($_POST['field'])) + { + /** + * delete existing entries + */ + $query = $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_data " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); + + foreach($_POST['field'] AS $key=>$value) + { + if(is_array($value)) // coming from a select (categories etc.) + { + $value = ';'.implode(';',$value).';'; + } + + if(! empty($value)) + { + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_data ". + "(field_id, md5sum, meta_data) VALUES " . + "('".linSql::linAddslashes($key)."','".$GLOBALS['linpha']->imgview->md5sum."','".linSql::linAddslashes($value)."')"); + } + } + } +} +?> + +<style> +.main { + margin-left: 10px; + text-align: left; +} + +.navigation { + margin-left: 10px; +} + +.div_all_main { + margin-left: 10px; +} + +.mainimage { + width: 350px; + height: auto; +} + + +</style> + +<div class="navigation"> + <?php echo $GLOBALS['linpha']->imgview->output['navigation']; ?> + <br /><br /> +</div> + + +<div class="div_all_main"> + <div class="div_all_prevthumb"> + <?php echo $GLOBALS['linpha']->imgview->output['prev_thumb']; ?> + </div> + <?php echo $GLOBALS['linpha']->imgview->output['current_thumb']; ?> + <div class="div_all_nextthumb"> + <?php echo $GLOBALS['linpha']->imgview->output['next_thumb']; ?> + </div> +</div> + +<div id='maindiv' class='main'> +<h1>Edit image informations</h1> +<?php +$query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type FROM ".PREFIX."meta_fields " . + "WHERE flags = '5' OR flags = '7' ORDER by id"); +$num = $query->RecordCount(); +?> +<form action="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current; ?>" method="POST"> +<table border='1'> + <tr> + <td width="150"><b>Name</b></td> + <td width="200"><b>Value</b></td> + <td rowspan="<?php echo $num+1; ?>"><?php echo $GLOBALS['linpha']->imgview->output['image']; ?></td> + </tr> + <?php + while($data = $query->FetchRow()) + { + ?> + <tr> + <td><?php echo $data['name']; ?></td> + <td> + <?php + $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data FROM ".PREFIX."meta_data " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'" . + "AND field_id = '".$data['id']."'"); + + switch($data['field_type']) + { + case 1: + case 3: + if(isset($meta_data['meta_data'])) { + $value = $meta_data['meta_data']; + } else { + $value = ''; + } + echo '<input type="text" name="field['.$data['id'].']" value="'.$value.'" style="width: 200px;" maxlength="255"/>'; + break; + case 2: + if(isset($meta_data['meta_data'])) { + $array_pieces = explodeAndSlice(';',$meta_data['meta_data']); + } else { + $array_pieces = Array(); + } + ?> + <select name="field[<?php echo $data['id']; ?>][]" multiple="multiple" style="width: 200px;"> + <?php + $cat_query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_category " . + "WHERE field_id = '".$data['id']."'"); + while($cat_data = $cat_query->FetchRow()) + { + if(in_array($cat_data['id'],$array_pieces)) { + $checked = ' selected="selected"'; + } else { + $checked = ''; + } + + echo '<option value="'.$cat_data['id'].'"'.$checked.'>'.$cat_data['name'].'</option>'."\n"; + } + ?> + </select> + <?php + break; + } + ?> + </td> + </tr> + <?php + } + ?> +</table> +<input type="hidden" name="cmd" value="insert_metadata" /> +<input type="submit" name="submit" value="submit" /> +</form> +</div> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |