=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/add.png' Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/add.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/add.png 2010-03-18 00:21:22 +0000 differ === modified file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/CreateMobileAppAction.java' --- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/CreateMobileAppAction.java 2010-03-09 17:32:56 +0000 +++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/CreateMobileAppAction.java 2010-03-18 00:21:22 +0000 @@ -26,27 +26,42 @@ * (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 com.opensymphony.xwork2.Action; import java.io.File; +import java.util.Collection; import org.apache.struts2.ServletActionContext; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.period.PeriodService; -public class CreateMobileAppAction implements Action { +public class CreateMobileAppAction implements Action +{ private String mvnPath; + private String mvnStatus; + private String[] splashImg; - public String[] getSplashImg() { - String webappPath = ServletActionContext.getServletContext().getRealPath("/"); + private String[] availableDatasets; + + public String[] getSplashImg() + { + String webappPath = ServletActionContext.getServletContext().getRealPath( "/" ); String imgPath = webappPath + "/dhis-web-mobile/javame_src/src/main/resources/splash"; - File imgFolder = new File(imgPath); + File imgFolder = new File( imgPath ); File[] images; - if (imgFolder.exists()) { - if (imgFolder.isDirectory()) { + if ( imgFolder.exists() ) + { + if ( imgFolder.isDirectory() ) + { images = imgFolder.listFiles(); String[] imageNames = new String[images.length]; - for (int i = 0; i < images.length; i++) { - if (images[i].getName().contains(".png")) { + for ( int i = 0; i < images.length; i++ ) + { + if ( images[i].getName().contains( ".png" ) ) + { imageNames[i] = images[i].getName(); } } @@ -56,19 +71,24 @@ return splashImg; } - public String getMvnPath() { + public String getMvnPath() + { //long startTime = System.currentTimeMillis(); - String PATH = System.getenv("PATH"); + String PATH = System.getenv( "PATH" ); String[] locations; - if (getOSName().equals("win")) { - locations = PATH.split(";"); - } else { - locations = PATH.split(":"); + if ( getOSName().equals( "win" ) ) + { + locations = PATH.split( ";" ); + } else + { + locations = PATH.split( ":" ); } - for (String location : locations) { - File folder = new File(location); - String filePath = scanPath(getOSName(), folder); - if (!filePath.equals("")) { + for ( String location : locations ) + { + File folder = new File( location ); + String filePath = scanPath( getOSName(), folder ); + if ( !filePath.equals( "" ) ) + { mvnPath = filePath; break; } @@ -78,49 +98,68 @@ return mvnPath; } - public void setMvnPath(String path) { - File mvnFolder = new File(path); - String filePath = scanPath(getOSName(), mvnFolder); - if (!filePath.equals("")) { + public void setMvnPath( String path ) + { + File mvnFolder = new File( path ); + String filePath = scanPath( getOSName(), mvnFolder ); + if ( !filePath.equals( "" ) ) + { this.mvnPath = filePath; - } else { + } else + { mvnStatus = "Could not find mvn.bat at the location you entered"; } } - public String getMvnStatus() { + public String getMvnStatus() + { return mvnStatus; } - public void setMvnStatus(String status) { + public void setMvnStatus( String status ) + { this.mvnStatus = status; } - private String getOSName() { + private String getOSName() + { String osName; - if (System.getProperty("os.name").toLowerCase().contains("windows")) { + if ( System.getProperty( "os.name" ).toLowerCase().contains( "windows" ) ) + { osName = "win"; - } else { + } else + { osName = "nix"; } return osName; } - private String scanPath(String osName, File folder) { + private String scanPath( String osName, File folder ) + { String filePath = new String(); - if (folder.exists()) { - if (folder.isDirectory()) { + if ( folder.exists() ) + { + if ( folder.isDirectory() ) + { File[] files = folder.listFiles(); - for (File file : files) { - if (osName.equals("win")) { - if (file.getName().equals("mvn.bat")) { + for ( File file : files ) + { + if ( osName.equals( "win" ) ) + { + if ( file.getName().equals( "mvn.bat" ) ) + { filePath = file.getAbsolutePath(); break; } - } else if (osName.equals("nix")) { - if (file.getName().equals("mvn")) { - filePath = file.getAbsolutePath(); - break; + } else + { + if ( osName.equals( "nix" ) ) + { + if ( file.getName().equals( "mvn" ) ) + { + filePath = file.getAbsolutePath(); + break; + } } } } @@ -129,10 +168,37 @@ return filePath; } + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + private PeriodService periodService; + + public void setPeriodService( PeriodService periodService ) + { + this.periodService = periodService; + } + + public String[] getAvailableDatasets() + { + int i = 0; + Collection allDataSets = dataSetService.getAllDataSets(); + availableDatasets = new String[allDataSets.size()]; + for ( DataSet dataSet : allDataSets ) + { + availableDatasets[i] = dataSet.getName(); + i++; + } + return availableDatasets; + } + @Override public String execute() - throws Exception { - + throws Exception + { return SUCCESS; } } === added file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/GetDataElementsAction.java' --- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/GetDataElementsAction.java 1970-01-01 00:00:00 +0000 +++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/GetDataElementsAction.java 2010-03-18 00:21:22 +0000 @@ -0,0 +1,85 @@ +/* + * 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. + */ +package org.hisp.dhis.mobile.app.action; + + +import com.opensymphony.xwork2.Action; +import java.util.Collection; +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; + +public class GetDataElementsAction implements Action +{ + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + private String dataSetName; + + public void setDataSetName( String dataSetName ) + { + this.dataSetName = dataSetName; + } + + // ------------------------------------------------------------------------- + // Output + // ------------------------------------------------------------------------- + private Collection dataElements; + + public Collection getDataElements() + { + return dataElements; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + @Override + public String execute() + throws Exception + { + DataSet dataSet = dataSetService.getDataSetByName( dataSetName ); + dataElements = dataSet.getDataElements(); + for ( DataElement de : dataElements ) + { + System.out.println( "DataElement = " + de.getName() ); + } + System.out.println( "===================================" ); + return SUCCESS; + } +} === modified file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/JarGeneratorAction.java' --- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/JarGeneratorAction.java 2010-03-09 17:32:56 +0000 +++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/JarGeneratorAction.java 2010-03-18 00:21:22 +0000 @@ -94,12 +94,19 @@ public String execute() throws Exception { String webappPath = ServletActionContext.getServletContext().getRealPath("/"); String javameSrc = webappPath + "/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile"; - File dir = new File(javameSrc); + + //For splash screen replaceStringInFile(dir, "DHISMobile.java", "\\w*.png", splash); - System.out.println("MVN BIN = " + mvnBin); - System.out.println("Full Exec: " + mvnBin + " install " + "-f " + ServletActionContext.getServletContext().getRealPath("/") + "/dhis-web-mobile/javame_src/pom.xml"); + //For dataset + //replaceStringInFile(dir, "DHISMobile.java", "", dataset); + + //For language + //replaceStringInFile(dir, "DHISMobile.java", "", language); + + //For patient-program stage + //replaceStringInFile(dir, "DHISMobile.java", "", patient_program); ProcessBuilder pb = new ProcessBuilder(mvnBin, "install", "-f", ServletActionContext.getServletContext().getRealPath("/") + "/dhis-web-mobile/javame_src/pom.xml"); pb.redirectErrorStream(true); === modified file 'dhis-mobile/dhis-web-mobile/src/main/resources/META-INF/dhis/beans.xml' --- dhis-mobile/dhis-web-mobile/src/main/resources/META-INF/dhis/beans.xml 2010-03-09 17:32:56 +0000 +++ dhis-mobile/dhis-web-mobile/src/main/resources/META-INF/dhis/beans.xml 2010-03-18 00:21:22 +0000 @@ -12,6 +12,14 @@ + + + + + + - - + - - + === modified file 'dhis-mobile/dhis-web-mobile/src/main/resources/struts.xml' --- dhis-mobile/dhis-web-mobile/src/main/resources/struts.xml 2010-03-09 17:32:56 +0000 +++ dhis-mobile/dhis-web-mobile/src/main/resources/struts.xml 2010-03-18 00:21:22 +0000 @@ -19,6 +19,11 @@ /dhis-web-mobile/menu.vm + + /dhis-web-mobile/dataElementsResponse.vm + plainTextError + + /dhis-web-mobile/splashUploadResponse.vm plainTextError === modified file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/create.html' --- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/create.html 2010-03-09 17:32:56 +0000 +++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/create.html 2010-03-18 00:21:22 +0000 @@ -8,14 +8,23 @@ collapsible: true }); $("#splashUpdate input:radio:first").attr("checked","checked"); - var options = { + var splashOptions = { url: 'splashUpload.action', target: '#splashUpdate', success: function(){ $("#splashUpdate input:radio:first").attr("checked","checked"); } } - $("#splashForm").ajaxForm(options); + $("#splashForm").ajaxForm(splashOptions); + + var dataElementsOptions = { + url: 'getDataElements.action', + type: 'POST', + success: function(responseXML){ + $("#dataElementsListDiv").append(responseXML); + } + } + $("#dataSetForm").ajaxForm(dataElementsOptions); }); function showPathField(){ @@ -48,6 +57,10 @@ form.submit(); } + function addDataSet(){ + $("#dataSetForm").submit(); + } +

Create Mobile Application

@@ -105,11 +118,23 @@

Step 2: Dataset Selection

+
+ + + +
+
+

Step 3: Set Pages

+

-

Step 3: Select Language Or Translate Data Elements

+

Step 4: Select Language Or Translate Data Elements

@@ -119,8 +144,8 @@
-

Step 4: Generate Application

-
- -
+

Step 5: Generate Application

+
+ +
\ No newline at end of file === modified file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/createMobileApp.vm' --- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/createMobileApp.vm 2010-03-09 17:32:56 +0000 +++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/createMobileApp.vm 2010-03-18 00:21:22 +0000 @@ -8,14 +8,23 @@ collapsible: true }); $("#splashUpdate input:radio:first").attr("checked","checked"); - var options = { + var splashOptions = { url: 'splashUpload.action', target: '#splashUpdate', success: function(){ $("#splashUpdate input:radio:first").attr("checked","checked"); } } - $("#splashForm").ajaxForm(options); + $("#splashForm").ajaxForm(splashOptions); + + var dataElementsOptions = { + url: 'getDataElements.action', + type: 'POST', + success: function(responseXML){ + $("#dataElementsListDiv").append(responseXML); + } + } + $("#dataSetForm").ajaxForm(dataElementsOptions); }); function showPathField(){ @@ -48,6 +57,10 @@ form.submit(); } + function addDataSet(){ + $("#dataSetForm").submit(); + } +

Create Mobile Application

@@ -105,11 +118,23 @@

Step 2: Dataset Selection

+
+ + + +
+
+

Step 3: Set Pages

+

-

Step 3: Select Language Or Translate Data Elements

+

Step 4: Select Language Or Translate Data Elements

@@ -119,8 +144,8 @@
-

Step 4: Generate Application

-
- -
+

Step 5: Generate Application

+
+ +
\ No newline at end of file === added file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/dataElementsResponse.vm' --- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/dataElementsResponse.vm 1970-01-01 00:00:00 +0000 +++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/dataElementsResponse.vm 2010-03-18 00:21:22 +0000 @@ -0,0 +1,5 @@ + \ No newline at end of file