summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2018-11-05 04:58:23 -0500
committerMalf Furious <m@lfurio.us>2018-11-05 04:58:23 -0500
commit0e3e65d1ba0ecbc4f819fed3eb9c03e212e400c1 (patch)
treee932b4f82d86aaf7135fef8d3f42941e615fbfc4
parentfead9f76a6f620642e0051d0065e689580af7d90 (diff)
parentdaa4f7a34e23d18e23d34d4becca752635b2ea38 (diff)
downloadscrott-0e3e65d1ba0ecbc4f819fed3eb9c03e212e400c1.tar.gz
scrott-0e3e65d1ba0ecbc4f819fed3eb9c03e212e400c1.zip
Merge branch 'feature/view-closed-issues' into dev
-rw-r--r--app/class/pad.class.php18
-rw-r--r--app/index.php5
-rw-r--r--app/model/pad.php2
-rw-r--r--app/view/issue.php86
-rw-r--r--app/view/pad.php12
-rw-r--r--app/view/pad_closed.php64
6 files changed, 141 insertions, 46 deletions
diff --git a/app/class/pad.class.php b/app/class/pad.class.php
index dcf2b32..0c69385 100644
--- a/app/class/pad.class.php
+++ b/app/class/pad.class.php
@@ -108,6 +108,24 @@ class pad extends obj
$stage->saveObj();
$this->saveObj();
}
+
+ /*
+ * Get an array of all closed issues under this pad. Ordered by
+ * datetime closed.
+ */
+ public function getClosedIssues_ordByClosed() : array
+ {
+ $query = "SELECT o.guid FROM objects o JOIN issues i ON o.guid = i.guid " .
+ "WHERE o.parent = '" . database::esc($this->guid) . "' ORDER BY i.closed DESC";
+ $res = database::query($query);
+
+ $issues = array();
+
+ foreach ($res as $i)
+ $issues[] = new issue($i['guid']);
+
+ return $issues;
+ }
}
?>
diff --git a/app/index.php b/app/index.php
index 7395c6f..7f05479 100644
--- a/app/index.php
+++ b/app/index.php
@@ -111,7 +111,10 @@ function main(array $argv) : void
$obj = new pad($argv[0]);
setPageObj($obj);
setPageName($obj->name);
- require "view/pad.php";
+ if (isset($argv[1]) && $argv[1] == "closed")
+ require "view/pad_closed.php";
+ else
+ require "view/pad.php";
break;
}
}
diff --git a/app/model/pad.php b/app/model/pad.php
index d7cfb23..0090c27 100644
--- a/app/model/pad.php
+++ b/app/model/pad.php
@@ -26,4 +26,6 @@ foreach ($stages as $s)
$issues = array_merge($issues, $i);
}
+$closed_issues = $pad->getClosedIssues_ordByClosed();
+
?>
diff --git a/app/view/issue.php b/app/view/issue.php
index 5f1c518..6edf7cf 100644
--- a/app/view/issue.php
+++ b/app/view/issue.php
@@ -109,53 +109,55 @@ require_once "class/issue.class.php";
</div>
<?php } ?>
- <form method="post" action="<?=ap()?>" enctype="multipart/form-data">
- <?=\formctrl\formname( "iss-mesg-add" )?>
- <?=\formctrl\hidden( "issue", $i->guid )?>
- <?=\formctrl\textarea( "New message", "mesg", 5 )?>
-
- <div class="btn-group pull-right">
- <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-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>
-
- <button type="button" class="btn btn-default" data-toggle="collapse" data-target="#assignCollapse-<?=$i->guid?>" title="Assign issue">
- <span class="glyphicon glyphicon-share-alt"></span>
- </button>
- </div>
-
- <div class="collapse" id="assignCollapse-<?=$i->guid?>">
- <div class="form-group">
- <label>Select assignee</label>
+ <?php if ($i->isOpen()) { ?>
+ <form method="post" action="<?=ap()?>" enctype="multipart/form-data">
+ <?=\formctrl\formname( "iss-mesg-add" )?>
+ <?=\formctrl\hidden( "issue", $i->guid )?>
+ <?=\formctrl\textarea( "New message", "mesg", 5 )?>
+
+ <div class="btn-group pull-right">
+ <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-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>
+
+ <button type="button" class="btn btn-default" data-toggle="collapse" data-target="#assignCollapse-<?=$i->guid?>" title="Assign issue">
+ <span class="glyphicon glyphicon-share-alt"></span>
+ </button>
+ </div>
- <select name="input[assignee]" class="form-control selectpicker">
- <option data-icon="glyphicon-user" value="<?=$i->getParent()->getParent()->getOwner()->guid?>">
- <?=$i->getParent()->getParent()->getOwner()->getDisplayName()?>
- </option>
+ <div class="collapse" id="assignCollapse-<?=$i->guid?>">
+ <div class="form-group">
+ <label>Select assignee</label>
- <?php foreach ($i->getParent()->getParent()->getMembers() as $memb) { ?>
- <option data-icon="glyphicon-user" value="<?=$memb->guid?>">
- <?=$memb->getDisplayName()?>
+ <select name="input[assignee]" class="form-control selectpicker">
+ <option data-icon="glyphicon-user" value="<?=$i->getParent()->getParent()->getOwner()->guid?>">
+ <?=$i->getParent()->getParent()->getOwner()->getDisplayName()?>
</option>
- <?php } ?>
- </select>
- </div>
- <button type="submit" name="input[assIssue]" class="btn btn-default">
- <span class="glyphicon glyphicon-share-alt"></span> Post and assign issue
- </button>
- </div>
+ <?php foreach ($i->getParent()->getParent()->getMembers() as $memb) { ?>
+ <option data-icon="glyphicon-user" value="<?=$memb->guid?>">
+ <?=$memb->getDisplayName()?>
+ </option>
+ <?php } ?>
+ </select>
+ </div>
+
+ <button type="submit" name="input[assIssue]" class="btn btn-default">
+ <span class="glyphicon glyphicon-share-alt"></span> Post and assign issue
+ </button>
+ </div>
- <?=\formctrl\file( "Attachment", "attachment" )?>
- </form>
+ <?=\formctrl\file( "Attachment", "attachment" )?>
+ </form>
+ <?php } ?>
</div>
<div class="col-md-4">
diff --git a/app/view/pad.php b/app/view/pad.php
index a9c8508..bf626bf 100644
--- a/app/view/pad.php
+++ b/app/view/pad.php
@@ -42,9 +42,15 @@ require_once "view/issue.php";
<span class="glyphicon glyphicon-edit"></span>
<?=$pad->name?>
- <button type="button" class="btn btn-success" data-toggle="modal" data-target="#newIssueModal">
- <span class="glyphicon glyphicon-plus"></span> Open Issue
- </button>
+ <div class="btn-group">
+ <button type="button" class="btn btn-success" data-toggle="modal" data-target="#newIssueModal">
+ <span class="glyphicon glyphicon-plus"></span> Open Issue
+ </button>
+
+ <a href="<?=ap()?>/closed" class="btn btn-default">
+ View closed issues
+ </a>
+ </div>
</h1>
</div>
</div>
diff --git a/app/view/pad_closed.php b/app/view/pad_closed.php
new file mode 100644
index 0000000..19864cd
--- /dev/null
+++ b/app/view/pad_closed.php
@@ -0,0 +1,64 @@
+<?php
+
+/*
+ * SCROTT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * For more information, please refer to UNLICENSE
+ */
+
+require_once "model/pad.php";
+require_once "view/stdpage.php";
+require_once "view/datalsts.php";
+require_once "view/issue.php";
+
+?>
+
+<!DOCTYPE html>
+
+<html lang="en">
+ <head>
+ <?=stdpage\head( getPageName() )?>
+ </head>
+
+ <body>
+ <?php foreach ($closed_issues as $i) { ?>
+ <?=issue_v\issue($i)?>
+ <?php } ?>
+
+ <?=stdpage\top()?>
+ <?=stdpage\nav()?>
+
+ <div class="container">
+ <div class="well well-lg">
+ <div class="row">
+ <div class="col-md-12">
+ <h1>
+ <span class="glyphicon glyphicon-edit"></span>
+ <?=$pad->name?>
+
+ <a href="<?=ar()?>/<?=$pad->guid?>" class="btn btn-default">
+ View open issues
+ </a>
+ </h1>
+ </div>
+ </div>
+ </div>
+
+ <div class="panel panel-default">
+ <table class="table table-hover">
+ <?php foreach ($closed_issues as $i) { ?>
+ <?=datalsts\issueListItem($i)?>
+ <?php } ?>
+ </table>
+ </div>
+ </div>
+
+ <?=stdpage\foot()?>
+ </body>
+</html>