[pLog-svn] r4722 - in plog/trunk: class/action class/action/admin class/controller class/dao class/file class/gallery/dao class/misc class/view/admin locale templates/admin templates/admin/chooser templates/misc

oscar at devel.lifetype.net oscar at devel.lifetype.net
Mon Feb 12 18:45:55 EST 2007


Author: oscar
Date: 2007-02-12 18:45:54 -0500 (Mon, 12 Feb 2007)
New Revision: 4722

Added:
   plog/trunk/class/action/admin/adminchangegalleryitemslocationaction.class.php
   plog/trunk/class/action/admin/adminchangepostslocationaction.class.php
Modified:
   plog/trunk/class/action/admin/adminaction.class.php
   plog/trunk/class/action/admin/adminaddpostaction.class.php
   plog/trunk/class/action/admin/adminaddresourceaction.class.php
   plog/trunk/class/action/admin/adminchangegalleryitemsalbumaction.class.php
   plog/trunk/class/action/admin/adminchangepostscategoryaction.class.php
   plog/trunk/class/action/admin/adminchangepostsstatusaction.class.php
   plog/trunk/class/action/admin/admincleanupaction.class.php
   plog/trunk/class/action/admin/admineditpostsaction.class.php
   plog/trunk/class/action/admin/adminlocationdisplayaction.class.php
   plog/trunk/class/action/admin/adminresourcesaction.class.php
   plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php
   plog/trunk/class/action/admin/adminupdatepostaction.class.php
   plog/trunk/class/action/admin/adminupdateresourceaction.class.php
   plog/trunk/class/action/viewalbumaction.class.php
   plog/trunk/class/controller/admincontrollermap.properties.php
   plog/trunk/class/dao/articles.class.php
   plog/trunk/class/dao/searchengine.class.php
   plog/trunk/class/file/file.class.php
   plog/trunk/class/gallery/dao/galleryresources.class.php
   plog/trunk/class/misc/version.class.php
   plog/trunk/class/view/admin/admineditpostview.class.php
   plog/trunk/class/view/admin/admineditresourceview.class.php
   plog/trunk/class/view/admin/adminpostslistview.class.php
   plog/trunk/class/view/admin/adminresourceslistview.class.php
   plog/trunk/class/view/admin/adminview.class.php
   plog/trunk/locale/locale_en_UK.php
   plog/trunk/locale/locale_es_ES.php
   plog/trunk/templates/admin/chooser/resourcelist.template
   plog/trunk/templates/admin/editlinks.template
   plog/trunk/templates/admin/editpost.template
   plog/trunk/templates/admin/editposts.template
   plog/trunk/templates/admin/header.template
   plog/trunk/templates/admin/newpost.template
   plog/trunk/templates/admin/resourceinfo.template
   plog/trunk/templates/admin/resources.template
   plog/trunk/templates/misc/location.template
Log:
Plenty of changes so far:
- Implemented support for changing the location when editing posts and resources
- Implemented support for changing the location when using the 'bulk edit' feature for resources and posts
- moved some javascript code to the Lifetype.UI.* namespace
- Merged from 1.2 to trunk up to revision 4719
- Added support for using locations as filters for resources and posts, and modified all related classes


Modified: plog/trunk/class/action/admin/adminaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaction.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/action/admin/adminaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -304,6 +304,33 @@
 		function getRequiredPermissions()
 		{
 			return( $this->_permissions );
-		}		
+		}
+		
+		/**
+		 * Check if there was any location information in the request. If there was
+		 * process it accordingly and return the id of the location object
+		 *
+		 * @return the id of a location object
+		 */
+		function getLocationFromRequest()
+		{
+			$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();
+				}
+			}
+			
+			return( $locId );
+		}
     }
 ?>
\ No newline at end of file

Modified: plog/trunk/class/action/admin/adminaddpostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddpostaction.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/action/admin/adminaddpostaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -82,22 +82,7 @@
 			$this->notifyEvent( EVENT_PRE_POST_ADD, Array( "article" => &$article ));
 			
 			// location data, if necessary
-			// check if we have to save the location data
-			$config =& Config::getConfig();
-			if( $config->getValue( "location_data_enabled", false )) {
-				if ($this->_request->getValue( "locationId") == "0" ) {
-					// no location set
-					$article->setLocationId( 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" ));
-					$article->setLocation( $location );
-				}
-			}					
+			$article->setLocationId( $this->getLocationFromRequest());
 			
 			// in case the post is already in the db
 			if( $this->_postId != "" ) {

Modified: plog/trunk/class/action/admin/adminaddresourceaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddresourceaction.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/action/admin/adminaddresourceaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -111,22 +111,8 @@
 					$resource = $resources->getResource( $res, $this->_blogInfo->getId());
 					
 					// check if we have to save the location data
-					$config =& Config::getConfig();
-					if( $config->getValue( "location_data_enabled", false )) {
-						if ($this->_request->getValue( "locationId") == "0" ) {
-							// no location set
-							$resource->setLocationId( 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" ));
-							$resource->setLocation( $location );
-                            $resources->updateResource( $resource );
-						}
-					}
+					$resource->setLocationId( $this->getLocationFromRequest());
+                    $resources->updateResource( $resource );
 					
 					$this->notifyEvent( EVENT_POST_RESOURCE_ADD, Array( "resource" => &$resource ));					
 				}

Modified: plog/trunk/class/action/admin/adminchangegalleryitemsalbumaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminchangegalleryitemsalbumaction.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/action/admin/adminchangegalleryitemsalbumaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -97,20 +97,20 @@
 					$result = $resources->updateResource( $resource );
 					
 					if( !$result ) {
-						$this->_errorMessage .= $this->_locale->pr("error_deleting_resource", $resource->getFileName())."<br/>";
+						$this->_errorMessage .= $this->_locale->pr("error_updating_resource", $resource->getFileName())."<br/>";
 					}
 					else {
 						$this->_totalOk++;
 						if( $this->_totalOk < 2 ) 
-							$this->_successMessage .= $this->_locale->pr("item_updated_ok", $resource->getFileName());
+							$this->_successMessage .= $this->_locale->pr("resource_updated_ok", $resource->getFileName());
 						else
-							$this->_successMessage = $this->_locale->pr("items_updated_ok", $this->_totalOk );
+							$this->_successMessage = $this->_locale->pr("resources_updated_ok", $this->_totalOk );
 						// fire the post event
 						$this->notifyEvent( EVENT_POST_RESOURCE_UPDATE, Array( "article" => &$post ));					
 					}
 				} 
 				else {
-					$this->_errorMessage .= $this->_locale->pr("error_deleting_resource2", $resourceId )."<br/>";
+					$this->_errorMessage .= $this->_locale->pr("error_updating_resource2", $resourceId )."<br/>";
 				}
 			}
         }
@@ -142,14 +142,14 @@
 					else {
 						$this->_totalOk++;
 						if( $this->_totalOk < 2 ) 
-							$this->_successMessage = $this->_locale->pr("item_updated_ok", $album->getName());
+							$this->_successMessage = $this->_locale->pr("album_updated_ok", $album->getName());
 						else
-							$this->_successMessage = $this->_locale->pr("items_updated_ok", $this->_totalOk );
+							$this->_successMessage = $this->_locale->pr("albums_updated_ok", $this->_totalOk );
 						// fire the post event
 						$this->notifyEvent( EVENT_POST_ALBUM_UPDATE, Array( "album" => &$album ));	
 					}
 				} else {
-					$this->_errorMessage .= $this->_locale->pr( "error_deleting_album2", $albumId )."<br/>";
+					$this->_errorMessage .= $this->_locale->pr( "error_updating_album2", $albumId )."<br/>";
             	}
 			}
         }

Added: plog/trunk/class/action/admin/adminchangegalleryitemslocationaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminchangegalleryitemslocationaction.class.php	                        (rev 0)
+++ plog/trunk/class/action/admin/adminchangegalleryitemslocationaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -0,0 +1,113 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresource.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/template/cachecontrol.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/view/admin/adminresourceslistview.class.php" );
+
+    /**
+     * \ingroup Action
+     * @private
+     *
+     * Massive changes resources and albums to another Album
+     */
+    class AdminChangeGalleryItemsLocationAction extends AdminAction
+    {
+
+    	var $_resourceIds;
+		var $_albumIds;
+		var $_locationId;
+		
+		var $_successMessage;
+		var $_errorMessage;
+		var $_totalOk;
+
+    	/**
+         * Constructor. If nothing else, it also has to call the constructor of the parent
+         * class, BlogAction with the same parameters
+         */
+        function AdminChangeGalleryItemsLocationAction( $actionInfo, $request )
+        {
+        	$this->AdminAction( $actionInfo, $request );
+
+			$this->_totalOk = 0;
+			$this->_successMessage = "";
+			$this->_errorMessage = "";
+			
+			// data validation
+			$this->registerFieldValidator( "resourceIds", new ArrayValidator(), true );
+			$this->registerFieldValidator( "locationId", new IntegerValidator(), true );
+			$view = new AdminResourcesListView( $this->_blogInfo );
+			$view->setErrorMessage( $this->_locale->tr("error_no_resources_selected"));
+			$this->setValidationErrorView( $view );
+        }
+		
+		function perform()
+		{
+			// create the view
+			$this->_view = new AdminResourcesListView( $this->_blogInfo );
+
+			// fetch the parameters
+			$this->_resourceIds = $this->_request->getValue( "resourceIds" );
+			$this->_locationId = $this->_request->getValue( "locationId" );
+
+			// make sure that we're dealing with arrays!
+			if( !is_array( $this->_resourceIds)) $this->_resourceIds = Array();
+
+			$this->_updateResources();
+
+			// put error and success messages (if any) into the view
+			if( $this->_successMessage != "" ) $this->_view->setSuccessMessage( $this->_successMessage );
+			if( $this->_errorMessage != "" ) $this->_view->setErrorMessage( $this->_errorMessage );
+			$this->setCommonData();
+			
+			// clear the cache
+			CacheControl::resetBlogCache( $this->_blogInfo->getId(), false );
+
+            // better to return true if everything fine
+            return true;		
+		}
+
+        /**
+		 * updates resources from the list
+         */
+        function _updateResources()
+        {
+        	// Chanages the resource album field by selection
+            $resources = new GalleryResources();
+
+            foreach( $this->_resourceIds as $resourceId ) {
+            	// get the resource
+                $resource = $resources->getResource( $resourceId, $this->_blogInfo->getId());
+				
+				if( $resource ) {
+					// fire the event
+					$this->notifyEvent( EVENT_PRE_RESOURCE_UPDATE, Array( "resource" => &$resource ));
+						
+					// update the resource location
+					$resource->setLocationId( $this->_locationId );
+					$result = $resources->updateResource( $resource );
+					
+					if( !$result ) {
+						$this->_errorMessage .= $this->_locale->pr("error_updating_resource", $resource->getFileName())."<br/>";
+					}
+					else {
+						$this->_totalOk++;
+						if( $this->_totalOk < 2 ) 
+							$this->_successMessage .= $this->_locale->pr("resource_updated_ok", $resource->getFileName());
+						else
+							$this->_successMessage = $this->_locale->pr("resources_updated_ok", $this->_totalOk );
+						// fire the post event
+						$this->notifyEvent( EVENT_POST_RESOURCE_UPDATE, Array( "article" => &$post ));					
+					}
+				} 
+				else {
+					$this->_errorMessage .= $this->_locale->pr("error_updating_resource2", $resourceId )."<br/>";
+				}
+			}
+        }
+    }
+?>

Modified: plog/trunk/class/action/admin/adminchangepostscategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminchangepostscategoryaction.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/action/admin/adminchangepostscategoryaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -56,20 +56,20 @@
 					$result = $articles->updateArticle( $post );
 					
 					if( !$result ) {
-						$errorMessage .= $this->_locale->pr("error_update_article", $post->getTopic())."<br/>";
+						$errorMessage .= $this->_locale->pr("error_updating_post", $post->getTopic())."<br/>";
 					}
 					else {
 						$totalOk++;
 						if( $totalOk < 2 ) 
-							$successMessage .= $this->_locale->pr("article_updated_ok", $post->getTopic())."<br/>";
+							$successMessage .= $this->_locale->pr("post_updated_ok", $post->getTopic())."<br/>";
 						else
-							$successMessage = $this->_locale->pr("articles_updated_ok", $totalOk );
+							$successMessage = $this->_locale->pr("posts_updated_ok", $totalOk );
 						// fire the post event
 						$this->notifyEvent( EVENT_POST_POST_UPDATE, Array( "article" => &$post ));					
 					}
 				}
 				else {
-					$errorMessage .= $this->_locale->pr( "error_updating_article2", $postId )."<br/>";
+					$errorMessage .= $this->_locale->pr( "error_updating_posts2", $postId )."<br/>";
 				}
             }
 			

Added: plog/trunk/class/action/admin/adminchangepostslocationaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminchangepostslocationaction.class.php	                        (rev 0)
+++ plog/trunk/class/action/admin/adminchangepostslocationaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -0,0 +1,102 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/view/admin/adminpostslistview.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/dao/locations.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/template/cachecontrol.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+
+    /**
+     * \ingroup Action
+     * @private
+     *
+     * Massive changes posts status
+     */
+    class AdminChangePostsLocationAction extends AdminAction 
+	{
+
+        var $_postIds;
+        var $_postLocation;
+
+    	/**
+         * Constructor. If nothing else, it also has to call the constructor of the parent
+         * class, BlogAction with the same parameters
+         */
+        function AdminChangePostsLocationAction( $actionInfo, $request )
+        {
+        	$this->AdminAction( $actionInfo, $request );
+			$this->registerFieldValidator( "postIds", new ArrayValidator());
+			$this->registerFieldValidator( "postLocation", new IntegerValidator() );
+			$view = new AdminPostsListView( $this->_blogInfo );
+			$view->setErrorMessage( $this->_locale->tr("error_incorrect_article_id"));
+			$this->setValidationErrorView( $view );		
+        }
+
+        /**
+         * Carries out the specified action
+         */
+        function _changePostsStatus()
+        {
+        	// Chanages the post status field by selection
+            $articles = new Articles();
+            $errorMessage = "";
+			$successMessage = "";
+			$totalOk = 0;
+			
+            foreach( $this->_postIds as $postId ) {
+            	// get the post
+                $post = $articles->getBlogArticle( $postId, $this->_blogInfo->getId());
+				
+				if( $post ) {
+					// fire the event
+					$this->notifyEvent( EVENT_PRE_POST_UPDATE, Array( "article" => &$post ));
+					
+					// update the post status
+					$post->setLocationId( $this->_postLocation );
+					$result = $articles->updateArticle( $post );
+					
+					if( !$result ) {
+						$errorMessage .= $this->_locale->pr("error_updating_post", $post->getTopic())."<br/>";
+					}
+					else {
+						$totalOk++;
+						if( $totalOk < 2 ) 
+							$successMessage .= $this->_locale->pr("post_updated_ok", $post->getTopic())."<br/>";
+						else
+							$successMessage = $this->_locale->pr("posts_updated_ok", $totalOk );
+						// fire the post event
+						$this->notifyEvent( EVENT_POST_POST_UPDATE, Array( "article" => &$post ));					
+					}
+				}
+				else {
+					$errorMessage .= $this->_locale->pr( "error_updating_post2", $postId )."<br/>";
+				}
+            }
+			
+			// clean up the cache
+			CacheControl::resetBlogCache( $this->_blogInfo->getId());
+
+			$this->_view = new AdminPostsListView( $this->_blogInfo );
+			if( $errorMessage != "" ) 
+				$this->_view->setErrorMessage( $errorMessage );
+			if( $successMessage != "" )
+				$this->_view->setSuccessMessage( $successMessage );
+				
+			$this->setCommonData();
+			
+            return true;
+        }
+		
+		function perform()
+		{
+			// prepare the parameters.. If there's only one category id, then add it to
+			// an array.
+			$this->_postIds = $this->_request->getValue( "postIds" );
+			$this->_postLocation = $this->_request->getValue( "postLocation" );
+				
+			$this->_changePostsStatus();
+		}
+    }
+?>
\ No newline at end of file

