← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1495: create select excel template file when add/update report excel

 

------------------------------------------------------------
revno: 1495
committer: Tran Thanh Tri <Tran Thanh Tri@compaq>
branch nick: trunk
timestamp: Thu 2010-02-25 09:41:20 +0700
message:
  create select excel template file when add/update report excel
modified:
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelTemplateList.vm
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reports.js
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reports.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-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelTemplateList.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelTemplateList.vm	2010-02-24 17:47:59 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelTemplateList.vm	2010-02-25 02:41:20 +0000
@@ -20,20 +20,6 @@
 	</table>
 </form>
 
-<table width=100%>
-	<tr>
-		<td>
-			$i18n.getString( "filter_by_name" ): <input type="text" onkeyup="filterValues( this.value , 1)" style="width:300px"/>
-		</td>
-		<td>
-
-		</td>
-		<td align=right>
-			<input type="button" value="$i18n.getString( "cancel" )" onclick="window.location='administration.action'" style="width:100px"/>
-		</td>
-	</tr>
-</table>
-
 <table width="100%" class="listTable">
 	<thead>
 		<tr>

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reports.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reports.js	2010-02-23 04:26:05 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reports.js	2010-02-25 02:41:20 +0000
@@ -314,3 +314,34 @@
 		window.location.reload();	
 	}
 }
+
+function getListExcelTemplate()
+{
+	var request = new Request();
+    request.setResponseTypeXML( 'files' );
+    request.setCallbackSuccess( getListExcelTemplateReceived );
+	request.send( "getListExcelTemplateFile.action");	
+}
+
+function getListExcelTemplateReceived( files )
+{
+	var html = "<ul>";
+	var excels = files.getElementsByTagName( "file");
+	
+	for( var i=0;i<excels.length;i++){
+	
+		html += "<li onclick='selectExcelTemplate(this);'>" + excels[i].firstChild.nodeValue + "</li>";
+		
+	}
+	
+	html += "</ul>";
+	
+	byId("listExcelTemplate").innerHTML = html;
+	showById( 'listExcelTemplate' );
+}
+
+function selectExcelTemplate( li )
+{
+	byId( 'excelTemplateFile' ).value = li.innerHTML;
+	hideById( 'listExcelTemplate' );
+}

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reports.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reports.vm	2010-02-24 17:47:59 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reports.vm	2010-02-25 02:41:20 +0000
@@ -1,4 +1,4 @@
-<h3>$i18n.getString('reports')</h3>
+<h2>$i18n.getString('reports')</h2>
 <table width=100%>
 	<tr>
 		<td>
@@ -152,7 +152,10 @@
 		</tr>
 		<tr>
 			<td><label>$i18n.getString('excel_template')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-			<td><input type="text" id="excelTemplateFile"  style="width:20em"/></td>
+			<td>
+				<input type="text" id="excelTemplateFile"  style="width:18em"/>
+				<a href="javascript:getListExcelTemplate();"><img align="absmiddle" src="../images/excel.png" style="cursor:pointer;width:20px;"></a>
+			</td>
 		</tr>
 		<tr>
 			<td><label>$i18n.getString('report_type')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
@@ -361,6 +364,22 @@
 
 <span id="message" style="top:100px;right:5px;position:absolute;width:200px;z-index:10002" onclick="javascript:hideById(this.id);"></span>
 
+<div id="listExcelTemplate" style="overflow:auto;position:fixed;display:none;width:300px;z-index:10001;background-color: white;border: medium solid silver;height:500px;padding:5px;right:5px;top:5px;">
+	
+</div>	
+
+<style>
+div#listExcelTemplate ul li {
+	padding-top:10px;
+	cursor:pointer;
+}
+
+div#listExcelTemplate ul li:hover{
+	color:red;
+}
+</style>
+	
+