[Registry-dev] svn commit r14742 - in
trunk/registry/modules/webapps/src/main/webapp/admin: . css js
svn at wso2.org
svn at wso2.org
Wed Mar 12 10:04:49 PDT 2008
Author: chanaka
Date: Wed Mar 12 10:04:39 2008
New Revision: 14742
Log:
validation script made compatible with IE
Modified:
trunk/registry/modules/webapps/src/main/webapp/admin/css/main.css
trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js
trunk/registry/modules/webapps/src/main/webapp/admin/js/validation.js
trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp
Modified: trunk/registry/modules/webapps/src/main/webapp/admin/css/main.css
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/css/main.css (original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/css/main.css Wed Mar 12 10:04:39 2008
@@ -731,4 +731,8 @@
padding:5px;
margin-bottom:10px;
line-height:30px;
+}
+.required{
+color:red;
+font-size:10px;
}
\ No newline at end of file
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 Wed Mar 12 10:04:39 2008
@@ -1,4 +1,5 @@
var browserName=navigator.appName;
+var resourceType="file";
function showHide(toShowHide){
var resource_div=document.getElementById('add-resource-div');
@@ -532,13 +533,14 @@
var rForm = document.forms["resourceupload"];
var resourceReason=document.getElementById("resourceReason");
/* Validate the form before submit */
+
var reason="";
- if(!(rForm.upload.hasAttribute("disabled")))
- reason+=validateFilePath(rForm.upload,"File Path");
- if(!(rForm.fetchURL.hasAttribute("disabled")))
- reason+=validateUrl(rForm.fetchURL,"Content URL");
+ if(resourceType=="file")
+ reason+=validateFilePath(rForm.upload,"File Path");
+ else
+ reason+=validateUrl(rForm.fetchURL,"Content URL");
reason+=validateIllegal(rForm.filename,"Name");
-
+
if(reason!=""){
resourceReason.style.display="block";
resourceReason.innerHTML=reason;
@@ -580,6 +582,7 @@
/* This function will preform the disable and enabaling of the two input fiels on resource adding form */
function resourceFrom(type)
{
+ resourceType=type;
/* Get radio button and file form field objects */
var contentFile=document.getElementById('contentFile');
var resourceFile=document.getElementById('resourceFile');
@@ -595,6 +598,7 @@
fetchURLID.setAttribute('disabled','');
resourceFile.removeAttribute('disabled');
+ fetchURLID.style.background="#ffffff";
urlHelpText.style.color="#cccccc";
fileHelpText.style.color="#000000";
@@ -603,6 +607,7 @@
resourceFile.setAttribute('disabled','');
fetchURLID.removeAttribute('disabled');
+ resourceFile.style.background="#ffffff";
fileHelpText.style.color="#cccccc";
urlHelpText.style.color="#000000";
}
Modified: trunk/registry/modules/webapps/src/main/webapp/admin/js/validation.js
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/js/validation.js (original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/js/validation.js Wed Mar 12 10:04:39 2008
@@ -11,6 +11,7 @@
}
function validateUrl(fld,fldName) {
+
var error = "";
var regx = RegExp("(http|https|ftp|file)://.*");
if(fld.value==""){
@@ -20,7 +21,6 @@
else if(!(fld.value.match(regx))){
error = "The "+fldName+" is not a valid URL.<br />";
fld.style.background = 'Yellow';
- alert('error');
}
@@ -37,6 +37,7 @@
else if(!fld.value.match(regx)){
error = "The "+fldName+" is not a valid URL.<br />";
fld.style.background = 'Yellow';
+
}
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 Wed Mar 12 10:04:39 2008
@@ -341,21 +341,21 @@
<div class="validationError" id="resourceReason" style="display:none;"></div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
- <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 valign="top"><input id="contentFile" type="radio" name="contentMethod" value="file" checked="checked" onclick="resourceFrom('file')" /><span id="contentFileText">Import content from file<span class="required">*</span></span></td>
<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 etc..)</div>
</td>
</tr>
<tr>
- <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 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 class="required">*</span></span></td>
<td>
<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>
+ <div class="helpText" id="urlHelpText" style="color:#cccccc;">Give the full url of the resource to fetch content from URL</div>
</td>
</tr>
<tr>
- <td valign="top">Name</td>
+ <td valign="top">Name<span class="required">*</span></td>
<td><input id="resourceName" type="text" name="filename" style="margin-bottom:10px;"/></td>
</tr>
More information about the Registry-dev
mailing list