Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1091 [Core] fix: file can't be download after copy when conf is 0660 #1092

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ed4dd9b
#1086 [JS] fix: media gallery error and config medias
nicolas-eoxia Sep 27, 2024
4d5655d
#1088 [Mod] add: function check_variable for tpl
nicolas-eoxia Sep 27, 2024
7fb7f78
#1091 [Core] fix: file can't be download after copy when conf is 0660
evarisk-kilyan Sep 27, 2024
7deae12
Merge pull request #1087 from nicolas-eoxia/fix_media_gallery_and_config
nicolas-eoxia Sep 27, 2024
16bf238
#1089 [TPL] fix: fatal wrong type parameters
nicolas-eoxia Sep 27, 2024
d4f49eb
Merge pull request #1089 from nicolas-eoxia/add_function_check_variab…
nicolas-eoxia Sep 27, 2024
aa2615a
#1093 [CSS] add: html and css new module infobox
eoxia-amandine Oct 2, 2024
c1e5196
#1093 [CSS] add: template infobox
eoxia-amandine Oct 3, 2024
7c11455
#1093 [Dashboard] add: adding picto color, widget title and fix widge…
evarisk-kilyan Oct 4, 2024
7672a53
#1093 [Dashboard] fix: clean code
evarisk-kilyan Oct 4, 2024
567167e
Merge pull request #1094 from eoxia-amandine/add_css_infobox
nicolas-eoxia Oct 4, 2024
9efd9cd
#1095 [CSS] add: img css for remove unwanted property
nicolas-eoxia Oct 7, 2024
a54c5fd
Merge pull request #1096 from nicolas-eoxia/add_img_css
nicolas-eoxia Oct 7, 2024
9ca19fe
#1097 [JS] fix: manage help button on menu
nicolas-eoxia Oct 9, 2024
631ec3f
Merge pull request #1098 from nicolas-eoxia/fix_menu
nicolas-eoxia Oct 9, 2024
aba0cb6
#1084 [Media] fix: add file button fatal
nicolas-eoxia Oct 9, 2024
3bd6576
Merge pull request #1099 from nicolas-eoxia/fix_media_add_button
nicolas-eoxia Oct 9, 2024
74b65a4
#1100 [ODT] fix: change redirect proke method
nicolas-eoxia Oct 9, 2024
29da1f7
Merge pull request #1101 from nicolas-eoxia/fix_builddoc
nicolas-eoxia Oct 9, 2024
3687783
#1102 [Lib] add: parameter entity for showUrlOfLastGeneratedDocument
nicolas-eoxia Oct 11, 2024
0c12749
Merge pull request #1103 from nicolas-eoxia/add_param_showUrlOfLastGe…
nicolas-eoxia Oct 11, 2024
48761dd
#1105 [DocumentAction] fix: infinite redirect when archive
evarisk-kilyan Oct 14, 2024
1f8fbbb
#1107 [SaturneDashboard] fix: table overflow on phone
evarisk-kilyan Oct 14, 2024
8a1f949
Merge pull request #1106 from evarisk-kilyan/fix_infinite_redirect
nicolas-eoxia Oct 14, 2024
50d6292
#1108 [Dashboard] fix: remove useless form for exportcsv and manage i…
evarisk-kilyan Oct 21, 2024
a729b42
#1108 [Dashboard] fix: send data in json
evarisk-kilyan Oct 22, 2024
61d18a6
#1108 [Dashboard] fix: clean PHPCS and trad
nicolas-eoxia Oct 22, 2024
c4463bc
Merge pull request #1111 from evarisk-kilyan/remove_useless_form_expo…
nicolas-eoxia Oct 22, 2024
0d27f78
#1113 [SaturneObject] add: label on getNomUrlTooltip
nicolas-eoxia Oct 24, 2024
18b639b
Merge pull request #1114 from nicolas-eoxia/add_saturneobject_getNomUrl
nicolas-eoxia Oct 24, 2024
51e57f8
#1091 [Core] fix: file can't be download after copy when conf is 0660
evarisk-kilyan Sep 27, 2024
b7bb5a1
#1091 [Core] fix: add set_const to replace global
evarisk-kilyan Oct 24, 2024
84395de
Merge remote-tracking branch 'evarisk-kilyan/fix_file_cant_download' …
evarisk-kilyan Oct 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 90 additions & 1 deletion admin/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@
require_once __DIR__ . '/../lib/saturne.lib.php';

