pari: branch aadk r706 - in /branches/aadk/config: flashupdate.html upload2.html

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Wed Apr 18 14:27:41 MST 2007


Author: pari
Date: Wed Apr 18 16:27:41 2007
New Revision: 706

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=706
Log:
Check if post_mappings are defined in http.conf, Compact Flash is mounted, if mounted create a uploads folder on C.F 

Modified:
    branches/aadk/config/flashupdate.html
    branches/aadk/config/upload2.html

Modified: branches/aadk/config/flashupdate.html
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/config/flashupdate.html?view=diff&rev=706&r1=705&r2=706
==============================================================================
--- branches/aadk/config/flashupdate.html (original)
+++ branches/aadk/config/flashupdate.html Wed Apr 18 16:27:41 2007
@@ -46,7 +46,43 @@
 	_$('updatetype_http').checked = true;
 	switch_httptftp('h');
 	showdiv_statusmessage();
-	parent.loadscreen(this);
+	config2json('http.conf', 1, httpconfloaded ) ;
+}
+
+function httpconfloaded(b){ // check if post_mappings defined in http.conf
+	var c = eval('(' + b + ')');
+	var ispmdefined = 0;
+
+	for( var d in c ){
+		if ( c.hasOwnProperty(d) && d == 'post_mappings'  ) {
+			ispmdefined = 1;	
+		}
+	}
+
+	if(!ispmdefined){
+		_$('tdupload').style.display="none";
+		parent.loadscreen(this);
+		return;
+	}
+
+	parent.astmanEngine.run_tool( asterisk_guiSysInfo, callback = function() { // check it C.F is mounted
+		var opt = { method: 'get', asynchronous: true,
+			onComplete: function(originalRequest){
+				_$('sysinfohtml').innerHTML = originalRequest.responseText;
+				parent.loadscreen(this);
+				if( $('cf_status').innerHTML == "1"){ // if C.F is mounted, created an uploads folder
+					parent.astmanEngine.run_tool("mkdir -p /var/lib/asterisk/sounds/uploads", callback = function() {}); 
+				}else{ // C.F not mounted 
+					gui_alert("You need a Compact Flash to use this feature");
+					_$('tdupload').style.display="none";
+				}
+			},
+			onFailure: function(t) { alert("Error: " + t.status + ": " + t.statusText); }
+		};
+		opt.parameters="";
+		var tmp = new Ajax.Request( asterisk_guiSysInfo_output, opt);
+	});
+
 }
 
 
@@ -153,7 +189,7 @@
 		</td>
 		</tr>
 		<tr>
-		<td align=center>
+		<td align=center id="tdupload">
 			<BR>
 			<fieldset>
 				<legend><B>&nbsp;Upload a new image :&nbsp;</B></legend>
@@ -167,4 +203,5 @@
 </tr>
 </table>
 </div>
+<div id="sysinfohtml" style="display:none"></div>
 </body>

Modified: branches/aadk/config/upload2.html
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/config/upload2.html?view=diff&rev=706&r1=705&r2=706
==============================================================================
--- branches/aadk/config/upload2.html (original)
+++ branches/aadk/config/upload2.html Wed Apr 18 16:27:41 2007
@@ -13,11 +13,6 @@
 		a = fullpath.lastIndexOf("/");
 	}
 	parent.uImage_filename = fullpath.substr(a+1); 
-
-	// here we should check if the 
-	//	[*] C.F is mounted 
-	//	[*] there are proper post_mappings defined in http.conf
-	//	[*] whether the uploads folder is there on the C.F
 
         parent._$('status_message').style.display = "";
 	parent.gui_feedback('File Upload in progress, please wait','default', 300000 );



More information about the asterisk-gui-commits mailing list