/*@@ @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 "util_String.h" #include static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusConnect_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 ********************* ********************************************************************/ int HTTP_ContentHeader(const cGH *GH, int choice, int len, char *header, char *menu); int HTTP_ContentFooter(const cGH *GH, int choice, int len, char *footer); /******************************************************************** ********************* 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" "" "
\n" "
\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(const cGH *GH, int choice, int len, char *header, char *menu) { char title[TITLE_ARRAY_SIZE]; char parfile[200]; char currentdate[50]; char currenttime[50]; char quicklinks[1524]; struct httpLink *link; char *file; char *dir; /* avoid compiler warning about unused parameter */ len = len; 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 */ CCTK_RunTitle(TITLE_ARRAY_SIZE,title); CCTK_ParameterFilename(200,parfile); Util_SplitFilename(&dir,&file,parfile); Util_CurrentDate(50,currentdate); Util_CurrentTime(50,currenttime); /* Build the header */ sprintf( header, "\n" "\n" "
\n" "\n" "\n" "\n
\n"); strcat(header, "Master Run Page\n"); sprintf(header,"%s\n" "\n
\n" "
Environment:\n" "
Time: %s\n" "
Date: %s\n" "
\n", header,currenttime,currentdate); sprintf(header, "%s
\n" "
Simulation:\n" "
%s\n" "
%s\n" "
Iteration: %d\n" "
Physical time: %4.2f\n" "
\n" ,header,title,file, GH ? GH->cctk_iteration : 0 , GH ? GH->cctk_time : 0); if (ContentLinks) { strcat(header,quicklinks); } strcat(header,"
\n"); if (menu) { strcat(header,"
\n"); strcat(header,menu); strcat(header,"
\n"); } /* Online links */ /* sprintf(header,"%s\n" "
" "
On-Line:\n" "
Cactus Homepage\n" "
Users Guide\n" "
Cactus Helpdesk\n" "
\n", header,currenttime,currentdate); */ 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(const cGH *GH, int choice, int len, char *footer) { /* avoid compiler warnings about unused parameters */ GH = GH; choice = choice; len = len; strcpy(footer,cactus_footer); return strlen(footer); }