Modified: plog/trunk/class/action/admin/adminchangepostsstatusaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminchangepostsstatusaction.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/action/admin/adminchangepostsstatusaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -57,20 +57,20 @@
 					$result = $articles->updateArticle( $post );
 					
 					if( !$result ) {
-						$errorMessage .= $this->_locale->pr("error_update_article", $post->getTopic())."<br/>";
+						$errorMessage .= $this->_locale->pr("error_updating_post", $post->getTopic())."<br/>";
 					}
 					else {
 						$totalOk++;
 						if( $totalOk < 2 ) 
-							$successMessage .= $this->_locale->pr("article_updated_ok", $post->getTopic())."<br/>";
+							$successMessage .= $this->_locale->pr("post_updated_ok", $post->getTopic())."<br/>";
 						else
-							$successMessage = $this->_locale->pr("articles_updated_ok", $totalOk );
+							$successMessage = $this->_locale->pr("posts_updated_ok", $totalOk );
 						// fire the post event
 						$this->notifyEvent( EVENT_POST_POST_UPDATE, Array( "article" => &$post ));					
 					}
 				}
 				else {
-					$errorMessage .= $this->_locale->pr( "error_updating_article2", $postId )."<br/>";
+					$errorMessage .= $this->_locale->pr( "error_updating_post2", $postId )."<br/>";
 				}
             }
 			

Modified: plog/trunk/class/action/admin/admincleanupaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admincleanupaction.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/action/admin/admincleanupaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -135,7 +135,7 @@
 			include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
 			$config =& Config::getConfig();
 			$tmpFolder = $config->getValue( "temp_folder" );
-			$excludes = array('.htaccess');
+			$excludes = array('.htaccess', '.svn');
 			File::deleteDir( $tmpFolder, true, true, $excludes );
 			
 			$this->_message = $this->_locale->tr( "temp_folder_reset_ok" );

Modified: plog/trunk/class/action/admin/admineditpostsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditpostsaction.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/action/admin/admineditpostsaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -33,7 +33,8 @@
 												          "showStatus" => $this->_request->getValue( "showStatus" ),
 														  "showUser" => $this->_request->getValue( "showUser" ),
 														  "showMonth" => $this->_request->getValue( "showMonth" ),
-														  "searchTerms" => $this->_request->getValue( "searchTerms" )));
+														  "searchTerms" => $this->_request->getValue( "searchTerms" ),
+														  "showLocation" => $this->_request->getValue( "showLocation" )));
             $this->setCommonData();
 
             // better to return true if everything fine

Modified: plog/trunk/class/action/admin/adminlocationdisplayaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminlocationdisplayaction.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/action/admin/adminlocationdisplayaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -19,13 +19,22 @@
 				$coords = explode( ",", $c );
 				$this->_view->setLatitude( $coords[0] );
 				$this->_view->setLongitude( $coords[1] );
+				$this->_view->setDescription( $this->_request->getValue( "desc" ));				
 			}
+			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());
+			}
 			else {
 				$this->_view->setLatitude( $this->_request->getValue( "lat" ));
 				$this->_view->setLongitude( $this->_request->getValue( "long" ));				
+				$this->_view->setDescription( $this->_request->getValue( "desc" ));				
 			}
-
-			$this->_view->setDescription( $this->_request->getValue( "desc" ));
 			
 			// and set the mode to viewer instead of chooser
 			$this->_view->setMode( LOCATION_POPUP_VIEWER_MODE );

Modified: plog/trunk/class/action/admin/adminresourcesaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminresourcesaction.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/action/admin/adminresourcesaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -16,6 +16,7 @@
     {
 
     	var $_albumId;
+		var $_locationId;
 
     	/**
          * Constructor. If nothing else, it also has to call the constructor of the parent
@@ -61,6 +62,7 @@
         {
             $this->_albumId = $this->_request->getValue( "albumId", 0 );
 			$this->_searchTerms = $this->_request->getValue( "searchTerms" );
+			$this->_locationId = $this->_request->getValue( "showLocation", -1 );
 
 			$errorMessage = $this->checkFolders();
 			if( $errorMessage ) {
@@ -70,7 +72,8 @@
 			}
 			else {
 				$this->_view = new AdminResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_albumId,
-																					"searchTerms" => $this->_searchTerms ));
+																					"searchTerms" => $this->_searchTerms,
+																					"locationId" => $this->_locationId ));
 			}
 
             $this->setCommonData();

Modified: plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -175,22 +175,8 @@
             }
 
 			// check if we have to save the location data
-			$config =& Config::getConfig();
-			if( $config->getValue( "location_data_enabled", false )) {
-				if ($this->_request->getValue( "locationId") == "0" ) {
-					// no location set
-					$this->_blogInfo->setLocationId( 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" ));
-					$this->_blogInfo->setLocation( $location );
-				}
-			}
-
+			$this->_blogInfo->setLocationId( $this->getLocationFromRequest());
+			
             // and now update the settings in the database
             $blogs = new Blogs();
 

Modified: plog/trunk/class/action/admin/adminupdatepostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatepostaction.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/action/admin/adminupdatepostaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -129,6 +129,9 @@
                 $post->setFields( $fields );
 			}
 			
+			// location data, if necessary
+			$post->setLocationId( $this->getLocationFromRequest());			
+			
 			// fire the pre event
 			$this->notifyEvent( EVENT_PRE_POST_UPDATE, Array( "article" => &$post ));
 		

Modified: plog/trunk/class/action/admin/adminupdateresourceaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateresourceaction.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/action/admin/adminupdateresourceaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -71,6 +71,8 @@
             // update the fields we'd like to update
             $resource->setAlbumId( $this->_albumId );
             $resource->setDescription( $this->_resourceDescription );
+			// location data, if any
+			$resource->setLocationId( $this->getLocationFromRequest());			
 			// send the event
 			$this->notifyEvent( EVENT_PRE_RESOURCE_UPDATE, Array( "resource" => &$resource ));						
             // and update it in the db

Modified: plog/trunk/class/action/viewalbumaction.class.php
===================================================================
--- plog/trunk/class/action/viewalbumaction.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/action/viewalbumaction.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -116,6 +116,7 @@
 																  $album->getId(),
 																  GALLERY_RESOURCE_ANY,
 																  "",
+																  -1,
 																  $this->_page,
 																  DEFAULT_ITEMS_PER_PAGE );															
 																  

Modified: plog/trunk/class/controller/admincontrollermap.properties.php
===================================================================
--- plog/trunk/class/controller/admincontrollermap.properties.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/controller/admincontrollermap.properties.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -37,9 +37,10 @@
     // removes a post from the database
     $actions["deletePost"] = "AdminDeletePostAction";
 	$actions["deletePosts"] = "AdminDeletePostAction";
-	// massive change post status & category
+	// massive change post status, category and location
 	$actions["changePostsStatus"] = "AdminChangePostsStatusAction";
 	$actions["changePostsCategory"] = "AdminChangePostsCategoryAction";
+	$actions["changePostsLocation"] = "AdminChangePostsLocationAction";
     // log out
     $actions["Logout"] = "AdminLogoutAction";
     // shows form to add a new link category
@@ -215,6 +216,7 @@
 	$actions["deleteResourceItems"] = "AdminDeleteGalleryItemsAction";
 	// massive change gallery items album
 	$actions["changeGalleryItemsAlbum"] = "AdminChangeGalleryItemsAlbumAction";
+	$actions["changeGalleryItemsLocation"] = "AdminChangeGalleryItemsLocationAction";	
     // mark as spam
     $actions["markComment"] = "AdminMarkCommentAction";
     $actions["markTrackback"] = "AdminMarkTrackbackAction";	

Modified: plog/trunk/class/dao/articles.class.php
===================================================================
--- plog/trunk/class/dao/articles.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/dao/articles.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -199,11 +199,12 @@
                                      $status = POST_STATUS_PUBLISHED,
                                      $userId = 0,
                                      $maxDate = 0,
-                                     $searchTerms = "")
+                                     $searchTerms = "",
+									 $locationId = -1 )
 		{
             $postStatus = $status;
 		    $prefix = $this->getPrefix();
-            $where = $this->buildWhere( $blogId, $date, -1, $categoryId, $status, $userId, $maxDate, $searchTerms );
+            $where = $this->buildWhere( $blogId, $date, -1, $categoryId, $status, $userId, $maxDate, $searchTerms, $locationId );
             $query = "SELECT COUNT(a.id) AS total FROM {$prefix}articles a, {$prefix}articles_categories c, {$prefix}article_categories_link l WHERE $where ";
 
             $result = $this->_db->Execute( $query );
@@ -348,7 +349,8 @@
 							 $status = 0, 
 							 $userId = 0, 
 							 $maxDate = 0, 
-							 $searchTerms = "" )
+							 $searchTerms = "",
+							 $locationId  = -1 )
 		{
             $postStatus = $status;
 		    $prefix = $this->getPrefix();
@@ -382,6 +384,11 @@
                 }
             }
 
+			if( $locationId != -1 ) {
+				// location filter
+				$query .= " AND loc_id = ".Db::qstr( $locationId );
+			}
+
             if( $status > 0 )
                 $query .= " AND a.status = '$postStatus'";
             if( $userId > 0 )
@@ -418,6 +425,7 @@
          * @param maxDate a date in MySQL TIMESTAMP(14)
 		 * @param searchTerms in case we would like to further refine the filtering, 
                               we can also use search features
+		 * @param locationId A location identifier
          * @return Returns an array with all the articles from the given blog
          */
 
@@ -429,6 +437,7 @@
                                   $userId       = 0, 
                                   $maxDate      = 0, 
                                   $searchTerms  = "", 
+								  $locationId   = -1,
                                   $page         = -1 )
         {
             // build the query
@@ -437,7 +446,7 @@
             // wether the category has to be shown in the main page or not, etc...
             $postStatus = $status;
 		    $prefix = $this->getPrefix();
-		    $where = $this->buildWhere( $blogId, $date, $amount, $categoryId, $status, $userId, $maxDate, $searchTerms );
+		    $where = $this->buildWhere( $blogId, $date, $amount, $categoryId, $status, $userId, $maxDate, $searchTerms, $locationId );
             $query = "SELECT a.id as id, a.id, a.date,
                              a.user_id,a.blog_id,a.status,a.properties,
                              a.num_reads, a.slug, 1 AS relevance, a.num_comments AS num_comments,
@@ -1236,4 +1245,4 @@
 
         }
     }
