* iteratorstruct private again
authorMatt <matt@uncensored.citadel.org>
Fri, 6 Feb 2009 09:45:47 +0000 (09:45 +0000)
committerMatt <matt@uncensored.citadel.org>
Fri, 6 Feb 2009 09:45:47 +0000 (09:45 +0000)
* removed HAVE_ZLIB check, Gzip encoding works
* remove old cond display_msg and lastmsg, obsoleted by new iterator params
* Added javascript code which will switch #global to a scrollable pane and make roombanner fixed under IE8 and the good browsers
* added some conditions in head.html that deal explicitly with IE
* Fixed message pane in mailbox not being cleared properly in IE prior to message refresh
* Page selector in mailbox safe mode now keeps the current page selected

webcit/msg_renderers.c
webcit/static/summaryview.js
webcit/static/t/head.html
webcit/static/t/msg_listview.html
webcit/static/t/roombanner.html
webcit/static/t/who.html
webcit/static/wclib.js
webcit/static/webcit.css
webcit/subst.c
webcit/subst.h
webcit/webserver.c

index 5112aba61955429c55416588275b9fa99c34b6cc..8ca86433efab0e537366a97b0ed2db9e0ddf4329 100644 (file)
@@ -430,27 +430,6 @@ HashList *iterate_get_mailsumm_All(StrBuf *Target, WCTemplputParams *TP)
 {
        return WC->summ;
 }
