From f7c7d7e3ee6e2e7c701c0d1c13f9a1662fc4278e Mon Sep 17 00:00:00 2001 From: Alexander Davis Date: Mon, 10 Aug 2020 15:30:11 +0100 Subject: [PATCH 1/5] Basic UI @luketainton please edit lines 120-140 on the editsub and managesub files --- app/public/editsub.php | 154 ++++++++++++++++++++++++++++++++++++ app/public/managesub.php | 165 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 319 insertions(+) create mode 100644 app/public/editsub.php create mode 100644 app/public/managesub.php diff --git a/app/public/editsub.php b/app/public/editsub.php new file mode 100644 index 0000000..127379c --- /dev/null +++ b/app/public/editsub.php @@ -0,0 +1,154 @@ + + + + + +
+ + +
+
+ +
+
+ +
+
+

+

+

+
+
+
+
+
+
+
+
Information
+
    +
  • +
    +
    + Status: + +
    +
    +
  • +
  • +
    +
    + Created by: + +
    +
    +
  • +
  • +
    +
    + Assigned to: + " . get_user_name($db, $request['assignee']) . ""); + } else { + echo("None"); + } ?> +
    +
    +
  • +
  • +
    +
    + Created: + +
    +
    +
  • +
  • +
    +
    + Last updated: + +
    +
    +
  • +
+
+
+ +
+
+
Updates
+
    + No updates"); + } else { + foreach($updates as $update) { + ?> +
  • +
    +
    + +
    +
    + +
    +
    +
  • + +
+
+
+ +
+
+
+ +
+
+
+
+
+
Edit Subscriber
+
+
+ +
+
+ + + Cancel +
+
+
+
+
+
+
+ + +
+
+

You are not authorised to see this page.

+
+
+ + +
+ + diff --git a/app/public/managesub.php b/app/public/managesub.php new file mode 100644 index 0000000..238e5f3 --- /dev/null +++ b/app/public/managesub.php @@ -0,0 +1,165 @@ + + + + + +
+ + +
+
+ +
+
+ +
+
+

+

+

+
+
+
+
+
+
+
+
Information
+
    +
  • +
    +
    + Status: + +
    +
    +
  • +
  • +
    +
    + Created by: + +
    +
    +
  • +
  • +
    +
    + Assigned to: + " . get_user_name($db, $request['assignee']) . ""); + } else { + echo("None"); + } ?> +
    +
    +
  • +
  • +
    +
    + Created: + +
    +
    +
  • +
  • +
    +
    + Last updated: + +
    +
    +
  • +
+
+
+ +
+
+
Updates
+
    + No updates"); + } else { + foreach($updates as $update) { + ?> +
  • +
    +
    + +
    +
    + +
    +
    +
  • + +
+
+
+ +
+
+
+ +
+
+
+
+ Request Subscribers +
+ +
+
+ + + + +
+
+

You are not authorised to see this page.

+
+
+ + +
+ + -- 2.49.1 From 48d5b2ee7362531f0ac77b5b229da980ce31f47f Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Mon, 10 Aug 2020 16:00:27 +0100 Subject: [PATCH 2/5] :sparkles: Add subscription management Signed-off-by: Luke Tainton --- app/includes/app_functions.php | 13 +++++ app/public/actions/addsub.php | 30 ++++++++++ app/public/actions/delsub.php | 30 ++++++++++ app/public/managesub.php | 102 ++++++++++++++++----------------- 4 files changed, 121 insertions(+), 54 deletions(-) create mode 100644 app/public/actions/addsub.php create mode 100644 app/public/actions/delsub.php diff --git a/app/includes/app_functions.php b/app/includes/app_functions.php index 4011194..6d7bf28 100644 --- a/app/includes/app_functions.php +++ b/app/includes/app_functions.php @@ -1,4 +1,17 @@ prepare($stmt); + $sql->execute(); + $sql->setFetchMode(PDO::FETCH_ASSOC); + $result = $sql->fetchAll(); + } catch (PDOException $e) { + echo("Error: " . $e->getMessage()); + } + return $result; + } + function get_user_name($db, $user_uuid) { try { $stmt = "SELECT given_name, family_name FROM users WHERE uuid=:uuid"; diff --git a/app/public/actions/addsub.php b/app/public/actions/addsub.php new file mode 100644 index 0000000..6a18db0 --- /dev/null +++ b/app/public/actions/addsub.php @@ -0,0 +1,30 @@ +prepare($stmt); + $sql->bindParam(':tktuuid', $request['uuid']); + $sql->bindParam(':usruuid', $POST['addSubSelector']); + $sql->execute(); + } catch (PDOException $e) { + $alert = array("danger", "Failed to add subscriber: " . $e->getMessage()); + } + } + $newURL = "/managesub?rid=" . $request['uuid']; + echo(""); + } else { + $alert = array("danger", "You are not authorised to manage subscribers on this request."); + $newURL = "/managesub?rid=" . $request['uuid']; + echo(""); + } + +?> diff --git a/app/public/actions/delsub.php b/app/public/actions/delsub.php new file mode 100644 index 0000000..f4ed389 --- /dev/null +++ b/app/public/actions/delsub.php @@ -0,0 +1,30 @@ +prepare($stmt); + $sql->bindParam(':tktuuid', $request['uuid']); + $sql->bindParam(':usruuid', $POST['addSubSelector']); + $sql->execute(); + } catch (PDOException $e) { + $alert = array("danger", "Failed to remove subscriber(s): " . $e->getMessage()); + } + } + $newURL = "/managesub?rid=" . $request['uuid']; + echo(""); + } else { + $alert = array("danger", "You are not authorised to manage subscribers on this request."); + $newURL = "/managesub?rid=" . $request['uuid']; + echo(""); + } + +?> diff --git a/app/public/managesub.php b/app/public/managesub.php index 238e5f3..e403603 100644 --- a/app/public/managesub.php +++ b/app/public/managesub.php @@ -1,11 +1,12 @@ @@ -38,7 +39,9 @@
-
Information
+
+ Information +
  • @@ -90,66 +93,57 @@
    -
    Updates
    +
    + Manage Subscribers +
      - No updates"); - } else { - foreach($updates as $update) { - ?> -
    • -
      -
      - -
      -
      - -
      +
    • +
      +
      +
      +
      + + + +
      + +
      -
    • - +
    +
  • +
  • +
    +
    +
    +
    + + + +
    + +
    +
    +
    +
-
-
-
-
-
- Request Subscribers -
- -
-
- - -
-- 2.49.1 From 244e03adee90c17bb292a0062788c35c6c098e56 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Mon, 10 Aug 2020 16:00:27 +0100 Subject: [PATCH 3/5] :sparkles: Add subscription management Signed-off-by: Luke Tainton --- app/includes/app_functions.php | 13 +++++ app/public/actions/addsub.php | 30 ++++++++++ app/public/actions/delsub.php | 30 ++++++++++ app/public/managesub.php | 102 ++++++++++++++++----------------- 4 files changed, 121 insertions(+), 54 deletions(-) create mode 100644 app/public/actions/addsub.php create mode 100644 app/public/actions/delsub.php diff --git a/app/includes/app_functions.php b/app/includes/app_functions.php index 4011194..6d7bf28 100644 --- a/app/includes/app_functions.php +++ b/app/includes/app_functions.php @@ -1,4 +1,17 @@ prepare($stmt); + $sql->execute(); + $sql->setFetchMode(PDO::FETCH_ASSOC); + $result = $sql->fetchAll(); + } catch (PDOException $e) { + echo("Error: " . $e->getMessage()); + } + return $result; + } + function get_user_name($db, $user_uuid) { try { $stmt = "SELECT given_name, family_name FROM users WHERE uuid=:uuid"; diff --git a/app/public/actions/addsub.php b/app/public/actions/addsub.php new file mode 100644 index 0000000..6a18db0 --- /dev/null +++ b/app/public/actions/addsub.php @@ -0,0 +1,30 @@ +prepare($stmt); + $sql->bindParam(':tktuuid', $request['uuid']); + $sql->bindParam(':usruuid', $POST['addSubSelector']); + $sql->execute(); + } catch (PDOException $e) { + $alert = array("danger", "Failed to add subscriber: " . $e->getMessage()); + } + } + $newURL = "/managesub?rid=" . $request['uuid']; + echo(""); + } else { + $alert = array("danger", "You are not authorised to manage subscribers on this request."); + $newURL = "/managesub?rid=" . $request['uuid']; + echo(""); + } + +?> diff --git a/app/public/actions/delsub.php b/app/public/actions/delsub.php new file mode 100644 index 0000000..f4ed389 --- /dev/null +++ b/app/public/actions/delsub.php @@ -0,0 +1,30 @@ +prepare($stmt); + $sql->bindParam(':tktuuid', $request['uuid']); + $sql->bindParam(':usruuid', $POST['addSubSelector']); + $sql->execute(); + } catch (PDOException $e) { + $alert = array("danger", "Failed to remove subscriber(s): " . $e->getMessage()); + } + } + $newURL = "/managesub?rid=" . $request['uuid']; + echo(""); + } else { + $alert = array("danger", "You are not authorised to manage subscribers on this request."); + $newURL = "/managesub?rid=" . $request['uuid']; + echo(""); + } + +?> diff --git a/app/public/managesub.php b/app/public/managesub.php index 238e5f3..e403603 100644 --- a/app/public/managesub.php +++ b/app/public/managesub.php @@ -1,11 +1,12 @@ @@ -38,7 +39,9 @@
-
Information
+
+ Information +
  • @@ -90,66 +93,57 @@
    -
    Updates
    +
    + Manage Subscribers +
      - No updates"); - } else { - foreach($updates as $update) { - ?> -
    • -
      -
      - -
      -
      - -
      +
    • +
      +
      +
      +
      + + + +
      + +
      -
    • - +
    +
  • +
  • +
    +
    +
    +
    + + + +
    + +
    +
    +
    +
