incubator-esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhir...@apache.org
Subject svn commit: r950565 - in /incubator/esme/trunk/server/src/main: resources/ESMEUI.properties scala/org/apache/esme/lib/AccessPoolMgr.scala scala/org/apache/esme/model/AccessPool.scala webapp/pools_view/index.html webapp/scripts/dialog_pool.js
Date Wed, 02 Jun 2010 13:50:31 GMT
Author: rhirsch
Date: Wed Jun  2 13:50:30 2010
New Revision: 950565

URL: http://svn.apache.org/viewvc?rev=950565&view=rev
Log:
[ESME-92] Add description to the Access Pool object
Patch by Imtiaz Ahmed Hajee Esmail 

Modified:
    incubator/esme/trunk/server/src/main/resources/ESMEUI.properties
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/AccessPoolMgr.scala
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/AccessPool.scala
    incubator/esme/trunk/server/src/main/webapp/pools_view/index.html
    incubator/esme/trunk/server/src/main/webapp/scripts/dialog_pool.js

Modified: incubator/esme/trunk/server/src/main/resources/ESMEUI.properties
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/resources/ESMEUI.properties?rev=950565&r1=950564&r2=950565&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/resources/ESMEUI.properties (original)
+++ incubator/esme/trunk/server/src/main/resources/ESMEUI.properties Wed Jun  2 13:50:30 2010
@@ -21,6 +21,7 @@ ui_base_error=Error:
 ui_base_notife=FYI:
 
 ui_form_all_fields_required=All form fields are required.
+ui_form_pool_name_required=Pool name is required.
  
 ui_sign_up_intro=Create a new account
 ui_sign_up_basic_info=Basic User Information
@@ -46,7 +47,8 @@ ui_default_title=Enterprise Social Messa
 
 ui_pool_manage=My Pools
 ui_pool_create=Create New Pool
