[pLog-svn] r4743 - in plog/trunk: class/action class/action/admin class/controller class/dao class/database class/template/smarty/plugins class/view class/view/admin class/view/admin/chooser js/location js/tinymce js/ui js/yui js/yui/connection templates/admin templates/admin/chooser templates/misc

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sat Feb 17 12:52:17 EST 2007


Author: oscar
Date: 2007-02-17 12:52:17 -0500 (Sat, 17 Feb 2007)
New Revision: 4743

Added:
   plog/trunk/class/action/admin/adminaddlocationajaxaction.class.php
   plog/trunk/class/action/admin/adminshowbloglocationsaction.class.php
   plog/trunk/class/action/admin/adminupdatelocationajaxaction.class.php
   plog/trunk/class/view/admin/adminbloglocationsview.class.php
   plog/trunk/js/yui/connection/
   plog/trunk/js/yui/connection/connection-min.js
   plog/trunk/templates/admin/bloglocations.template
   plog/trunk/templates/admin/bloglocationslist.template
Modified:
   plog/trunk/class/action/admin/adminaction.class.php
   plog/trunk/class/action/admin/adminlocationdisplayaction.class.php
   plog/trunk/class/action/locationdisplay.class.php
   plog/trunk/class/controller/admincontrollermap.properties.php
   plog/trunk/class/dao/location.class.php
   plog/trunk/class/dao/locations.class.php
   plog/trunk/class/database/dbobject.class.php
   plog/trunk/class/template/smarty/plugins/function.location_chooser.php
   plog/trunk/class/template/smarty/plugins/function.location_display.php
   plog/trunk/class/view/admin/chooser/adminlocationchooserview.class.php
   plog/trunk/class/view/locationview.class.php
   plog/trunk/js/location/location.js
   plog/trunk/js/tinymce/tiny_mce-plog-resourcelist.js
   plog/trunk/js/ui/overlay.js
   plog/trunk/js/ui/plogui.js
   plog/trunk/templates/admin/chooser/header.template
   plog/trunk/templates/admin/chooser/location.template
   plog/trunk/templates/admin/editposts.template
   plog/trunk/templates/admin/header.template
   plog/trunk/templates/admin/menus.xml
   plog/trunk/templates/admin/resources.template
   plog/trunk/templates/misc/location.template
Log:
Latest batch of changes for the Google maps integration. Amongst other things, markers are now draggable on the map and their coordinates are dynamically updated in the background via ajax (same thing with new markers)


Modified: plog/trunk/class/action/admin/adminaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaction.class.php	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/class/action/admin/adminaction.class.php	2007-02-17 17:52:17 UTC (rev 4743)
@@ -106,7 +106,7 @@
 			    if( !$find ) {
 			        $this->_userBlogs[] = $this->_blogInfo;
 			    }
-            }            
+            }
         }
 
         /**
@@ -316,18 +316,7 @@
 		{
 			$config =& Config::getConfig();
 			if( $config->getValue( "location_data_enabled", false )) {
-				if ($this->_request->getValue( "locationId") == "0" ) {
-					// no location set
-					$locId = 0;
-				}
-				else {
-					// otherwise check the location data
-					include_once( PLOG_CLASS_PATH."class/dao/locations.class.php" );
-					$locations = new Locations();
-					$coords = split(",", $this->_request->getValue( "locationId" ));
-					$location = $locations->getLocationAddIfNotFound( $coords[0], $coords[1], $this->_blogInfo->getId(), $this->_request->getValue( "locationDesc" ));
-					$locId = $location->getId();
-				}
+				$locId = $this->_request->getValue( "locationId");
 			}
 			
 			return( $locId );

Added: plog/trunk/class/action/admin/adminaddlocationajaxaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddlocationajaxaction.class.php	                        (rev 0)
+++ plog/trunk/class/action/admin/adminaddlocationajaxaction.class.php	2007-02-17 17:52:17 UTC (rev 4743)
@@ -0,0 +1,71 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/view/admin/adminxmlview.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/dao/locations.class.php" );
+
+    /**
+     * \ingroup Action
+     * @private
+     */
+	class AdminAddLocationAjaxAction extends AdminAction
+	{
+		function AdminAddLocationAjaxAction( $actionInfo, $request )
+		{
+			$this->AdminAction( $actionInfo, $request );
+			
+			$this->registerFieldValidator( "id", new IntegerValidator());
+			$this->registerFieldValidator( "lat", new StringValidator());
+			$this->registerFieldValidator( "long", new StringValidator());
+			$this->registerFieldValidator( "desc", new StringValidator());									
+			$this->setValidationErrorView( $this->_getErrorView());
+		}
+		
+		function _getErrorView()
+		{
+			$view = new AdminXmlView( $this->_blogInfo, "response" );
+			$view->setValue( "method", "addLocationAjax" );
+			$view->setValue( "success", "0" );
+			$view->setValue( "message", $this->_locale->tr("error_adding_location" ));
+			
+			return( $view );			
+		}
+
+		function validate()
+		{
+			// load data from the request
+			$lat = $this->_request->getValue( "lat" );
+			$long = $this->_request->getValue( "long" );
+			$desc = $this->_request->getValue( "desc" );
+			
+			// create the location object with the given information
+			$loc = new Location(
+				$lat,							// latitude
+				$long,							// longitude
+				$this->_blogInfo->getId(),		// blog id
+				$desc							// description
+			);
+			
+			// add the Location object and send an error if there was a problem
+			$locations = new Locations();
+			$res = $locations->addLocation( $loc );
+			if( !$res ) {
+				$this->_view = $this->_getErrorView();
+				$this->setCommonData();
+				return( false );
+			}
+			
+			// everything went fine, we can send the confirmation
+            $this->_view = new AdminXmlView( $this->_blogInfo, "response" );
+            $this->_view->setValue( "method", "addLocationAjax" );
+
+            $this->_view->setValue( "success", "1" );
+            $this->_view->setValue( "message", $this->_locale->tr("location_added_ok" ));
+			$this->_view->setValue( "result", $loc->toXml());
+
+            return true;
+		}
+    }
+?>
\ No newline at end of file

Modified: plog/trunk/class/action/admin/adminlocationdisplayaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminlocationdisplayaction.class.php	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/class/action/admin/adminlocationdisplayaction.class.php	2007-02-17 17:52:17 UTC (rev 4743)
@@ -2,6 +2,7 @@
 
 	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/view/admin/chooser/adminlocationchooserview.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/view/admin/adminbloglocationsview.class.php" );	
 
 	class AdminLocationDisplayAction extends AdminAction
 	{
@@ -12,35 +13,28 @@
 		
 		function perform()
 		{
-			$this->_view = new AdminLocationChooserView( $this->_blogInfo );
-			
-			// if the parameter is available, it takes precedence over 'lat' and 'long'
-			if( $c = $this->_request->getValue( "c" )) {
-				$coords = explode( ",", $c );
-				$this->_view->setLatitude( $coords[0] );
-				$this->_view->setLongitude( $coords[1] );
-				$this->_view->setDescription( $this->_request->getValue( "desc" ));				
+			$locs = new Locations();
+			if( $locId = $this->_request->getValue( "locId" )) {
+				$location = $locs->getLocation( $locId );
+				$this->_view = new AdminLocationChooserView( $this->_blogInfo );
+				$this->_view->setLocation( $location );
+				$this->_view->setMode( LOCATION_POPUP_VIEWER_MODE );
 			}
-			elseif( $locId = $this->_request->getValue( "locId", "" )) {
-				$locations = new Locations();
-				$location = $locations->getLocation( $locId );
-				if( !$location )
-					die( "Incorrect location identifier" );
-				$this->_view->setLatitude( $location->getLatitude());
-				$this->_view->setLongitude( $location->getLongitude());				
-				$this->_view->setDescription( $location->getDescription());
+			elseif( $blogId = $this->_request->getValue( "blogId" )) {
+				$locations = $locs->getBlogLocations( $blogId );
+				$this->_view = new AdminBlogLocationsView( $this->_blogInfo );
+				$this->_view->setLocations( $locations );
 			}
 			else {
-				$this->_view->setLatitude( $this->_request->getValue( "lat" ));
-				$this->_view->setLongitude( $this->_request->getValue( "long" ));				
-				$this->_view->setDescription( $this->_request->getValue( "desc" ));				
+				die( "Incorrect parameters" );
 			}
 			
-			// and set the mode to viewer instead of chooser
-			$this->_view->setMode( LOCATION_POPUP_VIEWER_MODE );
+			$this->_view->setWidth( $this->_request->getValue( "width" ));
+			$this->_view->setHeight( $this->_request->getValue( "height" ));
 			
-			// render the view
 			$this->setCommonData();
+			
+			return( true );
 		}
 	}
 ?>
\ No newline at end of file

Added: plog/trunk/class/action/admin/adminshowbloglocationsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminshowbloglocationsaction.class.php	                        (rev 0)
+++ plog/trunk/class/action/admin/adminshowbloglocationsaction.class.php	2007-02-17 17:52:17 UTC (rev 4743)
@@ -0,0 +1,29 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
+
+    /**
+     * \ingroup Action
+     * @private
+     *
+     * Shows the list of locations that have been added by this blog
+     */
+    class AdminShowBlogLocationsAction extends AdminAction 
+	{
+        function perform()
+        {
+			// if location data is not enabled, this action cannot be used
+			$config =& Config::getConfig();
+			if( !$config->getValue( "location_data_enabled", false )) {
+				$this->_view = new AdminErrorView( $this->_blogInfo );
+				$this->_view->setMessage( $this->_locale->tr( "error_location_data_not_enabled" ));
+			}
+		
+			$this->_view = new AdminTemplatedView( $this->_blogInfo, "bloglocationslist" );
+            $this->setCommonData();
+
+            return true;
+        }
+    }
+?>
\ No newline at end of file

Added: plog/trunk/class/action/admin/adminupdatelocationajaxaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatelocationajaxaction.class.php	                        (rev 0)
+++ plog/trunk/class/action/admin/adminupdatelocationajaxaction.class.php	2007-02-17 17:52:17 UTC (rev 4743)
@@ -0,0 +1,82 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/view/admin/adminxmlview.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/dao/locations.class.php" );
+
+    /**
+     * \ingroup Action
+     * @private
+     */
+	class AdminUpdateLocationAjaxAction extends AdminAction
+	{
+		function AdminUpdateLocationAjaxAction( $actionInfo, $request )
+		{
+			$this->AdminAction( $actionInfo, $request );
+			
+			$this->registerFieldValidator( "id", new IntegerValidator());
+			$this->registerFieldValidator( "lat", new StringValidator());
+			$this->registerFieldValidator( "long", new StringValidator());
+			$this->registerFieldValidator( "desc", new StringValidator());									
+			$this->setValidationErrorView( $this->_getErrorView());
+		}
+		
+		function _getErrorView()
+		{
+			$view = new AdminXmlView( $this->_blogInfo, "response" );
+			$view->setValue( "method", "updateLocationAjax" );
+			$view->setValue( "success", "0" );
+			$view->setValue( "message", $this->_locale->tr("error_updating_location" ));
+			
+			return( $view );			
+		}
+
+		function validate()
+		{
+			// load data from the request
+			$id = $this->_request->getValue( "locId" );
+			$lat = $this->_request->getValue( "lat" );
+			$long = $this->_request->getValue( "long" );
+			$desc = $this->_request->getValue( "desc" );
+			
+			// load the location object and send an error if it does not exist
+			$locations = new Locations();
+			$loc = $locations->getLocation( $id );
+			if( !$loc ) {
+				$this->_view = $this->_getErrorView();
+				$this->setCommonData();
+				return( false );
+			}
+			
+			// check if the location belongs to the blog
+			if( $loc->getBlogId() != $this->_blogInfo->getId()) {
+				$this->_view = $this->_getErrorView();
+				$this->setCommonData();
+				return( false );
+			}
+			
+			// update the object
+			$loc->setDescription( $desc );
+			$loc->setLatitude( $lat );
+			$loc->setLongitude( $long );
+			$res = $locations->updateLocation( $loc );
+
+            $this->_view = new AdminXmlView( $this->_blogInfo, "response" );
+            $this->_view->setValue( "method", "updateLocationAjax" );
+            if( $res ) {
+                $this->_view->setValue( "success", "1" );
+                $this->_view->setValue( "message", $this->_locale->tr("location_updated_ok" ));
+				$this->_view->setValue( "result", $loc->toXml());
+            }
+            else
+            {
+                $this->_view->setValue( "success", "0" );
+                $this->_view->setValue( "message", $this->_locale->tr("error_updating_location" ));
+            }
+
+            return true;
+		}
+    }
+?>
\ No newline at end of file

Modified: plog/trunk/class/action/locationdisplay.class.php
===================================================================
--- plog/trunk/class/action/locationdisplay.class.php	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/class/action/locationdisplay.class.php	2007-02-17 17:52:17 UTC (rev 4743)
@@ -3,24 +3,34 @@
 	lt_include( PLOG_CLASS_PATH."class/action/blogaction.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/dao/locations.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/view/locationview.class.php" );	
+	lt_include( PLOG_CLASS_PATH."class/view/errorview.class.php" );		
+	lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );	
 
 	class LocationDisplay extends BlogAction
 	{
 		function LocationDisplay( $actionInfo, $request )
 		{
 			$this->BlogAction( $actionInfo, $request );
+			
+			$this->registerFieldValidator( "locId", new IntegerValidator());
+			$view = new ErrorView( $this->_blogInfo, $this->_locale->tr("incorrect_location_id" ));
+			$this->setValidationErrorView( $view );
 		}
 		
 		function perform()
 		{
+			$locId = $this->_request->getValue( "locId" );
+			
 			$locs = new Locations();
-			$location = $locs->getLocation( $this->_request->getValue( "locId" ));
+			$location = $locs->getLocation( $locId );
+			if( !$location ) {
+				$this->_view = new ErrorView( $this->_blogInfo, $this->_locale->tr("incorrect_location_id" ));
+				$this->setCommonData();
+				return( false );
+			}
 			
 			$this->_view = new LocationView( $this->_blogInfo );
-			$this->_view->setLatitude( $location->getLatitude());
-			$this->_view->setLongitude( $location->getLongitude());
-			$this->_view->setDescription( $location->getDescription());
-			
+			$this->_view->setLocation( $location );
 			$this->_view->setWidth( $this->_request->getValue( "width" ));
 			$this->_view->setHeight( $this->_request->getValue( "height" ));
 			

Modified: plog/trunk/class/controller/admincontrollermap.properties.php
===================================================================
--- plog/trunk/class/controller/admincontrollermap.properties.php	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/class/controller/admincontrollermap.properties.php	2007-02-17 17:52:17 UTC (rev 4743)
@@ -318,7 +318,10 @@
 	// global plugin settings
 	$actions["pluginSettings"] = "AdminPluginSettingsAction";
 	$actions["updatePluginSettings"] = "AdminUpdatePluginSettingsAction";	
-	// location chooser
+	// location
 	$actions['locationChooser'] = 'AdminLocationChooserAction';
 	$actions['adminLocationDisplay'] = 'AdminLocationDisplayAction';
+	$actions['showBlogLocations'] = 'AdminShowBlogLocationsAction';	
+	$actions['updateLocation'] = 'AdminUpdateLocationAjaxAction';
+	$actions['addLocation'] = 'AdminAddLocationAjaxAction';	
 ?>
\ No newline at end of file

Modified: plog/trunk/class/dao/location.class.php
===================================================================
--- plog/trunk/class/dao/location.class.php	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/class/dao/location.class.php	2007-02-17 17:52:17 UTC (rev 4743)
@@ -57,5 +57,38 @@
 		{
 			return( $this->_blogId );
 		}
+		
+		function setDescription( $desc )
+		{
+			$this->_desc = $desc;
+		}
+		
+		function setLatitude( $lat )
+		{
+			$this->_lat = $lat;
+		}
+		
+		function setLongitude( $long )
+		{
+			$this->_long = $long;
+		}
+		
+		function toXml( $useEnvelope = false )
+		{
+			$xml = "";
+			
+			if( $useEnvelope )
+				$xml = "<?xml version=\"1.0\"?><dbobject>";
+				
+			$xml .= "<id>".$this->getId()."</id>";
+			$xml .= "<lat>".$this->getLatitude()."</lat>";
+			$xml .= "<long>".$this->getLongitude()."</long>";
+			$xml .= "<desc><![CDATA[".$this->getDescription()."]]></desc>";
+				
+			if( $useEnvelope )
+				$xml .= "</dbobject>";
+				
+			return( $xml );			
+		}
 	}
 ?>
\ No newline at end of file

Modified: plog/trunk/class/dao/locations.class.php
===================================================================
--- plog/trunk/class/dao/locations.class.php	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/class/dao/locations.class.php	2007-02-17 17:52:17 UTC (rev 4743)
@@ -6,8 +6,17 @@
 	define( "CACHE_LOCATION_BY_ID", "location_by_id" );
 	define( "CACHE_LOCATIONS_BY_BLOG", "locations_by_blog" );
 
+	/**
+	 * \inpackage DAO
+	 *
+	 * maps Location objects in the database
+	 * @see Location
+	 */
 	class Locations extends Model
 	{
+		/**
+		 * Constructor of the class
+		 */
 		function Locations()
 		{
 			$this->Model();
@@ -15,11 +24,23 @@
 			$this->table = $this->getPrefix()."locations";
 		}
 		
+		/**
+		 * Returns a Location object given its id
+		 *
+		 * @param locId
+		 * @return a Location object
+		 */
 		function getLocation( $locId )
 		{
 			return( $this->get( "id", $locId, CACHE_LOCATION_BY_ID ));
 		}
 		
+		/**
+		 * Returns an array containing all the locations in a blog 
+		 *
+		 * @param blogId
+		 * @return An array of Location object
+		 */
 		function getBlogLocations( $blogId )
 		{
 			$locations =  $this->getMany( "blog_id", $blogId, CACHE_LOCATIONS_BY_BLOG );
@@ -89,11 +110,66 @@
 			return( $result );
 		}
 		
+		/**
+		 * Deletes a location
+		 *
+		 * @param locId
+		 */
 		function deleteLocation( $locId )
 		{
 			return( $this->delete( "id", $locId ));
 		}
 		
+		/**
+		 * Returns all the locations given an album id
+		 *
+		 * @param albumId
+		 * @param type
+		 * @return An array of Location objects
+		 */
+		function getAlbumLocations( $albumId = -1, $type = -1 )
+		{
+			$query = "SELECT DISTINCT loc_id FROM ".$this->getPrefix()."gallery_resources";
+			
+			$conds = "";
+			if( $albumId != -1 )
+				$conds .= "album_id = '".Db::qstr( $albumId )."'";
+			if( $type != -1 ) {
+				if( $conds != "" ) $conds .= " AND ";
+				$conds .= "resource_type = '".Db::qstr( $type )."'";
+			}
+			
+			// build the final query using the conditions if any
+			$conds != "" ? $query .= " WHERE $conds" : $query = $query;
+			
+			$result = $this->Execute( $query );
+			if( !$result )
+				return Array();
+				
+			$results = Array();
+			while( $row = $result->FetchRow()) {
+				$results[] = $this->getLocation( $row["loc_id"] );
+			}
+			
+			return( $results );
+		}
+		
+		/**
+		 * update the given location
+		 */
+		function updateLocation( $loc )
+		{
+			if(( $result = $this->update( $loc ))) {
+				$this->_cache->removeData( $loc->getBlogId(), CACHE_LOCATIONS_BY_BLOG );
+				$this->_cache->removeData( $loc->getId(), CACHE_LOCATION_BY_ID );
+			}
+			
+			return( $result );			
+		}
+				
+		/**
+		 * @private
+		 */
 		function mapRow( $row )
 		{
 			return( new Location( $row["latitude"], $row["longitude"], $row["blog_id"], $row["description"], $row["id"] ));

Modified: plog/trunk/class/database/dbobject.class.php
===================================================================
--- plog/trunk/class/database/dbobject.class.php	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/class/database/dbobject.class.php	2007-02-17 17:52:17 UTC (rev 4743)
@@ -65,6 +65,20 @@
     	{
     		return( $this->_fields );
     	}
+
+		/**
+		 * Provides an XML version of this object
+		 */
+		function toXml( $useEnvelope = false )
+		{
+			if( $useEnvelope ) {
+				$xml = "<?xml version=\"1.0\"?><dbobject></dbobject>";
+			}
+			else
+				$xml = "";
+				
+			return( $xml );
+		}
 		
 		/**
 		 * No null values are serialized to the session. If there any values in your data class

Modified: plog/trunk/class/template/smarty/plugins/function.location_chooser.php
===================================================================
--- plog/trunk/class/template/smarty/plugins/function.location_chooser.php	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/class/template/smarty/plugins/function.location_chooser.php	2007-02-17 17:52:17 UTC (rev 4743)
@@ -38,7 +38,7 @@
 	$code .= "<option value=\"0\"";
 	$code .= ">None</option>";	
 	foreach( $locs as $loc ) {
-		$code .= "<option value=\"".$loc->getLatitude().",".$loc->getLongitude()."\"";
+		$code .= "<option value=\"".$loc->getId()."\"";
 		if( $default ) {
 			if( $loc->getId() == $default->getId())
 				$code .= " selected=\"selected\"";
@@ -61,9 +61,8 @@
 			list = document.getElementById('locationId');
 			if( list.options[list.selectedIndex].value == 0 )
 				return false;
-			coords = list.options[list.selectedIndex].value;
-			text = list.options[list.selectedIndex].text;
-			url = '?op=adminLocationDisplay&c=' + coords + '&desc=' + text;
+			locId = list.options[list.selectedIndex].value;
+			url = '?op=adminLocationDisplay&locId=' + locId;
 			window.open(url,'Location Viewer','scrollbars=no,resizable=no,toolbar=no,height=500,width=590');
 		  }
 		 </script> 

Modified: plog/trunk/class/template/smarty/plugins/function.location_display.php
===================================================================
--- plog/trunk/class/template/smarty/plugins/function.location_display.php	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/class/template/smarty/plugins/function.location_display.php	2007-02-17 17:52:17 UTC (rev 4743)
@@ -36,7 +36,7 @@
 	$code = "<script type=\"text/javascript\" src=\"{$baseUrl}/js/yui/yahoo/yahoo-min.js\"></script>";
 	$code .= "<script type=\"text/javascript\" src=\"{$baseUrl}/js/yui/dom/dom-min.js\"></script>";
 	$code .= "<script type=\"text/javascript\" src=\"{$baseUrl}/js/yui/event/event-min.js\"></script>";
-	$code .= "<a id=\"$o\" href=\"#\">".$location->getDescription()."</a>";
+	$code .= "<a id=\"$o\" href=\"javascript:void(0);\">".$location->getDescription()."</a>";
 	$code .= "<script type=\"text/javascript\">$o=new Lifetype.UI.Overlay({url:'".$indexUrl."?op=locationDisplay&width=".$width."&height=".$height."&locId=".$location->getId()."',width:".$width.",height:".$height.",context:'$o',showCloseButton:true});</script>";
 	
 	return( $code );

Added: plog/trunk/class/view/admin/adminbloglocationsview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminbloglocationsview.class.php	                        (rev 0)
+++ plog/trunk/class/view/admin/adminbloglocationsview.class.php	2007-02-17 17:52:17 UTC (rev 4743)
@@ -0,0 +1,50 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
+	
+	class AdminBlogLocationsView extends AdminTemplatedView
+	{
+		var $_locations;
+		var $_blogInfo;
+		var $_width;
+		var $_height;		
+		
+		function AdminBlogLocationsView( $blogInfo )
+		{
+			$this->AdminTemplatedView( $blogInfo, "bloglocations" ); 
+
+			$this->_width = 590;
+			$this->_height = 500;
+		}
+		
+		function setWidth( $width )
+		{
+			$this->_width = $width;
+		}
+		
+		function setHeight( $height )
+		{
+			$this->_height = $height;
+		}
+		
+		function setLocations( $locations )
+		{
+			$this->_locations = $locations;
+		}
+
+		function render()
+		{			
+			// google API key
+			$config =& Config::getConfig();
+			$this->setValue( "google_maps_api_key", $config->getValue( "google_maps_api_key" ));
+			$this->setValue( 'locale', $this->_blogInfo->getLocale());
+			
+			// width and height
+			$this->setValue( 'width', $this->_width );
+			$this->setValue( 'height', $this->_height );
+			$this->setValue( 'locations', $this->_locations );
+			
+			return( parent::render());
+		}		
+	}
+?>
\ No newline at end of file

Modified: plog/trunk/class/view/admin/chooser/adminlocationchooserview.class.php
===================================================================
--- plog/trunk/class/view/admin/chooser/adminlocationchooserview.class.php	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/class/view/admin/chooser/adminlocationchooserview.class.php	2007-02-17 17:52:17 UTC (rev 4743)
@@ -12,60 +12,50 @@
      */	
 	class AdminLocationChooserView extends AdminTemplatedView
 	{
-		var $_lat;
-		var $_long;
 		var $_mode;
-		var $_desc;
+		var $_width;
+		var $_height;
+		var $_loc;
 		
 		function AdminLocationChooserView( $blogInfo, $params = Array())
 		{
 			$this->AdminTemplatedView( $blogInfo, "chooser/location" );
 			
-			// no latitude and longitude
-			$this->_lat = 0;
-			$this->_long = 0;
-			// no description either
-			$this->_desc = "";
-			
 			// the default mode is chooser
 			$this->_mode = LOCATION_POPUP_CHOOSER_MODE;
+			$this->_width = 590;
+			$this->_height = 500;
 		}
-		
-		function setLatitude( $lat )
+
+		function setWidth( $width )
 		{
-			$this->_lat = $lat;
+			$this->_width = $width;
 		}
-		
-		function setLongitude( $long )
+
+		function setHeight( $height )
 		{
-			$this->_long = $long;
+			$this->_height = $height;
 		}
 		
-		function setDescription( $desc )
+		function setMode( $mode )
 		{
-			$this->_desc = $desc;
+			$this->_mode = $mode;
 		}
 		
-		function setMode( $mode )
+		function setLocation( $loc )
 		{
-			$this->_mode = $mode;
+			$this->_loc = $loc;
 		}
 		
 		function render()
 		{
-			// load the list of currently defined locations if needed
-			if( $this->_mode == LOCATION_POPUP_CHOOSER_MODE ) {
-				$locs = new Locations();
-				$blogLocations = $locs->getBlogLocations( $this->_blogInfo->getId());
-				$this->setValue( "locations", $blogLocations );
-			}
 			// google API key
 			$config =& Config::getConfig();
 			$this->setValue( "google_maps_api_key", $config->getValue( "google_maps_api_key" ));
-			$this->setValue( "startLatitude", $this->_lat );
-			$this->setValue( "startLongitude", $this->_long );
-			$this->setValue( "startDescription", $this->_desc );
 			$this->setValue( "mode", $this->_mode );
+			$this->setValue( 'width', $this->_width );
+			$this->setValue( 'height', $this->_height );			
+			$this->setValue( 'loc', $this->_loc );
 			
 			return( parent::render());
 		}

Modified: plog/trunk/class/view/locationview.class.php
===================================================================
--- plog/trunk/class/view/locationview.class.php	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/class/view/locationview.class.php	2007-02-17 17:52:17 UTC (rev 4743)
@@ -5,12 +5,11 @@
 	
 	class LocationView extends View
 	{
-		var $_lat;
-		var $_long;
-		var $_desc;	
+
 		var $_blogInfo;
 		var $_width;
 		var $_height;		
+		var $_loc;
 		
 		function LocationView( $blogInfo )
 		{
@@ -26,30 +25,20 @@
 			$this->_height = 500;
 		}
 		
-		function setLatitude( $lat )
+		function setLocation( $loc )
 		{
-			$this->_lat = $lat;
+			$this->_loc = $loc;
 		}
-		
-		function setLongitude( $long )
+				
+		function setHeight( $height )
 		{
-			$this->_long = $long;
+			$this->_height = $height;
 		}
 		
-		function setDescription( $desc )
-		{
-			$this->_desc = $desc;
-		}
-		
 		function setWidth( $width )
 		{
 			$this->_width = $width;
-		}
-		
-		function setHeight( $height )
-		{
-			$this->_height = $height;
-		}
+		}		
 
 		function render()
 		{
@@ -58,11 +47,11 @@
 			// google API key
 			$config =& Config::getConfig();
 			$this->setValue( "google_maps_api_key", $config->getValue( "google_maps_api_key" ));
-			$this->setValue( "startLatitude", $this->_lat );
-			$this->setValue( "startLongitude", $this->_long );
-			$this->setValue( "startDescription", $this->_desc );
 			$this->setValue( 'locale', $this->_blogInfo->getLocale());
 			
+			// Location object
+			$this->setValue( 'loc', $this->_loc );
+			
 			// width and height
 			$this->setValue( 'width', $this->_width );
 			$this->setValue( 'height', $this->_height );

Modified: plog/trunk/js/location/location.js
===================================================================
--- plog/trunk/js/location/location.js	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/js/location/location.js	2007-02-17 17:52:17 UTC (rev 4743)
@@ -12,28 +12,33 @@
  */
 Lifetype.UI.Location.prototype =
 {
-	// constructor of the class
 	/**
+	 * Mode that the chooser will use
+	 * Use '1' for addition mode and '2' for display only
+	 */
+	mode: 1,
+
+	/**
 	 * The markerMode variable defines whether we can have multiple markers or
 	 * more than one marker at the same time: 1 = one marker, any other value = multiple markers
 	 */
 	markerMode: 1,
 
 	/**
-	 * Whether to show our custom control with the list of pre-defined locations
+	 * Whether to show the little display with the latitude and the longitude
 	 */
-	useCustomLocationControl: true,
-
+	useCustomLatitudeAndLongitudeDisplay: true,
+	
 	/**
-	 * Whether to show the little display with the latitude and the longitude
+	 * Whether to use the click handler or not
 	 */
-	useCustomLatitudeAndLongitudeDisplay: true,
+	useClickHandler: true,
 
 	/**
 	 * Array of predefined locations to show in the custom control
 	 */
 	locations: Array(
-	  Array( "0,0", "-- Select --" )
+	  { latlong: "0,0", desc: "-- Select --", id: -1 }
 	),
 
 	/**
@@ -41,15 +46,17 @@
 	 */
 	locationLocaleNoMarkerHasBeenSetYet: "No marker has been set yet",
 	locationLocaleNoDescriptionError: "Please type a description for the new location",
+	locationLocaleEnterNewLocationName: "Name for the new location",
 
 	/**
 	 * Used to control whether the marker is already in place or not, please
 	 * do not modify these
 	 */
 	markerAdded: false,
-	markerLat: 0,
-	markerLong: 0,
-	markerDesc: "",
+	
+	/**
+	 * Global marker
+	 */
 	globalMarker: new GMarker( new GLatLng(0,0)),
 
 	/**
@@ -57,6 +64,12 @@
 	 * to move the marker around
 	 */
 	displayOnlyMode: false,
+	
+	/**
+	 * Whether markers can be dragged and updated 
+	 * via the Ajax backend
+	 */
+	dynamicMarkerUpdate: false,
 
 	/**
 	 * The global GMap2 object, please do not modify this
@@ -66,33 +79,48 @@
 
 /**
  * Initializes and renders the selector
+ *
+ * @param mode Use '1' for insertion mode, '2' for display only mode with draggable and 
+ * dynamically updateable markers and '3' for display only mode with no draggable
+ * markers
  */
-Lifetype.UI.Location.prototype.init = function()
+Lifetype.UI.Location.prototype.init = function( mode )
 {
+	this.mode = mode;
+
+	if( this.mode == 1 ) {
+		l.useCustomLocationControl = true;
+		l.displayOnlyMode = false;
+		l.dynamicMarkerUpdate = true;	
+	}
+	else if ( this.mode == 2 ) {
+		l.useCustomLocationControl = false;
+		l.displayOnlyMode = true;
+		l.dynamicMarkerUpdate = true;
+	}
+	else {
+		l.useCustomLocationControl = false;
+		l.displayOnlyMode = true;
+		l.dynamicMarkerUpdate = false;	
+	}
+
 	if (GBrowserIsCompatible()) {
-	  mapOpts = { mapTypes: new Array( G_HYBRID_MAP ) };
-	  this.map = new GMap2(document.getElementById( "map" ), mapOpts );
-		// place the centre of the map somewhere in the middle of the atlantic ocean
-		if( this.markerLat != 0 || this.markerLong != 0 ) {
-			this.map.setCenter( new GLatLng( this.markerLat, this.markerLong ), 13 );
-			this.ClickHandler( null, new GLatLng( this.markerLat, this.markerLong ));
-		}
-		else { 
-	  		this.map.setCenter( new GLatLng(37.160316, -38.671875), 2 );
-		}
+		mapOpts = { mapTypes: new Array( G_HYBRID_MAP ) };
+	  	this.map = new GMap2(document.getElementById( "map" ), mapOpts );
+
+	  	this.map.setCenter( new GLatLng(37.160316, -38.671875), 2 );
 	
 		// add two controls to our map
 		this.map.addControl(new GLargeMapControl());
 		this.map.addControl(new GMapTypeControl());
-		if( this.useCustomLocationControl )
-			this.map.addControl(new Lifetype.UI.Location.SelectorControl( this ));
+		/*if( this.useCustomLocationControl )
+			this.map.addControl(new Lifetype.UI.Location.SelectorControl( this ));*/
 		if( this.useCustomLatitudeAndLongitudeDisplay ) 
 			this.map.addControl(new Lifetype.UI.Location.LatitudeAndLongitudeDisplayControl());
 	
 		// add a click listener
 		if( !this.displayOnlyMode ) {
 			GEvent.addListener( this.map, "click", this.ClickHandler );
-			//YAHOO.util.Event.addListener( this.map, "click", this.ClickHandler, this, true );			
 		}
 		
 		// save a link to ourselves in the map object
@@ -117,42 +145,17 @@
 	if( !point )
 		return;
 
-  // remove the marker if it was already there
-  if( o.markerMode != 1 ) {
-	  lat = document.getElementById('lat');
-	  lng = document.getElementById('long');
-	  lat.value = point.lat();
-	  lng.value = point.lng();
-	  o.map.addOverlay( new GMarker( point ));
-  }
-  else {
-	  if( o.markerAdded ) {
-	    o.map.removeOverlay( o.globalMarker );
-	    o.markerAdded = false;	
-	  }
-	  if( !o.markerAdded ) {
-		  lat = document.getElementById('lat');
-		  lng = document.getElementById('long');
-		  lat.value = point.lat();
-		  lng.value = point.lng();
-	      o.globalMarker = new GMarker( point );
-		  o.markerLat = point.lat();
-		  o.markerLong = point.lng();
-	      o.map.addOverlay( o.globalMarker );
-		  o.markerAdded = true;
-		  o.map.setCenter( point );	
-		  if( o.markerDesc ) {
-			o.markerDesc = o.markerDesc + "<br/>" + o.markerLat + ", " + o.markerLong;
-		  }
-		  else {
-			o.markerDesc = o.markerLat + ", " + o.markerLong;
-		  }
-		  // add the info window		
-		GEvent.addListener( o.globalMarker, "click", function() {
-	    	o.globalMarker.openInfoWindowHtml( o.markerDesc );
-	  	});		
-		o.globalMarker.openInfoWindowHtml( o.markerDesc );		
-	  }
+  	if( o.markerAdded ) {
+    	o.map.removeOverlay( o.globalMarker );
+    	o.markerAdded = false;	
+  	}
+  	else {
+		o.globalMarker = o._genMarker({latlong:point.lat()+","+point.lng(),desc:"",id:"-1"});
+		// we don't want to be able to drag new markers
+		o.globalMarker.disableDragging();
+		// add it to the map
+		o.map.addOverlay( o.globalMarker );
+		o.markerAdded = true;	  				
    }
 }
 
@@ -169,54 +172,272 @@
 	// get the list that holds the locations
 	locationList = parent.opener.document.getElementById("locationId");
 	
-	// is the location already in the list?
-	currentLatLng = new GLatLng( this.markerLat, this.markerLong);
-	for( i = 0; i < locationList.options.length; i++ ) {
-	 	coords = locationList.options[i].value.split(",");	
-		optLatLng = new GLatLng( coords[0], coords[1] );
-		if( currentLatLng.equals( optLatLng )) {
-			locationList.selectedIndex = i;
-			return true;
-		}
-	}	
-	
 	// get the description and quit if empty
-	locationDesc = document.getElementById( "locationDesc" );
-	if( locationDesc.value == "" ) {
+	newLocationDesc = window.prompt( this.locationLocaleEnterNewLocationName )
+	if( newLocationDesc == "" || newLocationDesc == null ) {
 		window.alert( this.locationLocaleNoDescriptionError );
 		return false;
 	}	
 	
+	this.globalMarker.locationDesc = newLocationDesc;
+	
+	// perform the addition of the new marker in the background
+	this.globalMarker.addLocationAjax();	
+
+	return true;
+}
+
+/**
+ * utility method to display a location based on the id from a drop-down list
+ * that contains a list of location ids. This is used in editposts.template.
+ *
+ * @param elem
+ * @param ignoreValues
+ */
+Lifetype.UI.Location.displaySelectedLocationFromId = function( elem, ignoreValues )
+{
+	list = document.getElementById( elem );
+	if( !list )
+		return false;
+		
+	// is it one of the elements of the 'ignoreValues' array?
+	for( i = 0; i < ignoreValues.length; i++ ) {
+		if( list.options[list.selectedIndex].value == ignoreValues[i] )
+			return false;
+	}
+
+	locId = list.options[list.selectedIndex].value;
+	text = list.options[list.selectedIndex].text;
+	url = '?op=adminLocationDisplay&locId=' + locId;
+	
+	window.open(url,'Location Viewer','scrollbars=no,resizable=no,toolbar=no,height=500,width=590');		
+	
+	return false;
+}
+
+
+/**
+ * Marker is being dragged
+ */
+GMarker.prototype.markerDragged = function()
+{
+	// save the old latitude and longitude, just in case
+	point = this.getPoint();
+	this.oldLat = point.lat();
+	this.oldLong = point.lng();
+}
+
+/**
+ * Marker is being dropped, we have to update its coordinates
+ */
+GMarker.prototype.markerDropped = function()
+{
+	// new latitude and longitude
+	point = this.getPoint();
+	
+	// ask for a new description, if any
+	newDesc = prompt( "Enter new location description: ", this.locationDesc );
+	
+	if( newDesc == null )
+		return false;
+		
+	this.locationDesc = newDesc;
+
+	//alert("dropping location = " + this.locationDesc + " - id = " + this.locationId + " old lat = " + this.oldLat + " - new = " + lat );
+	
+	// update the location information via Ajax only if the marker already exists
+	if( this.locationId != undefined )
+		this.updateLocationAjax();
+}
+
+/**
+ * Updates the location data in the background
+ */
+GMarker.prototype.updateLocationAjax = function()
+{
+	if( this.locationId == -1 )
+		return false;
+
+	// built the URL to update the location
+	p = this.getPoint();
+	url = 'admin.php?op=updateLocation&locId=' + this.locationId + '&desc=' + encodeURIComponent( this.locationDesc ) + '&lat=' + p.lat() + '&long=' + p.lng();
+
+	// make the HTTP request
+	var transaction = YAHOO.util.Connect.asyncRequest( 'GET', url, { success:__handleUpdateLocationAjaxResponse, failure:__handleUpdateLocationAjaxResponse });
+	
+	// disable the "add location" button so that it cannot be clicked more than once
+	addButton = document.getElementById( 'addLocationButton' );
+	if( addButton != undefined )
+		addButton.disabled = true;
+}
+
+/**
+ * I don't know why I can't get this work as a method which is part of the GMarker object...
+ */
+function __handleUpdateLocationAjaxResponse( o )
+{
+	var xmldoc = o.responseXML;
+	var success = xmldoc.getElementsByTagName('success')[0].firstChild.nodeValue
+	var message = xmldoc.getElementsByTagName('message')[0].firstChild.nodeValue;
+		
+	// there was an error, let's not continue...
+	if( success == 0 ) {
+		window.alert(message);	
+		return( false );
+	}
+		
+	// show the success message
+	window.alert( message );	
+	
+	// get the id of the updated location from the response message
+	var locId = xmldoc.getElementsByTagName('id')[0].firstChild.nodeValue;	
+	// and the description
+	var locDesc = xmldoc.getElementsByTagName('desc')[0].firstChild.nodeValue;
+	
+	// get the list that holds the locations and if it's there, then 
+	// update the one that we just moved around
+	locationList = parent.opener.document.getElementById("locationId");	
+	if( locationList != undefined ) {		
+		for( i = 0; i < locationList.options.length; i++ ) {
+			if( locationList.options[i].value == locId )
+				locationList.options[i].text = locDesc;
+		}
+	}
+}
+
+/**
+ * Adds the new location data in the background
+ */
+GMarker.prototype.addLocationAjax = function()
+{
+	// built the URL to update the location
+	p = this.getPoint();
+	url = 'admin.php?op=addLocation&desc=' + encodeURIComponent( this.locationDesc ) + '&lat=' + p.lat() + '&long=' + p.lng();
+
+	// make the HTTP request
+	var transaction = YAHOO.util.Connect.asyncRequest( 'GET', url, { success:__handleAddLocationAjaxResponse, failure:__handleAddLocationAjaxResponse });
+}
+
+/**
+ * Handle the XmlHttpRequest callbacks with regards to adding new markers
+ * in the background
+ */
+function __handleAddLocationAjaxResponse( o )
+{
+	var xmldoc = o.responseXML;
+	var success = xmldoc.getElementsByTagName('success')[0].firstChild.nodeValue
+	var message = xmldoc.getElementsByTagName('message')[0].firstChild.nodeValue;
+		
+	// there was an error, let's not continue...
+	if( success == 0 ) {
+		window.alert(message);	
+		return( false );
+	}
+	
+	// get the id of the updated location from the response message
+	var locId = xmldoc.getElementsByTagName('id')[0].firstChild.nodeValue;	
+	// and the description
+	var locDesc = xmldoc.getElementsByTagName('desc')[0].firstChild.nodeValue;
+	
+	// get the list that holds the locations and if it's there, then 
+	// update the one that we just moved around
+	locationList = parent.opener.document.getElementById("locationId");	
+
 	// save the "add_new" option so that it doesn't get removed
 	addNewText = locationList.options[locationList.selectedIndex].text;
 	addNewValue = locationList.options[locationList.selectedIndex].value;	
 	
-	// if not, then we have to add it
+	// add the new option
 	opt = parent.opener.document.createElement( "option" );
-	opt.text = locationDesc.value;
-	opt.value = this.markerLat + "," + this.markerLong;
+	opt.text = locDesc;
+	opt.value = locId;
 	locationList.options[locationList.options.length - 1] = opt;
 	
-	// add the "add new" option
-	/*addNew = parent.opener.document.createElement( "option" );
-	addNew.text = addNewText;
-	addNew.value = addNewValue;
-	locationList.options[locationList.options.length - 1] = addNew;	*/
-	
 	// and select the last but one option (the new one that was added)
 	locationList.selectedIndex = locationList.options.length - 1;
 	
 	locationLatitude = parent.opener.document.getElementById("locationLat");
-	locationLatitude.value = this.markerLat;	
+	if( locationLatitude != undefined )
+		locationLatitude.value = this.markerLat;	
+	
 	locationLongitude = parent.opener.document.getElementById("locationLong");
-	locationLongitude.value = this.markerLong;
+	if( locationLongitude != undefined )
+		locationLongitude.value = this.markerLong;
+		
 	locationDesc = parent.opener.document.getElementById("locationDesc");
-	newLocationDesc = document.getElementById( "locationDesc" );
-	locationDesc.value = newLocationDesc.value;
+	if( locationDesc != undefined )	
+		locationDesc.value = newLocationDesc;
 	
-	return true;
+	// show the success message
+	window.alert( message );
+	
+	window.close();
 }
 
+/** 
+ * Marker is clicked
+ */
+GMarker.prototype.markerClicked = function()
+{
+	if( this.locationDesc != "" )
+		text = this.locationDesc + "<br/>";
+	else
+		text = "";
+
+	p = this.getPoint();		
+	this.openInfoWindowHtml( text + p.lat() + ", " + p.lng());
+}
+
+/**
+ * @private
+ */
+Lifetype.UI.Location.prototype._genMarker = function( locationInfo )
+{
+   	var coords = locationInfo.latlong.split(",");
+	lat = coords[0];
+	lng = coords[1]
+	desc = locationInfo.desc
+
+	var marker = new GMarker( new GLatLng( lat, lng ), { draggable: true });
+	marker.locationId = locationInfo.id;
+	marker.locationDesc = locationInfo.desc;
+
+	// check if the marker can be dragged
+	if( this.dynamicMarkerUpdate ) {
+		marker.enableDragging();
+		GEvent.bind( marker, "dragstart", marker, marker.markerDragged );
+		GEvent.bind( marker, "dragend", marker, marker.markerDropped );	
+	}
+	else {
+		marker.disableDragging();
+	}
+	
+	GEvent.bind( marker, "click", marker, marker.markerClicked );	
+
+	return( marker );
+}
+
+/**
+ * Displays all chooser locations
+ */
+Lifetype.UI.Location.prototype.displayAllLocations = function()
+{
+	for( i = 0; i < this.locations.length; i++ ) {
+		this.map.addOverlay( this._genMarker( this.locations[i] ));
+	}
+}
+
+/**
+ * Display the selected location
+ *
+ * @param
+ */
+Lifetype.UI.Location.prototype.displayLocation = function( loc )
+{
+	marker = this._genMarker( loc );
+	this.map.addOverlay( marker );
+}
+
 ///////////////////////////////////////////////////
 // code for the custom location selector
 ///////////////////////////////////////////////////
@@ -247,9 +468,8 @@
   for( i = 0; i < this.locations.length; i++ ) {
 	// build the option
     opt = document.createElement( "option" );
-    data = this.locations[i];
-    opt.text = data[1];
-    opt.value = data[0];
+    opt.text = this.locations[i].desc;
+    opt.value = this.locations[i].latlong;
     // and add it to the list
     try {
 	  // standards compliant, doesn't work in IE

Modified: plog/trunk/js/tinymce/tiny_mce-plog-resourcelist.js
===================================================================
--- plog/trunk/js/tinymce/tiny_mce-plog-resourcelist.js	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/js/tinymce/tiny_mce-plog-resourcelist.js	2007-02-17 17:52:17 UTC (rev 4743)
@@ -1,24 +1,3 @@
-function _generateBaseLink( dest, blogId, type, resourceName, resourceDesc, preview )
-{
-    if( type == 2 ) {
-	    if( preview == 1 ) {
-	        htmlCode = plogBaseUrl+'/resserver.php?blogId='+blogId+'&resource='+encodeURIComponent(resourceName)+'&mode=preview';
-	    }
-		else if( preview == 2) {
-			htmlCode = plogBaseUrl+'/resserver.php?blogId='+blogId+'&resource='+encodeURIComponent(resourceName)+'&mode=medium';
-		}
-	    else {
-	        htmlCode = plogBaseUrl+'/resserver.php?blogId='+blogId+'&resource='+encodeURIComponent(resourceName);
-	    }
-    }
-    else {
-	    // if not an image, there is not much we can do
-	    htmlCode = '<a title="'+resourceDesc+'" href="'+plogBaseUrl+'/resserver.php?blogId='+blogId+'&amp;resource='+encodeURIComponent(resourceName)+'">'+resourceName+'</a>';
-    }
-  
-    return htmlCode;
-}
-
 function _generateResourceLink( dest, blogId, type, resourceName, resourceDesc, preview, mimeType, resId, albumName, albumId )
 {
     var htmlCode = '';

Modified: plog/trunk/js/ui/overlay.js
===================================================================
--- plog/trunk/js/ui/overlay.js	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/js/ui/overlay.js	2007-02-17 17:52:17 UTC (rev 4743)
@@ -109,7 +109,7 @@
 		
 		a = document.createElement( "a" );
 		a.innerHTML = "&nbsp;X&nbsp;";
-		a.href = "#";
+		a.href = "javascript:void(0);";
 		a.style.textDecoration = "none";
 		YAHOO.util.Event.addListener( a, "click", this.toggle, this, true );
 		div.appendChild( a );

Modified: plog/trunk/js/ui/plogui.js
===================================================================
--- plog/trunk/js/ui/plogui.js	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/js/ui/plogui.js	2007-02-17 17:52:17 UTC (rev 4743)
@@ -136,25 +136,63 @@
 	}
 }
 
-function submitPostsList(op)
+//
+// declaration of the namespaces
+//
+Lifetype.UI.Pages = function() {}
+Lifetype.UI.Pages.EditPosts = function() {}
+
+/**
+ * Submit hook used for the 'bulk edit' in the editcomments.template
+ * page
+ *
+ * @param op
+ */
+Lifetype.UI.Pages.EditPosts.submitPostsList = function(op)
 {
-	if ( op == 'changePostsStatus' )
-	{
+	if ( op == 'changePostsStatus' ) {
 		if ( document.getElementById("postsList").postStatus.value == -1 )
-	    	window.alert(errorPostStatusMsg);
-		else
-		{
+	    	window.alert(errorLocationMsg);
+		else {
 			document.getElementById("postsList").op.value = op;
 			document.getElementById("postsList").submit();
 		}
 	}
-	else
-	{
+	else if( op == 'changePostsLocation' ) {
+		if ( document.getElementById("postsList").postLocation.value == -1 ) {
+	    	window.alert(errorPostLocationMsg);
+		}
+		else {
+			document.getElementById("postsList").op.value = op;
+			document.getElementById("postsList").submit();
+		}	
+	}
+	else {
 		document.getElementById("postsList").op.value = op;
 		document.getElementById("postsList").submit();
 	}
 }
 
+
+Lifetype.UI.Pages.EditResources = function() {}
+/**
+ * Submit hook used for the 'bulk edit' in the resources.templ
+ * page
+ * @param op
+ */
+Lifetype.UI.Pages.EditResources.submitGalleryItemsList = function(op)
+{
+	if( op == 'changeResourceLocation' ) {
+		if ( document.getElementById("Resources").resourceLocation.value == -1 ) {
+    		window.alert(errorLocationMsg);
+		}
+	}
+
+	document.getElementById("Resources").op.value = op;
+	document.getElementById("Resources").submit();
+}
+
+
 function submitCommentsList(op)
 {
 	if ( op == 'changeCommentsStatus' )
@@ -193,12 +231,6 @@
 	}
 }
 
-function submitGalleryItemsList(op)
-{
-	document.getElementById("Resources").op.value = op;
-	document.getElementById("Resources").submit();
-}
-
 function submitLinksList(op)
 {
 	document.getElementById("links").op.value = op;
@@ -227,4 +259,33 @@
    button.style.display = "none";     
    bar = document.getElementById("status_bar");
    bar.style.display = "block";
+}
+
+/**
+ * Code for the onChange hook in the "blog locations" page
+ */
+Lifetype.UI.Pages.BlogLocations = function() {}
+
+/**
+ * Sets up the iframe with the map, according to the current location id
+ *
+ * @param list
+ */
+Lifetype.UI.Pages.BlogLocations.showSelectedLocation = function( list )
+{
+	// get the location id
+	locId = list.options[ list.selectedIndex ].value;
+	
+	// build the URL to the display
+	if( locId < 0 )
+		url = "index.php?op=locationDisplay&blogId=" + (-locId) + "&width=600&height=400";
+	else
+		url = "index.php?op=locationDisplay&locId=" + locId + "&width=600&height=400";
+	
+	// set the parameters for the iframe
+	iframe = document.getElementById( "displayEmbeddedLocation" );
+	iframe.style.display = "block";
+	iframe.src = url;
+	
+	return( true );
 }
\ No newline at end of file

Added: plog/trunk/js/yui/connection/connection-min.js
===================================================================
--- plog/trunk/js/yui/connection/connection-min.js	                        (rev 0)
+++ plog/trunk/js/yui/connection/connection-min.js	2007-02-17 17:52:17 UTC (rev 4743)
@@ -0,0 +1,104 @@
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.12.2
+*/
+YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_header:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:'application/x-www-form-urlencoded',_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,setProgId:function(id)
+{this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b)
+{this._use_default_post_header=b;},setPollingInterval:function(i)
+{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId)
+{var obj,http;try
+{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};}
+catch(e)
+{for(var i=0;i<this._msxml_progid.length;++i){try
+{http=new ActiveXObject(this._msxml_progid[i]);obj={conn:http,tId:transactionId};break;}
+catch(e){}}}
+finally
+{return obj;}},getConnectionObject:function()
+{var o;var tId=this._transaction_id;try
+{o=this.createXhrObject(tId);if(o){this._transaction_id++;}}
+catch(e){}
+finally
+{return o;}},asyncRequest:function(method,uri,callback,postData)
+{var o=this.getConnectionObject();if(!o){return null;}
+else{if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(o.tId,callback,uri,postData);this.releaseObject(o);return;}
+if(method=='GET'){if(this._sFormData.length!=0){uri+=((uri.indexOf('?')==-1)?'?':'&')+this._sFormData;}
+else{uri+="?"+this._sFormData;}}
+else if(method=='POST'){postData=postData?this._sFormData+"&"+postData:this._sFormData;}}
+o.conn.open(method,uri,true);if(this._isFormSubmit||(postData&&this._use_default_post_header)){this.initHeader('Content-Type',this._default_post_header);if(this._isFormSubmit){this.resetFormState();}}
+if(this._has_http_headers){this.setHeader(o);}
+this.handleReadyState(o,callback);o.conn.send(postData||null);return o;}},handleReadyState:function(o,callback)
+{var oConn=this;if(callback&&callback.timeout){this._timeOut[o.tId]=window.setTimeout(function(){oConn.abort(o,callback,true);},callback.timeout);}
+this._poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState==4){window.clearInterval(oConn._poll[o.tId]);delete oConn._poll[o.tId];if(callback&&callback.timeout){delete oConn._timeOut[o.tId];}
+oConn.handleTransactionResponse(o,callback);}},this._polling_interval);},handleTransactionResponse:function(o,callback,isAbort)
+{if(!callback){this.releaseObject(o);return;}
+var httpStatus,responseObject;try
+{if(o.conn.status!==undefined&&o.conn.status!=0){httpStatus=o.conn.status;}
+else{httpStatus=13030;}}
+catch(e){httpStatus=13030;}
+if(httpStatus>=200&&httpStatus<300){try
+{responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);}
+else{callback.success.apply(callback.scope,[responseObject]);}}}
+catch(e){}}
+else{try
+{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,(isAbort?isAbort:false));if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
+else{callback.failure.apply(callback.scope,[responseObject]);}}
+break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
+else{callback.failure.apply(callback.scope,[responseObject]);}}}}
+catch(e){}}
+this.releaseObject(o);responseObject=null;},createResponseObject:function(o,callbackArg)
+{var obj={};var headerObj={};try
+{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i<header.length;i++){var delimitPos=header[i].indexOf(':');if(delimitPos!=-1){headerObj[header[i].substring(0,delimitPos)]=header[i].substring(delimitPos+2);}}}
+catch(e){}
+obj.tId=o.tId;obj.status=o.conn.status;obj.statusText=o.conn.statusText;obj.getResponseHeader=headerObj;obj.getAllResponseHeaders=headerStr;obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof callbackArg!==undefined){obj.argument=callbackArg;}
+return obj;},createExceptionObject:function(tId,callbackArg,isAbort)
+{var COMM_CODE=0;var COMM_ERROR='communication failure';var ABORT_CODE=-1;var ABORT_ERROR='transaction aborted';var obj={};obj.tId=tId;if(isAbort){obj.status=ABORT_CODE;obj.statusText=ABORT_ERROR;}
+else{obj.status=COMM_CODE;obj.statusText=COMM_ERROR;}
+if(callbackArg){obj.argument=callbackArg;}
+return obj;},initHeader:function(label,value)
+{if(this._http_header[label]===undefined){this._http_header[label]=value;}
+else{this._http_header[label]=value+","+this._http_header[label];}
+this._has_http_headers=true;},setHeader:function(o)
+{for(var prop in this._http_header){if(this._http_header.hasOwnProperty(prop)){o.conn.setRequestHeader(prop,this._http_header[prop]);}}
+delete this._http_header;this._http_header={};this._has_http_headers=false;},setForm:function(formId,isUpload,secureUri)
+{this.resetFormState();var oForm;if(typeof formId=='string'){oForm=(document.getElementById(formId)||document.forms[formId]);}
+else if(typeof formId=='object'){oForm=formId;}
+else{return;}
+if(isUpload){this.createFrame(secureUri?secureUri:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=oForm;return;}
+var oElement,oName,oValue,oDisabled;var hasSubmit=false;for(var i=0;i<oForm.elements.length;i++){oElement=oForm.elements[i];oDisabled=oForm.elements[i].disabled;oName=oForm.elements[i].name;oValue=oForm.elements[i].value;if(!oDisabled&&oName)
+{switch(oElement.type)
+{case'select-one':case'select-multiple':for(var j=0;j<oElement.options.length;j++){if(oElement.options[j].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].attributes['value'].specified?oElement.options[j].value:oElement.options[j].text)+'&';}
+else{this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].hasAttribute('value')?oElement.options[j].value:oElement.options[j].text)+'&';}}}
+break;case'radio':case'checkbox':if(oElement.checked){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
+break;case'file':case undefined:case'reset':case'button':break;case'submit':if(hasSubmit==false){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';hasSubmit=true;}
+break;default:this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';break;}}}
+this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);return this._sFormData;},resetFormState:function(){this._isFormSubmit=false;this._isFileUpload=false;this._formNode=null;this._sFormData="";},createFrame:function(secureUri){var frameId='yuiIO'+this._transaction_id;if(window.ActiveXObject){var io=document.createElement('<iframe id="'+frameId+'" name="'+frameId+'" />');if(typeof secureUri=='boolean'){io.src='javascript:false';}
+else if(typeof secureURI=='string'){io.src=secureUri;}}
+else{var io=document.createElement('iframe');io.id=frameId;io.name=frameId;}
+io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},appendPostData:function(postData)
+{var formElements=[];var postMessage=postData.split('&');for(var i=0;i<postMessage.length;i++){var delimitPos=postMessage[i].indexOf('=');if(delimitPos!=-1){formElements[i]=document.createElement('input');formElements[i].type='hidden';formElements[i].name=postMessage[i].substring(0,delimitPos);formElements[i].value=postMessage[i].substring(delimitPos+1);this._formNode.appendChild(formElements[i]);}}
+return formElements;},uploadFile:function(id,callback,uri,postData){var frameId='yuiIO'+id;var io=document.getElementById(frameId);this._formNode.action=uri;this._formNode.method='POST';this._formNode.target=frameId;if(this._formNode.encoding){this._formNode.encoding='multipart/form-data';}
+else{this._formNode.enctype='multipart/form-data';}
+if(postData){var oElements=this.appendPostData(postData);}
+this._formNode.submit();if(oElements&&oElements.length>0){try
+{for(var i=0;i<oElements.length;i++){this._formNode.removeChild(oElements[i]);}}
+catch(e){}}
+this.resetFormState();var uploadCallback=function()
+{var obj={};obj.tId=id;obj.argument=callback.argument;try
+{obj.responseText=io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;obj.responseXML=io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;}
+catch(e){}
+if(callback.upload){if(!callback.scope){callback.upload(obj);}
+else{callback.upload.apply(callback.scope,[obj]);}}
+if(YAHOO.util.Event){YAHOO.util.Event.removeListener(io,"load",uploadCallback);}
+else if(window.detachEvent){io.detachEvent('onload',uploadCallback);}
+else{io.removeEventListener('load',uploadCallback,false);}
+setTimeout(function(){document.body.removeChild(io);},100);};if(YAHOO.util.Event){YAHOO.util.Event.addListener(io,"load",uploadCallback);}
+else if(window.attachEvent){io.attachEvent('onload',uploadCallback);}
+else{io.addEventListener('load',uploadCallback,false);}},abort:function(o,callback,isTimeout)
+{if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this._poll[o.tId]);delete this._poll[o.tId];if(isTimeout){delete this._timeOut[o.tId];}
+this.handleTransactionResponse(o,callback,true);return true;}
+else{return false;}},isCallInProgress:function(o)
+{if(o.conn){return o.conn.readyState!=4&&o.conn.readyState!=0;}
+else{return false;}},releaseObject:function(o)
+{o.conn=null;o=null;}};
\ No newline at end of file

Added: plog/trunk/templates/admin/bloglocations.template
===================================================================
--- plog/trunk/templates/admin/bloglocations.template	                        (rev 0)
+++ plog/trunk/templates/admin/bloglocations.template	2007-02-17 17:52:17 UTC (rev 4743)
@@ -0,0 +1,41 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+  <meta http-equiv="Content-Type" content="text/html; charset={$locale->getCharset()}"/> 
+  <title>{$locale->tr("location")}</title>
+  <!-- Google Maps library -->
+  <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={$google_maps_api_key}" type="text/javascript"></script>
+  <!-- Yahoo UI Library -->
+  <script type="text/javascript" src="js/yui/yahoo/yahoo-min.js"></script> 
+  <script type="text/javascript" src="js/yui/dom/dom-min.js"></script> 
+  <script type="text/javascript" src="js/yui/event/event-min.js"></script>
+  <script type="text/javascript" src="js/yui/connection/connection-min.js"></script>
+  <!-- Lifetype UI library -->
+  <script type="text/javascript" src="js/ui/core.js"></script>
+  <script type="text/javascript" src="js/location/location.js"></script>
+  <script type="text/javascript">
+	// create the global object
+	l = new Lifetype.UI.Location();
+
+	l.locations = new Array(
+	  {foreach from=$locations item=loc name=locationsLoop}
+	  {literal}{{/literal} latlong: "{$loc->getLatitude()},{$loc->getLongitude()}", desc: "{$loc->getDescription()}", id: {$loc->getId()} {literal}}{/literal}{if !$smarty.foreach.locationsLoop.last},{/if}
+	  {/foreach}
+	);
+	
+	{literal}
+	  YAHOO.util.Event.addListener( window, "load", function() {
+		l.init( 2 );
+		l.displayAllLocations();
+	  });
+	  YAHOO.util.Event.addListener( window, "unload", GUnload());
+	{/literal}	
+  </script>
+</head>
+<body>
+  <body style="padding:0;margin:0">
+    <div id="map" style="width:{$width}px; height: {$height}px;margin:0;padding:0;"></div>
+    <input type="hidden" name="lat" value="" id="lat" />
+    <input type="hidden" name="long" value="" id="long" />
+	</body>
+</html>
\ No newline at end of file

Added: plog/trunk/templates/admin/bloglocationslist.template
===================================================================
--- plog/trunk/templates/admin/bloglocationslist.template	                        (rev 0)
+++ plog/trunk/templates/admin/bloglocationslist.template	2007-02-17 17:52:17 UTC (rev 4743)
@@ -0,0 +1,11 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=showBlogLocations title=$locale->tr("showBlogLocations")}
+
+<iframe
+  src="?op=adminLocationDisplay&blogId={$blog->getId()}&width=600&height=400"
+  style="width:600px;height:400px;border:0px;padding:0;margin:0"
+>
+</iframe>
+
+{include file="$admintemplatepath/footernavigation.template"}
+{include file="$admintemplatepath/footer.template"}
\ No newline at end of file

Modified: plog/trunk/templates/admin/chooser/header.template
===================================================================
--- plog/trunk/templates/admin/chooser/header.template	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/templates/admin/chooser/header.template	2007-02-17 17:52:17 UTC (rev 4743)
@@ -10,6 +10,7 @@
   <script type="text/javascript" src="js/yui/yahoo/yahoo-min.js"></script> 
   <script type="text/javascript" src="js/yui/dom/dom-min.js"></script> 
   <script type="text/javascript" src="js/yui/event/event-min.js"></script>
+  <script type="text/javascript" src="js/yui/connection/connection-min.js"></script>
   <!-- LifeType UI Library -->
   <script type="text/javascript" src="js/ui/core.js"></script>
   <script type="text/javascript" src="js/ui/tableeffects.js"></script>

