[pLog-svn] r5640 - in plog/trunk: class/action/admin class/controller class/dao class/view/admin templates/admin

mark at devel.lifetype.net mark at devel.lifetype.net
Tue Jul 10 11:44:48 EDT 2007


Author: mark
Date: 2007-07-10 11:44:48 -0400 (Tue, 10 Jul 2007)
New Revision: 5640

Added:
   plog/trunk/class/action/admin/admineditoutboxprivatemessagesaction.class.php
   plog/trunk/class/view/admin/adminoutboxprivatemessageslistview.class.php
   plog/trunk/templates/admin/editoutboxprivatemessages.template
Removed:
   plog/trunk/class/action/admin/admineditoutgoingprivatemessagesaction.class.php
   plog/trunk/class/view/admin/adminoutgoingprivatemessageslistview.class.php
   plog/trunk/templates/admin/editoutgoingprivatemessages.template
Modified:
   plog/trunk/class/action/admin/adminsendprivatemessageaction.class.php
   plog/trunk/class/controller/admincontrollermap.properties.php
   plog/trunk/class/dao/daocacheconstants.properties.php
   plog/trunk/class/dao/privatemessagebox.class.php
   plog/trunk/class/dao/privatemessageboxes.class.php
   plog/trunk/class/dao/privatemessages.class.php
   plog/trunk/templates/admin/menus.xml
Log:
Now, when sender decide to backup the private message, after the message saved, the page will redirect to outbox private message list view.

Copied: plog/trunk/class/action/admin/admineditoutboxprivatemessagesaction.class.php (from rev 5637, plog/trunk/class/action/admin/admineditoutgoingprivatemessagesaction.class.php)
===================================================================
--- plog/trunk/class/action/admin/admineditoutboxprivatemessagesaction.class.php	                        (rev 0)
+++ plog/trunk/class/action/admin/admineditoutboxprivatemessagesaction.class.php	2007-07-10 15:44:48 UTC (rev 5640)
@@ -0,0 +1,37 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/view/admin/adminoutboxprivatemessageslistview.class.php" );
+
+    /**
+     * \ingroup Action
+     * @private
+     *
+     * Action that shows the list privatemessages
+     */
+    class AdminEditOutboxPrivateMessagesAction extends AdminAction
+	{
+
+    	/**
+         * Constructor. If nothing else, it also has to call the constructor of the parent
+         * class, BlogAction with the same parameters
+         */
+        function AdminEditOutboxPrivateMessagesAction( $actionInfo, $request )
+        {
+        	$this->AdminAction( $actionInfo, $request );
+        }
+
+        /**
+         * Carries out the specified action
+         */
+        function perform()
+        {
+			$searchTerms = $this->_request->getValue( "searchTerms" );
+            $this->_view = new AdminOutboxPrivateMessagesListView( $this->_blogInfo, Array( "searchTerms" => $searchTerms ) );
+            $this->setCommonData();
+
+            // better to return true if everything fine
+            return true;
+        }
+    }
+?>
\ No newline at end of file

Deleted: plog/trunk/class/action/admin/admineditoutgoingprivatemessagesaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditoutgoingprivatemessagesaction.class.php	2007-07-10 13:21:48 UTC (rev 5639)
+++ plog/trunk/class/action/admin/admineditoutgoingprivatemessagesaction.class.php	2007-07-10 15:44:48 UTC (rev 5640)
@@ -1,37 +0,0 @@
-<?php
-
-	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
-    lt_include( PLOG_CLASS_PATH."class/view/admin/adminoutgoingprivatemessageslistview.class.php" );
-
-    /**
-     * \ingroup Action
-     * @private
-     *
-     * Action that shows the list privatemessages
-     */
-    class AdminEditOutgoingPrivateMessagesAction extends AdminAction 
-	{
-
-    	/**
-         * Constructor. If nothing else, it also has to call the constructor of the parent
-         * class, BlogAction with the same parameters
-         */
-        function AdminEditOutgoingPrivateMessagesAction( $actionInfo, $request )
-        {
-        	$this->AdminAction( $actionInfo, $request );
-        }
-
-        /**
-         * Carries out the specified action
-         */
-        function perform()
-        {
-			$searchTerms = $this->_request->getValue( "searchTerms" );
-            $this->_view = new AdminOutgoingPrivateMessagesListView( $this->_blogInfo, Array( "searchTerms" => $searchTerms ) );
-            $this->setCommonData();
-
-            // better to return true if everything fine
-            return true;
-        }
-    }
-?>
\ No newline at end of file

Modified: plog/trunk/class/action/admin/adminsendprivatemessageaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminsendprivatemessageaction.class.php	2007-07-10 13:21:48 UTC (rev 5639)
+++ plog/trunk/class/action/admin/adminsendprivatemessageaction.class.php	2007-07-10 15:44:48 UTC (rev 5640)
@@ -3,7 +3,7 @@
     lt_include( PLOG_CLASS_PATH."class/dao/privatemessages.class.php" );
     lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
     lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
-	lt_include( PLOG_CLASS_PATH."class/view/admin/adminprivatemessagesoutboxlistview.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/view/admin/adminoutboxprivatemessageslistview.class.php" );
 
     /**
      * \ingroup Action
@@ -98,7 +98,7 @@
                                                                 $this->_messageText );
                     $privateMessages->addPrivateMessage( $senderPrivateMessage );
                 }
-				$this->_view = new AdminPrivateMessagesOutboxListView( $this->_blogInfo );
+				$this->_view = new AdminOutboxPrivateMessagesListView( $this->_blogInfo );
 				$this->_view->setSuccess( true );
 				$this->_view->setSuccessMessage( $this->_locale->pr("private_message_sended_ok", $receiverPrivateMessage->getSubject()));
 				$this->notifyEvent( EVENT_POST_SEND_PRIVATE_MESSAGE, Array( "privatemessage" => &$receiverPrivateMessage ));

Modified: plog/trunk/class/controller/admincontrollermap.properties.php
===================================================================
--- plog/trunk/class/controller/admincontrollermap.properties.php	2007-07-10 13:21:48 UTC (rev 5639)
+++ plog/trunk/class/controller/admincontrollermap.properties.php	2007-07-10 15:44:48 UTC (rev 5640)
@@ -351,8 +351,8 @@
 	// add this for private messages
 	$actions["newPrivateMessage"] = "AdminNewPrivateMessageAction";
   	$actions["sendPrivateMessage"] = "AdminSendPrivateMessageAction";
-	$actions["editIncomingPrivateMessages"] = "AdminEditIncomingPrivateMessagesAction";
-	$actions["editOutgoingPrivateMessages"] = "AdminEditOutgoingPrivateMessagesAction";
+	$actions["editInboxPrivateMessages"] = "AdminEditInboxPrivateMessagesAction";
+	$actions["editOutboxPrivateMessages"] = "AdminEditOutboxPrivateMessagesAction";
   	$actions["readPrivateMessage"] = "AdminReadPrivateMessageAction";
   	$actions["replyPrivateMessage"] = "AdminReplyPrivateMessageAction";
   	$actions["deletePrivateMessages"] = "AdminDeletePrivateMessageAction";

Modified: plog/trunk/class/dao/daocacheconstants.properties.php
===================================================================
--- plog/trunk/class/dao/daocacheconstants.properties.php	2007-07-10 13:21:48 UTC (rev 5639)
+++ plog/trunk/class/dao/daocacheconstants.properties.php	2007-07-10 15:44:48 UTC (rev 5640)
@@ -12,53 +12,53 @@
 	define( "CACHE_ARTICLE_CATEGORIES_BYNAME", "article_categories_byname" );
 	define( "CACHE_ARTICLE_CATEGORIES_BLOG", "article_categories_blog" );
 	define( "CACHE_ARTICLE_CATEGORIES_LINK", "article_categories_link" );
-	
+
 	/**
 	 * articles
 	 */
     define( "CACHE_ARTICLES",            "articles" );
-    define( "CACHE_ARTICLES_BYNAME",     "articles_byname" );    
-    define( "CACHE_ARTICLETEXT",         "article_text" );    
-    define( "CACHE_ARTICLESPERMONTH",    "articles_per_month" );	
-	
+    define( "CACHE_ARTICLES_BYNAME",     "articles_byname" );
+    define( "CACHE_ARTICLETEXT",         "article_text" );
+    define( "CACHE_ARTICLESPERMONTH",    "articles_per_month" );
+
 	/**
 	 * blog categories
 	 */
 	define( "CACHE_BLOGCATEGORIES", "cache_blog_categories" );
-	define( "CACHE_BLOGCATEGORIES_ALL", "cache_blog_categories_all" );		
+	define( "CACHE_BLOGCATEGORIES_ALL", "cache_blog_categories_all" );
 
 	/**
 	 * blogs
 	 */
     define( "CACHE_BLOGINFOS",     "bloginfo" );
-    define( "CACHE_BLOGIDBYNAME",  "bloginfo_idbyname" );    
-    define( "CACHE_BLOGIDBYDOMAIN","bloginfo_idbydomain" ); 
-    
+    define( "CACHE_BLOGIDBYNAME",  "bloginfo_idbyname" );
+    define( "CACHE_BLOGIDBYDOMAIN","bloginfo_idbydomain" );
+
 	/**
 	 * article comments
 	 */
 	define( "CACHE_ARTICLE_COMMENTS", "article_comments" );
 	define( "CACHE_ARTICLE_COMMENTS_BYARTICLE_NEWEST_TO_OLDEST", "article_comments_byarticle_newest_to_oldest" );
 	define( "CACHE_ARTICLE_COMMENTS_BYARTICLE_OLDEST_TO_NEWEST", "article_comments_byarticle_oldest_to_newest" );
-	 
+
 	/**
 	 * custom fields
 	 */
 	define( "CACHE_CUSTOMFIELDS", "customfields" );
 	define( "CACHE_CUSTOMFIELDS_BLOG", "customfields_blog" );
-	define( "CACHE_CUSTOMFIELDS_BY_NAME", "customfields_name" );	
+	define( "CACHE_CUSTOMFIELDS_BY_NAME", "customfields_name" );
 
 	/**
 	 * custom field values
 	 */
     define( "CACHE_CUSTOMFIELDVALUES_ARTICLE", "customfieldvalues_article" );
-	
+
 	/**
 	 * article global categories
 	 */
 	define( "CACHE_GLOBALCATEGORIES", "cache_global_categories" );
-	define( "CACHE_GLOBALCATEGORIES_ALL", "cache_global_categories_all" );	
-	
+	define( "CACHE_GLOBALCATEGORIES_ALL", "cache_global_categories_all" );
+
 	/**
 	 * links
 	 */
