Author: taylor
Date: Sat Mar 14 16:00:14 2015
New Revision: 1666699

URL: http://svn.apache.org/r1666699
Log:
JS2-1293: improvements on Fast(Ajax) User Manager: added new profile tab, added 
profile to new user dialog, always display current user in edit dialog, added 
cancel button as additional navigation, tested on responsive decorators and 
made slight improvements to layout (needs more fixes on button padding)

Modified:
    
portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/security/usermanager2.jsp

Modified: 
portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/security/usermanager2.jsp
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/security/usermanager2.jsp?rev=1666699&r1=1666698&r2=1666699&view=diff
==============================================================================
--- 
portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/security/usermanager2.jsp
 (original)
+++ 
portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/security/usermanager2.jsp
 Sat Mar 14 16:00:14 2015
@@ -74,7 +74,7 @@ limitations under the License.
 </div>
 
 <div id="editUserPage" class="hidden-node">
-       <span><a id="actionEditUserBack" href="#">FIND USER</a> | EDIT 
USER</span>
+       <span><a id="actionEditUserBack" href="#">FIND USER</a> | EDIT USER   - 
   </span><span id="userDisplayName">Unset</span>
        <div class="yui-skin-sam">
        <div id="user-properties" class="yui-navset" style="width:665px;">
                <form id="editUserForm">
@@ -85,7 +85,7 @@ limitations under the License.
                        <li class="selected"><a 
href="#tab1"><em>USER</em></a></li>
                        <li><a href="#tab2"><em>ROLES</em></a></li>
                        <li><a href="#tab3"><em>GROUPS</em></a></li>
-
+                       <li><a href="#tab4"><em>PROFILE</em></a></li>
                </ul>            
                <div style="margin-bottom:20px" class="yui-content">
                        <div>
@@ -172,7 +172,7 @@ limitations under the License.
                                        </div>
                                        <div 
style="float:left;margin-left:20px;margin-right:20px;padding-top:3em">
                                                <input id="actionAssignGroups" 
type="button" name="toRight" value="&gt;"/><br />
-                                               <input id="actionRemoveGroups" 
type="button" name="toLeft" value="&lt;" style="margin-top:5px"//>
+                                               <input id="actionRemoveGroups" 
type="button" name="toLeft" value="&lt;" style="margin-top:5px"/>
                                        </div>
                                        <div style="float:left">
                                                <label for="assignedGroups" 
style="">Assigned Groups</label><br/>
@@ -181,6 +181,15 @@ limitations under the License.
                                        </div>
                                </div>
                        </div>
+                       <div>
+                               <div>
+                                       <div 
style="float:left;margin-left:20px">
+                                               <label for="rule">Profiling 
Rule</label><br/>
+                                               <select id="rule" name="rule" >
+                                               </select>
+                                       </div>
+                               </div>
+                       </div>
                </div>
                </form>
        </div>
@@ -188,6 +197,7 @@ limitations under the License.
        <div style="clear:both; width:665px; text-align:right">
                <input id="actionUpdateUser" type="button" value="Update"/>
                <input id="actionDeleteUser" style="margin-right:10px" 
type="button" value="Remove"/>
+               <input id="actionCancelEditUser" type="button" value="Cancel"/>
        </div>
 </div>
 
@@ -239,6 +249,13 @@ limitations under the License.
                                <div 
style="float:left;margin-left:20px;margin-right:20px;width:20em">Email</div>
                                <div 
style="float:left;width:214px;padding-bottom:1em;"> 
                                        <input id="inputUserEmail" 
name="user_email" type="text" style="width:100%"/> 
+                               </div>
+                       </div>
+                       <div style="clear:both">
+                               <div 
style="float:left;margin-left:20px;margin-right:20px;width:20em">Profiling 
Rule</div>
+                               <div 
style="float:left;width:214px;padding-bottom:1em;">
+                                       <select id="newrule" name="newrule" >
+                                       </select>
                                </div><br />
                        </div>
                </div>
@@ -247,6 +264,7 @@ limitations under the License.
        </div>
        <div style="clear:both; width:665px; text-align:right">
                <input id="actionCreateUser" type="button" value="Save"/>
+               <input id="actionCancelNewUser" type="button" value="Cancel"/>
        </div>
 </div>
 
@@ -286,6 +304,11 @@ YUI({combine: true, timeout: 10000}).use
         var node = Y.one('#constraints');
         node.append(getConstraint(constraintUIId));  // added as lastChild
                
node.get('lastChild').one('#actionRemoveConstraint'+constraintUIId).on('click', 
removeConstraint);
+               Y.get('#constraintValue' + constraintUIId).on("keypress",  
function(e) {
+                       if (e.charCode == 13) {
+                               actionFindUser(e);
+                       }
+               });
                constraintUIId++;
     };
     
