[Carbon-dev] svn commit r30619 - in trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web: role user userstore

dimuthul at wso2.com dimuthul at wso2.com
Mon Feb 9 20:55:34 PST 2009


Author: dimuthul
Date: Mon Feb  9 20:55:34 2009
New Revision: 30619
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=30619

Log:
Cleaning up. And sending error messages correctly to the error.jsp



Modified:
   trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/add-step1.jsp
   trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/add-step2.jsp
   trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/add-step3.jsp
   trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/user/add-step2.jsp
   trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/config-edit.jsp
   trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/config-mgt.jsp
   trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/ex-role-mgt.jsp
   trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/ex-user-mgt.jsp

Modified: trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/add-step1.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/add-step1.jsp?rev=30619&r1=30618&r2=30619&view=diff
==============================================================================
--- trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/add-step1.jsp	(original)
+++ trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/add-step1.jsp	Mon Feb  9 20:55:34 2009
@@ -11,37 +11,9 @@
 <script type="text/javascript" src="../userstore/extensions/js/vui.js"></script>
 <script type="text/javascript" src="../admin/js/main.js"></script>
 <jsp:include page="../dialog/dialog_header.jsp"/>
-<jsp:include page="../dialog/display_messages.jsp"/>
 
 <jsp:useBean id="roleBean" type="org.wso2.carbon.user.ui.client.RoleBean" class="org.wso2.carbon.user.ui.client.RoleBean" scope="session"/>
 
