mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 01:05:39 +02:00
Merge branch 'ent-7143-Autoajuste-de-la-consola-visual' into 'develop'
Ent 7143 autoajuste de la consola visual See merge request artica/pandorafms!4218
This commit is contained in:
commit
397eebd86c
@ -11,4 +11,6 @@ UPDATE `tuser_task_scheduled` SET
|
|||||||
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:7;s:3:"PDF";s:15:"first_execution"')
|
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:7;s:3:"PDF";s:15:"first_execution"')
|
||||||
WHERE `id_user_task` = 2;
|
WHERE `id_user_task` = 2;
|
||||||
|
|
||||||
|
ALTER TABLE `tlayout` ADD COLUMN `auto_adjust` INTEGER UNSIGNED NOT NULL default 0;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -1665,6 +1665,8 @@ UPDATE tlayout SET is_favourite = 1 WHERE name REGEXP '^(' OR name REGEXP '^
|
|||||||
|
|
||||||
ALTER TABLE `tlayout` MODIFY COLUMN `is_favourite` int(10) unsigned NOT NULL DEFAULT '0';
|
ALTER TABLE `tlayout` MODIFY COLUMN `is_favourite` int(10) unsigned NOT NULL DEFAULT '0';
|
||||||
|
|
||||||
|
ALTER TABLE `tlayout` ADD COLUMN `auto_adjust` INTEGER UNSIGNED NOT NULL default 0;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tlayout_data`
|
-- Table `tlayout_data`
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
|
@ -222,6 +222,9 @@ $table->data[5][1] .= '<span class="opt" style="visibility:hidden;">
|
|||||||
$table->data[6][0] = __('Favourite visual console');
|
$table->data[6][0] = __('Favourite visual console');
|
||||||
$table->data[6][1] = html_print_checkbox('is_favourite', 0, $is_favourite, true);
|
$table->data[6][1] = html_print_checkbox('is_favourite', 0, $is_favourite, true);
|
||||||
|
|
||||||
|
$table->data[7][0] = __('Auto adjust to screen in fullscreen');
|
||||||
|
$table->data[7][1] = html_print_checkbox('auto_adjust', 0, $auto_adjust, true);
|
||||||
|
|
||||||
if ($action == 'new') {
|
if ($action == 'new') {
|
||||||
$textButtonSubmit = __('Save');
|
$textButtonSubmit = __('Save');
|
||||||
$classButtonSubmit = 'sub wand';
|
$classButtonSubmit = 'sub wand';
|
||||||
@ -426,6 +429,22 @@ $(document).ready (function () {
|
|||||||
$("#hidden-is_favourite_sent").val(0);
|
$("#hidden-is_favourite_sent").val(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if($("#checkbox-auto_adjust").is(":checked")) {
|
||||||
|
$("#hidden-auto_adjust_sent").val(1);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("#hidden-auto_adjust_sent").val(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#checkbox-auto_adjust").change(function(){
|
||||||
|
if($(this).is(":checked")) {
|
||||||
|
$("#hidden-auto_adjust_sent").val(1);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("#hidden-auto_adjust_sent").val(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function metaconsole_url() {
|
function metaconsole_url() {
|
||||||
metaconsole = $("input[name='metaconsole_activated']").val();
|
metaconsole = $("input[name='metaconsole_activated']").val();
|
||||||
|
@ -151,6 +151,7 @@ switch ($activeTab) {
|
|||||||
$height = '';
|
$height = '';
|
||||||
$visualConsoleName = '';
|
$visualConsoleName = '';
|
||||||
$is_favourite = 0;
|
$is_favourite = 0;
|
||||||
|
$auto_adjust = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'update':
|
case 'update':
|
||||||
@ -162,6 +163,7 @@ switch ($activeTab) {
|
|||||||
$height = (int) get_parameter('height');
|
$height = (int) get_parameter('height');
|
||||||
$visualConsoleName = (string) get_parameter('name');
|
$visualConsoleName = (string) get_parameter('name');
|
||||||
$is_favourite = (int) get_parameter('is_favourite_sent');
|
$is_favourite = (int) get_parameter('is_favourite_sent');
|
||||||
|
$auto_adjust = (int) get_parameter('auto_adjust_sent');
|
||||||
|
|
||||||
// ACL for the new visual console
|
// ACL for the new visual console
|
||||||
// $vconsole_read_new = check_acl ($config['id_user'], $idGroup, "VR");
|
// $vconsole_read_new = check_acl ($config['id_user'], $idGroup, "VR");
|
||||||
@ -186,6 +188,7 @@ switch ($activeTab) {
|
|||||||
'width' => $width,
|
'width' => $width,
|
||||||
'height' => $height,
|
'height' => $height,
|
||||||
'is_favourite' => $is_favourite,
|
'is_favourite' => $is_favourite,
|
||||||
|
'auto_adjust' => $auto_adjust,
|
||||||
];
|
];
|
||||||
|
|
||||||
$error = $_FILES['background_image']['error'];
|
$error = $_FILES['background_image']['error'];
|
||||||
@ -353,6 +356,7 @@ switch ($activeTab) {
|
|||||||
$width = $visualConsole['width'];
|
$width = $visualConsole['width'];
|
||||||
$height = $visualConsole['height'];
|
$height = $visualConsole['height'];
|
||||||
$is_favourite = $visualConsole['is_favourite'];
|
$is_favourite = $visualConsole['is_favourite'];
|
||||||
|
$auto_adjust = $visualConsole['auto_adjust'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -737,6 +737,13 @@ function loadVisualConsoleData(baseUrl, vcId, size, id_user, hash, callback) {
|
|||||||
)
|
)
|
||||||
.done(handleSuccess("props"))
|
.done(handleSuccess("props"))
|
||||||
.fail(handleFail);
|
.fail(handleFail);
|
||||||
|
|
||||||
|
var queryString = new URLSearchParams(window.location.search);
|
||||||
|
var widthScreen = 0;
|
||||||
|
if (queryString.get("width")) {
|
||||||
|
widthScreen = document.body.offsetWidth;
|
||||||
|
}
|
||||||
|
|
||||||
// Visual Console items request.
|
// Visual Console items request.
|
||||||
itemsJqXHR = jQuery
|
itemsJqXHR = jQuery
|
||||||
// .get(apiPath + "/visual-consoles/" + vcId + "/items", null, "json")
|
// .get(apiPath + "/visual-consoles/" + vcId + "/items", null, "json")
|
||||||
@ -748,7 +755,8 @@ function loadVisualConsoleData(baseUrl, vcId, size, id_user, hash, callback) {
|
|||||||
size: size,
|
size: size,
|
||||||
visualConsoleId: vcId,
|
visualConsoleId: vcId,
|
||||||
id_user: typeof id_user == undefined ? id_user : null,
|
id_user: typeof id_user == undefined ? id_user : null,
|
||||||
auth_hash: typeof hash == undefined ? hash : null
|
auth_hash: typeof hash == undefined ? hash : null,
|
||||||
|
widthScreen: widthScreen
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
)
|
)
|
||||||
|
@ -86,6 +86,8 @@ if ($getVisualConsole === true) {
|
|||||||
|
|
||||||
$size = get_parameter('size', []);
|
$size = get_parameter('size', []);
|
||||||
|
|
||||||
|
$width = get_parameter('widthScreen', 0);
|
||||||
|
|
||||||
$ratio = 0;
|
$ratio = 0;
|
||||||
if (isset($size) === true
|
if (isset($size) === true
|
||||||
&& is_array($size) === true
|
&& is_array($size) === true
|
||||||
@ -107,10 +109,16 @@ if ($getVisualConsole === true) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$widthRatio = 0;
|
||||||
|
if ($visualConsoleData['autoAdjust'] === true && $width > 0) {
|
||||||
|
$widthRatio = ($width / $visualConsoleData['width']);
|
||||||
|
}
|
||||||
|
|
||||||
$vcItems = VisualConsole::getItemsFromDB(
|
$vcItems = VisualConsole::getItemsFromDB(
|
||||||
$visualConsoleId,
|
$visualConsoleId,
|
||||||
$aclUserGroups,
|
$aclUserGroups,
|
||||||
$ratio
|
$ratio,
|
||||||
|
$widthRatio
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '['.implode(',', $vcItems).']';
|
echo '['.implode(',', $vcItems).']';
|
||||||
|
@ -72,17 +72,17 @@ abstract class CachedModel extends Model
|
|||||||
*
|
*
|
||||||
* @overrides Model::fromDB.
|
* @overrides Model::fromDB.
|
||||||
*/
|
*/
|
||||||
public static function fromDB(array $filter, ?float $ratio=0): Model
|
public static function fromDB(array $filter, ?float $ratio=0, ?float $widthRatio=0): Model
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
$save_cache = false;
|
$save_cache = false;
|
||||||
if ($ratio == 0 && $filter['cache_expiration'] > 0) {
|
if ($ratio == 0 && $filter['cache_expiration'] > 0 && $widthRatio == 0) {
|
||||||
$data = static::fetchCachedData($filter);
|
$data = static::fetchCachedData($filter);
|
||||||
$save_cache = true;
|
$save_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data) === false) {
|
if (isset($data) === false) {
|
||||||
$data = static::fetchDataFromDB($filter, $ratio);
|
$data = static::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
} else {
|
} else {
|
||||||
// Retrieved from cache.
|
// Retrieved from cache.
|
||||||
$save_cache = false;
|
$save_cache = false;
|
||||||
|
@ -130,7 +130,8 @@ abstract class Model
|
|||||||
*/
|
*/
|
||||||
abstract protected static function fetchDataFromDB(
|
abstract protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -141,10 +142,10 @@ abstract class Model
|
|||||||
*
|
*
|
||||||
* @return self A modeled element's instance.
|
* @return self A modeled element's instance.
|
||||||
*/
|
*/
|
||||||
public static function fromDB(array $filter, ?float $ratio=0): self
|
public static function fromDB(array $filter, ?float $ratio=0, ?float $widthRatio=0): self
|
||||||
{
|
{
|
||||||
// The reserved word static refers to the invoked class at runtime.
|
// The reserved word static refers to the invoked class at runtime.
|
||||||
return static::fromArray(static::fetchDataFromDB($filter, $ratio));
|
return static::fromArray(static::fetchDataFromDB($filter, $ratio, $widthRatio));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,6 +84,7 @@ final class Container extends Model
|
|||||||
'backgroundImage' => static::extractBackgroundImage($data),
|
'backgroundImage' => static::extractBackgroundImage($data),
|
||||||
'backgroundColor' => static::extractBackgroundColor($data),
|
'backgroundColor' => static::extractBackgroundColor($data),
|
||||||
'isFavorite' => static::extractFavorite($data),
|
'isFavorite' => static::extractFavorite($data),
|
||||||
|
'autoAdjust' => static::extractAutoAdjust($data),
|
||||||
'width' => (int) $data['width'],
|
'width' => (int) $data['width'],
|
||||||
'height' => (int) $data['height'],
|
'height' => (int) $data['height'],
|
||||||
'backgroundURL' => static::extractBackgroundUrl($data),
|
'backgroundURL' => static::extractBackgroundUrl($data),
|
||||||
@ -252,6 +253,21 @@ final class Container extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract the "auto adjust" switch value.
|
||||||
|
*
|
||||||
|
* @param array $data Unknown input data structure.
|
||||||
|
*
|
||||||
|
* @return boolean If the item is favorite or not.
|
||||||
|
*/
|
||||||
|
private static function extractAutoAdjust(array $data): bool
|
||||||
|
{
|
||||||
|
return static::parseBool(
|
||||||
|
static::issetInArray($data, ['auto_adjust', 'autoAdjust'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain a container data structure from the database using a filter.
|
* Obtain a container data structure from the database using a filter.
|
||||||
*
|
*
|
||||||
@ -264,7 +280,8 @@ final class Container extends Model
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
) {
|
) {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
@ -387,7 +404,8 @@ final class Container extends Model
|
|||||||
public static function getItemsFromDB(
|
public static function getItemsFromDB(
|
||||||
int $layoutId,
|
int $layoutId,
|
||||||
array $groupsFilter=[],
|
array $groupsFilter=[],
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Default filter.
|
// Default filter.
|
||||||
$filter = ['id_layout' => $layoutId];
|
$filter = ['id_layout' => $layoutId];
|
||||||
@ -438,7 +456,7 @@ final class Container extends Model
|
|||||||
$class = static::getItemClass((int) $data['type']);
|
$class = static::getItemClass((int) $data['type']);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
array_push($items, $class::fromDB($data, $ratio));
|
array_push($items, $class::fromDB($data, $ratio, $widthRatio));
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
error_log('VC[Container]: '.$e->getMessage());
|
error_log('VC[Container]: '.$e->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -765,7 +765,8 @@ class Item extends CachedModel
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Load side libraries.
|
// Load side libraries.
|
||||||
global $config;
|
global $config;
|
||||||
@ -805,6 +806,11 @@ class Item extends CachedModel
|
|||||||
$row['pos_y'] = ($row['pos_y'] * $ratio);
|
$row['pos_y'] = ($row['pos_y'] * $ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($widthRatio != 0) {
|
||||||
|
$row['width'] = ($row['width'] * $widthRatio);
|
||||||
|
$row['pos_x'] = ($row['pos_x'] * $widthRatio);
|
||||||
|
}
|
||||||
|
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,11 +192,12 @@ final class BarsGraph extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -419,11 +419,12 @@ final class Clock extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
// Default values.
|
// Default values.
|
||||||
if ((int) $data['width'] === 0) {
|
if ((int) $data['width'] === 0) {
|
||||||
|
@ -280,11 +280,12 @@ final class ColorCloud extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -89,11 +89,12 @@ final class DonutGraph extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -82,11 +82,12 @@ final class EventsHistory extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -204,11 +204,12 @@ final class Group extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -98,11 +98,12 @@ final class Icon extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -194,7 +194,8 @@ final class Line extends Model
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
@ -211,6 +212,11 @@ final class Line extends Model
|
|||||||
$row['pos_y'] = ($row['pos_y'] * $ratio);
|
$row['pos_y'] = ($row['pos_y'] * $ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($widthRatio != 0) {
|
||||||
|
$row['width'] = ($row['width'] * $widthRatio);
|
||||||
|
$row['pos_x'] = ($row['pos_x'] * $widthRatio);
|
||||||
|
}
|
||||||
|
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,11 +266,12 @@ final class ModuleGraph extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -359,7 +359,8 @@ final class NetworkLink extends Model
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
@ -376,6 +377,11 @@ final class NetworkLink extends Model
|
|||||||
$row['pos_y'] = ($row['pos_y'] * $ratio);
|
$row['pos_y'] = ($row['pos_y'] * $ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($widthRatio != 0) {
|
||||||
|
$row['width'] = ($row['width'] * $widthRatio);
|
||||||
|
$row['pos_x'] = ($row['pos_x'] * $widthRatio);
|
||||||
|
}
|
||||||
|
|
||||||
$row['label'] = static::buildLabels($row);
|
$row['label'] = static::buildLabels($row);
|
||||||
|
|
||||||
return $row;
|
return $row;
|
||||||
|
@ -330,11 +330,12 @@ final class Percentile extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -230,11 +230,12 @@ final class SimpleValue extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -143,11 +143,12 @@ final class StaticGraph extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -77,6 +77,9 @@ $pure = (bool) get_parameter('pure', $config['pure']);
|
|||||||
// Refresh interval in seconds.
|
// Refresh interval in seconds.
|
||||||
$refr = (int) get_parameter('refr', $config['vc_refr']);
|
$refr = (int) get_parameter('refr', $config['vc_refr']);
|
||||||
|
|
||||||
|
$width = (int) get_parameter('width', 0);
|
||||||
|
$height = (int) get_parameter('height', 0);
|
||||||
|
|
||||||
// Load Visual Console.
|
// Load Visual Console.
|
||||||
use Models\VisualConsole\Container as VisualConsole;
|
use Models\VisualConsole\Container as VisualConsole;
|
||||||
$visualConsole = null;
|
$visualConsole = null;
|
||||||
@ -200,7 +203,7 @@ $options['view']['active'] = true;
|
|||||||
|
|
||||||
if (is_metaconsole() === false) {
|
if (is_metaconsole() === false) {
|
||||||
if (!$config['pure']) {
|
if (!$config['pure']) {
|
||||||
$options['pure']['text'] = '<a href="index.php?sec=network&sec2=operation/visual_console/render_view&id='.$visualConsoleId.'&pure=1&refr='.$refr.'">'.html_print_image(
|
$options['pure']['text'] = '<a id ="full_screen" href="index.php?sec=network&sec2=operation/visual_console/render_view&id='.$visualConsoleId.'&pure=1&refr='.$refr.'">'.html_print_image(
|
||||||
'images/full_screen.png',
|
'images/full_screen.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
@ -489,11 +492,47 @@ ui_require_javascript_file('pandora_visual_console');
|
|||||||
include_javascript_d3();
|
include_javascript_d3();
|
||||||
visual_map_load_client_resources();
|
visual_map_load_client_resources();
|
||||||
|
|
||||||
|
$widthRatio = 0;
|
||||||
|
if ($width > 0 && $pure == 1) {
|
||||||
|
$widthRatio = ($width / $visualConsoleData['width']);
|
||||||
|
|
||||||
|
if ($visualConsoleData['width'] > $height) {
|
||||||
|
?>
|
||||||
|
<style type="text/css">
|
||||||
|
div#main_pure {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
div#visual-console-container {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<style type="text/css">
|
||||||
|
div#main_pure {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
div#visual-console-container {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Load Visual Console Items.
|
// Load Visual Console Items.
|
||||||
$visualConsoleItems = VisualConsole::getItemsFromDB(
|
$visualConsoleItems = VisualConsole::getItemsFromDB(
|
||||||
$visualConsoleId,
|
$visualConsoleId,
|
||||||
$aclUserGroups
|
$aclUserGroups,
|
||||||
|
0,
|
||||||
|
$widthRatio
|
||||||
);
|
);
|
||||||
|
|
||||||
ui_require_css_file('modal');
|
ui_require_css_file('modal');
|
||||||
ui_require_css_file('form');
|
ui_require_css_file('form');
|
||||||
?>
|
?>
|
||||||
@ -506,6 +545,7 @@ ui_require_css_file('form');
|
|||||||
var items = <?php echo '['.implode(',', $visualConsoleItems).']'; ?>;
|
var items = <?php echo '['.implode(',', $visualConsoleItems).']'; ?>;
|
||||||
var baseUrl = "<?php echo ui_get_full_url('/', false, false, false); ?>";
|
var baseUrl = "<?php echo ui_get_full_url('/', false, false, false); ?>";
|
||||||
var controls = document.getElementById('vc-controls');
|
var controls = document.getElementById('vc-controls');
|
||||||
|
|
||||||
autoHideElement(controls, 1000);
|
autoHideElement(controls, 1000);
|
||||||
var handleUpdate = function (prevProps, newProps) {
|
var handleUpdate = function (prevProps, newProps) {
|
||||||
if (!newProps) return;
|
if (!newProps) return;
|
||||||
@ -683,6 +723,19 @@ if ($edit_capable === true) {
|
|||||||
visualConsoleManager.createItem(type);
|
visualConsoleManager.createItem(type);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#full_screen').click(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
if (props.autoAdjust === true) {
|
||||||
|
var hrefAux = $('#full_screen').attr('href');
|
||||||
|
hrefAux += '&width=' + document.body.offsetWidth+'&height=' + screen.height;
|
||||||
|
$('#full_screen').attr('href', hrefAux);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.location.href = $('#full_screen').attr('href');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process ajax responses and shows a dialog with results.
|
* Process ajax responses and shows a dialog with results.
|
||||||
*/
|
*/
|
||||||
|
@ -1626,6 +1626,7 @@ CREATE TABLE IF NOT EXISTS `tlayout` (
|
|||||||
`width` INTEGER UNSIGNED NOT NULL default 0,
|
`width` INTEGER UNSIGNED NOT NULL default 0,
|
||||||
`background_color` varchar(50) NOT NULL default '#FFF',
|
`background_color` varchar(50) NOT NULL default '#FFF',
|
||||||
`is_favourite` INTEGER UNSIGNED NOT NULL default 0,
|
`is_favourite` INTEGER UNSIGNED NOT NULL default 0,
|
||||||
|
`auto_adjust` INTEGER UNSIGNED NOT NULL default 0,
|
||||||
PRIMARY KEY(`id`)
|
PRIMARY KEY(`id`)
|
||||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
@ -1334,18 +1334,18 @@ UPDATE `tnotification_source` SET `enabled`=1 WHERE `description` = 'System 
|
|||||||
--
|
--
|
||||||
INSERT INTO `tlayout`
|
INSERT INTO `tlayout`
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Demo visual console', 0, 'fondo.jpg', 1080, 1920, 'white', 0),
|
(1, 'Demo visual console', 0, 'fondo.jpg', 1080, 1920, 'white', 0, 0),
|
||||||
(2,'Demo visual console 2',0,'fondo-keep-alive.jpg',1080,1920,'#FFF',0),
|
(2,'Demo visual console 2',0,'fondo-keep-alive.jpg',1080,1920,'#FFF',0, 0),
|
||||||
(3,'Worldmap',0,'map_world.jpg',1080,1920,'white',0),
|
(3,'Worldmap',0,'map_world.jpg',1080,1920,'white',0, 0),
|
||||||
(4,'Europe',0,'map_europe_1.jpg',1080,1920,'white',0),
|
(4,'Europe',0,'map_europe_1.jpg',1080,1920,'white',0, 0),
|
||||||
(5,'USA',0,'map_USA.jpg',1080,1920,'white',0),
|
(5,'USA',0,'map_USA.jpg',1080,1920,'white',0, 0),
|
||||||
(6,'Spain',0,'map_spain.jpg',1080,1920,'white',0),
|
(6,'Spain',0,'map_spain.jpg',1080,1920,'white',0, 0),
|
||||||
(7,'Madrid',0,'map_madrid.jpg',1080,1920,'white',0),
|
(7,'Madrid',0,'map_madrid.jpg',1080,1920,'white',0, 0),
|
||||||
(8,'Germany',0,'map_germany_1.jpg',1080,1920,'white',0),
|
(8,'Germany',0,'map_germany_1.jpg',1080,1920,'white',0, 0),
|
||||||
(9,'France',0,'map_france.jpg',1080,1920,'white',0),
|
(9,'France',0,'map_france.jpg',1080,1920,'white',0, 0),
|
||||||
(10,'Catalonia',0,'map_catalonia.jpg',1080,1920,'white',0),
|
(10,'Catalonia',0,'map_catalonia.jpg',1080,1920,'white',0, 0),
|
||||||
(11,'Basque Country',0,'map_basque-country.jpg',1080,1920,'white',0),
|
(11,'Basque Country',0,'map_basque-country.jpg',1080,1920,'white',0, 0),
|
||||||
(12,'Andalusia',0,'map_andalusia.jpg',1080,1920,'white',0)
|
(12,'Andalusia',0,'map_andalusia.jpg',1080,1920,'white',0, 0)
|
||||||
;
|
;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
Loading…
x
Reference in New Issue
Block a user