You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@esme.apache.org by vd...@apache.org on 2010/02/01 10:28:54 UTC

svn commit: r905218 - in /incubator/esme/trunk/server/src/main: resources/ scala/bootstrap/liftweb/ scala/org/apache/esme/lib/ webapp/profile_view/ webapp/templates-hidden/

Author: vdichev
Date: Mon Feb  1 09:28:53 2010
New Revision: 905218

URL: http://svn.apache.org/viewvc?rev=905218&view=rev
Log:
Added page for user profile editing

Added:
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ProfileMgr.scala   (with props)
    incubator/esme/trunk/server/src/main/webapp/profile_view/
    incubator/esme/trunk/server/src/main/webapp/profile_view/edit.html   (with props)
Modified:
    incubator/esme/trunk/server/src/main/resources/ESMEBase.properties
    incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala
    incubator/esme/trunk/server/src/main/webapp/templates-hidden/default.html
    incubator/esme/trunk/server/src/main/webapp/templates-hidden/message.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=905218&r1=905217&r2=905218&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/resources/ESMEBase.properties (original)
+++ incubator/esme/trunk/server/src/main/resources/ESMEBase.properties Mon Feb  1 09:28:53 2010
@@ -90,3 +90,4 @@
 
 base_users_menu=Users
 
+base_profile_menu=Edit Profile

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=905218&r1=905217&r2=905218&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 Mon Feb  1 09:28:53 2010
@@ -136,7 +136,8 @@
         AccessPoolMgr.menuItems :::
         StreamMgr.menuItems :::
         ConversationMgr.menuItems :::
-        SearchMgr.menuItems
+        SearchMgr.menuItems :::
+        ProfileMgr.menuItems
 
     LiftRules.setSiteMap(SiteMap(entries: _*))
 

Added: incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ProfileMgr.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ProfileMgr.scala?rev=905218&view=auto
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ProfileMgr.scala (added)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ProfileMgr.scala Mon Feb  1 09:28:53 2010
@@ -0,0 +1,71 @@
+/**
+ * Copyright 2008-2009 WorldWide Conferencing, LLC
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.esme.lib
+
+import net.liftweb._
+import http._
+import SHtml._
+import js._
+import JsCmds._
+import JE._
+
+import sitemap._
+import Loc._
+
+import mapper._
+
+import util._
+import common._
+import Helpers._
+
+import model._
+
+import scala.xml._
+
+/**
+ * Manage the sitemap and related snippets for editing a user's profile
+ */
+object ProfileMgr {
+  def loggedIn_? = User.loggedIn_?
+
+  val ifIsLoggedIn = If(loggedIn_? _, strFuncToFailMsg(() => S.?("base_error_not_logged_in")))
+
+  val menuItems =
+  Menu(Loc("profile", List("profile_view", "edit"), S.?("base_profile_menu"), ifIsLoggedIn,
+           Loc.Snippet("editProfile", editProfile))) ::
+  Nil
+
+  def editProfile(in: NodeSeq): NodeSeq = {
+
+    (for (user <- User.currentUser) yield {
+      bind("user", in, "nickname" -> text(user.nickname, {_ =>}, "disabled" -> "true"),
+                       "lastName" -> user.lastName.toForm,
+                       "imageURL" -> user.imageUrl.toForm,
+                       "firstName" -> user.firstName.toForm,
+                       "timezone" -> user.timezone.toForm,
+                       "locale" -> user.locale.toForm,
+                       "save" -> submit("Save", user.save))
+    }).getOrElse(NodeSeq.Empty)
+
+  }
+
+}

Propchange: incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ProfileMgr.scala
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/esme/trunk/server/src/main/webapp/profile_view/edit.html
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/profile_view/edit.html?rev=905218&view=auto
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/profile_view/edit.html (added)
+++ incubator/esme/trunk/server/src/main/webapp/profile_view/edit.html Mon Feb  1 09:28:53 2010
@@ -0,0 +1,15 @@
+<lift:surround with="default" at="content">
+  <lift:editProfile form="post">
+    <table id="profile">
+      <tbody>
+        <tr> <td><lift:loc>ui_sign_up_nickname</lift:loc></td> <td><user:nickname/></td> </tr>
+        <tr> <td><lift:loc>ui_sign_up_firstname</lift:loc></td> <td><user:firstName/></td> </tr>
+        <tr> <td><lift:loc>ui_sign_up_lastname</lift:loc></td> <td><user:lastName/></td> </tr>
+        <tr> <td><lift:loc>ui_sign_up_image_url</lift:loc></td> <td><user:imageURL/></td> </tr>
+        <tr> <td><lift:loc>ui_sign_up_timezone</lift:loc></td> <td><user:timezone/></td> </tr>
+        <tr> <td><lift:loc>ui_sign_up_locale</lift:loc></td> <td><user:locale/></td> </tr>
+        <user:save/>
+      </tbody>
+    </table>
+  </lift:editProfile>
+</lift:surround>

Propchange: incubator/esme/trunk/server/src/main/webapp/profile_view/edit.html
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/esme/trunk/server/src/main/webapp/templates-hidden/default.html
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/templates-hidden/default.html?rev=905218&r1=905217&r2=905218&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/templates-hidden/default.html (original)
+++ incubator/esme/trunk/server/src/main/webapp/templates-hidden/default.html Mon Feb  1 09:28:53 2010
@@ -37,6 +37,9 @@
                         <lift:Menu.item name="streams"/>
                     </li>
                     <li>
+                        <lift:Menu.item name="profile"/>
+                    </li>
+                    <li>
                         <lift:Menu.item name="logout"/>
                     </li>
                 </ul>

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=905218&r1=905217&r2=905218&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 Mon Feb  1 09:28:53 2010
@@ -37,6 +37,9 @@
                         <lift:Menu.item name="streams"/>
                     </li>
                     <li>
+                        <lift:Menu.item name="profile"/>
+                    </li>
+                    <li>
                         <lift:Menu.item name="logout"/>
                     </li>
                 </ul>