Fix bug 815568 - Cannot remove any but last attendee in attendees dialog. r=mmecca,a=philipp
authorPhilipp Kewisch <mozilla@kewis.ch>
Tue, 27 Nov 2012 11:27:51 +0100
changeset 13615 a38bc62c8484328996fe339bb62b7e02887d7dc5
parent 13614 0dc051fb48ccbcde93861adaa2699cb036f8aa6b
child 13616 7c6897b7efac220e5e5b7baddb44bddd3eebc16f
push id32
push usermatthew.mecca@gmail.com
push dateFri, 08 Feb 2013 20:54:18 +0000
reviewersmmecca, philipp
bugs815568
Fix bug 815568 - Cannot remove any but last attendee in attendees dialog. r=mmecca,a=philipp
calendar/base/content/dialogs/calendar-event-dialog-attendees.xml
--- a/calendar/base/content/dialogs/calendar-event-dialog-attendees.xml
+++ b/calendar/base/content/dialogs/calendar-event-dialog-attendees.xml
@@ -16,38 +16,41 @@
     <content>
       <xul:listbox anonid="listbox"
                    seltype="multiple"
                    class="listbox-noborder"
                    rows="-1"
                    flex="1">
         <xul:listcols>
           <xul:listcol/>
+          <xul:listcol/>
           <xul:listcol flex="1"/>
         </xul:listcols>
         <xul:listitem anonid="item" class="addressingWidgetItem" allowevents="true">
           <xul:listcell class="addressingWidgetCell" align="center" pack="center">
             <xul:image id="attendeeCol1#1" anonid="rolestatus-icon"/>
           </xul:listcell>
           <xul:listcell class="addressingWidgetCell">
-            <xul:textbox id="attendeeCol2#1"
+              <xul:image id="attendeeCol2#1" anonid="usertype-icon" class="usertype-icon" onclick="this.parentNode.select();"/>
+          </xul:listcell>
+          <xul:listcell class="addressingWidgetCell">
+            <xul:textbox id="attendeeCol3#1"
                          anonid="input"
                          class="plain textbox-addressingWidget uri-element"
                          type="autocomplete"
                          flex="1"
                          autocompletesearch="addrbook ldap"
                          timeout="300"
                          maxrows="4"
                          completedefaultindex="true"
                          forcecomplete="true"
                          minresultsforpopup="1"
                          onblur="if (this.localName == 'textbox') document.getBindingParent(this).onBlurInput(event);"
                          ignoreblurwhilesearching="true"
                          oninput="this.setAttribute('dirty', 'true');">
-              <xul:image id="attendeeCol3#1" anonid="usertype-icon" class="usertype-icon" onclick="this.parentNode.select();"/>
             </xul:textbox>
           </xul:listcell>
         </xul:listitem>
       </xul:listbox>
     </content>
 
     <implementation>
       <field name="mMaxAttendees">0</field>
@@ -276,18 +279,18 @@
           if (aDisableIfOrganizer && aAttendee && aAttendee.isOrganizer) {
               input.setAttribute("disabled", "true");
           }
 
           this.mMaxAttendees++;
           var rowNumber = this.mMaxAttendees;
           if (rowNumber >= 0) {
               roleStatusIcon.setAttribute("id", "attendeeCol1#" + rowNumber);
-              input.setAttribute("id", "attendeeCol2#" + rowNumber);
-              userTypeIcon.setAttribute("id", "attendeeCol3#" + rowNumber);
+              userTypeIcon.setAttribute("id", "attendeeCol2#" + rowNumber);
+              input.setAttribute("id", "attendeeCol3#" + rowNumber);
           }
 
           if (!aAttendee) {
               aAttendee = this.createAttendee();
           }
 
           // construct the display string from common name and/or email address.
           var inputValue = aAttendee.commonName;
@@ -391,18 +394,18 @@
                   roleStatusIcon.setAttribute("disabled", "true");
                   userTypeIcon.setAttribute("disabled", "true");
               }
 
               this.mMaxAttendees++;
               var rowNumber = this.mMaxAttendees;
               if (rowNumber >= 0) {
                   roleStatusIcon.setAttribute("id", "attendeeCol1#" + rowNumber);
-                  input.setAttribute("id", "attendeeCol2#" + rowNumber);
-                  userTypeIcon.setAttribute("id", "attendeeCol3#" + rowNumber);
+                  userTypeIcon.setAttribute("id", "attendeeCol2#" + rowNumber);
+                  input.setAttribute("id", "attendeeCol3#" + rowNumber);
               }
 
               input.value = null;
               input.removeAttribute("value");
               input.attendee = newAttendee;
 
               // set role and participation status
               //status.setAttribute("status", newAttendee.participationStatus);
