1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-05 02:39:47 +02:00

CSS trick to remove grid view

This commit is contained in:
Afterster 2015-12-19 14:51:30 +01:00
parent 68a2f92102
commit 4ca86c15ac
27 changed files with 123 additions and 34 deletions

View file

@ -1659,6 +1659,7 @@ class Art extends database_object
$size['height'] = 24;
$size['width'] = 24;
break;
case 11:
default:
$size['height'] = 275;
$size['width'] = 275;
@ -1725,13 +1726,14 @@ class Art extends database_object
$imgurl .= '&kind=' . $kind;
}
echo "<img src=\"" . $imgurl . "\" alt=\"" . $name . "\" height=\"" . $size['height'] . "\" width=\"" . $size['width'] . "\" />";
if ($prettyPhoto) {
if ($size['width'] >= 150) {
if ($size['height'] > 150) {
echo "<div class=\"item_art_play\">";
echo Ajax::text('?page=stream&action=directplay&object_type=' . $object_type . '&object_id=' . $object_id . '\' + getPagePlaySettings() + \'', '<span class="item_art_play_icon" title="' . T_('Play') . '" />', 'directplay_art_' . $object_type . '_' . $object_id);
echo "</div>";
}
if ($prettyPhoto) {
$libitem = new $object_type($object_id);
echo "<div class=\"item_art_actions\">";
if ($GLOBALS['user']->has_access(50) || ($GLOBALS['user']->has_access(25) && $GLOBALS['user']->id == $libitem->get_user_owner())) {
@ -1745,6 +1747,7 @@ class Art extends database_object
}
echo"</div>";
}
echo "</a>\n";
echo "</div>";

View file

@ -49,6 +49,7 @@ class Browse extends Query
if (!$id) {
$this->set_use_pages(true);
$this->set_use_alpha(false);
$this->set_grid_view(true);
}
$this->show_header = true;
}
@ -423,6 +424,10 @@ class Browse extends Query
$this->set_filter('regex_not_match', '');
}
}
$cn = 'browse_' . $type . '_grid_view';
if (isset($_COOKIE[$cn])) {
$this->set_grid_view($_COOKIE[$cn] == 'true');
}
parent::set_type($type, $custom_base);
}
@ -458,6 +463,25 @@ class Browse extends Query
return $this->_state['use_pages'];
}
/**
*
* @param boolean $grid_view
*/
public function set_grid_view($grid_view)
{
$this->save_cookie_params('grid_view', $grid_view ? 'true' : 'false');
$this->_state['grid_view'] = $grid_view;
}
/**
*
* @return boolean
*/
public function get_grid_view()
{
return $this->_state['grid_view'];
}
/**
*
* @param boolean $use_alpha
@ -530,5 +554,18 @@ class Browse extends Query
{
return $this->_state['threshold'];
}
/**
*
* @return string
*/
public function get_css_class()
{
$css = '';
if (!$this->_state['grid_view']) {
$css = 'disablegv';
}
return $css;
}
} // browse

View file

