pari: branch aadk r669 - in /branches/aadk/config: ./ scripts/

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Mon Apr 16 08:57:48 MST 2007


Author: pari
Date: Mon Apr 16 10:57:47 2007
New Revision: 669

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=669
Log:
upload new uImages and apply uimage after uploading

Added:
    branches/aadk/config/upload2.html
Modified:
    branches/aadk/config/flashupdate.html
    branches/aadk/config/scripts/astman.js

Modified: branches/aadk/config/flashupdate.html
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/config/flashupdate.html?view=diff&rev=669&r1=668&r2=669
==============================================================================
--- branches/aadk/config/flashupdate.html (original)
+++ branches/aadk/config/flashupdate.html Mon Apr 16 10:57:47 2007
@@ -24,11 +24,26 @@
 <link href="stylesheets/rico.css" media="all" rel="Stylesheet" type="text/css" />
 <link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
 <script>
+var uImage_filename;
+
+function execute_applyuimage(){
+	gui_feedback('Upgrading firmware','blue', 30000 );
+	_$('status_message').style.display = "";
+
+	parent.astmanEngine.run_tool(asterisk_guiapplyUimage + " " + asterisk_guiUploads_path_appliance + uImage_filename , onSuccess = function() {
+			_$('status_message').style.display = "none";
+			gui_feedback('Firmware upgraded','green', 5000 );
+			gui_alert("Finished upgrading firmware <BR> reboot to boot with new firmware");
+		}
+	);
+}
+
 
 
 function localajaxinit(){
 	_$('updatetype_http').checked = true;
 	switch_httptftp('h');
+	showdiv_statusmessage();
 	parent.loadscreen(this);
 }
 
@@ -62,14 +77,16 @@
 		return false;
 	}
 
+        _$('status_message').style.display = "";
+	gui_feedback('Please do not reboot .. firmware update in progress','blue', 180000 ); // will be soon replaced by a countdown
+
 	if( h.checked ){ 
 		parent.astmanEngine.run_tool("flashupdate " + hu.value , onSuccess = function() {
-				gui_alert("Please reboot system after 5 minutes");
+				gui_alert("Done .. You Can reboot");
 			}
 		);
 		return;
 	}
