Revision 2864
Added by sgarg almost 19 years ago
register-dataset.cgi | ||
---|---|---|
106 | 106 |
$config->define("deleteDataTemplate", { DEFAULT => 'crap.tmpl'} ); |
107 | 107 |
$config->define("modEmailNotificationTemplate", { DEFAULT => 'crap.tmpl'} ); |
108 | 108 |
$config->define("modResultTemplate", { DEFAULT => 'crap.tmpl'} ); |
109 |
$config->define("getReviewsTemplate", { DEFAULT => 'crap.tmpl'} ); |
|
109 | 110 |
$config->define("debug", { DEFAULT => '0'} ); |
110 | 111 |
$config->define("lat", { ARGCOUNT => ARGCOUNT_HASH} ); |
111 | 112 |
$config->define("lon", { ARGCOUNT => ARGCOUNT_HASH} ); |
... | ... | |
137 | 138 |
my $confirmDataTemplate = $config->confirmDataTemplate(); |
138 | 139 |
my $modEmailNotificationTemplate = $config->modEmailNotificationTemplate(); |
139 | 140 |
my $modResultTemplate = $config->modResultTemplate(); |
141 |
my $getReviewsTemplate = $config->getReviewsTemplate(); |
|
140 | 142 |
my $accesspubid = $config->accesspubid(); |
141 | 143 |
my $accesssysid = $config->accesssysid(); |
142 | 144 |
my $datasetpubid = $config->datasetpubid(); |
... | ... | |
2551 | 2553 |
my $username = $FORM::username; |
2552 | 2554 |
my $password = $FORM::password; |
2553 | 2555 |
|
2554 |
debug($username); |
|
2555 |
debug($password); |
|
2556 | 2556 |
my $metacat = Metacat->new(); |
2557 | 2557 |
if ($metacat) { |
2558 | 2558 |
$metacat->set_options( metacatUrl => $metacatUrl ); |
... | ... | |
2584 | 2584 |
$html .= "<input type=\"hidden\" name=\"password\" value=\"".$FORM::password."\" />"; |
2585 | 2585 |
$html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$FORM::cfg."\" />"; |
2586 | 2586 |
$html .= "</form></body></html>"; |
2587 |
debug($html); |
|
2588 |
debug($session->header()); |
|
2589 | 2587 |
print $session->header(); |
2590 | 2588 |
print $html; |
2591 | 2589 |
} else { |
... | ... | |
2638 | 2636 |
$html .= "<input type=\"hidden\" name=\"username\" value=\"".$uname."\" />"; |
2639 | 2637 |
$html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$FORM::cfg."\" />"; |
2640 | 2638 |
$html .= "</form></body></html>"; |
2641 |
debug($html); |
|
2642 | 2639 |
print($html); |
2643 | 2640 |
} |
2644 | 2641 |
} |
... | ... | |
2714 | 2711 |
} |
2715 | 2712 |
|
2716 | 2713 |
my $moderator = $session->param("moderator"); |
2717 |
if ( $moderator ne 'true') { |
|
2718 |
my $reviewHistory = getReviewHistoryHTML($session->param("username"), $session->param("password")); |
|
2719 |
if($reviewHistory eq ''){ |
|
2720 |
print "<br><br><br>No comments found"; |
|
2721 |
} else { |
|
2722 |
print $reviewHistory; |
|
2723 |
} |
|
2724 |
return; |
|
2714 |
|
|
2715 |
$$templateVars{'reviewdocid'} = getReviewHistoryHTML($session->param("username"), $session->param("password")); |
|
2716 |
$$templateVars{'docid'} = $FORM::docid; |
|
2717 |
debug("yooooooooooooo ".$$templateVars{'docid'}); |
|
2718 |
debug("yooooooooooooo ".$$templateVars{'reviewdocid'}); |
|
2719 |
if ( $moderator eq 'true') { |
|
2720 |
$$templateVars{'isModerator'} = "true"; |
|
2725 | 2721 |
} |
2726 |
|
|
2727 |
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"; |
|
2728 |
print "<html><head><META http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">"; |
|
2729 |
print "<link href=\"/style/skins/esa/esa.css\" type=\"text/css\" rel=\"stylesheet\"></head><body>"; |
|
2730 |
print getReviewHistoryHTML($session->param("username"), $session->param("password")); |
|
2731 |
print "<br><br><center><p class=\"sectionnames\">Moderator Actions</p>"; |
|
2732 |
print "<form target=\"_top\" id=\"reviewForm\" method=\"POST\" action=\"@cgi-prefix@/register-dataset.cgi\">"; |
|
2733 |
print "<input value=\"mod_accept\" name=\"stage\" type=\"hidden\">"; |
|
2734 |
print "<input value=\"esa\" name=\"cfg\" type=\"hidden\">"; |
|
2735 |
print "<input name=\"docid\" type=\"hidden\" value=\"".$FORM::docid."\">"; |
|
2736 |
print "<p>Comments:<br><textarea name=\"review\" rows=\"10\"></textarea></p>"; |
|
2737 |
print "<br><br><input name=\"Accept\" value=\" Accept \" type=\"SUBMIT\" onClick=\"this.parentNode.stage.value='mod_accept';\">"; |
|
2738 |
print "<br><br><input name=\"Decline\" value=\"Decline\" type=\"SUBMIT\" onClick=\"this.parentNode.stage.value='mod_decline';\">"; |
|
2739 |
print "<br><br><input name=\"Revise\" value=\" Revise \" type=\"SUBMIT\" onClick=\"this.parentNode.stage.value='mod_revise';\">"; |
|
2740 |
print "</form></center></body></html>"; |
|
2722 |
$template->process( $getReviewsTemplate, $templateVars); |
|
2741 | 2723 |
} |
2742 | 2724 |
|
2743 | 2725 |
sub getReviewHistoryHTML { |
... | ... | |
2771 | 2753 |
foreach $node ($findNodes->get_nodelist) { |
2772 | 2754 |
$reviewDocumentId = findValue($node,'docid'); |
2773 | 2755 |
} |
2774 |
|
|
2775 |
#update the old document |
|
2776 |
$response = $metacat->read($reviewDocumentId); |
|
2777 |
$doc = $response->content(); |
|
2778 |
$xmldoc = $parser->parse_string($doc); |
|
2779 |
|
|
2780 |
if ($xmldoc eq "" || $doc=~ /<error/){ |
|
2781 |
return " Unable to read the document from Metacat which has old reviews for the docid:".$docid; |
|
2782 |
} else { |
|
2783 |
my $findNodes = $xmldoc->findnodes('//reviewHistory/review'); |
|
2784 |
if($findNodes->size() > 0){ |
|
2785 |
# found contact email address |
|
2786 |
my $node = ''; |
|
2787 |
my $text = ''; |
|
2788 |
my $datetime = ''; |
|
2789 |
foreach $node ($findNodes->get_nodelist) { |
|
2790 |
$text = findValue($node,'text'); |
|
2791 |
$datetime = findValue($node,'datetime'); |
|
2792 |
|
|
2793 |
$reviewHTML .= "<tr><td>".$datetime."</td><td>".$text."</td></tr>"; |
|
2794 |
} |
|
2795 |
|
|
2796 |
$reviewHTML = "<table width=\"90%\" border=\"0\"> <tr><td>Time</td><td>Review</td></tr>".$reviewHTML."</table>"; |
|
2797 |
} |
|
2798 |
} |
|
2799 | 2756 |
} |
2800 | 2757 |
} |
2801 |
if ($reviewHTML ne ''){ |
|
2802 |
$reviewHTML = "<center>".$reviewHTML."</center>"; |
|
2803 |
} |
|
2804 |
|
|
2805 |
return $reviewHTML; |
|
2758 |
return $reviewDocumentId; |
|
2806 | 2759 |
} |
2807 | 2760 |
|
2808 | 2761 |
################################################################################ |
Also available in: Unified diff
Added template for getting the review