incubator-esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhir...@apache.org
Subject svn commit: r925107 - in /incubator/esme/trunk/server/src/main: resources/ scala/bootstrap/liftweb/ scala/org/apache/esme/lib/ webapp/action_view/ webapp/pools_view/ webapp/templates-hidden/ webapp/track_view/
Date Fri, 19 Mar 2010 07:11:53 GMT
Author: rhirsch
Date: Fri Mar 19 07:11:52 2010
New Revision: 925107

URL: http://svn.apache.org/viewvc?rev=925107&view=rev
Log:
[ESME-100] Finish web UI
Daily hour

Modified:
    incubator/esme/trunk/server/src/main/resources/ESMEBase.properties
    incubator/esme/trunk/server/src/main/resources/ESMEUI.properties
    incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/AccessPoolMgr.scala
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ActionMgr.scala
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/TrackMgr.scala
    incubator/esme/trunk/server/src/main/webapp/action_view/index.html
    incubator/esme/trunk/server/src/main/webapp/pools_view/index.html
    incubator/esme/trunk/server/src/main/webapp/templates-hidden/message.html
    incubator/esme/trunk/server/src/main/webapp/track_view/index.html

Modified: incubator/esme/trunk/server/src/main/resources/ESMEBase.properties
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/resources/ESMEBase.properties?rev=925107&r1=925106&r2=925107&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/resources/ESMEBase.properties (original)
+++ incubator/esme/trunk/server/src/main/resources/ESMEBase.properties Fri Mar 19 07:11:52
2010
@@ -36,9 +36,9 @@ base_menu_logout_error=You must be logge
 base_menu_sign_up_error=You can't sign up when you are already logged in
 
 base_pool_menu=Pools
-base_pool_error_name_short=Pool name is too short
-base_pool_msg_new_pool=A new pool has been created.
-base_pool_msg_duplicate_name_pool=A pool with this name already exists. Please choose a different
one
+base_pool_error_name_short=The pool name is too short. Pool names must have a length of at
least 3 characters!
+base_pool_msg_new_pool=A new pool '%s' has been created.
+base_pool_msg_duplicate_name_pool=A pool with this name '%s' already exists. Please choose
a different one
 base_pool_msg_choose_pool=--choose pool--
 base_pool_err_user_not_found=User not found
 base_pool_err_pool_not_found=Pool not found
@@ -47,6 +47,7 @@ base_pool_ui_empty_date=NA
 base_pool_err_no_admin_users=No other admin users in pool!
 base_pool_err_dup_name=A pool with this name already exists
 base_pool_err_dup_name_in_realm=A pool with this name '%s' already exists in realm '%s'
+base_pool_msg_no_permission=You don't have permission to edit this pool
 
 base_urlstore_err_too_short=The minimum URL length is 3 characters
 
@@ -78,7 +79,8 @@ base_token_msg_new_token=A new token '%s
 base_token_msg_removed=Action '%s' removed
 
 base_track_menu=Tracks
-base_track_error_name_short=Track is too short!
+base_track_error_name_short=The track is too short. Tracks must have a length of at least
3 characters!
+base_track_error_name_long=The track is too long. Tracks must have a length less than l30
characters!
 base_track_msg_success=Now tracking '%s'
 base_track_msg_removed=Track '%s' removed
 base_track_msg_active=Active state of the track '%s' changed: %b

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=925107&r1=925106&r2=925107&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/resources/ESMEUI.properties (original)
+++ incubator/esme/trunk/server/src/main/resources/ESMEUI.properties Fri Mar 19 07:11:52 2010
@@ -124,6 +124,7 @@ ui_login_password=Password
 
 ui_open_id_title=OpenID
 
+ui_messages_share=Share with
 ui_messages_your_timeline=Your timeline
 ui_messages_message_label_author=Author
 ui_messages_message_label_message=Message

Modified: incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala?rev=925107&r1=925106&r2=925107&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala Fri Mar 19 07:11:52
2010
@@ -82,6 +82,14 @@ class Boot {
         if r.param("token").isDefined =>
         () => RestAPI.sendMsgWithToken(r)
     }
+    
+    //Added exceptions to the log
+    LiftRules.exceptionHandler.prepend {
+      case (_, _, exception) => {
+        Log.error(exception.getStackTrace.toString)
+        RedirectResponse("/")
+      }
+    } 
 
     LiftRules.dispatch.append(ESMEOpenIDVendor.dispatchPF)
 

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=925107&r1=925106&r2=925107&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 Fri
Mar 19 07:11:52 2010
@@ -21,9 +21,12 @@ package org.apache.esme.lib
 
 import net.liftweb._
 import http._
-import SHtml._
 import js._
-import JsCmds._
+import js.jquery._
+import http.jquery._
+import JqJsCmds._
+import JsCmds._ 
+import SHtml._
 import JE._
 
 import sitemap._
@@ -74,22 +77,24 @@ object AccessPoolMgr {
   def addPool(in: NodeSeq): NodeSeq = {
     val theInput = "new_pool"
     val user = User.currentUser 
-    
+    val redisplayPool = updatePool.is
+       
     def addNewPool(name: String) = {
       name.trim match {
-        case x if x.length < 3 => S.error(S.?("base_pool_error_name_short"))
+        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)
           pool match {
-            case Failure(_,_,_) => S.error(S.?("base_pool_msg_duplicate_name_pool"))
+            case Failure(_,_,_) => DisplayMessage("messages", <b>{S.?("base_pool_msg_duplicate_name_pool",name)}</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)
-                S.notice(S.?("base_pool_msg_new_pool"))
+                Distributor ! Distributor.AllowUserInPool(user.get.id.is, p.id.is)      
  
                 logger.info("ACCESS: " + S.?("base_pool_msg_new_pool") + " " + name)
+                SetValById(theInput, "")
+                DisplayMessage("messages", <b>{S.?("base_pool_msg_new_pool",name)}</b>,
 3 seconds, 2 seconds) 
               } else
-                S.error(S.?("base_error_general"))
+                DisplayMessage("messages", <b>{S.?("base_pool_msg_no_permission")}</b>,
 3 seconds, 2 seconds)
             case _ => S.error(S.?("base_error_general"))
           }
         }
@@ -132,15 +137,18 @@ object AccessPoolMgr {
     def addPoolUser(permission: String): JsCmd = {
       val r: Box[Boolean] = 
       for (admin <- adminUser;
-           p <- AccessPool.find(pool) ?~ S.?("base_pool_err_pool_not_found");
-           user <- User.findFromWeb(username) ?~ S.?("base_pool_err_user_not_found")
+           p <- AccessPool.find(pool) ?~ DisplayMessage("messages", <b>{S.?("base_pool_err_pool_not_found")}</b>,
 3 seconds, 2 seconds);
+           user <- User.findFromWeb(username) ?~ DisplayMessage("messages", <b>{S.?("base_pool_err_pool_not_found")}</b>,
 3 seconds, 2 seconds)
       ) yield if(Privilege.hasPermission(admin.id.is, p.id.is, Permission.Admin)) {
         val result = try {
           Privilege.create.user(user).pool(p).permission(Permission(permission.toInt)).save
         } catch {
           case _: Exception => false
         }
-        if (result) Distributor ! Distributor.AllowUserInPool(user.id.is, p.id.is)
+        if (result) {
+        	Distributor ! Distributor.AllowUserInPool(user.id.is, p.id.is)
+        	DisplayMessage("messages", <b>{S.?("base_pool_msg_permission_set")}</b>,
 3 seconds, 2 seconds)
+       }
         result
       } else false // "User has no permission to administer pool"
       r match {

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ActionMgr.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ActionMgr.scala?rev=925107&r1=925106&r2=925107&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ActionMgr.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ActionMgr.scala Fri Mar
19 07:11:52 2010
@@ -21,9 +21,12 @@ package org.apache.esme.lib
 
 import net.liftweb._
 import http._
-import SHtml._
 import js._
-import JsCmds._
+import js.jquery._
+import http.jquery._
+import JqJsCmds._
+import JsCmds._ 
+import SHtml._
 import JE._
 
 import sitemap._
@@ -36,6 +39,10 @@ import common._
 import Helpers._
 
 import model._
+import JqJsCmds._
+import JsCmds._ 
+import SHtml._
+
 
 import java.util.Date
 import java.text.{DateFormat,SimpleDateFormat}
@@ -66,13 +73,15 @@ object ActionMgr {
    }
 
   def displayActions(in: NodeSeq): NodeSeq = {
+  
     // get the span name to update
     val spanName = S.attr("the_id") openOr "TokenSpan"
     // get the current user
     val user = User.currentUser
 
     // bind the dynamic content to the incoming nodeseq
-    def doRender(): NodeSeq =
+    
+    def doRender(): NodeSeq =   
     Action.findAll(By(Action.user, user), By(Action.removed, false),
                    OrderBy(Action.id, Ascending)) match {
       case Nil => NodeSeq.Empty
@@ -81,14 +90,16 @@ object ActionMgr {
                       (lst => xs.flatMap(i => bind("item", lst,
                                                    "name" -> i.name.is,
                                                    "enabled" -> ajaxCheckbox(!i.disabled,
-                                                                             e => {i.disabled(!e).save;
S.notice(S.?("base_action_msg_active")); Noop} ),
+                                                                             e => {i.disabled(!e).save;
DisplayMessage("messages", <b>Action activity changed</b>,  3 seconds, 3 seconds);
Noop} ),
                                                    "test" -> i.testText,
                                                    "action" -> i.actionText,
                                                    "createdDate" -> getDateHtml(i.createdDate),
                                                    "remove" -> 
                                                    ((bt: NodeSeq) => 
-                  ajaxButton(bt, () => {i.removed(true).save ; S.notice(S.?("base_action_msg_removed",
i.name.is)); updateSpan()}))
+                  ajaxButton(bt, () => {i.removed(true).save ; DisplayMessage("messages",
<b>Action removed</b>,  3 seconds, 3 seconds); updateSpan()}))
               ))))
+   
+
     }
 
     def updateSpan(): JsCmd = SetHtml(spanName, doRender())
@@ -115,15 +126,16 @@ object ActionMgr {
              a2 <- a1.setTest(test))
         yield a2.validate
 
+
+          
         act match {
           case Full(Nil) =>
             toSave.save 
-            S.notice(S.?("base_action_msg_new_action", name))
             redisplay() &
             SetValById(mainName, "") &
             SetValById(mainAction, "") &
-            SetValById(mainTest, "")
-
+            SetValById(mainTest, "") &
+            DisplayMessage("messages", <b>{S.?("base_action_msg_new_action",name)}</b>,
 3 seconds, 3 seconds) 
           case Full(xs) => S.error(xs); Noop
           case Failure(msg, _, _) => S.error(msg) ; Noop
           case _ => Noop

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/TrackMgr.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/TrackMgr.scala?rev=925107&r1=925106&r2=925107&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/TrackMgr.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/TrackMgr.scala Fri Mar
19 07:11:52 2010
@@ -21,9 +21,12 @@ package org.apache.esme.lib
 
 import net.liftweb._
 import http._
-import SHtml._
 import js._
-import JsCmds._
+import js.jquery._
+import http.jquery._
+import JqJsCmds._
+import JsCmds._ 
+import SHtml._
 import JE._
 
 import sitemap._
@@ -71,10 +74,10 @@ object TrackMgr {
                       (lst => xs.flatMap(i => bind("item", lst,
                                                    "pattern" -> i.pattern,
                                                    "enabled" -> ajaxCheckbox(!i.disabled,
-                                                                             e => {i.disabled(!e).save;
S.notice(S.?("base_track_msg_active", i.pattern, e)); Noop} ),
+                                                                             e => {i.disabled(!e).save;
 Noop} ),
                                                    "remove" -> 
                                                    ((bt: NodeSeq) => 
-                  ajaxButton(bt, () => { S.notice(S.?("base_track_msg_removed", i.pattern));
i.removed(true).save ; updateSpan()}))
+                  ajaxButton(bt, () => { i.removed(true).save ; updateSpan(); }))
               ))))
     }
 
@@ -91,12 +94,17 @@ object TrackMgr {
     
     def addTrack(what: String): JsCmd = {
       what.trim match {
-        case x if x.length < 3 => S.error(S.?("base_track_error_name_short"))
-        case x => Tracking.create.regex(x).user(user).saveMe
-          S.notice(S.?("base_track_msg_success", x))
+        case x if x.length < 3 => DisplayMessage("messages", <b>{S.?("base_track_error_name_short")}</b>,
 3 seconds, 3 seconds)
+        case x if x.length > 30 => DisplayMessage("messages", <b>{S.?("base_track_error_name_long")}</b>,
 3 seconds, 3 seconds)  
+        case x => Tracking.create.regex(x).user(user).saveMe 
+        redisplayTracking()
+        SetValById(theInput, "")
+        DisplayMessage("messages", <b>{S.?("base_track_msg_success", x)}</b>,
 3 seconds, 3 seconds)
+        
+          
       }
 
-      redisplayTracking() & SetValById(theInput, "")
+      
     }
 
     bind("main", in,

Modified: incubator/esme/trunk/server/src/main/webapp/action_view/index.html
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/action_view/index.html?rev=925107&r1=925106&r2=925107&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/action_view/index.html (original)
+++ incubator/esme/trunk/server/src/main/webapp/action_view/index.html Fri Mar 19 07:11:52
2010
@@ -35,6 +35,7 @@
 	<script type="text/javascript" src="../scripts/jquery-ui-1.7.2.custom.min.js"></script>
 	<script type="text/javascript" src="../scripts/esme.js"></script>
 	<script type="text/javascript" src="../scripts/esme_table_sorter.js"></script>
+	 <div id="messages"></div>
 	<div class="demo">
 		<div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs">
 			<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">

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=925107&r1=925106&r2=925107&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 Fri Mar 19 07:11:52
2010
@@ -30,6 +30,7 @@
     </script>
     <script type="text/javascript" src="../scripts/esme_table_sorter.js">
     </script>
+    <div id="messages"></div>
     <div class="demo">
         <div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs">
             <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header
ui-corner-all">

Modified: incubator/esme/trunk/server/src/main/webapp/templates-hidden/message.html
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/templates-hidden/message.html?rev=925107&r1=925106&r2=925107&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/templates-hidden/message.html (original)
+++ incubator/esme/trunk/server/src/main/webapp/templates-hidden/message.html Fri Mar 19 07:11:52
2010
@@ -26,8 +26,9 @@
 					<lift:loc>ui_messages_message_label_message_request</lift:loc>
 				</h3>
 				<div id="form-update">
+				         <div id="messages"></div>
 					<div class="post-form-row">
-						<label>                                            Share with               
                        </label>
+						<label><lift:loc>ui_messages_share</lift:loc></label>
 						<select id="vPool" class="inputBox2">
 							<option value="0">
 								<lift:loc>ui_messages_message_label_message_pool_public</lift:loc>

Modified: incubator/esme/trunk/server/src/main/webapp/track_view/index.html
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/track_view/index.html?rev=925107&r1=925106&r2=925107&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/track_view/index.html (original)
+++ incubator/esme/trunk/server/src/main/webapp/track_view/index.html Fri Mar 19 07:11:52
2010
@@ -37,6 +37,7 @@
 	<script type="text/javascript" src="../scripts/dialog_test.js">    </script>
 	<script type="text/javascript" src="../scripts/esme.js">    </script>
 	<script type="text/javascript" src="../scripts/esme_table_sorter.js">    </script>
+	<div id="messages"></div>
 	<div class="demo">
 		<div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs">
 			<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">



Mime
View raw message