markster: trunk r23 - in /trunk/config: ./ scripts/

asterisk-gui-commits at lists.digium.internal asterisk-gui-commits at lists.digium.internal
Mon Sep 11 16:53:02 CDT 2006


Author: markster
Date: Mon Sep 11 16:53:02 2006
New Revision: 23

URL: http://svn.digium.com/view/asterisk-gui?rev=23&view=rev
Log:
More appliance updates

Added:
    trunk/config/appliance.html   (with props)
    trunk/config/homeapp.html   (with props)
Modified:
    trunk/config/numberplan.html
    trunk/config/scripts/astman.js
    trunk/config/trunks.html

Added: trunk/config/appliance.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/appliance.html?rev=23&view=auto
==============================================================================
--- trunk/config/appliance.html (added)
+++ trunk/config/appliance.html Mon Sep 11 16:53:02 2006
@@ -1,0 +1,207 @@
+<!--
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Top level for configuration GUI
+ *
+ * Copyright (C) 1999 - 2006, Digium, Inc.
+ *
+ * Mark Spencer <markster at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ *
+-->
+
+<script src="scripts/prototype.js"></script>
+<script src="scripts/rico.js"></script>
+<script src="scripts/astman.js"></script>
+<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>
+	PanelDef = Class.create();
+	PanelDef.prototype = {
+		initialize: function(name, label, icon, content) {
+			this.name = name;
+			this.label = label;
+			this.icon = icon;
+			this.content = content;
+		}
+	}
+	var panels = new Array;
+	var eventeater = new Object;
+	var loggedon = -1;
+	var started = 0;
+	var accordion;
+	var copyright = "Copyright &copy;2006 Digium, Inc.  All Rights Reserved. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
+
+
+	eventeater.eventcb = function(msgs) {
+		if (loggedon == 1)
+			astmanEngine.pollEvents();
+	}
+
+	panels.push( 
+
+		new PanelDef("homeapp", "Home", "home.png",
+			"Welcome to the Asterisk Business Edition configuration portal!  This portal " +
+			"is designed to simplify Asterisk configuration for new users of Asterisk " +
+			"Business Edition."),
+
+		new PanelDef("users", "Users", "accordion-icon.gif",
+			"Users is a short cut for quickly adding and removing all the necessary " +
+			"configuration components for any new phone."),
+
+		new PanelDef("meetme", "Conferencing", "accordion-icon.gif",
+			"MeetMe conference bridging allow quick, ad-hoc conferences with or without " +
+			"security."),
+
+		new PanelDef("voicemail", "Voicemail", "accordion-icon.gif",
+			"General settings for voicemail"),
+
+		new PanelDef("queues", "Call Queues", "accordion-icon.gif",
+			"Call queues allow calls to be sequenced to one or more agents."),
+
+		new PanelDef("trunks", "Trunks", "accordion-icon.gif",
+			"Trunks are outbound lines used to allow the system to make calls to the " +
+			"real world.  Trunks can be VoIP lines or traditional telephony lines."),
+
+		new PanelDef("numberplan", "Number Plan", "accordion-icon.gif",
+			"The number plan defines dialing permissions and least cost routing rules."),
+
+		new PanelDef("networking", "Networking", "accordion-icon.gif",
+			"Configures networking parameters"),
+
+		new PanelDef("menus", "Voice Menus", "accordion-icon.gif",
+			"Menus allow for more efficient routing of calls from incoming callers."),
+
+		new PanelDef("status", "Status", "accordion-icon.gif", "Monitor active channels."),
+
+		new PanelDef("options", "Options", "accordion-icon.gif", "Admin Settings")
+
+	);
+
+	astmanEngine.setURL('../../rawman');
+	astmanEngine.setEventCallback(eventeater.eventcb);
+</script>
+<head>
+<title>Asterisk AtomPBX</title>
+</head>
+
+<body onload="javascript:registerajax()">
+
+<script>
+	
+	function setLoggedOn(onoff) {
+		loggedon = onoff;
+		if (loggedon == 1) {
+			for (var i = 0; i < panels.length; i++) {
+				if (panels[i].name == 'homeapp')
+					continue;
+				$(panels[i].name).onclick = $(panels[i].name).realonclick;
+				$(panels[i].name).onmouseover = $(panels[i].name).realonmouseover;
+				$(panels[i].name).style.visibility = 'inherit';
+			}
+		} else {
+			for (var i = 0; i < panels.length; i++) {
+				if (panels[i].name == 'homeapp')
+					continue;
+				$(panels[i].name).onclick = false;
+				$(panels[i].name).onmouseover = false;
+				$(panels[i].name).style.visibility = 'hidden';
+			}
+		}
+	}
+	
+	function loadscreen(srcbody) {
+		$('mainscreen').style.display = '';
+		new Rico.Effect.FadeTo($('mainscreen'), 1, 100, 1);
+		if (loggedon == 1)
+			astmanEngine.pollEvents();
+	}
+
+	function finishfade(page) {
+		$('mainscreen').style.display = "none"; 
+	}
+	
+	function setstatus(status) {
+		$('status').innerHTML = copyright + status;
+	}
+
+	function showmainscreen(page) {
+		if (started) {
+			$('mainscreen').innerHTML = "Loading active screen...";
+			$('mainscreen').src = page.titleBar.id + ".html";
+		}
+	}
+
+	function fademainscreen(page, newpage) {
+		new Rico.Effect.FadeTo($('mainscreen'), 0, 100, 5, {complete:finishfade(page)});
+	}
+
+	function registerajax() {
+		accordion = new Rico.Accordion( $('configpanel'), { panelHeight:280,onHideTab:fademainscreen,onShowTab:showmainscreen });
+		$('borderbox').style.height = $('screenholder').clientHeight;
+		$('titlebar').style.width = $('borderbox').clientWidth - 12;
+		for (var i = 0; i < panels.length; i++) {
+			if (panels[i].name == 'homeapp')
+				continue;
+			$(panels[i].name).realonclick = $(panels[i].name).onclick;
+			$(panels[i].name).realonmouseover = $(panels[i].name).onmouseover;
+		}
+		
+		started = 1;
+	}
+</script>
+<table border="0" align="center" cellspacing="0" cellpadding="0" bgcolor="#dddddd">
+
+<tr>
+	<td bgcolor='white'></td>
+	<td width='80' bgcolor='white'></td>
+	<td bgcolor='white'></td>
+</tr>
+<tr><td valign="bottom" align='right' colspan="2" bgcolor='white'>
+<img align='left' src="images/digiumlogo.gif" align="left">
+</td><td valign='bottom' align='right' bgcolor='white'>
+<a target='_guido' href="http://www.digium.com/guido/about">About Digium</a> | 
+<a target='_guido' href="http://www.digium.com/guido/help">Help</a>
+</td></tr>
+
+<tr><td>
+<div id="configpanel" style="width:150px">
+	<script>
+	for (var i = 0; i < panels.length; i++) {
+		document.write("<div>");
+		document.write("	<div id='" + panels[i].name + "' class='accordionTabTitleBar'>");
+		document.write("		<img style='vertical-align:middle' src='images/" + panels[i].icon + "'>");
+		document.write("		<span style='margin-left: 4px;font-weight:bold'>" + panels[i].label + "</span>");
+		document.write("    </div>");
+		document.write("	<div class='accordionTabContentBox' style='background-image:url(images/panel.png)'>");
+		document.write(panels[i].content);
+		document.write("	</div>");
+		document.write("</div>");
+	}
+	</script>
+</div>
+</td>
+<td colspan='2' width="600" bgcolor="#eeeeef" valign="top" id="screenholder">
+	<div id="titlebar" class="mainscreenTitleBar" style="position:absolute;top:56px">
+		<span style="margin-left: 4px;font-weight:bold">Loading Screen&nbsp;<img src='images/dots.gif'></span>
+	</div>
+	<div id="borderbox" class="mainscreenBorderBox" style="height:100px">
+	</div>
+	<iframe width="600" height="600" frameborder="0" border="0" marginheight="0" marginwidth="0" src="homeapp.html" id="mainscreen" style="position:absolute;top:56px">
+	</iframe>
+</td>
+</tr>
+<tr><td colspan="3">
+	<div id="status" class="statusbar">Copyright &copy;2006 Digium, Inc.  Digium&reg; and Asterisk&reg; are registered <a href="http://www.digium.com/trademarks">trademarks</a> of Digium, Inc.  All Rights Reserved. <i><a href="http://www.digium.com/gui_legal">Legal Information</a></i></div>
+</td></tr>
+</table>
+</body>

