* move serverrestart to templates
authorWilfried Göesgens <willi@citadel.org>
Tue, 2 Sep 2008 12:38:58 +0000 (12:38 +0000)
committerWilfried Göesgens <willi@citadel.org>
Tue, 2 Sep 2008 12:38:58 +0000 (12:38 +0000)
* make it return to the aide menu instead of knrooms

webcit/mainmenu.c
webcit/static/t/box_serverrestart.html [new file with mode: 0644]
webcit/static/t/box_serverrestartpage.html [new file with mode: 0644]
webcit/static/t/box_serverrestartpagedo.html [new file with mode: 0644]
webcit/static/t/display_serverrestart.html [new file with mode: 0644]
webcit/static/t/display_serverrestartpage.html [new file with mode: 0644]
webcit/static/t/display_serverrestartpagedo.html [new file with mode: 0644]
webcit/static/t/subject_serverrestartpage.html [new file with mode: 0644]

index 816c5683f62d9c21e8cbb6c1282811365f0da002..5693329b01296d72b3d7ed96201a982ac4f81f05 100644 (file)
@@ -357,75 +357,60 @@ void display_shutdown(void)
        char *when;
        
        when=bstr("when");
-       if (!strcmp(when, "now")){
+       if (strcmp(when, "now") == 0){
                serv_printf("DOWN 1");
                serv_getln(buf, sizeof buf);
                if (atol(buf) == 500)
                { /* upsie. maybe the server is not running as daemon? */
-                       wprintf("<html><head></head><body>Attention: %s</body></html>", &buf[4]);
-
-               }
-               else {
-                       wprintf("<html>\n"
-                               "<head>\n"
-                               "<meta http-equiv=\"refresh\" content=\"15; URL=knrooms\"/>\n"
-                               "</head>\n"
-                               "<body bgcolor=\"#FFFFFF\">\n"
-                               "<img src=\"static/throbber.gif\" /> <font color=\"#AAAAAA\">%s </font>"
-                               "</body>\n</html>\n",
-                               _("Please wait while the Citadel server is restarted... ")
-                               );
+                       
+                       safestrncpy(WC->ImportantMessage,
+                                   &buf[4],
+                                   sizeof WC->ImportantMessage);
                }
-               wDumpContent(0);
+               begin_burst();
+               output_headers(1, 0, 0, 0, 1, 0);
+               DoTemplate(HKEY("display_serverrestart"), NULL, NULL);
+               end_burst();
                lingering_close(WC->http_sock);
                sleeeeeeeeeep(10);
                serv_printf("NOOP");
                serv_printf("NOOP");
        }
-       else if (!strcmp(when, "page")) {
+       else if (strcmp(when, "page") == 0) {
                char *message;
               
                message = bstr("message");
                if ((message == NULL) || (IsEmptyStr(message)))
                {
-                       output_headers(1, 1, 1, 0, 0, 0);
-                       svput("BOXTITLE", WCS_STRING, _("Message to your Users:"));
-                       do_template("beginbox", NULL);
-                       wprintf("<form action=\"server_shutdown\">\n"
-                               "<input type=\"hidden\" name=\"when\" value=\"page\">\n"
-                               "<input type=\"text\" name=\"message\" value=\"%s\">\n"
-                               "<input type=\"submit\" value=\"go\">\n"
-                               "</form>\n",
-                               _("The citadel server has to be restarted. It 'll be back in a minute.")
-                               );
-                       do_template("endbox", NULL);
-                       wDumpContent(1);
-
-                       
+                       begin_burst();
+                       output_headers(1, 0, 0, 0, 1, 0);
+                       DoTemplate(HKEY("display_serverrestartpage"), NULL, NULL);
+                       end_burst();
                }
                else
                {
-                       // TODO: page the users... wait longer...
                        serv_printf("SEXP broadcast|%s", message);
                        serv_getln(buf, sizeof buf); // should we care?
-                       wprintf("<html>\n"
-                               "<head>\n"
-                               "<meta http-equiv=\"refresh\" content=\"15; URL=knrooms\"/>\n"
-                               "</head>\n"
-                               "<body bgcolor=\"#FFFFFF\">\n"
-                               "<img src=\"static/throbber.gif\" /> <font color=\"#AAAAAA\">%s </font>"
-                               "</body>\n</html>\n",
-                               _("Please wait while your users are being paged, the citadel server will be restarted after that... "));
-                       
+                       begin_burst();
+                       output_headers(1, 0, 0, 0, 1, 0);
+                       DoTemplate(HKEY("display_serverrestartpagedo"), NULL, NULL);
+                       end_burst();                    
                }
        }
        else if (!strcmp(when, "idle")) {
                serv_printf("SCDN 3");
                serv_getln(buf, sizeof buf);
-               if (atol(buf) == 500) {
-                       /* oops ... maybe the server is not running as a daemon? */
-                       wprintf("<html><head></head><body>Attention: %s</body></html>", &buf[4]);
+
+               if (atol(buf) == 500)
+               { /* upsie. maybe the server is not running as daemon? */
+                       safestrncpy(WC->ImportantMessage,
+                                   &buf[4],
+                                   sizeof WC->ImportantMessage);
                }
+               begin_burst();
+               output_headers(1, 0, 0, 0, 1, 0);
+               DoTemplate(HKEY("display_aide_menu"), NULL, NULL);
+               end_burst();                    
        }
 }
 
diff --git a/webcit/static/t/box_serverrestart.html b/webcit/static/t/box_serverrestart.html
new file mode 100644 (file)
index 0000000..d09bfb3
--- /dev/null
@@ -0,0 +1,6 @@
+<img src="static/throbber.gif" /> 
+<font color="#AAAAAA">
+ <?_("Please wait while the Citadel server is restarted... ")>
+</font>
+
+
diff --git a/webcit/static/t/box_serverrestartpage.html b/webcit/static/t/box_serverrestartpage.html
new file mode 100644 (file)
index 0000000..c6ffba0
--- /dev/null
@@ -0,0 +1,24 @@
+<div align=CENTER>
+<form action="server_shutdown">
+<br />
+<br />
+<br />
+<input type="hidden" name="when" value="page">
+<input type="text" cols="40" rows="5" name="message" value='<?_("The citadel server has to be restarted. It will be back in a minute.")>'>
+
+<br />
+<br />
+<br />
+<br />
+
+<hr>
+<br />
+<br />
+<div class="buttons"> <span class="button_link"><input type="submit" value="go"></span></div>
+</form>
+<br />
+<br />
+<br />
+<br />
+
+</div>
diff --git a/webcit/static/t/box_serverrestartpagedo.html b/webcit/static/t/box_serverrestartpagedo.html
new file mode 100644 (file)
index 0000000..971de74
--- /dev/null
@@ -0,0 +1,15 @@
+<img src="static/throbber.gif" /> 
+<font color="#AAAAAA">
+ <?_("Please wait while your users are being paged, the citadel server will be restarted after that... ")>
+</font>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/webcit/static/t/display_serverrestart.html b/webcit/static/t/display_serverrestart.html
new file mode 100644 (file)
index 0000000..e534ddf
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<title><?CURRENT_USER> - <?SERV_HUMANNODE></title>
+<meta name="MSSmartTagsPreventParsing" content="TRUE" >
+<meta name="keywords" content="groupware messaging collaboration" >
+<link href="static/niftyCorners.css" rel="stylesheet" type="text/css">
+<link href="static/webcit.css" rel="stylesheet" type="text/css">
+<link href="static/datepicker.css" rel="stylesheet" type="text/css">
+<link href="static/bt.css" rel="stylesheet" type="text/css">
+
+<?CSSLOCAL>
+<script type="text/javascript" src="static/prototype.js"></script>
+<script type="text/javascript" src="static/scriptaculous.js"></script>
+<script type="text/javascript" src="static/niftycube.js"></script>
+<script type="text/javascript" src="static/BubbleTooltips.js"></script>
+<script type="text/javascript" src="static/datepicker-dev.js"></script>
+<script type="text/javascript" src="static/table.js"></script>
+<script type="text/javascript" src="static/wclib.js"></script>
+<meta http-equiv="refresh" content="15; URL=do_template?template=display_aide_menu"/>
+</head>
+<body>
+<div id="global">
+<?=important_msg>
+<div id="content" class="service">
+<div class="fix_scrollbar_bug">
+<table>
+<td width=50%% valign="top">
+<?DOBOXED("box_serverrestart", "subject_floorconfig")>
+</td></tr></table></div>
+<?=trailing>
diff --git a/webcit/static/t/display_serverrestartpage.html b/webcit/static/t/display_serverrestartpage.html
new file mode 100644 (file)
index 0000000..26bf8d9
--- /dev/null
@@ -0,0 +1,6 @@
+<?=head>
+<?=important_msg>
+<div id="resatrt_page">
+<?DOBOXED("box_serverrestartpage", "subject_serverrestartpage")>
+</div>
+<?=trailing>
diff --git a/webcit/static/t/display_serverrestartpagedo.html b/webcit/static/t/display_serverrestartpagedo.html
new file mode 100644 (file)
index 0000000..a5c03ea
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<title><?CURRENT_USER> - <?SERV_HUMANNODE></title>
+<meta name="MSSmartTagsPreventParsing" content="TRUE" >
+<meta name="keywords" content="groupware messaging collaboration" >
+<link href="static/niftyCorners.css" rel="stylesheet" type="text/css">
+<link href="static/webcit.css" rel="stylesheet" type="text/css">
+<link href="static/datepicker.css" rel="stylesheet" type="text/css">
+<link href="static/bt.css" rel="stylesheet" type="text/css">
+
+<?CSSLOCAL>
+<script type="text/javascript" src="static/prototype.js"></script>
+<script type="text/javascript" src="static/scriptaculous.js"></script>
+<script type="text/javascript" src="static/niftycube.js"></script>
+<script type="text/javascript" src="static/BubbleTooltips.js"></script>
+<script type="text/javascript" src="static/datepicker-dev.js"></script>
+<script type="text/javascript" src="static/table.js"></script>
+<script type="text/javascript" src="static/wclib.js"></script>
+<meta http-equiv="refresh" content="40; URL=server_shutdown?when=now"/>
+</head>
+<body>
+<div id="global">
+<?=important_msg>
+<div id="content" class="service">
+<div class="fix_scrollbar_bug">
+<table>
+<td width=50%% valign="top">
+<?DOBOXED("box_serverrestartpagedo")>
+</td></tr></table></div>
+<?=trailing>
diff --git a/webcit/static/t/subject_serverrestartpage.html b/webcit/static/t/subject_serverrestartpage.html
new file mode 100644 (file)
index 0000000..a12b331
--- /dev/null
@@ -0,0 +1 @@
+<?_("Message to your Users:")>