[Linpha-cvs] SF.net SVN: linpha: [4897] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2008-03-07 15:53:44
|
Revision: 4897 http://linpha.svn.sourceforge.net/linpha/?rev=4897&view=rev Author: fangehrn Date: 2008-03-07 07:53:42 -0800 (Fri, 07 Mar 2008) Log Message: ----------- 2008-03-07 flo * fixed some bugs * implemented dynamic menu reload 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/plugins/maps/LinMaps.js trunk/linpha2/lib/plugins/maps/class.googlemaps.js trunk/linpha2/templates/default/maps.head.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/view_img.head.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/ChangeLog 2008-03-07 15:53:42 UTC (rev 4897) @@ -1,5 +1,7 @@ 2008-03-07 flo + * fixed some bugs + * implemented dynamic menu reload * added static login form (for non javascript browsers) 2008-02-25 flo Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-03-07 15:53:42 UTC (rev 4897) @@ -304,7 +304,7 @@ /** * append to "admin - import" entry */ - $GLOBALS['linpha']->template->menu['admin']['import']['value'][] = array( + $GLOBALS['linpha']->template->menu['admin']['import']['link'][] = array( 'name' => i18n("Recreate This Thumbnail"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' ); @@ -383,8 +383,8 @@ if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) { $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['value'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; } if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) @@ -433,17 +433,17 @@ if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][0]['name'] = i18n("Rotate Left"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][0]['value'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; - $GLOBALS['linpha']->template->menu['more']['edit']['value'][1]['name'] = i18n("Rotate Right"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][1]['value'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; + $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['name'] = i18n("Rotate Left"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; + $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['name'] = i18n("Rotate Right"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; } if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) { $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['value'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; } Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2008-03-07 15:53:42 UTC (rev 4897) @@ -281,6 +281,14 @@ } if (isset($this->arrayDefaultMenuEntries[$menuEntry])) { + + if ($menuEntry == 'admin' && !$GLOBALS['linpha']->sql->isAdmin()) { + continue; + } + if ($menuEntry == 'settings' && !$GLOBALS['linpha']->sql->isLoggedIn()) { + continue; + } + if ($menuEntry == 'more') { $link = ''; } elseif($menuEntry == 'admin') { @@ -288,6 +296,7 @@ } else { $link = LINPHA_LINK.'&linCat='.$menuEntry; } + $this->menuFinal[ $menuEntry ] = array( 'name' => $this->arrayDefaultMenuEntries[$menuEntry], 'link' => $link Modified: trunk/linpha2/lib/js/LinGlobal.js =================================================================== --- trunk/linpha2/lib/js/LinGlobal.js 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/js/LinGlobal.js 2008-03-07 15:53:42 UTC (rev 4897) @@ -84,7 +84,7 @@ } }, - AjaxPost: function(parameters,successFunction) + AjaxPost: function(url, parameters, successFunction) { var opt = { // Use POST @@ -108,17 +108,17 @@ } } - new Ajax.Request(xmlUrl + '&linId=' + IdCurrent + '&xml', opt); + new Ajax.Request(url, opt); }, - reloadMenu: function() + /*reloadMenu: function() { if( this.menuNeedsUpdating ) { new Ajax.Updater('menu', LINPHA_LINK + '&linCat=ajax&reloadmenu&linId='+IdCurrent, {method: 'get', asynchronous:true, evalScripts:true}); this.menuNeedsUpdating = false; } - }, + },*/ /** * setWindowSize() Modified: trunk/linpha2/lib/js/LinImage.js =================================================================== --- trunk/linpha2/lib/js/LinImage.js 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/js/LinImage.js 2008-03-07 15:53:42 UTC (rev 4897) @@ -67,16 +67,7 @@ }, loadImageXml: function(imgId) { - // http://wiki.script.aculo.us/scriptaculous/show/Ajax.Request - new Ajax.Request( - xmlUrl + '&linId=' + imgId + '&xml', - { - method:'get', - asynchronous:true, - onSuccess:this.loadImageContinue, - onFailure: function(t) { alert('Error ' + t.status + ' -- ' + t.statusText); } - } - ); + myLinGlobal.AjaxPost(linUrlBase + '&linId=' + imgId + '&xml', '', myLinImage.loadImageContinue); }, loadImageContinue: function(t) { Modified: trunk/linpha2/lib/plugins/maps/LinMaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/LinMaps.js 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/plugins/maps/LinMaps.js 2008-03-07 15:53:42 UTC (rev 4897) @@ -20,6 +20,8 @@ this.markersData = false; this.markersObj = new Array(); this.imagesObj = new Array(); + + this.ajaxUrl = linUrlBase + '&linId=' + IdCurrent + '&xml'; }, /** @@ -27,7 +29,7 @@ */ loadMarkers: function() { - myLinGlobal.AjaxPost('cmd=loadMarkers',myLinMaps.showMarkers); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=loadMarkers',myLinMaps.showMarkers); }, showMarkers: function(t) { @@ -102,7 +104,7 @@ deleteMarker: function(markerId) { - myLinGlobal.AjaxPost('cmd=deleteMarker&markerId='+markerId,myLinMaps.deleteMarkerFinish); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=deleteMarker&markerId='+markerId,myLinMaps.deleteMarkerFinish); }, deleteMarkerFinish: function(t) { @@ -135,14 +137,14 @@ assignAlbum: function(markerId,albId) { - myLinGlobal.AjaxPost('cmd=assignAlbum&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbum&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); }, assignAlbumChange: function(markerId,albId) { - myLinGlobal.AjaxPost('cmd=assignAlbumChange&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbumChange&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); }, assignAlbumDelete: function(markerId,albId) { - myLinGlobal.AjaxPost('cmd=assignAlbumDelete&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbumDelete&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); }, assignAlbumFinish: function(t) { @@ -162,7 +164,7 @@ loadAlbums: function() { - myLinGlobal.AjaxPost('cmd=loadAlbums',myLinMaps.showAlbums); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=loadAlbums',myLinMaps.showAlbums); }, showAlbums: function(t) { @@ -192,7 +194,7 @@ this.toggleNav(); } - myLinGlobal.AjaxPost('cmd=loadImages&albId='+albId,myLinMaps.showImages); + myLinGlobal.AjaxPost(this.ajaxUrl, 'cmd=loadImages&albId='+albId,myLinMaps.showImages); }, showImages: function(t) Modified: trunk/linpha2/lib/plugins/maps/class.googlemaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2008-03-07 15:53:42 UTC (rev 4897) @@ -27,7 +27,7 @@ var mapDefaultZoom = 4; var mapDefaultLat = 49.9801; var mapDefaultLng = 10.8731; - + geocoder = new GClientGeocoder(); googlemap = new google.maps.Map2(document.getElementById("linDivMapObject")); @@ -179,7 +179,7 @@ inputForm.setAttribute("action",""); inputForm.setAttribute("method","POST"); inputForm.setAttribute("id","linFormEditMarker"); - inputForm.onsubmit = function() {myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;}; + inputForm.onsubmit = function() {myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, Form.serialize(this),myLinMaps.saveMarker); return false;}; inputForm.innerHTML = $('linDivEditMarker').innerHTML; myLinMaps.editMarker.bindInfoWindow( inputForm ); // The marker.bindInfoWindow*() methods create GEvent listeners that perform the corresponding marker.openInfoWindow*() calls when the marker is clicked. Modified: trunk/linpha2/templates/default/maps.head.php =================================================================== --- trunk/linpha2/templates/default/maps.head.php 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/templates/default/maps.head.php 2008-03-07 15:53:42 UTC (rev 4897) @@ -1,6 +1,5 @@ <script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/scriptaculous.js?load=effects,builder,dragdrop"></script> <script language="JavaScript" type="text/javascript"> -var xmlUrl = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; var imageSrc = '<?php echo LINPHA_CLIENT.'/get_image.php?linId='; ?>'; var thumbSrc = '<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='; ?>'; var maxImageWidth = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; ?>; Modified: trunk/linpha2/templates/default/menu.html.php =================================================================== --- trunk/linpha2/templates/default/menu.html.php 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/templates/default/menu.html.php 2008-03-07 15:53:42 UTC (rev 4897) @@ -9,13 +9,14 @@ var myMenu = <?php linSetMenuJS(); ?>; cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); -function linRedrawMenu() +function linRedrawMenu(t) { - cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); + myMenuReload = eval('(' + t.responseText + ')'); + cmDraw ('linDivMenu', myMenuReload, 'hbr', cmThemePanel); } function linReloadMenu(form_params) { - myLinGlobal.AjaxPost(form_params, linRedrawMenu, LINPHA_CLIENT + '/?linCat=ajax&reloadmenu&linId=' + IdCurrent); + myLinGlobal.AjaxPost(LINPHA_LINK + 'linCat=ajax&reloadmenu&linId=' + IdCurrent, form_params, linRedrawMenu); } --> </script> @@ -33,9 +34,10 @@ $html_login = '<td class="ThemePanelMenuItemLeft"></td><td colspan="2">'; if (linUseAjax()) { - $html_login .= '<form action="" method="POST" onsubmit="new Ajax.Updater(\'linDivMenu\', '. + /*$html_login .= '<form action="" method="POST" onsubmit="new Ajax.Updater(\'linDivMenu\', '. 'LINPHA_CLIENT + \'/?linCat=ajax&reloadmenu&linId=\'+IdCurrent, {method: \'post\', '. - 'asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;">'; + 'asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;">';*/ + $html_login .= '<form action="" method="POST" onsubmit="linReloadMenu(Form.serialize(this)); return false;">'; } else { $html_login .= '<form action="'.$linTpl->URL_full.'" method="POST">'; } Modified: trunk/linpha2/templates/default/view_img.head.php =================================================================== --- trunk/linpha2/templates/default/view_img.head.php 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/templates/default/view_img.head.php 2008-03-07 15:53:42 UTC (rev 4897) @@ -1,6 +1,5 @@ <script language="JavaScript" type="text/javascript"> -var xmlUrl = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; var imageSrc = '<?php echo LINPHA_CLIENT.'/get_image.php?linId='; ?>'; var thumbSrc = '<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='; ?>'; var maxImageWidth = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; ?>; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |