diff options
author | Malf Furious <m@lfurio.us> | 2018-11-01 04:57:52 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2018-11-01 04:57:52 -0400 |
commit | 0452872abb62d30fa3831e5ffdd4b0dabf702fd6 (patch) | |
tree | 7cdb94bb81e6e92b1230377c3b5c59eee710a488 | |
parent | cd6a58c4dd233109e0ccddd42e6b636391845036 (diff) | |
parent | dc99ab0c0a0603d5efc1e07cf690c53260528820 (diff) | |
download | scrott-0452872abb62d30fa3831e5ffdd4b0dabf702fd6.tar.gz scrott-0452872abb62d30fa3831e5ffdd4b0dabf702fd6.zip |
Merge branch 'feature/adv-issue' into dev
-rw-r--r-- | app/model/issue.php | 46 | ||||
-rw-r--r-- | app/view/issue.php | 12 |
2 files changed, 46 insertions, 12 deletions
diff --git a/app/model/issue.php b/app/model/issue.php index 4300bbb..910cb14 100644 --- a/app/model/issue.php +++ b/app/model/issue.php @@ -23,7 +23,7 @@ if (isAction("iss-mesg-add")) { $form = new form(); $form->text("issue"); - $form->text("mesg"); + $form->text("mesg", false); if (!$form->populate(input())) return; @@ -36,19 +36,49 @@ if (isAction("iss-mesg-add")) return; } - if (!$user->canCreateSub($issue)) + if (isset($form->mesg) && $form->mesg != "") { - logError(ERROR, "You do not have permission to post to this issue"); - return; + if (!$user->canCreateSub($issue)) + { + logError(ERROR, "You do not have permission to post to this issue"); + return; + } + + $mesg = mesg::initNew($form->mesg, $user, $issue); + + if ($mesg->setAttachment("attachment")) + logError(NOTICE, "Saved attachment " . $mesg->attachment); } - $mesg = mesg::initNew($form->mesg, $user, $issue); + if (isset(input()['advIssue'])) + { + if (!$user->canModify($issue)) + { + logError(ERROR, "You do not have permission to move this issue"); + return; + } - if ($mesg->setAttachment("attachment")) - logError(NOTICE, "Saved attachment " . $mesg->attachment); + $issue->advance($user); - if (isset(input()['closeIssue'])) + if ($issue->isOpen()) + { + $sgename = $issue->getParent()->name; + $log = mesg::initNewLog("%s advanced issue to '" . $sgename . "'", $user, $issue); + } + else + { + $log = mesg::initNewLog("%s closed issue", $user, $issue); + } + } + + else if (isset(input()['closeIssue'])) { + if (!$user->canModify($issue)) + { + logError(ERROR, "You do not have permission to close this issue"); + return; + } + $issue->close($user); logError(NOTICE, "Issue #" . $issue->numb . " closed"); $log = mesg::initNewLog("% closed issue", $user, $issue); diff --git a/app/view/issue.php b/app/view/issue.php index 2d781ba..67f5627 100644 --- a/app/view/issue.php +++ b/app/view/issue.php @@ -115,12 +115,16 @@ require_once "class/issue.class.php"; <?=\formctrl\textarea( "New message", "mesg", 5 )?> <div class="btn-group pull-right"> - <button type="submit" name="input[postMesg]" class="btn btn-primary"> - <span class="glyphicon glyphicon-envelope"></span> Post message + <button type="submit" name="input[postMesg]" class="btn btn-primary" title="Post message"> + <span class="glyphicon glyphicon-envelope"></span> </button> - <button type="submit" name="input[closeIssue]" class="btn btn-success"> - <span class="glyphicon glyphicon-ok"></span> Close issue + <button type="submit" name="input[closeIssue]" class="btn btn-default" title="Close issue"> + <span class="glyphicon glyphicon-ok"></span> + </button> + + <button type="submit" name="input[advIssue]" class="btn btn-default" title="Advance issue"> + <span class="glyphicon glyphicon-chevron-up"></span> </button> </div> |