]> code.citadel.org Git - citadel.git/blobdiff - webcit/static/wclib.js
* fix some fallout from last commit: iconbar now in head.html so no one should call...
[citadel.git] / webcit / static / wclib.js
index e4ead482f5ccd3f6def25c1863c413ab55be2669..48fdd05d83d9fcfc31dd48ec3f3f4975d576ff0e 100644 (file)
@@ -27,9 +27,10 @@ if (window.navigator.userAgent.toLowerCase().match("gecko")) {
 var ns6=document.getElementById&&!document.all;
 Event.observe(window, 'load', ToggleTaskDateOrNoDateActivate);
 Event.observe(window, 'load', taskViewActivate);
+Event.observe(window, 'load', fixbanner);
 //document.observe("dom:loaded", setupPrefEngine);
 document.observe("dom:loaded", setupIconBar);
-document.observe('dom:loaded', function() { $('ib_chat_launch').observe('click', launchChat);});
+document.observe('dom:loaded', function() { if (!!document.getElementById("ib_chat_launch")) { $('ib_chat_launch').observe('click', launchChat); } });
 function CtdlRandomString()  {
        return((Math.random()+'').substr(3));
 }
@@ -144,8 +145,7 @@ function setupIconBar() {
     }
   }
   var online_users = document.getElementById("online_users");
-  var ou_displayAs = online_users.style.display;
-  if (ou_displayAs != "none") {
+  if (online_users.offsetParent != null) {
     new Ajax.PeriodicalUpdater('online_users', 'do_template?template=wholist_section', {method: 'get', frequency: 30});
   }
 }
@@ -154,9 +154,7 @@ function changeIconBarEvent(event) {
 }
 function changeIconBar(target) {
   var switchTo = target.ctdlSwitchIconBarTo;
-  if (!!window.console) {
-    console.log("Changing to: " + switchTo);
-  }
+  WCLog("Changing to: " + switchTo);
   ctdlLocalPrefs.setPref("iconbar_view", target.ctdlSwitchIconBarTo);  
   if (switchTo == "rooms") {
     switch_to_room_list();
@@ -658,8 +656,10 @@ function TaskViewGatherCategoriesFromTable() {
 function attachDatePicker(relative) {
        var dpck = new DatePicker({
        relative: relative,
-       language: 'en', // fix please
-       disableFutureDate: false
+             language: 'en', //wclang.substr(0,2),
+             disableFutureDate: false,
+             dateFormat: [ ["yyyy", "mm", "dd"], "-"],
+             showDuration: 0.2
        });
        document.getElementById(relative).dpck = dpck; // attach a ref to it
 }
@@ -675,9 +675,6 @@ function eventEditAllDay() {
        }
 }
 
-
-
-
 // Functions which handle show/hide of various elements in the recurrence editor
 
 function RecurrenceShowHide() {
@@ -758,3 +755,37 @@ function RecurrenceShowHide() {
 function launchChat(event) {
 window.open('chat', 'ctdl_chat_window', 'toolbar=no,location=no,directories=no,copyhistory=no,status=no,scrollbars=yes,resizable=yes');
 }
+// logger
+function WCLog(msg) {
+  if (!!window.console && !!console.log) {
+    console.log(msg);
+  } else if (!!window.opera && !!opera.postError) {
+    opera.postError(msg);
+  }
+}
+
+function fixMissingCSSTable(elems) {
+ if (elems[0] == null) {
+    return;
+  }
+  if (elems[0].getStyle("display") != "table-cell") {
+    var parentNode = elems[0].parentNode;
+    var table = document.createElement("table");
+    table.style.width = "100%";
+    var tbody = document.createElement("tbody");
+    table.appendChild(tbody);
+    var tr = document.createElement("tr");
+    tbody.appendChild(tr);
+    parentNode.appendChild(table);
+    for(var i=0; i<elems.length; i++) {
+      parentNode.removeChild(elems[i]);
+      var td = document.createElement("td");
+      td.appendChild(elems[i]);
+      tr.appendChild(td);
+    }
+  }
+}
+function fixbanner() {
+  var elems = [$('room_banner'),$('actiondiv')];
+  fixMissingCSSTable(elems);
+}