Author: chanaka
Date: Sun Jan 13 22:36:32 2008
New Revision: 12187
Log:
1 Remove the frame on resource page.
2 Properties editing functionality added
Modified:
trunk/registry/modules/webapps/src/main/webapp/admin/ajax/resource-properties.jsp
trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js
trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp
Modified:
trunk/registry/modules/webapps/src/main/webapp/admin/ajax/resource-properties.jsp
==============================================================================
---
trunk/registry/modules/webapps/src/main/webapp/admin/ajax/resource-properties.jsp
(original)
+++
trunk/registry/modules/webapps/src/main/webapp/admin/ajax/resource-properties.jsp
Sun Jan 13 22:36:32 2008
@@ -1,6 +1,8 @@
-<%@ page import="java.util.Properties" %>
+<%@ page import="org.wso2.registry.web.UIConstants" %>
+<%@ page import="org.wso2.registry.web.actions.ResourceDetailsAction" %>
<%@ page import="org.wso2.registry.web.utils.PropertiesUtil" %>
<%@ page import="java.util.Iterator" %>
+<%@ page import="java.util.Properties" %>
<%--
Created by IntelliJ IDEA.
User: chathura
@@ -10,17 +12,48 @@
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
+ ResourceDetailsAction details = (ResourceDetailsAction)
request.getSession().getAttribute(UIConstants.RESOURCE_BEAN);
String resourcePath = (String)
request.getSession().getAttribute("resourcePath");
Properties props = PropertiesUtil.getResourceProperties(resourcePath,
request);
-
+ %>
+ <table cellpadding="0" cellspacing="0" border="0" class="data-table"
style="width:100%">
+ <tr>
+ <th style="width:40%">Name</th>
+ <th>Value</th>
+ <th style="width:70px;"></th>
+ </tr>
+ <%
Iterator iProps = props.keySet().iterator();
- while (iProps.hasNext()) {
+ for (int i=0;iProps.hasNext();i++) {
String name = (String) iProps.next();
String value = (String) props.get(name);
%>
- <strong><%=name%></strong>: <%=value%> <input type="button"
value="Remove" onclick="removeProperty('<%=name%>')"/> <br/>
+
+
+ <tr id="propEditPanel_<%=i%>" style="display:none;">
+ <td><input id="propRPath_<%=i%>" type="hidden"
value="<%=details.getPath()%>"/><input value="<%=name%>" type="text"
id="propName_<%=i%>" /></td>
+ <td><input value="<%=value%>" id="propValue_<%=i%>"
type="text"/></td>
+ <td>
+ <a href="#"
onclick="showHideCommon('propViewPanel_<%=i%>');showHideCommon('propEditPanel_<%=i%>');
editProperty('<%=i%>')"><img border="0" align="top" title="Save"
src="/wso2registry/admin/images/save-button.gif" id="propSaveButton_<%=i%>"
/></a>
+ </td>
+ </tr>
+
+
+
+ <tr id="propViewPanel_<%=i%>">
+ <td><%=name%></td>
+ <td><%=value%></td>
+ <td>
+ <a href="#"
onclick="showHideCommon('propViewPanel_<%=i%>');showHideCommon('propEditPanel_<%=i%>')"><img
title="Edit" border="0" align="top"
src="/wso2registry/admin/images/icon-edit.gif" /></a>
+ <a href="#" onclick="removeProperty('<%=name%>')"
style="margin-left:5px;"><img title="Remove" style="margin-top:3px;" border="0"
align="top" src="/wso2registry/admin/images/icon-trash.gif" /></a>
+
+ </td>
+ </tr>
+
+
<%
}
%>
+</table>
Modified: trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js
(original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js Sun Jan
13 22:36:32 2008
@@ -154,6 +154,10 @@
divx.style.display='block';
if(divx.nodeName == 'IMG')
divx.style.display='inline';
+ if(divx.nodeName == 'TR')
+ divx.style.display='table-row';
+ if(divx.nodeName == 'TD')
+ divx.style.display='table-cell';
//link.innerHTML=textHidden;
}
/* hide the initaly shown object */
@@ -252,7 +256,12 @@
document.getElementById('propValue').value = "";
new Ajax.Updater('resourceProperties', '/wso2registry/system/setProperty',
{ method: 'post', parameters: {resourcePath: resourcePath, propertyName:
propertyName, propertyValue: propertyValue} });
}
-
+function editProperty(rowid) {
+ var resourcePath = document.getElementById('propRPath_'+rowid).value;
+ var propertyName = document.getElementById('propName_'+rowid).value;
+ var propertyValue = document.getElementById('propValue_'+rowid).value;
+ new Ajax.Updater('resourceProperties', '/wso2registry/system/setProperty',
{ method: 'post', parameters: {resourcePath: resourcePath, propertyName:
propertyName, propertyValue: propertyValue} });
+}
function removeProperty(propertyName) {
var resourcePath = document.getElementById('propRPath').value;
@@ -389,4 +398,34 @@
hideInput.setAttribute('disabled','disabled');
showInput.removeAttribute('disabled');
+}
+/* This function will preform the disable and enabaling of the two input fiels
on resource adding form */
+function resourceFrom(type)
+{
+ /* Get radio button and file form field objects */
+ var contentFile=document.getElementById('contentFile');
+ var resourceFile=document.getElementById('resourceFile');
+
+ var contentURL=document.getElementById('contentURL');
+ var fetchURLID=document.getElementById('fetchURLID');
+
+ /* Get the help text content */
+ var fileHelpText=document.getElementById('fileHelpText');
+ var urlHelpText=document.getElementById('urlHelpText');
+
+ if(type=='file'){
+
+ fetchURLID.setAttribute('disabled','');
+ resourceFile.removeAttribute('disabled');
+ urlHelpText.style.color="#cccccc";
+ fileHelpText.style.color="#000000";
+
+ }
+ else{
+
+ resourceFile.setAttribute('disabled','');
+ fetchURLID.removeAttribute('disabled');
+ fileHelpText.style.color="#cccccc";
+ urlHelpText.style.color="#000000";
+ }
}
\ No newline at end of file
Modified:
trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp
(original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp
Sun Jan 13 22:36:32 2008
@@ -94,27 +94,7 @@
<td class="leftColoumSizer" valign="top">
<!-- Hear comes the box1 table -->
-<div class="box1-head">
- <table cellspacing="0" cellpadding="0" border="0" style="width:100%">
- <tr>
- <td valign="top" style="padding-top:0px;width:14px;"><img
src="/wso2registry/admin/images/box1-lefttop.jpg" /></td>
- <td valign="top">
- <h2>Information</h2>
- </td>
- <td align="right" valign="top">
- <a href="#"
onclick="showHideCommon('mainIconExpanded');showHideCommon('mainIconMinimized');showHideCommon('mainExpanded');showHideCommon('mainMinimized');">
- <img src="/wso2registry/admin/images/icon-expanded.gif"
border="0" align="top" id="mainIconExpanded" />
- <img src="/wso2registry/admin/images/icon-minimized.gif"
border="0" align="top" id="mainIconMinimized" style="display:none;" />
- </a>
- </td>
- <td valign="top" align="right" style="width:14px;
padding-top:0px;" ><img src="/wso2registry/admin/images/box1-righttop.jpg"
/></td>
- </tr>
- </table>
-</div>
-<div class="box1-mid" id="mainMinimized" style="display:none;">
- Expand to view details
-</div>
-<div class="box1-mid" id="mainExpanded">
+<div style="margin-bottom:10px;">
<!-- all the content goes here -->
<table cellpadding="0" cellspacing="0" border="0"
class="simple-data-table">
<tr><th style="width:140px;">Created:</th><td
style="width:170px;"><%=details.getCreatedOn().toString()%></td><th>Author:</th><td><%=details.getAuthor()%></td></tr>
@@ -128,30 +108,79 @@
new Ajax.Updater('ratingDiv', '/wso2registry/system/getInitialRating',
{ method: 'get', parameters: {resourcePath: '<%=details.getPath()%>'} });
</script>
- <br/>
- <h2>Properties</h2><br/>
- <div id="resourceProperties">
+ <table cellpadding="0" cellspacing="0" border="0"
class="simple-data-table">
+ <tr>
+ <th style="width:140px;height:25px;">
+ Properties
+ </th>
+ <td>
+ <a onclick="showHideCommon('propertiesAddDiv');"
href="#">
+ <img border="0" title="Add New Properties"
style="margin-top: -10px;" valign="top"
src="/wso2registry/admin/images/universal-add.gif"/>
+ </a>
+ </td>
+ <td id="propertiesAddDiv" style="display:none;
padding-left:10px;">
+ <form>
+ <input type="hidden" id="propRPath"
value="<%=details.getPath()%>"/>
+ Name: <input type="text" id="propName"/> Value:
<input type="text" id="propValue"/>
+ <input type="button" value="Add"
onclick="setProperty();showHideCommon('propertiesAddDiv');"/>
+ </form>
+ </td>
+ </tr>
+ </table>
+
+ <div id="resourceProperties" style="margin-left:145px;">
+
+ <form>
+ <table cellpadding="0" cellspacing="0" border="0" class="data-table"
style="width:100%">
+ <tr>
+ <th style="width:40%">Name</th>
+ <th>Value</th>
+ <th style="width:70px;"></th>
+ </tr>
<%
Properties props = details.getProperties();
Iterator iProps = props.keySet().iterator();
- while (iProps.hasNext()) {
+ for (int i=0;iProps.hasNext();i++) {
String name = (String) iProps.next();
String value = (String) props.get(name);
%>
- <strong><%=name%></strong>: <%=value%> <input type="button"
value="Remove" onclick="removeProperty('<%=name%>')"/> <br/>
+
+
+ <tr id="propEditPanel_<%=i%>" style="display:none;">
+ <td><input id="propRPath_<%=i%>" type="hidden"
value="<%=details.getPath()%>"/><input value="<%=name%>" type="text"
id="propName_<%=i%>" /></td>
+ <td><input value="<%=value%>" id="propValue_<%=i%>"
type="text"/></td>
+ <td>
+ <a href="#"
onclick="showHideCommon('propViewPanel_<%=i%>');showHideCommon('propEditPanel_<%=i%>');
editProperty('<%=i%>')"><img border="0" align="top" title="Save"
src="/wso2registry/admin/images/save-button.gif" id="propSaveButton_<%=i%>"
/></a>
+ </td>
+ </tr>
+
+
+
+ <tr id="propViewPanel_<%=i%>">
+ <td><%=name%></td>
+ <td><%=value%></td>
+ <td>
+ <a href="#"
onclick="showHideCommon('propViewPanel_<%=i%>');showHideCommon('propEditPanel_<%=i%>')"><img
title="Edit" border="0" align="top"
src="/wso2registry/admin/images/icon-edit.gif" /></a>
+ <a href="#" onclick="removeProperty('<%=name%>')"
style="margin-left:5px;"><img title="Remove" style="margin-top:3px;" border="0"
align="top" src="/wso2registry/admin/images/icon-trash.gif" /></a>
+
+ </td>
+ </tr>
+
+
+
+
+
<%
}
%>
+ </table>
+ </form>
</div>
- <br/>
- <form>
- <input type="hidden" id="propRPath" value="<%=details.getPath()%>"/>
- Name: <input type="text" id="propName"/> Value: <input type="text"
id="propValue"/>
- <input type="button" value="Add" onclick="setProperty()"/>
- </form>
+
+
<table cellpadding="0" cellspacing="0" border="0"
class="simple-data-table" style="width:100%">
<tr>
@@ -180,21 +209,8 @@
new Ajax.Updater('descView', '/wso2registry/system/getDescription', {
method: 'get', parameters: {resourcePath: '<%=details.getPath()%>'} });
document.getElementById('descEdit').textContent =
document.getElementById('descView').innerHTML;
</script>
-
-
-
-
-
- <!-- End box1-mid div -->
-</div>
-<div class="box1-bot">
- <table cellspacing="0" cellpadding="0" border="0" style="width:100%" >
- <tr>
- <td><img src="/wso2registry/admin/images/box1-leftbot.jpg" /></td>
- <td align="right"><img
src="/wso2registry/admin/images/box1-rightbot.jpg" /></td>
- </tr>
- </table>
</div>
+<!-- Page main information Ends here -->
@@ -254,21 +270,20 @@
<h3>Add Resource</h3>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
- <td valign="top"><input id="contentFile" type="radio"
name="contentMethod" value="file" checked="checked" /><span
id="contentFileText">Import content from file</span></td>
+ <td valign="top"><input id="contentFile" type="radio"
name="contentMethod" value="file" checked="checked"
onclick="resourceFrom('file')" /><span id="contentFileText">Import content from
file</span></td>
<td>
- <input id="resourceFile" type="file" name="upload"
onchange="fillResourceDetails()"/>
- <div class="helpText">Give the url of a file to fetch
content (xml,wsdl,jar etc..)</div>
+ <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 etc..)</div>
</td>
</tr>
<tr>
- <td valign="top" style="width:180px;"><input id="contentURL"
type="radio" name="contentMethod" value="url" /><span
id="contentURLText">Import content from URL</span></td>
+ <td valign="top" style="width:180px;"><input id="contentURL"
onclick="resourceFrom('url')" type="radio" name="contentMethod" value="url"
/><span id="contentURLText">Import content from URL</span></td>
<td>
- <input id="fetchURLID" type="text" name="fetchURL"
onchange="fillResourceDetailsForURLs()"/>
- <div class="helpText">Give the full url of the resource to
fetch content from URL</div>
+ <input id="fetchURLID" type="text" name="fetchURL"
onchange="fillResourceDetailsForURLs()" disabled="" />
+ <div class="helpText" id="urlHelpText">Give the full url
of the resource to fetch content from URL</div>
</td>
</tr>
<tr>
- <tr>
<td valign="top">Name</td>
<td><input id="resourceName" type="text" name="filename"
style="margin-bottom:10px;"/></td>
_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev