]> code.citadel.org Git - citadel.git/blobdiff - webcit/netconf.c
* Created IsEmptyStr define to be used rather then using some weird strlen constructs
[citadel.git] / webcit / netconf.c
index eb4d8f2d781007831fd1b1610d722c48b51f3410..bfb9388708df9a24f15290e24daff3974ed741e6 100644 (file)
@@ -1,19 +1,24 @@
 /* 
  * $Id$
+ */
+/**
+ * \defgroup NetShareConf Functions which handle network and sharing configuration.
  *
- * Functions which handle network and sharing configuration.
- *
+ * \ingroup CitadelConfig
  */
-
+/*@{*/
 #include "webcit.h"
 
+/**
+ * \brief edit a network node
+ */
 void edit_node(void) {
        char buf[SIZ];
        char node[SIZ];
        char cnode[SIZ];
        FILE *fp;
 
-       if (strlen(bstr("ok_button")) > 0) {
+       if (!IsEmptyStr(bstr("ok_button"))) {
                strcpy(node, bstr("node") );
                fp = tmpfile();
                if (fp != NULL) {
@@ -51,12 +56,14 @@ void edit_node(void) {
 }
 
 
-
+/**
+ * \brief add a node
+ */
 void display_add_node(void)
 {
        output_headers(1, 1, 2, 0, 0, 0);
        wprintf("<div id=\"banner\">\n");
-       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
+       wprintf("<TABLE class=\"netconf_banner\"><TR><TD>");
        wprintf("<SPAN CLASS=\"titlebar\">");
        wprintf(_("Add a new node"));
        wprintf("</SPAN>");
@@ -64,6 +71,7 @@ void display_add_node(void)
        wprintf("</div>\n<div id=\"content\">\n");
 
        wprintf("<FORM METHOD=\"POST\" action=\"edit_node\">\n");
+       wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
        wprintf("<CENTER><TABLE border=0>\n");
        wprintf("<TR><TD>%s</TD>", _("Node name"));
        wprintf("<TD><INPUT TYPE=\"text\" NAME=\"node\" MAXLENGTH=\"16\"></TD></TR>\n");
@@ -82,6 +90,9 @@ void display_add_node(void)
        wDumpContent(1);
 }
 
+/**
+ * \brief modify an existing node
+ */
 void display_edit_node(void)
 {
        char buf[512];
@@ -95,7 +106,7 @@ void display_edit_node(void)
 
        output_headers(1, 1, 2, 0, 0, 0);
        wprintf("<div id=\"banner\">\n");
-       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
+       wprintf("<TABLE class=\"netconf_banner\"><TR><TD>");
        wprintf("<SPAN CLASS=\"titlebar\">");
        wprintf(_("Edit node configuration for "));
        escputs(node);
@@ -114,6 +125,7 @@ void display_edit_node(void)
 
                        if (!strcasecmp(node, cnode)) {
                                wprintf("<FORM METHOD=\"POST\" action=\"edit_node\">\n");
+                               wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
                                wprintf("<CENTER><TABLE border=0>\n");
                                wprintf("<TR><TD>");
                                wprintf(_("Node name"));
@@ -143,7 +155,7 @@ void display_edit_node(void)
                }
        }
 
-       else {          /* command error getting configuration */
+       else {          /** command error getting configuration */
                wprintf("%s<br />\n", &buf[4]);
        }
 
@@ -151,7 +163,9 @@ void display_edit_node(void)
 }
 
 
-
+/**
+ * \brief display all configured nodes
+ */
 void display_netconf(void)
 {
        char buf[SIZ];
@@ -159,7 +173,7 @@ void display_netconf(void)
 
        output_headers(1, 1, 2, 0, 0, 0);
        wprintf("<div id=\"banner\">\n");
-       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
+       wprintf("<TABLE class=\"netconf_banner\"><TR><TD>");
        wprintf("<SPAN CLASS=\"titlebar\">");
        wprintf(_("Network configuration"));
        wprintf("</SPAN>\n");
@@ -172,7 +186,7 @@ void display_netconf(void)
        wprintf("</A><br />\n");
        wprintf("</CENTER>");
 
-       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
+       wprintf("<TABLE class=\"netconf_banner\"><TR><TD>");
        wprintf("<SPAN CLASS=\"titlebar\">");
        wprintf(_("Currently configured nodes"));
        wprintf("</SPAN>\n");
@@ -203,14 +217,16 @@ void display_netconf(void)
        wDumpContent(1);
 }
 
-
+/**
+ * \brief display the dialog to verify the deletion
+ */
 void display_confirm_delete_node(void)
 {
        char node[SIZ];
 
        output_headers(1, 1, 2, 0, 0, 0);
        wprintf("<div id=\"banner\">\n");
-       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
+       wprintf("<TABLE class=\"netconf_banner\"><TR><TD>");
        wprintf("<SPAN CLASS=\"titlebar\">");
        wprintf(_("Confirm delete"));
        wprintf("</SPAN>\n");
@@ -234,7 +250,9 @@ void display_confirm_delete_node(void)
        wDumpContent(1);
 }
 
-
+/**
+ * \brief actually delete the node
+ */
 void delete_node(void)
 {
        char buf[SIZ];
@@ -272,7 +290,9 @@ void delete_node(void)
        display_netconf();
 }
 
-
+/**
+ * \brief add a new node
+ */
 void add_node(void)
 {
        char node[SIZ];
@@ -280,7 +300,7 @@ void add_node(void)
 
        strcpy(node, bstr("node"));
 
-       if (strlen(bstr("add_button")) > 0)  {
+       if (!IsEmptyStr(bstr("add_button")))  {
                sprintf(buf, "NSET addnode|%s", node);
                serv_puts(buf);
                serv_getln(buf, sizeof buf);
@@ -299,3 +319,4 @@ void add_node(void)
 }
 
 
+/*@}*/