-
-
-
-
-
- Request Subscribers -
- -
-
- - -
-- 2.49.1 From ba5e020d600285b309c6698ab0173f3d86422f83 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Mon, 10 Aug 2020 16:05:12 +0100 Subject: [PATCH 4/5] :bug: Fix incorrect POST variable and add foreach() Signed-off-by: Luke Tainton --- app/public/actions/delsub.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/public/actions/delsub.php b/app/public/actions/delsub.php index f4ed389..917e59a 100644 --- a/app/public/actions/delsub.php +++ b/app/public/actions/delsub.php @@ -9,14 +9,16 @@ // Add subscriber if ($is_authorised == true) { if($_SERVER['REQUEST_METHOD'] == 'POST') { - try { - $stmt = "DELETE FROM ticket_subscribers WHERE ticket_uuid=:tktuuid AND user_uuid=:usruuid"; - $sql = $db->prepare($stmt); - $sql->bindParam(':tktuuid', $request['uuid']); - $sql->bindParam(':usruuid', $POST['addSubSelector']); - $sql->execute(); - } catch (PDOException $e) { - $alert = array("danger", "Failed to remove subscriber(s): " . $e->getMessage()); + foreach ($_POST['addSubSelector'] as $sub) { + try { + $stmt = "DELETE FROM ticket_subscribers WHERE ticket_uuid=:tktuuid AND user_uuid=:usruuid"; + $sql = $db->prepare($stmt); + $sql->bindParam(':tktuuid', $request['uuid']); + $sql->bindParam(':usruuid', $sub); + $sql->execute(); + } catch (PDOException $e) { + $alert = array("danger", "Failed to remove subscriber(s): " . $e->getMessage()); + } } } $newURL = "/managesub?rid=" . $request['uuid']; -- 2.49.1 From 27cd8d168d616f4e26b0e06490e65d964b92e23a Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Mon, 10 Aug 2020 16:09:34 +0100 Subject: [PATCH 5/5] :art: Fix file names and add link on view.php Signed-off-by: Luke Tainton --- app/public/editsub.php | 91 ++++++++++--------- app/public/{managesub.php => editsub.php.old} | 91 +++++++++---------- app/public/view.php | 5 +- 3 files changed, 94 insertions(+), 93 deletions(-) rename app/public/{managesub.php => editsub.php.old} (62%) diff --git a/app/public/editsub.php b/app/public/editsub.php index 127379c..e403603 100644 --- a/app/public/editsub.php +++ b/app/public/editsub.php @@ -1,11 +1,12 @@ @@ -38,7 +39,9 @@
-
Information
+
+ Information +
  • @@ -90,51 +93,53 @@
    -
    Updates
    +
    + Manage Subscribers +
      - No updates"); - } else { - foreach($updates as $update) { - ?> -
    • -
      -
      - -
      -
      - -
      +
    • +
      +
      +
      +
      + + + +
      + +
      -
    • - +
    +
  • +
  • +
    +
    +
    +
    + + + +
    + +
    +
    +
    +
- -
-
-
- -
-
-
-
-
-
Edit Subscriber
-
-
- -
-
- - - Cancel -
-
-
-
diff --git a/app/public/managesub.php b/app/public/editsub.php.old similarity index 62% rename from app/public/managesub.php rename to app/public/editsub.php.old index e403603..127379c 100644 --- a/app/public/managesub.php +++ b/app/public/editsub.php.old @@ -1,12 +1,11 @@ @@ -39,9 +38,7 @@
-
- Information -
+
Information
  • @@ -93,53 +90,51 @@
    -
    - Manage Subscribers -
    +
    Updates
      -
    • -
      -
      -
      -
      - - - -
      - -
      + No updates"); + } else { + foreach($updates as $update) { + ?> +
    • +
      +
      + +
      +
      + +
      -
    -
  • -
  • -
    -
    -
    -
    - - - -
    - -
    -
    -
    -
  • + +
+ +
+ + + +
+
+
+
+
+
Edit Subscriber
+
+
+ +
+
+ + + Cancel +
+
+
+
diff --git a/app/public/view.php b/app/public/view.php index 65bb1e6..6d58f22 100644 --- a/app/public/view.php +++ b/app/public/view.php @@ -53,8 +53,9 @@

Update the request - Add attachment(s) - + Add attachment(s) + Manage subscribers +

-- 2.49.1