[pLog-svn] r496 - in plog/trunk: class/action/admin class/view/admin templates/admin

oscar at devel.plogworld.net oscar at devel.plogworld.net
Tue Dec 14 17:48:58 GMT 2004


Author: oscar
Date: 2004-12-14 17:48:57 +0000 (Tue, 14 Dec 2004)
New Revision: 496

Modified:
   plog/trunk/class/action/admin/adminadduseraction.class.php
   plog/trunk/class/view/admin/adminadduserview.class.php
   plog/trunk/templates/admin/createuser.template
Log:
added support for setting the user status right in the "add user" page plus fixed a bug where the user wasn't being assigned to any blog, even if we selected one!

Modified: plog/trunk/class/action/admin/adminadduseraction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminadduseraction.class.php	2004-12-14 17:33:54 UTC (rev 495)
+++ plog/trunk/class/action/admin/adminadduseraction.class.php	2004-12-14 17:48:57 UTC (rev 496)
@@ -27,6 +27,7 @@
 		var $_userBlog;
 		var $_userFullName;
 		var $_properties;
+		var $_userStatus;
 
     	function AdminAddUserAction( $actionInfo, $request )
         {
@@ -36,6 +37,7 @@
         	$this->registerFieldValidator( "userName", new StringValidator());
         	$this->registerFieldValidator( "userPassword", new PasswordValidator());
         	$this->registerFieldValidator( "userEmail", new EmailValidator());
+			$this->registerFieldValidator( "userStatus", new IntegerValidator());
         	$this->registerField( "userFullName" );
         	$this->registerField( "userBlog", new IntegerValidator());
         	$view = new AdminAddUserView( $this->_blogInfo );
@@ -48,7 +50,9 @@
         	$this->_userName = $this->_request->getValue( "userName" );
             $this->_userPassword = $this->_request->getValue( "userPassword" );
             $this->_userEmail = $this->_request->getValue( "userEmail" );
-            $this->_userFullName = $this->_request->getValue( "userFullName" );	        
+            $this->_userFullName = $this->_request->getValue( "userFullName" );
+			$this->_userStatus = $this->_request->getValue( "userStatus" );
+			$this->_userBlog = $this->_request->getValue( "userBlog" );
 	        
         	// now that we have validated the data, we can proceed to create the user, making
             // sure that it doesn't already exists
@@ -69,6 +73,7 @@
 								  $this->_userFullName,
 								  0,
 								  $this->_properties );
+			$user->setStatus( $this->_userStatus );
 			$this->notifyEvent( EVENT_PRE_USER_ADD, Array( "user" => &$user ));
 			$newUserId = $users->addUser( $user );
 			

Modified: plog/trunk/class/view/admin/adminadduserview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminadduserview.class.php	2004-12-14 17:33:54 UTC (rev 495)
+++ plog/trunk/class/view/admin/adminadduserview.class.php	2004-12-14 17:48:57 UTC (rev 496)
@@ -1,28 +1,30 @@
-<?php
-
-	include_once( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
-	include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
-	
-	/**
-	 * shows a special view to add a user to the site
-	 */
-	class AdminAddUserView extends AdminTemplatedView
-	{
-	
-		function AdminAddUserView( $blogInfo )
-		{
-			$this->AdminTemplatedView( $blogInfo, "createuser" );	
-		}
-		
-		function render()
-		{
-			// load the list of blogs
-			$blogs = new Blogs();
-			$siteBlogs = $blogs->getAllBlogs();
-			
-			$this->setValue( "siteblogs", $siteBlogs );
-		
-			parent::render();
-		}
-	}
+<?php
+
+	include_once( PLOG_CLASS_PATH.'class/view/admin/admintemplatedview.class.php' );
+	include_once( PLOG_CLASS_PATH.'class/dao/blogs.class.php' );
+	include_once( PLOG_CLASS_PATH.'class/dao/userstatus.class.php' );
+	
+	/**
+	 * shows a special view to add a user to the site
+	 */
+	class AdminAddUserView extends AdminTemplatedView
+	{
+	
+		function AdminAddUserView( $blogInfo )
+		{
+			$this->AdminTemplatedView( $blogInfo, 'createuser' );	
+		}
+		
+		function render()
+		{
+			// load the list of blogs
+			$blogs = new Blogs();
+			$siteBlogs = $blogs->getAllBlogs();
+			
+			$this->setValue( 'siteblogs', $siteBlogs );
+			$this->setValue( 'userStatusList', UserStatus::getStatusList());
+		
+			parent::render();
+		}
+	}
 ?>
\ No newline at end of file

Modified: plog/trunk/templates/admin/createuser.template
===================================================================
--- plog/trunk/templates/admin/createuser.template	2004-12-14 17:33:54 UTC (rev 495)
+++ plog/trunk/templates/admin/createuser.template	2004-12-14 17:48:57 UTC (rev 496)
@@ -32,6 +32,16 @@
       <input type="text" name="userEmail" value="{$userEmail}"/>
       {include file="$admintemplatepath/validate.template" field=userEmail message=$locale->tr("error_incorrect_email_address")}
     </div>
+	<div class="field">
+	  <label for="userStatus">{$locale->tr("status")}</label>
+	  <span class="required">*</span>
+	  <div class="formHelp">{$locale->tr("user_status_help")}</div>
+	  <select name="userStatus">
+	   {foreach from=$userStatusList item=status key=statusKey}
+	     <option value="{$status}">{$locale->tr($statusKey)}</option>
+	   {/foreach}
+	  </select>
+	</div>
     <div class="field">
       <label for="userBlog">{$locale->tr("assigned_to_blog")}</label>
       <span class="required"></span>




More information about the pLog-svn mailing list