[Linpha-cvs] SF.net SVN: linpha: [4579] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-10-08 22:20:43
|
Revision: 4579 http://svn.sourceforge.net/linpha/?rev=4579&view=rev Author: fangehrn Date: 2006-10-08 15:20:11 -0700 (Sun, 08 Oct 2006) Log Message: ----------- 2006-10-08 flo * some minor improvements Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/get_image.php trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/js/LinImage.js trunk/linpha2/lib/js/LinThumbnails.js trunk/linpha2/templates/default/css/global.css trunk/linpha2/templates/default/css/view_img.css trunk/linpha2/templates/default/css/view_thumb.css trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/view_img.head.php trunk/linpha2/templates/default/view_img_static.html.php trunk/linpha2/templates/default/view_thumb.head.php trunk/linpha2/templates/default/view_thumb_static.html.php Added Paths: ----------- trunk/linpha2/lib/js/LinGlobal.js trunk/linpha2/lib/modules/module.ajax.php Removed Paths: ------------- trunk/linpha2/lib/js/LinSyslog.js trunk/linpha2/templates/default/css/syslog.css Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/ChangeLog 2006-10-08 22:20:11 UTC (rev 4579) @@ -1,4 +1,7 @@ 2006-10-08 flo + * some minor improvements + +2006-10-08 flo * some improvements done, now it runs quite smooth :-) 2006-10-08 flo Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/docs/dev/TODO.txt 2006-10-08 22:20:11 UTC (rev 4579) @@ -4,7 +4,6 @@ ## Small Todos -- add possibility to force static view for old browsers with half javascript working - save image height and width in database to reduce file access in get_image.php and imgview() ? ## Big Todos Modified: trunk/linpha2/get_image.php =================================================================== --- trunk/linpha2/get_image.php 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/get_image.php 2006-10-08 22:20:11 UTC (rev 4579) @@ -23,7 +23,7 @@ * @package Image */ -//sleep(3); +sleep(5); if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','.'); } Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/index.php 2006-10-08 22:20:11 UTC (rev 4579) @@ -41,6 +41,9 @@ case 'settings': include_once(LINPHA_DIR.'/lib/modules/module.settings.php'); break; +case 'ajax': + include_once(LINPHA_DIR.'/lib/modules/module.ajax.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-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-10-08 22:20:11 UTC (rev 4579) @@ -212,6 +212,9 @@ break; } + /** + * at this point, there should be absolut no output + */ include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); } Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2006-10-08 22:20:11 UTC (rev 4579) @@ -49,6 +49,52 @@ $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/'.$this->body_name.'.html.php'; break; case 'head': +/** + * do some common definitions in head + */ +?> +<!-- css includes --> +<link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/'.$this->template_name.'/css/global.css'; ?>' type='text/css'> +<link rel='stylesheet' href='<?php $this->includeFile('css'); ?>' type='text/css'> + <!-- IE hack for the menu--> + <!--[if IE]> + <style type="text/css" media="screen"> + #menu a, #menu span + { + width: 50px; + } + </style> + <![endif]--> + <!--[if lt IE 7]> + <style type="text/css" media="screen"> + body { + behavior: url(templates/default/css/csshover.htc); + font-size: 100%; + } + + #menu ul li a {height: 1%;} + + #menu a, #menu span { + font: bold 0.7em/1.4em arial, helvetica, sans-serif; + } + </style> + <![endif]--> + +<?php if( isset( $GLOBALS['linpha']->template->output['slideshow_head'] ) ) { + echo '<!-- slideshow-->'; + echo $GLOBALS['linpha']->template->output['slideshow_head']; +} ?> + +<script type="text/javascript" language="javascript" src="<?php echo LINPHA_DIR; ?>/lib/js/prototype.js"></script> +<script type="text/javascript" language="javascript" src="<?php echo LINPHA_DIR; ?>/lib/js/LinGlobal.js"></script> +<?php +if(! isset($_SESSION['use_js']) && ! isset($_SESSION['disable_ajax'])) +{ +?> +<script type="text/javascript" language="JavaScript">var LINPHA_DIR = '<?php echo LINPHA_DIR; ?>'; checkAjaxCompatibility();</script> +<?php +} + $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/'.$this->head_name.'.head.php'; break; case 'css': Added: trunk/linpha2/lib/js/LinGlobal.js =================================================================== --- trunk/linpha2/lib/js/LinGlobal.js (rev 0) +++ trunk/linpha2/lib/js/LinGlobal.js 2006-10-08 22:20:11 UTC (rev 4579) @@ -0,0 +1,77 @@ + +/** + * dynamically open syslog + * used in ajax context + */ +function linSyslog(text) +{ + $('divSyslogText').innerHTML = text; + Element.show('divSyslog'); +} + +/** + * check ajax compatibilty + * will be on every page view until it was successfully + * then, the page will be reloaded + * + * use this on every page and not only on home page, because if user is linked directly to an image + * + * ajax may be disabled with ./?cat=ajax&disable_ajax + * and may be re-enabled with ./?cat=ajax&enable_ajax + */ +function checkAjaxCompatibility() +{ + new Ajax.Request(LINPHA_DIR + '/?cat=ajax&use_js', {asynchronous:true, onSuccess:checkAjaxCompatibilitySuccess} ); +} + +/** + * reload page, now with ajax activated + * will be called if the request in checkAjaxCompatibility() was successfully + */ +function checkAjaxCompatibilitySuccess(t) +{ + location.reload(); + linSyslog('Ajax enabled'); +} + +/** + * setMainHeight + * + * sets the height in thumb and image view of the "divmain" + */ +function setMainHeight() +{ + + /** + * get some values + * browser incompatibilities... + * + * needs to be in display_images! + */ + var linInnerWidth, linInnerHeight; + if (window.innerHeight) // all except Explorer + { + //linInnerWidth = self.innerWidth; + linInnerHeight = self.innerHeight; + } + else if (document.body && document.body.offsetWidth) + { + //linInnerWidth = document.body.offsetWidth; + linInnerHeight = document.body.offsetHeight; + } + else + { + //linInnerWidth = 500; // take a default value (@todo needs testing, maybe anyway never needed) + linInnerHeight = 300; // take a default value (needs teseting) + } + + var newHeight = linInnerHeight - $('main').offsetTop - 40; // 35 = 15 (bottom rounded corners) + 10 (margin-bottom) + 15 (??) + if(newHeight < 100) + { + newHeight = 100; + } + + $('main').style.height = newHeight; + +} + Modified: trunk/linpha2/lib/js/LinImage.js =================================================================== --- trunk/linpha2/lib/js/LinImage.js 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/lib/js/LinImage.js 2006-10-08 22:20:11 UTC (rev 4579) @@ -486,6 +486,16 @@ return returnarray; } +/** + * onWindowResize + * + * will be called if the window is resized + */ +function onWindowResize() +{ + myLinImage.setImageInfoLink(); +// setMainHeight(); // defined in LinGlobal.js +} /** * init on finished page load @@ -493,9 +503,12 @@ function initLinImage() { setInfoColors(); + $('divimage').style.height = startImgHeight; // initial sets correct height at begin and not after the image is loaded + $('mainImage').style.height = startImgHeight; // initial sets correct height at begin and not after the image is loaded myLinImage = new LinImage(); myLinImage.loadImage(startImgId); - window.onresize = myLinImage.setImageInfoLink; +// setMainHeight(); // defined in LinGlobal.js + window.onresize = onWindowResize; } Event.observe(window, 'load', initLinImage, false); Deleted: trunk/linpha2/lib/js/LinSyslog.js =================================================================== --- trunk/linpha2/lib/js/LinSyslog.js 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/lib/js/LinSyslog.js 2006-10-08 22:20:11 UTC (rev 4579) @@ -1,24 +0,0 @@ -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(); \ No newline at end of file Modified: trunk/linpha2/lib/js/LinThumbnails.js =================================================================== --- trunk/linpha2/lib/js/LinThumbnails.js 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/lib/js/LinThumbnails.js 2006-10-08 22:20:11 UTC (rev 4579) @@ -15,7 +15,7 @@ * better a space more than a space too less */ var img_spacer_width = 12; // used to calculate nr_cols -var img_spacer_height = 9; // used to calculate nr_rows +var img_spacer_height = 11; // used to calculate nr_rows var img_div_spacer_height = 11; // used to calculate max-height of the image (depending how much text we would like to add) /** @@ -32,32 +32,9 @@ function display_images() { /** - * get some values - * browser incompatibilities... - * - * needs to be in display_images! - */ - var linInnerWidth, linInnerHeight; - if (window.innerHeight) // all except Explorer - { - linInnerWidth = self.innerWidth; - linInnerHeight = self.innerHeight; - } - else if (document.body && document.body.offsetWidth) - { - linInnerWidth = document.body.offsetWidth; - linInnerHeight = document.body.offsetHeight; - } - else - { - linInnerWidth = 500; // take a default value (@todo needs testing, maybe anyway never needed) - linInnerHeight = 300; // take a default value (needs teseting) - } - - /** * set correct main height only if photos_per_page == auto */ - document.getElementById('main').style.height = linInnerHeight - document.getElementById('spacer_height')['offsetHeight']; + setMainHeight(); // defined in LinGlobal.js /** * calculate nr of photos per page (from select form) @@ -148,6 +125,8 @@ * flush buffer of divhtmltext on end of line * with this buffer, we're 3-4 as fast as without !! * see also http://www.softwaresecretweapons.com/jspwiki/Wiki.jsp?page=JavascriptStringConcatenation !! + * + * update: using the DOM functions with createElement etc. we would be at least 2 times slower!! */ if( (img_nr-1) % nr_cols == 0) { Added: trunk/linpha2/lib/modules/module.ajax.php =================================================================== --- trunk/linpha2/lib/modules/module.ajax.php (rev 0) +++ trunk/linpha2/lib/modules/module.ajax.php 2006-10-08 22:20:11 UTC (rev 4579) @@ -0,0 +1,59 @@ +<?php +/* + * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> + * Florian Angehrn + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/** + * Ajax + * @package Modules + */ + +/** + * use ajax if requested + */ +if(isset($_GET['use_js'])) +{ + $_SESSION['use_js'] = true; + echo 'use_js saved'; +} + +/** + * force ajax disable + */ +if(isset($_GET['disable_ajax'])) +{ + $_SESSION['disable_ajax'] = true; + echo 'disable_ajax saved'; +} +/** + * re-enable + */ +if(isset($_GET['enable_ajax'])) +{ + if(isset($_SESSION['disable_ajax'])) + { + unset($_SESSION['disable_ajax']); + echo 'enable_ajax saved (was disabled before)'; + } + else + { + echo 'enable_ajax saved (but was not disabled before)'; + } +} + + ?> \ No newline at end of file Modified: trunk/linpha2/templates/default/css/global.css =================================================================== --- trunk/linpha2/templates/default/css/global.css 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/templates/default/css/global.css 2006-10-08 22:20:11 UTC (rev 4579) @@ -5,6 +5,7 @@ body { font-family: arial, helvetica, sans-serif; margin: 0px; + padding: 0px; } a:link { @@ -107,6 +108,7 @@ */ #divmain { margin: 0px 10px 10px 10px; + padding: 0px; } #main { padding: 5px; @@ -114,22 +116,47 @@ /** * right + * + * @todo not used anymore, but in static view.. */ #divright { margin: 10px 10px 10px 10px; -/* position: absolute; - top: 280px; - right: 10px;*/ } #right { -// width: 205px; - padding: 5px; margin: 0px; } + +/** + * syslog + */ + #divSysLog { + position: absolute; + left: 15px; + top: 15px; + width: auto; + z-index: 10; + + padding: 5px; + + border: 1px solid #FFD500; + background-color: #FFFF81; + } + + #divSyslogClose { + position: absolute; + right: 0; + top: 0; + z-index: 10; + + background-color: #ffd5ee; + border: 1px solid #f09; + } + + /** * menu */ Deleted: trunk/linpha2/templates/default/css/syslog.css =================================================================== --- trunk/linpha2/templates/default/css/syslog.css 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/templates/default/css/syslog.css 2006-10-08 22:20:11 UTC (rev 4579) @@ -1,24 +0,0 @@ -#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 Modified: trunk/linpha2/templates/default/css/view_img.css =================================================================== --- trunk/linpha2/templates/default/css/view_img.css 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/templates/default/css/view_img.css 2006-10-08 22:20:11 UTC (rev 4579) @@ -33,7 +33,7 @@ #divinfolinks { position: absolute; text-align: right; - width: 50px; /* hardcoded in LinImage.js setImageInfoLink() change to!*/ + width: 50px; /* hardcoded in LinImage.js setImageInfoLink() better to not change!*/ } Modified: trunk/linpha2/templates/default/css/view_thumb.css =================================================================== --- trunk/linpha2/templates/default/css/view_thumb.css 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/templates/default/css/view_thumb.css 2006-10-08 22:20:11 UTC (rev 4579) @@ -1,17 +1,16 @@ -/*#main { - height: 85%; -}*/ /** - * need this to calculate heigh of main div + * not used anymore + + need this to calculate heigh of main div * if you're gettings scrollbars, adjust the height! * height: 12.52em; dosent work, it increases to much if we adjust browsers font-size - */ + #spacer_height { height: 208px; position: absolute; visibility: hidden; -} +}*/ /** * page nr @@ -57,7 +56,7 @@ .img_thumbnail { border: 0; - width: auto; + /*width: auto;*/ } .img_text { Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/templates/default/global.html.php 2006-10-08 22:20:11 UTC (rev 4579) @@ -9,42 +9,6 @@ <head> <title><?php echo $GLOBALS['linpha']->template->linpha_title; ?></title> -<!-- css includes --> -<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'> - <!-- IE hack for the menu--> - <!--[if IE]> - <style type="text/css" media="screen"> - #menu a, #menu span - { - width: 50px; - } - </style> - <![endif]--> - <!--[if lt IE 7]> - <style type="text/css" media="screen"> - body { - behavior: url(templates/default/css/csshover.htc); - font-size: 100%; - } - - #menu ul li a {height: 1%;} - - #menu a, #menu span { - font: bold 0.7em/1.4em arial, helvetica, sans-serif; - } - </style> - <![endif]--> - -<?php if( isset( $GLOBALS['linpha']->template->output['sys_log'] ) ) { ?> - <link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/css/syslog.css'; ?>' type='text/css'> -<?php } ?> - -<?php if( isset( $GLOBALS['linpha']->template->output['slideshow_head'] ) ) { - echo '<!-- slideshow-->'; - echo $GLOBALS['linpha']->template->output['slideshow_head']; -} ?> - <?php $GLOBALS['linpha']->template->includeFile('head'); ?> </head> @@ -52,17 +16,14 @@ <body> -<?php if( isset($GLOBALS['linpha']->template->output['sys_log']) ) { ?> - <!-- syslog --> - <div id="sys_log"> - <div id="sys_log_close"><a href="javascript:toggleWindow()">X</a></div> - <div id="sys_log_text"> - <?php echo i18n("Linpha Syslog"); ?>:<br /> - <?php echo $GLOBALS['linpha']->template->output['sys_log']; ?> - </div> +<!-- syslog --> +<div id="divSyslog"<?php if( ! isset($GLOBALS['linpha']->template->output['sys_log']) ) { echo ' style="display: none;"'; } ?>> + <div id="divSyslogClose"><a href="javascript:void(0);" onclick="Element.hide('divSyslog')">X</a></div> + <?php echo i18n("Linpha Syslog"); ?>:<br /> + <div id="divSyslogText"> + <?php echo $GLOBALS['linpha']->template->output['sys_log']; ?> </div> - <script type="text/javascript" language="javascript" src="<?php echo LINPHA_DIR; ?>/lib/classes/syslog.js"> </script> -<?php } ?> +</div> <!-- title/navigation --> <div id="title"> Modified: trunk/linpha2/templates/default/view_img.head.php =================================================================== --- trunk/linpha2/templates/default/view_img.head.php 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/templates/default/view_img.head.php 2006-10-08 22:20:11 UTC (rev 4579) @@ -5,8 +5,8 @@ var thumbSrc = '<?php echo LINPHA_DIR.'/get_thumb.php?id='; ?>'; var imageSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_size']; ?>; var startImgId = <?php echo $GLOBALS['linpha']->imgview->id_current; ?>; +var startImgHeight = <?php echo $GLOBALS['linpha']->imgview->img_height; ?>; </script> -<script type="text/javascript" language="javascript" src="<?php echo LINPHA_DIR; ?>/lib/js/prototype.js"></script> <script type="text/javascript" language="javascript" src="<?php echo LINPHA_DIR; ?>/lib/js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" language="javascript" src="<?php echo LINPHA_DIR; ?>/lib/js/LinImage.js"> </script> Modified: trunk/linpha2/templates/default/view_img_static.html.php =================================================================== --- trunk/linpha2/templates/default/view_img_static.html.php 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/templates/default/view_img_static.html.php 2006-10-08 22:20:11 UTC (rev 4579) @@ -1,10 +1,4 @@ -<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']; ?> Modified: trunk/linpha2/templates/default/view_thumb.head.php =================================================================== --- trunk/linpha2/templates/default/view_thumb.head.php 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/templates/default/view_thumb.head.php 2006-10-08 22:20:11 UTC (rev 4579) @@ -7,4 +7,6 @@ var photos_per_page = 'auto'; <?php echo $GLOBALS['linpha']->template->output['files_db']."\n"; ?> </script> + +<script type="text/javascript" language="javascript" src="<?php echo LINPHA_DIR; ?>/lib/js/scriptaculous.js?load=builder"></script> <script type="text/javascript" language="javascript" src="<?php echo LINPHA_DIR; ?>/lib/js/LinThumbnails.js"></script> Modified: trunk/linpha2/templates/default/view_thumb_static.html.php =================================================================== --- trunk/linpha2/templates/default/view_thumb_static.html.php 2006-10-08 18:02:04 UTC (rev 4578) +++ trunk/linpha2/templates/default/view_thumb_static.html.php 2006-10-08 22:20:11 UTC (rev 4579) @@ -1,10 +1,4 @@ -<script language="JavaScript" type="text/javascript"> -<!-- -location.href = "<?php echo convert_amp($GLOBALS['linpha']->template->URL_full.'&use_js=1'); ?>"; -//--> -</script> - <!-- navigation --> <?php if(isset($GLOBALS['linpha']->template->output['navigation']) && !empty($GLOBALS['linpha']->template->output['navigation'])) { ?> <div id="divnavigation"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |