reportnode.php3 2.99 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
<?php
#
# Copyright (c) 2005-2013 University of Utah and the Flux Group.
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
#
include("defs.php3");
include_once("node_defs.php");

#
# Only known and logged in users.
#
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();

#
# Verify page arguments.
#
$reqargs = RequiredPageArguments("node",       PAGEARG_NODE);
$optargs = OptionalPageArguments("message",    PAGEARG_ANYTHING,
				 "canceled",   PAGEARG_STRING,
				 "send",       PAGEARG_STRING);

#
# Standard Testbed Header
#
PAGEHEADER("Report a Problem with a Node");

echo $node->PageHeader();
echo "<br>";

#
# We run this twice. The first time we are checking for a confirmation
# by putting up a form. The next time through the confirmation will be
# set. Or, the user can hit the cancel button, in which case we should
# probably redirect the browser back up a level.
#
if (isset($canceled) && $canceled) {
    echo "<center><h3>Problem report canceled!</h3>
          </center>\n";
    PAGEFOOTER();
    return;
}

if (!isset($send)) {
    $node_id = $node->node_id();
    $url = CreateURL("reportnode", $node);

    echo "<br>";
    echo "If you would like to report a problem with $node_id, please ";
    echo "use the box below to describe the problem, and someone from the ";
    echo "operations staff will get back to you shortly. Problems you should ";
    echo "report are hardware problems, connectivity problems, etc.";
    echo "<br><br>\n";
   
    echo "<form action='$url' method=post>\n";
    echo "<table border=1>\n";
    echo "  <tr><td><textarea rows=5 cols=60 name=message></textarea>
	      </td></tr>
	    <tr><td><center>\n";
    echo "    <input type=submit name=send value='Send Report'>\n";
    echo "    &nbsp; &nbsp;\n";
    echo "    <input type=submit name=canceled value=Cancel>\n";
    echo "    </center></td></tr>\n";
    echo "</table>\n";
    echo "</form>\n";

    PAGEFOOTER();
    return;
}

$node_id = $node->node_id();
$user_name  = $this_user->name();
$user_email = $this_user->email();

TBMAIL($TBMAIL_OPS,
       "Problem with $node_id - Please help!",
       "Hi. I am having a problem with $node_id.\n\n".
       "$message\n",
       "From: $user_name <$user_email>");

echo "<center><h2>Message sent!</h2>
      </center>\n";

#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>