← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2007: Merged CONFIG module functionality from india branch to Trunk

 

------------------------------------------------------------
revno: 2007
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-08-30 17:34:09 +0530
message:
  Merged CONFIG module functionality from india branch to Trunk
removed:
  local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/javascript/
  local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/takeMysqlBackupForm.vm
added:
  local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/images/
  local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/images/ajax-loader.gif
  local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/images/download-icon.jpg
modified:
  local/in/dhis-web-maintenance-in/pom.xml
  local/in/dhis-web-maintenance-in/src/main/java/org/hisp/dhis/config/action/StreamMySqlBackupAction.java
  local/in/dhis-web-maintenance-in/src/main/java/org/hisp/dhis/config/action/TakeMySqlBackupAction.java
  local/in/dhis-web-maintenance-in/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/configurationForm.vm
  local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/menu.vm
  local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/takeMysqlBackupResult.vm
  local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/welcome.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 'local/in/dhis-web-maintenance-in/pom.xml'
--- local/in/dhis-web-maintenance-in/pom.xml	2010-08-20 09:13:09 +0000
+++ local/in/dhis-web-maintenance-in/pom.xml	2010-08-30 12:04:09 +0000
@@ -44,16 +44,18 @@
       <artifactId>dhis-web-commons-resources</artifactId>
 	  <type>war</type>			
     </dependency>
+<!--
 	<dependency>
       <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-service-aggregationengine-default</artifactId>
 	<version>${version}</version>
     </dependency>
+	
    <dependency>
       <groupId>net.sourceforge.jexcelapi</groupId>
       <artifactId>jxl</artifactId>
     </dependency>    
-    
+-->    
     <!-- Other -->
     <!--
     <dependency>

=== modified file 'local/in/dhis-web-maintenance-in/src/main/java/org/hisp/dhis/config/action/StreamMySqlBackupAction.java'
--- local/in/dhis-web-maintenance-in/src/main/java/org/hisp/dhis/config/action/StreamMySqlBackupAction.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-maintenance-in/src/main/java/org/hisp/dhis/config/action/StreamMySqlBackupAction.java	2010-08-30 12:04:09 +0000
@@ -15,10 +15,6 @@
 {
 
     // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    // -------------------------------------------------------------------------
     // Input and Output Parameters
     // -------------------------------------------------------------------------
 
@@ -80,20 +76,9 @@
             }
 
             out.close();
+
             bis.close();
 
-            System.out.println( "zipFilePath : " + zipFilePath );
-
-            /*
-             * PipedOutputStream out = new PipedOutputStream();
-             * 
-             * PipedInputStream in = new PipedInputStream( out );
-             * 
-             * ZipOutputStream zipOut = new ZipOutputStream( out );
-             * 
-             * zipOut.putNextEntry( new ZipEntry( fileName ) );
-             */
-
             inputStream = new BufferedInputStream( new FileInputStream( zipFilePath ), 1024 );
         }
         catch ( Exception e )

=== modified file 'local/in/dhis-web-maintenance-in/src/main/java/org/hisp/dhis/config/action/TakeMySqlBackupAction.java'
--- local/in/dhis-web-maintenance-in/src/main/java/org/hisp/dhis/config/action/TakeMySqlBackupAction.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-maintenance-in/src/main/java/org/hisp/dhis/config/action/TakeMySqlBackupAction.java	2010-08-30 12:04:09 +0000
@@ -8,13 +8,13 @@
 import org.hisp.dhis.config.ConfigurationService;
 import org.hisp.dhis.config.Configuration_IN;
 import org.hisp.dhis.system.database.DatabaseInfoProvider;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import com.opensymphony.xwork2.Action;
 
 public class TakeMySqlBackupAction
     implements Action
 {
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -26,13 +26,9 @@
         this.configurationService = configurationService;
     }
 
+    @Autowired
     private DatabaseInfoProvider provider;
-    
-    public void setProvider( DatabaseInfoProvider provider )
-    {
-        this.provider = provider;
-    }
-    
+        
     // -------------------------------------------------------------------------
     // Input and Output Parameters
     // -------------------------------------------------------------------------
@@ -43,7 +39,14 @@
     {
         return statusMessage;
     }
+
+    private String status;
     
+    public String getStatus()
+    {
+        return status;
+    }
+
     private String backupFilePath;
 
     public String getBackupFilePath()