@@ -69,7 +69,7 @@
 	 * recent articles
 	 */
 	define( "CACHE_RECENT_ARTICLES_BY_BLOG", "recent_articles_by_blog" );
-	
+
 	/**
 	 * link categories
 	 */
@@ -86,28 +86,28 @@
 
 	/**
 	 * gallery resources
-	 */	
+	 */
 	define( "CACHE_RESOURCES", "galleryresources" );
-	define( "CACHE_RESOURCES_BY_NAME", "galleryresources_name" );	
-	define( "CACHE_RESOURCES_USER", "galleryresources_user" );	
+	define( "CACHE_RESOURCES_BY_NAME", "galleryresources_name" );
+	define( "CACHE_RESOURCES_USER", "galleryresources_user" );
 
 	/**
 	 * users
 	 */
     define( "CACHE_USERINFO", "userinfo" );
     define( "CACHE_USERIDBYNAME", "userinfo_idbyname" );
-	 
+
 	/**
 	 * user permissions
 	 */
 	define( "CACHE_USER_PERMISSIONS", "user_permissions" );
-	
+
 	/**
 	 * locales
-	 */	
+	 */
     define( "CACHE_LOCALES", "locales" );
     define( "CACHE_BLOG_LOCALES", "bloglocales" );
-    
+
     /**
      * permissions
      */
@@ -136,6 +136,5 @@
      * private messages
      */
     define( "CACHE_PRIVATE_MESSAGES", "cache_private_messages" );
-    define( "CACHE_PRIVATE_MESSAGES_BY_RECEIVER_ID", "cache_private_messages_by_receiver_id" );
-    define( "CACHE_PRIVATE_MESSAGES_BY_SENDER_ID", "cache_private_messages_by_sender_id" );
+    define( "CACHE_PRIVATE_MESSAGES_BY_BOX_ID", "cache_private_messages_by_box_id" );
 ?>
\ No newline at end of file

Modified: plog/trunk/class/dao/privatemessagebox.class.php
===================================================================
--- plog/trunk/class/dao/privatemessagebox.class.php	2007-07-10 13:21:48 UTC (rev 5639)
+++ plog/trunk/class/dao/privatemessagebox.class.php	2007-07-10 15:44:48 UTC (rev 5640)
@@ -6,17 +6,17 @@
 	 * whether we'd like to fetch a inbox, outbox or anything
 	 */
 	define( "BOX_TYPE_INBOX", 1 );
-	define( "BOX_TYPE_OUTBOX", 2 );	
+	define( "BOX_TYPE_OUTBOX", 2 );
 	define( "BOX_TYPE_ANY", -1 );
 
     /**
 	 * \ingroup DAO
-	 * 
+	 *
      * The private messages one can add to a user can also be filed under different boxes.
-     * This object are the abstraction of those boxes and offer methods to check the value 
+     * This object are the abstraction of those boxes and offer methods to check the value
      * of some of its attributes.
      */
-    class PrivateMessageBox extends DbObject 
+    class PrivateMessageBox extends DbObject
 	{
 
 		var $_id;
@@ -43,11 +43,11 @@
             $this->_boxType = $boxType;
 			$this->setProperties( $properties );
             $this->_id = $id;
-            
+
             $this->_numUnreadPrivateMessages = 0;
             $this->_numPrivateMessages = 0;
             $this->_privateMessages = null;
-			
+
 			$this->_pk = "id";
 			$this->_fields = Array(
 			   "user_id" => "getUserId",
@@ -136,7 +136,7 @@
          * Returns assign many unread private messages have been filed under this message box.
          *
          * @param Number of unread messages.
-         * 
+         *
          * @return nothing
          */
         function setNumUnreadPrivateMessages( $numUnreadPrivateMessages )
@@ -148,32 +148,39 @@
          * Returns assign many private messages have been filed under this message box.
          *
          * @param Number of messages.
-         * 
+         *
          * @return nothing
          */
         function setNumPrivateMessages( $numPrivateMessages )
         {
         	$this->_numPrivateMessages = $numPrivateMessages;
         }
-		
+
         /**
          * Returns an array of private messages
          *
          * @return Array of PrivateMessage object
          */
-        function getPrivateMessages( $userId, $searchTerms = "", $page = -1, $itemsPerPage = 15 )
+        function getPrivateMessagesFromBox( $searchTerms = "", $page = -1, $itemsPerPage = 15 )
         {
-			lt_include( PLOG_CLASS_PATH."class/dao/privatemessage.class.php" );
+			lt_include( PLOG_CLASS_PATH."class/dao/privatemessages.class.php" );
 			$privateMessages = new PrivateMessages();
-			if( $this->_boxType == BOX_TYPE_INBOX ) {
-				$boxMessages = $privateMessages->getInboxPrivateMessages( $userId, $searchTerms, $page, $itemsPerPage );
-			} elseif( $this->_boxType == BOX_TYPE_OUTBOX ) {
-				$boxMessages = $privateMessages->getOutboxPrivateMessages( $userId, $searchTerms, $page, $itemsPerPage );
-			} else {
-				$boxMessages = $privateMessages->getPrivateMessages( $userId, $searchTerms, $page, $itemsPerPage );
-			}
-			
-        	return $boxMessages;
+			$mesages = $privateMessages->getPrivateMessagesFromBoxId( $this->_id, $searchTerms, $page, $itemsPerPage );
+
+			return $mesages;
         }
-    }
+
+        /**
+         * Returns an array of private messages
+         *
+         * @return Array of PrivateMessage object
+         */
+        function getNumPrivateMessagesFromBox( $searchTerms = "" )
+        {
+			lt_include( PLOG_CLASS_PATH."class/dao/privatemessages.class.php" );
+			$privateMessages = new PrivateMessages();
+
+			return( $privateMessages->getNumPrivateMessagesFromBoxId( $this->_id, $searchTerms ) );
+        }
+	}
 ?>
