Merge pull request #32076 from frederic34/phpstan_doc_ui

fix phpstan doc ui
This commit is contained in:
Laurent Destailleur 2024-12-24 02:50:21 +01:00 committed by Laurent Destailleur (aka Eldy)
commit 490ff8973c
14 changed files with 338 additions and 203 deletions

View File

@ -1776,6 +1776,48 @@ parameters:
count: 2
path: ../../htdocs/admin/tools/purge.php
-
message: '#^Method Documentation\:\:displayMenu\(\) has parameter \$menu with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: ../../htdocs/admin/tools/ui/class/documentation.class.php
-
message: '#^Method Documentation\:\:displaySummary\(\) has parameter \$menu with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: ../../htdocs/admin/tools/ui/class/documentation.class.php
-
message: '#^Method Documentation\:\:setMenu\(\) should return mixed but return statement is missing\.$#'
identifier: return.missing
count: 1
path: ../../htdocs/admin/tools/ui/class/documentation.class.php
-
message: '#^Method Documentation\:\:showCode\(\) has parameter \$lines with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: ../../htdocs/admin/tools/ui/class/documentation.class.php
-
message: '#^Property Documentation\:\:\$menu type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: ../../htdocs/admin/tools/ui/class/documentation.class.php
-
message: '#^Property Documentation\:\:\$summary type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: ../../htdocs/admin/tools/ui/class/documentation.class.php
-
message: '#^Property Documentation\:\:\$view type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: ../../htdocs/admin/tools/ui/class/documentation.class.php
-
message: '#^Variable \$massactionbutton in empty\(\) always exists and is always falsy\.$#'
identifier: empty.variable

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2024 Anthony Damhet <a.damhet@progiseize.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -57,6 +58,7 @@ class Documentation
* Constructor
*
* @param DoliDB $db Database handler
* @return void
*/
public function __construct(DoliDB $db)
{
@ -75,7 +77,6 @@ class Documentation
*/
private function setMenu()
{
global $hookmanager;
@ -223,7 +224,8 @@ class Documentation
}
/**
* Output sidebar
* Output sidebar
*
* @return void
*/
public function showSidebar()
@ -312,7 +314,8 @@ class Documentation
}
/**
* Output summary
* Output summary
*
* @param int $showsubmenu Show Sub menus: 0 = No, 1 = Yes
* @param int $showsubmenu_summary Show summary of sub menus: 0 = No, 1 = Yes
* @return void
@ -320,6 +323,7 @@ class Documentation
public function showSummary($showsubmenu = 1, $showsubmenu_summary = 1)
{
$i = 0;
$menu_entry = [];
if (!empty($this->view)) :
// On se place au bon niveau
foreach ($this->view as $view) {
@ -384,16 +388,16 @@ class Documentation
* Output a View Code area
*
* @param array $lines Lines of code to show
* @param string $option Source code language ('html', 'php' etc)
* @return void
*/
public function showCode($lines = array())
public function showCode($lines = array(), $option = 'html')
{
print '<div class="documentation-code"><pre>';
if (!empty($lines)) {
foreach ($lines as $lineofcode) {
print dol_htmlentities($lineofcode).'<br/>';
}
}
print '</pre></div>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
print '<div class="documentation-code">';
$content = implode("\n", $lines) . "\n";
$doleditor = new DolEditor(md5($content), $content, '', 0, 'Basic', 'In', true, false, 'ace', 0, '99%', 1);
print $doleditor->Create(1, '', false, '', $option);
print '</div>';
}
}

View File

@ -1,36 +1,39 @@
<?php
/*
* Copyright (C) 2024 Anthony Damhet <a.damhet@progiseize.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program and files/directory inner it is free software: you can
* redistribute it and/or modify it under the terms of the
* GNU Affero General Public License (AGPL) as published by
* the Free Software Foundation, either version 3 of the License, or
* 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 FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AGPL for more details.
* GNU General Public License for more details.
*
* You should have received a copy of the GNU AGPL
* along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
$res=0;
if (! $res && file_exists("../../main.inc.php")) : $res=@include '../../main.inc.php';
endif;
if (! $res && file_exists("../../../main.inc.php")) : $res=@include '../../../main.inc.php';
endif;
if (! $res && file_exists("../../../../main.inc.php")) : $res=@include '../../../../main.inc.php';
endif;
// Load Dolibarr environment
require '../../../../main.inc.php';
/**
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Protection if external user
if ($user->socid > 0) : accessforbidden();
endif;
if ($user->socid > 0) {
accessforbidden();
}
// Includes
dol_include_once('admin/tools/ui/class/documentation.class.php');
require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
// Load documentation translations
$langs->load('uxdocumentation');
@ -38,8 +41,13 @@ $langs->load('uxdocumentation');
//
$documentation = new Documentation($db);
$morejs = [
'/includes/ace/src/ace.js',
'/includes/ace/src/ext-statusbar.js',
'/includes/ace/src/ext-language_tools.js',
];
// Output html head + body - Param is Title
$documentation->docHeader('Badges');
$documentation->docHeader('Badges', $morejs);
// Set view for menu and breadcrumb
// Menu must be set in constructor of documentation class
@ -49,7 +57,7 @@ $documentation->view = array('Components','Badges');
$documentation->showSidebar(); ?>
<div class="doc-wrapper">
<?php $documentation->showBreadCrumb(); ?>
<div class="doc-content-wrapper">
@ -310,4 +318,4 @@ $documentation->showSidebar(); ?>
<?php
// Output close body + html
$documentation->docFooter();
?>
?>

View File

@ -1,45 +1,52 @@
<?php
/*
* Copyright (C) 2024 Anthony Damhet <a.damhet@progiseize.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program and files/directory inner it is free software: you can
* redistribute it and/or modify it under the terms of the
* GNU Affero General Public License (AGPL) as published by
* the Free Software Foundation, either version 3 of the License, or
* 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 FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AGPL for more details.
* GNU General Public License for more details.
*
* You should have received a copy of the GNU AGPL
* along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
$res=0;
if (! $res && file_exists("../../main.inc.php")) : $res=@include '../../main.inc.php';
endif;
if (! $res && file_exists("../../../main.inc.php")) : $res=@include '../../../main.inc.php';
endif;
if (! $res && file_exists("../../../../main.inc.php")) : $res=@include '../../../../main.inc.php';
endif;
// Load Dolibarr environment
require '../../../../main.inc.php';
/**
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Protection if external user
if ($user->socid > 0) : accessforbidden();
endif;
if ($user->socid > 0) {
accessforbidden();
}
// Includes
dol_include_once('admin/tools/ui/class/documentation.class.php');
require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
// Load documentation translations
$langs->load('uxdocumentation');
//
$documentation = new Documentation($db);
$morejs = [
'/includes/ace/src/ace.js',
'/includes/ace/src/ext-statusbar.js',
'/includes/ace/src/ext-language_tools.js',
];
// Output html head + body - Param is Title
$documentation->docHeader('Buttons');
$documentation->docHeader('Buttons', $morejs);
// Set view for menu and breadcrumb
// Menu must be set in constructor of documentation class
@ -128,7 +135,7 @@ $documentation->showSidebar(); ?>
' */',
'print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);',
);
echo $documentation->showCode($lines); ?>
echo $documentation->showCode($lines, 'php'); ?>
</div>
<!-- Example of modal usage -->
@ -144,7 +151,7 @@ $documentation->showSidebar(); ?>
$id = 'button-id-7';
$url = '#'.$id;
$params = array(
'confirm' => true
'confirm' => [],
);
print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);
@ -170,7 +177,7 @@ $documentation->showSidebar(); ?>
$id = 'button-id-9';
$url = '#'.$id;
$params = array(
'confirm' => true
'confirm' => [],
);
print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params); ?>
</div>
@ -179,7 +186,7 @@ $documentation->showSidebar(); ?>
'<?php',
'// Default parameters',
'$params = array(',
' \'confirm\' => true',
' \'confirm\' => [],',
');',
'',
'// Custom parameters',
@ -189,13 +196,13 @@ $documentation->showSidebar(); ?>
' \'title\' => \'Your title to display\',',
' \'action-btn-label\' => \'Your confirm label\',',
' \'cancel-btn-label\' => \'Your cancel label\',',
' \'content\' => \'Content to display with <strong>HTML</strong> compatible <ul><li>test 01</li><li>test 02</li><li>test 03</li></ul>\'',
' \'content\' => \'Content to display with <strong>HTML</strong> compatible <ul><li>test 01</li><li>test 02</li><li>test 03</li></ul>\',',
' )',
');',
'',
'print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);',
);
echo $documentation->showCode($lines); ?>
echo $documentation->showCode($lines, 'php'); ?>
</div>
<!-- Example of subbutton usage -->
@ -214,13 +221,15 @@ $documentation->showSidebar(); ?>
'lang'=>'documentation@documentation',
'url'=> $submenu_url.'#'.$id,
'label' => 'My SubAction 1',
'perm' => 1
'perm' => true,
'enabled' => true,
),
array(
'lang'=>'documentation@documentation',
'url'=> $submenu_url.'#'.$id,
'label' => 'My SubAction 2',
'perm' => 0
'perm' => false,
'enabled' => true,
),
);
$params = array();
@ -250,7 +259,7 @@ $documentation->showSidebar(); ?>
');',
'print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);'
);
echo $documentation->showCode($lines); ?>
echo $documentation->showCode($lines, 'php'); ?>
</div>
@ -277,7 +286,7 @@ $documentation->showSidebar(); ?>
'print \' <button class="btn-low-emphasis --btn-icon" title="\'.dol_escape_htmltag($btnLabel).\'" aria-label="\'.dol_escape_htmltag($btnLabel).\'" >\'.img_picto($btnLabel, \'eraser\', \'aria-hidden="true"\', 0, 0, 1).\'</button>\';',
);
echo $documentation->showCode($lines); ?>
echo $documentation->showCode($lines, 'php'); ?>
</div>
<!-- Example of subbutton usage -->
@ -313,18 +322,16 @@ $documentation->showSidebar(); ?>
'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-file\', \'#\', \'\', $status);',
);
echo $documentation->showCode($lines); ?><div class="documentation-example">
echo $documentation->showCode($lines, 'php'); ?><div class="documentation-example">
<?php
$btnLabel = $langs->trans('Label');
$btnLabel = $langs->trans('Label', 'php');
print dolGetButtonTitle($btnLabel, '', 'fa fa-download', '#', '', 0, ['forcenohideoftext'=>1]); // Not Enough Permissions
print dolGetButtonTitle($btnLabel, '', 'fa fa-download', '#', '', 1, ['forcenohideoftext'=>1]); // Active
print dolGetButtonTitle($btnLabel, '', 'fa fa-download', '#', '', 2, ['forcenohideoftext'=>1]); // Active and selected
print dolGetButtonTitle($btnLabel, '', 'fa fa-download', '#', '', -1, ['forcenohideoftext'=>1]); // Functionality is disabled
print dolGetButtonTitle($btnLabel, '', 'fa fa-download', '#', '', -2, ['forcenohideoftext'=>1]); // Disabled without info
?>
</div>
@ -343,15 +350,9 @@ $documentation->showSidebar(); ?>
'$status = -2; // Disabled without info',
'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-download\', \'#\', \'\', $status, [\'forcenohideoftext\'=>1]);',
);
echo $documentation->showCode($lines); ?>
echo $documentation->showCode($lines, 'php'); ?>
</div>
</div>
</div>

