<?PHP

#
#   FILE:  SPT--Home.html
#
#   Part of the Collection Workflow Integration System (CWIS)
#   Copyright 2013 Edward Almasy and Internet Scout Research Group
#   http://scout.wisc.edu/cwis/
#
function PrintAnnouncementRow(
        $Headline, $DatePosted, $PosterName, $Text, $EditOkay, $EditLink)
{
?>

<div class="Announcement">
	<div class="AnnouncementHeadline">
		<?php  if ($EditOkay) {  ?>
			<a href="<?PHP  print($EditLink);  ?>" class="EditButton">Edit</a>
		<?php  } ?>
		<?PHP  print($Headline);  ?>
	</div>
	<div class="AnnouncementInfo">
		Posted <?php  print($DatePosted);  ?> by <?php  print($PosterName);  ?>
	</div>
	<div class="AnnouncementText"><?PHP  print($Text);  ?></div>
</div>
<?PHP
}

function PrintNoAnnouncementsMessage()
{
?>
    No new announcements.
<?PHP
}

function PrintNewResourceRow($Fields, $FullRecordLink, $EditOkay, $EditLink,
                             $CumulativeRating)
{
    PrintResource($Fields, $FullRecordLink, $EditOkay, $EditLink,
                  $CumulativeRating);
}

function PrintNoResourcesMessage()
{

?>
    No new resources.
<?PHP
}
?>

<br>
<!-- ANNOUNCEMENTS -->
<?PHP if(AnnouncementsEnabled()) { ?>
<div class="BodyDiv">
<div class="BodyDivTop">
	<?php
	    if ( $User->HasPriv(PRIV_NEWSADMIN) &&
	        ((NumAnnouncementRows() < $SysConfig->NumAnnounceOnHomePage())
	        || !SoftwareIsCWIS()) )
	    {
	?>
	    <a href="index.php?P=EditAnnouncement" class="EditButton">Add</a>
	<?php
	    }
	?>
	Announcements
</div>
<?php  PrintAnnouncementsTableRows();  ?>

<?PHP
    if( !SoftwareIsCWIS() )
    {
?>
    <?PHP
    if(PreviousAnnouncementsAvailable())
    {
    ?>
        <a href="<?PHP PrintPrevAnnouncementLink(); ?>">Previous <?PHP PrintNumberOfAnnouncements(); ?> announcements</a>
    <?PHP
    }
    if(NextAnnouncementsAvailable())
    {
    ?>
        <a href="<?PHP PrintNextAnnouncementLink(); ?>">Next <?PHP PrintNumberOfAnnouncements(); ?> announcements</a>
    <?PHP
    }
    ?>
<?PHP
}
?>
    </div>

<?PHP } ?>
<!-- NEW RESOURCES -->
<div class="BodyDiv">
<div class="BodyDivTop">
	<?php  if ($User->HasPriv(PRIV_RESOURCEADMIN)) {  ?> <a href="index.php?P=DBEntry" class="EditButton">Add</a><?php  } ?> New Resources
</div>
	<?php  PrintNewResourceTableRows();  ?>
<?PHP
if(NextResourcesAvailable())
{
?>
    <a href="<?PHP PrintNextResourceLink(); ?>">Previous <?PHP PrintNumberOfResources(); ?> resources</a>
<?PHP
}
if(PreviousResourcesAvailable())
{
?>
    <a href="<?PHP PrintPrevResourceLink(); ?>">Next <?PHP PrintNumberOfResources(); ?>  resources</a>
<?PHP
}
?>
</div>