-
 
 	if( t.checked ){
 		if( _$('tftp_filename').value.length ){
@@ -77,8 +94,9 @@
 		}else{
 			var fname = "" ;
 		}
+
 		parent.astmanEngine.run_tool("flashupdate tftp " + tu.value + fname, onSuccess = function() {
-				gui_alert("Please reboot system after 5 minutes");
+				gui_alert("Done .. You Can reboot");
 			}
 		);
 		return;
@@ -99,42 +117,40 @@
 		<td align=left>
 			<BR>
 			<fieldset>
-				<legend><B>&nbsp;Download image from a :&nbsp;</B></legend>
-				<LABEL FOR="updatetype_http">
-					<input type=radio id="updatetype_http" name="updatetype" value="HTTP" onchange="switch_httptftp('h');"> HTTP URL
-				</LABEL>
-				&nbsp;&nbsp;&nbsp;&nbsp;
-				<LABEL FOR="updatetype_tftp">
-					<input type=radio id="updatetype_tftp" name="updatetype" value="TFTP" onchange="switch_httptftp('t');"> TFTP Server
-				</LABEL>
+			<legend><B>&nbsp;Download image from a :&nbsp;</B></legend>
+			<LABEL FOR="updatetype_http">
+				<input type=radio id="updatetype_http" name="updatetype" value="HTTP" onchange="switch_httptftp('h');"> HTTP URL
+			</LABEL>
+			&nbsp;&nbsp;&nbsp;&nbsp;
+			<LABEL FOR="updatetype_tftp">
+				<input type=radio id="updatetype_tftp" name="updatetype" value="TFTP" onchange="switch_httptftp('t');"> TFTP Server
+			</LABEL>
+			<table>
+				<tr id="tr_1">
+					<td align=right>HTTP URL :</td>
+					<td> <input id="httpurl" size=35> </td>
+				</tr>
+				<tr id="tr_2">
+					<td align=right>TFTP Server :</td>
+					<td><input id="tftpurl" size=35></td>
+				</tr>
+				<tr id="tr_3">
+					<td align=right>File Name :</td>
+					<td><input id="tftp_filename" size=25></td>
+				</tr>
+			</table>
+			<BR>
+			<input type="button" id="Update_Image" onclick="call_flashupdate();" value="Go">
 			</fieldset>
 		</td>
 		</tr>
 		<tr>
-		<td>	<BR>
+		<td align=center>
 			<fieldset>
-				<legend><B>&nbsp;Details :&nbsp;</B></legend>
-				<table>
-					<tr id="tr_1">	
-						<td align=right>HTTP URL :</td>
-						<td> <input id="httpurl" size=35> </td>
-					</tr>
-					<tr id="tr_2">
-						<td align=right>TFTP Server :</td>
-						<td><input id="tftpurl" size=35></td>
-					</tr>
-					<tr id="tr_3">
-						<td align=right>File Name :</td>
-						<td><input id="tftp_filename" size=25></td>
-					</tr>					 
-				</table>
+				<legend><B>&nbsp;Upload a new image :&nbsp;</B></legend>
+			<IFRAME src="upload2.html" id="uploadiframe" width="300" height="100" frameborder="0" border="0" marginheight="0" marginwidth="0"></IFRAME>
 			</fieldset>
 		</td>
-		</tr>
-		<tr>	<td align=center>
-				<BR>
-				<input type="button" id="Update_Image" onclick="call_flashupdate();" value="Update">			
-			</td>
 		</tr>
 		</table>
 	</td>

Modified: branches/aadk/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/config/scripts/astman.js?view=diff&rev=669&r1=668&r2=669
==============================================================================
--- branches/aadk/config/scripts/astman.js (original)
+++ branches/aadk/config/scripts/astman.js Mon Apr 16 10:57:47 2007
@@ -36,6 +36,8 @@
 var asterisk_guiConfigFile = "guipreferences.conf"; // will be created in asterisk_configfolder, if the file does not exist 
 var asterisk_configfolder = "/etc/asterisk/";
 var asterisk_guiListFiles = "sh /etc/asterisk/scripts/listfiles" ;
+var asterisk_guiapplyUimage = "sh /etc/asterisk/scripts/applyuimage" ;
+var asterisk_guiUploads_path_appliance = "/var/lib/asterisk/sounds/uploads/" ;
 
 var sortbynames = false;
 var dragdata = new Object;

Added: branches/aadk/config/upload2.html
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/config/upload2.html?view=auto&rev=669
==============================================================================
--- branches/aadk/config/upload2.html (added)
+++ branches/aadk/config/upload2.html Mon Apr 16 10:57:47 2007
@@ -1,0 +1,30 @@
+<script>
+
+function test(){
+	var fullpath = document.getElementById("uf1").value ;
+	if(!fullpath){
+		alert("Please select a uImage file to upload");
+		return;
+	}
+	var a = fullpath.lastIndexOf("\\");
+	if (a == -1){
+		var a = fullpath.lastIndexOf("/");
+	}
+	parent.uImage_filename = fullpath.substr(a+1); 
+        parent._$('status_message').style.display = "";
+        document.getElementById('form22').submit();
+}
+
+
+function hidetheupload(){
+        parent._$('uploadiframe').style.display="none";
+        parent._$('status_message').style.display = "none";
+        parent.gui_feedback("File Uploaded");
+	parent.execute_applyuimage();
+}
+</script>
+<body onunload="hidetheupload()">
+<FORM method="POST" action="/uploads" enctype="multipart/form-data" id="form22">
+        Choose a uImage file to upload: <input name="uploadedfile1" type="file" id="uf1"> <BR>
+        <input type="button" value="Upload Image" onclick="test();">
+</FORM>



More information about the asterisk-gui-commits mailing list