NEW: add config type securekey module builder
This commit is contained in:
parent
475bdc24f4
commit
056143450b
@ -60,6 +60,7 @@ $arrayofparameters = array(
|
|||||||
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
|
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
|
||||||
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
|
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
|
||||||
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
|
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
|
||||||
|
'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1),
|
||||||
);
|
);
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -74,6 +75,7 @@ if ((float) DOL_VERSION >= 6) {
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'updateMask') {
|
if ($action == 'updateMask') {
|
||||||
$maskconstorder = GETPOST('maskconstorder', 'alpha');
|
$maskconstorder = GETPOST('maskconstorder', 'alpha');
|
||||||
$maskorder = GETPOST('maskorder', 'alpha');
|
$maskorder = GETPOST('maskorder', 'alpha');
|
||||||
@ -196,7 +198,6 @@ print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, 'even
|
|||||||
// Setup page goes here
|
// Setup page goes here
|
||||||
echo '<span class="opacitymedium">'.$langs->trans("EventOrganizationSetupPage").'</span><br><br>';
|
echo '<span class="opacitymedium">'.$langs->trans("EventOrganizationSetupPage").'</span><br><br>';
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'edit') {
|
if ($action == 'edit') {
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
@ -206,12 +207,12 @@ if ($action == 'edit') {
|
|||||||
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
foreach ($arrayofparameters as $constname => $val) {
|
foreach ($arrayofparameters as $constname => $val) {
|
||||||
if ($val['enabled']==1) {
|
if ($val['enabled']==1) {
|
||||||
$setupnotempty++;
|
$setupnotempty++;
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
|
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
|
||||||
print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
|
print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
|
|
||||||
if ($val['type'] == 'textarea') {
|
if ($val['type'] == 'textarea') {
|
||||||
print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
|
print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
|
||||||
@ -255,6 +256,26 @@ if ($action == 'edit') {
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
$formcompany = new FormCompany($db);
|
$formcompany = new FormCompany($db);
|
||||||
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname);
|
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname);
|
||||||
|
} elseif ($val['type'] == 'securekey') {
|
||||||
|
print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : $conf->global->{$constname}).'" size="40">';
|
||||||
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
|
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"');
|
||||||
|
}
|
||||||
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
|
print "\n".'<script type="text/javascript">';
|
||||||
|
print '$(document).ready(function () {
|
||||||
|
$("#generate_token'.$constname.'").click(function() {
|
||||||
|
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
|
||||||
|
action: \'getrandompassword\',
|
||||||
|
generic: true
|
||||||
|
},
|
||||||
|
function(token) {
|
||||||
|
$("#'.$constname.'").val(token);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});';
|
||||||
|
print '</script>';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
|
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
|
||||||
}
|
}
|
||||||
@ -391,7 +412,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($module->isEnabled()) {
|
if ($module->isEnabled()) {
|
||||||
dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
|
generate_tokendol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
|
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
|
||||||
print $module->info();
|
print $module->info();
|
||||||
|
|||||||
@ -81,6 +81,7 @@ $arrayofparameters = array(
|
|||||||
//'MYMODULE_MYPARAM4'=>array('type'=>'emailtemplate:thirdparty', 'enabled'=>1),
|
//'MYMODULE_MYPARAM4'=>array('type'=>'emailtemplate:thirdparty', 'enabled'=>1),
|
||||||
//'MYMODULE_MYPARAM5'=>array('type'=>'yesno', 'enabled'=>1),
|
//'MYMODULE_MYPARAM5'=>array('type'=>'yesno', 'enabled'=>1),
|
||||||
//'MYMODULE_MYPARAM5'=>array('type'=>'thirdparty_type', 'enabled'=>1),
|
//'MYMODULE_MYPARAM5'=>array('type'=>'thirdparty_type', 'enabled'=>1),
|
||||||
|
//'MYMODULE_MYPARAM6'=>array('type'=>'securekey', 'enabled'=>1),
|
||||||
);
|
);
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -276,6 +277,26 @@ if ($action == 'edit') {
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
$formcompany = new FormCompany($db);
|
$formcompany = new FormCompany($db);
|
||||||
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname);
|
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname);
|
||||||
|
} elseif ($val['type'] == 'securekey') {
|
||||||
|
print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : $conf->global->{$constname}).'" size="40">';
|
||||||
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
|
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"');
|
||||||
|
}
|
||||||
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
|
print "\n".'<script type="text/javascript">';
|
||||||
|
print '$(document).ready(function () {
|
||||||
|
$("#generate_token'.$constname.'").click(function() {
|
||||||
|
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
|
||||||
|
action: \'getrandompassword\',
|
||||||
|
generic: true
|
||||||
|
},
|
||||||
|
function(token) {
|
||||||
|
$("#'.$constname.'").val(token);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});';
|
||||||
|
print '</script>';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
|
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user