123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- /*
- Jquery.dashboard V1.0
- @author V.carruesco aka idleman
- @mail idleman@idleman.fr
- @licence CC-by-nc-sa
- */
- $(document).ready(function(){
- var view = $('#dashboard_switch').val();
- plugin_dashboard_load_view(view);
- });
- function plugin_dashboard_load_view(view){
- if($.trim(view) =='') return;
- $.ajax({
- dataType: "json",
- url: 'action.php?action=GET_WIDGETS',
- data : {dashboard : view},
- success: function(response){
-
- $('#dashboard').dashboard({
- models: response.model ,
- data: response.data ,
- onCreate : function(widget,bloc,column,cell){
- $.ajax({
- dataType: "json",
- url: 'action.php?action=ADD_WIDGET',
- data : {view : $('#dashboard_switch').val(),model : widget['uid'],data:widget['data'] , column:column,cell:cell},
- method : 'POST',
- success : function(response){
- $.dashboard.setBlocData(bloc,response);
- if(widget.onLoad!=null){
- $.ajax({
- url : widget.onLoad,
- data : {id:widget.id},
- method : 'POST',
- success : function(response2){
- $.dashboard.setBlocData(bloc,response2);
- }
- });
- }
- }
- });
-
- },
- onLoad : function(model,widget){
-
- },
- onDelete : function(widget,bloc){
-
- $.ajax({
- dataType: "json",
- url: 'action.php?action=DELETE_WIDGET',
- data : {id : widget.id},
- method : 'POST'
- });
- if(widget.onDelete!=null){
- $.ajax({
- url : widget.onDelete,
- data : {id:widget.id},
- method : 'POST'
- });
- }
- },
- onMinimize : function(widget){
-
- $.ajax({
- dataType: "json",
- url: 'action.php?action=MINIMIZE_WIDGET',
- data : {id : widget.id},
- method : 'POST'
- });
- if(widget.onMinimize!=null){
- $.ajax({
- url : widget.onMinimize,
- data : {id:widget.id},
- method : 'POST'
- });
- }
- },
- onMaximize : function(widget){
-
- $.ajax({
- dataType: "json",
- url: 'action.php?action=MAXIMIZE_WIDGET',
- data : {id : widget.id},
- method : 'POST'
- });
- if(widget.onMaximize!=null){
- $.ajax({
- url : id.onMaximize,
- data : {id:widget.id},
- method : 'POST'
- });
- }
- },
- onMove : function(widget,sort){
-
- $.ajax({
- dataType: "json",
- url: 'action.php?action=MOVE_WIDGET',
- data : {id : widget.id , sort : sort},
- method : 'POST'
- });
- if(widget.onMove!=null){
- $.ajax({
- url : widget.onMove,
- data : {id:widget.id, sort : sort},
- method : 'POST'
- });
- }
- }
- });
- }
- });
-
- }
|