@ -413,7 +413,7 @@ function submitNewItemsOrder(itemId, tableid, rowPrefix, updateUrl, refreshActio
function getPagePlaySettings() {
var settings = '';
var stg_subtitle = document.getElementById('play_setting_subtitle');
if (stg_subtitle !== undefined) {
if (stg_subtitle !== undefined && stg_subtitle !== null) {
if (stg_subtitle.value != '') {
settings += '&subtitle=' + stg_subtitle.value;
}

View file

@ -245,11 +245,14 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/
// Columns Initialization Loop.
wdg.$table.find('thead th').each(function(i){ __thInit.call( this, i, wdg ); });
if (wdg.$menu.$list !== undefined) {
wdg.$menu.$list.append(wdg.$menu.$footer);
}
if (wdg.$menu.$footer !== undefined) {
wdg.$menu.$footer.bind('click',function(){
__reset.call(_this);
});
}
}
@ -317,12 +320,13 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/
$.fn.mediaTable = function() {
var cfg = false;
var hasMenu = !$(this).hasClass('disablegv');
// Default configuration block
if ( !arguments.length || $.isPlainObject(arguments[0]) ) cfg = $.extend({},{
// Teach the widget to create a toggle menu to declare column's visibility
menu: true,
menu: hasMenu,
menuTitle: 'Columns',
menuReset: 'Reset',

View file

@ -175,6 +175,10 @@ switch ($_REQUEST['action']) {
$browse->set_filter('regex_not_match', '');
}
break;
case 'grid_view':
$value = ($value == 'true');
$browse->set_grid_view($value);
break;
case 'limit':
$value = intval($value);
if ($value > 0) {

View file

@ -147,6 +147,7 @@ if ($limit > 0 && $total > $limit) {
<span class="browse-options-content">
<span><input type="checkbox" id="browse_<?php echo $browse->id; ?>_use_pages_<?php echo $is_header; ?>" value="true" <?php echo (($browse->get_use_pages()) ? 'checked' : ''); ?> onClick="javascript:<?php echo Ajax::action("?page=browse&action=options&browse_id=" . $browse->id . "&option=use_pages&value=' + $('#browse_" . $browse->id . "_use_pages_" . $is_header . "').is(':checked') + '" . $argument_param, "browse_" . $browse->id . "_use_pages_" . $is_header); ?>"><?php echo T_('Pages'); ?></span>
<span><input type="checkbox" id="browse_<?php echo $browse->id; ?>_use_scroll_<?php echo $is_header; ?>" value="true" <?php echo ((!$browse->get_use_pages()) ? 'checked' : ''); ?> onClick="javascript:<?php echo Ajax::action("?page=browse&action=options&browse_id=" . $browse->id . "&option=use_pages&value=' + !($('#browse_" . $browse->id . "_use_scroll_" . $is_header . "').is(':checked')) + '" . $argument_param, "browse_" . $browse->id . "_use_scroll_" . $is_header); ?>"><?php echo T_('Infinite Scroll'); ?></span>
<span><input type="checkbox" id="browse_<?php echo $browse->id; ?>_grid_view_<?php echo $is_header; ?>" value="true" <?php echo (($browse->get_grid_view()) ? 'checked' : ''); ?> onClick="javascript:<?php echo Ajax::action("?page=browse&action=options&browse_id=" . $browse->id . "&option=grid_view&value=' + ($('#browse_" . $browse->id . "_grid_view_" . $is_header . "').is(':checked')) + '" . $argument_param, "browse_" . $browse->id . "_grid_view_" . $is_header); ?>"><?php echo T_('Grid View'); ?></span>
<?php if (!$browse->is_static_content()) {
?>
<span><input type="checkbox" id="browse_<?php echo $browse->id;

View file

@ -42,7 +42,8 @@ if (Art::is_enabled()) {
?>
<td class="cel_cover">
<?php
Art::display('album', $libitem->id, $name, 1, AmpConfig::get('web_path') . '/albums.php?action=show&album=' . $libitem->id);
$thumb = (isset($browse) && !$browse->get_grid_view()) ? 11 : 1;
Art::display('album', $libitem->id, $name, $thumb, AmpConfig::get('web_path') . '/albums.php?action=show&album=' . $libitem->id);
?>
</td>
<?php

View file

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

View file

@ -42,7 +42,8 @@ if (Art::is_enabled()) {
?>
<td class="cel_cover">
<?php
Art::display('artist', $libitem->id, $name, 1, AmpConfig::get('web_path') . '/artists.php?action=show&artist=' . $libitem->id);
$thumb = (isset($browse) && !$browse->get_grid_view()) ? 11 : 1;
Art::display('artist', $libitem->id, $name, $thumb, AmpConfig::get('web_path') . '/artists.php?action=show&artist=' . $libitem->id);
?>
</td>
<?php

View file

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

View file

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

View file

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

View file

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

View file

@ -37,7 +37,7 @@ $thcount = 6;
<?php if ($browse->get_show_header()) {
require AmpConfig::get('prefix') . UI::find_template('list_header.inc.php');
} ?>
<table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="label">
<table class="tabledata <?php echo $browse->get_css_class() ?>" cellpadding="0" cellspacing="0" data-objecttype="label">
<thead>
<tr class="th-top">
<?php if (Art::is_enabled()) {

View file

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

View file

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

View file

@ -43,7 +43,7 @@ $thcount = 5;
<?php if ($browse->get_show_header()) {
require AmpConfig::get('prefix') . UI::find_template('list_header.inc.php');
} ?>
<table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="label">
<table class="tabledata <?php echo $browse->get_css_class() ?>" cellpadding="0" cellspacing="0" data-objecttype="label">
<thead>
<tr class="th-top">
<th class="cel_select essential persist"></th>

View file

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

View file

@ -20,7 +20,7 @@
*
*/
?>
<table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="share">
<table class="tabledata <?php echo $browse->get_css_class() ?>" cellpadding="0" cellspacing="0" data-objecttype="share">
<thead>
<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>

View file

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

View file

@ -26,7 +26,7 @@ $thcount = 6;
<?php if ($browse->get_show_header()) {
require AmpConfig::get('prefix') . UI::find_template('list_header.inc.php');
} ?>
<table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="tvshow_season">
<table class="tabledata <?php echo $browse->get_css_class() ?>" cellpadding="0" cellspacing="0" data-objecttype="tvshow_season">
<thead>
<tr class="th-top">
<th class="cel_play essential"></th>

View file

@ -28,7 +28,7 @@ $thcount = 8;
<?php if ($browse->get_show_header()) {
require AmpConfig::get('prefix') . UI::find_template('list_header.inc.php');
} ?>
<table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="tvshow">
<table class="tabledata <?php echo $browse->get_css_class() ?>" cellpadding="0" cellspacing="0" data-objecttype="tvshow">
<thead>
<tr class="th-top">
<th class="cel_play essential"></th>

View file

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

View file

@ -51,7 +51,8 @@ if (Art::is_enabled()) {
$art_showed = Art::display('video', $libitem->id, $libitem->f_title, 9, $libitem->link, false, 'preview');
}
if (!$art_showed) {
Art::display('video', $libitem->id, $libitem->f_title, 6, $libitem->link);
$thumb = (isset($browse) && !$browse->get_grid_view()) ? 7 : 6;
Art::display('video', $libitem->id, $libitem->f_title, $thumb, $libitem->link);
}
?>
</td>

View file

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

View file

@ -20,7 +20,7 @@
*
*/
?>
<table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="wanted">
<table class="tabledata <?php echo $browse->get_css_class() ?>" cellpadding="0" cellspacing="0" data-objecttype="wanted">
<thead>
<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>

View file

@ -957,6 +957,43 @@ div.box.box_current_configuration {
margin-top: 20px;
}
table.disablegv thead {
display: none;
}
table.disablegv tr {
float: left;
text-align: center;
width: 285px;
padding: 20px;
}
table.disablegv tr.odd {
background-color: rgba(255, 255, 255, 0) !important;
}
table.disablegv td {
display: block !important;
height: 25px;
}
table.disablegv td.optional {
display: none !important;
}
table.disablegv td.cel_cover {
display: block !important;
height: auto !important;
}
table.disablegv td.cel_play, table.disablegv td.cel_add, table.disablegv td.cel_action, table.disablegv td.cel_year, table.disablegv td.cel_drag {
display: none !important;
}
table.disablegv td.cel_rating {
display: inline-block !important;
}
/***********************************************
Content (info-box)
***********************************************/