-?>
+?>
\ No newline at end of file

Modified: plog/trunk/class/dao/searchengine.class.php
===================================================================
--- plog/trunk/class/dao/searchengine.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/dao/searchengine.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -373,6 +373,7 @@
                                    										   GALLERY_NO_ALBUM, 
 									                                   	   GALLERY_RESOURCE_ANY,
 																	   	   $searchTerms,
+																	 	   -1,
 									                                   	   $page, 
 									                                   	   $itemsPerPage );											
 														  

Modified: plog/trunk/class/file/file.class.php
===================================================================
--- plog/trunk/class/file/file.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/file/file.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -240,7 +240,7 @@
 		  * @param onlyFiles If the recursive mode is enabled, setting this to 'true' will
 		  * force the method to only remove files but not folders. The directory will not be
 		  * removed but all the files included it in (and all subdirectories) will be.
-		  * @param excludedFiles If some files should not be removed (like .htaccess) they can be added
+		  * @param excludedFiles If some files or directories should not be removed (like .htaccess) they can be added
 		  * to this array. This operation is case sensitive!
 		  * @return True if successful or false otherwise
 		  * @static
@@ -265,7 +265,8 @@
 			$files = Glob::myGlob( $dirName, "*" );
 			foreach( $files as $file ) 
 			{
-				if( File::isDir( $file )) {
+				// check if the filename is in the list of files we must not delete
+				if( File::isDir( $file ) && array_search(basename( $file ), $excludedFiles) === false) {
 					// perform a recursive call if we were allowed to do so
 					if( $recursive ) {
 						File::deleteDir( $file, $recursive, $onlyFiles );

Modified: plog/trunk/class/gallery/dao/galleryresources.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresources.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/gallery/dao/galleryresources.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -173,11 +173,13 @@
         /**
          * Returns all the resources that belong to a blog
          *
-         * @param blogId The blog to which the resources belong, use -1 to indicate any blog/owner
+         * @param ownerId The blog to which the resources belong, use -1 to indicate any blog/owner
          * @param albumId Filters by album
+         * @param resourceType
+		 * @param searchTerms
+		 * @param locationId
 		 * @param page
 		 * @param itemsPerPage
-		 * @param searchTerms
          * @return Returns an array of GalleryResource objects with all
          * the resources that match the given conditions, or empty
          * if none could be found.
@@ -186,6 +188,7 @@
                                    $albumId = GALLERY_NO_ALBUM, 
                                    $resourceType = GALLERY_RESOURCE_ANY,
 								   $searchTerms = "",
+								   $locationId = -1,
                                    $page = DEFAULT_PAGING_ENABLED, 
                                    $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
         {
@@ -199,7 +202,9 @@
             if( $resourceType != GALLERY_RESOURCE_ANY )
                 $query .= " resource_type = '".Db::qstr($resourceType)."' AND";
             if( $searchTerms != "" )
-                $query .= " (".$this->getSearchConditions( $searchTerms ).")";
+                $query .= " (".$this->getSearchConditions( $searchTerms ).") AND";
+			if( $locationId != -1 ) 
+				$query .= " loc_id = '".Db::qstr( $locationId )."' AND";
             
                 // just in case if for any reason the string ends with "AND"
             $query = trim( $query );
@@ -256,7 +261,7 @@
 		 * @see getUserResources
 		 * @return the total number of items
 		 */
-		function getNumUserResources( $ownerId, $albumId = GALLERY_NO_ALBUM, $resourceType = GALLERY_RESOURCE_ANY, $searchTerms = "" )
+		function getNumUserResources( $ownerId, $albumId = GALLERY_NO_ALBUM, $resourceType = GALLERY_RESOURCE_ANY, $searchTerms = "", $locationId = -1 )
 		{
 			$prefix = $this->getPrefix();
 			$table  = "{$prefix}gallery_resources";
@@ -275,6 +280,8 @@
 				$searchParams = $this->getSearchConditions( $searchTerms );
 				$cond .= " AND (".$searchParams.")";
 			}
+			if( $locationId != -1 ) 
+				$cond .= " AND loc_id = '".Db::qstr( $locationId )."'";	
 
 			// return the number of items
 			return( $this->getNumItems( $table, $cond ));
@@ -862,8 +869,6 @@
 				$query .= " OR normalized_description LIKE '%".Db::qstr( $searchTerms )."%'";
 			}
 			
-			print($query);
-			
 			return( $query );
 		}
 		

Modified: plog/trunk/class/misc/version.class.php
===================================================================
--- plog/trunk/class/misc/version.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/misc/version.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -25,11 +25,12 @@
 			lt_include( PLOG_CLASS_PATH."class/file/file.class.php" );		
             $versionFile = PLOG_CLASS_PATH."version.php";
 			$version = "undefined";
-            if( File::isReadable( $versionFile ))
-                lt_include( $versionFile );
-            else
+
+            if( File::isReadable( $versionFile )) {
+                include( $versionFile );
+            } else {
                 $version = "UNKNOWN";
-
+            }
             return $version;
         }
 
@@ -58,4 +59,4 @@
 			return( version_compare( $v1, $v2 ));
 		}
     }
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/class/view/admin/admineditpostview.class.php
===================================================================
--- plog/trunk/class/view/admin/admineditpostview.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/view/admin/admineditpostview.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -78,6 +78,16 @@
 	            $this->setValue( "postHour", $postDate->getHour());
 	            $this->setValue( "postMinutes", $postDate->getMinutes());
 	            $this->setValue( "globalArticleCategoryId", $this->_article->getGlobalCategoryId());