@@ -424,17 +427,17 @@
               // For now we'll just put in a hack that ensures the focused attribute
               // is never copied when the node is cloned.
               if (input.getAttribute('focused') != '') {
                   input.removeAttribute('focused');
               }
 
               // this copies the autocomplete sessions list from first attendee
               if (this.mLDAPSession && this.mSessionAdded) {
-                  input.syncSessions(document.getAnonymousElementByAttribute(this, "id", 'attendeeCol2#1'));
+                  input.syncSessions(document.getAnonymousElementByAttribute(this, "id", 'attendeeCol3#1'));
               }
 
               // focus on new input widget
               if (aSetFocus) {
                   this.setFocus(newNode);
               }
           }
           return newNode;
@@ -709,20 +712,20 @@
     <method name="_fillListItemWithEntry">
         <parameter name="listitem"/>
         <parameter name="entry"/>
         <parameter name="rowNumber"/>
         <body><![CDATA[
             let newAttendee = this.createAttendee(entry);
             let input = document.getAnonymousElementByAttribute(listitem, "anonid", "input");
             input.removeAttribute("disabled");
-            input.setAttribute("id", "attendeeCol2#" + rowNumber);
+            input.setAttribute("id", "attendeeCol3#" + rowNumber);
 
             if (this.mLDAPSession && this.mSessionAdded) {
-                input.syncSessions(document.getElementById('attendeeCol2#1'));
+                input.syncSessions(document.getElementById('attendeeCol3#1'));
             }
 
             input.attendee = newAttendee;
             input.value = entry;
             input.setAttribute("value", entry);
             input.setAttribute("dirty", "true");
             if (input.getAttribute('focused') != '') {
                 input.removeAttribute('focused');
@@ -731,17 +734,17 @@
             let roleStatusIcon = document.getAnonymousElementByAttribute(listitem, "anonid", "rolestatus-icon");
             roleStatusIcon.removeAttribute("disabled");
             roleStatusIcon.setAttribute("id", "attendeeCol1#" + rowNumber);
             roleStatusIcon.setAttribute("class", "role-icon");
             roleStatusIcon.setAttribute("role", newAttendee.role);
 
             let userTypeIcon = document.getAnonymousElementByAttribute(listitem, "anonid", "userstatus-icon");
             userTypeIcon.removeAttribute("disabled");
-            userTypeIcon.setAttribute("id", "attendeeCol3#" + rowNumber);
+            userTypeIcon.setAttribute("id", "attendeeCol2#" + rowNumber);
             userTypeIcon.setAttribute("cutype", newAttendee.userType);
           ]]></body>
     </method>
 
     <method name="resolvePotentialList">
         <parameter name="input"/>
         <body><![CDATA[
             let fieldValue = input.value;
@@ -765,20 +768,20 @@
                           }
                           this.mMaxAttendees += entries.length;
                           for (let i = currentIndex; i <= this.mMaxAttendees; i++) {
                               let row = template.parentNode.childNodes[i];
                               let roleStatusIcon = document.getAnonymousElementByAttribute(row, "anonid", "rolestatus-icon");
                               roleStatusIcon.setAttribute("id", "attendeeCol1#" + i);
 
                               let userTypeIcon = document.getAnonymousElementByAttribute(row, "anonid", "usertype-icon");
-                              userTypeIcon.setAttribute("id", "attendeeCol3#" + i);
+                              userTypeIcon.setAttribute("id", "attendeeCol2#" + i);
 
                               let input = document.getAnonymousElementByAttribute(row, "anonid", "input");
-                              input.setAttribute("id", "attendeeCol2#" + i);
+                              input.setAttribute("id", "attendeeCol3#" + i);
                               input.setAttribute("dirty", "true");
                           }
                       }
                   }
               }
             ]]></body>
       </method>
 
@@ -1024,17 +1027,17 @@
         ]]></body>
       </method>
 
       <!-- This method returns the <xul:textbox> that contains
            the name of the attendee at row number 'aRow' -->
       <method name="getInputElement">
         <parameter name="aRow"/>
         <body><![CDATA[
-          return document.getAnonymousElementByAttribute(this, "id", "attendeeCol2#" + aRow);
+          return document.getAnonymousElementByAttribute(this, "id", "attendeeCol3#" + aRow);
         ]]></body>
       </method>
 
       <method name="getRoleElement">
         <parameter name="aRow"/>
         <body><![CDATA[
           return document.getAnonymousElementByAttribute(this, "id", "attendeeCol1#" + aRow);
         ]]></body>
@@ -1045,17 +1048,17 @@
         <body><![CDATA[
           return document.getAnonymousElementByAttribute(this, "id", "attendeeCol1#" + aRow);
         ]]></body>
       </method>
 
       <method name="getUserTypeElement">
         <parameter name="aRow"/>
         <body><![CDATA[
-          return document.getAnonymousElementByAttribute(this, "id", "attendeeCol3#" + aRow);
+          return document.getAnonymousElementByAttribute(this, "id", "attendeeCol2#" + aRow);
         ]]></body>
       </method>
 
       <method name="setFocus">
         <parameter name="aRow"/>
         <body><![CDATA[
           var self = this;
           var set_focus = function() {