From 68d0262464933a158e31f76fd927b72b19fdf497 Mon Sep 17 00:00:00 2001
From: Malfurious <m@lfurio.us>
Date: Mon, 18 Oct 2021 18:25:53 -0400
Subject: Add additional info / controls to issueListItem

The list of assignees, the owner (opener), and quick controls for
advancing or closing an issue are now available in the issue listing for
pad stages (or the closed issue list, which is missing the new control
buttons).

If using the quick control buttons to manipulate an issue, the issue
modal is not called-up on the page reload.

Signed-off-by: Malfurious <m@lfurio.us>
---
 app/model/issue.php     |  4 +++-
 app/view/datalsts.php   | 43 +++++++++++++++++++++++++++++++++++++++----
 app/view/pad_closed.php |  2 +-
 3 files changed, 43 insertions(+), 6 deletions(-)

(limited to 'app')

diff --git a/app/model/issue.php b/app/model/issue.php
index dd904e4..3f7b620 100644
--- a/app/model/issue.php
+++ b/app/model/issue.php
@@ -25,6 +25,7 @@ if (isAction("iss-mesg-add"))
     $form->text("issue");
     $form->text("mesg", false);
     $form->text("assignee");
+    $form->flag("nopop");
 
     if (!$form->populate(input()))
         return;
@@ -106,7 +107,8 @@ if (isAction("iss-mesg-add"))
     }
 
     /* automatically redisplay issue modal */
-    setAutoModal("#issueModal-" . $issue->guid);
+    if ($form->nopop != "1")
+        setAutoModal("#issueModal-" . $issue->guid);
 }
 
 ?>
diff --git a/app/view/datalsts.php b/app/view/datalsts.php
index ba9021b..b80de78 100644
--- a/app/view/datalsts.php
+++ b/app/view/datalsts.php
@@ -17,6 +17,7 @@ namespace datalsts;
 require_once "class/obj.class.php";
 require_once "class/stage.class.php";
 require_once "class/issue.class.php";
+require_once "view/formctrl.php";
 
 ?>
 <?php function objHeadCircle(\obj $obj, int $height) : void { ?>
@@ -130,12 +131,46 @@ require_once "class/issue.class.php";
     </div>
 
 <?php } ?>