-    <%
-        String[] names = null;
-        String userType = (String) request.getParameter("userType");
-        if(userType != null){
-            session.setAttribute("org.wso2.carbon.user.userType", userType);
-        }
-        try {
-            String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
-            String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
-            ConfigurationContext configContext =
-                    (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
-            UserMgtClient client = new UserMgtClient(cookie, backendServerURL, configContext);
-            if ("external".equals(userType)) {
-                names = client.getExternalUsers();
-            } else {
-                names = client.getInternalUsers();
-            }
-        } catch (Exception e) {
-            CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
-            session.setAttribute(CarbonUIMessage.ID, uiMsg);
-%>
-            <jsp:include page="../admin/error.jsp"/>
-<%
-            return;
-        }
-    %>
-    
 <fmt:bundle basename="org.wso2.carbon.userstore.ui.i18n.Resources">
     <carbon:breadcrumb label="add.user.role"
                        resourceBundle="org.wso2.carbon.userstore.ui.i18n.Resources"

Modified: trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/add-step2.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/add-step2.jsp?rev=30619&r1=30618&r2=30619&view=diff
==============================================================================
--- trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/add-step2.jsp	(original)
+++ trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/add-step2.jsp	Mon Feb  9 20:55:34 2009
@@ -15,7 +15,44 @@
 <script type="text/javascript" src="../userstore/extensions/js/vui.js"></script>
 <script type="text/javascript" src="../admin/js/main.js"></script>
 <jsp:include page="../dialog/dialog_header.jsp"/>
-<jsp:include page="../dialog/display_messages.jsp"/>
+
+<%
+       String[] datas = null;
+       String[] selected = null;
+    
+       String filter = (String)request.getParameter("org.wso2.usermgt.role.add.filter");
+       if(filter == null){
+          filter = "*";
+       }else{
+          filter = filter.trim();
+       }
+       
+        String userType = (String)session.getAttribute("org.wso2.carbon.user.userType");
+        try {
+            String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+            String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+            ConfigurationContext configContext =
+                    (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+            UserMgtClient client = new UserMgtClient(cookie, backendServerURL, configContext);
+            if(filter.length() > 0){
+                if ("external".equals(userType)) {
+                    datas = client.listExternalUsers(filter);
+                }else{
+                    System.out.println();
+                    datas = client.listInternalUsers(filter);
+                }
+            }
+            selected = roleBean.getSelectedUsers();
+        } catch (Exception e) {
+            CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
+            session.setAttribute(CarbonUIMessage.ID, uiMsg);
+%>
+            <jsp:include page="../admin/error.jsp"/>
+<%
+            return;
+        }
+    %>
+    
 <fmt:bundle basename="org.wso2.carbon.userstore.ui.i18n.Resources">
     <carbon:breadcrumb label="add.users"
                        resourceBundle="org.wso2.carbon.userstore.ui.i18n.Resources"
@@ -50,42 +87,7 @@
         }
     </script>
 
-    <%
-       String[] datas = null;
-       String[] selected = null;
-    
-	   String filter = (String)request.getParameter("org.wso2.usermgt.role.add.filter");
-	   if(filter == null){
-	      filter = "*";
-	   }else{
-	      filter = filter.trim();
-	   }
-       
-        String userType = (String)session.getAttribute("org.wso2.carbon.user.userType");
-        try {
-            String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
-            String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
-            ConfigurationContext configContext =
-                    (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
-            UserMgtClient client = new UserMgtClient(cookie, backendServerURL, configContext);
-            if(filter.length() > 0){
-        	    if ("external".equals(userType)) {
-        		    datas = client.listExternalUsers(filter);
-        		}else{
-        		    System.out.println();
-        		    datas = client.listInternalUsers(filter);
-        		}
-            }
-            selected = roleBean.getSelectedUsers();
-        } catch (Exception e) {
-            CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
-            session.setAttribute(CarbonUIMessage.ID, uiMsg);
-%>
-            <jsp:include page="../admin/error.jsp"/>
-<%
-            return;
-        }
-    %>
+   
 
     <div id="middle">
         <h2><fmt:message key="add.user.role"/></h2>

Modified: trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/add-step3.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/add-step3.jsp?rev=30619&r1=30618&r2=30619&view=diff
==============================================================================
--- trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/add-step3.jsp	(original)
+++ trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/add-step3.jsp	Mon Feb  9 20:55:34 2009
@@ -8,6 +8,7 @@
 <%@page import="org.wso2.carbon.CarbonError" %>
 <%@page import="java.util.List"%>
 <%@page import="java.util.Arrays"%>
+<%@page import="org.wso2.carbon.ui.CarbonUIMessage"%>
 <jsp:useBean id="roleBean" type="org.wso2.carbon.user.ui.client.RoleBean" scope="session"/>
 <jsp:setProperty name="roleBean" property="*" />
 
@@ -42,9 +43,10 @@
         }
     </script>
 
-    <%!String[] datas = null; %>
-    <%!String[] selected = null; %>
     <%
+        String[] datas = null;
+        String[] selected = null;
+    
         try {
             String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
             String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
@@ -55,12 +57,12 @@
             datas = client.getSystemPermissions();
             selected = roleBean.getSelectedPermissions();
         } catch (Exception e) {
-            CarbonError error = new CarbonError();
-            error.addError(e.getMessage());
-            request.setAttribute(CarbonError.ID, error);
+            CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
+            session.setAttribute(CarbonUIMessage.ID, uiMsg);
     %>
-    <jsp:forward page="../admin/error.jsp"/>
+            <jsp:include page="../admin/error.jsp"/>
     <%
+            return;
         }
     %>
 

Modified: trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/user/add-step2.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/user/add-step2.jsp?rev=30619&r1=30618&r2=30619&view=diff
==============================================================================
--- trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/user/add-step2.jsp	(original)
+++ trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/user/add-step2.jsp	Mon Feb  9 20:55:34 2009
@@ -6,6 +6,7 @@
 <%@page import="org.apache.axis2.context.ConfigurationContext" %>
 <%@page import="org.wso2.carbon.CarbonConstants" %>
 <%@page import="org.wso2.carbon.CarbonError" %>
+<%@page import="org.wso2.carbon.ui.CarbonUIMessage"%>
 <script type="text/javascript" src="../userstore/extensions/js/vui.js"></script>
 <script type="text/javascript" src="../admin/js/main.js"></script>
 <jsp:include page="../dialog/dialog_header.jsp"/>
@@ -42,7 +43,7 @@
         
     </script>        
         
-        <%
+    <%
         String[] groupData = new String[0];
         try{
 
@@ -53,16 +54,14 @@
             UserMgtClient client = new UserMgtClient(cookie, backendServerURL, configContext);
             groupData = client.getInternalRoles();
         }catch(Exception e){
-            CarbonError error = new CarbonError();
-            error.addError(e.getMessage());
-            request.getSession().setAttribute(CarbonError.ID, error);
-        %>
-
-        location.href = '../admin/error.jsp';
-
-        <%
+            CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
+            session.setAttribute(CarbonUIMessage.ID, uiMsg);
+   %>
+            <jsp:include page="../admin/error.jsp"/>
+   <%
+            return;
             }
-        %>
+   %>
 
     <div id="middle">
         <h2><fmt:message key="add.user"/></h2>

Modified: trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/config-edit.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/config-edit.jsp?rev=30619&r1=30618&r2=30619&view=diff
==============================================================================
--- trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/config-edit.jsp	(original)
+++ trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/config-edit.jsp	Mon Feb  9 20:55:34 2009
@@ -7,11 +7,34 @@
 <%@page import="org.wso2.carbon.CarbonConstants" %>
 <%@page import="java.util.Map"%>
 <%@page import="org.wso2.carbon.CarbonError"%>
+<%@page import="org.wso2.carbon.ui.CarbonUIMessage"%>
 <script type="text/javascript" src="extensions/js/vui.js"></script>
 <script type="text/javascript" src="../admin/js/main.js"></script>
 <jsp:include page="../dialog/dialog_header.jsp"/>
 <jsp:include page="../dialog/display_messages.jsp"/>
 
+    <%
+        Map<String, String> datas = null;
+        String type = null;
+	    try {
+	        String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+	        String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(),
+	                session);
+	        ConfigurationContext configContext = (ConfigurationContext) config
+	                .getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+	        UserMgtClient client = new UserMgtClient(cookie, backendServerURL, configContext);
+	
+	        datas = client.getExternalUserStoreConfig();
+	        type = datas.get("RealmType");
+	    } catch (Exception e) {
+	        CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
+	        session.setAttribute(CarbonUIMessage.ID, uiMsg);
+	%>
+	        <jsp:include page="../admin/error.jsp"/>
+	<%
+	        return;
+        }
+    %>
 <fmt:bundle basename="org.wso2.carbon.userstore.ui.i18n.Resources">
 <carbon:breadcrumb label="edit.external.store.configuration"
 		resourceBundle="org.wso2.carbon.userstore.ui.i18n.Resources"
