summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/class/globals.php26
-rw-r--r--app/class/user.class.php13
-rw-r--r--app/model/issue.php6
-rw-r--r--app/view/stdpage.php20
4 files changed, 52 insertions, 13 deletions
diff --git a/app/class/globals.php b/app/class/globals.php
index 8a6efd7..468ad6d 100644
--- a/app/class/globals.php
+++ b/app/class/globals.php
@@ -19,7 +19,7 @@ require_once "class/obj.class.php";
* These are utility functions and constants for the Scrott application.
*/
-define("__VERSION__", "v0.2");
+define("__VERSION__", "v0.3");
/*
* These global variables are arrays of strings logged by Scrott business
@@ -50,6 +50,12 @@ $_SCROTT['PAGE_OBJECT'] = NULL;
$_SCROTT['PAGE_NAME'] = "";
/*
+ * The auto modal variable holds the name (DOM ID) of a modal to automatically
+ * open on page load. The `stdpage` footer will reference this.
+ */
+$_SCROTT['AUTO_MODAL'] = "";
+
+/*
* Get the application root path. This is an absolute path on the server.
*/
function ar() : string
@@ -182,6 +188,24 @@ function getPageName() : string
}
/*
+ * Set the auto modal.
+ */
+function setAutoModal(string $autoModal) : void
+{
+ global $_SCROTT;
+ $_SCROTT['AUTO_MODAL'] = $autoModal;
+}
+
+/*
+ * Get the auto modal.
+ */
+function getAutoModal() : string
+{
+ global $_SCROTT;
+ return $_SCROTT['AUTO_MODAL'];
+}
+
+/*
* Produce a string, but only once. This function is useful
* when dealing with some variable collection of markup and
* you want to affect only the first one with a modifier.
diff --git a/app/class/user.class.php b/app/class/user.class.php
index 231111d..7d67257 100644
--- a/app/class/user.class.php
+++ b/app/class/user.class.php
@@ -46,11 +46,12 @@ class user extends agent
* the username is not in use. Therefore, this function can be
* used to test the existence of a user with the given username.
*/
- public static function getGuidByUname(string $uname) : ?string
+ public static function getGuidByUname(string $uname, bool $caseInsens = false) : ?string
{
$uname = database::esc($uname);
- $query = "SELECT guid FROM objects WHERE objtype = 'user' AND name = '" . $uname . "'";
+ $query = "SELECT guid FROM objects WHERE objtype = 'user' AND " .
+ ($caseInsens ? "" : "BINARY ") . "name = '" . $uname . "'";
$res = database::query($query);
if (count($res) == 0)
@@ -64,9 +65,9 @@ class user extends agent
* is not in use. This function can be used to test the existence
* of a user with the given username.
*/
- public static function getByUname(string $uname) : ?user
+ public static function getByUname(string $uname, bool $caseInsens = false) : ?user
{
- if (($guid = self::getGuidByUname($uname)))
+ if (($guid = self::getGuidByUname($uname, $caseInsens)))
return new user($guid);
return NULL;
@@ -190,7 +191,9 @@ class user extends agent
*/
public static function initNew(string $uname, string $passwd) : ?user
{
- if (self::getByUname($uname))
+ /* search is case-insensitive, to make sure no duplicates exist
+ * which differ _only_ by case */
+ if (self::getByUname($uname, true))
return NULL;
$user = new user();
diff --git a/app/model/issue.php b/app/model/issue.php
index 7159015..dd904e4 100644
--- a/app/model/issue.php
+++ b/app/model/issue.php
@@ -68,6 +68,8 @@ if (isAction("iss-mesg-add"))
}
else
{
+ $issue->signoffAssignee($user);
+ logError(NOTICE, "Issue #" . $issue->numb . " closed");
$log = mesg::initNewLog("%s closed issue", $user, $issue);
}
}
@@ -97,10 +99,14 @@ if (isAction("iss-mesg-add"))
return;
}
+ $issue->signoffAssignee($user);
$issue->close($user);
logError(NOTICE, "Issue #" . $issue->numb . " closed");
$log = mesg::initNewLog("%s closed issue", $user, $issue);
}
+
+ /* automatically redisplay issue modal */
+ setAutoModal("#issueModal-" . $issue->guid);
}
?>
diff --git a/app/view/stdpage.php b/app/view/stdpage.php
index 99cbb25..90e25d8 100644
--- a/app/view/stdpage.php
+++ b/app/view/stdpage.php
@@ -145,6 +145,12 @@ require_once "view/settings.php";
$("#noticeModal").modal("show");
});
</script>
+ <?php } else if (getAutoModal() != "") { ?>
+ <script type="text/javascript">
+ $(window).on('load', function () {
+ $("<?=getAutoModal()?>").modal("show");
+ });
+ </script>
<?php } ?>
<script type="text/javascript">
@@ -195,7 +201,7 @@ require_once "view/settings.php";
<span class="icon-bar"></span>
</button>
- <a href="<?=ar()?>/" class="navbar-brand">
+ <a href="<?=ar()?>/" class="navbar-brand" title="Dashboard">
<span class="glyphicon glyphicon-pencil"></span> Scrott
</a>
</div>
@@ -205,12 +211,12 @@ require_once "view/settings.php";
<p class="navbar-text navbar-right"><i>Not Logged In&nbsp;&nbsp;&nbsp;</i></p>
<?php } else { ?>
<ul class="nav navbar-nav">
- <li><a href="<?=ap()?>"><span class="glyphicon glyphicon-refresh"></span></a></li>
- <li><a href="<?=ar()?>/groups"><span class="glyphicon glyphicon-th"></span></a></li>
- <li><a href="<?=ar()?>/pads"><span class="glyphicon glyphicon-edit"></span></a></li>
+ <li><a href="<?=ap()?>" title="Reload Content"><span class="glyphicon glyphicon-refresh"></span></a></li>
+ <li><a href="<?=ar()?>/groups" title="My Groups"><span class="glyphicon glyphicon-th"></span></a></li>
+ <li><a href="<?=ar()?>/pads" title="My Pads"><span class="glyphicon glyphicon-edit"></span></a></li>
<li class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
+ <a href="#" class="dropdown-toggle" title="Quickjump" data-toggle="dropdown" aria-expanded="false">
<?=getPageName()?> <span class="caret"></span>
</a>
@@ -222,7 +228,7 @@ require_once "view/settings.php";
</li>
<li class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
+ <a href="#" class="dropdown-toggle" title="Create Something" data-toggle="dropdown" aria-expanded="false">
<span class="glyphicon glyphicon-plus"></span> <span class="caret"></span>
</a>
@@ -240,7 +246,7 @@ require_once "view/settings.php";
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
+ <a href="#" class="dropdown-toggle" title="Options" data-toggle="dropdown" aria-expanded="false">
<?php if (\user::getCurrent()->admin == 1) { ?>
<span class="glyphicon glyphicon-sunglasses"></span>
<?php } ?>