]> err.no Git - scalable-opengroupware.org/commitdiff
changed dhtml behavior to squash bugs #1067 and #1464
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 18 Jul 2005 12:55:01 +0000 (12:55 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 18 Jul 2005 12:55:01 +0000 (12:55 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@790 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/UI/MailerUI/ChangeLog
SOGo/UI/MailerUI/UIxMailToSelection.m
SOGo/UI/MailerUI/Version
SOGo/UI/Templates/ChangeLog
SOGo/UI/Templates/UIxMailToSelection.wox

index 98abf9cc812c5892d76050a11df4c9cc09ab2f67..a4852eb7abdd7488a051b4aa5477e0d57d48d776 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-18  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+        * UIxMailToSelection.m: changed behavior for adding/removing text
+          fields and changing focus (v0.9.145)
+
 2005-07-18  Helge Hess  <helge.hess@opengroupware.org>
 
        * product.plist: properly bind a 'getMail' method to the account
index 9e992378c1272812338b03624ae27919d77d1548..6fc52c4637db3f7383a65262ae912bfca54d276b 100644 (file)
@@ -314,6 +314,7 @@ static NSArray *headers = nil;
   // TODO: might be better to use -stringByReplacingBindings: etc
   static NSString *script = \
   @"var currentIndex = %d;\n"
+  @"var lastIndex    = currentIndex;\n"
   @"\n"
   @"function hasAddress(email) {\n"
   @"  var e = document.getElementById(email);\n"
@@ -362,19 +363,30 @@ static NSArray *headers = nil;
   @"}\n"
   @"\n"
   @"function fancyAddRow(shouldEdit, text) {\n"
-  @"  var table, lastChild, proto, row, select, input;\n"
+  @"  var addr, table, lastChild, proto, row, select, input;\n"
   @"\n"
+  @"  addr = document.getElementById('addr_' + lastIndex);\n"
+  @"  if (addr && addr.value == '') {\n"
+  @"    input = document.getElementById('compose_subject_input');\n"
+  @"    if (input) {\n"
+  @"      input.focus();\n"
+  @"      input.select();\n"
+  @"      return;\n"
+  @"    }\n"
+  @"  }\n"
   @"  table = this.getTable();\n"
   @"  lastChild = document.getElementById('row_last');\n"
   @"\n"
   @"  currentIndex++;\n"
   @"\n"
-  @"  proto = document.getElementById('row_0');\n"
+  @"  proto = document.getElementById('row_' + lastIndex);\n"
   @"  row = proto.cloneNode(true);\n"
   @"  row.id = 'row_' + currentIndex;\n"
   @"\n"
+  @"  // select popup\n"
   @"  select = row.childNodes[1].childNodes[1];\n"
   @"  select.name = 'popup_' + currentIndex;\n"
+  @"  select.value = proto.childNodes[1].childNodes[1].value;\n"
   @"  input = row.childNodes[3].childNodes[1];\n"
   @"  input.name  = 'addr_' + currentIndex;\n"
   @"  input.id    = 'addr_' + currentIndex;\n"
@@ -387,7 +399,19 @@ static NSArray *headers = nil;
   @"  }\n"
   @"}\n"
   @"\n"
+  @"function addressFieldGotFocus(sender) {\n"
+  @"  var idx;\n"
+  @"\n"
+  @"  idx = this.getIndexFromIdentifier(sender.id);\n"
+  @"  if ((lastIndex == idx) || (idx == 0)) return;\n"
+  @"  this.removeLastEditedRowIfEmpty();\n"
+  @"}\n"
+  @"function addressFieldLostFocus(sender) {\n"
+  @"  lastIndex = this.getIndexFromIdentifier(sender.id);\n"
+  @"}\n"
+  @"\n"
   @"function removeIfNecessary(sender) {\n"
+  @"/*"
   @"  var idx, addr, table, senderRow;\n"
   @"\n"
   @"  if(sender.value != '')\n"
@@ -403,6 +427,24 @@ static NSArray *headers = nil;
   @"  table = this.getTable();\n"
   @"  senderRow = this.findRowWithIndex(idx);\n"
   @"  table.removeChild(senderRow);\n"
+  @"*/"
+  @"}\n"
+  @"\n"
+  @"function removeLastEditedRowIfEmpty() {\n"
+  @"  var idx, addr, table, senderRow;\n"
+  @"\n"
+  @"  idx = lastIndex;\n"
+  @"  addr = document.getElementById('addr_' + idx);\n"
+  @"  if (!addr) return;\n"
+  @"  if (addr.value != '') return;\n"
+  @"  addr = this.findAddressWithIndex(idx);\n"
+  @"  if(addr) {\n"
+  @"     var addresses = document.getElementById('addr_addresses');\n"
+  @"     addresses.removeChild(addr);\n"
+  @"  }\n"
+  @"  table = this.getTable();\n"
+  @"  senderRow = this.findRowWithIndex(idx);\n"
+  @"  table.removeChild(senderRow);\n"
   @"}\n"
   @"\n"
   @"function findAddressWithIndex(idx) {\n"
index bbe1a21b322100200a4bdc3f59f066115ed92b7c..d4e4663d64bd0c01a3449eab3d6d6c27683da7e8 100644 (file)
@@ -1,6 +1,6 @@
 # version file
 
-SUBMINOR_VERSION:=144
+SUBMINOR_VERSION:=145
 
 # v0.9.140 requires SoObjects/Mailer v0.9.100
 # v0.9.134 requires libSOGo          v0.9.41
index e4df4d1d5de174646d4356b0bc38c2b016f063c1..d4816b024fdf216286afa4d6d807e73a6f20ce0d 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-18  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * UIxMailToSelection.wox: changed JavaScript functions to be more
+         generic
+
 2005-07-15  Helge Hess  <helge.hess@opengroupware.org>
 
        * MailPartViewers/UIxMailPartICalViewer.wox: prepared support for iMIP
index 92d2bd34d3098441e7affebb0a0794279d219c57..6e217ef3271d195441d48576f1318d79b199795c 100644 (file)
@@ -29,7 +29,8 @@
                    var:name="currentAddressId"
                    type="text"
                    var:value="address"
-                   onblur="removeIfNecessary(this);"
+                   onfocus="addressFieldGotFocus(this);"
+                   onblur="addressFieldLostFocus(this);"
                    style="width: 100%;"
             />
           </td>