-<?php function issueListItem(\issue $i) : void { ?>
+<?php function issueListItem(\issue $i, bool $show_ctrls = true) : void { ?>
+
+    <?php $assigns = $i->getAssignees(); ?>
 
     <tr class="issueListItem" data-guid="<?=$i->guid?>">
-        <!-- TODO -->
-        <td class="col-md-2"><?=$i->guid?> (#<?=$i->numb?>)</td>
-        <td class="col-md-10"><?=$i->name?></td>
+        <td class="col-md-1">#<?=$i->numb?></td>
+
+        <td class="col-md-11">
+            <?=$i->name?>
+
+            <span class="pull-right">
+                <form method="post" action="<?=ap()?>">
+                    <?=\formctrl\formname( "iss-mesg-add" )?>
+                    <?=\formctrl\hidden( "issue", $i->guid )?>
+                    <?=\formctrl\hidden( "assignee", " " )?>
+                    <?=\formctrl\hidden( "nopop", "1" )?>
+
+                    <?php if (count($assigns) == 0) { ?>
+                        <span class="glyphicon glyphicon-ban-circle"></span>&nbsp;
+                    <?php } foreach ($assigns as $assign) { ?>
+                        <?=objHeadCircle($assign->assignee, 20)?>
+                    <?php } ?>
+                    <span class="glyphicon glyphicon-share-alt"></span>
+                    <?=objHeadCircle($i->getOwner(), 20)?>
+
+                    <?php if ($show_ctrls) { ?>
+                        &nbsp;
+                        <div class="btn-group" role="group">
+                            <button type="submit" name="input[advIssue]" class="btn btn-sm btn-default" title="Advance issue">
+                                <span class="glyphicon glyphicon-chevron-up"></span>
+                            </button>
+
+                            <button type="submit" name="input[closeIssue]" class="btn btn-sm btn-default" title="Close issue">
+                                <span class="glyphicon glyphicon-ok"></span>
+                            </button>
+                        </div>
+                    <?php } ?>
+                </form>
+            </span>
+        </td>
     </tr>
 
 <?php } ?>
diff --git a/app/view/pad_closed.php b/app/view/pad_closed.php
index 412ce4f..c0678e3 100644
--- a/app/view/pad_closed.php
+++ b/app/view/pad_closed.php
@@ -64,7 +64,7 @@ require_once "view/issue.php";
 
                 <table class="table table-hover">
                     <?php foreach ($closed_issues as $i) { ?>
-                        <?=datalsts\issueListItem($i)?>
+                        <?=datalsts\issueListItem($i, false)?>
                     <?php } ?>
                 </table>
             </div>
-- 
cgit v1.2.3


From d554ce9e415c3d8ed1541e1c0bf507cf0b88b208 Mon Sep 17 00:00:00 2001
From: Malfurious <m@lfurio.us>
Date: Mon, 18 Oct 2021 19:27:27 -0400
Subject: Add stage/guid information to issue modal title bar

The previous patch removed the guid from the far left side of
issueListItem entries.  This patch makes that value visible again within
the popup issue modal window.

Additionally, the issue's current stage is displayed next to its name.
Viewing this info here is convenient, however this is mostly done in
anticipation of being able to access issues from the main user
dashboard, where pad stage context may be missing.

Signed-off-by: Malfurious <m@lfurio.us>
---
 app/view/issue.php | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

(limited to 'app')

diff --git a/app/view/issue.php b/app/view/issue.php
index 01a9f5f..4ca0e3b 100644
--- a/app/view/issue.php
+++ b/app/view/issue.php
@@ -51,6 +51,7 @@ require_once "class/issue.class.php";
 <?php function issue(\issue $i) : void { ?>
 
     <?php $m = $i->getOPMesg(); ?>
+    <?php $s = $i->getParent(); ?>
 
     <div id="issueModal-<?=$i->guid?>" class="modal fade" tabindex="-1" role="dialog">
         <div class="modal-dialog modal-lg" role="document">
@@ -61,9 +62,15 @@ require_once "class/issue.class.php";
                     </button>
 
                     <h4 class="modal-title">
-                        <span class="glyphicon glyphicon-inbox"></span>
-                        <?=$i->name?>
-                        <small>#<?=$i->numb?></small>
+                        <span class="glyphicon glyphicon-inbox"></span> <?=$i->name?>&nbsp;&nbsp;
+
+                        <small>
+                            <?php if ($s->objtype == "stage") { ?>
+                                <span class="glyphicon glyphicon-tasks"></span> <?=$s->name?>&nbsp;&nbsp;
+                            <?php } ?>
+
+                            #<?=$i->numb?> <?=$i->guid?>
+                        </small>
                     </h4>
                 </div>
 
-- 
cgit v1.2.3


From d74fcf9e8bfb15158fce16a9920ce638f4c675cf Mon Sep 17 00:00:00 2001
From: Malfurious <m@lfurio.us>
Date: Mon, 18 Oct 2021 19:42:58 -0400
Subject: Automatically call-up issue modal for newly-opened issues

This patch will cause the interface for new issues to be immediately
visible after page load on opening a new issue, as it is likely the user
may wish to perform some action on it.

This patch also fixes a bug which has previously prevented this from
being the default behavior.  The pad view's script imports have been
reordered such that all issue state manipulation is done and pushed to
the DB before any of the pad view page content is rendered.  This
prevents situations where the page would often load in a broken state
(the reason for the previous 'location()' call - to force a reload), and
enables us to use the new issue as the autoModal window as this patch
does.

Signed-off-by: Malfurious <m@lfurio.us>
---
 app/model/datamods.php | 2 +-
 app/view/pad.php       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

(limited to 'app')

diff --git a/app/model/datamods.php b/app/model/datamods.php
index 0b7f3da..b3384a7 100644
--- a/app/model/datamods.php
+++ b/app/model/datamods.php
@@ -114,7 +114,7 @@ if (isAction("dm-issue-add"))
     $issue = issue::initNew($mesg, $user, $stages[0]);
     $log = mesg::initNewLog("%s opened issue", $user, $issue);
 
-    location(); // bug mitigation
+    setAutoModal("#issueModal-" . $issue->guid);
 }
 
 ?>
diff --git a/app/view/pad.php b/app/view/pad.php
index 4408df2..f47b2e7 100644
--- a/app/view/pad.php
+++ b/app/view/pad.php
@@ -12,10 +12,10 @@
  * 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";
+require_once "model/pad.php";
 
 ?>
 
-- 
cgit v1.2.3


From a2f522583ef35e009f1f0be7086fc511d52c2b36 Mon Sep 17 00:00:00 2001
From: Malfurious <m@lfurio.us>
Date: Mon, 18 Oct 2021 20:14:26 -0400
Subject: Keep issue modal open after closing an issue

For consistency reasons, I've decided to keep the issue UI open even
after just closing an issue.  That is assuming the user used the modal
window to perform the close.  If an issue is closed via the quick control
buttons in the pad view page, no window is spawned since none was open
to begin with.

Other edge-cases that would interrupt the return of the issue modal have
also been removed.  For example, an informational message is no longer
produced when an attachment is successfully uploaded, and users are no
longer notified that an action resulted in an issue being closed.

Signed-off-by: Malfurious <m@lfurio.us>
---
 app/model/issue.php | 6 +++---
 app/model/pad.php   | 5 +++++
 2 files changed, 8 insertions(+), 3 deletions(-)

(limited to 'app')

diff --git a/app/model/issue.php b/app/model/issue.php
index 3f7b620..41392e8 100644
--- a/app/model/issue.php
+++ b/app/model/issue.php
@@ -49,7 +49,9 @@ if (isAction("iss-mesg-add"))
         $mesg = mesg::initNew($form->mesg, $user, $issue);
 
         if ($mesg->setAttachment("attachment"))
-            logError(NOTICE, "Saved attachment " . $mesg->attachment);
+        {
+            //logError(NOTICE, "Saved attachment " . $mesg->attachment);
+        }
     }
 
     if (isset(input()['advIssue']))
@@ -70,7 +72,6 @@ if (isAction("iss-mesg-add"))
         else
         {
             $issue->signoffAssignee($user);
-            logError(NOTICE, "Issue #" . $issue->numb . " closed");
             $log = mesg::initNewLog("%s closed issue", $user, $issue);
         }
     }
@@ -102,7 +103,6 @@ if (isAction("iss-mesg-add"))
 
         $issue->signoffAssignee($user);
         $issue->close($user);
-        logError(NOTICE, "Issue #" . $issue->numb . " closed");
         $log = mesg::initNewLog("%s closed issue", $user, $issue);
     }
 
diff --git a/app/model/pad.php b/app/model/pad.php
index e11a644..69f58e2 100644
--- a/app/model/pad.php
+++ b/app/model/pad.php
@@ -41,6 +41,11 @@ foreach ($stages as $s)
     $issues = array_merge($issues, $i);
 }
 
+/* this will include a 'just closed' issue on the main pad page, enabling it
+ * to be displayed via auto-modal */
+if (isset($_REQUEST['input']['issue']))
+    $issues[] = new issue($_REQUEST['input']['issue']);
+
 $closed_issues = $pad->getClosedIssues_ordByClosed();
 
 ?>
-- 
cgit v1.2.3