rbrindley: branch rbrindley/astman_revamp r4662 - in /team/rbrindley/astman_r...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Mar 25 12:45:59 CDT 2009


Author: rbrindley
Date: Wed Mar 25 12:45:54 2009
New Revision: 4662

URL: http://svn.digium.com/svn-view/asterisk-gui?view=rev&rev=4662
Log:

- merged lastest from branches/2.0
- prep-ing for the addition of pbx.trunks.rules.*


Modified:
    team/rbrindley/astman_revamp/config/incoming.html
    team/rbrindley/astman_revamp/config/js/incoming.js
    team/rbrindley/astman_revamp/config/js/pbx2.js
    team/rbrindley/astman_revamp/config/js/users.js
    team/rbrindley/astman_revamp/config/users.html

Modified: team/rbrindley/astman_revamp/config/incoming.html
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/astman_revamp/config/incoming.html?view=diff&rev=4662&r1=4661&r2=4662
==============================================================================
--- team/rbrindley/astman_revamp/config/incoming.html (original)
+++ team/rbrindley/astman_revamp/config/incoming.html Wed Mar 25 12:45:54 2009
@@ -18,10 +18,6 @@
  * at the top of the source tree.
  *
 -->
-<script src="js/jquery.js"></script>
-<script src="js/astman.js"></script>
-<script src="js/incoming.js"></script>
-<script src="js/jquery.tooltip.js"></script>
 <link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
 <style type="text/css">
 
@@ -103,4 +99,53 @@
 		</TABLE>
 	</div>
 
+<script src="js/jquery.js"></script>
+<script src="js/astman.js"></script>
+<script src="js/incoming.js"></script>
+<script src="js/jquery.tooltip.js"></script>
+<script type="text/javascript">
+	$(document).ready(function() {
+		top.document.title = "Incoming Calling Rules";
+		
+		incomingRules_MiscFunctions.listAllRulesInTable();
+
+		/* Populate Time Intervals <select> */
+		var itrl_tf = $('#edit_itrl_tf');
+		var list = parent.pbx.time_intervals.list();
+		for (var ti in list) {
+			if (!list.hasOwnProperty(ti)) {
+				continue;
+			}
+
+			itrl_tf.append($('<option>').html(ti).val(list[ti]));
+		};
+		itrl_tf.append($('<option>').html('None (no Time Intervals matched)').val(''));
+		delete itrl_tf;
+		delete list;
+
+		/* Populate Destinations <select> */
+		var dest = $('#edit_itrl_dest');
+		var list = parent.miscFunctions.getAllDestinations();
+		for (var d in list) {
+			if (!list.hasOwnProperty(d)) {
+				continue;
+			}
+
+			dest.append($('<option>').html(d).val(list[d]));
+		}
+		dest.append($('<option>').html('Local Extension by DID').val('ByDID'));
+
+		/* now lets add some events!! */
+		dest.change(function() {
+			if (this.val() === 'ByDID') {
+				$('.localext_byDid').show();
+			} else {
+				$('.localext_byDid').hide();
+			}
+		});
+		$('#edit_itrl_trunk').click(function() {
+			incomingRules_MiscFunctions.enableDisablePattern();
+		});
+	});
+</script>
 </body>