@@ -346,7 +369,7 @@ YUI({combine: true, timeout: 10000}).use
         var dataOut = null;
 
         try {
-                       Y.log(data);
+                       //Y.log(data);
             dataOut = Y.JSON.parse(data);
             if (!dataOut) {
                 Y.log("Error: no data found.");
@@ -357,6 +380,7 @@ YUI({combine: true, timeout: 10000}).use
             return;
         }
         Y.one('#inputUserName').set('value', dataOut.name);
+        Y.one('#userDisplayName').setContent(dataOut.name);
         Y.one('#inputUserNameHidden').set('value', dataOut.name);
         Y.one('#inputUserNameGiven').set('value', 
dataOut.infoMap["user.name.given"]);
         Y.one('#inputUserNameFamily').set('value', 
dataOut.infoMap["user.name.family"]);
@@ -394,24 +418,25 @@ YUI({combine: true, timeout: 10000}).use
                        assignedGroups.appendChild(new 
Option(dataOut.groups[i], dataOut.groups[i]));
                }
            }
+               var availableRules = Y.one('#rule')
+               availableRules.get('children').remove();
+               if (dataOut.availableRules) {
+                       for (var i=0; i<dataOut.availableRules.length; i++) {
+                               var option = new 
Option(dataOut.availableRules[i], dataOut.availableRules[i]);
+                               if (!Y.Lang.isUndefined(dataOut.rule) && 
dataOut.availableRules[i] === dataOut.rule)
+                                       option.selected = true;
+                               availableRules.appendChild(option);
+                       }
+               }
            userTabView.selectTab(0);
-        
-    }
-    
-       <%--//  go back to the find user dialog from the edit user page  --%>
-    var actionEditUserBack = function(e) {
-       var node = Y.one('#editUserPage');
-       node.toggleClass('hidden-node');
-       var node = Y.one('#searchPage');
-       node.toggleClass('hidden-node');
     }
-    
+
        <%--//  PUT user detail data back to the service for updating  --%>
     var actionUpdateUserDetail = function() {
                var userName = Y.one('#inputUserNameHidden').get('value');
                doSelectAll(Y.one('#assignedRoles'));
                doSelectAll(Y.one('#assignedGroups'));
-               
+
                // add form data to request
                var formObject = document.getElementById('editUserForm');
                <%--// Since we use the PUT method, we have to add the form 
data manually.
@@ -448,8 +473,12 @@ YUI({combine: true, timeout: 10000}).use
        node.toggleClass('hidden-node');
        var node = Y.one('#searchPage');
        node.toggleClass('hidden-node');
+               var node = Y.one('#newUserError');
+               if (!node.hasClass('hidden-node')) {
+                       node.toggleClass('hidden-node');
+               }
        document.getElementById('newUserForm').reset();
-       
+
        }
 
        var actionCreateUser = function(e) {
@@ -488,6 +517,14 @@ YUI({combine: true, timeout: 10000}).use
        node.toggleClass('hidden-node');
        };
 
+       <%--//  go back to the find user dialog from the edit user page  --%>
+       var actionEditUserBack = function(e) {
+               var node = Y.one('#editUserPage');
+               node.toggleClass('hidden-node');
+               var node = Y.one('#searchPage');
+               node.toggleClass('hidden-node');
+       }
+
        var actionDeleteUser = function(e) {
                var userName = Y.one('#inputUserNameHidden').get('value');
                var cObj = YAHOO.util.Connect.asyncRequest('DELETE', 
'${portalContextPrefix}/services/usermanager/users/' + userName + 
'/?_type=json', actionDeleteUserDone);
@@ -522,10 +559,18 @@ YUI({combine: true, timeout: 10000}).use
 
     Y.one('#actionFindUser').on('click', actionFindUser);
 
+       Y.get('#constraintValue0').on("keypress",  function(e) {
+               if (e.charCode == 13) {
+                       actionFindUser(e);
+               }
+       });
+
     Y.one('#actionNewUser').on('click', actionNewUser);
     
     Y.one('#actionCreateUser').on('click', actionCreateUser);
-       
+    Y.one('#actionCancelNewUser').on('click', actionNewUserBack);
+    Y.one('#actionCancelEditUser').on('click', actionEditUserBack);
+
        Y.one('#actionUpdateUser').on('click', actionUpdateUserDetail);
        
     Y.one('#actionNewUserBack').on('click', actionNewUserBack);
@@ -565,7 +610,9 @@ YUI({combine: true, timeout: 10000}).use
                        {key:"lastName"}
                    ],
                        metaFields: {
-                           totalRecords: "totalRecords" // Access to value in 
the server response
+                           totalRecords: "totalRecords", // Access to value in 
the server response
+                                       rules: "availableRules",
+                                       templates: "templates"
                        }
                };
                        var oConfigs = {
@@ -589,6 +636,14 @@ YUI({combine: true, timeout: 10000}).use
                // Update totalRecords on the fly with value from server
                    myDataTable.handleDataReturnPayload = function(oRequest, 
oResponse, oPayload) {
                        oPayload.totalRecords = oResponse.meta.totalRecords;
+                               var availableRules = Y.one('#newrule')
+                               availableRules.get('children').remove();
+                               if (oResponse.meta.rules) {
+                                       for (var i=0; 
i<oResponse.meta.rules.length; i++) {
+                                               var option = new 
Option(oResponse.meta.rules[i], oResponse.meta.rules[i]);
+                                               
availableRules.appendChild(option);
+                                       }
+                               }
                        return oPayload;
                    }
                // Subscribe to events for row selection



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscr...@portals.apache.org
For additional commands, e-mail: jetspeed-dev-h...@portals.apache.org

Reply via email to