Author: pari
Date: Tue Jan 8 11:40:21 2008
New Revision: 2101
URL: http://svn.digium.com/view/asterisk-gui?view=rev&am
p;rev=2101
Log:
fixing wrong priorities in voicemenu steps
Modified:
branches/asterisknow/config/menus.html
Modified: branches/asterisknow/config/menus.html
URL: http://svn.digium.com/view/asterisk-gui/branche
s/asterisknow/config/menus.html?view=diff&rev=2101&r
1=2100&r2=2101
============================================================
==================
--- branches/asterisknow/config/menus.html (original)
+++ branches/asterisknow/config/menus.html Tue Jan 8
11:40:21 2008
 -315,7
+315,17 
var priorities = new Array;
if(voicemenusdata[_vmv].extensions['s'] &&
voicemenusdata[_vmv].extensions['s'].length > 0 ){
- newpriority = 'n';
+ // you might be tempted to say " newpriority =
voicemenusdata[_vmv].extensions['s'].length + 1; " but
this won't work cause
+ // you might be dealing a "[s,1][s,3][s,7]"
where the array length is 3 - but new priority shud be 8
+
+ // so ,
+ var laststep_tmp = voicemenusdata[_vmv].extensions['s'][
voicemenusdata[_vmv].extensions['s'].length -1 ] ;
+ var laststep_priority =
ASTGUI.parseContextLine.getPriority( laststep_tmp );
+
+ // gui versions before AA50 firmware 1.1 used 's,n'
+ // this is updated to's,number' in 1.1
+ // so if we find a old format - we will delete all the
's' extension and update it to new format
+ newpriority = ( laststep_priority == 'n' ) ?
voicemenusdata[_vmv].extensions['s'].length + 1 :
Number(laststep_priority) + 1 ;
}else{
newpriority = 1;
}
 -376,40
+386,62 
action_string = "s,undefined,undefined";
}
- uri += build_action('append', 0, _vmv,"exten",
action_string );
-
- makerequest('u','extensions.conf', uri,
- function(t){
- setTimeout(function(){
_$('status_message').style.display = 'none';
},sc_displaytime);
- // if request successfull then add this to the steps
select box
- var newoption =
document.createElement("option");
- newoption.text = format_step(action_string );
- newoption.value = action_string ;
- var _steps = _$('steps') ;
- _steps.options.add ( newoption );
- // and also add the information to the voicemenus data
- if(voicemenusdata[_vmv].extensions['s']){
- voicemenusdata[_vmv].extensions['s'].push(action_string
);
- }else{
- voicemenusdata[_vmv].extensions['s'] = new Array;
- voicemenusdata[_vmv].extensions['s'][0] =
action_string;
- }
- // empty this textbox & disable this button, select
the newly added item to the steps options box
- _nsa.selectedIndex = 0;
- _$('deletestep').disabled = false;
- _steps.selectedIndex = _steps.length - 1 ;
- gui_feedback('New step added !','blue');
- update_updown();
- _nsv.value = "";
- _nsv.style.display = "none" ;
- _$('add_newstep_extensions').style.display =
"none";
- _$('add_newstep_menus').style.display =
"none";
- _$('combodiv_sounds').style.display = "none"
;
- _nsvd = _$('newstep_var_digit');
- _nsvd.value= "";
- _nsvd.style.display= "none" ;
- }
- );
+ var after = function(t){
+ setTimeout(function(){ _$('status_message').style.display
= 'none'; },sc_displaytime);
+ hide_addStep();
+ // if request successfull then add this to the steps
select box
+ var newoption =
document.createElement("option");
+ newoption.text = format_step(action_string );
+ newoption.value = action_string ;
+ var _steps = _$('steps') ;
+ _steps.options.add ( newoption );
+ // and also add the information to the voicemenus data
+ if(voicemenusdata[_vmv].extensions['s']){
+ voicemenusdata[_vmv].extensions['s'].push(action_string);
+ }else{
+ voicemenusdata[_vmv].extensions['s'] = new Array;
+ voicemenusdata[_vmv].extensions['s'][0] = action_string;
+ }
+ // empty this textbox & disable this button, select
the newly added item to the steps options box
+ _nsa.selectedIndex = 0;
+ _$('deletestep').disabled = false;
+ _steps.selectedIndex = _steps.length - 1 ;
+ gui_feedback('New step added !','blue');
+ update_updown();
+ _nsv.value = "";
+ _nss.value="";
+ _nsv.style.display = "none" ;
+ _nss.style.display = "none" ;
+ _$('add_newstep_extensions').style.display =
"none";
+ _$('add_newstep_menus').style.display =
"none";
+ _nsvd = _$('newstep_var_digit');
+ _nsvd.value= "";
+ _nsvd.style.display= "none" ;
+ if(laststep_priority == 'n' ){ window.location.reload();
}
+ }
+
+ if( laststep_priority=='n' ){ // if old configuration -
update to new
+ var chs = new listOfActions();
+ chs.filename('extensions.conf'); var c = 0;
+ for(var vg=0; vg <
voicemenusdata[_vmv]['extensions']['s'].length ; vg++ ){
+ chs.build_action ( 'delete', c , _vmv, "exten",
'', voicemenusdata[_vmv]['extensions']['s'][vg] );
+ }
+
+ var tmp_priority = 1;
+ for(var vg=0; vg <
voicemenusdata[_vmv]['extensions']['s'].length ; vg++ ){
+ var tmp_step = 's,' + tmp_priority + ','+
ASTGUI.parseContextLine.getAction(
voicemenusdata[_vmv]['extensions']['s'][vg] ) ;
+ voicemenusdata[_vmv]['extensions']['s'][vg] = tmp_step;
+ tmp_priority++ ;
+ chs.build_action ( 'append', c , _vmv, 'exten', tmp_step
);
+ }
+ chs.build_action( 'append', c , _vmv, 'exten',
action_string );
+ chs.callActions(after);
+ return;
+ }else{
+ uri += build_action('append', 0, _vmv,"exten",
action_string );
+ makerequest('u','extensions.conf', uri, after );
+ return;
+ }
}
 -824,9
+856,9 
_$(current_key_exts).style.display = "";
select_menu(current_key_exts,
tmp[2],"isext"); // select_menu common for exts
and menus
}else if(tmp[2].match("Hangup") ){ // if
HangUp
- _$(current_key_action).options[4].selected =
true;
+ ASTGUI.selectbox.selectOption(_$(current_key_action),
'Hangup'); //
}else if( tmp[2].match('Playback') &&
tmp[2].match( "(invalid)" ) ){
- _$(current_key_action).options[5].selected =
true;
+ ASTGUI.selectbox.selectOption(_$(current_key_action),
'PlayInvalid');
}else{ // if custom (no 'goto')
_$(current_key_action).options[3].selected = true;
_$(current_key_text).style.display = "";
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.c
om--
asterisk-gui-commits mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-g
ui-commits
|