#!/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_main.pl
#
# Routines for printing to the main page
1; # Return true
sub Generate_Main_Page {
if ("$in{$CGI_SUB_SWITCH}" eq "$CGI_DEMO_INFO_FLAG") {
&Generate_Demo_Info_Page("$in{$CGI_DEMO_SWITCH}", "$in{$CGI_TREE_SWITCH}", 0);
} elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_HELP_FLAG") {
&Print_Help_Page;
} elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_SEARCH_FLAG") {
&Generate_Search_Page;
} elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_ADMIN_FLAG") {
&Generate_Admin_Page;
} else {
&Generate_Opening_Main_Page;
}
}
sub Generate_Admin_Page {
&Print_HTTP_Header("BLANK");
print "
\n";
print "\n";
print " |
\n";
&Print_Help_Page_Admin;
&Print_HTTP_Footer;
}
sub Generate_Opening_Main_Page {
&Print_Opening_Main_Page;
}
sub Generate_Demo_Info_Page {
if ( &Is_Real_Demo("$_[0]","$_[1]") ) {
&Print_Demo_Info_Page("$_[0]", "$_[1]");
} else {
&Print_Bad_Demo_Page($_[0]);
}
}
sub Print_Bad_Demo_Page {
&Print_HTTP_Header;
print "";
print "The Demo $_[0] does not exist. Please report this ";
print "bug in the interface.\n";
&Print_HTTP_Footer;
}
sub Is_Real_Demo {
return( &Is_Demo_In_Tree("$_[0]","$_[1]") );
}
sub Print_Demo_Info_Header {
&Print_HTTP_Header("BLANK", "$HTTP_YES_SCRIPT");
print "\n";
print "\n";
}
sub Print_Demo_Info_Page {
&Print_Demo_Info_Header;
$tree_path = &Tree_Path_From_Name("$_[1]");
&Parse_Demo_Info("$tree_path/$_[0]/$DEMOSRC_INDEX");
if ($_[2]) { print "\n"; }
else { print "\n"; }
print " \n";
print "\n";
print "
\n";
print "\n";
print "\n";
print "\n";
print "\n";
print " \n";
print " | \n";
print "\n";
print "$demo_info{'DESCRIPTION'} \n";
print " | \n";
print "\n";
print " \n";
print " | \n
\n
\n";
print "
\n";
# Only print this if there is information to put in it
if (grep(/\S+/, $demo_info{'AUTHOR'})) {
print "Author(s): $demo_info{'AUTHOR'}" if (grep(/\S+/, $demo_info{'AUTHOR'}));
}
print "
\n";
print "Quick Start:
\n";
print "
\n";
print "
\n\n\n";
print "$demo_info{'BRIEF_INSTRUCTIONS'} \n";
print " |
\n";
# Only print this if there is information to put in it
if (grep(/\S+/, $demo_info{'DETAILED_INSTRUCTIONS'})) {
print "\n";
print "
\n";
print "
\n";
print "More Details:
\n";
print "
\n";
print "\n";
print "$demo_info{'DETAILED_INSTRUCTIONS'} \n";
print " |
\n";
print "\n";
}
# Only print this if there is information to put in it
if (grep(/\S+/, $demo_info{'OTHER_INFORMATION'})) {
print "\n";
print "
\n";
print "
\n";
print "Other Information:\n";
print "
\n";
print "\n";
print "$demo_info{'OTHER_INFORMATION'} \n";
print " |
\n";
print "\n";
}
# Only print this if there is information to put in it
if (grep(/\S+/, $demo_info{'SYSTEM_REQS'})) {
print "\n";
print "
\n";
print "
\n";
print "System Requirements:\n";
print "
\n";
print "\n";
print "$demo_info{'SYSTEM_REQS'} \n";
print " |
\n";
print "\n";
}
print "\n";
print "
\n";
print "\n";
print "\n";
print "\n";
print "Features: \n";
print " | \n";
print "\n";
print "Industries: \n";
print " | \n";
print "\n";
print "Hardware: \n";
print " | \n";
print "
\n";
print "\n";
print "| \n";
&Print_Category_Links("FEATURES", "$CGI_FEATURES_FLAG", @features_categories);
print " | \n";
&Print_Category_Links("MARKETS", "$CGI_MARKETS_FLAG", @markets_categories);
print " | \n";
&Print_Category_Links("HARDWARE", "$CGI_HARDWARE_FLAG", @hardware_categories);
print " | \n";
print "
\n";
print "
\n";
print "\n";
&Print_HTTP_Footer;
}
sub Print_Category_Links {
local($category, $flag, @links);
$category = shift;
$flag = shift;
@links = split(/\n/, $demo_info{$category});
@links = &alpha(@links);
foreach $i ( 0 .. $#links ) {
if (grep(/$links[$i]/i, @_) && "$links[$i]" ne "") {
$link_http = &Insert_For_Space("$links[$i]", "$HTTP_NAME_DELIM");
print "";
print "\U$links[$i]\E
\n";
}
}
}
sub Print_Image_Script {
print "function SwitchImage( index , pic ) {\n";
print "\tdocument.images[index].src = pic\n";
print "}\n";
print "\n";
}
sub Print_Plugin_Script {
print <<_YAMAHA_IT200N_;
function initDisplay(Msg) {
// pluginOutput is the name of the frame which has been specified
// by the EMBED attribute called "PLUGINTARGET" for use with the
// demoUI plugin.
// This allows the target name of the frame the demoUI plugin
// sends it's output to, to be configurable.
//
// displayVar is the name of the variable that has been specified
// by the EMBED attribute called "JSVARNAME" for use with the demoUI
// plugin.
// This allows the variable name that holds the X DISPLAY value which
// the plugin sends it's output to, to be configurable.
//
dVar = null;
// is the demoUI mime type available to the browser?
mimetype=navigator.mimeTypes["application/demoUI"];
if(mimetype) {
// is this mimetype handled by a plugin, presumably mine?
pluginEnabled = mimetype.enabledPlugin;
if(pluginEnabled) {
// is a plugin loaded into the page
if(self.document.embeds.length == 1) {
// See what the plugin sent diag as the DISPLAY value
dVar = "" + parent.diag.displayVar;
if ( dVar == "undefined" ) {
dVar = null; // something went wrong, so set to null so parent will know
}
} else { self.location.reload() }
}
}
// send dVar value to parent so she can store it and I can go do other stuff
parent.storeDisplayValue(dVar);
} // end initDisplay()
_YAMAHA_IT200N_
}
sub Print_Opening_Main_Page {
&Print_HTTP_Header("BLANK", "$HTTP_YES_SCRIPT");
print "\n";
print "\n";
print "\n";
print "\n";
print " |
\n";
print "
\n";
print "
\n";
print "\n";
print "\n";
print <<_YAMAHA_YZ250_;