// Global variables definitions
global $db, $langs, $user;
global $conf, $db, $langs, $user;

// Load translation files required by the page
saturne_load_langs(['admin']);

// Initialize view objects
$form = new Form($db);

// Parameters
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
Expand All @@ -51,6 +54,30 @@
$permissiontoread = $user->rights->saturne->adminpage->read;
saturne_check_access($permissiontoread);

/*
* Actions
*/

if ($action == 'set_media_infos') {
$mediasMax['SATURNE_MEDIA_MAX_WIDTH_MINI'] = GETPOST('MediaMaxWidthMini', 'alpha');
$mediasMax['SATURNE_MEDIA_MAX_HEIGHT_MINI'] = GETPOST('MediaMaxHeightMini', 'alpha');
$mediasMax['SATURNE_MEDIA_MAX_WIDTH_SMALL'] = GETPOST('MediaMaxWidthSmall', 'alpha');
$mediasMax['SATURNE_MEDIA_MAX_HEIGHT_SMALL'] = GETPOST('MediaMaxHeightSmall', 'alpha');
$mediasMax['SATURNE_MEDIA_MAX_WIDTH_MEDIUM'] = GETPOST('MediaMaxWidthMedium', 'alpha');
$mediasMax['SATURNE_MEDIA_MAX_HEIGHT_MEDIUM'] = GETPOST('MediaMaxHeightMedium', 'alpha');
$mediasMax['SATURNE_MEDIA_MAX_WIDTH_LARGE'] = GETPOST('MediaMaxWidthLarge', 'alpha');
$mediasMax['SATURNE_MEDIA_MAX_HEIGHT_LARGE'] = GETPOST('MediaMaxHeightLarge', 'alpha');
$mediasMax['SATURNE_DISPLAY_NUMBER_MEDIA_GALLERY'] = GETPOST('DisplayNumberMediaGallery', 'alpha');

foreach($mediasMax as $key => $valueMax) {
dolibarr_set_const($db, $key, $valueMax, 'integer', 0, '', $conf->entity);
}

setEventMessage('SavedConfig');
header('Location: ' . $_SERVER['PHP_SELF']);
exit;
}

/*
* View
*/
Expand Down Expand Up @@ -136,6 +163,68 @@
// End of the table
print '</table>';

print load_fiche_titre($langs->trans('Configs', $langs->transnoentities('MediasMin')), '', '');

print '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '" name="media_data">';
print '<input type="hidden" name="token" value="' . newToken() . '">';
print '<input type="hidden" name="action" value="set_media_infos">';
print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans('Name') . '</td>';
print '<td>' . $langs->trans('Description') . '</td>';
print '<td>' . $langs->trans('Value') . '</td>';
print '</tr>';

print '<tr class="oddeven"><td><label for="MediaMaxWidthMini">' . $langs->trans('MediaMaxWidthMini') . '</label></td>';
print '<td>' . $langs->trans('MediaMaxWidthMiniDescription') . '</td>';
print '<td><input type="number" name="MediaMaxWidthMini" min="0" value="' . getDolGlobalInt('SATURNE_MEDIA_MAX_WIDTH_MINI') . '" required></td>';
print '</td></tr>';

print '<tr class="oddeven"><td><label for="MediaMaxHeightMini">' . $langs->trans('MediaMaxHeightMini') . '</label></td>';
print '<td>' . $langs->trans('MediaMaxHeightMiniDescription') . '</td>';
print '<td><input type="number" name="MediaMaxHeightMini" min="0" value="' . getDolGlobalInt('SATURNE_MEDIA_MAX_HEIGHT_MINI') . '" required></td>';
print '</td></tr>';

print '<tr class="oddeven"><td><label for="MediaMaxWidthSmall">' . $langs->trans('MediaMaxWidthSmall') . '</label></td>';
print '<td>' . $langs->trans('MediaMaxWidthSmallDescription') . '</td>';
print '<td><input type="number" name="MediaMaxWidthSmall" min="0" value="' . getDolGlobalInt('SATURNE_MEDIA_MAX_WIDTH_SMALL') . '" required></td>';
print '</td></tr>';

print '<tr class="oddeven"><td><label for="MediaMaxHeightSmall">' . $langs->trans('MediaMaxHeightSmall') . '</label></td>';
print '<td>' . $langs->trans('MediaMaxHeightSmallDescription') . '</td>';
print '<td><input type="number" name="MediaMaxHeightSmall" min="0" value="' . getDolGlobalInt('SATURNE_MEDIA_MAX_HEIGHT_SMALL') . '" required></td>';
print '</td></tr>';

print '<tr class="oddeven"><td><label for="MediaMaxWidthMedium">' . $langs->trans('MediaMaxWidthMedium') . '</label></td>';
print '<td>' . $langs->trans('MediaMaxWidthMediumDescription') . '</td>';
print '<td><input type="number" name="MediaMaxWidthMedium" min="0" value="' . getDolGlobalInt('SATURNE_MEDIA_MAX_WIDTH_MEDIUM') . '" required></td>';
print '</td></tr>';

print '<tr class="oddeven"><td><label for="MediaMaxHeightMedium">' . $langs->trans('MediaMaxHeightMedium') . '</label></td>';
print '<td>' . $langs->trans('MediaMaxHeightMediumDescription') . '</td>';
print '<td><input type="number" name="MediaMaxHeightMedium" min="0" value="' . getDolGlobalInt('SATURNE_MEDIA_MAX_HEIGHT_MEDIUM') . '" required></td>';
print '</td></tr>';

print '<tr class="oddeven"><td><label for="MediaMaxWidthLarge">' . $langs->trans('MediaMaxWidthLarge') . '</label></td>';
print '<td>' . $langs->trans('MediaMaxWidthLargeDescription') . '</td>';
print '<td><input type="number" name="MediaMaxWidthLarge" min="0" value="' . getDolGlobalInt('SATURNE_MEDIA_MAX_WIDTH_LARGE') . '" required></td>';
print '</td></tr>';

print '<tr class="oddeven"><td><label for="MediaMaxHeightLarge">' . $langs->trans('MediaMaxHeightLarge') . '</label></td>';
print '<td>' . $langs->trans('MediaMaxHeightLargeDescription') . '</td>';
print '<td><input type="number" name="MediaMaxHeightLarge" value="' . getDolGlobalInt('SATURNE_MEDIA_MAX_HEIGHT_LARGE') . '" required></td>';
print '</td></tr>';

print '<tr class="oddeven"><td><label for="DisplayNumberMediaGallery">' . $langs->trans('DisplayNumberMediaGallery') . '</label></td>';
print '<td>' . $langs->trans('DisplayNumberMediaGalleryDescription') . '</td>';
print '<td><input type="number" name="DisplayNumberMediaGallery" value="' . getDolGlobalInt('SATURNE_DISPLAY_NUMBER_MEDIA_GALLERY') . '" required></td>';
print '</td></tr>';

// End of the table
print '</table>';
print $form->buttonsSaveCancel('Save', '');
print '</form>';

