diff options
author | allen <allen@1faa4e14-9dd3-4be0-9f0e-ffe519881164> | 2000-09-19 23:35:56 +0000 |
---|---|---|
committer | allen <allen@1faa4e14-9dd3-4be0-9f0e-ffe519881164> | 2000-09-19 23:35:56 +0000 |
commit | c1e6b818b3ad317850015cd9a80e7513a9660ffd (patch) | |
tree | 95bb822ece5a3069a30035f527aa4d49905f987a /src/Headers.c | |
parent | 7bc89f775b9129148f1bc9e1d5197ee13f3faca6 (diff) |
Moved headers to a separate file, they are now callable by a function.
Added page about groups and variables
Added parameter file name, current time and date
git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@52 1faa4e14-9dd3-4be0-9f0e-ffe519881164
Diffstat (limited to 'src/Headers.c')
-rw-r--r-- | src/Headers.c | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/src/Headers.c b/src/Headers.c new file mode 100644 index 0000000..74afd0a --- /dev/null +++ b/src/Headers.c @@ -0,0 +1,143 @@ + /*@@ + @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$ + @@*/ + +#define TITLE_ARRAY_SIZE 100 + +#include <string.h> + +#include "cctk.h" + +static char *rcsid = "$Header$"; + +CCTK_FILEVERSION(DevThorns_httpd_Headers_c) + +/******************************************************************** + ********************* Local Data Types *********************** + ********************************************************************/ + +static const char *cactus_mainheader = +"</HEAD>\n" +"<BODY BGCOLOR=\"#FFFFFF\"" +" link=\"#1B831D\" vlink=\"#768000\" alink=\"#00FF00\">\n" +"<center><A HREF=\"http://www.cactuscode.org/\">" +"<img src=\"/Images/wwwcactuscodeorg.jpg\"" +" alt=\"Cactus\" BORDER=0></A>" +"</A>" +"<table width=70% border=0><tr><td>" +"\n"; + +static const char *cactus_footer = +"</table>\n" +"<TABLE WIDTH=100\% BORDER=0>\n" +"<tr><td colspan=2><HR NOSHADE SIZE=1></td></tr>\n" +"<tr><td align=left valign=top>" +"<ADDRESS><DIV ALIGN=left>\n" +"<SMALL>\n" +"<A HREF=\"http://www.cactuscode.org/\">Cactus Home Page</A><BR>\n" +"Cactus Web Interface by <A HREF=\"mailto:cactusmaint@cactuscode.org\">The Cactus Team</A><BR>\n" +"</SMALL></DIV></ADDRESS>" +"</TD><TD ALIGN=RIGHT VALIGN=TOP><SMALL>" +"<A HREF=\"/About.html\"><i>About this Server</i></A>" +"</SMALL></TD></TR></TABLE>" +"</BODY></HTML>\n"; + + +/******************************************************************** + ********************* Local Routine Prototypes ********************* + ********************************************************************/ + +/******************************************************************** + ********************* Other Routine Prototypes ********************* + ********************************************************************/ + +/******************************************************************** + ********************* Local Data ***************************** + ********************************************************************/ + +/******************************************************************** + ********************* 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(int choice, int len, char *header) +{ + char title[TITLE_ARRAY_SIZE]; + char currentdate[50]; + char currenttime[50]; + + int titlelen,datelen,timelen; + + 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, + "</HEAD>\n<BODY BGCOLOR=\"#FFFFFF\" link=\"#1B831D\" " + "vlink=\"#768000\" alink=\"#00FF00\">\n" + "<table width=100\% border=1>\n<tr>\n<td align=left>\n"); + strcat(header,"<font color=#1B831D><small>\n"); + strncat(header, title, titlelen*sizeof(char)); + strcat(header,"</br>"); + strncat(header, currentdate, datelen*sizeof(char)); + strcat(header, " "); + strncat(header, currenttime, timelen*sizeof(char)); + strcat(header, "</small></font>\n"); + strcat(header, "</td>\n<td align=right valign=top>\n" + "<A HREF=\"/\">Simulation Homepage</A>\n" + "</td>\n</tr>\n</table>\n<center>\n<table width=70% border=0>\n" + "<tr>\n<td>\n"); + printf("Header is \n%s\n",header); + } + 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(int choice, int len, char *footer) +{ + strcpy(footer,cactus_footer); + return strlen(footer); +} + + + |