]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/reports/oils_rpt_folder_window.js
fixed a bug that caused from-clause pruning to fail in some cases...
[working/Evergreen.git] / Open-ILS / web / reports / oils_rpt_folder_window.js
1
2
3
4
5 /* generic folder window class */
6 oilsRptSetSubClass('oilsRptFolderWindow', 'oilsRptObject');
7 function oilsRptFolderWindow(type, folderId) { 
8         this.init();
9         var node = oilsRptCurrentFolderManager.findNode(type, folderId);
10         this.selector = DOM.oils_rpt_folder_contents_selector;
11         this.folderNode = node;
12         this.type = type;
13 }
14
15
16 oilsRptFolderWindow.prototype.draw = function() {
17
18         _debug('drawing folder window for ' + this.folderNode.folder.name() );
19
20         var obj = this;
21         setSelector(DOM.oils_rpt_output_limit_selector, oilsRptOutputLimit);
22         setSelector(DOM.oils_rpt_output_limit_selector_2, oilsRptOutputLimit2);
23
24         DOM.oils_rpt_output_limit_selector.onchange = function() {
25                 oilsRptOutputLimit = getSelectorVal(DOM.oils_rpt_output_limit_selector);
26                 obj.draw();
27         }
28
29         DOM.oils_rpt_output_limit_selector_2.onchange = function() {
30                 oilsRptOutputLimit2 = getSelectorVal(DOM.oils_rpt_output_limit_selector_2);
31                 obj.draw();
32         }
33
34         var mine = ( this.folderNode.folder.owner().id() == USER.id() );
35
36         _debug('drawing folder window with type '+this.type);
37         if(mine) _debug('folder is mine...');
38
39         if( mine && this.type == 'template') 
40                 unHideMe(DOM.oils_rpt_folder_window_contents_new_template.parentNode);
41         else hideMe(DOM.oils_rpt_folder_window_contents_new_template.parentNode);
42
43         unHideMe(DOM.oils_rpt_folder_window_contents_div);
44         hideMe(DOM.oils_rpt_folder_manager_div);
45         hideMe(DOM.oils_rpt_top_folder);
46
47         DOM.oils_rpt_folder_window_manage_tab.onclick = function() {
48                 unHideMe(DOM.oils_rpt_folder_window_contents_div);
49                 hideMe(DOM.oils_rpt_folder_manager_div);
50         }
51         DOM.oils_rpt_folder_window_edit_tab.onclick = function() {
52                 hideMe(DOM.oils_rpt_folder_window_contents_div);
53                 unHideMe(DOM.oils_rpt_folder_manager_div);
54         }
55
56         this.setFolderEditActions();
57
58         hideMe(DOM.oils_rpt_template_folder_new_report);
59         unHideMe(DOM.oils_rpt_folder_table_right_td);
60         hideMe(DOM.oils_rpt_folder_table_alt_td);
61         this.drawFolderDetails();
62
63         DOM.oils_rpt_folder_content_action_go.onclick = 
64                 function() {obj.doFolderAction()}
65
66         this.fetchFolderData();
67
68         var sel = DOM.oils_rpt_folder_contents_action_selector;
69         var x = true;
70         for( var i = 0; i < sel.options.length; i++ ) {
71                 var opt = sel.options[i];
72
73                 if( !mine && opt.getAttribute('value').match(/move/) ) {
74                         hideMe(opt);
75                         continue;
76                 }
77
78                 if( opt.getAttribute('type') == this.type ) {
79                         if(x && !opt.disabled) {
80                                 opt.selected = true;
81                                 x = false;
82                         }
83                         unHideMe(opt);
84                 } else hideMe(opt);
85         }
86
87         this.drawEditActions();
88
89         var porg = PERMS.SHARE_REPORT_FOLDER;
90         if( porg < 1 ) 
91                 DOM.oils_rpt_folder_manager_share_opt.disabled = true;
92 }
93
94 oilsRptFolderWindow.prototype.drawEditActions = function() {
95
96         DOM.oils_rpt_folder_window_contents_new_template.onclick = function() {
97                 var s = location.search+'';
98                 s = s.replace(/\&folder=\d+/g,'');
99                 s = s.replace(/\&ct=\d+/g,'');
100                 goTo( 'oils_rpt_builder.xhtml'+s+'&folder='+obj.folderNode.folder.id());
101         }
102
103
104         if( this.folderNode.folder.owner().id() != USER.id() )
105                 hideMe(DOM.oils_rpt_folder_manager_tab_table);
106         else
107                 unHideMe(DOM.oils_rpt_folder_manager_tab_table);
108
109         if( isTrue(this.folderNode.folder.shared())) {
110                 DOM.oils_rpt_folder_manager_share_opt.disabled = true;
111                 DOM.oils_rpt_folder_manager_unshare_opt.disabled = false;
112         } else {
113                 DOM.oils_rpt_folder_manager_share_opt.disabled = false;
114                 DOM.oils_rpt_folder_manager_unshare_opt.disabled = true;
115         }
116
117         this.hideFolderActions();
118         var obj = this;
119
120         DOM.oils_rpt_folder_manager_actions_submit.onclick = function() {
121                 var act = getSelectorVal(DOM.oils_rpt_folder_manager_actions);
122                 _debug("doing folder action: " + act);
123                 obj.hideFolderActions();
124                 switch(act) {
125                         case 'change_name':
126                                 unHideMe(DOM.oils_rpt_folder_manager_change_name_div);
127                                 break;
128                         case 'create_sub_folder':
129                                 var porg = PERMS.SHARE_REPORT_FOLDER;
130                                 if( porg < 1 ) 
131                                         DOM.oils_rpt_folder_manager_sub_shared.disabled = true;
132                                 removeChildren(DOM.oils_rpt_folder_manager_sub_lib_picker);
133                                 unHideMe(DOM.oils_rpt_folder_manager_create_sub);
134                                 obj.myOrgSelector = new oilsRptMyOrgsWidget(
135                                         DOM.oils_rpt_folder_manager_sub_lib_picker, USER.ws_ou(), porg)
136                                 obj.myOrgSelector.draw();
137                                 break;
138                         case 'delete':
139                                 obj.doFolderDelete();
140                                 break;
141                         case 'share':
142                                 obj.shareFolder();
143                                 break;
144                         case 'unshare':
145                                 obj.unShareFolder();
146                                 break;
147                 }
148         }
149
150 }
151
152
153 oilsRptFolderWindow.prototype.shareFolder = function() {
154         var folder = this.folderNode.folder;
155         if(isTrue(folder.shared()))
156                 return alertId('oils_rpt_folder_already_shared');
157         unHideMe(DOM.oils_rpt_folder_manager_share_div);
158
159
160         var orgsel = new oilsRptMyOrgsWidget(
161                 DOM.oils_rpt_folder_manager_share_lib_picker, 
162                 USER.ws_ou(), PERMS.SHARE_REPORT_FOLDER);
163         orgsel.draw();
164
165         var type = this.type;
166         DOM.oils_rpt_folder_manager_share_submit.onclick = function() {
167                 folder.shared('t');
168                 folder.share_with(orgsel.getValue());
169                 oilsRptUpdateFolder( folder, type, 
170                         function(success) {
171                                 if(success) {
172                                         oilsRptAlertSuccess();
173                                         oilsRptCurrentFolderManager.draw();
174                                 }
175                         }
176                 );
177         }
178 }
179
180 oilsRptFolderWindow.prototype.unShareFolder = function() {
181         var folder = this.folderNode.folder;
182         if(!isTrue(folder.shared()))
183                 return alertId('oils_rpt_folder_already_unshared');
184         if(!confirmId('oils_rpt_folder_unshare_confirm')) return;
185         folder.shared('f');
186         var type = this.type;
187         oilsRptUpdateFolder( folder, type, 
188                 function(success) {
189                         if(success) {
190                                 oilsRptAlertSuccess();
191                                 oilsRptCurrentFolderManager.draw();
192                         }
193                 }
194         );
195 }
196
197
198 oilsRptFolderWindow.prototype.hideFolderActions = function() {
199         hideMe(DOM.oils_rpt_folder_manager_change_name_div);
200         hideMe(DOM.oils_rpt_folder_manager_create_sub);
201         hideMe(DOM.oils_rpt_folder_manager_share_div);
202 }
203
204
205 oilsRptFolderWindow.prototype.doFolderAction = function() {
206         var objs = (this.fmTable) ? this.fmTable.getSelected() : [];
207
208         if( this.type == 'output' && this.fmTable2 ) 
209                 objs = objs.concat( this.fmTable2.getSelected() );
210
211         if( objs.length == 0 ) 
212                 return alert('Please select an item from the list');
213         var action = getSelectorVal(DOM.oils_rpt_folder_contents_action_selector);
214
215         var obj = this;
216         var successCallback = function(errid) {
217                 if(errid) alertId(errid)
218                 else oilsRptAlertSuccess();
219                 obj.draw();
220         };
221
222         var obj = this;
223         switch(action) {
224                 case 'create_report' :
225                         hideMe(DOM.oils_rpt_folder_table_right_td);
226                         unHideMe(DOM.oils_rpt_folder_table_alt_td);
227                         unHideMe(DOM.oils_rpt_editor_div);
228                         new oilsRptReportEditor(new oilsReport(objs[0]), this);
229                         break;
230                 case 'delete_report' :
231                         if(!confirmId('oils_rpt_folder_contents_confirm_delete')) return;
232                         this.deleteReports(objs, 0, successCallback);
233                         break;
234
235                 case 'delete_template' :
236                         if(!confirmId('oils_rpt_folder_contents_confirm_delete')) return;
237                         this.deleteTemplates(objs, 0, successCallback);
238                         break;
239
240                 case 'show_output':
241                         this.showOutput(objs[0]);
242                         break;
243
244                 case 'delete_output':
245                         if(!confirmId('oils_rpt_folder_contents_confirm_delete')) return;
246                         this.deleteOutputs(objs,0, successCallback);
247                         break;
248
249                 case 'move_template':
250                         this.changeBatchFolder(objs, 'template', successCallback);
251                         break;
252
253                 case 'move_report':
254                         this.changeBatchFolder(objs, 'report', successCallback);
255                         break;
256
257                 case 'move_output':
258                         this.changeBatchFolder(objs, 'output', successCallback);
259                         break;
260
261                 case 'clone_template':
262                         this.cloneTemplate(objs[0]);
263         }
264 }
265
266 oilsRptFolderWindow.prototype.changeBatchFolder = function(objs, type, callback) {
267         hideMe(DOM.oils_rpt_folder_window_contents_table);
268         unHideMe(DOM.oils_rpt_move_folder_div)
269         var obj = this;
270         this.drawFolderOptions(type,    
271                 function(folderid) {
272                         obj.changeFolderList(objs, type, folderid, 0, callback);
273                         hideMe(DOM.oils_rpt_move_folder_div)
274                         unHideMe(DOM.oils_rpt_folder_window_contents_table);
275                 }
276         );
277 }
278
279 oilsRptFolderWindow.prototype.cloneTemplate = function(template) {
280         hideMe(DOM.oils_rpt_folder_window_contents_table);
281         unHideMe(DOM.oils_rpt_move_folder_div)
282         var obj = this;
283         this.drawFolderOptions('template',
284                 function(folderid) {
285                         var s = location.search+'';
286                         s = s.replace(/\&folder=\d+/g,'');
287                         s = s.replace(/\&ct=\d+/g,'');
288                         goTo('oils_rpt_builder.xhtml'+s+'&folder='+folderid+'&ct='+template.id());
289                 }
290         );
291 }
292
293
294 oilsRptFolderWindow.prototype.changeFolderList = function(list, type, folderid, idx, callback, errid) {
295         if( idx >= list.length ) return callback(errid);
296         var item = list[idx];
297         var obj = this;
298         var rcback = function(){obj.changeFolderList(list,type,folderid,++idx,callback,errid)};
299
300         item.folder(folderid);
301
302         switch(type) {
303                 case 'template':
304                         oilsRptUpdateTemplate(item,rcback);
305                         break;
306                 case 'report':
307                         oilsRptUpdateReport(item,rcback);
308                         break;
309                 case 'output':
310                         oilsRptUpdateSchedule(item,rcback);
311                         break;
312         }
313 }
314
315 oilsRptFolderWindow.prototype.drawFolderOptions = function(type, callback) {
316         //var oilsRptChangeFolderTree;
317         var selectedFolder;
318         oilsRptBuildFolder(
319                 type,
320                 DOM.oils_rpt_move_folder_picker,
321                 'tree9807897',
322                 'Change Folders',
323                 function(node) { 
324                         appendClear(DOM.oils_rpt_move_folder_selected, node.folder.name());
325                         selectedFolder = node.folder.id();
326                 } 
327         );
328
329         DOM.oils_rpt_change_folder_submit.onclick = function() {
330                 if(selectedFolder) callback(selectedFolder);
331         }
332
333         DOM.oils_rpt_change_folder_cancel.onclick = function() {
334                 hideMe(DOM.oils_rpt_move_folder_div)
335                 unHideMe(DOM.oils_rpt_folder_window_contents_table);
336         }
337 }
338
339
340 oilsRptFolderWindow.prototype.deleteOutputs = function(list, idx, callback, errid) {
341         if( idx >= list.length ) return callback(errid);
342         var output = list[idx];
343
344         if( output.runner().id()  != USER.id() ) {
345                 this.deleteOutputs(list, ++idx, 
346                         callback, 'oils_rpt_folder_contents_no_delete');
347
348         } else {
349                 _debug('deleting output ' + output.id());
350                 var req = new Request(OILS_RPT_DELETE_SCHEDULE,SESSION,output.id());
351                 var obj = this;
352                 req.callback(function(){obj.deleteOutputs(list, ++idx, callback, errid);});
353                 req.send();
354         }
355 }
356
357 oilsRptFolderWindow.prototype.showOutput = function(sched) {
358         oilsRptFetchReport(sched.report().id(), 
359                 function(r) {
360                         var url = oilsRptBuildOutputLink(r.template(), r.id(), sched.id());
361                         _debug("launching report output view at URL: " + url);
362                         if(isXUL()) 
363                                 xulG.new_tab(url,{"tab_name":"Report Output: " + r.name()},{})
364                         else {
365                                 //goTo(url);
366                                 var win = window.open(url,r.name(), 'resizable,width=800,height=600,scrollbars=1'); 
367                         }
368                 }
369         );
370 }
371
372
373 oilsRptFolderWindow.prototype.deleteReports = function(list, idx, callback, errid) {
374         if( idx >= list.length ) return callback(errid);
375         var report = list[idx];
376
377         if( report.owner().id() != USER.id() ) {
378                 this.deleteReports(list, ++idx, 
379                         callback, 'oils_rpt_folder_contents_no_delete');
380
381         } else {
382
383                 var obj = this;
384                 var req0 = new Request(OILS_RPT_REPORT_HAS_OUTS, SESSION, report.id());
385                 req0.callback(
386                         function(r0) {
387                                 var r0es = r0.getResultObject();
388                                 if( r0es != '0' ) {
389                                         obj.deleteReports(list, ++idx, 
390                                                 callback, 'oils_rpt_folder_contents_report_no_delete');
391                                 } else {
392                                         _debug('deleting report ' + report.id());
393                                         var req = new Request(OILS_RPT_DELETE_REPORT, SESSION, report.id());
394                                         req.callback(function(r) { 
395                                                 var res = r.getResultObject();
396                                                 if( res != 1 ) return oilsRptAlertFailure();
397                                                 obj.deleteReports(list, ++idx, callback, errid)
398                                         });
399                                         req.send();
400                                 }
401                         }
402                 );
403
404                 req0.send();
405         }
406 }
407
408 oilsRptFolderWindow.prototype.deleteTemplates = function(list, idx, callback, errid) {
409         if( idx >= list.length ) return callback(errid);
410         var tmpl = list[idx];
411
412         var obj = this;
413         if( tmpl.owner().id() != USER.id() ) {
414                 this.deleteTemplates(list, ++idx, 
415                         callback, 'oils_rpt_folder_contents_no_delete');
416
417         } else {
418
419                 var req0 = new Request( OILS_RPT_TEMPLATE_HAS_RPTS, SESSION, tmpl.id() );
420                 req0.callback(
421                         function(r0) {
422                                 var resp = r0.getResultObject();
423
424                                 if( resp != '0' ) {
425                                         obj.deleteTemplates(list, ++idx, 
426                                                 callback, 'oils_rpt_folder_contents_template_no_delete');
427
428                                 } else {
429                                         _debug('deleting template ' + tmpl.id());
430                                         var req = new Request(OILS_RPT_DELETE_TEMPLATE, SESSION, tmpl.id());
431                                         req.callback(function(r) {
432                                                 var res = r.getResultObject();
433                                                 if( res != 1 ) return oilsRptAlertFailure();
434                                                 obj.deleteTemplates(list, ++idx, callback, errid)
435                                         });
436                                         req.send();
437                                 }
438                         }
439                 );
440                 req0.send();
441         }
442 }
443
444
445
446 oilsRptFolderWindow.prototype.drawFolderDetails = function() {
447         appendClear(DOM.oils_rpt_folder_creator_label, 
448                 text(this.folderNode.folder.owner().usrname()));
449         appendClear(DOM.oils_rpt_folder_name_label, 
450                 text(this.folderNode.folder.name()));
451 }
452
453
454 oilsRptFolderWindow.prototype.fetchFolderData = function(callback) {
455
456         hideMe(DOM.oils_rpt_content_count_row_2);
457         hideMe(DOM.oils_rpt_content_row_2);
458
459         removeChildren(this.selector);
460         var req = new Request(OILS_RPT_FETCH_FOLDER_DATA, 
461                 SESSION, this.type, this.folderNode.folder.id(), oilsRptOutputLimit);
462
463         hideMe(DOM.oils_rpt_pending_output);
464
465         if(this.type == 'output') {
466                 unHideMe(DOM.oils_rpt_pending_output);
467                 /* first fetch the non-complete schedules */
468                 req = new Request(OILS_RPT_FETCH_OUTPUT, 
469                         SESSION, this.folderNode.folder.id(), oilsRptOutputLimit, 0);
470         }
471
472         var obj = this;
473         removeChildren(obj.selector);
474         req.callback(
475                 function(r) {
476                         var res = r.getResultObject();
477
478                         if( res.length == 0 ) {
479                                 //hideMe(DOM.oils_rpt_content_count_row); /* this also hides the new-template link.. fix me */
480                                 hideMe(DOM.oils_rpt_content_row);
481                                 unHideMe(DOM.oils_rpt_content_row_empty);
482                         } else {
483                                 unHideMe(DOM.oils_rpt_content_count_row);
484                                 unHideMe(DOM.oils_rpt_content_row);
485                                 hideMe(DOM.oils_rpt_content_row_empty);
486                         }
487
488                         if( obj.type == 'output' ) {
489                                 obj.fleshSchedules(res, 0, obj.selector);
490                         } else {
491
492
493                                 obj.fmTable = drawFMObjectTable( 
494                                         { 
495                                                 dest : obj.selector, 
496                                                 obj : res,
497                                                 selectCol : true,
498                                                 selectColName : 'Select',
499                                                 selectAllName : 'All',
500                                                 selectNoneName : 'None'
501                                         }
502                                 );
503                         }
504                 }
505         );
506         req.send();
507
508         if( this.type != 'output' ) return;
509
510         /*
511         unHideMe(DOM.oils_rpt_content_count_row_2);
512         unHideMe(DOM.oils_rpt_content_row_2);
513         */
514
515         /* now fetch the completed schedules */
516         req = new Request(OILS_RPT_FETCH_OUTPUT, 
517                 SESSION, this.folderNode.folder.id(), oilsRptOutputLimit2, 1);
518
519         _debug("TRYING: fleshing finished scheds with div: " + DOM.oils_rpt_folder_contents_selector_2);
520         removeChildren(DOM.oils_rpt_folder_contents_selector_2);
521         req.callback(
522                 function(r) {
523                         var res = r.getResultObject();
524
525                         if( res.length == 0 ) {
526                                 hideMe(DOM.oils_rpt_content_count_row_2);
527                                 hideMe(DOM.oils_rpt_content_row_2);
528                         } else {
529                                 unHideMe(DOM.oils_rpt_content_count_row_2);
530                                 unHideMe(DOM.oils_rpt_content_row_2);
531                         }
532
533                         _debug("fleshing finished scheds with div: " + DOM.oils_rpt_folder_contents_selector_2);
534                         obj.fleshSchedules(res, 0, DOM.oils_rpt_folder_contents_selector_2, true);
535                 }
536         );
537         req.send();
538 }
539
540
541 oilsRptFolderWindow.prototype.fleshSchedules = function(list, idx, selector, isSecond) {
542
543         if( idx >= list.length ) return;
544
545         var sched = list[idx];
546         var obj = this;
547
548         oilsRptFetchUser(sched.runner(),
549
550                 function(user) {
551                         sched.runner(user);
552                         oilsRptFetchTemplate(sched.report().template(),
553
554                                 function(template) {
555                                         sched.report().template(template);
556                                         if( idx == 0 ) {
557                                                 _debug("drawing schedule with output: "+selector);
558                                                 var t = drawFMObjectTable( 
559                                                         { 
560                                                                 dest : selector, 
561                                                                 obj : [sched],
562                                                                 selectCol : true,
563                                                                 selectColName : 'Select',
564                                                                 selectAllName : 'All',
565                                                                 selectNoneName : 'None'
566                                                         }
567                                                 );
568
569                                                 if( isSecond ) obj.fmTable2 = t;
570                                                 else obj.fmTable = t;
571
572                                         } else {
573                                                 //obj.fmTable.add(sched);
574                                                 if( isSecond ) obj.fmTable2.add(sched);
575                                                 else obj.fmTable.add(sched);
576                                         }
577
578                                         obj.fleshSchedules(list, ++idx, selector, isSecond);
579                                 }
580                         );
581                 }
582         );
583 }
584
585
586 oilsRptFolderWindow.prototype.setSelected = function(folderNode) {
587         this.selectedFolder = folderNode;
588 }
589
590 oilsRptFolderWindow.prototype.setFolderEditActions = function() {
591         var folder = this.folderNode.folder;
592
593         var obj = this;
594         DOM.oils_rpt_folder_manager_name_input.value = folder.name();
595         DOM.oils_rpt_folder_manager_change_name_submit.onclick = function() {
596                 var name = DOM.oils_rpt_folder_manager_name_input.value;
597                 if(name) {
598                         folder.name( name );
599                         if(confirmId('oils_rpt_folder_manager_change_name_confirm')) {
600                                 oilsRptUpdateFolder(folder, obj.type,
601                                         function(success) {
602                                                 if(success) {
603                                                         oilsRptAlertSuccess();
604                                                         oilsRptCurrentFolderManager.draw();
605                                                 }
606                                         }
607                                 );
608                         }
609                 }
610         }
611
612         DOM.oils_rpt_folder_manager_sub_lib_create.onclick = function() {
613                 var folder;
614
615                 if( obj.type == 'report' ) folder = new rrf();
616                 if( obj.type == 'template' ) folder = new rtf();
617                 if( obj.type == 'output' ) folder = new rof();
618
619                 folder.owner(USER.id());
620                 folder.parent(obj.folderNode.folder.id());
621                 folder.name(DOM.oils_rpt_folder_manager_sub_name.value);
622                 var shared = getSelectorVal(DOM.oils_rpt_folder_manager_sub_shared);
623                 folder.shared( (shared == 'yes') ? 't' : 'f');
624                 if( folder.shared() == 't' )
625                         folder.share_with( obj.myOrgSelector.getValue() );
626
627                 oilsRptCreateFolder(folder, obj.type,
628                         function(success) {
629                                 if(success) {
630                                         oilsRptAlertSuccess();
631                                         oilsRptCurrentFolderManager.draw();
632                                 }
633                         }
634                 );
635         }
636 }
637
638
639 oilsRptFolderWindow.prototype.doFolderDelete = function() {
640         
641         var cache = oilsRptFolderNodeCache[this.type];
642         /* let's see if this folder has any children */
643         for( var c in cache ) 
644                 if( cache[c].folder.parent() == this.folderNode.folder.id() )
645                         return alertId('oils_rpt_folder_cannot_delete');
646
647         /* lets see if the folder has contents */
648         var req = new Request(OILS_RPT_FETCH_FOLDER_DATA, 
649                 SESSION, this.type, this.folderNode.folder.id(), 1);
650
651         if(this.type == 'output') {
652                 req = new Request(OILS_RPT_FETCH_OUTPUT, 
653                         SESSION, this.folderNode.folder.id(), 1);
654         }
655
656         var obj = this;
657         req.send();
658
659         req.callback( 
660                 function(r) {
661
662                         var contents = r.getResultObject();
663                         if( contents.length > 0 ) 
664                                 return alertId('oils_rpt_folder_cannot_delete');
665
666                         if( confirmId('oils_rpt_folder_manager_delete_confirm') ) {
667                                 var req2 = new Request(OILS_RPT_DELETE_FOLDER, 
668                                         SESSION, obj.type, obj.folderNode.folder.id());
669         
670                                 req2.callback( 
671                                         function(r2) {
672                                                 var res = r2.getResultObject();
673                                                 if( res == 1 ) {
674                                                         oilsRptAlertSuccess();
675                                                         oilsRptCurrentFolderManager.draw();
676                                                 }
677                                                 else alert('error: '+js2JSON(res));
678                                         }
679                                 );
680
681                                 req2.send();
682                         }
683                 }
684         );
685 }
686
687