fmout: removed.
authorWilfried Goesgens <dothebart@citadel.org>
Sun, 25 Mar 2012 23:17:06 +0000 (01:17 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 25 Mar 2012 23:17:06 +0000 (01:17 +0200)
  - templatize the logout screen; it doesn't need the old fmout now anymore.
  - templatize the change password dialog; it doesn't need the old fmout now anymore.
  - remove fmout

webcit/auth.c
webcit/serv_func.c
webcit/static/t/logout.html [new file with mode: 0644]
webcit/static/t/menu/change_pw.html [new file with mode: 0644]
webcit/static/t/menu/your_info.html
webcit/webcit.h

index e5275104dc9c52d1d03b6427a73aebdf674fc930..45c78592d34c3a8a89091ee4696bdb871ef28cc8 100644 (file)
@@ -498,45 +498,7 @@ void do_logout(void)
 
        /* Calling output_headers() this way causes the cookies to be un-set */
        output_headers(1, 1, 0, 1, 0, 0);
-
-       /* For sites in guest mode, redirect to the landing page after we're logged out */
-       if (WC->serv_info->serv_supports_guest) {
-               wc_printf("     <script type=\"text/javascript\">       "
-                       "       window.location='/';                    "
-                       "       </script>                               "
-               );
-       }
-
-       wc_printf("<div id=\"logout_screen\">");
-        wc_printf("<div class=\"box\">");
-        wc_printf("<div class=\"boxlabel\">");
-       wc_printf(_("Log off"));
-        wc_printf("</div><div class=\"boxcontent\">");
-       serv_puts("MESG goodbye");
-       serv_getln(buf, sizeof buf);
-
-       if (WCC->serv_sock >= 0) {
-               if (buf[0] == '1') {
-                       fmout("'CENTER'");
-               } else {
-                       wc_printf("Goodbye\n");
-               }
-       }
-       else {
-               wc_printf(_("This program was unable to connect or stay "
-                       "connected to the Citadel server.  Please report "
-                       "this problem to your system administrator.")
-               );
-               wc_printf("<a href=\"http://www.citadel.org/doku.php/"
-                       "faq:mastering_your_os:net#netstat\">%s</a>",
-                       _("Read More..."));
-       }
-
-       wc_printf("<hr /><div class=\"buttons\"> "
-               "<span class=\"button_link\"><a href=\".\">");
-       wc_printf(_("Log in again"));
-       wc_printf("</a></span>");
-       wc_printf("</div></div></div>\n");
+       do_template("logout");
        if (WC->serv_info->serv_supports_guest) {
                display_default_landing_page();
                return;
@@ -761,62 +723,6 @@ void display_reg(int during_login)
 
 }
 
-
-/*
- * display form for changing your password
- */
-void display_changepw(void)
-{
-       wcsession *WCC = WC;
-       WCTemplputParams SubTP;
-       char buf[SIZ];
-       StrBuf *Buf;
-       output_headers(1, 1, 1, 0, 0, 0);
-
-       Buf = NewStrBufPlain(_("Change your password"), -1);
-       memset(&SubTP, 0, sizeof(WCTemplputParams));
-       SubTP.Filter.ContextType = CTX_STRBUF;
-       SubTP.Context = Buf;
-       DoTemplate(HKEY("box_begin"), NULL, &SubTP);
-
-       FreeStrBuf(&Buf);
-
-       if (StrLength(WCC->ImportantMsg) > 0) {
-               wc_printf("<span class=\"errormsg\">"
-                         "%s</span><br>\n", ChrPtr(WCC->ImportantMsg));
-               FlushStrBuf(WCC->ImportantMsg);
-       }
-
-       serv_puts("MESG changepw");
-       serv_getln(buf, sizeof buf);
-       if (buf[0] == '1') {
-               fmout("CENTER");
-       }
-
-       wc_printf("<form name=\"changepwform\" action=\"changepw\" method=\"post\">\n");
-       wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
-       wc_printf("<table class=\"altern\" ");
-       wc_printf("<tr class=\"even\"><td>");
-       wc_printf(_("Enter new password:"));
-       wc_printf("</td><td>");
-       wc_printf("<input type=\"password\" name=\"newpass1\" value=\"\" maxlength=\"20\"></td></tr>\n");
-       wc_printf("<tr class=\"odd\"><td>");
-       wc_printf(_("Enter it again to confirm:"));
-       wc_printf("</td><td>");
-       wc_printf("<input type=\"password\" name=\"newpass2\" value=\"\" maxlength=\"20\"></td></tr>\n");
-       wc_printf("</table>\n");
-
-       wc_printf("<div class=\"buttons\">\n");
-       wc_printf("<input type=\"submit\" name=\"change_action\" value=\"%s\">", _("Change password"));
-       wc_printf("&nbsp;");
-       wc_printf("<input type=\"submit\" name=\"cancel_action\" value=\"%s\">\n", _("Cancel"));
-       wc_printf("</div>\n");
-       wc_printf("</form>\n");
-
-       do_template("box_end");
-       wDumpContent(1);
-}
-
 /*
  * change password
  * if passwords match, propagate it to citserver.
@@ -837,13 +743,13 @@ void changepw(void)
 
        if (strcasecmp(newpass1, newpass2)) {
                AppendImportantMessage(_("They don't match.  Password was not changed."), -1);
-               display_changepw();
+               do_template("menu_change_pw");
                return;
        }
 
        if (IsEmptyStr(newpass1)) {
                AppendImportantMessage(_("Blank passwords are not allowed."), -1);
-               display_changepw();
+               do_template("menu_change_pw");
                return;
        }
 
@@ -864,7 +770,7 @@ void changepw(void)
                display_main_menu();
        }
        else {
-               display_changepw();
+               do_template("menu_change_pw");
        }
        FreeStrBuf(&Line);
 }
@@ -1036,7 +942,6 @@ InitModule_AUTH
        WebcitAddUrlHandler(HKEY("validate"), "", 0, validate, 0);
        WebcitAddUrlHandler(HKEY("do_welcome"), "", 0, do_welcome, 0);
        WebcitAddUrlHandler(HKEY("display_reg"), "", 0, _display_reg, 0);
-       WebcitAddUrlHandler(HKEY("display_changepw"), "", 0, display_changepw, 0);
        WebcitAddUrlHandler(HKEY("changepw"), "", 0, changepw, 0);
        WebcitAddUrlHandler(HKEY("termquit"), "", 0, do_logout, 0);
        WebcitAddUrlHandler(HKEY("do_logout"), "", 0, do_logout, ANONYMOUS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);
index 0158ca1fbc2b6f93a19779c29cd3333f5ce277f4..6d7dc34c387d7ae34c3d83a7b6aa711fb064e53b 100644 (file)
@@ -254,55 +254,6 @@ int GetConnected (void)
        return 0;
 }
 
-/*
- *  Read Citadel variformat text and spit it out as HTML.
- *  align html align string
- */
-inline void fmout(const char *align)
-{
-       _fmout(WC->WBuf, align);
-}
-
-void _fmout(StrBuf *Target, const char *align)
-{
-       int intext = 0;
-       int bq = 0;
-       char buf[SIZ];
-
-       StrBufAppendPrintf(Target, "<div align=%s>\n", align);
-       while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
-
-               if ((intext == 1) && (isspace(buf[0]))) {
-                       wc_printf("<br>");
-               }
-               intext = 1;
-
-               /*
-                * Quoted text should be displayed in italics and in a
-                * different colour.  This code understands Citadel-style
-                * " >" quotes and will convert to <BLOCKQUOTE> tags.
-                */
-               if ((bq == 0) && (!strncmp(buf, " >", 2))) {
-                       StrBufAppendBufPlain(Target, HKEY("<BLOCKQUOTE>"), 0);
-                       bq = 1;
-               } else if ((bq == 1) && (strncmp(buf, " >", 2))) {
-                       StrBufAppendBufPlain(Target, HKEY("</BLOCKQUOTE>"), 0);
-                       bq = 0;
-               }
-               if ((bq == 1) && (!strncmp(buf, " >", 2))) {
-                       strcpy(buf, &buf[2]);
-               }
-               /* Activate embedded URL's */
-               url(buf, sizeof(buf));
-
-               escputs(buf);
-               StrBufAppendBufPlain(Target, HKEY("\n"), 0);
-       }
-       if (bq == 1) {
-               wc_printf("</I>");
-       }
-       wc_printf("</div><br>\n");
-}
 
 void FmOut(StrBuf *Target, const char *align, const StrBuf *Source)
 {
diff --git a/webcit/static/t/logout.html b/webcit/static/t/logout.html
new file mode 100644 (file)
index 0000000..60c86c3
--- /dev/null
@@ -0,0 +1,18 @@
+<?--("For sites in guest mode, redirect to the landing page after we're logged out")>
+<?!("COND:SERV:SUPPORTS_GUEST", 1)>
+<script type="text/javascript">
+window.location='/';                   
+</script>                              
+<?!("X", 1)>
+
+<div id="logout_screen">
+<div class="box">
+<div class="boxlabel"><?_("Log off")></div>
+<div class="boxcontent">
+<?SERV:MESG("goodbye")>
+
+<hr /><div class="buttons"> 
+<span class="button_link"><a href=".">
+<?_("Log in again")>
+</a></span>
+</div></div></div>
diff --git a/webcit/static/t/menu/change_pw.html b/webcit/static/t/menu/change_pw.html
new file mode 100644 (file)
index 0000000..fbacd71
--- /dev/null
@@ -0,0 +1,32 @@
+<?=("head")>
+<?%("COND:LOGGEDIN", 1, 1, 1, "", ="paging")>
+<?ROOMBANNER>
+<div id="content">
+
+<?=("box_begin_1")><?_("Change your password")><?=("box_begin_2")>
+
+<?SERV:MESG("changepw")>
+
+<form name="changepwform" action="changepw" method="post">
+<input type="hidden" name="nonce" value="<?NONCE>">
+
+<table class="altern" >
+<tr class="even">
+ <td><?_("Enter new password:")></td>
+ <td><input type="password" name="newpass1" value="" maxlength="20"></td>
+</tr>
+<tr class="odd">
+ <td><?_("Enter it again to confirm:")></td>
+ <td><input type="password" name="newpass2" value="" maxlength="20"></td>
+</tr>
+</table>
+
+<div class="buttons">
+<input type="submit" name="change_action" value="<?_("Change password")>"> 
+&nbsp;
+<input type="submit" name="cancel_action" value="<?_("Cancel")>">
+</div>
+</form>
+<?=("box_end")>
+<?=("trailing")>
index 350d361c98fc6d84b0bb6e670dc6e66fd46f7d2d..fb3af7926389025f9e1b21a43a701e8188c6c847 100644 (file)
@@ -1,7 +1,7 @@
 <ul class="adminitems">
 <li><a href="do_template?template=preferences"><?_("Change your preferences and settings")></a></li>
 <li><a href="display_reg"><?_("Update your contact information")></a></li>
-<li><a href="display_changepw"><?_("Change your password")></a></li>
+<li><a href="do_template?template=menu_change_pw"><?_("Change your password")></a></li>
 <li><a href="display_editbio"><?_("Enter your 'bio'")></a></li>
 <li><a href="display_editpic"><?_("Edit your online photo")></a></li>
 <li><a href="do_template?template=sieve_list"><?_("View/edit server-side mail filters")></a></li>
index 62f9ba204e2c9395423c9e520855d3bbab02d6c8..ef976ec93362d1a736c8cd43d96a960082142bce 100644 (file)
@@ -692,8 +692,6 @@ void CreateMimeStr(void);
 
 void pop_destination(void);
 
-void fmout(const char *align);
-void _fmout(StrBuf *Targt, const char *align);
 void FmOut(StrBuf *Target, const char *align, const StrBuf *Source);
 void wDumpContent(int);