diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index b7d2cf3d5..82faa4b89 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -34,7 +34,7 @@ class LibraryController extends Zend_Controller_Action $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $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.colReorder.min.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/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); @@ -46,7 +46,7 @@ class LibraryController extends Zend_Controller_Action $this->view->headLink()->appendStylesheet($baseUrl.'css/media_library.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/dataTables.colReorder.min.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/waveform.css?'.$CC_CONFIG['airtime_version']); $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); diff --git a/airtime_mvc/application/controllers/ShowBuilderController.php b/airtime_mvc/application/controllers/ShowBuilderController.php index 28cb0bcfc..b46172a52 100644 --- a/airtime_mvc/application/controllers/ShowBuilderController.php +++ b/airtime_mvc/application/controllers/ShowBuilderController.php @@ -22,7 +22,7 @@ class ShowBuilderController extends Zend_Controller_Action { $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $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.colReorder.min.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/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); @@ -33,7 +33,7 @@ class ShowBuilderController extends Zend_Controller_Action { $this->view->headLink()->appendStylesheet($baseUrl.'css/media_library.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/dataTables.colReorder.min.css?'.$CC_CONFIG['airtime_version']); $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/_library.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/_library_showbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); diff --git a/airtime_mvc/application/views/scripts/form/edit-user.phtml b/airtime_mvc/application/views/scripts/form/edit-user.phtml index a36e1aaf9..45f45ee73 100644 --- a/airtime_mvc/application/views/scripts/form/edit-user.phtml +++ b/airtime_mvc/application/views/scripts/form/edit-user.phtml @@ -1,4 +1,4 @@ -

escape($this->currentUser)) ?>

+