Propchange: trunk/config/appliance.html
------------------------------------------------------------------------------
    svn:executable = *

Added: trunk/config/homeapp.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/homeapp.html?rev=23&view=auto
==============================================================================
--- trunk/config/homeapp.html (added)
+++ trunk/config/homeapp.html Mon Sep 11 16:53:02 2006
@@ -1,0 +1,168 @@
+<!--
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Initial login screen
+ *
+ * Copyright (C) 1999 - 2006, Digium, Inc.
+ *
+ * Mark Spencer <markster at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ *
+-->
+
+<script src="scripts/prototype.js"></script>
+<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 demo = new Object;
+	var localloggedon = -1;
+	function updateButtons()
+	{
+		if (parent.loggedon) {
+			$('username').disabled = 1;
+			$('secret').disabled = 1;
+			$('logoff').disabled = 0;
+			$('reboot').disabled = 0;
+			$('factorydefault').disabled = 0;
+			$('saveconfig').disabled = 0;
+			$('login').disabled = 1;
+		} else {
+			$('username').disabled = 0;
+			$('secret').disabled = 0;
+			$('logoff').disabled = 1;
+			$('reboot').disabled = 1;
+			$('factorydefault').disabled = 1;
+			$('saveconfig').disabled = 1;
+			$('login').disabled = 0;
+		}
+	}
+	
+	function loggedOn() {
+		if ((parent.loggedon == 1) && (localloggedon == 1))
+			return;
+		parent.setLoggedOn(1);
+		localloggedon = 1;
+		updateButtons();
+		$('statusbar').innerHTML = "<i>Connected!</i>";
+		parent.astmanEngine.pollEvents();
+	}
+	
+	function loggedOff() {
+		if ((parent.loggedon == 0) && (localloggedon == 0))
+			return;
+		parent.setLoggedOn(0);
+		localloggedon = 0;
+		updateButtons();
+	}
+	
+	function doSaveConfig() {
+		parent.astmanEngine.run_tool("save_config");
+		alert("Configuration Saved");
+	}
+	
+	function doReboot() {
+		if (confirm("Are you sure you want to reboot the Atom?")) {
+			parent.astmanEngine.run_tool("reboot");
+			alert("Rebooting!");
+		}
+	}
+	
+	function doFactoryDefault() {
+		if (confirm("Are you sure you want to reset to factory defaults?")) {
+			parent.astmanEngine.run_tool("factory_default");
+			alert("Resetting to defaults.  Please reboot!");
+		}
+	}
+	
+	demo.logoffs = function(msgs) {
+		$('statusbar').innerHTML = msgs[0].headers['message'];
+		loggedOff();
+	};
+
+	demo.logins = function(msgs) {
+		$('statusbar').innerHTML = msgs[0].headers['message'];
+		resp = msgs[0].headers['response'];
+		if (resp == "Success")
+			loggedOn();
+		else
+			loggedOff();
+	};
+	
+	demo.pongs  = function(msgs) {
+		resp = msgs[0].headers['response'];
+		if (resp == "Pong") {
+			$('statusbar').innerHTML = "<i>Already connected...</i>";
+			loggedOn();
+		} else {
+			$('statusbar').innerHTML = "<i>Please login...</i>";
+			loggedOff();
+		}
+	}
+
+	function localajaxinit() {
+		parent.loadscreen(this);
+	}
+
+	function doLogin() {
+		$('statusbar').innerHTML = "<i>Logging in...</i>";
+		parent.astmanEngine.sendRequest('action=login&username=' + $('username').value + "&secret=" + $('secret').value, demo.logins);
+	}
+	
+	function doLogoff() {
+		$('statusbar').innerHTML = "<i>Logging off...</i>";
+		parent.astmanEngine.sendRequest('action=logoff', demo.logoffs);
+	}
+	function localajaminit() {	
+		parent.astmanEngine.sendRequest('action=ping', demo.pongs);
+	}
+	function localinit() {
+		localajaxinit();
+		localajaminit();
+	}
+
+</script>
+
+
+<body id="foo" onload="localinit()">
+
+<div class="mainscreenTitleBar">
+	<span style="margin-left: 4px;font-weight:bold">Welcome to the Asterisk Configuration Panel</span>
+</div>
+<div class="mainscreenContentBox" id="mailboxcontent">
+<table class="mainscreenTable" width="100%">
+	<tr valign="top">
+		<td colspan=2>
+			<table align="center">
+				<tr><td colspan="2"><h2>Asterisk&trade; Configuration Engine</h2></td>
+				<tr><td>Username:</td><td><input disabled=1 id="username" value="admin"></td></tr>
+				<tr><td>Secret:</td><td><input disabled=1 type="password" id="secret" value="superiaxy"></td></tr>
+				<tr><td colspan=2 align="center">
+				  <div id="statusbar">
+					<span style="margin-left: 4px;font-weight:bold">&nbsp;</span>
+				  </div>
+				</td></tr>
+
+				<tr><td align='center' colspan='2'><input type="submit" id="login" value="Login" disabled=1 onClick="doLogin()">
+				&nbsp;&nbsp;&nbsp;&nbsp;
+				<input type="submit" id="logoff" value="Logoff" disabled=1 onClick="doLogoff()"></td></tr>
+				<tr><td align='center' colspan='2'><input type="submit" id="saveconfig" value="Save Config" disabled=1 onClick="doSaveConfig()">
+				&nbsp;&nbsp;&nbsp;&nbsp;
+				<input type="submit" id="reboot" value="Reboot" disabled=1 onClick="doReboot()">
+				&nbsp;&nbsp;&nbsp;&nbsp;
+				<input type="submit" id="factorydefault" value="Factory Defaults" disabled=1 onClick="doFactoryDefault()"></td></tr>
+			</table>
+		</td>
+	</tr>
+</table>
+</div>
+</body>

Propchange: trunk/config/homeapp.html
------------------------------------------------------------------------------
    svn:executable = *

Modified: trunk/config/numberplan.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/numberplan.html?rev=23&r1=22&r2=23&view=diff
==============================================================================
--- trunk/config/numberplan.html (original)
+++ trunk/config/numberplan.html Mon Sep 11 16:53:02 2006
@@ -186,10 +186,6 @@
 
 	}
 
-
-
-
-
 	callbacks.postselect = function(box, val) {
 	// called "ON page load" and when the  extensions select box is clicked
 		var tmp;
@@ -201,6 +197,7 @@
 				$('priup').disabled = !matches(box, tmp[0], tmp[1], box.selectedIndex - 1)
 				$('pridown').disabled = !matches(box, tmp[0], tmp[1], box.selectedIndex + 1);
 				$('planident').disabled = true;
+				$('trunk').disabled = false;
 				$('planident').value =  '';
 				$('include').disabled = true;
 				$('comment').disabled = true;
@@ -209,6 +206,7 @@
 				// Clicked a MainMenu - The blue ones
 				$('priup').disabled = true;
 				$('pridown').disabled = true;
+				$('trunk').disabled = true;
 				$('planident').value = $('name').value.substr(11);
 				$('name').disabled = true;
 				$('newitem').disabled=false; // "Add new Pattern" is Enabled
@@ -288,7 +286,9 @@
 		var tmp = new Object;
 		var x;
 		var gen;
-		tmp['name'] = $('combosel').options[0].value;
+		tmp['name'] = $('extensions').stored_config.catbyname[$('extensions').value].fieldbyname['defaultpat'];
+		if (!tmp['name'] || !tmp['name'].length)
+			tmp['name'] = $('combosel').options[0].value;
 		numplan = $('extensions').value ;
 		return new Array(numplan, 'exten', tmp);
 	}