View File

@ -1,37 +1,39 @@
<?php
/*
* Copyright (C) 2024 Anthony Damhet <a.damhet@progiseize.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program and files/directory inner it is free software: you can
* redistribute it and/or modify it under the terms of the
* GNU Affero General Public License (AGPL) as published by
* the Free Software Foundation, either version 3 of the License, or
* 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 FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AGPL for more details.
* GNU General Public License for more details.
*
* You should have received a copy of the GNU AGPL
* along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
$res=0;
if (! $res && file_exists("../../main.inc.php")) : $res=@include '../../main.inc.php';
endif;
if (! $res && file_exists("../../../main.inc.php")) : $res=@include '../../../main.inc.php';
endif;
if (! $res && file_exists("../../../../main.inc.php")) : $res=@include '../../../../main.inc.php';
endif;
// Load Dolibarr environment
require '../../../../main.inc.php';
/**
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Protection if external user
if ($user->socid > 0) : accessforbidden();
endif;
if ($user->socid > 0) {
accessforbidden();
}
// Includes
dol_include_once('admin/tools/ui/class/documentation.class.php');
require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
// Load documentation translations
$langs->load('uxdocumentation');
@ -55,9 +57,13 @@ if ($action == 'displayeventmessage') {
//
$documentation = new Documentation($db);
$morejs = [
'/includes/ace/src/ace.js',
'/includes/ace/src/ext-statusbar.js',
'/includes/ace/src/ext-language_tools.js',
];
// Output html head + body - Param is Title
$documentation->docHeader('SetEventMessages');
$documentation->docHeader('SetEventMessages', $morejs);
// Set view for menu and breadcrumb
// Menu must be set in constructor of documentation class
@ -121,7 +127,7 @@ $documentation->showSidebar(); ?>
'setEventMessages("message", null);',
'setEventMessages(null, messages[]);',
);
echo $documentation->showCode($lines); ?>
echo $documentation->showCode($lines, 'php'); ?>
</div>
<!-- Contextual variations -->
@ -156,11 +162,12 @@ $documentation->showSidebar(); ?>
</div>
<?php
$lines = array(
'<?php',
'setEventMessages("message", null)',
'setEventMessages("message", null, "warnings")',
'setEventMessages("message", null, "errors")'
);
echo $documentation->showCode($lines); ?>
echo $documentation->showCode($lines, 'php'); ?>
</div>
<!-- -->
</div>

View File

@ -1,36 +1,39 @@
<?php
/*
* Copyright (C) 2024 Anthony Damhet <a.damhet@progiseize.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program and files/directory inner it is free software: you can
* redistribute it and/or modify it under the terms of the
* GNU Affero General Public License (AGPL) as published by
* the Free Software Foundation, either version 3 of the License, or
* 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 FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AGPL for more details.
* GNU General Public License for more details.
*
* You should have received a copy of the GNU AGPL
* along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
$res=0;
if (! $res && file_exists("../../main.inc.php")) : $res=@include '../../main.inc.php';
endif;
if (! $res && file_exists("../../../main.inc.php")) : $res=@include '../../../main.inc.php';
endif;
if (! $res && file_exists("../../../../main.inc.php")) : $res=@include '../../../../main.inc.php';
endif;
// Load Dolibarr environment
require '../../../../main.inc.php';
/**
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Protection if external user
if ($user->socid > 0) : accessforbidden();
endif;
if ($user->socid > 0) {
accessforbidden();
}
// Includes
dol_include_once('admin/tools/ui/class/documentation.class.php');
require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
// Load documentation translations
$langs->load('uxdocumentation');
@ -48,7 +51,7 @@ $documentation->view = array('Components');
$documentation->showSidebar(); ?>
<div class="doc-wrapper">
<?php $documentation->showBreadCrumb(); ?>
<div class="doc-content-wrapper">
@ -56,11 +59,11 @@ $documentation->showSidebar(); ?>
<h1 class="documentation-title"><?php echo $langs->trans('DocComponentsTitle'); ?></h1>
<p class="documentation-text"><?php echo $langs->trans('DocComponentsMainDescription'); ?></p>
<?php $documentation->showSummary(); ?>
<?php $documentation->showSummary(); ?>
</div>
</div>
<?php
// Output close body + html
$documentation->docFooter();
?>
?>

View File

@ -1,36 +1,39 @@
<?php
/*
* Copyright (C) 2024 Anthony Damhet <a.damhet@progiseize.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program and files/directory inner it is free software: you can
* redistribute it and/or modify it under the terms of the
* GNU Affero General Public License (AGPL) as published by
* the Free Software Foundation, either version 3 of the License, or
* 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 FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AGPL for more details.
* GNU General Public License for more details.
*
* You should have received a copy of the GNU AGPL
* along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
$res=0;
if (! $res && file_exists("../../main.inc.php")) : $res=@include '../../main.inc.php';
endif;
if (! $res && file_exists("../../../main.inc.php")) : $res=@include '../../../main.inc.php';
endif;
if (! $res && file_exists("../../../../main.inc.php")) : $res=@include '../../../../main.inc.php';
endif;
// Load Dolibarr environment
require '../../../../main.inc.php';
/**
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Protection if external user
if ($user->socid > 0) : accessforbidden();
endif;
if ($user->socid > 0) {
accessforbidden();
}
// Includes
dol_include_once('admin/tools/ui/class/documentation.class.php');
require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
// Load documentation translations
$langs->load('uxdocumentation');
@ -38,8 +41,13 @@ $langs->load('uxdocumentation');
//
$documentation = new Documentation($db);
$morejs = [
'/includes/ace/src/ace.js',
'/includes/ace/src/ext-statusbar.js',
'/includes/ace/src/ext-language_tools.js',
];
// Output html head + body - Param is Title
$documentation->docHeader('Progress-bars');
$documentation->docHeader('Progress-bars', $morejs);
// Set view for menu and breadcrumb
// Menu must be set in constructor of documentation class
@ -247,6 +255,7 @@ $documentation->showSidebar(); ?>
' <div class="progress-bar progress-bar-danger" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>',
'</div>',
'',
'',
);
echo $documentation->showCode($lines); ?>

View File

@ -1,17 +1,43 @@
<?php
/* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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 FITNESS 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 <https://www.gnu.org/licenses/>.
*/
// Load Dolibarr environment
@include '../../main.inc.php';
require '../../../../main.inc.php';
/**
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var int $dolibarr_main_prod
*/
// Security
if ($dolibarr_main_prod) {
accessforbidden('Access forbidden when $dolibarr_main_prod is set to 1');
}
// Protection if external user
if ($user->socid > 0) {
accessforbidden();
}
$optioncss = GETPOST('optioncsss', 'alpha');
/*
* View
@ -19,7 +45,9 @@ if ($dolibarr_main_prod) {
$form = new Form($db);
$usedolheader = 1; // 1 = Test inside a dolibarr page, 0 = Use hard coded header
// 1 = Test inside a dolibarr page, 0 = Use hard coded header
// Using a dolibarr constant avoid phpstan hardcoded value always true or false
$usedolheader = getDolGlobalInt('MAIN_TEST_UI_IN_DOLIBARR_PAGE', 1);
// HEADER
//--------
@ -163,15 +191,14 @@ $productspecimen = new Product($db);
$productspecimen->initAsSpecimen();
$object = $productspecimen;
$param = '';
$actioncode = '';
$status = '';
$filter = '';
$filtert = '';
$socid = 0;
$type = 0;
$usergroup = 0;
$sortfield = 'aaa';
$actioncode = getDolGlobalString('MAIN_TEST_UI_ACTION_CODE'); // '' by default
$status = getDolGlobalString('MAIN_TEST_UI_STATUS'); // '' by default;
$filter = getDolGlobalString('MAIN_TEST_UI_FILTER'); // '' by default;
$filtert = getDolGlobalString('MAIN_TEST_UI_FILTERT'); // '' by default;
$socid = getDolGlobalInt('MAIN_TEST_UI_SOCID', 0); // 0 by default;
$type = getDolGlobalInt('MAIN_TEST_UI_TYPE', 0); // 0 by default;
$usergroup = getDolGlobalInt('MAIN_TEST_UI_USERGROUP', 0); // 0 by default;
$sortfield = getDolGlobalString('MAIN_TEST_UI_SORTFIELD', 'aaa'); // 'aaa' by default;
$sortorder = 'ASC';
$tasksarray = array(1, 2, 3); // To force having several lines
$tagidfortablednd = 'tablelines3';
@ -242,18 +269,16 @@ $cate_arbo = array('field1' => 'value1d into the select list D', 'field2' => 'va
$moreforfilter .= $form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 1); // List with js combo forced
$moreforfilter .= '</div>';
if (!empty($moreforfilter)) {
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
?>
<table class="stripe row-border order-column centpercent tagtable liste<?php echo $moreforfilter ? " listwithfilterbefore" : ""; ?>" id="tablelines3">
<table class="stripe row-border order-column centpercent tagtable liste<?php echo /* $moreforfilter ? */ " listwithfilterbefore" /* : "" */; ?>" id="tablelines3">
<thead>
<tr class="liste_titre">
<?php print getTitleFieldOfList($langs->trans('title1'), 0, $_SERVER["PHP_SELF"], 'aaa', '', '', 'align="left"', $sortfield, $sortorder); ?>