+	
+				$config =& Config::getConfig();
+				if( $config->getValue( "location_data_enabled", false )) {
+					if( $this->_article->hasLocationData()) {
+						$this->setValue( "location", $this->_article->getLocation());
+					}
+					else {
+						$this->setValue( "locId", 0 );
+					}
+				}
         	}
                         
             // let our parent class do the rest...

Modified: plog/trunk/class/view/admin/admineditresourceview.class.php
===================================================================
--- plog/trunk/class/view/admin/admineditresourceview.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/view/admin/admineditresourceview.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -33,6 +33,10 @@
 			$this->notifyEvent( EVENT_ALBUMS_LOADED, Array( "albums" => &$blogAlbums ));
 			$this->setValue( "albums", $blogAlbums );
 			
+			// load the list of locations
+			$locations = new Locations();
+			$this->setValue( "locations", $locations->getBlogLocations( $this->_blogInfo->getId()));
+			
 			parent::render();
 		}
 	}

Modified: plog/trunk/class/view/admin/adminpostslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminpostslistview.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/view/admin/adminpostslistview.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -4,6 +4,7 @@
 	lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
     lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
     lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/dao/locations.class.php" );
     lt_include( PLOG_CLASS_PATH."class/dao/articlestatus.class.php" );
     lt_include( PLOG_CLASS_PATH."class/data/pager/pager.class.php" );
     lt_include( PLOG_CLASS_PATH.'class/data/timestamp.class.php' );
@@ -22,6 +23,7 @@
 		var $_showCategory = -1;
         var $_showStatus = 1;
         var $_showUser   = 0;
+		var $_locationId = -1;
         var $_showMonth;
 		var $_searchTerms;	
 		var $_page;
@@ -117,20 +119,19 @@
 			// to show the view...
 
 			$this->_showCategory = $this->_getParameter( $params, "showCategory", -1 );
+			$this->_showLocation = $this->_getParameter( $params, "showLocation", 0 );			
 			$this->_showStatus   = $this->_getParameter( $params, "showStatus", POST_STATUS_ALL );
             $this->_showUser   = $this->_getParameter( $params, "showUser", 0 );			
             $this->_showMonth = $this->_getParameter( $params, "showMonth", $this->_locale->formatDate( new Timestamp(), "%Y%m" ));
 			$this->_searchTerms = $this->_getParameter( $params, "searchTerms", "");
-			
-//			print("search terms = ".$this->_searchTerms);
+			$this->_locationId = $this->_getParameter( $params, "showLocation", -1 );
 		}
 		
 		/**
 		 * renders the view
 		 */
 		function render()
-		{
-
+		{			
             // fetch all the articles for edition, but we need to know whether we are trying to 
 			// search for some of them or simply filter them based on certain criteria
             $articles = new Articles();			
@@ -142,6 +143,7 @@
 												 $this->_showUser,  // current user
 												 0,  // no maxdate
 												 $this->_searchTerms, // current search terms
+												 $this->_locationId, // location id												
 												 $this->_page // current page
 												 );												
 												 
@@ -153,10 +155,11 @@
 												 $this->_showStatus,  // current status
 												 $this->_showUser,  // current user
 												 0,  // no maxdate
-												 $this->_searchTerms // current search terms
+												 $this->_searchTerms, // current search terms
+												 $this->_locationId // location id
 												 );
 			