@@ -373,6 +373,34 @@
 			a =  $('extensions').selectedIndex;
 			b = a+1;
 			swap_priorities(a,b);
+		}
+
+		callbacks.delchanges = function(box, delvalue, delcat) {
+			var x;
+			var tmp;
+			var match = delvalue.split(']');
+			var cat;
+			var uri = "";
+			var n = 0;
+			if (match.length < 2)
+				return;
+			cat = box.stored_config.catbyname[match[0]];
+			for (x=0;x<box.options.length;x++) {
+				tmp = box.options[x].value.split(']');
+				if (tmp.length > 1) {
+					if ((tmp[0] == match[0]) && 
+						(cat.subfields[tmp[1]]['priority'] > delcat['priority']) && 
+						(cat.subfields[tmp[1]]['name'] == delcat['name'])) {
+							cat.subfields[tmp[1]].priority--;
+							uri += build_action('update', n++, tmp[0], 'exten', 
+								cat.subfields[tmp[1]].name + "," + cat.subfields[tmp[1]].priority + "," + cat.subfields[tmp[1]].app + "(" + cat.subfields[tmp[1]].args + ")",
+								cat.fields[tmp[1]]);
+					}
+				}
+			}
+			if (uri.length) {
+				apply_uri(box, uri);
+			}
 		}
 
 		function swap_priorities(a,b){

Modified: trunk/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/scripts/astman.js?rev=23&r1=22&r2=23&view=diff
==============================================================================
--- trunk/config/scripts/astman.js (original)
+++ trunk/config/scripts/astman.js Mon Sep 11 16:53:02 2006
@@ -288,13 +288,13 @@
 			if (box.widgets['status']) 
 				box.widgets['status'].innerHTML = "<i>Deleted.</i>";
 			if (box.callbacks.delchanges)
-				box.callbacks.delchanges(box.delvalue);
+				box.callbacks.delchanges(box, box.delvalue, box.delcat);
 		},
 		onFailure: function(t) {
 			alert("Config Error: " + t.status + ": " + t.statusText);
 		}
 	};
