[Linpha-cvs] SF.net SVN: linpha: [4618] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-11-02 22:36:24
|
Revision: 4618 http://svn.sourceforge.net/linpha/?rev=4618&view=rev Author: fangehrn Date: 2006-11-02 14:35:50 -0800 (Thu, 02 Nov 2006) Log Message: ----------- * implemented back/forward/reload browser functions in ajax mode thanks to http://www.galileocomputing.de/openbook/javascript_ajax/ Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/js/LinGlobal.js trunk/linpha2/lib/js/LinImage.js trunk/linpha2/lib/modules/module.filemanager.php trunk/linpha2/templates/default/themes/vertical-nav/css/view_img.css Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-02 20:27:40 UTC (rev 4617) +++ trunk/linpha2/ChangeLog 2006-11-02 22:35:50 UTC (rev 4618) @@ -7,6 +7,8 @@ if making only a few changes * added a "vertical align of thumbs" theme for the poor guys without a widescreen tft :-P + * implemented back/forward/reload browser functions in ajax mode + thanks to http://www.galileocomputing.de/openbook/javascript_ajax/ 2006-11-01 flo * implemented linpha_log() Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-02 20:27:40 UTC (rev 4617) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-02 22:35:50 UTC (rev 4618) @@ -1108,8 +1108,6 @@ */ function viewImgXml() { - - header('Content-type: text/xml'); echo '<?xml version="1.0" ?>'."\n"; ?> Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2006-11-02 20:27:40 UTC (rev 4617) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2006-11-02 22:35:50 UTC (rev 4618) @@ -126,7 +126,7 @@ <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_DIR; ?>/lib/js/LinGlobal.js"></script> <script type="text/javascript" language="JavaScript"> var LINPHA_DIR = '<?php echo LINPHA_DIR; ?>'; -var IdCurrent = <?php echo $this->idCurrent; ?>; +var startIdCurrent = <?php echo $this->idCurrent; ?>; <?php if(! isset($_SESSION['use_js']) && ! isset($_SESSION['disable_ajax'])) { Modified: trunk/linpha2/lib/js/LinGlobal.js =================================================================== --- trunk/linpha2/lib/js/LinGlobal.js 2006-11-02 20:27:40 UTC (rev 4617) +++ trunk/linpha2/lib/js/LinGlobal.js 2006-11-02 22:35:50 UTC (rev 4618) @@ -128,3 +128,13 @@ $('main').style.height = newHeight; } + +function fOnError(txt_message, url, line) { + var txt = "Error occured...\n\n"; + txt += "Message: " + txt_message + "\n"; + txt += "URL: " + url + "\n"; + txt += "Line: " + line; + alert(txt); +} +window.onerror = fOnError; + Modified: trunk/linpha2/lib/js/LinImage.js =================================================================== --- trunk/linpha2/lib/js/LinImage.js 2006-11-02 20:27:40 UTC (rev 4617) +++ trunk/linpha2/lib/js/LinImage.js 2006-11-02 22:35:50 UTC (rev 4618) @@ -3,6 +3,7 @@ alert('Error ' + t.status + ' -- ' + t.statusText); } +var IdCurrent; var nextThumbs = new Array(); var prevThumbs = new Array(); @@ -19,6 +20,8 @@ var preloadImageFinished = new Array(); // set to true after preload completed var preloadXmlFinished = new Array(); +var curLocationHash; + var borderSize = 0; var resizeDuration = 0.5; @@ -38,8 +41,11 @@ { IdCurrent = imgId; menuNeedsUpdating = true; // IdCurrent changed, update menu on next hover of the menu + location.hash = 'idCurrent='+IdCurrent; } + curLocationHash = location.hash; // update current Hash, this value is periodically checked to reload the image if neccessary + if(preloadXmlFinished[imgId] && typeof xmlDoc[imgId] != "undefined" ) // use typeof to work in IE { this.changeImage(); @@ -781,9 +787,50 @@ $('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(); + + /** + * doing something very important! + * rebuild the browsers histroy back, forware and reload functions + * if we have a #idCurrent=xyz in the url use this as the id + */ + if( document.location.hash.indexOf('idCurrent') != -1 ) + { + IdCurrent = document.location.hash.substr(11); + } + else + { + IdCurrent = startIdCurrent; + } + + /** + * and again something important + * rebuild the browsers histroy back, forware and reload functions + * periodically check if the url has changed + * if so, load the new id + */ + curLocationHash = location.hash; + window.setInterval(function() + { + if (curLocationHash != location.hash) + { + if( document.location.hash.substr(11) != '' ) + { + IdCurrent = document.location.hash.substr(11); + + } + else // location.hash contains no '#idCurrent', we're back on start + { + IdCurrent = startIdCurrent; + } + + myLinImage.loadImage(IdCurrent); + } + }, 500); + + // automatically start slideshow if requested (coming from thumbview) - if( document.location.toString().indexOf('slideshow') != -1 ) + if( document.location.search.indexOf('slideshow') != -1 ) { myLinImage.fullscreenStart(); } Modified: trunk/linpha2/lib/modules/module.filemanager.php =================================================================== --- trunk/linpha2/lib/modules/module.filemanager.php 2006-11-02 20:27:40 UTC (rev 4617) +++ trunk/linpha2/lib/modules/module.filemanager.php 2006-11-02 22:35:50 UTC (rev 4618) @@ -289,7 +289,7 @@ { throw new Exception(i18n("Rename File/Folder Failed!"). htmlspecialchars($full_filename,ENT_QUOTES).' '.i18n("to").' '.htmlspecialchars($parent_dirname.'/'.$new_name,ENT_QUOTES). - LIN_LF.i18n($str_checkpermissions) + LIN_NL.i18n($str_checkpermissions) ); } @@ -335,7 +335,7 @@ i18n("Cannot Copy/Move to Folder \"%s\" because its not writable!"), htmlspecialchars($full_destparentname,ENT_QUOTES) ). - LIN_LF. + LIN_NL. i18n($str_checkpermissions) ); } @@ -473,6 +473,11 @@ $data = $linpha->db->GetRow("SELECT parent_id FROM ".PREFIX."photos " . "WHERE id = '".LinSql::linAddslashes($value)."'"); + if( !isset($data['parent_id']) ) + { + throw new Exception(i18n("This file doesn't exists anymore!").' file id: '.$value); + } + /** * check write permission of parent folder */ @@ -684,7 +689,7 @@ } // end try() catch(Exception $error) { - linSysLog("Error: ".str_replace(LIN_LF,"<br />",$error -> getMessage())); + linSysLog("Error: ".str_replace(LIN_NL,"<br />",$error -> getMessage())); linLog(LOG_TYPE_FILEMANAGER,LOG_ERR,'fm_'.$_REQUEST['file_action'],$error->getMessage()); } Modified: trunk/linpha2/templates/default/themes/vertical-nav/css/view_img.css =================================================================== --- trunk/linpha2/templates/default/themes/vertical-nav/css/view_img.css 2006-11-02 20:27:40 UTC (rev 4617) +++ trunk/linpha2/templates/default/themes/vertical-nav/css/view_img.css 2006-11-02 22:35:50 UTC (rev 4618) @@ -9,7 +9,7 @@ position: relative; height: auto; - min-height: 640px; + min-height: 650px; width: 120px; } @@ -57,7 +57,7 @@ margin-left: 130px; } #main { - min-height: 640px; + min-height: 650px; } #divright { clear: left; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |