From edaec54a5d796280c72315fb764e243d4148a356 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Fri, 4 May 2012 15:00:18 +0200 Subject: [PATCH] CC-3724 : Now Playing -> Timeline view: to drag and drop single file very fast will block adding the same file using jquery.blockUI.js on timeline/playlist builder pages. --- .../controllers/PlaylistController.php | 1 + .../controllers/ShowbuilderController.php | 3 +- airtime_mvc/public/css/playlist_builder.css | 10 -- airtime_mvc/public/css/showbuilder.css | 2 +- airtime_mvc/public/js/airtime/library/spl.js | 91 +++++++++---------- .../public/js/airtime/showbuilder/builder.js | 33 +++++++ 6 files changed, 80 insertions(+), 60 deletions(-) diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index bf84aef13..f53a99754 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -113,6 +113,7 @@ class PlaylistController extends Zend_Controller_Action $request = $this->getRequest(); $baseUrl = $request->getBaseUrl(); + $this->view->headScript()->appendFile($baseUrl.'/js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index 9339ac087..725c85419 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -48,7 +48,8 @@ class ShowbuilderController extends Zend_Controller_Action $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - + + $this->view->headScript()->appendFile($baseUrl.'/js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); diff --git a/airtime_mvc/public/css/playlist_builder.css b/airtime_mvc/public/css/playlist_builder.css index 9e4a88425..3c474ac4b 100644 --- a/airtime_mvc/public/css/playlist_builder.css +++ b/airtime_mvc/public/css/playlist_builder.css @@ -449,14 +449,4 @@ div.helper li { li.spl_empty { height: 56px; -} - -.pl-overlay { - z-index:100; - opacity: 0.7; -} - -.pl-loading { - z-index:101; - background: transparent url(images/loader.gif) no-repeat 0 0; } \ No newline at end of file diff --git a/airtime_mvc/public/css/showbuilder.css b/airtime_mvc/public/css/showbuilder.css index b67cef15d..84a0151c7 100644 --- a/airtime_mvc/public/css/showbuilder.css +++ b/airtime_mvc/public/css/showbuilder.css @@ -1,7 +1,7 @@ @CHARSET "UTF-8"; .sb-content { - overflow: hidden; + overflow: hidden; } .sb-content .dataTables_scrolling { diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index 927ca3d08..114e731ae 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -639,62 +639,57 @@ var AIRTIME = (function(AIRTIME){ }); }; + mod.disableUI = function() { + + $lib.block({ + message: "", + theme: true, + applyPlatformOpacityRules: false + }); + + $pl.block({ + message: "", + theme: true, + applyPlatformOpacityRules: false + }); + }; + + mod.enableUI = function() { + + $lib.unblock(); + $pl.unblock(); + + //Block UI changes the postion to relative to display the messages. + $lib.css("position", "static"); + $pl.css("position", "static"); + }; + + function playlistResponse(json){ + + if (json.error !== undefined) { + playlistError(json); + } + else { + setPlaylistContent(json); + } + + mod.enableUI(); + } + function playlistRequest(sUrl, oData) { - var lastMod = getModified(), - plContent = $("#side_playlist"), - offset = plContent.offset(), - plHeight = plContent.height(), - plWidth = plContent.width(), - overlay, - loading; + var lastMod; + + mod.disableUI(); + + lastMod = getModified(); oData["modified"] = lastMod; oData["format"] = "json"; - - overlay = $("
", { - "class": "pl-overlay ui-widget-content", - "css": { - "position": "absolute", - "top": offset.top, - "left": offset.left, - "height": plHeight + 16, - "width": plWidth + 16 - } - }).click(function(){ - return false; - }); - - loading = $("
", { - "class": "pl-loading", - "css": { - "position": "absolute", - "top": offset.top + plHeight/2 - 32 - 8, - "left": offset.left + plWidth/2 - 32 -8, - "height": 64, - "width": 64 - } - }); - - $("body") - .append(overlay) - .append(loading); - $.post( sUrl, oData, - function(json){ - - if (json.error !== undefined) { - playlistError(json); - } - else { - setPlaylistContent(json); - } - - loading.remove(); - overlay.remove(); - } + playlistResponse ); } diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js index 4582d4466..c2d6292b9 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js @@ -145,13 +145,42 @@ var AIRTIME = (function(AIRTIME){ mod.checkToolBarIcons(); }; + mod.disableUI = function() { + + $lib.block({ + message: "", + theme: true, + applyPlatformOpacityRules: false + }); + + $sbContent.block({ + message: "", + theme: true, + applyPlatformOpacityRules: false + }); + }; + + mod.enableUI = function() { + + $lib.unblock(); + $sbContent.unblock(); + + //Block UI changes the postion to relative to display the messages. + $lib.css("position", "static"); + $sbContent.css("position", "static"); + }; + mod.fnItemCallback = function(json) { checkError(json); oSchedTable.fnDraw(); + + mod.enableUI(); }; mod.fnAdd = function(aMediaIds, aSchedIds) { + mod.disableUI(); + $.post("/showbuilder/schedule-add", {"format": "json", "mediaIds": aMediaIds, "schedIds": aSchedIds}, mod.fnItemCallback @@ -160,6 +189,8 @@ var AIRTIME = (function(AIRTIME){ mod.fnMove = function(aSelect, aAfter) { + mod.disableUI(); + $.post("/showbuilder/schedule-move", {"format": "json", "selectedItem": aSelect, "afterItem": aAfter}, mod.fnItemCallback @@ -168,6 +199,8 @@ var AIRTIME = (function(AIRTIME){ mod.fnRemove = function(aItems) { + mod.disableUI(); + $.post( "/showbuilder/schedule-remove", {"items": aItems, "format": "json"}, mod.fnItemCallback