fix cv in mobile pandora_enterprise#12196

This commit is contained in:
daniel 2023-10-11 10:48:26 +02:00
parent 98d843c32f
commit d19b506781
8 changed files with 99 additions and 29 deletions

View File

@ -1440,22 +1440,56 @@ function openURLTagWindow(url) {
*/
function defineTinyMCE(selector) {
var defaultToolbar =
"undo redo | blocks | bold italic | code | alignleft aligncenter alignright alignjustify | outdent indent";
tinymce.init({
selector: selector,
plugins: "preview, searchreplace, table, nonbreaking, link, image",
plugins:
"preview, searchreplace, table, nonbreaking, link, image, code, codesample",
promotion: false,
branding: false
branding: false,
codesample_languages: [
{ text: "HTML/XML", value: "markup" },
{ text: "JavaScript", value: "javascript" },
{ text: "CSS", value: "css" },
{ text: "PHP", value: "php" },
{ text: "Ruby", value: "ruby" },
{ text: "Python", value: "python" },
{ text: "Java", value: "java" },
{ text: "C", value: "c" },
{ text: "C#", value: "csharp" },
{ text: "C++", value: "cpp" }
],
toolbar: defaultToolbar
});
}
function defineTinyMCEDark(selector) {
var defaultToolbar =
"undo redo | blocks | bold italic | code | alignleft aligncenter alignright alignjustify | outdent indent";
tinymce.init({
selector: selector,
plugins: "preview, searchreplace, table, nonbreaking, link, image",
plugins:
"preview, searchreplace, table, nonbreaking, link, image, code, codesample",
promotion: false,
branding: false,
skin: "oxide-dark",
content_css: "dark"
content_css: "dark",
codesample_languages: [
{ text: "HTML/XML", value: "markup" },
{ text: "JavaScript", value: "javascript" },
{ text: "CSS", value: "css" },
{ text: "PHP", value: "php" },
{ text: "Ruby", value: "ruby" },
{ text: "Python", value: "python" },
{ text: "Java", value: "java" },
{ text: "C", value: "c" },
{ text: "C#", value: "csharp" },
{ text: "C++", value: "cpp" }
],
toolbar: defaultToolbar
});
}

View File

@ -1487,12 +1487,26 @@ function dashboardLoadVC(settings) {
let width = 0;
let height = 0;
let isMobile = true;
// If it is detected that it is a real mobile not the web inspector
// deducts 45 more for the header and footer of the mobile.
const fixHeader = 45;
if (navigator && navigator.userAgentData != null) {
isMobile = navigator.userAgentData.mobile;
}
if (event.target.screen.orientation.angle === 0) {
width = $(window).height() + 45;
height = $(window).width() - 45;
width = $(window).height();
if (isMobile) {
width += fixHeader;
}
height = $(window).width();
} else {
width = $(window).height() + 45;
height = $(window).width() - 45 * 2;
width = $(window).height();
height = $(window).width() - fixHeader;
if (isMobile) {
height -= fixHeader;
}
}
var dimensions = {

View File

@ -1497,7 +1497,11 @@ function show_dialog(dialog) {
$(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
const requestBody = ajaxOptions.data;
try {
if (requestBody && requestBody.includes("drawConsoleSound=1")) {
if (
requestBody &&
typeof requestBody.includes === "function" &&
requestBody.includes("drawConsoleSound=1")
) {
console.log(
"AJAX request sent with drawConsoleSound=1:",
ajaxOptions.url
@ -1659,7 +1663,11 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
$(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
const requestBody = ajaxOptions.data;
try {
if (requestBody && requestBody.includes("drawConsoleSound=1")) {
if (
requestBody &&
typeof requestBody.includes === "function" &&
requestBody.includes("drawConsoleSound=1")
) {
console.log(
"AJAX request sent with drawConsoleSound=1:",
ajaxOptions.url

View File

@ -353,7 +353,6 @@ class Manager
}
}
} catch (\Exception $e) {
hd($e->getMessage());
$error_upload = $e->getMessage();
}
@ -1499,7 +1498,6 @@ class Manager
$result = $ITSM->pingItsmtoPandora($path);
} catch (Throwable $e) {
echo $e->getMessage();
hd($e->getMessage(), true);
$result = false;
exit;
}

View File

@ -325,10 +325,6 @@ final class ModuleGraph extends Item
$width = (int) $data['width'];
$height = (int) $data['height'];
if ($height == 0) {
$height = 15;
}
// Custom graph.
if (empty($customGraphId) === false) {
$customGraph = \db_get_row('tgraph', 'id_graph', $customGraphId);
@ -340,7 +336,12 @@ final class ModuleGraph extends Item
'field_order'
);
$hackLegendHight = (28 * count($sources));
$total_labels = $config['items_combined_charts'];
if (count($sources) < $config['items_combined_charts']) {
$total_labels = count($sources);
}
$hackLegendHight = (25.5 * $total_labels);
// Trick for legend monstruosity.
if ((int) $customGraph['stacked'] === CUSTOM_GRAPH_STACKED_LINE
@ -348,16 +349,20 @@ final class ModuleGraph extends Item
|| (int) $customGraph['stacked'] === CUSTOM_GRAPH_AREA
|| (int) $customGraph['stacked'] === CUSTOM_GRAPH_LINE
) {
if ($width < 200 || $height < 200) {
if (($height - $hackLegendHight) <= 50) {
$showLegend = false;
} else {
$height = ($height - 10 - $hackLegendHight);
$showLegend = true;
$height = ($height - $hackLegendHight);
}
} else if ((int) $customGraph['stacked'] === CUSTOM_GRAPH_VBARS) {
$height = ($height - 40);
}
if ($height <= 0) {
$showLegend = false;
$height = 100;
}
$params = [
'period' => $period,
'width' => $width,
@ -394,11 +399,8 @@ final class ModuleGraph extends Item
}
// Trick for legend monstruosity.
if ($width < 200 || $height < 200) {
$showLegend = false;
} else {
$height = ($height - 30);
$showLegend = true;
if ((bool) $showLegend === true) {
$height -= 30;
}
$params = [

View File

@ -51,6 +51,11 @@ h1 {
margin-bottom: 0.5rem;
}
.visual-console-container-dashboard h1 {
font-size: inherit;
margin-bottom: inherit;
}
.container-fluid {
margin-top: 5px;
}

View File

@ -3320,7 +3320,3 @@ div.visual-console-container-dashboard fieldset {
.ui-page-theme-a div.visual-console-container-dashboard a {
color: inherit !important;
}
body div.visual-console-container-dashboard .visual-console-item-label {
line-height: 10px;
}

View File

@ -1032,6 +1032,19 @@ class Ui
$(document).ready(function () {
dashboardLoadVC(settings);
if(settings.mobile_view_orientation_vc === false) {
$("#main_page > .ui-content").css("display", "block");
$(".container-center").css("padding", "50% 0");
$(".container-center").css("height", "100vh");
$(".visual-console-container-dashboard").css("display", "block");
$(".visual-console-container-dashboard").css("transform-origin", "left top");
$(".visual-console-container-dashboard").css("transform", "rotate(-90deg) translate(-100%)");
$(".visual-console-container-dashboard").css("margin-top", "-50%");
$(".visual-console-container-dashboard").css("white-space", "nowrap");
if(settings.props.height > settings.props.width) {
$(".container-center").css("overflow", "auto");
}
}
});
</script>'
);