\ No newline at end of file

Modified: plog/trunk/class/dao/privatemessageboxes.class.php
===================================================================
--- plog/trunk/class/dao/privatemessageboxes.class.php	2007-07-10 13:21:48 UTC (rev 5639)
+++ plog/trunk/class/dao/privatemessageboxes.class.php	2007-07-10 15:44:48 UTC (rev 5640)
@@ -2,7 +2,7 @@
 
 	lt_include( PLOG_CLASS_PATH."class/dao/model.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/dao/privatemessagebox.class.php" );
-	
+
 	/**
 	 * \ingroup DAO
 	 *
@@ -10,13 +10,13 @@
 	 */
 	class PrivateMessageBoxes extends Model
 	{
-	
+
 		function PrivateMessageBoxes()
 		{
-			$this->Model();			
+			$this->Model();
 			$this->table = $this->getPrefix()."private_message_boxes";
 		}
-		
+
 		/**
 		 * loads the given private message box identifier
 		 *
@@ -29,7 +29,7 @@
 		}
 
 		/**
-		 * loads the private message inbox from user identifier 
+		 * loads the private message inbox from user identifier
 		 *
 		 * @param user identifier
 		 * @return false if there was an error loading or a PrivateMessageBox object if it was found
@@ -56,7 +56,7 @@
 		}
 
 		/**
-		 * loads the private message outbox from user identifier 
+		 * loads the private message outbox from user identifier
 		 *
 		 * @param user identifier
 		 * @return false if there was an error loading or a PrivateMessageBox object if it was found
@@ -69,7 +69,6 @@
 				$query = "SELECT * FROM ".$this->table." WHERE user_id = ".$userId;
 				$query .= " AND box_type = ".BOX_TYPE_OUTBOX;
 
-				echo $query;
 				$result = $this->Execute( $query );
 
 				if( !$result )
@@ -93,14 +92,14 @@
 		function addPrivateMessageBox( &$privateMessageBox )
 		{
 			$result = $this->add( $privateMessageBox, Array( CACHE_PRIVATE_MESSAGE_BOXES => "getId" ));
-				
+
 			return( $result );
 		}
-		
+
 		/**
 		 * deletes a private message outbox. Warning: the upper layers must have already made sure that there
-		 * are no private messages that point to this private message box *before* removing it, or else we could 
-		 * have problems with data integrity.		 
+		 * are no private messages that point to this private message box *before* removing it, or else we could
+		 * have problems with data integrity.
 		 *
 		 * @param id
 		 * @return True if successful, false otherwise
@@ -111,7 +110,7 @@
 			if(!$box)
 				return flase;
 
-			if( $box->getNumPrivateMessages() > 0 )				
+			if( $box->getNumPrivateMessages() > 0 )
 				return flase;
 
 			$userId = $box->getUserId();
@@ -127,7 +126,7 @@
 
 			return( $result );
 		}
-		
+
 		/**
 		 * update a given private message outbox
 		 *

Modified: plog/trunk/class/dao/privatemessages.class.php
===================================================================
--- plog/trunk/class/dao/privatemessages.class.php	2007-07-10 13:21:48 UTC (rev 5639)
+++ plog/trunk/class/dao/privatemessages.class.php	2007-07-10 15:44:48 UTC (rev 5640)
@@ -8,13 +8,13 @@
 	 *
      * Model for the private message feature
      */
-    class PrivateMessages extends Model 
+    class PrivateMessages extends Model
 	{
-	
+
 		function PrivateMessages()
 		{
 			$this->Model();
-		
+
 			$this->table = $this->getPrefix()."private_messages";
 		}
 
@@ -31,8 +31,7 @@
 			if( $result ) {
 				// clean the cache
                 $this->_cache->removeData( $privateMessage->getId(), CACHE_PRIVATE_MESSAGES );
-                $this->_cache->removeData( $privateMessage->getReceiverId(), CACHE_PRIVATE_MESSAGES_BY_RECEIVER_ID );
-                $this->_cache->removeData( $privateMessage->getSenderId(), CACHE_PRIVATE_MESSAGES_BY_SENDER_ID );
+                $this->_cache->removeData( $privateMessage->getBoxId(), CACHE_PRIVATE_MESSAGES_BY_BOX_ID );
 				// update corresponding counters
 				$box = $privateMessage->getBox();
 				$box->setNumPrivateMessages( $box->getNumPrivateMessages() + 1 );
@@ -43,7 +42,7 @@
 
             return $result;
         }
-		
+
 		/**
          * Updates a private message to the database
          *
@@ -54,7 +53,7 @@
         {
 			// get the previous version of this private message before saving it
 			$prevVersion = $this->getPrivateMessage( $privateMessage->getId());
-		
+
         	$result = $this->update( $privateMessage );
 
             if( !$result ) {
@@ -63,18 +62,17 @@
 
             // clean the cache
             $this->_cache->removeData( $privateMessage->getId(), CACHE_PRIVATE_MESSAGES );
-            $this->_cache->removeData( $privateMessage->getReceiverId(), CACHE_PRIVATE_MESSAGES_BY_RECEIVER_ID );
-            $this->_cache->removeData( $privateMessage->getSenderId(), CACHE_PRIVATE_MESSAGES_BY_SENDER_ID );
-			// update corresponding counters
+            $this->_cache->removeData( $privateMessage->getBoxId(), CACHE_PRIVATE_MESSAGES_BY_BOX_ID );
+ 			// update corresponding counters
 			$box = $prevVersion->getBox();
 			if( $prevVersion->getReceiverReadStatus() == PRIVATE_MESSAGE_RECEIVER_UNREAD &&
-				$privateMessage->getReceiverReadStatus() == PRIVATE_MESSAGE_RECEIVER_READ ) 
+				$privateMessage->getReceiverReadStatus() == PRIVATE_MESSAGE_RECEIVER_READ )
 			{
 				$box->setNumUnreadPrivateMessages( $box->getNumUnreadPrivateMessages() - 1 );
 				$privateMessageBoxes = new PrivateMessageBoxes();
 				$privateMessageBoxes->updatePrivateMessageBox( $box );
 			} elseif ( $prevVersion->getReceiverReadStatus() == PRIVATE_MESSAGE_RECEIVER_READ &&
-					   $privateMessage->getReceiverReadStatus() == PRIVATE_MESSAGE_RECEIVER_UNREAD ) 
+					   $privateMessage->getReceiverReadStatus() == PRIVATE_MESSAGE_RECEIVER_UNREAD )
 			{
 				$box->setNumUnreadPrivateMessages( $box->getNumUnreadPrivateMessages() + 1 );
 				$privateMessageBoxes = new PrivateMessageBoxes();
@@ -94,7 +92,7 @@
         {
 			$privateMessage->setStatus( PRIVATE_MESSAGE_READ );
 			$result = $this->updatePrivateMessage( $privateMessage );
-			
+
 			return $result;
         }
 
@@ -108,10 +106,10 @@
         {
 			$privateMessage->setStatus( PRIVATE_MESSAGE_UNREAD );
 			$result = $this->updatePrivateMessage( $privateMessage );
-			
+
 			return $result;
         }
-		
+
 		/**
          * Get all iprivate messages from a boxId from the db.
 		 *
@@ -121,24 +119,24 @@
 		 * @param itemsPerPage
 		 * @return Returns an array of Private Messages for that specific Receiver.
          */
-		function getPrivateMessagesFromBoxId( $boxId, $searchTerms = "", $page = -1, $itemsPerPage = 15 )			
+		function getPrivateMessagesFromBoxId( $boxId, $searchTerms = "", $page = -1, $itemsPerPage = 15 )
 		{
-			$privateMessages = $this->getMany( "box_id", 
-			                                   $boxId, 
-			                                   CACHE_PRIVATE_MESSAGES_BY_RECEIVER_ID,
+			$privateMessages = $this->getMany( "box_id",
+			                                   $boxId,
+			                                   CACHE_PRIVATE_MESSAGES_BY_BOX_ID,
 			                                   Array( CACHE_PRIVATE_MESSAGES => "getId" ),
 			                                   Array( "date" => "DESC" ),
 			                                   $searchTerms,
 			                                   $page,
-			                                   $itemsPerPage );			                             
-			    
+			                                   $itemsPerPage );
+
             if( !$privateMessages )
             	return Array();
             else
             	return( $privateMessages );
 		}
 
-		function getNumIncomingMessagesFromReceiverId( $boxId, $searchTerms = "" )
+		function getNumPrivateMessagesFromBoxId( $boxId, $searchTerms = "" )
 		{
 			return( count( $this->getPrivateMessagesFromBoxId( $boxId, $searchTerms )));
 		}
@@ -176,19 +174,18 @@
         	if( $privateMessage ) {
         		$this->delete( "id", $$messageId );
                 $this->_cache->removeData( $privateMessage->getId(), CACHE_PRIVATE_MESSAGES );
-                $this->_cache->removeData( $privateMessage->getReceiverId(), CACHE_PRIVATE_MESSAGES_BY_RECEIVER_ID );
-                $this->_cache->removeData( $privateMessage->getSenderId(), CACHE_PRIVATE_MESSAGES_BY_SENDER_ID );
+                $this->_cache->removeData( $privateMessage->getBoxId(), CACHE_PRIVATE_MESSAGES_BY_BOX_ID );
 
 			    // update corresponding counters
 				$box = $privateMessage->getReceiverInfo();
 				$box->setNumPrivateMessages( $box->geNumPrivateMessages() - 1 );
-				if( $privateMessage->getStatus() == PRIVATE_MESSAGE_UNREAD ) 
+				if( $privateMessage->getStatus() == PRIVATE_MESSAGE_UNREAD )
 				{
 					$box->setNumUnreadPrivateMessages( $box->getNumUnreadPrivateMessages() - 1 );
 				}
 				$privateMessageBoxes = new PrivateMessageBoxes();
 				$privateMessageBoxes->updatePrivateMessageBox( $box );
-				
+
 				return true;
         	}
         	else
@@ -200,29 +197,15 @@
          *
          * @param receiverId The receiver identifier
          */
-        function deletePrivateMessagesByReceiverId( $receiverId )
+        function deletePrivateMessagesByBoxId( $boxId )
         {
-        	if( $this->delete( "receiver_id", $receiverId )) {
-	        	return( $this->_cache->removeData( $receiverId, CACHE_PRIVATE_MESSAGES_BY_RECEIVER_ID ));
+        	if( $this->delete( "box_id", $boxId )) {
+	        	return( $this->_cache->removeData( $boxId, CACHE_PRIVATE_MESSAGES_BY_BOX_ID ));
         	}
         	else
         		return false;
         }
 
-        /**
-         * Removes all the private messages from the given sender id
-         *
-         * @param senderId The sender identifier
-         */
-        function deletePrivateMessagesBySenderId( $senderId )
-        {
-        	if( $this->delete( "sender_id", $senderId )) {
-	        	return( $this->_cache->removeData( $senderId, CACHE_PRIVATE_MESSAGES_BY_SENDER_ID ));
-        	}
-        	else
-        		return false;
-        }
-
 		/**
 		 * @see Model::getSearchConditions
 		 */
@@ -230,18 +213,18 @@
 		{
 			return( "(normalized_subject LIKE '%".Db::qstr( $searchTerms )."%' OR normalized_message LIKE '%".Db::qstr( $searchTerms )."%')" );
 		}
-        
+
 		/**
 		 * @private
 		 */
         function mapRow( $row )
         {
             $privateMessage = new PrivateMessage( $row["box_id"],
-			                                      $row["receiver_id"], 
-			                                      $row["sender_id"], 
-			                                      $row["subject"], 
-			                                      $row["message"], 
-			                                      $row["date"], 
+			                                      $row["receiver_id"],
+			                                      $row["sender_id"],
+			                                      $row["subject"],
+			                                      $row["message"],
+			                                      $row["date"],
 			                                      $row["receiver_read_status"],
 			                                      $row["id"] );
 

Copied: plog/trunk/class/view/admin/adminoutboxprivatemessageslistview.class.php (from rev 5637, plog/trunk/class/view/admin/adminoutgoingprivatemessageslistview.class.php)
===================================================================
--- plog/trunk/class/view/admin/adminoutboxprivatemessageslistview.class.php	                        (rev 0)
+++ plog/trunk/class/view/admin/adminoutboxprivatemessageslistview.class.php	2007-07-10 15:44:48 UTC (rev 5640)
@@ -0,0 +1,60 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/pager/pager.class.php" );
+
+    /**
+     * \ingroup View
+     * @private
+     *
+	 * shows a list of private messages
+	 */
+	class AdminOutboxPrivateMessagesListView extends AdminTemplatedView
+	{
+		var $_page;
+
+		function AdminOutboxPrivateMessagesListView( $blogInfo, $params = Array())
+		{
+			$this->AdminTemplatedView( $blogInfo, "editoutboxprivatemessages" );
+
+			// save the parameters and put them in a nicer place after checking them
+			if( !isset( $params["searchTerms"] ) ) $params["searchTerms"] = "";
+			$this->setValue( "searchTerms", $params["searchTerms"] );
+
+			$this->_page = $this->getCurrentPageFromRequest();
+		}
+
+		function render()
+		{
+            $searchTerms = $this->getValue( "searchTerms" );
+			$blogSettings = $this->_blogInfo->getSettings();
+			// get the private messages
+            lt_include( PLOG_CLASS_PATH."class/dao/privatemessageboxes.class.php" );
+			$privateMessageBoxes = new PrivateMessageBoxes();
+            $privateMessageOutbox = $privateMessageBoxes->getPrivateMessageOutboxFromUserId( $this->_userInfo->getId() );
+            $outboxPrivateMessages = $privateMessageOutbox->getPrivateMessagesFromBox( $searchTerms,
+                                                                                       $this->_page,
+                                                                                       DEFAULT_ITEMS_PER_PAGE );
+
+			// get the total number of private messages
+			$numOutboxPrivateMessages = $privateMessageOutbox->getNumPrivateMessagesFromBox( $searchTerms );
+
+			// throw the event
+			$this->notifyEvent( EVENT_PRIVATE_MESSAGES_LOADED, Array( "privatemessages" => &$outgoingMessages ));
+
+			// create the pager
+			$pager = new Pager( "?op=editOutboxPrivateMessages&amp;searchTerms={$searchTerms}&amp;page=",
+			                    $this->_page,
+								$numOutboxPrivateMessages,
+								DEFAULT_ITEMS_PER_PAGE );
+
+            // create the view and fill the template context
+            $this->setValue( "privatemessages", $outboxPrivateMessages );
+			$this->setValue( "searchTerms", $searchTerms );
+			$this->setValue( "pager", $pager );
+
+			// transfer control to the parent class
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file

Deleted: plog/trunk/class/view/admin/adminoutgoingprivatemessageslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminoutgoingprivatemessageslistview.class.php	2007-07-10 13:21:48 UTC (rev 5639)
+++ plog/trunk/class/view/admin/adminoutgoingprivatemessageslistview.class.php	2007-07-10 15:44:48 UTC (rev 5640)
@@ -1,60 +0,0 @@
-<?php
-
-	lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
-	lt_include( PLOG_CLASS_PATH."class/dao/privatemessages.class.php" );
-	lt_include( PLOG_CLASS_PATH."class/data/pager/pager.class.php" );
-
-    /**
-     * \ingroup View
-     * @private
-     *	
-	 * shows a list of private messages
-	 */
-	class AdminOutgoingPrivateMessagesListView extends AdminTemplatedView
-	{
-		var $_page;
-	
-		function AdminOutgoingPrivateMessagesListView( $blogInfo, $params = Array())
-		{
-			$this->AdminTemplatedView( $blogInfo, "editoutgoingprivatemessages" );
-			
-			// save the parameters and put them in a nicer place after checking them
-			if( !isset( $params["searchTerms"] ) ) $params["searchTerms"] = "";
-			$this->setValue( "searchTerms", $params["searchTerms"] );
-
-			$this->_page = $this->getCurrentPageFromRequest();
-		}
-		
-		function render()
-		{
-            $searchTerms = $this->getValue( "searchTerms" );
-			$blogSettings = $this->_blogInfo->getSettings();
-			// get the private messages
-            $privateMessages = new PrivateMessages();
-            $outgoingMessages = $privateMessages->getOutgoingMessagesFromSenderId( $this->_userInfo->getId(),
-                                                                                   $searchTerms,
-                                                                                   $this->_page,
-                                                                                   DEFAULT_ITEMS_PER_PAGE );
-
-			// get the total number of private messages
-			$numOutgoingPrivateMessages = $privateMessages->getNumOutgoingMessagesFromSenderId( $this->_userInfo->getId(), $searchTerms );
-			
-			// throw the event
-			$this->notifyEvent( EVENT_PRIVATE_MESSAGES_LOADED, Array( "privatemessages" => &$outgoingMessages ));
-			
-			// create the pager
-			$pager = new Pager( "?op=editOutgoingPrivateMessages&amp;searchTerms={$searchTerms}&amp;page=",
-			                    $this->_page,
-								$numOutgoingPrivateMessages,
-								DEFAULT_ITEMS_PER_PAGE );
-
-            // create the view and fill the template context
-            $this->setValue( "privatemessages", $outgoingMessages );
-			$this->setValue( "searchTerms", $searchTerms );
-			$this->setValue( "pager", $pager );
-			
-			// transfer control to the parent class
-			parent::render();
-		}
-	}
-?>
\ No newline at end of file

Copied: plog/trunk/templates/admin/editoutboxprivatemessages.template (from rev 5639, plog/trunk/templates/admin/editoutgoingprivatemessages.template)
===================================================================
--- plog/trunk/templates/admin/editoutboxprivatemessages.template	                        (rev 0)
+++ plog/trunk/templates/admin/editoutboxprivatemessages.template	2007-07-10 15:44:48 UTC (rev 5640)
@@ -0,0 +1,78 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=editOutboxPrivateMessages title=$locale->tr("editOutboxPrivateMessages")}
+<script type="text/javascript">
+{literal}
+YAHOO.util.Event.addListener( window, "load", function() {
+		var t = new Lifetype.UI.TableEffects( "list" );
+		t.stripe();
+		t.highlightRows();
+	});
+{/literal}
+</script>
+        <div id="list_nav_bar">
+            <div id="list_nav_select">
+
+<form id="viewPrivateMessages" action="admin.php" method="post">
+ <fieldset>
+  <legend>{$locale->tr("show_by")}</legend>
+
+   <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" />
+   </div>   
+   
+   <div class="list_nav_option">
+    <br />
+    <input type="hidden" name="op" value="editOutboxPrivateMessages" />
+    <input type="submit" name="Show" value="{$locale->tr("show")}" />
+   </div>
+  </fieldset> 
+ </form> 
+ </div>
+ <br style="clear:both" />
+ </div> 
+
+ <form id="outboxPrivateMessages" action="admin.php" method="post">
+ <div id="list"> 
+  {include file="$admintemplatepath/successmessage.template"}
+  {include file="$admintemplatepath/errormessage.template"}
+ <table id="list" class="info" summary="{$locale->tr("editOutboxPrivateMessages")}">
+  <thead>
+   <tr>
+    <th><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="toggleAllChecks('outboxPrivateMessages');" /></th>
+    <th style="width:20%">{$locale->tr("receiverName")}</th>
+    <th style="width:20%">{$locale->tr("date")}</th>
+    <th style="width:50%">{$locale->tr("subject")}</th>
+    <th style="width:10%">{$locale->tr("actions")}</th>
+   </tr>
+  </thead>
+  <tbody> 
+  {foreach from=$privatemessages item=privatemessage}
+  <tr>
+   <td align="center"><input class="checkbox" type="checkbox" name="messageIds[{counter}]" value="{$privatemessage->getId()}"/></td>  
+   <td class="col_highlighted">
+	 <a href="admin.php?op=readPrivateMessage&amp;messageId={$privatemessage->getId()}">{$privatemessage->getReceiverId()}</a>
+   </td>
+   <td>
+	 <a href="admin.php?op=readPrivateMessage&amp;messageId={$privatemessage->getId()}">{$privatemessage->getDate()}</a>
+   </td>
+   <td>
+	 <a href="admin.php?op=readPrivateMessage&amp;messageId={$privatemessage->getId()}">{$privatemessage->getSubject()}</a>
+   </td>
+   <td>
+   </td>   
+  </tr>
+  {/foreach}
+ </tbody> 
+ </table>
+ </div>
+ <div id="list_action_bar">
+  {adminpager style=list}
+  <input type="hidden" name="op" value="deleteLinkCategories"/>
+  <input type="submit" name="Delete selected" value="{$locale->tr("delete")}"/>
+ </div> 
+ </form>
+
+{include file="$admintemplatepath/footernavigation.template"}
+{include file="$admintemplatepath/footer.template"}

Deleted: plog/trunk/templates/admin/editoutgoingprivatemessages.template
===================================================================
--- plog/trunk/templates/admin/editoutgoingprivatemessages.template	2007-07-10 13:21:48 UTC (rev 5639)
+++ plog/trunk/templates/admin/editoutgoingprivatemessages.template	2007-07-10 15:44:48 UTC (rev 5640)
@@ -1,82 +0,0 @@
-{include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=editOutgoingPrivateMessages title=$locale->tr("editOutgoingPrivateMessages")}
-<script type="text/javascript">
-{literal}
-YAHOO.util.Event.addListener( window, "load", function() {
-		var t = new Lifetype.UI.TableEffects( "list" );
-		t.stripe();
-		t.highlightRows();
-	});
-{/literal}
-</script>
-        <div id="list_nav_bar">
-            <div id="list_nav_select">
-
-<form id="viewPrivateMessages" action="admin.php" method="post">
- <fieldset>
-  <legend>{$locale->tr("show_by")}</legend>
-
-   <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" />
-   </div>   
-   
-   <div class="list_nav_option">
-    <br />
-    <input type="hidden" name="op" value="editOutgoingPrivateMessages" />
-    <input type="submit" name="Show" value="{$locale->tr("show")}" />
-   </div>
-  </fieldset> 
- </form> 
- </div>
- <br style="clear:both" />
- </div> 
-
- <form id="outgoingPrivateMessages" action="admin.php" method="post">
- <div id="list"> 
-  {include file="$admintemplatepath/successmessage.template"}
-  {include file="$admintemplatepath/errormessage.template"}
- <table id="list" class="info" summary="{$locale->tr("editOutgoingPrivateMessages")}">
-  <thead>
-   <tr>
-    <th><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="toggleAllChecks('outgoingPrivateMessages');" /></th>
-    <th style="width:20%">{$locale->tr("senderName")}</th>
-    <th style="width:10%">{$locale->tr("date")}</th>
-    <th style="width:50%">{$locale->tr("subject")}</th>
-    <th style="width:10%">{$locale->tr("status")}</th>
-    <th style="width:10%">{$locale->tr("actions")}</th>
-   </tr>
-  </thead>
-  <tbody> 
-  {foreach from=$privatemessages item=privatemessage}
-  <tr>
-   <td align="center"><input class="checkbox" type="checkbox" name="messageIds[{counter}]" value="{$privatemessage->getId()}"/></td>  
-   <td class="col_highlighted">
-	 <a href="admin.php?op=readPrivateMessage&amp;messageId={$privatemessage->getId()}">{$privatemessage->getSenderId()}</a>
-   </td>
-   <td>
-	 <a href="admin.php?op=readPrivateMessage&amp;messageId={$privatemessage->getId()}">{$privatemessage->getDate()}</a>
-   </td>
-   <td>
-	 <a href="admin.php?op=readPrivateMessage&amp;messageId={$privatemessage->getId()}">{$privatemessage->getSubject()}</a>
-   </td>
-   <td>
-	 <a href="admin.php?op=readPrivateMessage&amp;messageId={$privatemessage->getId()}">{$privatemessage->getStatus()}</a>
-   </td>
-   <td>
-   </td>   
-  </tr>
-  {/foreach}
- </tbody> 
- </table>
- </div>
- <div id="list_action_bar">
-  {adminpager style=list}
-  <input type="hidden" name="op" value="deleteLinkCategories"/>
-  <input type="submit" name="Delete selected" value="{$locale->tr("delete")}"/>
- </div> 
- </form>
-
-{include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}

Modified: plog/trunk/templates/admin/menus.xml
===================================================================
--- plog/trunk/templates/admin/menus.xml	2007-07-10 13:21:48 UTC (rev 5639)
+++ plog/trunk/templates/admin/menus.xml	2007-07-10 15:44:48 UTC (rev 5640)
@@ -32,11 +32,11 @@
 	    <editFriends url="?op=editFriends"/>
 	    <newFriendGroup url="?op=newFriendGroup"/> 		     
 	    <editFriendGroups url="?op=editFriendGroups"/>
-	  </manageFriends>
-	  <managePrivateMessages ignoreBreadCrumbs="1">
-	    <newPrivateMessage url="?op=newPrivateMessage"/> 		     
-	    <editIncomingPrivateMessages url="?op=editIncomingPrivateMessages"/>
-		<editOutgoingPrivateMessages url="?op=editOutgoingPrivateMessages"/>
+	  </manageFriends>
+	  <managePrivateMessages ignoreBreadCrumbs="1">
+	    <newPrivateMessage url="?op=newPrivateMessage"/> 		     
+	    <editInboxPrivateMessages url="?op=editInboxPrivateMessages"/>
+		<editOutboxPrivateMessages url="?op=editOutboxPrivateMessages"/>
 	  </managePrivateMessages>
 	</friendManagement>
 	<controlCenter url="?op=controlCenter">



More information about the pLog-svn mailing list