update tabellisting and callbacks, make columns invisible

This commit is contained in:
envoyr
2022-02-23 17:33:54 +01:00
parent 4e4e4eca94
commit 04263cb69f
13 changed files with 21 additions and 79 deletions

View File

@@ -32,7 +32,7 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_admins");
$admin_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/admin/tablelisting.admin.php';
$admin_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.admin.php';
try {
// get collection

View File

@@ -31,7 +31,7 @@ $id = (int) Request::get('id');
if ($page == 'customers' && $userinfo['customers'] != '0') {
if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_customers");
$customer_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/admin/tablelisting.customer.php';
$customer_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.customer.php';
try {
// get collection
@@ -39,7 +39,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
// initialize pagination and filtering
$paging = new \Froxlor\UI\Pagination($userinfo, $customer_list_data['customer_list']['columns'], $collection->count());
// get filtered collection
$collection = new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Customers::class, $userinfo, $paging->getApiCommandParams());
$collection = new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Customers::class, $userinfo, array_merge($paging->getApiCommandParams(), ['show_usages' => true]));
$collection->has('admin', \Froxlor\Api\Commands\Admins::class, 'adminid', 'adminid');
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());

View File

@@ -36,7 +36,7 @@ if ($page == 'domains' || $page == 'overview') {
if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_domains");
$domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/admin/tablelisting.domain.php';
$domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.domain.php';
try {
// get collection

View File

@@ -261,7 +261,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version, $c
$has_preconfig = true;
$description = 'Froxlor can now limit the number of autoresponder-entries for each user. Here you can set the value which will be available for each customer (Of course you can change the value for each customer separately after the update).';
$question = '<strong>How many autoresponders should your customers be able to add?:</strong>&nbsp;';
$question .= '<input type="text" class="text" name="update_autoresponder_default" value="0" />&nbsp;' . \Froxlor\UI\HTML::makecheckbox('update_autoresponder_default', $lng['customer']['unlimited'], '-1', false, 0, true, true) . '<br />';
$question .= '<input type="text" class="text" name="update_autoresponder_default" value="0" />&nbsp;' . \Froxlor\UI\HTML::makecheckbox('update_autoresponder_default', $lng['panel']['unlimited'], '-1', false, 0, true, true) . '<br />';
eval("\$return.=\"" . \Froxlor\UI\Template::getTemplate("update/preconfigitem") . "\";");
}
}

View File

@@ -1,45 +0,0 @@
<?php
namespace Froxlor\UI\Callbacks;
use Froxlor\PhpHelper;
use Froxlor\UI\Panel\UI;
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @author Maurice Preuß <hello@envoyr.com>
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Listing
*
*/
class Number
{
/**
* Formats the diskspace to human-readable number
*
* @param string $data
* @return string
*/
public static function diskspace(string $data): string
{
return $data >= 0 ? PhpHelper::sizeReadable($data * 1024, null, 'bi') : UI::getLng('panel.unlimited');
}
/**
* Formats the traffic to human-readable number
*
* @param string $data
* @return string
*/
public static function traffic(string $data): string
{
return $data >= 0 ? PhpHelper::sizeReadable($data * (1024 * 1024), null, 'bi') : UI::getLng('panel.unlimited');
}
}

View File

