From 50d2fa7543c5fa7099aff0e2bcdb82d4b5c3e4dd Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Thu, 24 Apr 2025 14:37:01 +0200 Subject: [PATCH] Look and feel v22 --- htdocs/opensurvey/list.php | 74 ++++++++++++++-------- htdocs/opensurvey/wizard/create_survey.php | 2 +- htdocs/theme/eldy/global.inc.php | 8 +-- htdocs/theme/md/style.css.php | 2 +- 4 files changed, 52 insertions(+), 34 deletions(-) diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index eedfef73762..2042f4f14ea 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -1,8 +1,8 @@ - * Copyright (C) 2014 Marcos García - * Copyright (C) 2024 Frédéric France - * Copyright (C) 2025 MDW +/* Copyright (C) 2013-2017 Laurent Destailleur + * Copyright (C) 2014 Marcos García + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -93,6 +93,8 @@ if (!$user->hasRight('opensurvey', 'read')) { accessforbidden(); } +$fieldstosearchall = array(); + // Definition of fields for list $arrayfields = array(); // Extra fields @@ -120,7 +122,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array(); +$parameters = array('arrayfields' => &$arrayfields); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -163,7 +165,8 @@ $now = dol_now(); $help_url = ''; $title = $langs->trans('OpenSurveyArea'); - +// Build and execute select +// -------------------------------------------------------------------- $sql = "SELECT p.id_sondage as rowid, p.fk_user_creat, p.format, p.date_fin, p.status, p.titre as title, p.nom_admin, p.tms,"; $sql .= " u.login, u.firstname, u.lastname"; $sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as p"; @@ -219,10 +222,10 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { } // Direct jump if only one record found -if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) { +if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; - header("Location: ".dol_buildpath('/opensurvey/card.php', 1).'?id='.$id); + header("Location: ".dol_buildpath('/opensurvey/card.php', 1).'?id='.((int) $id)); exit; } @@ -241,11 +244,11 @@ if (/* !empty($contextpage) && */ $contextpage != $_SERVER["PHP_SELF"]) { // $co if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } -$fieldtosortuser = !getDolGlobalString('MAIN_FIRSTNAME_NAME_POSITION') ? 'firstname' : 'lastname'; - if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } +$fieldtosortuser = getDolGlobalString('MAIN_FIRSTNAME_NAME_POSITION') ? 'lastname' : 'firstname'; + // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -254,7 +257,7 @@ $arrayofmassactions = array( //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), ); -if ($permissiontodelete) { +if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) { @@ -262,10 +265,7 @@ if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predel } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); - -// List of surveys into database - -print '
'; +print ''."\n"; if ($optioncss != '') { print ''; } @@ -274,7 +274,10 @@ print ''; print ''; print ''; +print ''; print ''; +print ''; +print ''; $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('NewSurvey'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/opensurvey/wizard/index.php', '', $user->hasRight('opensurvey', 'write')); @@ -290,11 +293,13 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { - $fieldstosearchall = array(); + $setupstring = ''; // @phan-suppress-next-line PhanEmptyForeach foreach ($fieldstosearchall as $key => $val) { // @phpstan-ignore-line $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; } + print ''."\n"; print '
'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'
'; } @@ -310,6 +315,9 @@ if (empty($reshook)) { } else { $moreforfilter = $hookmanager->resPrint; } +$parameters = array( + 'arrayfields' => &$arrayfields, +); if (!empty($moreforfilter)) { print '
'; @@ -318,19 +326,19 @@ if (!empty($moreforfilter)) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -//$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields -$selectedfields = ''; +$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup +$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; -print ''."\n"; +print '
'."\n"; // Fields title search // -------------------------------------------------------------------- print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; @@ -343,39 +351,50 @@ print ''; print ''; print ''; $arraystatus = array('-1' => ' ', '0' => $langs->trans("Draft"), '1' => $langs->trans("Opened"), '2' => $langs->trans("Closed")); -print ''; +print ''; // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields' => $arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; } print ''."\n"; +$totalarray = array(); +$totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.id_sondage", $param, "", "", $sortfield, $sortorder); +$totalarray['nbfield']++; print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "p.titre", $param, "", "", $sortfield, $sortorder); +$totalarray['nbfield']++; print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "p.format", $param, "", "", $sortfield, $sortorder); +$totalarray['nbfield']++; print_liste_field_titre("Author", $_SERVER["PHP_SELF"], "u.".$fieldtosortuser, $param, "", "", $sortfield, $sortorder); +$totalarray['nbfield']++; print_liste_field_titre("NbOfVoters", $_SERVER["PHP_SELF"], "", $param, "", 'align="right"', $sortfield, $sortorder); +$totalarray['nbfield']++; print_liste_field_titre("ExpireDate", $_SERVER["PHP_SELF"], "p.date_fin", $param, "", 'align="center"', $sortfield, $sortorder); +$totalarray['nbfield']++; print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "p.tms", $param, "", 'align="center"', $sortfield, $sortorder); +$totalarray['nbfield']++; print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "p.status", $param, "", 'align="center"', $sortfield, $sortorder); +$totalarray['nbfield']++; // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -385,6 +404,7 @@ print $hookmanager->resPrint; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } print ''."\n"; @@ -393,9 +413,11 @@ print ''."\n"; // Loop on record // -------------------------------------------------------------------- $i = 0; +$savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < min($num, $limit)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -418,7 +440,7 @@ while ($i < min($num, $limit)) { $opensurvey_static->date_fin = $db->jdate($obj->date_fin); // Show here line of result - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print '
'; + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print ''.$form->selectarray('search_status', $arraystatus, $search_status, 0, 0, 0, '', 0, 0, 0, '', 'onroghtofpage').''.$form->selectarray('search_status', $arraystatus, $search_status, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth100 onrightofpage').''; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'; diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index d0904ab85ce..6dd57cbdda9 100644 --- a/htdocs/opensurvey/wizard/create_survey.php +++ b/htdocs/opensurvey/wizard/create_survey.php @@ -139,7 +139,7 @@ $arrayofjs = array(); $arrayofcss = array('/opensurvey/css/style.css'); llxHeader('', $langs->trans("OpenSurvey"), '', "", 0, 0, $arrayofjs, $arrayofcss); -print load_fiche_titre($langs->trans("CreatePoll").' (1 / 2)'); +print load_fiche_titre($langs->trans("CreatePoll").' (1 / 2)', '', 'poll'); print ''."\n"; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 902e1e51a44..4065457561c 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -411,7 +411,7 @@ input[type=submit], input[type=submit]:hover { } input[type=checkbox], input[type=radio] { margin: 0 5px 0 1px; - transform: scale(1.2); + transform: scale(1.3); } .kanban input.checkforselect { margin-right: 0px; @@ -837,15 +837,11 @@ table.tableforfield .buttonDelete:not(.bordertransp):not(.buttonpayment) { cursor: pointer; text-decoration: none !important; background-color: #f5f5f5; - background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); - background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); - background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); background-repeat: repeat-x; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); border: 1px solid #aaa; - border-radius: 1px; + border-radius: 4px; font-weight: bold; text-transform: uppercase; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 2643d3ab5f9..68c095efb11 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -967,7 +967,7 @@ input:-webkit-autofill { input[type=checkbox], input[type=radio] { margin: 0 5px 0 1px; - transform: scale(1.2); + transform: scale(1.3); } .kanban input.checkforselect { margin-right: 0px;