#!/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_add.pl # # Routines to add or edit demos 1; # return true # INPUT: %in {global} # Based on the CGI input, we can take the appropriate actions and generate # the appropriate pages. sub Generate_Maint_Add_Page { if ($in{$CGI_ADD_NAME_SWITCH}) { if ($in{$CGI_ADD_WRITE_SWITCH}) { &Generate_Example_Page; } else { &Generate_Edit_Info_Page("$in{$CGI_ADD_NAME_SWITCH}","$in{$CGI_TREE_SWITCH}"); } } else { # Print the default top level page &Print_Add_Front_Page; } } # INPUT: %in # Given the user input to the add/edit forms page, take the following actions # - Create header image with the demos title on top # - Write a new .index file # - Update the tables in the background # - Notify user that we are updating tables # - Print a message to the error log # - Finally, display what the page will look like sub Generate_Example_Page { $tree_path = &Tree_Path_From_Name("$in{$CGI_TREE_SWITCH}"); &Create_Header_Image; &Write_Index_File; &Update_Tables; # &Notify_User; &Print_Error("$ERROR_INFO","Added $in{$CGI_ADD_NAME_SWITCH} to interface.","$STATUS_MINOR"); &Display_Example_Page; } # INPUT: %in # After add/editing a page, display it by calling a routine from DEMO_main.pl sub Display_Example_Page { &Print_Demo_Info_Page($in{$CGI_ADD_NAME_SWITCH}, $in{$CGI_TREE_SWITCH}, 1); } # INPUT: # Notify the user about updating tables by calling routine from DEMO_pop.pl sub Notify_User { &Pop("Updating Demo Information", "$FILE_UPDATE_NOTIFY") if ($NOTIFY_USER); } # INPUT: %in # Write user input data to the .index file of a demo sub Write_Index_File { open(INDEX, ">$tree_path/$in{$CGI_ADD_NAME_SWITCH}/$DEMOSRC_INDEX"); select(INDEX); print "MARKETS:\n"; print "$in{'MARKETS'}\n"; print "END_MARKETS\n"; print "\n"; print "FEATURES:\n"; print "$in{'FEATURES'}\n"; print "END_FEATURES\n"; print "\n"; print "HARDWARE:\n"; print "$in{'HARDWARE'}\n"; print "END_HARDWARE\n"; print "\n"; print "OTHER_INFORMATION:\n"; print "$in{'OTHER_INFORMATION'}\n"; print "END_OTHER_INFORMATION\n"; print "\n"; print "TITLE:\n"; print "$in{'TITLE'}\n"; print "END_TITLE\n"; print "\n"; print "AUTHOR:\n"; print "$in{'AUTHOR'}\n"; print "END_AUTHOR\n"; print "\n"; print "DESCRIPTION:\n"; print "$in{'DESCRIPTION'}\n"; print "END_DESCRIPTION\n"; print "\n"; print "BRIEF_INSTRUCTIONS:\n"; print "$in{'BRIEF_INSTRUCTIONS'}\n"; print "END_BRIEF_INSTRUCTIONS\n"; print "\n"; print "DETAILED_INSTRUCTIONS:\n"; print "$in{'DETAILED_INSTRUCTIONS'}\n"; print "END_DETAILED_INSTRUCTIONS\n"; print "\n"; print "SYSTEM_REQS:\n"; print "$in{'SYSTEM_REQS'}\n"; print "END_SYSTEM_REQS\n"; print "\n"; print "END_HTMLUI\n"; print "# Information in this section is either not used by\n"; print "# the HTML interface or is misformatted and can't\n"; print "# be read by the HTML interface.\n"; print "#\n"; print "\n"; select(STDOUT); close(INDEX); } # INPUT: %in # Create a header image using the appropriate text string using the "imgcomp" # script by Paul Harberli sub Create_Header_Image { # Make imgcomp script open(IMGSCRIPT, ">$FILE_IMGCOMP_TMP"); print IMGSCRIPT "GLOBALSCALE 1.0\n"; print IMGSCRIPT "IMGSIZE 617 134\n"; print IMGSCRIPT "SETCOLOR 253 186 53\n"; print IMGSCRIPT "CLEARSCREEN\n"; print IMGSCRIPT "SETFONT Times-Roman 33\n"; print IMGSCRIPT "SHOWIMAGE $FILE_HEADER_BACK 0 0\n"; print IMGSCRIPT "SETCOLOR 253 186 53\n"; print IMGSCRIPT "CHARPOS 600 80\n"; print IMGSCRIPT "LEFTTEXT $in{'TITLE'}\n"; close(IMGSCRIPT); # Set environment vaiable $ENV{'IL_READ_THREADS'} = 0; # Generate the header image `$CMD_IMGCOMP $FILE_IMGCOMP_TMP $FILE_HEADER_TMP.$EXT_RGB 1$CMD_NULLIFY 2>&1 `; `$CMD_IMGCOPY $CMD_IMGCOPY_FLAGS $FILE_HEADER_TMP.$EXT_RGB $FILE_HEADER_TMP.$EXT_JPG 1$CMD_NULLIFY 2>&1 `; # Move the image `$CMD_MV $FILE_HEADER_TMP.$EXT_JPG $tree_path/$in{$CGI_ADD_NAME_SWITCH}/$DEMOSRC_HEADER 2>&1 `; # Remove the comp file `$CMD_RM $FILE_IMGCOMP_TMP`; } # INPUT: ($demo_name, $tree_name) # Manage the editing of an already existing demo. This includes adding default # images, checking permissions and setup, and creating info forms. sub Generate_Edit_Info_Page { &Add_Thumbnail_Image("$_[0]", "$_[1]") if ("$in{$CGI_ADD_THUMBNAIL_SWITCH}" eq "$CGI_MAINT_TRUE_FLAG"); &Add_Pic_Image("$_[0]", "$_[1]") if ("$in{$CGI_ADD_PIC_SWITCH}" eq "$CGI_MAINT_TRUE_FLAG"); if (!&Demo_Dir_Exists("$_[0]", "$_[1]")) { &Print_No_Dir_Error_Page; } elsif (!&Dir_Setup_Legal("$_[0]", "$_[1]")) { &Print_Not_Legal_Error_Page; } else { &Print_Edit_Info_Page; } } # INPUT: %in # Create the edit info forms, the last step in editing a demo. sub Print_Edit_Info_Page { local($path); $path = &Tree_Path_From_Name("$in{$CGI_TREE_SWITCH}"); &Parse_Demo_Info("$path/$in{$CGI_ADD_NAME_SWITCH}/$DEMOSRC_INDEX") if ($indexfound); &Print_Maint_Top("Edit Demo: Customize Demo Information", "$IMGSRC_HEADER_EDITINFO"); print "INFORMATION
\n"; print "
| "; print " |
| \n";
print "INDUSTRIES: \n"; &Print_Category_Chooser("MARKETS", @markets_categories); print " | \n \n";
print "FEATURES: | \n
| \n";
print "HARDWARE: \n"; &Print_Category_Chooser("HARDWARE", @hardware_categories); print "\n \n"; print "\n"; print " \n"; print " | \n
\n";
print "The directory
\n";
print "
\n
\n"; print "
\n"; print "\n";
print "The directory
\n";
$path = &Tree_Path_From_Name("$in{$CGI_TREE_SWITCH}");
print "
\n
\n
\n"; print "
\n
\n
\n"; print "Select a demo name and edit that demo's detailed information. \n"; # print "
\n
\n
\n"; for $tree ( &List_Tree_Names ) { print "
$tree
\n";
print "\n";
print "\n";
$curr_col = 1;
for $demo (&Demos_In_Tree("$tree")) {
if (&Is_Basically_Legal(&Tree_Path_From_Name("$tree"), "$demo") ) {
print "
\n";
print "\n";
}
}
# INPUT:
# Print out the add a demo form
sub Print_Add_Form {
local($tree);
print "ADD\n" if ($curr_col == 1);
print " \n" if ($curr_col == $ADD_COLUMNS);
$curr_col = 0 if ($curr_col == $ADD_COLUMNS);
++$curr_col;
}
}
print "\n";
print "$demo\n";
print " \n";
print "
\n"; print "
\n"; }