[xoops-cvslog 4481] CVS update: xoops2jp/html/modules/pm/forms

Back to archive index

Minahito minah****@users*****
2006年 9月 10日 (日) 19:39:14 JST


Index: xoops2jp/html/modules/pm/forms/PmliteEditForm.class.php
diff -u xoops2jp/html/modules/pm/forms/PmliteEditForm.class.php:1.1.2.9 xoops2jp/html/modules/pm/forms/PmliteEditForm.class.php:1.1.2.10
--- xoops2jp/html/modules/pm/forms/PmliteEditForm.class.php:1.1.2.9	Thu Aug 17 18:09:23 2006
+++ xoops2jp/html/modules/pm/forms/PmliteEditForm.class.php	Sun Sep 10 19:39:14 2006
@@ -42,6 +42,14 @@
 		}
 	}
 	
+	/**
+	 * This member function is called by Pm_PmliteEditFormReplyState.
+	 */
+	function setToUserByUid($uid)
+	{
+		$this->set('to_userid', $uid);
+	}
+	
 	function fetch()
 	{
 		parent::fetch();
@@ -50,7 +58,7 @@
 			$this->mState->fetch($this);
 		}
 	}
-
+	
 	function changeStateReply()
 	{
 		$this->mState =& new Pm_PmliteEditFormReplyState();
@@ -68,6 +76,11 @@
 		parent::prepare();
 		$this->mFormProperties['to_userid'] = new XCube_IntProperty('to_userid');
 	}
+	
+	function setToUserByUid($uid)
+	{
+		$this->set('to_userid', $uid);
+	}
 
 	/**
 	 * Check existence of the target user.
@@ -108,6 +121,25 @@
 		$this->mFormProperties['to_uname'] = new XCube_StringProperty('to_uname');
 	}
 
+	function setToUserByUid($uid)
+	{
+		$handler =& xoops_gethandler('user');
+		$user =& $handler->get($uid);
+
+		if (is_object($user) && $user->isActive()) {
+			$this->set('to_uname', $user->get('uname'));
+		}
+	}
+	
+	function fetch()
+	{
+		parent::fetch();
+		
+		if (xoops_getrequest('to_userid') != null && xoops_getrequest('to_uname') == null) {
+			$this->setToUserByUid(xoops_getrequest('to_userid'));
+		}
+	}
+	
 	/**
 	 * Check existence of the target user.
 	 */
@@ -119,7 +151,7 @@
 			$userArr =& $handler->getObjects($criteria);
 
 			if (count($userArr) > 0 && is_object($userArr[0]) && $userArr[0]->isActive()) {
-				$this->_mId = $userArr[0]->get('uid');
+				$this->_mUid = $userArr[0]->get('uid');
 			}
 			else {
 				$this->addErrorMessage(_MD_PM_ERROR_PLZTRYAGAIN);
@@ -168,10 +200,18 @@
 				$root =& XCube_Root::getSingleton();
 				$currentUser =& $root->mController->getXoopsUser();
 				if ($pm->get('to_userid') == $currentUser->get('uid')) {
+					$form->setToUserByUid($pm->get('from_userid'));
+					
 					//
 					// Create subject
 					//
-					if (!preg_match("/^Re:/", $pm->get('subject'))) {
+					if (preg_match("/^Re\[(\d+)\]:(.*)", $pm->get('subject'), $matches)) {
+						$form->set('subject', "Re[" . $matches[1] . "]: " . $matches[2]);
+					}
+					elseif (preg_match("/^Re:(.*)/", $pm->get('subject'), $matches)) {
+						$form->set('subject', "Re[2]: " . $matches[1]);
+					}
+					else {
 						$form->set('subject', "Re: " . $pm->get('subject'));
 					}
 


xoops-cvslog メーリングリストの案内
Back to archive index