isSuperAdmin()) : ?> diff --git a/airtime_mvc/public/css/datatables/css/ColReorder.css b/airtime_mvc/public/css/datatables/css/dataTables.colReorder.css similarity index 53% rename from airtime_mvc/public/css/datatables/css/ColReorder.css rename to airtime_mvc/public/css/datatables/css/dataTables.colReorder.css index 6bb55e22c..bdd6aa0b9 100644 --- a/airtime_mvc/public/css/datatables/css/ColReorder.css +++ b/airtime_mvc/public/css/datatables/css/dataTables.colReorder.css @@ -3,12 +3,12 @@ */ table.DTCR_clonedTable { - background-color: white; - z-index: 998; + background-color: rgba(255, 255, 255, 0.7); + z-index: 202; } div.DTCR_pointer { width: 1px; - background-color: #5B5B5B; - z-index: 997; + background-color: #0259C4; + z-index: 201; } \ No newline at end of file diff --git a/airtime_mvc/public/css/datatables/css/dataTables.colReorder.min.css b/airtime_mvc/public/css/datatables/css/dataTables.colReorder.min.css new file mode 100644 index 000000000..77b230e01 --- /dev/null +++ b/airtime_mvc/public/css/datatables/css/dataTables.colReorder.min.css @@ -0,0 +1 @@ +table.DTCR_clonedTable{background-color:rgba(255,255,255,0.7);z-index:202}div.DTCR_pointer{width:1px;background-color:#0259C4;z-index:201} diff --git a/airtime_mvc/public/css/datatables/images/insert.png b/airtime_mvc/public/css/datatables/images/insert.png new file mode 100644 index 000000000..15d5522da Binary files /dev/null and b/airtime_mvc/public/css/datatables/images/insert.png differ diff --git a/airtime_mvc/public/css/media_library.css b/airtime_mvc/public/css/media_library.css index 40f3aa4d7..f76078df8 100644 --- a/airtime_mvc/public/css/media_library.css +++ b/airtime_mvc/public/css/media_library.css @@ -109,6 +109,38 @@ td.library_bitrate { text-align: right; } +td.library_actions +{ + padding: 0px !important; +} + +.library_actions_btn { + float: left; + font-weight: bold; + white-space: nowrap; + border: 1px solid #ccc; + border-radius: 50%; + height: 24px; + width: 18px; + padding: 0px !important; + margin: 0px !important; + margin-top: 0px !important; + margin-right: 6px !important; + line-height: 17px !important; + padding-left: 6px !important; +} + +.library_actions_btn:hover { + background: #555; +} +tr.lib-selected > td > div.library_actions_btn { + border-color: #000; +} +tr.lib-selected > td > div.library_actions_btn:hover { + background: #000; + color: #eee; +} + .library_import { padding-bottom: 5px; } diff --git a/airtime_mvc/public/js/airtime/library/_library.js b/airtime_mvc/public/js/airtime/library/_library.js index b0a85163f..2a285178f 100644 --- a/airtime_mvc/public/js/airtime/library/_library.js +++ b/airtime_mvc/public/js/airtime/library/_library.js @@ -150,7 +150,8 @@ var AIRTIME = (function(AIRTIME) { "
  • " + $.i18n._("Deselect this page") + "
  • " + "
  • " + $.i18n._("Deselect all") + "
  • " + "" + - "
    "); + "" + ); }; mod.moveSearchBarToHeader = function() { @@ -438,10 +439,6 @@ var AIRTIME = (function(AIRTIME) { } }; - mod.initializeContextMenus = function() { - - }; - libraryInit = function() { @@ -611,7 +608,8 @@ var AIRTIME = (function(AIRTIME) { /* Track Number */ { "sTitle" : $.i18n._("Track Number") , "mDataProp" : "track_number" , "bVisible" : false , "sClass" : "library_track" , "sWidth" : "125px" }, /* Upload Time */ { "sTitle" : $.i18n._("Uploaded") , "mDataProp" : "utime" , "bVisible" : false , "sClass" : "library_upload_time" , "sWidth" : "155px" }, /* Website */ { "sTitle" : $.i18n._("Website") , "mDataProp" : "info_url" , "bVisible" : false , "sClass" : "library_url" , "sWidth" : "150px" }, - /* Year */ { "sTitle" : $.i18n._("Year") , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" } + /* Year */ { "sTitle" : $.i18n._("Year") , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" }, + /* Context Menu */ { "sTitle" : "" , "mData" : null , "bSortable" : false , "sClass" : "library_actions" , "bSearchable" : false , "sWidth" : "16px" } ], "bProcessing": true, @@ -714,6 +712,12 @@ var AIRTIME = (function(AIRTIME) { // add checkbox $(nRow).find('td.library_checkbox').html(""); + $(nRow).find('td.library_actions') + .text("...") + .on('click', function(e) { + $(this).contextMenu({x: $(e.target).offset().left, y: $(e.target).offset().top}) + }).html("
    ...
    "); + // add audio preview image/button if (aData.ftype === "audioclip") { $(nRow).find('td.library_type').html(''); @@ -774,13 +778,14 @@ var AIRTIME = (function(AIRTIME) { "oColVis": { "sAlign": "right", - "aiExclude": [0, 1, 2], + "aiExclude": [0, 1, 2, 31], "sSize": "css", "fnStateChange": setFilterElement, "buttonText": $.i18n._("Columns") }, "oColReorder": { + "iFixedColumnsRight": 1, "iFixedColumns": 3 }, @@ -933,13 +938,15 @@ var AIRTIME = (function(AIRTIME) { } }); - AIRTIME.library.initializeContextMenus(); + $('#sb-actions').on("click", function(e) { + $("#library_display tr:has(td)").contextMenu({x: $(e.target).offset().left, y: $(e.target).offset().top}); + }); - /* // begin context menu initialization. - $.contextMenu({ + AIRTIME.library.ctxMenu = $.contextMenu({ selector: '#library_display tr:has(td)', - trigger: "right", + //trigger: "left", + trigger: "custom", build: function($el, e) { var data, screen, items, callback, $tr; @@ -1127,7 +1134,6 @@ var AIRTIME = (function(AIRTIME) { }; } }); - */ }; mod.libraryInit = libraryInit; diff --git a/airtime_mvc/public/js/datatables/plugin/dataTables.ColReorder.js b/airtime_mvc/public/js/datatables/plugin/dataTables.ColReorder.js deleted file mode 100644 index 35b96594f..000000000 --- a/airtime_mvc/public/js/datatables/plugin/dataTables.ColReorder.js +++ /dev/null @@ -1,982 +0,0 @@ -/* - * File: ColReorder.js - * Version: 1.0.8 - * CVS: $Id$ - * Description: Allow columns to be reordered in a DataTable - * Author: Allan Jardine (www.sprymedia.co.uk) - * Created: Wed Sep 15 18:23:29 BST 2010 - * Modified: $Date$ by $Author$ - * Language: Javascript - * License: GPL v2 or BSD 3 point style - * Project: DataTables - * Contact: www.sprymedia.co.uk/contact - * - * Copyright 2010-2011 Allan Jardine, all rights reserved. - * - * This source file is free software, under either the GPL v2 license or a - * BSD style license, available at: - * http://datatables.net/license_gpl2 - * http://datatables.net/license_bsd - * - */ - - -(function($, window, document) { - - -/** - * Switch the key value pairing of an index array to be value key (i.e. the old value is now the - * key). For example consider [ 2, 0, 1 ] this would be returned as [ 1, 2, 0 ]. - * @method fnInvertKeyValues - * @param array aIn Array to switch around - * @returns array - */ -function fnInvertKeyValues( aIn ) -{ - var aRet=[]; - for ( var i=0, iLen=aIn.length ; i= iCols ) - { - this.oApi._fnLog( oSettings, 1, "ColReorder 'from' index is out of bounds: "+iFrom ); - return; - } - - if ( iTo < 0 || iTo >= iCols ) - { - this.oApi._fnLog( oSettings, 1, "ColReorder 'to' index is out of bounds: "+iTo ); - return; - } - - /* - * Calculate the new column array index, so we have a mapping between the old and new - */ - var aiMapping = []; - for ( i=0, iLen=iCols ; i this.s.fixed-1 ) - { - this._fnMouseListener( i, this.s.dt.aoColumns[i].nTh ); - } - - /* Mark the original column order for later reference */ - this.s.dt.aoColumns[i]._ColReorder_iOrigCol = i; - } - - /* State saving */ - this.s.dt.oApi._fnCallbackReg( this.s.dt, 'aoStateSaveParams', function (oS, oData) { - that._fnStateSave.call( that, oData ); - }, "ColReorder_State" ); - - /* An initial column order has been specified */ - var aiOrder = null; - if ( typeof this.s.init.aiOrder != 'undefined' ) - { - aiOrder = this.s.init.aiOrder.slice(); - } - - /* State loading, overrides the column order given */ - if ( this.s.dt.oLoadedState && typeof this.s.dt.oLoadedState.ColReorder != 'undefined' && - this.s.dt.oLoadedState.ColReorder.length == this.s.dt.aoColumns.length ) - { - aiOrder = this.s.dt.oLoadedState.ColReorder; - } - - /* If we have an order to apply - do so */ - if ( aiOrder ) - { - /* We might be called during or after the DataTables initialisation. If before, then we need - * to wait until the draw is done, if after, then do what we need to do right away - */ - if ( !that.s.dt._bInitComplete ) - { - var bDone = false; - this.s.dt.aoDrawCallback.push( { - "fn": function () { - if ( !that.s.dt._bInitComplete && !bDone ) - { - bDone = true; - var resort = fnInvertKeyValues( aiOrder ); - that._fnOrderColumns.call( that, resort ); - } - }, - "sName": "ColReorder_Pre" - } ); - } - else - { - var resort = fnInvertKeyValues( aiOrder ); - that._fnOrderColumns.call( that, resort ); - } - } - }, - - - /** - * Set the column order from an array - * @method _fnOrderColumns - * @param array a An array of integers which dictate the column order that should be applied - * @returns void - * @private - */ - "_fnOrderColumns": function ( a ) - { - if ( a.length != this.s.dt.aoColumns.length ) - { - this.s.dt.oInstance.oApi._fnLog( this.s.dt, 1, "ColReorder - array reorder does not "+ - "match known number of columns. Skipping." ); - return; - } - - for ( var i=0, iLen=a.length ; i 0 ) - { - this.dom.drag.removeChild( this.dom.drag.getElementsByTagName('caption')[0] ); - } - while ( this.dom.drag.getElementsByTagName('tbody').length > 0 ) - { - this.dom.drag.removeChild( this.dom.drag.getElementsByTagName('tbody')[0] ); - } - while ( this.dom.drag.getElementsByTagName('tfoot').length > 0 ) - { - this.dom.drag.removeChild( this.dom.drag.getElementsByTagName('tfoot')[0] ); - } - - $('thead tr:eq(0)', this.dom.drag).each( function () { - $('th', this).eq(that.s.mouse.targetIndex).siblings().remove(); - } ); - $('tr', this.dom.drag).height( $('tr:eq(0)', that.s.dt.nTHead).height() ); - - $('thead tr:gt(0)', this.dom.drag).remove(); - - $('thead th:eq(0)', this.dom.drag).each( function (i) { - this.style.width = $('th:eq('+that.s.mouse.targetIndex+')', that.s.dt.nTHead).width()+"px"; - } ); - - this.dom.drag.style.position = "absolute"; - this.dom.drag.style.top = "0px"; - this.dom.drag.style.left = "0px"; - this.dom.drag.style.width = $('th:eq('+that.s.mouse.targetIndex+')', that.s.dt.nTHead).outerWidth()+"px"; - - - this.dom.pointer = document.createElement( 'div' ); - this.dom.pointer.className = "DTCR_pointer"; - this.dom.pointer.style.position = "absolute"; - - if ( this.s.dt.oScroll.sX === "" && this.s.dt.oScroll.sY === "" ) - { - this.dom.pointer.style.top = $(this.s.dt.nTable).offset().top+"px"; - this.dom.pointer.style.height = $(this.s.dt.nTable).height()+"px"; - } - else - { - this.dom.pointer.style.top = $('div.dataTables_scroll', this.s.dt.nTableWrapper).offset().top+"px"; - this.dom.pointer.style.height = $('div.dataTables_scroll', this.s.dt.nTableWrapper).height()+"px"; - } - - document.body.appendChild( this.dom.pointer ); - document.body.appendChild( this.dom.drag ); - }, - - /** - * Clean up ColReorder memory references and event handlers - * @method _fnDestroy - * @returns void - * @private - */ - "_fnDestroy": function () - { - for ( var i=0, iLen=ColReorder.aoInstances.length ; i= iCols ) + { + this.oApi._fnLog( oSettings, 1, "ColReorder 'from' index is out of bounds: "+iFrom ); + return; + } + + if ( iTo < 0 || iTo >= iCols ) + { + this.oApi._fnLog( oSettings, 1, "ColReorder 'to' index is out of bounds: "+iTo ); + return; + } + + /* + * Calculate the new column array index, so we have a mapping between the old and new + */ + var aiMapping = []; + for ( i=0, iLen=iCols ; i this.s.fixed-1 && i < iLen - this.s.fixedRight ) + { + this._fnMouseListener( i, this.s.dt.aoColumns[i].nTh ); + } + + /* Mark the original column order for later reference */ + this.s.dt.aoColumns[i]._ColReorder_iOrigCol = i; + } + + /* State saving */ + this.s.dt.oApi._fnCallbackReg( this.s.dt, 'aoStateSaveParams', function (oS, oData) { + that._fnStateSave.call( that, oData ); + }, "ColReorder_State" ); + + /* An initial column order has been specified */ + var aiOrder = null; + if ( this.s.init.aiOrder ) + { + aiOrder = this.s.init.aiOrder.slice(); + } + + /* State loading, overrides the column order given */ + if ( this.s.dt.oLoadedState && typeof this.s.dt.oLoadedState.ColReorder != 'undefined' && + this.s.dt.oLoadedState.ColReorder.length == this.s.dt.aoColumns.length ) + { + aiOrder = this.s.dt.oLoadedState.ColReorder; + } + + /* If we have an order to apply - do so */ + if ( aiOrder ) + { + /* We might be called during or after the DataTables initialisation. If before, then we need + * to wait until the draw is done, if after, then do what we need to do right away + */ + if ( !that.s.dt._bInitComplete ) + { + var bDone = false; + this.s.dt.aoDrawCallback.push( { + "fn": function () { + if ( !that.s.dt._bInitComplete && !bDone ) + { + bDone = true; + var resort = fnInvertKeyValues( aiOrder ); + that._fnOrderColumns.call( that, resort ); + } + }, + "sName": "ColReorder_Pre" + } ); + } + else + { + var resort = fnInvertKeyValues( aiOrder ); + that._fnOrderColumns.call( that, resort ); + } + } + else { + this._fnSetColumnIndexes(); + } + }, + + + /** + * Set the column order from an array + * @method _fnOrderColumns + * @param array a An array of integers which dictate the column order that should be applied + * @returns void + * @private + */ + "_fnOrderColumns": function ( a ) + { + if ( a.length != this.s.dt.aoColumns.length ) + { + this.s.dt.oInstance.oApi._fnLog( this.s.dt, 1, "ColReorder - array reorder does not "+ + "match known number of columns. Skipping." ); + return; + } + + for ( var i=0, iLen=a.length ; i') + .addClass( 'DTCR_pointer' ) + .css( { + position: 'absolute', + top: scrolling ? + $('div.dataTables_scroll', this.s.dt.nTableWrapper).offset().top : + $(this.s.dt.nTable).offset().top, + height : scrolling ? + $('div.dataTables_scroll', this.s.dt.nTableWrapper).height() : + $(this.s.dt.nTable).height() + } ) + .appendTo( 'body' ); + }, + + /** + * Clean up ColReorder memory references and event handlers + * @method _fnDestroy + * @returns void + * @private + */ + "_fnDestroy": function () + { + var i, iLen; + + for ( i=0, iLen=this.s.dt.aoDrawCallback.length ; ib||b>=n)this.oApi._fnLog(a,1,"ColReorder 'from' index is out of bounds: "+b);else if(0>e||e>=n)this.oApi._fnLog(a,1,"ColReorder 'to' index is out of bounds: "+e);else{f=[];c=0;for(g=n;cthis.s.fixed-1&&eMath.pow(Math.pow(a.pageX-this.s.mouse.startX,2)+Math.pow(a.pageY-this.s.mouse.startY,2),0.5))return;this._fnCreateDragNode()}this.dom.drag.css({left:a.pageX-this.s.mouse.offsetX,top:a.pageY-this.s.mouse.offsetY});for(var b=!1,e=this.s.mouse.toIndex,d=1,c=this.s.aoTargets.length;d").addClass("DTCR_pointer").css({position:"absolute",top:a?d("div.dataTables_scroll",this.s.dt.nTableWrapper).offset().top:d(this.s.dt.nTable).offset().top,height:a?d("div.dataTables_scroll",this.s.dt.nTableWrapper).height(): +d(this.s.dt.nTable).height()}).appendTo("body")},_fnDestroy:function(){var a,b;a=0;for(b=this.s.dt.aoDrawCallback.length;a