Skip to content

Commit

Permalink
Add button Save and stay when editing property of web site
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Oct 20, 2019
1 parent 05352a6 commit b21bca1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions htdocs/admin/company.php
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@
}

// Logo
print '<tr class="oddeven"><td><label for="logo">'.$langs->trans("Logo").' (png,jpg)</label></td><td>';
print '<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->trans("Logo"), 'png, jpg').'</label></td><td>';
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
print '<input type="file" class="flat minwidth200" name="logo" id="logo" accept="image/*">';
print '</td><td class="nocellnopadd right" valign="middle">';
Expand All @@ -493,7 +493,7 @@
print '</td></tr>';

// Logo (squarred)
print '<tr class="oddeven"><td><label for="logo_squarred">'.$langs->trans("LogoSquarred").' (png,jpg)</label></td><td>';
print '<tr class="oddeven"><td><label for="logo_squarred">'.$form->textwithpicto($langs->trans("LogoSquarred"), 'png, jpg').'</label></td><td>';
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
print '<input type="file" class="flat minwidth200" name="logo_squarred" id="logo_squarred" accept="image/*">';
print '</td><td class="nocellnopadd right" valign="middle">';
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/main.lang
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ ToValidate=To validate
NotValidated=Not validated
Save=Save
SaveAs=Save As
SaveAndStay=Save and stay
TestConnection=Test connection
ToClone=Clone
ConfirmClone=Choose data you want to clone:
Expand Down
17 changes: 12 additions & 5 deletions htdocs/website/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -1236,12 +1236,18 @@
setEventMessages($langs->trans("Saved"), null, 'mesgs');
}

$action='preview';

if ($backtopage)
if (! GETPOSTISSET('updateandstay')) // If we click on "Save And Stay", we don not make the redirect
{
$action='preview';
if ($backtopage)
{
header("Location: ".$backtopage);
exit;
}
}
else
{
header("Location: ".$backtopage);
exit;
$action = 'editcss';
}
}
}
Expand Down Expand Up @@ -2105,6 +2111,7 @@

if (in_array($action, array('editcss','editmenu','file_manager','replacesite','replacesiteconfirm')))
{
if ($action == 'editcss' && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') print '<input type="submit" id="savefilean stay" class="button buttonforacesave" value="'.dol_escape_htmltag($langs->trans("SaveAndStay")).'" name="updateandstay">';
if (preg_match('/^create/', $action) && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') print '<input type="submit" id="savefile" class="button buttonforacesave" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
if (preg_match('/^edit/', $action) && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') print '<input type="submit" id="savefile" class="button buttonforacesave" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="cancel">';
Expand Down

0 comments on commit b21bca1

Please sign in to comment.