Thread: [Linpha-cvs] SF.net SVN: linpha: [4380] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-03-04 08:01:25
|
Revision: 4380 Author: fangehrn Date: 2006-03-04 00:01:16 -0800 (Sat, 04 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4380&view=rev Log Message: ----------- removing .cvsignore Removed Paths: ------------- trunk/linpha2/.cvsignore trunk/linpha2/albums/.cvsignore Property Changed: ---------------- trunk/linpha2/ Property changes on: trunk/linpha2 ___________________________________________________________________ Name: svn:ignore - .project var project.index + .project project.index Deleted: trunk/linpha2/.cvsignore =================================================================== --- trunk/linpha2/.cvsignore 2006-03-04 07:44:30 UTC (rev 4379) +++ trunk/linpha2/.cvsignore 2006-03-04 08:01:16 UTC (rev 4380) @@ -1,3 +0,0 @@ -.project -var -project.index \ No newline at end of file Deleted: trunk/linpha2/albums/.cvsignore =================================================================== --- trunk/linpha2/albums/.cvsignore 2006-03-04 07:44:30 UTC (rev 4379) +++ trunk/linpha2/albums/.cvsignore 2006-03-04 08:01:16 UTC (rev 4380) @@ -1,3 +0,0 @@ -20* -test* -alb* \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-04 10:41:27
|
Revision: 4392 Author: fangehrn Date: 2006-03-04 02:41:04 -0800 (Sat, 04 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4392&view=rev Log Message: ----------- * working on basket Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.other.php trunk/linpha2/templates/main_html/global.html.php trunk/linpha2/templates/main_html/view_basket.html.php trunk/linpha2/templates/main_html/view_thumb.head.php Removed Paths: ------------- trunk/linpha2/templates/main_html/view_img.head.php trunk/linpha2/templates/main_html/view_thumbdetail.head.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-04 08:52:22 UTC (rev 4391) +++ trunk/linpha2/ChangeLog 2006-03-04 10:41:04 UTC (rev 4392) @@ -1,4 +1,9 @@ + 2006-03-04 flo + * fixed some double declarations in installer + * working on basket + +2006-03-04 flo * testing svn deleted linpha1 from svn (it is still available on older revisions) maybe we want to delete the linpha1 tags also.. Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-03-04 08:52:22 UTC (rev 4391) +++ trunk/linpha2/index.php 2006-03-04 10:41:04 UTC (rev 4392) @@ -20,8 +20,8 @@ case 'alb': include_once(LINPHA_DIR.'/lib/module.albums.php'); break; -case 'img': - include_once(LINPHA_DIR.'/lib/module.image.php'); +case 'search': + include_once(LINPHA_DIR.'/lib/module.search.php'); break; } Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2006-03-04 08:52:22 UTC (rev 4391) +++ trunk/linpha2/lib/classes/linpha.class.php 2006-03-04 10:41:04 UTC (rev 4392) @@ -41,6 +41,7 @@ } include_once(LINPHA_DIR.'/lib/classes/linpha.sql.class.php'); +include_once(LINPHA_DIR.'/lib/classes/linpha.template_new.class.php'); include_once(LINPHA_DIR.'/lib/classes/linpha.image.class.php'); include_once(LINPHA_DIR.'/lib/classes/linpha.filesys.class.php'); @@ -50,11 +51,12 @@ class linpha { - public $db, $sql; + public $db, $sql, $template; function __construct() { $this->sql = new linSql(); + $this->template = new linTemplate(); } } // end class linpha Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-04 08:52:22 UTC (rev 4391) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-04 10:41:04 UTC (rev 4392) @@ -31,7 +31,6 @@ public $id_current; public $id_parent; private $album_dir; -private $head,$body; private $nr_pages, $current_page; // only used if javascript disabled /** @@ -148,7 +147,7 @@ $this->viewBasket_view(); } - include_once(LINPHA_DIR.'/templates/global.html.php'); + include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'_html/global.html.php'); } /** @@ -173,7 +172,7 @@ } /** - * create top menu + * create optional top menu */ function setMenu() { @@ -210,18 +209,15 @@ $GLOBALS['output']['menu_optional'] = Array( 'basket' => Array( - 'add all to basket (of this page)' => '#', - 'add all to basket (of all pages)' => '#', + 'add all to basket' => '#', 'switch to basket view' => $this->link_url.'&id='.$this->id_current.'&view=basket', 'open basket' => '#' ), - 'thumb' => Array( - 'size' => $array_tn_sizes_links, - 'nr' => $array_nr_links - ), 'view' => Array( 'sort' => $array_sort_orders_links, - 'view' => $array_views_links + 'view' => $array_views_links, + 'thumb_size' => $array_tn_sizes_links, + 'thumb_nr' => $array_nr_links ), 'edit' => Array( 'set_permissions' => LINPHA_DIR.'/admin/permissions.php?&cmd=edit&id='.$this->id_current @@ -247,20 +243,17 @@ ); break; case 'basket_view': - $GLOBALS['output']['menu_optional'] = Array( - 'open basket' => '#', - 'add selected to basket' => '#', - 'edit' => Array( - 'rot_left' => '#', - 'rot_right' => '#', - 'set_permissions' => LINPHA_DIR.'/admin/permissions.php?&cmd=edit&id='.$this->id_current - ) + $GLOBALS['output']['menu_sub'] = Array( + 'back to normal view' => $this->link_url.'&id='.$this->id_current.'&view=thumb', + 'open basket' => '#' ); break; } } } + + /** * img_view */ @@ -269,8 +262,7 @@ */ function viewImg_view() { - $this->head = 'imgview.head.php'; - $this->body = 'imgview.html.php'; + $GLOBALS['linpha']->template->setModuleName('view_img'); /** * search current key in array @@ -347,8 +339,7 @@ */ function viewThumb_View() { - $this->head = 'thumbview.head.php'; - $this->body = 'thumbview.html.php'; + $GLOBALS['linpha']->template->setModuleName('view_thumb'); $this->setSubFolders(); @@ -541,8 +532,7 @@ */ function viewThumbdetail_view() { - $this->head = 'thumbview_detail.head.php'; - $this->body = 'thumbview_detail.html.php'; + $GLOBALS['linpha']->template->setModuleName('view_thumbdetail'); $this->setRandomImages(); } @@ -574,8 +564,8 @@ */ function viewBasket_view() { - $this->head = 'thumbview.head.php'; - $this->body = 'view_basket.html.php'; + $GLOBALS['linpha']->template->setModuleName('view_basket'); + $GLOBALS['linpha']->template->overrideModule('css','view_thumb'); // used the same css definitions as view_thumb $this->setSubFolders(); $this->viewThumb_View_nojs(); Modified: trunk/linpha2/lib/classes/linpha.other.php =================================================================== --- trunk/linpha2/lib/classes/linpha.other.php 2006-03-04 08:52:22 UTC (rev 4391) +++ trunk/linpha2/lib/classes/linpha.other.php 2006-03-04 10:41:04 UTC (rev 4392) @@ -79,8 +79,23 @@ </div> <?php } + + if( isset( $GLOBALS['output']['menu_sub'] ) ) + { + printSubMenu(); + } } +function printSubMenu() +{ + echo '</div>'; + echo '<div">Basket: '; + foreach($GLOBALS['output']['menu_sub'] AS $key=>$value) + { + echo '<a href="'.$value.'">'.$key.'</a> '; + } +} + function printMenuEntry($index) { foreach($GLOBALS['output'][$index] AS $key=>$value) Modified: trunk/linpha2/templates/main_html/global.html.php =================================================================== --- trunk/linpha2/templates/main_html/global.html.php 2006-03-04 08:52:22 UTC (rev 4391) +++ trunk/linpha2/templates/main_html/global.html.php 2006-03-04 10:41:04 UTC (rev 4392) @@ -1,160 +1,6 @@ <html> <head> -<style type="text/css"> -<!-- - body { - font-family: arial, helvetica, sans-serif; - margin: 0px; - } - - .header { - background-color: #ffd5ee; - border: 1px solid #f09; - /*position: fixed; - top: 10px; - left: 10px; - right: 10px;*/ - margin: 10px; - z-index: 400; - padding: 5px; - - height: 70px; - } - - /** - * used if .header is position:fixed - */ - .header2 { - /*margin: 10px; - height: 80px;*/ - /*visibility: hidden;*/ - } - - .left { - position: absolute; - top: 100px; - left: 10px; - - width: 205px; - min-height: 400px; - - - padding: 5px; - margin: 0px; - - background-color: #ffd5ee; - - border: 1px solid #f09; - } - - .navigation { - background-color: #d5fcf4; - padding: 0; - border: 1px solid #0c9; - margin: 10px 10px 10px 237px; - } - - .main { - background-color: #d5eeff; - padding: 5px; - border: 1px solid #09f; - margin: 10px 10px 10px 237px; - } - - -/** - * menu - * view http://www.tanfa.co.uk/css/examples/menu/tutorial-h.asp - * the nicest one! - */ - #menu { - width: 100%; - float: left; - } - - #menu ul { - list-style: none; - margin: 0; - padding: 0; - width: 7em; - float: left; - } - - /** - * all elements - */ - #menu a, #menu span { - display: block; - border-width: 1px; - border-style: solid; - border-color: #ccc #888 #555 #bbb; - margin: 0; - padding: 2px 3px; - color: #fff; - background: #036; - text-decoration: none; - } - - /** - * only first level elements - */ - #menu ul a, #menu ul span { - text-align: center; - } - - /** - * only two or more level elements - */ - #menu ul ul a, #menu ul ul span { - text-align: left; - } - - #menu a:hover, #menu span:hover { - color: #fff; - background: #369; - } - - #menu li { - position: relative; - } - - #menu ul ul { - position: absolute; - z-index: 500; - font-size: 0.8em; - width: auto; - min-width: 7em; - white-space: nowrap; - } - - #menu ul ul ul { - position: absolute; - top: 0; - left: 100%; - } - - div#menu ul ul { - display: none; - } - - div#menu ul ul, - div#menu ul li:hover ul ul, - div#menu ul ul li:hover ul ul - {display: none;} - - div#menu ul li:hover ul, - div#menu ul ul li:hover ul, - div#menu ul ul ul li:hover ul - {display: block;} - - #menu_switch a { - width: 1em; - float: left; - } ---> -</style> - - +<link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'_css/global.css'; ?>' type='text/css'> <?php if( isset($output['sys_log'])) { ?> <style> .sys_log { @@ -183,10 +29,8 @@ } </style> <?php } ?> - - -<?php include_once( LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->imgview->head ); ?> - +<link rel='stylesheet' href='<?php $GLOBALS['linpha']->template->includeFile('css'); ?>' type='text/css'> +<?php $GLOBALS['linpha']->template->includeFile('head'); ?> </head> <body> @@ -239,6 +83,6 @@ left<br />left<br />left<br />left<br />left<br />left<br /> </div> -<?php include_once( LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->imgview->body ); ?> +<?php $GLOBALS['linpha']->template->includeFile('body'); ?> </body> </html> \ No newline at end of file Modified: trunk/linpha2/templates/main_html/view_basket.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_basket.html.php 2006-03-04 08:52:22 UTC (rev 4391) +++ trunk/linpha2/templates/main_html/view_basket.html.php 2006-03-04 10:41:04 UTC (rev 4392) @@ -11,6 +11,7 @@ <br /><br /> </div> +<form name='basket' action='#' method='POST'> <div id='maindiv' class='main'> <?php $i = 1; @@ -21,21 +22,84 @@ */ if( ($i-1) % $GLOBALS['no_js_nr_cols'] == 0) { - $str_clear = ' clear: left;'; + echo "<div style='height: ".$GLOBALS['def_tn_size']."px; clear: left;' class='imgdiv'>"; + echo "<a href='javascript:void(0)' onclick='check_from_to(".$i.",".($i+$GLOBALS['no_js_nr_cols']-1).")'>Check row</a>"; + echo "</div>"; } - else - { - $str_clear = ''; - } - $i++; ?> - <div style='width: <?php echo $GLOBALS['def_tn_size']; ?>px; height: <?php echo $GLOBALS['def_tn_size']; ?>px; <?php echo $str_clear; ?>' class='imgdiv'> - <a href='./?cat=alb&id=<?php echo $value['id']; ?>'><img height='<?php echo ($GLOBALS['def_tn_size']-20); ?>' src='./get_thumb.php?id=<?php echo $value['id']; ?>' class='img_thumbnail' /></a> + <div style='width: <?php echo $GLOBALS['def_tn_size']; ?>px; height: <?php echo $GLOBALS['def_tn_size']; ?>px;' class='imgdiv'> + <a href='javascript:void(0)' onclick='update_checkbox(<?php echo $i; ?>)'><img height='<?php echo ($GLOBALS['def_tn_size']-20); ?>' src='./get_thumb.php?id=<?php echo $value['id']; ?>' class='img_thumbnail' /></a> <br /> - <input type="checkbox" /> + <input type='checkbox' id='<?php echo $i; ?>' name='img_id[]' value='<?php echo $value['id']; ?>'> <?php echo $value['name']; ?> </div> + <?php + $i++; } ?> + <div style="clear: left;"></div> + <br /><br /> + <input type='button' name='button_check_all' value='check all' onClick='this.value=check_all()'> + <input type='submit' value='add to basket'> + <script language="JavaScript" type='text/javascript'> + var checkflag = 0; + function check_all() { + if (checkflag == 0) // check all + { + checkflag = 1; + var return_value = "remove selection"; + } + else // clear all + { + checkflag = 0; + var return_value = "check all"; + } + + for (var i = 0; i < document.forms[0].length; i++) + { + elem = document.forms[0].elements[i]; + if (elem.type == "checkbox") { + elem.checked = checkflag; + } + } + return return_value; + } + + function update_checkbox(elem_id) + { + elem = document.getElementById(elem_id); + if(elem.checked==true) + { + elem.checked = false; + } + else + { + elem.checked = true; + } + } + + function check_from_to(i_start,i_end) + { + var do_what; + elem = document.getElementById(i_start); + if(elem.checked==true) + { + do_what = false; + } + else + { + do_what = true; + } + + for(var i = i_start; i <= i_end; i++) + { + if(document.getElementById(i)) // don't run out of index on last line + { + document.getElementById(i).checked = do_what; + } + } + } + </script> + </div> \ No newline at end of file Deleted: trunk/linpha2/templates/main_html/view_img.head.php =================================================================== --- trunk/linpha2/templates/main_html/view_img.head.php 2006-03-04 08:52:22 UTC (rev 4391) +++ trunk/linpha2/templates/main_html/view_img.head.php 2006-03-04 10:41:04 UTC (rev 4392) @@ -1,83 +0,0 @@ -<style type="text/css"> - - 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; - } - - -/** - * navigation stuff - */ - .div_all_main { - position: relative; - - background-color: #d5fcf4; - border: 1px solid #0c9; - margin: 10px 10px 10px 237px; - height: 120px; - - text-align: center; - font-size: 0.5em; - - } - - .div_all_prevthumb { - position: absolute; - right: 50%; - margin-right: 50px; - } - - .div_all_nextthumb { - position: absolute; - left: 50%; - margin-left: 50px; - } - - .div_prevnextthumb { - /*border: 1px solid #000000;*/ - float: left; - width: 90px; - height: 90px; - margin: 2px; - } - - .div_currentthumb { - /*border: 1px solid #000000;*/ - position: absolute; - left: 50%; - margin: 2px; - - width: 80px; - margin-left: -40px; /* should be the half of 'width' */ - height: 80px; - } - - .img_prevnextthumb { - width: 75px; - height: auto; - border: 0px; - } - .img_currentthumb { - width: 50px; - height: auto; - border: 0px; - } -</style> \ No newline at end of file Modified: trunk/linpha2/templates/main_html/view_thumb.head.php =================================================================== --- trunk/linpha2/templates/main_html/view_thumb.head.php 2006-03-04 08:52:22 UTC (rev 4391) +++ trunk/linpha2/templates/main_html/view_thumb.head.php 2006-03-04 10:41:04 UTC (rev 4392) @@ -1,58 +1,12 @@ -<style type="text/css"> - -/** - * need this to calculate heigh of main div - * if you're gettings scrollbars, adjust the height! - */ -.spacer_height { - height: 220px; - position: absolute; - visibility: hidden; -} - -.imgdiv { - border: 1px #000000 solid; - margin: 3px; - text-align: center; - float: left; -} - -.img_thumbnail { - border: 0; - width: auto; -} - -.page_nr_main { - position: absolute; - right: 12px; - top: 100px; - width: 600px; -} -.page_nr { - float: right; - border: 1px #000000 solid; - margin: 5px;; - padding: 10px; - height: 25px; - width: 40px; - white-space: nowrap; -} - -.main { - height: 500px; -} - -</style> - <?php if($GLOBALS['linpha']->imgview->use_javascript) { ?> - <script language="JavaScript" type="text/javascript"> - var tot_photos = <?php echo $GLOBALS['linpha']->imgview->tot_photos; ?>; - var startup_page = 1; - var link_get_thumb = '<?php echo LINPHA_DIR.'/get_thumb.php?id='; ?>'; - var link_url = '<?php echo $GLOBALS['linpha']->imgview->link_url; ?>'; - var tn_size = <?php echo $GLOBALS['def_tn_size']; ?>; - var photos_per_page = 'auto'; - <?php echo $GLOBALS['linpha']->imgview->output['files_db']."\n"; ?> - </script> - <script type="text/javascript" language="javascript" src="<?php echo LINPHA_DIR; ?>/lib/classes/thumbnails.js"> </script> +<script language="JavaScript" type="text/javascript"> +var tot_photos = <?php echo $GLOBALS['linpha']->imgview->tot_photos; ?>; +var startup_page = 1; +var link_get_thumb = '<?php echo LINPHA_DIR.'/get_thumb.php?id='; ?>'; +var link_url = '<?php echo $GLOBALS['linpha']->imgview->link_url; ?>'; +var tn_size = <?php echo $GLOBALS['def_tn_size']; ?>; +var photos_per_page = 'auto'; +<?php echo $GLOBALS['linpha']->imgview->output['files_db']."\n"; ?> +</script> +<script type="text/javascript" language="javascript" src="<?php echo LINPHA_DIR; ?>/lib/classes/thumbnails.js"> </script> <?php } ?> \ No newline at end of file Deleted: trunk/linpha2/templates/main_html/view_thumbdetail.head.php =================================================================== --- trunk/linpha2/templates/main_html/view_thumbdetail.head.php 2006-03-04 08:52:22 UTC (rev 4391) +++ trunk/linpha2/templates/main_html/view_thumbdetail.head.php 2006-03-04 10:41:04 UTC (rev 4392) @@ -1,65 +0,0 @@ -<style type="text/css"> - -h1 { - font-size: 18pt; - font-family: Verdana, Arial, Helvetica, sans-serif; -} - -h2 { - font-size: 14pt; - font-family: Verdana, Arial, Helvetica, sans-serif; - margin-top: 2px; - margin-bottom: 7px; -} - -hr { - clear: both; -} - -.div_random { - height: 200px; -} - -.div_random_img { - float: left; - margin-left: 40px; -} - -.img_random_thumbnail { - border: 0; - - max-width: 130px; - max-height: 130px; -} - -.div_folder { - position: relative; - margin: 2px; - margin-left: 15px; - margin-bottom: 15px; - padding: 5px; - - height: 151px; - width: 700px; - - background-color: #d5fcf4; - border: 1px solid #0c9; -} - -.div_folder_text { - margin-left: 180px; - height: 140px; - padding: 5px; -} - -.img_folder_thumbnail { - position: absolute; - top: 15px; - left: 20px; - - width: 130px; - height: auto; - - border: 0; -} -</style> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-04 13:19:11
|
Revision: 4395 Author: fangehrn Date: 2006-03-04 05:18:41 -0800 (Sat, 04 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4395&view=rev Log Message: ----------- * implemented basic basket functions Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.other.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/templates/main_html/view_basket.html.php Added Paths: ----------- trunk/linpha2/lib/modules/module.basket.php trunk/linpha2/templates/main_css/basket.css trunk/linpha2/templates/main_css/global.css trunk/linpha2/templates/main_css/view_basket.css trunk/linpha2/templates/main_css/view_img.css trunk/linpha2/templates/main_css/view_thumb.css trunk/linpha2/templates/main_css/view_thumbdetail.css trunk/linpha2/templates/main_html/basket.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-04 10:43:35 UTC (rev 4394) +++ trunk/linpha2/ChangeLog 2006-03-04 13:18:41 UTC (rev 4395) @@ -1,7 +1,7 @@ 2006-03-04 flo * fixed some double declarations in installer - * working on basket + * implemented basic basket functions 2006-03-04 flo * testing svn Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-03-04 10:43:35 UTC (rev 4394) +++ trunk/linpha2/index.php 2006-03-04 13:18:41 UTC (rev 4395) @@ -3,26 +3,41 @@ include_once(LINPHA_DIR.'/lib/include/common.php'); -if(!isset($_GET['cat'])) -{ - $_GET['cat'] = 'alb'; -} +/** + * some init stuff + * @todo where to place? + */ + if(!isset($_GET['cat'])) + { + $_GET['cat'] = 'alb'; + } + if( ! isset( $_SESSION['basket_ids'] ) ) + { + $_SESSION['basket_ids'] = Array(); + } + + $output['menu_main'] = Array( + 'home' => LINPHA_DIR . '/', + 'admin' => '#', /*LINPHA_DIR . '/?cat=admin'*/ + 'search' => '#', /*LINPHA_DIR . '/?cat=search'*/ + 'login' => '#' /*LINPHA_DIR . '/?cat=login'*/ + ); -$output['menu_main'] = Array( - 'home' => LINPHA_DIR . '/', - 'admin' => '#', /*LINPHA_DIR . '/?cat=admin'*/ - 'search' => '#', /*LINPHA_DIR . '/?cat=search'*/ - 'login' => '#' /*LINPHA_DIR . '/?cat=login'*/ -); +/** + * open modules + */ switch($_GET['cat']) { case 'alb': - include_once(LINPHA_DIR.'/lib/module.albums.php'); + include_once(LINPHA_DIR.'/lib/modules/module.albums.php'); break; case 'search': - include_once(LINPHA_DIR.'/lib/module.search.php'); + include_once(LINPHA_DIR.'/lib/modules/module.search.php'); break; +case 'basket': + include_once(LINPHA_DIR.'/lib/modules/module.basket.php'); + break; } ?> \ 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-04 10:43:35 UTC (rev 4394) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-04 13:18:41 UTC (rev 4395) @@ -6,7 +6,7 @@ * config stuff * @todo ... */ -$show_subfolders_separate = 1; +$show_subfolders_separate = 0; $nr_prev_next_thumbs = 3; $nr_random_images = 4; $array_tn_sizes = Array(50,75,100,150,200,250,300,400,500); @@ -182,12 +182,15 @@ if($this->id_current != 0) { /** - * for double used menu entry 'view' + * more than one time used stuff */ foreach($GLOBALS['array_sort_orders'] AS $value) { $array_sort_orders_links[$value] = $this->link_url.'&id='.$this->id_current.'&order_by='.$value; } + + $open_basket_link = LINPHA_DIR.'?cat=basket&ref_id='.$this->id_current; + $edit_permission_link = LINPHA_DIR.'/admin/permissions.php?&cmd=edit&id='.$this->id_current; switch($this->view) { @@ -209,9 +212,10 @@ $GLOBALS['output']['menu_optional'] = Array( 'basket' => Array( - 'add all to basket' => '#', + 'add all to basket' => $open_basket_link.'&cmd=add_all', 'switch to basket view' => $this->link_url.'&id='.$this->id_current.'&view=basket', - 'open basket' => '#' + 'open basket' => $open_basket_link, + 'in basket: '.count($_SESSION['basket_ids']) => '#' ), 'view' => Array( 'sort' => $array_sort_orders_links, @@ -220,7 +224,7 @@ 'thumb_nr' => $array_nr_links ), 'edit' => Array( - 'set_permissions' => LINPHA_DIR.'/admin/permissions.php?&cmd=edit&id='.$this->id_current + 'set_permissions' => $edit_permission_link ) ); break; @@ -230,7 +234,8 @@ 'basket' => Array( 'add to basket' => '#', 'switch to basket view' => '#', - 'open basket' => '#' + 'open basket' => $open_basket_link, + 'in basket: '.count($_SESSION['basket_ids']) => '#' ), 'view' => Array( 'sort' => $array_sort_orders_links @@ -238,14 +243,13 @@ 'edit' => Array( 'rot_left' => '#', 'rot_right' => '#', - 'set_permissions' => LINPHA_DIR.'/admin/permissions.php?&cmd=edit&id='.$this->id_current + 'set_permissions' => $edit_permission_link ) ); break; case 'basket_view': $GLOBALS['output']['menu_sub'] = Array( - 'back to normal view' => $this->link_url.'&id='.$this->id_current.'&view=thumb', - 'open basket' => '#' + 'back to normal view' => $this->link_url.'&id='.$this->id_current.'&view=thumb' ); break; } @@ -511,9 +515,9 @@ function setSubFolders() { $this->output['folders'] = ''; + $nr_folders = 0; if($GLOBALS['show_subfolders_separate']) { - $nr_folders = 0; foreach($this->photos_filtered AS $key=>$value) { if($value['img_type'] == 0) Modified: trunk/linpha2/lib/classes/linpha.other.php =================================================================== --- trunk/linpha2/lib/classes/linpha.other.php 2006-03-04 10:43:35 UTC (rev 4394) +++ trunk/linpha2/lib/classes/linpha.other.php 2006-03-04 13:18:41 UTC (rev 4395) @@ -143,7 +143,23 @@ } } +function set_navigation_line( $id ) +{ + $array_files = $GLOBALS['linpha']->sql->getFullFilenameFromId( $id ); + $str = '<a href="'.LINPHA_DIR.'/?cat=alb&id=0">top</a> / '; + foreach($array_files AS $key=>$value) + { + if($value != "") + { + $str .= '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$key.'">'.$value.'</a> / '; + } + } + + return $str; +} + + function linSysLog($str) { if( ! isset( $GLOBALS['output']['sys_log'] ) ) Modified: trunk/linpha2/lib/modules/module.albums.php =================================================================== --- trunk/linpha2/lib/modules/module.albums.php 2006-03-04 10:43:35 UTC (rev 4394) +++ trunk/linpha2/lib/modules/module.albums.php 2006-03-04 13:18:41 UTC (rev 4395) @@ -35,16 +35,7 @@ /** * set navigation line */ - $array_files = $GLOBALS['linpha']->sql->getFullFilenameFromId( $linpha->imgview->id_parent ); - $linpha->imgview->output['navigation'] = '<a href="'.LINPHA_DIR.'/?cat=alb&id=0">top</a> / '; - - foreach($array_files AS $key=>$value) - { - if($value != "") - { - $linpha->imgview->output['navigation'] .= '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$key.'">'.$value.'</a> / '; - } - } + $linpha->imgview->output['navigation'] = set_navigation_line( $linpha->imgview->id_parent ); /** Added: trunk/linpha2/lib/modules/module.basket.php =================================================================== --- trunk/linpha2/lib/modules/module.basket.php (rev 0) +++ trunk/linpha2/lib/modules/module.basket.php 2006-03-04 13:18:41 UTC (rev 4395) @@ -0,0 +1,101 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +/** + * init + */ + include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); + $linpha = new linpha(); + $linpha->sql->startSession(); + +/** + * parse POST data and GET commands + */ + /** + * parse GET commands + */ + if( isset( $_GET['cmd'] ) ) + { + switch($_GET['cmd']) + { + + /** + * add all + */ + case 'add_all': + + if( isset( $_GET['ref_id'] ) ) + { + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE img_type <> '0' AND parent_id = '".linSql::linAddslashes($_GET['ref_id'])."'"); + while($data = $query->FetchRow()) + { + if($GLOBALS['linpha']->sql->photoIsAllowed($data[0])) + { + $_SESSION['basket_ids'][] = $data[0]; + } + } + $ref_id = $_GET['ref_id']; + } + else + { + $ref_id = 0; + } + + Header("Location: ".LINPHA_DIR."/?cat=alb&id=".$ref_id."&ref=imgids_added"); + exit(); + + + /** + * add ids to session if allowed + */ + case 'add_selected': + + if( isset( $_POST['img_id'] ) ) + { + foreach($_POST['img_id'] AS $value) + { + if($GLOBALS['linpha']->sql->photoIsAllowed($value)) + { + $_SESSION['basket_ids'][] = $value; + } + } + } + Header("Location: ".LINPHA_DIR."/?cat=alb&id=".$_GET['ref_id']."&ref=imgids_added"); + exit(); + + /** + * remove all + */ + case 'remove_all': + $_SESSION['basket_ids'] = Array(); + break; + + /** + * remove selected + */ + case 'remove_selected': + + if( isset( $_POST['img_id'] ) ) + { + foreach($_POST['img_id'] AS $value) + { + $key = array_search($value, $_SESSION['basket_ids']); + unset($_SESSION['basket_ids'][$key]); + } + } + + break; + } + } + + +/** + * build basket view + */ + + + +$linpha->template->setModuleName('basket'); +$linpha->template->UrlFull = LINPHA_DIR.'/?cat=basket&ref_id='.$_GET['ref_id']; +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'_html/global.html.php'); +?> \ No newline at end of file Added: trunk/linpha2/templates/main_css/basket.css =================================================================== --- trunk/linpha2/templates/main_css/basket.css (rev 0) +++ trunk/linpha2/templates/main_css/basket.css 2006-03-04 13:18:41 UTC (rev 4395) @@ -0,0 +1,14 @@ +.imgdiv { + border: 1px #000000 solid; + margin: 3px; + text-align: center; + float: left; + width: 150px; + height: 150px; +} + +.img_thumbnail { + border: 0; + width: auto; + height: 130px; +} \ No newline at end of file Added: trunk/linpha2/templates/main_css/global.css =================================================================== --- trunk/linpha2/templates/main_css/global.css (rev 0) +++ trunk/linpha2/templates/main_css/global.css 2006-03-04 13:18:41 UTC (rev 4395) @@ -0,0 +1,152 @@ +<!-- +body { + font-family: arial, helvetica, sans-serif; + margin: 0px; +} + +.header { + background-color: #ffd5ee; + border: 1px solid #f09; + /*position: fixed; + top: 10px; + left: 10px; + right: 10px;*/ + margin: 10px; + z-index: 400; + padding: 5px; + + height: 70px; +} + +/** + * used if .header is position:fixed + */ +.header2 { + /*margin: 10px; + height: 80px;*/ + /*visibility: hidden;*/ +} + +.left { + position: absolute; + top: 100px; + left: 10px; + + width: 205px; + min-height: 400px; + + + padding: 5px; + margin: 0px; + + background-color: #ffd5ee; + + border: 1px solid #f09; +} + +.navigation { + background-color: #d5fcf4; + padding: 0; + border: 1px solid #0c9; + margin: 10px 10px 10px 237px; +} + +.main { + background-color: #d5eeff; + padding: 5px; + border: 1px solid #09f; + margin: 10px 10px 10px 237px; +} + + +/** + * menu + * view http://www.tanfa.co.uk/css/examples/menu/tutorial-h.asp + * the nicest one! + */ + #menu { + width: 100%; + float: left; + } + + #menu ul { + list-style: none; + margin: 0; + padding: 0; + width: 7em; + float: left; + white-space: nowrap; + } + + /** + * all elements + */ + #menu a, #menu span { + display: block; + border-width: 1px; + border-style: solid; + border-color: #ccc #888 #555 #bbb; + margin: 0; + padding: 2px 3px; + color: #fff; + background: #036; + text-decoration: none; + } + + /** + * only first level elements + */ + #menu ul a, #menu ul span { + text-align: center; + } + + /** + * only two or more level elements + */ + #menu ul ul a, #menu ul ul span { + text-align: left; + } + + #menu a:hover, #menu span:hover { + color: #fff; + background: #369; + } + + #menu li { + position: relative; + } + + #menu ul ul { + position: absolute; + z-index: 500; + font-size: 0.8em; + width: auto; + min-width: 7em; +/* white-space: nowrap;*/ + } + + #menu ul ul ul { + position: absolute; + top: 0; + left: 100%; + } + + div#menu ul ul { + display: none; + } + + div#menu ul ul, + div#menu ul li:hover ul ul, + div#menu ul ul li:hover ul ul + {display: none;} + + div#menu ul li:hover ul, + div#menu ul ul li:hover ul, + div#menu ul ul ul li:hover ul + {display: block;} + + #menu_switch a { + width: 1em; + float: left; + } +--> \ No newline at end of file Added: trunk/linpha2/templates/main_css/view_basket.css =================================================================== Added: trunk/linpha2/templates/main_css/view_img.css =================================================================== --- trunk/linpha2/templates/main_css/view_img.css (rev 0) +++ trunk/linpha2/templates/main_css/view_img.css 2006-03-04 13:18:41 UTC (rev 4395) @@ -0,0 +1,80 @@ + 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; + } + + +/** + * navigation stuff + */ + .div_all_main { + position: relative; + + background-color: #d5fcf4; + border: 1px solid #0c9; + margin: 10px 10px 10px 237px; + height: 120px; + + text-align: center; + font-size: 0.5em; + + } + + .div_all_prevthumb { + position: absolute; + right: 50%; + margin-right: 50px; + } + + .div_all_nextthumb { + position: absolute; + left: 50%; + margin-left: 50px; + } + + .div_prevnextthumb { + /*border: 1px solid #000000;*/ + float: left; + width: 90px; + height: 90px; + margin: 2px; + } + + .div_currentthumb { + /*border: 1px solid #000000;*/ + position: absolute; + left: 50%; + margin: 2px; + + width: 80px; + margin-left: -40px; /* should be the half of 'width' */ + height: 80px; + } + + .img_prevnextthumb { + width: 75px; + height: auto; + border: 0px; + } + .img_currentthumb { + width: 50px; + height: auto; + border: 0px; + } \ No newline at end of file Added: trunk/linpha2/templates/main_css/view_thumb.css =================================================================== --- trunk/linpha2/templates/main_css/view_thumb.css (rev 0) +++ trunk/linpha2/templates/main_css/view_thumb.css 2006-03-04 13:18:41 UTC (rev 4395) @@ -0,0 +1,41 @@ +/** + * need this to calculate heigh of main div + * if you're gettings scrollbars, adjust the height! + */ +.spacer_height { + height: 220px; + position: absolute; + visibility: hidden; +} + +.imgdiv { + border: 1px #000000 solid; + margin: 3px; + text-align: center; + float: left; +} + +.img_thumbnail { + border: 0; + width: auto; +} + +.page_nr_main { + position: absolute; + right: 12px; + top: 100px; + width: 600px; +} +.page_nr { + float: right; + border: 1px #000000 solid; + margin: 5px;; + padding: 10px; + height: 25px; + width: 40px; + white-space: nowrap; +} + +.main { + min-height: 500px; /* @todo floated divs in thumb view without javascript doesnt count to the main div height */ +} \ No newline at end of file Added: trunk/linpha2/templates/main_css/view_thumbdetail.css =================================================================== --- trunk/linpha2/templates/main_css/view_thumbdetail.css (rev 0) +++ trunk/linpha2/templates/main_css/view_thumbdetail.css 2006-03-04 13:18:41 UTC (rev 4395) @@ -0,0 +1,62 @@ +h1 { + font-size: 18pt; + font-family: Verdana, Arial, Helvetica, sans-serif; +} + +h2 { + font-size: 14pt; + font-family: Verdana, Arial, Helvetica, sans-serif; + margin-top: 2px; + margin-bottom: 7px; +} + +hr { + clear: both; +} + +.div_random { + height: 200px; +} + +.div_random_img { + float: left; + margin-left: 40px; +} + +.img_random_thumbnail { + border: 0; + + max-width: 130px; + max-height: 130px; +} + +.div_folder { + position: relative; + margin: 2px; + margin-left: 15px; + margin-bottom: 15px; + padding: 5px; + + height: 151px; + width: 700px; + + background-color: #d5fcf4; + border: 1px solid #0c9; +} + +.div_folder_text { + margin-left: 180px; + height: 140px; + padding: 5px; +} + +.img_folder_thumbnail { + position: absolute; + top: 15px; + left: 20px; + + width: 130px; + height: auto; + + border: 0; +} \ No newline at end of file Added: trunk/linpha2/templates/main_html/basket.html.php =================================================================== --- trunk/linpha2/templates/main_html/basket.html.php (rev 0) +++ trunk/linpha2/templates/main_html/basket.html.php 2006-03-04 13:18:41 UTC (rev 4395) @@ -0,0 +1,97 @@ + +<form name="basket" action="<?php echo $GLOBALS['linpha']->template->UrlFull; ?>&cmd=remove_selected" method="POST"> +<div class='navigation'> +<a href="<?php echo LINPHA_DIR.'/?cat=alb&id='.$_GET['ref_id']; ?>">Go back</a> +<a href="<?php echo $GLOBALS['linpha']->template->UrlFull; ?>&cmd=remove_all">Remove all</a> +<input type="submit" name="submit" value="remove selected" /> +<br /><br /> +Images in basket: <?php echo count($_SESSION['basket_ids']); ?> +</div> + +<div id='maindiv' class='main'> + +<?php if( count($_SESSION['basket_ids']) > 0 ) { ?> + + +<?php + + /** + * get and save parent ids + */ + sort($_SESSION['basket_ids']); + foreach($_SESSION['basket_ids'] AS $value) + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT parent_id FROM ".PREFIX."photos WHERE id = '". linSql::linAddslashes($value)."'" ); + $array_folder_ids[] = $data[0]; + + $array_folders[$data[0]][] = $value; // store all imgids in an array with parent_id as the key + } + + $array_folder_ids = array_unique($array_folder_ids); + + + + foreach($array_folder_ids AS $value) + { + echo set_navigation_line($value).'<br />'; + + $i = 1; + foreach($array_folders[$value] AS $sub_value) + { + ?> + <div class='imgdiv'> + <a href='javascript:void(0)' onclick='update_checkbox(<?php echo $i; ?>)'><img src='<?php echo LINPHA_DIR.'/get_thumb.php?id='.$sub_value; ?>' class='img_thumbnail' /></a> + <br /> + <input type='checkbox' id='<?php echo $i; ?>' name='img_id[]' value='<?php echo $sub_value; ?>'> + </div> + <?php + $i++; + } + + echo '<div style="clear: both;"></div><br /><br />'; + } + + + + + + + /* + echo '<pre>'; + print_r($_SESSION['basket_ids']); + + + foreach($array_path_ids AS $value) + { + print_r(linSql::getFullFilenameFromId($value)); + } + + echo '</pre>';*/ +?> + + + <script language="JavaScript" type='text/javascript'> + function update_checkbox(elem_id) + { + elem = document.getElementById(elem_id); + if(elem.checked==true) + { + elem.checked = false; + } + else + { + elem.checked = true; + } + } + </script> + + + + +<?php } else { ?> + + Basket is empty + +<?php } ?> +</div> +</form> \ No newline at end of file Modified: trunk/linpha2/templates/main_html/view_basket.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_basket.html.php 2006-03-04 10:43:35 UTC (rev 4394) +++ trunk/linpha2/templates/main_html/view_basket.html.php 2006-03-04 13:18:41 UTC (rev 4395) @@ -9,9 +9,11 @@ <div class="navigation"> <?php echo $GLOBALS['linpha']->imgview->output['navigation']; ?> <br /><br /> + Images in basket: <?php echo count($_SESSION['basket_ids']); ?> + (<a href="<?php echo LINPHA_DIR.'?cat=basket&ref_id='.$GLOBALS['linpha']->imgview->id_current; ?>">open basket</a>) </div> -<form name='basket' action='#' method='POST'> +<form name='basket' action='<?php echo LINPHA_DIR.'/?cat=basket&cmd=add_selected&ref_id='.$GLOBALS['linpha']->imgview->id_current; ?>' method='POST'> <div id='maindiv' class='main'> <?php $i = 1; @@ -40,8 +42,9 @@ ?> <div style="clear: left;"></div> <br /><br /> - <input type='button' name='button_check_all' value='check all' onClick='this.value=check_all()'> + <input type='button' name='button_check_all' value='check all of this page' onClick='this.value=check_all()'> <input type='submit' value='add to basket'> + <a href="<?php echo LINPHA_DIR.'?cat=basket&ref_id='.$GLOBALS['linpha']->imgview->id_current.'&cmd=add_all'; ?>">add all of this folder to basket</a> <script language="JavaScript" type='text/javascript'> var checkflag = 0; function check_all() { @@ -53,7 +56,7 @@ else // clear all { checkflag = 0; - var return_value = "check all"; + var return_value = "check all of this page"; } for (var i = 0; i < document.forms[0].length; i++) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-04 18:50:49
|
Revision: 4396 Author: fangehrn Date: 2006-03-04 10:50:34 -0800 (Sat, 04 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4396&view=rev Log Message: ----------- * admin/image.php thats how it should look like but no idea how to do (not yet.. ;-) ) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/templates/main_css/view_thumb.css trunk/linpha2/templates/main_html/view_basket.html.php Added Paths: ----------- trunk/linpha2/admin/image.php trunk/linpha2/lib/modules/module.admin.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-04 13:18:41 UTC (rev 4395) +++ trunk/linpha2/ChangeLog 2006-03-04 18:50:34 UTC (rev 4396) @@ -2,6 +2,10 @@ 2006-03-04 flo * fixed some double declarations in installer * implemented basic basket functions + * admin/image.php + thats how it should look like + but no idea how to do + (not yet.. ;-) ) 2006-03-04 flo * testing svn Added: trunk/linpha2/admin/image.php =================================================================== --- trunk/linpha2/admin/image.php (rev 0) +++ trunk/linpha2/admin/image.php 2006-03-04 18:50:34 UTC (rev 4396) @@ -0,0 +1,78 @@ +<div align="center"> +<table border="0"> + <tr> + <td valign="top" rowspan="3" align="center"> + Current selection<br /> + <select name="image_fields" size="30" style="width: 200px;"> + <option value=""></option> + <option value=""></option> + <option value=""></option> + <option value=""></option> + </select> + <br /> + <input type="button" name="shift_up" value="^" /> + <input type="button" name="shift_down" value="v" /> + <input type="button" name="remove" value=">" /> + </td> + <td> + <input type="button" name="builtin_shiftleft" value="<" /> + </td> + <td> + Builtin fields<br /> + <select name="builtin_fields" size="10" style="width: 200px;"> + <option value=""></option> + <option value=""></option> + <option value=""></option> + <option value=""></option> + </select> + </td> + </tr> + <tr> + <td> + <input type="button" name="exif_shiftleft" value="<" /> + </td> + <td> + Exif fields<br /> + <select name="exif_fields" size="10" style="width: 200px;"> + <option value=""></option> + <option value=""></option> + <option value=""></option> + <option value=""></option> + </select> + </td> + </tr> + <tr> + <td> + <input type="button" name="iptc_shiftleft" value="<" /> + </td> + <td> + IPTC fields<br /> + <select name="iptc_fields" size="10" style="width: 200px;"> + <option value=""></option> + <option value=""></option> + <option value=""></option> + <option value=""></option> + </select> + </td> + </tr> + <tr> + <td> + <input type="text" name="title" value="" /><br /> + <input type="button" name="add_title" value="add title" /> + </td> + <td> + <input type="button" name="own_shiftleft" value="<" /> + </td> + <td> + Own fields<br /> + <select name="own_fields" size="10" style="width: 200px;"> + <option value=""></option> + <option value=""></option> + <option value=""></option> + <option value=""></option> + </select> + </td> + </tr> +</table> + +</div> \ No newline at end of file Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-03-04 13:18:41 UTC (rev 4395) +++ trunk/linpha2/index.php 2006-03-04 18:50:34 UTC (rev 4396) @@ -11,14 +11,10 @@ { $_GET['cat'] = 'alb'; } - if( ! isset( $_SESSION['basket_ids'] ) ) - { - $_SESSION['basket_ids'] = Array(); - } $output['menu_main'] = Array( 'home' => LINPHA_DIR . '/', - 'admin' => '#', /*LINPHA_DIR . '/?cat=admin'*/ + 'admin' => LINPHA_DIR . '/?cat=admin', 'search' => '#', /*LINPHA_DIR . '/?cat=search'*/ 'login' => '#' /*LINPHA_DIR . '/?cat=login'*/ ); @@ -38,6 +34,9 @@ case 'basket': include_once(LINPHA_DIR.'/lib/modules/module.basket.php'); break; +case 'admin': + include_once(LINPHA_DIR.'/lib/modules/module.admin.php'); + break; } ?> \ 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-04 13:18:41 UTC (rev 4395) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-03-04 18:50:34 UTC (rev 4396) @@ -173,6 +173,16 @@ } else { $this->passed=false; } + + /** + * initialize basket + * it's much nicer if we can later just use count($_SESSION['basket_ids']) etc. + * without additional isset() and so on.. + */ + if( ! isset( $_SESSION['basket_ids'] ) ) + { + $_SESSION['basket_ids'] = Array(); + } } // end function startSession Added: trunk/linpha2/lib/modules/module.admin.php =================================================================== --- trunk/linpha2/lib/modules/module.admin.php (rev 0) +++ trunk/linpha2/lib/modules/module.admin.php 2006-03-04 18:50:34 UTC (rev 4396) @@ -0,0 +1,8 @@ +<?php + + +?> + +<a href="./admin/permissions.php">Permissions</a> +<a href="./admin/import.php">Import</a> +<a href="./admin/image.php">Image fields</a> \ No newline at end of file Modified: trunk/linpha2/templates/main_css/view_thumb.css =================================================================== --- trunk/linpha2/templates/main_css/view_thumb.css 2006-03-04 13:18:41 UTC (rev 4395) +++ trunk/linpha2/templates/main_css/view_thumb.css 2006-03-04 18:50:34 UTC (rev 4396) @@ -13,6 +13,7 @@ margin: 3px; text-align: center; float: left; + font-size: 8pt; } .img_thumbnail { @@ -20,6 +21,11 @@ width: auto; } +.img_text { + padding-left: 10px; + text-align: left; +} + .page_nr_main { position: absolute; right: 12px; Modified: trunk/linpha2/templates/main_html/view_basket.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_basket.html.php 2006-03-04 13:18:41 UTC (rev 4395) +++ trunk/linpha2/templates/main_html/view_basket.html.php 2006-03-04 18:50:34 UTC (rev 4396) @@ -31,9 +31,12 @@ ?> <div style='width: <?php echo $GLOBALS['def_tn_size']; ?>px; height: <?php echo $GLOBALS['def_tn_size']; ?>px;' class='imgdiv'> <a href='javascript:void(0)' onclick='update_checkbox(<?php echo $i; ?>)'><img height='<?php echo ($GLOBALS['def_tn_size']-20); ?>' src='./get_thumb.php?id=<?php echo $value['id']; ?>' class='img_thumbnail' /></a> - <br /> + + <div class="img_text"> <input type='checkbox' id='<?php echo $i; ?>' name='img_id[]' value='<?php echo $value['id']; ?>'> <?php echo $value['name']; ?> + </div> + </div> <?php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-05 21:43:26
|
Revision: 4400 Author: fangehrn Date: 2006-03-05 13:43:01 -0800 (Sun, 05 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4400&view=rev Log Message: ----------- * adding an admin menu * working on image fields Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/admin.css trunk/linpha2/admin/image_fields_define.php trunk/linpha2/admin/image_fields_select.php trunk/linpha2/admin/index.php trunk/linpha2/db_data.sql trunk/linpha2/db_mysql.sql trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/metadata.config.php trunk/linpha2/linpha2.specs.txt Added Paths: ----------- trunk/linpha2/admin/image_fields.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-05 14:24:51 UTC (rev 4399) +++ trunk/linpha2/ChangeLog 2006-03-05 21:43:01 UTC (rev 4400) @@ -1,5 +1,9 @@ 2006-03-04 flo + * adding an admin menu + * working on image fields + +2006-03-04 flo * fixed some double declarations in installer * implemented basic basket functions * admin/image.php Modified: trunk/linpha2/admin/admin.css =================================================================== --- trunk/linpha2/admin/admin.css 2006-03-05 14:24:51 UTC (rev 4399) +++ trunk/linpha2/admin/admin.css 2006-03-05 21:43:01 UTC (rev 4400) @@ -1,3 +1,9 @@ +form +{ + margin: 0; + padding: 0; +} + .navlist { padding: 3px 0; Added: trunk/linpha2/admin/image_fields.php =================================================================== --- trunk/linpha2/admin/image_fields.php (rev 0) +++ trunk/linpha2/admin/image_fields.php 2006-03-05 21:43:01 UTC (rev 4400) @@ -0,0 +1,26 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +if(!isset($cat2)) +{ + $cat2 = 'select'; +} + +$array_menu = Array( + 'select' => Array('name' => 'Select image fields', 'link' => 'imagefields_select'), + 'define' => Array('name' => 'Define image fields', 'link' => 'imagefields_define') +); + +print_admin_menu($array_menu,$cat2); + +switch($cat2) +{ +case 'select': + include_once('./image_fields_select.php'); + break; +case 'define': + include_once('./image_fields_define.php'); + break; +} +?> + Modified: trunk/linpha2/admin/image_fields_define.php =================================================================== --- trunk/linpha2/admin/image_fields_define.php 2006-03-05 14:24:51 UTC (rev 4399) +++ trunk/linpha2/admin/image_fields_define.php 2006-03-05 21:43:01 UTC (rev 4400) @@ -1,53 +1,337 @@ <?php if(!defined('LINPHA_DIR')) { exit(1); } +/** + * init + */ + if(!isset($cat3)) + { + $cat3 = 'own'; + } + $array_field_types = Array( + 1 => 'text', + 2 => 'select', + 3 => 'date' + ); -if(!isset( $_GET['sub_cat'])) +/** + * show subsubmenu + */ + $array_menu = Array( + 'own' => Array('name' => 'Own fields', 'link' => 'imagefields_define_own'), + 'adddata' => Array('name' => 'Add select data (set Category names)', 'link' => 'imagefields_define_adddata'), + 'exif' => Array('name' => 'Exif fields', 'link' => 'imagefields_define_exif'), + 'iptc' => Array('name' => 'Iptc fields', 'link' => 'imagefields_define_iptc') + ); + + print_admin_menu($array_menu,$cat3); + +/** + * parse POST data + */ +if(isset($_POST['cmd'])) { - $_GET['sub_cat'] = 'own'; -} + switch($_POST['cmd']) + { + case 'update_builtin': + foreach($_POST['builtin'] AS $key=>$value) + { + $linpha->db->Execute("UPDATE ".PREFIX."meta_fields SET enabled = '".linSql::linAddslashes($value)."' ". + "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') "); + break; + case 'change_field': -$array_menu = Array( - 'own' => Array('name' => 'Own fields', 'link' => '?cat=image_fields_define&sub_cat=own'), - 'exif' => Array('name' => 'Exif fields', 'link' => '?cat=image_fields_define&sub_cat=exif'), - 'iptc' => Array('name' => 'Iptc fields', 'link' => '?cat=image_fields_define&sub_cat=iptc') -); + $linpha->db->Execute("UPDATE ".PREFIX."meta_fields SET " . + "name = '".linSql::linAddslashes($_POST['new_name'])."', ". + "enabled = '".linSql::linAddslashes($_POST['builtin'][$_POST['id']])."' ". + "WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + break; + case 'delete': + ?> + <h3>Delete selected field</h3> + Really sure? all will be lost... + <form action="./?cat=imagefields_define_own" method="POST"> + <input type="hidden" name="cmd" value="do_delete" /> + <input type="hidden" name="id" value="<?php echo $_POST['id']; ?>" /> + <input type="submit" name="delete" value="delete" /> + <a href="./?cat=imagefields_define_own">Cancel</a> + </form> + <br /><br /> + <?php + break; + case 'do_delete': + $linpha->db->Execute("DELETE FROM ".PREFIX."meta_fields WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + break; + case 'add_new_category': + if(isset($_POST['isprivate'])) { + $isprivate = 1; + } else { + $isprivate = 0; + } + $linpha->db->Execute("INSERT into ".PREFIX."meta_category (field_id, name, isprivate) VALUES (" . + "'".linSql::linAddslashes($_POST['field_id'])."'," . + "'".linSql::linAddslashes($_POST['new_name'])."'," . + "'".$isprivate."')"); -print_admin_menu($array_menu,$_GET['sub_cat']); + break; + case 'mod_category': + if(isset($_POST['isprivate'])) { + $isprivate = 1; + } else { + $isprivate = 0; + } + + $linpha->db->Execute("UPDATE ".PREFIX."meta_category SET " . + "name = '".linSql::linAddslashes($_POST['new_name'])."', ". + "isprivate = '".$isprivate."' ". + "WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); -switch($_GET['sub_cat']) + break; + case 'delete_category': + $linpha->db->Execute("DELETE FROM ".PREFIX."meta_category WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + break; + case 'update_exifiptc': + $linpha->sql->config->updateConfig('sys_image_'.$cat3,$_POST['exifiptc_enable']); + $linpha->sql->config->reloadConfig(); + break; + } +} + +switch($cat3) { case 'own': -?> + ?> + <h3>Built-in fields</h3> + <form name="builtin" action="./?cat=imagefields_define_own" method="POST"> + <table border="0" width="400"> + <tr> + <td><b>Field name</b></td> + <td><b>Type</b></td> + <td><b>Enable</b></td> + <td><b>Disable</b></td> + </tr> + + <?php + $query = $linpha->db->Execute("SELECT id, name, field_type, enabled FROM ".PREFIX."meta_fields WHERE builtin = '1'"); + while($data = $query->FetchRow()) + { + echo '<tr><td>'; + echo $data['name']; + echo '</td><td>'; + echo $array_field_types[$data['field_type']]; + echo '</td><td>'; + + echo '<input type="radio" name="builtin['.$data['id'].']" value="1"'. ( $data['enabled'] ? ' checked="checked"' : '') .' />'; + echo '</td><td>'; + echo '<input type="radio" name="builtin['.$data['id'].']" value="0"'. ( $data['enabled'] ? '' : ' checked="checked"') .' />'; + echo '</td></tr>'; + } + ?> + </table> + + <input type="hidden" name="cmd" value="update_builtin" /> + <input type="submit" name="submit" value="submit" /> + </form> + <br /> + + + <h3>Add new own fields</h3> + <form name="addnew" action="./?cat=imagefields_define_own" method="POST"> + <table border="0"> + <tr> + <td width="100">Name</td> + <td><input type="text" name="new_name" value="" maxlength="255" style="width: 200px;" /></td> + </tr> + <tr> + <td>Type</td> + <td> + <select name="new_type" style="width: 200px;" > + <?php + foreach($array_field_types AS $key=>$value) + { + echo '<option value="'.$key.'">'.$value.'</option>'; + } + ?> + </select> + </td> + </tr> + </table> + <input type="hidden" name="cmd" value="add_new" /> + <input type="submit" name="submit" value="add new"/> + </form> + <br /> + + <?php + $query = $linpha->db->Execute("SELECT id, name, field_type, enabled FROM ".PREFIX."meta_fields WHERE builtin = '0'"); + if($query->RecordCount()>0) + { + ?> + <h3>Own fields</h3> + <form name="builtin" action="./?cat=imagefields_define_own" method="POST"> + <table border="0"> + <tr> + <td width="170"><b>Field name</b></td> + <td width="150"><b>Type</b></td> + <td width="70"><b>Enable</b></td> + <td width="100"><b>Disable</b></td> + <td><b>Commands</b></td> + <td> </td> + </tr> + + <?php + while($data = $query->FetchRow()) + { + ?> + <tr> + <form action="./?cat=imagefields_define_own" method="POST"> + <td> + <input type="text" name="new_name" value="<?php echo $data['name']; ?>" style="width: 150px;" maxlength="255" /> + </td> + <td><?php echo $array_field_types[$data['field_type']]; ?></td> + <td> + <?php + echo '<input type="radio" name="builtin['.$data['id'].']" value="1"'. ( $data['enabled'] ? ' checked="checked"' : '') .' />'; + ?> + </td> + <td> + <?php + echo '<input type="radio" name="builtin['.$data['id'].']" value="0"'. ( $data['enabled'] ? '' : ' checked="checked"') .' />'; + ?> + </td> + <td> + <input type="hidden" name="cmd" value="change_field" /> + <input type="hidden" name="id" value="<?php echo $data['id']; ?>" /> + <input type="submit" name="rename" value="submit" /> + </td> + </form> + <td> + <form action="./?cat=imagefields_define_own" method="POST"> + <input type="hidden" name="cmd" value="delete" /> + <input type="hidden" name="id" value="<?php echo $data['id']; ?>" /> + <input type="submit" name="delete" value="delete" /> + </form> + </td> + </tr> + <?php + } + + ?> + </table> + </form> + <?php + } - -<?php break; +case 'adddata': + $query = $linpha->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE field_type = '2'"); + while($data = $query->FetchRow()) + { + ?> + <h3><?php echo $data['name']; ?></h3> + <table border="0"> + <tr> + <td width="170"><b>Name</b></td> + <td width="150"><b>Private</b></td> + <td><b>Commands</b></td> + <td> </td> + </tr> + <?php + $query2 = $linpha->db->Execute("SELECT id, name, isprivate FROM ".PREFIX."meta_category WHERE field_id = '".$data['id']."'"); + while($data2 = $query2->FetchRow()) + { + ?> + <tr> + <form action="./?cat=imagefields_define_adddata" method="POST"> + <td> + <input type="text" name="new_name" value="<?php echo $data2['name']; ?>" /> + </td> + <td> + <input type="checkbox" name="isprivate" value="true"<?php echo ($data2['isprivate'] ? ' checked="checked"' : ''); ?> /> + </td> + <td> + <input type="hidden" name="cmd" value="mod_category" /> + <input type="hidden" name="id" value="<?php echo $data2['id']; ?>" /> + <input type="submit" name="submit" value="Submit" /> + </td> + </form> + <td> + <form action="./?cat=imagefields_define_adddata" method="POST"> + <input type="hidden" name="cmd" value="delete_category" /> + <input type="hidden" name="id" value="<?php echo $data2['id']; ?>" /> + <input type="submit" name="delete" value="delete" /> + </form> + </td> + </tr> + <?php + } + ?> + <tr> + <form action="./?cat=imagefields_define_adddata" method="POST"> + <td> + <input type="text" name="new_name" value="" /> + </td> + <td> + <input type="checkbox" name="isprivate" value="1" /> + </td> + <td> + <input type="hidden" name="field_id" value="<?php echo $data['id']; ?>" /> + <input type="hidden" name="cmd" value="add_new_category" /> + <input type="submit" name="submit" value="Add new" /> + </td> + <td> </td> + </form> + </tr> + </table> + <?php + } + break; case 'exif': case 'iptc': - switch($_GET['sub_cat']) + switch($cat3) { case 'exif': + include_once(LINPHA_DIR.'/lib/classes/metadata.class.php'); + $array_available_fields = MetaData::getExifTranslationArray(); + + /** + * modify array as needed + */ + foreach($array_available_fields AS $key=>$value) + { + $array_available_fields[$key] = $key; + } break; case 'iptc': + include_once(LINPHA_DIR.'/lib/classes/metadata.config.php'); + $array_available_fields = getIptcTranslationArray(); break; } + + $enabled = $linpha->sql->config->value['sys_image_'.$cat3]; ?> - <form name="form_image_fields"> <div align="center"> - - <input type="radio" name="global_enable" value="true" />Enable - <input type="radio" name="global_enable" value="false" />Disable + <form action="./?cat=imagefields_define_<?php echo $cat3; ?>" method="POST"> + <input type="radio" name="exifiptc_enable" value="1"<?php echo ($enabled ? ' checked="checked"' : ''); ?> />Enable + <input type="radio" name="exifiptc_enable" value="0"<?php echo ($enabled ? '' : ' checked="checked"'); ?> />Disable + <input type="hidden" name="cmd" value="update_exifiptc" /> + <input type="submit" name="name" value="update" /> + </form> <br /><br /> <table border="0"> <tr> <td valign="top" rowspan="3" align="center"> Selected fields<br /> - <select name="selected_fields" size="25" style="width: 200px;"> + <select id="selected_fields" name="selected_fields" size="25" style="width: 200px;"> <option value="element1">element1</option> <option value="element2">element2</option> <option value="element3">element3</option> @@ -63,10 +347,12 @@ <td valign="top"> Available fields<br /> <select id="all_fields" name="builtin_fields" size="25" style="width: 200px;"> - <option value="builtin1">builtin1</option> - <option value="builtin2">builtin2</option> - <option value="builtin3">builtin3</option> - <option value="builtin4">builtin4</option> + <?php + foreach($array_available_fields AS $key=>$value) + { + echo '<option value="'.$key.'">'.$value.'</option>'; + } + ?> </select> </td> </tr> @@ -74,106 +360,51 @@ </div> </form> -<?php - break; -} -?> -<script type="text/javascript"> -/** - * http://www.babailiica.com/js/sorter/ - */ - -function copyElement (coming_from) -{ - obj = document.getElementById(coming_from); - - NewEntry = new Option( obj.options[ obj.selectedIndex ].value, obj.options[ obj.selectedIndex ].text, false, true ); - document.form_image_fields.select_image_fields.options[document.form_image_fields.select_image_fields.options.length] = NewEntry; -} - -function addElement () -{ - NewEntry = new Option( document.form_image_fields.title_name.value, document.form_image_fields.title_name.value, false, true ); - NewEntry.className = "option_title"; - document.form_image_fields.select_image_fields.options[document.form_image_fields.select_image_fields.options.length] = NewEntry; - document.form_image_fields.title_name.value = ""; -} - -function deleteElement () -{ - current_index = document.form_image_fields.select_image_fields.selectedIndex; - document.form_image_fields.select_image_fields.options[ current_index ] = null; - + <script type="text/javascript"> /** - * set selectedIndex back to field above + * http://www.babailiica.com/js/sorter/ */ - if( current_index == document.form_image_fields.select_image_fields.length ) + + function addElement () { - document.form_image_fields.select_image_fields.selectedIndex = current_index - 1; + obj_from = document.getElementById('all_fields'); + obj_to = document.getElementById('selected_fields'); + + moveElement(obj_from, obj_to); } - else - { - document.form_image_fields.select_image_fields.selectedIndex = current_index; - } -} -function moveupElement () -{ - current_index = document.form_image_fields.select_image_fields.selectedIndex; - if( current_index != 0 ) + function removeElement () { - /** - * swap entries - */ - obj = document.form_image_fields.select_image_fields.options; + obj_from = document.getElementById('selected_fields'); + obj_to = document.getElementById('all_fields'); - tmp_value = obj[ current_index ].value; - tmp_text = obj[ current_index ].text; - tmp_class = obj[ current_index ].className; - - obj[ current_index ].value = obj[ current_index - 1].value; - obj[ current_index ].text = obj[ current_index - 1].text; - obj[ current_index ].className = obj[ current_index - 1].className; - - obj[ current_index - 1].value = tmp_value; - obj[ current_index - 1].text = tmp_text; - obj[ current_index - 1].className = tmp_class; - - /** - * set selectedIndex back to swapped field - */ - document.form_image_fields.select_image_fields.selectedIndex = current_index - 1; + moveElement(obj_from, obj_to); } -} -function movedownElement () -{ - current_index = document.form_image_fields.select_image_fields.selectedIndex; - - if( current_index != ( document.form_image_fields.select_image_fields.length - 1 ) ) + function moveElement(obj_from, obj_to) { - /** - * swap entries - */ - obj = document.form_image_fields.select_image_fields.options; - - tmp_value = obj[ current_index ].value; - tmp_text = obj[ current_index ].text; - tmp_class = obj[ current_index ].className; - - obj[ current_index ].value = obj[ current_index + 1].value; - obj[ current_index ].text = obj[ current_index + 1].text; - obj[ current_index ].className = obj[ current_index + 1].className; + NewEntry = new Option( obj_from.options[ obj_from.selectedIndex ].text, obj_from.options[ obj_from.selectedIndex ].value, false, true ); + obj_to.options[ obj_to.options.length] = NewEntry; - obj[ current_index + 1].value = tmp_value; - obj[ current_index + 1].text = tmp_text; - obj[ current_index + 1].className = tmp_class; - + current_index = obj_from.selectedIndex; + obj_from.options[ current_index ] = null; + /** - * set selectedIndex back to swapped field + * set selectedIndex back to field above */ - document.form_image_fields.select_image_fields.selectedIndex = current_index + 1; + /*if( current_index == document.form_image_fields.select_image_fields.length ) + { + document.form_image_fields.select_image_fields.selectedIndex = current_index - 1; + } + else + { + document.form_image_fields.select_image_fields.selectedIndex = current_index; + }*/ } + + </script> +<?php + break; } -</script> \ No newline at end of file +?> \ No newline at end of file Modified: trunk/linpha2/admin/image_fields_select.php =================================================================== --- trunk/linpha2/admin/image_fields_select.php 2006-03-05 14:24:51 UTC (rev 4399) +++ trunk/linpha2/admin/image_fields_select.php 2006-03-05 21:43:01 UTC (rev 4400) @@ -1,20 +1,19 @@ <?php if(!defined('LINPHA_DIR')) { exit(1); } - -if(!isset( $_GET['sub_cat'])) +if(!isset($cat3)) { - $_GET['sub_cat'] = 'image'; + $cat3 = 'image'; } $array_menu = Array( - 'image' => Array('name' => 'Image', 'link' => '?cat=image_fields&sub_cat=image'), - 'video' => Array('name' => 'Video', 'link' => '?cat=image_fields&sub_cat=video') + 'image' => Array('name' => 'Image', 'link' => 'imagefields_select_image'), + 'video' => Array('name' => 'Video', 'link' => 'imagefields_select_video') ); -print_admin_menu($array_menu,$_GET['sub_cat']); +print_admin_menu($array_menu,$cat3); -switch($_GET['sub_cat']) +switch($cat3) { case 'image': ?> @@ -46,7 +45,7 @@ <option value="builtin4">builtin4</option> </select> <br /> - <a href="./?cat=image_fields_define&sub_cat=own">define fields</a> + <a href="./?cat=imagefields_define_own">define fields</a> </td> </tr> <tr> @@ -62,7 +61,7 @@ <option value="own4">own4</option> </select> <br /> - <a href="./?cat=image_fields_define&sub_cat=own">define fields</a> + <a href="./?cat=imagefields_define_own">define fields</a> </td> </tr> <tr> @@ -78,7 +77,7 @@ <option value="exif4">exif4</option> </select> <br /> - <a href="./?cat=image_fields_define&sub_cat=exif">define fields</a> + <a href="./?cat=imagefields_define_exif">define fields</a> </td> </tr> <tr> @@ -100,7 +99,7 @@ <option value="iptc4">iptc4</option> </select> <br /> - <a href="./?cat=image_fields_define&sub_cat=iptc">define fields</a> + <a href="./?cat=imagefields_define_iptc">define fields</a> </td> </tr> </table> @@ -128,7 +127,7 @@ { obj = document.getElementById(coming_from); - NewEntry = new Option( obj.options[ obj.selectedIndex ].value, obj.options[ obj.selectedIndex ].text, false, true ); + NewEntry = new Option( obj.options[ obj.selectedIndex ].text, obj.options[ obj.selectedIndex ].value, false, true ); document.form_image_fields.select_image_fields.options[document.form_image_fields.select_image_fields.options.length] = NewEntry; } Modified: trunk/linpha2/admin/index.php =================================================================== --- trunk/linpha2/admin/index.php 2006-03-05 14:24:51 UTC (rev 4399) +++ trunk/linpha2/admin/index.php 2006-03-05 21:43:01 UTC (rev 4400) @@ -4,6 +4,7 @@ /** * init */ + include_once(LINPHA_DIR.'/lib/include/common.php'); include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); $linpha = new linpha(); $linpha->sql->startSession(); @@ -14,11 +15,30 @@ if( ! isset( $_GET['cat'] ) ) { - $_GET['cat'] = 'home'; + $cat1 = 'home'; } +else +{ + $array = explode('_',$_GET['cat']); + + $cat1 = $array[0]; + + if(isset($array[1])) + { + $cat2 = $array[1]; + } + + if(isset($array[2])) + { + $cat3 = $array[2]; + } + + if(isset($array[3])) + { + $cat4 = $array[3]; + } +} ?> - - <html> <head> <link rel='stylesheet' href='admin.css' type='text/css'> @@ -27,16 +47,15 @@ <?php $array_menu = Array( - 'home' => Array('name' => 'Home', 'link' => '?cat=home'), - 'permissions' => Array('name' => 'Permissions', 'link' => '?cat=permissions'), - 'import' => Array('name' => 'Import', 'link' => '?cat=import'), - 'image_fields' => Array('name' => 'Select image fields', 'link' => '?cat=image_fields'), - 'image_fields_define' => Array('name' => 'Define image fields', 'link' => '?cat=image_fields_define') + 'home' => Array('name' => 'Home', 'link' => 'home'), + 'permissions' => Array('name' => 'Permissions', 'link' => 'permissions'), + 'import' => Array('name' => 'Import', 'link' => 'import'), + 'imagefields' => Array('name' => 'Image fields', 'link' => 'imagefields'), ); -print_admin_menu($array_menu,$_GET['cat']); +print_admin_menu($array_menu,$cat1); -switch($_GET['cat']) +switch($cat1) { case 'home': include_once('./home.php'); @@ -47,12 +66,9 @@ case 'import': include_once('./import.php'); break; -case 'image_fields': +case 'imagefields': include_once('./image_fields.php'); break; -case 'image_fields_define': - include_once('./image_fields_define.php'); - break; } ?> @@ -70,11 +86,11 @@ { if($active==$key) { - echo '<li class="active"><a href="'.$value['link'].'" class="current">'.$value['name'].'</a></li>'; + echo '<li class="active"><a href="./?cat='.$value['link'].'" class="current">'.$value['name'].'</a></li>'; } else { - echo '<li><a href="'.$value['link'].'">'.$value['name'].'</a></li>'; + echo '<li><a href="./?cat='.$value['link'].'">'.$value['name'].'</a></li>'; } } ?> Modified: trunk/linpha2/db_data.sql =================================================================== --- trunk/linpha2/db_data.sql 2006-03-05 14:24:51 UTC (rev 4399) +++ trunk/linpha2/db_data.sql 2006-03-05 21:43:01 UTC (rev 4400) @@ -6,12 +6,14 @@ INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_db_adodb_cache_path', 'var/tmp/adocache', 0); INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_db_adodb_caching', '0', 0); INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_db_version', '1', 0); -INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_import_autoimport', '1', 0); INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_im_bracket_support', '0', 0); INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_im_convert_path', '0', 0); INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_im_gd_version', '0', 0); INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_im_use_convert', '0', 0); INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_im_video_thumbnail', '1', 0); +INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_import_autoimport', '1', 0); +INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_image_exif', '1', 0); +INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_image_iptc', '0', 0); INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_lang', 'German', 0); INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_lang_autolang', '1', 0); INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_path_album_dir', 'albums/', 0); Modified: trunk/linpha2/db_mysql.sql =================================================================== --- trunk/linpha2/db_mysql.sql 2006-03-05 14:24:51 UTC (rev 4399) +++ trunk/linpha2/db_mysql.sql 2006-03-05 21:43:01 UTC (rev 4400) @@ -76,4 +76,25 @@ `stats_views` int(11) NOT NULL default '0', `stats_downloads` int(11) NOT NULL default '0', PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; \ No newline at end of file +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + + +DROP TABLE IF EXISTS linpha_meta_fields; +CREATE TABLE IF NOT EXISTS linpha_meta_fields ( + 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', + PRIMARY KEY (id) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + + +DROP TABLE IF EXISTS `linpha_meta_category`; +CREATE TABLE linpha_meta_category ( + id int(11) NOT NULL auto_increment, + field_id int(11) NOT NULL default '0', + name varchar(255) NOT NULL default '', + isprivate int(11) default NULL, + PRIMARY KEY (id) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-03-05 14:24:51 UTC (rev 4399) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-03-05 21:43:01 UTC (rev 4400) @@ -428,9 +428,9 @@ function updateConfig($option_name,$option_value) { $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."config SET option_value = ". - "'".$GLOBALS['linpha']->sql->linAddslashes($option_value)."'". + "'".linSql::linAddslashes($option_value)."'". "WHERE option_name = ". - "'".$GLOBALS['linpha']->sql->linAddslashes($option_name)."'"); + "'".linSql::linAddslashes($option_name)."'"); } } // end sub-class linSqlConfig Modified: trunk/linpha2/lib/classes/metadata.config.php =================================================================== --- trunk/linpha2/lib/classes/metadata.config.php 2006-03-05 14:24:51 UTC (rev 4399) +++ trunk/linpha2/lib/classes/metadata.config.php 2006-03-05 21:43:01 UTC (rev 4400) @@ -68,17 +68,10 @@ $exif_search_tags = Array( 'DateTimeOriginal', 'ImageDescription','JpegComment','Artist','Copyright','Make','Model' ); - - -/** - * Function used in search.php to translate iptc tags to human readable values - * if called with $arg == single. If called with $arg == array return the wholw - * thing for metadata.class.php (i.e. left_view ) - * @returns $array or single array value - */ -function translateIptcSearchTags($tag, $arg) + +function getIptcTranslationArray() { - $trans_array= array( + return array( 'caption' => 'Caption', 'caption_writer' => 'Caption Writer', 'headline' => 'Headline', @@ -108,6 +101,17 @@ 'country_code' => 'Country Code', 'trans_reference' => 'Transmission Reference' ); +} + +/** + * Function used in search.php to translate iptc tags to human readable values + * if called with $arg == single. If called with $arg == array return the wholw + * thing for metadata.class.php (i.e. left_view ) + * @returns $array or single array value + */ +function translateIptcSearchTags($tag, $arg) +{ + $trans_array = getIptcTranslationArray(); /** * return: either single value or whole array Modified: trunk/linpha2/linpha2.specs.txt =================================================================== --- trunk/linpha2/linpha2.specs.txt 2006-03-05 14:24:51 UTC (rev 4399) +++ trunk/linpha2/linpha2.specs.txt 2006-03-05 21:43:01 UTC (rev 4400) @@ -219,7 +219,6 @@ 2 = select 3 = select multiple 4 = date - 5 = date (with from to) Part 12. main menu ============================================================================ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-05 14:03:47
|
Revision: 4397 Author: fangehrn Date: 2006-03-05 06:03:24 -0800 (Sun, 05 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4397&view=rev Log Message: ----------- Modified Paths: -------------- trunk/linpha2/index.php trunk/linpha2/linpha2.specs.txt Added Paths: ----------- trunk/linpha2/admin/image_fields.php trunk/linpha2/admin/image_fields_define.php trunk/linpha2/admin/index.php Removed Paths: ------------- trunk/linpha2/admin/image.php trunk/linpha2/lib/modules/module.admin.php Deleted: trunk/linpha2/admin/image.php =================================================================== --- trunk/linpha2/admin/image.php 2006-03-04 18:50:34 UTC (rev 4396) +++ trunk/linpha2/admin/image.php 2006-03-05 14:03:24 UTC (rev 4397) @@ -1,78 +0,0 @@ -<div align="center"> -<table border="0"> - <tr> - <td valign="top" rowspan="3" align="center"> - Current selection<br /> - <select name="image_fields" size="30" style="width: 200px;"> - <option value=""></option> - <option value=""></option> - <option value=""></option> - <option value=""></option> - </select> - <br /> - <input type="button" name="shift_up" value="^" /> - <input type="button" name="shift_down" value="v" /> - <input type="button" name="remove" value=">" /> - </td> - <td> - <input type="button" name="builtin_shiftleft" value="<" /> - </td> - <td> - Builtin fields<br /> - <select name="builtin_fields" size="10" style="width: 200px;"> - <option value=""></option> - <option value=""></option> - <option value=""></option> - <option value=""></option> - </select> - </td> - </tr> - <tr> - <td> - <input type="button" name="exif_shiftleft" value="<" /> - </td> - <td> - Exif fields<br /> - <select name="exif_fields" size="10" style="width: 200px;"> - <option value=""></option> - <option value=""></option> - <option value=""></option> - <option value=""></option> - </select> - </td> - </tr> - <tr> - <td> - <input type="button" name="iptc_shiftleft" value="<" /> - </td> - <td> - IPTC fields<br /> - <select name="iptc_fields" size="10" style="width: 200px;"> - <option value=""></option> - <option value=""></option> - <option value=""></option> - <option value=""></option> - </select> - </td> - </tr> - <tr> - <td> - <input type="text" name="title" value="" /><br /> - <input type="button" name="add_title" value="add title" /> - </td> - <td> - <input type="button" name="own_shiftleft" value="<" /> - </td> - <td> - Own fields<br /> - <select name="own_fields" size="10" style="width: 200px;"> - <option value=""></option> - <option value=""></option> - <option value=""></option> - <option value=""></option> - </select> - </td> - </tr> -</table> - -</div> \ No newline at end of file Copied: trunk/linpha2/admin/image_fields.php (from rev 4396, trunk/linpha2/admin/image.php) =================================================================== --- trunk/linpha2/admin/image_fields.php (rev 0) +++ trunk/linpha2/admin/image_fields.php 2006-03-05 14:03:24 UTC (rev 4397) @@ -0,0 +1,236 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + + +if(!isset( $_GET['cat'])) +{ + $_GET['cat'] = 'image'; +} + +$array_menu = Array( + 'image' => 'Image', + 'video' => 'Video' +); +?> + +<ul id="navlist"> + <?php + foreach($array_menu AS $key=>$value) + { + if($_GET['cat']==$key) + { + echo '<li id="active"><a href="?cat='.$key.'" id="current">'.$value.'</a></li>'; + } + else + { + echo '<li><a href="?cat='.$key.'">'.$value.'</a></li>'; + } + } + ?> +</ul> + + +<?php +switch($_GET['cat']) +{ +case 'image': +?> + <form name="form_image_fields"> + <div align="center"> + <table border="0"> + <tr> + <td valign="top" rowspan="3" align="center"> + Current image fields shown<br /> + <select name="select_image_fields" size="25" style="width: 200px;"> + <option value="element1">element1</option> + <option value="element2">element2</option> + <option value="element3">element3</option> + <option value="element4">element4</option> + </select> + <br /> + <input type="button" name="shift_up" value="^" onclick="moveupElement()" /> + <input type="button" name="shift_down" value="v" onclick="movedownElement()" /> + </td> + <td> + <input type="button" name="builtin_shiftleft" value="<" onclick="copyElement('builtin_fields')" /> + </td> + <td> + Builtin fields<br /> + <select id="builtin_fields" name="builtin_fields" size="7" style="width: 200px;"> + <option value="builtin1">builtin1</option> + <option value="builtin2">builtin2</option> + <option value="builtin3">builtin3</option> + <option value="builtin4">builtin4</option> + </select> + <br /> + <a href="image_fields.php?cat=own">define fields</a> + </td> + </tr> + <tr> + <td> + <input type="button" name="own_shiftleft" value="<" onclick="copyElement('own_fields')" /> + </td> + <td> + Own fields<br /> + <select id="own_fields" name="own_fields" size="7" style="width: 200px;"> + <option value="own1">own1</option> + <option value="own2">own2</option> + <option value="own3">own3</option> + <option value="own4">own4</option> + </select> + <br /> + <a href="image_fields.php?cat=own">define fields</a> + </td> + </tr> + <tr> + <td> + <input type="button" name="exif_shiftleft" value="<" onclick="copyElement('exif_fields')" /> + </td> + <td> + Exif fields<br /> + <select id="exif_fields" name="exif_fields" size="7" style="width: 200px;"> + <option value="exif1">exif1</option> + <option value="exif2">exif2</option> + <option value="exif3">exif3</option> + <option value="exif4">exif4</option> + </select> + <br /> + <a href="image_fields.php?cat=exif">define fields</a> + </td> + </tr> + <tr> + <td> + <input type="button" name="remove" value="delete selected" onclick="deleteElement()" /> + <br /><br /> + <input type="text" name="title_name" value="" /><br /> + <input type="button" name="add_title" value="add title" onclick="addElement()" /> + </td> + <td> + <input type="button" name="iptc_shiftleft" value="<" onclick="copyElement('iptc_fields')" /> + </td> + <td> + IPTC fields<br /> + <select id="iptc_fields" name="iptc_fields" size="7" style="width: 200px;"> + <option value="iptc1">iptc1</option> + <option value="iptc2">iptc2</option> + <option value="iptc3">iptc3</option> + <option value="iptc4">iptc4</option> + </select> + <br /> + <a href="image_fields.php?cat=iptc">define fields</a> + </td> + </tr> + </table> + + </div> + </form> +<?php + break; +case 'video': +?> + +<?php + break; +} +?> + + + +<script type="text/javascript"> +/** + * http://www.babailiica.com/js/sorter/ + */ + +function copyElement (coming_from) +{ + obj = document.getElementById(coming_from); + + NewEntry = new Option( obj.options[ obj.selectedIndex ].value, obj.options[ obj.selectedIndex ].text, false, true ); + document.form_image_fields.select_image_fields.options[document.form_image_fields.select_image_fields.options.length] = NewEntry; +} + +function addElement () +{ + NewEntry = new Option( document.form_image_fields.title_name.value, document.form_image_fields.title_name.value, false, true ); + NewEntry.className = "option_title"; + document.form_image_fields.select_image_fields.options[document.form_image_fields.select_image_fields.options.length] = NewEntry; + document.form_image_fields.title_name.value = ""; +} + +function deleteElement () +{ + current_index = document.form_image_fields.select_image_fields.selectedIndex; + document.form_image_fields.select_image_fields.options[ current_index ] = null; + + /** + * set selectedIndex back to field above + */ + if( current_index == document.form_image_fields.select_image_fields.length ) + { + document.form_image_fields.select_image_fields.selectedIndex = current_index - 1; + } + else + { + document.form_image_fields.select_image_fields.selectedIndex = current_index; + } +} + +function moveupElement () +{ + current_index = document.form_image_fields.select_image_fields.selectedIndex; + if( current_index != 0 ) + { + /** + * swap entries + */ + obj = document.form_image_fields.select_image_fields.options; + + tmp_value = obj[ current_index ].value; + tmp_text = obj[ current_index ].text; + tmp_class = obj[ current_index ].className; + + obj[ current_index ].value = obj[ current_index - 1].value; + obj[ current_index ].text = obj[ current_index - 1].text; + obj[ current_index ].className = obj[ current_index - 1].className; + + obj[ current_index - 1].value = tmp_value; + obj[ current_index - 1].text = tmp_text; + obj[ current_index - 1].className = tmp_class; + + /** + * set selectedIndex back to swapped field + */ + document.form_image_fields.select_image_fields.selectedIndex = current_index - 1; + } +} + +function movedownElement () +{ + current_index = document.form_image_fields.select_image_fields.selectedIndex; + + if( current_index != ( document.form_image_fields.select_image_fields.length - 1 ) ) + { + /** + * swap entries + */ + obj = document.form_image_fields.select_image_fields.options; + + tmp_value = obj[ current_index ].value; + tmp_text = obj[ current_index ].text; + tmp_class = obj[ current_index ].className; + + obj[ current_index ].value = obj[ current_index + 1].value; + obj[ current_index ].text = obj[ current_index + 1].text; + obj[ current_index ].className = obj[ current_index + 1].className; + + obj[ current_index + 1].value = tmp_value; + obj[ current_index + 1].text = tmp_text; + obj[ current_index + 1].className = tmp_class; + + /** + * set selectedIndex back to swapped field + */ + document.form_image_fields.select_image_fields.selectedIndex = current_index + 1; + } +} +</script> \ No newline at end of file Added: trunk/linpha2/admin/image_fields_define.php =================================================================== --- trunk/linpha2/admin/image_fields_define.php (rev 0) +++ trunk/linpha2/admin/image_fields_define.php 2006-03-05 14:03:24 UTC (rev 4397) @@ -0,0 +1,194 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +if(!isset( $_GET['cat'])) +{ + $_GET['cat'] = 'own'; +} + +$array_menu = Array( + 'own' => 'Own', + 'exif' => 'Exif', + 'iptc' => 'Iptc' +); +?> + +<ul id="navlist"> + <?php + foreach($array_menu AS $key=>$value) + { + if($_GET['cat']==$key) + { + echo '<li id="active"><a href="?cat='.$key.'" id="current">'.$value.' fields</a></li>'; + } + else + { + echo '<li><a href="?cat='.$key.'">'.$value.' fields</a></li>'; + } + } + ?> +</ul> + + +<?php +switch($_GET['cat']) +{ +case 'own': +?> + + + +<?php + break; +case 'exif': +case 'iptc': + switch($_GET['cat']) + { + case 'exif': + break; + case 'iptc': + break; + } +?> + + <form name="form_image_fields"> + <div align="center"> + + <input type="radio" name="global_enable" value="true" />Enable + <input type="radio" name="global_enable" value="false" />Disable + <br /><br /> + + <table border="0"> + <tr> + <td valign="top" rowspan="3" align="center"> + Selected fields<br /> + <select name="selected_fields" size="25" style="width: 200px;"> + <option value="element1">element1</option> + <option value="element2">element2</option> + <option value="element3">element3</option> + <option value="element4">element4</option> + </select> + <br /> + </td> + <td> + <input type="button" name="shiftleft" value="<" onclick="addElement()" /> + <br /> + <input type="button" name="shiftright" value=">" onclick="removeElement()" /> + </td> + <td valign="top"> + Available fields<br /> + <select id="all_fields" name="builtin_fields" size="25" style="width: 200px;"> + <option value="builtin1">builtin1</option> + <option value="builtin2">builtin2</option> + <option value="builtin3">builtin3</option> + <option value="builtin4">builtin4</option> + </select> + </td> + </tr> + </table> + + </div> + </form> +<?php + break; +} +?> + +<script type="text/javascript"> +/** + * http://www.babailiica.com/js/sorter/ + */ + +function copyElement (coming_from) +{ + obj = document.getElementById(coming_from); + + NewEntry = new Option( obj.options[ obj.selectedIndex ].value, obj.options[ obj.selectedIndex ].text, false, true ); + document.form_image_fields.select_image_fields.options[document.form_image_fields.select_image_fields.options.length] = NewEntry; +} + +function addElement () +{ + NewEntry = new Option( document.form_image_fields.title_name.value, document.form_image_fields.title_name.value, false, true ); + NewEntry.className = "option_title"; + document.form_image_fields.select_image_fields.options[document.form_image_fields.select_image_fields.options.length] = NewEntry; + document.form_image_fields.title_name.value = ""; +} + +function deleteElement () +{ + current_index = document.form_image_fields.select_image_fields.selectedIndex; + document.form_image_fields.select_image_fields.options[ current_index ] = null; + + /** + * set selectedIndex back to field above + */ + if( current_index == document.form_image_fields.select_image_fields.length ) + { + document.form_image_fields.select_image_fields.selectedIndex = current_index - 1; + } + else + { + document.form_image_fields.select_image_fields.selectedIndex = current_index; + } +} + +function moveupElement () +{ + current_index = document.form_image_fields.select_image_fields.selectedIndex; + if( current_index != 0 ) + { + /** + * swap entries + */ + obj = document.form_image_fields.select_image_fields.options; + + tmp_value = obj[ current_index ].value; + tmp_text = obj[ current_index ].text; + tmp_class = obj[ current_index ].className; + + obj[ current_index ].value = obj[ current_index - 1].value; + obj[ current_index ].text = obj[ current_index - 1].text; + obj[ current_index ].className = obj[ current_index - 1].className; + + obj[ current_index - 1].value = tmp_value; + obj[ current_index - 1].text = tmp_text; + obj[ current_index - 1].className = tmp_class; + + /** + * set selectedIndex back to swapped field + */ + document.form_image_fields.select_image_fields.selectedIndex = current_index - 1; + } +} + +function movedownElement () +{ + current_index = document.form_image_fields.select_image_fields.selectedIndex; + + if( current_index != ( document.form_image_fields.select_image_fields.length - 1 ) ) + { + /** + * swap entries + */ + obj = document.form_image_fields.select_image_fields.options; + + tmp_value = obj[ current_index ].value; + tmp_text = obj[ current_index ].text; + tmp_class = obj[ current_index ].className; + + obj[ current_index ].value = obj[ current_index + 1].value; + obj[ current_index ].text = obj[ current_index + 1].text; + obj[ current_index ].className = obj[ current_index + 1].className; + + obj[ current_index + 1].value = tmp_value; + obj[ current_index + 1].text = tmp_text; + obj[ current_index + 1].className = tmp_class; + + /** + * set selectedIndex back to swapped field + */ + document.form_image_fields.select_image_fields.selectedIndex = current_index + 1; + } +} +</script> \ No newline at end of file Added: trunk/linpha2/admin/index.php =================================================================== --- trunk/linpha2/admin/index.php (rev 0) +++ trunk/linpha2/admin/index.php 2006-03-05 14:03:24 UTC (rev 4397) @@ -0,0 +1,88 @@ +<?php +define('LINPHA_DIR','.'); + +/** + * init + */ + include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); + $linpha = new linpha(); + $linpha->sql->startSession(); + +/** + * @todo admin permission check + */ +?> + +<style> + +#navlist +{ +padding: 3px 0; +margin-left: 0; +border-bottom: 1px solid #778; +font: bold 12px Verdana, sans-serif; +} + +#navlist li +{ +list-style: none; +margin: 0; +display: inline; +} + +#navlist li a +{ +padding: 3px 0.5em; +margin-left: 3px; +border: 1px solid #778; +border-bottom: none; +background: #DDE; +text-decoration: none; +} + +#navlist li a:link { color: #448; } +#navlist li a:visited { color: #667; } + +#navlist li a:hover +{ +color: #000; +background: #AAE; +border-color: #227; +} + +#navlist li a#current +{ +background: white; +border-bottom: 1px solid white; +} + + +.option_title +{ + font-weight: bold; +} +</style> + + + +<a href="./?cat=permissions">Permissions</a> +<a href="./?cat=import">Import</a> +<a href="./?cat=image_fields">Select image fields</a> +<a href="./?cat=image_fields_define">Define image fields</a> + +<?php +switch($_GET['cat']) +{ +case 'permissions': + include_once('./permissions.php'); + break; +case 'import': + include_once('./import.php'); + break; +case 'image_fields': + include_once('./image_fields.php'); + break; +case 'image_fields_define': + include_once('./image_fields_define.php'); + break; +} \ No newline at end of file Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-03-04 18:50:34 UTC (rev 4396) +++ trunk/linpha2/index.php 2006-03-05 14:03:24 UTC (rev 4397) @@ -14,7 +14,7 @@ $output['menu_main'] = Array( 'home' => LINPHA_DIR . '/', - 'admin' => LINPHA_DIR . '/?cat=admin', + 'admin' => LINPHA_DIR . '/admin/', 'search' => '#', /*LINPHA_DIR . '/?cat=search'*/ 'login' => '#' /*LINPHA_DIR . '/?cat=login'*/ ); @@ -34,9 +34,6 @@ case 'basket': include_once(LINPHA_DIR.'/lib/modules/module.basket.php'); break; -case 'admin': - include_once(LINPHA_DIR.'/lib/modules/module.admin.php'); - break; } ?> \ No newline at end of file Deleted: trunk/linpha2/lib/modules/module.admin.php =================================================================== --- trunk/linpha2/lib/modules/module.admin.php 2006-03-04 18:50:34 UTC (rev 4396) +++ trunk/linpha2/lib/modules/module.admin.php 2006-03-05 14:03:24 UTC (rev 4397) @@ -1,8 +0,0 @@ -<?php - - -?> - -<a href="./admin/permissions.php">Permissions</a> -<a href="./admin/import.php">Import</a> -<a href="./admin/image.php">Image fields</a> \ No newline at end of file Modified: trunk/linpha2/linpha2.specs.txt =================================================================== --- trunk/linpha2/linpha2.specs.txt 2006-03-04 18:50:34 UTC (rev 4396) +++ trunk/linpha2/linpha2.specs.txt 2006-03-05 14:03:24 UTC (rev 4397) @@ -213,6 +213,14 @@ for Holidays, all images in this album should be shown (but what to do with subfolders?) + - ability to define own image fields (low priority) + types: + 1 = text + 2 = select + 3 = select multiple + 4 = date + 5 = date (with from to) + Part 12. main menu ============================================================================ - use a css only menu? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-07 17:38:45
|
Revision: 4402 Author: fangehrn Date: 2006-03-07 09:38:22 -0800 (Tue, 07 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4402&view=rev Log Message: ----------- * working on image fields Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/image_fields.php trunk/linpha2/admin/image_fields_define.php trunk/linpha2/admin/image_fields_select.php trunk/linpha2/db_data.sql trunk/linpha2/get_thumb.php trunk/linpha2/install/sql/sql.mysql.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/metadata.class.php Added Paths: ----------- trunk/linpha2/admin/image_fields_define_post.php Removed Paths: ------------- trunk/linpha2/lib/classes/metadata.config.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-07 14:51:32 UTC (rev 4401) +++ trunk/linpha2/ChangeLog 2006-03-07 17:38:22 UTC (rev 4402) @@ -1,3 +1,6 @@ +2006-03-07 flo + * adding forced thumbnail recreation + * working on image fields 2006-03-04 flo * adding an admin menu Modified: trunk/linpha2/admin/image_fields.php =================================================================== --- trunk/linpha2/admin/image_fields.php 2006-03-07 14:51:32 UTC (rev 4401) +++ trunk/linpha2/admin/image_fields.php 2006-03-07 17:38:22 UTC (rev 4402) @@ -22,5 +22,66 @@ include_once('./image_fields_define.php'); break; } + +/** + * workaround.. + */ +$array_available_fields = Array(); +function get_selected_fields($what) +{ + include_once(LINPHA_DIR.'/lib/classes/metadata.class.php'); + + switch($what) + { + case 'exif': + + $GLOBALS['array_available_fields'] = MetaData::getExifTranslationArray(); + + /** + * modify array as needed + * change key to lowercase + */ + foreach($GLOBALS['array_available_fields'] AS $key=>$value) + { + $new_key = strtolower($key); + unset($GLOBALS['array_available_fields'][$key]); + $GLOBALS['array_available_fields'][$new_key] = $key; + } + + $array_selected_fields = $GLOBALS['linpha']->db->MetaColumns(PREFIX."meta_exif"); + + break; + case 'iptc': + $GLOBALS['array_available_fields'] = MetaData::getIptcTranslationArray(); + + $array_selected_fields = $GLOBALS['linpha']->db->MetaColumns(PREFIX."meta_iptc"); + break; + } + + /** + * change keys to lowercase + */ + foreach($array_selected_fields AS $key=>$value) + { + $new_key = strtolower($key); + unset($array_selected_fields[$key]); + $array_selected_fields[$new_key] = $GLOBALS['array_available_fields'][$new_key]; + } + + /** + * remove md5sum entry + */ + unset($array_selected_fields['md5sum']); + + /** + * remove selected_fields from available_fields + */ + foreach($array_selected_fields AS $key=>$value) + { + unset($GLOBALS['array_available_fields'][$key]); + } + + return $array_selected_fields; +} ?> Modified: trunk/linpha2/admin/image_fields_define.php =================================================================== --- trunk/linpha2/admin/image_fields_define.php 2006-03-07 14:51:32 UTC (rev 4401) +++ trunk/linpha2/admin/image_fields_define.php 2006-03-07 17:38:22 UTC (rev 4402) @@ -29,84 +29,26 @@ /** * parse POST data */ -if(isset($_POST['cmd'])) -{ - switch($_POST['cmd']) - { - case 'update_builtin': - - foreach($_POST['builtin'] AS $key=>$value) - { - $linpha->db->Execute("UPDATE ".PREFIX."meta_fields SET enabled = '".linSql::linAddslashes($value)."' ". - "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') "); - break; - case 'change_field': - - $linpha->db->Execute("UPDATE ".PREFIX."meta_fields SET " . - "name = '".linSql::linAddslashes($_POST['new_name'])."', ". - "enabled = '".linSql::linAddslashes($_POST['builtin'][$_POST['id']])."' ". - "WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); - break; - case 'delete': - ?> - <h3>Delete selected field</h3> - Really sure? all will be lost... - <form action="./?cat=imagefields_define_own" method="POST"> - <input type="hidden" name="cmd" value="do_delete" /> - <input type="hidden" name="id" value="<?php echo $_POST['id']; ?>" /> - <input type="submit" name="delete" value="delete" /> - <a href="./?cat=imagefields_define_own">Cancel</a> - </form> - <br /><br /> - <?php - break; - case 'do_delete': - $linpha->db->Execute("DELETE FROM ".PREFIX."meta_fields WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); - break; - case 'add_new_category': - if(isset($_POST['isprivate'])) { - $isprivate = 1; - } else { - $isprivate = 0; - } - $linpha->db->Execute("INSERT into ".PREFIX."meta_category (field_id, name, isprivate) VALUES (" . - "'".linSql::linAddslashes($_POST['field_id'])."'," . - "'".linSql::linAddslashes($_POST['new_name'])."'," . - "'".$isprivate."')"); - - break; - case 'mod_category': - if(isset($_POST['isprivate'])) { - $isprivate = 1; - } else { - $isprivate = 0; - } - - $linpha->db->Execute("UPDATE ".PREFIX."meta_category SET " . - "name = '".linSql::linAddslashes($_POST['new_name'])."', ". - "isprivate = '".$isprivate."' ". - "WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); - - break; - case 'delete_category': - $linpha->db->Execute("DELETE FROM ".PREFIX."meta_category WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); - break; - case 'update_exifiptc': - $linpha->sql->config->updateConfig('sys_image_'.$cat3,$_POST['exifiptc_enable']); - $linpha->sql->config->reloadConfig(); - break; - } +if(isset($_POST['cmd'])) { + include_once(LINPHA_DIR.'/admin/image_fields_define_post.php'); } switch($cat3) { case 'own': + show_own_fields(); + break; +case 'adddata': + show_add_data(); + break; +case 'exif': +case 'iptc': + show_exif_iptc(); + break; +} + +function show_own_fields() +{ ?> <h3>Built-in fields</h3> <form name="builtin" action="./?cat=imagefields_define_own" method="POST"> @@ -119,13 +61,13 @@ </tr> <?php - $query = $linpha->db->Execute("SELECT id, name, field_type, enabled FROM ".PREFIX."meta_fields WHERE builtin = '1'"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type, enabled FROM ".PREFIX."meta_fields WHERE builtin = '1'"); while($data = $query->FetchRow()) { echo '<tr><td>'; echo $data['name']; echo '</td><td>'; - echo $array_field_types[$data['field_type']]; + 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"' : '') .' />'; @@ -155,7 +97,7 @@ <td> <select name="new_type" style="width: 200px;" > <?php - foreach($array_field_types AS $key=>$value) + foreach($GLOBALS['array_field_types'] AS $key=>$value) { echo '<option value="'.$key.'">'.$value.'</option>'; } @@ -170,7 +112,7 @@ <br /> <?php - $query = $linpha->db->Execute("SELECT id, name, field_type, enabled FROM ".PREFIX."meta_fields WHERE builtin = '0'"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type, enabled FROM ".PREFIX."meta_fields WHERE builtin = '0'"); if($query->RecordCount()>0) { ?> @@ -195,7 +137,7 @@ <td> <input type="text" name="new_name" value="<?php echo $data['name']; ?>" style="width: 150px;" maxlength="255" /> </td> - <td><?php echo $array_field_types[$data['field_type']]; ?></td> + <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"' : '') .' />'; @@ -228,10 +170,11 @@ </form> <?php } +} - break; -case 'adddata': - $query = $linpha->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE field_type = '2'"); +function show_add_data() +{ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE field_type = '2'"); while($data = $query->FetchRow()) { ?> @@ -244,7 +187,7 @@ <td> </td> </tr> <?php - $query2 = $linpha->db->Execute("SELECT id, name, isprivate FROM ".PREFIX."meta_category WHERE field_id = '".$data['id']."'"); + $query2 = $GLOBALS['linpha']->db->Execute("SELECT id, name, isprivate FROM ".PREFIX."meta_category WHERE field_id = '".$data['id']."'"); while($data2 = $query2->FetchRow()) { ?> @@ -292,34 +235,20 @@ </table> <?php } - break; -case 'exif': -case 'iptc': - switch($cat3) - { - case 'exif': - include_once(LINPHA_DIR.'/lib/classes/metadata.class.php'); - $array_available_fields = MetaData::getExifTranslationArray(); - - /** - * modify array as needed - */ - foreach($array_available_fields AS $key=>$value) - { - $array_available_fields[$key] = $key; - } - break; - case 'iptc': - include_once(LINPHA_DIR.'/lib/classes/metadata.config.php'); - $array_available_fields = getIptcTranslationArray(); - break; - } +} + +function show_exif_iptc() +{ + $array_selected_fields = get_selected_fields($GLOBALS['cat3']); - $enabled = $linpha->sql->config->value['sys_image_'.$cat3]; + /** + * get enabled/disabled setting + */ + $enabled = $GLOBALS['linpha']->sql->config->value['sys_image_'.$GLOBALS['cat3']]; ?> <div align="center"> - <form action="./?cat=imagefields_define_<?php echo $cat3; ?>" method="POST"> + <form action="./?cat=imagefields_define_<?php echo $GLOBALS['cat3']; ?>" method="POST"> <input type="radio" name="exifiptc_enable" value="1"<?php echo ($enabled ? ' checked="checked"' : ''); ?> />Enable <input type="radio" name="exifiptc_enable" value="0"<?php echo ($enabled ? '' : ' checked="checked"'); ?> />Disable <input type="hidden" name="cmd" value="update_exifiptc" /> @@ -327,15 +256,18 @@ </form> <br /><br /> + <form action="./?cat=imagefields_define_<?php echo $GLOBALS['cat3']; ?>" method="POST" onsubmit="selectAll()"> <table border="0"> <tr> <td valign="top" rowspan="3" align="center"> Selected fields<br /> - <select id="selected_fields" name="selected_fields" size="25" style="width: 200px;"> - <option value="element1">element1</option> - <option value="element2">element2</option> - <option value="element3">element3</option> - <option value="element4">element4</option> + <select id="selected_fields" name="selected_fields[]" size="25" style="width: 200px;" multiple="multiple"> + <?php + foreach($array_selected_fields AS $key=>$value) + { + echo '<option value="'.$key.'">'.$value.'</option>'."\n"; + } + ?> </select> <br /> </td> @@ -348,7 +280,7 @@ Available fields<br /> <select id="all_fields" name="builtin_fields" size="25" style="width: 200px;"> <?php - foreach($array_available_fields AS $key=>$value) + foreach($GLOBALS['array_available_fields'] AS $key=>$value) { echo '<option value="'.$key.'">'.$value.'</option>'; } @@ -357,15 +289,25 @@ </td> </tr> </table> - - </div> + <input type="hidden" name="cmd" value="create_exifiptc" /> + <input type="submit" name="name" value="Submit" /> </form> + </div> + <script type="text/javascript"> /** * http://www.babailiica.com/js/sorter/ */ + function selectAll() + { + obj = document.getElementById('selected_fields'); + for (var i=0; i<obj.length; i++) { + obj[i].selected = true; + } + } + function addElement () { obj_from = document.getElementById('all_fields'); @@ -384,27 +326,37 @@ function moveElement(obj_from, obj_to) { - NewEntry = new Option( obj_from.options[ obj_from.selectedIndex ].text, obj_from.options[ obj_from.selectedIndex ].value, false, true ); - obj_to.options[ obj_to.options.length] = NewEntry; + if(obj_from.selectedIndex != -1) + { + old_index = obj_from.selectedIndex; + + NewEntry = new Option( obj_from.options[ obj_from.selectedIndex ].text, obj_from.options[ obj_from.selectedIndex ].value, false, true ); + obj_to.options[ obj_to.options.length] = NewEntry; - current_index = obj_from.selectedIndex; - obj_from.options[ current_index ] = null; + obj_from.options[ obj_from.selectedIndex ] = null; - /** - * set selectedIndex back to field above - */ - /*if( current_index == document.form_image_fields.select_image_fields.length ) - { - document.form_image_fields.select_image_fields.selectedIndex = current_index - 1; + /** + * set selectedIndex back to field above + */ + obj_to.selectedIndex = obj_to.length - 1; + + if( obj_from.selectedIndex == obj_from.length ) + { + obj_from.selectedIndex = obj_from.selectedIndex - 1; + } + else + { + obj_from.selectedIndex = old_index; + } } else { - document.form_image_fields.select_image_fields.selectedIndex = current_index; - }*/ + alert('nothing selected'); + } } </script> -<?php - break; + <?php } + ?> \ No newline at end of file Added: trunk/linpha2/admin/image_fields_define_post.php =================================================================== --- trunk/linpha2/admin/image_fields_define_post.php (rev 0) +++ trunk/linpha2/admin/image_fields_define_post.php 2006-03-07 17:38:22 UTC (rev 4402) @@ -0,0 +1,91 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +switch($_POST['cmd']) +{ +case 'update_builtin': + + foreach($_POST['builtin'] AS $key=>$value) + { + $linpha->db->Execute("UPDATE ".PREFIX."meta_fields SET enabled = '".linSql::linAddslashes($value)."' ". + "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') "); + break; +case 'change_field': + + $linpha->db->Execute("UPDATE ".PREFIX."meta_fields SET " . + "name = '".linSql::linAddslashes($_POST['new_name'])."', ". + "enabled = '".linSql::linAddslashes($_POST['builtin'][$_POST['id']])."' ". + "WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + break; +case 'delete': + ?> + <h3>Delete selected field</h3> + Really sure? all will be lost... + <form action="./?cat=imagefields_define_own" method="POST"> + <input type="hidden" name="cmd" value="do_delete" /> + <input type="hidden" name="id" value="<?php echo $_POST['id']; ?>" /> + <input type="submit" name="delete" value="delete" /> + <a href="./?cat=imagefields_define_own">Cancel</a> + </form> + <br /><br /> + <?php + break; +case 'do_delete': + $linpha->db->Execute("DELETE FROM ".PREFIX."meta_fields WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + break; +case 'add_new_category': + if(isset($_POST['isprivate'])) { + $isprivate = 1; + } else { + $isprivate = 0; + } + $linpha->db->Execute("INSERT into ".PREFIX."meta_category (field_id, name, isprivate) VALUES (" . + "'".linSql::linAddslashes($_POST['field_id'])."'," . + "'".linSql::linAddslashes($_POST['new_name'])."'," . + "'".$isprivate."')"); + + break; +case 'mod_category': + if(isset($_POST['isprivate'])) { + $isprivate = 1; + } else { + $isprivate = 0; + } + + $linpha->db->Execute("UPDATE ".PREFIX."meta_category SET " . + "name = '".linSql::linAddslashes($_POST['new_name'])."', ". + "isprivate = '".$isprivate."' ". + "WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + + break; +case 'delete_category': + $linpha->db->Execute("DELETE FROM ".PREFIX."meta_category WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + break; +case 'update_exifiptc': + $linpha->sql->config->updateConfig('sys_image_'.$cat3,$_POST['exifiptc_enable']); + $linpha->sql->config->reloadConfig(); + break; +case 'create_exifiptc': + include_once(LINPHA_DIR.'/lib/classes/metadata.class.php'); + if( ! isset($_POST['selected_fields'])) + { + $_POST['selected_fields'] = Array(); + } + if($cat3 == 'exif') { + $linpha->db->Execute("DROP TABLE IF EXISTS ".PREFIX."meta_exif"); + $linpha->db->Execute( Metadata::createExifTable( $_POST['selected_fields'] ) ); + } elseif($cat3 == 'iptc') { + $linpha->db->Execute("DROP TABLE IF EXISTS ".PREFIX."meta_iptc"); + $linpha->db->Execute( Metadata::createIptcTable( $_POST['selected_fields'] ) ); + } + break; +} + + +?> \ No newline at end of file Modified: trunk/linpha2/admin/image_fields_select.php =================================================================== --- trunk/linpha2/admin/image_fields_select.php 2006-03-07 14:51:32 UTC (rev 4401) +++ trunk/linpha2/admin/image_fields_select.php 2006-03-07 17:38:22 UTC (rev 4402) @@ -11,19 +11,24 @@ 'video' => Array('name' => 'Video', 'link' => 'imagefields_select_video') ); +if(isset($_POST['cmd'])) +{ + print_r($_POST['select_image_fields']); +} + print_admin_menu($array_menu,$cat3); switch($cat3) { case 'image': ?> - <form name="form_image_fields"> + <form name="form_image_fields" method="POST" onsubmit="selectAll()"> <div align="center"> <table border="0"> <tr> - <td valign="top" rowspan="3" align="center"> + <td valign="top" rowspan="4" align="center"> Current image fields shown<br /> - <select name="select_image_fields" size="25" style="width: 200px;"> + <select id="select_image_fields" name="select_image_fields[]" size="25" style="width: 200px;" multiple="multiple"> <option value="element1">element1</option> <option value="element2">element2</option> <option value="element3">element3</option> @@ -32,20 +37,27 @@ <br /> <input type="button" name="shift_up" value="^" onclick="moveupElement()" /> <input type="button" name="shift_down" value="v" onclick="movedownElement()" /> + <br /><br /> + <input type="button" name="remove" value="delete selected" onclick="deleteElement()" /> + <br /><br /> + <input type="text" name="title_name" value="" /><br /> + <input type="button" name="add_title" value="add title" onclick="addElement()" /> </td> <td> <input type="button" name="builtin_shiftleft" value="<" onclick="copyElement('builtin_fields')" /> </td> <td> - Builtin fields<br /> + Builtin fields (<a href="./?cat=imagefields_define_own">define</a>)<br /> <select id="builtin_fields" name="builtin_fields" size="7" style="width: 200px;"> - <option value="builtin1">builtin1</option> - <option value="builtin2">builtin2</option> - <option value="builtin3">builtin3</option> - <option value="builtin4">builtin4</option> + <?php + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields " . + "WHERE builtin = '1' AND enabled = '1'"); + while($data = $query->FetchRow()) + { + echo '<option value="'.$data['id'].'">'.$data['name'].'</option>'; + } + ?> </select> - <br /> - <a href="./?cat=imagefields_define_own">define fields</a> </td> </tr> <tr> @@ -53,15 +65,17 @@ <input type="button" name="own_shiftleft" value="<" onclick="copyElement('own_fields')" /> </td> <td> - Own fields<br /> + Own fields (<a href="./?cat=imagefields_define_own">define</a>)<br /> <select id="own_fields" name="own_fields" size="7" style="width: 200px;"> - <option value="own1">own1</option> - <option value="own2">own2</option> - <option value="own3">own3</option> - <option value="own4">own4</option> + <?php + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields " . + "WHERE builtin = '0' AND enabled = '1'"); + while($data = $query->FetchRow()) + { + echo '<option value="'.$data['id'].'">'.$data['name'].'</option>'; + } + ?> </select> - <br /> - <a href="./?cat=imagefields_define_own">define fields</a> </td> </tr> <tr> @@ -69,41 +83,54 @@ <input type="button" name="exif_shiftleft" value="<" onclick="copyElement('exif_fields')" /> </td> <td> - Exif fields<br /> - <select id="exif_fields" name="exif_fields" size="7" style="width: 200px;"> - <option value="exif1">exif1</option> - <option value="exif2">exif2</option> - <option value="exif3">exif3</option> - <option value="exif4">exif4</option> + Exif fields (<a href="./?cat=imagefields_define_exif">define</a>)<br /> + <?php + if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) { + $str_disabled = ''; + } else { + $str_disabled = ' disabled="disabled"'; + } + ?> + <select id="exif_fields" name="exif_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> + <?php + $array_selected_fields = get_selected_fields('exif'); + foreach($array_selected_fields AS $key=>$value) + { + echo '<option value="'.$key.'">'.$value.'</option>'; + } + ?> </select> - <br /> - <a href="./?cat=imagefields_define_exif">define fields</a> </td> </tr> <tr> <td> - <input type="button" name="remove" value="delete selected" onclick="deleteElement()" /> - <br /><br /> - <input type="text" name="title_name" value="" /><br /> - <input type="button" name="add_title" value="add title" onclick="addElement()" /> - </td> - <td> <input type="button" name="iptc_shiftleft" value="<" onclick="copyElement('iptc_fields')" /> </td> <td> - IPTC fields<br /> - <select id="iptc_fields" name="iptc_fields" size="7" style="width: 200px;"> - <option value="iptc1">iptc1</option> - <option value="iptc2">iptc2</option> - <option value="iptc3">iptc3</option> - <option value="iptc4">iptc4</option> + IPTC fields (<a href="./?cat=imagefields_define_iptc">define</a>)<br /> + <?php + if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { + $str_disabled = ''; + } else { + $str_disabled = ' disabled="disabled"'; + } + ?> + <select id="iptc_fields" name="iptc_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> + <?php + $array_selected_fields = get_selected_fields('iptc'); + foreach($array_selected_fields AS $key=>$value) + { + echo '<option value="'.$key.'">'.$value.'</option>'; + } + ?> </select> - <br /> - <a href="./?cat=imagefields_define_iptc">define fields</a> </td> </tr> </table> - + <br /> + <input type="hidden" name="cmd" value="select_image_fields" /> + <input type="submit" name="submit" value="submit" /> + </div> </form> <?php @@ -123,96 +150,115 @@ * http://www.babailiica.com/js/sorter/ */ +function selectAll() +{ + obj = document.getElementById('select_image_fields'); + for (var i=0; i<obj.length; i++) { + obj[i].selected = true; + } +} + + function copyElement (coming_from) { - obj = document.getElementById(coming_from); + obj_from = document.getElementById(coming_from); + obj = document.getElementById('select_image_fields'); - NewEntry = new Option( obj.options[ obj.selectedIndex ].text, obj.options[ obj.selectedIndex ].value, false, true ); - document.form_image_fields.select_image_fields.options[document.form_image_fields.select_image_fields.options.length] = NewEntry; + NewEntry = new Option( obj_from.options[ obj_from.selectedIndex ].text, obj_from.options[ obj_from.selectedIndex ].value, false, true ); + obj.options[ obj.options.length ] = NewEntry; + + /** + * remove new selection on left side + */ + obj.options[ obj.options.length-1 ].selected = false; } function addElement () { + obj = document.getElementById('select_image_fields'); + NewEntry = new Option( document.form_image_fields.title_name.value, document.form_image_fields.title_name.value, false, true ); NewEntry.className = "option_title"; - document.form_image_fields.select_image_fields.options[document.form_image_fields.select_image_fields.options.length] = NewEntry; + obj.options[obj.options.length] = NewEntry; document.form_image_fields.title_name.value = ""; } function deleteElement () { - current_index = document.form_image_fields.select_image_fields.selectedIndex; - document.form_image_fields.select_image_fields.options[ current_index ] = null; + obj = document.getElementById('select_image_fields'); + + current_index = obj.selectedIndex; + obj.options[ current_index ] = null; /** * set selectedIndex back to field above */ - if( current_index == document.form_image_fields.select_image_fields.length ) + if( current_index == obj.length ) { - document.form_image_fields.select_image_fields.selectedIndex = current_index - 1; + obj.selectedIndex = current_index - 1; } else { - document.form_image_fields.select_image_fields.selectedIndex = current_index; + obj.selectedIndex = current_index; } } function moveupElement () { - current_index = document.form_image_fields.select_image_fields.selectedIndex; + obj = document.getElementById('select_image_fields'); + + current_index = obj.selectedIndex; if( current_index != 0 ) { /** * swap entries */ - obj = document.form_image_fields.select_image_fields.options; + tmp_value = obj.options[ current_index ].value; + tmp_text = obj.options[ current_index ].text; + tmp_class = obj.options[ current_index ].className; - tmp_value = obj[ current_index ].value; - tmp_text = obj[ current_index ].text; - tmp_class = obj[ current_index ].className; - - obj[ current_index ].value = obj[ current_index - 1].value; - obj[ current_index ].text = obj[ current_index - 1].text; - obj[ current_index ].className = obj[ current_index - 1].className; + obj.options[ current_index ].value = obj.options[ current_index - 1].value; + obj.options[ current_index ].text = obj.options[ current_index - 1].text; + obj.options[ current_index ].className = obj.options[ current_index - 1].className; - obj[ current_index - 1].value = tmp_value; - obj[ current_index - 1].text = tmp_text; - obj[ current_index - 1].className = tmp_class; + obj.options[ current_index - 1].value = tmp_value; + obj.options[ current_index - 1].text = tmp_text; + obj.options[ current_index - 1].className = tmp_class; /** * set selectedIndex back to swapped field */ - document.form_image_fields.select_image_fields.selectedIndex = current_index - 1; + obj.selectedIndex = current_index - 1; } } function movedownElement () { - current_index = document.form_image_fields.select_image_fields.selectedIndex; + obj = document.getElementById('select_image_fields'); + + current_index = obj.selectedIndex; - if( current_index != ( document.form_image_fields.select_image_fields.length - 1 ) ) + if( current_index != ( obj.length - 1 ) ) { /** * swap entries */ - obj = document.form_image_fields.select_image_fields.options; + tmp_value = obj.options[ current_index ].value; + tmp_text = obj.options[ current_index ].text; + tmp_class = obj.options[ current_index ].className; - tmp_value = obj[ current_index ].value; - tmp_text = obj[ current_index ].text; - tmp_class = obj[ current_index ].className; - - obj[ current_index ].value = obj[ current_index + 1].value; - obj[ current_index ].text = obj[ current_index + 1].text; - obj[ current_index ].className = obj[ current_index + 1].className; + obj.options[ current_index ].value = obj.options[ current_index + 1].value; + obj.options[ current_index ].text = obj.options[ current_index + 1].text; + obj.options[ current_index ].className = obj.options[ current_index + 1].className; - obj[ current_index + 1].value = tmp_value; - obj[ current_index + 1].text = tmp_text; - obj[ current_index + 1].className = tmp_class; + obj.options[ current_index + 1].value = tmp_value; + obj.options[ current_index + 1].text = tmp_text; + obj.options[ current_index + 1].className = tmp_class; /** * set selectedIndex back to swapped field */ - document.form_image_fields.select_image_fields.selectedIndex = current_index + 1; + obj.selectedIndex = current_index + 1; } } </script> \ No newline at end of file Modified: trunk/linpha2/db_data.sql =================================================================== --- trunk/linpha2/db_data.sql 2006-03-07 14:51:32 UTC (rev 4401) +++ trunk/linpha2/db_data.sql 2006-03-07 17:38:22 UTC (rev 4402) @@ -43,4 +43,15 @@ -- -------------------------------------------------------- -TRUNCATE `linpha_photos`; \ No newline at end of file +TRUNCATE `linpha_photos`; + + +-- +-- Daten f\xFCr Tabelle `linpha_meta_fields` +-- + +TRUNCATE `linpha_meta_fields`; +INSERT INTO `linpha_meta_fields` VALUES (1, 'description', 1, 1, 1); +INSERT INTO `linpha_meta_fields` VALUES (2, 'category', 2, 1, 1); +INSERT INTO `linpha_meta_fields` VALUES (3, 'persons', 2, 1, 1); +INSERT INTO `linpha_meta_fields` VALUES (4, 'date', 3, 1, 1); Modified: trunk/linpha2/get_thumb.php =================================================================== --- trunk/linpha2/get_thumb.php 2006-03-07 14:51:32 UTC (rev 4401) +++ trunk/linpha2/get_thumb.php 2006-03-07 17:38:22 UTC (rev 4402) @@ -29,7 +29,13 @@ throw new Exception("not permitted!"); } - $output = linImage::createThumbnail($data['id'],$data['img_type'],$force=false); + if( isset($_GET['force'] ) ) { + $force = true; + } else { + $force = false; + } + + $output = linImage::createThumbnail($data['id'],$data['img_type'],$force); Header("Content-type: image/jpeg"); readfile( $output ); } Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2006-03-07 14:51:32 UTC (rev 4401) +++ trunk/linpha2/install/sql/sql.mysql.php 2006-03-07 17:38:22 UTC (rev 4402) @@ -256,7 +256,6 @@ * create dynamically the linpha_meta_exif table */ include_once(LINPHA_DIR.'/lib/classes/metadata.class.php'); -$metadata = new MetaData; -$sql_tables[] = $metadata->createExifTable(); +$sql_tables[] = Metadata::createExifTable(); ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-03-07 14:51:32 UTC (rev 4401) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-03-07 17:38:22 UTC (rev 4402) @@ -66,8 +66,8 @@ * create new tmp folder */ $tmp_dir = $GLOBALS['linpha']->sql->config->value['sys_path_tmp_dir']; - for($i=0; file_exists(linFilesys::getFullPath($tmp_dir).'/thumb_folder_'.session_id().'_'.$i); $i++) { } - $tmp_folder = linFilesys::getFullPath($tmp_dir).'/thumb_folder_'.session_id().'_'.$i; + for($i=0; file_exists(linFilesys::getFullPath($tmp_dir).'thumb_folder_'.session_id().'_'.$i); $i++) { } + $tmp_folder = linFilesys::getFullPath($tmp_dir).'thumb_folder_'.session_id().'_'.$i; mkdir($tmp_folder,0700); /** Modified: trunk/linpha2/lib/classes/metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/metadata.class.php 2006-03-07 14:51:32 UTC (rev 4401) +++ trunk/linpha2/lib/classes/metadata.class.php 2006-03-07 17:38:22 UTC (rev 4402) @@ -23,8 +23,6 @@ if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','..'); } -include_once(LINPHA_DIR.'/lib/classes/metadata.config.php'); - class MetaData { var $trans_array; @@ -843,30 +841,26 @@ /** * $suffix required to create temporary table during upgrade on sqlite */ - function createExifTable($suffix='') + function createExifTable($array) { - if(!defined('PREFIX')): define('PREFIX', $_POST['db_prefix']); endif; - - $array = $this->getExifTranslationArray(); - if(DB_TYPE == "mysql") { - $str = "CREATE TABLE ".PREFIX."meta_exif".$suffix." (". + $str = "CREATE TABLE ".PREFIX."meta_exif (". "md5sum VARCHAR(32) NOT NULL, "; foreach($array AS $key=>$value) { - $str .= strtolower($key)." VARCHAR(255), "; + $str .= linSql::linAddslashes(strtolower($value))." VARCHAR(255), "; } $str .= "PRIMARY KEY (md5sum), "; $str .= "KEY (md5sum) )"; } elseif(DB_TYPE == "sqlite") { - $str = "CREATE TABLE ".PREFIX."meta_exif".$suffix." (". + $str = "CREATE TABLE ".PREFIX."meta_exif (". "md5sum VARCHAR(32) PRIMARY KEY NOT NULL, "; foreach($array AS $key=>$value) { - $str .= strtolower($key)." VARCHAR(255), "; + $str .= strtolower($value)." VARCHAR(255), "; } /** * remove last 2 signs (the comma and the space) @@ -875,12 +869,12 @@ } elseif(DB_TYPE == "postgres") { - $str = "CREATE TABLE ".PREFIX."meta_exif".$suffix." (". + $str = "CREATE TABLE ".PREFIX."meta_exif (". "md5sum VARCHAR(32) NOT NULL, "; foreach($array AS $key=>$value) { - $str .= strtolower($key)." VARCHAR(255), "; + $str .= strtolower($value)." VARCHAR(255), "; } /** @@ -890,6 +884,88 @@ } return $str; } + +/** + * get array with iptctags + */ +function getIptcTranslationArray() +{ + return array( + 'caption' => 'Caption', + 'caption_writer' => 'Caption Writer', + 'headline' => 'Headline', + 'instructions' => 'Special Instructions', + 'keywords' => 'Keywords', + 'category' => 'Category', + 'supplemental_categorie' => 'Supplemental Category', + 'copyright' => 'Copyright Notice', + 'byline' => 'By-Line (Author)', + 'byline_title' => 'By-Line Title', + 'credit' => 'Credit', + 'source' => 'Source', + 'edit_status' => 'Edit Status', + 'priority' => 'Priority', + 'object_cycle' => 'Object Cycle', + 'job_id' => 'Fixture Identifier', + 'program' => 'Originating Program', + 'object_name' => 'Object Name (Title)', + 'date_created' => 'Date Created', + 'date_released' => 'Release Date', + 'time_created' => 'Time Created', + 'time_released' => 'Release Time', + 'city' => 'City', + 'sublocation' => 'Sub-Location', + 'state' => 'Province/State', + 'country' => 'Country Name', + 'country_code' => 'Country Code', + 'trans_reference' => 'Transmission Reference' + ); } - + +function createIptcTable($array) +{ + if(DB_TYPE == "mysql") + { + $str = "CREATE TABLE ".PREFIX."meta_iptc (". + "md5sum VARCHAR(32) NOT NULL, "; + + foreach($array AS $key=>$value) + { + $str .= linSql::linAddslashes(strtolower($value))." VARCHAR(255), "; + } + $str .= "PRIMARY KEY (md5sum), "; + $str .= "KEY (md5sum) )"; + } + elseif(DB_TYPE == "sqlite") + { + $str = "CREATE TABLE ".PREFIX."meta_iptc (". + "md5sum VARCHAR(32) PRIMARY KEY NOT NULL, "; + foreach($array AS $key=>$value) + { + $str .= strtolower($value)." VARCHAR(255), "; + } + /** + * remove last 2 signs (the comma and the space) + */ + $str = substr($str,0,strlen($str)-2).")"; + } + elseif(DB_TYPE == "postgres") + { + $str = "CREATE TABLE ".PREFIX."meta_iptc (". + "md5sum VARCHAR(32) NOT NULL, "; + + foreach($array AS $key=>$value) + { + $str .= strtolower($value)." VARCHAR(255), "; + } + + /** + * remove last 2 signs (the comma and the space) + */ + $str = substr($str,0,strlen($str)-2).")"; + } + return $str; +} + +} // end class metadata ?> \ No newline at end of file Deleted: trunk/linpha2/lib/classes/metadata.config.php =================================================================== --- trunk/linpha2/lib/classes/metadata.config.php 2006-03-07 14:51:32 UTC (rev 4401) +++ trunk/linpha2/lib/classes/metadata.config.php 2006-03-07 17:38:22 UTC (rev 4402) @@ -1,128 +0,0 @@ -<?php - -/** - * 1 -> low, 2 -> medium, 3 -> high - */ -function getExifTagsByVerbosityLevel($level) -{ - $array[1] = Array( - 'DateTimeOriginal','Make','Model','Artist','Copyright' - ); - - $array[2] = Array( - 'DateTimeOriginal','Make','Model','Artist','Copyright' - ,'ApertureValue','ShutterSpeedValue','ExposureTime' - ); - - $array[3] = Array( - 'DateTimeOriginal','Make','Model','Artist','Copyright' - ,'ApertureValue','ShutterSpeedValue','ExposureTime' - ,'ISOSpeedRatings','Flash','FocalLength','FNumber' - ); - - if(isset($array[$level])) - { - return $array[$level]; - } - else - { - return $array[2]; - } -} - -/** - * 1 -> low, 2 -> medium, 3 -> high - */ -function getIptcTagsByVerbosityLevel($level) -{ - $array[1] = Array( - 'caption','caption_writer','headline','instructions', 'copyright' - ,'keywords', 'object_name' - ); - - $array[2] = Array( - 'caption','caption_writer','headline','instructions','copyright','byline' - ,'byline_title','object_name', 'keywords','category','supplemental_categorie' - ); - - $array[3] = Array( - 'caption','caption_writer','headline','instructions','copyright','byline' - ,'byline_title','object_name','keywords','category','supplemental_categorie' - ,'credit','source','date_created','time_created' - ); - - if(isset($array[$level])) - { - return $array[$level]; - } - else - { - return $array[2]; - } -} - -$iptc_search_tags = Array( - 'caption_writer','caption','keywords','headline','copyright','source','byline' - , 'object_name'); - -$exif_search_tags = Array( - 'DateTimeOriginal', 'ImageDescription','JpegComment','Artist','Copyright','Make','Model' - ); - -function getIptcTranslationArray() -{ - return array( - 'caption' => 'Caption', - 'caption_writer' => 'Caption Writer', - 'headline' => 'Headline', - 'instructions' => 'Special Instructions', - 'keywords' => 'Keywords', - 'category' => 'Category', - 'supplemental_categorie' => 'Supplemental Category', - 'copyright' => 'Copyright Notice', - 'byline' => 'By-Line (Author)', - 'byline_title' => 'By-Line Title', - 'credit' => 'Credit', - 'source' => 'Source', - 'edit_status' => 'Edit Status', - 'priority' => 'Priority', - 'object_cycle' => 'Object Cycle', - 'job_id' => 'Fixture Identifier', - 'program' => 'Originating Program', - 'object_name' => 'Object Name (Title)', - 'date_created' => 'Date Created', - 'date_released' => 'Release Date', - 'time_created' => 'Time Created', - 'time_released' => 'Release Time', - 'city' => 'City', - 'sublocation' => 'Sub-Location', - 'state' => 'Province/State', - 'country' => 'Country Name', - 'country_code' => 'Country Code', - 'trans_reference' => 'Transmission Reference' - ); -} - -/** - * Function used in search.php to translate iptc tags to human readable values - * if called with $arg == single. If called with $arg == array return the wholw - * thing for metadata.class.php (i.e. left_view ) - * @returns $array or single array value - */ -function translateIptcSearchTags($tag, $arg) -{ - $trans_array = getIptcTranslationArray(); - - /** - * return: either single value or whole array - */ - if($arg == "single") - { - return $trans_array[$tag]; - } - else - { - return $trans_array; - } -} -?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-08 16:32:38
|
Revision: 4405 Author: fangehrn Date: 2006-03-08 08:32:29 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4405&view=rev Log Message: ----------- Removed Paths: ------------- trunk/linpha2/albums.php trunk/linpha2/albums_test.php Deleted: trunk/linpha2/albums.php =================================================================== Deleted: trunk/linpha2/albums_test.php =================================================================== --- trunk/linpha2/albums_test.php 2006-03-08 16:31:25 UTC (rev 4404) +++ trunk/linpha2/albums_test.php 2006-03-08 16:32:29 UTC (rev 4405) @@ -1,111 +0,0 @@ -<?php -$def_tn_size = 150; - -$array_tn_sizes = Array(50,75,100,150,200,250,300,400,500); -?> -<html> -<head> -<style type="text/css"> -body { - margin-left: 250px; - -} - -.div { - border: 1px #000000 solid; - margin: 3px; - text-align: center; - float: left; -} - -.infodiv { - float: left; - border: 1px #000000 solid; - margin-right: 10px; - padding: 5px; - height: 30px; -} -</style> - -<script language="JavaScript" type="text/javascript"> - -var show_debug = 1; - -var tot_photos = 100; -var startup_page = 1; -img_ids = new Array(tot_photos); - -for(var i = 1; i <= tot_photos; i++) -{ - img_ids[i] = i; -} - - -</script> - -<script type="text/javascript" language="javascript" src="lib/classes/thumbnails.js"> </script> - -</head> -<body onload="init()"> - -<div id='info0' style="height: 140px;"> -<div id='info1' class="infodiv">info1</div> -<div id='info2' class="infodiv">info2</div> -<div id='info3' class="infodiv">info3</div> -<div class="infodiv"> - -<select id="tn_size" name="tn_size" onchange="display_images();"> -<?php -foreach($array_tn_sizes AS $value) -{ - if($value == $def_tn_size) - { - $str_selected = ' selected="selected"'; - } - else - { - $str_selected = ''; - } - echo '<option value="'.$value.'"'.$str_selected.'>'.$value.' Pixel</option>'."\n"; -} -?> -</select> -</div> -<div class="infodiv"> -<select id="nr_tn" name="nr_tn" onchange="display_images()"> -<option value='auto' selected="selected">Auto</option><?php // in Opera, we need a value='' !!!!!! ?> -<option value='10'>10</option> -<option value='25'>25</option> -<option value='50'>50</option> -<option value='100'>100</option> -<option value='200'>200</option> -<option value='all'>All</option> -</select> -</div> - -<div class="infodiv"> -<a href="javascript:view_source_code()">View Source Code</a> -</div> -<br /><br /> -<div id='page_nr_left' style="margin-top: 20px; clear:left; " class="infodiv">page nr left</div> -<div id='page_nr' style="width: 350px; text-align: center; margin-top: 20px;" class="infodiv">page nr middle</div> -<div id='page_nr_right' style="margin-top: 20px;" class="infodiv">page nr right</div> - -</div> - -<div id='mainmaindiv' class='div' style="width: 100%; bottom: 25px;"> -<div id="maindiv"></div> -</div> - - -<script language="JavaScript" type="text/javascript"> - -window.onresize = display_images; - - - -</script> - - -</body> -</html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-08 16:31:42
|
Revision: 4404 Author: fangehrn Date: 2006-03-08 08:31:25 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4404&view=rev Log Message: ----------- * finished first stage of image fields Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/image_fields.php trunk/linpha2/admin/image_fields_define.php trunk/linpha2/admin/image_fields_define_post.php trunk/linpha2/admin/image_fields_select.php trunk/linpha2/db_data.sql trunk/linpha2/db_mysql.sql trunk/linpha2/install/sql/sql.mysql.php trunk/linpha2/install/sql/sql.postgres.php trunk/linpha2/install/sql/sql.sqlite.php trunk/linpha2/install/sql/sql.tables.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/templates/main_html/global.html.php trunk/linpha2/templates/main_html/view_basket.html.php trunk/linpha2/templates/main_html/view_img.html.php trunk/linpha2/templates/main_html/view_thumb.html.php trunk/linpha2/templates/main_html/view_thumbdetail.html.php Removed Paths: ------------- trunk/linpha2/lib/classes/metadata.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/ChangeLog 2006-03-08 16:31:25 UTC (rev 4404) @@ -1,3 +1,6 @@ +2006-03-08 flo + * finished first stage of image fields + 2006-03-07 flo * adding forced thumbnail recreation * working on image fields Modified: trunk/linpha2/admin/image_fields.php =================================================================== --- trunk/linpha2/admin/image_fields.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/admin/image_fields.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -22,66 +22,5 @@ include_once('./image_fields_define.php'); break; } - -/** - * workaround.. - */ -$array_available_fields = Array(); -function get_selected_fields($what) -{ - include_once(LINPHA_DIR.'/lib/classes/metadata.class.php'); - - switch($what) - { - case 'exif': - - $GLOBALS['array_available_fields'] = MetaData::getExifTranslationArray(); - - /** - * modify array as needed - * change key to lowercase - */ - foreach($GLOBALS['array_available_fields'] AS $key=>$value) - { - $new_key = strtolower($key); - unset($GLOBALS['array_available_fields'][$key]); - $GLOBALS['array_available_fields'][$new_key] = $key; - } - - $array_selected_fields = $GLOBALS['linpha']->db->MetaColumns(PREFIX."meta_exif"); - - break; - case 'iptc': - $GLOBALS['array_available_fields'] = MetaData::getIptcTranslationArray(); - - $array_selected_fields = $GLOBALS['linpha']->db->MetaColumns(PREFIX."meta_iptc"); - break; - } - - /** - * change keys to lowercase - */ - foreach($array_selected_fields AS $key=>$value) - { - $new_key = strtolower($key); - unset($array_selected_fields[$key]); - $array_selected_fields[$new_key] = $GLOBALS['array_available_fields'][$new_key]; - } - - /** - * remove md5sum entry - */ - unset($array_selected_fields['md5sum']); - - /** - * remove selected_fields from available_fields - */ - foreach($array_selected_fields AS $key=>$value) - { - unset($GLOBALS['array_available_fields'][$key]); - } - - return $array_selected_fields; -} ?> Modified: trunk/linpha2/admin/image_fields_define.php =================================================================== --- trunk/linpha2/admin/image_fields_define.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/admin/image_fields_define.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -239,8 +239,23 @@ function show_exif_iptc() { - $array_selected_fields = get_selected_fields($GLOBALS['cat3']); + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + $MetaData = new MetaData(); + $MetaData->setFields( $GLOBALS['cat3'] ); + switch($GLOBALS['cat3']) + { + case 'exif': + $defined_fields = 'defined_exif_fields'; + $available_fields = 'available_exif_fields'; + break; + case 'iptc': + $defined_fields = 'defined_iptc_fields'; + $available_fields = 'available_iptc_fields'; + break; + } + + /** * get enabled/disabled setting */ @@ -263,7 +278,7 @@ Selected fields<br /> <select id="selected_fields" name="selected_fields[]" size="25" style="width: 200px;" multiple="multiple"> <?php - foreach($array_selected_fields AS $key=>$value) + foreach($MetaData->$defined_fields AS $key=>$value) { echo '<option value="'.$key.'">'.$value.'</option>'."\n"; } @@ -280,7 +295,7 @@ Available fields<br /> <select id="all_fields" name="builtin_fields" size="25" style="width: 200px;"> <?php - foreach($GLOBALS['array_available_fields'] AS $key=>$value) + foreach($MetaData->$available_fields AS $key=>$value) { echo '<option value="'.$key.'">'.$value.'</option>'; } Modified: trunk/linpha2/admin/image_fields_define_post.php =================================================================== --- trunk/linpha2/admin/image_fields_define_post.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/admin/image_fields_define_post.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -72,7 +72,7 @@ $linpha->sql->config->reloadConfig(); break; case 'create_exifiptc': - include_once(LINPHA_DIR.'/lib/classes/metadata.class.php'); + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); if( ! isset($_POST['selected_fields'])) { $_POST['selected_fields'] = Array(); Modified: trunk/linpha2/admin/image_fields_select.php =================================================================== --- trunk/linpha2/admin/image_fields_select.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/admin/image_fields_select.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -8,12 +8,28 @@ $array_menu = Array( 'image' => Array('name' => 'Image', 'link' => 'imagefields_select_image'), - 'video' => Array('name' => 'Video', 'link' => 'imagefields_select_video') + 'video' => Array('name' => 'Video', 'link' => 'imagefields_select_video'), + 'album' => Array('name' => 'Album', 'link' => 'imagefields_select_album') ); if(isset($_POST['cmd'])) { - print_r($_POST['select_image_fields']); + /** + * delete all existing entries in database + */ + $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_fields WHERE builtin = '10'"); + + /** + * write new entrys + */ + if(isset($_POST['select_image_fields'])) + { + foreach($_POST['select_image_fields'] AS $value) + { + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_fields (name, builtin)" . + " VALUES ('".linSql::linAddslashes($value)."','10')"); + } + } } print_admin_menu($array_menu,$cat3); @@ -21,18 +37,28 @@ switch($cat3) { case 'image': + /** + * set exif/iptc fields + */ + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + $MetaData = new MetaData(); + $MetaData->setFields('exif'); + $MetaData->setFields('iptc'); ?> <form name="form_image_fields" method="POST" onsubmit="selectAll()"> <div align="center"> <table border="0"> <tr> <td valign="top" rowspan="4" align="center"> - Current image fields shown<br /> + Selected fields<br /> <select id="select_image_fields" name="select_image_fields[]" size="25" style="width: 200px;" multiple="multiple"> - <option value="element1">element1</option> - <option value="element2">element2</option> - <option value="element3">element3</option> - <option value="element4">element4</option> + <?php + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE builtin = '10' ORDER by id"); + while($data = $query->FetchRow()) + { + echo '<option value="'.$data['name'].'">'.$MetaData->getNameOfField($data['name'],true).'</option>'; + } + ?> </select> <br /> <input type="button" name="shift_up" value="^" onclick="moveupElement()" /> @@ -44,17 +70,17 @@ <input type="button" name="add_title" value="add title" onclick="addElement()" /> </td> <td> - <input type="button" name="builtin_shiftleft" value="<" onclick="copyElement('builtin_fields')" /> + <input type="button" name="builtin_shiftleft" value="<" onclick="copyElement('image_fields')" /> </td> <td> - Builtin fields (<a href="./?cat=imagefields_define_own">define</a>)<br /> - <select id="builtin_fields" name="builtin_fields" size="7" style="width: 200px;"> + Image fields<br /> + <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 = '1' AND enabled = '1'"); + "WHERE builtin = '2'"); while($data = $query->FetchRow()) { - echo '<option value="'.$data['id'].'">'.$data['name'].'</option>'; + echo '<option value="id_'.$data['id'].'">'.$MetaData->array_special_fields[$data['name']].'</option>'; } ?> </select> @@ -65,14 +91,14 @@ <input type="button" name="own_shiftleft" value="<" onclick="copyElement('own_fields')" /> </td> <td> - Own fields (<a href="./?cat=imagefields_define_own">define</a>)<br /> + Tag fields (<a href="./?cat=imagefields_define_own">define</a>)<br /> <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 = '0' AND enabled = '1'"); + "WHERE (builtin = '1' OR builtin = '0') AND enabled = '1'"); while($data = $query->FetchRow()) { - echo '<option value="'.$data['id'].'">'.$data['name'].'</option>'; + echo '<option value="id_'.$data['id'].'">'.$data['name'].'</option>'; } ?> </select> @@ -93,10 +119,9 @@ ?> <select id="exif_fields" name="exif_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> <?php - $array_selected_fields = get_selected_fields('exif'); - foreach($array_selected_fields AS $key=>$value) + foreach($MetaData->defined_exif_fields AS $key=>$value) { - echo '<option value="'.$key.'">'.$value.'</option>'; + echo '<option value="exif_'.$key.'">'.$value.'</option>'; } ?> </select> @@ -117,10 +142,9 @@ ?> <select id="iptc_fields" name="iptc_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> <?php - $array_selected_fields = get_selected_fields('iptc'); - foreach($array_selected_fields AS $key=>$value) + foreach($MetaData->defined_iptc_fields AS $key=>$value) { - echo '<option value="'.$key.'">'.$value.'</option>'; + echo '<option value="iptc_'.$key.'">'.$value.'</option>'; } ?> </select> @@ -168,6 +192,19 @@ obj.options[ obj.options.length ] = NewEntry; /** + * append ' (exif)' and ' (iptc)' + */ + if(coming_from=='exif_fields') + { + obj.options[ obj.options.length-1 ].text = obj.options[ obj.options.length-1 ].text + ' (exif)'; + } + if(coming_from=='iptc_fields') + { + obj.options[ obj.options.length-1 ].text = obj.options[ obj.options.length-1 ].text + ' (iptc)'; + } + + + /** * remove new selection on left side */ obj.options[ obj.options.length-1 ].selected = false; Modified: trunk/linpha2/db_data.sql =================================================================== --- trunk/linpha2/db_data.sql 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/db_data.sql 2006-03-08 16:31:25 UTC (rev 4404) @@ -49,9 +49,18 @@ -- -- Daten f\xFCr Tabelle `linpha_meta_fields` -- - TRUNCATE `linpha_meta_fields`; -INSERT INTO `linpha_meta_fields` VALUES (1, 'description', 1, 1, 1); -INSERT INTO `linpha_meta_fields` VALUES (2, 'category', 2, 1, 1); -INSERT INTO `linpha_meta_fields` VALUES (3, 'persons', 2, 1, 1); -INSERT INTO `linpha_meta_fields` VALUES (4, 'date', 3, 1, 1); +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); Modified: trunk/linpha2/db_mysql.sql =================================================================== --- trunk/linpha2/db_mysql.sql 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/db_mysql.sql 2006-03-08 16:31:25 UTC (rev 4404) @@ -98,3 +98,38 @@ isprivate int(11) default NULL, PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Tabellenstruktur f\xFCr Tabelle `linpha_meta_exif` +-- + +DROP TABLE IF EXISTS linpha_meta_exif; +CREATE TABLE IF NOT EXISTS linpha_meta_exif ( + md5sum varchar(32) collate latin1_general_ci NOT NULL default '', + datetimeoriginal varchar(255) collate latin1_general_ci default NULL, + make varchar(255) collate latin1_general_ci default NULL, + model varchar(255) collate latin1_general_ci default NULL, + artist varchar(255) collate latin1_general_ci default NULL, + copyright varchar(255) collate latin1_general_ci default NULL, + aperturevalue varchar(255) collate latin1_general_ci default NULL, + shutterspeedvalue varchar(255) collate latin1_general_ci default NULL, + exposuretime varchar(255) collate latin1_general_ci default NULL, + isospeedratings varchar(255) collate latin1_general_ci default NULL, + flash varchar(255) collate latin1_general_ci default NULL, + focallength varchar(255) collate latin1_general_ci default NULL, + fnumber varchar(255) collate latin1_general_ci default NULL, + PRIMARY KEY (md5sum), + KEY md5sum (md5sum) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + +-- +-- Tabellenstruktur f\xFCr Tabelle `linpha_meta_iptc` +-- + +DROP TABLE IF EXISTS linpha_meta_iptc; +CREATE TABLE IF NOT EXISTS linpha_meta_iptc ( + md5sum varchar(32) collate latin1_general_ci NOT NULL default '', + PRIMARY KEY (md5sum), + KEY md5sum (md5sum) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/install/sql/sql.mysql.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -255,7 +255,7 @@ /** * create dynamically the linpha_meta_exif table */ -include_once(LINPHA_DIR.'/lib/classes/metadata.class.php'); +include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); $sql_tables[] = Metadata::createExifTable(); ?> \ No newline at end of file Modified: trunk/linpha2/install/sql/sql.postgres.php =================================================================== --- trunk/linpha2/install/sql/sql.postgres.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/install/sql/sql.postgres.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -224,9 +224,9 @@ /** * create dynamically the linpha_meta_exif table */ -include_once(LINPHA_DIR.'/lib/classes/metadata.class.php'); -$metadata = new MetaData; -$sql_tables[] = $metadata->createExifTable(); +include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); +$sql_tables[] = Metadata::createExifTable(); + /** * make md5sum UNIQUE in postgres DB (linpha_meta_iptc and linpha_meta_exif) Modified: trunk/linpha2/install/sql/sql.sqlite.php =================================================================== --- trunk/linpha2/install/sql/sql.sqlite.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/install/sql/sql.sqlite.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -225,8 +225,7 @@ /** * create dynamically the linpha_meta_exif table */ -include_once(LINPHA_DIR.'/lib/classes/metadata.class.php'); -$metadata = new MetaData; -$sql_tables[] = $metadata->createExifTable(); +include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); +$sql_tables[] = Metadata::createExifTable(); ?> \ No newline at end of file Modified: trunk/linpha2/install/sql/sql.tables.php =================================================================== --- trunk/linpha2/install/sql/sql.tables.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/install/sql/sql.tables.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -39,7 +39,6 @@ "mail_list" => "mail_list", //"facetmap" => "facetmap", "permissions" => "permissions", - "meta_iptc" => "meta_iptc", "blacklist" => "blacklist", "meta_exif" => "meta_exif" ); Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -319,7 +319,40 @@ /** * set navigation line */ - $this->output['navigation'] .= ' '.$this->photos_filtered[$current_key]['name']; + $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 + */ + $this->output['image_infos'] = ''; + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + $MetaData = new MetaData(); + $MetaData->setFields('exif'); + $MetaData->setFields('iptc'); + + $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 />'; + } + } /** Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -25,8 +25,156 @@ class MetaData { -var $trans_array; +public $all_exif_fields, $all_iptc_fields; +public $available_exif_fields, $available_iptc_fields; +public $defined_exif_fields, $defined_iptc_fields; +private $current_all_fields, $current_available_fields, $current_defined_fields; + +function __construct() +{ + + /** + * should be replaced if language files are implemented... + */ + $this->array_special_fields = Array( + 'filename'=>'Filename', + 'imagesize'=>'Image Size', + 'dimension'=>'Dimension', + 'persons' => 'Persons', + 'description' => 'Description', + 'category' => 'Category', + 'date' => 'Date' + ); +} + +function getNameOfField( $key , $show_exifiptc_in_brackets) +{ + $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 + $data2 = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."meta_fields WHERE id = '".$last_part."'"); + $value = $this->array_special_fields[$data2['name']]; + break; + case 'exif': + $value = $this->all_exif_fields[$last_part]; + if($show_exifiptc_in_brackets) { + $value .= ' (exif)'; + } + break; + case 'iptc': + $value = $this->all_iptc_fields[$last_part]; + if($show_exifiptc_in_brackets) { + $value .= ' (iptc)'; + } + break; + } + + return $value; +} + +function getDefaultExifFields() +{ + return Array + ( + 'datetimeoriginal', + 'make', + 'model', + 'artist', + 'copyright', + 'aperturevalue', + 'shutterspeedvalue', + 'exposuretime', + 'isospeedratings', + 'flash', + 'focallength', + 'fnumber' + ); +} + +function setFields($what) +{ + switch($what) + { + case 'exif': + + $this->all_exif_fields = $this->getExifTranslationArray(); + + /** + * modify array as needed + * change key to lowercase + */ + foreach($this->all_exif_fields AS $key=>$value) + { + $new_key = strtolower($key); + unset($this->all_exif_fields[$key]); + $this->all_exif_fields[$new_key] = $key; + } + + $this->defined_exif_fields = $GLOBALS['linpha']->db->MetaColumns(PREFIX."meta_exif"); + + $this->current_defined_fields = $this->defined_exif_fields; + $this->current_available_fields = $this->available_exif_fields; + $this->current_all_fields = $this->all_exif_fields; + + break; + case 'iptc': + $this->all_iptc_fields = MetaData::getIptcTranslationArray(); + + $this->defined_iptc_fields = $GLOBALS['linpha']->db->MetaColumns(PREFIX."meta_iptc"); + + $this->current_defined_fields = $this->defined_iptc_fields; + $this->current_available_fields = $this->available_iptc_fields; + $this->current_all_fields = $this->all_iptc_fields; + + break; + } + + /** + * remove md5sum entry + */ + unset($this->current_defined_fields['MD5SUM']); + + + /** + * change keys to lowercase + */ + foreach($this->current_defined_fields AS $key=>$value) + { + $new_key = strtolower($key); + unset($this->current_defined_fields[$key]); + $this->current_defined_fields[$new_key] = $this->current_all_fields[$new_key]; + } + + /** + * create available_fields + */ + foreach($this->current_all_fields AS $key=>$value) + { + if( ! isset( $this->current_defined_fields[$key] )) + { + $this->current_available_fields[$key] = $value; + } + } + + switch($what) + { + case 'exif': + $this->defined_exif_fields = $this->current_defined_fields; + $this->available_exif_fields = $this->current_available_fields; + $this->all_exif_fields = $this->current_all_fields; + break; + case 'iptc': + $this->defined_iptc_fields = $this->current_defined_fields; + $this->available_iptc_fields = $this->current_available_fields; + $this->all_iptc_fields = $this->current_all_fields; + break; + } +} + /** * store EXIF data in DB * @@ -838,11 +986,13 @@ ); } - /** - * $suffix required to create temporary table during upgrade on sqlite - */ - function createExifTable($array) + function createExifTable($array='') { + if(empty($array)) + { + $array = $this->getDefaultExifFields(); + } + if(DB_TYPE == "mysql") { $str = "CREATE TABLE ".PREFIX."meta_exif (". @@ -922,8 +1072,13 @@ ); } -function createIptcTable($array) +function createIptcTable($array='') { + if(empty($array)) + { + $array = Array(); + } + if(DB_TYPE == "mysql") { $str = "CREATE TABLE ".PREFIX."meta_iptc (". Deleted: trunk/linpha2/lib/classes/metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/metadata.class.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/lib/classes/metadata.class.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -1,971 +0,0 @@ -<?php -/** - * This class handles all the EXIF and IPTC stuff used in LinPHA - */ - -/* -* Copyright (c) 2002-2005 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','..'); } - -class MetaData { - -var $trans_array; - - /** - * store EXIF data in DB - * - * create an entry in the db even if we haven't found anything - * to prevent img_view.class.php to call this function every time - * the image is viewed - */ - function saveExifData($filename,$md5sum) - { - /** - * get exif info from file - */ - $exif_data = get_EXIF_JPEG( $filename ); - - /** - * get exif tags - */ - $exif_tags = $this->getExifTranslationArray(); - - /** - * special tags - */ - // Canon Owner Name append to Artist - if(isset($exif_data['Makernote_Tag']['Decoded Data']) - && is_array($exif_data['Makernote_Tag']['Decoded Data']) // sometimes 'Decoded Data' is an empty string - && isset($exif_data['Makernote_Tag']['Decoded Data'][0][9]['Text Value'])) - { - $owner = $exif_data['Makernote_Tag']['Decoded Data'][0][9]['Text Value']; - if(isset($exif_data[0][315]['Text Value'])) - { - $exif_data[0][315]['Text Value'] .= $owner; - } - else - { - $exif_data[0][315]['Text Value'] = $owner; - } - - } - - /** - * search for valid tags - */ - $str_columns = "md5sum, "; - $str_values = "'".$md5sum."', "; - foreach($exif_tags AS $key=>$value) - { - if($value != "") - { - /** - * there are currently only entries at level deep 2 and 5 in the - * array - */ - $array_pieces = explode('/',$value); - switch(count($array_pieces)) - { - case 2: - if(isset($exif_data[ $array_pieces[0] ][ $array_pieces[1] ]['Text Value'])) - { - $str_columns .= strtolower($key).', '; - - $exif_value = $exif_data[ $array_pieces[0] ][ $array_pieces[1] ]['Text Value']; - $str_values .= "'".linpha_addslashes(trim( $exif_value ))."', "; - } - break; - case 5: - if(isset($exif_data[ $array_pieces[0] ][ $array_pieces[1] ][ $array_pieces[2] ][ $array_pieces[3] ][ $array_pieces[4] ]['Text Value'])) - { - $str_columns .= strtolower($key).', '; - - $exif_value = $exif_data[ $array_pieces[0] ][ $array_pieces[1] ][ $array_pieces[2] ][ $array_pieces[3] ][ $array_pieces[4] ]['Text Value']; - $str_values .= "'".linpha_addslashes(trim( $exif_value ))."', "; - } - break; - default: - echo "Error no valid path for key: ".$key." value: ".$value; - break; - } - } - } - - include_once(LINPHA_DIR.'/include/phpmeta/JPEG.php'); - - /** - * add jpegcomment - */ - $jpeg_header_data = get_jpeg_header_data( $filename ); - $comment = get_jpeg_Comment( $jpeg_header_data ); - if(!empty($comment)) - { - $str_columns .= 'jpegcomment, '; - $str_values .= "'".linpha_addslashes(trim( $comment ))."', "; - } - - /** - * remove last two signs - */ - $str_columns = substr($str_columns,0,strlen($str_columns)-2); - $str_values = substr($str_values,0,strlen($str_values)-2); - - - /** - * no double entries - */ - $query = $GLOBALS['db']->Execute("SELECT md5sum FROM ".PREFIX."meta_exif ". - "WHERE md5sum = '".$md5sum."'"); - $num = $query->RecordCount(); - if($num == 0) - { - $GLOBALS['db']->Execute("INSERT into ".PREFIX."meta_exif (".$str_columns.") ". - "VALUES (".$str_values.")"); - } - } - - /** - * esacape sql strings a clean way - - function cleansql($text) - { - $return=""; - $chars = preg_split('//', $text, -1, PREG_SPLIT_NO_EMPTY); - $count = count($chars); - for ($c=0; $c<$count; $c++) - { - $letter=$chars[$c]; - if (!preg_match("/[a-zA-Z0-9]/", $letter)) - { - $return .= "\\$letter"; - } - else - { - $return .= "$letter"; - } - } - return $return; - } - */ - /** - * store IPTC data in DB - */ - function saveIptcData($filename, $md5sum) - { - // Retrieve the header information - $jpeg_header_data = get_jpeg_header_data($filename); - - if($jpeg_header_data) - { - // get array with all available IPTC data - $IPTC_Info = get_Photoshop_IPTC(get_Photoshop_IRB($jpeg_header_data)); - - // init values (prevent php notice msg if not set) - $caption = ""; - $object_name = ""; - $edit_status = ""; - $priority = ""; - $category = ""; - $supplemental_categorie = ""; - $job_id = ""; - $keywords = ""; - $date_released = ""; - $time_released = ""; - $instructions = ""; - $date_created = ""; - $time_created = ""; - $program = ""; - $object_cycle = ""; - $byline = ""; - $byline_title = ""; - $city = ""; - $sublocation = ""; - $state = ""; - $country_code = ""; - $country = ""; - $trans_reference = ""; - $headline = ""; - $credit = ""; - $source = ""; - $copyright = ""; - $caption_writer = ""; - - $IPTC_Meta = array(); - $query = $GLOBALS['db']->Execute("SELECT md5sum FROM ".PREFIX."meta_iptc " . - "WHERE md5sum = '".$md5sum."' "); - $num = $query->RecordCount(); - - if($num == 0) - { - if(is_array($IPTC_Info)) - { - // Cycle through each of the IPTC-NAA IIM records - foreach($IPTC_Info as $IPTC_Record) - { - switch ( $IPTC_Record['IPTC_Type'] ) - { - case "2:05": // object name - $object_name = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:07": // edit_status - $edit_status = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:10": // priority - $priority = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:15": // category - $category = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:20": // supplemental_categorie - $supplemental_categorie .= " ".linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:22": // job_id - $job_id = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:25": // keywords - $keywords .= " ".linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:30": // date_released - $date_released = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:35": // time_released - $time_released = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:40": // instructions - $instructions = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:55": // date_created - $date_created = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:60": // time_created - $time_created = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:65": // program - $program = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:75": // object_cycle - $object_cycle = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:80": // byline - $byline = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:85": // byline_title - $byline_title = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:90": // city - $city = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:92": // sublocation - $sublocation = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:95": // state - $state = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:100": // country_code - $country_code = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:101": // country - $country = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:103": // trans_reference - $trans_reference = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:105": // headline - $headline = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:110": // credit - $credit = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:115": // source - $source = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:116": // copyright - $copyright = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:120": // caption - $caption = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:122": // caption_writer - $caption_writer = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - } - } - - $saveiptc = $GLOBALS['db']->Execute("INSERT INTO ".PREFIX."meta_iptc ( " . - "md5sum, caption, caption_writer, headline, " . - "instructions, keywords, category, supplemental_categorie, " . - "copyright, byline, byline_title, credit, source, " . - "edit_status, priority, object_cycle, job_id, program, " . - "object_name, date_created, date_released, time_created, " . - "time_released, city, sublocation, state, country, " . - "country_code, trans_reference, marked_ignored) " . - "VALUES('".$md5sum."', '".$caption."', '".$caption_writer."', '".$headline."', " . - "'".$instructions."', '".$keywords."', '".$category."', '".$supplemental_categorie."', " . - "'".$copyright."', '".$byline."', '".$byline_title."', '".$credit."', '".$source."', " . - "'".$edit_status."', '".$priority."', '".$object_cycle."', '".$job_id."', '".$program."', " . - "'".$object_name."', '".$date_created."', '".$date_released."', '".$time_created."', " . - "'".$time_released."', '".$city."', '".$sublocation."', '".$state."', '".$country."', " . - "'".$country_code."', '".$trans_reference."', '0')"); - - return true; - } - else - { - $saveiptc_dummy = $GLOBALS['db']->Execute("INSERT INTO ".PREFIX."meta_iptc ( " . - "md5sum, caption, caption_writer, headline, " . - "instructions, keywords, category, supplemental_categorie, " . - "copyright, byline, byline_title, credit, source, " . - "edit_status, priority, object_cycle, job_id, program, " . - "object_name, date_created, date_released, time_created, " . - "time_released, city, sublocation, state, country, " . - "country_code, trans_reference, marked_ignored) " . - "VALUES('".$md5sum."', '', '', '', '', '', '', '', '', '', '', '', '', " . - "'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1')"); - - return false; - } - } - } - else - { - return false; - } - } - - /** - * generate "more EXIF details" link. Used if we have only IPTC data but - * also wonna have an option to display EXIF - */ - function showMoreDetailLink($meta) - { - global $exif_less, $exif_more; - - if($meta == "exif") - { - $link = "<a class='leftmenu' href='".$GLOBALS['img_view']->link_address."&imgid=".$_GET['imgid']."&exif="; - echo "<tr><td colspan='2' align='center'>".$link."2'>". - "<u><b>".$exif_more." (EXIF)</b></u></a></td></tr>"; - - } - else - { - $link = "<a class='leftmenu' href='".$GLOBALS['img_view']->link_address."&imgid=".$_GET['imgid']."&iptc="; - echo "<tr><td colspan='2' align='center'>".$link."2'>". - "<u><b>".$exif_more." (IPTC)</b></u></a></td></tr>"; - - } - - } - - /** - * prepare EXIF HTML output left menu (get from DB) - */ - function showExifData($md5sum) - { - global $exif_less, $exif_more, $str_search_all_images_taken; - $link = "<a class='leftmenu' href='".$GLOBALS['img_view']->link_address."&imgid=".$_GET['imgid']."&exif="; - - switch(read_config("exif_level")) - { - case 'low': $exif_level = 1; break; - case 'medium': $exif_level = 2; break; - case 'high': $exif_level = 3; break; - } - - /** - * set exif setting in $_SESSION - */ - $show_exif = true; - - if(isset($_GET['exif']) && !isset($_GET['iptc'])) - { - $_SESSION['exif'] = $_GET['exif']; - - if($_GET['exif'] == 0) - { - $show_exif = false; - unset($_SESSION['exif']); - - } else { - $exif_level = $_GET['exif']; - } - } - elseif( isset($_SESSION['exif']) ) - { - $exif_level = $_SESSION['exif']; - } - elseif(!read_config("exif_default")) - { - $show_exif = false; - } - - if( $show_exif ) - { - /** - * get showed tags according to exif verbosity level - */ - $exif_tags = getExifTagsByVerbosityLevel($exif_level); - $str_exif_tags = strtolower( implode(', ',$exif_tags) ); - $str_exif_tags .= ", imagedescription, jpegcomment"; - - $query = $GLOBALS['db']->Execute("SELECT ".$str_exif_tags." ". - "FROM ".PREFIX."meta_exif WHERE md5sum = '".$md5sum."'"); - $data = $query->FetchRow(ADODB_FETCH_ASSOC); - - /** - * imagedescription and usercomment are later used in - * leftSideImage (img_view) - * - * use @ because on mysql 3.x we got an undefined index if they - * are empty... strange... - */ - $this->exif_imagedescription = @$data['imagedescription']; - $this->exif_jpegcomment = @$data['jpegcomment']; - - foreach($exif_tags AS $value) - { - if(!empty($data[strtolower($value)])) - { - $exif_key = $value; - $exif_value = $data[strtolower($value)]; - - /** - * special tags - */ - if($exif_key == 'DateTime' OR $exif_key == 'DateTimeOriginal') - { - $exif_key = 'DateTime'; - $tmp = explode(" ",$exif_value); - $exif_value = "<a class='FromTo' href='".LINPHA_DIR."/search.php?sk=".$tmp[0]."' title='".sprintf($str_search_all_images_taken,$tmp[0])."'>". - $tmp[0]."</a><br />".@$tmp[1]; - } - if($exif_key == "ShutterSpeedValue") - { - $exif_key = "ShutterSpeed"; - } - - echo "<tr><td><span class='leftmenuexiflabel'>".$exif_key."</span></td>". - "<td><span class='leftmenuexifvalue'>".$exif_value."</span></td></tr>"; - } - - } - - switch($exif_level) - { - case 1: $less = 0; $more = 2; break; - case 2: $less = 1; $more = 3; break; - case 3: $less = 2; $more = 3; break; - default: $less = 2; $more = 3; break; - } - - echo "<tr><td colspan='2' align='center'>"; - echo $link.$less."'><u><b>Less</b></u></a> "; - - if($more!="3" || @$_SESSION['exif']!="3") - echo $link.$more."'><u><b>More</b></u></a> "; - echo "<a class='leftmenu' target='_blank' href='".LINPHA_DIR."/include/metadata_editor.php?md5sum=".$md5sum."'><u><b>All</b></u></a>"; - - echo "</td></tr>"; - } - - if(@$_GET['exif'] == 0 && @$_SESSION['exif'] == 0 && !read_config('exif_default')) - { - $this->showMoreDetailLink("exif"); - } - } - - /** - * prepare IPTC HTML output left menu (get from DB) - */ - function showIptcData($md5sum) - { - global $exif_less, $exif_more, $str_search_all_images_taken; - $link = "<a class='leftmenu' href='".$GLOBALS['img_view']->link_address."&imgid=".$_GET['imgid']."&iptc="; - - switch(read_config("iptc_level")) - { - case 'low': $iptc_level = 1; break; - case 'medium': $iptc_level = 2; break; - case 'high': $iptc_level = 3; break; - } - - /** - * set iptc setting in $_SESSION - */ - $show_iptc = true; - - if(!isset($_GET['exif'])) - { - if(isset($_GET['iptc'])) - { - $_SESSION['iptc'] = $_GET['iptc']; - - if($_GET['iptc'] == 0) - { - $show_iptc = false; - } else { - $iptc_level = $_GET['iptc']; - } - } - elseif(isset($_SESSION['iptc'])) - { - $iptc_level = $_SESSION['iptc']; - if($iptc_level == 0) - { - $show_iptc = false; - } - } - } - else - { - $show_iptc = false; - } - - /** - * @uses metadata.config.php - */ - $trans_array = translateIptcSearchTags("", "array"); - $has_iptc_data = false; - - if( $show_iptc && !read_config('exif_default')) - { - /** - * get showed tags according to iptc verbosity level - */ - $iptc_tags = getIptcTagsByVerbosityLevel($iptc_level); - $trans_array=array_flip($trans_array); - $iptc_tags = array_intersect($trans_array, $iptc_tags); - $str_iptc_tags = ""; - - while(list($long_term, $query_term) = each($iptc_tags)) - { - $str_iptc_tags .= "".$query_term.", "; - } - - reset($iptc_tags); - - $str_iptc_tags .= substr($str_iptc_tags,0,strlen($str_iptc_tags)-2); - - $query = $GLOBALS['db']->Execute("SELECT ".$str_iptc_tags." ". - "FROM ".PREFIX."meta_iptc WHERE md5sum = '".$md5sum."'"); - $data = $query->FetchRow(ADODB_FETCH_ASSOC); - - $this->iptc_imagedescription = stripslashes($data['headline']); - $this->iptc_usercomment = stripslashes($data['caption']); - - if(isset($this->iptc_imagedescription) || isset($this->iptc_usercomment)) - { - $has_iptc_data = true; - } - - while(list($key, $value) = each($iptc_tags)) - { - if(!empty($data[$value])) - { - $iptc_key = $key; - $iptc_value = stripslashes($data[$value]); - if($key != "Caption" && $key != "Headline") - echo "<tr><td><span class='leftmenuexiflabel'>".$iptc_key."</span></td>". - "<td><span class='leftmenuexifvalue'>".$iptc_value."</span></td></tr>"; - $has_iptc_data = true; - - } - } - - switch($iptc_level) - { - case 1: $less = 0; $more = 2; break; - case 2: $less = 1; $more = 3; break; - case 3: $less = 2; $more = 3; break; - default: $less = 2; $more = 3; break; - } - - if($has_iptc_data) - { - echo "<tr><td colspan='2' align='center'>"; - echo $link.$less."'><u><b>Less</b></u></a> "; - if($more!="3" || @$_SESSION['iptc']!="3") - echo $link.$more."'><u><b>More</b></u></a> "; - echo "<a class='leftmenu' target='_blank' href='".LINPHA_DIR."/include/metadata_editor.php?md5sum=".$md5sum."'><u><b>All</b></u></a>"; - echo "</td></tr>"; - } - } - else - { - $this->showMoreDetailLink("iptc"); - } - } - - /** - * edit IPTC Data in HTML popup - */ - function editIptcData() - { - - } - - /** - * save modified IPTC data to DB - */ - function saveModIptcData() - { - - } - - - - /** - * get array with exiftags and path where they are - * keys are used to create the database table - * - * warning: if making changes in the keys of the array, we will need to - * update the db!! - */ - function getExifTranslationArray() - { - return Array( - // TIFF Rev. 6.0 Attribute Information - // A. Tags relating to image data structure - 'ImageWidth' => '', - 'ImageLength' => '', - 'BitsPerSample' => '', - 'Compression' => '', - 'PhotometricInterpretation' => '', - 'Orientation' => '0/274', - 'SamplesPerPixel' => '', - 'PlanarConfiguration' => '', - 'YCbCrSubSampling' => '', - 'YCbCrPositioning' => '0/531', - 'XResolution' => '0/282', - 'YResolution' => '0/283', - 'ResolutionUnit' => '0/296', - - // B. Tags relating to recording offset - 'StripOffsets' => '', - 'RowsPerStrip' => '', - 'StripByteCounts' => '', - 'JPEGInterchangeFormat' => '', - 'JPEGInterchangeFormatLength' => '', - - // C. Tags relating to image data characteristics - 'TransferFunction' => '', - 'WhitePoint' => '', - 'PrimaryChromaticities' => '', - 'YCbCrCoefficients' => '', - 'ReferenceBlackWhite' => '', - - // D. Other tags - 'DateTime' => '0/306', - 'ImageDescription' => '0/270', - 'Make' => '0/271', - 'Model' => '0/272', - 'Software' => '0/305', - 'Artist' => '0/315', - 'Copyright' => '0/33432', - - // Exif IFD Attribute Information - // A. Tags Relating to Version - 'ExifVersion' => '0/34665/Data/0/36864', - 'FlashpixVersion' => '0/34665/Data/0/40960', - - // B. Tag Relating to Image Data Characteristics - 'ColorSpace' => '0/34665/Data/0/40961', - - // C. Tags Relating to Image Configuration - 'ComponentsConfiguration' => '0/34665/Data/0/37121', - 'CompressedBitsPerPixel' => '0/34665/Data/0/37122', - 'PixelXDimension' => '0/34665/Data/0/40962', - 'PixelYDimension' => '0/34665/Data/0/40963', - - // D. Tags Relating to User Information - //'MakerNote' => '', too big to store!! - 'UserComment' => '0/34665/Data/0/37510', - - // E. Tag Relating to Related File Information - 'RelatedSoundFile' => '', - - // F. Tags Relating to Date and Time - 'DateTimeOriginal' => '0/34665/Data/0/36867', - 'DateTimeDigitized' => '0/34665/Data/0/36868', - 'SubSecTime' => '', - 'SubSecTimeOriginal' => '', - 'SubSecTimeDigitized' => '', - - // G. Tags Relating to Picture-Taking Conditions - 'ExposureTime' => '0/34665/Data/0/33434', - 'FNumber' => '0/34665/Data/0/33437', - 'ExposureProgram' => '0/34665/Data/0/34850', - 'SpectralSensitivity' => '', - 'ISOSpeedRatings' => '0/34665/Data/0/34855', - 'OECF' => '', - 'ShutterSpeedValue' => '0/34665/Data/0/37377', - 'ApertureValue' => '0/34665/Data/0/37378', - 'BrightnessValue' => '0/34665/Data/0/37379', - 'ExposureBiasValue' => '0/34665/Data/0/37380', - 'MaxApertureValue' => '0/34665/Data/0/37381', - 'SubjectDistance' => '0/34665/Data/0/37382', - 'MeteringMode' => '0/34665/Data/0/37383', - 'LightSource' => '0/34665/Data/0/37384', - 'Flash' => '0/34665/Data/0/37385', - 'FocalLength' => '0/34665/Data/0/37386', - 'SubjectArea' => '', - 'FlashEnergy' => '', - 'SpatialFrequencyResponse' => '', - 'FocalPlaneXResolution' => '0/34665/Data/0/41486', - 'FocalPlaneYResolution' => '0/34665/Data/0/41487', - 'FocalPlaneResolutionUnit' => '0/34665/Data/0/41488', - 'SubjectLocation' => '', - 'ExposureIndex' => '', - 'SensingMethod' => '0/34665/Data/0/41495', - 'FileSource' => '0/34665/Data/0/41728', - 'SceneType' => '0/34665/Data/0/41729', - 'CFAPattern' => '', - 'CustomRendered' => '0/34665/Data/0/41985', - 'ExposureMode' => '0/34665/Data/0/41986', - 'WhiteBalance' => '0/34665/Data/0/41987', - 'DigitalZoomRatio' => '0/34665/Data/0/41988', - 'FocalLengthIn35mmFilm' => '', - 'SceneCaptureType' => '0/34665/Data/0/41990', - 'GainControl' => '0/34665/Data/0/41991', - 'Contrast' => '0/34665/Data/0/41992', - 'Saturation' => '0/34665/Data/0/41993', - 'Sharpness' => '0/34665/Data/0/41994', - 'DeviceSettingDescription' => '', - 'SubjectDistanceRange' => '', - - // H. Other Tags - 'ImageUniqueID' => '', - - // GPS Attribute Information - // A. Tags Relating to GPS - 'GPSVersionID' => '0/34853/Data/0/0', - 'GPSLatitudeRef' => '0/34853/Data/0/1', - 'GPSLatitude' => '0/34853/Data/0/2', - 'GPSLongitudeRef' => '0/34853/Data/0/3', - 'GPSLongitude' => '0/34853/Data/0/4', - 'GPSAltitudeRef' => '0/34853/Data/0/5', - 'GPSAltitude' => '0/34853/Data/0/6', - 'GPSTimeStamp' => '0/34853/Data/0/7', - 'GPSSatellites' => '0/34853/Data/0/8', - 'GPSStatus' => '0/34853/Data/0/9', - 'GPSMeasureMode' => '0/34853/Data/0/10', - 'GPSDOP' => '0/34853/Data/0/11', - 'GPSSpeedRef' => '0/34853/Data/0/12', - 'GPSSpeed' => '0/34853/Data/0/13', - 'GPSTrackRef' => '0/34853/Data/0/14', - 'GPSTrack' => '0/34853/Data/0/15', - 'GPSImgDirectionRef' => '0/34853/Data/0/16', - 'GPSImgDirection' => '0/34853/Data/0/17', - 'GPSMapDatum' => '0/34853/Data/0/18', - 'GPSDestLatitudeRef' => '0/34853/Data/0/19', - 'GPSDestLatitude' => '0/34853/Data/0/20', - 'GPSDestLongitudeRef' => '0/34853/Data/0/21', - 'GPSDestLongitude' => '0/34853/Data/0/22', - 'GPSDestBearingRef' => '0/34853/Data/0/23', - 'GPSDestBearing' => '0/34853/Data/0/24', - 'GPSDestDistanceRef' => '0/34853/Data/0/25', - 'GPSDestDistance' => '0/34853/Data/0/26', - 'GPSProcessingMethod' => '0/34853/Data/0/27', - 'GPSAreaInformation' => '0/34853/Data/0/28', - 'GPSDateStamp' => '0/34853/Data/0/29', - 'GPSDifferential' => '0/34853/Data/0/30', - - // Custom Makernotes http://www.ozhiker.com/electronics/pjmt/jpeg_info/makernotes.html - // there are several tags: camera settings etc. might be usefull - - // Canon - // overwrite Artist => 0/315 - //'OwnerName' => 'Makernote_Tag/Decoded Data/0/9' - - // Casio - - // Fujifilm - - // Konica/Minolta - - // Nikon - - // Olympus - - // Panasonic - - // Ricoh - - 'JpegComment' => '' - ); - } - - /** - * $suffix required to create temporary table during upgrade on sqlite - */ - function createExifTable($array) - { - if(DB_TYPE == "mysql") - { - $str = "CREATE TABLE ".PREFIX."meta_exif (". - "md5sum VARCHAR(32) NOT NULL, "; - foreach($array AS $key=>$value) - { - $str .= linSql::linAddslashes(strtolower($value))." VARCHAR(255), "; - } - $str .= "PRIMARY KEY (md5sum), "; - $str .= "KEY (md5sum) )"; - } - elseif(DB_TYPE == "sqlite") - { - $str = "CREATE TABLE ".PREFIX."meta_exif (". - "md5sum VARCHAR(32) PRIMARY KEY NOT NULL, "; - foreach($array AS $key=>$value) - { - $str .= strtolower($value)." VARCHAR(255), "; - } - /** - * remove last 2 signs (the comma and the space) - */ - $str = substr($str,0,strlen($str)-2).")"; - } - elseif(DB_TYPE == "postgres") - { - $str = "CREATE TABLE ".PREFIX."meta_exif (". - "md5sum VARCHAR(32) NOT NULL, "; - - foreach($array AS $key=>$value) - { - $str .= strtolower($value)." VARCHAR(255), "; - } - - /** - * remove last 2 signs (the comma and the space) - */ - $str = substr($str,0,strlen($str)-2).")"; - } - return $str; - } - -/** - * get array with iptctags - */ -function getIptcTranslationArray() -{ - return array( - 'caption' => 'Caption', - 'caption_writer' => 'Caption Writer', - 'headline' => 'Headline', - 'instructions' => 'Special Instructions', - 'keywords' => 'Keywords', - 'category' => 'Category', - 'supplemental_categorie' => 'Supplemental Category', - 'copyright' => 'Copyright Notice', - 'byline' => 'By-Line (Author)', - 'byline_title' => 'By-Line Title', - 'credit' => 'Credit', - 'source' => 'Source', - 'edit_status' => 'Edit Status', - 'priority' => 'Priority', - 'object_cycle' => 'Object Cycle', - 'job_id' => 'Fixture Identifier', - 'program' => 'Originating Program', - 'object_name' => 'Object Name (Title)', - 'date_created' => 'Date Created', - 'date_released' => 'Release Date', - 'time_created' => 'Time Created', - 'time_released' => 'Release Time', - 'city' => 'City', - 'sublocation' => 'Sub-Location', - 'state' => 'Province/State', - 'country' => 'Country Name', - 'country_code' => 'Country Code', - 'trans_reference' => 'Transmission Reference' - ); -} - -function createIptcTable($array) -{ - if(DB_TYPE == "mysql") - { - $str = "CREATE TABLE ".PREFIX."meta_iptc (". - "md5sum VARCHAR(32) NOT NULL, "; - - foreach($array AS $key=>$value) - { - $str .= linSql::linAddslashes(strtolower($value))." VARCHAR(255), "; - } - $str .= "PRIMARY KEY (md5sum), "; - $str .= "KEY (md5sum) )"; - } - elseif(DB_TYPE == "sqlite") - { - $str = "CREATE TABLE ".PREFIX."meta_iptc (". - "md5sum VARCHAR(32) PRIMARY KEY NOT NULL, "; - foreach($array AS $key=>$value) - { - $str .= strtolower($value)." VARCHAR(255), "; - } - /** - * remove last 2 signs (the comma and the space) - */ - $str = substr($str,0,strlen($str)-2).")"; - } - elseif(DB_TYPE == "postgres") - { - $str = "CREATE TABLE ".PREFIX."meta_iptc (". - "md5sum VARCHAR(32) NOT NULL, "; - - foreach($array AS $key=>$value) - { - $str .= strtolower($value)." VARCHAR(255), "; - } - - /** - * remove last 2 signs (the comma and the space) - */ - $str = substr($str,0,strlen($str)-2).")"; - } - return $str; -} - -} // end class metadata -?> \ No newline at end of file Modified: trunk/linpha2/templates/main_html/global.html.php =================================================================== --- trunk/linpha2/templates/main_html/global.html.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/templates/main_html/global.html.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -78,11 +78,6 @@ </div> <div class="header2"></div> -<div class="left"> -left<br />left<br />left<br />left<br />left<br />left<br /> -left<br />left<br />left<br />left<br />left<br />left<br /> -</div> - <?php $GLOBALS['linpha']->template->includeFile('body'); ?> </body> </html> \ No newline at end of file Modified: trunk/linpha2/templates/main_html/view_basket.html.php =================================================... [truncated message content] |
From: <fan...@us...> - 2006-03-08 21:48:29
|
Revision: 4406 Author: fangehrn Date: 2006-03-08 13:48:13 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4406&view=rev Log Message: ----------- * adding image and album comments Modified Paths: -------------- trunk/linpha2/ChangeLog 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.metadata.class.php trunk/linpha2/lib/include/common.php trunk/linpha2/templates/main_html/global.html.php trunk/linpha2/templates/main_html/view_img.html.php Added Paths: ----------- trunk/linpha2/templates/main_html/view_comment.html.php trunk/linpha2/templates/main_html/view_meta.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-08 16:32:29 UTC (rev 4405) +++ trunk/linpha2/ChangeLog 2006-03-08 21:48:13 UTC (rev 4406) @@ -1,5 +1,6 @@ 2006-03-08 flo * finished first stage of image fields + * adding image and album comments 2006-03-07 flo * adding forced thumbnail recreation Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-03-08 16:32:29 UTC (rev 4405) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-03-08 21:48:13 UTC (rev 4406) @@ -3,6 +3,22 @@ class linImage { +/** + * delete thumbnail + */ +function deleteThumbnail($id) +{ + $output = linSql::getCachePath('thumb',$id); + + if(file_exists($output)) + { + unlink($output); + } +} + +/** + * create thumbnail + */ function createThumbnail($id,$img_type,$force) { /** Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-08 16:32:29 UTC (rev 4405) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-08 21:48:13 UTC (rev 4406) @@ -28,8 +28,7 @@ public $photos; public $photos_filtered; public $use_javascript; -public $id_current; -public $id_parent; +public $id_current, $id_parent, $img_type, $filename, $md5sum; private $album_dir; private $nr_pages, $current_page; // only used if javascript disabled @@ -66,8 +65,11 @@ /** * switch between alb_view and img_view */ - $current_data = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id FROM ".PREFIX."photos " . + $current_data = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum FROM ".PREFIX."photos " . "WHERE id = '".linSql::linAddslashes($_GET['id'])."'"); + $this->img_type = $current_data['img_type']; + $this->filename = $current_data['name']; + $this->md5sum = $current_data['md5sum']; /** * check for valid id @@ -76,7 +78,7 @@ { $this->id_current = $current_data['id']; - if($current_data['img_type'] == 0) + if( $this->img_type == 0) { $this->id_parent = $current_data['id']; @@ -90,6 +92,12 @@ case 'basket': $this->view = 'basket_view'; break; + case 'meta': + $this->view = 'meta_view'; + break; + case 'comment': + $this->view = 'comment_view'; + break; default: $this->view = 'thumb_view'; } @@ -101,7 +109,24 @@ } else { - $this->view = 'img_view'; + if(isset($_SESSION['view'])) + { + switch($_SESSION['view']) + { + case 'meta': + $this->view = 'meta_view'; + break; + case 'comment': + $this->view = 'comment_view'; + break; + default: + $this->view = 'img_view'; + } + } + else + { + $this->view = 'img_view'; + } $this->id_parent = $current_data['parent_id']; } } @@ -145,6 +170,13 @@ break; case 'basket_view': $this->viewBasket_view(); + break; + case 'meta_view': + $this->viewMeta_view(); + break; + case 'comment_view': + $this->viewComment_view(); + break; } include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'_html/global.html.php'); @@ -225,6 +257,10 @@ ), 'edit' => Array( 'set_permissions' => $edit_permission_link + ), + 'metainfo' => Array( + 'edit album comment' => $this->link_url.'&id='.$this->id_current.'&view=comment', + 'edit album information' => $this->link_url.'&id='.$this->id_current.'&view=meta' ) ); break; @@ -244,6 +280,9 @@ 'rot_left' => '#', 'rot_right' => '#', 'set_permissions' => $edit_permission_link + ), + 'metainfo' => Array( + 'edit image information' => $this->link_url.'&id='.$this->id_current.'&view=meta' ) ); break; @@ -607,5 +646,21 @@ $this->setSubFolders(); $this->viewThumb_View_nojs(); } + +/** + * comment_view + */ + function viewComment_view() + { + $GLOBALS['linpha']->template->setModuleName('view_comment'); + } + +/** + * meta_view + */ + function viewMeta_view() + { + $GLOBALS['linpha']->template->setModuleName('view_meta'); + } } // end class linImgview ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-03-08 16:32:29 UTC (rev 4405) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-03-08 21:48:13 UTC (rev 4406) @@ -224,7 +224,16 @@ "parent_id , name, img_type , md5sum , time_add , time_mod , stats_numbers ) " . "VALUES ( '".$parent_id."' , '".$GLOBALS['linpha']->sql->linAddslashes($filename)."', " . "'".$org_type."' , '".$md5sum."', '".time()."', '".time()."', '1' )"); - + + /** + * delete thumbnail if one exists with the same id + */ + $inserted_id = $GLOBALS['linpha']->db->Insert_ID(); + linImage::deleteThumbnail($inserted_id); + + /** + * update number of photos + */ linImport::updateNumberPhotos( $parent_id ); } else @@ -240,9 +249,15 @@ $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."photos ( parent_id , img_type , name , time_add , time_mod )" . " VALUES ( '".$parent_id."' , '0' , '". linSql::linAddSlashes($filename)."' , '".time()."' , '".time()."' )"); + /** + * delete thumbnail if one exists with the same id + */ + $inserted_id = $GLOBALS['linpha']->db->Insert_ID(); + linImage::deleteThumbnail($inserted_id); + if($recursive) { - $inserted_id = $GLOBALS['linpha']->db->Insert_ID(); + linImport::addNew( $inserted_id , $dirname.$filename.'/' , $recursive); } } Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-03-08 16:32:29 UTC (rev 4405) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-03-08 21:48:13 UTC (rev 4406) @@ -21,7 +21,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','..'); } +if(!defined('LINPHA_DIR')) { exit(1); } class MetaData { Modified: trunk/linpha2/lib/include/common.php =================================================================== --- trunk/linpha2/lib/include/common.php 2006-03-08 16:32:29 UTC (rev 4405) +++ trunk/linpha2/lib/include/common.php 2006-03-08 21:48:13 UTC (rev 4406) @@ -1,4 +1,6 @@ <?php +if(!defined('LINPHA_DIR')) { exit(1); } + /** * This file removes the magic quotes * always include this file with *include_once* to prevent multiple remove of magic quotes! Modified: trunk/linpha2/templates/main_html/global.html.php =================================================================== --- trunk/linpha2/templates/main_html/global.html.php 2006-03-08 16:32:29 UTC (rev 4405) +++ trunk/linpha2/templates/main_html/global.html.php 2006-03-08 21:48:13 UTC (rev 4406) @@ -1,7 +1,7 @@ <html> <head> <link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'_css/global.css'; ?>' type='text/css'> -<?php if( isset($output['sys_log'])) { ?> +<?php if( isset($GLOBALS['output']['sys_log'])) { ?> <style> .sys_log { position: absolute; @@ -34,12 +34,12 @@ </head> <body> -<?php if( isset($output['sys_log']) ) { ?> +<?php if( isset($GLOBALS['output']['sys_log']) ) { ?> <div id="sys_log" class="sys_log"> <div class="sys_log_close"><a href="javascript:toggleWindow()">X</a></div> <div id="sys_log_text" class="sys_log_text"> Linpha Syslog:<br /> - <?php echo $output['sys_log']; ?> + <?php echo $GLOBALS['output']['sys_log']; ?> </div> </div> <script language="JavaScript" type="text/javascript"> Added: trunk/linpha2/templates/main_html/view_comment.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_comment.html.php (rev 0) +++ trunk/linpha2/templates/main_html/view_comment.html.php 2006-03-08 21:48:13 UTC (rev 4406) @@ -0,0 +1,47 @@ +<?php + +if( isset( $_POST['cmd'] ) ) +{ + /** + * check if comment exists + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."meta_comments " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->id_current."'"); + + if($query->RecordCount()==0) // insert + { + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_comments (time, md5sum, author, comment)" . + "VALUES ('".time()."','".$GLOBALS['linpha']->imgview->id_current."','".linSql::linAddslashes($_POST['author'])."'," . + "'".linSql::linAddslashes($_POST['comment'])."')"); + } + else // update + { + $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."meta_comments SET ". + "time = '".time()."', ". + "author = '".linSql::linAddslashes($_POST['author'])."', " . + "comment = '".linSql::linAddslashes($_POST['comment'])."' " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->id_current."'"); + } +} + + +?> + +<div id='maindiv' class='main'> +<form action="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current; ?>" method="POST"> +<?php +$data = $GLOBALS['linpha']->db->GetRow("SELECT id, time, author, comment FROM ".PREFIX."meta_comments"); +?> +<a href="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current.'&view=thumb'; ?>">back</a> +<br /><br /> + +Author: +<input type="text" name="author" value="<?php echo $data['author']; ?>" size="40" maxlength="40" /> +<br /> +<textarea name="comment" rows="10" cols="50"><?php echo $data['comment']; ?></textarea> +<br /> +<input type="hidden" name="cmd" value="add_comment" /> +<input type="submit" name="submit" value="submit" /> + +</form> +</div> \ No newline at end of file Modified: trunk/linpha2/templates/main_html/view_img.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_img.html.php 2006-03-08 16:32:29 UTC (rev 4405) +++ trunk/linpha2/templates/main_html/view_img.html.php 2006-03-08 21:48:13 UTC (rev 4406) @@ -20,4 +20,75 @@ <div id='maindiv' class='main'> <?php echo $GLOBALS['linpha']->imgview->output['image']; ?> -</div> \ No newline at end of file +<br /><br /> + +<?php +if( isset( $_POST['cmd'] ) ) +{ + if( !empty($_POST['comment_textarea'])) + { + $comment = $_POST['comment_textarea']; + } + else + { + $comment = $_POST['comment_text']; + } + + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_comments (time, md5sum, author, comment)" . + "VALUES ('".time()."','".$GLOBALS['linpha']->imgview->md5sum."','".linSql::linAddslashes($_POST['author'])."'," . + "'".linSql::linAddslashes($comment)."')"); +} +?> +<style> +.add_comment { + color: #036; + width: 600px; +} +.add_comment input, .add_comment textarea { + background-color: #d5eeff; +} + +.comments { + border: 1px solid #09f; + width: 200px; + margin: 5px; + margin-left: 150px; +} +</style> +<div class="add_comment"> +<form action="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current; ?>" method="POST"> +Name: +<input type="text" name="author" value="" size="10" maxlength="40" /> +Comment: +<input type="text" id="comment_text" name="comment_text" value="" size="40" maxlength="40" /> +<a href="javascript:open_textarea()">(+)</a> +<textarea style="display: none;" id="comment_textarea" name="comment_textarea" rows="10" cols="50"></textarea> +<input type="hidden" name="cmd" value="add_comment" /> +<input type="submit" name="submit" value="submit" /> +</form> +</div> +<br /><br /> + +<?php +$query = $GLOBALS['linpha']->db->Execute("SELECT id, time, author, comment FROM ".PREFIX."meta_comments " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); +while($data = $query->FetchRow()) +{ + echo '<div class="comments">'; + echo $data['time'].' '.$data['author'].'<br />'; + echo $data['comment'].'<br /><br />'; + echo '</div>'; +} +?> + +</div> + +<script language="Javascript"> +function open_textarea() +{ + document.getElementById('comment_textarea').style.display = 'block'; + document.getElementById('comment_text').style.display = 'none'; + + document.getElementById('comment_textarea').value = document.getElementById('comment_text').value; +} +</script> \ No newline at end of file Added: trunk/linpha2/templates/main_html/view_meta.html.php =================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-12 22:57:14
|
Revision: 4410 Author: fangehrn Date: 2006-03-12 14:57:02 -0800 (Sun, 12 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4410&view=rev Log Message: ----------- * saving exif/iptc infos on image view Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/linpha2.specs.txt trunk/linpha2/templates/main_html/view_img.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-12 22:21:55 UTC (rev 4409) +++ trunk/linpha2/ChangeLog 2006-03-12 22:57:02 UTC (rev 4410) @@ -1,3 +1,6 @@ +2006-03-12 flo + * saving exif/iptc infos on image view + 2006-03-08 flo * finished first stage of image fields * adding image and album comments Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-12 22:21:55 UTC (rev 4409) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-12 22:57:02 UTC (rev 4410) @@ -51,10 +51,6 @@ { $this->id_parent = 0; - - - - if(isset($_GET['id']) && $_GET['id'] != 0) { if(isset($_GET['view'])) @@ -63,7 +59,7 @@ } /** - * switch between alb_view and img_view + * set file informations */ $current_data = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum FROM ".PREFIX."photos " . "WHERE id = '".linSql::linAddslashes($_GET['id'])."'"); @@ -78,6 +74,9 @@ { $this->id_current = $current_data['id']; + /** + * switch between thumb_view and img_view + */ if( $this->img_type == 0) { $this->id_parent = $current_data['id']; @@ -364,33 +363,77 @@ /** * set image informations */ - $this->output['image_infos'] = ''; 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); - $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 ); + /** + * 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); + } + } - $pos = strpos($key,'_'); - $first_part = substr($key,0,$pos); - $last_part = substr($key,$pos+1); - switch($first_part) + + /** + * 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()) { - case 'id': // builtin and own fields and special fields like filename, imagesize and dimension - break; - case 'exif': - break; - case 'iptc': - break; + $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 />'; } - $value = ''; - - $this->output['image_infos'] .= $name.': '.$value.' <br />'; - } } Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-03-12 22:21:55 UTC (rev 4409) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-03-12 22:57:02 UTC (rev 4410) @@ -221,7 +221,7 @@ $str_values = "'".$md5sum."', "; foreach($exif_tags AS $key=>$value) { - if($value != "") + if($value != "" && in_array($key,$this->defined_exif_fields)) { /** * there are currently only entries at level deep 2 and 5 in the @@ -236,7 +236,7 @@ $str_columns .= strtolower($key).', '; $exif_value = $exif_data[ $array_pieces[0] ][ $array_pieces[1] ]['Text Value']; - $str_values .= "'".linpha_addslashes(trim( $exif_value ))."', "; + $str_values .= "'".linSql::linAddslashes(trim( $exif_value ))."', "; } break; case 5: @@ -245,7 +245,7 @@ $str_columns .= strtolower($key).', '; $exif_value = $exif_data[ $array_pieces[0] ][ $array_pieces[1] ][ $array_pieces[2] ][ $array_pieces[3] ][ $array_pieces[4] ]['Text Value']; - $str_values .= "'".linpha_addslashes(trim( $exif_value ))."', "; + $str_values .= "'".linSql::linAddslashes(trim( $exif_value ))."', "; } break; default: @@ -255,17 +255,18 @@ } } - include_once(LINPHA_DIR.'/include/phpmeta/JPEG.php'); - /** * add jpegcomment */ - $jpeg_header_data = get_jpeg_header_data( $filename ); - $comment = get_jpeg_Comment( $jpeg_header_data ); - if(!empty($comment)) + if(in_array('jpegcomment',$this->defined_exif_fields)) { - $str_columns .= 'jpegcomment, '; - $str_values .= "'".linpha_addslashes(trim( $comment ))."', "; + $jpeg_header_data = get_jpeg_header_data( $filename ); + $comment = get_jpeg_Comment( $jpeg_header_data ); + if(!empty($comment)) + { + $str_columns .= 'jpegcomment, '; + $str_values .= "'".linSql::linAddslashes(trim( $comment ))."', "; + } } /** @@ -278,12 +279,12 @@ /** * no double entries */ - $query = $GLOBALS['db']->Execute("SELECT md5sum FROM ".PREFIX."meta_exif ". + $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum FROM ".PREFIX."meta_exif ". "WHERE md5sum = '".$md5sum."'"); $num = $query->RecordCount(); if($num == 0) { - $GLOBALS['db']->Execute("INSERT into ".PREFIX."meta_exif (".$str_columns.") ". + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_exif (".$str_columns.") ". "VALUES (".$str_values.")"); } } @@ -355,167 +356,170 @@ $caption_writer = ""; $IPTC_Meta = array(); - $query = $GLOBALS['db']->Execute("SELECT md5sum FROM ".PREFIX."meta_iptc " . + $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum FROM ".PREFIX."meta_iptc " . "WHERE md5sum = '".$md5sum."' "); $num = $query->RecordCount(); if($num == 0) { - if(is_array($IPTC_Info)) - { - // Cycle through each of the IPTC-NAA IIM records - foreach($IPTC_Info as $IPTC_Record) - { - switch ( $IPTC_Record['IPTC_Type'] ) - { - case "2:05": // object name - $object_name = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:07": // edit_status - $edit_status = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:10": // priority - $priority = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:15": // category - $category = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:20": // supplemental_categorie - $supplemental_categorie .= " ".linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:22": // job_id - $job_id = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:25": // keywords - $keywords .= " ".linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:30": // date_released - $date_released = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:35": // time_released - $time_released = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:40": // instructions - $instructions = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:55": // date_created - $date_created = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:60": // time_created - $time_created = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:65": // program - $program = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:75": // object_cycle - $object_cycle = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:80": // byline - $byline = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:85": // byline_title - $byline_title = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:90": // city - $city = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:92": // sublocation - $sublocation = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:95": // state - $state = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:100": // country_code - $country_code = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:101": // country - $country = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:103": // trans_reference - $trans_reference = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:105": // headline - $headline = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:110": // credit - $credit = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:115": // source - $source = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:116": // copyright - $copyright = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:120": // caption - $caption = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:122": // caption_writer - $caption_writer = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - } - } - - $saveiptc = $GLOBALS['db']->Execute("INSERT INTO ".PREFIX."meta_iptc ( " . - "md5sum, caption, caption_writer, headline, " . - "instructions, keywords, category, supplemental_categorie, " . - "copyright, byline, byline_title, credit, source, " . - "edit_status, priority, object_cycle, job_id, program, " . - "object_name, date_created, date_released, time_created, " . - "time_released, city, sublocation, state, country, " . - "country_code, trans_reference, marked_ignored) " . - "VALUES('".$md5sum."', '".$caption."', '".$caption_writer."', '".$headline."', " . - "'".$instructions."', '".$keywords."', '".$category."', '".$supplemental_categorie."', " . - "'".$copyright."', '".$byline."', '".$byline_title."', '".$credit."', '".$source."', " . - "'".$edit_status."', '".$priority."', '".$object_cycle."', '".$job_id."', '".$program."', " . - "'".$object_name."', '".$date_created."', '".$date_released."', '".$time_created."', " . - "'".$time_released."', '".$city."', '".$sublocation."', '".$state."', '".$country."', " . - "'".$country_code."', '".$trans_reference."', '0')"); - - return true; + if(is_array($IPTC_Info)) + { + // Cycle through each of the IPTC-NAA IIM records + foreach($IPTC_Info as $IPTC_Record) + { + switch ( $IPTC_Record['IPTC_Type'] ) + { + case "2:05": // object name + $object_name = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:07": // edit_status + $edit_status = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:10": // priority + $priority = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:15": // category + $category = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:20": // supplemental_categorie + $supplemental_categorie .= " ".linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:22": // job_id + $job_id = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:25": // keywords + $keywords .= " ".linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:30": // date_released + $date_released = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:35": // time_released + $time_released = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:40": // instructions + $instructions = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:55": // date_created + $date_created = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:60": // time_created + $time_created = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:65": // program + $program = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:75": // object_cycle + $object_cycle = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:80": // byline + $byline = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:85": // byline_title + $byline_title = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:90": // city + $city = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:92": // sublocation + $sublocation = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:95": // state + $state = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:100": // country_code + $country_code = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:101": // country + $country = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:103": // trans_reference + $trans_reference = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:105": // headline + $headline = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:110": // credit + $credit = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:115": // source + $source = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:116": // copyright + $copyright = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:120": // caption + $caption = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + + case "2:122": // caption_writer + $caption_writer = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); + break; + } + } + + $GLOBALS['linpha']->db->Execute("INSERT INTO ".PREFIX."meta_iptc ( " . + "md5sum, caption, caption_writer, headline, " . + "instructions, keywords, category, supplemental_categorie, " . + "copyright, byline, byline_title, credit, source, " . + "edit_status, priority, object_cycle, job_id, program, " . + "object_name, date_created, date_released, time_created, " . + "time_released, city, sublocation, state, country, " . + "country_code, trans_reference, marked_ignored) " . + "VALUES('".$md5sum."', '".$caption."', '".$caption_writer."', '".$headline."', " . + "'".$instructions."', '".$keywords."', '".$category."', '".$supplemental_categorie."', " . + "'".$copyright."', '".$byline."', '".$byline_title."', '".$credit."', '".$source."', " . + "'".$edit_status."', '".$priority."', '".$object_cycle."', '".$job_id."', '".$program."', " . + "'".$object_name."', '".$date_created."', '".$date_released."', '".$time_created."', " . + "'".$time_released."', '".$city."', '".$sublocation."', '".$state."', '".$country."', " . + "'".$country_code."', '".$trans_reference."', '0')"); + + return true; + } + else + { + /** + * save empty entry to prevent re-read on every page visit + */ + $GLOBALS['linpha']->db->Execute("INSERT INTO ".PREFIX."meta_iptc ( " . + "md5sum, caption, caption_writer, headline, " . + "instructions, keywords, category, supplemental_categorie, " . + "copyright, byline, byline_title, credit, source, " . + "edit_status, priority, object_cycle, job_id, program, " . + "object_name, date_created, date_released, time_created, " . + "time_released, city, sublocation, state, country, " . + "country_code, trans_reference, marked_ignored) " . + "VALUES('".$md5sum."', '', '', '', '', '', '', '', '', '', '', '', '', " . + "'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1')"); + + return false; + } } - else - { - $saveiptc_dummy = $GLOBALS['db']->Execute("INSERT INTO ".PREFIX."meta_iptc ( " . - "md5sum, caption, caption_writer, headline, " . - "instructions, keywords, category, supplemental_categorie, " . - "copyright, byline, byline_title, credit, source, " . - "edit_status, priority, object_cycle, job_id, program, " . - "object_name, date_created, date_released, time_created, " . - "time_released, city, sublocation, state, country, " . - "country_code, trans_reference, marked_ignored) " . - "VALUES('".$md5sum."', '', '', '', '', '', '', '', '', '', '', '', '', " . - "'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1')"); - - return false; - } - } } else { @@ -527,7 +531,7 @@ * generate "more EXIF details" link. Used if we have only IPTC data but * also wonna have an option to display EXIF */ - function showMoreDetailLink($meta) + /*function showMoreDetailLink($meta) { global $exif_less, $exif_more; @@ -545,13 +549,12 @@ "<u><b>".$exif_more." (IPTC)</b></u></a></td></tr>"; } - - } + }*/ /** * prepare EXIF HTML output left menu (get from DB) */ - function showExifData($md5sum) + /*function showExifData($md5sum) { global $exif_less, $exif_more, $str_search_all_images_taken; $link = "<a class='leftmenu' href='".$GLOBALS['img_view']->link_address."&imgid=".$_GET['imgid']."&exif="; @@ -565,7 +568,7 @@ /** * set exif setting in $_SESSION - */ + $show_exif = true; if(isset($_GET['exif']) && !isset($_GET['iptc'])) @@ -594,7 +597,7 @@ { /** * get showed tags according to exif verbosity level - */ + $exif_tags = getExifTagsByVerbosityLevel($exif_level); $str_exif_tags = strtolower( implode(', ',$exif_tags) ); $str_exif_tags .= ", imagedescription, jpegcomment"; @@ -609,7 +612,7 @@ * * use @ because on mysql 3.x we got an undefined index if they * are empty... strange... - */ + $this->exif_imagedescription = @$data['imagedescription']; $this->exif_jpegcomment = @$data['jpegcomment']; @@ -622,7 +625,7 @@ /** * special tags - */ + if($exif_key == 'DateTime' OR $exif_key == 'DateTimeOriginal') { $exif_key = 'DateTime'; @@ -663,12 +666,12 @@ { $this->showMoreDetailLink("exif"); } - } + }*/ /** * prepare IPTC HTML output left menu (get from DB) */ - function showIptcData($md5sum) + /*function showIptcData($md5sum) { global $exif_less, $exif_more, $str_search_all_images_taken; $link = "<a class='leftmenu' href='".$GLOBALS['img_view']->link_address."&imgid=".$_GET['imgid']."&iptc="; @@ -682,7 +685,7 @@ /** * set iptc setting in $_SESSION - */ + $show_iptc = true; if(!isset($_GET['exif'])) @@ -714,7 +717,7 @@ /** * @uses metadata.config.php - */ + $trans_array = translateIptcSearchTags("", "array"); $has_iptc_data = false; @@ -722,7 +725,7 @@ { /** * get showed tags according to iptc verbosity level - */ + $iptc_tags = getIptcTagsByVerbosityLevel($iptc_level); $trans_array=array_flip($trans_array); $iptc_tags = array_intersect($trans_array, $iptc_tags); @@ -785,7 +788,7 @@ { $this->showMoreDetailLink("iptc"); } - } + }*/ /** * edit IPTC Data in HTML popup @@ -805,235 +808,235 @@ - /** - * get array with exiftags and path where they are - * keys are used to create the database table - * - * warning: if making changes in the keys of the array, we will need to - * update the db!! - */ - function getExifTranslationArray() - { - return Array( - // TIFF Rev. 6.0 Attribute Information - // A. Tags relating to image data structure - 'ImageWidth' => '', - 'ImageLength' => '', - 'BitsPerSample' => '', - 'Compression' => '', - 'PhotometricInterpretation' => '', - 'Orientation' => '0/274', - 'SamplesPerPixel' => '', - 'PlanarConfiguration' => '', - 'YCbCrSubSampling' => '', - 'YCbCrPositioning' => '0/531', - 'XResolution' => '0/282', - 'YResolution' => '0/283', - 'ResolutionUnit' => '0/296', - - // B. Tags relating to recording offset - 'StripOffsets' => '', - 'RowsPerStrip' => '', - 'StripByteCounts' => '', - 'JPEGInterchangeFormat' => '', - 'JPEGInterchangeFormatLength' => '', - - // C. Tags relating to image data characteristics - 'TransferFunction' => '', - 'WhitePoint' => '', - 'PrimaryChromaticities' => '', - 'YCbCrCoefficients' => '', - 'ReferenceBlackWhite' => '', - - // D. Other tags - 'DateTime' => '0/306', - 'ImageDescription' => '0/270', - 'Make' => '0/271', - 'Model' => '0/272', - 'Software' => '0/305', - 'Artist' => '0/315', - 'Copyright' => '0/33432', - - // Exif IFD Attribute Information - // A. Tags Relating to Version - 'ExifVersion' => '0/34665/Data/0/36864', - 'FlashpixVersion' => '0/34665/Data/0/40960', - - // B. Tag Relating to Image Data Characteristics - 'ColorSpace' => '0/34665/Data/0/40961', - - // C. Tags Relating to Image Configuration - 'ComponentsConfiguration' => '0/34665/Data/0/37121', - 'CompressedBitsPerPixel' => '0/34665/Data/0/37122', - 'PixelXDimension' => '0/34665/Data/0/40962', - 'PixelYDimension' => '0/34665/Data/0/40963', - - // D. Tags Relating to User Information - //'MakerNote' => '', too big to store!! - 'UserComment' => '0/34665/Data/0/37510', - - // E. Tag Relating to Related File Information - 'RelatedSoundFile' => '', - - // F. Tags Relating to Date and Time - 'DateTimeOriginal' => '0/34665/Data/0/36867', - 'DateTimeDigitized' => '0/34665/Data/0/36868', - 'SubSecTime' => '', - 'SubSecTimeOriginal' => '', - 'SubSecTimeDigitized' => '', - - // G. Tags Relating to Picture-Taking Conditions - 'ExposureTime' => '0/34665/Data/0/33434', - 'FNumber' => '0/34665/Data/0/33437', - 'ExposureProgram' => '0/34665/Data/0/34850', - 'SpectralSensitivity' => '', - 'ISOSpeedRatings' => '0/34665/Data/0/34855', - 'OECF' => '', - 'ShutterSpeedValue' => '0/34665/Data/0/37377', - 'ApertureValue' => '0/34665/Data/0/37378', - 'BrightnessValue' => '0/34665/Data/0/37379', - 'ExposureBiasValue' => '0/34665/Data/0/37380', - 'MaxApertureValue' => '0/34665/Data/0/37381', - 'SubjectDistance' => '0/34665/Data/0/37382', - 'MeteringMode' => '0/34665/Data/0/37383', - 'LightSource' => '0/34665/Data/0/37384', - 'Flash' => '0/34665/Data/0/37385', - 'FocalLength' => '0/34665/Data/0/37386', - 'SubjectArea' => '', - 'FlashEnergy' => '', - 'SpatialFrequencyResponse' => '', - 'FocalPlaneXResolution' => '0/34665/Data/0/41486', - 'FocalPlaneYResolution' => '0/34665/Data/0/41487', - 'FocalPlaneResolutionUnit' => '0/34665/Data/0/41488', - 'SubjectLocation' => '', - 'ExposureIndex' => '', - 'SensingMethod' => '0/34665/Data/0/41495', - 'FileSource' => '0/34665/Data/0/41728', - 'SceneType' => '0/34665/Data/0/41729', - 'CFAPattern' => '', - 'CustomRendered' => '0/34665/Data/0/41985', - 'ExposureMode' => '0/34665/Data/0/41986', - 'WhiteBalance' => '0/34665/Data/0/41987', - 'DigitalZoomRatio' => '0/34665/Data/0/41988', - 'FocalLengthIn35mmFilm' => '', - 'SceneCaptureType' => '0/34665/Data/0/41990', - 'GainControl' => '0/34665/Data/0/41991', - 'Contrast' => '0/34665/Data/0/41992', - 'Saturation' => '0/34665/Data/0/41993', - 'Sharpness' => '0/34665/Data/0/41994', - 'DeviceSettingDescription' => '', - 'SubjectDistanceRange' => '', - - // H. Other Tags - 'ImageUniqueID' => '', - - // GPS Attribute Information - // A. Tags Relating to GPS - 'GPSVersionID' => '0/34853/Data/0/0', - 'GPSLatitudeRef' => '0/34853/Data/0/1', - 'GPSLatitude' => '0/34853/Data/0/2', - 'GPSLongitudeRef' => '0/34853/Data/0/3', - 'GPSLongitude' => '0/34853/Data/0/4', - 'GPSAltitudeRef' => '0/34853/Data/0/5', - 'GPSAltitude' => '0/34853/Data/0/6', - 'GPSTimeStamp' => '0/34853/Data/0/7', - 'GPSSatellites' => '0/34853/Data/0/8', - 'GPSStatus' => '0/34853/Data/0/9', - 'GPSMeasureMode' => '0/34853/Data/0/10', - 'GPSDOP' => '0/34853/Data/0/11', - 'GPSSpeedRef' => '0/34853/Data/0/12', - 'GPSSpeed' => '0/34853/Data/0/13', - 'GPSTrackRef' => '0/34853/Data/0/14', - 'GPSTrack' => '0/34853/Data/0/15', - 'GPSImgDirectionRef' => '0/34853/Data/0/16', - 'GPSImgDirection' => '0/34853/Data/0/17', - 'GPSMapDatum' => '0/34853/Data/0/18', - 'GPSDestLatitudeRef' => '0/34853/Data/0/19', - 'GPSDestLatitude' => '0/34853/Data/0/20', - 'GPSDestLongitudeRef' => '0/34853/Data/0/21', - 'GPSDestLongitude' => '0/34853/Data/0/22', - 'GPSDestBearingRef' => '0/34853/Data/0/23', - 'GPSDestBearing' => '0/34853/Data/0/24', - 'GPSDestDistanceRef' => '0/34853/Data/0/25', - 'GPSDestDistance' => '0/34853/Data/0/26', - 'GPSProcessingMethod' => '0/34853/Data/0/27', - 'GPSAreaInformation' => '0/34853/Data/0/28', - 'GPSDateStamp' => '0/34853/Data/0/29', - 'GPSDifferential' => '0/34853/Data/0/30', - - // Custom Makernotes http://www.ozhiker.com/electronics/pjmt/jpeg_info/makernotes.html - // there are several tags: camera settings etc. might be usefull +/** + * get array with exiftags and path where they are + * keys are used to create the database table + * + * warning: if making changes in the keys of the array, we will need to + * update the db!! + */ +function getExifTranslationArray() +{ + return Array( + // TIFF Rev. 6.0 Attribute Information + // A. Tags relating to image data structure + 'ImageWidth' => '', + 'ImageLength' => '', + 'BitsPerSample' => '', + 'Compression' => '', + 'PhotometricInterpretation' => '', + 'Orientation' => '0/274', + 'SamplesPerPixel' => '', + 'PlanarConfiguration' => '', + 'YCbCrSubSampling' => '', + 'YCbCrPositioning' => '0/531', + 'XResolution' => '0/282', + 'YResolution' => '0/283', + 'ResolutionUnit' => '0/296', + + // B. Tags relating to recording offset + 'StripOffsets' => '', + 'RowsPerStrip' => '', + 'StripByteCounts' => '', + 'JPEGInterchangeFormat' => '', + 'JPEGInterchangeFormatLength' => '', + + // C. Tags relating to image data characteristics + 'TransferFunction' => '', + 'WhitePoint' => '', + 'PrimaryChromaticities' => '', + 'YCbCrCoefficients' => '', + 'ReferenceBlackWhite' => '', + + // D. Other tags + 'DateTime' => '0/306', + 'ImageDescription' => '0/270', + 'Make' => '0/271', + 'Model' => '0/272', + 'Software' => '0/305', + 'Artist' => '0/315', + 'Copyright' => '0/33432', + + // Exif IFD Attribute Information + // A. Tags Relating to Version + 'ExifVersion' => '0/34665/Data/0/36864', + 'FlashpixVersion' => '0/34665/Data/0/40960', + + // B. Tag Relating to Image Data Characteristics + 'ColorSpace' => '0/34665/Data/0/40961', + + // C. Tags Relating to Image Configuration + 'ComponentsConfiguration' => '0/34665/Data/0/37121', + 'CompressedBitsPerPixel' => '0/34665/Data/0/37122', + 'PixelXDimension' => '0/34665/Data/0/40962', + 'PixelYDimension' => '0/34665/Data/0/40963', + + // D. Tags Relating to User Information + //'MakerNote' => '', too big to store!! + 'UserComment' => '0/34665/Data/0/37510', + + // E. Tag Relating to Related File Information + 'RelatedSoundFile' => '', + + // F. Tags Relating to Date and Time + 'DateTimeOriginal' => '0/34665/Data/0/36867', + 'DateTimeDigitized' => '0/34665/Data/0/36868', + 'SubSecTime' => '', + 'SubSecTimeOriginal' => '', + 'SubSecTimeDigitized' => '', + + // G. Tags Relating to Picture-Taking Conditions + 'ExposureTime' => '0/34665/Data/0/33434', + 'FNumber' => '0/34665/Data/0/33437', + 'ExposureProgram' => '0/34665/Data/0/34850', + 'SpectralSensitivity' => '', + 'ISOSpeedRatings' => '0/34665/Data/0/34855', + 'OECF' => '', + 'ShutterSpeedValue' => '0/34665/Data/0/37377', + 'ApertureValue' => '0/34665/Data/0/37378', + 'BrightnessValue' => '0/34665/Data/0/37379', + 'ExposureBiasValue' => '0/34665/Data/0/37380', + 'MaxApertureValue' => '0/34665/Data/0/37381', + 'SubjectDistance' => '0/34665/Data/0/37382', + 'MeteringMode' => '0/34665/Data/0/37383', + 'LightSource' => '0/34665/Data/0/37384', + 'Flash' => '0/34665/Data/0/37385', + 'FocalLength' => '0/34665/Data/0/37386', + 'SubjectArea' => '', + 'FlashEnergy' => '', + 'SpatialFrequencyResponse' => '', + 'FocalPlaneXResolution' => '0/34665/Data/0/41486', + 'FocalPlaneYResolution' => '0/34665/Data/0/41487', + 'FocalPlaneResolutionUnit' => '0/34665/Data/0/41488', + 'SubjectLocation' => '', + 'ExposureIndex' => '', + 'SensingMethod' => '0/34665/Data/0/41495', + 'FileSource' => '0/34665/Data/0/41728', + 'SceneType' => '0/34665/Data/0/41729', + 'CFAPattern' => '', + 'CustomRendered' => '0/34665/Data/0/41985', + 'ExposureMode' => '0/34665/Data/0/41986', + 'WhiteBalance' => '0/34665/Data/0/41987', + 'DigitalZoomRatio' => '0/34665/Data/0/41988', + 'FocalLengthIn35mmFilm' => '', + 'SceneCaptureType' => '0/34665/Data/0/41990', + 'GainControl' => '0/34665/Data/0/41991', + 'Contrast' => '0/34665/Data/0/41992', + 'Saturation' => '0/34665/Data/0/41993', + 'Sharpness' => '0/34665/Data/0/41994', + 'DeviceSettingDescription' => '', + 'SubjectDistanceRange' => '', + + // H. Other Tags + 'ImageUniqueID' => '', + + // GPS Attribute Information + // A. Tags Relating to GPS + 'GPSVersionID' => '0/34853/Data/0/0', + 'GPSLatitudeRef' => '0/34853/Data/0/1', + 'GPSLatitude' => '0/34853/Data/0/2', + 'GPSLongitudeRef' => '0/34853/Data/0/3', + 'GPSLongitude' => '0/34853/Data/0/4', + 'GPSAltitudeRef' => '0/34853/Data/0/5', + 'GPSAltitude' => '0/34853/Data/0/6', + 'GPSTimeStamp' => '0/34853/Data/0/7', + 'GPSSatellites' => '0/34853/Data/0/8', + 'GPSStatus' => '0/34853/Data/0/9', + 'GPSMeasureMode' => '0/34853/Data/0/10', + 'GPSDOP' => '0/34853/Data/0/11', + 'GPSSpeedRef' => '0/34853/Data/0/12', + 'GPSSpeed' => '0/34853/Data/0/13', + 'GPSTrackRef' => '0/34853/Data/0/14', + 'GPSTrack' => '0/34853/Data/0/15', + 'GPSImgDirectionRef' => '0/34853/Data/0/16', + 'GPSImgDirection' => '0/34853/Data/0/17', + 'GPSMapDatum' => '0/34853/Data/0/18', + 'GPSDestLatitudeRef' => '0/34853/Data/0/19', + 'GPSDestLatitude' => '0/34853/Data/0/20', + 'GPSDestLongitudeRef' => '0/34853/Data/0/21', + 'GPSDestLongitude' => '0/34853/Data/0/22', + 'GPSDestBearingRef' => '0/34853/Data/0/23', + 'GPSDestBearing' => '0/34853/Data/0/24', + 'GPSDestDistanceRef' => '0/34853/Data/0/25', + 'GPSDestDistance' => '0/34853/Data/0/26', + 'GPSProcessingMethod' => '0/34853/Data/0/27', + 'GPSAreaInformation' => '0/34853/Data/0/28', + 'GPSDateStamp' => '0/34853/Data/0/29', + 'GPSDifferential' => '0/34853/Data/0/30', + + // Custom Makernotes http://www.ozhiker.com/electronics/pjmt/jpeg_info/makernotes.html + // there are several tags: camera settings etc. might be usefull - // Canon - // overwrite Artist => 0/315 - //'OwnerName' => 'Makernote_Tag/Decoded Data/0/9' - - // Casio - - // Fujifilm - - // Konica/Minolta - - // Nikon + // Canon + // overwrite Artist => 0/315 + //'OwnerName' => 'Makernote_Tag/Decoded Data/0/9' + + // Casio + + // Fujifilm + + // Konica/Minolta + + // Nikon - // Olympus - - // Panasonic - - // Ricoh + // Olympus + + // Panasonic + + // Ricoh - 'JpegComment' => '' - ); - } + 'JpegComment' => '' + ); +} - function createExifTable($array='') +function createExifTable($array='') +{ + if(empty($array)) { - if(empty($array)) + $array = $this->getDefaultExifFields(); + } + + if(DB_TYPE == "mysql") + { + $str = "CREATE TABLE ".PREFIX."meta_exif (". + "md5sum VARCHAR(32) NOT NULL, "; + foreach($array AS $key=>$value) { - $array = $this->getDefaultExifFields(); + $str .= linSql::linAddslashes(strtolower($value))." VARCHAR(255), "; } - - if(DB_TYPE == "mysql") + $str .= "PRIMARY KEY (md5sum), "; + $str .= "KEY (md5sum) )"; + } + elseif(DB_TYPE == "sqlite") + { + $str = "CREATE TABLE ".PREFIX."meta_exif (". + "md5sum VARCHAR(32) PRIMARY KEY NOT NULL, "; + foreach($array AS $key=>$value) { - $str = "CREATE TABLE ".PREFIX."meta_exif (". - "md5sum VARCHAR(32) NOT NULL, "; - foreach($array AS $key=>$value) - { - $str .= linSql::linAddslashes(strtolower($value))." VARCHAR(255), "; - } - $str .= "PRIMARY KEY (md5sum), "; - $str .= "KEY (md5sum) )"; + $str .= strtolower($value)." VARCHAR(255), "; } - elseif(DB_TYPE == "sqlite") + /** + * remove last 2 signs (the comma and the space) + */ + $str = substr($str,0,strlen($str)-2).")"; + } + elseif(DB_TYPE == "postgres") + { + $str = "CREATE TABLE ".PREFIX."meta_exif (". + "md5sum VARCHAR(32) NOT NULL, "; + + foreach($array AS $key=>$value) { - $str = "CREATE TABLE ".PREFIX."meta_exif (". - "md5sum VARCHAR(32) PRIMARY KEY NOT NULL, "; - foreach($array AS $key=>$value) - { - $str .= strtolower($value)." VARCHAR(255), "; - } - /** - * remove last 2 signs (the comma and the space) - */ - $str = substr($str,0,strlen($str)-2).")"; + $str .= strtolower($value)." VARCHAR(255), "; } - elseif(DB_TYPE == "postgres") - { - $str = "CREATE TABLE ".PREFIX."meta_exif (". - "md5sum VARCHAR(32) NOT NULL, "; - - foreach($array AS $key=>$value) - { - $str .= strtolower($value)." VARCHAR(255), "; - } - - /** - * remove last 2 signs (the comma and the space) - */ - $str = substr($str,0,strlen($str)-2).")"; - } - return $str; + + /** + * remove last 2 signs (the comma and the space) + */ + $str = substr($str,0,strlen($str)-2).")"; } + return $str; +} /** * get array with iptctags Modified: trunk/linpha2/linpha2.specs.txt =================================================================== --- trunk/linpha2/linpha2.specs.txt 2006-03-12 22:21:55 UTC (rev 4409) +++ trunk/linpha2/linpha2.specs.txt 2006-03-12 22:57:02 UTC (rev 4410) @@ -51,6 +51,7 @@ - rawurlencode() - htmlspecialchars() - htmlentities() + - smart_htmlspecialchars() from phpmeta used several times in forms in linpha1 ? - ? - users have to use firefox Modified: trunk/linpha2/templates/main_html/view_img.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_img.html.php 2006-03-12 22:21:55 UTC (rev 4409) +++ trunk/linpha2/templates/main_html/view_img.html.php 2006-03-12 22:57:02 UTC (rev 4410) @@ -43,6 +43,8 @@ .add_comment { color: #036; width: 600px; + text-align: left; + margin-left: 100px; } .add_comment input, .add_comment textarea { background-color: #d5eeff; @@ -57,12 +59,13 @@ </style> <div class="add_comment"> <form action="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current; ?>" method="POST"> -Name: -<input type="text" name="author" value="" size="10" maxlength="40" /> -Comment: -<input type="text" id="comment_text" name="comment_text" value="" size="40" maxlength="40" /> +Add Comment:<br /> +<div id="comment_div_text"> +<input type="text" id="comment_input_text" name="comment_text" value="" size="40" maxlength="40" /> <a href="javascript:open_textarea()">(+)</a> +</div> <textarea style="display: none;" id="comment_textarea" name="comment_textarea" rows="10" cols="50"></textarea> +Name: <input type="text" name="author" value="" size="10" maxlength="40" /> <input type="hidden" name="cmd" value="add_comment" /> <input type="submit" name="submit" value="submit" /> </form> @@ -87,8 +90,8 @@ function open_textarea() { document.getElementById('comment_textarea').style.display = 'block'; - document.getElementById('comment_text').style.display = 'none'; + document.getElementById('comment_div_text').style.display = 'none'; - document.getElementById('comment_textarea').value = document.getElementById('comment_text').value; + document.getElementById('comment_textarea').value = document.getElementById('comment_input_text').value; } </script> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 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. |
From: <fan...@us...> - 2006-03-14 21:00:48
|
Revision: 4412 Author: fangehrn Date: 2006-03-14 13:00:36 -0800 (Tue, 14 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4412&view=rev Log Message: ----------- * show image information * adding "browse by date" feature Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/templates/main_html/view_meta.html.php trunk/linpha2/templates/main_html/view_thumbdetail.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-13 22:27:31 UTC (rev 4411) +++ trunk/linpha2/ChangeLog 2006-03-14 21:00:36 UTC (rev 4412) @@ -1,3 +1,7 @@ +2006-03-14 flo + * show image information + * adding "browse by date" feature + 2006-03-13 flo * add image infos Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-13 22:27:31 UTC (rev 4411) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-14 21:00:36 UTC (rev 4412) @@ -489,8 +489,41 @@ { $GLOBALS['linpha']->template->setModuleName('view_thumbdetail'); - $this->setRandomImages(); + /** + * set some infos only viewed in top view + */ + if($this->id_current == 0) + { + $this->setRandomImages(); + + $this->setBrowseByDate(); + } } + + function setBrowseByDate() + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal), max(datetimeoriginal) " . + "FROM ".PREFIX."meta_exif"); + + /** + * get min and max year + */ + $min_year = substr($data[0],0,4); + $max_year = substr($data[1],0,4); + + /** + * get years between + */ + $this->output['browse_by_date'] = ''; + 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) + { + $this->output['browse_by_date'] .= $i.' ('.$data[0].'), '; + } + } + } function setRandomImages() { @@ -591,26 +624,74 @@ /** * read image information from database */ + + if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) { + $str_exif_fields = strtolower( implode(', ',$MetaData->defined_exif_fields) ); + $exif_data = $GLOBALS['linpha']->db->GetRow("SELECT ".$str_exif_fields." FROM ".PREFIX."meta_exif WHERE md5sum = '".$this->md5sum."'"); + } + + if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { + $str_iptc_fields = strtolower( implode(', ',$MetaData->defined_iptc_fields) ); + $iptc_data = $GLOBALS['linpha']->db->GetRow("SELECT ".$str_iptc_fields." FROM ".PREFIX."meta_iptc WHERE md5sum = '".$this->md5sum."'"); + } + $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 ); + $value = ''; $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 + case 'id': + $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT name, field_type FROM ".PREFIX."meta_fields WHERE id = '".$last_part."'"); + if($meta_data['field_type']==0) // special fields like filename, dimension, imagesize + { + /** + * @todo maybe we could save this values in the db for speed improvements + */ + switch($meta_data['name']) + { + case 'filename': + $value = $this->filename; + break; + case 'imagesize': + $value = filesize(LINPHA_DIR.'/'.$this->full_filename); + break; + case 'dimension': + $array = linIdentify::linGetImageSize(LINPHA_DIR.'/'.$this->full_filename); + $value = $array[0].'x'.$array[1]; + break; + } + } + else // builtin and own fields + { + $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data FROM ".PREFIX."meta_data ". + "WHERE field_id = '".$last_part."' AND md5sum = '".$this->md5sum."'"); + if(isset($meta_data['meta_data'])) { + $value = $meta_data['meta_data']; + } + } break; case 'exif': + if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) { + $value = $exif_data[$last_part]; + } break; case 'iptc': + if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { + $value = $iptc_data[$last_part]; + } break; } - $value = ''; - $this->output['image_infos'][$data['name']] = Array('name' => $name, 'value' => $value); + if($value != '') + { + $this->output['image_infos'][$data['name']] = Array('name' => $name, 'value' => $value); + } } } Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-03-13 22:27:31 UTC (rev 4411) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-03-14 21:00:36 UTC (rev 4412) @@ -57,7 +57,11 @@ { case 'id': // builtin and own fields and special fields like filename, imagesize and dimension $data2 = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."meta_fields WHERE id = '".$last_part."'"); - $value = $this->array_special_fields[$data2['name']]; + if(isset($this->array_special_fields[$data2['name']])) { + $value = $this->array_special_fields[$data2['name']]; + } else { + $value = $data2['name']; + } break; case 'exif': $value = $this->all_exif_fields[$last_part]; Modified: trunk/linpha2/templates/main_html/view_meta.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_meta.html.php 2006-03-13 22:27:31 UTC (rev 4411) +++ trunk/linpha2/templates/main_html/view_meta.html.php 2006-03-14 21:00:36 UTC (rev 4412) @@ -66,6 +66,7 @@ </div> <div id='maindiv' class='main'> +<a href="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current.'&view=img'; ?>">Back to normal view</a> <h1>Edit image informations</h1> <?php $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type FROM ".PREFIX."meta_fields " . Modified: trunk/linpha2/templates/main_html/view_thumbdetail.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_thumbdetail.html.php 2006-03-13 22:27:31 UTC (rev 4411) +++ trunk/linpha2/templates/main_html/view_thumbdetail.html.php 2006-03-14 21:00:36 UTC (rev 4412) @@ -30,6 +30,9 @@ <hr /> <?php } ?> + Browse by Date: <?php echo $GLOBALS['linpha']->imgview->output['browse_by_date']; ?><br /> + <hr /> + <h1>Albums</h1> <?php } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-15 21:46:19
|
Revision: 4413 Author: fangehrn Date: 2006-03-15 13:45:53 -0800 (Wed, 15 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4413&view=rev Log Message: ----------- * adding "browse by date" feature Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.other.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/templates/main_html/view_thumb.html.php trunk/linpha2/templates/main_html/view_thumbdetail.html.php Added Paths: ----------- trunk/linpha2/lib/modules/module.browse.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-14 21:00:36 UTC (rev 4412) +++ trunk/linpha2/ChangeLog 2006-03-15 21:45:53 UTC (rev 4413) @@ -1,3 +1,6 @@ +2006-03-15 flo + * adding "browse by date" feature + 2006-03-14 flo * show image information * adding "browse by date" feature Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-03-14 21:00:36 UTC (rev 4412) +++ trunk/linpha2/index.php 2006-03-15 21:45:53 UTC (rev 4413) @@ -34,6 +34,9 @@ case 'basket': include_once(LINPHA_DIR.'/lib/modules/module.basket.php'); break; +case 'browse': + include_once(LINPHA_DIR.'/lib/modules/module.browse.php'); + break; } ?> \ 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-14 21:00:36 UTC (rev 4412) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-15 21:45:53 UTC (rev 4413) @@ -45,7 +45,7 @@ /** * set current view (thumb, thumbdetail, img, basket, ...) */ -function setCurrentView() +function setCurrentView($modulename) { $this->id_parent = 0; @@ -133,9 +133,19 @@ } else { - $this->id_current = 0; - $this->id_parent = 0; - $this->view = 'thumbdetail_view'; + switch($modulename) + { + case 'albums': + $this->id_current = 0; + $this->id_parent = 0; + $this->view = 'thumbdetail_view'; + break; + case 'browse': + $this->id_current = 0; + $this->view = 'thumb_view'; + //$_GET['id'] = -1; + break; + } } } @@ -354,6 +364,7 @@ } else { + $_GET['pn'] = 1; $this->current_page = 1; } @@ -465,7 +476,7 @@ */ function setSubFolders() { - $this->output['folders'] = ''; + $output_folders = ''; $nr_folders = 0; if($GLOBALS['show_subfolders_separate']) { @@ -473,11 +484,16 @@ { if($value['img_type'] == 0) { - $this->output['folders'] .= '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">'.$value['name'].'</a><br />'; + $output_folders .= '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">'.$value['name'].'</a><br />'; $nr_folders++; } } } + + if(! empty($output_folders)) + { + $this->output['navigation'] .= '<br /><br />'.$output_folders; + } $this->tot_photos = count($this->photos_filtered) - $nr_folders; } @@ -520,7 +536,7 @@ $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) FROM ".PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); if($data[0]>0) { - $this->output['browse_by_date'] .= $i.' ('.$data[0].'), '; + $this->output['browse_by_date'] .= '<a href="'.LINPHA_DIR.'/?cat=browse&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; } } } @@ -771,14 +787,6 @@ . '<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 Modified: trunk/linpha2/lib/classes/linpha.other.php =================================================================== --- trunk/linpha2/lib/classes/linpha.other.php 2006-03-14 21:00:36 UTC (rev 4412) +++ trunk/linpha2/lib/classes/linpha.other.php 2006-03-15 21:45:53 UTC (rev 4413) @@ -156,6 +156,15 @@ } } + /** + * append filename if one exists + */ + if($GLOBALS['linpha']->imgview->img_type!=0) + { + $str .= ' <a href="'.$GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current.'">' + .$GLOBALS['linpha']->imgview->filename.'</a>'; + } + return $str; } Modified: trunk/linpha2/lib/modules/module.albums.php =================================================================== --- trunk/linpha2/lib/modules/module.albums.php 2006-03-14 21:00:36 UTC (rev 4412) +++ trunk/linpha2/lib/modules/module.albums.php 2006-03-15 21:45:53 UTC (rev 4413) @@ -2,7 +2,7 @@ if(!defined('LINPHA_DIR')) { exit(1); } /** - * temporary set permission string and configs + * @todo temporary set permission string and configs */ $_SESSION["user_groups"] = ';1;'; $order_by = 'name ASC'; @@ -21,7 +21,7 @@ * set some infos */ $linpha->imgview->link_url = LINPHA_DIR.'/?cat=alb'; - $linpha->imgview->setCurrentView(); + $linpha->imgview->setCurrentView('albums'); /** * do import Added: trunk/linpha2/lib/modules/module.browse.php =================================================================== --- trunk/linpha2/lib/modules/module.browse.php (rev 0) +++ trunk/linpha2/lib/modules/module.browse.php 2006-03-15 21:45:53 UTC (rev 4413) @@ -0,0 +1,107 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +/** + * @todo temporary set permission string and configs + */ +$_SESSION["user_groups"] = ';1;'; +$order_by = 'name ASC'; + +/** + * init + */ + include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); + $linpha = new linpha(); + $linpha->sql->startSession(); + + include_once(LINPHA_DIR . '/lib/classes/linpha.imgview.class.php'); + $linpha->imgview = new linImgview(); + +/** + * set some infos + */ + $url_base = LINPHA_DIR.'/?cat=browse'; + $url_append = ''; + + if(isset($_GET['year'])) + { + $url_append = '&year='.$_GET['year']; + + if(isset($_GET['month'])) + { + $url_append .= '&month='.$_GET['month']; + + if(isset($_GET['day'])) + { + $url_append = '&day='.$_GET['day']; + } + } + } + + + $linpha->imgview->link_url = $url_base.$url_append; + + + $linpha->imgview->setCurrentView('browse'); + +/** + * set navigation line + */ + $linpha->imgview->output['navigation'] = '<a href="'.$url_base.'">all</a> > '; + + if(isset($_GET['year'])) + { + $linpha->imgview->output['navigation'] .= '<a href="'.$url_base.'&year='.$_GET['year'].'">'.$_GET['year'].'</a> > '; + } + + if(isset($_GET['month'])) + { + $linpha->imgview->output['navigation'] .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$_GET['month'].'">'.$_GET['month'].'</a> > '; + } + + if(isset($_GET['day'])) + { + $linpha->imgview->output['navigation'] .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$_GET['month'].'&day='.$_GET['day'].'">'.$_GET['day'].'</a> > '; + } + + if($linpha->imgview->id_current != 0) + { + $linpha->imgview->output['navigation'] .= '<a href="'.$linpha->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current.'">' + .$GLOBALS['linpha']->imgview->filename.'</a>'; + } + +/** + * set date links + */ + $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal), max(datetimeoriginal) " . + "FROM ".PREFIX."meta_exif"); + + /** + * get min and max year + */ + $min_year = substr($data[0],0,4); + $max_year = substr($data[1],0,4); + + /** + * get years between + */ + $linpha->imgview->output['navigation'] .= '<br /><br />'; + 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) + { + $linpha->imgview->output['navigation'] .= '<a href="'.$url_base.'&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; + } + } + + +/** + * get photos + */ + $linpha->imgview->photos = $GLOBALS['linpha']->db->GetAssoc("SELECT id, name, img_type, stats_numbers, time_add FROM ".PREFIX."photos " . + "WHERE img_type <> '0' ORDER by ".$order_by); + + +$linpha->imgview->buildImgView(); +?> \ No newline at end of file Modified: trunk/linpha2/templates/main_html/view_thumb.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_thumb.html.php 2006-03-14 21:00:36 UTC (rev 4412) +++ trunk/linpha2/templates/main_html/view_thumb.html.php 2006-03-15 21:45:53 UTC (rev 4413) @@ -29,9 +29,6 @@ <div id='navigation' class="navigation"> <?php echo $GLOBALS['linpha']->imgview->output['navigation']; ?> - <br /><br /> - <?php echo $GLOBALS['linpha']->imgview->output['folders']; ?> - <br /><br /> </div> <div id='maindiv' class='main'> Modified: trunk/linpha2/templates/main_html/view_thumbdetail.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_thumbdetail.html.php 2006-03-14 21:00:36 UTC (rev 4412) +++ trunk/linpha2/templates/main_html/view_thumbdetail.html.php 2006-03-15 21:45:53 UTC (rev 4413) @@ -3,6 +3,13 @@ left<br />left<br />left<br />left<br />left<br />left<br /> </div> +<?php if($GLOBALS['linpha']->imgview->id_current!=0) { ?> +<div id='navigation' class="navigation"> + <?php echo $GLOBALS['linpha']->imgview->output['navigation']; ?> + <br /><br /> +</div> +<?php } ?> + <div id='maindiv' class='main'> <?php if($GLOBALS['linpha']->imgview->id_current==0) { /* show welcome only in top view */ ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2006-03-19 17:59:33
|
Revision: 4419 Author: bzrudi Date: 2006-03-19 09:59:21 -0800 (Sun, 19 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4419&view=rev Log Message: ----------- language stuff enhancements Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.functions.php Added Paths: ----------- trunk/linpha2/lib/lang/language.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-17 10:19:02 UTC (rev 4418) +++ trunk/linpha2/ChangeLog 2006-03-19 17:59:21 UTC (rev 4419) @@ -1,3 +1,13 @@ +2006-03-19 bzrudi <linpha2_AT_tuxpower_DOT_de> + * added new file: /lib/lang/language.php + + list already known phrases + + makes it possible to edit/create language files via webinterface + + added "autocollector" of new phrases to translate tr() function + (a file /var/tmp/lang.temp.php is created which automagically saves + all new added translations in any files using tr()function + So - as of now please make always use of tr()! + (still incomplete!) + 2006-03-17 bzrudi <linpha2_AT_tuxpower_DOT_de> * added basic language support (yet incomplete) Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-03-17 10:19:02 UTC (rev 4418) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-03-19 17:59:21 UTC (rev 4419) @@ -3,25 +3,52 @@ /** * Take care of translation * - * This simple method takes care of all translation related stuff + * This simple method takes care of all translation related stuff. + * If option tr_learn is set - all new entries will be autolearned. + * @param string $text phrase/word to translate */ function tr($text) { - /** - * make language array global - */ - global $translate; + global $translate; + $tr_learn = true; //autolearn new language entries + + /** + * translation starts here + */ + if(true == isset($translate[$text])) + { + echo "$translate[$text]"; + } + else + { + echo "$text"; + } + + /** + * autolearn new language entries defined by tr() function. + */ + if($tr_learn == true) + { + $tmpfile = LINPHA_DIR."/var/tmp/lang.temp.txt"; + + if(false == file_exists("$tmpfile")) + { + if(false == touch("$tmpfile")) + { + echo "Unable to create ".$tmpfile." - please check permissions"; + } + } + + $filedata = file("$tmpfile"); + + if(false == in_array($text."\n", $filedata)) + { + $filedata[] = $text."\n"; + file_put_contents($tmpfile, $filedata); + } + } +} // end tr() - if(true==isset($translate[$text])) - { - echo "$translate[$text]"; - } - else - { - echo "$text"; - } - } - /** * print the main menu * Added: trunk/linpha2/lib/lang/language.php =================================================================== --- trunk/linpha2/lib/lang/language.php (rev 0) +++ trunk/linpha2/lib/lang/language.php 2006-03-19 17:59:21 UTC (rev 4419) @@ -0,0 +1,403 @@ +<?php +/* +* Copyright (c) 2006 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','../..'); } + +print_xhtml_header(); +print_menu_head(); + +(!isset($_GET['action'])) ? $_GET['action'] = "info": ''; + +/** + * switch page content + */ +switch($_REQUEST['action']) +{ + case "show_phrases": + print_phrases_list(); + break; + case "show_lang_files": + print_lang_file_select(); + break; + case "edit_lang": + edit_lang_files($_POST['language']); + break; + case "save_lang": + save_lang_files($_POST['language'], $_POST['phrase']); + break; + case "info": + echo "Please choose from the menu above"; + break; +} + +/** + * scan recursive for all php files in all subfolders + * @param string $dir + * @param int $counter default = 0 + */ +/* +function scanRecursive($dir, $counter) +{ + global $counter; + global $filelist; + if(!isset($counter)): $counter= 0; endif; + + $ignore = array (".", "..", ".svn", ".project", "albums", "install", "adodb", + "phpmeta", "graphics", "var"); + + if (is_dir($dir)) + { + $files = scandir($dir); + + foreach ($files as $file) + { + if(!in_array($file, array_values($ignore))) + { + $currentfile = $dir."/".$file; + $last_dir = ""; + $count = substr_count($currentfile, '/'); + $sub_count = substr_count($_SERVER['DOCUMENT_ROOT'], '/'); + $count -= ($sub_count + 2); + + if (is_dir($currentfile)) + { + scanRecursive($currentfile, $counter); + } + else + { + $filelist[$counter] = $currentfile; + $counter++; + } + } + } + } + return $filelist; // array() +} +*/ + +/** + * parse $tmpfile and output a list of all known phrases/words + * @param none + */ +function print_phrases_list() +{ + $tmpfile = LINPHA_DIR."/var/tmp/lang.temp.txt"; + + if(file_exists("$tmpfile")) + { + $phrases = file("$tmpfile"); + natcasesort($phrases); + foreach($phrases as $phrase) + { + echo $phrase."<br>"; + } + } + else + { + echo "Failed to open temporary lang file ($tmpfile)"; + } +} + +/** + * show all available language files an let user choose to edit/update + * @param none + */ +function print_lang_file_select() +{ + if(false == check_file_permissions()) + { + die("<strong>Please set right permissions first - aborting</strong>"); + } + + echo "<hr>Please choose language file to edit:<br />"; + echo "<form method='POST' action=".$_SERVER['PHP_SELF'].">"; + + build_lang_file_select(); + + echo " <input type=submit value='Go'>"; + echo " or create a <a href='#'><strong>new one</<strong></a>"; + echo "<input type='hidden' name='action' value='edit_lang'>"; + echo "</form>"; +} + +/** + * This function takes care right file permissions for language file stuff + * @param none + */ +function check_file_permissions() +{ + +$decperms = fileperms("".LINPHA_DIR."/lib/lang/"); +$octalperms = sprintf("%o",$decperms); +$dir_perms = (substr($octalperms,1)); + +echo "<strong>Checking write permissions of /lang folder...</strong><br>"; + +if($dir_perms != "0777") +{ + echo "<font color='#ff0000'>Warning: Please change /lang directory " . + "permissions from ".$dir_perms." to 0777!</font><br>"; + $permissions_ok = false; +} +else +{ + echo "<font color='#00FF00'>OK: /lang directory permissions are OK " . + "(".$dir_perms.")</font><br>"; + $permissions_ok = true; +} + /* parse all language files in dir*/ + $dir_handle = opendir("".LINPHA_DIR."/lib/lang/"); + $file_handle = readdir($dir_handle); + + while($file_handle != false) + { + $explode = explode(".",$file_handle); + if($explode[0] == "lang") + { + if(false == is_writeable("$file_handle")) + { + echo "<font color='#ff0000'>Warning: Seems that ".$file_handle."" . + " is NOT writeable, please set to (0666) first!</font><br>"; + $file_error = true; + }else + { + $file_error = false; + } + } + $file_handle = readdir($dir_handle); + } + + if(true == $permissions_ok AND false == $file_error) + { + echo "<font color='#00FF00'>OK: All language files are set " . + "writeable!</font><br>"; + return true; + } + else + { + return false; + } +} + + +/** + * return array of all available language files found + * in /lib/lang to be used in select field + * @param none + **/ +function build_lang_file_select() +{ + +$path = LINPHA_DIR."/lib/lang"; + +$file_handle = opendir($path); +$file = readdir($file_handle); +$options = array(); + + while($file != false) + { + $explode = explode(".",$file); + + /* Only files that starts with 'lang.' are language files. */ + if($explode[0] == "lang") + { + $options[$explode[1]] = $explode[1]; + } + $file = readdir($file_handle); + } + natcasesort($options); + + form_generate_select("language", "", $options); +} + + + +/** + * autogenrate select field for all available language files + * @param string $name name of select field + * @param string $size vsize of selectfield, e.g. height + * @param array $values array of all available language files + */ +function form_generate_select($name, $size, $values) +{ + print "<select name='".$name."' size='".$size."'>\n"; + foreach ($values as $key => $value) + { + echo "<option value='".$key."'>".$value."</option>\n"; + } + print "</select>"; +} + + + +/** + * edit language files + * @param string $langfile name of language file to edit + */ +function edit_lang_files($langfile) +{ + global $translate; + $langfile = LINPHA_DIR."/lib/lang/lang.".$langfile.".php"; + $tmpfile = LINPHA_DIR."/var/tmp/lang.temp.txt"; + + if(file_exists("$langfile") && file_exists("$tmpfile")) + { + include_once("$langfile"); + $collected = file("$tmpfile"); + } + else + { + die("Failed to include: ".$langfile.""); + } + + /** + * collect missing entries in langfile + */ + foreach($collected as $phrase) + { + if(false == array_key_exists(trim($phrase), $translate)) + { + $new_phrases[] = $phrase; + } + } + + if(false == isset($new_phrases)) + { + echo "FINE - Your language file is up to date"; + } + else + { + echo "<table width='80%' colspan='0' rowspan='0'>" . + "<tr><td colspan='2'>" . + "Please translate all missing entries" . + "</td></tr>" . + "<form method='POST' action=".$_SERVER['PHP_SELF'].">" . + "<tr>"; + + foreach($new_phrases as $phrase2tr) + { + echo "<td width='30%'>$phrase2tr</td>" . + "<td><input type='text' name='phrase[$phrase2tr][]'></td></tr>"; + } + + echo "<input type='hidden' name='action' value='save_lang'>" . + "<input type='hidden' name='language' value='$langfile'>" . + "<tr><td colspan='2'>" . + "<input type='submit' name='submit' value='submit'>" . + "</td></tr>" . + "</form></table>"; + } +} + + + +/** + * save translation to file + * @param string $langfile language filename incl. full path + * @param array $phrases array of all translated parts + */ +function save_lang_files($langfile, $phrases) +{ + + if(file_exists($langfile)) + { + include_once($langfile); + } + + /** + * merge already found translation phrases with the new ones + */ + while (list($phrase, $translation) = each($phrases)) + { + foreach($translation as $translated) + { + if(false == empty($translated)) + { + $translate[$phrase] = $translated; + } + } + } + + $last_key = end(array_keys($translate)); + reset($translate); + $last_value = array_pop($translate); + reset($translate); + + $file_data = "<?php\n"; + $file_data .= "\$translate = array (\n"; + + while(list($phrase , $translation) = each($translate)) + { + $file_data .= "\"".trim($phrase)."\""." => "."\"$translation\","."\n"; + } + + $file_data .= "\"".trim($last_key)."\""." => "."\"$last_value\"\n"; + $file_data .= ");\n"; + $file_data .= "?>"; + + + $fp = fopen("$langfile", "w+"); + fwrite($fp, $file_data); + fclose($fp); + //chmod($file_handle, 0666); + +} + + + +/** + * Prepare valid XHTML header + */ +function print_xhtml_header() +{ + ?> + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + + <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-AU"> + + <head> + + <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8"/> + <meta name="author" content="The LinPHA Developers" /> + <meta name="keywords" content="Linpha" /> + <meta name="description" content="The LinPHA2 Photo Archive" /> + + <title>LinPHA - Translation Module</title> + + </head> + <body bgcolor="#808000"> + <?php +} + +/** + * Prepare site Menu + */ +function print_menu_head() +{ + echo "<strong>Welcome To LinPHA2 Translation Module"."</strong><hr /> "; + echo "<ul>"; + echo "<li><a href=".$_SERVER['PHP_SELF']."?action=show_phrases>" . + "Show list of already known phrases/words</a>"; + echo "<li><a href=".$_SERVER['PHP_SELF']."?action=show_lang_files>" . + "Edit/Update language files</a>"; + //echo "<li><a href=".$_SERVER['PHP_SELF']."?action=info>Dummy</a>"; + echo "</ul>"; + echo "<hr />"; +} +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2006-03-20 14:46:52
|
Revision: 4420 Author: bzrudi Date: 2006-03-20 06:46:30 -0800 (Mon, 20 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4420&view=rev Log Message: ----------- language stuff should work now Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/lang/language.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-19 17:59:21 UTC (rev 4419) +++ trunk/linpha2/ChangeLog 2006-03-20 14:46:30 UTC (rev 4420) @@ -1,3 +1,6 @@ +2006-03-20 bzrudi <linpha2_AT_tuxpower_DOT_de> + * language stuff should work now + 2006-03-19 bzrudi <linpha2_AT_tuxpower_DOT_de> * added new file: /lib/lang/language.php + list already known phrases Modified: trunk/linpha2/lib/lang/language.php =================================================================== --- trunk/linpha2/lib/lang/language.php 2006-03-19 17:59:21 UTC (rev 4419) +++ trunk/linpha2/lib/lang/language.php 2006-03-20 14:46:30 UTC (rev 4420) @@ -21,7 +21,7 @@ print_xhtml_header(); print_menu_head(); -(!isset($_GET['action'])) ? $_GET['action'] = "info": ''; +(!isset($_REQUEST['action'])) ? $_REQUEST['action'] = "info": ''; /** * switch page content @@ -35,11 +35,14 @@ print_lang_file_select(); break; case "edit_lang": - edit_lang_files($_POST['language']); + edit_lang_files($_REQUEST['language']); break; case "save_lang": save_lang_files($_POST['language'], $_POST['phrase']); break; + case "create_file": + create_new_file(@$_POST['filename']); + break; case "info": echo "Please choose from the menu above"; break; @@ -130,13 +133,14 @@ build_lang_file_select(); echo " <input type=submit value='Go'>"; - echo " or create a <a href='#'><strong>new one</<strong></a>"; + echo " or create a <a href='".$_SERVER['PHP_SELF']."?action=create_file'>" . + "<strong>new one</<strong></a>"; echo "<input type='hidden' name='action' value='edit_lang'>"; echo "</form>"; } /** - * This function takes care right file permissions for language file stuff + * This function takes care of right file permissions * @param none */ function check_file_permissions() @@ -333,11 +337,17 @@ } } + /** + * temporary save last array entry. + */ $last_key = end(array_keys($translate)); reset($translate); $last_value = array_pop($translate); reset($translate); + /** + * create language file + */ $file_data = "<?php\n"; $file_data .= "\$translate = array (\n"; @@ -350,16 +360,63 @@ $file_data .= ");\n"; $file_data .= "?>"; - + copy($langfile, $langfile.".bak"); $fp = fopen("$langfile", "w+"); fwrite($fp, $file_data); fclose($fp); - //chmod($file_handle, 0666); + chmod($langfile, 0644); } +/** + * create new empty language file + * @param string $filename filename for new language file + */ +function create_new_file($filename) +{ + + if(false == isset($filename)) + { + echo "Please enter the name of new language file to create " . + "(e.g. German, French, Japanese...). A file named lang.Yourlang.php " . + "will be created which you can edit later.<br />" . + "<form method='POST' action=".$_SERVER['PHP_SELF'].">" . + "Language to create: " . + "<input type='text' name='filename'></td></tr>" . + "<input type='hidden' name='action' value='create_file'> " . + "<input type='submit' name='submit' value='submit'>" . + "</form>"; + } + else + { + + $langfile = LINPHA_DIR."/lib/lang/lang.".$filename.".php"; + + if(true == file_exists($langfile)) + { + die("File already exists! Please remove first - aborting!"); + } + /** + * create empty language file + */ + $file_data = "<?php\n"; + $file_data .= "\$translate = array (\n\n"; + $file_data .= ");\n"; + $file_data .= "?>"; + + $fp = fopen("$langfile", "w+"); + fwrite($fp, $file_data); + fclose($fp); + chmod($langfile, 0644); + + echo "Fine - now please go " . + "<a href='".$_SERVER['PHP_SELF']."?action=edit_lang&language=".$filename."'>here<a> " . + "and start translating"; + } +} + /** * Prepare valid XHTML header */ @@ -396,7 +453,8 @@ "Show list of already known phrases/words</a>"; echo "<li><a href=".$_SERVER['PHP_SELF']."?action=show_lang_files>" . "Edit/Update language files</a>"; - //echo "<li><a href=".$_SERVER['PHP_SELF']."?action=info>Dummy</a>"; + echo "<li><a href=".$_SERVER['PHP_SELF']."?action=create_file>" . + "Create new language file</a>"; echo "</ul>"; echo "<hr />"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2006-03-20 14:48:18
|
Revision: 4421 Author: bzrudi Date: 2006-03-20 06:47:56 -0800 (Mon, 20 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4421&view=rev Log Message: ----------- removed DEFAULT CHARSET option, as it's mysql >=4.1 only and I stuck with 4.0 ;-) Modified Paths: -------------- trunk/linpha2/db_data.sql trunk/linpha2/db_mysql.sql Modified: trunk/linpha2/db_data.sql =================================================================== --- trunk/linpha2/db_data.sql 2006-03-20 14:46:30 UTC (rev 4420) +++ trunk/linpha2/db_data.sql 2006-03-20 14:47:56 UTC (rev 4421) @@ -1,7 +1,7 @@ -- -- Daten f?r Tabelle `linpha_photos` -- - +use linpha2; TRUNCATE `linpha_config`; INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_db_adodb_cache_path', 'var/tmp/adocache', 0); INSERT INTO `linpha_config` (`option_name`, `option_value`, `userid`) VALUES ('sys_db_adodb_caching', '0', 0); Modified: trunk/linpha2/db_mysql.sql =================================================================== --- trunk/linpha2/db_mysql.sql 2006-03-20 14:46:30 UTC (rev 4420) +++ trunk/linpha2/db_mysql.sql 2006-03-20 14:47:56 UTC (rev 4421) @@ -16,6 +16,8 @@ -- Tabellenstruktur f?r Tabelle `linpha_config` -- +use linpha2; + DROP TABLE IF EXISTS `linpha_config`; CREATE TABLE `linpha_config` ( `ID` smallint(5) unsigned NOT NULL auto_increment, @@ -26,7 +28,7 @@ UNIQUE KEY `option_name_2` (`option_name`), KEY `option_name` (`option_name`), KEY `option_value` (`option_value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +); -- -------------------------------------------------------- @@ -39,7 +41,7 @@ `id` int(11) NOT NULL auto_increment, `name` varchar(100) NOT NULL default '', PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +); -- -------------------------------------------------------- @@ -54,7 +56,7 @@ `perm_type` varchar(255) NOT NULL default '0', `permission` varchar(255) NOT NULL default '', PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +); -- -------------------------------------------------------- @@ -76,17 +78,17 @@ `stats_views` int(11) NOT NULL default '0', `stats_downloads` int(11) NOT NULL default '0', PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +); -DROP TABLE IF EXISTS linpha_meta_fields; +DROP TABLE IF EXISTS `linpha_meta_fields`; CREATE TABLE IF NOT EXISTS linpha_meta_fields ( id int(11) NOT NULL auto_increment, name varchar(255) NOT NULL default '', field_type int(11) NOT NULL default '0', flags int(11) NOT NULL default '0', PRIMARY KEY (id) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +); DROP TABLE IF EXISTS `linpha_meta_category`; @@ -96,7 +98,7 @@ name varchar(255) NOT NULL default '', isprivate int(11) default NULL, PRIMARY KEY (id) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +); -- -- Tabellenstruktur f?r Tabelle `linpha_meta_exif` @@ -104,22 +106,22 @@ DROP TABLE IF EXISTS linpha_meta_exif; CREATE TABLE IF NOT EXISTS linpha_meta_exif ( - md5sum varchar(32) collate latin1_general_ci NOT NULL default '', - datetimeoriginal varchar(255) collate latin1_general_ci default NULL, - make varchar(255) collate latin1_general_ci default NULL, - model varchar(255) collate latin1_general_ci default NULL, - artist varchar(255) collate latin1_general_ci default NULL, - copyright varchar(255) collate latin1_general_ci default NULL, - aperturevalue varchar(255) collate latin1_general_ci default NULL, - shutterspeedvalue varchar(255) collate latin1_general_ci default NULL, - exposuretime varchar(255) collate latin1_general_ci default NULL, - isospeedratings varchar(255) collate latin1_general_ci default NULL, - flash varchar(255) collate latin1_general_ci default NULL, - focallength varchar(255) collate latin1_general_ci default NULL, - fnumber varchar(255) collate latin1_general_ci default NULL, + md5sum varchar(32) NOT NULL default '', + datetimeoriginal varchar(255) default NULL, + make varchar(255) default NULL, + model varchar(255) default NULL, + artist varchar(255) default NULL, + copyright varchar(255) default NULL, + aperturevalue varchar(255) default NULL, + shutterspeedvalue varchar(255) default NULL, + exposuretime varchar(255) default NULL, + isospeedratings varchar(255) default NULL, + flash varchar(255) default NULL, + focallength varchar(255) default NULL, + fnumber varchar(255) default NULL, PRIMARY KEY (md5sum), KEY md5sum (md5sum) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +); -- -- Tabellenstruktur f?r Tabelle `linpha_meta_iptc` @@ -127,10 +129,10 @@ DROP TABLE IF EXISTS linpha_meta_iptc; CREATE TABLE IF NOT EXISTS linpha_meta_iptc ( - md5sum varchar(32) collate latin1_general_ci NOT NULL default '', + md5sum varchar(32) NOT NULL default '', PRIMARY KEY (md5sum), KEY md5sum (md5sum) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +); @@ -146,7 +148,7 @@ author varchar(255) NOT NULL default '', `comment` text NOT NULL, PRIMARY KEY (id) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +); -- @@ -160,4 +162,4 @@ 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 +); \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2006-03-20 16:34:37
|
Revision: 4423 Author: bzrudi Date: 2006-03-20 08:34:17 -0800 (Mon, 20 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4423&view=rev Log Message: ----------- renamed tr() to i18n() Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/templates/main_html/basket.html.php trunk/linpha2/templates/main_html/view_img.html.php trunk/linpha2/templates/main_html/view_meta.html.php Property Changed: ---------------- trunk/linpha2/lib/lang/ Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-20 14:52:31 UTC (rev 4422) +++ trunk/linpha2/ChangeLog 2006-03-20 16:34:17 UTC (rev 4423) @@ -1,5 +1,6 @@ 2006-03-20 bzrudi <linpha2_AT_tuxpower_DOT_de> * language stuff should work now + * renamed tr() to i18n() 2006-03-19 bzrudi <linpha2_AT_tuxpower_DOT_de> * added new file: /lib/lang/language.php Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-03-20 14:52:31 UTC (rev 4422) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-03-20 16:34:17 UTC (rev 4423) @@ -7,7 +7,7 @@ * If option tr_learn is set - all new entries will be autolearned. * @param string $text phrase/word to translate */ - function tr($text) + function i18n($text) { global $translate; $tr_learn = true; //autolearn new language entries Property changes on: trunk/linpha2/lib/lang ___________________________________________________________________ Name: svn:ignore + lang.* Modified: trunk/linpha2/templates/main_html/basket.html.php =================================================================== --- trunk/linpha2/templates/main_html/basket.html.php 2006-03-20 14:52:31 UTC (rev 4422) +++ trunk/linpha2/templates/main_html/basket.html.php 2006-03-20 16:34:17 UTC (rev 4423) @@ -1,11 +1,11 @@ <form name="basket" action="<?php echo $GLOBALS['linpha']->template->UrlFull; ?>&cmd=remove_selected" method="POST"> <div class='navigation'> -<a href="<?php echo LINPHA_DIR.'/?cat=alb&id='.$_GET['ref_id']; ?>"><?php tr("Go Back"); ?></a> -<a href="<?php echo $GLOBALS['linpha']->template->UrlFull; ?>&cmd=remove_all"><?php tr("Remove All"); ?></a> +<a href="<?php echo LINPHA_DIR.'/?cat=alb&id='.$_GET['ref_id']; ?>"><?php i18n("Go Back"); ?></a> +<a href="<?php echo $GLOBALS['linpha']->template->UrlFull; ?>&cmd=remove_all"><?php i18n("Remove All"); ?></a> <input type="submit" name="submit" value="remove selected" /> <br /><br /> -<?php tr("Images In Basket");?>:<?php echo count($_SESSION['basket_ids']); ?> +<?php i18n("Images In Basket");?>:<?php echo count($_SESSION['basket_ids']); ?> </div> <div id='maindiv' class='main'> @@ -90,7 +90,7 @@ <?php } else { - tr("Empty Basket"); + i18n("Empty Basket"); } ?> </div> Modified: trunk/linpha2/templates/main_html/view_img.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_img.html.php 2006-03-20 14:52:31 UTC (rev 4422) +++ trunk/linpha2/templates/main_html/view_img.html.php 2006-03-20 16:34:17 UTC (rev 4423) @@ -64,13 +64,13 @@ </style> <div class="add_comment"> <form action="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current; ?>" method="POST"> -<?php tr("Add Comment"); ?>:<br /> +<?php i18n("Add Comment"); ?>:<br /> <div id="comment_div_text"> <input type="text" id="comment_input_text" name="comment_text" value="" size="40" maxlength="40" /> <a href="javascript:open_textarea()">(+)</a> </div> <textarea style="display: none;" id="comment_textarea" name="comment_textarea" rows="10" cols="50"></textarea> -<?php tr("Name"); ?>: <input type="text" name="author" value="" size="10" maxlength="40" /> +<?php i18n("Name"); ?>: <input type="text" name="author" value="" size="10" maxlength="40" /> <input type="hidden" name="cmd" value="add_comment" /> <input type="submit" name="submit" value="submit" /> </form> Modified: trunk/linpha2/templates/main_html/view_meta.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_meta.html.php 2006-03-20 14:52:31 UTC (rev 4422) +++ trunk/linpha2/templates/main_html/view_meta.html.php 2006-03-20 16:34:17 UTC (rev 4423) @@ -67,7 +67,7 @@ <div id='maindiv' class='main'> <a href="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current.'&view=img'; ?>">Back to normal view</a> -<h1><?php tr("Edit Image Imformation"); ?></h1> +<h1><?php i18n("Edit Image Imformation"); ?></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"); @@ -76,8 +76,8 @@ <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><?php tr("Name"); ?></b></td> - <td width="200"><b><?php tr("Value"); ?></b></td> + <td width="150"><b><?php i18n("Name"); ?></b></td> + <td width="200"><b><?php i18n("Value"); ?></b></td> <td rowspan="<?php echo $num+1; ?>"><?php echo $GLOBALS['linpha']->imgview->output['image']; ?></td> </tr> <?php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-20 18:45:27
|
Revision: 4425 Author: fangehrn Date: 2006-03-20 10:45:06 -0800 (Mon, 20 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4425&view=rev Log Message: ----------- * testing language stuff, really nice ;-) * small design review, making class img_view even more modular Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/dev.txt trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/templates/main_css/view_img.css trunk/linpha2/templates/main_css/view_thumbdetail.css trunk/linpha2/templates/main_html/view_img.html.php trunk/linpha2/templates/main_html/view_thumb.head.php trunk/linpha2/templates/main_html/view_thumb.html.php trunk/linpha2/templates/main_html/view_thumbdetail.html.php Added Paths: ----------- trunk/linpha2/templates/main_css/home.css trunk/linpha2/templates/main_html/home.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-20 16:53:55 UTC (rev 4424) +++ trunk/linpha2/ChangeLog 2006-03-20 18:45:06 UTC (rev 4425) @@ -1,3 +1,7 @@ +2006-03-15 flo + * testing language stuff, really nice ;-) + * small design review, making class img_view even more modular + 2006-03-20 bzrudi <linpha2_AT_tuxpower_DOT_de> * language stuff should work now * renamed tr() to i18n() Modified: trunk/linpha2/dev.txt =================================================================== --- trunk/linpha2/dev.txt 2006-03-20 16:53:55 UTC (rev 4424) +++ trunk/linpha2/dev.txt 2006-03-20 18:45:06 UTC (rev 4425) @@ -4,4 +4,4 @@ $GLOBALS['linpha']->sql->config->value['']; -test \ No newline at end of file +<?php echo i18n(""); ?> \ No newline at end of file Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-03-20 16:53:55 UTC (rev 4424) +++ trunk/linpha2/index.php 2006-03-20 18:45:06 UTC (rev 4425) @@ -13,10 +13,10 @@ } $output['menu_main'] = Array( - 'home' => LINPHA_DIR . '/', - 'admin' => LINPHA_DIR . '/admin/', - 'search' => '#', /*LINPHA_DIR . '/?cat=search'*/ - 'login' => '#' /*LINPHA_DIR . '/?cat=login'*/ + Array('name' => 'home', 'value' => LINPHA_DIR . '/'), + Array('name' => 'admin', 'value' => LINPHA_DIR . '/admin/'), + Array('name' => 'search', 'value' => '#'), /*LINPHA_DIR . '/?cat=search'*/ + Array('name' => 'login', 'value' => '#') /*LINPHA_DIR . '/?cat=login'*/ ); Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-03-20 16:53:55 UTC (rev 4424) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-03-20 18:45:06 UTC (rev 4425) @@ -97,7 +97,7 @@ ?> <div id="menu_switch"> - <a href="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$_GET['id'].'&menu='.$link; + <a href="<?php echo $GLOBALS['linpha']->imgview->url_full.'&menu='.$link; ?>"><?php echo $str_href; ?></a> </div> <?php /* @@ -111,7 +111,7 @@ menu_is_open = false; document.getElementById('menu_optional').style.visibility = 'hidden'; - document.getElementById('menu_switch').innerHTML = '<a href="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$_GET['id']; + document.getElementById('menu_switch').innerHTML = '<a href="<?php echo $GLOBALS['linpha']->imgview->url_full; ?>" onclick="open_close_menu(); return false;">></a>'; } else @@ -119,7 +119,7 @@ menu_is_open = true; document.getElementById('menu_optional').style.visibility = ''; - document.getElementById('menu_switch').innerHTML = '<a href="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$_GET['id']; + document.getElementById('menu_switch').innerHTML = '<a href="<?php echo $GLOBALS['linpha']->imgview->url_full; ?>" onclick="open_close_menu(); return false;"><</a>'; } } @@ -144,7 +144,7 @@ echo '<div">Basket: '; foreach($GLOBALS['output']['menu_sub'] AS $key=>$value) { - echo '<a href="'.$value.'">'.i18n($key).'</a> '; + echo '<a href="'.$value.'">'.$key.'</a> '; } } @@ -153,32 +153,31 @@ foreach($GLOBALS['output'][$index] AS $key=>$value) { echo "\n\n".'<ul>'."\n"; - if(! is_array($value)) + if(!is_array($value['value'])) { - echo "\t".'<li><a href="'.$value.'">'.i18n($key).'</a></li>'."\n"; + echo "\t".'<li><a href="'.$value['value'].'">'.$value['name'].'</a></li>'."\n"; } else { - echo "\t".'<li><span>'.i18n($key).'</span>'."\n"; + echo "\t".'<li><span>'.$value['name'].'</span>'."\n"; echo "\t".'<ul>'."\n"; - foreach($value AS $sub_key=>$sub_value) + foreach($value['value'] AS $sub_value) { - - if(! is_array($sub_value)) + if(!is_array($sub_value['value'])) { - echo "\t\t".'<li><a href="'.$sub_value.'">'.i18n($sub_key).'</a></li>'."\n"; + echo "\t\t".'<li><a href="'.$sub_value['value'].'">'.$sub_value['name'].'</a></li>'."\n"; } else { - echo "\t\t".'<li><span>'.i18n($sub_key).'</span>'."\n"; + echo "\t\t".'<li><span>'.$sub_value['name'].'</span>'."\n"; echo "\t\t".'<ul>'."\n"; - foreach($sub_value AS $subsub_key=>$subsub_value) + foreach($sub_value['value'] AS $subsub_value) { - echo "\t\t\t".'<li><a href="'.$subsub_value.'">'.i18n($subsub_key).'</a></li>'."\n"; + echo "\t\t\t".'<li><a href="'.$subsub_value['value'].'">'.$subsub_value['name'].'</a></li>'."\n"; } echo "\t\t".'</ul>'."\n"; @@ -213,7 +212,7 @@ */ if($GLOBALS['linpha']->imgview->img_type!=0) { - $str .= ' <a href="'.$GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current.'">' + $str .= ' <a href="'.$GLOBALS['linpha']->imgview->url_full.'">' .$GLOBALS['linpha']->imgview->filename.'</a>'; } @@ -260,4 +259,12 @@ return $array; } +/** + * we have to use & in links (W3C) + * in javascript, the & arent convert in & ! + */ +function convert_amp($url) +{ + return str_replace('&','&',$url); +} ?> \ 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-20 16:53:55 UTC (rev 4424) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-20 18:45:06 UTC (rev 4425) @@ -20,7 +20,7 @@ class linImgview { public $view; -public $link_url; +public $url_base, $url_full; public $output; public $tot_photos; public $photos; @@ -47,8 +47,6 @@ */ function setCurrentView($modulename) { - $this->id_parent = 0; - if(isset($_GET['id']) && $_GET['id'] != 0) { if(isset($_GET['view'])) @@ -61,24 +59,23 @@ */ $current_data = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum FROM ".PREFIX."photos " . "WHERE id = '".linSql::linAddslashes($_GET['id'])."'"); - $this->img_type = $current_data['img_type']; - $this->filename = $current_data['name']; - $this->md5sum = $current_data['md5sum']; /** * check for valid id */ - if( isset($current_data) && count($current_data) > 0 ) + if( isset($current_data) ) { + $this->img_type = $current_data['img_type']; + $this->filename = $current_data['name']; + $this->md5sum = $current_data['md5sum']; $this->id_current = $current_data['id']; + $this->id_parent = $current_data['parent_id']; /** * switch between thumb_view and img_view */ if( $this->img_type == 0) { - $this->id_parent = $current_data['id']; - if(isset($_SESSION['view'])) { switch($_SESSION['view']) @@ -121,32 +118,32 @@ { $this->view = 'img_view'; } - $this->id_parent = $current_data['parent_id']; } } else // no valid id supplied { $this->id_current = 0; - $this->id_parent = 0; $this->view = 'thumbdetail_view'; } } else { - switch($modulename) + $this->id_current = 0; + + if($modulename=='albums') { - case 'albums': - $this->id_current = 0; - $this->id_parent = 0; - $this->view = 'thumbdetail_view'; - break; - case 'browse': - $this->id_current = 0; - $this->view = 'thumb_view'; - //$_GET['id'] = -1; - break; + $this->view = 'home'; } + else + { + $this->view = 'thumb_view'; + } } + + if( ! isset( $this->id_parent) ) + { + $this->id_parent = $this->id_current; + } } /** @@ -163,6 +160,9 @@ */ switch($this->view) { + case 'home': + $this->viewHome_view(); + break; case 'img_view': $this->viewImg_view(); break; @@ -215,14 +215,14 @@ /** * don't show this menu if we're on top */ - if($this->id_current != 0) + if($this->view != 'home') { /** * more than one time used stuff */ foreach($GLOBALS['array_sort_orders'] AS $value) { - $array_sort_orders_links[$value] = $this->link_url.'&id='.$this->id_current.'&order_by='.$value; + $array_sort_orders_links[] = Array('name' => i18n($value), 'value' => $this->url_full.'&order_by='.$value); } $open_basket_link = LINPHA_DIR.'?cat=basket&ref_id='.$this->id_current; @@ -235,64 +235,88 @@ foreach($GLOBALS['array_tn_sizes'] AS $value) { - $array_tn_sizes_links[$value.' Pixel'] = 'javascript:set_tn_size('.$value.')'; + $array_tn_sizes_links[] = Array('name' => $value.' '.i18n("Pixel"), 'value' => 'javascript:set_tn_size('.$value.')'); } foreach($GLOBALS['array_nr_images'] AS $value) { - $array_nr_links[$value] = "javascript:set_nr_images('".$value."')"; + $array_nr_links[] = Array('name' => $value, 'value' =>"javascript:set_nr_images('".$value."')"); } foreach($GLOBALS['array_views'] AS $value) { - $array_views_links[$value] = $this->link_url.'&id='.$this->id_current.'&view='.$value; + $array_views_links[] = Array('name' => i18n($value), 'value' => $this->url_full.'&view='.$value); } $GLOBALS['output']['menu_optional'] = Array( - 'basket' => Array( - 'add all to basket' => $open_basket_link.'&cmd=add_all', - 'switch to basket view' => $this->link_url.'&id='.$this->id_current.'&view=basket', - 'open basket' => $open_basket_link, - 'in basket: '.count($_SESSION['basket_ids']) => '#' + Array( + 'name' => 'basket', + 'value' => Array( + Array('name' => i18n('add all to basket'), 'value' => $open_basket_link.'&cmd=add_all'), + Array('name' => i18n('switch to basket view'), 'value' => $this->url_full.'&view=basket'), + Array('name' => i18n('open basket'), 'value' => $open_basket_link), + Array('name' => i18n('in basket').': '.count($_SESSION['basket_ids']), 'value' => '#') + ) ), - 'view' => Array( - 'sort' => $array_sort_orders_links, - 'view' => $array_views_links, - 'thumb_size' => $array_tn_sizes_links, - 'thumb_nr' => $array_nr_links - ), - 'edit' => Array( - 'set_permissions' => $edit_permission_link + Array( + 'name' => 'view', + 'value' => Array( + Array('name' => i18n('sort'), 'value' => $array_sort_orders_links), + Array('name' => i18n('view'), 'value' => $array_views_links), + Array('name' => i18n('thumb size'), 'value' => $array_tn_sizes_links), + Array('name' => i18n('thumb nr'), 'value' => $array_nr_links) + ) + ), + Array( + 'name' => 'edit', + 'value' => Array( + Array('name' => i18n('set_permissions'), 'value' => $edit_permission_link) + ) ), - 'metainfo' => Array( - 'edit album comment' => $this->link_url.'&id='.$this->id_current.'&view=comment', - 'edit album information' => $this->link_url.'&id='.$this->id_current.'&view=meta' + Array( + 'name' => 'metainfo', + 'value' => Array( + Array('name' => i18n('edit album comment'), 'value' => $this->url_full.'&view=comment'), + Array('name' => i18n('edit album information'), 'value' => $this->url_full.'&view=meta') + ) ) ); break; case 'img_view': $GLOBALS['output']['menu_optional'] = Array( - 'basket' => Array( - 'add to basket' => '#', - 'switch to basket view' => '#', - 'open basket' => $open_basket_link, - 'in basket: '.count($_SESSION['basket_ids']) => '#' + Array( + 'name' => 'basket', + 'value' => Array( + Array('name' => i18n('add to basket'), 'value' => '#'), + Array('name' => i18n('switch to basket view'), 'value' => '#'), + Array('name' => i18n('open basket'), 'value' => $open_basket_link), + Array('name' => i18n('in basket').': '.count($_SESSION['basket_ids']), 'value' => '#') + ) ), - 'view' => Array( - 'sort' => $array_sort_orders_links + Array( + 'name' => 'view', + 'value' => Array( + Array('name' => i18n('sort'), 'value' => $array_sort_orders_links) + ) ), - 'edit' => Array( - 'rot_left' => '#', - 'rot_right' => '#', - 'set_permissions' => $edit_permission_link + Array( + 'name' => 'edit', + 'value' => Array( + Array('name' => i18n('rotate left'), 'value' => '#'), + Array('name' => i18n('rotate right'), 'value' => '#'), + Array('name' => i18n('set permissions'), 'value' => $edit_permission_link) + ) ), - 'metainfo' => Array( - 'edit image information' => $this->link_url.'&id='.$this->id_current.'&view=meta' + Array( + 'name' => 'metainfo', + 'value' => Array( + Array('name' => i18n('edit image information'), 'value' => $this->url_full.'&view=meta') + ) ) ); break; case 'basket_view': $GLOBALS['output']['menu_sub'] = Array( - 'back to normal view' => $this->link_url.'&id='.$this->id_current.'&view=thumb' + 'back to normal view' => $this->url_full.'&view=thumb' ); break; } @@ -314,7 +338,8 @@ if(isset($_GET['use_js'])) { $this->use_javascript = 1; - $this->link_url .= '&use_js=1'; + $this->url_base .= '&use_js=1'; + $this->url_full .= '&use_js=1'; $this->output['page_nr_left'] = ''; $this->output['page_nr_right'] = ''; $this->output['page_nr'] = ''; @@ -437,7 +462,7 @@ } else { - $this->output['page_nr'] .= '<a href="'.$this->link_url.'&id='.$this->id_current.'&pn='.$i.'">'.$i.'</a> '; + $this->output['page_nr'] .= '<a href="'.$this->url_full.'&pn='.$i.'">'.$i.'</a> '; } } @@ -448,8 +473,8 @@ */ if($this->current_page != 1) { - $this->output['page_nr_left'] = '<a href="'.$this->link_url.'&id='.$this->id_current.'&pn=1"><<</a> ' . - '<a href="'.$this->link_url.'&id='.$this->id_current.'&pn='.($this->current_page-1).'"><</a> '; + $this->output['page_nr_left'] = '<a href="'.$this->url_full.'&pn=1"><<</a> ' . + '<a href="'.$this->url_full.'&pn='.($this->current_page-1).'"><</a> '; } else { @@ -461,8 +486,8 @@ */ if($this->current_page != $this->nr_pages && $this->nr_pages != 0) // need check nr_pages != 0 because we don't need links if nr_pages == 0! { - $this->output['page_nr_right'] = '<a href="'.$this->link_url.'&id='.$this->id_current.'&pn='.($this->current_page+1).'">></a> ' . - '<a href="'.$this->link_url.'&id='.$this->id_current.'&pn='.($this->nr_pages).'">>></a> '; + $this->output['page_nr_right'] = '<a href="'.$this->url_full.'&pn='.($this->current_page+1).'">></a> ' . + '<a href="'.$this->url_full.'&pn='.($this->nr_pages).'">>></a> '; } else { @@ -498,22 +523,21 @@ } + function viewHome_view() + { + $GLOBALS['linpha']->template->setModuleName('home'); + + $this->setRandomImages(); + + $this->setBrowseByDate(); + } + /** * thumbdetail_view */ function viewThumbdetail_view() { $GLOBALS['linpha']->template->setModuleName('view_thumbdetail'); - - /** - * set some infos only viewed in top view - */ - if($this->id_current == 0) - { - $this->setRandomImages(); - - $this->setBrowseByDate(); - } } function setBrowseByDate() @@ -721,7 +745,7 @@ $name = $this->photos_filtered[$key]['name']; $str = '<div class="div_'.$class.'thumb">' - . '<a href="'.$this->link_url.'&id='.$id.'">' + . '<a href="'.$this->url_base.'&id='.$id.'">' . '<img class="img_'.$class.'thumb" src="'.LINPHA_DIR.'/get_thumb.php?id='.$id.'" /></a>' . '<br />'.$name.'</div>'."\n"; @@ -741,7 +765,6 @@ function viewImgCommon() { - /** * search current key in array */ Modified: trunk/linpha2/lib/modules/module.albums.php =================================================================== --- trunk/linpha2/lib/modules/module.albums.php 2006-03-20 16:53:55 UTC (rev 4424) +++ trunk/linpha2/lib/modules/module.albums.php 2006-03-20 18:45:06 UTC (rev 4425) @@ -20,22 +20,28 @@ /** * set some infos */ - $linpha->imgview->link_url = LINPHA_DIR.'/?cat=alb'; + $linpha->imgview->url_base = LINPHA_DIR.'/?cat=alb'; + + if(isset($_GET['id'])) { + $linpha->imgview->url_full = LINPHA_DIR.'/?cat=alb&id='.$_GET['id']; + } else { + $linpha->imgview->url_full = LINPHA_DIR.'/?cat=alb'; + } + $linpha->imgview->setCurrentView('albums'); /** * do import */ - if( $linpha->sql->config->value['sys_import_autoimport'] - && ($linpha->imgview->view == 'thumb_view' || $linpha->imgview->view == 'thumbdetail_view')) + if( $linpha->sql->config->value['sys_import_autoimport'] && $linpha->imgview->img_type == 0) { - linImport::updateDir( $linpha->imgview->id_parent, $recursive = false ); + linImport::updateDir( $linpha->imgview->id_current, $recursive = false ); } /** * set navigation line */ - $linpha->imgview->output['navigation'] = set_navigation_line( $linpha->imgview->id_parent ); + $linpha->imgview->output['navigation'] = set_navigation_line( $linpha->imgview->id_current ); /** Added: trunk/linpha2/templates/main_css/home.css =================================================================== --- trunk/linpha2/templates/main_css/home.css (rev 0) +++ trunk/linpha2/templates/main_css/home.css 2006-03-20 18:45:06 UTC (rev 4425) @@ -0,0 +1,62 @@ +h1 { + font-size: 18pt; + font-family: Verdana, Arial, Helvetica, sans-serif; +} + +h2 { + font-size: 14pt; + font-family: Verdana, Arial, Helvetica, sans-serif; + margin-top: 2px; + margin-bottom: 7px; +} + +hr { + clear: both; +} + +.div_random { + height: 200px; +} + +.div_random_img { + float: left; + margin-left: 40px; +} + +.img_random_thumbnail { + border: 0; + + max-width: 130px; + max-height: 130px; +} + +.div_folder { + position: relative; + margin: 2px; + margin-left: 15px; + margin-bottom: 15px; + padding: 5px; + + height: 151px; + width: 700px; + + background-color: #d5fcf4; + border: 1px solid #0c9; +} + +.div_folder_text { + margin-left: 180px; + height: 140px; + padding: 5px; +} + +.img_folder_thumbnail { + position: absolute; + top: 15px; + left: 20px; + + width: 130px; + height: auto; + + border: 0; +} \ No newline at end of file Modified: trunk/linpha2/templates/main_css/view_img.css =================================================================== --- trunk/linpha2/templates/main_css/view_img.css 2006-03-20 16:53:55 UTC (rev 4424) +++ trunk/linpha2/templates/main_css/view_img.css 2006-03-20 18:45:06 UTC (rev 4425) @@ -7,7 +7,27 @@ text-align: center; } +/** + * comment stuff + */ + .add_comment { + color: #036; + width: 600px; + text-align: left; + margin-left: 100px; + } + .add_comment input, .add_comment textarea { + background-color: #d5eeff; + } + + .comments { + border: 1px solid #09f; + width: 200px; + margin: 5px; + margin-left: 150px; + } + /** * navigation stuff */ Modified: trunk/linpha2/templates/main_css/view_thumbdetail.css =================================================================== --- trunk/linpha2/templates/main_css/view_thumbdetail.css 2006-03-20 16:53:55 UTC (rev 4424) +++ trunk/linpha2/templates/main_css/view_thumbdetail.css 2006-03-20 18:45:06 UTC (rev 4425) @@ -1,35 +1,3 @@ -h1 { - font-size: 18pt; - font-family: Verdana, Arial, Helvetica, sans-serif; -} - -h2 { - font-size: 14pt; - font-family: Verdana, Arial, Helvetica, sans-serif; - margin-top: 2px; - margin-bottom: 7px; -} - -hr { - clear: both; -} - -.div_random { - height: 200px; -} - -.div_random_img { - float: left; - margin-left: 40px; -} - -.img_random_thumbnail { - border: 0; - - max-width: 130px; - max-height: 130px; -} - .div_folder { position: relative; margin: 2px; Added: trunk/linpha2/templates/main_html/home.html.php =================================================================== --- trunk/linpha2/templates/main_html/home.html.php (rev 0) +++ trunk/linpha2/templates/main_html/home.html.php 2006-03-20 18:45:06 UTC (rev 4425) @@ -0,0 +1,59 @@ +<div class="left"> +left<br />left<br />left<br />left<br />left<br />left<br /> +left<br />left<br />left<br />left<br />left<br />left<br /> +</div> + +<div id='maindiv' class='main'> + +<h1><?php echo i18n("Welcome"); ?></h1> +<br /><br /><br /> + +<hr /> + +<?php if( count($GLOBALS['linpha']->imgview->output['random_images']) > 0 ) { ?> + <h1><?php echo i18n("Random images"); ?></h1> + <div class='div_random'> + <?php + foreach($GLOBALS['linpha']->imgview->output['random_images'] AS $key=>$value) + { + ?> + <div class='div_random_img'> + <?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">' + . '<img class="img_random_thumbnail" title="'.htmlentities($value['path']).'" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" /></a>'; ?> + </div> + <?php + } + ?> + </div> + + <hr /> +<?php } ?> + +<?php echo i18n("Browse by Date").': '.$GLOBALS['linpha']->imgview->output['browse_by_date']; ?><br /> +<hr /> + +<h1><?php echo i18n("Albums"); ?></h1> + +<?php +foreach($GLOBALS['linpha']->imgview->photos_filtered AS $key=>$value) +{ + ?> + <div class='div_folder'> + <?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">' + . '<img class="img_folder_thumbnail" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" /></a>'; ?> + + <div class='div_folder_text'> + <h2><?php echo $value['name']; ?></h2> + + <?php echo $value['stats_numbers']. i18n("Photos"); ?> + + <br /> + <?php echo strftime("%x %X",$value['time_add']); ?> + + </div> + </div> + <?php +} +?> +</div> + Modified: trunk/linpha2/templates/main_html/view_img.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_img.html.php 2006-03-20 16:53:55 UTC (rev 4424) +++ trunk/linpha2/templates/main_html/view_img.html.php 2006-03-20 18:45:06 UTC (rev 4425) @@ -44,35 +44,18 @@ "'".linSql::linAddslashes($comment)."')"); } ?> -<style> -.add_comment { - color: #036; - width: 600px; - text-align: left; - margin-left: 100px; -} -.add_comment input, .add_comment textarea { - background-color: #d5eeff; -} -.comments { - border: 1px solid #09f; - width: 200px; - margin: 5px; - margin-left: 150px; -} -</style> <div class="add_comment"> <form action="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current; ?>" method="POST"> -<?php i18n("Add Comment"); ?>:<br /> +<?php echo i18n("Add Comment"); ?>:<br /> <div id="comment_div_text"> <input type="text" id="comment_input_text" name="comment_text" value="" size="40" maxlength="40" /> <a href="javascript:open_textarea()">(+)</a> </div> <textarea style="display: none;" id="comment_textarea" name="comment_textarea" rows="10" cols="50"></textarea> -<?php i18n("Name"); ?>: <input type="text" name="author" value="" size="10" maxlength="40" /> +<?php echo i18n("Name"); ?>: <input type="text" name="author" value="" size="10" maxlength="40" /> <input type="hidden" name="cmd" value="add_comment" /> -<input type="submit" name="submit" value="submit" /> +<input type="submit" name="submit" value="<?php echo i18n("submit"); ?>" /> </form> </div> <br /><br /> Modified: trunk/linpha2/templates/main_html/view_thumb.head.php =================================================================== --- trunk/linpha2/templates/main_html/view_thumb.head.php 2006-03-20 16:53:55 UTC (rev 4424) +++ trunk/linpha2/templates/main_html/view_thumb.head.php 2006-03-20 18:45:06 UTC (rev 4425) @@ -3,7 +3,7 @@ var tot_photos = <?php echo $GLOBALS['linpha']->imgview->tot_photos; ?>; var startup_page = 1; var link_get_thumb = '<?php echo LINPHA_DIR.'/get_thumb.php?id='; ?>'; -var link_url = '<?php echo $GLOBALS['linpha']->imgview->link_url; ?>'; +var link_url = '<?php echo $GLOBALS['linpha']->imgview->url_base; ?>'; var tn_size = <?php echo $GLOBALS['def_tn_size']; ?>; var photos_per_page = 'auto'; <?php echo $GLOBALS['linpha']->imgview->output['files_db']."\n"; ?> Modified: trunk/linpha2/templates/main_html/view_thumb.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_thumb.html.php 2006-03-20 16:53:55 UTC (rev 4424) +++ trunk/linpha2/templates/main_html/view_thumb.html.php 2006-03-20 18:45:06 UTC (rev 4425) @@ -48,7 +48,7 @@ ?> <script language="JavaScript" type="text/javascript"> <!-- - location.href = "<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current.'&use_js=1'; ?>"; + location.href = "<?php echo convert_amp($GLOBALS['linpha']->imgview->url_full.'&use_js=1'); ?>"; //--> </script> @@ -62,9 +62,6 @@ <div class="navigation"> <?php echo $GLOBALS['linpha']->imgview->output['navigation']; ?> - <br /><br /> - <?php echo $GLOBALS['linpha']->imgview->output['folders']; ?> - <br /><br /> </div> <div id='maindiv' class='main'> Modified: trunk/linpha2/templates/main_html/view_thumbdetail.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_thumbdetail.html.php 2006-03-20 16:53:55 UTC (rev 4424) +++ trunk/linpha2/templates/main_html/view_thumbdetail.html.php 2006-03-20 18:45:06 UTC (rev 4425) @@ -3,46 +3,13 @@ left<br />left<br />left<br />left<br />left<br />left<br /> </div> -<?php if($GLOBALS['linpha']->imgview->id_current!=0) { ?> <div id='navigation' class="navigation"> <?php echo $GLOBALS['linpha']->imgview->output['navigation']; ?> <br /><br /> </div> -<?php } ?> <div id='maindiv' class='main'> -<?php if($GLOBALS['linpha']->imgview->id_current==0) { /* show welcome only in top view */ ?> - <h1><?php echo i18n("Welcome"); ?></h1> - <br /><br /><br /> - - <hr /> - - <?php if( count($GLOBALS['linpha']->imgview->output['random_images']) > 0 ) { ?> - <h1><?php echo i18n("Random images"); ?></h1> - <div class='div_random'> - <?php - foreach($GLOBALS['linpha']->imgview->output['random_images'] AS $key=>$value) - { - ?> - <div class='div_random_img'> - <?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">' - . '<img class="img_random_thumbnail" title="'.htmlentities($value['path']).'" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" /></a>'; ?> - </div> - <?php - } - ?> - </div> - - <hr /> - <?php } ?> - - <?php echo i18n("Browse by Date").': '.$GLOBALS['linpha']->imgview->output['browse_by_date']; ?><br /> - <hr /> - - <h1><?php echo i18n("Albums"); ?></h1> -<?php } ?> - <?php foreach($GLOBALS['linpha']->imgview->photos_filtered AS $key=>$value) { @@ -64,5 +31,4 @@ <?php } ?> -</div> - +</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. |
From: <fan...@us...> - 2006-03-21 23:14:25
|
Revision: 4426 Author: fangehrn Date: 2006-03-21 15:14:00 -0800 (Tue, 21 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4426&view=rev Log Message: ----------- * finished browse by date feature Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/import.php trunk/linpha2/get_thumb.php trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.template_new.class.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/lib/modules/module.basket.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/templates/main_html/basket.html.php trunk/linpha2/templates/main_html/global.html.php trunk/linpha2/templates/main_html/home.html.php trunk/linpha2/templates/main_html/view_basket.html.php trunk/linpha2/templates/main_html/view_comment.html.php trunk/linpha2/templates/main_html/view_img.html.php trunk/linpha2/templates/main_html/view_meta.html.php trunk/linpha2/templates/main_html/view_thumb.head.php trunk/linpha2/templates/main_html/view_thumb.html.php trunk/linpha2/templates/main_html/view_thumbdetail.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/ChangeLog 2006-03-21 23:14:00 UTC (rev 4426) @@ -1,4 +1,7 @@ -2006-03-15 flo +2006-03-22 flo + * finished browse by date feature + +2006-03-20 flo * testing language stuff, really nice ;-) * small design review, making class img_view even more modular Modified: trunk/linpha2/admin/import.php =================================================================== --- trunk/linpha2/admin/import.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/admin/import.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -25,10 +25,10 @@ linImage::createThumbnail($data['id'],$data['img_type'],$force=false); } - if( isset($output['sys_log']) ) + if( isset($GLOBALS['linpha']->template->output['sys_log']) ) { echo 'Linpha Syslog:<br />'; - echo $output['sys_log']; + echo $GLOBALS['linpha']->template->output['sys_log']; } Modified: trunk/linpha2/get_thumb.php =================================================================== --- trunk/linpha2/get_thumb.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/get_thumb.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -35,9 +35,9 @@ $force = false; } - $output = linImage::createThumbnail($data['id'],$data['img_type'],$force); + $output_file = linImage::createThumbnail($data['id'],$data['img_type'],$force); Header("Content-type: image/jpeg"); - readfile( $output ); + readfile( $output_file ); } catch(Exception $error) { Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/index.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -7,12 +7,16 @@ * some init stuff * @todo where to place? */ + include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); + $linpha = new linpha(); + $linpha->sql->startSession(); + if(!isset($_GET['cat'])) { $_GET['cat'] = 'alb'; } - $output['menu_main'] = Array( + $linpha->template->output['menu_main'] = Array( Array('name' => 'home', 'value' => LINPHA_DIR . '/'), Array('name' => 'admin', 'value' => LINPHA_DIR . '/admin/'), Array('name' => 'search', 'value' => '#'), /*LINPHA_DIR . '/?cat=search'*/ Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -64,7 +64,7 @@ { printMenuEntry('menu_main'); - if(isset($GLOBALS['output']['menu_optional'] ) ) + if(isset($GLOBALS['linpha']->template->output['menu_optional'] ) ) { /** * stuff for browsers with deactivated javascript @@ -97,7 +97,7 @@ ?> <div id="menu_switch"> - <a href="<?php echo $GLOBALS['linpha']->imgview->url_full.'&menu='.$link; + <a href="<?php echo $GLOBALS['linpha']->template->URL_full.'&menu='.$link; ?>"><?php echo $str_href; ?></a> </div> <?php /* @@ -111,7 +111,7 @@ menu_is_open = false; document.getElementById('menu_optional').style.visibility = 'hidden'; - document.getElementById('menu_switch').innerHTML = '<a href="<?php echo $GLOBALS['linpha']->imgview->url_full; + document.getElementById('menu_switch').innerHTML = '<a href="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" onclick="open_close_menu(); return false;">></a>'; } else @@ -119,7 +119,7 @@ menu_is_open = true; document.getElementById('menu_optional').style.visibility = ''; - document.getElementById('menu_switch').innerHTML = '<a href="<?php echo $GLOBALS['linpha']->imgview->url_full; + document.getElementById('menu_switch').innerHTML = '<a href="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" onclick="open_close_menu(); return false;"><</a>'; } } @@ -132,7 +132,7 @@ <?php } - if( isset( $GLOBALS['output']['menu_sub'] ) ) + if( isset( $GLOBALS['linpha']->template->output['menu_sub'] ) ) { printSubMenu(); } @@ -142,7 +142,7 @@ { echo '</div>'; echo '<div">Basket: '; - foreach($GLOBALS['output']['menu_sub'] AS $key=>$value) + foreach($GLOBALS['linpha']->template->output['menu_sub'] AS $key=>$value) { echo '<a href="'.$value.'">'.$key.'</a> '; } @@ -150,7 +150,7 @@ function printMenuEntry($index) { - foreach($GLOBALS['output'][$index] AS $key=>$value) + foreach($GLOBALS['linpha']->template->output[$index] AS $key=>$value) { echo "\n\n".'<ul>'."\n"; if(!is_array($value['value'])) @@ -207,14 +207,11 @@ } } - /** - * append filename if one exists - */ - if($GLOBALS['linpha']->imgview->img_type!=0) - { - $str .= ' <a href="'.$GLOBALS['linpha']->imgview->url_full.'">' - .$GLOBALS['linpha']->imgview->filename.'</a>'; - } + /** + * remove last 3 signs (the comma and the spaces) + */ + $str = substr($str,0,strlen($str)-3); + return $str; } @@ -222,12 +219,12 @@ function linSysLog($str) { - if( ! isset( $GLOBALS['output']['sys_log'] ) ) + if( ! isset( $GLOBALS['linpha']->template->output['sys_log'] ) ) { - $GLOBALS['output']['sys_log'] = ''; + $GLOBALS['linpha']->template->output['sys_log'] = ''; } - $GLOBALS['output']['sys_log'] .= $str; + $GLOBALS['linpha']->template->output['sys_log'] .= $str; } /** Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -20,8 +20,6 @@ class linImgview { public $view; -public $url_base, $url_full; -public $output; public $tot_photos; public $photos; public $photos_filtered; @@ -63,19 +61,21 @@ /** * check for valid id */ + if( isset($current_data) ) { $this->img_type = $current_data['img_type']; $this->filename = $current_data['name']; $this->md5sum = $current_data['md5sum']; $this->id_current = $current_data['id']; - $this->id_parent = $current_data['parent_id']; /** * switch between thumb_view and img_view */ if( $this->img_type == 0) { + $this->id_parent = $current_data['id']; // use current_id as parent_id, because we want to see the content of the actual folder! + if(isset($_SESSION['view'])) { switch($_SESSION['view']) @@ -100,6 +100,8 @@ } else { + $this->id_parent = $current_data['parent_id']; // use parent_id on image view + if(isset($_SESSION['view'])) { switch($_SESSION['view']) @@ -222,7 +224,7 @@ */ foreach($GLOBALS['array_sort_orders'] AS $value) { - $array_sort_orders_links[] = Array('name' => i18n($value), 'value' => $this->url_full.'&order_by='.$value); + $array_sort_orders_links[] = Array('name' => i18n($value), 'value' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); } $open_basket_link = LINPHA_DIR.'?cat=basket&ref_id='.$this->id_current; @@ -243,15 +245,15 @@ } foreach($GLOBALS['array_views'] AS $value) { - $array_views_links[] = Array('name' => i18n($value), 'value' => $this->url_full.'&view='.$value); + $array_views_links[] = Array('name' => i18n($value), 'value' => $GLOBALS['linpha']->template->URL_full.'&view='.$value); } - $GLOBALS['output']['menu_optional'] = Array( + $GLOBALS['linpha']->template->output['menu_optional'] = Array( Array( 'name' => 'basket', 'value' => Array( Array('name' => i18n('add all to basket'), 'value' => $open_basket_link.'&cmd=add_all'), - Array('name' => i18n('switch to basket view'), 'value' => $this->url_full.'&view=basket'), + Array('name' => i18n('switch to basket view'), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), Array('name' => i18n('open basket'), 'value' => $open_basket_link), Array('name' => i18n('in basket').': '.count($_SESSION['basket_ids']), 'value' => '#') ) @@ -274,15 +276,15 @@ Array( 'name' => 'metainfo', 'value' => Array( - Array('name' => i18n('edit album comment'), 'value' => $this->url_full.'&view=comment'), - Array('name' => i18n('edit album information'), 'value' => $this->url_full.'&view=meta') + Array('name' => i18n('edit album comment'), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=comment'), + Array('name' => i18n('edit album information'), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') ) ) ); break; case 'img_view': - $GLOBALS['output']['menu_optional'] = Array( + $GLOBALS['linpha']->template->output['menu_optional'] = Array( Array( 'name' => 'basket', 'value' => Array( @@ -309,14 +311,14 @@ Array( 'name' => 'metainfo', 'value' => Array( - Array('name' => i18n('edit image information'), 'value' => $this->url_full.'&view=meta') + Array('name' => i18n('edit image information'), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') ) ) ); break; case 'basket_view': - $GLOBALS['output']['menu_sub'] = Array( - 'back to normal view' => $this->url_full.'&view=thumb' + $GLOBALS['linpha']->template->output['menu_sub'] = Array( + 'back to normal view' => $GLOBALS['linpha']->template->URL_full.'&view=thumb' ); break; } @@ -338,11 +340,11 @@ if(isset($_GET['use_js'])) { $this->use_javascript = 1; - $this->url_base .= '&use_js=1'; - $this->url_full .= '&use_js=1'; - $this->output['page_nr_left'] = ''; - $this->output['page_nr_right'] = ''; - $this->output['page_nr'] = ''; + $GLOBALS['linpha']->template->URL_base .= '&use_js=1'; + $GLOBALS['linpha']->template->URL_full .= '&use_js=1'; + $GLOBALS['linpha']->template->output['page_nr_left'] = ''; + $GLOBALS['linpha']->template->output['page_nr_right'] = ''; + $GLOBALS['linpha']->template->output['page_nr'] = ''; /** @@ -350,23 +352,23 @@ * this is a normal javascript array * just another kind of definition... */ - $this->output['files_db'] = 'var img_ids = ['."\n"; + $GLOBALS['linpha']->template->output['files_db'] = 'var img_ids = ['."\n"; if($this->tot_photos > 0) // check if not all entries were folders { foreach($this->photos_filtered AS $key=>$value) { if( ( $GLOBALS['show_subfolders_separate'] && $value['img_type'] != 0 ) OR !$GLOBALS['show_subfolders_separate'] ) { - $this->output['files_db'] .= '{ id: "'.$value['id'].'", fn: "'.$value['name'].'" }, '; + $GLOBALS['linpha']->template->output['files_db'] .= '{ id: "'.$value['id'].'", fn: "'.$value['name'].'" }, '; } } /** * remove last 2 signs (the comma and the space) */ - $this->output['files_db'] = substr($this->output['files_db'],0,strlen($this->output['files_db'])-2); + $GLOBALS['linpha']->template->output['files_db'] = substr($GLOBALS['linpha']->template->output['files_db'],0,strlen($GLOBALS['linpha']->template->output['files_db'])-2); } - $this->output['files_db'] .= "\n".'];'; + $GLOBALS['linpha']->template->output['files_db'] .= "\n".'];'; } else { @@ -452,33 +454,33 @@ } } - $this->output['page_nr'] = $left_dots; + $GLOBALS['linpha']->template->output['page_nr'] = $left_dots; for($i=$start_nr; $i <= $this->nr_pages; $i++) { if($i == $this->current_page) { - $this->output['page_nr'] .= $i.' '; + $GLOBALS['linpha']->template->output['page_nr'] .= $i.' '; } else { - $this->output['page_nr'] .= '<a href="'.$this->url_full.'&pn='.$i.'">'.$i.'</a> '; + $GLOBALS['linpha']->template->output['page_nr'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.$i.'">'.$i.'</a> '; } } - $this->output['page_nr'] .= $right_dots; + $GLOBALS['linpha']->template->output['page_nr'] .= $right_dots; /** * write starting ' << ' and ' < ' */ if($this->current_page != 1) { - $this->output['page_nr_left'] = '<a href="'.$this->url_full.'&pn=1"><<</a> ' . - '<a href="'.$this->url_full.'&pn='.($this->current_page-1).'"><</a> '; + $GLOBALS['linpha']->template->output['page_nr_left'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn=1"><<</a> ' . + '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page-1).'"><</a> '; } else { - $this->output['page_nr_left'] = '<< <'; + $GLOBALS['linpha']->template->output['page_nr_left'] = '<< <'; } /** @@ -486,12 +488,12 @@ */ if($this->current_page != $this->nr_pages && $this->nr_pages != 0) // need check nr_pages != 0 because we don't need links if nr_pages == 0! { - $this->output['page_nr_right'] = '<a href="'.$this->url_full.'&pn='.($this->current_page+1).'">></a> ' . - '<a href="'.$this->url_full.'&pn='.($this->nr_pages).'">>></a> '; + $GLOBALS['linpha']->template->output['page_nr_right'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page+1).'">></a> ' . + '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->nr_pages).'">>></a> '; } else { - $this->output['page_nr_right'] = '> >>'; + $GLOBALS['linpha']->template->output['page_nr_right'] = '> >>'; } } @@ -517,7 +519,7 @@ if(! empty($output_folders)) { - $this->output['navigation'] .= '<br /><br />'.$output_folders; + $GLOBALS['linpha']->template->output['navigation'] .= '<br /><br />'.$output_folders; } $this->tot_photos = count($this->photos_filtered) - $nr_folders; } @@ -554,13 +556,13 @@ /** * get years between */ - $this->output['browse_by_date'] = ''; + $GLOBALS['linpha']->template->output['browse_by_date'] = ''; 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) { - $this->output['browse_by_date'] .= '<a href="'.LINPHA_DIR.'/?cat=browse&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; + $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_DIR.'/?cat=browse&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; } } } @@ -578,12 +580,12 @@ break; } - $this->output['random_images'] = Array(); + $GLOBALS['linpha']->template->output['random_images'] = Array(); $query = $GLOBALS['linpha']->db->SelectLimit("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 ORDER by ".$str_random,$GLOBALS['nr_random_images']); while($data = $query->FetchRow()) { $path = implode('/',linSql::getFullFilenameFromId($data['id'])); - $this->output['random_images'][] = Array('id'=>$data['id'],'path'=>$path); + $GLOBALS['linpha']->template->output['random_images'][] = Array('id'=>$data['id'],'path'=>$path); } } @@ -730,7 +732,7 @@ if($value != '') { - $this->output['image_infos'][$data['name']] = Array('name' => $name, 'value' => $value); + $GLOBALS['linpha']->template->output['image_infos'][$data['name']] = Array('name' => $name, 'value' => $value); } } @@ -745,7 +747,7 @@ $name = $this->photos_filtered[$key]['name']; $str = '<div class="div_'.$class.'thumb">' - . '<a href="'.$this->url_base.'&id='.$id.'">' + . '<a href="'.$GLOBALS['linpha']->template->URL_base.'&id='.$id.'">' . '<img class="img_'.$class.'thumb" src="'.LINPHA_DIR.'/get_thumb.php?id='.$id.'" /></a>' . '<br />'.$name.'</div>'."\n"; @@ -778,26 +780,34 @@ } /** + * ooh, something went wrong + */ + if(!isset($this->current_key)) + { + $this->current_key = 0; + } + + /** * set prev thumbs */ - $this->output['prev_thumb'] = ''; + $GLOBALS['linpha']->template->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' ); + $GLOBALS['linpha']->template->output['prev_thumb'] .= $this->viewImg_viewThumbHtml( $this->current_key - $i , 'prevnext' ); } } /** * set next thumbs */ - $this->output['next_thumb'] = ''; + $GLOBALS['linpha']->template->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'); + $GLOBALS['linpha']->template->output['next_thumb'] .= $this->viewImg_viewThumbHtml($this->current_key + ($i+1) ,'prevnext'); } } @@ -805,11 +815,11 @@ /** * set current thumb and image */ - $this->output['image'] = '<img class="mainimage" src="'.LINPHA_DIR.'/get_thumb.php?id=' + $GLOBALS['linpha']->template->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' ); + $GLOBALS['linpha']->template->output['current_thumb'] = $this->viewImg_viewThumbHtml( $this->current_key , 'current' ); } } // end class linImgview Modified: trunk/linpha2/lib/classes/linpha.template_new.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template_new.class.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/lib/classes/linpha.template_new.class.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -3,6 +3,8 @@ class linTemplate { public $template_name; + public $output; + public $URL_base, $URL_full; private $body_name; private $head_name; Modified: trunk/linpha2/lib/modules/module.albums.php =================================================================== --- trunk/linpha2/lib/modules/module.albums.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/lib/modules/module.albums.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -10,22 +10,18 @@ /** * init */ - include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); - $linpha = new linpha(); - $linpha->sql->startSession(); - include_once(LINPHA_DIR . '/lib/classes/linpha.imgview.class.php'); $linpha->imgview = new linImgview(); /** * set some infos */ - $linpha->imgview->url_base = LINPHA_DIR.'/?cat=alb'; + $linpha->template->URL_base = LINPHA_DIR.'/?cat=alb'; if(isset($_GET['id'])) { - $linpha->imgview->url_full = LINPHA_DIR.'/?cat=alb&id='.$_GET['id']; + $linpha->template->URL_full = LINPHA_DIR.'/?cat=alb&id='.$_GET['id']; } else { - $linpha->imgview->url_full = LINPHA_DIR.'/?cat=alb'; + $linpha->template->URL_full = LINPHA_DIR.'/?cat=alb'; } $linpha->imgview->setCurrentView('albums'); @@ -41,7 +37,7 @@ /** * set navigation line */ - $linpha->imgview->output['navigation'] = set_navigation_line( $linpha->imgview->id_current ); + $GLOBALS['linpha']->template->output['navigation'] = set_navigation_line( $linpha->imgview->id_current ); /** @@ -58,6 +54,5 @@ $linpha->imgview->photos = array_merge($array_folders,$array_files); - $linpha->imgview->buildImgView(); ?> \ No newline at end of file Modified: trunk/linpha2/lib/modules/module.basket.php =================================================================== --- trunk/linpha2/lib/modules/module.basket.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/lib/modules/module.basket.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -2,13 +2,6 @@ if(!defined('LINPHA_DIR')) { exit(1); } /** - * init - */ - include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); - $linpha = new linpha(); - $linpha->sql->startSession(); - -/** * parse POST data and GET commands */ /** @@ -96,6 +89,6 @@ $linpha->template->setModuleName('basket'); -$linpha->template->UrlFull = LINPHA_DIR.'/?cat=basket&ref_id='.$_GET['ref_id']; +$linpha->template->URL_full = LINPHA_DIR.'/?cat=basket&ref_id='.$_GET['ref_id']; include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'_html/global.html.php'); ?> \ No newline at end of file Modified: trunk/linpha2/lib/modules/module.browse.php =================================================================== --- trunk/linpha2/lib/modules/module.browse.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/lib/modules/module.browse.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -10,97 +10,207 @@ /** * init */ - include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); - $linpha = new linpha(); - $linpha->sql->startSession(); - include_once(LINPHA_DIR . '/lib/classes/linpha.imgview.class.php'); $linpha->imgview = new linImgview(); /** * set some infos */ + $linpha->imgview->setCurrentView('browse'); + $url_base = LINPHA_DIR.'/?cat=browse'; $url_append = ''; - if(isset($_GET['year'])) { - $url_append = '&year='.$_GET['year']; + $url_append = '&year='.$_GET['year']; if(isset($_GET['month'])) { - $url_append .= '&month='.$_GET['month']; + $url_append .= '&month='.$_GET['month']; if(isset($_GET['day'])) { - $url_append = '&day='.$_GET['day']; + $url_append .= '&day='.$_GET['day']; } } } + $linpha->template->URL_base = $url_base.$url_append; - $linpha->imgview->link_url = $url_base.$url_append; - - - $linpha->imgview->setCurrentView('browse'); + if(isset($_GET['id'])) + { + $url_append .= '&id='.$_GET['id']; + } + $linpha->template->URL_full = $url_base.$url_append; /** - * set navigation line + * set date and navigation line */ - $linpha->imgview->output['navigation'] = '<a href="'.$url_base.'">all</a> > '; - - if(isset($_GET['year'])) - { - $linpha->imgview->output['navigation'] .= '<a href="'.$url_base.'&year='.$_GET['year'].'">'.$_GET['year'].'</a> > '; - } + $search_string = ''; + $str_navigation = '<a href="'.$url_base.'">all</a> > '; + $str_datelinks = i18n("Years").': '; - if(isset($_GET['month'])) - { - $linpha->imgview->output['navigation'] .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$_GET['month'].'">'.$_GET['month'].'</a> > '; - } - - if(isset($_GET['day'])) - { - $linpha->imgview->output['navigation'] .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$_GET['month'].'&day='.$_GET['day'].'">'.$_GET['day'].'</a> > '; - } - - if($linpha->imgview->id_current != 0) - { - $linpha->imgview->output['navigation'] .= '<a href="'.$linpha->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current.'">' - .$GLOBALS['linpha']->imgview->filename.'</a>'; - } - /** - * set date links + * year */ $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal), max(datetimeoriginal) " . "FROM ".PREFIX."meta_exif"); - - /** - * get min and max year - */ + $min_year = substr($data[0],0,4); $max_year = substr($data[1],0,4); + $sum = 0; + /** * get years between */ - $linpha->imgview->output['navigation'] .= '<br /><br />'; 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) { - $linpha->imgview->output['navigation'] .= '<a href="'.$url_base.'&year='.$i.'">'.$i.'</a> ('.$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]; } } + + /** + * calc not indexed images + */ + $data = $GLOBALS['linpha']->db->GetRow("SELECT sum( stats_numbers ) FROM ".PREFIX."photos WHERE parent_id = '0' GROUP BY parent_id"); + $str_datelinks .= '<a href="'.$url_base.'&year=0">'.i18n("not indexed").'</a> ('.($data[0]-$sum).')'; + if(isset($_GET['year']) && $_GET['year'] != 0) + { + $str_navigation .= '<a href="'.$url_base.'&year='.$_GET['year'].'">'.$_GET['year'].'</a> > '; + $search_string = $_GET['year']; + + /** + * show month links + */ + $str_datelinks .= '<br />'.i18n("Months").': '; + for($i=1; $i <= 12; $i++) + { + if(strlen($i)==1) + { + $i = "0".$i; + } + + $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) FROM ".PREFIX."meta_exif " . + "WHERE datetimeoriginal LIKE '".linSql::linAddslashes($search_string).":".$i."%'"); + if($data[0]>0) + { + if(isset($_GET['month']) && $i == $_GET['month']) + { + $str_datelinks .= $i.' ('.$data[0].'), '; + } + else + { + $str_datelinks .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$i.'">'.$i.'</a> ('.$data[0].'), '; + } + } + } + } + /** + * month + */ + if(isset($_GET['month'])) + { + $str_navigation .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$_GET['month'].'">'.$_GET['month'].'</a> > '; + $search_string = $_GET['year'].':'.$_GET['month']; + + /** + * show day links + */ + $str_datelinks .= '<br />'.i18n("Days").': '; + for($i=1; $i <= 31; $i++) + { + if(strlen($i)==1) + { + $i = "0".$i; + } + + $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) FROM ".PREFIX."meta_exif " . + "WHERE datetimeoriginal LIKE '".linSql::linAddslashes($search_string).":".$i."%'"); + if($data[0]>0) + { + if(isset($_GET['day']) && $i == $_GET['day']) + { + $str_datelinks .= $i.' ('.$data[0].'), '; + } + else + { + $str_datelinks .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$_GET['month'].'&day='.$i.'">'.$i.'</a> ('.$data[0].'), '; + } + } + } + } + +/** + * day + */ + if(isset($_GET['day'])) + { + $str_navigation .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$_GET['month'].'&day='.$_GET['day'].'">'.$_GET['day'].'</a> > '; + $search_string = $_GET['year'].':'.$_GET['month'].':'.$_GET['day']; + } + +/** + * not indexed + * must be before filename + */ + if(isset($_GET['year']) && $_GET['year']==0) + { + $str_navigation .= '<a href="'.$url_base.'&year=0">'.i18n("not indexed").'</a> > '; + } + +/** + * filename + */ + if($linpha->imgview->id_current != 0) + { + $str_navigation .= '<a href="'.$linpha->template->URL_base.'&id='.$GLOBALS['linpha']->imgview->id_current.'">' + .$GLOBALS['linpha']->imgview->filename.'</a>'; + } + +/** + * write navigation and date links + */ + $GLOBALS['linpha']->template->output['navigation'] = $str_navigation.'<br /><br />'.$str_datelinks; + + +/** * get photos */ - $linpha->imgview->photos = $GLOBALS['linpha']->db->GetAssoc("SELECT id, name, img_type, stats_numbers, time_add FROM ".PREFIX."photos " . - "WHERE img_type <> '0' ORDER by ".$order_by); + /** + * not indexed + */ + if(isset($_GET['year']) && $_GET['year']==0) + { + $linpha->imgview->photos = $GLOBALS['linpha']->db->GetAssoc("SELECT id, name, img_type, stats_numbers, time_add " . + "FROM ".PREFIX."photos AS p LEFT OUTER JOIN ".PREFIX."meta_exif AS e ON p.md5sum = e.md5sum " . + "WHERE e.datetimeoriginal is NULL AND img_type <> '0' " . + "ORDER by ".$order_by); + } + else + { + $linpha->imgview->photos = $GLOBALS['linpha']->db->GetAssoc("SELECT id, name, img_type, stats_numbers, time_add " . + "FROM ".PREFIX."photos AS p, ".PREFIX."meta_exif AS e " . + "WHERE p.md5sum = e.md5sum " . + "AND img_type <> '0' " . + "AND e.datetimeoriginal LIKE '".$search_string."%' " . + "ORDER by ".$order_by); + } $linpha->imgview->buildImgView(); Modified: trunk/linpha2/templates/main_html/basket.html.php =================================================================== --- trunk/linpha2/templates/main_html/basket.html.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/templates/main_html/basket.html.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -1,11 +1,11 @@ -<form name="basket" action="<?php echo $GLOBALS['linpha']->template->UrlFull; ?>&cmd=remove_selected" method="POST"> +<form name="basket" action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>&cmd=remove_selected" method="POST"> <div class='navigation'> -<a href="<?php echo LINPHA_DIR.'/?cat=alb&id='.$_GET['ref_id']; ?>"><?php i18n("Go Back"); ?></a> -<a href="<?php echo $GLOBALS['linpha']->template->UrlFull; ?>&cmd=remove_all"><?php i18n("Remove All"); ?></a> -<input type="submit" name="submit" value="remove selected" /> +<a href="<?php echo LINPHA_DIR.'/?cat=alb&id='.$_GET['ref_id']; ?>"><?php echo i18n("Go Back"); ?></a> +<a href="<?php echo $GLOBALS['linpha']->template->URL_full; ?>&cmd=remove_all"><?php echo i18n("Remove all"); ?></a> +<input type="submit" name="submit" value="<?php echo i18n("Remove selected"); ?>" /> <br /><br /> -<?php i18n("Images In Basket");?>:<?php echo count($_SESSION['basket_ids']); ?> +<?php echo i18n("Images in basket");?>: <?php echo count($_SESSION['basket_ids']); ?> </div> <div id='maindiv' class='main'> @@ -90,7 +90,7 @@ <?php } else { - i18n("Empty Basket"); + echo i18n("Empty Basket"); } ?> </div> Modified: trunk/linpha2/templates/main_html/global.html.php =================================================================== --- trunk/linpha2/templates/main_html/global.html.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/templates/main_html/global.html.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -1,7 +1,7 @@ <html> <head> <link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'_css/global.css'; ?>' type='text/css'> -<?php if( isset($GLOBALS['output']['sys_log'])) { ?> +<?php if( isset($GLOBALS['linpha']->template->output['sys_log'])) { ?> <style> .sys_log { position: absolute; @@ -34,12 +34,12 @@ </head> <body> -<?php if( isset($GLOBALS['output']['sys_log']) ) { ?> +<?php if( isset($GLOBALS['linpha']->template->output['sys_log']) ) { ?> <div id="sys_log" class="sys_log"> <div class="sys_log_close"><a href="javascript:toggleWindow()">X</a></div> <div id="sys_log_text" class="sys_log_text"> Linpha Syslog:<br /> - <?php echo $GLOBALS['output']['sys_log']; ?> + <?php echo $GLOBALS['linpha']->template->output['sys_log']; ?> </div> </div> <script language="JavaScript" type="text/javascript"> Modified: trunk/linpha2/templates/main_html/home.html.php =================================================================== --- trunk/linpha2/templates/main_html/home.html.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/templates/main_html/home.html.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -10,11 +10,11 @@ <hr /> -<?php if( count($GLOBALS['linpha']->imgview->output['random_images']) > 0 ) { ?> +<?php if( count($GLOBALS['linpha']->template->output['random_images']) > 0 ) { ?> <h1><?php echo i18n("Random images"); ?></h1> <div class='div_random'> <?php - foreach($GLOBALS['linpha']->imgview->output['random_images'] AS $key=>$value) + foreach($GLOBALS['linpha']->template->output['random_images'] AS $key=>$value) { ?> <div class='div_random_img'> @@ -29,7 +29,7 @@ <hr /> <?php } ?> -<?php echo i18n("Browse by Date").': '.$GLOBALS['linpha']->imgview->output['browse_by_date']; ?><br /> +<?php echo i18n("Browse by Date").': '.$GLOBALS['linpha']->template->output['browse_by_date']; ?><br /> <hr /> <h1><?php echo i18n("Albums"); ?></h1> Modified: trunk/linpha2/templates/main_html/view_basket.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_basket.html.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/templates/main_html/view_basket.html.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -7,13 +7,13 @@ <div class="page_nr_main"> <!-- cannot use floated div in another div !! in this div it is possible because it has position: absolute --> - <div class='page_nr' id='page_nr_right'><?php echo $GLOBALS['linpha']->imgview->output['page_nr_right']; ?></div> - <div class='page_nr' id='page_nr' style="width: 350px; text-align: center;"><?php echo $GLOBALS['linpha']->imgview->output['page_nr']; ?></div> - <div class='page_nr' id='page_nr_left'><?php echo $GLOBALS['linpha']->imgview->output['page_nr_left']; ?></div> + <div class='page_nr' id='page_nr_right'><?php echo $GLOBALS['linpha']->template->output['page_nr_right']; ?></div> + <div class='page_nr' id='page_nr' style="width: 350px; text-align: center;"><?php echo $GLOBALS['linpha']->template->output['page_nr']; ?></div> + <div class='page_nr' id='page_nr_left'><?php echo $GLOBALS['linpha']->template->output['page_nr_left']; ?></div> </div> <div class="navigation"> - <?php echo $GLOBALS['linpha']->imgview->output['navigation']; ?> + <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> <br /><br /> Images in basket: <?php echo count($_SESSION['basket_ids']); ?> (<a href="<?php echo LINPHA_DIR.'?cat=basket&ref_id='.$GLOBALS['linpha']->imgview->id_current; ?>">open basket</a>) Modified: trunk/linpha2/templates/main_html/view_comment.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_comment.html.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/templates/main_html/view_comment.html.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -28,11 +28,11 @@ ?> <div id='maindiv' class='main'> -<form action="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current; ?>" method="POST"> +<form action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" method="POST"> <?php $data = $GLOBALS['linpha']->db->GetRow("SELECT id, time, author, comment FROM ".PREFIX."meta_comments"); ?> -<a href="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current.'&view=thumb'; ?>">back</a> +<a href="<?php echo $GLOBALS['linpha']->template->URL_full.'&view=thumb'; ?>">back</a> <br /><br /> Author: Modified: trunk/linpha2/templates/main_html/view_img.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_img.html.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/templates/main_html/view_img.html.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -1,6 +1,6 @@ <div class="left"> <?php - foreach($GLOBALS['linpha']->imgview->output['image_infos'] AS $value) + foreach($GLOBALS['linpha']->template->output['image_infos'] AS $value) { echo $value['name'].': '.$value['value'].'<br />'; } @@ -9,22 +9,22 @@ <div class="navigation"> - <?php echo $GLOBALS['linpha']->imgview->output['navigation']; ?> + <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> <br /><br /> </div> <div class="div_all_main"> <div class="div_all_prevthumb"> - <?php echo $GLOBALS['linpha']->imgview->output['prev_thumb']; ?> + <?php echo $GLOBALS['linpha']->template->output['prev_thumb']; ?> </div> - <?php echo $GLOBALS['linpha']->imgview->output['current_thumb']; ?> + <?php echo $GLOBALS['linpha']->template->output['current_thumb']; ?> <div class="div_all_nextthumb"> - <?php echo $GLOBALS['linpha']->imgview->output['next_thumb']; ?> + <?php echo $GLOBALS['linpha']->template->output['next_thumb']; ?> </div> </div> <div id='maindiv' class='main'> -<?php echo $GLOBALS['linpha']->imgview->output['image']; ?> +<?php echo $GLOBALS['linpha']->template->output['image']; ?> <br /><br /> <?php @@ -46,7 +46,7 @@ ?> <div class="add_comment"> -<form action="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current; ?>" method="POST"> +<form action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" method="POST"> <?php echo i18n("Add Comment"); ?>:<br /> <div id="comment_div_text"> <input type="text" id="comment_input_text" name="comment_text" value="" size="40" maxlength="40" /> Modified: trunk/linpha2/templates/main_html/view_meta.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_meta.html.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/templates/main_html/view_meta.html.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -50,35 +50,35 @@ </style> <div class="navigation"> - <?php echo $GLOBALS['linpha']->imgview->output['navigation']; ?> + <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> <br /><br /> </div> <div class="div_all_main"> <div class="div_all_prevthumb"> - <?php echo $GLOBALS['linpha']->imgview->output['prev_thumb']; ?> + <?php echo $GLOBALS['linpha']->template->output['prev_thumb']; ?> </div> - <?php echo $GLOBALS['linpha']->imgview->output['current_thumb']; ?> + <?php echo $GLOBALS['linpha']->template->output['current_thumb']; ?> <div class="div_all_nextthumb"> - <?php echo $GLOBALS['linpha']->imgview->output['next_thumb']; ?> + <?php echo $GLOBALS['linpha']->template->output['next_thumb']; ?> </div> </div> <div id='maindiv' class='main'> -<a href="<?php echo $GLOBALS['linpha']->imgview->link_url.'&id='.$GLOBALS['linpha']->imgview->id_current.'&view=img'; ?>">Back to normal view</a> +<a href="<?php echo $GLOBALS['linpha']->template->URL_full.'&view=img'; ?>">Back to normal view</a> <h1><?php i18n("Edit Image Imformation"); ?></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"> +<form action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" method="POST"> <table border='1'> <tr> <td width="150"><b><?php i18n("Name"); ?></b></td> <td width="200"><b><?php i18n("Value"); ?></b></td> - <td rowspan="<?php echo $num+1; ?>"><?php echo $GLOBALS['linpha']->imgview->output['image']; ?></td> + <td rowspan="<?php echo $num+1; ?>"><?php echo $GLOBALS['linpha']->template->output['image']; ?></td> </tr> <?php while($data = $query->FetchRow()) Modified: trunk/linpha2/templates/main_html/view_thumb.head.php =================================================================== --- trunk/linpha2/templates/main_html/view_thumb.head.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/templates/main_html/view_thumb.head.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -3,10 +3,10 @@ var tot_photos = <?php echo $GLOBALS['linpha']->imgview->tot_photos; ?>; var startup_page = 1; var link_get_thumb = '<?php echo LINPHA_DIR.'/get_thumb.php?id='; ?>'; -var link_url = '<?php echo $GLOBALS['linpha']->imgview->url_base; ?>'; +var link_url = '<?php echo convert_amp($GLOBALS['linpha']->template->URL_base); ?>'; var tn_size = <?php echo $GLOBALS['def_tn_size']; ?>; var photos_per_page = 'auto'; -<?php echo $GLOBALS['linpha']->imgview->output['files_db']."\n"; ?> +<?php echo $GLOBALS['linpha']->template->output['files_db']."\n"; ?> </script> <script type="text/javascript" language="javascript" src="<?php echo LINPHA_DIR; ?>/lib/classes/thumbnails.js"> </script> <?php } ?> \ No newline at end of file Modified: trunk/linpha2/templates/main_html/view_thumb.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_thumb.html.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/templates/main_html/view_thumb.html.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -28,7 +28,7 @@ </div> <div id='navigation' class="navigation"> - <?php echo $GLOBALS['linpha']->imgview->output['navigation']; ?> + <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> </div> <div id='maindiv' class='main'> @@ -48,20 +48,20 @@ ?> <script language="JavaScript" type="text/javascript"> <!-- - location.href = "<?php echo convert_amp($GLOBALS['linpha']->imgview->url_full.'&use_js=1'); ?>"; + location.href = "<?php echo convert_amp($GLOBALS['linpha']->template->URL_full.'&use_js=1'); ?>"; //--> </script> <div class="page_nr_main"> <!-- cannot use floated div in another div !! in this div it is possible because it has position: absolute --> - <div class='page_nr' id='page_nr_right'><?php echo $GLOBALS['linpha']->imgview->output['page_nr_right']; ?></div> - <div class='page_nr' id='page_nr' style="width: 350px; text-align: center;"><?php echo $GLOBALS['linpha']->imgview->output['page_nr']; ?></div> - <div class='page_nr' id='page_nr_left'><?php echo $GLOBALS['linpha']->imgview->output['page_nr_left']; ?></div> + <div class='page_nr' id='page_nr_right'><?php echo $GLOBALS['linpha']->template->output['page_nr_right']; ?></div> + <div class='page_nr' id='page_nr' style="width: 350px; text-align: center;"><?php echo $GLOBALS['linpha']->template->output['page_nr']; ?></div> + <div class='page_nr' id='page_nr_left'><?php echo $GLOBALS['linpha']->template->output['page_nr_left']; ?></div> </div> <div class="navigation"> - <?php echo $GLOBALS['linpha']->imgview->output['navigation']; ?> + <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> </div> <div id='maindiv' class='main'> Modified: trunk/linpha2/templates/main_html/view_thumbdetail.html.php =================================================================== --- trunk/linpha2/templates/main_html/view_thumbdetail.html.php 2006-03-20 18:45:06 UTC (rev 4425) +++ trunk/linpha2/templates/main_html/view_thumbdetail.html.php 2006-03-21 23:14:00 UTC (rev 4426) @@ -4,7 +4,7 @@ </div> <div id='navigation' class="navigation"> - <?php echo $GLOBALS['linpha']->imgview->output['navigation']; ?> + <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> <br /><br /> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-22 19:10:33
|
Revision: 4427 Author: fangehrn Date: 2006-03-22 11:10:20 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4427&view=rev Log Message: ----------- * checked if bug with fatal error on not readable also exists in linpha2 -> does not * added "lost+found" to ignore filelist * documented import methods Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.import.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-21 23:14:00 UTC (rev 4426) +++ trunk/linpha2/ChangeLog 2006-03-22 19:10:20 UTC (rev 4427) @@ -1,4 +1,10 @@ 2006-03-22 flo + * checked if bug with fatal error on not readable also exists in linpha2 + -> does not + * added "lost+found" to ignore filelist + * documented import methods + +2006-03-21 flo * finished browse by date feature 2006-03-20 flo Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-03-21 23:14:00 UTC (rev 4426) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-03-22 19:10:20 UTC (rev 4427) @@ -20,6 +20,11 @@ class linImport { +/** + * update selected directory + * add new dirs/files, delete old ones + * if recursive, all sub directories are checked too! + */ function updateDir($parent_id, $recursive) { /** @@ -82,7 +87,6 @@ */ foreach($array_new AS $value) { - /** * no output as it would occur on each view! */ @@ -146,52 +150,9 @@ } } -function addNew( $parent_id , $dirname , $recursive) -{ - $d = dir( $dirname ); - - while( false !== ($entry = $d->read() ) ) - { - $ext = linFilesys::getFileExtFromPath($entry); - if($entry == '.' OR $entry == '..') - { - //no output - } - elseif($entry{0} == '.') - { - linSysLog('hidden'); - } - elseif( in_array( $entry, linImport::getIgnoreFilelist() ) ) - { - linSysLog('ignore'); - } - elseif( in_array($ext, linImport::getIgnoreFileext() ) ) - { - linSysLog('ignore'); - } - elseif( !is_readable( $dirname.$entry) ) - { - linSysLog('not readable'); - } - /** - * no need for is_link as links are detected correctly with is_file, is_dir and is_readable ! - * elseif( is_link ($name.'/'.$entry ) ) - { - echo 'link'; - }*/ - elseif( is_file( $dirname.$entry ) ) - { - linImport::addNewFile( $parent_id, $dirname , $entry ); - } - elseif( is_dir( $dirname.$entry ) ) - { - linImport::addNewDir( $parent_id , $dirname , $entry , $recursive); - } - } - $d->close(); - -} // end function addNew - +/** + * import new file, calc md5sum, delete thumbnail if one already exists with the same id, update number of photo of parent folder + */ function addNewFile( $parent_id , $dirname , $filename ) { linSysLog('new file '.$dirname.$filename.'<br />'); @@ -242,6 +203,9 @@ } } +/** + * import new directory + */ function addNewDir( $parent_id , $dirname , $filename , $recursive) { linSysLog('new dir '.$dirname .$filename.'<br />'); @@ -258,11 +222,62 @@ if($recursive) { - linImport::addNew( $inserted_id , $dirname.$filename.'/' , $recursive); + linImport::addNewSubEntry( $inserted_id , $dirname.$filename.'/' , $recursive); } } /** + * add new subdir/subfile + * only called from addNewDir() + */ +function addNewSubEntry( $parent_id , $dirname , $recursive) +{ + $d = dir( $dirname ); + + while( false !== ($entry = $d->read() ) ) + { + $ext = linFilesys::getFileExtFromPath($entry); + if($entry == '.' OR $entry == '..') + { + //no output + } + elseif($entry{0} == '.') + { + linSysLog('hidden'); + } + elseif( in_array( $entry, linImport::getIgnoreFilelist() ) ) + { + linSysLog('ignore'); + } + elseif( in_array($ext, linImport::getIgnoreFileext() ) ) + { + linSysLog('ignore'); + } + elseif( !is_readable( $dirname.$entry) ) + { + linSysLog('not readable'); + } + /** + * no need for is_link as links are detected correctly with is_file, is_dir and is_readable ! + * elseif( is_link ($name.'/'.$entry ) ) + { + echo 'link'; + }*/ + elseif( is_file( $dirname.$entry ) ) + { + linImport::addNewFile( $parent_id, $dirname , $entry ); + } + elseif( is_dir( $dirname.$entry ) ) + { + linImport::addNewDir( $parent_id , $dirname , $entry , $recursive); + } + } + $d->close(); + +} // end function addNew + + +/** * recursive delete entry * * @todo delete other stuff too! (permissions, exif? iptc? comments?) @@ -348,7 +363,7 @@ */ function getIgnoreFilelist() { - return Array('CVS','Thumbs.db','ZbThumbnail.info'); + return Array('CVS','Thumbs.db','ZbThumbnail.info','lost+found'); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-22 21:33:47
|
Revision: 4430 Author: fangehrn Date: 2006-03-22 13:33:26 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4430&view=rev Log Message: ----------- updated templates Modified Paths: -------------- trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.template_new.class.php trunk/linpha2/lib/classes/thumbnails.js trunk/linpha2/lib/modules/module.basket.php trunk/linpha2/templates/css/default/basket.css trunk/linpha2/templates/css/default/home.css trunk/linpha2/templates/css/default/view_thumb.css trunk/linpha2/templates/html/default/basket.html.php trunk/linpha2/templates/html/default/global.html.php trunk/linpha2/templates/html/default/home.html.php trunk/linpha2/templates/html/default/view_comment.html.php trunk/linpha2/templates/html/default/view_thumb.html.php Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-03-22 19:18:37 UTC (rev 4429) +++ trunk/linpha2/index.php 2006-03-22 21:33:26 UTC (rev 4430) @@ -5,7 +5,6 @@ /** * some init stuff - * @todo where to place? */ include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); $linpha = new linpha(); @@ -16,14 +15,6 @@ $_GET['cat'] = 'alb'; } - $linpha->template->output['menu_main'] = Array( - Array('name' => 'home', 'value' => LINPHA_DIR . '/'), - Array('name' => 'admin', 'value' => LINPHA_DIR . '/admin/'), - Array('name' => 'search', 'value' => '#'), /*LINPHA_DIR . '/?cat=search'*/ - Array('name' => 'login', 'value' => '#') /*LINPHA_DIR . '/?cat=login'*/ - ); - - /** * open modules */ Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-03-22 19:18:37 UTC (rev 4429) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-03-22 21:33:26 UTC (rev 4430) @@ -44,6 +44,7 @@ if(false == in_array($text."\n", $filedata)) { $filedata[] = $text."\n"; + natcasesort($filedata); // Sort an array using a case insensitive "natural order" algorithm file_put_contents($tmpfile, $filedata); } } @@ -94,13 +95,13 @@ $link = 'open'; $str_href = '>'; } + ?> - ?> - <div id="menu_switch"> - <a href="<?php echo $GLOBALS['linpha']->template->URL_full.'&menu='.$link; - ?>"><?php echo $str_href; ?></a> - </div> - <?php /* +<div id="menu_switch"> +<a href="<?php echo $GLOBALS['linpha']->template->URL_full.'&menu='.$link; + ?>"><?php echo $str_href; ?></a> +</div> +<?php /* onclick="open_close_menu(); return false;" <script language="JavaScript" type="text/javascript"> var menu_is_open = false; @@ -126,10 +127,12 @@ </script> */ ?> - <div id="menu_optional" style="<?php echo $style; ?>"> - <?php printMenuEntry('menu_optional'); ?> - </div> - <?php +<div id="menu_optional" style="<?php echo $style; ?>"> +<?php printMenuEntry('menu_optional'); ?> + +</div> +<?php + } if( isset( $GLOBALS['linpha']->template->output['menu_sub'] ) ) @@ -152,7 +155,7 @@ { foreach($GLOBALS['linpha']->template->output[$index] AS $key=>$value) { - echo "\n\n".'<ul>'."\n"; + echo "\n".'<ul>'."\n"; if(!is_array($value['value'])) { echo "\t".'<li><a href="'.$value['value'].'">'.$value['name'].'</a></li>'."\n"; @@ -165,26 +168,52 @@ foreach($value['value'] AS $sub_value) { - if(!is_array($sub_value['value'])) + /** + * search special + */ + if($sub_value['name'] == 'special_search') { - echo "\t\t".'<li><a href="'.$sub_value['value'].'">'.$sub_value['name'].'</a></li>'."\n"; +?> + <li><span> + <input type="text" name="search" value="" /> + <input type="submit" name="submit" value="<?php echo i18n("search"); ?>" /> + </span></li> +<?php } + /** + * login special + */ + elseif($sub_value['name'] == 'special_login') + { +?> + <li><span> + <?php echo i18n("Username"); ?>: <input type="text" name="username" value="" /><br /> + <?php echo i18n("Password"); ?>: <input type="password" name="password" value="" /><br /> + <input type="submit" name="submit" value="<?php echo i18n("login"); ?>" /> + </span></li> +<?php + } else { - echo "\t\t".'<li><span>'.$sub_value['name'].'</span>'."\n"; - - echo "\t\t".'<ul>'."\n"; - - foreach($sub_value['value'] AS $subsub_value) + if(!is_array($sub_value['value'])) { - echo "\t\t\t".'<li><a href="'.$subsub_value['value'].'">'.$subsub_value['name'].'</a></li>'."\n"; + echo "\t\t".'<li><a href="'.$sub_value['value'].'">'.$sub_value['name'].'</a></li>'."\n"; } - - echo "\t\t".'</ul>'."\n"; - echo "\t\t".'</li>'."\n"; + else + { + echo "\t\t".'<li><span>'.$sub_value['name'].' ></span>'."\n"; + + echo "\t\t".'<ul>'."\n"; + + foreach($sub_value['value'] AS $subsub_value) + { + echo "\t\t\t".'<li><a href="'.$subsub_value['value'].'">'.$subsub_value['name'].'</a></li>'."\n"; + } + + echo "\t\t".'</ul>'."\n"; + echo "\t\t".'</li>'."\n"; + } } - - } echo "\t".'</ul>'."\n"; Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-22 19:18:37 UTC (rev 4429) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-22 21:33:26 UTC (rev 4430) @@ -89,6 +89,9 @@ case 'meta': $this->view = 'meta_view'; break; + case 'comment': + $this->view = 'comment_view'; + break; default: $this->view = 'thumb_view'; } @@ -109,9 +112,6 @@ case 'meta': $this->view = 'meta_view'; break; - case 'comment': - $this->view = 'comment_view'; - break; default: $this->view = 'img_view'; } @@ -185,7 +185,7 @@ break; } - include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'_html/global.html.php'); + include_once(LINPHA_DIR.'/templates/html/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); } /** @@ -270,7 +270,7 @@ Array( 'name' => 'edit', 'value' => Array( - Array('name' => i18n('set_permissions'), 'value' => $edit_permission_link) + Array('name' => i18n('set permissions'), 'value' => $edit_permission_link) ) ), Array( @@ -601,6 +601,11 @@ $this->viewThumb_View_nojs(); } + function viewComment_view() + { + $GLOBALS['linpha']->template->setModuleName('view_comment'); + } + /** ***** image view */ Modified: trunk/linpha2/lib/classes/linpha.template_new.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template_new.class.php 2006-03-22 19:18:37 UTC (rev 4429) +++ trunk/linpha2/lib/classes/linpha.template_new.class.php 2006-03-22 21:33:26 UTC (rev 4430) @@ -12,7 +12,8 @@ function __construct() { - $this->template_name = 'main'; + $this->template_name = 'default'; + $this->output['title'] = "Linpha 2.0"; } /** @@ -23,13 +24,13 @@ switch($what) { case 'body': - $filename = LINPHA_DIR.'/templates/'.$this->template_name.'_html/'.$this->body_name.'.html.php'; + $filename = LINPHA_DIR.'/templates/html/'.$this->template_name.'/'.$this->body_name.'.html.php'; break; case 'head': - $filename = LINPHA_DIR.'/templates/'.$this->template_name.'_html/'.$this->head_name.'.head.php'; + $filename = LINPHA_DIR.'/templates/html/'.$this->template_name.'/'.$this->head_name.'.head.php'; break; case 'css': - echo LINPHA_DIR.'/templates/'.$this->template_name.'_css/'.$this->css_name.'.css'; + echo LINPHA_DIR.'/templates/css/'.$this->template_name.'/'.$this->css_name.'.css'; break; } Modified: trunk/linpha2/lib/classes/thumbnails.js =================================================================== --- trunk/linpha2/lib/classes/thumbnails.js 2006-03-22 19:18:37 UTC (rev 4429) +++ trunk/linpha2/lib/classes/thumbnails.js 2006-03-22 21:33:26 UTC (rev 4430) @@ -167,13 +167,13 @@ var myImg = document.createElement("img"); myImg.src = link_get_thumb + img_ids[i]['id']; - myImg.height = (tn_size-img_div_spacer_height); + //myImg.height = (tn_size-img_div_spacer_height); - /* + myImg.style.cssText = "max-width: " + tn_size + "; max-height: " + (tn_size-img_div_spacer_height) + ";"; - myImg.style.max-width = tn_size; - myImg.style.max-height = tn_size-img_div_spacer_height; - */ + //myImg.style.max-width = tn_size; + //myImg.style.max-height = tn_size-img_div_spacer_height; + var myAttribute=document.createAttribute("class"); myAttribute.nodeValue = 'img_thumbnail'; Modified: trunk/linpha2/lib/modules/module.basket.php =================================================================== --- trunk/linpha2/lib/modules/module.basket.php 2006-03-22 19:18:37 UTC (rev 4429) +++ trunk/linpha2/lib/modules/module.basket.php 2006-03-22 21:33:26 UTC (rev 4430) @@ -81,14 +81,30 @@ } } - /** * build basket view */ + /** + * get and save parent ids + */ + if( count($_SESSION['basket_ids']) > 0 ) + { + sort($_SESSION['basket_ids']); + foreach($_SESSION['basket_ids'] AS $value) + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT parent_id FROM ".PREFIX."photos WHERE id = '". linSql::linAddslashes($value)."'" ); + $array_folders[] = $data[0]; + + /** + * store all imgids in an array with parent_id as the key for easy access + */ + $GLOBALS['linpha']->template->output['basket_folder_contents'][$data[0]][] = $value; + } + + $GLOBALS['linpha']->template->output['basket_folders'] = array_unique($array_folders); + } - - $linpha->template->setModuleName('basket'); $linpha->template->URL_full = LINPHA_DIR.'/?cat=basket&ref_id='.$_GET['ref_id']; -include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'_html/global.html.php'); +include_once(LINPHA_DIR.'/templates/html/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); ?> \ No newline at end of file Modified: trunk/linpha2/templates/css/default/basket.css =================================================================== --- trunk/linpha2/templates/css/default/basket.css 2006-03-22 19:18:37 UTC (rev 4429) +++ trunk/linpha2/templates/css/default/basket.css 2006-03-22 21:33:26 UTC (rev 4430) @@ -1,3 +1,11 @@ +.main { + margin-left: 10px; +} + +.navigation { + margin-left: 10px; +} + .imgdiv { border: 1px #000000 solid; margin: 3px; Modified: trunk/linpha2/templates/css/default/home.css =================================================================== --- trunk/linpha2/templates/css/default/home.css 2006-03-22 19:18:37 UTC (rev 4429) +++ trunk/linpha2/templates/css/default/home.css 2006-03-22 21:33:26 UTC (rev 4430) @@ -1,3 +1,9 @@ +.main { + margin-left: 10px; +} + + + h1 { font-size: 18pt; font-family: Verdana, Arial, Helvetica, sans-serif; Modified: trunk/linpha2/templates/css/default/view_thumb.css =================================================================== --- trunk/linpha2/templates/css/default/view_thumb.css 2006-03-22 19:18:37 UTC (rev 4429) +++ trunk/linpha2/templates/css/default/view_thumb.css 2006-03-22 21:33:26 UTC (rev 4430) @@ -1,3 +1,12 @@ +.main { + margin-left: 10px; +} + +.navigation { + margin-left: 10px; +} + + /** * need this to calculate heigh of main div * if you're gettings scrollbars, adjust the height! Modified: trunk/linpha2/templates/html/default/basket.html.php =================================================================== --- trunk/linpha2/templates/html/default/basket.html.php 2006-03-22 19:18:37 UTC (rev 4429) +++ trunk/linpha2/templates/html/default/basket.html.php 2006-03-22 21:33:26 UTC (rev 4430) @@ -12,64 +12,25 @@ <?php if( count($_SESSION['basket_ids']) > 0 ) { ?> - -<?php - - /** - * get and save parent ids - */ - sort($_SESSION['basket_ids']); - foreach($_SESSION['basket_ids'] AS $value) + <?php + foreach($GLOBALS['linpha']->template->output['basket_folders'] AS $value) { - $data = $GLOBALS['linpha']->db->GetRow("SELECT parent_id FROM ".PREFIX."photos WHERE id = '". linSql::linAddslashes($value)."'" ); - $array_folder_ids[] = $data[0]; - - $array_folders[$data[0]][] = $value; // store all imgids in an array with parent_id as the key - } - - $array_folder_ids = array_unique($array_folder_ids); - - - - foreach($array_folder_ids AS $value) - { echo set_navigation_line($value).'<br />'; - $i = 1; - foreach($array_folders[$value] AS $sub_value) + foreach($GLOBALS['linpha']->template->output['basket_folder_contents'][$value] AS $sub_value) { - ?> + ?> <div class='imgdiv'> <a href='javascript:void(0)' onclick='update_checkbox(<?php echo $i; ?>)'><img src='<?php echo LINPHA_DIR.'/get_thumb.php?id='.$sub_value; ?>' class='img_thumbnail' /></a> <br /> <input type='checkbox' id='<?php echo $i; ?>' name='img_id[]' value='<?php echo $sub_value; ?>'> </div> - <?php + <?php $i++; } - echo '<div style="clear: both;"></div><br /><br />'; } - - - - - - - /* - echo '<pre>'; - print_r($_SESSION['basket_ids']); - - - foreach($array_path_ids AS $value) - { - print_r(linSql::getFullFilenameFromId($value)); - } - - echo '</pre>';*/ -?> - - + ?> <script language="JavaScript" type='text/javascript'> function update_checkbox(elem_id) { @@ -84,14 +45,11 @@ } } </script> - - - - -<?php } else { - +<?php +} +else +{ echo i18n("Empty Basket"); - } ?> </div> </form> \ No newline at end of file Modified: trunk/linpha2/templates/html/default/global.html.php =================================================================== --- trunk/linpha2/templates/html/default/global.html.php 2006-03-22 19:18:37 UTC (rev 4429) +++ trunk/linpha2/templates/html/default/global.html.php 2006-03-22 21:33:26 UTC (rev 4430) @@ -1,6 +1,43 @@ +<?php +/** + * create main menu + */ +$GLOBALS['linpha']->template->output['menu_main'] = Array( + Array('name' => 'home', 'value' => LINPHA_DIR . '/'), + Array('name' => 'admin', 'value' => LINPHA_DIR . '/admin/'), + Array( + 'name' => 'search', + 'value' => Array( + Array( + 'name' => 'special_search', + 'value' => '#' + ), + Array( + 'name' => 'extended search', + 'value' => LINPHA_DIR . '/?cat=search' + ) + ) + ), + Array( + 'name' => 'login', + 'value' => Array( + Array( + 'name' => 'special_login', + 'value' => '#' + ) + ) + ) +); + +/** + * first output starts here + */ +?> +<?php /*header('Content-type: text/html; charset='.$html_charset);*/ ?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> -<link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'_css/global.css'; ?>' type='text/css'> +<link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/css/'.$GLOBALS['linpha']->template->template_name.'/global.css'; ?>' type='text/css'> <?php if( isset($GLOBALS['linpha']->template->output['sys_log'])) { ?> <style> .sys_log { @@ -31,14 +68,14 @@ <?php } ?> <link rel='stylesheet' href='<?php $GLOBALS['linpha']->template->includeFile('css'); ?>' type='text/css'> <?php $GLOBALS['linpha']->template->includeFile('head'); ?> +<title><?php echo $GLOBALS['linpha']->template->output['title']; ?></title> </head> <body> - <?php if( isset($GLOBALS['linpha']->template->output['sys_log']) ) { ?> <div id="sys_log" class="sys_log"> <div class="sys_log_close"><a href="javascript:toggleWindow()">X</a></div> <div id="sys_log_text" class="sys_log_text"> - Linpha Syslog:<br /> + <?php echo i18n("Linpha syslog"); ?>:<br /> <?php echo $GLOBALS['linpha']->template->output['sys_log']; ?> </div> </div> @@ -70,13 +107,15 @@ </script> <?php } ?> - +<!-- header with menu //--> <div class="header"> <div id="menu"> - <?php printMenu(); ?> +<?php printMenu(); echo "\n"; ?> </div> </div> + <div class="header2"></div> +<!-- end header with menu //--> <?php $GLOBALS['linpha']->template->includeFile('body'); ?> </body> Modified: trunk/linpha2/templates/html/default/home.html.php =================================================================== --- trunk/linpha2/templates/html/default/home.html.php 2006-03-22 19:18:37 UTC (rev 4429) +++ trunk/linpha2/templates/html/default/home.html.php 2006-03-22 21:33:26 UTC (rev 4430) @@ -1,8 +1,3 @@ -<div class="left"> -left<br />left<br />left<br />left<br />left<br />left<br /> -left<br />left<br />left<br />left<br />left<br />left<br /> -</div> - <div id='maindiv' class='main'> <h1><?php echo i18n("Welcome"); ?></h1> @@ -19,7 +14,7 @@ ?> <div class='div_random_img'> <?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">' - . '<img class="img_random_thumbnail" title="'.htmlentities($value['path']).'" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" /></a>'; ?> + . '<img class="img_random_thumbnail" title="'.htmlentities($value['path']).'" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" alt="randomimage" /></a>'; ?> </div> <?php } @@ -40,7 +35,7 @@ ?> <div class='div_folder'> <?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">' - . '<img class="img_folder_thumbnail" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" /></a>'; ?> + . '<img class="img_folder_thumbnail" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" alt="thumbnail_album" /></a>'; ?> <div class='div_folder_text'> <h2><?php echo $value['name']; ?></h2> Modified: trunk/linpha2/templates/html/default/view_comment.html.php =================================================================== --- trunk/linpha2/templates/html/default/view_comment.html.php 2006-03-22 19:18:37 UTC (rev 4429) +++ trunk/linpha2/templates/html/default/view_comment.html.php 2006-03-22 21:33:26 UTC (rev 4430) @@ -23,15 +23,14 @@ "WHERE md5sum = '".$GLOBALS['linpha']->imgview->id_current."'"); } } - - ?> -<div id='maindiv' class='main'> -<form action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" method="POST"> <?php $data = $GLOBALS['linpha']->db->GetRow("SELECT id, time, author, comment FROM ".PREFIX."meta_comments"); ?> + +<div id='maindiv' class='main'> +<form action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" method="POST"> <a href="<?php echo $GLOBALS['linpha']->template->URL_full.'&view=thumb'; ?>">back</a> <br /><br /> Modified: trunk/linpha2/templates/html/default/view_thumb.html.php =================================================================== --- trunk/linpha2/templates/html/default/view_thumb.html.php 2006-03-22 19:18:37 UTC (rev 4429) +++ trunk/linpha2/templates/html/default/view_thumb.html.php 2006-03-22 21:33:26 UTC (rev 4430) @@ -1,9 +1,3 @@ -<div class="left"> -left<br />left<br />left<br />left<br />left<br />left<br /> -left<br />left<br />left<br />left<br />left<br />left<br /> -</div> - - <?php /** * javascript enabled @@ -94,6 +88,4 @@ </div> <?php } -?> - - +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-25 13:09:01
|
Revision: 4435 Author: fangehrn Date: 2006-03-25 05:08:27 -0800 (Sat, 25 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4435&view=rev Log Message: ----------- * working on templates Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.template_new.class.php trunk/linpha2/templates/css/default/basket.css trunk/linpha2/templates/css/default/global.css trunk/linpha2/templates/css/default/view_thumb.css trunk/linpha2/templates/html/default/global.html.php trunk/linpha2/templates/html/default/view_basket.html.php trunk/linpha2/templates/html/default/view_img.html.php trunk/linpha2/templates/html/default/view_meta.html.php trunk/linpha2/templates/html/default/view_thumb.html.php trunk/linpha2/templates/html/default/view_thumbdetail.html.php Added Paths: ----------- trunk/linpha2/lib/classes/syslog.js trunk/linpha2/templates/css/default/syslog.css trunk/linpha2/templates/css/default/view_meta.css trunk/linpha2/templates/html/default/view_meta.head.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-24 17:54:01 UTC (rev 4434) +++ trunk/linpha2/ChangeLog 2006-03-25 13:08:27 UTC (rev 4435) @@ -1,3 +1,6 @@ +2006-03-25 flo + * working on templates + 2006-03-24 bzrudi <linpha2_AT_tuxpower_DOT_de> * code cleanups and documentation Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-03-24 17:54:01 UTC (rev 4434) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-03-25 13:08:27 UTC (rev 4435) @@ -71,176 +71,7 @@ } // end tr() -/** - * print the main menu - * - * view http://www.tanfa.co.uk/css/examples/menu/tutorial-h.asp - * the nicest one! - * - * @todo should not work in IE yet - */ -function printMenu() -{ - printMenuEntry('menu_main'); - - if(isset($GLOBALS['linpha']->template->output['menu_optional'] ) ) - { - /** - * stuff for browsers with deactivated javascript - */ - if(isset($_GET['menu'])) - { - if($_GET['menu'] == 'open') - { - $_SESSION['menu'] = 'open'; - } - else - { - $_SESSION['menu'] = 'close'; - } - } - - if( (isset($_SESSION['menu']) && $_SESSION['menu']=='open') - OR isset($_SESSION['view']) && $_SESSION['view']=='basket') - { - $style = "visibility: visible;"; - $link = 'close'; - $str_href = '<'; - } - else - { - $style = "visibility: hidden;"; - $link = 'open'; - $str_href = '>'; - } - ?> -<div id="menu_switch"> -<a href="<?php echo $GLOBALS['linpha']->template->URL_full.'&menu='.$link; - ?>"><?php echo $str_href; ?></a> -</div> -<?php /* - onclick="open_close_menu(); return false;" - <script language="JavaScript" type="text/javascript"> - var menu_is_open = false; - function open_close_menu() - { - if( menu_is_open ) - { - menu_is_open = false; - - document.getElementById('menu_optional').style.visibility = 'hidden'; - document.getElementById('menu_switch').innerHTML = '<a href="<?php echo $GLOBALS['linpha']->template->URL_full; - ?>" onclick="open_close_menu(); return false;">></a>'; - } - else - { - menu_is_open = true; - - document.getElementById('menu_optional').style.visibility = ''; - document.getElementById('menu_switch').innerHTML = '<a href="<?php echo $GLOBALS['linpha']->template->URL_full; - ?>" onclick="open_close_menu(); return false;"><</a>'; - } - } - </script> - */ ?> - -<div id="menu_optional" style="<?php echo $style; ?>"> -<?php printMenuEntry('menu_optional'); ?> - -</div> -<?php - - } - - if( isset( $GLOBALS['linpha']->template->output['menu_sub'] ) ) - { - printSubMenu(); - } -} - -function printSubMenu() -{ - echo '</div>'; - echo '<div">Basket: '; - foreach($GLOBALS['linpha']->template->output['menu_sub'] AS $key=>$value) - { - echo '<a href="'.$value.'">'.$key.'</a> '; - } -} - -function printMenuEntry($index) -{ - foreach($GLOBALS['linpha']->template->output[$index] AS $key=>$value) - { - echo "\n".'<ul>'."\n"; - if(!is_array($value['value'])) - { - echo "\t".'<li><a href="'.$value['value'].'">'.$value['name'].'</a></li>'."\n"; - } - else - { - echo "\t".'<li><span>'.$value['name'].'</span>'."\n"; - - echo "\t".'<ul>'."\n"; - - foreach($value['value'] AS $sub_value) - { - /** - * search special - */ - if($sub_value['name'] == 'special_search') - { -?> - <li><span> - <input type="text" name="search" value="" /> - <input type="submit" name="submit" value="<?php echo i18n("search"); ?>" /> - </span></li> -<?php - } - /** - * login special - */ - elseif($sub_value['name'] == 'special_login') - { -?> - <li><span> - <?php echo i18n("Username"); ?>: <input type="text" name="username" value="" /><br /> - <?php echo i18n("Password"); ?>: <input type="password" name="password" value="" /><br /> - <input type="submit" name="submit" value="<?php echo i18n("login"); ?>" /> - </span></li> -<?php - } - else - { - if(!is_array($sub_value['value'])) - { - echo "\t\t".'<li><a href="'.$sub_value['value'].'">'.$sub_value['name'].'</a></li>'."\n"; - } - else - { - echo "\t\t".'<li><span>'.$sub_value['name'].' ></span>'."\n"; - - echo "\t\t".'<ul>'."\n"; - - foreach($sub_value['value'] AS $subsub_value) - { - echo "\t\t\t".'<li><a href="'.$subsub_value['value'].'">'.$subsub_value['name'].'</a></li>'."\n"; - } - - echo "\t\t".'</ul>'."\n"; - echo "\t\t".'</li>'."\n"; - } - } - } - - echo "\t".'</ul>'."\n"; - echo "\t".'</li>'."\n"; - } - echo '</ul>'."\n"; - } -} - function set_navigation_line( $id ) { $array_files = $GLOBALS['linpha']->sql->getFullFilenameFromId( $id ); @@ -263,7 +94,9 @@ return $str; } - +/** + * linpha syslog window, shows up system info like "images added" + */ function linSysLog($str) { if( ! isset( $GLOBALS['linpha']->template->output['sys_log'] ) ) @@ -307,8 +140,7 @@ /** - * we have to use & in links (W3C) - * in javascript, the & arent convert in & ! + * we have to use & in links (W3C), but in javascript we cannot use &! */ function convert_amp($url) { Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-24 17:54:01 UTC (rev 4434) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-25 13:08:27 UTC (rev 4435) @@ -275,79 +275,73 @@ $array_views_links[] = Array('name' => i18n($value), 'value' => $GLOBALS['linpha']->template->URL_full.'&view='.$value); } - $GLOBALS['linpha']->template->output['menu_optional'] = Array( + $GLOBALS['linpha']->template->output['menu_more'] = Array( Array( - 'name' => 'basket', + 'name' => i18n("Basket"), 'value' => Array( - Array('name' => i18n('add all to basket'), 'value' => $open_basket_link.'&cmd=add_all'), - Array('name' => i18n('switch to basket view'), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), - Array('name' => i18n('open basket'), 'value' => $open_basket_link), - Array('name' => i18n('in basket').': '.count($_SESSION['basket_ids']), 'value' => '#') + Array('name' => i18n("Add all To Basket"), 'value' => $open_basket_link.'&cmd=add_all'), + Array('name' => i18n("Switch To Basket View"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), + Array('name' => i18n("Open Basket"), 'value' => $open_basket_link), + Array('name' => i18n("Images In Basket").': '.count($_SESSION['basket_ids']), 'value' => '#') ) ), Array( - 'name' => 'view', + 'name' => i18n("View"), 'value' => Array( - Array('name' => i18n('sort'), 'value' => $array_sort_orders_links), - Array('name' => i18n('view'), 'value' => $array_views_links), - Array('name' => i18n('thumb size'), 'value' => $array_tn_sizes_links), - Array('name' => i18n('thumb nr'), 'value' => $array_nr_links) + Array('name' => i18n("Sort"), 'value' => $array_sort_orders_links), + Array('name' => i18n("View"), 'value' => $array_views_links), + Array('name' => i18n("Thumb Size"), 'value' => $array_tn_sizes_links), + Array('name' => i18n("Thumb Nr"), 'value' => $array_nr_links) ) ), Array( - 'name' => 'edit', + 'name' => i18n("Edit"), 'value' => Array( - Array('name' => i18n('set permissions'), 'value' => $edit_permission_link) + Array('name' => i18n("Set Permissions"), 'value' => $edit_permission_link) ) ), Array( - 'name' => 'metainfo', + 'name' => i18n("Metainfo"), 'value' => Array( - Array('name' => i18n('edit album comment'), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=comment'), - Array('name' => i18n('edit album information'), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') + Array('name' => i18n("Edit Album Comment"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=comment'), + Array('name' => i18n("Edit Album Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') ) ) ); break; case 'img_view': - $GLOBALS['linpha']->template->output['menu_optional'] = Array( + $GLOBALS['linpha']->template->output['menu_more'] = Array( Array( - 'name' => 'basket', + 'name' => i18n("Basket"), 'value' => Array( - Array('name' => i18n('add to basket'), 'value' => '#'), - Array('name' => i18n('switch to basket view'), 'value' => '#'), - Array('name' => i18n('open basket'), 'value' => $open_basket_link), - Array('name' => i18n('in basket').': '.count($_SESSION['basket_ids']), 'value' => '#') + Array('name' => i18n("Add To Basket"), 'value' => '#'), + Array('name' => i18n("Open Basket"), 'value' => $open_basket_link), + Array('name' => i18n("Images In Basket").': '.count($_SESSION['basket_ids']), 'value' => '#') ) ), Array( - 'name' => 'view', + 'name' => i18n("View"), 'value' => Array( - Array('name' => i18n('sort'), 'value' => $array_sort_orders_links) + Array('name' => i18n("Sort"), 'value' => $array_sort_orders_links) ) ), Array( - 'name' => 'edit', + 'name' => i18n("Edit"), 'value' => Array( - Array('name' => i18n('rotate left'), 'value' => '#'), - Array('name' => i18n('rotate right'), 'value' => '#'), - Array('name' => i18n('set permissions'), 'value' => $edit_permission_link) + Array('name' => i18n("Rotate Left"), 'value' => '#'), + Array('name' => i18n("Rotate Right"), 'value' => '#'), + Array('name' => i18n("Set Permissions"), 'value' => $edit_permission_link) ) ), Array( - 'name' => 'metainfo', + 'name' => i18n("Metainfo"), 'value' => Array( - Array('name' => i18n('edit image information'), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') + Array('name' => i18n("Edit Image Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') ) ) ); break; - case 'basket_view': - $GLOBALS['linpha']->template->output['menu_sub'] = Array( - 'back to normal view' => $GLOBALS['linpha']->template->URL_full.'&view=thumb' - ); - break; } } } @@ -667,13 +661,50 @@ { $GLOBALS['linpha']->template->setModuleName('view_img'); - $this->viewImgCommon(); + $this->viewImgSetPrevNextThumb(); $array_files = $GLOBALS['linpha']->sql->getFullFilenameFromId( $this->id_current ); $this->full_filename = $this->album_dir.implode('/',$array_files); + $this->viewImg_viewReadImageInformation(); + /** + * image comments + */ + + /** + * save comment + */ + if( isset( $_POST['cmd'] ) && $_POST['cmd']=='add_comment') + { + if( !empty($_POST['comment_textarea'])) + { + $comment = $_POST['comment_textarea']; + } + else + { + $comment = $_POST['comment_text']; + } + + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_comments (time, md5sum, author, comment)" . + "VALUES ('".time()."','".$GLOBALS['linpha']->imgview->md5sum."','".linSql::linAddslashes($_POST['author'])."'," . + "'".linSql::linAddslashes($comment)."')"); + } + + /** + * get comments + */ + $GLOBALS['linpha']->template->output['image_comments'] = $GLOBALS['linpha']->db->Execute("SELECT id, time, author, comment FROM ".PREFIX."meta_comments " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); +} + +/** + * read image informations + */ +function viewImg_viewReadImageInformation() +{ + /** * set image informations */ include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); @@ -718,10 +749,6 @@ } } - /** - * read image information from database - */ - if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) { $str_exif_fields = strtolower( implode(', ',$MetaData->defined_exif_fields) ); $exif_data = $GLOBALS['linpha']->db->GetRow("SELECT ".$str_exif_fields." FROM ".PREFIX."meta_exif WHERE md5sum = '".$this->md5sum."'"); @@ -732,6 +759,9 @@ $iptc_data = $GLOBALS['linpha']->db->GetRow("SELECT ".$str_iptc_fields." FROM ".PREFIX."meta_iptc WHERE md5sum = '".$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()) { @@ -790,10 +820,8 @@ $GLOBALS['linpha']->template->output['image_infos'][$data['name']] = Array('name' => $name, 'value' => $value); } } - } - /** * generate html code for the prev/next thumbnail */ @@ -819,14 +847,44 @@ $GLOBALS['linpha']->template->setModuleName('view_meta'); $GLOBALS['linpha']->template->overrideModule('css','view_img'); // used the same css definitions as view_img - $this->viewImgCommon(); + $this->viewImgSetPrevNextThumb(); + + /** + * save metadata + */ + 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)."')"); + } + } + } + } } /** - * @todo what exactly does this method ? + * set prev/next thumb for img_view and meta_view */ -function viewImgCommon() +function viewImgSetPrevNextThumb() { /** * search current key in array Modified: trunk/linpha2/lib/classes/linpha.template_new.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template_new.class.php 2006-03-24 17:54:01 UTC (rev 4434) +++ trunk/linpha2/lib/classes/linpha.template_new.class.php 2006-03-25 13:08:27 UTC (rev 4435) @@ -62,7 +62,68 @@ break; } } + + /** + * print the main menu + * + * view http://www.tanfa.co.uk/css/examples/menu/tutorial-h.asp + * the nicest one! + * + * @todo should not work in IE yet + */ + function printMenu($index) + { + echo "\n".'<ul>'."\n"; + echo "\t".'<li><span>'.i18n("More").' v</span>'."\n"; + echo "\n".'<ul>'."\n"; + + foreach($GLOBALS['linpha']->template->output['menu_'.$index] AS $key=>$value) + { + if(!is_array($value['value'])) + { + echo "\t".'<li><a href="'.$value['value'].'">'.$value['name'].'</a></li>'."\n"; + } + else + { + echo "\t".'<li><span>'.$value['name'].' ></span>'."\n"; + + echo "\t".'<ul>'."\n"; + + foreach($value['value'] AS $sub_value) + { + if(!is_array($sub_value['value'])) + { + echo "\t\t".'<li><a href="'.$sub_value['value'].'">'.$sub_value['name'].'</a></li>'."\n"; + } + else + { + echo "\t\t".'<li><span>'.$sub_value['name'].' ></span>'."\n"; + + echo "\t\t".'<ul>'."\n"; + + foreach($sub_value['value'] AS $subsub_value) + { + echo "\t\t\t".'<li><a href="'.$subsub_value['value'].'">'.$subsub_value['name'].'</a></li>'."\n"; + } + + echo "\t\t".'</ul>'."\n"; + echo "\t\t".'</li>'."\n"; + } + } + + echo "\t".'</ul>'."\n"; + echo "\t".'</li>'."\n"; + } + } + + echo "\t".'</ul>'."\n"; + echo "\t".'</li>'."\n"; + echo '</ul>'."\n"; + } + + + } // end class linTemplate ?> \ No newline at end of file Added: trunk/linpha2/lib/classes/syslog.js =================================================================== Modified: trunk/linpha2/templates/css/default/basket.css =================================================================== --- trunk/linpha2/templates/css/default/basket.css 2006-03-24 17:54:01 UTC (rev 4434) +++ trunk/linpha2/templates/css/default/basket.css 2006-03-25 13:08:27 UTC (rev 4435) @@ -2,10 +2,6 @@ margin-left: 10px; } -.navigation { - margin-left: 10px; -} - .imgdiv { border: 1px #000000 solid; margin: 3px; Modified: trunk/linpha2/templates/css/default/global.css =================================================================== --- trunk/linpha2/templates/css/default/global.css 2006-03-24 17:54:01 UTC (rev 4434) +++ trunk/linpha2/templates/css/default/global.css 2006-03-25 13:08:27 UTC (rev 4435) @@ -17,29 +17,27 @@ text-decoration: underline; } -.header { +.title { + background-color: #d5fcf4; + padding: 0; + border: 1px solid #0c9; + margin: 10px 10px 10px 10px; +} + +.menu { background-color: #ffd5ee; border: 1px solid #f09; - /*position: fixed; - top: 10px; - left: 10px; - right: 10px;*/ margin: 10px; z-index: 400; padding: 5px; - height: 70px; + height: 30px; } -.header2 { /* used if .header is position:fixed */ - /*margin: 10px; - height: 80px;*/ - /*visibility: hidden;*/ -} .left { position: absolute; - top: 100px; + top: 200px; left: 10px; width: 205px; @@ -54,13 +52,6 @@ border: 1px solid #f09; } -.navigation { - background-color: #d5fcf4; - padding: 0; - border: 1px solid #0c9; - margin: 10px 10px 10px 237px; -} - .main { background-color: #d5eeff; padding: 5px; @@ -129,7 +120,7 @@ #menu ul ul { position: absolute; z-index: 500; - font-size: 0.8em; + font-size: 1em; /* relativ to parent element */ width: auto; min-width: 7em; /* white-space: nowrap;*/ @@ -141,10 +132,6 @@ left: 100%; } - div#menu ul ul { - display: none; - } - div#menu ul ul, div#menu ul li:hover ul ul, div#menu ul ul li:hover ul ul @@ -154,9 +141,4 @@ div#menu ul ul li:hover ul, div#menu ul ul ul li:hover ul {display: block;} - - #menu_switch a { - width: 1em; - float: left; - } --> \ No newline at end of file Added: trunk/linpha2/templates/css/default/syslog.css =================================================================== --- trunk/linpha2/templates/css/default/syslog.css (rev 0) +++ trunk/linpha2/templates/css/default/syslog.css 2006-03-25 13:08:27 UTC (rev 4435) @@ -0,0 +1,24 @@ +.sys_log { + position: absolute; + left: 15px; + top: 15px; + width: auto; + + z-index: 10; + + padding: 5px; + + border: 1px solid #FFD500; + background-color: #FFFF81; + +} + +.sys_log_close { + position: absolute; + right: 0; + top: 0; + z-index: 10; + + background-color: #ffd5ee; + border: 1px solid #f09; +} \ No newline at end of file Added: trunk/linpha2/templates/css/default/view_meta.css =================================================================== --- trunk/linpha2/templates/css/default/view_meta.css (rev 0) +++ trunk/linpha2/templates/css/default/view_meta.css 2006-03-25 13:08:27 UTC (rev 4435) @@ -0,0 +1,13 @@ +.main { + margin-left: 10px; + text-align: left; +} + +.div_all_main { + margin-left: 10px; +} + +.mainimage { + width: 350px; + height: auto; +} \ No newline at end of file Modified: trunk/linpha2/templates/css/default/view_thumb.css =================================================================== --- trunk/linpha2/templates/css/default/view_thumb.css 2006-03-24 17:54:01 UTC (rev 4434) +++ trunk/linpha2/templates/css/default/view_thumb.css 2006-03-25 13:08:27 UTC (rev 4435) @@ -2,17 +2,12 @@ margin-left: 10px; } -.navigation { - margin-left: 10px; -} - - /** * need this to calculate heigh of main div * if you're gettings scrollbars, adjust the height! */ .spacer_height { - height: 220px; + height: 240px; position: absolute; visibility: hidden; } @@ -35,22 +30,38 @@ text-align: left; } -.page_nr_main { +/** + * page nr + */ +.page_nr_spacer { + height: 45px; +} +.page_nr { position: absolute; - right: 12px; - top: 100px; - width: 600px; + margin-top: 5px; + left: 50%; + width: 530px; + height: 55px; + margin-left: -265px; /* should be the half of 'width' */ + + border: 1px #000000 solid; } -.page_nr { - float: right; - border: 1px #000000 solid; - margin: 5px;; +.page_nr_divs { + float: left; +/* border: 1px #000000 solid; */ + margin: 5px; padding: 10px; height: 25px; width: 40px; white-space: nowrap; } +.page_nr_maindiv { + width: 350px; + text-align: center; +} + + .main { min-height: 500px; /* @todo floated divs in thumb view without javascript doesnt count to the main div height */ } \ No newline at end of file Modified: trunk/linpha2/templates/html/default/global.html.php =================================================================== --- trunk/linpha2/templates/html/default/global.html.php 2006-03-24 17:54:01 UTC (rev 4434) +++ trunk/linpha2/templates/html/default/global.html.php 2006-03-25 13:08:27 UTC (rev 4435) @@ -1,35 +1,5 @@ <?php /** - * create main menu - */ -$GLOBALS['linpha']->template->output['menu_main'] = Array( - Array('name' => 'home', 'value' => LINPHA_DIR . '/'), - Array('name' => 'admin', 'value' => LINPHA_DIR . '/admin/'), - Array( - 'name' => 'search', - 'value' => Array( - Array( - 'name' => 'special_search', - 'value' => '#' - ), - Array( - 'name' => 'extended search', - 'value' => LINPHA_DIR . '/?cat=search' - ) - ) - ), - Array( - 'name' => 'login', - 'value' => Array( - Array( - 'name' => 'special_login', - 'value' => '#' - ) - ) - ) -); - -/** * first output starts here */ ?> @@ -37,86 +7,86 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> +<title><?php echo $GLOBALS['linpha']->template->output['title']; ?></title> + +<!-- css includes --> <link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/css/'.$GLOBALS['linpha']->template->template_name.'/global.css'; ?>' type='text/css'> +<link rel='stylesheet' href='<?php $GLOBALS['linpha']->template->includeFile('css'); ?>' type='text/css'> + <?php if( isset($GLOBALS['linpha']->template->output['sys_log'])) { ?> - <style> - .sys_log { - position: absolute; - left: 15px; - top: 15px; - width: auto; - - z-index: 10; - - padding: 5px; - - border: 1px solid #FFD500; - background-color: #FFFF81; - - } - - .sys_log_close { - position: absolute; - right: 0; - top: 0; - z-index: 10; - - background-color: #ffd5ee; - border: 1px solid #f09; - } - </style> + <link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/css/'.$GLOBALS['linpha']->template->template_name.'/syslog.css'; ?>' type='text/css'> <?php } ?> -<link rel='stylesheet' href='<?php $GLOBALS['linpha']->template->includeFile('css'); ?>' type='text/css'> + <?php $GLOBALS['linpha']->template->includeFile('head'); ?> -<title><?php echo $GLOBALS['linpha']->template->output['title']; ?></title> </head> + <body> + <?php if( isset($GLOBALS['linpha']->template->output['sys_log']) ) { ?> + <!-- syslog --> <div id="sys_log" class="sys_log"> <div class="sys_log_close"><a href="javascript:toggleWindow()">X</a></div> <div id="sys_log_text" class="sys_log_text"> - <?php echo i18n("Linpha syslog"); ?>:<br /> + <?php echo i18n("Linpha Syslog"); ?>:<br /> <?php echo $GLOBALS['linpha']->template->output['sys_log']; ?> </div> </div> - <script language="JavaScript" type="text/javascript"> - var window_is_open = false; - function toggleWindow() - { - if( window_is_open ) - { - window_is_open = false; - - document.getElementById('sys_log').style.width = '20px'; - document.getElementById('sys_log').style.height = '20px'; - - document.getElementById('sys_log_text').style.visibility = 'hidden'; - } - else - { - window_is_open = true; - - document.getElementById('sys_log').style.width = 'auto'; - document.getElementById('sys_log').style.height = 'auto'; - - document.getElementById('sys_log_text').style.visibility = ''; - } - } - - toggleWindow(); - </script> + <script type="text/javascript" language="javascript" src="<?php echo LINPHA_DIR; ?>/lib/classes/syslog.js"> </script> <?php } ?> -<!-- header with menu //--> -<div class="header"> +<!-- title/navigation --> +<div id="header" class="title"> + <h1><?php echo $GLOBALS['linpha']->template->output['title']." :: ".$GLOBALS['linpha']->template->output['navigation']; ?></h1> +</div> + +<!-- menu --> +<div class="menu"> <div id="menu"> -<?php printMenu(); echo "\n"; ?> + <ul> + <li><a href="./"><?php echo i18n("Home"); ?></a></li> + </ul> + <ul> + <li><a href="./admin/"><?php echo i18n("Admin"); ?></a></li> + </ul> + <ul> + <li><span><?php echo i18n("Search"); ?> v</span> + <ul> + <li><a href="./?cat=search"><?php echo i18n("Extended Search"); ?></a></li> + <li> + <span> + <input type="text" name="search" value="" /> + <input type="submit" name="submit" value="<?php echo i18n("Search"); ?>" /> + </span> + </li> + </ul> + </li> + </ul> + <ul> + <li> + <span><?php echo i18n("Login"); ?> v</span> + <ul> + <li> + <span> + <?php echo i18n("Username"); ?>: <input type="text" name="username" value="" /><br /> + <?php echo i18n("Password"); ?>: <input type="password" name="password" value="" /><br /> + <input type="submit" name="submit" value="<?php echo i18n("Login"); ?>" /> + </span> + </li> + </ul> + </li> + </ul> + <?php + /** + * Print "More"-menu entry + */ + if( isset( $GLOBALS['linpha']->template->output['menu_more'] ) ) { + $GLOBALS['linpha']->template->printMenu('more'); + } + ?> </div> </div> +<!-- end menu --> -<div class="header2"></div> -<!-- end header with menu //--> - <?php $GLOBALS['linpha']->template->includeFile('body'); ?> </body> </html> \ No newline at end of file Modified: trunk/linpha2/templates/html/default/view_basket.html.php =================================================================== --- trunk/linpha2/templates/html/default/view_basket.html.php 2006-03-24 17:54:01 UTC (rev 4434) +++ trunk/linpha2/templates/html/default/view_basket.html.php 2006-03-25 13:08:27 UTC (rev 4435) @@ -15,8 +15,10 @@ <div class="navigation"> <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> <br /><br /> - Images in basket: <?php echo count($_SESSION['basket_ids']); ?> - (<a href="<?php echo LINPHA_DIR.'?cat=basket&ref_id='.$GLOBALS['linpha']->imgview->id_current; ?>">open basket</a>) + <?php echo i18n("Images In Basket"); ?>: <?php echo count($_SESSION['basket_ids']); ?> + (<a href="<?php echo LINPHA_DIR.'?cat=basket&ref_id='.$GLOBALS['linpha']->imgview->id_current; ?>"><?php echo i18n("Open Basket"); ?></a>) + <br /> + <a href="<?php echo $GLOBALS['linpha']->template->URL_full.'&view=thumb'; ?>"><?php echo i18n("Back To Normal View"); ?></a> </div> <form name='basket' action='<?php echo LINPHA_DIR.'/?cat=basket&cmd=add_selected&ref_id='.$GLOBALS['linpha']->imgview->id_current; ?>' method='POST'> Modified: trunk/linpha2/templates/html/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/html/default/view_img.html.php 2006-03-24 17:54:01 UTC (rev 4434) +++ trunk/linpha2/templates/html/default/view_img.html.php 2006-03-25 13:08:27 UTC (rev 4435) @@ -7,12 +7,6 @@ ?> </div> - -<div class="navigation"> - <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> - <br /><br /> -</div> - <div class="div_all_main"> <div class="div_all_prevthumb"> <?php echo $GLOBALS['linpha']->template->output['prev_thumb']; ?> @@ -27,24 +21,6 @@ <?php echo $GLOBALS['linpha']->template->output['image']; ?> <br /><br /> -<?php -if( isset( $_POST['cmd'] ) ) -{ - if( !empty($_POST['comment_textarea'])) - { - $comment = $_POST['comment_textarea']; - } - else - { - $comment = $_POST['comment_text']; - } - - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_comments (time, md5sum, author, comment)" . - "VALUES ('".time()."','".$GLOBALS['linpha']->imgview->md5sum."','".linSql::linAddslashes($_POST['author'])."'," . - "'".linSql::linAddslashes($comment)."')"); -} -?> - <div class="add_comment"> <form action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" method="POST"> <?php echo i18n("Add Comment"); ?>:<br /> @@ -59,19 +35,17 @@ </form> </div> <br /><br /> - -<?php -$query = $GLOBALS['linpha']->db->Execute("SELECT id, time, author, comment FROM ".PREFIX."meta_comments " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); -while($data = $query->FetchRow()) -{ - echo '<div class="comments">'; - echo $data['time'].' '.$data['author'].'<br />'; - echo $data['comment'].'<br /><br />'; - echo '</div>'; -} -?> +<!-- show image comments //--> +<?php while($data = $GLOBALS['linpha']->template->output['image_comments']->FetchRow()) { ?> + <div class="comments"> + <?php echo $data['time']; ?> <?php echo $data['author']; ?> + <br /> + <?php echo $data['comment']; ?> + <br /><br /> + </div> +<?php } ?> + </div> <script language="Javascript"> Added: trunk/linpha2/templates/html/default/view_meta.head.php =================================================================== --- trunk/linpha2/templates/html/default/view_meta.head.php (rev 0) +++ trunk/linpha2/templates/html/default/view_meta.head.php 2006-03-25 13:08:27 UTC (rev 4435) @@ -0,0 +1,6 @@ +<?php +/** + * use all definitions from view_img.css, and append here view_meta.css + */ +?> +<link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/css/'.$GLOBALS['linpha']->template->template_name.'/view_meta.css'; ?>' type='text/css'> \ No newline at end of file Modified: trunk/linpha2/templates/html/default/view_meta.html.php =================================================================== --- trunk/linpha2/templates/html/default/view_meta.html.php 2006-03-24 17:54:01 UTC (rev 4434) +++ trunk/linpha2/templates/html/default/view_meta.html.php 2006-03-25 13:08:27 UTC (rev 4435) @@ -1,60 +1,3 @@ -<?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']->template->output['navigation']; ?> - <br /><br /> -</div> - - <div class="div_all_main"> <div class="div_all_prevthumb"> <?php echo $GLOBALS['linpha']->template->output['prev_thumb']; ?> Modified: trunk/linpha2/templates/html/default/view_thumb.html.php =================================================================== --- trunk/linpha2/templates/html/default/view_thumb.html.php 2006-03-24 17:54:01 UTC (rev 4434) +++ trunk/linpha2/templates/html/default/view_thumb.html.php 2006-03-25 13:08:27 UTC (rev 4435) @@ -10,21 +10,16 @@ window.onresize = display_images; </script> - <div class="page_nr_main"> - <!-- cannot use floated div in another div !! - in this div it is possible because it has position: absolute --> - <div class='page_nr' id='page_nr_right'>right</div> - <div class='page_nr' id='page_nr' style="width: 350px; text-align: center;">page nr middle</div> - <div class='page_nr' id='page_nr_left'>left</div> + <div class="page_nr"> + <div class="page_nr_divs" id='page_nr_left'>left</div> + <div class="page_nr_divs page_nr_maindiv" id='page_nr'>page nr middle</div> + <div class="page_nr_divs" id='page_nr_right'>right</div> </div> + <div class="page_nr_spacer"></div> <div id='spacer_height' class='spacer_height'> </div> - <div id='navigation' class="navigation"> - <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> - </div> - <div id='maindiv' class='main'> </div> @@ -54,10 +49,6 @@ <div class='page_nr' id='page_nr_left'><?php echo $GLOBALS['linpha']->template->output['page_nr_left']; ?></div> </div> - <div class="navigation"> - <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> - </div> - <div id='maindiv' class='main'> <?php $i = 1; Modified: trunk/linpha2/templates/html/default/view_thumbdetail.html.php =================================================================== --- trunk/linpha2/templates/html/default/view_thumbdetail.html.php 2006-03-24 17:54:01 UTC (rev 4434) +++ trunk/linpha2/templates/html/default/view_thumbdetail.html.php 2006-03-25 13:08:27 UTC (rev 4435) @@ -3,11 +3,6 @@ left<br />left<br />left<br />left<br />left<br />left<br /> </div> -<div id='navigation' class="navigation"> - <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> - <br /><br /> -</div> - <div id='maindiv' class='main'> <?php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-26 20:32:58
|
Revision: 4436 Author: fangehrn Date: 2006-03-26 12:32:20 -0800 (Sun, 26 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4436&view=rev Log Message: ----------- * applying bastian's theme * added "more" menu entry Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.template_new.class.php trunk/linpha2/lib/classes/thumbnails.js trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/templates/css/default/basket.css trunk/linpha2/templates/css/default/global.css trunk/linpha2/templates/css/default/home.css trunk/linpha2/templates/css/default/syslog.css trunk/linpha2/templates/css/default/view_img.css trunk/linpha2/templates/css/default/view_meta.css trunk/linpha2/templates/css/default/view_thumb.css trunk/linpha2/templates/css/default/view_thumbdetail.css trunk/linpha2/templates/html/default/basket.html.php trunk/linpha2/templates/html/default/global.html.php trunk/linpha2/templates/html/default/home.html.php trunk/linpha2/templates/html/default/view_basket.html.php trunk/linpha2/templates/html/default/view_comment.html.php trunk/linpha2/templates/html/default/view_img.html.php trunk/linpha2/templates/html/default/view_meta.head.php trunk/linpha2/templates/html/default/view_meta.html.php trunk/linpha2/templates/html/default/view_thumb.html.php trunk/linpha2/templates/html/default/view_thumbdetail.html.php Added Paths: ----------- trunk/linpha2/templates/html/images/ trunk/linpha2/templates/html/images/bl.gif trunk/linpha2/templates/html/images/br.gif trunk/linpha2/templates/html/images/tl.gif trunk/linpha2/templates/html/images/tr.gif Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/ChangeLog 2006-03-26 20:32:20 UTC (rev 4436) @@ -1,3 +1,7 @@ +2006-03-26 flo + * applying bastian's theme + * added "more" menu entry + 2006-03-25 flo * working on templates Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-26 20:32:20 UTC (rev 4436) @@ -35,13 +35,12 @@ $def_tn_size = 150; $array_nr_images = Array('auto',10,25,50,100,200,'all'); $array_sort_orders = Array('nameasc', 'namedesc', 'dateasc', 'datedesc'); -$array_views = Array('normal','detail'); $no_js_nr_rows = 3; $no_js_nr_cols = 4; class LinImgview { -public $view; +public $mode; // 'home', 'thumb', 'image' public $tot_photos; public $photos; public $photos_filtered; @@ -64,18 +63,13 @@ /** - * set current view - * @param string $modulname thumb, thumbdetail, img, basket, ... + * set current view and set fileinfos of $_GET['id'] + * @param string $modulname (album, browse, search, ...) */ function setCurrentView($modulename) { if(isset($_GET['id']) && $_GET['id'] != 0) { - if(isset($_GET['view'])) - { - $_SESSION['view'] = $_GET['view']; - } - /** * set file informations */ @@ -98,74 +92,65 @@ */ if( $this->img_type == 0) { + $this->mode = 'thumb'; $this->id_parent = $current_data['id']; // use current_id as parent_id, because we want to see the content of the actual folder! - if(isset($_SESSION['view'])) + if(! isset($_SESSION['mode_thumbview']) ) { - switch($_SESSION['view']) - { - case 'detail': - $this->view = 'thumbdetail_view'; - break; - case 'basket': - $this->view = 'basket_view'; - break; - case 'meta': - $this->view = 'meta_view'; - break; - case 'comment': - $this->view = 'comment_view'; - break; - default: - $this->view = 'thumb_view'; - } + $_SESSION['mode_thumbview'] = 'thumb'; } - else - { - $this->view = 'thumb_view'; - } } else { + $this->mode = 'image'; $this->id_parent = $current_data['parent_id']; // use parent_id on image view - if(isset($_SESSION['view'])) + if( ! isset($_SESSION['mode_imageview']) ) { - switch($_SESSION['view']) - { - case 'meta': - $this->view = 'meta_view'; - break; - default: - $this->view = 'img_view'; - } + $_SESSION['mode_imageview'] = 'img'; } - else - { - $this->view = 'img_view'; - } } } else // no valid id supplied { + $this->mode = 'home'; $this->id_current = 0; - $this->view = 'thumbdetail_view'; } } - else + else // ( ! isset($_GET['id'] OR $_GET['id']==0) ) { $this->id_current = 0; + /** + * on top view, reset current view + */ if($modulename=='albums') { - $this->view = 'home'; + $this->mode = 'home'; } - else + else // $modulename=='browse', others will come.. { - $this->view = 'thumb_view'; + $this->mode = 'thumb'; + + if( ! isset($_SESSION['mode_thumbview']) ) + { + $_SESSION['mode_thumbview'] = 'thumb'; + } } } - + + if($this->mode == 'thumb' && isset($_GET['view'])) + { + $_SESSION['mode_thumbview'] = $_GET['view']; + } + if($this->mode == 'image' && isset($_GET['view'])) + { + $_SESSION['mode_imageview'] = $_GET['view']; + } + + /** + * set id_parent to a default value + */ if( ! isset( $this->id_parent) ) { $this->id_parent = $this->id_current; @@ -185,29 +170,39 @@ /** * set mode specific things */ - switch($this->view) + switch($this->mode) { case 'home': $this->viewHome_view(); break; - case 'img_view': - $this->viewImg_view(); + case 'thumb': + switch($_SESSION['mode_thumbview']) + { + case 'thumb': + $this->viewThumb_view(); + break; + case 'thumbdetail': + $this->viewThumbdetail_view(); + break; + case 'basket': + $this->viewBasket_view(); + break; + case 'albcomment': + $this->viewAlbComment_view(); + break; + } break; - case 'thumb_view': - $this->viewThumb_view(); + case 'image': + switch($_SESSION['mode_imageview']) + { + case 'img': + $this->viewImg_view(); + break; + case 'meta': + $this->viewMeta_view(); + break; + } break; - case 'thumbdetail_view': - $this->viewThumbdetail_view(); - break; - case 'basket_view': - $this->viewBasket_view(); - break; - case 'meta_view': - $this->viewMeta_view(); - break; - case 'comment_view': - $this->viewComment_view(); - break; } include_once(LINPHA_DIR.'/templates/html/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); @@ -224,7 +219,7 @@ { foreach($this->photos AS $key=>$value) { - if( ! ($this->view == 'img_view' && $value['img_type']==0 ) ) // exclude subfolders from img_view + if( ! ($this->mode == 'image' && $value['img_type']==0 ) ) // exclude subfolders from img_view { if( $GLOBALS['linpha']->sql->photoIsAllowed( $value['id'] ) ) { @@ -244,7 +239,7 @@ /** * don't show this menu if we're on top */ - if($this->view != 'home') + if($this->mode != 'home') { /** * more than one time used stuff @@ -257,10 +252,9 @@ $open_basket_link = LINPHA_DIR.'?cat=basket&ref_id='.$this->id_current; $edit_permission_link = LINPHA_DIR.'/admin/permissions.php?&cmd=edit&id='.$this->id_current; - switch($this->view) + switch($this->mode) { - case 'thumb_view': - case 'thumbdetail_view': + case 'thumb': foreach($GLOBALS['array_tn_sizes'] AS $value) { @@ -270,10 +264,10 @@ { $array_nr_links[] = Array('name' => $value, 'value' =>"javascript:set_nr_images('".$value."')"); } - foreach($GLOBALS['array_views'] AS $value) - { - $array_views_links[] = Array('name' => i18n($value), 'value' => $GLOBALS['linpha']->template->URL_full.'&view='.$value); - } + + $array_views_links[] = Array('name' => i18n('Normal'), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=thumb'); + $array_views_links[] = Array('name' => i18n('Detail'), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=thumbdetail'); + $GLOBALS['linpha']->template->output['menu_more'] = Array( Array( @@ -303,13 +297,13 @@ Array( 'name' => i18n("Metainfo"), 'value' => Array( - Array('name' => i18n("Edit Album Comment"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=comment'), + Array('name' => i18n("Edit Album Comment"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=albcomment'), Array('name' => i18n("Edit Album Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') ) ) ); break; - case 'img_view': + case 'image': $GLOBALS['linpha']->template->output['menu_more'] = Array( Array( @@ -528,29 +522,36 @@ /** - * print sub folders - * and calculate tot_photos + * print sub folders AND calculate tot_photos + * @todo should we show subfolders separate..? + * i think this is useless if we can set automatically view = thumbdetail */ function setSubFolders() { $output_folders = ''; $nr_folders = 0; + + if( ! isset($GLOBALS['linpha']->template->output['navigation'] ) ) + { + $GLOBALS['linpha']->template->output['navigation'] = ''; + } + if($GLOBALS['show_subfolders_separate']) { foreach($this->photos_filtered AS $key=>$value) { if($value['img_type'] == 0) { - $output_folders .= '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">'.$value['name'].'</a><br />'; + $GLOBALS['linpha']->template->output['navigation'] .= '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">'.$value['name'].'</a><br />'; $nr_folders++; } } } - if(! empty($output_folders)) - { - $GLOBALS['linpha']->template->output['navigation'] .= '<br /><br />'.$output_folders; - } + /** + * set tot_photos + * subtract number of folders if they are shown separate + */ $this->tot_photos = count($this->photos_filtered) - $nr_folders; } @@ -648,9 +649,41 @@ /** * setup comment view */ -function viewComment_view() +function viewAlbComment_view() { $GLOBALS['linpha']->template->setModuleName('view_comment'); + + /** + * save data + */ + if( isset( $_POST['cmd'] ) && $_POST['cmd']=="add_comment") + { + /** + * check if comment exists + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."meta_comments " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->id_current."'"); + + if($query->RecordCount()==0) // insert + { + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_comments (time, md5sum, author, comment)" . + "VALUES ('".time()."','".$GLOBALS['linpha']->imgview->id_current."','".linSql::linAddslashes($_POST['author'])."'," . + "'".linSql::linAddslashes($_POST['comment'])."')"); + } + else // update + { + $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."meta_comments SET ". + "time = '".time()."', ". + "author = '".linSql::linAddslashes($_POST['author'])."', " . + "comment = '".linSql::linAddslashes($_POST['comment'])."' " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->id_current."'"); + } + } + + /** + * get data + */ + $GLOBALS['linpha']->template->output['comment'] = $GLOBALS['linpha']->db->GetRow("SELECT id, time, author, comment FROM ".PREFIX."meta_comments"); } Modified: trunk/linpha2/lib/classes/linpha.template_new.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template_new.class.php 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/lib/classes/linpha.template_new.class.php 2006-03-26 20:32:20 UTC (rev 4436) @@ -13,7 +13,7 @@ function __construct() { $this->template_name = 'default'; - $this->output['title'] = "Linpha 2.0"; + $this->linpha_title = "Linpha 2.0"; } /** Modified: trunk/linpha2/lib/classes/thumbnails.js =================================================================== --- trunk/linpha2/lib/classes/thumbnails.js 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/lib/classes/thumbnails.js 2006-03-26 20:32:20 UTC (rev 4436) @@ -60,9 +60,9 @@ } /** - * set correct maindiv height + * set correct main height */ - document.getElementById('maindiv').style.height = linInnerHeight - document.getElementById('spacer_height')['offsetHeight']; + document.getElementById('main').style.height = linInnerHeight - document.getElementById('spacer_height')['offsetHeight']; /** * calculate nr of photos per page (from select form) @@ -70,12 +70,12 @@ switch( photos_per_page ) { case 'auto': - var nr_cols = Math.floor( document.getElementById('maindiv')['offsetWidth'] / (tn_size + img_spacer_width) ); - var nr_rows = Math.floor( document.getElementById('maindiv')['offsetHeight'] / (tn_size + img_spacer_height) ); + var nr_cols = Math.floor( document.getElementById('main')['offsetWidth'] / (tn_size + img_spacer_width) ); + var nr_rows = Math.floor( document.getElementById('main')['offsetHeight'] / (tn_size + img_spacer_height) ); var max_photos_per_page = nr_rows * nr_cols; break; case 'all': - var nr_cols = Math.floor( document.getElementById('maindiv')['offsetWidth'] / (tn_size + img_spacer_width) ); + var nr_cols = Math.floor( document.getElementById('main')['offsetWidth'] / (tn_size + img_spacer_width) ); var max_photos_per_page = tot_photos; var nr_rows = Math.ceil(max_photos_per_page / nr_cols); break; @@ -83,7 +83,7 @@ /** * ceil max_photos_per_page to complet the row! */ - var nr_cols = Math.floor( document.getElementById('maindiv')['offsetWidth'] / (tn_size + img_spacer_width) ); + var nr_cols = Math.floor( document.getElementById('main')['offsetWidth'] / (tn_size + img_spacer_width) ); var nr_rows = Math.ceil( photos_per_page / nr_cols); var max_photos_per_page = nr_rows * nr_cols; break; @@ -121,7 +121,7 @@ */ var img_nr = 1; var startup_img_nr = (current_page - 1)*max_photos_per_page; - document.getElementById("maindiv").innerHTML=''; + document.getElementById("main").innerHTML=''; for (i in img_ids) { @@ -196,7 +196,7 @@ var myText = document.createTextNode(img_ids[i]['fn']); myDiv.appendChild(myText); - document.getElementById("maindiv").appendChild(myDiv); + document.getElementById("main").appendChild(myDiv); img_nr++; } @@ -379,7 +379,7 @@ /** * write page numbers */ - DivPageNr = document.getElementById("page_nr"); + DivPageNr = document.getElementById("page_nr_middle"); DivPageNr.innerHTML=''; for(var i = 1; i <= nr_pages; i++) Modified: trunk/linpha2/lib/modules/module.albums.php =================================================================== --- trunk/linpha2/lib/modules/module.albums.php 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/lib/modules/module.albums.php 2006-03-26 20:32:20 UTC (rev 4436) @@ -37,7 +37,7 @@ /** * set navigation line */ - $GLOBALS['linpha']->template->output['navigation'] = set_navigation_line( $linpha->imgview->id_current ); + $GLOBALS['linpha']->template->output['title'] = set_navigation_line( $linpha->imgview->id_current ); /** Modified: trunk/linpha2/lib/modules/module.browse.php =================================================================== --- trunk/linpha2/lib/modules/module.browse.php 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/lib/modules/module.browse.php 2006-03-26 20:32:20 UTC (rev 4436) @@ -186,9 +186,9 @@ /** * write navigation and date links */ - $GLOBALS['linpha']->template->output['navigation'] = $str_navigation.'<br /><br />'.$str_datelinks; + $GLOBALS['linpha']->template->output['title'] = $str_navigation; + $GLOBALS['linpha']->template->output['navigation'] = $str_datelinks; - /** * get photos */ Modified: trunk/linpha2/templates/css/default/basket.css =================================================================== --- trunk/linpha2/templates/css/default/basket.css 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/css/default/basket.css 2006-03-26 20:32:20 UTC (rev 4436) @@ -1,4 +1,4 @@ -.main { +#main { margin-left: 10px; } Modified: trunk/linpha2/templates/css/default/global.css =================================================================== --- trunk/linpha2/templates/css/default/global.css 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/css/default/global.css 2006-03-26 20:32:20 UTC (rev 4436) @@ -1,4 +1,7 @@ <!-- +/** + * common definitions + */ body { font-family: arial, helvetica, sans-serif; margin: 0px; @@ -17,56 +20,102 @@ text-decoration: underline; } -.title { - background-color: #d5fcf4; - padding: 0; - border: 1px solid #0c9; - margin: 10px 10px 10px 10px; -} +/** + * title + */ + #divtitle { + margin-top: 10px; + height: 40px; + } + #title { + /* background-color: #d5fcf4;*/ + /* border: 1px solid #0c9;*/ + + position: absolute; + left: 50%; + width: 600px; + height: 40px; + margin-left: -300px; /* should be the half of 'width' */ + white-space: nowrap; + + /* padding: 0;*/ + /* margin: 10px 10px 10px 10px;*/ + + font-size: 25pt; + } + #title a:link, #title a:visited, #title a:hover { + color: #444444; + text-decoration: none; + } + #title a:hover { + text-decoration: underline; + } -.menu { - background-color: #ffd5ee; - border: 1px solid #f09; - margin: 10px; - z-index: 400; - padding: 5px; +/** + * left + */ + #left { + /* background-color: #ffd5ee;*/ + /* border: 1px solid #f09;*/ + + position: absolute; + top: 160px; + left: 10px; + + width: 205px; + min-height: 400px; + + padding: 5px; + margin: 0px; + } - height: 30px; -} +/** + * navigation + */ + #navigation { + /* background-color: #d5fcf4;*/ + /* border: 1px solid #0c9;*/ + padding: 0; + margin: 10px 10px 10px 10px; + } +/** + * main + */ + #divmain { + margin: 10px 10px 10px 10px; + } + #main { + /* background-color: #d5eeff;*/ + /* border: 1px solid #09f;*/ + padding: 5px; + } -.left { - position: absolute; - top: 200px; - left: 10px; - - width: 205px; - min-height: 400px; - - - padding: 5px; - margin: 0px; - - background-color: #ffd5ee; - - border: 1px solid #f09; -} - -.main { - background-color: #d5eeff; - padding: 5px; - border: 1px solid #09f; - margin: 10px 10px 10px 237px; -} - /** * menu * view http://www.tanfa.co.uk/css/examples/menu/tutorial-h.asp * the nicest one! */ + #divmenu { + /* background-color: #ffd5ee;*/ + /* border: 1px solid #f09;*/ + + margin-top: 5px; + + z-index: 400; + + height: 40px; + } + #menu { - width: 100%; + position: absolute; + left: 50%; + width: 600px; + height: 40px; + margin-left: -300px; /* should be the half of 'width' */ + + /*width: 100%;*/ float: left; } @@ -84,33 +133,48 @@ */ #menu a, #menu span { display: block; - border-width: 1px; + + margin: 0; + padding: 2px 3px; + +/* border-width: 1px; border-style: solid; border-color: #ccc #888 #555 #bbb; - margin: 0; - padding: 2px 3px; color: #fff; - background: #036; - text-decoration: none; + background: #036;*/ } /** * only first level elements */ #menu ul a, #menu ul span { + margin-left: 10px; + margin-right: 10px; + text-align: center; + text-decoration: none; + border-top: 1px solid #000000; + color: #000000; + background: #FFFFFF; } /** * only two or more level elements */ #menu ul ul a, #menu ul ul span { + margin: 0px; + text-align: left; + text-decoration: none; + + border: 1px solid #000000; + border-top-width: 0px; + background: #eeeeee; } #menu a:hover, #menu span:hover { - color: #fff; - background: #369; +/* color: #fff;*/ + background: #bbbbbb; } #menu li { @@ -141,4 +205,27 @@ div#menu ul ul li:hover ul, div#menu ul ul ul li:hover ul {display: block;} + +/** + * rounded corner stuff + * http://kalsey.com/2003/07/rounded_corners_in_css/ + */ + #divmain { + background-color: #f90; + } + + .roundtop { + background: url(../../html/images/tr.gif) no-repeat top right; + } + + .roundbottom { + background: url(../../html/images/br.gif) no-repeat top right; + } + + img.corner { + width: 15px; + height: 15px; + border: none; + display: block !important; + } --> \ No newline at end of file Modified: trunk/linpha2/templates/css/default/home.css =================================================================== --- trunk/linpha2/templates/css/default/home.css 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/css/default/home.css 2006-03-26 20:32:20 UTC (rev 4436) @@ -1,4 +1,4 @@ -.main { +#main { margin-left: 10px; } Modified: trunk/linpha2/templates/css/default/syslog.css =================================================================== --- trunk/linpha2/templates/css/default/syslog.css 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/css/default/syslog.css 2006-03-26 20:32:20 UTC (rev 4436) @@ -1,4 +1,4 @@ -.sys_log { +#sys_log { position: absolute; left: 15px; top: 15px; @@ -13,7 +13,7 @@ } -.sys_log_close { +#sys_log_close { position: absolute; right: 0; top: 0; Modified: trunk/linpha2/templates/css/default/view_img.css =================================================================== --- trunk/linpha2/templates/css/default/view_img.css 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/css/default/view_img.css 2006-03-26 20:32:20 UTC (rev 4436) @@ -1,3 +1,11 @@ +#navigation { + margin: 10px 10px 10px 237px; +} + +#main { + text-align: center; +} + .mainimage { width: 350px; height: auto; @@ -3,8 +11,4 @@ } -.main { - text-align: center; -} - /** * comment stuff Modified: trunk/linpha2/templates/css/default/view_meta.css =================================================================== --- trunk/linpha2/templates/css/default/view_meta.css 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/css/default/view_meta.css 2006-03-26 20:32:20 UTC (rev 4436) @@ -1,4 +1,4 @@ -.main { +#main { margin-left: 10px; text-align: left; } Modified: trunk/linpha2/templates/css/default/view_thumb.css =================================================================== --- trunk/linpha2/templates/css/default/view_thumb.css 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/css/default/view_thumb.css 2006-03-26 20:32:20 UTC (rev 4436) @@ -1,67 +1,67 @@ -.main { - margin-left: 10px; +#main { + min-height: 500px; /* @todo floated divs in thumb view without javascript doesnt count to the main div height */ } /** * need this to calculate heigh of main div * if you're gettings scrollbars, adjust the height! */ -.spacer_height { - height: 240px; +#spacer_height { + height: 200px; position: absolute; visibility: hidden; } -.imgdiv { - border: 1px #000000 solid; - margin: 3px; - text-align: center; - float: left; - font-size: 8pt; -} - -.img_thumbnail { - border: 0; - width: auto; -} - -.img_text { - padding-left: 10px; - text-align: left; -} - /** * page nr */ -.page_nr_spacer { - height: 45px; -} -.page_nr { - position: absolute; - margin-top: 5px; - left: 50%; - width: 530px; - height: 55px; - margin-left: -265px; /* should be the half of 'width' */ + #divpage_nr { + margin-top: 5px; + height: 35px; + } + + #page_nr { + position: absolute; + left: 50%; + width: 530px; + height: 35px; + margin-left: -265px; /* should be the half of 'width' */ + + /* border: 1px #000000 solid;*/ + } + .page_nr_divs { + float: left; + margin-left: 5px; + margin-right: 5px; + padding-left: 10px; + padding-right: 10px; - border: 1px #000000 solid; -} -.page_nr_divs { - float: left; -/* border: 1px #000000 solid; */ - margin: 5px; - padding: 10px; - height: 25px; - width: 40px; - white-space: nowrap; -} -.page_nr_maindiv { - width: 350px; - text-align: center; -} +/* height: 25px;*/ + width: 40px; + white-space: nowrap; + } + .page_nr_maindiv { + width: 350px; + text-align: center; + } - - -.main { - min-height: 500px; /* @todo floated divs in thumb view without javascript doesnt count to the main div height */ -} \ No newline at end of file +/** + * thumbnails + */ + .imgdiv { + /* border: 1px #000000 solid;*/ + margin: 3px; + text-align: center; + float: left; + font-size: 8pt; + } + + .img_thumbnail { + border: 0; + width: auto; + } + + .img_text { + padding-left: 10px; + text-align: left; + } \ No newline at end of file Modified: trunk/linpha2/templates/css/default/view_thumbdetail.css =================================================================== --- trunk/linpha2/templates/css/default/view_thumbdetail.css 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/css/default/view_thumbdetail.css 2006-03-26 20:32:20 UTC (rev 4436) @@ -1,3 +1,10 @@ +#navigation { + background-color: #d5fcf4; + padding: 0; + border: 1px solid #0c9; + margin: 10px 10px 10px 237px; +} + .div_folder { position: relative; margin: 2px; Modified: trunk/linpha2/templates/html/default/basket.html.php =================================================================== --- trunk/linpha2/templates/html/default/basket.html.php 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/html/default/basket.html.php 2006-03-26 20:32:20 UTC (rev 4436) @@ -1,4 +1,3 @@ - <form name="basket" action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>&cmd=remove_selected" method="POST"> <div class='navigation'> <a href="<?php echo LINPHA_DIR.'/?cat=alb&id='.$_GET['ref_id']; ?>"><?php echo i18n("Go Back"); ?></a> @@ -8,7 +7,7 @@ <?php echo i18n("Images in basket");?>: <?php echo count($_SESSION['basket_ids']); ?> </div> -<div id='maindiv' class='main'> +<div id="main"> <?php if( count($_SESSION['basket_ids']) > 0 ) { ?> Modified: trunk/linpha2/templates/html/default/global.html.php =================================================================== --- trunk/linpha2/templates/html/default/global.html.php 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/html/default/global.html.php 2006-03-26 20:32:20 UTC (rev 4436) @@ -7,7 +7,7 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> -<title><?php echo $GLOBALS['linpha']->template->output['title']; ?></title> +<title><?php echo $GLOBALS['linpha']->template->linpha_title; ?></title> <!-- css includes --> <link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/css/'.$GLOBALS['linpha']->template->template_name.'/global.css'; ?>' type='text/css'> @@ -20,13 +20,15 @@ <?php $GLOBALS['linpha']->template->includeFile('head'); ?> </head> + + <body> <?php if( isset($GLOBALS['linpha']->template->output['sys_log']) ) { ?> <!-- syslog --> - <div id="sys_log" class="sys_log"> + <div id="sys_log"> <div class="sys_log_close"><a href="javascript:toggleWindow()">X</a></div> - <div id="sys_log_text" class="sys_log_text"> + <div id="sys_log_text"> <?php echo i18n("Linpha Syslog"); ?>:<br /> <?php echo $GLOBALS['linpha']->template->output['sys_log']; ?> </div> @@ -35,56 +37,62 @@ <?php } ?> <!-- title/navigation --> -<div id="header" class="title"> - <h1><?php echo $GLOBALS['linpha']->template->output['title']." :: ".$GLOBALS['linpha']->template->output['navigation']; ?></h1> +<div id="divtitle"> +<div id="title"> + <?php echo $GLOBALS['linpha']->template->linpha_title." :: ".$GLOBALS['linpha']->template->output['title']; ?> </div> +</div> <!-- menu --> -<div class="menu"> - <div id="menu"> - <ul> - <li><a href="./"><?php echo i18n("Home"); ?></a></li> - </ul> - <ul> - <li><a href="./admin/"><?php echo i18n("Admin"); ?></a></li> - </ul> - <ul> - <li><span><?php echo i18n("Search"); ?> v</span> - <ul> - <li><a href="./?cat=search"><?php echo i18n("Extended Search"); ?></a></li> - <li> - <span> - <input type="text" name="search" value="" /> - <input type="submit" name="submit" value="<?php echo i18n("Search"); ?>" /> - </span> - </li> - </ul> - </li> - </ul> - <ul> - <li> - <span><?php echo i18n("Login"); ?> v</span> - <ul> - <li> - <span> - <?php echo i18n("Username"); ?>: <input type="text" name="username" value="" /><br /> - <?php echo i18n("Password"); ?>: <input type="password" name="password" value="" /><br /> - <input type="submit" name="submit" value="<?php echo i18n("Login"); ?>" /> - </span> - </li> - </ul> - </li> - </ul> - <?php - /** - * Print "More"-menu entry - */ - if( isset( $GLOBALS['linpha']->template->output['menu_more'] ) ) { - $GLOBALS['linpha']->template->printMenu('more'); - } - ?> - </div> +<!-- +need an outer div for the correct height, because elements in #menu are floated +and doesn't count to the this elements height +--> +<div id="divmenu"> +<div id="menu"> + <ul> + <li><a href="./"><?php echo i18n("Home"); ?></a></li> + </ul> + <ul> + <li><a href="./admin/"><?php echo i18n("Admin"); ?></a></li> + </ul> + <ul> + <li><span><?php echo i18n("Search"); ?> v</span> + <ul> + <li><a href="./?cat=search"><?php echo i18n("Extended Search"); ?></a></li> + <li> + <span> + <input type="text" name="search" value="" /> + <input type="submit" name="submit" value="<?php echo i18n("Search"); ?>" /> + </span> + </li> + </ul> + </li> + </ul> + <ul> + <li> + <span><?php echo i18n("Login"); ?> v</span> + <ul> + <li> + <span> + <?php echo i18n("Username"); ?>: <input type="text" name="username" value="" /><br /> + <?php echo i18n("Password"); ?>: <input type="password" name="password" value="" /><br /> + <input type="submit" name="submit" value="<?php echo i18n("Login"); ?>" /> + </span> + </li> + </ul> + </li> + </ul> + <?php + /** + * Print "More"-menu entry + */ + if( isset( $GLOBALS['linpha']->template->output['menu_more'] ) ) { + $GLOBALS['linpha']->template->printMenu('more'); + } + ?> </div> +</div> <!-- end menu --> <?php $GLOBALS['linpha']->template->includeFile('body'); ?> Modified: trunk/linpha2/templates/html/default/home.html.php =================================================================== --- trunk/linpha2/templates/html/default/home.html.php 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/html/default/home.html.php 2006-03-26 20:32:20 UTC (rev 4436) @@ -1,5 +1,10 @@ -<div id='maindiv' class='main'> +<div id="divmain"> + <div class="roundtop"> + <img src="templates/html/images/tl.gif" alt="" width="15" height="15" class="corner" style="display: none" /> + </div> +<div id="main"> + <h1><?php echo i18n("Welcome"); ?></h1> <br /><br /><br /> @@ -40,7 +45,7 @@ <div class='div_folder_text'> <h2><?php echo $value['name']; ?></h2> - <?php echo $value['stats_numbers']. i18n("Photos"); ?> + <?php echo $value['stats_numbers'].' '.i18n("Photos"); ?> <br /> <?php echo strftime("%x %X",$value['time_add']); ?> @@ -52,3 +57,7 @@ ?> </div> + <div class="roundbottom"> + <img src="templates/html/images/bl.gif" alt="" width="15" height="15" class="corner" style="display: none" /> + </div> +</div> \ No newline at end of file Modified: trunk/linpha2/templates/html/default/view_basket.html.php =================================================================== --- trunk/linpha2/templates/html/default/view_basket.html.php 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/html/default/view_basket.html.php 2006-03-26 20:32:20 UTC (rev 4436) @@ -1,4 +1,4 @@ -<div class="left"> +<div id="left"> left<br />left<br />left<br />left<br />left<br />left<br /> left<br />left<br />left<br />left<br />left<br />left<br /> </div> @@ -12,7 +12,7 @@ <div class='page_nr' id='page_nr_left'><?php echo $GLOBALS['linpha']->template->output['page_nr_left']; ?></div> </div> -<div class="navigation"> +<div id="navigation"> <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> <br /><br /> <?php echo i18n("Images In Basket"); ?>: <?php echo count($_SESSION['basket_ids']); ?> @@ -22,7 +22,7 @@ </div> <form name='basket' action='<?php echo LINPHA_DIR.'/?cat=basket&cmd=add_selected&ref_id='.$GLOBALS['linpha']->imgview->id_current; ?>' method='POST'> -<div id='maindiv' class='main'> +<div id="main"> <?php $i = 1; foreach($GLOBALS['linpha']->imgview->photos_show AS $value) Modified: trunk/linpha2/templates/html/default/view_comment.html.php =================================================================== --- trunk/linpha2/templates/html/default/view_comment.html.php 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/html/default/view_comment.html.php 2006-03-26 20:32:20 UTC (rev 4436) @@ -1,43 +1,12 @@ -<?php - -if( isset( $_POST['cmd'] ) ) -{ - /** - * check if comment exists - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."meta_comments " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->id_current."'"); - - if($query->RecordCount()==0) // insert - { - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_comments (time, md5sum, author, comment)" . - "VALUES ('".time()."','".$GLOBALS['linpha']->imgview->id_current."','".linSql::linAddslashes($_POST['author'])."'," . - "'".linSql::linAddslashes($_POST['comment'])."')"); - } - else // update - { - $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."meta_comments SET ". - "time = '".time()."', ". - "author = '".linSql::linAddslashes($_POST['author'])."', " . - "comment = '".linSql::linAddslashes($_POST['comment'])."' " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->id_current."'"); - } -} -?> - -<?php -$data = $GLOBALS['linpha']->db->GetRow("SELECT id, time, author, comment FROM ".PREFIX."meta_comments"); -?> - -<div id='maindiv' class='main'> +<div id="main"> <form action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" method="POST"> <a href="<?php echo $GLOBALS['linpha']->template->URL_full.'&view=thumb'; ?>">back</a> <br /><br /> Author: -<input type="text" name="author" value="<?php echo $data['author']; ?>" size="40" maxlength="40" /> +<input type="text" name="author" value="<?php echo $GLOBALS['linpha']->template->output['comment']['author']; ?>" size="40" maxlength="40" /> <br /> -<textarea name="comment" rows="10" cols="50"><?php echo $data['comment']; ?></textarea> +<textarea name="comment" rows="10" cols="50"><?php echo $GLOBALS['linpha']->template->output['comment']['comment']; ?></textarea> <br /> <input type="hidden" name="cmd" value="add_comment" /> <input type="submit" name="submit" value="submit" /> Modified: trunk/linpha2/templates/html/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/html/default/view_img.html.php 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/html/default/view_img.html.php 2006-03-26 20:32:20 UTC (rev 4436) @@ -1,4 +1,4 @@ -<div class="left"> +<div id="left"> <?php foreach($GLOBALS['linpha']->template->output['image_infos'] AS $value) { @@ -7,6 +7,12 @@ ?> </div> +<?php if(isset($GLOBALS['linpha']->template->output['navigation']) && !empty($GLOBALS['linpha']->template->output['navigation'])) { ?> +<div id="navigation"> + <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> +</div> +<?php } ?> + <div class="div_all_main"> <div class="div_all_prevthumb"> <?php echo $GLOBALS['linpha']->template->output['prev_thumb']; ?> @@ -17,26 +23,29 @@ </div> </div> -<div id='maindiv' class='main'> +<div id="main"> + +<!-- show image --> <?php echo $GLOBALS['linpha']->template->output['image']; ?> <br /><br /> +<!-- show add comment form --> <div class="add_comment"> <form action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" method="POST"> <?php echo i18n("Add Comment"); ?>:<br /> <div id="comment_div_text"> -<input type="text" id="comment_input_text" name="comment_text" value="" size="40" maxlength="40" /> +<input type="text" id="comment_input_text" name="comment_text" value="" tabindex="1" size="40" maxlength="40" /> <a href="javascript:open_textarea()">(+)</a> </div> -<textarea style="display: none;" id="comment_textarea" name="comment_textarea" rows="10" cols="50"></textarea> -<?php echo i18n("Name"); ?>: <input type="text" name="author" value="" size="10" maxlength="40" /> +<textarea style="display: none;" id="comment_textarea" name="comment_textarea" tabindex="1" rows="10" cols="50"></textarea> +<?php echo i18n("Name"); ?>: <input type="text" name="author" value="" tabindex="2" size="10" maxlength="40" /> <input type="hidden" name="cmd" value="add_comment" /> <input type="submit" name="submit" value="<?php echo i18n("submit"); ?>" /> </form> </div> <br /><br /> -<!-- show image comments //--> +<!-- show image comments --> <?php while($data = $GLOBALS['linpha']->template->output['image_comments']->FetchRow()) { ?> <div class="comments"> <?php echo $data['time']; ?> <?php echo $data['author']; ?> @@ -48,7 +57,7 @@ </div> -<script language="Javascript"> +<script language="JavaScript" type="text/javascript"> function open_textarea() { document.getElementById('comment_textarea').style.display = 'block'; Modified: trunk/linpha2/templates/html/default/view_meta.head.php =================================================================== --- trunk/linpha2/templates/html/default/view_meta.head.php 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/html/default/view_meta.head.php 2006-03-26 20:32:20 UTC (rev 4436) @@ -3,4 +3,4 @@ * use all definitions from view_img.css, and append here view_meta.css */ ?> -<link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/css/'.$GLOBALS['linpha']->template->template_name.'/view_meta.css'; ?>' type='text/css'> \ No newline at end of file +<link rel="stylesheet" href="<?php echo LINPHA_DIR.'/templates/css/'.$GLOBALS['linpha']->template->template_name.'/view_meta.css'; ?>" type="text/css" /> \ No newline at end of file Modified: trunk/linpha2/templates/html/default/view_meta.html.php =================================================================== --- trunk/linpha2/templates/html/default/view_meta.html.php 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/html/default/view_meta.html.php 2006-03-26 20:32:20 UTC (rev 4436) @@ -8,7 +8,7 @@ </div> </div> -<div id='maindiv' class='main'> +<div id="main"> <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/html/default/view_thumb.html.php =================================================================== --- trunk/linpha2/templates/html/default/view_thumb.html.php 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/html/default/view_thumb.html.php 2006-03-26 20:32:20 UTC (rev 4436) @@ -10,19 +10,38 @@ window.onresize = display_images; </script> - <div class="page_nr"> - <div class="page_nr_divs" id='page_nr_left'>left</div> - <div class="page_nr_divs page_nr_maindiv" id='page_nr'>page nr middle</div> - <div class="page_nr_divs" id='page_nr_right'>right</div> + <?php if(isset($GLOBALS['linpha']->template->output['navigation']) && !empty($GLOBALS['linpha']->template->output['navigation'])) { ?> + <div id="navigation"> + <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> </div> - <div class="page_nr_spacer"></div> - - <div id='spacer_height' class='spacer_height'> + <?php } ?> + + <!-- + need an outer div for the correct height, because elements in #page_nr are floated + and doesn't count to the this elements height + --> + <div id="divpage_nr"> + <div id="page_nr"> + <div class="page_nr_divs" id="page_nr_left">left</div> + <div class="page_nr_divs page_nr_maindiv" id="page_nr_middle">page nr middle</div> + <div class="page_nr_divs" id="page_nr_right">right</div> </div> + </div> - <div id='maindiv' class='main'> + <div id="spacer_height"> </div> + <div id="divmain"> + <div class="roundtop"> + <img src="templates/html/images/tl.gif" alt="" width="15" height="15" class="corner" style="display: none" /> + </div> + <div id="main"> + </div> + <div class="roundbottom"> + <img src="templates/html/images/bl.gif" alt="" width="15" height="15" class="corner" style="display: none" /> + </div> + </div> + <script language="JavaScript" type="text/javascript"> display_images(); </script> @@ -41,15 +60,19 @@ //--> </script> - <div class="page_nr_main"> - <!-- cannot use floated div in another div !! - in this div it is possible because it has position: absolute --> - <div class='page_nr' id='page_nr_right'><?php echo $GLOBALS['linpha']->template->output['page_nr_right']; ?></div> - <div class='page_nr' id='page_nr' style="width: 350px; text-align: center;"><?php echo $GLOBALS['linpha']->template->output['page_nr']; ?></div> - <div class='page_nr' id='page_nr_left'><?php echo $GLOBALS['linpha']->template->output['page_nr_left']; ?></div> + <?php if(isset($GLOBALS['linpha']->template->output['navigation']) && !empty($GLOBALS['linpha']->template->output['navigation'])) { ?> + <div id="navigation"> + <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> </div> + <?php } ?> + + <div id="page_nr"> + <div class="page_nr_divs" id="page_nr_right"><?php echo $GLOBALS['linpha']->template->output['page_nr_right']; ?></div> + <div class="page_nr_divs page_nr_maindiv" id="page_nr"><?php echo $GLOBALS['linpha']->template->output['page_nr']; ?></div> + <div class="page_nr_divs" id="page_nr_left"><?php echo $GLOBALS['linpha']->template->output['page_nr_left']; ?></div> + </div> - <div id='maindiv' class='main'> + <div id="main"> <?php $i = 1; foreach($GLOBALS['linpha']->imgview->photos_show AS $value) @@ -67,9 +90,9 @@ } $i++; ?> - <div style='width: <?php echo $GLOBALS['def_tn_size']; ?>px; height: <?php echo $GLOBALS['def_tn_size']; ?>px; <?php echo $str_clear; ?>' class='imgdiv'> - <a href='./?cat=alb&id=<?php echo $value['id']; ?>'> - <img height='<?php echo ($GLOBALS['def_tn_size']-20); ?>' src='./get_thumb.php?id=<?php echo $value['id']; ?>' class='img_thumbnail' /> + <div style="width: <?php echo $GLOBALS['def_tn_size']; ?>px; height: <?php echo $GLOBALS['def_tn_size']; ?>px; <?php echo $str_clear; ?>" class="imgdiv"> + <a href="./?cat=alb&id=<?php echo $value['id']; ?>"> + <img height="<?php echo ($GLOBALS['def_tn_size']-20); ?>" src="./get_thumb.php?id=<?php echo $value['id']; ?>" class="img_thumbnail" /> </a> <br /><?php echo $value['name']; ?> </div> Modified: trunk/linpha2/templates/html/default/view_thumbdetail.html.php =================================================================== --- trunk/linpha2/templates/html/default/view_thumbdetail.html.php 2006-03-25 13:08:27 UTC (rev 4435) +++ trunk/linpha2/templates/html/default/view_thumbdetail.html.php 2006-03-26 20:32:20 UTC (rev 4436) @@ -1,10 +1,17 @@ -<div class="left"> +<div id="left"> left<br />left<br />left<br />left<br />left<br />left<br /> left<br />left<br />left<br />left<br />left<br />left<br /> </div> -<div id='maindiv' class='main'> +<?php if(isset($GLOBALS['linpha']->template->output['navigation']) && !empty($GLOBALS['linpha']->template->output['navigation'])) { ?> +<div id="navigation"> + <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> +</div> +<?php } ?> + +<div id="main"> + <?php foreach($GLOBALS['linpha']->imgview->photos_filtered AS $key=>$value) { @@ -16,11 +23,22 @@ <div class='div_folder_text'> <h2><?php echo $value['name']; ?></h2> - <?php echo $value['stats_numbers']. i18n("Photos"); ?> + <?php if($value['img_type']==0) { ?> - <br /> - <?php echo strftime("%x %X",$value['time_add']); ?> + <!-- folder view --> + <?php echo $value['stats_numbers'].' '.i18n("Photos"); ?> + <br /> + <?php echo strftime("%x %X",$value['time_add']); ?> + <?php } else { ?> + + <!-- file view --> + <?php echo strftime("%x %X",$value['time_add']); ?> + + <?php } ?> + + + </div> </div> <?php Added: trunk/linpha2/templates/html/images/bl.gif =================================================================== (Binary files differ) Property changes on: trunk/linpha2/templates/html/images/bl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/templates/html/images/br.gif =================================================================== (Binary files differ) Property changes on: trunk/linpha2/templates/html/images/br.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/templates/html/images/tl.gif =================================================================== (Binary files differ) Property changes on: trunk/linpha2/templates/html/images/tl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/templates/html/images/tr.gif =================================================================== (Binary files differ) Property changes on: trunk/linpha2/templates/html/images/tr.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-03-29 13:12:11
|
Revision: 4451 Author: fangehrn Date: 2006-03-29 05:11:38 -0800 (Wed, 29 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4451&view=rev Log Message: ----------- * rearanged templates Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index_template.php trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/classes/thumbnails.js trunk/linpha2/lib/modules/module.basket.php trunk/linpha2/linpha2.specs.txt trunk/linpha2/templates/default/css/global.css trunk/linpha2/templates/default/css/view_thumb.css trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/home.html.php trunk/linpha2/templates/default/view_meta.head.php trunk/linpha2/templates/default/view_thumb.html.php trunk/linpha2/templates/default_old/index.php trunk/linpha2/templates/default_old/main.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/ChangeLog 2006-03-29 13:11:38 UTC (rev 4451) @@ -1,3 +1,6 @@ +2006-03-29 flo + * rearanged templates + 2006-03-26 flo * applying bastian's theme * added "more" menu entry Modified: trunk/linpha2/index_template.php =================================================================== --- trunk/linpha2/index_template.php 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/index_template.php 2006-03-29 13:11:38 UTC (rev 4451) @@ -37,7 +37,7 @@ // "<lib/include/dbconnect.php> in $_SERVER[SCRIPT_FILENAME]"); //} - if(!include_once(LINPHA_DIR.'/templates/default/main.php')) + if(!include_once(LINPHA_DIR.'/templates/default_old/main.php')) { throw new Exception ("ERROR: failed to include " . "</templates/default/main.php><br>LOCATION: index.php"); Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/lib/classes/linpha.class.php 2006-03-29 13:11:38 UTC (rev 4451) @@ -43,7 +43,7 @@ } include_once(LINPHA_DIR.'/lib/classes/linpha.sql.class.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.template_new.class.php'); +include_once(LINPHA_DIR.'/lib/classes/linpha.template.class.php'); include_once(LINPHA_DIR.'/lib/classes/linpha.image.class.php'); include_once(LINPHA_DIR.'/lib/classes/linpha.filesys.class.php'); Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-29 13:11:38 UTC (rev 4451) @@ -205,7 +205,7 @@ break; } - include_once(LINPHA_DIR.'/templates/html/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); + include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); } @@ -356,8 +356,8 @@ if(isset($_GET['use_js'])) { $this->use_javascript = 1; - $GLOBALS['linpha']->template->URL_base .= '&use_js=1'; - $GLOBALS['linpha']->template->URL_full .= '&use_js=1'; + $GLOBALS['linpha']->template->URL_base .= '&use_js=1'; + $GLOBALS['linpha']->template->URL_full .= '&use_js=1'; $GLOBALS['linpha']->template->output['page_nr_left'] = ''; $GLOBALS['linpha']->template->output['page_nr_right'] = ''; $GLOBALS['linpha']->template->output['page_nr'] = ''; Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2006-03-29 13:11:38 UTC (rev 4451) @@ -24,13 +24,13 @@ switch($what) { case 'body': - $filename = LINPHA_DIR.'/templates/html/'.$this->template_name.'/'.$this->body_name.'.html.php'; + $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/'.$this->body_name.'.html.php'; break; case 'head': - $filename = LINPHA_DIR.'/templates/html/'.$this->template_name.'/'.$this->head_name.'.head.php'; + $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/'.$this->head_name.'.head.php'; break; case 'css': - echo LINPHA_DIR.'/templates/css/'.$this->template_name.'/'.$this->css_name.'.css'; + echo LINPHA_DIR.'/templates/'.$this->template_name.'/css/'.$this->css_name.'.css'; break; } Modified: trunk/linpha2/lib/classes/thumbnails.js =================================================================== --- trunk/linpha2/lib/classes/thumbnails.js 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/lib/classes/thumbnails.js 2006-03-29 13:11:38 UTC (rev 4451) @@ -1,17 +1,3 @@ -/* -Important links (dont delete!) -http://de.selfhtml.org/javascript/beispiele/fensterueberwachen.htm -http://www.quirksmode.org/viewport/ !! -http://css.maxdesign.com.au/floatutorial/ Float Tutorial -http://www.csszengarden.com/tr/deutsch - -http://www.thestyleworks.de/tut-art/layout_div.shtml sehr ausf?hrlich! - -max-width in IE: -http://www.svendtofte.com/code/max_width_in_ie/ - -*/ - var current_page = startup_page var nr_pages = 0; Modified: trunk/linpha2/lib/modules/module.basket.php =================================================================== --- trunk/linpha2/lib/modules/module.basket.php 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/lib/modules/module.basket.php 2006-03-29 13:11:38 UTC (rev 4451) @@ -106,5 +106,5 @@ $linpha->template->setModuleName('basket'); $linpha->template->URL_full = LINPHA_DIR.'/?cat=basket&ref_id='.$_GET['ref_id']; -include_once(LINPHA_DIR.'/templates/html/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); +include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); ?> \ No newline at end of file Modified: trunk/linpha2/linpha2.specs.txt =================================================================== --- trunk/linpha2/linpha2.specs.txt 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/linpha2.specs.txt 2006-03-29 13:11:38 UTC (rev 4451) @@ -69,7 +69,20 @@ - getID3 for all Video stuff - PHPThumb for all image related manipulation (needs testing!) + Links: + CSS/ Javascript + - Rounded Corners http://kalsey.com/2003/07/rounded_corners_in_css/ + - Menu http://www.tanfa.co.uk/css/examples/menu/tutorial-h.asp + - CSS Zen Garden http://www.csszengarden.com/tr/deutsch + - Float Tutorial http://css.maxdesign.com.au/floatutorial/ + - CSS Layouts, sehr ausfuehrlich http://www.thestyleworks.de/tut-art/layout_div.shtml + - http://www.quirksmode.org/viewport/ !! + - max-width in IE: http://www.svendtofte.com/code/max_width_in_ie/ + - Fenster ueberwachen http://de.selfhtml.org/javascript/beispiele/fensterueberwachen.htm + + + Part 5: Folder Structure ============================================================================== actions/ @@ -258,10 +271,6 @@ ############################################################################ Open questions ############################################################################ -- store thumbnails in /var/cache/thumb? - - id or md5sum based? - /* edit bzrudi */ - (as discussed it should be id based...) - thumbnail size, set a max size (for example 150px), to be able to switch the size on fly @@ -332,6 +341,11 @@ DONE ==== + - store thumbnails in /var/cache/thumb? + - id or md5sum based? + /* edit bzrudi */ + (as discussed it should be id based...) + - allow unlimited subfolders - allow permissions set to all files and folders Modified: trunk/linpha2/templates/default/css/global.css =================================================================== --- trunk/linpha2/templates/default/css/global.css 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/templates/default/css/global.css 2006-03-29 13:11:38 UTC (rev 4451) @@ -25,6 +25,7 @@ */ #divtitle { margin-top: 10px; + margin-bottom: 20px; height: 40px; } #title { @@ -83,29 +84,25 @@ * main */ #divmain { - margin: 10px 10px 10px 10px; + margin: 0px 10px 10px 10px; } #main { - /* background-color: #d5eeff;*/ - /* border: 1px solid #09f;*/ - padding: 5px; + /*background-color: #d5eeff;*/ + /*border: 1px solid #09f;*/ + padding: 5px; } /** * menu - * view http://www.tanfa.co.uk/css/examples/menu/tutorial-h.asp - * the nicest one! */ #divmenu { /* background-color: #ffd5ee;*/ /* border: 1px solid #f09;*/ - margin-top: 5px; - z-index: 400; - height: 40px; + height: 30px; } #menu { @@ -208,18 +205,17 @@ /** * rounded corner stuff - * http://kalsey.com/2003/07/rounded_corners_in_css/ */ #divmain { background-color: #f90; } .roundtop { - background: url(../../html/images/tr.gif) no-repeat top right; + background: url(../images/tr.gif) no-repeat top right; } .roundbottom { - background: url(../../html/images/br.gif) no-repeat top right; + background: url(../images/br.gif) no-repeat top right; } img.corner { Modified: trunk/linpha2/templates/default/css/view_thumb.css =================================================================== --- trunk/linpha2/templates/default/css/view_thumb.css 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/templates/default/css/view_thumb.css 2006-03-29 13:11:38 UTC (rev 4451) @@ -1,5 +1,5 @@ #main { - min-height: 500px; /* @todo floated divs in thumb view without javascript doesnt count to the main div height */ + min-height: 500px; @todo floated divs in thumb view without javascript doesnt count to the main div height */ } /** Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/templates/default/global.html.php 2006-03-29 13:11:38 UTC (rev 4451) @@ -10,11 +10,11 @@ <title><?php echo $GLOBALS['linpha']->template->linpha_title; ?></title> <!-- css includes --> -<link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/css/'.$GLOBALS['linpha']->template->template_name.'/global.css'; ?>' type='text/css'> +<link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/css/global.css'; ?>' type='text/css'> <link rel='stylesheet' href='<?php $GLOBALS['linpha']->template->includeFile('css'); ?>' type='text/css'> <?php if( isset($GLOBALS['linpha']->template->output['sys_log'])) { ?> - <link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/css/'.$GLOBALS['linpha']->template->template_name.'/syslog.css'; ?>' type='text/css'> + <link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/css/syslog.css'; ?>' type='text/css'> <?php } ?> <?php $GLOBALS['linpha']->template->includeFile('head'); ?> Modified: trunk/linpha2/templates/default/home.html.php =================================================================== --- trunk/linpha2/templates/default/home.html.php 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/templates/default/home.html.php 2006-03-29 13:11:38 UTC (rev 4451) @@ -1,6 +1,6 @@ <div id="divmain"> <div class="roundtop"> - <img src="templates/html/images/tl.gif" alt="" width="15" height="15" class="corner" style="display: none" /> + <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"> @@ -58,6 +58,6 @@ </div> <div class="roundbottom"> - <img src="templates/html/images/bl.gif" alt="" width="15" height="15" class="corner" style="display: none" /> + <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> \ No newline at end of file Modified: trunk/linpha2/templates/default/view_meta.head.php =================================================================== --- trunk/linpha2/templates/default/view_meta.head.php 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/templates/default/view_meta.head.php 2006-03-29 13:11:38 UTC (rev 4451) @@ -3,4 +3,4 @@ * use all definitions from view_img.css, and append here view_meta.css */ ?> -<link rel="stylesheet" href="<?php echo LINPHA_DIR.'/templates/css/'.$GLOBALS['linpha']->template->template_name.'/view_meta.css'; ?>" type="text/css" /> \ No newline at end of file +<link rel="stylesheet" href="<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/css/view_meta.css'; ?>" type="text/css" /> \ No newline at end of file Modified: trunk/linpha2/templates/default/view_thumb.html.php =================================================================== --- trunk/linpha2/templates/default/view_thumb.html.php 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/templates/default/view_thumb.html.php 2006-03-29 13:11:38 UTC (rev 4451) @@ -1,20 +1,33 @@ -<?php -/** - * javascript enabled - */ -if($GLOBALS['linpha']->imgview->use_javascript) -{ -?> - <script language="JavaScript" type="text/javascript"> +<script language="JavaScript" type="text/javascript"> +<!-- + <?php // javascript enabled + if($GLOBALS['linpha']->imgview->use_javascript) { + ?> window.onresize = display_images; - </script> + <?php + } else { // javascript disabled + ?> + location.href = "<?php echo convert_amp($GLOBALS['linpha']->template->URL_full.'&use_js=1'); ?>"; + <?php + } + ?> +//--> +</script> - <?php if(isset($GLOBALS['linpha']->template->output['navigation']) && !empty($GLOBALS['linpha']->template->output['navigation'])) { ?> - <div id="navigation"> - <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> +<?php if(isset($GLOBALS['linpha']->template->output['navigation']) && !empty($GLOBALS['linpha']->template->output['navigation'])) { ?> +<div id="navigation"> + <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> +</div> +<?php } ?> + +<div id="spacer_height"> +</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> - <?php } ?> <!-- need an outer div for the correct height, because elements in #page_nr are floated @@ -22,84 +35,54 @@ --> <div id="divpage_nr"> <div id="page_nr"> - <div class="page_nr_divs" id="page_nr_left">left</div> - <div class="page_nr_divs page_nr_maindiv" id="page_nr_middle">page nr middle</div> - <div class="page_nr_divs" id="page_nr_right">right</div> + <div id="page_nr_left" class="page_nr_divs"><?php echo $GLOBALS['linpha']->template->output['page_nr_left']; ?></div> + <div id="page_nr_middle" class="page_nr_divs page_nr_maindiv"><?php echo $GLOBALS['linpha']->template->output['page_nr']; ?></div> + <div id="page_nr_right" class="page_nr_divs"><?php echo $GLOBALS['linpha']->template->output['page_nr_right']; ?></div> </div> </div> - - <div id="spacer_height"> - </div> - - <div id="divmain"> - <div class="roundtop"> - <img src="templates/html/images/tl.gif" alt="" width="15" height="15" class="corner" style="display: none" /> - </div> - <div id="main"> - </div> - <div class="roundbottom"> - <img src="templates/html/images/bl.gif" alt="" width="15" height="15" class="corner" style="display: none" /> - </div> - </div> - - <script language="JavaScript" type="text/javascript"> - display_images(); - </script> -<?php -} -else -{ -/** - * javascript disabled - */ -?> - <script language="JavaScript" type="text/javascript"> - <!-- - location.href = "<?php echo convert_amp($GLOBALS['linpha']->template->URL_full.'&use_js=1'); ?>"; - //--> - </script> - - <?php if(isset($GLOBALS['linpha']->template->output['navigation']) && !empty($GLOBALS['linpha']->template->output['navigation'])) { ?> - <div id="navigation"> - <?php echo $GLOBALS['linpha']->template->output['navigation']; ?> - </div> - <?php } ?> - - <div id="page_nr"> - <div class="page_nr_divs" id="page_nr_right"><?php echo $GLOBALS['linpha']->template->output['page_nr_right']; ?></div> - <div class="page_nr_divs page_nr_maindiv" id="page_nr"><?php echo $GLOBALS['linpha']->template->output['page_nr']; ?></div> - <div class="page_nr_divs" id="page_nr_left"><?php echo $GLOBALS['linpha']->template->output['page_nr_left']; ?></div> - </div> - <div id="main"> - <?php - $i = 1; - foreach($GLOBALS['linpha']->imgview->photos_show AS $value) + <?php // javascript disabled + if( ! $GLOBALS['linpha']->imgview->use_javascript) { - /** - * add clear float to last div on row - */ - if( ($i-1) % $GLOBALS['no_js_nr_cols'] == 0) + $i = 1; + foreach($GLOBALS['linpha']->imgview->photos_show AS $value) { - $str_clear = ' clear: left;'; + /** + * add clear float to last div on row + */ + if( ($i-1) % $GLOBALS['no_js_nr_cols'] == 0) + { + $str_clear = ' clear: left;'; + } + else + { + $str_clear = ''; + } + $i++; + ?> + <div style="width: <?php echo $GLOBALS['def_tn_size']; ?>px; height: <?php echo $GLOBALS['def_tn_size']; ?>px; <?php echo $str_clear; ?>" class="imgdiv"> + <a href="<?php echo LINPHA_DIR.'/?cat=alb&id='.$value['id']; ?>"> + <img height="<?php echo ($GLOBALS['def_tn_size']-20); ?>" src="<?php echo LINPHA_DIR.'/get_thumb.php?id='.$value['id']; ?>" class="img_thumbnail" /> + </a> + <br /><?php echo $value['name']; ?> + </div> + <?php } - else - { - $str_clear = ''; - } - $i++; - ?> - <div style="width: <?php echo $GLOBALS['def_tn_size']; ?>px; height: <?php echo $GLOBALS['def_tn_size']; ?>px; <?php echo $str_clear; ?>" class="imgdiv"> - <a href="./?cat=alb&id=<?php echo $value['id']; ?>"> - <img height="<?php echo ($GLOBALS['def_tn_size']-20); ?>" src="./get_thumb.php?id=<?php echo $value['id']; ?>" class="img_thumbnail" /> - </a> - <br /><?php echo $value['name']; ?> - </div> - <?php } ?> + </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> -<?php -} -?> \ No newline at end of file + + <?php // javascript enabled + if($GLOBALS['linpha']->imgview->use_javascript) { + ?> + <script language="JavaScript" type="text/javascript"> + display_images(); + </script> + <?php + } + ?> \ No newline at end of file Modified: trunk/linpha2/templates/default_old/index.php =================================================================== --- trunk/linpha2/templates/default_old/index.php 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/templates/default_old/index.php 2006-03-29 13:11:38 UTC (rev 4451) @@ -49,13 +49,13 @@ <div><a href="">Guestbook</a></div> </li> <li class="button"> - <div><a href=""><img src="<?php echo TOP_DIR.'/templates/default/images/slideshow.png'?>" alt="slideshow" /></a></div> + <div><a href=""><img src="<?php echo TOP_DIR.'/templates/default_old/images/slideshow.png'?>" alt="slideshow" /></a></div> </li> <li class="button"> - <div><a href=""><img src="<?php echo LINPHA_DIR.'/templates/default/images/download.png'?>" alt="download" /></a></div> + <div><a href=""><img src="<?php echo LINPHA_DIR.'/templates/default_old/images/download.png'?>" alt="download" /></a></div> </li> <li class="button"> - <div><a href=""><img src="<?php echo LINPHA_DIR.'/templates/default/images/print.png'?>" alt="print" /></a></div> + <div><a href=""><img src="<?php echo LINPHA_DIR.'/templates/default_old/images/print.png'?>" alt="print" /></a></div> </li> <li> <div><a href="">My settings</a></div> @@ -75,11 +75,11 @@ </div> </div> <div id="thumb_navigation"> - <div id="previous"><img src="<?php echo LINPHA_DIR.'/templates/default/images/previous.png'?>" alt="previous" /></div> - <div id="next"><img src="<?php echo LINPHA_DIR.'/templates/default/images/next.png'?>" alt="next" /></div> + <div id="previous"><img src="<?php echo LINPHA_DIR.'/templates/default_old/images/previous.png'?>" alt="previous" /></div> + <div id="next"><img src="<?php echo LINPHA_DIR.'/templates/default_old/images/next.png'?>" alt="next" /></div> </div> <div id="content"> - <div id="photo"><img src="<?php echo LINPHA_DIR.'/templates/default/images/photo.jpg'?>" alt="photo" /></div> + <div id="photo"><img src="<?php echo LINPHA_DIR.'/templates/default_old/images/photo.jpg'?>" alt="photo" /></div> <div id="photo_comment">The colorado beetle. This beetle is serious pest of potatoes and other solanaceous plants. But a very beautifull one!</div> <div id="photo_exif"> Name: org00164.jpg<br /> Modified: trunk/linpha2/templates/default_old/main.php =================================================================== --- trunk/linpha2/templates/default_old/main.php 2006-03-29 12:30:11 UTC (rev 4450) +++ trunk/linpha2/templates/default_old/main.php 2006-03-29 13:11:38 UTC (rev 4451) @@ -28,13 +28,13 @@ { if(!defined('LINPHA2_INC')) { die("ERROR: Direct access forbidden."); } - if(include_once(LINPHA_DIR.'/lib/classes/linpha.template.class.php')) + if(include_once(LINPHA_DIR.'/lib/classes/linpha.template_old.class.php')) { /** * Create new instance of class Template * @param string template name */ - $objTemplate = new Template("default"); + $objTemplate = new Template("default_old"); } else { @@ -51,7 +51,7 @@ $objTemplate -> linXhtmlHeader(); -require_once(LINPHA_DIR.'/templates/default/index.php'); +require_once(LINPHA_DIR.'/templates/default_old/index.php'); } // end try This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |