- Timestamp:
- 11/12/08 18:16:59 (8 weeks ago)
- Location:
- branches/iclerencia/dashboard/client/ebox/src
- Files:
-
- 3 modified
-
EBox/Module.pm (modified) (1 diff)
-
templates/dashboard/configurewidgets.mas (modified) (2 diffs)
-
templates/dashboard/index.mas (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/iclerencia/dashboard/client/ebox/src/EBox/Module.pm
r11594 r11645 709 709 if(defined($winfo)) { 710 710 my $widget = $winfo->{'widget'}->($self, $name, $winfo->{'title'}); 711 $widget->{'module'} = $self->{'name'}; 711 712 unless(UNIVERSAL::can($widget,'isa') and 712 713 $widget->isa('EBox::Dashboard::Widget')) { -
branches/iclerencia/dashboard/client/ebox/src/templates/dashboard/configurewidgets.mas
r11626 r11645 43 43 var wid = "widget_" + module + ":" + widname; 44 44 var drag = new Draggable(wid, { 45 onStart: function(d) { 46 if(!this.loaded) { 47 new Ajax.Updater(d.element.id, 48 '/ebox/Dashboard/Widget?module=' + 49 d.module + '&widget=' + d.widget, { 50 method: 'get', 51 onComplete: function() { 52 var elements = $(d.element.id).getElementsByClassName('closeBox'); 53 Effect.toggle(elements[0],'appear'); 54 } 55 }); 56 this.loaded = true; 45 onDrag: function(d,e) { 46 if(e.clientY > 100) { 47 if(!this.loaded) { 48 new Ajax.Updater(d.element.id, 49 '/ebox/Dashboard/Widget?module=' + 50 d.module + '&widget=' + d.widget, { 51 method: 'get', 52 onComplete: function() { 53 var elements = $(d.element.id).getElementsByClassName('closeBox'); 54 Effect.toggle(elements[0],'appear'); 55 } 56 }); 57 this.loaded = true; 58 } 57 59 } 58 60 }, … … 71 73 var func = null; 72 74 if(widget_name_list[j].indexOf("dashboard") == 0) { 73 func = function(dashboard) { 74 var id = dashboard.id; 75 new Ajax.Request("/ebox/Dashboard/Update", { 76 method: "post", 77 parameters: { dashboard: id, widgets: Sortable.sequence(id).join(',') } 78 }); 79 }; 75 Sortable.create(widget_name_list[j], { 76 tag: "div", 77 handle: "widgetHandle", 78 dropOnEmpty: true, 79 constraint: false, 80 scroll: window, 81 containment: widget_name_list, 82 onUpdate: function(dashboard) { 83 var id = dashboard.id; 84 new Ajax.Request("/ebox/Dashboard/Update", { 85 method: "post", 86 parameters: { dashboard: id, widgets: Sortable.sequence(id).join(',') } 87 }); 88 } 89 }); 80 90 } else { 81 func = function() {}; 91 var d = new Draggable(widget_name_list[j], { 92 handle: "widgetHandle", 93 constraint: false, 94 scroll: window 95 }); 96 d.element.onChange = function() {} 97 Sortable.sortables[d.element.id] = d.element; 82 98 } 83 Sortable.create(widget_name_list[j], {84 tag: "div",85 handle: "widgetHandle",86 dropOnEmpty: true,87 constraint: false,88 scroll: window,89 containment: widget_name_list,90 onUpdate: func91 });92 99 } 93 100 } -
branches/iclerencia/dashboard/client/ebox/src/templates/dashboard/index.mas
r11638 r11645 6 6 <%init> 7 7 use EBox::Gettext; 8 my @urls;9 8 </%init> 10 9 <link href="/data/css/modalbox.css" rel="stylesheet" type="text/css" /> … … 57 56 <br/> 58 57 % foreach my $widget (@dashboard1) { 59 % push(@urls, '/ebox/Dashboard/WidgetJSON?module=' . $widget->{module} . '&widget=' . $widget->{name});60 58 <& dashboard/widget.mas, widget => $widget, toggled => \%toggled &> 61 59 % } … … 64 62 <br/> 65 63 % foreach my $widget (@dashboard2) { 66 % push(@urls, '/ebox/Dashboard/WidgetJSON?module=' . $widget->{module} . '&widget=' . $widget->{name});67 64 <& dashboard/widget.mas, widget => $widget, toggled => \%toggled &> 68 65 % } … … 127 124 % } 128 125 129 % my $urlstr = join(",", map {qq/"$_"/} @urls);130 var urls = new Array(<% $urlstr %>);131 132 126 function updateWidget(widget) { 133 127 if(widget == null) { … … 135 129 } 136 130 widget.sections.each(function(s) { 137 var sectname = widget. name + '_' + s.name;131 var sectname = widget.module + ":" + widget.name + '_' + s.name; 138 132 s.items.each(function(item,i) { 139 133 var itemname = sectname + '_' + i; … … 183 177 184 178 function updateWidgets() { 185 urls.each(function(u) { 186 new Ajax.Request(u, { 179 var widgets = Sortable.sequence("dashboard1").concat(Sortable.sequence("dashboard2")); 180 widgets.each(function(w) { 181 var parts = w.split(':'); 182 var url = '/ebox/Dashboard/WidgetJSON?module=' + parts[0] + '&widget=' + parts[1]; 183 new Ajax.Request(url, { 187 184 method: "get", 188 185 asynchronous: false,
