dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #05022
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1680: dhis-web-mobile: In progress... One Dataset/dataelements can be selected and customized for mobil...
------------------------------------------------------------
revno: 1680
committer: Saptarshi <sunbiz@xxxxxxxxx>
branch nick: trunk
timestamp: Sun 2010-03-21 15:27:54 +0100
message:
dhis-web-mobile: In progress... One Dataset/dataelements can be selected and customized for mobile application
added:
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javascript/createMobileApp.js
modified:
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/GetDataElementsAction.java
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/JarGeneratorAction.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/create.html
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/createMobileApp.vm
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/dataElementsResponse.vm
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/DHISMobile.java
--
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-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-18 00:21:22 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/CreateMobileAppAction.java 2010-03-21 14:27:54 +0000
@@ -26,7 +26,6 @@
* (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;
@@ -35,33 +34,35 @@
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;
-
private String[] availableDatasets;
-
- public String[] getSplashImg()
- {
- String webappPath = ServletActionContext.getServletContext().getRealPath( "/" );
+ private String mobileAppFilename;
+
+ public String getMobileAppFilename() {
+ String webappPath = ServletActionContext.getServletContext().getRealPath("/");
+ String appPath = webappPath + "/dhis-web-mobile/javame_src/target";
+ File appFile = new File(appPath, "dhis-javame-1.0.0-me.jar");
+ if (appFile.exists()) {
+ mobileAppFilename = appFile.getName();
+ }
+ return mobileAppFilename;
+ }
+
+ 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();
}
}
@@ -71,92 +72,67 @@
return splashImg;
}
- public String getMvnPath()
- {
- //long startTime = System.currentTimeMillis();
- String PATH = System.getenv( "PATH" );
+ public String getMvnPath() {
+ 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;
}
}
- //long endTime = System.currentTimeMillis();
- //System.out.println("OS = " + getOSName() + "; Total exec time=" + Long.toString(endTime - startTime) + "ms to find" + mvnPath);
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" ) )
- {
+ } else {
+ if (osName.equals("nix")) {
+ if (file.getName().equals("mvn")) {
filePath = file.getAbsolutePath();
break;
}
@@ -167,28 +143,22 @@
}
return filePath;
}
-
private DataSetService dataSetService;
- public void setDataSetService( DataSetService dataSetService )
- {
+ public void setDataSetService(DataSetService dataSetService) {
this.dataSetService = dataSetService;
}
-
private PeriodService periodService;
- public void setPeriodService( PeriodService periodService )
- {
+ public void setPeriodService(PeriodService periodService) {
this.periodService = periodService;
}
- public String[] getAvailableDatasets()
- {
+ public String[] getAvailableDatasets() {
int i = 0;
Collection<DataSet> allDataSets = dataSetService.getAllDataSets();
availableDatasets = new String[allDataSets.size()];
- for ( DataSet dataSet : allDataSets )
- {
+ for (DataSet dataSet : allDataSets) {
availableDatasets[i] = dataSet.getName();
i++;
}
@@ -197,8 +167,7 @@
@Override
public String execute()
- throws Exception
- {
+ throws Exception {
return SUCCESS;
}
}
=== modified 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 2010-03-18 00:21:22 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/GetDataElementsAction.java 2010-03-21 14:27:54 +0000
@@ -56,6 +56,10 @@
this.dataSetName = dataSetName;
}
+ public String getDataSetName(){
+ return this.dataSetName;
+ }
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -75,11 +79,6 @@
{
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-18 00:21:22 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/JarGeneratorAction.java 2010-03-21 14:27:54 +0000
@@ -43,6 +43,16 @@
private String mvnBin;
private String splash;
+ private String selectDataSet;
+ private String dataElements;
+
+ public void setDataElements(String dataElements) {
+ this.dataElements = dataElements;
+ }
+
+ public void setSelectDataSet(String selectDataSet) {
+ this.selectDataSet = selectDataSet;
+ }
public String getMvnBin() {
return mvnBin;
@@ -100,8 +110,11 @@
replaceStringInFile(dir, "DHISMobile.java", "\\w*.png", splash);
//For dataset
- //replaceStringInFile(dir, "DHISMobile.java", "", dataset);
-
+ replaceStringInFile(dir, "FormsListPage.java", "formNames\\[].*;", "formNames[] = {\"" + selectDataSet + "\"};");
+
+ //For dataElements
+ replaceStringInFile(dir, "DHISMobile.java", "dataElements =.*\\},\\{", "dataElements = {{" + dataElements + "},{");
+
//For language
//replaceStringInFile(dir, "DHISMobile.java", "", language);
=== 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-18 00:21:22 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/create.html 2010-03-21 14:27:54 +0000
@@ -1,95 +1,45 @@
<link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/util/css/redmond/jquery-ui.css">
<script type="text/javascript" src="../dhis-web-commons/util/jquery-ui.js"></script>
<script type="text/javascript" src="javascript/jquery-form.js"></script>
-<script type="text/javascript">
- $(document).ready(function() {
- $("#mvnDiv").hide();
- $("#accordion").accordion({
- collapsible: true
- });
- $("#splashUpdate input:radio:first").attr("checked","checked");
- var splashOptions = {
- url: 'splashUpload.action',
- target: '#splashUpdate',
- success: function(){
- $("#splashUpdate input:radio:first").attr("checked","checked");
- }
- }
- $("#splashForm").ajaxForm(splashOptions);
-
- var dataElementsOptions = {
- url: 'getDataElements.action',
- type: 'POST',
- success: function(responseXML){
- $("#dataElementsListDiv").append(responseXML);
- }
- }
- $("#dataSetForm").ajaxForm(dataElementsOptions);
- });
-
- function showPathField(){
- $("#mvnDiv").toggle(200);
- }
-
- function submitMvnForm(){
- $("#mvnForm").submit();
- }
-
- function submitJarGenerator(){
- var form = document.createElement("form");
- form.setAttribute("method", "get");
- form.setAttribute("action", "jarGenerator.action");
-
- var aField = document.createElement("input");
- aField.setAttribute("type", "radio");
- aField.setAttribute("name", "splash");
- aField.setAttribute("checked", "checked");
- aField.setAttribute("value", $('input[name=splash]:checked').val());
- form.appendChild(aField);
- var bField = document.createElement("input");
- bField.setAttribute("type", "text");
- bField.setAttribute("name", "mvnBin");
- bField.setAttribute("value", $("#mvnBin").attr("value"));
- form.appendChild(bField);
-
- document.body.appendChild(form);
- form.style.visibility = "hidden";
- form.submit();
- }
-
- function addDataSet(){
- $("#dataSetForm").submit();
- }
-
-</script>
-
-<h1>Create Mobile Application</h1>
-<div id="mvnStatusDiv">
- #set ($path = "$!mvnPath")
- #if($path != "")
- #set ($status = "$!mvnStatus")
- #if($status != "")
- <span style="color:red">$status</span> <br/>
- #end
- <img src="../images/check.png" alt="" /> Using mvn found in PATH at $path (<a href="javascript: showPathField()">Change</a>)<br/><br/>
- <div id="mvnDiv">
- <form id="mvnForm" method="post">
- Enter mvn Folder Path: <input name="mvnPath" type="text" value="$!mvnPath" size="40" />
- <input type="button" value="Set mvn Path" onclick="submitMvnForm()" />
- </form>
- </div>
- #else
- #set ($status = "$!mvnStatus")
- #if($status != "")
- <span style="color:red">$status</span>
- #end
- mvn not found... Please configure mvn location <br/>
- <form id="mvnForm" method="post">
- Enter mvn Folder Path: <input name="mvnPath" type="text" value="$!mvnPath" size="40" />
- <input type="button" value="Set mvn Path" onclick="submitMvnForm()" />
- </form>
- #end
-</div>
+<script type="text/javascript" src="javascript/createMobileApp.js"></script>
+<table width="100%">
+ <tr>
+ <td>
+ <h1>Create Mobile Application</h1>
+ <div id="mvnStatusDiv">
+ #set ($path = "$!mvnPath")
+ #if($path != "")
+ #set ($status = "$!mvnStatus")
+ #if($status != "")
+ <span style="color:red">$status</span> <br/>
+ #end
+ <img src="../images/check.png" alt="" /> Using mvn found in PATH at $path (<a href="javascript: showPathField()">Change</a>)<br/><br/>
+ <div id="mvnDiv">
+ <form id="mvnForm" method="post">
+ Enter mvn Folder Path: <input name="mvnPath" type="text" value="$!mvnPath" size="40" />
+ <input type="button" value="Set mvn Path" onclick="submitMvnForm()" />
+ </form>
+ </div>
+ #else
+ #set ($status = "$!mvnStatus")
+ #if($status != "")
+ <span style="color:red">$status</span>
+ #end
+ mvn not found... Please configure mvn location <br/>
+ <form id="mvnForm" method="post">
+ Enter mvn Folder Path: <input name="mvnPath" type="text" value="$!mvnPath" size="40" />
+ <input type="button" value="Set mvn Path" onclick="submitMvnForm()" />
+ </form>
+ #end
+ </div>
+ </td>
+ <td align="right">
+ #if ($mobileAppFilename)
+ <a href="javame_src/target/$mobileAppFilename">Download $mobileAppFilename</a>
+ #end
+ </td>
+ </tr>
+</table>
<input id="mvnBin" style=" visibility: hidden" name="mvnBin" value="$path"/>
<div id="accordion">
@@ -146,6 +96,6 @@
</div>
<h3><a href="#">Step 5: Generate Application</a></h3>
<div id="jarGenerator">
- <input type="button" value="Generate Mobile Application" onclick="submitJarGenerator()" />
+ <input id="genButton" type="button" value="Generate Mobile Application" onclick="submitJarGenerator()" />
</div>
</div>
\ 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-18 00:21:22 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/createMobileApp.vm 2010-03-21 14:27:54 +0000
@@ -1,95 +1,45 @@
<link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/util/css/redmond/jquery-ui.css">
<script type="text/javascript" src="../dhis-web-commons/util/jquery-ui.js"></script>
<script type="text/javascript" src="javascript/jquery-form.js"></script>
-<script type="text/javascript">
- $(document).ready(function() {
- $("#mvnDiv").hide();
- $("#accordion").accordion({
- collapsible: true
- });
- $("#splashUpdate input:radio:first").attr("checked","checked");
- var splashOptions = {
- url: 'splashUpload.action',
- target: '#splashUpdate',
- success: function(){
- $("#splashUpdate input:radio:first").attr("checked","checked");
- }
- }
- $("#splashForm").ajaxForm(splashOptions);
-
- var dataElementsOptions = {
- url: 'getDataElements.action',
- type: 'POST',
- success: function(responseXML){
- $("#dataElementsListDiv").append(responseXML);
- }
- }
- $("#dataSetForm").ajaxForm(dataElementsOptions);
- });
-
- function showPathField(){
- $("#mvnDiv").toggle(200);
- }
-
- function submitMvnForm(){
- $("#mvnForm").submit();
- }
-
- function submitJarGenerator(){
- var form = document.createElement("form");
- form.setAttribute("method", "get");
- form.setAttribute("action", "jarGenerator.action");
-
- var aField = document.createElement("input");
- aField.setAttribute("type", "radio");
- aField.setAttribute("name", "splash");
- aField.setAttribute("checked", "checked");
- aField.setAttribute("value", $('input[name=splash]:checked').val());
- form.appendChild(aField);
- var bField = document.createElement("input");
- bField.setAttribute("type", "text");
- bField.setAttribute("name", "mvnBin");
- bField.setAttribute("value", $("#mvnBin").attr("value"));
- form.appendChild(bField);
-
- document.body.appendChild(form);
- form.style.visibility = "hidden";
- form.submit();
- }
-
- function addDataSet(){
- $("#dataSetForm").submit();
- }
-
-</script>
-
-<h1>Create Mobile Application</h1>
-<div id="mvnStatusDiv">
- #set ($path = "$!mvnPath")
- #if($path != "")
- #set ($status = "$!mvnStatus")
- #if($status != "")
- <span style="color:red">$status</span> <br/>
- #end
- <img src="../images/check.png" alt="" /> Using mvn found in PATH at $path (<a href="javascript: showPathField()">Change</a>)<br/><br/>
- <div id="mvnDiv">
- <form id="mvnForm" method="post">
- Enter mvn Folder Path: <input name="mvnPath" type="text" value="$!mvnPath" size="40" />
- <input type="button" value="Set mvn Path" onclick="submitMvnForm()" />
- </form>
- </div>
- #else
- #set ($status = "$!mvnStatus")
- #if($status != "")
- <span style="color:red">$status</span>
- #end
- mvn not found... Please configure mvn location <br/>
- <form id="mvnForm" method="post">
- Enter mvn Folder Path: <input name="mvnPath" type="text" value="$!mvnPath" size="40" />
- <input type="button" value="Set mvn Path" onclick="submitMvnForm()" />
- </form>
- #end
-</div>
+<script type="text/javascript" src="javascript/createMobileApp.js"></script>
+<table width="100%">
+ <tr>
+ <td>
+ <h1>Create Mobile Application</h1>
+ <div id="mvnStatusDiv">
+ #set ($path = "$!mvnPath")
+ #if($path != "")
+ #set ($status = "$!mvnStatus")
+ #if($status != "")
+ <span style="color:red">$status</span> <br/>
+ #end
+ <img src="../images/check.png" alt="" /> Using mvn found in PATH at $path (<a href="javascript: showPathField()">Change</a>)<br/><br/>
+ <div id="mvnDiv">
+ <form id="mvnForm" method="post">
+ Enter mvn Folder Path: <input name="mvnPath" type="text" value="$!mvnPath" size="40" />
+ <input type="button" value="Set mvn Path" onclick="submitMvnForm()" />
+ </form>
+ </div>
+ #else
+ #set ($status = "$!mvnStatus")
+ #if($status != "")
+ <span style="color:red">$status</span>
+ #end
+ mvn not found... Please configure mvn location <br/>
+ <form id="mvnForm" method="post">
+ Enter mvn Folder Path: <input name="mvnPath" type="text" value="$!mvnPath" size="40" />
+ <input type="button" value="Set mvn Path" onclick="submitMvnForm()" />
+ </form>
+ #end
+ </div>
+ </td>
+ <td align="right">
+ #if ($mobileAppFilename)
+ <a href="javame_src/target/$mobileAppFilename">Download $mobileAppFilename</a>
+ #end
+ </td>
+ </tr>
+</table>
<input id="mvnBin" style=" visibility: hidden" name="mvnBin" value="$path"/>
<div id="accordion">
@@ -146,6 +96,6 @@
</div>
<h3><a href="#">Step 5: Generate Application</a></h3>
<div id="jarGenerator">
- <input type="button" value="Generate Mobile Application" onclick="submitJarGenerator()" />
+ <input id="genButton" type="button" value="Generate Mobile Application" onclick="submitJarGenerator()" />
</div>
</div>
\ No newline at end of file
=== modified 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 2010-03-18 00:21:22 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/dataElementsResponse.vm 2010-03-21 14:27:54 +0000
@@ -1,4 +1,4 @@
-<select multiple="false" style="width: 250px; height: 180px;">
+<select name="dataSet" id="$dataSetName" multiple="false" style="width: 250px; height: 180px;">
#foreach( $dataElement in $dataElements )
<option value="$dataElement.id">$dataElement.name</option>
#end
=== modified file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/DHISMobile.java'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/DHISMobile.java 2010-03-09 17:32:56 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/DHISMobile.java 2010-03-21 14:27:54 +0000
@@ -22,10 +22,7 @@
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc=" Declarations: Program Flow ">
- private static String[][] dataElements = {{"Total No. of Pregnant Women", "No. Registered Within 1st Trimester",
- "No. of New Women Registered Under JSY", "No. of Women Received 3 ANC Checkup",
- "No. of Women Given TT1", "No. of Women Given TT2 / Booster", "No. of Women Given 100 IFA Tablets",
- "New Pregnant Women with Hypertension", "No. of Pregnant Women Having HB < 11"},{""},};
+ private static String[][] dataElements = {{"Total No. of Pregnant Women", "No. Registered Within 1st Trimester", "No. of New Women Registered Under JSY", "No. of Women Received 3 ANC Checkup", "No. of Women Given TT1", "No. of Women Given TT2 / Booster", "No. of Women Given 100 IFA Tablets", "New Pregnant Women with Hypertension", "No. of Pregnant Women Having HB < 11"},{""},};
private static final FormsListPage formListPage = new FormsListPage();
private static final PeriodPage periodPage = new PeriodPage();
private static final DatasetPage datasetPage = new DatasetPage(dataElements[0]);
=== added file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javascript/createMobileApp.js'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javascript/createMobileApp.js 1970-01-01 00:00:00 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javascript/createMobileApp.js 2010-03-21 14:27:54 +0000
@@ -0,0 +1,77 @@
+$(document).ready(function() {
+ $("#mvnDiv").hide();
+ $("#accordion").accordion({
+ collapsible: true
+ });
+ $("#splashUpdate input:radio:first").attr("checked","checked");
+ var splashOptions = {
+ url: 'splashUpload.action',
+ target: '#splashUpdate',
+ success: function(){
+ $("#splashUpdate input:radio:first").attr("checked","checked");
+ }
+ }
+ $("#splashForm").ajaxForm(splashOptions);
+
+ var dataElementsOptions = {
+ url: 'getDataElements.action',
+ type: 'POST',
+ target: '#dataElementsListDiv'
+ /* TODO: Multiple datasets
+ success: function(responseXML){
+ $("#dataElementsListDiv").append(responseXML);
+ }*/
+ }
+ $("#dataSetForm").ajaxForm(dataElementsOptions);
+});
+
+function showPathField(){
+ $("#mvnDiv").toggle(200);
+}
+
+function submitMvnForm(){
+ $("#mvnForm").submit();
+}
+
+function submitJarGenerator(){
+ var form = document.createElement("form");
+ form.style.visibility = "hidden";
+ form.setAttribute("method", "post");
+ form.setAttribute("action", "jarGenerator.action");
+
+ var aField = document.createElement("input");
+ aField.setAttribute("type", "radio");
+ aField.setAttribute("name", "splash");
+ aField.setAttribute("checked", "checked");
+ aField.setAttribute("value", $("input[name=splash]:checked").val());
+ form.appendChild(aField);
+ var bField = document.createElement("input");
+ bField.setAttribute("type", "text");
+ bField.setAttribute("name", "mvnBin");
+ bField.setAttribute("value", $("#mvnBin").attr("value"));
+ form.appendChild(bField);
+ var cField = document.createElement("input");
+ cField.setAttribute("type", "text");
+ cField.setAttribute("name", "selectDataSet");
+ cField.setAttribute("value", $("select[name=dataSet]").attr('id'));
+ form.appendChild(cField);
+ var deStr="";
+ $("select[name=dataSet] option").each(function(){
+ deStr += "\""+$(this).text()+"\",";
+ });
+ deStr = deStr.substring(0,deStr.length-1)
+ var dField = document.createElement("input");
+ dField.setAttribute("type", "text");
+ dField.setAttribute("name", "dataElements");
+ dField.setAttribute("value", deStr);
+ form.appendChild(dField);
+
+ document.body.appendChild(form);
+ form.submit();
+
+ $("#genButton").attr('disabled', 'disabled');
+}
+
+function addDataSet(){
+ $("#dataSetForm").submit();
+}
\ No newline at end of file