Modified: team/rbrindley/astman_revamp/config/js/incoming.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/astman_revamp/config/js/incoming.js?view=diff&rev=4662&r1=4661&r2=4662
==============================================================================
--- team/rbrindley/astman_revamp/config/js/incoming.js (original)
+++ team/rbrindley/astman_revamp/config/js/incoming.js Wed Mar 25 12:45:54 2009
@@ -118,7 +118,7 @@
 
 	listAllRulesInTable : function(){ // incomingRules_MiscFunctions.listAllRulesInTable();
 		EX_CF = config2json({filename:'extensions.conf', usf:0 });
-		var t = parent.astgui_managetrunks.listofAllTrunks();
+		var t = parent.pbx.trunks.list();
 
 		if ( !t.length ){
 
@@ -142,7 +142,7 @@
 
 		var TMP_FORSORT = [];
 		t.each( function(item){
-			TMP_FORSORT.push( parent.astgui_managetrunks.misc.getTrunkName(item) + STRING_SEPERATOR +  item);
+			TMP_FORSORT.push( parent.pbx.trunks.getName(item) + STRING_SEPERATOR +  item);
 		});
 
 		TMP_FORSORT.sort();
@@ -150,7 +150,7 @@
 			var a = this_str.split(STRING_SEPERATOR); // a[0] is trunkname , a[1] is trunk 
 			var this_trunk = a[1];
 			var this_trunk_label = a[0];
-			var ttype = parent.astgui_managetrunks.misc.getTrunkType( this_trunk );
+			var ttype = parent.pbx.trunks.getType(this_trunk);
 			var defaultContext_ContextName = ASTGUI.contexts.TrunkDIDPrefix + this_trunk + ASTGUI.contexts.TrunkDefaultSuffix ;
 
 			ASTGUI.selectbox.append('edit_itrl_trunk', this_trunk_label , this_trunk );
@@ -327,7 +327,7 @@
 			_$('edit_itrl_pattern').disabled = false;
 			return ;
 		}
-		var ttype = parent.astgui_managetrunks.misc.getTrunkType(tn);
+		var ttype = parent.pbx.trunks.getType(tn);
 		_$('edit_itrl_pattern').disabled = (ttype == 'analog') ? true : false;
 		if( ttype == 'analog' ){
 			_$('edit_itrl_pattern').value = 's'  ;
@@ -352,7 +352,7 @@
 		var this_tiName = ASTGUI.getFieldValue('edit_itrl_tf') ;
 		var TMP_NEW_PATTERN = ASTGUI.getFieldValue('edit_itrl_pattern');
 
-		if( ASTGUI.getFieldValue('edit_itrl_dest') == 'ByDID' && parent.astgui_managetrunks.misc.getTrunkType(this_trunk) == 'analog' ){
+		if( ASTGUI.getFieldValue('edit_itrl_dest') == 'ByDID' && parent.pbx.trunks.getType(this_trunk) == 'analog' ){
 			ASTGUI.feedback ({ msg: 'Local Extension by DID is not applicable for Analog Trunks !' , showfor:3,  color:'red' });
 			return ;
 		}
@@ -387,7 +387,7 @@
 						x.new_action ( 'newcat', thisRule_context , '' , '' );
 					}
 	
-					var this_ttype = parent.astgui_managetrunks.misc.getTrunkType(this_trunk) ;
+					var this_ttype = parent.pbx.trunks.getType(this_trunk) ;
 					if( this_ttype == 'analog' && TMP_NEW_PATTERN == 's' ){
 						this_ActualRule = TMP_NEW_PATTERN + ',3,' + ASTGUI.getFieldValue('edit_itrl_dest') ;
 						x.new_action( 'append', thisRule_context, 'exten', ASTGUI.globals.sbcid_1 );
@@ -439,7 +439,7 @@
 				}
 
 				if( TMP_NEW_PATTERN == 's' || TMP_NEW_PATTERN == '_X.' ){
-					var this_ttype = parent.astgui_managetrunks.misc.getTrunkType(this_trunk) ;
+					var this_ttype = parent.pbx.trunks.getType(this_trunk) ;
 					if( this_ttype == 'analog' && TMP_NEW_PATTERN == 's' ){
 						var this_ActualRule = TMP_NEW_PATTERN + ',3,' + ASTGUI.getFieldValue('edit_itrl_dest') ;
 						PREVIOUS_DEFAULT_CONTEXT.push('exten=' + ASTGUI.globals.sbcid_1 );
@@ -491,26 +491,3 @@
 		}
 	}
 };
-
-
-
-var localajaxinit = function(){
-	top.document.title = 'Incoming Calling Rules' ;
-	incomingRules_MiscFunctions.listAllRulesInTable();
-
-	var TI_LIST = parent.miscFunctions.getTimeIntervals() ;
-	ASTGUI.selectbox.populateArray( 'edit_itrl_tf', TI_LIST.getOwnProperties() );
-	ASTGUI.selectbox.append( 'edit_itrl_tf' , 'None (no TimeIntervals matched)' , '' );
-	ASTGUI.selectbox.populateArray( 'edit_itrl_dest' ,  parent.miscFunctions.getAllDestinations() );
-	ASTGUI.selectbox.append( 'edit_itrl_dest' , 'Local Extension by DID' , 'ByDID' );
-	ASTGUI.events.add( 'edit_itrl_trunk' , 'click' , incomingRules_MiscFunctions.enableDisablePattern );
-
-	ASTGUI.events.add( 'edit_itrl_dest', 'change' , function(){
-		if( _$('edit_itrl_dest').value == 'ByDID' ){
-			$('.localext_byDid').show();
-		}else{
-			$('.localext_byDid').hide();
-		}
-	});
-	//'edit_itrl_trunk', 'edit_itrl_tf', 'edit_itrl_pattern', 'edit_itrl_dest'
-};

Modified: team/rbrindley/astman_revamp/config/js/pbx2.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/astman_revamp/config/js/pbx2.js?view=diff&rev=4662&r1=4661&r2=4662
==============================================================================
--- team/rbrindley/astman_revamp/config/js/pbx2.js (original)
+++ team/rbrindley/astman_revamp/config/js/pbx2.js Wed Mar 25 12:45:54 2009
@@ -39,6 +39,7 @@
  * @return boolean of success
  */
 pbx.calling_rules.add = function(name, dp) {
+	/* lets make sure we get all the necessary args */
 	if (!name) {
 		top.log.warn('pbx.calling_rules.add: name is not defined');
 		return false;
@@ -47,29 +48,32 @@
 		return false;
 	}
 
+	/* lets make sure that the name begins with the prefix */
 	if (!name.beginsWith(ASTGUI.contexts.CallingRulePrefix)) {
 		name = ASTGUI.contexts.CallingRulePrefix + name;
 	}
 
+	/* chop chop! */
 	dp = dp.lChop('exten=');
 
+	/* add actions to update extensions.conf */
 	var ext_conf = new listOfSynActions('extensions.conf');
-
 	if (!sessionData.pbxinfo.callingRules.hasOwnProperty(name)) {
 		ext_conf.new_action('delcat', name, '', ''); /* for good measure :) */
 		ext_conf.new_action('newcat', name, '', '');
 		sessionData.pbxinfo.callingRules[name] = [];
 	}
-
 	ext_conf.new_action('append', name, 'exten', dp);
+	
+	/* update extensions.conf */
 	var resp = ext_conf.callActions();
-
 	if (!resp.contains('Response: Success')) {
 		top.log.error('pbx.calling_rules.add: error adding ' + name + ' to extensions.conf');
 		top.log.error(resp);
 		return false;
 	}
 
+	/* now update cache and go! */
 	sessionData.pbxinfo.callingRules[name].push('exten=' + dp);
 	return true;
 };
@@ -942,6 +946,23 @@
 
 	ASTGUI.feedback({ msg: 'Updated time interval!', showfor: 3, color: 'green', bgcolor: '#ffffff'});
 	return true;
+};
+
+/**
+ * List all Time Intervals.
+ * @return an object of all the time intervals.
+ */
+pbx.time_intervals.list = function() {
+	var list = new ASTGUI.customObject;
+
+	var globals = context2json({filename: 'extensions.conf', context: 'globals', usf:0});
+	for (var i=0; i<globals.length; i++) {
+		if (globals[i].beginsWith(ASTGUI.contexts.TimeIntervalsPrefix)) {
+			list[globals[i].lChop(ASTGUI.contexts.TimeIntervalPrefix).beforeChar('=')] = globals[i].afterChar('=');
+		}
+	}
+
+	return list;
 };
 
 /**

Modified: team/rbrindley/astman_revamp/config/js/users.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/astman_revamp/config/js/users.js?view=diff&rev=4662&r1=4661&r2=4662
==============================================================================
--- team/rbrindley/astman_revamp/config/js/users.js (original)
+++ team/rbrindley/astman_revamp/config/js/users.js Wed Mar 25 12:45:54 2009
@@ -22,21 +22,6 @@
 var EXTENSION_EDIT;
 var zapchan_Before = '';
 var MULTI_FIELDS = ['edit_check_multiple_obcid','edit_multiple_obcid','edit_check_multiple_dialplan','edit_multiple_dialplan','edit_check_multiple_hasvoicemail','edit_multiple_hasvoicemail','edit_check_multiple_vmsecret', 'edit_multiple_vmCHoice1', 'edit_multiple_vmCHoice2', 'edit_multiple_vmsecret', 'edit_check_multiple_hassip', 'edit_multiple_hassip', 'edit_check_multiple_hasiax', 'edit_multiple_hasiax', 'edit_check_multiple_allow',  'edit_multiple_codec_one', 'edit_multiple_codec_two', 'edit_multiple_codec_three', 'edit_multiple_codec_fourth', 'edit_multiple_codec_fifth', 'edit_check_multiple_flashrxflash',  'edit_multiple_flash', 'edit_multiple_rxflash', 'edit_check_multiple_secret', 'edit_multiple_seCHoice1', 'edit_multiple_seCHoice2', 'edit_multiple_secret', 'edit_check_multiple_nat',  'edit_multiple_nat', 'edit_check_multiple_canreinvite', 'edit_multiple_canreinvite', 'edit_check_multiple_dtmfmode',  'edit_multiple_dtmfmode', 'edit_check_multiple_insecure',  'edit_multiple_insecure', 'edit_check_multiple_3waycalling',  'edit_multiple_3waycalling', 'edit_check_multiple_indirectory',  'edit_multiple_indirectory', 'edit_check_multiple_callwaiting',  'edit_multiple_callwaiting', 'edit_check_multiple_cti',  'edit_multiple_cti', 'edit_check_multiple_isagent',  'edit_multiple_isagent', 'edit_check_multiple_pickupgroup',  'edit_multiple_pickupgroup'];
-
-
-var localajaxinit = function(){
-	top.document.title = 'Manage User Extensions ' ;
-	if( !ASTGUI.miscFunctions.alertIfRangeisNotdefined('ue_start','ue_end', 'Users') ){
-		$('.top_buttons').hide();
-		return;
-	}
-
-	$('#new_ext').keyup(function(){ $('#edit_callerid_span').html(this.value); }).change(function(){ $('#edit_callerid_span').html(this.value); });
-
-	USERS_MISC_FUNCTIONS.load_users_table();
-	$('#whereToBuy_button').tooltip({delay:0.9,showURL:false,top:15,left:-300});
-	setTimeout( function(){ USERS_MISC_FUNCTIONS.initialize_formFields(); }, 10 );
-};
 
 var USERS_MISC_FUNCTIONS = {
 	show_UserEdit_normal : function(){ // USERS_MISC_FUNCTIONS.show_UserEdit_normal();

Modified: team/rbrindley/astman_revamp/config/users.html
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/astman_revamp/config/users.html?view=diff&rev=4662&r1=4661&r2=4662
==============================================================================
--- team/rbrindley/astman_revamp/config/users.html (original)
+++ team/rbrindley/astman_revamp/config/users.html Wed Mar 25 12:45:54 2009
@@ -19,13 +19,12 @@
  * at the top of the source tree.
  *
 -->
-<script src="js/jquery.js"></script>
-<script src="js/astman.js"></script>
-<script src="js/users.js"></script>
-<script src="js/jquery.tooltip.js"></script>
 <link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
 <style type="text/css">
-	.no_obcid{ color: #FF0000; }
+	.no_obcid { 
+		color: #FF0000; 
+	}
+
 	#table_userslist_container{
 		clear:both;
 		height: 600px;
@@ -43,14 +42,48 @@
 		padding : 1px;
 	}
 
-	#table_userslist tr.frow { background: #6b79a5; color: #CED7EF; }
-	#table_userslist tr.frow td{ font-weight:bold; }
-	#table_userslist tr td{ padding : 3px; }
-	#table_userslist tr.even { background: #DFDFDF; }
-	#table_userslist tr.odd{ background: #FFFFFF; }
+	#table_userslist tr.frow { 
+		background: #6b79a5; 
+		color: #CED7EF; 
+	}
+
+	#table_userslist tr.frow td { 
+		font-weight:bold; 
+	}
+
+	#table_userslist tr td { 
+		padding : 3px; 
+	}
+
+	#table_userslist tr.even { 
+		background: #DFDFDF; 
+	}
+
+	#table_userslist tr.odd { 
+		background: #FFFFFF; 
+	}
+
 	#table_userslist tr.even:hover, #table_userslist tr.odd:hover {
 		background: #a8b6e5;
 		cursor: default;
+	}
+
+	.top_buttons > span.guiButton, .top_buttons > span.guiButtonNew, .top_buttons > span.guiButtonDelete {
+		float: left;
+	}
+
+	.top_buttons > span.lite_Heading {
+		margin-left: 80px;
+	}
+
+	#whereToBuy_button {
+		float: right;
+		margin-right: 30px;
+	}
+
+	#edit_userExtension_div {
+		display: none;
+		width: 750px;
 	}
 
 </style>
@@ -60,19 +93,19 @@
 	<span class='refresh_icon' onclick="window.location.reload();" >&nbsp;<img src="images/refresh.png" title=" Refresh " border=0 >&nbsp;</span>
 </div>
 	<div class='top_buttons'>
-		<span id='new' class='guiButtonNew' onclick='USERS_MISC_FUNCTIONS.NEW_USER_FORM();' style='float:left'>Create New User</span>
-		<span class='guiButton' onclick='USERS_MISC_FUNCTIONS.EDIT_SELECTEDUSERs_FORM();' style='float:left'>Modify Selected Users</span>
-		<span class='guiButtonDelete' onclick='USERS_MISC_FUNCTIONS.DELETE_SELECTED_USERS();' style='float:left'>Delete Selected Users</span>
-
-		<span class='guiButton' style='float:right; margin-right:30px;' onclick='buynow_action();' id='whereToBuy_button' tip="en,users,98">Where to Buy</span>
-		<span class='lite_Heading' style='margin-left: 80px'> List of User Extensions </span>
+		<span id='new' class='guiButtonNew' onclick='USERS_MISC_FUNCTIONS.NEW_USER_FORM();'>Create New User</span>
+		<span class='guiButton' onclick='USERS_MISC_FUNCTIONS.EDIT_SELECTEDUSERs_FORM();'>Modify Selected Users</span>
+		<span class='guiButtonDelete' onclick='USERS_MISC_FUNCTIONS.DELETE_SELECTED_USERS();'>Delete Selected Users</span>
+
+		<span class='guiButton' onclick='buynow_action();' id='whereToBuy_button' tip="en,users,98">Where to Buy</span>
+		<span class='lite_Heading'> List of User Extensions </span>
 	</div>
 
 <div id='table_userslist_container'>
 <table id='table_userslist' cellpadding=0 cellspacing=0 border=0 align=center></table>
 </div>
 
-<div id="edit_userExtension_div" STYLE="width:750; display: none;" class='dialog'>
+<div id="edit_userExtension_div" class='dialog'>
 	<TABLE width="100%" cellpadding=0 cellspacing=0>
 	<TR class="dialog_title_tr">
 		<TD class="dialog_title" onmousedown="ASTGUI.startDrag(event);"><span id="edit_userExtension_div_title"></span></TD>
@@ -458,4 +491,31 @@
 	<form name="buynow_form" id="buynow_form" action="http://www.digium.com/en/ecosystem/partners/partners.php" method="post"></form>
 </div>
 
+<script src="js/jquery.js"></script>
+<script src="js/astman.js"></script>
+<script src="js/users.js"></script>
+<script src="js/jquery.tooltip.js"></script>
+<script type="text/javascript">
+	$(document).ready(function() {
+		top.document.title = "Manage User Extensions";
+		if (!ASTGUI.miscFunctions.alertIfRangeisNotdefined('ue_start', 'ue_end', 'Users')) {
+			$('.top_buttons').hide();
+			return;
+		}
+		
+		$('#new_ext')
+			.keyup(function() {
+				$('#edit_callerid_span').html(this.value);
+			})
+			.change(function() {
+				$('#edit_callerid_span').html(this.value);
+		});
+
+		USERS_MISC_FUNCTIONS.load_users_table();
+
+		$('#whereToBuy_button').tooltip({ delay: 0.9, showURL: false, top: 15, left: -300});
+
+		USERS_MISC_FUNCTIONS.initialize_formFields();
+	});
+</script>
 </body>




More information about the asterisk-gui-commits mailing list