Files
resatennis_tyroltenn/www/cgi-bin/Demos/DEMO_maint.pl

212 lines
8.3 KiB
Perl
Executable File

#!/usr/sbin/perl
#**************************************************************************
#* *
#* Copyright (c) 1996 Silicon Graphics, Inc. *
#* All Rights Reserved *
#* *
#* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SGI *
#* *
#* The copyright notice above does not evidence any actual of intended *
#* publication of such source code, and is an unpublished work by Silicon *
#* Graphics, Inc. This material contains CONFIDENTIAL INFORMATION that is *
#* the property of Silicon Graphics, Inc. Any use, duplication or *
#* disclosure not specifically authorized by Silicon Graphics is strictly *
#* prohibited. *
#* *
#* RESTRICTED RIGHTS LEGEND: *
#* *
#* Use, duplication or disclosure by the Government is subject to *
#* restrictions as set forth in subdivision (c)(1)(ii) of the Rights in *
#* Technical Data and Computer Software clause at DFARS 52.227-7013, *
#* and/or in similar or successor clauses in the FAR, DOD or NASA FAR *
#* Supplement. Unpublished - rights reserved under the Copyright Laws of *
#* the United States. Contractor is SILICON GRAPHICS, INC., 2011 N. *
#* Shoreline Blvd., Mountain View, CA 94039-7311 *
#**************************************************************************
# DEMO_maint.pl
#
# Routines that route requests to perform maintenence
1; # Return true
sub Generate_Maint_Page {
if ( (&Passwd_Entered) && (!&Legal_Passwd) ) {
&Generate_Bad_Passwd_Page;
} elsif ( (&Is_Passwd) && (&Is_Help_Link) ) {
&Generate_Enter_Passwd_Page;
} elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_MAINT_ADD_TREE_FLAG") {
&Generate_Maint_Tree_Page;
} elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_MAINT_ELEMENTS_FLAG") {
&Generate_Maint_Cat_Page;
} elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_MAINT_UPDATE_FLAG") {
&Generate_Maint_Update_Page;
} elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_MAINT_PASSWD_FLAG") {
&Generate_Maint_Passwd_Page;
} elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_MAINT_CUSTOM_FLAG") {
&Generate_Maint_Custom_Page;
} elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_MAINT_UPDATE_FLAG") {
&Generate_Maint_Custom_Page;
} elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_MAINT_EDIT_FLAG") {
&Print_Edit_Front_Page;
} elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_MAINT_ADD_FLAG") {
&Generate_Maint_Add_Page;
} else {
&Print_Bad_Input_Page;
}
}
sub Is_Help_Link {
local($result);
$result = 1 unless ("$in{$CGI_MAINT_OUTSIDE_SWITCH}" eq "$CGI_MAINT_FALSE_FLAG");
return($result);
}
# sub Is_Passwd_Link {
# local($result);
# $result = 0 unless ("$in{$CGI_MAINT_PASSWD_SWITCH}" eq "$CGI_MAINT_TRUE_FLAG");
# return($result);
# }
sub Print_Maint_Top {
&Print_HTTP_Header("BLANK", "$HTTP_YES_SCRIPT");
print "<SCRIPT>\n";
print "<!-- \n";
print "function GoToHelp() {\n";
print "top.frames[\"$FRAME_MAIN\"].location = \"$WWW_SCRIPT?$CGI_SWITCH=$FRAME_MAIN&$CGI_SUB_SWITCH=$CGI_HELP_FLAG\" \n";
print "top.frames[\"$FRAME_SIDE\"].location = \"$WWW_SCRIPT?$CGI_SWITCH=$FRAME_SIDE&$CGI_SUB_SWITCH=$CGI_HELP_FLAG\" \n";
print "}\n";
print "function PopTreeView( tree_name ) {\n";
$url_new_win = "$WWW_SCRIPT?$CGI_SWITCH=$CGI_MAINT_FLAG&$CGI_SUB_SWITCH=$CGI_MAINT_ADD_TREE_FLAG";
$url_new_win .= "&$CGI_MAINT_OUTSIDE_SWITCH=$CGI_MAINT_FALSE_FLAG&$CGI_TREE_VIEW_SWITCH=";
print "win_url = \"$url_new_win\" + tree_name\n";
print "myDate = new Date()\n";
print "window.open(win_url, myDate.getTime(), \"scrollbars,width=$FRAME_SIDE_WIDTH\")\n";
print "return false\n";
print "}\n";
print "function PopCustomView( custom_name ) {\n";
$url_new_win = "$WWW_SCRIPT?$CGI_SWITCH=$CGI_MAINT_FLAG&$CGI_SUB_SWITCH=$CGI_MAINT_CUSTOM_FLAG";
$url_new_win .= "&$CGI_MAINT_OUTSIDE_SWITCH=$CGI_MAINT_FALSE_FLAG&$CGI_CUSTOM_VIEW_SWITCH=";
print "win_url = \"$url_new_win\" + custom_name\n";
print "myDate = new Date()\n";
print "window.open(win_url, myDate.getTime(), \"scrollbars,width=$FRAME_SIDE_WIDTH\")\n";
print "return false\n";
print "}\n";
print "\n";
print "function ClickUpdateTables() {\n";
$refreshString = "$WWW_SCRIPT?";
$refreshString .= "$CGI_SWITCH=$FRAME_DIAG&$CGI_SUB_SWITCH=$CGI_UPDATE_FLAG";
$refreshString .= "&$CGI_NOTIFY_SWITCH=$CGI_TRUE_FLAG";
print "\tparent.frames[\"$FRAME_DIAG\"].location = \"$refreshString\"\n";
print "}\n";
print "\n";
print "function cancelCustom() {\n";
print "\twindow.location = \"$WWW_SCRIPT?$CGI_SWITCH=$CGI_MAINT_FLAG&$CGI_SUB_SWITCH=$CGI_MAINT_CUSTOM_FLAG&$CGI_MAINT_OUTSIDE_SWITCH=$CGI_MAINT_FALSE_FLAG\"\n";
print "}\n";
print "\n";
print "function confirmDelete(victim_name) {\n";
print "\treturn window.confirm(\"Delete \\\" \" + victim_name + \"\\\"?\")\n";
print "}\n";
print "\n";
print "function removeCat(this_form , remove_location) {\n";
print "if (this_form.$CGI_CAT_SELECT_SWITCH.selectedIndex != -1) {\n";
print "\nvar val = this_form.$CGI_CAT_SELECT_SWITCH.options[this_form.$CGI_CAT_SELECT_SWITCH.selectedIndex].value\n";
print "if (val != \"$CAT_DO_NOTHING\") {\n";
print "\tif (confirmDelete(val)) {\n";
print "\t\tvar tmp = remove_location + \"$CGI_CAT_REMOVE_SWITCH=\" + escape(val)\n";
print "\t\tself.location = tmp\n";
print "\t} \n";
print "\t}\n";
print "}\n";
print "}\n";
print "\n";
print "function newCat(this_form , new_location) {\n";
print "var name = prompt(\"New category name:\", \"\")\n";
print "if (name != null && name != \"\") {\n";
print "\tvar tmp = new_location + \"$CGI_CAT_ADD_SWITCH=\" + escape(name)\n";
print "\tself.location = tmp\n";
print "\t}\n";
print "}\n";
print "\n";
print "function changeCat(this_form , new_location) {\n";
print "if (this_form.$CGI_CAT_SELECT_SWITCH.selectedIndex != -1) {\n";
print "\nvar val = this_form.$CGI_CAT_SELECT_SWITCH.options[this_form.$CGI_CAT_SELECT_SWITCH.selectedIndex].value\n";
print "if (val != \"$CAT_DO_NOTHING\") {\n";
print "\tvar name = prompt(\"Change category \\\"\" + val + \"\\\" to:\", \"\")\n";
print "\tif (name != null && name != \"\") {\n";
print "\t\tvar tmp = new_location + \"$CGI_CAT_NAME_SWITCH=\" + escape(name) + \"&$CGI_CAT_NAME_OLD_SWITCH=\" + escape(val)\n";
print "\t\tself.location = tmp\n";
print "\t\t}\n";
print "\t}\n";
print "}\n";
print "}\n";
print "\n";
&Print_DblClick_Script;
print "\n";
if ((&Is_Help_Link || $LEGAL_PASSWD) && (!$_[2])) {
print "// -->\n";
print "</SCRIPT>\n";
print "</head>\n";
print "<body bgcolor=\"white\">\n";
} elsif ($_[3]) {
print "function UpdateToc() {\n";
print "top.frames[\"$FRAME_TOC\"].location = \"$WWW_SCRIPT?$CGI_SWITCH=$FRAME_TOC\" \n";
print "}\n";
print "// -->\n";
print "</SCRIPT>\n";
print "</head>\n";
print "<body onLoad=\"UpdateToc()\" bgcolor=\"white\">\n";
} elsif ($_[4]) {
print "function UpdateTables() {\n";
$refreshString = "$WWW_SCRIPT?";
$refreshString .= "$CGI_SWITCH=$FRAME_DIAG&$CGI_SUB_SWITCH=$CGI_UPDATE_FLAG";
$refreshString .= "&$CGI_NOTIFY_SWITCH=$CGI_TRUE_FLAG";
print "\tparent.frames[\"$FRAME_DIAG\"].location = \"$refreshString\"\n";
print "}\n";
print "// -->\n";
print "</SCRIPT>\n";
print "</head>\n";
print "<body onLoad=\"UpdateTables()\" bgcolor=\"white\">\n";
} else {
print "// -->\n";
print "</SCRIPT>\n";
print "</head>\n";
print "<body bgcolor=\"white\">\n";
}
if ($_[1]) {
print "<table width=100%><tr><td align=right><img src=\"$_[1]\"></td></tr></table>\n";
} else {
print "<table width=100%><tr><td align=right><img src=\"$IMGSRC_HEADER_MAINT\"></td></tr></table>\n";
}
print "<center>\n";
print "<h2>$_[0]</h2>\n";
print "</center>\n";
print "<p>";
# print "<hr>\n";
print "<p>\n";
print "<center>\n";
print "<table width=100%>\n";
print "<tr>\n";
print "<td>\n";
print "<hr NOSHADE>\n";
}
sub Print_Maint_Bottom {
print "</td></tr>\n";
print "</table>\n";
print "</center>\n";
}
sub Print_Look_At_Help {
print "<hr noshade>\n";
}
sub Print_Maint_Menu {
&Generate_Help_Menu(1);
}