-			$pager = new Pager( "?op=editPosts&amp;showMonth={$this->_showMonth}&amp;showStatus={$this->_showStatus}&amp;showCategory={$this->_showCategory}&amp;showUser={$this->_showUser}&amp;searchTerms={$this->_searchTerms}&amp;page=",
+			$pager = new Pager( "?op=editPosts&amp;showMonth={$this->_showMonth}&amp;showStatus={$this->_showStatus}&amp;showCategory={$this->_showCategory}&amp;showUser={$this->_showUser}&amp;searchTerms={$this->_searchTerms}&amp;showLocation={$this->_locationId}&amp;page=",
 			                    $this->_page, 
 								$numPosts, 
 								$this->_itemsPerPage );
@@ -181,6 +184,10 @@
 			// and all the post status available
 			$postStatusList = ArticleStatus::getStatusList( true );
 			$postStatusListWithoutAll = ArticleStatus::getStatusList( false );
+			
+			// and all the locations defined
+			$locations = new Locations();
+			$this->setValue( "locations", $locations->getBlogLocations( $this->_blogInfo->getId()));
 
             $this->setValue( "categories", $blogCategories );
 			// values for the session, so that we can recover the status
@@ -194,6 +201,7 @@
             $this->setValue( "currentstatus", $this->_showStatus );
             $this->setValue( "currentuser", $this->_showUser );
             $this->setValue( "currentmonth", $this->_showMonth );
+            $this->setValue( "currentlocation", $this->_showLocation );
             $this->setValue( "users", $blogUsers );
             $this->setValue( "months", $this->_getMonths());			
 			$this->setValue( "poststatus", $postStatusList );

Modified: plog/trunk/class/view/admin/adminresourceslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminresourceslistview.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/view/admin/adminresourceslistview.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -5,6 +5,7 @@
     lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresources.class.php" );	
 	lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcequotas.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/data/pager/pager.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/dao/locations.class.php" );	
 	
 	define( "ROOT_ALBUM_ID", 0 );
 	
@@ -20,6 +21,7 @@
 		var $_page;
 		var $_resourceType;
 		var $_viewParams;
+		var $_locationId;
 	
 		function AdminResourcesListView( $blogInfo, $params = Array())
 		{
@@ -34,6 +36,9 @@
 			// fetch and save the albumId parameter in the request, if not available as a
 			// constructor parameter
 			isset( $this->_viewParams["albumId"] ) ? $this->_albumId = $this->_viewParams["albumId"] : $this->_albumId = null;
+			
+			// location id parameter
+			isset( $this->_viewParams["locationId"] ) ? $this->_locationId = $this->_viewParams["locationId"] : $this->_locationId = null;			
 				
 			if( $this->_albumId == null )
 				$this->_albumId = $this->getSessionValue( "albumId", ROOT_ALBUM_ID );
@@ -54,7 +59,7 @@
 			// base url for the pager so that it can be changed by parent classes
 			// such as AdminSimpleResourcesListView
 			if ( !isset( $this->_pagerUrl ) )
-				$this->_pagerUrl = "?op=resources&amp;albumId=".$this->_albumId."&amp;page=";
+				$this->_pagerUrl = "?op=resources&amp;albumId=".$this->_albumId."&amp;showLocation=".$this->_locationId."&amp;page=";
 		
 		
 			// get the page from the request
@@ -78,6 +83,7 @@
 					                                                  $this->_albumId,
 					                                                  $this->_resourceType,
 																	  $this->_searchTerms,
+																	  $this->_locationId,
 					                                                  $this->_page,
 					                                                  DEFAULT_ITEMS_PER_PAGE );
 																	  
@@ -85,25 +91,28 @@
 					$numResources = $galleryResources->getNumUserResources( $this->_blogInfo->getId(),
 					                                                        $this->_albumId,
 					                                                        $this->_resourceType,
-																			$this->_searchTerms );
+																			$this->_searchTerms,
+																			$this->_locationId );
 				}
 			}
 			else {
 				$album = null;
 				// if we're at the root album but search terms, still call GalleryResources::getUserResources
-				if( $this->_searchTerms ) {
+				if( $this->_searchTerms || $this->_locationId > -1 ) {
 					// load the resources matching the given string from *all* albums
 					$resources = $galleryResources->getUserResources( $this->_blogInfo->getId(),
 					                                                  GALLERY_NO_ALBUM,
 					                                                  $this->_resourceType,
 																	  $this->_searchTerms,
-					                                                  $this->_page,
+																	  $this->_locationId,
+					                                                  $this->_page,						
 					                                                  DEFAULT_ITEMS_PER_PAGE );
 					// total number of resources for the pager
 					$numResources = $galleryResources->getNumUserResources( $this->_blogInfo->getId(),
 					                                                        GALLERY_NO_ALBUM,
 					                                                        $this->_resourceType,
-																			$this->_searchTerms );				
+																			$this->_searchTerms,
+																			$this->_locationId );
 				}
 				else {
 					$albums = $galleryAlbums->getChildAlbums( $this->_albumId, $this->_blogInfo->getId(), $this->_searchTerms );
@@ -134,6 +143,11 @@
 			else {
 				$this->setValue( "albums", $albums );
 			}
+			
+			// load the list of locations
+			$locations = new Locations();
+			$this->setValue( "locations", $locations->getBlogLocations( $this->_blogInfo->getId()));
+			$this->setValue( "currentlocation", $this->_locationId );
 	        
 			// event about the resources
 			$this->notifyEvent( EVENT_RESOURCES_LOADED, Array ( "resources" => &$resources ));

Modified: plog/trunk/class/view/admin/adminview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminview.class.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/class/view/admin/adminview.class.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -101,6 +101,7 @@
 			// is location data enabled?
 			//
 			$this->setValue( 'location_data_enabled', $config->getValue( 'location_data_enabled', false ));
+			$this->setValue( 'google_maps_api_key', $config->getValue( 'google_maps_api_key' ));			
 
 			//
 			// stuff to generate the menu on the left

Modified: plog/trunk/locale/locale_en_UK.php
===================================================================
--- plog/trunk/locale/locale_en_UK.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/locale/locale_en_UK.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -1251,4 +1251,13 @@
 $messages['form_authenticated'] = 'Authenticated';
 
 $messages['help_forbidden_blognames'] = 'List of strings separated by a blank space that are not allowed to be used as blog names. It is possible to use regular expressions instead of plain strings. [ Default = (empty) ]';
+
+$messages['posts_updated_ok'] = '%s posts updated successfully';
+$messages['error_updating_post2'] = 'There was an error updating the article with idenfitier %s';
+$messages['resources_updated_ok'] = '%s resources updated successfully';
+$messages['error_updating_resource2'] = 'There was an error updating the resource with identifier %s';
+$messages['albums_updated_ok'] = '%s albums updated successfully';
+$messages['error_updating_album2'] = 'There was an error updating album with identifier %s';
+$messages['links_updated_ok'] = '%s links updated successfully';
+$messages['error_updating_link2'] = 'There was an error updating the link with identifier %s';
 ?>

Modified: plog/trunk/locale/locale_es_ES.php
===================================================================
--- plog/trunk/locale/locale_es_ES.php	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/locale/locale_es_ES.php	2007-02-12 23:45:54 UTC (rev 4722)
@@ -1246,4 +1246,13 @@
 $messages['help_forbidden_blognames'] = 'Lista de cadenas separadas por un espacio en blanco que no se pueden usar como nombres de bitácora. Es posible usar una expresión regular en lugar de una simple cadena. [ Valor por defecto = (vacío) ]';
 
 $messages['bookmark_it_to_lifetype'] = 'Añadir como favorito en LifeType!';
+
+$messages['posts_updated_ok'] = '%s artículos fueron actualizados correctamente';
+$messages['error_updating_post2'] = 'Hubo un error actualizando el artículo cuyo identificador es %s';
+$messages['resources_updated_ok'] = '% ficheros fueron actualizados correctamente';
+$messages['error_updating_resource2'] = 'Hubo un error actualizando el fichero cuyo identificador es %s';
+$messages['albums_updated_ok'] = '%s álbums fueron actualizados correctamente';
+$messages['error_updating_album2'] = 'Hubo un error actualizando el álbum cuyo identificador es %s';
+$messages['links_updated_ok'] = '%s enlaces fueron actualizados correctamente';
+$messages['error_updating_link2'] = 'Hubo un error actualizando el enlace cuyo identificador es %s';
 ?>
\ No newline at end of file

Modified: plog/trunk/templates/admin/chooser/resourcelist.template
===================================================================
--- plog/trunk/templates/admin/chooser/resourcelist.template	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/templates/admin/chooser/resourcelist.template	2007-02-12 23:45:54 UTC (rev 4722)
@@ -124,6 +124,8 @@
   <script type="text/javascript">
     var resName_{$resource->getId()} = '{$resource->getFileName()|escape:"javascript"}';
     var resDesc_{$resource->getId()} = '{$resource->getDescription()|escape:"javascript"}';
+    var resPreviewName_{$resource->getId()} = '{$resource->getPreviewFileName()|escape:"javascript"}';
+    var resMediunPreviewName_{$resource->getId()} = '{$resource->getMediumSizePreviewFileName()|escape:"javascript"}';
     {assign var=resourceAlbum value=$resource->getAlbum()}
 	var resAlbumName_{$resource->getId()} = '{$resourceAlbum->getMangledName()|escape:"javascript"}';
 	var resAlbumId_{$resource->getId()} = '{$resourceAlbum->getId()}';
@@ -135,11 +137,11 @@
   {/if}
   {if $resource->hasPreview()}
    {if $htmlarea}
-    <a href="javascript:addHtmlareaLink({$destination},{$blog->getId()},{$resource->getResourceType()},resName_{$resource->getId()},resDesc_{$resource->getId()},1,'{$resource->getMimeType()}','{$resource->getId()}',resAlbumName_{$resource->getId()},resAlbumId_{$resource->getId()});">{$locale->tr("add_resource_preview")}</a><br/>
-    <a href="javascript:addHtmlareaLink({$destination},{$blog->getId()},{$resource->getResourceType()},resName_{$resource->getId()},resDesc_{$resource->getId()},2,'{$resource->getMimeType()}','{$resource->getId()}',resAlbumName_{$resource->getId()},resAlbumId_{$resource->getId()});">{$locale->tr("add_resource_medium")}</a><br/>
+    <a href="javascript:addHtmlareaLink({$destination},{$blog->getId()},{$resource->getResourceType()},resMediunPreviewName_{$resource->getId()},resDesc_{$resource->getId()},1,'{$resource->getMimeType()}','{$resource->getId()}',resAlbumName_{$resource->getId()},resAlbumId_{$resource->getId()});">{$locale->tr("add_resource_preview")}</a><br/>
+    <a href="javascript:addHtmlareaLink({$destination},{$blog->getId()},{$resource->getResourceType()},resMediunPreviewName_{$resource->getId()},resDesc_{$resource->getId()},2,'{$resource->getMimeType()}','{$resource->getId()}',resAlbumName_{$resource->getId()},resAlbumId_{$resource->getId()});">{$locale->tr("add_resource_medium")}</a><br/>
    {else}
-   <a href="javascript:addResourceLink({$destination},{$blog->getId()},{$resource->getResourceType()},resName_{$resource->getId()},resDesc_{$resource->getId()},1,'{$resource->getMimeType()}','{$resource->getId()}',resAlbumName_{$resource->getId()},resAlbumId_{$resource->getId()});">{$locale->tr("add_resource_preview")}</a><br/>
-   <a href="javascript:addResourceLink({$destination},{$blog->getId()},{$resource->getResourceType()},resName_{$resource->getId()},resDesc_{$resource->getId()},2,'{$resource->getMimeType()}','{$resource->getId()}',resAlbumName_{$resource->getId()},resAlbumId_{$resource->getId()});">{$locale->tr("add_resource_medium")}</a><br/>
+   <a href="javascript:addResourceLink({$destination},{$blog->getId()},{$resource->getResourceType()},resPreviewName_{$resource->getId()},resDesc_{$resource->getId()},1,'{$resource->getMimeType()}','{$resource->getId()}',resAlbumName_{$resource->getId()},resAlbumId_{$resource->getId()});">{$locale->tr("add_resource_preview")}</a><br/>
+   <a href="javascript:addResourceLink({$destination},{$blog->getId()},{$resource->getResourceType()},resPreviewName_{$resource->getId()},resDesc_{$resource->getId()},2,'{$resource->getMimeType()}','{$resource->getId()}',resAlbumName_{$resource->getId()},resAlbumId_{$resource->getId()});">{$locale->tr("add_resource_medium")}</a><br/>
    {/if}
   {/if}
  </td>

Modified: plog/trunk/templates/admin/editlinks.template
===================================================================
--- plog/trunk/templates/admin/editlinks.template	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/templates/admin/editlinks.template	2007-02-12 23:45:54 UTC (rev 4722)
@@ -114,7 +114,7 @@
   {check_perms perm="update_link"}
    <input type="submit" name="Delete selected" value="{$locale->tr("delete")}"/>
   {/check_perms}
-  <div id="massiveChangeOption" style="display: none; text-align: left;">
+  <div id="massiveChangeOption" style="display: none;">
     <fieldset>
       <legend>{$locale->tr("massive_change_option")}</legend>
 	  <label for="linkCategoryId">{$locale->tr("category")}</label>

Modified: plog/trunk/templates/admin/editpost.template
===================================================================
--- plog/trunk/templates/admin/editpost.template	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/templates/admin/editpost.template	2007-02-12 23:45:54 UTC (rev 4722)
@@ -17,7 +17,7 @@
  <script type="text/javascript">
   
   // some messages that we are going to need in the functions above 
-  var htmlAreaEnabled = '{$htmlarea}';
+  var htmlAreaEnabled = {if $htmlarea==0 || !$htmlarea}false{else}true{/if};
   var msgSaving = "{$locale->tr("saving_message")}";  
   var msgShowOptionPanel = "{$locale->tr("show_option_panel")}";
   var msgHideOptionPanel = "{$locale->tr("hide_option_panel")}";  
@@ -111,15 +111,15 @@
          </select>	   
 	   </div>
 	
-    {if $location_data_enabled}
-    <!-- location selector, this should only appear if location data is enabled -->
-    <div class="field">
-      <label for="locId">{$locale->tr("location")}</label>
-	  <span class="required"*</span>
-	  <div class="formHelp">{$locale->tr("article_location_help")}</div>
-	  {location_chooser blogId=$blog->getId() addNewString=$locale->tr("add_new") showDisplayLink=1 default=$location}
-     </div>
-     {/if}	
+      {if $location_data_enabled}
+      <!-- location selector, this should only appear if location data is enabled -->
+      <div class="field">
+        <label for="locId">{$locale->tr("location")}</label>
+	    <span class="required"*</span>
+	    <div class="formHelp">{$locale->tr("article_location_help")}</div>
+	    {location_chooser blogId=$blog->getId() addNewString=$locale->tr("add_new") showDisplayLink=1 default=$location}
+      </div>
+      {/if}	
 	   
 	   <div class="field">
          <label for="postCategories[]">{$locale->tr("categories")}</label>

Modified: plog/trunk/templates/admin/editposts.template
===================================================================
--- plog/trunk/templates/admin/editposts.template	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/templates/admin/editposts.template	2007-02-12 23:45:54 UTC (rev 4722)
@@ -3,6 +3,7 @@
 	<script type="text/javascript" src="js/ui/plogui.js"></script>
 	<script type="text/javascript">
 		var errorPostStatusMsg = '{$locale->tr("error_post_status")}';
+		var errorLocationMsg = '{$locale->tr("error_post_location")}';
 		var showMassiveChangeOption = '{$locale->tr("show_massive_change_option")}';
 		var hideMassiveChangeOption = '{$locale->tr("hide_massive_change_option")}';
 	</script>
@@ -64,7 +65,24 @@
                     </select>
                     </div>
 
+					{if $location_data_enabled}
                     <div class="list_nav_option">
+                    <label for="location">{$locale->tr("location")}</label>
+                    <br />
+                    <select name="showLocation" id="location">
+                     <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 ] );">
+					  <img src="imgs/admin/icon_globe-16.png" alt="View" style="border:0px" />
+					</a>
+                    </div>
+					{/if}
+
+                    <div class="list_nav_option">
                     <label for="search">{$locale->tr("search_terms")}</label>
                     <br />
                     <input type="text" name="searchTerms" value="{$searchTerms}" size="15" id="search" />