// Page end
print dol_get_fiche_end();
llxFooter();
Expand Down
109 changes: 59 additions & 50 deletions class/saturnedashboard.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,57 +134,69 @@ public function show_dashboard(?array $moreParams = [])
foreach ($dashboards['widgets'] as $dashboardWidgets) {
foreach ($dashboardWidgets as $key => $dashboardWidget) {
if (!isset($disableWidgetList->$key) && is_array($dashboardWidget) && !empty($dashboardWidget)) {
$widget .= '<div class="box-flex-item"><div class="box-flex-item-with-margin">';
$widget .= '<div class="info-box">';
$widget .= '<span class="info-box-icon">';
$widget .= '<i class="' . $dashboardWidget['picto'] . '"></i>';
$widget .= '</span>';
$widget .= '<div class="info-box-content">';
$widget .= '<div class="info-box-title" title="' . $langs->trans('Close') . '">';
$widget .= '<span class="close-dashboard-widget" data-widgetname="' . $key . '"><i class="fas fa-times"></i></span>';
$widget .= '</div>';
$widget .= '<div class="info-box-lines">';
$widget .= '<div class="info-box-line" style="font-size : 20px;">';
for ($i = 0; $i < count($dashboardWidget['label']); $i++) {
if (!empty($dashboardWidget['label'][$i])) {
$widget .= '<span class=""><strong>' . $dashboardWidget['label'][$i] . ' : ' . '</strong>';
if (isset($dashboardWidget['content'][$i]) && $dashboardWidget['content'][$i] !== '') {
$widget .= '<span class="classfortooltip badge badge-info">' . $dashboardWidget['content'][$i] . '</span>';
$widget .= (!empty($dashboardWidget['tooltip'][$i]) ? $form->textwithpicto('', $langs->transnoentities($dashboardWidget['tooltip'][$i])) : '') . '</span>';
if (isset($dashboardWidget['moreContent'][$i]) && $dashboardWidget['moreContent'][$i] !== '') {
$widget .= $dashboardWidget['moreContent'][$i];
}
} else {
$widget .= $dashboardWidget['customContent'][$i];

$widget .= '<div class="wpeo-infobox">';

$widget .= '<div class="wpeo-infobox__header">';
$widget .= '<div class="header__icon-container">';
$widget .= '<span class="header__icon-background" style="background: ' . ($dashboardWidget['pictoColor'] ?? '#0D8AFF') . ';"></span>';
$widget .= '<i class="header__icon ' . $dashboardWidget['picto'] . '" style="color: ' . ($dashboardWidget['pictoColor'] ?? '#0D8AFF') . ';"></i>';
$widget .= '</div>';
$widget .= '<div class="header__title">' . ($dashboardWidget['title'] ?? $langs->transnoentities('Title')) . '</div>';
$widget .= '<i class="close-dashboard-widget header__close fas fa-times" data-widgetname="' . $key . '"></i>';
$widget .= '</div>';

$widget .= '<div class="wpeo-infobox__body">';
$widget .= '<ul class="body__row-container">';
for ($i = 0; $i < count($dashboardWidget['label']); $i++) {
if (!empty($dashboardWidget['label'][$i])) {
$widget .= '<li class="body__row">';
$widget .= '<span class="row__libelle">';
$widget .= $dashboardWidget['label'][$i];
$widget .= (!empty($dashboardWidget['tooltip'][$i]) ? $form->textwithpicto('', $langs->transnoentities($dashboardWidget['tooltip'][$i])) : '');
$widget .= '</span>';
$widget .= '<span class="row__data-container">';
$widget .= '<span class="row__data">'; // @TODO Boucle ici pour avoir plusieurs badges
if (isset($dashboardWidget['content'][$i]) && $dashboardWidget['content'][$i] !== '') {
$widget .= '<span class="row__data-libelle">' . $dashboardWidget['content'][$i] . '</span>';

if (isset($dashboardWidget['moreContent'][$i]) && $dashboardWidget['moreContent'][$i] !== '') {
$widget .= $dashboardWidget['moreContent'][$i];
}
} else {
$widget .= $dashboardWidget['customContent'][$i];
}
$widget .= '</span>';
$widget .= '</span>';
$widget .= '</li>';
}
$widget .= '<br>';
}
}
if (is_array($dashboardWidget['moreParams']) && (!empty($dashboardWidget['moreParams']))) {
foreach ($dashboardWidget['moreParams'] as $dashboardWidgetMoreParamsKey => $dashboardWidgetMoreParams) {
switch ($dashboardWidgetMoreParamsKey) {
case 'links' :
if (is_array($dashboardWidget['moreParams']['links']) && (!empty($dashboardWidget['moreParams']['links']))) {
foreach ($dashboardWidget['moreParams']['links'] as $dashboardWidgetMoreParamsLink) {
$widget .= '<a class="' . $dashboardWidgetMoreParamsLink['moreCSS'] . '" href="' . dol_buildpath($dashboardWidgetMoreParamsLink['url'], 1) . '" target="_blank">' . img_picto($langs->trans('Url'), 'globe', 'class="paddingrightonly"') . $langs->transnoentities($dashboardWidgetMoreParamsLink['linkName']) . '</a><br>';
$widget .= '</ul>';
if (is_array($dashboardWidget['moreParams']) && (!empty($dashboardWidget['moreParams']))) {
$widget .= '<div class="body__content">';
foreach ($dashboardWidget['moreParams'] as $dashboardWidgetMoreParamsKey => $dashboardWidgetMoreParams) {
switch ($dashboardWidgetMoreParamsKey) {
case 'links' :
if (is_array($dashboardWidget['moreParams']['links']) && (!empty($dashboardWidget['moreParams']['links']))) {
foreach ($dashboardWidget['moreParams']['links'] as $dashboardWidgetMoreParamsLink) {
$widget .= '<a class="' . $dashboardWidgetMoreParamsLink['moreCSS'] . '" href="' . dol_buildpath($dashboardWidgetMoreParamsLink['url'], 1) . '" target="_blank">' . img_picto($langs->trans('Url'), 'globe', 'class="paddingrightonly"') . $langs->transnoentities($dashboardWidgetMoreParamsLink['linkName']) . '</a><br>';
}
}
}
break;
default :
$widget .= $dashboardWidgetMoreParams;
break;
break;
default :
$widget .= $dashboardWidgetMoreParams;
break;
}
}
$widget .= '</div>';
}
}
$widget .= '</div>';
$widget .= '</div><!-- /.info-box-lines --></div><!-- /.info-box-content -->';
$widget .= '</div><!-- /.info-box -->';
$widget .= '</div><!-- /.box-flex-item-with-margin -->';

$widget .= '</div>';
}
}
}
print '<div class="opened-dash-board-wrap"><div class="box-flex-container">' . $widget . '</div></div>';
print '<div class="opened-dash-board-wrap"><div class="wpeo-infobox-container box-flex-container">' . $widget . '</div></div>';
}

print '<div class="graph-dashboard wpeo-grid grid-2">';
Expand Down Expand Up @@ -258,13 +270,10 @@ public function show_dashboard(?array $moreParams = [])
$graph->draw($fileName[$uniqueKey], $fileUrl[$uniqueKey]);
print '<div class="' . $dashboardGraph['moreCSS'] . '">';

$downloadCSV = '<form method="POST" action="' . $_SERVER['PHP_SELF'] . (GETPOSTISSET('id') ? '?id=' . GETPOST('id') : '') . '">';
$downloadCSV .= '<input type="hidden" name="token" value="' . newToken() . '">';
$downloadCSV .= '<input type="hidden" name="action" value="generate_csv">';
$downloadCSV .= '<input type="hidden" name="graph" value="' . http_build_query($dashboardGraph) . '">';
$downloadCSV .= '<button class="wpeo-button no-load button-grey">';
$downloadCSV .= img_picto('ExportCSV', 'fontawesome_file-csv_fas_#31AD29_15px');
$downloadCSV .= '</button></form>';
$downloadCSV = '<input type="hidden" name="graph" value="' . dol_escape_htmltag(json_encode($dashboardGraph, JSON_UNESCAPED_UNICODE)) . '">';
$downloadCSV .= '<button class="wpeo-button no-load button-grey" id="export-csv" data-graph-name="' . dol_sanitizeFileName(dol_strtolower($dashboardGraph['title'])) . '">';
$downloadCSV .= img_picto($langs->transnoentities('ExportGraphCSV'), 'fontawesome_file-csv_fas_#31AD29_15px');
$downloadCSV .= '</button>';
$dashboardGraph['morehtmlright'] .= $downloadCSV;

print load_fiche_titre($dashboardGraph['title'], $dashboardGraph['morehtmlright'], $dashboardGraph['picto']);
Expand All @@ -288,13 +297,13 @@ public function show_dashboard(?array $moreParams = [])
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
foreach ($dashboardList['labels'] as $key => $dashboardListLabel) {
print '<td class="nowraponall tdoverflowmax200 ' . (($key != 'Ref') ? 'center' : '') . '">' . $langs->transnoentities($dashboardListLabel) . '</td>';
print '<td class="' . ($conf->browser->layout == 'classic' ? 'nowraponall tdoverflowmax200 ' : '') . (($key != 'Ref') ? 'center' : '') . '">' . $langs->transnoentities($dashboardListLabel) . '</td>';
}
print '</tr>';
foreach ($dashboardList['data'] as $dashboardListDatasets) {
print '<tr class="oddeven">';
foreach ($dashboardListDatasets as $key => $dashboardGraphDataset) {
print '<td class="nowraponall tdoverflowmax200 ' . (($key != 'Ref') ? 'center ' : '') . $dashboardGraphDataset['morecss'] . '"' . $dashboardGraphDataset['moreAttr'] . '>' . $dashboardGraphDataset['value'] . '</td>';
print '<td class="' . ($conf->browser->layout == 'classic' ? 'nowraponall tdoverflowmax200 ' : '') . (($key != 'Ref') ? 'center ' : '') . $dashboardGraphDataset['morecss'] . '"' . $dashboardGraphDataset['moreAttr'] . '>' . $dashboardGraphDataset['value'] . '</td>';
}
print '</tr>';
}
Expand Down
Loading