mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Look and feel v16
This commit is contained in:
parent
a787fc178b
commit
775a8c5334
|
|
@ -10079,14 +10079,15 @@ class Form
|
|||
/**
|
||||
* Output the buttons to submit a creation/edit form
|
||||
*
|
||||
* @param string $save_label Alternative label for save button
|
||||
* @param string $cancel_label Alternative label for cancel button
|
||||
* @param array $morebuttons Add additional buttons between save and cancel
|
||||
* @param bool $withoutdiv Option to remove enclosing centered div
|
||||
* @param string $morecss More CSS
|
||||
* @return string Html code with the buttons
|
||||
* @param string $save_label Alternative label for save button
|
||||
* @param string $cancel_label Alternative label for cancel button
|
||||
* @param array $morebuttons Add additional buttons between save and cancel
|
||||
* @param bool $withoutdiv Option to remove enclosing centered div
|
||||
* @param string $morecss More CSS
|
||||
* @param string $dol_openinpopup If the button are shown in a context of a page shown inside a popup, we put here the string name of popup.
|
||||
* @return string Html code with the buttons
|
||||
*/
|
||||
public function buttonsSaveCancel($save_label = 'Save', $cancel_label = 'Cancel', $morebuttons = array(), $withoutdiv = 0, $morecss = '')
|
||||
public function buttonsSaveCancel($save_label = 'Save', $cancel_label = 'Cancel', $morebuttons = array(), $withoutdiv = 0, $morecss = '', $dol_openinpopup = '')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
|
@ -10124,6 +10125,19 @@ class Form
|
|||
}
|
||||
$retstring .= $withoutdiv ? '': '</div>';
|
||||
|
||||
if ($dol_openinpopup) {
|
||||
$retstring .= '<!-- buttons are shown into a $dol_openinpopup='.$dol_openinpopup.' context, so we enable the close of dialog on cancel -->'."\n";
|
||||
$retstring .= '<script>';
|
||||
$retstring .= 'jQuery(".button-cancel").click(function(e) {
|
||||
e.preventDefault(); console.log(\'We click on cancel in iframe popup '.$dol_openinpopup.'\');
|
||||
window.parent.jQuery(\'#idfordialog'.$dol_openinpopup.'\').dialog(\'close\');
|
||||
});';
|
||||
$retstring .= '</script>';
|
||||
// TODO @LDR for the save button, in action "add", set parent var to return data and close the window
|
||||
//$retstring .= '<a onclick="javascript:$(\'#varforreturndialogid'.$dol_openinpopup.'\', window.parent.document).text(\'setid\');">setid</a> ';
|
||||
//$retstring .= '<a onclick="javascript:$(\'#varforreturndialoglabel'.$dol_openinpopup.'\', window.parent.document).text(\'setlabel\');">setlabel</a>';
|
||||
}
|
||||
|
||||
return $retstring;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1575,36 +1575,70 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
|
|||
* Such buttons must be included inside a HTML form.
|
||||
*
|
||||
* @param string $name A name for the html component
|
||||
* @param string $label Label of button
|
||||
* @param string $label Label shown in Popup title top bar
|
||||
* @param string $buttonstring button string
|
||||
* @param string $url Url to open
|
||||
* @param string $disabled Disabled text
|
||||
* @param string $morecss More CSS
|
||||
* @param string $backtopagejsfields The back to page must be managed using javascript instead of a redirect.
|
||||
* Value is 'Name of html component to set with id:Name of html component to set with label'
|
||||
* TODO Support this mode, for example when used from the page create a project on thirdparty creation.
|
||||
* @return string HTML component with button
|
||||
*/
|
||||
function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '')
|
||||
function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'button bordertransp', $backtopagejsfields = '')
|
||||
{
|
||||
if (strpos($url, '?') > 0) {
|
||||
$url .= '&dol_hide_topmenu=1&dol_hide_leftmenu=1&dol_openinpopup=1';
|
||||
$url .= '&dol_hide_topmenu=1&dol_hide_leftmenu=1&dol_openinpopup='.urlencode($name);
|
||||
} else {
|
||||
$url .= '?dol_hide_menuinpopup=1&dol_hide_leftmenu=1&dol_openinpopup=1';
|
||||
$url .= '?dol_hide_topmenu=1&dol_hide_leftmenu=1&dol_openinpopup='.urlencode($name);
|
||||
}
|
||||
|
||||
$out .= '';
|
||||
|
||||
$backtopagejsfieldsid = ''; $backtopagejsfieldslabel = '';
|
||||
if ($backtopagejsfields) {
|
||||
$url .= '&backtopagejsfields='.urlencode($backtopagejsfields);
|
||||
$tmpbacktopagejsfields = explode(':', $backtopagejsfields);
|
||||
$backtopagejsfieldsid = empty($tmpbacktopagejsfields[0]) ? '' : $tmpbacktopagejsfields[0];
|
||||
$backtopagejsfieldslabel = empty($tmpbacktopagejsfields[1]) ? '' : $tmpbacktopagejsfields[1];
|
||||
}
|
||||
|
||||
//print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="file_manager">';
|
||||
$out = '<a class="button bordertransp button_'.$name.'"'.$disabled.' title="'.dol_escape_htmltag($label).'">'.$buttonstring.'</a>';
|
||||
$out .= '<!-- a link for button to open url into a dialog popup backtopagejsfields = '.$backtopagejsfields.' -->'."\n";
|
||||
$out .= '<a class="cursorpointer button_'.$name.($morecss ? ' '.$morecss : '').'"'.$disabled.' title="'.dol_escape_htmltag($label).'">'.$buttonstring.'</a>';
|
||||
$out .= '<div id="idfordialog'.$name.'" class="hidden">div for dialog</div>';
|
||||
$out .= '<div id="varforreturndialogid'.$name.'" class="hidden">div for returned id</div>';
|
||||
$out .= '<div id="varforreturndialoglabel'.$name.'" class="hidden">div for returned label</div>';
|
||||
$out .= '<!-- Add js code to open dialog popup on dialog -->';
|
||||
$out .= '<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery(".button_'.$name.'").click(function () {
|
||||
console.log("Open popup with jQuery(...).dialog() on URL '.dol_escape_js(DOL_URL_ROOT.$url).'")
|
||||
var $dialog = $(\'<div></div>\').html(\'<iframe class="iframedialog" style="border: 0px;" src="'.DOL_URL_ROOT.$url.'" width="100%" height="98%"></iframe>\')
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
modal: true,
|
||||
height: (window.innerHeight - 150),
|
||||
width: \'80%\',
|
||||
title: "'.dol_escape_js($label).'"
|
||||
});
|
||||
$dialog.dialog(\'open\');
|
||||
console.log(\'Open popup with jQuery(...).dialog() on URL '.dol_escape_js(DOL_URL_ROOT.$url).'\');
|
||||
var $tmpdialog = $(\'#idfordialog'.$name.'\');
|
||||
$tmpdialog.html(\'<iframe class="iframedialog" id="iframedialog'.$name.'" style="border: 0px;" src="'.DOL_URL_ROOT.$url.'" width="100%" height="98%"></iframe>\');
|
||||
$tmpdialog.dialog({
|
||||
autoOpen: false,
|
||||
modal: true,
|
||||
height: (window.innerHeight - 150),
|
||||
width: \'80%\',
|
||||
title: \''.dol_escape_js($label).'\',
|
||||
open: function (event, ui) {
|
||||
console.log("open popup");
|
||||
},
|
||||
close: function (event, ui) {
|
||||
returnedid = jQuery("#varforreturndialogid'.$name.'").text();
|
||||
returnedlabel = jQuery("#varforreturndialoglabel'.$name.'").text();
|
||||
console.log("popup has been closed. returnedid="+returnedid+" returnedlabel="+returnedlabel);
|
||||
if (returnedid != "" && returnedid != "div for returned id") {
|
||||
jQuery("#'.(empty($backtopagejsfieldsid)?"none":$backtopagejsfieldsid).'").val(returnedid);
|
||||
}
|
||||
if (returnedlabel != "" && returnedlabel != "div for returned label") {
|
||||
jQuery("#'.(empty($backtopagejsfieldslabel)?"none":$backtopagejsfieldslabel).'").val(returnedlabel);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$tmpdialog.dialog(\'open\');
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
|
|
|||
|
|
@ -1367,11 +1367,11 @@ if (!function_exists("llxHeader")) {
|
|||
print '<body id="mainbody" class="'.$tmpcsstouse.'">'."\n";
|
||||
|
||||
// top menu and left menu area
|
||||
if (empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) {
|
||||
if ((empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) && !GETPOST('dol_openinpopup', 'aZ09')) {
|
||||
top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss, $morequerystring, $help_url);
|
||||
}
|
||||
|
||||
if (empty($conf->dol_hide_leftmenu)) {
|
||||
if (empty($conf->dol_hide_leftmenu) && !GETPOST('dol_openinpopup', 'aZ09')) {
|
||||
left_menu('', $help_url, '', '', 1, $title, 1); // $menumanager is retrieved with a global $menumanager inside this function
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,13 +87,15 @@ $langs->loadLangs(array("mymodule@mymodule", "other"));
|
|||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09');
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new MyObject($db);
|
||||
|
|
|
|||
|
|
@ -46,8 +46,11 @@ $id = GETPOST('id', 'int');
|
|||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$backtopagejsfields = GETPOST('backtopagejsfields', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'aZ09');
|
||||
$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09');
|
||||
|
||||
$status = GETPOST('status', 'int');
|
||||
$opp_status = GETPOST('opp_status', 'int');
|
||||
$opp_percent = price2num(GETPOST('opp_percent', 'alpha'));
|
||||
|
|
@ -505,9 +508,10 @@ if ($action == 'create' && $user->rights->projet->creer) {
|
|||
print load_fiche_titre($titlenew, '', 'project');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
print '<input type="hidden" name="backtopagejsfields" value="'.$backtopagejsfields.'">';
|
||||
|
||||
print dol_get_fiche_head();
|
||||
|
||||
|
|
@ -605,7 +609,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
|
|||
if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) {
|
||||
$filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
|
||||
}
|
||||
$text = img_picto('', 'company').$form->select_company(GETPOST('socid', 'int'), 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 widthcentpercentminusxx');
|
||||
$text = img_picto('', 'company').$form->select_company(GETPOST('socid', 'int'), 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
|
||||
if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) {
|
||||
$texthelp = $langs->trans("IfNeedToUseOtherObjectKeepEmpty");
|
||||
print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1);
|
||||
|
|
@ -613,7 +617,12 @@ if ($action == 'create' && $user->rights->projet->creer) {
|
|||
print $text;
|
||||
}
|
||||
if (!GETPOSTISSET('backtopage')) {
|
||||
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
|
||||
$url = '/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create');
|
||||
$newbutton = '<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span>';
|
||||
// TODO @LDR Impletment this
|
||||
//$tmpbacktopagejsfields = 'socid:search_socid';
|
||||
//print dolButtonToOpenUrlInDialogPopup('addthirdparty', $langs->transnoentitiesnoconv('AddThirdParty'), $newbutton, $url, '', '', $tmpbacktopagejsfields);
|
||||
print ' <a href="'.DOL_URL_ROOT.$url.'">'.$newbutton.'</a>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,9 @@ $error = 0; $errors = array();
|
|||
$action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$backtopagejsfields = GETPOST('backtopagejsfields', 'alpha');
|
||||
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
|
||||
$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int');
|
||||
|
|
@ -1262,8 +1264,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc" autocomplete="off">'; // Chrome ignor autocomplete
|
||||
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
print '<input type="hidden" name="backtopagejsfields" value="'.$backtopagejsfields.'">';
|
||||
print '<input type="hidden" name="private" value='.$object->particulier.'>';
|
||||
print '<input type="hidden" name="type" value='.GETPOST("type", 'alpha').'>';
|
||||
print '<input type="hidden" name="LastName" value="'.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName').'">';
|
||||
|
|
@ -1721,7 +1724,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print $form->buttonsSaveCancel("AddThirdParty");
|
||||
print $form->buttonsSaveCancel("AddThirdParty", 'Cancel', null, 0, '', $dol_openinpopup);
|
||||
|
||||
print '</form>'."\n";
|
||||
} elseif ($action == 'edit') {
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
|
|||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'websitelist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
$dol_hide_topmenu = GETPOST('dol_hide_topmenu', 'int');
|
||||
$dol_hide_leftmenu = GETPOST('dol_hide_leftmenu', 'int');
|
||||
$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09');
|
||||
|
||||
$type_container = GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha');
|
||||
|
||||
|
|
@ -2558,6 +2561,7 @@ print '<!-- Open form for all page -->'."\n";
|
|||
print '<form action="'.$_SERVER["PHP_SELF"].($action == 'file_manager' ? '?uploadform=1': '').'" method="POST" enctype="multipart/form-data" class="websiteformtoolbar">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
print '<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.'">';
|
||||
|
||||
if ($action == 'createsite') {
|
||||
print '<input type="hidden" name="action" value="addsite">';
|
||||
|
|
@ -2638,7 +2642,7 @@ if (!GETPOST('hide_websitemenu')) {
|
|||
|
||||
|
||||
//var_dump($objectpage);exit;
|
||||
print '<div class="centpercent websitebar'.(GETPOST('dol_openinpopup', 'int') ? ' hidden' : '').'">';
|
||||
print '<div class="centpercent websitebar'.(GETPOST('dol_openinpopup', 'aZ09') ? ' hidden' : '').'">';
|
||||
|
||||
//
|
||||
// Toolbar for websites
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user