]> git.sur5r.net Git - bacula/bacula/blob - gui/baculum/protected/JavaScript/panel-window.js
Update ReleaseNotes + ChangeLog
[bacula/bacula] / gui / baculum / protected / JavaScript / panel-window.js
1 var PanelWindowClass = Class.create({
2
3         currentWindowId: null,
4         windowIds: ['dashboard', 'container', 'graphs', 'users'],
5         onShow: null,
6
7         initialize: function() {
8                 this.currentWindowId = this.windowIds[0];
9         },
10
11         hideOthers: function() {
12                 var hide_panel_by_id = function(id) {
13                         var el = $(id);
14                         if(el.visible() === true && id != this.currentWindowId) {
15                                 Effect.toggle(el, 'slide', {
16                                         duration: 0.3,
17                                         afterFinish: function() {
18                                                 el.hide();
19                                         }.bind(el)
20                                 });
21                         }
22                 }
23                 for (var i = 0; i < this.windowIds.length; i++) {
24                         hide_panel_by_id(this.windowIds[i]);
25                 }
26         },
27
28         show: function(id) {
29                 if($(id).visible() === true) {
30                         return;
31                 }
32
33                 this.currentWindowId = id;
34                 Effect.toggle(id, 'slide', {
35                         duration: 0.3,
36                         beforeStart: function() {
37                                 this.hideOthers();
38                         }.bind(this),
39                         afterFinish: function() {
40                                 if (this.onShow) {
41                                         this.onShow();
42                                 }
43                                 setContentWidth();
44                         }.bind(this)
45                 });
46         }
47 });
48
49 var PanelWindow;
50 document.observe("dom:loaded", function() {
51         PanelWindow = new PanelWindowClass();
52 });