dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #04961
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1656: Mirror fix.
------------------------------------------------------------
revno: 1656
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-03-17 13:25:32 +0700
message:
Mirror fix.
removed:
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/UpdateDocumentAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/ValidateUpdateDocumentAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/updateDocumentForm.vm
modified:
dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/GetDocumentAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/SaveDocumentAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties
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/viewDocumentForm.vm
--
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-dataentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml 2010-03-16 03:34:03 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml 2010-03-17 06:25:32 +0000
@@ -27,7 +27,7 @@
<param name="menu">/dhis-web-dataentry/menu.vm</param>
<param name="menuTreeHeight">420</param>
<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/general.js,javascript/form.js,
- ../dhis-web-commons/util/date.js,../dhis-web-commons/util/validate/jquery.validate.js,../dhis-web-commons/util/jquery.metadata.js
+ ../dhis-web-commons/util/validate/jquery.validate.js,../dhis-web-commons/util/jquery.metadata.js
,../dhis-web-commons/util/validate/additional-methods.js,../dhis-web-commons/util/validate/messages_locale.js</param>
<param name="stylesheets">style/dhis-web-dataentry.css,style/custom_data_entry_form_styles.css</param>
</action>
@@ -54,7 +54,7 @@
../dhis-web-commons/calendar/calendar.js,
../dhis-web-commons/calendar/calendar-lang.js,
../dhis-web-commons/calendar/calendar-setup.js,
- ../dhis-web-commons/util/date.js,../dhis-web-commons/util/validate/jquery.validate.js,../dhis-web-commons/util/jquery.metadata.js
+ ../dhis-web-commons/util/validate/jquery.validate.js,../dhis-web-commons/util/jquery.metadata.js
,../dhis-web-commons/util/validate/additional-methods.js,../dhis-web-commons/util/validate/messages_locale.js
</param>
<param name="stylesheets">style/dhis-web-dataentry.css,style/custom_data_entry_form_styles.css</param>
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2010-03-16 10:16:48 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2010-03-17 06:25:32 +0000
@@ -305,6 +305,7 @@
document.getElementById( "undoButton" ).disabled = false;
document.getElementById( "dateField" ).disabled = true;
document.getElementById( "dateDiv" ).style.display = "none";
+ hideById('message');
changeInputTextStatus( true );
}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/GetDocumentAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/GetDocumentAction.java 2009-08-20 08:17:49 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/GetDocumentAction.java 2010-03-17 06:25:32 +0000
@@ -60,7 +60,7 @@
{
this.id = id;
}
-
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -71,16 +71,17 @@
{
return document;
}
-
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
public String execute()
{
- document = documentService.getDocument( id );
-
+ if ( id != null )
+ {
+ document = documentService.getDocument( id );
+ }
return SUCCESS;
}
}
-
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/SaveDocumentAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/SaveDocumentAction.java 2010-02-05 07:29:49 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/SaveDocumentAction.java 2010-03-17 06:25:32 +0000
@@ -45,10 +45,11 @@
implements Action
{
private static final Log log = LogFactory.getLog( SaveDocumentAction.class );
-
+
private static final String HTTP_PREFIX = "http://";
+
private static final String HTTPS_PREFIX = "https://";
-
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -66,11 +67,18 @@
{
this.locationManager = locationManager;
}
-
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
private String name;
public void setName( String name )
@@ -98,21 +106,21 @@
{
this.file = file;
}
-
+
private String fileName;
-
+
public void setUploadFileName( String fileName )
{
this.fileName = fileName;
}
-
+
private String contentType;
-
+
public void setUploadContentType( String contentType )
{
this.contentType = contentType;
}
-
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -120,35 +128,46 @@
public String execute()
throws Exception
{
- if ( !external )
+ Document document = new Document();
+
+ if ( id != null )
{
- log.info( "Uploading file: '" + fileName + "', content-type: '" + contentType + "'" );
+ document = documentService.getDocument( id );
- File destination = locationManager.getFileForWriting( fileName, DocumentService.DIR );
-
- boolean fileMoved = file.renameTo( destination );
-
- if ( !fileMoved )
- {
- throw new RuntimeException( "File was not uploaded" );
- }
-
- url = fileName;
+ document.setName( name );
}
else
{
- if ( !( url.startsWith( HTTP_PREFIX ) || url.startsWith( HTTPS_PREFIX ) ) )
- {
- url = HTTP_PREFIX + url;
- }
+ if ( !external )
+ {
+ log.info( "Uploading file: '" + fileName + "', content-type: '" + contentType + "'" );
+
+ File destination = locationManager.getFileForWriting( fileName, DocumentService.DIR );
+
+ boolean fileMoved = file.renameTo( destination );
+
+ if ( !fileMoved )
+ {
+ throw new RuntimeException( "File was not uploaded" );
+ }
+
+ url = fileName;
+ }
+ else
+ {
+ if ( !(url.startsWith( HTTP_PREFIX ) || url.startsWith( HTTPS_PREFIX )) )
+ {
+ url = HTTP_PREFIX + url;
+ }
+ }
+
+ log.info( "Document name: '" + name + "', url: '" + url + "', external: '" + external + "'" );
+
+ document = new Document( name, url, external );
}
-
- log.info( "Document name: '" + name + "', url: '" + url + "', external: '" + external + "'" );
-
- Document document = new Document( name, url, external );
-
+
documentService.saveDocument( document );
-
+
return SUCCESS;
}
}
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/UpdateDocumentAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/UpdateDocumentAction.java 2010-03-16 07:56:31 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/UpdateDocumentAction.java 1970-01-01 00:00:00 +0000
@@ -1,161 +0,0 @@
-package org.hisp.dhis.reporting.document.action;
-
-/*
- * Copyright (c) 2004-2007, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.io.File;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.document.Document;
-import org.hisp.dhis.document.DocumentService;
-import org.hisp.dhis.external.location.LocationManager;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class UpdateDocumentAction
- implements Action
-{
- private static final Log log = LogFactory.getLog( UpdateDocumentAction.class );
-
- private static final String HTTP_PREFIX = "http://";
-
- private static final String HTTPS_PREFIX = "https://";
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private DocumentService documentService;
-
- public void setDocumentService( DocumentService documentService )
- {
- this.documentService = documentService;
- }
-
- private LocationManager locationManager;
-
- public void setLocationManager( LocationManager locationManager )
- {
- this.locationManager = locationManager;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private String name;
-
- public void setName( String name )
- {
- this.name = name;
- }
-
- private String url;
-
- public void setUrl( String url )
- {
- this.url = url;
- }
-
- private Boolean external;
-
- public void setExternal( Boolean external )
- {
- this.external = external;
- }
-
- private File file;
-
- public void setUpload( File file )
- {
- this.file = file;
- }
-
- private String fileName;
-
- public void setUploadFileName( String fileName )
- {
- this.fileName = fileName;
- }
-
- private String contentType;
-
- public void setUploadContentType( String contentType )
- {
- this.contentType = contentType;
- }
-
- private Integer id;
-
- public void setId( Integer id )
- {
- this.id = id;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- Document document = documentService.getDocument( id );
- document.setName( name );
- document.setExternal( external );
-
- if ( !external && file != null )
- {
- log.info( "Uploading file: '" + fileName + "', content-type: '" + contentType + "'" );
-
- File destination = locationManager.getFileForWriting( fileName, DocumentService.DIR );
- boolean fileMoved = file.renameTo( destination );
-
- if ( !fileMoved )
- {
- throw new RuntimeException( "File was not uploaded" );
- }
- document.setUrl( fileName );
- }
- else if(external)
- {
- if ( !(url.startsWith( HTTP_PREFIX ) || url.startsWith( HTTPS_PREFIX )) )
- {
- url = HTTP_PREFIX + url;
- }
- document.setUrl( url );
- }
-
- documentService.saveDocument( document );
-
- return SUCCESS;
- }
-}
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/ValidateUpdateDocumentAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/ValidateUpdateDocumentAction.java 2010-03-16 07:56:31 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/ValidateUpdateDocumentAction.java 1970-01-01 00:00:00 +0000
@@ -1,127 +0,0 @@
-package org.hisp.dhis.reporting.document.action;
-
-/*
- * Copyright (c) 2004-2007, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.hisp.dhis.document.Document;
-import org.hisp.dhis.document.DocumentService;
-import org.hisp.dhis.i18n.I18n;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class ValidateUpdateDocumentAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private DocumentService documentService;
-
- public void setDocumentService( DocumentService documentService )
- {
- this.documentService = documentService;
- }
-
- private I18n i18n;
-
- public void setI18n( I18n i18n )
- {
- this.i18n = i18n;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Integer id;
-
- public void setId( Integer id )
- {
- this.id = id;
- }
-
- private String name;
-
- public void setName( String name )
- {
- this.name = name;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private String message;
-
- public String getMessage()
- {
- return message;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- {
- if ( name == null )
- {
- message = i18n.getString( "specify_name" );
-
- return INPUT;
- }
- else
- {
- name = name.trim();
-
- if ( name.length() == 0 )
- {
- message = i18n.getString( "specify_name" );
-
- return INPUT;
- }
-
- Document match = documentService.getDocumentByName( name );
-
- if ( match != null && (id == null || match.getId() != id) )
- {
- message = i18n.getString( "name_in_use" );
-
- return INPUT;
- }
- }
-
- message = i18n.getString( "everything_is_ok" );
-
- return SUCCESS;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2010-03-16 07:56:31 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2010-03-17 06:25:32 +0000
@@ -18,15 +18,6 @@
ref="org.hisp.dhis.external.location.LocationManager"/>
</bean>
- <bean id="org.hisp.dhis.reporting.document.action.UpdateDocumentAction"
- class="org.hisp.dhis.reporting.document.action.UpdateDocumentAction"
- scope="prototype">
- <property name="documentService"
- ref="org.hisp.dhis.document.DocumentService"/>
- <property name="locationManager"
- ref="org.hisp.dhis.external.location.LocationManager"/>
- </bean>
-
<bean id="org.hisp.dhis.reporting.document.action.GetDocumentAction"
class="org.hisp.dhis.reporting.document.action.GetDocumentAction"
scope="prototype">
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties 2010-03-16 10:16:48 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties 2010-03-17 06:25:32 +0000
@@ -301,5 +301,4 @@
intro_chart = View and add charts. Charts are based on indicators and either organisation units or periods.
intro_pivot_table = Browse pivot tables, which can be pivoted on any of the indicator, organisation unit and period dimensions.
intro_report_table = Add and generate report tables. Report tables are highly customizable database tables which can be used as basis for reports.
-intro_data_completeness = Browse the submission rates of data sets. This can be viewed by organisation unit and period, and later reported to PDF and Workbook.
-update_new_static_report = Update static report
\ No newline at end of file
+intro_data_completeness = Browse the submission rates of data sets. This can be viewed by organisation unit and period, and later reported to PDF and Workbook.
\ No newline at end of file
=== 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-03-16 07:56:31 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2010-03-17 06:25:32 +0000
@@ -22,12 +22,6 @@
<param name="requiredAuthorities">F_DOCUMENT_ADD</param>
</action>
- <action name="updateDocument" class="org.hisp.dhis.reporting.document.action.UpdateDocumentAction">
- <result name="success" type="redirect">displayViewDocumentForm.action</result>
- <interceptor-ref name="fileUploadStack"/>
- <param name="requiredAuthorities">F_DOCUMENT_UPDATE</param>
- </action>
-
<action name="removeDocument" class="org.hisp.dhis.reporting.document.action.RemoveDocumentAction">
<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
<param name="requiredAuthorities">F_DOCUMENT_DELETE</param>
@@ -40,21 +34,13 @@
<param name="javascripts">javascript/document.js</param>
</action>
- <action name="displayAddDocumentForm" class="org.hisp.dhis.reporting.action.NoAction">
+ <action name="displayAddDocumentForm" class="org.hisp.dhis.reporting.document.action.GetDocumentAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-reporting/addDocumentForm.vm</param>
<param name="menu">/dhis-web-reporting/menu.vm</param>
<param name="javascripts">javascript/document.js</param>
</action>
- <action name="displayUpdateDocumentForm" class="org.hisp.dhis.reporting.document.action.GetDocumentAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-reporting/updateDocumentForm.vm</param>
- <param name="menu">/dhis-web-reporting/menu.vm</param>
- <param name="javascripts">javascript/document.js</param>
- <param name="requiredAuthorities">F_DOCUMENT_UPDATE</param>
- </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>
=== 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 2009-03-07 13:10:38 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addDocumentForm.vm 2010-03-17 06:25:32 +0000
@@ -2,21 +2,21 @@
<h3>$i18n.getString( 'create_new_static_report' )</h3>
<form id="documentForm" action="saveDocument.action" method="post" enctype="multipart/form-data">
-
+<input type='hidden' id='id' name='id' value='$!document.id'/>
<table>
<tr>
<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"></td>
+ <td><input type="text" id="name" name="name" style="width:20em" value="$!document.name"></td>
</tr>
<tr>
<td><label for="external">$i18n.getString( "type" )</label></td>
<td>
- <select id="external" name="external" style="width:20em" onchange="toggleExternal()">
- <option value="false">$i18n.getString( "upload_file" )</option>
- <option value="true">$i18n.getString( "external_url" )</option>
+ <select id="external" name="external" style="width:20em" onchange="toggleExternal()" #if($!document) disabled=false else disabled=true #end>
+ <option value="false" #if(!$document.external) selected #end>$i18n.getString( "upload_file" )</option>
+ <option value="true" #if($document.external) selected #end>$i18n.getString( "external_url" )</option>
</select>
</td>
</tr>
@@ -26,16 +26,16 @@
<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><input type="file" id="upload" name="upload" size="25" #if($!document) disabled=true value="$!document.url" #end></td>
</tr>
</table>
</div>
-<div id="urlDiv" style="display:none">
+<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" value="http://"></td>
+ <td><input type="text" id="url" name="url" style="width:20em" #if($!document) disabled=true value="$!document.url" #else value="http://" #end></td>
</tr>
</table>
</div>
@@ -56,3 +56,4 @@
</form>
<span id="message"#if ( $message ) style="display:block"#end>$!message</span>
+<script>toggleExternal();</script>
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/updateDocumentForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/updateDocumentForm.vm 2010-03-16 07:56:31 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/updateDocumentForm.vm 1970-01-01 00:00:00 +0000
@@ -1,61 +0,0 @@
-
-<h3>$i18n.getString( 'update_new_static_report' )</h3>
-
-<form id="documentForm" action="updateDocument.action" method="post" enctype="multipart/form-data">
-<input type="hidden" id="id" name="id" value="$document.id">
-<table>
- <tr>
- <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>
- </tr>
- <tr>
- <td><label for="external">$i18n.getString( "type" )</label></td>
- <td>
- <select id="external" name="external" style="width:20em" onchange="toggleExternal();">
- <option value="false" #if(!$document.external) selected #end>$i18n.getString( "upload_file" )</option>
- <option value="true" #if($document.external) selected #end>$i18n.getString( "external_url" )</option>
- </select>
- </td>
- </tr>
-</table>
-
-<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>
- </tr>
-</table>
-</div>
-
-<div id="urlDiv" style="display:none">
-<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.external) value="$!document.url" #end></td>
- </tr>
-</table>
-</div>
-
-<table>
- <tr>
- <td colspan="2" height="7px"></td>
- </tr>
- <tr>
- <td></td>
- <td>
- <input type="button" value="$i18n.getString( 'save' )" style="width:10em" onclick="updateDocument();"><input
- type="button" value="$i18n.getString( 'cancel' )" style="width:10em" onclick="window.location.href='displayViewDocumentForm.action'">
- </td>
- </tr>
-</table>
-
-</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/viewDocumentForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDocumentForm.vm 2010-03-16 07:56:31 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDocumentForm.vm 2010-03-17 06:25:32 +0000
@@ -26,7 +26,7 @@
<tr id="tr${document.id}">
<td>$encoder.htmlEncode( $document.name )</td>
<td style="text-align:center; width: 60px">
- <a href="displayUpdateDocumentForm.action?id=$document.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
+ <a href="displayAddDocumentForm.action?id=$!document.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
#if ( $document.external )
<a href="$document.url" title="$i18n.getString( 'view_report' )">
#else