Merge branch 'Dolibarr:develop' into patch-6
This commit is contained in:
commit
0efb68e927
14 changed files with 103 additions and 181 deletions
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
## Features
|
||||
|
||||
Provides an api key for chatchpt for use it in other modules
|
||||
Provides AI (Artificial Intelligence) features in different part of the application. Need external AI API.
|
||||
|
||||
## Licenses
|
||||
|
||||
### Main code
|
||||
|
||||
|
|
|
|||
|
|
@ -31,11 +31,6 @@ global $langs, $user;
|
|||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
require_once '../lib/ai.lib.php';
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
|
@ -46,10 +41,15 @@ $label = GETPOST('label', 'alpha');
|
|||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type = 'myobject';
|
||||
|
||||
|
||||
$error = 0;
|
||||
$setupnotempty = 0;
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
// Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only
|
||||
$useFormSetup = 1;
|
||||
|
||||
|
|
@ -59,20 +59,16 @@ if (!class_exists('FormSetup')) {
|
|||
|
||||
$formSetup = new FormSetup($db);
|
||||
|
||||
// Setup conf AI_PUBLIC_INTERFACE_TOPIC
|
||||
$item = $formSetup->newItem('AI_KEY_API_CHATGPT');
|
||||
$item->defaultFieldValue = '';
|
||||
$arrayofia = array('chatgpt');
|
||||
|
||||
|
||||
// Save API Key
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$apiKey = GETPOST('api_key', 'alpha');
|
||||
// Validate and clean $apiKey here
|
||||
dolibarr_set_const($db, 'MAIN_AI_CHATGPT_API_KEY', $apiKey, 'chaine', 0, '', $conf->entity);
|
||||
foreach($arrayofia as $ia) {
|
||||
// Setup conf AI_PUBLIC_INTERFACE_TOPIC
|
||||
$item = $formSetup->newItem('AI_KEY_API_'.strtoupper($ia));
|
||||
$item->defaultFieldValue = '';
|
||||
}
|
||||
|
||||
// Retrieve existing API Key
|
||||
$apiKey = dolibarr_get_const($db, 'MAIN_AI_CHATGPT_API_KEY');
|
||||
//$apiKey = dolibarr_get_const($db, 'MAIN_AI_CHATGPT_API_KEY');
|
||||
|
||||
$setupnotempty =+ count($formSetup->items);
|
||||
|
||||
|
|
@ -84,11 +80,6 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
|||
* Actions
|
||||
*/
|
||||
|
||||
// For retrocompatibility Dolibarr < 15.0
|
||||
if (versioncompare(explode('.', DOL_VERSION), array(15)) < 0 && $action == 'update' && !empty($user->admin)) {
|
||||
$formSetup->saveConfFromPost();
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
|
|
|
|||
|
|
@ -849,12 +849,12 @@ class FormOther
|
|||
* @param int $showcolorbox 1=Show color code and color box, 0=Show only color code
|
||||
* @param array $arrayofcolors Array of possible colors to choose in the selector. All colors are possible if empty. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
|
||||
* @param string $morecss Add css style into input field
|
||||
* @param string $setpropertyonselect Set this property after selecting a color
|
||||
* @param string $setpropertyonselect Set this CSS property after selecting a color
|
||||
* @param string $default Default color
|
||||
* @return string
|
||||
* @see showColor()
|
||||
*/
|
||||
public static function selectColor($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = '', $morecss = '', $setpropertyonselect = '', $default = '')
|
||||
public static function selectColor($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = array(), $morecss = '', $setpropertyonselect = '', $default = '')
|
||||
{
|
||||
// Deprecation warning
|
||||
if ($form_name) {
|
||||
|
|
|
|||
|
|
@ -1239,8 +1239,13 @@ class FormSetupItem
|
|||
*/
|
||||
public function generateOutputFieldColor()
|
||||
{
|
||||
global $langs;
|
||||
$this->fieldAttr['disabled']=null;
|
||||
return $this->generateInputField();
|
||||
$color = colorArrayToHex(colorStringToArray($this->fieldValue, array()), '');
|
||||
if ($color) {
|
||||
return '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
}
|
||||
return $langs->trans("Default");
|
||||
}
|
||||
/**
|
||||
* generateInputFieldColor
|
||||
|
|
@ -1250,7 +1255,10 @@ class FormSetupItem
|
|||
public function generateInputFieldColor()
|
||||
{
|
||||
$this->fieldAttr['type']= 'color';
|
||||
return $this->generateInputFieldText();
|
||||
$default = $this->defaultFieldValue;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
$formother = new FormOther($this->db);
|
||||
return $formother->selectColor(colorArrayToHex(colorStringToArray($this->fieldAttr['value'], array()), ''), $this->fieldAttr['name'], '', 1, array(), '', '', $default).' ';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4387,7 +4387,7 @@ function getPictoForType($key)
|
|||
*/
|
||||
function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0, $alt = '', $morecss = '', $marginleftonlyshort = 2)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf;
|
||||
|
||||
// We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto
|
||||
$url = DOL_URL_ROOT;
|
||||
|
|
@ -4496,7 +4496,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||
'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda',
|
||||
'uncheck', 'url', 'user-cog', 'user-injured', 'user-md', 'vat', 'website', 'workstation', 'webhook', 'world', 'private',
|
||||
'conferenceorbooth', 'eventorganization',
|
||||
'stamp', 'signature'
|
||||
'stamp', 'signature',
|
||||
'webportal'
|
||||
))) {
|
||||
$fakey = $pictowithouttext;
|
||||
$facolor = '';
|
||||
|
|
@ -4548,7 +4549,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||
'uncheck'=>'times', 'uparrow'=>'share', 'url'=>'external-link-alt', 'vat'=>'money-check-alt', 'vcard'=>'arrow-alt-circle-down',
|
||||
'jabber'=>'comment-o',
|
||||
'website'=>'globe-americas', 'workstation'=>'pallet', 'webhook'=>'bullseye', 'world'=>'globe', 'private'=>'user-lock',
|
||||
'conferenceorbooth'=>'chalkboard-teacher', 'eventorganization'=>'project-diagram'
|
||||
'conferenceorbooth'=>'chalkboard-teacher', 'eventorganization'=>'project-diagram',
|
||||
'webportal'=>'door-open'
|
||||
);
|
||||
if ($conf->currency == 'EUR') {
|
||||
$arrayconvpictotofa['currency'] = 'euro-sign';
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class modAi extends DolibarrModules
|
|||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ class modAi extends DolibarrModules
|
|||
|
||||
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
|
||||
// It is used to group modules by family in module setup page
|
||||
$this->family = "mailings";
|
||||
$this->family = "technic";
|
||||
|
||||
// Module position in the family on 2 digits ('01', '10', '20', ...)
|
||||
$this->module_position = '50';
|
||||
|
|
@ -65,7 +65,7 @@ class modAi extends DolibarrModules
|
|||
// Module description, used if translation string 'ModuleAiDesc' not found (Ai is name of module).
|
||||
$this->description = "AiDescription";
|
||||
// Used only if file README.md and README-LL.md not found.
|
||||
$this->descriptionlong = "AiDescription";
|
||||
$this->descriptionlong = "AiDescriptionLong";
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = 'development';
|
||||
|
|
|
|||
|
|
@ -19,12 +19,13 @@
|
|||
/**
|
||||
* \defgroup modulebuilder Module ModuleBuilder
|
||||
* \brief Add a log into a block chain for some actions.
|
||||
* \file htdocs/core/modules/modBlockedLog.class.php
|
||||
* \ingroup blockedlog
|
||||
* \file htdocs/core/modules/modModuleBuilder.class.php
|
||||
* \ingroup modulebuilder
|
||||
* \brief Description and activation file for the module ModuleBuilder
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to describe a ModuleBuilder module
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1 +1,4 @@
|
|||
AI_KEY_API_CHATGPT= Key for IA api
|
||||
AiDescription=AI (Artificial Intelligence) features
|
||||
AiDescriptionLong=Provides AI (Artificial Intelligence) features in different part of the application. Need external AI API.
|
||||
AI_KEY_API_CHATGPT= Key for ChatGPT IA api
|
||||
AiSetup=AI module setup
|
||||
|
|
@ -64,11 +64,6 @@ $langs->loadLangs(array("admin", "mymodule@mymodule"));
|
|||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('mymodulesetup', 'globalsetup'));
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
|
@ -79,10 +74,15 @@ $label = GETPOST('label', 'alpha');
|
|||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type = 'myobject';
|
||||
|
||||
|
||||
$error = 0;
|
||||
$setupnotempty = 0;
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
// Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only
|
||||
$useFormSetup = 1;
|
||||
|
||||
|
|
@ -91,6 +91,11 @@ if (!class_exists('FormSetup')) {
|
|||
}
|
||||
$formSetup = new FormSetup($db);
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
// Enter here all parameters in your setup page
|
||||
|
||||
|
|
|
|||
|
|
@ -24,42 +24,9 @@
|
|||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
|
||||
$tmp2 = realpath(__FILE__);
|
||||
$i = strlen($tmp) - 1;
|
||||
$j = strlen($tmp2) - 1;
|
||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
|
||||
$i--;
|
||||
$j--;
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) {
|
||||
$res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php";
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) {
|
||||
$res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php using relative path
|
||||
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) {
|
||||
die("Include of main fails");
|
||||
}
|
||||
|
||||
global $conf, $db, $hookmanager, $langs, $user;
|
||||
|
||||
// Libraries
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||
dol_include_once('/webportal/lib/webportal.lib.php');
|
||||
require_once "../../main.inc.php";
|
||||
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT . "/webportal/lib/webportal.lib.php";
|
||||
|
||||
// Translations
|
||||
$langs->loadLangs(array("admin", "hrm", "other"));
|
||||
|
|
@ -67,14 +34,19 @@ $langs->loadLangs(array("admin", "hrm", "other"));
|
|||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('webportalsetup', 'globalsetup'));
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
if (empty($action)) {
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
|
@ -106,7 +78,7 @@ if ($action == 'updatecss') {
|
|||
* View
|
||||
*/
|
||||
|
||||
$title = "WebPortalCSS";
|
||||
$title = "WebPortalSetup";
|
||||
|
||||
$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
|
||||
|
||||
|
|
@ -132,7 +104,7 @@ print load_fiche_titre($langs->trans($title), $linkback, 'title_setup');
|
|||
|
||||
// Configuration header
|
||||
$head = webportalAdminPrepareHead();
|
||||
print dol_get_fiche_head($head, 'css', $langs->trans($title), -1, "webportal@webportal");
|
||||
print dol_get_fiche_head($head, 'css', $langs->trans($title), -1, "webportal");
|
||||
|
||||
// Setup page goes here
|
||||
echo '<span class="opacitymedium">' . $langs->trans("WebPortalCSS") . '</span><br><br>';
|
||||
|
|
|
|||
|
|
@ -23,42 +23,9 @@
|
|||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
|
||||
$tmp2 = realpath(__FILE__);
|
||||
$i = strlen($tmp) - 1;
|
||||
$j = strlen($tmp2) - 1;
|
||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
|
||||
$i--;
|
||||
$j--;
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) {
|
||||
$res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php";
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) {
|
||||
$res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php using relative path
|
||||
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) {
|
||||
die("Include of main fails");
|
||||
}
|
||||
|
||||
global $conf, $db, $hookmanager, $langs, $user;
|
||||
|
||||
// Libraries
|
||||
require_once "../../main.inc.php";
|
||||
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
|
||||
dol_include_once('/webportal/lib/webportal.lib.php');
|
||||
require_once DOL_DOCUMENT_ROOT . "/webportal/lib/webportal.lib.php";
|
||||
|
||||
// Translations
|
||||
$langs->loadLangs(array("admin", "webportal"));
|
||||
|
|
@ -66,25 +33,28 @@ $langs->loadLangs(array("admin", "webportal"));
|
|||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('webportalsetup', 'globalsetup'));
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
|
||||
|
||||
if (empty($action)) {
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type = 'myobject';
|
||||
|
||||
|
||||
$error = 0;
|
||||
$setupnotempty = 0;
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only
|
||||
$useFormSetup = 1;
|
||||
|
||||
|
|
@ -100,15 +70,12 @@ $item->fieldAttr = array('placeholder' => 'https://');
|
|||
$item->helpText = $langs->transnoentities('WebPortalRootUrlHelp');
|
||||
require_once __DIR__ . '/../class/context.class.php';
|
||||
$context = Context::getInstance();
|
||||
$item->fieldOutputOverride = '<a target="_blank" href="'.Context::getRootConfigUrl().'" ><i class="fa fa-arrow-right" ></i> '.Context::getRootConfigUrl().'</a>';
|
||||
$item->fieldOutputOverride = '<a target="_blank" href="'.Context::getRootConfigUrl().'" >'.img_picto('', 'globe', 'class="pictofixedwidth"').Context::getRootConfigUrl().'</a>';
|
||||
|
||||
|
||||
$formSetup->newItem('WEBPORTAL_TITLE')->defaultFieldValue = getDolGlobalString('MAIN_INFO_SOCIETE_NOM');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Enable access for the membership record
|
||||
$access_list = array(
|
||||
'hidden' => $langs->trans('WebPortalAccessHidden'),
|
||||
|
|
@ -256,6 +223,10 @@ if ($action == 'updateMask') {
|
|||
}
|
||||
}
|
||||
|
||||
// Force always edit mode
|
||||
if (empty($action) || $action == 'update') {
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
|
|
@ -264,7 +235,7 @@ if ($action == 'updateMask') {
|
|||
$form = new Form($db);
|
||||
|
||||
$help_url = '';
|
||||
$title = "Setup";
|
||||
$title = "WebPortalSetup";
|
||||
|
||||
llxHeader('', $langs->trans($title), $help_url);
|
||||
|
||||
|
|
@ -275,10 +246,10 @@ print load_fiche_titre($langs->trans($title), $linkback, 'title_setup');
|
|||
|
||||
// Configuration header
|
||||
$head = webportalAdminPrepareHead();
|
||||
print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "webportal@webportal");
|
||||
print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "webportal");
|
||||
|
||||
// Setup page goes here
|
||||
echo '<span class="opacitymedium">' . $langs->trans("SetupPage") . ' : ' . $langs->trans('UserAccountForWebPortalAreInThirdPartyTabHelp') .'</span>.<br><br>';
|
||||
print info_admin($langs->trans("UserAccountForWebPortalAreInThirdPartyTabHelp"));
|
||||
|
||||
if ($action == 'edit') {
|
||||
print $formSetup->generateOutput(true);
|
||||
|
|
|
|||
|
|
@ -23,42 +23,9 @@
|
|||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
|
||||
$tmp2 = realpath(__FILE__);
|
||||
$i = strlen($tmp) - 1;
|
||||
$j = strlen($tmp2) - 1;
|
||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
|
||||
$i--;
|
||||
$j--;
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) {
|
||||
$res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php";
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) {
|
||||
$res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php using relative path
|
||||
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) {
|
||||
die("Include of main fails");
|
||||
}
|
||||
|
||||
global $conf, $db, $hookmanager, $langs, $user;
|
||||
|
||||
// Libraries
|
||||
require_once "../../main.inc.php";
|
||||
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
|
||||
dol_include_once('/webportal/lib/webportal.lib.php');
|
||||
require_once DOL_DOCUMENT_ROOT . "/webportal/lib/webportal.lib.php";
|
||||
|
||||
// Translations
|
||||
$langs->loadLangs(array("admin", "webportal"));
|
||||
|
|
@ -66,11 +33,6 @@ $langs->loadLangs(array("admin", "webportal"));
|
|||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('webportalthemesetup', 'globalsetup'));
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
|
@ -79,8 +41,11 @@ $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleopti
|
|||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type = 'myobject';
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
$setupnotempty = 0;
|
||||
|
|
@ -94,7 +59,6 @@ if (!class_exists('FormSetup')) {
|
|||
|
||||
$formSetup = new FormSetup($db);
|
||||
|
||||
|
||||
require_once __DIR__ . '/../class/webPortalTheme.class.php';
|
||||
$webPortalTheme = new WebPortalTheme();
|
||||
|
||||
|
|
@ -126,8 +90,6 @@ $item = $formSetup->newItem('WEBPORTAL_BANNER_BACKGROUND_IS_DARK')->setAsYesNo()
|
|||
$setupnotempty += count($formSetup->items);
|
||||
|
||||
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
|
@ -135,6 +97,11 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
|||
|
||||
include DOL_DOCUMENT_ROOT . '/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
// Force always edit mode
|
||||
if (empty($action) || $action == 'update') {
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
|
|
@ -143,7 +110,7 @@ include DOL_DOCUMENT_ROOT . '/core/actions_setmoduleoptions.inc.php';
|
|||
$form = new Form($db);
|
||||
|
||||
$help_url = '';
|
||||
$title = "Setup";
|
||||
$title = "WebPortalSetup";
|
||||
|
||||
llxHeader('', $langs->trans($title), $help_url);
|
||||
|
||||
|
|
@ -154,10 +121,10 @@ print load_fiche_titre($langs->trans($title), $linkback, 'title_setup');
|
|||
|
||||
// Configuration header
|
||||
$head = webportalAdminPrepareHead();
|
||||
print dol_get_fiche_head($head, 'themesettings', $langs->trans($title), -1, "webportal@webportal");
|
||||
print dol_get_fiche_head($head, 'themesettings', $langs->trans($title), -1, "webportal");
|
||||
|
||||
// Setup page goes here
|
||||
echo '<span class="opacitymedium">' . $langs->trans("SetupPage") . ' : ' . $langs->trans('UserAccountForWebPortalAreInThirdPartyTabHelp') .'</span>.<br><br>';
|
||||
print info_admin($langs->trans("UserAccountForWebPortalAreInThirdPartyTabHelp"));
|
||||
|
||||
if ($action == 'edit') {
|
||||
print $formSetup->generateOutput(true);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class modWebPortal extends DolibarrModules
|
|||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $conf;
|
||||
$this->db = $db;
|
||||
|
||||
// Id for module (must be unique).
|
||||
|
|
@ -67,10 +67,10 @@ class modWebPortal extends DolibarrModules
|
|||
|
||||
// Author
|
||||
//$this->editor_name = 'Dolibarr';
|
||||
$this->editor_url = 'dolibarr.org';
|
||||
//$this->editor_url = 'dolibarr.org';
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = 'dolibarr';
|
||||
$this->version = 'experimental';
|
||||
// Url to the file with your last numberversion of this module
|
||||
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ class modWebPortal extends DolibarrModules
|
|||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||
// To use a supported fa-xxx css style of font awesome, use this->picto='xxx'
|
||||
$this->picto = 'fa-door-open_fa_#6c6aa8';
|
||||
$this->picto = 'fa-door-open';
|
||||
|
||||
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
|
||||
$this->module_parts = array(
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ WebPortalDescription = Public web portal module for membership and partnership
|
|||
# Admin page
|
||||
#
|
||||
WebPortalSetup = WebPortal setup
|
||||
WebPortalCSS=Web portal CSS
|
||||
Settings = Settings
|
||||
WebPortalSetupPage = WebPortal setup page
|
||||
WEBPORTAL_ROOT_URL = Public access url
|
||||
|
|
|
|||
Loading…
Reference in a new issue