Author: husted
Date: Tue Sep 13 14:11:48 2005
New Revision: 280659

URL: http://svn.apache.org/viewcvs?rev=280659&view=rev
Log:
OVR-5
* Change greeting to display user's name, when available.

Modified:
    struts/sandbox/trunk/overdrive/PhoneBook/Core/App.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Core/AppEntry.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Core/AppUserProfile.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx.cs

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/App.cs
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/App.cs?rev=280659&r1=280658&r2=280659&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/App.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/App.cs Tue Sep 13 14:11:48 
2005
@@ -82,6 +82,12 @@
                #region Commands
 
                /// <summary>
+               /// Token for select one command.
+               /// </summary>
+               /// 
+               public const string ENTRY = "entry";
+
+               /// <summary>
                /// Token for select all command.
                /// </summary>
                /// 

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/AppEntry.cs
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/AppEntry.cs?rev=280659&r1=280658&r2=280659&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/AppEntry.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/AppEntry.cs Tue Sep 13 
14:11:48 2005
@@ -23,12 +23,22 @@
        /// 
        public class AppEntry
        {
+
+               private IDictionary _Value = new Hashtable(5);
+
+               public void AddAll(IDictionary sources)
+               {
+                       ICollection keys = sources.Keys;
+                       foreach (string key in keys)
+                       {
+                               Add (key,sources[key] as string);
+                       }
+               }
+               
                public void Add(string key, string value)
                {
                        _Value.Add(key, value);
                }
-
-               private IDictionary _Value = new Hashtable(5);
 
                private string Get(string key)
                {

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/AppUserProfile.cs
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/AppUserProfile.cs?rev=280659&r1=280658&r2=280659&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/AppUserProfile.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/AppUserProfile.cs Tue Sep 13 
14:11:48 2005
@@ -1,4 +1,5 @@
 using System.Security.Principal;
+using System.Text;
 using Nexus.Core.Profile;
 
 namespace PhoneBook.Core
@@ -14,6 +15,33 @@
                {
                        get { return _IsEditor; }
                        set { _IsEditor = value; }
+               }
+
+               private AppEntry _Entry;
+
+               public AppEntry Entry
+               {
+                       get { return _Entry; }
+                       set
+                       {
+                               _Entry = value;
+                               if (_Entry!=null)
+                               {
+                                       StringBuilder sb = new StringBuilder();
+                                       sb.Append(_Entry.first_name);
+                                       sb.Append(" ");
+                                       sb.Append(Entry.last_name);
+                                       FullName = sb.ToString().Trim();
+                               }
+                       }
+               }
+
+               private string _FullName;
+
+               public string FullName
+               {
+                       get { return _FullName; }
+                       set { _FullName = value; }
                }
 
                /// <summary>

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx.cs
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx.cs?rev=280659&r1=280658&r2=280659&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx.cs 
(original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx.cs Tue 
Sep 13 14:11:48 2005
@@ -56,7 +56,7 @@
                        AppUserProfile profile = new AppUserProfile(id);
                        Session[UserProfile.USER_PROFILE] = profile;
 
-                       IViewHelper helper = 
Catalog.GetHelperFor(App.ENTRY_LIST);
+                       IViewHelper helper = Catalog.GetHelperFor(App.ENTRY);
                        helper.Criteria[App.USER_NAME] = profile.UserId;
                        helper.Execute();
                        if (helper.IsNominal)
@@ -65,8 +65,13 @@
                                // ISSUE: Need constant for "1" (true)
                                bool isEditor = ((editor != null) && 
(editor.Equals("1")));
                                profile.IsEditor = isEditor;
+                               if (editor!=null)
+                               {
+                                       AppEntry entry = new AppEntry();
+                                       entry.AddAll(helper.Criteria);
+                                       profile.Entry = entry;
+                               }
                        }
-
                        return profile;
                }
 
@@ -155,7 +160,11 @@
                        if (!IsPostBack)
                        {
                                Page_Prompt = GetMessage(App.DIRECTORY_PROMPT);
-                               profile_label.Text = Profile.UserId;
+                               string name = Profile.FullName;
+                               if (name==null)                 
+                                       profile_label.Text = Profile.UserId;    
                                
+                               else 
+                                       profile_label.Text = name;
                                // UserLocale = Profile.Locale;
                                finder.Open();
                        }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to