Author: pari
Date: Thu Jan 10 15:53:14 2008
New Revision: 2124
URL: http://svn.digium.com/view/asterisk-gui?view=rev&am
p;rev=2124
Log:
BE-315
Reason: only a part of the gui context is being created
Modified:
branches/asterisknow/config/home.html
branches/asterisknow/config/scripts/astman.js
Modified: branches/asterisknow/config/home.html
URL: http://svn.digium.com/view/asterisk-gui/branches
/asterisknow/config/home.html?view=diff&rev=2124&r1=
2123&r2=2124
============================================================
==================
--- branches/asterisknow/config/home.html (original)
+++ branches/asterisknow/config/home.html Thu Jan 10
15:53:14 2008
 -196,40
+196,26 
function installguitools(){
- var opt = {
- method: 'get',
- asynchronous: true,
- onComplete: function(){
+ var after = function(){ // then reload asterisk
+ parent.astmanEngine.cliCommand('reload', function(t){
gui_feedback("Restarted Asterisk !!",'blue');
top.window.location.reload(); // at this point ztscan
call was failed as it needs this context to run, so reload
- }
+ });
};
- opt.parameters="action=updateconfig&reload=yes&am
p;srcfilename=extensions.conf&dstfilename=extensions.con
f&" +
- "Action-000000=newcat&Cat-000000=" +
asterisk_guitools +
"&Var-000000=&Value-000000=" +
"&" +
- "Action-000001=append&Cat-000001=" +
asterisk_guitools +
"&Var-000001=exten&Value-000001=" +
- encodeURI('executecommand,1,System($)') +
"&" +
- "Action-000002=append&Cat-000002=" +
asterisk_guitools +
"&Var-000002=exten&Value-000002=" +
- encodeURI('executecommand,n,Wait(1)') + "&"
+
- "Action-000003=append&Cat-000003=" +
asterisk_guitools +
"&Var-000003=exten&Value-000003=" +
- encodeURI('executecommand,n,Hangup()') + "&"
+
- "Action-000004=append&Cat-000004=" +
asterisk_guitools +
"&Var-000004=exten&Value-000004=" +
- encodeURI('record_vmenu,1,Answer') + "&" +
- "Action-000005=append&Cat-000005=" +
asterisk_guitools +
"&Var-000005=exten&Value-000005=" +
- encodeURI('record_vmenu,n,Playback(vm-intro)') +
"&" +
- "Action-000006=append&Cat-000006=" +
asterisk_guitools +
"&Var-000006=exten&Value-000006=" +
- encodeURI('record_vmenu,n,Record($)') +
"&" +
- "Action-000007=append&Cat-000007=" +
asterisk_guitools +
"&Var-000007=exten&Value-000007=" +
- encodeURI('record_vmenu,n,Playback(vm-saved)') +
"&" +
- "Action-000008=append&Cat-000008=" +
asterisk_guitools +
"&Var-000008=exten&Value-000008=" +
- encodeURI('record_vmenu,n,Playback(vm-goodbye)') +
"&" +
- "Action-000009=append&Cat-000009=" +
asterisk_guitools +
"&Var-000009=exten&Value-000009=" +
- encodeURI('record_vmenu,n,Hangup') + "&" +
- "Action-0000010=append&Cat-0000010=" +
asterisk_guitools +
"&Var-000010=exten&Value-000010=" +
- encodeURI('play_file,1,Answer') + "&" +
- "Action-000011=append&Cat-000011=" +
asterisk_guitools +
"&Var-000011=exten&Value-000011=" +
- encodeURI('play_file,n,Playback($)') +
"&" +
- "Action-000012=append&Cat-000012=" +
asterisk_guitools +
"&Var-000012=exten&Value-000012=" +
- encodeURI('play_file,n,Hangup') + "&";
- var tmp = new Ajax.Request( asterisk_rawmanPath, opt) ;
+ var chs = new listOfActions();
+ chs.filename('extensions.conf'); var c = 0;
+ chs.build_action ( 'newcat', c , asterisk_guitools, '',
'');
+ chs.build_action ( 'append', c , asterisk_guitools,
'exten', 'executecommand,1,System($)' );
+ chs.build_action ( 'append', c , asterisk_guitools,
'exten', 'executecommand,n,Hangup()' );
+ chs.build_action ( 'append', c , asterisk_guitools,
'exten', 'record_vmenu,1,Answer' );
+ chs.build_action ( 'append', c , asterisk_guitools,
'exten', 'record_vmenu,n,Playback(vm-intro)' );
+ chs.build_action ( 'append', c , asterisk_guitools,
'exten', 'record_vmenu,n,Record($)' );
+ chs.build_action ( 'append', c , asterisk_guitools,
'exten', 'record_vmenu,n,Playback(vm-saved)' );
+ chs.build_action ( 'append', c , asterisk_guitools,
'exten', 'record_vmenu,n,Playback(vm-goodbye)' );
+ chs.build_action ( 'append', c , asterisk_guitools,
'exten', 'record_vmenu,n,Hangup' );
+ chs.build_action ( 'append', c , asterisk_guitools,
'exten', 'play_file,1,Answer' );
+ chs.build_action ( 'append', c , asterisk_guitools,
'exten', 'play_file,n,Playback($)' );
+ chs.build_action ( 'append', c , asterisk_guitools,
'exten', 'play_file,n,Hangup' );
+ chs.callActions(after);
}
</script>
Modified: branches/asterisknow/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/
branches/asterisknow/config/scripts/astman.js?view=diff&
rev=2124&r1=2123&r2=2124
============================================================
==================
--- branches/asterisknow/config/scripts/astman.js
(original)
+++ branches/asterisknow/config/scripts/astman.js Thu Jan 10
15:53:14 2008
 -49,6
+49,52 
var TIMERULES_CATEGORY = 'timebasedrules';
var isIE = false;
if(document.attachEvent){ isIE= true; }
+
+var listOfActions = function(){
+ this.current_batch = 1 ;
+ this.current_batch_actionnumber = 0;
+ this.actions = {};
+};
+
+listOfActions.prototype.filename= function(fn){
+ this.filename = fn;
+};
+listOfActions.prototype.getacn = function(nc){
+ return this.current_batch_actionnumber;
+};
+listOfActions.prototype.addNewChange = function(nc){
+ var t = 'act_' + this.current_batch;
+ if(!this.current_batch_actionnumber){
+ this.actions[t] = nc;
+ }else{
+ this.actions[t] = this.actions[t] + nc;
+ }
+ if( this.current_batch_actionnumber == 5 ){
+ this.current_batch++;
+ this.current_batch_actionnumber = 0;
+ }else{
+ this.current_batch_actionnumber++;
+ }
+};
+listOfActions.prototype.build_action =
function(a,x,b,c,d,e){
+ var z = this.getacn();
+ var nc = e?build_action(a, z, b, c, d, e):build_action(a,
z, b, c, d) ;
+ this.addNewChange(nc);
+};
+listOfActions.prototype.callActions= function(callback){
+ var pre_uri =
"action=updateconfig&srcfilename=" +
encodeURIComponent(this.filename) +
"&dstfilename=" +
encodeURIComponent(this.filename);
+ var treq = this.actions;
+ var start_sqreqs = function(st){
+ var f = treq[ 'act_' + st ];
+ if(f){
+ setTimeout( function(){
makerequest("","",pre_uri + f,
start_sqreqs(st+1) ); }, 500 );
+ }else{
+ setTimeout( callback , 600 ) ;
+ }
+ };
+ start_sqreqs(1);
+};
+
/* Some useful functions */
function isset(obj) {
_______________________________________________
--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
|