/*@@ @file Headers.c @date Wed Sep 17 23:47:43 2000 @author Gabrielle Allen @desc Functions to return standard headers and footers for HTML pages @enddesc @version $Header$ @@*/ #include "cctk.h" #include static char *rcsid = "$Header$"; CCTK_FILEVERSION(DevThorns_httpd_Headers_c) /******************************************************************** ********************* Local Data Types *********************** ********************************************************************/ extern struct httpLink *ContentLinks; struct httpLink { struct httpLink *next; char *URL; char *name; char *description; int flags; }; /******************************************************************** ********************* Local Routine Prototypes ********************* ********************************************************************/ /******************************************************************** ********************* Other Routine Prototypes ********************* ********************************************************************/ /******************************************************************** ********************* Local Data ***************************** ********************************************************************/ #define TITLE_ARRAY_SIZE 100 static const char *cactus_mainheader = "\n" "\n" "
" "\"Cactus\"" "" "
" "\n"; static const char *cactus_footer = "
\n" "\n" "\n" "

" "
\n" "\n" "Cactus Home Page
\n" "Cactus Web Interface by The Cactus Team
\n" "
" "
" "About this Server" "
" "\n"; /******************************************************************** ********************* External Routines ********************** ********************************************************************/ /*@@ @routine HTTP_ContentHeader @date Sat Sep 16 15:22:59 2000 @author Gabrielle Allen @desc Returns header for HTML pages @enddesc @calls @calledby @history @endhistory @@*/ int HTTP_ContentHeader(cGH *GH, int choice, int len, char *header, char *menu) { char title[TITLE_ARRAY_SIZE]; char currentdate[50]; char currenttime[50]; char quicklinks[524]; struct httpLink *link; int titlelen,datelen,timelen; if(ContentLinks) { strcpy(quicklinks,"
Options:"); for(link = ContentLinks; link; link=link->next) { sprintf(quicklinks, "%s
%s
\n", quicklinks, link->URL, link->name); } sprintf(quicklinks,"%s
\n",quicklinks); } if (choice == 0) { /* Find strings needed for nonmain-page headers */ titlelen = CCTK_RunTitle(TITLE_ARRAY_SIZE,title); datelen = Util_CurrentDate(50,currentdate); timelen = Util_CurrentTime(50,currenttime); /* Build the header */ sprintf( header, "\n\n" "
\n\n" "\n
\n"); strcat(header, "Master Run Page\n"); sprintf(header,"%s\n" "
" "
Environment:" "
Time: %s" "
Date: %s" "
", header,currenttime,currentdate); sprintf(header,"%s
Simulation:" "
%s" "
Iteration: %d" "
Physical time: %4.2f" "
" ,header,title,GH ? GH->cctk_iteration : 0 , GH ? GH->cctk_time : 0); if (ContentLinks) { strcat(header,quicklinks); } strcat(header,"
"); if (menu) { strcat(header,"
"); strcat(header,menu); strcat(header,"
"); } strcat(header,"
\n"); } else { sprintf(header,"%s",cactus_mainheader); } return strlen(header); } /*@@ @routine HTTP_ContentFooter @date Sat Sep 16 15:22:59 2000 @author Tom Goodale @desc Returns footer for HTML pages @enddesc @calls @calledby @history @endhistory @@*/ int HTTP_ContentFooter(cGH *GH, int choice, int len, char *footer) { strcpy(footer,cactus_footer); return strlen(footer); }