-	var tmp, uri;
+	var tmp, tmp2, uri;
 	var x,y;
 	var updatebox = 0;
 	var subcat, subname, suborig;
@@ -311,13 +311,23 @@
 	tmp = value.split(']');
 	if (tmp.length > 1) {
 		var oldname;
+		box.delcat = box.stored_config.catbyname[tmp[0]].subfields[tmp[1]];
 		oldname = box.stored_config.catbyname[tmp[0]].subfields[tmp[1]].name;
-		subcat = box.stored_config.catbyname[tmp[0]].subfields[tmp[1]];
 		subname = box.stored_config.catbyname[tmp[0]].names[tmp[1]];
 		suborig = box.stored_config.catbyname[tmp[0]].fields[tmp[1]];
 		box.stored_config.catbyname[tmp[0]].subfields.splice(tmp[1], 1);
 		box.stored_config.catbyname[tmp[0]].names.splice(tmp[1], 1);
 		box.stored_config.catbyname[tmp[0]].fields.splice(tmp[1], 1);
+		for (x=0;x<box.options.length;x++) {
+			tmp2 = box.options[x].value.split(']');
+			/* Renumber remaining line numbers */
+			if ((tmp2.length > 1) && (tmp2[0] == tmp[0])) {
+				if (tmp2[1] > tmp[1]) {
+					var newname = tmp2[0] + "]" + String(Number(tmp2[1]) - 1);
+					box.options[x].value = newname;
+				}
+			}
+		}
 		if (updatebox && oldname == "") {
 			if (box.widgets['status']) 
 				box.widgets['status'].innerHTML = "<i>Deleted.</i>";

Modified: trunk/config/trunks.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/trunks.html?rev=23&r1=22&r2=23&view=diff
==============================================================================
--- trunk/config/trunks.html (original)
+++ trunk/config/trunks.html Mon Sep 11 16:53:02 2006
@@ -75,7 +75,7 @@
 		parent.loadscreen(this);
 	}
 
-	callbacks.delchanges = function(value) {
+	callbacks.delchanges = function(box, value) {
 		var oldvalue = $('hiddenglobals').stored_config.catbyname['globals'].fieldbyname[value];
 		if (oldvalue) {
 			uri = build_action('delete', 0, 'globals', value, "");



More information about the asterisk-gui-commits mailing list