diff --git a/module/block/control.php b/module/block/control.php index 86be685770..5fd875299e 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -152,6 +152,28 @@ class block extends control $this->send(array('result' => 'success')); } + /** + * Resize block + * @param integer $id + * @access public + * @return void + */ + public function resize($id, $grid = 4) + { + $block = $this->block->getByID($id); + if($block) + { + $block->grid = $grid; + $this->dao->replace(TABLE_BLOCK)->data($block)->exec(); + if(dao::isError()) $this->send(array('result' => 'fail', 'code' => 500)); + $this->send(array('result' => 'success')); + } + else + { + $this->send(array('result' => 'fail', 'code' => 404)); + } + } + /** * Display dashboard for app. * diff --git a/module/block/js/dashboard.js b/module/block/js/dashboard.js index 0ac2b97e95..40f127ade1 100644 --- a/module/block/js/dashboard.js +++ b/module/block/js/dashboard.js @@ -35,7 +35,7 @@ function sortBlocks(orders) $.getJSON(createLink('block', 'sort', 'orders=' + newOrders.join(',') + '&module=' + module), function(data) { - if(data.result == 'success') $.zui.messager.success(config.ordersSaved); + // if(data.result == 'success') $.zui.messager.success(config.ordersSaved); }); } @@ -51,6 +51,15 @@ function checkEmpty() $dashboard.find('.dashboard-empty-message').toggleClass('hide', hasBlocks); } +function resizeBlock(event) +{ + var blockID = event.element.find('.panel').data('id'); + $.getJSON(createLink('block', 'resize', 'id=' + blockID + '&grid=' + event.grid), function(data) + { + if(data.result !== 'success') event.revert(); + }); +} + $(function() { @@ -62,7 +71,9 @@ $(function() afterOrdered : sortBlocks, afterPanelRemoved : deleteBlock, sensitive : true, - panelRemovingTip : config.confirmRemoveBlock + panelRemovingTip : config.confirmRemoveBlock, + resizable : true, + onResize : resizeBlock }); $dashboard.find('ul.dashboard-actions').addClass('hide').children('li').addClass('right').appendTo($('#modulemenu > .nav')); diff --git a/www/js/my.full.js b/www/js/my.full.js index f59c3626db..2d23dc1f3a 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -1759,8 +1759,9 @@ function initHelpLink() function initMainMenu() { var $menu = $('#mainmenu > .nav'); - $menu.sortable(); + $menu.sortable({ + }); } /* Ping the server every some minutes to keep the session. */