Modified: plog/trunk/templates/admin/chooser/location.template
===================================================================
--- plog/trunk/templates/admin/chooser/location.template	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/templates/admin/chooser/location.template	2007-02-17 17:52:17 UTC (rev 4743)
@@ -1,44 +1,30 @@
 {include file="$admintemplatepath/chooser/header.template"}
-    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={$google_maps_api_key}"
-      type="text/javascript"></script>
+    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={$google_maps_api_key}" type="text/javascript"></script>
     <script type="text/javascript" src="js/location/location.js"></script>
+
     <script type="text/javascript">
 
 	// create the global object
 	l = new Lifetype.UI.Location();
 
-	l.locations = new Array(
-	  new Array( "0,0", "-- {$locale->tr("select")} --" )
-	  {foreach from=$locations item=loc name=locationsLoop}
-	  {if $smarty.foreach.locationsLoop.first},{/if}
-	  new Array( "{$loc->getLatitude()},{$loc->getLongitude()}", "{$loc->getDescription()}" ){if !$smarty.foreach.locationsLoop.last},{/if}
-	  {/foreach}
-	);
-		
-	{if $mode==2}
-	l.markerLat = '{$startLatitude}';
-	l.markerLong = '{$startLongitude}';
-	l.markerDesc = '{$startDescription}';
-	l.useCustomLocationControl = false;
-	l.displayOnlyMode = true;
 	// localized messages
 	l.locationLocaleNoMarkerHasBeenSetYet = "{$locale->tr("error_no_marker_set")}";
 	l.locationLocaleNoDescriptionError    = "{$locale->tr("error_no_description_set")}";	
