[Linpha-cvs] SF.net SVN: linpha: [4777] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2007-11-05 22:31:30
|
Revision: 4777 http://linpha.svn.sourceforge.net/linpha/?rev=4777&view=rev Author: fangehrn Date: 2007-11-05 14:31:27 -0800 (Mon, 05 Nov 2007) Log Message: ----------- 2007-11-05 flo * worked some more on the map plugin delete markers is now working Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance_import.php trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/modules/module.filemanager.php trunk/linpha2/lib/plugins/maps/LinMaps.js trunk/linpha2/lib/plugins/maps/class.googlemaps.js trunk/linpha2/lib/plugins/maps/module.maps.php trunk/linpha2/templates/default/maps.html.php trunk/linpha2/templates/default/search.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-10-30 22:19:50 UTC (rev 4776) +++ trunk/linpha2/ChangeLog 2007-11-05 22:31:27 UTC (rev 4777) @@ -1,4 +1,9 @@ + +2007-11-05 flo + * worked some more on the map plugin + delete markers is now working + 2007-10-30 flo * working some more on the map plugin create markers is now working Modified: trunk/linpha2/admin/maintenance_import.php =================================================================== --- trunk/linpha2/admin/maintenance_import.php 2007-10-30 22:19:50 UTC (rev 4776) +++ trunk/linpha2/admin/maintenance_import.php 2007-11-05 22:31:27 UTC (rev 4777) @@ -310,7 +310,7 @@ <br /> <form action="./?cat=maintenance_import" method="POST"> <select name="album_select[]" size="10" multiple="multiple" style="width: 500px;"> -<?php linBuildAlbumSelect($with_all_albs_entry=true); ?> +<?php linBuildAlbumSelect($with_all_albs_entry=true,$with_linebreaks=true); ?> </select> <br /><br /> Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2007-10-30 22:19:50 UTC (rev 4776) +++ trunk/linpha2/lib/classes/linpha.class.php 2007-11-05 22:31:27 UTC (rev 4777) @@ -118,8 +118,12 @@ * to keep the update language file routine working */ define('LIN_STR_SUBMIT', i18n("Submit") ); +define('LIN_STR_CONFIRMDELETE', i18n("Do you really want to delete %s?") ); + +define('LIN_STR_SUCCUPDATEDDATA', i18n("Successfully updated data") ); + define('LIN_STR_ACCESSDENIED', i18n("Error: Access denied") ); -define('LIN_STR_SUCCUPDATEDDATA', i18n("Successfully updated data") ); +define('LIN_STR_NOVALIDDATA', i18n("Error: No valid data") ); define('LIN_STR_CHKFILEPERM', i18n("Check file permissions") ); Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2007-10-30 22:19:50 UTC (rev 4776) +++ trunk/linpha2/lib/classes/linpha.functions.php 2007-11-05 22:31:27 UTC (rev 4777) @@ -263,26 +263,29 @@ /** * functions to create a html select form with all albums */ -function linBuildAlbumSelect($with_all_albs_entry) +function linBuildAlbumSelect($with_all_albs_entry,$with_linebreaks) { - ?> - - <?php + if($with_linebreaks) { + $ln = "\n"; + } else { + $ln = ""; + } + if($with_all_albs_entry) { if(!isset($_REQUEST['album_select']) OR $_REQUEST['album_select'][0]=='all') { $select = ' selected'; - $_REQUEST['album_select'] = Array('all'=>'all'); + $_REQUEST['album_select'] = array('all'=>'all'); } else { $select = ''; } - echo '<option value="all"'.$select.'>'.i18n("All Albums").'</option>'."\n"; + echo '<option value="all"'.$select.'>'.i18n("All Albums").'</option>'.$ln; } - linBuildAlbumSelectSubEntry(0,''); + linBuildAlbumSelectSubEntry(0,'',$ln); } -function linBuildAlbumSelectSubEntry($id,$text) +function linBuildAlbumSelectSubEntry($id,$text,$ln) { $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".LIN_PREFIX."photos WHERE parent_id = '".$id."' AND img_type = '0' ORDER by name"); while($data = $query->FetchRow()) @@ -295,9 +298,9 @@ } else { $select = ''; } - echo '<option value="'.$data['id'].'"'.$select.'>'.$text.'/'.htmlspecialchars($data['name'],ENT_QUOTES).'</option>'."\n"; + echo '<option value="'.$data['id'].'"'.$select.'>'.$text.'/'.htmlspecialchars($data['name'],ENT_QUOTES).'</option>'.$ln; - linBuildAlbumSelectSubEntry($data['id'],$text.'/'.htmlspecialchars($data['name'],ENT_QUOTES)); + linBuildAlbumSelectSubEntry($data['id'],$text.'/'.htmlspecialchars($data['name'],ENT_QUOTES),$ln); } } Modified: trunk/linpha2/lib/modules/module.filemanager.php =================================================================== --- trunk/linpha2/lib/modules/module.filemanager.php 2007-10-30 22:19:50 UTC (rev 4776) +++ trunk/linpha2/lib/modules/module.filemanager.php 2007-11-05 22:31:27 UTC (rev 4777) @@ -182,7 +182,7 @@ <select name="movecopy_to" class="linForms"> <option value="0">/</option> <?php - linBuildAlbumSelect( $with_all_albs_entry=false ); + linBuildAlbumSelect( $with_all_albs_entry=false,$with_linebreaks=true ); ?> </selet> <input type="hidden" name="checkedfiles" value="<?php echo implode(';',$_REQUEST['checkedfiles']); ?>" /> Modified: trunk/linpha2/lib/plugins/maps/LinMaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/LinMaps.js 2007-10-30 22:19:50 UTC (rev 4776) +++ trunk/linpha2/lib/plugins/maps/LinMaps.js 2007-11-05 22:31:27 UTC (rev 4777) @@ -18,7 +18,7 @@ this.defaultMarkerZoom = linMapsDefaultMarkerZoom; this.markersData = false; - this.markersObj = false; + this.markersObj = new Array(); }, /** @@ -45,7 +45,7 @@ myLinMapObject.removeMarker( myLinMaps.markersObj[i] ); } - myLinMaps.markersObj = false; + myLinMaps.markersObj = new Array(); } /** @@ -104,6 +104,33 @@ } }, + deleteMarker: function(markerId) + { + myLinGlobal.AjaxPost('cmd=deleteMarker&markerId='+markerId,myLinMaps.deleteMarkerFinish); + }, + deleteMarkerFinish: function(t) + { + xmlAnswer = t.responseXML.documentElement; + + if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' ) + { + var markerId = xmlAnswer.getElementsByTagName('responseData').item(0).firstChild.data; + + for( i = 0; i < myLinMaps.markersData.markers.length; i++ ) + { + if( myLinMaps.markersData.markers[i].id == markerId ) + { + myLinMapObject.removeMarker( myLinMaps.markersObj[i] ); + myLinMaps.markersObj[i] = false; + } + } + } + else + { + alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data ); + } + }, + removeEditMarker: function() { myLinMapObject.removeMarker( this.editMarker ); @@ -116,12 +143,16 @@ assignAlbum: function(markerId,albId) { - alert( albId ); - myLinGlobal.AjaxPost('cmd=assignAlbum&albId='+albId,myLinMaps.assignAlbumFinish); + alert( markerId + ' ' + albId ); + myLinGlobal.AjaxPost('cmd=assignAlbum&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); }, assignAlbumFinsih: function(t) { }, + deleteAssignedAlbum: function(markerId,albId) + { + + }, loadAlbums: function() { Modified: trunk/linpha2/lib/plugins/maps/class.googlemaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2007-10-30 22:19:50 UTC (rev 4776) +++ trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2007-11-05 22:31:27 UTC (rev 4777) @@ -141,7 +141,7 @@ var marker = new GMarker(point, icon); GEvent.addListener(marker, "click", function() { - marker.openInfoWindowHtml( /*myLinMaps.getMarkerInfo( markerNode )*/ '<b>' + markerNode.name + '</b><br />' + markerNode.text ); + marker.openInfoWindowHtml( linGetMarkerHtml(markerNode) ); }); googlemap.addOverlay( marker ); Modified: trunk/linpha2/lib/plugins/maps/module.maps.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.maps.php 2007-10-30 22:19:50 UTC (rev 4776) +++ trunk/linpha2/lib/plugins/maps/module.maps.php 2007-11-05 22:31:27 UTC (rev 4777) @@ -52,20 +52,24 @@ { $path = htmlspecialchars($data['albPath'],ENT_QUOTES); - if($allowed) { + /*if($allowed) { if( $data['albId'] != 0 ) { - $text = '<a href=\'javascript:myLinMaps.assignAlbumChange('.$data['id'].','.$data['albId'].')\'>'.i18n("Change Assigned Album").'</a>'; + $text = '<a href=\'javascript:myLinMaps.assignAlbumChange('.$data['id'].','.$data['albId'].')\'>'.i18n("Change Assigned Album").'</a>' . + '<br /><a href=\'javascript:myLinMaps.deleteAssignedAlbum('.$data['id'].','.$data['albId'].')\'>'.i18n("Delete Assigned Album").'</a>'; } else { $text = '<a href=\'javascript:myLinMaps.assignAlbum('.$data['id'].',0)\'>'.i18n("Assign Album").'</a>'; } + + $text .= '<br /><a href=\'javascript:if(confirm(\'test\')){myLinMaps.deleteMarker('.$data['id'].')}\'>'.i18n("Delete Marker").'</a>'; + } else { $text = $path; - } + }*/ echo '{"id": '.$data['id'].', "albId": '.$data['albId'].', "path": "'.$path.'", ' . '"name": "'.htmlspecialchars($data['markerName'],ENT_QUOTES).'", ' . '"lat": '.$data['markerLat'].', "lon": '.$data['markerLon'].', ' . - '"zoom": '.$data['markerZoom'].', "text": "'.$text.'"},'. "\n"; + '"zoom": '.$data['markerZoom'].'},'. "\n"; } /* ?> { "markers": [ @@ -134,6 +138,36 @@ echo '</root>'."\n"; break; + case 'deleteMarker': + + header('Content-type: text/xml'); + echo '<?xml version="1.0" ?>'."\n"; + echo '<root>'."\n"; + + if( !$GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.LIN_STR_ACCESSDENIED.'</responseMsg>'."\n"; + } + elseif( !isset($_REQUEST['markerId']) ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.LIN_STR_NOVALIDDATA.'</responseMsg>'."\n"; + } + else + { + $markerId = intval($_REQUEST['markerId']); + $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."plugins_maps_markers " . + "WHERE id='".LinSql::linAddslashes($markerId)."'"); + + echo '<responseCode>success</responseCode>'."\n"; + echo '<responseData>'.$markerId.'</responseData>'."\n"; + } + + echo '</root>'."\n"; + + break; + case 'assignAlbum': header('Content-type: text/xml'); @@ -148,7 +182,7 @@ elseif( !isset($_REQUEST['markerId']) OR !isset($_REQUEST['albId']) ) { echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.i18n("Error: No valid data").'</responseMsg>'."\n"; + echo '<responseMsg>'.LIN_STR_NOVALIDDATA.'</responseMsg>'."\n"; } else { @@ -163,9 +197,7 @@ echo '</root>'."\n"; - break; - case 'loadAlbums': echo '{ "albums": [' . "\n"; Modified: trunk/linpha2/templates/default/maps.html.php =================================================================== --- trunk/linpha2/templates/default/maps.html.php 2007-10-30 22:19:50 UTC (rev 4776) +++ trunk/linpha2/templates/default/maps.html.php 2007-11-05 22:31:27 UTC (rev 4777) @@ -36,18 +36,6 @@ <div style="display: none"> - <div id="linDivMapListOfAllAlbums"> - <form> - <select name="linInputAlbum" style="width: 250px;"> - <?php linBuildAlbumSelect($with_all_albs_entry=false); ?> - </select><br /> - <input type="button" value="<?php echo i18n("Assign Album"); ?>" onclick="myLinMaps.assignAlbum(this.form.linInputAlbum.value)"> - </form> - </div> - - - <br /> - <div> Legend:<br /> (red) current marker<br /> @@ -118,7 +106,38 @@ </fieldset> </form> </div> -<script type="text/javascript"> -//new Draggable('linDivEditMarker',{revert:false}); -</script> +<script language="JavaScript" type="text/javascript"> +function linGetMarkerHtml(markerNode) +{ + var htmlStr = '<b>' + markerNode.name + '</b><br />' + markerNode.path; + <?php + if( $GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) + { + ?> + htmlStr += '<br /><br /><form><select name="linInputAlbum" style="width: 250px;"><?php + linBuildAlbumSelect($with_all_albs_entry=false,$with_linebreaks=false); ?></select><br />'; + + if(markerNode.albId != 0) + { + htmlStr += '<input type="button" value="<?php echo i18n("Change Assigned Album"); + ?>" onclick="myLinMaps.assignAlbumChange(' + markerNode.id + ',this.form.linInputAlbum.value)">' + + '<br /><input type="button" value="<?php echo i18n("Delete Assigned Album"); + ?>" onclick="myLinMaps.deleteAssignedAlbum(' + markerNode.id + ',' + markerNode.albId + ')">'; + } else { + htmlStr += '<input type="button" value="<?php echo i18n("Assign Album"); + ?>" onclick="myLinMaps.assignAlbum(this.form.linInputAlbum.value)">'; + } + + htmlStr += '<input type="button" value="<?php echo i18n("Delete Marker"); ?>" onclick="if(confirm(\'<?php + echo sprintf(LIN_STR_CONFIRMDELETE, i18n("this marker")); + ?>\')){myLinMaps.deleteMarker(' + markerNode.id + ');}"></form>'; + <?php + } + ?> + + return htmlStr; +} + +</script> + Modified: trunk/linpha2/templates/default/search.html.php =================================================================== --- trunk/linpha2/templates/default/search.html.php 2007-10-30 22:19:50 UTC (rev 4776) +++ trunk/linpha2/templates/default/search.html.php 2007-11-05 22:31:27 UTC (rev 4777) @@ -115,7 +115,7 @@ <!-- select album //--> <b><?php echo i18n("Search In Album"); ?><b><br /> <select name="album_select[]" size="10" multiple="multiple" style="width: 200px;"> - <?php linBuildAlbumSelect($with_all_albs_entry=true); ?> + <?php linBuildAlbumSelect($with_all_albs_entry=true,$with_linebreaks=true); ?> </select><br /> <font size="-2">(<?php echo i18n("Multiple Select Use 'Ctrl'"); ?>)</font> <br /><br /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |