#!/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_side.pl # # Routines to manage the sidebar 1; # Return true sub Generate_Side_Page { if ($in{$CGI_BOTTOM_SIDE_SWITCH}) { if ("$in{$CGI_BOTTOM_SIDE_SWITCH}" eq "$CGI_ALL_DEMOS_FLAG") { &Print_List_All_Page; } elsif ("$in{$CGI_BOTTOM_SIDE_SWITCH}" eq "$CGI_FEATURES_FLAG") { &Print_Bottom_Category_Page("$CGI_FEATURES_FLAG", "$in{$CGI_CATEGORY_SWITCH}"); } elsif ("$in{$CGI_BOTTOM_SIDE_SWITCH}" eq "$CGI_MARKETS_FLAG") { &Print_Bottom_Category_Page("$CGI_MARKETS_FLAG", "$in{$CGI_CATEGORY_SWITCH}"); } elsif ("$in{$CGI_BOTTOM_SIDE_SWITCH}" eq "$CGI_HARDWARE_FLAG") { &Print_Bottom_Category_Page("$CGI_HARDWARE_FLAG", "$in{$CGI_CATEGORY_SWITCH}"); } elsif ("$in{$CGI_BOTTOM_SIDE_SWITCH}" eq "$CGI_CUSTOM_NAME_FLAG") { &Print_Bottom_Custom_Page; } else { &Print_List_All_In_Tree("$in{$CGI_BOTTOM_SIDE_SWITCH}"); } } elsif ($in{$CGI_TOP_SIDE_SWITCH}) { #if ("$in{$CGI_TOP_SIDE_SWITCH}" eq "$CGI_FEATURES_FLAG") { # &Print_Top_Category_Page("$CGI_FEATURES_FLAG", "$in{$CGI_CATEGORY_SWITCH}"); #} elsif ("$in{$CGI_TOP_SIDE_SWITCH}" eq "$CGI_MARKETS_FLAG") { # &Print_Top_Category_Page("$CGI_MARKETS_FLAG", "$in{$CGI_CATEGORY_SWITCH}"); #} elsif ("$in{$CGI_TOP_SIDE_SWITCH}" eq "$CGI_HARDWARE_FLAG") { # &Print_Top_Category_Page("$CGI_HARDWARE_FLAG", "$in{$CGI_CATEGORY_SWITCH}"); #} elsif ("$in{$CGI_TOP_SIDE_SWITCH}" eq "$CGI_CUSTOM_NAME_FLAG") { # &Print_Top_Custom_Page; #} else { &Print_Top_Tree_Menu("$in{$CGI_TOP_SIDE_SWITCH}"); #} } elsif ($in{$CGI_SUB_SWITCH}) { # Maybe the first 3 lines here can be removed if the bottom frame buttons are not used??? if ("$in{$CGI_SUB_SWITCH}" eq "$CGI_FEATURES_FLAG") { &Print_Two_Frames("$CGI_FEATURES_FLAG&$CGI_CATEGORY_SWITCH=$in{$CGI_CATEGORY_SWITCH}","$CGI_FEATURES_FLAG&$CGI_CATEGORY_SWITCH=$in{$CGI_CATEGORY_SWITCH}", &Side_Top_Length("$CGI_FEATURES_FLAG")); } elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_MARKETS_FLAG") { &Print_Two_Frames("$CGI_MARKETS_FLAG&$CGI_CATEGORY_SWITCH=$in{$CGI_CATEGORY_SWITCH}","$CGI_MARKETS_FLAG&$CGI_CATEGORY_SWITCH=$in{$CGI_CATEGORY_SWITCH}", &Side_Top_Length("$CGI_MARKETS_FLAG")); } elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_HARDWARE_FLAG") { &Print_Two_Frames("$CGI_HARDWARE_FLAG&$CGI_CATEGORY_SWITCH=$in{$CGI_CATEGORY_SWITCH}","$CGI_HARDWARE_FLAG&$CGI_CATEGORY_SWITCH=$in{$CGI_CATEGORY_SWITCH}", &Side_Top_Length("$CGI_HARDWARE_FLAG")); #} elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_CUSTOM_TOP_FLAG") { # &Generate_Custom_Top_Page; } elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_SEARCH_RESULT_FLAG") { &Generate_Search_Result_Page($in{$CGI_DEMO_LIST_SWITCH}); } elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_ADMIN_FLAG") { &Generate_Admin_Menu; } elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_HELP_FLAG") { &Generate_Help_Menu; } elsif ("$in{$CGI_SUB_SWITCH}" eq "$CGI_MAINT_FLAG") { &Print_Maint_Menu; } else { &Generate_Trees_Page("$CGI_ALL_DEMOS_FLAG",&Get_Default_List, &Side_Top_Length("$CGI_ALL_DEMOS_FLAG")); } } else { &Generate_Trees_Page("$CGI_ALL_DEMOS_FLAG", &Get_Default_List, &Side_Top_Length("$CGI_ALL_DEMOS_FLAG")); } } sub Generate_Trees_Page { # if (&Is_Multiple_Trees || &Is_Custom_List) { &Print_Two_Frames("$_[0]","$_[1]", "$_[2]"); # } else { # &Print_List_All_Page; # } } sub Generate_Admin_Menu { &Print_HTTP_Header; if ($_[0]) { $no_passwd = "&$CGI_MAINT_OUTSIDE_SWITCH=$CGI_MAINT_FALSE_FLAG"; } else { $no_passwd = ""; } local($help_page) = "$WWW_SCRIPT?$CGI_SWITCH=$FRAME_MAIN&$CGI_SUB_SWITCH=$CGI_ADMIN_FLAG"; print "\n"; print "

Administration topics

\n"; print "


\n"; print "\n"; print "\n"; print "
Do It!Info
\n"; print ""; print "\n"; print "\n"; print "\n"; print "Managing Custom Demo Lists
\n"; print "
\n"; print ""; print "\n"; print "\n"; print "\n"; print "Password Protection
\n"; print "
\n"; print ""; print "\n"; print "\n"; print "\n"; print "Edit Demo Information
\n"; print "
\n"; print ""; print "\n"; print "\n"; print "\n"; print "Add a Demo
\n"; print "
\n"; print ""; print "\n"; print "\n"; print "\n"; print "Add a Group of Demos
\n"; print "
\n"; print ""; print "\n"; print "\n"; print "\n"; print "Managing Categories
\n"; print "
\n"; print ""; print "\n"; print "\n"; print "\n"; print "Update Demo Tables
\n"; print "
\n"; print "


\n"; &Print_HTTP_Footer; } sub Print_Top_Custom_Page { &Print_Side_Bar_Header; print "\n"; &Parse_Name_Space; if ($MENU_USE_FORM) { print "
\n\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "
\n
\n"; } else { print "
CUSTOM LISTS
\n

\n"; for $list ( &alpha(keys(%name_space)) ) { print "\n"; print "$list\n\n

\n"; } print "


\n"; } &Print_HTTP_Footer; } sub Print_Bottom_Custom_Page { &Parse_Name_Space; if ($in{$CGI_CUSTOM_NAME_SWITCH}) { $list = $in{$CGI_CUSTOM_NAME_SWITCH}; } else { @lists = &alpha(keys(%name_space)); $list = $lists[0]; } &Parse_Name_Space; &Print_Side_Bar_Header; print "\n"; print "
$list
\n"; print "


\n"; print "\n"; print "\n"; local(@custom_demos) = &Demos_On_List("$list"); for (@custom_demos) { ($demo_name, $demo_tree) = split($TREES_DELIM, $_); &Print_Demo_Bullet("$demo_name", "$demo_tree") if ($demo_tree); } print "
Do It!Info
\n"; print "


\n"; &Print_HTTP_Footer; } sub Print_Top_Tree_Menu { &Print_Side_Bar_Header; print "\n"; &Parse_Name_Space; @list_names = &alpha(keys(%name_space)); @tree_names = &List_Tree_Names; push(@tree_names, @list_names); if ($MENU_USE_TREES_FORM) { print "\n"; print "

\n"; print "Show:
\n"; # print "\n"; print "
\n\n"; # print "
\n"; # Stop printing default button checkbox since that should go into admin page # print "Default\n"; print "\n"; print "
\n"; print "
\n"; } else { print "
TREES
\n

\n"; $bold = ("$CGI_ALL_DEMOS_FLAG" eq "$_[0]"); &Print_Top_Tree_Menu_Item("$CGI_ALL_DEMOS_FLAG", "All Demos", "$bold"); print "

\n"; for $tree_name (@tree_names) { $bold = ("$tree_name" eq "$_[0]"); &Print_Top_Tree_Menu_Item(&HTTP_Syntax($tree_name), "$tree_name", "$bold"); } print "


\n"; } &Print_HTTP_Footer; } sub Print_Top_Tree_Menu_Item { print "\n"; print ""; print "" if ($_[2]); print "$_[1]"; print "" if ($_[2]); print "\n
\n"; } sub Print_List_All_In_Tree { local(@demo_list); &Print_Side_Bar_Header; print "\n"; print "
$_[0]
\n"; print "


\n"; print "\n"; print "\n"; local($name) = $_[0]; if (grep(/^$name$/, &List_Tree_Names)) { @demo_list = &Demos_In_Tree("$name"); for $demo (@demo_list) { $demo = "$demo$TREES_DELIM$name"; } } else { &Parse_Name_Space; @demo_list = &Demos_On_List("$name"); } for (&alpha(@demo_list)) { ($demo, $tree) = split($TREES_DELIM, $_); &Print_Demo_Bullet("$demo", "$tree"); } print "
Do It!Info
\n"; print "


\n"; &Print_HTTP_Footer; } sub Side_Top_Length { if ("$_[0]" eq "$CGI_ALL_DEMOS_FLAG") { if ($MENU_USE_TREES_FORM) { return($MENU_FORM_SIZE); } else { return($MENU_DEFAULT_SIZE); } } elsif ($MENU_USE_FORM) { return($MENU_FORM_SIZE); } elsif ("$_[0]" eq "$CGI_CUSTOM_NAME_FLAG") { return($MENU_CUSTOM_SIZE); } elsif ("$_[0]" eq "$CGI_HARDWARE_FLAG") { return($MENU_HARDWARE_SIZE); } elsif ("$_[0]" eq "$CGI_MARKETS_FLAG") { return($MENU_MARKETS_SIZE); } elsif ("$_[0]" eq "$CGI_FEATURES_FLAG") { return($MENU_FEATURES_SIZE); } } sub Print_Two_Frames { local($top_frame, $bottom_frame, $length); $top_frame = shift; $bottom_frame = shift; $bottom_frame =~ s/ /+/g; $length = shift; &Print_HTTP_Header; print "\n"; print "\t\n"; print "\t\n"; print "\n"; &Print_HTTP_Footer; } sub Generate_Custom_Top_Page { &Parse_Name_Space; @lists = &List_Custom_Lists; if (&Number_Custom_Lists == 1) { &Print_Bottom_Custom_Page; } else { &Print_Two_Frames("$CGI_CUSTOM_NAME_FLAG","$CGI_CUSTOM_NAME_FLAG", &Side_Top_Length("$CGI_CUSTOM_NAME_FLAG")); } } sub Print_List_All_Page { local(@demo_list, $demo, $demo_name, $demo_tree); &Print_Side_Bar_Header; print "\n"; print "

All Demos
\n"; print "


\n"; print "\n"; print "\n"; @demo_list = &Demos_In_All_Trees; for $demo (@demo_list) { ($demo_name,$demo_tree) = split(/$TREES_DELIM/, $demo); &Print_Demo_Bullet("$demo_name", "$demo_tree"); } print "
Do It!Info
\n"; print "


\n"; &Print_HTTP_Footer; } sub Generate_Search_Result_Page { local(@match_demos); &Print_Side_Bar_Header; @match_demos = split(/$HTTP_DEMOS_DELIM/, $_[0]); print "\n"; print "

Search Results
\n"; print "


\n"; print "\n"; if ($#match_demos == -1) { print "\n"; } else { print "\n"; for $demo (@match_demos) { ($demo_name, $demo_tree) = split(/$HTTP_TREES_DELIM/, $demo); &Print_Demo_Bullet("$demo_name", "$demo_tree"); } } print "
Sorry!
No demo matching
that search criteria
found.
Do It!Info
\n"; print "


\n"; &Print_HTTP_Footer; } sub Print_Bottom_Category_Page { local($category_flag, @demos, $demo, $demo_name, $demo_tree); &Print_Category_Top($_[0]); print "


\n"; for $category (&alpha(keys(%demos_under))) { $category_flag = &Insert_For_Space("$category", "$HTTP_NAME_DELIM"); if ( ("$_[1]" eq "$CGI_ALL_DEMOS_FLAG") || ("$_[1]" eq "\U$category_flag\E") ) { @demos = split(/$TABLE_SECOND_DELIM/, $demos_under{$category}); print ""; print "$category


\n"; for $demo (@demos) { ($demo_name,$demo_tree) = split(/$TABLE_THIRD_DELIM/, $demo); &Print_Demo_Bullet($demo_name, $demo_tree); } print "
\n"; } } if ("$_[1]" eq "$CGI_ALL_DEMOS_FLAG") { print "
\n";
		for $i (0..$SIDE_EXTRA_LINES) {
			print "\n";
		}
		print "
\n"; } &Print_HTTP_Footer; } sub Print_Top_Category_Page { local($category, $category_flag); &Print_Category_Top($_[0]); if ($MENU_USE_FORM) { print "
\n\n"; print "
\n"; print "Select Industry" if ("$_[0]" eq "$CGI_MARKETS_FLAG"); print "Select Feature" if ("$_[0]" eq "$CGI_FEATURES_FLAG"); print "Select Hardware" if ("$_[0]" eq "$CGI_HARDWARE_FLAG"); print "
\n"; print "\n"; print "
\n"; print "
\n
\n"; } else { foreach $category (&alpha(keys(%demos_under))) { $category_flag = &Insert_For_Space("$category", "$HTTP_NAME_DELIM"); print ""; print "$category"; print "
\n"; } } &Print_HTTP_Footer; } sub Print_Category_Top { &Print_Side_Bar_Header; print "\n"; &Source_Table("$FILE_TABLE_FEATURES", @features_categories) if ("$_[0]" eq "$CGI_FEATURES_FLAG"); &Source_Table("$FILE_TABLE_MARKETS", @markets_categories) if ("$_[0]" eq "$CGI_MARKETS_FLAG"); &Source_Table("$FILE_TABLE_HARDWARE", @hardware_categories) if ("$_[0]" eq "$CGI_HARDWARE_FLAG"); } sub Print_Side_Bar_Header { &Print_HTTP_Header("BLANK", "$HTTP_YES_SCRIPT"); print "\n"; print "\n"; } sub Print_DblClick_Script { print "// Protect from double clicks. \n"; print "// c. Silicon Graphics Inc. \n"; print "// David J. Anderson (sprout\@whip.mti.sgi.com) \n\n"; print "var running = false\n"; print "var endTime = null\n"; print "var timerID = null\n"; print "var dblClickLen = $DOUBLE_CLICK_TIME;\n"; print "\n"; print "function safeGo( place ) {\n"; print "\tif (!running) {\n"; print "\t\tupdateLocation(place)\n"; print "\t}\n"; print "\trunning = true\n"; print "\tnow = new Date()\n"; print "\tnow = now.getTime()\n"; print "\tendTime = now + dblClickLen \n"; print "\tshowCountDown()\n"; print "}\n"; print "\n"; print "function updateLocation(newPlace) {\n"; # print "\tself.location = newPlace\n"; #good print "\tself.location.replace(newPlace)\n"; print "\ttop.frames[\"diag\"].location.replace(newPlace)\n"; print "}\n"; print "\n"; print "function showCountDown() {\n"; print "\tvar now = new Date()\n"; print "\tnow = now.getTime()\n"; print "\tif (endTime - now <= 0) {\n"; print "\t\tstopTimer()\n"; print "\t} else {\n"; print "\t\tvar delta = new Date(endTime - now)\n"; print "\t\tvar theDiff = delta.getTime()\n"; print "\t\tif (running) {\n"; print "\t\t\ttimerID = setTimeout(\"showCountDown()\", 1000)\n"; print "\t\t}\n"; print "\t}\n"; print "}\n"; print "\n"; print "function stopTimer() {\n"; print "\tclearTimeout(timerID)\n"; print "\trunning = false\n"; print "}\n"; print "\n"; } sub Is_Basically_Legal { local($dir) = shift; local($demo) = shift; local($isLegal) = true; chdir("$dir"); $isLegal = chdir("$dir/$demo"); $isLegal = ( (-x "$DEMOSRC_RUN") && ($isLegal) ); $isLegal = ( (-r "$DEMOSRC_DEMOPIC") && ($isLegal) ); $isLegal = ( (-r "$DEMOSRC_HEADER") && ($isLegal) ); $isLegal = ( (-r "$DEMOSRC_THUMBNAIL") && ($isLegal) ); $isLegal = ( (-r "$DEMOSRC_INDEX") && ($isLegal) ); return($isLegal); } sub Print_Demo_Bullet { local($tree_path); $tree_path = &Tree_Path_From_Name("$_[1]"); # Run a few file tests to make sure the demo is still there if ( &Is_Basically_Legal("$tree_path","$_[0]") ) { print ""; print "\n"; print ""; print "\n"; print "$_[0]
"; print "\n"; } else { # print "Demo $_[0] was skipped

\n"; &Print_Error("$ERROR_INFO", "Removing \"$_[0]\" from \"$_[1]\". Did not pass basic test of directory.", "$STATUS_MINOR"); # Update tables } }