-	{/if}
-	{literal}
-	  YAHOO.util.Event.addListener( window, "load", function() {
-		l.init();
-	  });
+	
+	  YAHOO.util.Event.addListener( window, "load", function() 	{literal}{{/literal}
+		l.init( '{$mode}' );
+
+{if $loc}		l.displayLocation({literal}{{/literal}latlong:'{$loc->getLatitude()},{$loc->getLongitude()}',desc:'{$loc->getDescription()|escape:"javascript"}',id:'{$loc->getId()}'{literal}}{/literal});
+{/if}
+	  {literal}}{/literal});
+
 	  YAHOO.util.Event.addListener( window, "unload", GUnload());
-	{/literal}	
     </script>
   <body style="padding:0;margin:0">
     <div id="map" style="width: 590px; height: 500px;margin:0;margin-bottom:5px;padding:0;"></div>
     {if $mode==1}
     <div id="data" style="width:100%;padding-left:10px">
-    Description:
-    <input type="text" name="locationDesc" value="" id="locationDesc" style="width:60%" >&nbsp;
-    <input type="button" onClick="if( l.AddLocation()) window.close(); " value="{$locale->tr("add_location")}" />
+    <input type="button" onClick="l.AddLocation()" id="addLocationButton" value="{$locale->tr("add_location")}" />
     </div>
     {/if}
     <input type="hidden" name="lat" value="" id="lat" />