@@ -31,30 +31,12 @@ class ProgressBar
*/
public static function diskspace(string $data, array $attributes): array
{
$infotext = '';
if (isset($attributes['customerid'])) {
// get disk-space usages for web, mysql and mail
$usages_stmt = \Froxlor\Database\Database::prepare("
SELECT * FROM `" . TABLE_PANEL_DISKSPACE . "`
WHERE `customerid` = :cid
ORDER BY `stamp` DESC LIMIT 1
");
$usages = \Froxlor\Database\Database::pexecute_first($usages_stmt, array(
'cid' => $attributes['customerid']
));
if ($usages != true) {
$usages = [
'webspace' => 0,
'mailspace' => 0,
'dbspace' => 0
];
}
$infotext = null;
if (isset($attributes['webspace_used']) && isset($attributes['mailspace_used']) && isset($attributes['dbspace_used'])) {
$infotext = UI::getLng('panel.used') . ':<br>';
$infotext .= 'web: ' . PhpHelper::sizeReadable($usages['webspace'] * 1024, null, 'bi') . '<br>';
$infotext .= 'mail: ' . PhpHelper::sizeReadable($usages['mailspace'] * 1024, null, 'bi') . '<br>';
$infotext .= 'mysql: ' . PhpHelper::sizeReadable($usages['dbspace'] * 1024, null, 'bi');
$infotext .= 'web: ' . PhpHelper::sizeReadable($attributes['webspace_used'] * 1024, null, 'bi') . '<br>';
$infotext .= 'mail: ' . PhpHelper::sizeReadable($attributes['mailspace_used'] * 1024, null, 'bi') . '<br>';
$infotext .= 'mysql: ' . PhpHelper::sizeReadable($attributes['dbspace_used'] * 1024, null, 'bi');
}
return self::pbData('diskspace', $attributes, 1024, (int)\Froxlor\Settings::Get('system.report_webmax'), $infotext);
@@ -79,7 +61,7 @@ class ProgressBar
{
$percent = 0;
$style = 'bg-info';
$text = PhpHelper::sizeReadable($attributes[$field . '_used'] * $size_factor, null, 'bi') . ' / ' . UI::getLng('customer.unlimited');
$text = PhpHelper::sizeReadable($attributes[$field . '_used'] * $size_factor, null, 'bi') . ' / ' . UI::getLng('panel.unlimited');
if ((int) $attributes[$field] >= 0) {
if (($attributes[$field] / 100) * $report_max < $attributes[$field . '_used']) {
$style = 'bg-danger';

View File

@@ -23,12 +23,20 @@ class Listing
$items = $collection->getData()['list'];
$table = [];
foreach ($tabellisting['visible_columns'] as $visible_column) {
foreach ($tabellisting['visible_columns'] as $key => $visible_column) {
if (isset($tabellisting['columns'][$visible_column]['visible']) && !$tabellisting['columns'][$visible_column]['visible']) {
continue;
}
$table['th'][] = $tabellisting['columns'][$visible_column]['label'];
}
foreach ($items as $key => $item) {
foreach ($tabellisting['visible_columns'] as $visible_column) {
if (isset($tabellisting['columns'][$visible_column]['visible']) && !$tabellisting['columns'][$visible_column]['visible']) {
continue;
}
$format_callback = $tabellisting['columns'][$visible_column]['format_callback'] ?? null;
$column = $tabellisting['columns'][$visible_column]['column'];
$data = self::getMultiArrayFromString($item, $column);

View File

@@ -69,8 +69,6 @@ $lng['customer']['forwarders'] = 'Email-forwarders';
$lng['customer']['ftps'] = 'FTP-účty';
$lng['customer']['subdomains'] = 'Subdomény';
$lng['customer']['domains'] = 'Domény';
$lng['customer']['unlimited'] = '∞';
$lng['customer']['mib'] = 'MiB';
/**
* Customermenue

View File

@@ -70,7 +70,7 @@ $lng['customer']['forwarders'] = 'Email-forwarders';
$lng['customer']['ftps'] = 'FTP-accounts';
$lng['customer']['subdomains'] = 'Subdomains';
$lng['customer']['domains'] = 'Domains';
$lng['customer']['unlimited'] = '∞';
$lng['panel']['unlimited'] = '∞';
$lng['customer']['mib'] = 'MiB';
$lng['customer']['gib'] = 'GiB';

View File

@@ -40,4 +40,3 @@ $lng['menue']['logger']['logger'] = $lng['admin']['loggersystem'];
$lng['serversettings']['default_sslvhostconf']['description'] = $lng['serversettings']['default_vhostconf']['description'];
$lng['admin']['include_ownvhostsettings'] = $lng['serversettings']['includedefault_sslvhostconf'];
$lng['panel']['unlimited'] = $lng['customer']['unlimited'];