<?php
#
#   FILE:  SPT--PreviewMessage.php
#
#   FUNCTIONS PROVIDED:
#
#   FUNCTIONS EXPECTED:
#       DisplayAddButtons()
#           - display add, delete, cancel buttons
#
#   Part of the Scout Portal Toolkit
#   Copyright 2004 Internet Scout Project
#   http://scout.cs.wisc.edu
#

# ----- EXPORTED FUNCTIONS ---------------------------------------------------

function PrintResourceComments($PosterId, $PosterName, $PosterEmail)
{
    global $DB;

    $Comments = array();
    $DB->Query("SELECT * FROM Messages WHERE PosterId=".$PosterId);
    while ($Row = $DB->FetchRow() )
    {
        $Comments []= $Row;
    }

    # for each comment
    foreach ($Comments as $Comment)
    {
        # print comment
        PrintForumMessage(
            $Comment["Subject"],
            $Comment["Body"],
            $Comment["DatePosted"],
            $PosterName,
            $PosterEmail,
            FALSE,
            NULL,
            NULL,
            NULL,
            TRUE,
            NULL);
    }
}


# ----- LOCAL FUNCTIONS ------------------------------------------------------

# ----- MAIN -----------------------------------------------------------------

$PosterId   = intval($_GET["PosterId"]  );
$ResourceId = intval($_GET["ResourceId"]);

$DB->Query("SELECT UserName, EMail from APUsers WHERE "
           ."UserId=".$PosterId);
$Res = $DB->FetchRow();
$PosterName = $Res["UserName"];
$PosterEmail = $Res["EMail"];

if (!CheckAuthorization(PRIV_FORUMADMIN, PRIV_USERADMIN)) {  return;  }

PageTitle("Preview Message");

?>
