summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2016-03-27 20:19:10 -0400
committerMalf Furious <m@lfurio.us>2016-03-27 20:19:10 -0400
commit4d69a5ecca13bbda5843c176e1bc4df514f079d7 (patch)
treef15454061b94928181c0a36cd48f0979b9dfc943 /app
parent7a2672164a73bb011a3d930df52c0643ee18457d (diff)
parente55a32c647cab450c2a6c6a3156c798dc0f70256 (diff)
downloadscrott-4d69a5ecca13bbda5843c176e1bc4df514f079d7.tar.gz
scrott-4d69a5ecca13bbda5843c176e1bc4df514f079d7.zip
Merge branch 'feature/setting-modal' into dev
Diffstat (limited to '')
-rw-r--r--app/class/form.class.php2
-rw-r--r--app/class/user.class.php75
-rw-r--r--app/controller/dashboard.control.php29
-rw-r--r--app/controller/root.control.php22
-rw-r--r--app/model/common.mod.php233
-rw-r--r--app/model/dashboard.mod.php15
-rw-r--r--app/view/auth/default.view.php20
-rw-r--r--app/view/common/setting.modal.view.php253
-rw-r--r--app/view/common/topp.view.php20
-rw-r--r--app/view/dashboard/default.view.php13
-rw-r--r--app/view/sysconf/default.view.php24
11 files changed, 674 insertions, 32 deletions
diff --git a/app/class/form.class.php b/app/class/form.class.php
index 808de27..9f103ba 100644
--- a/app/class/form.class.php
+++ b/app/class/form.class.php
@@ -82,7 +82,7 @@ class Form
*/
function field_bool($name)
{
- $this->field_enum($name, array("true", "false"), "false");
+ $this->field_enum($name, array("1", "0"), "0");
}
/*
diff --git a/app/class/user.class.php b/app/class/user.class.php
index bd2e174..1130396 100644
--- a/app/class/user.class.php
+++ b/app/class/user.class.php
@@ -59,6 +59,22 @@ class User extends Object
}
/*
+ * Get all users -- ordered by admin DESC (admins first), then by name
+ */
+ function getAllUsers_orderByAdminByName()
+ {
+ $query = "SELECT o.guid FROM object o JOIN user u ON o.guid = u.guid WHERE o.type = 'user' ORDER BY u.admin DESC, o.name";
+ $result = $this->db->query($query);
+
+ $users = array();
+
+ foreach ($result as $u)
+ $users[] = new User($u['guid']);
+
+ return $users;
+ }
+
+ /*
* Check whether a given username is currently in use
*/
function usernameInUse($username)
@@ -99,10 +115,8 @@ class User extends Object
$this->perms = 0;
$this->name = $username;
$this->type = "user";
- $this->salt = $this->getBlob();
- $this->key = $this->getKey($password, $this->salt);
- $this->emailConf = 0;
- $this->emailConfKey = $this->getBlob();
+ $this->setPassword($password);
+ $this->setEmail("");
$this->saveObj();
@@ -120,6 +134,59 @@ class User extends Object
$key = $this->getKey($password, $this->salt);
return $key == $this->key;
}
+
+ /*
+ * Validate the email confirmation key for a user, returns true if correct, false otherwise. On success, $this->emailConf is also set to 1
+ */
+ function confirmEmailKey($key)
+ {
+ if ($key != $this->emailConfKey)
+ return false;
+
+ $this->emailConf = 1;
+ return true;
+ }
+
+ /*
+ * Overwrite the salt and key for this user, given a new plaintext password
+ */
+ function setPassword($password)
+ {
+ $this->salt = $this->getBlob();
+ $this->key = $this->getKey($password, $this->salt);
+ }
+
+ /*
+ * Overwrite the emailConfKey and flag, and change user's saved email address
+ */
+ function setEmail($email)
+ {
+ $this->email = $email;
+ $this->emailConf = 0;
+ $this->emailConfKey = $this->getBlob();
+ }
+
+ /*
+ * If a user has an alias set, display it instead of their username
+ */
+ function getDisplayName()
+ {
+ if ($this->alias != "")
+ return $this->alias;
+
+ return $this->name;
+ }
+
+ /*
+ * Get the glyphicon to use for this user
+ */
+ function getGlyphicon()
+ {
+ if ($this->admin)
+ return "glyphicon glyphicon-sunglasses";
+
+ return "glyphicon glyphicon-user";
+ }
}
?>
diff --git a/app/controller/dashboard.control.php b/app/controller/dashboard.control.php
new file mode 100644
index 0000000..53ca160
--- /dev/null
+++ b/app/controller/dashboard.control.php
@@ -0,0 +1,29 @@
+<?php
+
+require_once "class/controller.class.php";
+require_once "model/dashboard.mod.php";
+
+/*
+ * Main page, Dashboard -- Overview information for user, groups, and pads
+ */
+class Dashboard extends Controller
+{
+ /*
+ * Controller implementation
+ */
+ function handle($argv)
+ {
+ $mod = new DashboardModel();
+ $mod->common_handleFormSubmissions($_REQUEST['input']);
+ $mod->common_deflt();
+ $this->action_default($mod);
+ }
+
+ function action_default($mod)
+ {
+ $mod->deflt();
+ include "view/dashboard/default.view.php";
+ }
+}
+
+?>
diff --git a/app/controller/root.control.php b/app/controller/root.control.php
index a9e23e9..7017ada 100644
--- a/app/controller/root.control.php
+++ b/app/controller/root.control.php
@@ -5,6 +5,8 @@ require_once "class/setting.class.php";
require_once "controller/sysconf.control.php";
require_once "controller/except.control.php";
require_once "controller/auth.control.php";
+require_once "controller/deauth.control.php";
+require_once "controller/dashboard.control.php";
/*
* Root-level controller for Scrott app. This object will delegate the page request to the
@@ -17,8 +19,6 @@ class Root extends Controller
*/
function handle($argv)
{
- /* TODO -- Authentication (login / logout / register) MVC */
-
global $_SCROTT;
$argv = $this->normalizeArgv($argv);
@@ -56,8 +56,22 @@ class Root extends Controller
return;
}
- /* TODO */
- echo "ALL GOOD!<br />";
+ /* Handle page request */
+ if (count($argv) == 0)
+ $ctrl = new Dashboard();
+
+ else
+ {
+ switch ($argv[0])
+ {
+ case "logout": $ctrl = new Deauth(); break;
+ default:
+ throw new Exception("The requested path is not valid.");
+ break;
+ }
+ }
+
+ $ctrl->handle($argv);
}
catch (Exception $e)
diff --git a/app/model/common.mod.php b/app/model/common.mod.php
index d4270d8..b1aa0a0 100644
--- a/app/model/common.mod.php
+++ b/app/model/common.mod.php
@@ -1,9 +1,242 @@
<?php
require_once "model/master.mod.php";
+require_once "class/form.class.php";
+require_once "class/setting.class.php";
+require_once "class/user.class.php";
class CommonModel extends MasterModel
{
+ /*
+ * Default action
+ */
+ function common_deflt()
+ {
+ global $_SCROTT;
+
+ /* Admin settings tab */
+ if ($_SCROTT['settSSL'] != "neither")
+ {
+ $this->common_settingAdminSettSSLChecked[$_SCROTT['settSSL']] = "checked";
+ $this->common_settingAdminSettSSLDisabled = "disabled";
+ }
+ else
+ $this->common_settingAdminSettSSLChecked[Setting::settSSL()] = "checked";
+
+ if (Setting::allowPublicSignup())
+ $this->common_settingAdminAllowPublicSignupChecked = "checked";
+
+ /* Admin all-users settings tab */
+ $userTbl = new User();
+ $this->common_settingAllUsers = $userTbl->getAllUsers_orderByAdminByName();
+ }
+
+ /*
+ * Handle form submissions from common views
+ */
+ function common_handleFormSubmissions($input)
+ {
+ switch ($input['action'])
+ {
+ case "common-setting-user": $this->saveSettingUser($input); break;
+ case "common-setting-admin": $this->saveSettingAdmin($input); break;
+ case "common-setting-allusers-adduser": $this->saveSettingAllusersAdduser($input); break;
+ case "common-setting-allusers-edituser": $this->saveSettingAllusersEdituser($input); break;
+ }
+ }
+
+ /*
+ * Save changes to user account settings
+ */
+ function saveSettingUser($input)
+ {
+ $form = new Form();
+ $form->field_bool("setPasswd");
+ $form->field_text("curPasswd", null, false);
+ $form->field_text("newPasswd", null, false);
+ $form->field_text("confPasswd", null, false);
+ $form->field_text("alias", "", false);
+ $form->field_text("email", "", false);
+ $form->field_text("emailConfKey", null, false);
+
+ if (!$form->populate($input))
+ {
+ $this->logFormErrors($form);
+ return;
+ }
+
+ $user = $this->getCurrentUser();
+
+ if (!$user)
+ {
+ $this->logError("Not logged in");
+ return;
+ }
+
+ if ($form->setPasswd)
+ {
+ if ($user->validatePassword($form->curPasswd))
+ {
+ if ($form->newPasswd == $form->confPasswd)
+ {
+ $user->setPassword($form->newPasswd);
+ $this->logNotice("Password updated successfully");
+ }
+ else
+ $this->logWarning("Password not changed -- Passwords did not match");
+ }
+
+ else
+ $this->logWarning("Password not changed -- Current password was incorrect");
+ }
+
+ $user->alias = $form->alias;
+
+ if ($form->email != $user->email)
+ $user->setEmail($form->email);
+
+ else if ($form->emailConfKey != "")
+ {
+ if (!$user->confirmEmailKey($form->emailConfKey))
+ $this->logWarning("Email not confirmed -- Key was incorrect");
+ }
+
+ $user->saveObj();
+ }
+
+ /*
+ * Save changes to admin settings
+ */
+ function saveSettingAdmin($input)
+ {
+ $form = new Form();
+ $form->field_enum("settSSL", array("force", "neither", "forbid"), Setting::settSSL());
+ $form->field_bool("allowPublicSignup");
+
+ if (!$form->populate($input))
+ {
+ $this->logFormErrors($form);
+ return;
+ }
+
+ $user = $this->getCurrentUser();
+
+ if (!$user || $user->admin == 0)
+ {
+ $this->logError("Admin permissions required");
+ return;
+ }
+
+ Setting::settSSL($form->settSSL);
+ Setting::allowPublicSignup($form->allowPublicSignup);
+ }
+
+ /*
+ * Allow an admin to create a new user account
+ */
+ function saveSettingAllusersAdduser($input)
+ {
+ $form = new Form();
+ $form->field_text("username");
+ $form->field_text("password", null, false);
+ $form->field_text("cPassword", null, false);
+ $form->field_bool("admin");
+ $form->field_text("alias", "", false);
+ $form->field_text("email", "", false);
+
+ if (!$form->populate($input))
+ {
+ $this->logFormErrors($form);
+ return;
+ }
+
+ $user = $this->getCurrentUser();
+
+ if (!$user || $user->admin == 0)
+ {
+ $this->logError("Admin permissions required");
+ return;
+ }
+
+ if ($form->password != $form->cPassword)
+ {
+ $this->logError("Passwords do not match");
+ return;
+ }
+
+ $user = new User();
+
+ if (!$user->createNewUser($form->username, $form->password))
+ {
+ $this->logError("Username " . $form->username . " is not available");
+ return;
+ }
+
+ if ($form->admin)
+ $user->admin = 1;
+
+ $user->alias = $form->alias;
+ $user->setEmail($form->email);
+ $user->saveObj();
+
+ $this->logNotice("Created new user " . $form->username);
+ }
+
+ /*
+ * Allow an admin to edit user accounts
+ */
+ function saveSettingAllusersEdituser($input)
+ {
+ $form = new Form();
+ $form->field_text("guid");
+ $form->field_bool("setPasswd");
+ $form->field_text("newPasswd", null, false);
+ $form->field_text("confPasswd", null, false);
+ $form->field_bool("admin");
+ $form->field_text("alias", "", false);
+ $form->field_text("email", "", false);
+
+ if (!$form->populate($input))
+ {
+ $this->logFormErrors($form);
+ return;
+ }
+
+ $user = $this->getCurrentUser();
+
+ if (!$user || $user->admin == 0)
+ {
+ $this->logError("Admin permissions required");
+ return;
+ }
+
+ $user = new User($form->guid);
+
+ if ($user->type != "user")
+ {
+ $this->logError("Invalid user GUID");
+ return;
+ }
+
+ if ($form->setPasswd)
+ {
+ if ($form->newPasswd == $form->confPasswd)
+ {
+ $user->setPassword($form->newPasswd);
+ $this->logNotice("Password for " . $user->name . " updated successfully");
+ }
+ else
+ $this->logWarning("Password not changed -- Passwords did not match");
+ }
+
+ $user->admin = $form->admin;
+ $user->alias = $form->alias;
+
+ if ($form->email != $user->email)
+ $user->setEmail($form->email);
+
+ $user->saveObj();
+ }
}
?>
diff --git a/app/model/dashboard.mod.php b/app/model/dashboard.mod.php
new file mode 100644
index 0000000..845a56a
--- /dev/null
+++ b/app/model/dashboard.mod.php
@@ -0,0 +1,15 @@
+<?php
+
+require_once "model/common.mod.php";
+
+class DashboardModel extends CommonModel
+{
+ /*
+ * Default action
+ */
+ function deflt()
+ {
+ }
+}
+
+?>
diff --git a/app/view/auth/default.view.php b/app/view/auth/default.view.php
index 16085e7..83bb495 100644
--- a/app/view/auth/default.view.php
+++ b/app/view/auth/default.view.php
@@ -31,13 +31,13 @@
<h1>Login</h1>
<div class="form-group">
- <label for="loginUsername">Username</label>
- <input type="text" name="input[username]" id="loginUsername" class="form-control" required="true" autofocus />
+ <label>Username</label>
+ <input type="text" name="input[username]" class="form-control" required="true" autofocus />
</div>
<div class="form-group">
- <label for="loginPassword">Password</label>
- <input type="password" name="input[password]" id="loginPassword" class="form-control" />
+ <label>Password</label>
+ <input type="password" name="input[password]" class="form-control" />
</div>
<div class="btn-group pull-right">
@@ -72,18 +72,18 @@
<h1 class="text-center">Signup for Scrott</h1>
<div class="form-group">
- <label for="signupUsername">Username</label>
- <input type="text" name="input[username]" id="signupUsername" class="form-control" required="true" maxlength="50" />
+ <label>Username</label>
+ <input type="text" name="input[username]" class="form-control" required="true" maxlength="50" />
</div>
<div class="form-group">
- <label for="signupPassword">Password</label>
- <input type="password" name="input[password]" id="signupPassword" class="form-control" />
+ <label>Password</label>
+ <input type="password" name="input[password]" class="form-control" />
</div>
<div class="form-group">
- <label for="signupCPassword">Confirm Password</label>
- <input type="password" name="input[cPassword]" id="signupCPassword" class="form-control" />
+ <label>Confirm Password</label>
+ <input type="password" name="input[cPassword]" class="form-control" />
</div>
<div class="btn-group pull-right">
diff --git a/app/view/common/setting.modal.view.php b/app/view/common/setting.modal.view.php
new file mode 100644
index 0000000..11adc69
--- /dev/null
+++ b/app/view/common/setting.modal.view.php
@@ -0,0 +1,253 @@
+<div id="settingModal" class="modal fade" tabindex="-1" role="dialog">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+
+ <button type="button" class="close" data-dismiss="modal">
+ <span aria-hidden="true">&times;</span>
+ </button>
+
+ <h4 class="modal-title"><span class="glyphicon glyphicon-cog"></span> Settings</h4>
+
+ </div>
+
+ <div class="modal-body">
+ <ul class="nav nav-tabs" role="tablist">
+ <li class="active"><a href="#settUserTab" aria-controls="settUserTab" data-toggle="tab">
+ <span class="glyphicon glyphicon-user"></span> <?=$mod->getCurrentUser()->getDisplayName()?>
+ </a></li>
+
+ <?php if ($mod->getCurrentUser()->admin == 1) { ?>
+ <li><a href="#settAdminTab" aria-controls="settAdminTab" data-toggle="tab"><span class="glyphicon glyphicon-sunglasses"></span> Admin</a></li>
+ <li><a href="#settUsersTab" aria-controls="settUsersTab" data-toggle="tab"><span class="glyphicon glyphicon-th"></span> All Users</a></li>
+ <?php } ?>
+ </ul>
+
+ <div class="tab-content">
+ <div class="tab-pane fade in active" id="settUserTab">
+ <p>&nbsp;</p>
+
+ <?php if ($mod->getCurrentUser()->admin == 1) { ?>
+ <p class="pull-right"><span class="glyphicon glyphicon-sunglasses"></span> <?=$mod->getCurrentUser()->getDisplayName()?> is a Scrott Administrator</p>
+ <?php } ?>
+
+ <form method="post" action="<?=$mod->ap()?>">
+ <input type="hidden" name="input[action]" value="common-setting-user" />
+ <div class="form-group">
+ <label>Username</label>
+ <input type="text" class="form-control" value="<?=$mod->getCurrentUser()->name?>" disabled />
+ </div>
+
+ <div class="checkbox">
+ <label data-toggle="collapse" data-target="#inputUserPasswdCollapse">
+ <input type="checkbox" name="input[setPasswd]" value="1" /> Change Password
+ </label>
+ </div>
+
+ <div class="collapse" id="inputUserPasswdCollapse">
+ <div class="form-group">
+ <label>Current Password</label>
+ <input type="password" name="input[curPasswd]" class="form-control" />
+ </div>
+
+ <div class="form-group">
+ <label>New Password</label>
+ <input type="password" name="input[newPasswd]" class="form-control" />
+ </div>
+
+ <div class="form-group">
+ <label>Confirm Password</label>
+ <input type="password" name="input[confPasswd]" class="form-control" />
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label>Alias</label>
+ <input type="text" name="input[alias]" class="form-control" value="<?=$mod->getCurrentUser()->alias?>" maxlength="50" />
+ </div>
+
+ <div class="form-group">
+ <label>Email</label>
+ <input type="text" name="input[email]" class="form-control" value="<?=$mod->getCurrentUser()->email?>" maxlength="50" />
+ </div>
+
+ <?php if ($mod->getCurrentUser()->email != "" && $mod->getCurrentUser()->emailConf == 0) { ?>
+ <div class="form-group has-warning">
+ <label class="control-label">Email Confirmation Key</label>
+ <input type="text" name="input[emailConfKey]" class="form-control" />
+ <span class="help-block">You have not yet confirmed ownership of your saved email address</span>
+ </div>
+ <?php } ?>
+
+ <button type="submit" class="btn btn-success pull-right">Save</button>
+ </form>
+
+ <p>&nbsp;</p>
+ </div>
+
+ <?php if ($mod->getCurrentUser()->admin == 1) { ?>
+ <div class="tab-pane fade" id="settAdminTab">
+ <p>&nbsp;</p>
+
+ <form method="post" action="<?=$mod->ap()?>">
+ <input type="hidden" name="input[action]" value="common-setting-admin" />
+ <div class="form-group">
+ <label>HTTP(S)</label>
+ <div class="radio">
+ <label>
+ <input type="radio" name="input[settSSL]" value="force" <?=$mod->common_settingAdminSettSSLChecked['force']?> <?=$mod->common_settingAdminSettSSLDisabled?> />
+ Always Force SSL
+ </label>
+ </div>
+
+ <div class="radio">
+ <label>
+ <input type="radio" name="input[settSSL]" value="neither" <?=$mod->common_settingAdminSettSSLChecked['neither']?> <?=$mod->common_settingAdminSettSSLDisabled?> />
+ Neither
+ </label>
+ </div>
+
+ <div class="radio">
+ <label>
+ <input type="radio" name="input[settSSL]" value="forbid" <?=$mod->common_settingAdminSettSSLChecked['forbid']?> <?=$mod->common_settingAdminSettSSLDisabled?> />
+ Always Forbid SSL
+ </label>
+ </div>
+ </div>
+
+ <label>Access</label>
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="input[allowPublicSignup]" value="1" <?=$mod->common_settingAdminAllowPublicSignupChecked?> /> Allow anyone to create an account
+ </label>
+ </div>
+
+ <button type="submit" class="btn btn-success pull-right">Save</button>
+ </form>
+
+ <p>&nbsp;</p>
+ </div>
+
+ <div class="tab-pane fade" id="settUsersTab">
+ <p>&nbsp;</p>
+
+ <div class="panel-group" id="common-setting-allusers">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a href="#common-setting-allusers-add-collapse" data-toggle="collapse" data-parent="#common-setting-allusers" aria-expanded="false">
+ <span class="glyphicon glyphicon-plus"></span> Add New User
+ </a>
+ </h4>
+ </div>
+
+ <div class="panel-collapse collapse" id="common-setting-allusers-add-collapse">
+ <div class="panel-body">
+ <form method="post" action="<?=$mod->ap()?>">
+ <input type="hidden" name="input[action]" value="common-setting-allusers-adduser" />
+ <div class="form-group">
+ <label>Username</label>
+ <input type="text" name="input[username]" class="form-control" required="true" maxlength="50" />
+ </div>
+
+ <div class="form-group">
+ <label>Password</label>
+ <input type="password" name="input[password]" class="form-control" />
+ </div>
+
+ <div class="form-group">
+ <label>Confirm Password</label>
+ <input type="password" name="input[cPassword]" class="form-control" />
+ </div>
+
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="input[admin]" value="1" /> Administrator
+ </label>
+ </div>
+
+ <div class="form-group">
+ <label>Alias</label>
+ <input type="text" name="input[alias]" class="form-control" maxlength="50" />
+ </div>
+
+ <div class="form-group">
+ <label>Email</label>
+ <input type="text" name="input[email]" class="form-control" maxlength="50" />
+ </div>
+
+ <button type="submit" class="btn btn-success pull-right">Add</button>
+ </form>
+ </div>
+ </div>
+ </div>
+
+ <?php foreach ($mod->common_settingAllUsers as $user) { ?>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a href="#common-setting-allusers-<?=$user->guid?>-collapse" data-toggle="collapse" data-parent="#common-setting-allusers" aria-expanded="false">
+ <span class="<?=$user->getGlyphicon()?>"></span> <?=$user->name?> <?=($user->alias != "" ? "(" . $user->alias . ")" : "")?>
+ </a>
+ </h4>
+ </div>
+
+ <div class="panel-collapse collapse" id="common-setting-allusers-<?=$user->guid?>-collapse">
+ <div class="panel-body">
+ <form method="post" action="<?=$mod->ap()?>">
+ <input type="hidden" name="input[action]" value="common-setting-allusers-edituser" />
+ <input type="hidden" name="input[guid]" value="<?=$user->guid?>" />
+
+ <div class="form-group">
+ <label>Username</label>
+ <input type="text" class="form-control" value="<?=$user->name?>" disabled />
+ </div>
+
+ <div class="checkbox">
+ <label data-toggle="collapse" data-target="#input<?=$user->guid?>PasswdCollapse">
+ <input type="checkbox" name="input[setPasswd]" value="1" /> Change Password
+ </label>
+ </div>
+
+ <div class="collapse" id="input<?=$user->guid?>PasswdCollapse">
+ <div class="form-group">
+ <label>New Password</label>
+ <input type="password" name="input[newPasswd]" class="form-control" />
+ </div>
+
+ <div class="form-group">
+ <label>Confirm Password</label>
+ <input type="password" name="input[confPasswd]" class="form-control" />
+ </div>
+ </div>
+
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="input[admin]" value="1" <?=($user->admin ? "checked" : "")?>> Administrator
+ </label>
+ </div>
+
+ <div class="form-group">
+ <label>Alias</label>
+ <input type="text" name="input[alias]" class="form-control" maxlength="50" value="<?=$user->alias?>" />
+ </div>
+
+ <div class="form-group">
+ <label>Email</label>
+ <input type="text" name="input[email]" class="form-control" maxlength="50" value="<?=$user->email?>" />
+ </div>
+
+ <button type="submit" class="btn btn-success pull-right">Save</button>
+ </form>
+ </div>
+ </div>
+ </div>
+ <?php } ?>
+ </div>
+ </div>
+ <?php } ?>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/app/view/common/topp.view.php b/app/view/common/topp.view.php
index 05e4862..40ad3fe 100644
--- a/app/view/common/topp.view.php
+++ b/app/view/common/topp.view.php
@@ -1,5 +1,9 @@
<?php include "view/master/topp.view.php"; ?>
+<?php if ($mod->getCurrentUser()) { ?>
+ <?php include "view/common/setting.modal.view.php"; ?>
+<?php } ?>
+
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
@@ -14,7 +18,21 @@
</div>
<div class="collapse navbar-collapse" id="scrottnav">
- <p class="navbar-text navbar-right"><i>Not Logged In&nbsp;</i></p>
+ <?php if (!$mod->getCurrentUser()) { ?>
+ <p class="navbar-text navbar-right"><i>Not Logged In&nbsp;</i></p>
+ <?php } else { ?>
+ <ul class="nav navbar-nav navbar-right">
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
+ <span class="<?=$mod->getCurrentUser()->getGlyphicon()?>"></span> <?=$mod->getCurrentUser()->getDisplayName()?> <span class="caret"></span>
+ </a>
+ <ul class="dropdown-menu">
+ <li><a href="#" data-toggle="modal" data-target="#settingModal">Settings</a></li>
+ <li><a href="<?=$mod->ar()?>/logout">Log out</a></li>
+ </ul>
+ </li>
+ </ul>
+ <?php } ?>
</div>
</div>
diff --git a/app/view/dashboard/default.view.php b/app/view/dashboard/default.view.php
new file mode 100644
index 0000000..059d9c8
--- /dev/null
+++ b/app/view/dashboard/default.view.php
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+
+<html lang="en">
+ <head>
+ <?php include "view/common/head.view.php"; ?>
+ <title>Scrott - Dashboard</title>
+ </head>
+
+ <body>
+ <?php include "view/common/topp.view.php"; ?>
+ <?php include "view/common/foot.view.php"; ?>
+ </body>
+</html>
diff --git a/app/view/sysconf/default.view.php b/app/view/sysconf/default.view.php
index 00e6adf..65f7cb6 100644
--- a/app/view/sysconf/default.view.php
+++ b/app/view/sysconf/default.view.php
@@ -52,34 +52,34 @@
<input type="hidden" name="input[action]" value="save" />
<legend>Database Connection</legend>
<div class="form-group">
- <label for="inputDBEngine">Engine</label>
- <input type="text" id="inputDBEngine" class="form-control" value="Mysql" disabled />
+ <label>Engine</label>
+ <input type="text" class="form-control" value="Mysql" disabled />
</div>
<div class="form-group">
- <label for="inputDBAddress">Server Address</label>
- <input type="text" name="input[dbAddress]" id="inputDBAddress" class="form-control" placeholder="localhost" required="true" />
+ <label>Server Address</label>
+ <input type="text" name="input[dbAddress]" class="form-control" placeholder="localhost" required="true" />
</div>
<div class="form-group">
- <label for="inputDBName">Database Name</label>
- <input type="text" name="input[dbName]" id="inputDBName" class="form-control" placeholder="db_scrott" required="true" />
+ <label>Database Name</label>
+ <input type="text" name="input[dbName]" class="form-control" placeholder="db_scrott" required="true" />
</div>
<div class="form-group">
- <label for="inputDBUser">Username</label>
- <input type="text" name="input[dbUser]" id="inputDBUser" class="form-control" placeholder="root" required="true" />
+ <label>Username</label>
+ <input type="text" name="input[dbUser]" class="form-control" placeholder="root" required="true" />
</div>
<div class="form-group">
- <label for="inputDBPass">Password</label>
- <input type="password" name="input[dbPass]" id="inputDBPass" class="form-control" />
+ <label>Password</label>
+ <input type="password" name="input[dbPass]" class="form-control" />
</div>
<legend>Application Installation</legend>
<div class="form-group">
- <label for="inputAppPath">Install Location</label>
- <input type="text" id="inputAppPath" class="form-control" value="<?=$mod->ar()?>/" disabled />
+ <label>Install Location</label>
+ <input type="text" class="form-control" value="<?=$mod->ar()?>/" disabled />
<h6 class="pull-right">Detected from location of files in web document root</h6>
</div>