* Only offer views which make sense for the default view of a room
authorArt Cancro <ajc@citadel.org>
Tue, 14 Jan 2003 04:21:27 +0000 (04:21 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 14 Jan 2003 04:21:27 +0000 (04:21 +0000)
webcit/ChangeLog
webcit/README.txt
webcit/roomops.c
webcit/webcit.h

index 2a0784d769141aca180917c2ecc78906aa2b5057..d3a6a15386e1020dc7ecf028da2930988b9e5571 100644 (file)
@@ -1,4 +1,7 @@
 $Log$
+Revision 400.83  2003/01/14 04:21:27  ajc
+* Only offer views which make sense for the default view of a room
+
 Revision 400.82  2003/01/13 03:34:33  ajc
 * Get ready for the 6.10 release
 
@@ -1237,3 +1240,4 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
+
index de9d0da50873042cd478e07f583f1f130f356e84..cec68daddb0fd1c39e5a8492f782b4d9e53380b5 100644 (file)
@@ -1,7 +1,7 @@
                       WEBCIT for the Citadel/UX System
                                version 4.10
  
-   Copyright (C) 1996-2002 by the authors.  Portions written by:
+   Copyright (C) 1996-2003 by the authors.  Portions written by:
        Art Cancro
        Nathan Bryant
        Nick Grossman
index 65f01807129ee7668b20191ddd54f35fe03c7039..068ab233a9d06bcc21a168681601877826a3c07a 100644 (file)
@@ -348,11 +348,24 @@ void embed_view_o_matic(void) {
                "[selectedIndex].value\">\n");
 
        for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
-               wprintf("<OPTION %s VALUE=\"/changeview?view=%d\">",
-                       ((i == WC->wc_view) ? "SELECTED" : ""),
-                       i );
-               escputs(viewdefs[i]);
-               wprintf("</OPTION>\n");
+               /*
+                * Only offer the views that make sense, given the default
+                * view for the room.  For example, don't offer a Calendar
+                * view in a non-Calendar room.
+                */
+               if (
+                       (i == WC->wc_view)
+                  ||   (i == WC->wc_default_view)
+                  ||   ( (i == 0) && (WC->wc_default_view == 1) )
+                  ||   ( (i == 1) && (WC->wc_default_view == 0) )
+               ) {
+
+                       wprintf("<OPTION %s VALUE=\"/changeview?view=%d\">",
+                               ((i == WC->wc_view) ? "SELECTED" : ""),
+                               i );
+                       escputs(viewdefs[i]);
+                       wprintf("</OPTION>\n");
+               }
        }
        wprintf("</SELECT></FORM>\n");
 }
@@ -467,6 +480,7 @@ void gotoroom(char *gname, int display_name)
        }
        strcpy(WC->wc_roomname, WC->wc_roomname);
        WC->wc_view = extract_int(&buf[4], 11);
+       WC->wc_default_view = extract_int(&buf[4], 12);
 }
 
 
index 31976fc5514eb8b37b3b861bc936bf8bf9f5c78f..a4a592be350fc178ce8e6165ea697221522a76da 100644 (file)
@@ -160,6 +160,7 @@ struct wcsession {
        int serv_sock;
        unsigned room_flags;
        int wc_view;
+       int wc_default_view;
        char ugname[128];
        long uglsn;
        int upload_length;