Save the virtualhost so we can test without entering it each time.

This commit is contained in:
Laurent Destailleur 2016-07-14 19:42:04 +02:00
parent 2793cee829
commit a5123c06db
4 changed files with 30 additions and 6 deletions

View File

@ -35,6 +35,19 @@ $element = GETPOST('element','alpha',2);
$table_element = GETPOST('table_element','alpha',2);
$fk_element = GETPOST('fk_element','alpha',2);
/* Example:
field:editval_ref_customer (8 first chars will removed to know name of property)
element:contrat
table_element:contrat
fk_element:4
type:string
value:aaa
loadmethod:
savemethod:
savemethodname:
*/
/*
* View
*/
@ -81,7 +94,7 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
}
else $newelement = $element;
if (! empty($user->rights->$newelement->creer) || ! empty($user->rights->$newelement->write)
if (! empty($user->rights->$newelement->creer) || ! empty($user->rights->$newelement->create) || ! empty($user->rights->$newelement->write)
|| (isset($subelement) && (! empty($user->rights->$newelement->$subelement->creer) || ! empty($user->rights->$newelement->$subelement->write)))
|| ($element == 'payment' && $user->rights->facture->paiement)
|| ($element == 'payment_supplier' && $user->rights->fournisseur->facture->creer))

View File

@ -24,8 +24,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
/**
* \class GenericObject
* \brief Class of a generic business object
* Class of a generic business object
*/
class GenericObject extends CommonObject

View File

@ -99,7 +99,7 @@ class modWebsites extends DolibarrModules
$this->rights[$r][0] = 10002;
$this->rights[$r][1] = 'Create/modify website content';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'create';
$this->rights[$r][4] = 'write';
$r++;
$this->rights[$r][0] = 10003;

View File

@ -486,6 +486,7 @@ if (count($object->records) > 0)
{
$realurl=$urlwithroot.'/public/websites/index.php?website='.$website;
$dataroot=DOL_DATA_ROOT.'/websites/'.$website;
if (! empty($object->virtualhost)) $realurl=$object->virtualhost;
// TODO If virtual url defined, we use it
/*print ' - '.$langs->trans("RealURL").' ';
@ -507,10 +508,21 @@ if (count($object->records) > 0)
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#previewsite").click(function() {
/* Save url */
newurl=jQuery("#previewsiteurl").val();
console.log("Open url "+newurl);
/* Save url */
jQuery.ajax({
method: "POST",
url: "'.DOL_URL_ROOT.'/core/ajax/saveinplace.php",
data: {
field: \'editval_virtualhost\',
element: \'websites\',
table_element: \'website\',
fk_element: '.$object->id.',
value: encodeURIComponent(newurl),
},
context: document.body
});
$(this).attr("href",newurl);
});
});