Modified: plog/trunk/templates/admin/editposts.template
===================================================================
--- plog/trunk/templates/admin/editposts.template	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/templates/admin/editposts.template	2007-02-17 17:52:17 UTC (rev 4743)
@@ -69,14 +69,14 @@
                     <div class="list_nav_option">
                     <label for="location">{$locale->tr("location")}</label>
                     <br />
-                    <select name="showLocation" id="location">
+                    <select name="showLocation" id="locationId">
                      <option value="-1" {if $currentlocation == -1} selected="selected" {/if}>{$locale->tr("all")}</option>
                      <option value="0" {if $currentlocation == 0} selected="selected" {/if}>{$locale->tr("none")}</option>
 					 {foreach from=$locations item=location}
 					   <option value="{$location->getId()}" {if $currentlocation==$location->getId()}selected="selected"{/if}>{$location->getDescription()}</option>
 					 {/foreach}
                     </select>
-					<a href="#" onClick="Lifetype.UI.Location.displaySelectedLocationFromId('location', [ 0, -1 ] );">
+					<a href="javascript:void(0)" onClick="Lifetype.UI.Location.displaySelectedLocationFromId('locationId', [ 0, -1 ] );">
 					  <img src="imgs/admin/icon_globe-16.png" alt="View" style="border:0px" />
 					</a>
                     </div>

