From f06f8750688f95d37563b11c9255cd85e074a6e1 Mon Sep 17 00:00:00 2001
From: "Leigh B. Stoller" <stoller@flux.utah.edu>
Date: Wed, 27 Dec 2006 23:18:41 +0000
Subject: [PATCH] Add a Resend Project Approval link on the showproject page,
 since this is needed more then once a year.

---
 www/resendapproval.php | 71 ++++++++++++++++++++++++++++++++++++++++++
 www/showproject.php3   |  2 ++
 2 files changed, 73 insertions(+)
 create mode 100644 www/resendapproval.php

diff --git a/www/resendapproval.php b/www/resendapproval.php
new file mode 100644
index 0000000000..77d0dd0e38
--- /dev/null
+++ b/www/resendapproval.php
@@ -0,0 +1,71 @@
+<?php
+#
+# EMULAB-COPYRIGHT
+# Copyright (c) 2000-2003, 2005, 2006 University of Utah and the Flux Group.
+# All rights reserved.
+#
+include("defs.php3");
+
+#
+# Only known and logged in users can do this.
+#
+$this_user = CheckLoginOrDie();
+$uid       = $this_user->uid();
+$isadmin   = ISADMIN();
+
+PAGEHEADER("Resend Project Approval Message");
+
+if (!$isadmin) {
+    USERERROR("You do not have permission to access this page!", 1);
+}
+
+#
+# Verify form arguments.
+# 
+if (!isset($pid) ||
+    strcmp($pid, "") == 0) {
+    USERERROR("You must provide a Project ID.", 1);
+}
+
+#
+# Confirm target is a real project,
+#
+if (! ($target_project = Project::Lookup($pid))) {
+    USERERROR("The project $pid is not a valid project", 1);
+}
+if (! ($leader = $target_project->GetLeader())) {
+    TBERROR("Error getting leader for $pid", 1);
+}
+$headuid       = $leader->uid();
+$headuid_email = $leader->email();
+$headname      = $leader->name();
+
+TBMAIL("$headname '$headuid' <$headuid_email>",
+         "Project '$pid' Approval",
+         "\n".
+	 "This message is to notify you that your project '$pid'\n".
+	 "has been approved.  We recommend that you save this link so that\n".
+	 "you can send it to people you wish to have join your project.\n".
+	 "Otherwise, tell them to go to ${TBBASE} and join it.\n".
+	 "\n".
+	 "    ${TBBASE}/joinproject.php3?target_pid=$pid\n".
+         "\n".
+         "Thanks,\n".
+         "Testbed Operations\n",
+         "From: $TBMAIL_APPROVAL\n".
+         "Bcc: $TBMAIL_APPROVAL\n".
+         "Errors-To: $TBMAIL_WWW");
+
+echo "<center>
+      <h2>Done!</h2>
+      </center><br>\n";
+
+sleep(1);
+
+PAGEREPLACE(CreateURL("showproject", $target_project));
+
+#
+# Standard Testbed Footer
+# 
+PAGEFOOTER();
+?>
diff --git a/www/showproject.php3 b/www/showproject.php3
index 0aa747a5c8..f988903452 100644
--- a/www/showproject.php3
+++ b/www/showproject.php3
@@ -69,6 +69,8 @@ if ($isadmin) {
     WRITESUBMENUDIVIDER();
     WRITESUBMENUBUTTON("Delete this project",
 		       "deleteproject.php3?pid=$pid");
+    WRITESUBMENUBUTTON("Resend Approval Message",
+		       "resendapproval.php?pid=$pid");
 }
 
 SUBMENUEND();
-- 
GitLab