-int Conditional_ROOM_DISPLAY_MSG(StrBuf *Target, WCTemplputParams *TP) {
-       wcsession *WCC = WC;
-       IterateStruct *ITC = CCTX;
-       int num_inset = ITC->n;
-       if ((num_inset >= WC->startmsg) && (WCC->num_displayed <= WCC->maxmsgs)) {
-
-       WCC->num_displayed = WCC->num_displayed+1;
-       return 1; /* Pass GO, collect $200 */
-       } 
-       return 0;
-}
-int Conditional_MAIL_SUMM_LASTMSG(StrBuf *Target, WCTemplputParams *TP) {
-  IterateStruct *ITC = CCTX;
-       int is_last_n = ITC->LastN;
-/*
-       //GetHash(WC->vars, HKEY("ITERATE:N"), (void *)&n_dsubst);
-       //num_inset = n_dsubst->lvalue;
-       */
-       /* Is the num_displayed higher than maxmsgs? OR last in iterator */
-       return ((WC->num_displayed > WC->maxmsgs) || (is_last_n == 1));
-}
 void examine_time(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
 {
        Msg->date = StrTol(HdrLine);
@@ -1151,8 +1130,6 @@ InitModule_MSGRENDERERS
        RegisterNamespace("MAIL:SUMM:INREPLYTO", 0, 2, tmplput_MAIL_SUMM_INREPLYTO,  CTX_MAILSUM);
        RegisterNamespace("MAIL:BODY", 0, 2, tmplput_MAIL_BODY,  CTX_MAILSUM);
        RegisterNamespace("MAIL:QUOTETEXT", 1, 2, tmplput_QUOTED_MAIL_BODY,  CTX_NONE);
-       RegisterConditional(HKEY("COND:ROOM:DISPLAYMSG"), 0, Conditional_ROOM_DISPLAY_MSG, CTX_MAILSUM);
-       RegisterConditional(HKEY("COND:MAIL:SUMM:LASTMSG"), 0, Conditional_MAIL_SUMM_LASTMSG, CTX_MAILSUM);
        RegisterConditional(HKEY("COND:MAIL:SUMM:RFCA"), 0, Conditional_MAIL_SUMM_RFCA,  CTX_MAILSUM);
        RegisterConditional(HKEY("COND:MAIL:SUMM:CCCC"), 0, Conditional_MAIL_SUMM_CCCC,  CTX_MAILSUM);
        RegisterConditional(HKEY("COND:MAIL:SUMM:UNREAD"), 0, Conditional_MAIL_SUMM_UNREAD, CTX_MAILSUM);
index 497a611400846f422ed62bfd60c4fbf0f6fcea54..930679de9368acced0765c84332bada8d0784cd9 100644 (file)
@@ -21,6 +21,7 @@ var markedRowId = null;
 var mouseDownEvent = null;
 var exitedMouseDown = false;
 
+var currentPage = 0;
 var sortModes = {
   "rdate" : sortRowsByDateDescending,
   "date" : sortRowsByDateAscending,
@@ -103,6 +104,7 @@ function loadMessages(transport) {
   var msgs = data['msgs'];
   var length = msgs.length;
   rowArray = new Array(); // store so they can be sorted
+  WCLog("Row array length: "+rowArray.length);
   var start = new Date();
   for(var i=0; i<length;i++) {
     var trElement = document.createElement("tr");
@@ -136,7 +138,7 @@ function loadMessages(transport) {
       }
     }
     if (data[5]) {
-      trElement.setAttribute("class", "new_message");
+      trElement.ctdlNewMsg = true;
     }
     trElement.dropEnabled = true;
     trElement.ctdlMarked = false;
@@ -167,8 +169,17 @@ function loadMessages(transport) {
   sizePreviewPane();
 }
 function resortAndDisplay(sortMode) {
+  WCLog("Begin resortAndDisplay");
   var start = new Date();
-  emptyElement(message_view);
+  /* We used to try and clear out the message_view element,
+     but stupid IE doesn't even do that properly */
+  var message_view_parent = message_view.parentNode;
+  message_view_parent.removeChild(message_view);
+  message_view = document.createElement("tbody");
+  message_view.setAttribute("id","message_list_body");
+  message_view.className="mailbox_summary";
+  message_view_parent.appendChild(message_view);
+  
   var fragment = document.createDocumentFragment();
   if (sortMode != null) {
     rowArray.sort(sortMode);
@@ -177,13 +188,15 @@ function resortAndDisplay(sortMode) {
   for(var x=0; x<length; ++x) {
     try {
       var currentRow = rowArray[x];
-      var className = currentRow.className;
-      className = className.replace("table-alt-row","");
-      className = className.replace("table-row","");
+      currentRow.setAttribute("class","");
+      var className = "";
     if (((x-1) % 2) == 0) {
-      className += " table-alt-row";
+      className = "table-alt-row";
     } else {
-      className += " table-row";
+      className = "table-row";
+    }
+    if (currentRow.ctdlNewMsg) {
+      className += " new_message";
     }
     currentRow.className = className;
     /* Using element.onclick is evil, but until IE 
@@ -316,10 +329,10 @@ function getSortMode(toggleElem) {
 function removeOldSortClass() {
   if (currentSorterToggle) {
     var classes = currentSorterToggle.className;
-    classes = classes.replace("current_sort_mode","");
+    /* classes = classes.replace("current_sort_mode","");
     classes = classes.replace("sort_ascending","");
-    classes = classes.replace("sort_descending","");
-    currentSorterToggle.className = classes;
+    classes = classes.replace("sort_descending",""); */
+    currentSorterToggle.className = "";
   }
 }
 function markRow( row) {
@@ -486,10 +499,11 @@ function normalizeHeaderTable() {
 
 function setupPageSelector() {
   var summpage = document.getElementById("summpage");
-  //var select_page = document.getElementById("selectpage");
+  var select_page = document.getElementById("selectpage");
   summpage.innerHTML = "";
   if (is_safe_mode) {
-    summpage.parentNode.setAttribute("style","display: inline !important"); //override webcit.css
+    WCLog("unhiding parent page");
+    select_page.className = "";
   } else {
     return;
   }
@@ -498,6 +512,9 @@ function setupPageSelector() {
     var opt = document.createElement("option");
     var startmsg = i * 500;
     opt.setAttribute("value",startmsg);
+    if (currentPage == i) {
+      opt.setAttribute("selected","selected");
+    }
     opt.appendChild(document.createTextNode((i+1)));
     summpage.appendChild(opt);
   }
@@ -505,6 +522,7 @@ function setupPageSelector() {
 function getPage(event) {
   var target = event.target;
   startmsg = target.options.item(target.selectedIndex).value;
+  currentPage = target.selectedIndex;
   //query = ""; // We are getting a page from the _entire_ msg list, don't query
   getMessages();
 }
index 6076d5557ad45746b582eb1082c93e83964ddc77..eddddbae180c42f80b5cc93f19d7de838df01c27 100644 (file)
 
 <?CSSLOCAL> 
 <script type="text/javascript" src="static/protoaculous1.6.packed.js"></script> 
-<!--
-<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/wclib.js"></script>
 <script type="text/javascript" src="static/roomops.js"></script>
 <script type="text/javascript" src="static/ctdldragdrop.js"></script>
+<!--[if lte IE 7]>
+<script type="text/javascript">
+var is_ie6 = true;
+</script>
+<![endif]-->
+<!--[if IE]>
+<style type="text/css">
+#summary_view table { table-layout: fixed; }
+</style>
+<![endif]-->
 </head>
 <body>
 <??("COND:LOGGEDIN",1)>
index 39f884e3237c751a0322b0c60d4aaaac328083f8..615af505240f1ff40c45ab02580f74ca20e4c775 100644 (file)
@@ -1,7 +1,7 @@
 <script src="static/summaryview.js" type="text/javascript"></script>
 <script type="text/javascript">
 var is_safe_mode = <?%("COND:PREF", 1, :"mailbox", "client-nosort",
-"1", "0")>;
+"true", "false")>;
 var sortmode = "<?PREF:ROOM:VALUE("sort")>";
 </script>
 <div id="message_list_hdr">
index eaa52469f88feef172f3c708cc85cd0e2f0cd097..62346a7ca9fa72f02b87b74e135dc3c93f7ccd5d 100644 (file)
@@ -11,7 +11,7 @@
 <li class="start_page"><?START></li>
 <li class="search" id="searchomatic"><?SEARCHOMATIC></li>
 <li class="view"><?VIEWOMATIC></li>
-<??("COND:SUBST", 1, "WCVIEW", "1")><li id="selectpage"><?_("Select page: ")> <select id="summpage"><option> </option></select></li><??("X",1)>
+<??("COND:SUBST", 1, "WCVIEW", "1")><li class="hidden" id="selectpage"><?_("Select page: ")> <select id="summpage"><option> </option></select></li><??("X",1)>
 </ul>
 </div>
 </div>
index 632aed2c1ac3884360275fdd4d099d5679a9e41c..3ded6d3f236f8030393d786690251f74e5e1ddf5 100644 (file)
@@ -13,12 +13,13 @@ return confirm('<?_("Do you really want to kill this session?")>');
 <h1>
 <?_("Users currently on ")><?SERV:HUMANNODE>
 </h1></div>
+<div id="actiondiv">
 <ul class="room_actions">
 <li class="start_page">
        <?OFFERSTARTPAGE>
 </li></ul>
 </div>
-
+</div>
 <div id="content" class="fix_scrollbar_bug who_is_online">
 <?DOBOXED("wholiststatic", "wholiststatic_header")>
 </div>
index 155af4e1149aa9396107f1f5ca77977682f6453f..870ca031d178d7932508e0cc841ab8ac084d53f4 100644 (file)
@@ -20,6 +20,8 @@ var currentDropTarget = null;
 var supportsAddEventListener = (!!document.addEventListener);
 var today = new Date();
 
+var wc_log = "";
+var is_ie6 = false;
 if (document.all) {browserType = "ie"}
 if (window.navigator.userAgent.toLowerCase().match("gecko")) {
        browserType= "gecko";
@@ -40,7 +42,11 @@ function CtdlRandomString()  {
 function emptyElement(element) {
   childNodes = element.childNodes;
   for(var i=0; i<childNodes.length; i++) {
+    try {
     element.removeChild(childNodes[i]);
+    } catch (e) {
+      WCLog(e+"|"+e.description);
+    }
   }
 }
 /** Implements superior internet explorer 'extract all child text from element' feature'. Falls back on buggy, patent violating standardized method */
@@ -766,6 +772,8 @@ function WCLog(msg) {
     console.log(msg);
   } else if (!!window.opera && !!opera.postError) {
     opera.postError(msg);
+  } else {
+    wc_log += msg + "\r\n";
   }
 }
 
@@ -794,11 +802,31 @@ function fixbanner() {
   // Use prototype api methods here
   var elems = [$('room_banner'),$('actiondiv')];
   fixMissingCSSTable(elems);
-  /* var banner = $('banner'); 
-  if (banner != null) {
-  } */
+  if (!is_ie6) {
+    Event.observe(window, 'resize', makeContentScrollable);
+    makeContentScrollable();
+  }
+}
+function makeContentScrollable() {
+if (document.getElementById("banner")
+      && document.getElementById("content") 
+      && !document.getElementById("summary_view")) {
+  WCLog("makeContentScrollable");
+    document.body.style.overflowY="hidden";
+    var global = $("global");
+    global.className += "scrollable";
+    var content = document.getElementById("content");
+    var banner = document.getElementById("banner");
+    var bannerHeight = banner.offsetHeight;
+    banner.style.width="100%";
+    var bannerPercent = (bannerHeight/document.viewport.getHeight())*100;
+    //banner.style.height=bannerPercent+"%";
+    content.style.overflowY="scroll";
+    //content.style.top=bannerPercent+"%";
+    content.style.height=(100-bannerPercent)+"%";
+    content.style.right="0px";
+  }
 }
-
 function fixOffsetBanner() {
   var banner = document.getElementById("banner");
   if (banner.offsetLeft > 0) {
@@ -815,6 +843,9 @@ function resizeViewport() {
   var viewportWidth = document.viewport.getWidth();
   var iconbar = $('iconbar');
   var global = $('global');
+  if (iconbar == null || global == null || document.documentElement == null) {
+    return;
+  }
   if (typeof window.offsetWidth != 'undefined') {
     documentWidth = window.offsetWidth;
   } else {
index 86342013e86dc169a3e467816e3a661c8324c9db..91ea445fa13435ec07d62e01ac298ab587fdda3e 100644 (file)
@@ -141,7 +141,6 @@ body {
        padding: 0;
 }
 
-
 #banner a {
        color: #FFF
 }
@@ -535,7 +534,9 @@ body, #global {
     left: 0;
     overflow-y: auto;
 }
-
+#global.scrollable {
+    position: fixed;
+}
 #important_message {
        position: absolute;
        top: 0; 
@@ -837,7 +838,7 @@ body, #global {
        margin-top: 8px;
        margin-right: 4px;
 }
-#selectpage {
+#selectpage.hidden {
     display: none !important;
 }
 
index faf685dbdb84c055e72efda141191ecff4947c03..547aa945175c1fff38caeca33dff7f1a219ca482 100644 (file)
@@ -1741,14 +1741,14 @@ void RegisterITERATOR(const char *Name, long len,
        Put(Iterators, Name, len, It, NULL);
 }
 
-/* typedef struct _iteratestruct {
+typedef struct _iteratestruct {
        int GroupChange;
        int oddeven;
        const char *Key;
        long KeyLen;
        int n;
        int LastN;
-       }IterateStruct; */
+       }IterateStruct; 
 
 void tmpl_iterate_subtmpl(StrBuf *Target, WCTemplputParams *TP)
 {
index cc620e14fb8e35d54501d0a7622f8d9961574067..dcb4b556bc0623931666a698aaaf73681677334c 100644 (file)
@@ -165,15 +165,6 @@ typedef struct _ConditionalStruct {
        WCConditionalFunc CondF;
 } ConditionalStruct;
 
-/** IterateStruct TODO: SHOULD BE PRIVATE */
-typedef struct _iteratestruct {
-        int GroupChange;
-        int oddeven;  
-        const char *Key;
-        long KeyLen;
-        int n;
-        int LastN;
-}IterateStruct;
 
 typedef void (*SubTemplFunc)(StrBuf *TemplBuffer, WCTemplputParams *TP);
 typedef HashList *(*RetrieveHashlistFunc)(StrBuf *Target, WCTemplputParams *TP);
index 788eb25e6c5560288ec72afe051fbc7a45428672..b89035870b009d1373fce419961e8ed6c0d5d120 100644 (file)
@@ -271,13 +271,13 @@ long end_burst(void)
         fd_set wset;
         int fdflags;
 
-#ifdef HAVE_ZLIB
+       //#ifdef HAVE_ZLIB
        /* Perform gzip compression, if enabled and supported by client */
        if (!DisableGzip && (WCC->gzip_ok) && CompressBuffer(WCC->WBuf))
        {
                hprintf("Content-encoding: gzip\r\n");
        }
-#endif /* HAVE_ZLIB */
+       //#endif        /* HAVE_ZLIB */
 
        hprintf("Content-length: %d\r\n\r\n", StrLength(WCC->WBuf));