1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 17:59:21 +02:00

Save columns display

This commit is contained in:
Afterster 2014-05-22 23:24:03 +02:00
parent bf1f0ce2fb
commit 785f3ce6ce
16 changed files with 41 additions and 31 deletions

View file

@ -20,7 +20,7 @@ tools:
excluded_dirs: { } excluded_dirs: { }
filter: filter:
excluded_paths: excluded_paths:
- 'modules/*'' - 'modules/*'
paths: { } paths: { }
php_analyzer: php_analyzer:
enabled: true enabled: true
@ -53,5 +53,5 @@ tools:
excluded_dirs: { } excluded_dirs: { }
filter: filter:
excluded_paths: excluded_paths:
- 'modules/*'' - 'modules/*'
paths: { } paths: { }

View file

@ -26,6 +26,8 @@ https://github.com/thepeg/MediaTable
http://consulenza-web.com/jquery/MediaTable/ http://consulenza-web.com/jquery/MediaTable/
http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/ 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 __thInit = function( i, wdg ) {
var $th = $(this), var $th = $(this),
id = $th.attr('id'), id = $th.attr('id');
classes = $th.attr('class');
// Set up an auto-generated ID for the column. // Set up an auto-generated ID for the column.
// the ID is based upon widget's ID to allow multiple tables into one page. // 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. // 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()" ### }; // EndOf: "__thInit()" ###
var __trInit = function( i, id, classes ) { var __trInit = function( i, id, classes, styles ) {
var $cell = $(this).find('td,th').eq(i); var $cell = $(this).find('td,th').eq(i);
$cell.attr( 'headers', id ); $cell.attr( 'headers', id );
if ( classes ) $cell.addClass(classes); if ( classes ) $cell.addClass(classes);
if ( styles) $cell.attr('style', styles);
}; // EndOf: "__trInit()" ### }; // EndOf: "__trInit()" ###
var __liInitActions = function( $th, $checkbox, wdg ) { 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" 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") cols = wdg.$table.find("#" + val + ", [headers="+ val +"]"); // so we can easily find the matching header (id="company") and cells (headers="company")
var checked = $checkbox.is(":checked");
$.cookie(cookname, checked, { expires: 30, path: '/'});
if ( $checkbox.is(":checked")) { if (checked) {
cols.show(); cols.show();
} else { } else {
cols.hide(); cols.hide();
}; };
}; };
var updateCheck = function() { var updateCheck = function() {
//if ( $th.css("display") == "table-cell") { if ($.cookie(cookname) !== undefined) {
$checkbox.prop("checked", $.cookie(cookname) === true);
change();
}
if ($th.is(':visible')) { if ($th.is(':visible')) {
$checkbox.prop("checked", true); $checkbox.prop("checked", true);
} }
else { else {
$checkbox.prop("checked", false); $checkbox.prop("checked", false);
}; };
}; };
$checkbox $checkbox
@ -248,6 +255,7 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/
wdg.$table.find('thead th').each(function(i){ wdg.$table.find('thead th').each(function(i){
var $th = $('#' + wdg.id + '-mediaTableCol-' + i); var $th = $('#' + wdg.id + '-mediaTableCol-' + i);
var $checkbox = $('#toggle-col-' + wdg.id + '-' + i); var $checkbox = $('#toggle-col-' + wdg.id + '-' + i);
var cookname = 'mt_' + wdg.$table.attr('data-objecttype') + '_' + $th.index();
if ($checkbox !== undefined) { if ($checkbox !== undefined) {
$th.removeAttr('style'); $th.removeAttr('style');
if ( $th.is(':visible') ) { if ( $th.is(':visible') ) {
@ -260,6 +268,7 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/
var val = $checkbox.val(); var val = $checkbox.val();
var cols = wdg.$table.find("#" + val + ", [headers="+ val +"]"); var cols = wdg.$table.find("#" + val + ", [headers="+ val +"]");
cols.removeAttr('style'); cols.removeAttr('style');
$.removeCookie(cookname, { path: '/' });
} }
}); });

View file

@ -49,6 +49,7 @@ $location = get_location();
<script src="<?php echo $web_path; ?>/modules/prettyPhoto/js/jquery.prettyPhoto.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/modules/prettyPhoto/js/jquery.prettyPhoto.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/modules/tag-it/tag-it.min.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/modules/tag-it/tag-it.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/modules/noty/packaged/jquery.noty.packaged.min.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/modules/noty/packaged/jquery.noty.packaged.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/modules/jquery/jquery.cookie.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/modules/jscroll/jquery.jscroll.min.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/modules/jscroll/jquery.jscroll.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/modules/jquery/jquery.qrcode.min.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/modules/jquery/jquery.qrcode.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/modules/rhinoslider/js/rhinoslider-1.05.min.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/modules/rhinoslider/js/rhinoslider-1.05.min.js" language="javascript" type="text/javascript"></script>

View file

@ -24,7 +24,7 @@ $web_path = AmpConfig::get('web_path');
$thcount = 8; $thcount = 8;
?> ?>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="album">
<thead> <thead>
<tr class="th-top"> <tr class="th-top">
<th class="cel_play essential"></th> <th class="cel_play essential"></th>

View file

@ -26,7 +26,7 @@ $web_path = AmpConfig::get('web_path');
$thcount = 8; $thcount = 8;
?> ?>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="artist">
<thead> <thead>
<tr class="th-top"> <tr class="th-top">
<th class="cel_play essential"></th> <th class="cel_play essential"></th>

View file

@ -22,7 +22,7 @@
?> ?>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="broadcast">
<thead> <thead>
<tr class="th-top"> <tr class="th-top">
<th class="cel_play essential"></th> <th class="cel_play essential"></th>

View file

@ -21,7 +21,7 @@
*/ */
?> ?>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="catalog">
<thead> <thead>
<tr class="th-top"> <tr class="th-top">
<th class="cel_catalog essential persist"><?php echo T_('Name'); ?></th> <th class="cel_catalog essential persist"><?php echo T_('Name'); ?></th>

