]> err.no Git - scalable-opengroupware.org/blobdiff - UI/WebServerResources/UIxMailToSelection.js
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1287 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / UI / WebServerResources / UIxMailToSelection.js
index 663573ec6d63a6698b3396d66017797b13d79f9a..4a30bdf51478df9359cb247dd024d58f92ffb9bc 100644 (file)
@@ -23,7 +23,7 @@
  * It's required that "currentIndex" is defined in a top level context.
  *
  * Exports:
- * defines UIxRecipientSelectorHasRecipients() returning a bool for the
+ * defines hasRecipients() returning a bool for the
  * surrounding context to check.
  */
 
@@ -94,20 +94,19 @@ function fancyAddRow(shouldEdit, text) {
       return;
     }
   }
-  addressList = $("addressList");
+  addressList = $("addressList").tBodies[0];
   lastChild = $("lastRow");
   
   currentIndex++;
-
-  proto = $('row_' + lastIndex);
+  proto = lastChild.previous("tr");
   row = proto.cloneNode(true);
-  row.id = 'row_' + currentIndex;
+  row.setAttribute("id", 'row_' + currentIndex);
 
   // select popup
-  var rowNodes = row.childNodesWithTag("span");
+  var rowNodes = row.childNodesWithTag("td");
   select = $(rowNodes[0]).childNodesWithTag("select")[0];
   select.name = 'popup_' + currentIndex;
-//   select.value = row.childNodesWithTag("span")[0].childNodesWithTag("select")[0].value;
+  select.value = proto.down("select").value;
   input = $(rowNodes[1]).childNodesWithTag("input")[0];
   input.name  = 'addr_' + currentIndex;
   input.id = 'addr_' + currentIndex;
@@ -121,22 +120,22 @@ function fancyAddRow(shouldEdit, text) {
     input.select();
     input.setAttribute('autocomplete', 'on');
   }
-//   this.adjustInlineAttachmentListHeight(this);
 }
 
 function addressFieldGotFocus(sender) {
   var idx;
   
   idx = this.getIndexFromIdentifier(sender.id);
-  if ((lastIndex == idx) || (idx == 0)) return;
+  if (lastIndex == idx) return;
   this.removeLastEditedRowIfEmpty();
+  onWindowResize(null);
 
   return false;
 }
 
 function addressFieldLostFocus(sender) {
   lastIndex = this.getIndexFromIdentifier(sender.id);
-
+  
   return false;
 }
 
@@ -147,16 +146,15 @@ function removeLastEditedRowIfEmpty() {
   if (idx == 0) return;
   addr = $('addr_' + idx);
   if (!addr) return;
-  if (addr.value != '') return;
+  if (addr.value.strip() != '') return;
   addr = this.findAddressWithIndex(idx);
   if(addr) {
     var addresses = $('addr_addresses');
     addresses.removeChild(addr);
   }
-  addressList = $("addressList");
+  addressList = $("addressList").tBodies[0];
   senderRow = $("row_" + idx);
   addressList.removeChild(senderRow);
-  this.adjustInlineAttachmentListHeight(this);
 }
 
 function findAddressWithIndex(idx) {
@@ -180,16 +178,16 @@ function getAddressIDs() {
 
   addressIDs = new Array();
 
-  addressList = $("addressList");
+  addressList = $("addressList").tBodies[0];
   rows  = addressList.childNodes;
   count = rows.length;
 
   for (i = 0; i < count; i++) {
     var row, rowId;
     
-    row = addressList.childNodes[i];
+    row = rows[i];
     rowId = row.id;
-    if (rowId && rowId != 'row_last') {
+    if (rowId && rowId != 'lastRow') {
       var idx;
 
       idx = this.getIndexFromIdentifier(rowId);
@@ -216,30 +214,16 @@ function getAddressCount() {
   return addressCount;
 }
 
-function UIxRecipientSelectorHasRecipients() {
+function hasRecipients() {
   var count;
   
   count = this.getAddressCount();
-  if (count > 0)
-    return true;
-  return false;
-}
 
-function adjustInlineAttachmentListHeight(sender) {
-  var e;
-  
-  e = $('attachmentsArea');
-  if (e.style.display != 'none') {
-    /* need to lower left size first, because left auto-adjusts to right! */
-    xHeight('compose_attachments_list', 10);
-
-    var leftHeight, rightHeaderHeight;
-    leftHeight        = xHeight('compose_leftside');
-    rightHeaderHeight = xHeight('compose_attachments_header');
-    xHeight('compose_attachments_list',
-            (leftHeight - rightHeaderHeight) - 16);
-  }
+  return (count > 0)
 }
 
-/* addressbook helpers */
+function initMailToSelection() {
+  currentIndex = lastIndex = $$("table#addressList tr").length - 2;
+}
 
+FastInit.addOnLoad(initMailToSelection);