* restart logic for the "Shutdown Citadel" menu. The ui is sort of 3rd class so far...
authorWilfried Göesgens <willi@citadel.org>
Sat, 8 Sep 2007 18:16:19 +0000 (18:16 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sat, 8 Sep 2007 18:16:19 +0000 (18:16 +0000)
webcit/mainmenu.c
webcit/webcit.c
webcit/webcit.h

index cb5909e04907b94e747d0b7c114c2f08f237c8d1..7842e50b96e39639877d0770715c593ad53ac47c 100644 (file)
@@ -199,8 +199,6 @@ void display_aide_menu(void)
 
 
 
-
-
 /**
  * \brief Display the screen to enter a generic server command
  */
@@ -338,4 +336,77 @@ void display_menubar(int as_single_page) {
 }
 
 
+/**
+ * \brief Display the wait / input dialog while restarting the server.
+ */
+void display_shutdown(void)
+{
+       char buf[SIZ];
+       char *when;
+       
+       when=bstr("when");
+       if (!strcmp(when, "now")){
+               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=\"5; URL=knrooms\"/>\n"
+                               "</head>\n"
+                               "<body bgcolor=\"#FFFFFF\">\n"
+                               "Please wait while the citadel server is restarted... "
+                               "</body>\n</html>\n"
+                               );
+               }
+       }
+       else if (!strcmp(when, "page")) {
+               char *message;
+              
+               message = bstr("message");
+               if ((message == NULL) || (IsEmptyStr(message)))
+               {
+                       wprintf("<html>\n"
+                               "<head>\n"
+                               "</head>\n"
+                               "<body bgcolor=\"#FFFFFF\">\n"
+                               "<form action=\"server_shutdown\">\n"
+                               "<input type=\"hidden\" name=\"when\" value=\"page\">\n"
+                               "<input type=\"text\" name=\"message\" value=\"message\">\n"
+                               "<input type=\"submit\" value=\"go\">\n"
+                               "</form>\n"
+                               "</body>\n</html>\n"
+                               );
+                       
+               }
+               else
+               {
+                       // TODO: page the users... wait longer...
+                       wprintf("<html>\n"
+                               "<head>\n"
+                               "<meta http-equiv=\"refresh\" content=\"5; URL=server_shutdown?when=now&\"/>\n"
+                               "</head>\n"
+                               "<body bgcolor=\"#FFFFFF\">\n"
+                               "Please wait while your users are being paged, the citadel server will be restarted after that... "
+                               "</body>\n</html>\n"
+                               );
+                       
+               }
+       }
+       else if (!strcmp(when, "idle")) {
+               serv_printf("SCDN 3");
+               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]);
+
+               }
+       }
+}
+
+
 /*@}*/
index 54001abb39fc67d9516bc9393112b95e08906f04..d1070569dc18dee4272bea0938a7fa8f3868b9b6 100644 (file)
@@ -1505,6 +1505,8 @@ void session_loop(struct httprequest *req)
                url_do_template();
        } else if (!strcasecmp(action, "display_aide_menu")) {
                display_aide_menu();
+       } else if (!strcasecmp(action, "server_shutdown")) {
+               display_shutdown();
        } else if (!strcasecmp(action, "display_main_menu")) {
                display_main_menu();
        } else if (!strcasecmp(action, "who")) {
index ea572159a0be47fc7da7ed09946fc6c57ece0d07..c76709cd4be084058fd1171a8a256955afd08a2b 100644 (file)
@@ -453,6 +453,7 @@ void do_welcome(void);
 void do_logout(void);
 void display_main_menu(void);
 void display_aide_menu(void);
+void display_shutdown(void);
 void display_advanced_menu(void);
 void slrp_highest(void);
 void gotonext(void);