@@ -120,6 +138,14 @@
                                 <a href="?op=editPosts&amp;showCategory={$postCategory->getId()}&amp;showStatus=0">{$postCategory->getName()}</a>{if !$smarty.foreach.postCategories.last}, {/if}
                             {/foreach}
                             </span>
+							{if $location_data_enabled}
+							  {if $post->hasLocationData()}
+							    <br/><span style="font-weight:normal">
+							    {assign var=location value=$post->getLocation()}
+								{$locale->tr("location")}: {location_display location=$location width=350 height=350}
+								</span>
+							  {/if}
+							{/if}
                         </td>
                         <td>
                             {assign var=date value=$post->getDateObject()}
@@ -182,7 +208,7 @@
         <div id="list_action_bar">
 			{adminpager style="list"}
 			{check_perms perm=update_post}
-            <input type="button" name="delete" value="{$locale->tr("delete")}" class="submit" onClick="javascript:submitPostsList('deletePosts');" />
+            <input type="button" name="delete" value="{$locale->tr("delete")}" class="submit" onClick="Lifetype.UI.Pages.EditPosts('deletePosts');" />
             <input type="hidden" name="op" value="" />
 			{/check_perms}
 			{check_perms perm=update_post}
@@ -196,14 +222,28 @@
 		                <option value="{$status}">{$locale->tr($name)}</option>
 		              {/foreach}
 		            </select>
-		            <input type="button" name="changePostsStatus" value="{$locale->tr("change_status")}" class="submit" onClick="javascript:submitPostsList('changePostsStatus');" />
+		            <input type="button" name="changePostsStatus" value="{$locale->tr("change_status")}" class="submit" onClick="Lifetype.UI.Pages.EditPosts.submitPostsList('changePostsStatus');" />
 		            <label for="postCategories[]">{$locale->tr("categories")}</label>
 		            <select name="postCategories[]" id="postCategories" size="5" multiple="multiple">
 		              {foreach name=categories from=$categories item=category}
 		                <option value="{$category->getId()}" {if $smarty.foreach.categories.first} selected="selected" {/if}>{$category->getName()}</option>
 		              {/foreach}
 		            </select>
-		            <input type="button" name="changePostsCategory" value="{$locale->tr("change_category")}" class="submit" onClick="javascript:submitPostsList('changePostsCategory');" />
+		            <input type="button" name="changePostsCategory" value="{$locale->tr("change_category")}" class="submit" onClick="Lifetype.UI.Pages.EditPosts.submitPostsList('changePostsCategory');" />
+			 		<!-- location stuff -->
+					{if $location_data_enabled}
+                    <label for="location">{$locale->tr("location")}</label>
+                    <select name="postLocation" id="postLocation">
+                     <option value="-1" >-{$locale->tr("select")}-</option>
+					 {foreach from=$locations item=location}
+					   <option value="{$location->getId()}">{$location->getDescription()}</option>
+					 {/foreach}
+                    </select>
+					<a href="#" onClick="Lifetype.UI.Location.displaySelectedLocationFromId('postLocation', [ 0, -1 ] );">
+					  <img src="imgs/admin/icon_globe-16.png" alt="View" style="border:0px" />
+					</a>
+		            <input type="button" name="changePostsLocation" value="{$locale->tr("change_location")}" class="submit" onClick="Lifetype.UI.Pages.EditPosts.submitPostsList('changePostsLocation');" />
+					{/if}		
 		        </fieldset>
 			</div>
 			{/check_perms}

