dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07474
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2132: Fix bug: An exception in static report.
------------------------------------------------------------
revno: 2132
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-09-16 16:43:15 +0700
message:
Fix bug: An exception in static report.
modified:
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addDocumentForm.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/document.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2010-09-15 04:42:49 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2010-09-16 09:43:15 +0000
@@ -43,8 +43,9 @@
</action>
<action name="validateDocument" class="org.hisp.dhis.reporting.document.action.ValidateDocumentAction">
- <result name="success" type="velocity-xml">/dhis-web-reporting/responseSuccess.vm</result>
- <result name="input" type="velocity-xml">/dhis-web-reporting/responseInput.vm</result>
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addDocumentForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addDocumentForm.vm 2010-03-17 11:11:37 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addDocumentForm.vm 2010-09-16 09:43:15 +0000
@@ -1,3 +1,16 @@
+<script>
+ jQuery(document).ready( function(){
+ validation( 'documentForm', function( form ){
+ form.submit();
+ },function(){
+ });
+ checkValueIsExist( "name", "validateDocument.action", {id: "$!document.id"} );
+ });
+
+ function checkUploadFile(){
+
+ }
+</script>
<h3>$i18n.getString( 'create_new_static_report' )</h3>
@@ -8,8 +21,8 @@
<th colspan="2">$i18n.getString( "details" )</th>
</tr>
<tr>
- <td style="width:70px"><label for="name">$i18n.getString( "name" )</label></td>
- <td><input type="text" id="name" name="name" style="width:20em" value="$!document.name"></td>
+ <td style="width:70px"><label for="name">$i18n.getString( "name" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="name" name="name" style="width:20em" value="$!document.name" class="{validate:{required:true,minlength:2,maxlength:160}}"></td>
</tr>
<tr>
<td><label for="external">$i18n.getString( "type" )</label></td>
@@ -20,7 +33,7 @@
#elseif( $!document)
<option value="true">$i18n.getString( "external_url" )</option>
#else
- <option value="false">$i18n.getString( "upload_file" )</option>
+ <option value="false" onclick="checkUploadFile();">$i18n.getString( "upload_file" )</option>
<option value="true">$i18n.getString( "external_url" )</option>
#end
</select>
@@ -31,8 +44,9 @@
<div id="fileDiv">
<table>
<tr>
- <td style="width:70px"><label for="upload">$i18n.getString( "file" )</label></td>
- <td><input type="file" id="upload" name="upload" size="25"></td>
+ <td style="width:70px"><label for="upload">$i18n.getString( "file" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="file" id="upload" name="upload" size="25" >
+ </td>
</tr>
</table>
</div>
@@ -40,8 +54,8 @@
<div id="urlDiv">
<table>
<tr>
- <td style="width:70px"><label for="url">$i18n.getString( "url" )</label></td>
- <td><input type="text" id="url" name="url" style="width:20em" #if($!document) value="$!document.url" #else value="http://" #end></td>
+ <td style="width:70px"><label for="url">$i18n.getString( "url" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="url" name="url" style="width:20em" #if($!document) value="$!document.url" #else value="http://" #end ></td>
</tr>
</table>
</div>
@@ -53,7 +67,7 @@
<tr>
<td></td>
<td>
- <input type="button" value="$i18n.getString( 'save' )" style="width:10em" onclick="saveDocument()"><input
+ <input type="submit" value="$i18n.getString( 'save' )" style="width:10em"><input
type="button" value="$i18n.getString( 'cancel' )" style="width:10em" onclick="window.location.href='displayViewDocumentForm.action'">
</td>
</tr>
@@ -61,7 +75,6 @@
</form>
-<span id="message"#if ( $message ) style="display:block"#end>$!message</span>
<script>
toggleExternal();
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/document.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/document.js 2010-03-17 11:11:37 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/document.js 2010-09-16 09:43:15 +0000
@@ -1,31 +1,4 @@
-function saveDocument()
-{
- var url = "validateDocument.action?name=" + getFieldValue( "name" ) + "&id=" + getFieldValue( "id" );
-
- var request = new Request();
- request.setResponseTypeXML( 'message' );
- request.setCallbackSuccess( saveDocumentReceived );
- request.send( url );
-}
-
-function saveDocumentReceived( messageElement )
-{
- var type = messageElement.getAttribute( 'type' );
- var message = messageElement.firstChild.nodeValue;
-
- if ( type == "input" )
- {
- setMessage( message );
-
- return false;
- }
- else if ( type == "success" )
- {
- document.getElementById( "documentForm" ).submit();
- }
-}
-
function removeDocument( id )
{
removeItem( id, "", i18n_confirm_remove_report, "removeDocument.action" );
@@ -50,10 +23,17 @@
{
document.getElementById( "fileDiv" ).style.display = "none";
document.getElementById( "urlDiv" ).style.display = "block";
+ $('#url').attr('class','{validate:{required:true}}');
+ $('#upload').attr('class','');
}
else
{
document.getElementById( "fileDiv" ).style.display = "block";
document.getElementById( "urlDiv" ).style.display = "none";
+ if( byId('id').value == "")
+ {
+ $('#upload').attr('class','{validate:{required:true}}');
+ $('#url').attr('class','');
+ }
}
}