View File

@ -1,4 +1,20 @@
<?php
/* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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 FITNESS 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 <https://www.gnu.org/licenses/>.
*/
if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
@ -25,9 +41,18 @@ if (!defined('NOREQUIREMENU')) {
}
session_cache_limiter('public');
require_once '../../main.inc.php';
require '../../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
/**
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var int $dolibarr_main_prod
*/
// Security
if ($dolibarr_main_prod) {
accessforbidden();
@ -129,7 +154,7 @@ llxHeader('', 'Documentation and examples for theme');
$url = '#'.$id;
$userRight = 1;
$params = array(
'confirm' => true
'confirm' => [],
);
print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);
@ -142,13 +167,13 @@ llxHeader('', 'Documentation and examples for theme');
$url = $_SERVER['PHP_SELF'] . '?token='.newToken().'#'.$id;
$params = array(
'confirm' => array(
'confirm' => array(
'url' => 'your confirm action url',
'title' => 'Your title to display',
'action-btn-label' => 'Your confirm label',
'cancel-btn-label' => 'Your cancel label',
'content' => 'Content to display with <strong>HTML</strong> compatible <ul><li>test 01</li><li>test 02</li><li>test 03</li></ul>'
)
'content' => 'Content to display with <strong>HTML</strong> compatible <ul><li>test 01</li><li>test 02</li><li>test 03</li></ul>',
)
);
print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);
@ -168,7 +193,7 @@ llxHeader('', 'Documentation and examples for theme');
$url = '#'.$id;
$userRight = 0;
$params = array(
'confirm' => true
'confirm' => [],
);
print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);
@ -181,13 +206,13 @@ llxHeader('', 'Documentation and examples for theme');
$url = $_SERVER['PHP_SELF'] . '?token='.newToken().'#'.$id;
$params = array(
'confirm' => array(
'confirm' => array(
'url' => 'your confirm action url',
'title' => 'Your title to display',
'action-btn-label' => 'Your confirm label',
'cancel-btn-label' => 'Your cancel label',
'content' => 'Content to display with <strong>HTML</strong> compatible <ul><li>test 01</li><li>test 02</li><li>test 03</li></ul>'
)
'content' => 'Content to display with <strong>HTML</strong> compatible <ul><li>test 01</li><li>test 02</li><li>test 03</li></ul>',
)
);
print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);

View File

@ -14,6 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
//define("NOLOGIN",1); // This means this output page does not require to be logged.
/*if (!defined('NOSESSION')) {
@ -21,9 +22,18 @@ define("NOCSRFCHECK", 1); // We accept to go on this page from external web site
}*/
// Load Dolibarr environment
require '../../main.inc.php';
require '../../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
/**
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var int $dolibarr_main_prod
*/
// Security
if ($dolibarr_main_prod) {
accessforbidden('Access forbidden when $dolibarr_main_prod is set to 1');

View File

@ -1,32 +1,31 @@
<?php
/*
* Copyright (C) 2024 Anthony Damhet <a.damhet@progiseize.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program and files/directory inner it is free software: you can
* redistribute it and/or modify it under the terms of the
* GNU Affero General Public License (AGPL) as published by
* the Free Software Foundation, either version 3 of the License, or
* 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 FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AGPL for more details.
* GNU General Public License for more details.
*
* You should have received a copy of the GNU AGPL
* along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
$res=0;
if (! $res && file_exists("../../main.inc.php")) {
$res=@include '../../main.inc.php';
}
if (! $res && file_exists("../../../main.inc.php")) {
$res=@include '../../../main.inc.php';
}
if (! $res && file_exists("../../../../main.inc.php")) {
$res=@include '../../../../main.inc.php';
}
// Load Dolibarr environment
require '../../../../main.inc.php';
/**
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Protection if external user
if ($user->socid > 0) {
@ -34,7 +33,7 @@ if ($user->socid > 0) {
}
// Includes
dol_include_once('admin/tools/ui/class/documentation.class.php');
require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
// Load documentation translations
$langs->load('uxdocumentation');

View File

@ -1,36 +1,38 @@
<?php
/*
* Copyright (C) 2024 Anthony Damhet <a.damhet@progiseize.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program and files/directory inner it is free software: you can
* redistribute it and/or modify it under the terms of the
* GNU Affero General Public License (AGPL) as published by
* the Free Software Foundation, either version 3 of the License, or
* 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 FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AGPL for more details.
* GNU General Public License for more details.
*
* You should have received a copy of the GNU AGPL
* along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
$res=0;
if (! $res && file_exists("../main.inc.php")) : $res=@include '../main.inc.php';
endif;
if (! $res && file_exists("../../main.inc.php")) : $res=@include '../../main.inc.php';
endif;
if (! $res && file_exists("../../../main.inc.php")) : $res=@include '../../../main.inc.php';
endif;
// Load Dolibarr environment
require '../../../main.inc.php';
/**
* @var DoliDB $db
* @var Translate $langs
* @var User $user
*/
// Protection if external user
if ($user->socid > 0) : accessforbidden();
endif;
if ($user->socid > 0) {
accessforbidden();
}
// Includes
dol_include_once('admin/tools/ui/class/documentation.class.php');
require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
// Load documentation translations
$langs->load('uxdocumentation');
@ -48,7 +50,7 @@ $documentation->view = array('DocumentationHome');
$documentation->showSidebar(); ?>
<div class="doc-wrapper">
<?php $documentation->showBreadCrumb(); ?>
<div class="doc-content-wrapper">
@ -61,4 +63,4 @@ $documentation->showSidebar(); ?>
<?php
// Output close body + html
$documentation->docFooter();
?>
?>

View File

@ -394,9 +394,10 @@ class DolEditor
$out .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
$out .= 'var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
aceEditor.session.setMode("ace/mode/'.$format.'");
aceEditor.session.setMode("ace/mode/'.$format.'");
aceEditor.setReadOnly('.($this->readonly ? 'true' : 'false').');
aceEditor.setOptions({
enableBasicAutocompletion: true, // the editor completes the statement when you hit Ctrl + Space. Need lib ext-language_tools.js
enableBasicAutocompletion: true, // the editor completes the statement when you hit Ctrl + Space. Need lib ext-language_tools.js
enableLiveAutocompletion: false, // the editor completes the statement while you are typing. Need lib ext-language_tools.js
//enableSnippets: true, // ???
showPrintMargin: false, // hides the vertical limiting strip
@ -450,7 +451,7 @@ class DolEditor
jQuery("#'.dol_escape_js($this->htmlname).'_x").val(cursorPos.column);
jQuery("#'.dol_escape_js($this->htmlname).'_y").val(cursorPos.row);
}
//console.log(aceEditor.getSession().getValue());
//console.log(aceEditor.getSession().getValue());
// Inject content of editor into the original HTML field.
jQuery("#'.dol_escape_js($this->htmlname).'").val(aceEditor.getSession().getValue());
/*if (jQuery("#'.dol_escape_js($this->htmlname).'").html().length > 0) return true;
@ -460,7 +461,7 @@ class DolEditor
console.log("Failed to retrieve js object ACE from its name");
return false;
}
});
});
})';
$out .= '</script>'."\n";
}

View File

@ -19,7 +19,6 @@ parameters:
- scripts
excludePaths:
analyseAndScan:
- htdocs/admin/tools/ui/*
- htdocs/custom/*
- htdocs/documents/*
- htdocs/install/doctemplates/*