@@ -53,12 +56,6 @@
 
     private SimpleDateFormat simpleDateFormat;
 
-    public SimpleDateFormat getSimpleDateFormat()
-    {
-        return simpleDateFormat;
-    }
-
-    
     // -------------------------------------------------------------------------
     // Action Implementation
     // -------------------------------------------------------------------------
@@ -66,21 +63,13 @@
     public String execute()
         throws Exception
     {        
-        
-        //List<String> dbInfoList = new ArrayList<String>( dbConnection.getDBInfo() );
-                                
-        //String dbName = dbInfoList.get( 0 );
-        //String userName = dbInfoList.get( 1 );
-        //String password = dbInfoList.get( 2 );
-        
-        //String mySqlPath = dashBoardService.getMYSqlPath();
+        status = "INPUT";
         
         String dbName = provider.getDatabaseInfo().getName();
         String userName = provider.getDatabaseInfo().getUser();
         String password = provider.getDatabaseInfo().getPassword();
         
         String mySqlPath = configurationService.getConfigurationByKey( Configuration_IN.KEY_MYSQLPATH ).getValue();
-
         
         Calendar curDateTime = Calendar.getInstance();
         Date curDate = new Date();                
@@ -89,15 +78,15 @@
         simpleDateFormat = new SimpleDateFormat( "ddMMMyyyy-HHmmssSSS" );
                 
         String tempFolderName = simpleDateFormat.format( curDate );
-        System.out.println( tempFolderName );
         
-        //backupFilePath = dashBoardService.getRootDataPath();
         backupFilePath = configurationService.getConfigurationByKey( Configuration_IN.KEY_BACKUPDATAPATH ).getValue();
         backupFilePath += tempFolderName;
         
         File newdir = new File( backupFilePath );
         if( !newdir.exists() )
+        {
             newdir.mkdirs();
+        }
         
         backupFilePath += "/" + "dhis2.sql";
         
@@ -105,13 +94,15 @@
         
         try
         {
-            if(password == null || password.trim().equals( "" ))
+            if( password == null || password.trim().equals( "" ) )
+            {
                 backupCommand = mySqlPath + "mysqldump -u "+ userName +" "+ dbName +" -r "+backupFilePath;
+            }
             else
+            {
                 backupCommand = mySqlPath + "mysqldump -u "+ userName +" -p"+ password +" "+ dbName +" -r "+backupFilePath;
-
-            System.out.println( backupCommand );
-
+            }
+            
             Runtime rt = Runtime.getRuntime();
             
             Process process = rt.exec( backupCommand );
@@ -121,6 +112,8 @@
             if( process.exitValue() == 0 )
             {
                 statusMessage = "Backup taken succussfully at : "+backupFilePath;
+                
+                status = "SUCCESS";
             }
             else
             {
@@ -130,12 +123,11 @@
         catch ( Exception e )
         {
             System.out.println("Exception : "+e.getMessage());
+            
             statusMessage = "Not able to take Backup, Please check MySQL configuration and SQL file path.";
         }
 
         return SUCCESS;
     }
 
-
-    
 }

=== modified file 'local/in/dhis-web-maintenance-in/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-maintenance-in/src/main/resources/META-INF/dhis/beans.xml	2010-06-17 07:51:57 +0000
+++ local/in/dhis-web-maintenance-in/src/main/resources/META-INF/dhis/beans.xml	2010-08-30 12:04:09 +0000
@@ -33,9 +33,6 @@
       <property name="configurationService">
         <ref bean="org.hisp.dhis.config.ConfigurationService"/>
       </property>
-      <property name="provider">
-        <ref bean="org.hisp.dhis.system.database.DatabaseInfoProvider"/>
-      </property>	  
   </bean>
 
   <bean id="org.hisp.dhis.config.action.StreamMySqlBackupAction"

=== modified file 'local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/configurationForm.vm'
--- local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/configurationForm.vm	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/configurationForm.vm	2010-08-30 12:04:09 +0000
@@ -1,5 +1,4 @@
 
-
 <h3>$i18n.getString( "Configuration" )</h3>
 <hr />
 <br /><br />

=== added directory 'local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/images'
=== added file 'local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/images/ajax-loader.gif'
Binary files local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/images/ajax-loader.gif	1970-01-01 00:00:00 +0000 and local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/images/ajax-loader.gif	2010-08-30 12:04:09 +0000 differ
=== added file 'local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/images/download-icon.jpg'
Binary files local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/images/download-icon.jpg	1970-01-01 00:00:00 +0000 and local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/images/download-icon.jpg	2010-08-30 12:04:09 +0000 differ
=== removed directory 'local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/javascript'
=== modified file 'local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/menu.vm'
--- local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/menu.vm	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/menu.vm	2010-08-30 12:04:09 +0000
@@ -1,8 +1,58 @@
+
+<style>
+	#overlay 
+	{
+		z-index:19998;
+		position:absolute;
+		top:0;
+		bottom:0;
+		left:0;
+		width:100%;
+		background:#000;
+		opacity:0.45;
+		-moz-opacity:0.45;
+		filter:alpha(opacity=45);
+		visibility:hidden;
+	}
+
+	#overlayImg{ width: 50px; height: 50px; z-index: 9999; position: absolute; left:50%}
+</style>
+
+<div id="overlay">
+	<div id="overlayImg"><img  width="50" height="50" src="images/ajax-loader.gif" /></div>
+</div>
+	
 <h2>Lookup Tables</h2>
 <ul>
     <li>Configure</li>
     <ul>
         <li><a href="configForm.action">Configuration</a></li>
-        <li><a href="takeMysqlBackupResult.action">Take MySQL Backup</a></li>
+        <li><a href="takeMysqlBackupResult.action" onclick="showOverlay()">Take MySQL Backup</a></li>
     </ul>
 </ul>
+
+<script>
+    
+	function showOverlay() 
+	{
+		var o = document.getElementById('overlay');
+		o.style.visibility = 'visible';
+		jQuery("#overlay").css({
+			"position":"fixed",
+            "top":0+"px",
+            "left":0+"px",
+			"height": jQuery(document).height(),
+			"width": jQuery(document).width()
+		});
+		jQuery("#overlayImg").css({
+			"top":jQuery(window).height()/2
+		});
+	}
+	
+	function hideOverlay() 
+	{
+		var o = document.getElementById('overlay');
+		o.style.visibility = 'hidden';
+	}
+
+</script>
\ No newline at end of file

=== removed file 'local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/takeMysqlBackupForm.vm'
--- local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/takeMysqlBackupForm.vm	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/takeMysqlBackupForm.vm	1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
-
-<h3>$i18n.getString( "Take MYSQL Backup" )</h3>
-<hr />
-<br /><br />
-<form id="takeMySQlForm" name="takeMySQlForm" action="takeMysqlBackupResult.action" method="post">
-	<table>
-		<tr>
-			<td><label>$i18n.getString( "BackupFile Path" )</label></td>
-			<td><input type="text" id="backupFilePath" name="backupFilePath" size="60" onchange="javscript:formatPath(this);" onload="javscript:formatPath(this);" /></td>		
-		</tr>
-		<tr>
-			<td>&nbsp;</td>
-			<td><input type="submit" value="Take Backup"/></td>
-		</tr>
-	</table>	
-</form>
-
-<script>
-	function formatPath(text)
-	{
-		var value = text.value;		
-		text.value = value.replace(/\\/g,"/");		
-	}
-</script>

=== modified file 'local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/takeMysqlBackupResult.vm'
--- local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/takeMysqlBackupResult.vm	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/takeMysqlBackupResult.vm	2010-08-30 12:04:09 +0000
@@ -1,7 +1,10 @@
 
-<div align="right"><a href="streamMySQLBackup.action?backupFilePath=$backupFilePath">Download</a></div>
 
 <br /><br />
 
-<h3>$statusMessage</h3>
+<h3>$encoder.xmlEncode( $statusMessage ) 
+	#if( $!status == "SUCCESS" ) 
+		<a href="streamMySQLBackup.action?backupFilePath=$backupFilePath"><img  width="60" height="50" src="images/download-icon.jpg" /></a> 
+	#end
+</h3>
 

=== modified file 'local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/welcome.vm'
--- local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/welcome.vm	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-maintenance-in/src/main/webapp/dhis-web-maintenance-in/welcome.vm	2010-08-30 12:04:09 +0000
@@ -1,2 +1,2 @@
 
-    <font face"Arial" color="blue"><H1>Home Page</H1></font>
\ No newline at end of file
+<font face"Arial" color="blue"><H1>Home Page</H1></font>
\ No newline at end of file