NEW Add ALT+s to save a website page in edit mode

This commit is contained in:
Laurent Destailleur 2024-02-29 11:45:50 +01:00
parent a365800967
commit fd216d99ed

View File

@ -3146,7 +3146,18 @@ if (!GETPOST('hide_websitemenu')) {
if (in_array($action, array('editcss', 'editmenu', 'file_manager', 'replacesiteconfirm')) || in_array($mode, array('replacesite'))) {
if ($action == 'editcss') {
print '<input type="submit" id="savefileandstay" class="button buttonforacesave hideonsmartphone small" value="'.dol_escape_htmltag($langs->trans("SaveAndStay")).'" name="updateandstay">';
// accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox
// accesskey is for Mac: CTRL + key for all browsers
$stringforfirstkey = $langs->trans("KeyboardShortcut");
if ($conf->browser->name == 'chrome') {
$stringforfirstkey .= ' ALT +';
} elseif ($conf->browser->name == 'firefox') {
$stringforfirstkey .= ' ALT + SHIFT +';
} else {
$stringforfirstkey .= ' CTL +';
}
print '<input type="submit" accesskey="s" title="'.dol_escape_htmltag($stringforfirstkey.' s').'" id="savefileandstay" class="button buttonforacesave hideonsmartphone small" 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 button-save small" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
@ -3541,7 +3552,18 @@ if (!GETPOST('hide_websitemenu')) {
}
if (!in_array($mode, array('replacesite')) && !in_array($action, array('editcss', 'editmenu', 'file_manager', 'replacesiteconfirm', 'createsite', 'createcontainer', 'createfromclone', 'createpagefromclone', 'deletesite'))) {
if ($action == 'editsource' || $action == 'editmeta') {
print '<input type="submit" id="savefileandstay" class="button buttonforacesave hideonsmartphone small" value="'.dol_escape_htmltag($langs->trans("SaveAndStay")).'" name="updateandstay">';
// accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox
// accesskey is for Mac: CTRL + key for all browsers
$stringforfirstkey = $langs->trans("KeyboardShortcut");
if ($conf->browser->name == 'chrome') {
$stringforfirstkey .= ' ALT +';
} elseif ($conf->browser->name == 'firefox') {
$stringforfirstkey .= ' ALT + SHIFT +';
} else {
$stringforfirstkey .= ' CTL +';
}
print '<input type="submit" accesskey="s" title="'.dol_escape_htmltag($stringforfirstkey.' s').'" id="savefileandstay" class="button buttonforacesave hideonsmartphone small" value="'.dol_escape_htmltag($langs->trans("SaveAndStay")).'" name="updateandstay">';
}
if (preg_match('/^create/', $action)) {
print '<input type="submit" id="savefile" class="button buttonforacesave button-save small" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';