-ui_pool_add=Name  
+ui_pool_add=Name
+ui_pool_description=Description
 ui_pool_list_pool_name=Name
 ui_pool_list_last_modifier=Last Modifier
 ui_pool_list_modify_date=Modify Date

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/AccessPoolMgr.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/AccessPoolMgr.scala?rev=950565&r1=950564&r2=950565&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/AccessPoolMgr.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/AccessPoolMgr.scala Wed
Jun  2 13:50:30 2010
@@ -80,23 +80,35 @@ object AccessPoolMgr {
   def addPool(in: NodeSeq): NodeSeq = {
   
     val theInput = "new_pool"
-    val user = User.currentUser 
+    val newPoolDescription = "new_pool_description";
+    val user = User.currentUser
+    var newPoolName = "";
     
       
-    def addNewPool(name: String) = {
+    //def addNewPool(name: String) = {
+    def addNewPool(poolDescription: String) = {
+      /*
       name.trim match {
         case x if x.length < 3 => DisplayMessage("messages", <b>{S.?("base_pool_error_name_short")}</b>,
 3 seconds, 3 seconds)
         case x => {
-          val pool = AccessPool.create.realm(AccessPool.Native).setName(name)
+      */
+      (newPoolName.trim, poolDescription.trim) match {
+        case (x, y) if x.length < 3 => DisplayMessage("messages", <b>{S.?("base_pool_error_name_short")}</b>,
 3 seconds, 3 seconds)
+        case (x, y) => {
+          //val pool = AccessPool.create.realm(AccessPool.Native).setName(name)
+          val pool = AccessPool.create.realm(AccessPool.Native).setUpAccessPool(x, y)
           pool match {
-            case Failure(_,_,_) => DisplayMessage("messages", <b>{S.?("base_pool_msg_duplicate_name_pool",name)}</b>,
 3 seconds, 2 seconds)
+            //case Failure(_,_,_) => DisplayMessage("messages", <b>{S.?("base_pool_msg_duplicate_name_pool",name)}</b>,
 3 seconds, 2 seconds)
+            case Failure(_,_,_) => DisplayMessage("messages", <b>{S.?("base_pool_msg_duplicate_name_pool",x)}</b>,
 3 seconds, 2 seconds)
             case Full(p: AccessPool) => val privilegeSaved =
               Privilege.create.pool(p.saveMe).user(user).permission(Permission.Admin).save
               if(privilegeSaved && user.isDefined) {
                 Distributor ! Distributor.AllowUserInPool(user.get.id.is, p.id.is)      
  
-                logger.info("ACCESS: " + S.?("base_pool_msg_new_pool",name)) 
+                //logger.info("ACCESS: " + S.?("base_pool_msg_new_pool",name))
+                logger.info("ACCESS: " + S.?("base_pool_msg_new_pool",x))
                 SetValById(theInput, "")  &
-                DisplayMessage("messages", <b>{S.?("base_pool_msg_new_pool",name)}</b>,
 3 seconds, 2 seconds)
+                //DisplayMessage("messages", <b>{S.?("base_pool_msg_new_pool",name)}</b>,
 3 seconds, 2 seconds)
+                DisplayMessage("messages", <b>{S.?("base_pool_msg_new_pool",x)}</b>,
 3 seconds, 2 seconds)
               } else
                 DisplayMessage("messages", <b>{S.?("base_pool_msg_no_permission")}</b>,
 3 seconds, 2 seconds)
             case _ => S.error(S.?("base_error_general"))
@@ -107,8 +119,9 @@ object AccessPoolMgr {
     }
 
     bind("add", in,
-         "poolName" -%> text("", addNewPool, "id" -> theInput)
-    )
+         //"poolName" -%> text("", addNewPool, "id" -> theInput),
+         "poolName" -%> text("", newPoolName = _ , "id" -> theInput),
+         "poolDescription" -%> textarea("", addNewPool, "id" -> newPoolDescription,
"cols" -> "33", "rows" -> "2"))
     
   }
 
@@ -212,7 +225,7 @@ object AccessPoolMgr {
        AccessPool.find(By(AccessPool.id, poolId.is)) match {
         case Full(ap) => bind(
         "pool", in,
-        "name" -> ap.getName,     
+        "name" -> (if ( ap.getDescription.isEmpty ) ap.getName else ap.getName + " - "
+ ap.getDescription),
         "creator" -> displayUserName(ap.creator),
         "createdDate" -> getDateHtml(ap.createdDate),
         "modifier" -> displayUserName(ap.modifier),

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/AccessPool.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/AccessPool.scala?rev=950565&r1=950564&r2=950565&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/AccessPool.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/AccessPool.scala Wed
Jun  2 13:50:30 2010
@@ -64,6 +64,11 @@ class AccessPool extends LongKeyedMapper
       )
     
   }
+
+  def setUpAccessPool(name: String, descriptionStr: String) = {
+    this.description(descriptionStr)
+    setName(name)
+  }
   
   // set modify information when setName
   def setName(in: String) = sameName(in) match {

Modified: incubator/esme/trunk/server/src/main/webapp/pools_view/index.html
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/pools_view/index.html?rev=950565&r1=950564&r2=950565&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/pools_view/index.html (original)
+++ incubator/esme/trunk/server/src/main/webapp/pools_view/index.html Wed Jun  2 13:50:30
2010
@@ -133,7 +133,8 @@
 			</div>
 			<div id="dialog-form" title="Create new  pool" style="display: none">
 				<p class="validateTips">
-					<lift:loc>ui_form_all_fields_required</lift:loc>
+					<!--lift:loc>ui_form_all_fields_required</lift:loc-->
+               <lift:loc>ui_form_pool_name_required</lift:loc>
 				</p>
 				<form id="pool_new_dialog" onsubmit="false">
 					<lift:addPool>
@@ -142,6 +143,10 @@
 								<lift:loc>ui_pool_add</lift:loc>
 							</label>
 							<add:poolName class="text ui-widget-content ui-corner-all tipelement" title="This
is name of your new pool" />
+                     <label for="poolDescription">
+								<lift:loc>ui_pool_description</lift:loc>
+							</label>
+                     <add:poolDescription class="textarea ui-widget-content ui-corner-all
tipelement" title="This is a short description of the new pool" />
 						</fieldset>
 					</lift:addPool>
 				</form>

Modified: incubator/esme/trunk/server/src/main/webapp/scripts/dialog_pool.js
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/scripts/dialog_pool.js?rev=950565&r1=950564&r2=950565&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/scripts/dialog_pool.js (original)
+++ incubator/esme/trunk/server/src/main/webapp/scripts/dialog_pool.js Wed Jun  2 13:50:30
2010
@@ -9,6 +9,7 @@
 		$("#dialog").dialog("destroy");
 		
 		var pool_input = $("#new_pool"),
+         new_pool_description = $("#new_pool_description"),
 		  edit_username = $("#edit_username"),
 		   edit_permission = $("#edit_permission"),
 			allFields = $([]).add(pool_input),
@@ -63,8 +64,10 @@
 					bValid = bValid && checkLength(pool_input,"Pool name",3,16);
 
 					bValid = bValid && checkRegexp(pool_input,/^[a-z]([0-9a-z_])+$/i,"Name may consist
of a-z, 0-9, underscores, begin with a letter.");
+
+               npdValid = checkLength(new_pool_description, "Description", 0, 64);
 					
-					if (bValid) {
+					if (bValid && npdValid ) {
 						 liftAjax.lift_ajaxHandler(jQuery("#pool_new_dialog").serialize(), null, null, "javascript");
 
 
 						$(this).dialog('close');
@@ -89,11 +92,11 @@
 					var bValid = true;
 					allFieldsUser.removeClass('ui-state-error');
 
-					bValid = bValid && checkLength(edit_username,"User name",3,16);
+					bValid = bValid && checkLength(edit_username,"User name",2,16);
 					bValid = bValid && checkRegexp(edit_username,/^[a-z]([0-9a-z_])+$/i,"Name may
consist of a-z, 0-9, underscores, begin with a letter.");
 					
 					if (bValid) {
-						 liftAjax.lift_ajaxHandler(jQuery("#pool_new_dialog").serialize(), null, null, "javascript");
 
+						 liftAjax.lift_ajaxHandler(jQuery("#pool_new_user_dialog").serialize(), null, null,
"javascript");  
 
 						$(this).dialog('close');
 					}



Mime
View raw message