aboutsummaryrefslogtreecommitdiff
path: root/src/Content.c
diff options
context:
space:
mode:
authorallen <allen@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2000-09-28 04:36:02 +0000
committerallen <allen@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2000-09-28 04:36:02 +0000
commit672cdf715e314fec2df6ba3b6eb8248d1112db44 (patch)
treefdb44d8e49be065d373157ad5ca7d2b4bb43e6ef /src/Content.c
parentaa69bad8e6317c8192c5e89bd88188c2fe511b51 (diff)
New headers for all pages.
Added new Thorns pages, for now these just have the parameters, but there will be an easy way for thorns to add their own stuff git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@89 1faa4e14-9dd3-4be0-9f0e-ffe519881164
Diffstat (limited to 'src/Content.c')
-rw-r--r--src/Content.c202
1 files changed, 82 insertions, 120 deletions
diff --git a/src/Content.c b/src/Content.c
index fd27c6c..0e27c29 100644
--- a/src/Content.c
+++ b/src/Content.c
@@ -85,6 +85,7 @@ static int CookieTestPage(cGH *cctkGH, httpRequest *request, void *data);
********************************************************************/
int HTTPi_RegisterGroupsPages(void);
+int HTTPi_RegisterThornPages(void);
int HTTPi_RegisterParameterPages(void);
@@ -149,13 +150,6 @@ int HTTP_RegisterPages(void)
/* Register the master page. */
HTTP_RegisterPage("/index.html", MainPage, NULL);
- /* Register the server description page */
- HTTP_RegisterPage("/About.html", AboutPage, NULL);
-
- /* Register parameter stuff */
-
- HTTPi_RegisterParameterPages();
-
/* Register parameter control stuff. */
HTTP_RegisterPage("/control.html", ControlPage, NULL);
@@ -164,6 +158,17 @@ int HTTP_RegisterPages(void)
"Control Panel for this run",
HTTP_QUICKLINK);
+ /* Register thorn pages */
+
+ HTTPi_RegisterThornPages();
+
+ /* Register the server description page */
+ HTTP_RegisterPage("/About.html", AboutPage, NULL);
+
+ /* Register parameter stuff */
+
+ HTTPi_RegisterParameterPages();
+
/* Register Groups Pages */
HTTPi_RegisterGroupsPages();
@@ -285,7 +290,9 @@ static int MainPage(cGH *cctkGH, httpRequest *request, void *data)
{
int retval;
int filelen;
- char message[4098];
+ char message[10098];
+ char title[4098];
+ char menu[4098];
struct httpLink *link;
/* Status message */
@@ -303,48 +310,74 @@ static int MainPage(cGH *cctkGH, httpRequest *request, void *data)
HTTP_Write(request, message, strlen(message));
+
/* Write out the main header part */
- HTTP_ContentHeader(cctkGH, 1, 4096, message,NULL);
- HTTP_Write(request, message, strlen(message));
- strcpy(message, "<center><h1>Simulation Home Page</h1></center>");
+ /* LIST COMPILED THORNS */
+ {
+ int i;
+ int nthorns;
+ const char **thorns;
- /* ADD QUICK LINKS (e.g. FOR PALM) */
+ nthorns = CCTK_NumCompiledThorns();
+ thorns = (const char **)malloc(nthorns * sizeof(char *));
+ for(i=0; i < nthorns; i++)
+ {
+ thorns[i] = CCTK_CompiledThorn (i);
+ }
+ qsort(thorns, nthorns, sizeof(char *), CompareStrings);
- if(ContentLinks)
- {
- strcpy(message, "<center>Quick links: ");
-
- for(link = ContentLinks; link; link=link->next)
+ strcpy(menu, "<DT> <B>Active Thorns:</B>\n");
+ for(i=0; i < nthorns; i++)
{
- if(link->flags & HTTP_QUICKLINK)
+ if (CCTK_IsThornActive(thorns[i]))
{
- sprintf(message,
- "%s[<A HREF=\"%s\">%s</a>]",
- message,
- link->URL,
- link->name);
+ sprintf(menu,"%s<DT><A HREF=\"/Thorns/%s/\">%s</A>\n",
+ menu, thorns[i], thorns[i]);
}
}
- strcat(message,"</center>\n<br>\n");
- HTTP_Write(request, message, strlen(message));
+ free(thorns);
}
+ HTTP_ContentHeader(cctkGH, 0, 10096, message, menu);
+ HTTP_Write(request, message, strlen(message));
+
+ strcpy(message,"<CENTER>\n"
+ "<IMG SRC=\"/Images/wwwcactuscodeorg.jpg\""
+ " ALT=\"Cactus\" BORDER=0></CENTER>\n");
+
+ HTTP_Write(request, message, strlen(message));
+
+ CCTK_RunTitle(4098,title);
/* Some blurb */
- strcpy(message, "<br>"
- "<center><table cellspacing=5 cellpadding=5 border=0><tr>"
- "<td valign=top><h3>Simulation web server:</h3>"
- "<p>This browser is connected to a Cactus simulation which "
- "contains a web server thorn. This thorn allows you to "
- "monitor the simulation, and view and change parameters</p>"
- "<p>Depending on which other thorns are active, there may "
- "be additional features available, such as the viewing and "
- "downloading of output files</p>");
+ sprintf(message, "<br>"
+ "<CENTER>\n"
+ "<TABLE WIDTH=60%%>\n"
+ "<TR>\n"
+ "<TD ALIGN=CENTER>\n"
+ "<H2>%s</H2>\n"
+ "<P>This browser is connected to a Cactus simulation which "
+ "contains a web server thorn. This thorn provides information "
+ " and control for the simulation.</P>\n"
+ "<TABLE CELLPADDING=15>\n"
+ "<TR>\n"
+ "<TD ALIGN=CENTER BGCOLOR=#E5FFA2>\n"
+ "<P><B>Before controlling any features of the simulation, users "
+ "must <A HREF=\"/control.html\">authenticate</A>.</B></P>\n"
+ "</TD></TR></TABLE>\n"
+ "</TD>\n"
+ "</TR>\n"
+ "</TABLE>\n",title);
HTTP_Write(request, message, strlen(message));
- /*************************************************************************/
+ strcpy(message,
+ "<CENTER>\n"
+ "<TABLE CELLPADDING=10>\n"
+ "<TR>\n"
+ "<TD VALIGN=TOP>\n");
+ HTTP_Write(request, message, strlen(message));
/* AVAILABLE OPTIONS */
@@ -352,20 +385,26 @@ static int MainPage(cGH *cctkGH, httpRequest *request, void *data)
{
strcpy(message,
"<H3>Available options:</H3>\n"
- "<ul>\n");
+ "<dl>\n");
for(link = ContentLinks; link; link=link->next)
{
sprintf(message,
- "%s<li> <A HREF=\"%s\">%s</a> %s </li>\n",
+ "%s<dt> <A HREF=\"%s\">%s</a> <dd>%s \n",
message, link->URL, link->name, link->description);
}
- sprintf(message,"%s</ul>\n",message);
+ sprintf(message,"%s</dl>\n",message);
HTTP_Write(request, message, strlen(message));
}
+ strcpy(message,
+ "</TD>\n"
+ "<TD VALIGN=TOP>\n");
+ HTTP_Write(request, message, strlen(message));
+
+
/* CONFIGURATION DETAILS */
sprintf(message, "<h3>Configuration:</h3>"
@@ -402,89 +441,12 @@ static int MainPage(cGH *cctkGH, httpRequest *request, void *data)
strcpy(message,"</UL>");
HTTP_Write(request, message, strlen(message));
- /******************************************************************************/
-
- /* NEW COLUMN */
-
- strcpy(message, "</td><td valign=top>");
-
- HTTP_Write(request, message, strlen(message));
-
- /*******************************************************************************/
-
- /* CURRENT STATE OF SIMULATION */
-
- if (cctkGH)
- {
-
- sprintf(message, "<H3> Current state:</h3> "
- "<ul><li>Physical time <FONT COLOR=RED> %f"
- "</FONT> \n"
- "<li>Iteration number <FONT COLOR=RED> %d"
- "</FONT></li>\n",
- cctkGH->cctk_time,
- cctkGH->cctk_iteration);
- }
- else
- {
- strcpy(message, "<li>Current cactus time is unknown</li>\n");
- }
-
- HTTP_Write(request, message, strlen(message));
-
- strcpy(message, "</ul>");
-
- HTTP_Write(request, message, strlen(message));
-
- /* LIST COMPILED THORNS */
-
- {
- int i;
- int nthorns;
- const char **thorns;
-
- nthorns = CCTK_NumCompiledThorns();
-
- thorns = (const char **)malloc(nthorns * sizeof(char *));
-
- for(i=0; i < nthorns; i++)
- {
- thorns[i] = CCTK_CompiledThorn (i);
- }
-
- /* Sort the thorns */
- qsort(thorns, nthorns, sizeof(char *), CompareStrings);
-
- strcpy(message, "<h3>Compiled thorns:</h3>"
- "<p>This list shows all thorns compiled into the executable, "
- "those thorns which have been activated in the parameter "
- "file for this simulation are shown in "
- "<font color=red>red</font></p>"
- "<UL>");
-
- for(i=0; i < nthorns; i++)
- {
- strcat(message, "<LI>");
- if (CCTK_IsThornActive(thorns[i]))
- {
- sprintf(message,"%s <FONT COLOR=red> %s </FONT>\n", message, thorns[i]);
- }
- else
- {
- strcat(message, thorns[i]);
- }
- }
- strcat(message, "</UL>");
-
- free(thorns);
- }
-
- HTTP_Write(request, message, strlen(message));
-
-
/* Finish table started by blurb */
- strcpy(message, "</td></tr></table>");
-
+ strcpy(message,
+ "</TD>\n"
+ "</TR>\n"
+ "</TABLE>\n"
+ "</CENTER>\n");
HTTP_Write(request, message, strlen(message));
/* Write out the footer part. */