Modified: plog/trunk/templates/admin/header.template
===================================================================
--- plog/trunk/templates/admin/header.template	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/templates/admin/header.template	2007-02-12 23:45:54 UTC (rev 4722)
@@ -38,6 +38,11 @@
 <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>
+{if $location_data_enabled}
+<!-- Location libraries -->
+<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={$google_maps_api_key}"></script>
+<script type="text/javascript" src="js/location/location.js"></script>
+{/if}
 {if $blogEnablePullDownMenu}
   <script type="text/javascript" src="js/JSCookMenu/JSCookMenu.js"></script>
   <link rel="stylesheet" href="js/JSCookMenu/ThemeOffice/theme.css" type="text/css" />

Modified: plog/trunk/templates/admin/newpost.template
===================================================================
--- plog/trunk/templates/admin/newpost.template	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/templates/admin/newpost.template	2007-02-12 23:45:54 UTC (rev 4722)
@@ -23,7 +23,7 @@
   var msgErrorMakingRequest = "{$locale->tr("error_sending_request")}";
   var msgErrorNoCategorySelected = "{$locale->tr("error_no_category_selected")}";
   var xmlHttpRequestSupportEnabled = '{$xmlHttpRequestSupportEnabled}';
-  var htmlAreaEnabled = '{$htmlarea}';
+  var htmlAreaEnabled = {if $htmlarea==0 || !$htmlarea}false{else}true{/if};
   var msgErrorPostTopic = "{$locale->tr("error_missing_post_topic")}";
   var msgErrorPostText = "{$locale->tr("error_missing_post_text")}";
   var msgSaving = "{$locale->tr("saving_message")}";

Modified: plog/trunk/templates/admin/resourceinfo.template
===================================================================
--- plog/trunk/templates/admin/resourceinfo.template	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/templates/admin/resourceinfo.template	2007-02-12 23:45:54 UTC (rev 4722)
@@ -49,7 +49,7 @@
 	{/if}
 	{if $resource->hasLocationData()}
 	  {assign var=loc value=$resource->getLocation()}
-      {$locale->tr("location")}: {location_display location=$loc}
+      {$locale->tr("location")}: {location_chooser locations=$locations addNewString=$locale->tr("add_new") showDisplayLink=1 default=$loc}
 	{/if}
 	</span>   
    </div>

Modified: plog/trunk/templates/admin/resources.template
===================================================================
--- plog/trunk/templates/admin/resources.template	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/templates/admin/resources.template	2007-02-12 23:45:54 UTC (rev 4722)
@@ -4,6 +4,7 @@
   <script type="text/javascript">
     var showMassiveChangeOption = '{$locale->tr("show_massive_change_option")}';
     var hideMassiveChangeOption = '{$locale->tr("hide_massive_change_option")}';
+	var errorLocationMsg = '{$locale->tr("error_post_location")}';
   </script>
 <script type="text/javascript">
 {literal}
@@ -32,7 +33,25 @@
    {/foreach}
    </select>
    </div>   
+
+	{if $location_data_enabled}
    <div class="list_nav_option">
+   <label for="location">{$locale->tr("location")}</label>
+   <br />
+   <select name="showLocation" id="location">
+    <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 ] );">
+	  <img src="imgs/admin/icon_globe-16.png" alt="View" style="border:0px" />
+	</a>
+   </div>
+	{/if}
+
+   <div class="list_nav_option">
    <label for="search">{$locale->tr("search_terms")}</label>
    <br />
    <input type="text" name="searchTerms" value="{$searchTerms}" size="15" id="search" />
@@ -115,16 +134,18 @@
    {/if}
   {/if}
   </a><br/>
+  <a href="admin.php?op=resourceInfo&amp;resourceId={$resource->getId()}">{$resource->getFileName()}</a>
   {if $resource->hasLocationData()}
     {assign var=location value=$resource->getLocation()}
-    <a href="#" id="res_{$resource->getId()}">
+    <!-- a href="#" id="res_{$resource->getId()}">
       <img src="imgs/admin/icon_globe-16.png" alt="Location Data" />
     </a>
     <script type="text/javascript">
       o = new Lifetype.UI.Overlay( {literal}{{/literal}url:plogBaseUrl + "/" + scriptName + "?op=locationDisplay&locId={$location->getId()}&height=350&width=350",height:350,width:350,context:"res_{$resource->getId()}",showCloseButton:true{literal}}{/literal});
-	</script>
+	</script -->
+	<br/>
+	{$locale->tr("location")}: {location_display location=$location width=350 height=350}
   {/if}
-  <a href="admin.php?op=resourceInfo&amp;resourceId={$resource->getId()}">{$resource->getFileName()}</a>
  </td>
  <td>
   <div class="list_action_button"> 
@@ -149,7 +170,7 @@
   {if $quota > 0 }, {$locale->tr("quota")}: <strong>{$quota|round}</strong>{/if}
   <input type="submit" name="delete" value="{$locale->tr("delete")}" class="submit" />
   <input type="hidden" name="op" value="deleteResourceItems" />
-  <div id="massiveChangeOption" style="display: none; text-align: left;">
+  <div id="massiveChangeOption" style="display: none;">
     <fieldset>
       <legend>{$locale->tr("massive_change_option")}</legend>            
 	  <label for="galleryAlbumId">{$locale->tr("album")}</label>
@@ -162,7 +183,21 @@
           </option>
         {/foreach}
       </select>
-	  <input type="button" name="changeGalleryItemsAlbum" value="{$locale->tr("change_album")}" class="submit" onClick="javascript:submitGalleryItemsList('changeGalleryItemsAlbum');" />
+	  <input type="button" name="changeGalleryItemsAlbum" value="{$locale->tr("change_album")}" class="submit" onClick="Lifetype.UI.Pages.EditResources.submitGalleryItemsList('changeGalleryItemsAlbum');" />
+		{if $location_data_enabled}
+		<!-- location mass-edit -->
+      <label for="location">{$locale->tr("location")}</label>
+      <select name="locationId" id="resourceLocation">
+       <option value="-1" >-{$locale->tr("select")}-</option>
+		 {foreach from=$locations item=location}
+		   <option value="{$location->getId()}">{$location->getDescription()}</option>
+		 {/foreach}
+      </select>
+		<a href="#" onClick="Lifetype.UI.Location.displaySelectedLocationFromId('resourceLocation', [ 0, -1 ] );">
+		  <img src="imgs/admin/icon_globe-16.png" alt="View" style="border:0px" />
+		</a>
+      <input type="button" name="changeResourcesLocation" value="{$locale->tr("change_location")}" class="submit" onClick="Lifetype.UI.Pages.EditResources.submitGalleryItemsList('changeGalleryItemsLocation');" />
+		{/if}	
     </fieldset>
   </div> 
 </div>

Modified: plog/trunk/templates/misc/location.template
===================================================================
--- plog/trunk/templates/misc/location.template	2007-02-12 22:59:13 UTC (rev 4721)
+++ plog/trunk/templates/misc/location.template	2007-02-12 23:45:54 UTC (rev 4722)
@@ -17,10 +17,6 @@
 	// create the global object
 	l = new Lifetype.UI.Location();
 
-	// localized messages
-	var locationLocaleNoMarkerHasBeenSetYet = "{$locale->tr("error_no_marker_set")}";
-	var locationLocaleNoDescriptionError    = "{$locale->tr("error_no_description_set")}";
-
 	// properties of the location object
 	l.markerLat = '{$startLatitude}';
 	l.markerLong = '{$startLongitude}';



More information about the pLog-svn mailing list