Modified: plog/trunk/templates/admin/header.template
===================================================================
--- plog/trunk/templates/admin/header.template	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/templates/admin/header.template	2007-02-17 17:52:17 UTC (rev 4743)
@@ -32,6 +32,7 @@
 <script type="text/javascript" src="js/ui/common.js"></script>
 <script type="text/javascript" src="js/ui/forms.js"></script>
 <script type="text/javascript" src="js/ui/core.js"></script>
+<script type="text/javascript" src="js/ui/plogui.js"></script>
 <script type="text/javascript" src="js/ui/tableeffects.js"></script>
 <script type="text/javascript" src="js/ui/overlay.js"></script>
 <!-- Yahoo UI Library -->

Modified: plog/trunk/templates/admin/menus.xml
===================================================================
--- plog/trunk/templates/admin/menus.xml	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/templates/admin/menus.xml	2007-02-17 17:52:17 UTC (rev 4743)
@@ -36,6 +36,9 @@
 		  <newBlogUser url="?op=newBlogUser" andPerms="add_blog_user" />
 		  <showBlogUsers url="?op=showBlogUsers" andPerms="view_blog_users" />
 		 </manageBlogUsers>
+		<manageBlogLocations ignoreBreadCrumbs="1" andPerms=""> 
+		  <showBlogLocations url="?op=showBlogLocations" andPerms="" />
+		 </manageBlogLocations>		
 		 <manageBlogTemplates ignoreBreadCrumbs="1" orPerms="add_blog_template,view_blog_templates"> 
 		  <newBlogTemplate url="?op=newBlogTemplate" andPerms="add_blog_template" />
 		  <blogTemplates url="?op=blogTemplates" andPerms="view_blog_templates" />

Modified: plog/trunk/templates/admin/resources.template
===================================================================
--- plog/trunk/templates/admin/resources.template	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/templates/admin/resources.template	2007-02-17 17:52:17 UTC (rev 4743)
@@ -38,14 +38,14 @@
    <div class="list_nav_option">
    <label for="location">{$locale->tr("location")}</label>
    <br />
-   <select name="showLocation" id="location">
+   <select name="showLocation" id="locationId">
     <option value="-1" {if $currentlocation == -1} selected="selected" {/if}>{$locale->tr("all")}</option>
     <option value="0" {if $currentlocation == 0} selected="selected" {/if}>{$locale->tr("none")}</option>
 	 {foreach from=$locations item=location}
 	   <option value="{$location->getId()}" {if $currentlocation==$location->getId()}selected="selected"{/if}>{$location->getDescription()}</option>
 	 {/foreach}
    </select>
-	<a href="#" onClick="Lifetype.UI.Location.displaySelectedLocationFromId('location', [ 0, -1 ] );">
+	<a href="javascript:void(0)" onClick="Lifetype.UI.Location.displaySelectedLocationFromId('locationId', [ 0, -1 ] );">
 	  <img src="imgs/admin/icon_globe-16.png" alt="View" style="border:0px" />
 	</a>
    </div>

Modified: plog/trunk/templates/misc/location.template
===================================================================
--- plog/trunk/templates/misc/location.template	2007-02-14 10:12:08 UTC (rev 4742)
+++ plog/trunk/templates/misc/location.template	2007-02-17 17:52:17 UTC (rev 4743)
@@ -17,21 +17,15 @@
 	// create the global object
 	l = new Lifetype.UI.Location();
 
-	// properties of the location object
-	l.markerLat = '{$startLatitude}';
-	l.markerLong = '{$startLongitude}';
-	l.markerDesc = '{$startDescription}';
-	l.useCustomLocationControl = false;
-	l.displayOnlyMode = true;
 	// localized messages
 	l.locationLocaleNoMarkerHasBeenSetYet = "{$locale->tr("error_no_marker_set")}";
 	l.locationLocaleNoDescriptionError    = "{$locale->tr("error_no_description_set")}";	
-	{literal}
-	  YAHOO.util.Event.addListener( window, "load", function() {
-		l.init();
-	  });
+
+	  YAHOO.util.Event.addListener( window, "load", function(){literal}{{/literal}	
+		l.init( 3 );
+		l.displayLocation({literal}{{/literal}latlong:'{$loc->getLatitude()},{$loc->getLongitude()}',desc:'{$loc->getDescription()}',id:'{$loc->getId()}'{literal}}{/literal});
+	  {literal}}{/literal}	);
 	  YAHOO.util.Event.addListener( window, "unload", GUnload());
-	{/literal}	
   </script>
 </head>
 <body>



More information about the pLog-svn mailing list