Users - Edit: Sticky User Settings action bar.

This commit is contained in:
Nate
2020-02-12 11:58:56 -07:00
parent 93f2155d85
commit 232e49182b
2 changed files with 38 additions and 17 deletions

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2019
Portions created by the Initial Developer are Copyright (C) 2008-2020
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -147,9 +147,10 @@
$token = $object->create('/core/user_settings/user_settings.php');
//show the content
echo "<div class='action_bar sub'>\n";
echo " <div class='heading'><b>".$text['header-user_settings']."</b></div>\n";
echo "<div class='action_bar' id='action_bar_sub'>\n";
echo " <div class='heading'><b id='heading_sub'>".$text['header-user_settings']."</b></div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','id'=>'action_bar_sub_button_back','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px; display: none;','link'=>'users.php']);
if (permission_exists('user_setting_add')) {
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'link'=>PROJECT_PATH.'/core/user_settings/user_setting_edit.php?user_uuid='.urlencode($_GET['id'])]);
}
@@ -315,4 +316,21 @@
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>\n";
//make sub action bar sticky
echo "<script>\n";
echo " window.addEventListener('scroll', function(){\n";
echo " action_bar_scroll('action_bar_sub', 820, heading_modify, heading_restore);\n";
echo " }, false);\n";
echo " function heading_modify() {\n";
echo " document.getElementById('action_bar_sub_button_back').style.display = 'inline-block';\n";
echo " }\n";
echo " function heading_restore() {\n";
echo " document.getElementById('action_bar_sub_button_back').style.display = 'none';\n";
echo " }\n";
echo "</script>\n";
?>

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2019
Portions created by the Initial Developer are Copyright (C) 2008-2020
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -1025,27 +1025,30 @@
echo "</td>\n";
echo "</tr>\n";
echo " <tr>";
echo " <td colspan='2' align='right' style='white-space: nowrap;'>";
if ($unsaved) {
echo "<tr>";
echo "<td colspan='2' align='right' style='white-space: nowrap;'>";
echo " <span style='color: #b00;'>".$text['message-unsaved_changes']." <i class='fas fa-exclamation-triangle' style='margin-right: 15px;'></i></span>";
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo "<br /><br />";
if ($action == 'edit') {
echo " <input type='hidden' name='id' value=\"".escape($user_uuid)."\">";
echo "<input type='hidden' name='id' value=\"".escape($user_uuid)."\">";
if (permission_exists("user_edit")) {
echo " <input type='hidden' name='username_old' value=\"".escape($username)."\">";
echo "<input type='hidden' name='username_old' value=\"".escape($username)."\">";
}
}
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " <br>";
if ($unsaved) {
echo " <span style='color: #b00;'>".$text['message-unsaved_changes']." <i class='fas fa-exclamation-triangle' style='margin-right: 15px;'></i></span>";
}
echo " </td>";
echo " </tr>";
echo "</table>";
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>";
if (permission_exists("user_edit") && permission_exists('user_setting_view') && $action == 'edit') {
echo "<br><br>";
require $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/core/user_settings/user_settings.php";
echo "<br><br>";
}
//uuid generation script