diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 40625b4d..af1cd9ab 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -20,7 +20,7 @@ tools: excluded_dirs: { } filter: excluded_paths: - - 'modules/*'' + - 'modules/*' paths: { } php_analyzer: enabled: true @@ -53,5 +53,5 @@ tools: excluded_dirs: { } filter: excluded_paths: - - 'modules/*'' + - 'modules/*' paths: { } \ No newline at end of file diff --git a/modules/jquery-mediaTable/jquery.mediaTable.js b/modules/jquery-mediaTable/jquery.mediaTable.js index ddb85a47..a6f1ca95 100644 --- a/modules/jquery-mediaTable/jquery.mediaTable.js +++ b/modules/jquery-mediaTable/jquery.mediaTable.js @@ -26,6 +26,8 @@ https://github.com/thepeg/MediaTable http://consulenza-web.com/jquery/MediaTable/ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/ +**Modified version for Ampache.** + **/ @@ -133,8 +135,7 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/ var __thInit = function( i, wdg ) { var $th = $(this), - id = $th.attr('id'), - classes = $th.attr('class'); + id = $th.attr('id'); // Set up an auto-generated ID for the column. // the ID is based upon widget's ID to allow multiple tables into one page. @@ -164,50 +165,56 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/ } // Propagate column's properties to each cell. - $('tbody tr',wdg.$table).each(function(){ __trInit.call( this, i, id, classes ); }); + var classes = $th.attr('class'); + var styles = $th.attr('style'); + $('tbody tr',wdg.$table).each(function(){ __trInit.call( this, i, id, classes, styles ); }); }; // EndOf: "__thInit()" ### - var __trInit = function( i, id, classes ) { + var __trInit = function( i, id, classes, styles ) { var $cell = $(this).find('td,th').eq(i); $cell.attr( 'headers', id ); if ( classes ) $cell.addClass(classes); + if ( styles) $cell.attr('style', styles); }; // EndOf: "__trInit()" ### var __liInitActions = function( $th, $checkbox, wdg ) { - var change = function() { - + var cookname = 'mt_' + wdg.$table.attr('data-objecttype') + '_' + $th.index(); + + var change = function() { var val = $checkbox.val(), // this equals the header's ID, i.e. "company" cols = wdg.$table.find("#" + val + ", [headers="+ val +"]"); // so we can easily find the matching header (id="company") and cells (headers="company") - - if ( $checkbox.is(":checked")) { + var checked = $checkbox.is(":checked"); + $.cookie(cookname, checked, { expires: 30, path: '/'}); + + if (checked) { cols.show(); - } else { cols.hide(); - }; - - }; + }; var updateCheck = function() { - - //if ( $th.css("display") == "table-cell") { - if ( $th.is(':visible') ) { + + if ($.cookie(cookname) !== undefined) { + $checkbox.prop("checked", $.cookie(cookname) === true); + change(); + } + + if ($th.is(':visible')) { $checkbox.prop("checked", true); } else { $checkbox.prop("checked", false); }; - }; $checkbox @@ -248,6 +255,7 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/ wdg.$table.find('thead th').each(function(i){ var $th = $('#' + wdg.id + '-mediaTableCol-' + i); var $checkbox = $('#toggle-col-' + wdg.id + '-' + i); + var cookname = 'mt_' + wdg.$table.attr('data-objecttype') + '_' + $th.index(); if ($checkbox !== undefined) { $th.removeAttr('style'); if ( $th.is(':visible') ) { @@ -260,6 +268,7 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/ var val = $checkbox.val(); var cols = wdg.$table.find("#" + val + ", [headers="+ val +"]"); cols.removeAttr('style'); + $.removeCookie(cookname, { path: '/' }); } }); diff --git a/templates/header.inc.php b/templates/header.inc.php index b876d3c8..60bf704f 100644 --- a/templates/header.inc.php +++ b/templates/header.inc.php @@ -49,6 +49,7 @@ $location = get_location(); + diff --git a/templates/show_albums.inc.php b/templates/show_albums.inc.php index 9f4f1e11..8fb8648a 100644 --- a/templates/show_albums.inc.php +++ b/templates/show_albums.inc.php @@ -24,7 +24,7 @@ $web_path = AmpConfig::get('web_path'); $thcount = 8; ?> get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> - +
diff --git a/templates/show_artists.inc.php b/templates/show_artists.inc.php index 10992208..c1703632 100644 --- a/templates/show_artists.inc.php +++ b/templates/show_artists.inc.php @@ -26,7 +26,7 @@ $web_path = AmpConfig::get('web_path'); $thcount = 8; ?> get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> -
+
diff --git a/templates/show_broadcasts.inc.php b/templates/show_broadcasts.inc.php index 322809aa..73a828b0 100644 --- a/templates/show_broadcasts.inc.php +++ b/templates/show_broadcasts.inc.php @@ -22,7 +22,7 @@ ?> get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> -
+
diff --git a/templates/show_catalogs.inc.php b/templates/show_catalogs.inc.php index b714300a..ddec4cb5 100644 --- a/templates/show_catalogs.inc.php +++ b/templates/show_catalogs.inc.php @@ -21,7 +21,7 @@ */ ?> get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> -
+
diff --git a/templates/show_channels.inc.php b/templates/show_channels.inc.php index a04c420d..fbd0566d 100644 --- a/templates/show_channels.inc.php +++ b/templates/show_channels.inc.php @@ -22,7 +22,7 @@ ?> get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> -
+
diff --git a/templates/show_live_streams.inc.php b/templates/show_live_streams.inc.php index 97622290..26f0c21f 100644 --- a/templates/show_live_streams.inc.php +++ b/templates/show_live_streams.inc.php @@ -23,7 +23,7 @@ $web_path = AmpConfig::get('web_path'); ?> get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> -
+
diff --git a/templates/show_playlists.inc.php b/templates/show_playlists.inc.php index 7fa999d5..cf0a7d3a 100644 --- a/templates/show_playlists.inc.php +++ b/templates/show_playlists.inc.php @@ -21,7 +21,7 @@ */ ?> get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> -
+
diff --git a/templates/show_shared_objects.inc.php b/templates/show_shared_objects.inc.php index bb46ae9d..6c6eb82a 100644 --- a/templates/show_shared_objects.inc.php +++ b/templates/show_shared_objects.inc.php @@ -20,7 +20,7 @@ * */ ?> -
+
diff --git a/templates/show_smartplaylists.inc.php b/templates/show_smartplaylists.inc.php index b6ba7879..1d020b7d 100644 --- a/templates/show_smartplaylists.inc.php +++ b/templates/show_smartplaylists.inc.php @@ -22,7 +22,7 @@ ?> get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> -
id . '&type=share&sort=object', T_('Object'),'sort_share_object'); ?>
+
diff --git a/templates/show_songs.inc.php b/templates/show_songs.inc.php index 2e1ba0c5..dd00abb8 100644 --- a/templates/show_songs.inc.php +++ b/templates/show_songs.inc.php @@ -24,7 +24,7 @@ $web_path = AmpConfig::get('web_path'); $thcount = 8; ?> get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> -
+
diff --git a/templates/show_users.inc.php b/templates/show_users.inc.php index 004e7ce6..da9145a7 100644 --- a/templates/show_users.inc.php +++ b/templates/show_users.inc.php @@ -24,7 +24,7 @@ $web_path = AmpConfig::get('web_path'); ?> get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> -
+
diff --git a/templates/show_videos.inc.php b/templates/show_videos.inc.php index e2736813..f39aa15b 100644 --- a/templates/show_videos.inc.php +++ b/templates/show_videos.inc.php @@ -23,7 +23,7 @@ $web_path = AmpConfig::get('web_path'); if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> -
+
diff --git a/templates/show_wanted_albums.inc.php b/templates/show_wanted_albums.inc.php index 64bced48..9a1f6746 100644 --- a/templates/show_wanted_albums.inc.php +++ b/templates/show_wanted_albums.inc.php @@ -20,7 +20,7 @@ * */ ?> -
+
id . '&type=wanted&sort=name', T_('Album'),'sort_wanted_album'); ?>