User & User Settings: List view and button updates.

This commit is contained in:
Nate
2020-01-07 11:11:50 -07:00
parent 38e8a69bf9
commit 5b7d327189
8 changed files with 563 additions and 257 deletions
+40 -38
View File
@@ -1566,45 +1566,47 @@ $text['header-user_import']['sv-se'] = "Importera";
$text['header-user_import']['uk-ua'] = "";
$text['header-user_import']['tr-tr'] = "İçe Aktar";
$text['description-user_setting-edit']['en-us'] = "Edit a setting for this user.";
$text['description-user_setting-edit']['ar-eg'] = "";
$text['description-user_setting-edit']['de-at'] = "Eine Einstellung für diesen Benutzer bearbeiten."; //copied from de-de
$text['description-user_setting-edit']['de-ch'] = "Eine Einstellung für diesen Benutzer bearbeiten."; //copied from de-de
$text['description-user_setting-edit']['de-de'] = "Eine Einstellung für diesen Benutzer bearbeiten.";
$text['description-user_setting-edit']['es-cl'] = "Editar un escenario de este usuario.";
$text['description-user_setting-edit']['es-mx'] = "Editar un escenario de este usuario."; //copied from es-cl
$text['description-user_setting-edit']['fr-ca'] = "Modifier un réglage pour cet utilisateur."; //copied from fr-fr
$text['description-user_setting-edit']['fr-fr'] = "Modifier un réglage pour cet utilisateur.";
$text['description-user_setting-edit']['he-il'] = "";
$text['description-user_setting-edit']['it-it'] = "Modifica un parametro per questo utente.";
$text['description-user_setting-edit']['nl-nl'] = "";
$text['description-user_setting-edit']['pl-pl'] = "";
$text['description-user_setting-edit']['pt-br'] = "Editar uma configuração para este usuário."; //copied from pt-pt
$text['description-user_setting-edit']['pt-pt'] = "Editar uma configuração para este usuário.";
$text['description-user_setting-edit']['ro-ro'] = "";
$text['description-user_setting-edit']['ru-ru'] = "Изменить настройки этого пользователя.";
$text['description-user_setting-edit']['sv-se'] = "Ändra en inställning för denna användfare.";
$text['description-user_setting-edit']['uk-ua'] = "";
$text['header-user_settings']['en-us'] = "User Settings";
$text['header-user_settings']['ar-eg'] = "User Settings";
$text['header-user_settings']['de-at'] = "User Settings";
$text['header-user_settings']['de-ch'] = "User Settings";
$text['header-user_settings']['de-de'] = "User Settings";
$text['header-user_settings']['el-gr'] = "User Settings";
$text['header-user_settings']['es-cl'] = "User Settings";
$text['header-user_settings']['es-mx'] = "User Settings";
$text['header-user_settings']['fr-ca'] = "User Settings";
$text['header-user_settings']['fr-fr'] = "User Settings";
$text['header-user_settings']['he-il'] = "User Settings";
$text['header-user_settings']['it-it'] = "User Settings";
$text['header-user_settings']['nl-nl'] = "User Settings";
$text['header-user_settings']['pl-pl'] = "User Settings";
$text['header-user_settings']['pt-br'] = "User Settings";
$text['header-user_settings']['pt-pt'] = "User Settings";
$text['header-user_settings']['ro-ro'] = "User Settings";
$text['header-user_settings']['ru-ru'] = "User Settings";
$text['header-user_settings']['sv-se'] = "User Settings";
$text['header-user_settings']['uk-ua'] = "User Settings";
$text['header-user_settings']['tr-tr'] = "User Settings";
$text['description-user_setting-add']['en-us'] = "Add a setting for this user.";
$text['description-user_setting-add']['ar-eg'] = "";
$text['description-user_setting-add']['de-at'] = "Eine Einstellung für diesen Benutzer hinzufügen."; //copied from de-de
$text['description-user_setting-add']['de-ch'] = "Eine Einstellung für diesen Benutzer hinzufügen."; //copied from de-de
$text['description-user_setting-add']['de-de'] = "Eine Einstellung für diesen Benutzer hinzufügen.";
$text['description-user_setting-add']['es-cl'] = "Añadir un entorno para este usuario.";
$text['description-user_setting-add']['es-mx'] = "Añadir un entorno para este usuario."; //copied from es-cl
$text['description-user_setting-add']['fr-ca'] = "Ajouter un cadre pour cet utilisateur."; //copied from fr-fr
$text['description-user_setting-add']['fr-fr'] = "Ajouter un cadre pour cet utilisateur.";
$text['description-user_setting-add']['he-il'] = "";
$text['description-user_setting-add']['it-it'] = "Aggiungi un parametro per questo utente.";
$text['description-user_setting-add']['nl-nl'] = "";
$text['description-user_setting-add']['pl-pl'] = "";
$text['description-user_setting-add']['pt-br'] = "Adicionar uma definição para esse usuário."; //copied from pt-pt
$text['description-user_setting-add']['pt-pt'] = "Adicionar uma definição para esse usuário.";
$text['description-user_setting-add']['ro-ro'] = "";
$text['description-user_setting-add']['ru-ru'] = "Добавьте параметр для этого пользователя.";
$text['description-user_setting-add']['sv-se'] = "Lägg till en inställning för denna användare.";
$text['description-user_setting-add']['uk-ua'] = "";
$text['header_description-user_settings']['en-us'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['ar-eg'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['de-at'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['de-ch'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['de-de'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['es-cl'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['es-mx'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['fr-ca'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['fr-fr'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['he-il'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['it-it'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['nl-nl'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['pl-pl'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['pt-br'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['pt-pt'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['ro-ro'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['ru-ru'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['sv-se'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['uk-ua'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['description-user_manager']['en-us'] = "Add, edit, delete, and search users. ";
$text['description-user_manager']['ar-eg'] = "";
+32 -15
View File
@@ -642,22 +642,26 @@
echo "</script>\n";
echo "<form name='frm' id='frm' method='post'>\n";
echo "<input type='hidden' name='action' id='action' value=''>\n";
echo "<div style='float:right; white-space: nowrap;'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['header-user_edit']."</b></div>\n";
echo " <div class='actions'>\n";
if ($unsaved) {
echo "<span style='color: #b00;'>".$text['message-unsaved_changes']." <i class='fas fa-exclamation-triangle' style='margin-right: 15px;'></i></span>";
}
if (permission_exists('user_add') || permission_exists('user_edit')) {
echo " <input type='button' class='btn' style='margin-right: 10px;' onclick=\"window.location='users.php'\" value='".$text['button-back']."'>";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'users.php']);
}
if (permission_exists('ticket_add') || permission_exists('ticket_edit')) {
echo " <input type='button' class='btn' style='margin-right: 3px;' onclick=\"window.location='/app/tickets/tickets.php?user_uuid=".urlencode($user_uuid)."'\" value='".$text['button-tickets']."'>";
echo button::create(['type'=>'button','label'=>$text['button-tickets'],'icon'=>'tags','style'=>'margin-right: 15px;','link'=>PROJECT_PATH.'/app/tickets/tickets.php?user_uuid='.urlencode($user_uuid)]);
}
echo " <input type='submit' class='btn' value='".$text['button-save']."'>";
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<b>".$text['header-user_edit']."</b><br />\n";
echo $text['description-user_edit']."<br /><br />\n";
echo $text['description-user_edit']."\n";
echo "<br /><br />\n";
echo "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
@@ -951,7 +955,8 @@
}
echo "</select>";
if ($action == 'edit') {
echo "<input type='submit' class='btn' value=\"".$text['button-add']."\" >\n";
echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]);
// echo "<input type='submit' class='btn' value=\"".$text['button-add']."\" >\n";
}
}
unset($sql, $parameters, $groups, $field);
@@ -984,8 +989,8 @@
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-api_key']."</td>";
echo " <td class='vtable'>\n";
echo " <input type=\"text\" class='formfld' name=\"api_key\" id='api_key' value=\"".escape($api_key)."\" >";
echo " <input type='button' class='btn' value='".$text['button-generate']."' onclick=\"getElementById('api_key').value='".uuid()."';\">";
echo " <input type='text' class='formfld' style='width: 250px;' name='api_key' id='api_key' value=\"".escape($api_key)."\" >";
echo button::create(['type'=>'button','label'=>$text['button-generate'],'icon'=>'key','onclick'=>"document.getElementById('api_key').value = uuid();"]);
if (strlen($text['description-api_key']) > 0) {
echo " <br />".$text['description-api_key']."<br />\n";
}
@@ -997,8 +1002,8 @@
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-message_key']."</td>";
echo " <td class='vtable'>\n";
echo " <input type='text' class='formfld' name='message_key' id='message_key' value=\"".escape($user_settings["message"]["key"]["text"])."\" >";
echo " <input type='button' class='btn' value='".$text['button-generate']."' onclick=\"getElementById('message_key').value='".uuid()."';\">";
echo " <input type='text' class='formfld' style='width: 250px;' name='message_key' id='message_key' value=\"".escape($user_settings["message"]["key"]["text"])."\" >";
echo button::create(['type'=>'button','label'=>$text['button-generate'],'icon'=>'key','onclick'=>"document.getElementById('message_key').value = uuid();"]);
if (strlen($text['description-message_key']) > 0) {
echo " <br />".$text['description-message_key']."<br />\n";
}
@@ -1033,18 +1038,30 @@
if ($unsaved) {
echo " <span style='color: #b00;'>".$text['message-unsaved_changes']." <i class='fas fa-exclamation-triangle' style='margin-right: 15px;'></i></span>";
}
echo " <input type='submit' class='btn' value='".$text['button-save']."'>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "<br><br>";
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";
}
//uuid generation script
echo "<script>\n";
echo "function uuid() {\n";
echo " var d = new Date().getTime();\n";
echo " var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n";
echo " var r = (d + Math.random()*16)%16 | 0;\n";
echo " d = Math.floor(d/16);\n";
echo " return (c=='x' ? r : (r&0x3|0x8)).toString(16);\n";
echo " });\n";
echo " return uuid;\n";
echo "};\n";
echo "</script>\n";
//include the footer
require_once "resources/footer.php";
?>
?>
+64 -51
View File
@@ -43,7 +43,7 @@
$text = $language->get();
//built in str_getcsv requires PHP 5.3 or higher, this function can be used to reproduce the functionality but requires PHP 5.1.0 or higher
if(!function_exists('str_getcsv')) {
if (!function_exists('str_getcsv')) {
function str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\") {
$fp = fopen("php://memory", 'r+');
fputs($fp, $input);
@@ -90,9 +90,14 @@
$x = 0;
include ("core/users/app_config.php");
$i = 0;
foreach($apps[0]['db'] as $table) {
foreach ($apps[0]['db'] as $table) {
//get the table name and parent name
$table_name = $table["table"]['name'];
if (is_array($table["table"]['name'])) {
$table_name = $table["table"]['name']['text'];
}
else {
$table_name = $table["table"]['name'];
}
$parent_name = $table["table"]['parent'];
//remove the v_ table prefix
@@ -132,45 +137,41 @@
//match the column names to the field names
if (strlen($delimiter) > 0 && file_exists($_SESSION['file']) && $action != 'import') {
//form to match the fields to the column names
//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
//include header
$document['title'] = $text['title-user_import'];
require_once "resources/header.php";
echo "<form action='user_imports.php' method='POST' enctype='multipart/form-data' name='frmUpload' onSubmit=''>\n";
//form to match the fields to the column names
echo "<form name='frmUpload' method='POST' enctype='multipart/form-data'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['header-user_import']."</b></div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'users.php']);
echo button::create(['type'=>'submit','label'=>$text['button-import'],'icon'=>$_SESSION['theme']['button_icon_import']]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo $text['description-import']."\n";
echo "<br /><br />\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td valign='top' align='left' nowrap='nowrap'>\n";
echo " <b>".$text['header-user_import']."</b><br />\n";
echo " </td>\n";
echo " <td valign='top' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='users.php'\" value='".$text['button-back']."'>\n";
echo " <input name='submit' type='submit' class='btn' id='import' value=\"".$text['button-import']."\">\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='left'>\n";
echo " ".$text['description-import']."\n";
echo " </td>\n";
echo " </tr>\n";
//echo "<tr>\n";
//echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['header-import']."</b></td>\n";
//echo "<td width='70%' align='right'>\n";
//echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='users.php'\" value='".$text['button-back']."'>\n";
//echo "</td>\n";
//echo "</tr>\n";
//loop through user columns
$x = 0;
foreach ($line_fields as $line_field) {
$line_field = trim(trim($line_field), $enclosure);
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
//echo " ".$text['label-zzz']."\n";
echo $line_field;
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <select class='formfld' style='' name='fields[$x]'>\n";
echo " <option value=''></option>\n";
foreach($schema as $row) {
@@ -200,12 +201,15 @@
echo " <input name='from_row' type='hidden' value='$from_row'>\n";
echo " <input name='data_delimiter' type='hidden' value='$delimiter'>\n";
echo " <input name='data_enclosure' type='hidden' value='$enclosure'>\n";
echo " <input type='submit' class='btn' id='import' value=\"".$text['button-import']."\">\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>\n";
require_once "resources/footer.php";
//normalize the column names
@@ -233,6 +237,14 @@
//upload the csv
if (file_exists($_SESSION['file']) && $action == 'import') {
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: users.php');
exit;
}
//form to match the fields to the column names
//$document['title'] = $text['title-user_import'];
//require_once "resources/header.php";
@@ -387,34 +399,36 @@
}
}
//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
//include the header
$document['title'] = $text['title-user_import'];
require_once "resources/header.php";
//begin the content
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td valign='top' align='left' width='30%' nowrap='nowrap'>\n";
echo " <b>".$text['header-user_import']."</b><br />\n";
echo " ".$text['description-import']."\n";
echo " </td>\n";
echo " <td valign='top' width='70%' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='users.php'\" value='".$text['button-back']."'>\n";
//echo " <input name='submit' type='submit' class='btn' id='import' value=\"".$text['button-import']."\">\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>";
//show content
echo "<form name='frmUpload' method='post' enctype='multipart/form-data'>\n";
echo "<br />\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['header-user_import']."</b></div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'users.php']);
echo button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>$_SESSION['theme']['button_icon_upload']]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<form action='' method='POST' enctype='multipart/form-data' name='frmUpload' onSubmit=''>\n";
echo " <table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
echo $text['description-import']."\n";
echo "<br /><br />\n";
echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-import_data']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <textarea name='data' id='data' rows='7' class='formfld' style='width: 100%;' wrap='off'>$data</textarea>\n";
echo "<br />\n";
echo $text['description-import_data']."\n";
@@ -483,8 +497,7 @@
echo " </td>\n";
echo " <td valign='bottom' align='right' nowrap>\n";
echo " <input name='type' type='hidden' value='csv'>\n";
echo " <br />\n";
echo " <input name='submit' type='submit' class='btn' id='import' value=\"".$text['button-import']."\">\n";
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
@@ -494,4 +507,4 @@
//include the footer
require_once "resources/footer.php";
?>
?>