From ce402abda2cc711aa1d5f192862b32e45ba8d7bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Apr 2018 23:33:38 +0200 Subject: [PATCH] Debut ticket module --- htdocs/public/ticketsup/create_ticket.php | 27 +++++---- htdocs/public/ticketsup/index.php | 2 +- htdocs/public/ticketsup/list.php | 2 +- htdocs/public/ticketsup/view.php | 2 +- htdocs/ticketsup/css/bg.css.php | 57 ------------------- .../css/{styles.css => styles.css.php} | 40 +++++++++++++ 6 files changed, 58 insertions(+), 72 deletions(-) delete mode 100755 htdocs/ticketsup/css/bg.css.php rename htdocs/ticketsup/css/{styles.css => styles.css.php} (65%) diff --git a/htdocs/public/ticketsup/create_ticket.php b/htdocs/public/ticketsup/create_ticket.php index d7b3cf1d833..8c8a0dd2f60 100644 --- a/htdocs/public/ticketsup/create_ticket.php +++ b/htdocs/public/ticketsup/create_ticket.php @@ -70,8 +70,10 @@ $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); /* - * Add file in email form + * Actions */ + +// Add file in email form if (GETPOST('addfile') && !GETPOST('add_ticket')) { ////$res = $object->fetch('',GETPOST('track_id')); ////if($res > 0) @@ -89,9 +91,7 @@ if (GETPOST('addfile') && !GETPOST('add_ticket')) { ////} } -/* - * Remove file in email form - */ +// Remove file if (GETPOST('removedfile') && !GETPOST('add_ticket')) { ////$res = $object->fetch('',GETPOST('track_id')); ////if($res > 0) @@ -255,17 +255,20 @@ if ($action == 'create_ticket' && GETPOST('add_ticket')) { { foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $qualified = true; - if ($qualified && isset($this->attributes[$object->table_element]['list'][$key])) + $enabled = 1; + if ($qualified && isset($extrafields->attributes[$object->table_element]['list'][$key])) { - $qualified = dol_eval($this->attributes[$object->table_element]['list'][$key], 1); - if (empty($result) || $result == 2) $qualified = false; + $enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1); } - if ($qualified && isset($this->attributes[$object->table_element]['perms'][$key])) + $perms = 1; + if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key])) { - $qualified = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1); + $perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1); } + $qualified=true; + if (empty($enabled) || $enabled == 2) $qualified = false; + if (empty($perms)) $qualified = false; if ($qualified) $message_admin .= '
  • ' . $langs->trans($key) . ' : ' . $value . '
  • '; } } @@ -324,7 +327,7 @@ if ($action == 'create_ticket' && GETPOST('add_ticket')) { */ $arrayofjs = array(); -$arrayofcss = array('/opensurvey/css/style.css', '/ticketsup/css/styles.css', '/ticketsup/css/bg.css.php'); +$arrayofcss = array('/opensurvey/css/style.css', '/ticketsup/css/styles.css.php'); llxHeaderTicket($langs->trans("CreateTicket"), "", 0, 0, $arrayofjs, $arrayofcss); @@ -361,7 +364,7 @@ if ($action != "infos_success") { print '
    ' . $langs->trans('TicketPublicInfoCreateTicket') . '
    '; $formticket->showForm(); } else { - print '
    ' . $langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '' . $object->track_id . ''); + print '
    ' . $langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '' . $object->track_id . ''); print '
    '; print $langs->trans('PleaseRememberThisId'); } diff --git a/htdocs/public/ticketsup/index.php b/htdocs/public/ticketsup/index.php index 66c916f2708..576eee32bc4 100644 --- a/htdocs/public/ticketsup/index.php +++ b/htdocs/public/ticketsup/index.php @@ -66,7 +66,7 @@ $form = new Form($db); $formticket = new FormTicketsup($db); $arrayofjs = array(); -$arrayofcss = array('/ticketsup/css/styles.css', '/ticketsup/css/bg.css.php'); +$arrayofcss = array('/ticketsup/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); if (!$conf->global->TICKETS_ENABLE_PUBLIC_INTERFACE) { diff --git a/htdocs/public/ticketsup/list.php b/htdocs/public/ticketsup/list.php index 4a8462f31e2..4d98b69a669 100644 --- a/htdocs/public/ticketsup/list.php +++ b/htdocs/public/ticketsup/list.php @@ -134,7 +134,7 @@ $user_create = new User($db); $formticket = new FormTicketsup($db); $arrayofjs = array(); -$arrayofcss = array('/ticketsup/css/styles.css', '/ticketsup/css/bg.css.php'); +$arrayofcss = array('/ticketsup/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); if (!$conf->global->TICKETS_ENABLE_PUBLIC_INTERFACE) { diff --git a/htdocs/public/ticketsup/view.php b/htdocs/public/ticketsup/view.php index eef7a8c65be..3302c749e33 100644 --- a/htdocs/public/ticketsup/view.php +++ b/htdocs/public/ticketsup/view.php @@ -125,7 +125,7 @@ $form = new Form($db); $formticket = new FormTicketsup($db); $arrayofjs = array(); -$arrayofcss = array('/ticketsup/css/styles.css', '/ticketsup/css/bg.css.php'); +$arrayofcss = array('/ticketsup/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); if (!$conf->global->TICKETS_ENABLE_PUBLIC_INTERFACE) { diff --git a/htdocs/ticketsup/css/bg.css.php b/htdocs/ticketsup/css/bg.css.php deleted file mode 100755 index d54233860f7..00000000000 --- a/htdocs/ticketsup/css/bg.css.php +++ /dev/null @@ -1,57 +0,0 @@ -conf loaded (not done into main because of NOLOGIN constant defined) -if (empty($user->id) && ! empty($_SESSION['dol_login'])) { - $user->fetch('', $_SESSION['dol_login']); -} - - -// Define css type -header('Content-type: text/css'); -// Important: Following code is to avoid page request by browser and PHP CPU at -// each Dolibarr page access. -if (empty($dolibarr_nocache)) { - header('Cache-Control: max-age=3600, public, must-revalidate'); -} else { - header('Cache-Control: no-cache'); -} - -// On the fly GZIP compression for all pages (if browser support it). Must set the bit 3 of constant to 1. -if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x04)) { - ob_start("ob_gzhandler"); -} - - -print 'html {'; -if (! empty($conf->global->TICKETS_SHOW_MODULE_LOGO)) { - print 'background: url("../public/img/bg_ticket.png") no-repeat 95% 90%;'; -} -print '}'; diff --git a/htdocs/ticketsup/css/styles.css b/htdocs/ticketsup/css/styles.css.php similarity index 65% rename from htdocs/ticketsup/css/styles.css rename to htdocs/ticketsup/css/styles.css.php index 44ce0e7e6ac..955e6a1979d 100644 --- a/htdocs/ticketsup/css/styles.css +++ b/htdocs/ticketsup/css/styles.css.php @@ -1,3 +1,43 @@ + + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FI8TNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/ticketsup/css/styles.css.php + * \brief File for CSS style sheet for ticket module + */ + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url. +if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); +if (! defined('NOLOGIN')) define('NOLOGIN',1); // File must be accessed by logon page so without login +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); + +session_cache_limiter(FALSE); + +require_once '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + +?> + html { min-height: 100%; height: 100%; }