[Registry-dev] svn commit r17757 - in
branches/registry/1_1/modules/webapps/src/main:
java/org/wso2/registry/web webapp/admin webapp/admin/ajax
webapp/admin/js
chanaka at wso2.com
chanaka at wso2.com
Mon Jun 2 01:43:31 PDT 2008
Author: chanaka
Date: Mon Jun 2 01:43:31 2008
New Revision: 17757
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=17757
Log:
patch applied from trunk with some UI fixes
Modified:
branches/registry/1_1/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
branches/registry/1_1/modules/webapps/src/main/webapp/admin/ajax/association-list.jsp
branches/registry/1_1/modules/webapps/src/main/webapp/admin/js/common.js
branches/registry/1_1/modules/webapps/src/main/webapp/admin/registry-resources.jsp
Modified: branches/registry/1_1/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
URL: http://wso2.org/svn/browse/wso2/branches/registry/1_1/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java?rev=17757&r1=17756&r2=17757&view=diff
==============================================================================
--- branches/registry/1_1/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java (original)
+++ branches/registry/1_1/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java Mon Jun 2 01:43:31 2008
@@ -125,11 +125,11 @@
response.sendRedirect("/wso2registry/web");
//forwardToResources(request, response, path);
- }else if (command.equals("/activity")) {
+ } else if (command.equals("/activity")) {
forwardToActivity(request, response);
- }else if (command.equals("/addUser")) {
+ } else if (command.equals("/addUser")) {
AddUserAction addUserAction = new AddUserAction();
addUserAction.setNewUserName(request.getParameter("newUserName"));
@@ -249,7 +249,7 @@
forwardToResources(request, response, path);
}
- } else if(command.equals("/copyResource")){
+ } else if (command.equals("/copyResource")) {
try {
ResourcesUtil.copyResource(request, response);
} catch (Exception e) {
@@ -257,7 +257,7 @@
setErrorMessage(request, e.getMessage());
forwardToResources(request, response, path);
}
- } else if(command.equals("/moveResource")){
+ } else if (command.equals("/moveResource")) {
try {
ResourcesUtil.moveResource(request, response);
} catch (Exception e) {
@@ -285,8 +285,7 @@
forwardToResources(request, response, path);
}
- }
- else if (command.equals("/addAspect")) {
+ } else if (command.equals("/addAspect")) {
try {
LifecycleUtil.addAspect(request, response);
@@ -295,11 +294,10 @@
setErrorMessage(request, e.getMessage());
forwardToResources(request, response, path);
}
- }
- else if (command.equals("/saveFriendlyName")) {
+ } else if (command.equals("/saveFriendlyName")) {
try {
- UserUtil.updateFriendlyName(request,response);
+ UserUtil.updateFriendlyName(request, response);
} catch (Exception e) {
// todo: implement a general AJAX error segment
setErrorMessage(request, e.getMessage());
@@ -309,24 +307,34 @@
} else if (command.equals("/saveNewPassword")) {
try {
- UserUtil.updatePassword(request,response);
+ UserUtil.updatePassword(request, response);
} catch (Exception e) {
// todo: implement a general AJAX error segment
setErrorMessage(request, e.getMessage());
forwardToResources(request, response, path);
}
- }else if (command.equals("/setProperty")) {
+ } else if (command.equals("/setProperty")) {
PropertiesUtil.setProperty(request, response);
+ } else if (command.equals("/updateProperties")) {
+
+ try {
+ request.getSession().setAttribute("resourcePath", path);
+ request.getRequestDispatcher(UIConstants.AJAX_PROPERTIES_JSP).forward(request, response);
+ } catch (ServletException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
} else if (command.equals("/updateProperty")) {
PropertiesUtil.updateProperty(request, response);
- } else if(command.equals("/addAssociation")) {
+ } else if (command.equals("/addAssociation")) {
try {
- AssociationUtil.addAssociation(request,response);
+ AssociationUtil.addAssociation(request, response);
} catch (Exception e) {
// todo: implement a general AJAX error segment
setErrorMessage(request, e.getMessage());
@@ -343,10 +351,7 @@
setErrorMessage(request, e.getMessage());
}
forwardToResources(request, response, path);
- }
-
-
- else if (command.equals("/removeProperty")) {
+ } else if (command.equals("/removeProperty")) {
PropertiesUtil.removeProperty(request, response);
@@ -498,7 +503,7 @@
// path = path + "?" + qPart;
//}
- VersionsBean versionsBean ;
+ VersionsBean versionsBean;
try {
versionsBean = ResourcesUtil.getVersions(request, path);
} catch (RegistryException e) {
@@ -579,9 +584,9 @@
response.sendRedirect("/wso2registry/web");
//forwardToResources(request, response, path);
- } else if (command.equals("/associationTree")) {
+ } else if (command.equals("/associationTree")) {
- forwardToAssociation(request, response,path);
+ forwardToAssociation(request, response, path);
} else if (command.equals("/admin")) {
@@ -605,10 +610,9 @@
forwardToUserPage(request, response, userName);
- }else if(command.equals("/about")){
+ } else if (command.equals("/about")) {
request.getRequestDispatcher(UIConstants.ABOUT_JSP).forward(request, response);
- }
- else if (command.equals("/removeUserFromRole")) {
+ } else if (command.equals("/removeUserFromRole")) {
RemoveUserRoleAction removeUserRoleAction = new RemoveUserRoleAction();
removeUserRoleAction.setUserName(request.getParameter("user"));
@@ -624,9 +628,7 @@
response.sendRedirect("/wso2registry/system/people/" + request.getParameter("user"));
//forwardToUserPage(request, response, request.getParameter("user"));
- }
-
- else if (command.equals("/removeUserFromRole")) {
+ } else if (command.equals("/removeUserFromRole")) {
RemoveUserRoleAction removeUserRoleAction = new RemoveUserRoleAction();
removeUserRoleAction.setUserName(request.getParameter("user"));
@@ -672,10 +674,10 @@
response.sendRedirect("/wso2registry/system/people");
//forwardToUserManagement(request, response);
- } else if(command.equals("/resourceTree")){
- forwardToResourceTree(request,response,path);
+ } else if (command.equals("/resourceTree")) {
+ forwardToResourceTree(request, response, path);
- }else if (command.equals("/search")) {
+ } else if (command.equals("/search")) {
forwardToSearch(request, response);
@@ -750,7 +752,7 @@
} else if (command.equals("/getResourceMediaTypes")) {
- String mediaTypes ;
+ String mediaTypes;
try {
mediaTypes = MediaTypesReader.getResourceMediaTypeMappings(request);
} catch (RegistryException e) {
@@ -902,7 +904,7 @@
return;
- } catch(RegistryException re) {
+ } catch (RegistryException re) {
setErrorMessage(request, re.getMessage());
re.printStackTrace();
@@ -943,7 +945,8 @@
e.printStackTrace();
}
}
- private void forwardToAssociation(HttpServletRequest request, HttpServletResponse response,String path) {
+
+ private void forwardToAssociation(HttpServletRequest request, HttpServletResponse response, String path) {
try {
@@ -970,11 +973,12 @@
e.printStackTrace();
}
}
- private void forwardToResourceTree(HttpServletRequest request, HttpServletResponse response,String path) {
+
+ private void forwardToResourceTree(HttpServletRequest request, HttpServletResponse response, String path) {
try {
- String textBoxId= request.getParameter("textBoxId");
+ String textBoxId = request.getParameter("textBoxId");
ResourceDetailsAction details = new ResourceDetailsAction();
details.setPath(path);
details.execute(request);
@@ -992,7 +996,7 @@
request.getSession().setAttribute(UIConstants.RESOURCE_BEAN, details);
request.getSession().setAttribute(UIConstants.COLLECTION_BEAN, collection);
- request.getSession().setAttribute(UIConstants.RESOURCE_TREE_BEAN,showResourceTreeAction);
+ request.getSession().setAttribute(UIConstants.RESOURCE_TREE_BEAN, showResourceTreeAction);
} catch (Exception e) {
setErrorMessage(request, e.getMessage());
@@ -1011,6 +1015,7 @@
e.printStackTrace();
}
}
+
private void forwardToAdmin(HttpServletRequest request, HttpServletResponse response) {
AdminBean adminBean = AdminUtil.getAdminBean(request);
@@ -1185,7 +1190,8 @@
private void setErrorMessage(HttpServletRequest request, String message) {
request.getSession().setAttribute(UIConstants.ERROR_MESSAGE, message);
}
- private void setSuccessMessage(HttpServletRequest request, String message) {
+
+ private void setSuccessMessage(HttpServletRequest request, String message) {
request.getSession().setAttribute(UIConstants.SUCCESS_MESSAGE, message);
}
}
Modified: branches/registry/1_1/modules/webapps/src/main/webapp/admin/ajax/association-list.jsp
URL: http://wso2.org/svn/browse/wso2/branches/registry/1_1/modules/webapps/src/main/webapp/admin/ajax/association-list.jsp?rev=17757&r1=17756&r2=17757&view=diff
==============================================================================
--- branches/registry/1_1/modules/webapps/src/main/webapp/admin/ajax/association-list.jsp (original)
+++ branches/registry/1_1/modules/webapps/src/main/webapp/admin/ajax/association-list.jsp Mon Jun 2 01:43:31 2008
@@ -11,65 +11,98 @@
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%
+<% String type = (String) request.getSession().getAttribute("type");
ResourceDetailsAction details = (ResourceDetailsAction) request.getSession().getAttribute(UIConstants.RESOURCE_BEAN);
List depList = details.getAssociations();
+ Iterator forCount = depList.iterator();
Iterator deps = depList.iterator();
- Iterator depsDependencies = depList.iterator();
- boolean othersFound=false;
- boolean firstDepFound=false;
- while (deps.hasNext()) {
- Association association = (Association) deps.next();
- if (association.getSourcePath().equals(details.getPath()) && association.getAssociationType().equals("Dependency")) {
- if(firstDepFound==false){
-%>
-<h3 style="margin-top:10px;">Dependencies</h3>
-<%
- firstDepFound=true;
+ Iterator asso = depList.iterator();
+
+ boolean hasAssociations = false;
+ boolean hasDependencies = false;
+ while (forCount.hasNext()) {
+ Association association = (Association) forCount.next();
+ if (association.getSourcePath().equals(details.getPath()) && association.getAssociationType().equals("dependency"))
+ hasDependencies = true;
+ if (association.getSourcePath().equals(details.getPath()) && !association.getAssociationType().equals("dependency"))
+ hasAssociations = true;
}
+ if (hasDependencies == true && type.equals("dep")) {
%>
-<div style="height:20px;padding-left:5px;border-bottom:solid 1px #cccccc;">
- <% String destPath = association.getDestinationPath();
- String destLink = destPath;
- if (!destPath.startsWith("http://")) {
- destLink = "/wso2registry/web" + destPath;
- }
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%" class="data-table">
+ <tr>
+ <th>
+ Dependency Path
+ </th>
+ <th>
+
+ </th>
+ </tr>
+ <%
+
+ while (deps.hasNext()) {
+ Association association = (Association) deps.next();
+ if (association.getSourcePath().equals(details.getPath()) && association.getAssociationType().equals("dependency")) {
+
%>
- <a href="<%=destLink%>"><%=destPath%>
- </a>
-</div>
-<%
+
+ <tr>
+ <td>
+ <% String destPath = association.getDestinationPath();
+ String destLink = destPath;
+ if (!destPath.startsWith("http://")) {
+ destLink = "/wso2registry/web" + destPath;
+ }
+ %>
+ <a href="<%=destLink%>"><%=destPath%>
+ </a>
+ </td>
+ <td>
+
+ </td>
+ </tr>
+ <%
+ }
}
- if(!association.getAssociationType().equals("Dependency")) othersFound = true;
- }
- //All the other associations
+
+ %>
+</table>
+
+<div class="assoLink"><a href="/wso2registry/system/associationTree" title="Association Tree"><img align="middle"
+ src="/wso2registry/admin/images/icon-associationTree.jpg"
+ alt="Association Tree"
+ border="0"
+ width="30"/>Dependency
+ Tree</a></div>
+<% }
+
+
+/// Display associations
- if (!depList.isEmpty() && othersFound==true) {
+
+ if (hasAssociations == true && type.equals("asso")) {
%>
-<h3 style="margin-top:10px;">Associations</h3>
<table cellpadding="0" cellspacing="0" border="0" style="width:100%" class="data-table">
<tr>
<th>
- Association Type
+ Path
</th>
<th>
- Association Path
+ Type
</th>
</tr>
<%
- }
- while (depsDependencies.hasNext()) {
- Association association = (Association) depsDependencies.next();
- if (association.getSourcePath().equals(details.getPath()) && !association.getAssociationType().equals("Dependency")) {
+ while (asso.hasNext()) {
+ Association association = (Association) asso.next();
+ if (association.getSourcePath().equals(details.getPath()) && !association.getAssociationType().equals("dependency")) {
+
%>
+
<tr>
<td>
- <%=association.getAssociationType()%>
- </td>
- <td>
<% String destPath = association.getDestinationPath();
String destLink = destPath;
if (!destPath.startsWith("http://")) {
@@ -79,16 +112,22 @@
<a href="<%=destLink%>"><%=destPath%>
</a>
</td>
+ <td>
+ <%=association.getAssociationType()%>
+ </td>
</tr>
<%
}
}
+
+
%>
- <% if (!depList.isEmpty() && othersFound==true) { %>
</table>
-<div class="assoLink"><a href="/wso2registry/system/associationTree" title="Association Tree" ><img align="middle"
+
+<div class="assoLink"><a href="/wso2registry/system/associationTree" title="Association Tree"><img align="middle"
src="/wso2registry/admin/images/icon-associationTree.jpg"
alt="Association Tree"
- border="0" width="30" />Association
+ border="0"
+ width="30"/>Association
Tree</a></div>
<% } %>
Modified: branches/registry/1_1/modules/webapps/src/main/webapp/admin/js/common.js
URL: http://wso2.org/svn/browse/wso2/branches/registry/1_1/modules/webapps/src/main/webapp/admin/js/common.js?rev=17757&r1=17756&r2=17757&view=diff
==============================================================================
--- branches/registry/1_1/modules/webapps/src/main/webapp/admin/js/common.js (original)
+++ branches/registry/1_1/modules/webapps/src/main/webapp/admin/js/common.js Mon Jun 2 01:43:31 2008
@@ -215,6 +215,7 @@
var aspect =aspectElement.options[aspectElement.selectedIndex].value;
new Ajax.Updater('aspectList', '/wso2registry/system/addAspect', { method: 'post', parameters: {aspect: aspect, resourcePath: resourcePath} });
+ new Ajax.Updater('resourceProperties','/wso2registry/system/updateProperties',{method:'post'});
}
function showHideCommon(divxName){
divx=document.getElementById(divxName);
@@ -472,29 +473,32 @@
new Ajax.Updater('resourceProperties', '/wso2registry/system/removeProperty', { method: 'post', parameters: {resourcePath: resourcePath, propertyName: propertyName} });
}
-function addAssociation(){
-var reasonDiv=$('associationReason');
+function addAssociation(mainType){
+ var typeForm= document.forms[mainType];
+ var reasonDiv=$('associationReason');
var reason="";
- reason +=validateForInput($('type'),"Name");
- reason +=validateEmpty($('type'),"Name");
- reason +=validateForInput($('associationPaths'),"Association Type:");
- reason +=validateEmpty($('associationPaths'),"Association Path:");
+ if(mainType!="depForm"){
+ reason +=validateForInput(typeForm.type,"Name");
+ reason +=validateEmpty(typeForm.type,"Name");
+ }
+ reason +=validateForInput(typeForm.associationPaths,"Association Type:");
+ reason +=validateEmpty(typeForm.associationPaths,"Association Path:");
reasonDiv.innerHTML=reason;
if(reason=="") {
var resourcePath = $('resourcePath').value;
- var type = $('type').value;
- var associationPaths = $('associationPaths').value;
- $('type').value="";
- $('associationPaths').value="";
+ var type = typeForm.type.value;
+ var associationPaths = typeForm.associationPaths.value;
+ typeForm.type.value="";
+ typeForm.associationPaths.value="";
showHideCommon('dependenciesAddDiv');
new Ajax.Updater('associationDiv','/wso2registry/system/addAssociation', {method:'post',parameters:{resourcePath:resourcePath,type:type,associationPaths:associationPaths}}) ;
}
else{
reasonDiv.innerHTML = reason;
reasonDiv.style.display = "block";
- cleanField($('type'));
- cleanField($('associationPaths'));
+ cleanField(typeForm.type);
+ cleanField(typeForm.associationPaths);
}
}
@@ -893,6 +897,7 @@
else {
new Ajax.Updater('activityList', '/wso2registry/system/activity', { method: 'post', parameters: {fromDate: fromDateValue, toDate: toDateValue, userName:userNameValue,path:pathValue,filter:filter,page:page} });
+ new Ajax.Updater('resourceProperties','/wso2registry/system/updateProperties',{method:'post'});
//document.forms["activityForm"].submit();
}
}
@@ -1025,16 +1030,3 @@
}
}
-function fillTypeBox(){
- var assoList = document.getElementById('typeDropDown');
- var type = $('type');
- var selectedItem= assoList.options[assoList.selectedIndex].value;
- if(selectedItem=="--Other Type--"){
- type.removeAttribute('disabled') ;
- type.value="";
- }
- else{
- type.value=selectedItem;
- type.setAttribute('disabled','disabled');
- }
-}
\ No newline at end of file
Modified: branches/registry/1_1/modules/webapps/src/main/webapp/admin/registry-resources.jsp
URL: http://wso2.org/svn/browse/wso2/branches/registry/1_1/modules/webapps/src/main/webapp/admin/registry-resources.jsp?rev=17757&r1=17756&r2=17757&view=diff
==============================================================================
--- branches/registry/1_1/modules/webapps/src/main/webapp/admin/registry-resources.jsp (original)
+++ branches/registry/1_1/modules/webapps/src/main/webapp/admin/registry-resources.jsp Mon Jun 2 01:43:31 2008
@@ -515,7 +515,7 @@
<td>
<input id="resourceFile" type="file" name="upload" onchange="fillResourceDetails()"/>
- <div class="helpText" id="fileHelpText">Give the url of a file to fetch content (xml,wsdl,jar
+ <div class="helpText" id="fileHelpText">Give the path of a file to fetch content (xml,wsdl,jar
etc..)
</div>
</td>
@@ -1241,19 +1241,18 @@
<!-- END lifecycle listing box -->
</div>
-
<!-- Start dependencies div -->
<div class="box1-head">
<table cellspacing="0" cellpadding="0" border="0" style="width:100%">
<tr>
- <td valign="top"><h2 class="sub-headding-dependencies">Associations</h2></td>
+ <td valign="top"><h2 class="sub-headding-dependencies">dependencies</h2></td>
<td align="right" valign="top">
<table cellpadding="0" cellspacing="0" border="0" class="toolBarTable">
<tr>
<td>
<% if (details.isLoggedIn() && !details.isVersionView()) { %><a
- onclick="showHideCommon('dependenciesAddDiv');expandIfNot('dependencies');$('type').focus();fillTypeBox();"><img
+ onclick="showHideCommon('dependenciesAddDiv');expandIfNot('dependencies');$('depPaths').focus();"><img
src="/wso2registry/admin/images/universal-add.gif" border="0" valign="top"
title="Assign New Dependencies"/></a><% } %>
</td>
@@ -1276,19 +1275,84 @@
</div>
<div class="box2-mid" id="dependenciesExpanded">
- <div id="associationReason" class="validationError" style="display: none;"></div>
+ <div id="dependenciesReason" class="validationError" style="display: none;"></div>
<div id="dependenciesAddDiv" style="display:none;">
- <form onsubmit="return addAssociation();">
+ <form onsubmit="return addAssociation();" name="depForm">
+ <input type="hidden" name="resourcePath" value="<%=details.getPath()%>"/>
+ <input type="hidden" name="type" value="dependency"/>
+ <table cellpadding="0" cellspacing="0" border="0" class="simple-data-table">
+
+ <tr>
+ <th valign="top">Path:<span class="required">*</span></th>
+ <td><input type="text" name="associationPaths" id="depPaths" /> <input type="button"
+ value=".."
+ onclick="showResourceTree('depPaths');showHideCommon('resourceTree')"/>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td><input type="button" class="button" value="Add"
+ onclick="addAssociation('depForm');"/></td>
+ </tr>
+ </table>
+
+ </form>
+ </div>
+ <% request.getSession().setAttribute("type","dep"); %>
+ <div id="dependenciesDiv">
+ <jsp:include page="ajax/association-list.jsp"/>
+ </div>
+
+</div>
+
+<!-- ------------------------------------------------- -->
+
+<!-- End dependencies div -->
+
+
+<!-- Start association div -->
+<div class="box1-head">
+ <table cellspacing="0" cellpadding="0" border="0" style="width:100%">
+ <tr>
+
+ <td valign="top"><h2 class="sub-headding-associations">Associations</h2></td>
+ <td align="right" valign="top">
+ <table cellpadding="0" cellspacing="0" border="0" class="toolBarTable">
+ <tr>
+ <td>
+ <% if (details.isLoggedIn() && !details.isVersionView()) { %><a
+ onclick="showHideCommon('associationsAddDiv');expandIfNot('associations');$('type').focus();"><img
+ src="/wso2registry/admin/images/universal-add.gif" border="0" valign="top"
+ title="Assign New associations"/></a><% } %>
+ </td>
+ <td style="padding-top:3px;">
+ <a onclick="showHideCommon('associationsIconExpanded');showHideCommon('associationsIconMinimized');showHideCommon('associationsExpanded');showHideCommon('associationsMinimized');">
+ <img src="/wso2registry/admin/images/icon-expanded.gif" border="0" align="top"
+ id="associationsIconExpanded"/>
+ <img src="/wso2registry/admin/images/icon-minimized.gif" border="0" align="top"
+ id="associationsIconMinimized" style="display:none;"/>
+ </a>
+ </td>
+ </tr>
+ </table>
+ </td>
+
+ </tr>
+ </table>
+</div>
+<div class="box2-mid" id="associationsMinimized" style="display:none;">
+</div>
+
+<div class="box2-mid" id="associationsExpanded">
+ <div id="associationReason" class="validationError" style="display: none;"></div>
+ <div id="associationsAddDiv" style="display:none;">
+ <form onsubmit="return addAssociation();" name="assoForm">
<input type="hidden" name="resourcePath" id="resourcePath" value="<%=details.getPath()%>"/>
<table cellpadding="0" cellspacing="0" border="0" class="simple-data-table">
<tr>
<th valign="top">Type:<span class="required">*</span></th>
- <td><select id="typeDropDown" onchange="fillTypeBox()"
- style="margin-right:5px;margin-bottom:5px;width:130px;">
- <option selected="selected">Dependency</option>
- <option>--Other Type--</option>
- </select><input type="text" id="type" name="type" style="width:130px;margin-bottom:5px;"
- disabled="disabled"/></td>
+ <td><input type="text" name="type" id="type" style="width:130px;margin-bottom:5px;" />
+ </td>
</tr>
<tr>
<th valign="top">Path:<span class="required">*</span></th>
@@ -1300,17 +1364,13 @@
<tr>
<td></td>
<td><input type="button" class="button" value="Add"
- onclick="addAssociation();"/></td>
+ onclick="addAssociation('assoForm');"/></td>
</tr>
</table>
- <div style="font-style: italic; margin-top: 5px;">
- <img style="margin-right: 5px;" src="/wso2registry/admin/images/help-small.jpg"/>
- Dependency is a special type of association. You may define your own association type by selecting
- 'Other Type' from the drop down box.
- </div>
+
</form>
</div>
-
+ <% request.getSession().setAttribute("type","asso"); %>
<div id="associationDiv">
<jsp:include page="ajax/association-list.jsp"/>
</div>
@@ -1319,7 +1379,7 @@
<!-- ------------------------------------------------- -->
-<!-- End dependencies div -->
+<!-- End associations div -->
</td>
</tr>
More information about the Registry-dev
mailing list