@@ -159,28 +182,7 @@
 
 
     </script>
-    <%!Map<String, String> datas = null;%>
-    <%!String type = null;%>
-    <%
-                try {
-                    String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
-                    String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(),
-                            session);
-                    ConfigurationContext configContext = (ConfigurationContext) config
-                            .getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
-                    UserMgtClient client = new UserMgtClient(cookie, backendServerURL, configContext);
-
-                    datas = client.getExternalUserStoreConfig();
-                    type = datas.get("RealmType");
-                } catch (Exception e) {
-                    CarbonError error = new CarbonError();
-                    error.addError(e.getMessage());
-                    request.setAttribute(CarbonError.ID, error);
-    %>
-    <jsp:forward page="../admin/error.jsp"/>
-    <%
-    }
-    %>
+    
     <div id="middle">
         <h2><fmt:message key="external.user.store.configuration"/></h2>
 

Modified: trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/config-mgt.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/config-mgt.jsp?rev=30619&r1=30618&r2=30619&view=diff
==============================================================================
--- trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/config-mgt.jsp	(original)
+++ trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/config-mgt.jsp	Mon Feb  9 20:55:34 2009
@@ -10,11 +10,11 @@
 <%@page import="java.util.Map"%>
 <%@page import="java.util.Iterator"%>
 <%@page import="org.wso2.carbon.CarbonError"%>
+<%@page import="org.wso2.carbon.ui.CarbonUIMessage"%>
 <script type="text/javascript" src="extensions/js/vui.js"></script>
 <script type="text/javascript" src="../admin/js/main.js"></script>
 
 <jsp:include page="../dialog/dialog_header.jsp"/>
-<jsp:include page="../dialog/display_messages.jsp"/>
 
 
     <script type="text/javascript">
@@ -32,10 +32,9 @@
         }
     </script>
 
-    <%!Map<String, String> datas = null;%>
-    <%!String type = null; %>
     <%
-
+        Map<String, String> datas = null;
+        String type = null;
         try {
             String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
             String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
@@ -46,12 +45,13 @@
             datas = client.getExternalUserStoreConfig();
             type = datas.get("RealmType");
         } catch (Exception e) {
-            CarbonError error = new CarbonError();
-            error.addError(e.getMessage());
-            request.setAttribute(CarbonError.ID, error);
+            CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
+            session.setAttribute(CarbonUIMessage.ID, uiMsg);
     %>
-    <jsp:forward page="../admin/error.jsp"/>
+            <jsp:include page="../admin/error.jsp"/>
     <%
+            return;
+        
         }
     %>
     

Modified: trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/ex-role-mgt.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/ex-role-mgt.jsp?rev=30619&r1=30618&r2=30619&view=diff
==============================================================================
--- trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/ex-role-mgt.jsp	(original)
+++ trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/ex-role-mgt.jsp	Mon Feb  9 20:55:34 2009
@@ -28,12 +28,11 @@
                 datas = client.getExternalGroups();
                 internalDatas = client.getSpecialInternalRoles();
             } catch (Exception e) {
-                CarbonUIMessage.sendCarbonUIMessage(e.getMessage(), CarbonUIMessage.ERROR, request, e);
-                    %>
-                            <script type="text/javascript">
-                                   location.href = "../admin/error.jsp";
-                            </script>
-                    <%
+                CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
+                session.setAttribute(CarbonUIMessage.ID, uiMsg);
+        %>
+                <jsp:include page="../admin/error.jsp"/>
+        <%
                 return;
             }
         %>

Modified: trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/ex-user-mgt.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/ex-user-mgt.jsp?rev=30619&r1=30618&r2=30619&view=diff
==============================================================================
--- trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/ex-user-mgt.jsp	(original)
+++ trunk/carbon-components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/ex-user-mgt.jsp	Mon Feb  9 20:55:34 2009
@@ -40,12 +40,11 @@
             datas = client.listExternalUsers(filter);
         }
     } catch (Exception e) {
-	   CarbonUIMessage.sendCarbonUIMessage(e.getMessage(), CarbonUIMessage.ERROR, request, e);
-        %>
-                <script type="text/javascript">
-                       location.href = "../admin/error.jsp";
-                </script>
-        <%
+        CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
+        session.setAttribute(CarbonUIMessage.ID, uiMsg);
+%>
+        <jsp:include page="../admin/error.jsp"/>
+<%
         return;
     }
       %>



More information about the Carbon-dev mailing list