espiceland: branch 2.0 r5101 - in /branches/2.0/config: ./ js/
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Thu Oct 21 12:09:14 CDT 2010
Author: espiceland
Date: Thu Oct 21 12:09:10 2010
New Revision: 5101
URL: http://svnview.digium.com/svn/asterisk-gui?view=rev&rev=5101
Log:
Add ability to disable extension range preferences (under Options) with big warning that it's not a good idea. ASTGUI-173.
Modified:
branches/2.0/config/js/astman.js
branches/2.0/config/js/pbx.js
branches/2.0/config/js/preferences.js
branches/2.0/config/preferences.html
Modified: branches/2.0/config/js/astman.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/astman.js?view=diff&rev=5101&r1=5100&r2=5101
==============================================================================
--- branches/2.0/config/js/astman.js (original)
+++ branches/2.0/config/js/astman.js Thu Oct 21 12:09:10 2010
@@ -1494,6 +1494,7 @@
},
alertIfRangeisNotdefined: function(a , b, for_what){ // ASTGUI.miscFunctions.alertIfRangeisNotdefined();
+ if(parent.sessionData.GUI_PREFERENCES.getProperty('disable_extension_ranges') == 'yes'){ return true; }
if(!a || !b){return true;}
if( !parent.sessionData.GUI_PREFERENCES.getProperty(a) || !parent.sessionData.GUI_PREFERENCES.getProperty(b) ){
ASTGUI.dialog.alertmsg("You do not have an extension range defined for '"+ for_what +"'. Please define your <i>Extension Preferences</I> from the 'Options' panel");
@@ -1503,6 +1504,7 @@
},
isExtensionInRange: function(ext,a,b){ // ASTGUI.miscFunctions.isExtensionInRange('6000','ue_start','ue_end') ;
+ if(parent.sessionData.GUI_PREFERENCES.getProperty('disable_extension_ranges') == 'yes'){ return true; }
var v = parent.sessionData.GUI_PREFERENCES.getProperty(a) ;
var w = parent.sessionData.GUI_PREFERENCES.getProperty(b) ;
if( !v || !w ){
Modified: branches/2.0/config/js/pbx.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/pbx.js?view=diff&rev=5101&r1=5100&r2=5101
==============================================================================
--- branches/2.0/config/js/pbx.js (original)
+++ branches/2.0/config/js/pbx.js Thu Oct 21 12:09:10 2010
@@ -307,6 +307,11 @@
}else{
sessionData.GUI_PREFERENCES = gp['general'] ;
}
+ if(!sessionData.GUI_PREFERENCES.getProperty('disable_extension_ranges')){
+ var u = new listOfSynActions(ASTGUI.globals.configfile) ;
+ u.new_action('append', 'general', 'disable_extension_ranges', 'no');
+ u.callActions();
+ }
sessionData.continueParsing = true ;
}, // end of readcfg.guiPreferencesConf();
Modified: branches/2.0/config/js/preferences.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/preferences.js?view=diff&rev=5101&r1=5100&r2=5101
==============================================================================
--- branches/2.0/config/js/preferences.js (original)
+++ branches/2.0/config/js/preferences.js Thu Oct 21 12:09:10 2010
@@ -119,6 +119,10 @@
ASTGUI.updateFieldToValue( 'rge_end' , c.getProperty('rge_end') );
ASTGUI.updateFieldToValue( 'vmg_start' , c.getProperty('vmg_start') );
ASTGUI.updateFieldToValue( 'vmg_end' , c.getProperty('vmg_end') );
+
+ var disabled = c.getProperty('disable_extension_ranges');
+ ASTGUI.updateFieldToValue( 'disable_extension_ranges' , disabled == 'yes' ? 'on' : 'off' );
+ refreshExtensionRangesForm(disabled);
};
@@ -169,7 +173,57 @@
return true;
};
+var saveDisableExtensionRanges = function(){
+ var disabled = ASTGUI.getFieldValue("disable_extension_ranges");
+ ASTGUI.updateFieldToValue('disable_extension_ranges', 'no');
+ if(disabled == 'yes'){
+ if(!confirm("The Asterisk GUI uses these settings to help ensure that you cannot create extensions "
+ + "that may cause problems in Asterisk. We really do not recommend disabling this feature. Are "
+ + "you sure that you want to disable this? Click OK to disable.")){return;}
+ ASTGUI.updateFieldToValue('disable_extension_ranges', 'yes');
+ }
+ refreshExtensionRangesForm(disabled);
+};
+
+var refreshExtensionRangesForm = function(disabled){
+ if(disabled == 'yes'){
+ _$('ue_start').disabled = true;
+ _$('ue_end').disabled = true;
+ _$('mm_start').disabled = true;
+ _$('mm_end').disabled = true;
+ _$('vme_start').disabled = true;
+ _$('vme_end').disabled = true;
+ _$('rge_start').disabled = true;
+ _$('rge_end').disabled = true;
+ _$('qe_start').disabled = true;
+ _$('qe_end').disabled = true;
+ _$('vmg_start').disabled = true;
+ _$('vmg_end').disabled = true;
+ $('#reset_ranges_button').hide();
+ }else{
+ _$('ue_start').disabled = false;
+ _$('ue_end').disabled = false;
+ _$('mm_start').disabled = false;
+ _$('mm_end').disabled = false;
+ _$('vme_start').disabled = false;
+ _$('vme_end').disabled = false;
+ _$('rge_start').disabled = false;
+ _$('rge_end').disabled = false;
+ _$('qe_start').disabled = false;
+ _$('qe_end').disabled = false;
+ _$('vmg_start').disabled = false;
+ _$('vmg_end').disabled = false;
+ $('#reset_ranges_button').show();
+ }
+};
+
var save_changes = function(){
+ var disabled = ASTGUI.getFieldValue("disable_extension_ranges");
+ var x = new listOfSynActions(ASTGUI.globals.configfile);
+ x.new_action('update', 'general', 'disable_extension_ranges', disabled );
+ x.callActions();
+ top.sessionData.GUI_PREFERENCES.disable_extension_ranges = disabled;
+
if( !verify_Ranges() ){ return; }
parent.sessionData.pbxinfo.GLOBALS[ASTGUI.globals.obcidstr] = DOM_obCid_input.value;
Modified: branches/2.0/config/preferences.html
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/preferences.html?view=diff&rev=5101&r1=5100&r2=5101
==============================================================================
--- branches/2.0/config/preferences.html (original)
+++ branches/2.0/config/preferences.html Thu Oct 21 12:09:10 2010
@@ -66,6 +66,11 @@
<fieldset style="max-width:700px;min-width:500px;">
<legend><B> Extension preferences: </B></legend>
<table cellpadding=2 cellspacing=2 border=0 align=center>
+ <tr>
+ <td align=right>Disable Extension Ranges:</td>
+ <td><input id='disable_extension_ranges' type='checkbox' onclick='saveDisableExtensionRanges()'>
+ </td>
+ </tr>
<tr> <td align=right>User Extensions :</td>
<td><input id='ue_start' size=4 validation='numeric' required='yes'> to
<input id='ue_end' size=4 validation='numeric' required='yes'>
@@ -103,8 +108,9 @@
</td>
</tr>
- <tr> <td colspan=2 align=center>
- <span class='guiButton' onclick='reset_ranges_default()'>Reset to defaults</spann>
+ <tr>
+ <td colspan=2 align=center>
+ <span class='guiButton' onclick='reset_ranges_default()' id='reset_ranges_button'>Reset to defaults</spann>
</td>
</tr>
More information about the asterisk-gui-commits
mailing list