View file

@ -22,7 +22,7 @@
?> ?>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="channel">
<thead> <thead>
<tr class="th-top"> <tr class="th-top">
<th class="cel_play essential"></th> <th class="cel_play essential"></th>

View file

@ -23,7 +23,7 @@
$web_path = AmpConfig::get('web_path'); $web_path = AmpConfig::get('web_path');
?> ?>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="live_stream">
<thead> <thead>
<tr class="th-top"> <tr class="th-top">
<th class="cel_play essential"></th> <th class="cel_play essential"></th>

View file

@ -21,7 +21,7 @@
*/ */
?> ?>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="playlist">
<thead> <thead>
<tr class="th-top"> <tr class="th-top">
<th class="cel_play essential"></th> <th class="cel_play essential"></th>

View file

@ -20,7 +20,7 @@
* *
*/ */
?> ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="share">
<thead> <thead>
<tr class="th-top"> <tr class="th-top">
<th class="cel_object essential"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=share&sort=object', T_('Object'),'sort_share_object'); ?></th> <th class="cel_object essential"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=share&sort=object', T_('Object'),'sort_share_object'); ?></th>

View file

@ -22,7 +22,7 @@
?> ?>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="smartplaylist">
<thead> <thead>
<tr class="th-top"> <tr class="th-top">
<th class="cel_play essential"></th> <th class="cel_play essential"></th>

View file

@ -24,7 +24,7 @@ $web_path = AmpConfig::get('web_path');
$thcount = 8; $thcount = 8;
?> ?>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>
<table id="reorder_songs_table_<?php echo $browse->get_filter('album'); ?>" class="tabledata" cellpadding="0" cellspacing="0"> <table id="reorder_songs_table_<?php echo $browse->get_filter('album'); ?>" class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="song">
<thead> <thead>
<tr class="th-top"> <tr class="th-top">
<th class="cel_play essential"></th> <th class="cel_play essential"></th>

View file

@ -24,7 +24,7 @@ $web_path = AmpConfig::get('web_path');
?> ?>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="user">
<colgroup> <colgroup>
<col id="col_username" /> <col id="col_username" />
<col id="col_lastseen" /> <col id="col_lastseen" />

View file

@ -23,7 +23,7 @@
$web_path = AmpConfig::get('web_path'); $web_path = AmpConfig::get('web_path');
if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php';
?> ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="video">
<thead> <thead>
<tr class="th-top"> <tr class="th-top">
<th class="cel_play essential"></th> <th class="cel_play essential"></th>

View file

@ -20,7 +20,7 @@
* *
*/ */
?> ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="wanted">
<thead> <thead>
<tr class="th-top"> <tr class="th-top">
<th class="cel_album essential"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=wanted&sort=name', T_('Album'),'sort_wanted_album'); ?></th> <th class="cel_album essential"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=wanted&sort=name', T_('Album'),'sort_wanted_album'); ?></th>