[commits-cosmo] (mde) [3973] Fix for bug 6075 -- IE6: All day events z-index issue.

Matthew Eernisse mde at osafoundation.org
Fri Mar 30 11:36:34 PST 2007


Hmm, that commit (r3973) should also fix bug 8170 -- Annoying 'object 
required' error on initial app load in IE6.

svncheckin at osafoundation.org wrote:
> Revision
>     3973 <http://cvs.osafoundation.org/viewcvs.cgi?rev=3973&view=rev>
> Author
>     mde
> Date
>     2007-03-30 12:21:28 -0700 (Fri, 30 Mar 2007)
> 
> 
>       Log Message
> 
> Fix for bug 6075 
> <http://bugzilla.osafoundation.org/show_bug.cgi?id=6075> -- IE6: All day 
> events z-index issue. Hide
> the content div while resizing, and hard-code the height of
> the content div to the visible height on drop. Also put a
> proper fix on the selection-on-drag problem in IE.
> 
> 
>       Modified Paths
> 
>     * cosmo/trunk/cosmo/src/main/webapp/js/cosmo/ui/cal_main.js
>       <#cosmotrunkcosmosrcmainwebappjscosmouical_mainjs>
>     * cosmo/trunk/cosmo/src/main/webapp/js/cosmo/ui/event/handlers.js
>       <#cosmotrunkcosmosrcmainwebappjscosmouieventhandlersjs>
>     * cosmo/trunk/cosmo/src/main/webapp/js/cosmo/ui/resize_area.js
>       <#cosmotrunkcosmosrcmainwebappjscosmouiresize_areajs>
>     * cosmo/trunk/cosmo/src/main/webapp/js/cosmo/view/cal/canvas.js
>       <#cosmotrunkcosmosrcmainwebappjscosmoviewcalcanvasjs>
> 
> 
>       Diff
> 
> 
>         Modified:
>         cosmo/trunk/cosmo/src/main/webapp/js/cosmo/ui/cal_main.js (3972
>         => 3973)
> 
> --- cosmo/trunk/cosmo/src/main/webapp/js/cosmo/ui/cal_main.js	2007-03-30 17:35:34 UTC (rev 3972)
> +++ cosmo/trunk/cosmo/src/main/webapp/js/cosmo/ui/cal_main.js	2007-03-30 19:21:28 UTC (rev 3973)
> @@ -289,12 +289,6 @@
>          // seems to reset the scrollTop in Safari
>          viewDiv.scrollTop = parseInt(HOUR_UNIT_HEIGHT*8);
>          
> -        // BANDAID for IE6 -- dummy element to force 100% height to render
> -        if (document.all) {
> -            var dummyElem = document.createElement('div');
> -            allDayDiv.appendChild(dummyElem);
> -        }
> -        
>          // Add event listeners for form-element behaviors
>          this.calForm.setEventListeners();
>  
> 
> 
>         Modified:
>         cosmo/trunk/cosmo/src/main/webapp/js/cosmo/ui/event/handlers.js
>         (3972 => 3973)
> 
> --- cosmo/trunk/cosmo/src/main/webapp/js/cosmo/ui/event/handlers.js	2007-03-30 17:35:34 UTC (rev 3972)
> +++ cosmo/trunk/cosmo/src/main/webapp/js/cosmo/ui/event/handlers.js	2007-03-30 19:21:28 UTC (rev 3973)
> @@ -86,11 +86,24 @@
>  cosmo.ui.event.handlers.mouseMoveHandler = function (e) {
>      var d = cosmo.app.dragItem;
>      // Set global x-y coords
> -    xPos = e ? e.pageX : window.event.x;
> -    yPos = e ? e.pageY : (window.event.y + document.body.scrollTop);
> +    if (e) {
> +        xPos = e.pageX;
> +        yPos = e.pageY;
> +    }
> +    else {
> +        xPos = window.event.x;
> +        yPos = window.event.y;
> +        if (document.body) {
> +            yPos += document.body.scrollTop;
> +        }
> +    }
> +    
>      // Drag the app's draggable if there is one
>      if (d) {
> -       d.doDrag(); 
> +        // Prevent text selection on drag in IE
> +        // Must turn it back on after drag operation completes
> +        document.body.onselectstart = function () { return false; }; 
> +        d.doDrag(); 
>      }
>  }
>  
> @@ -100,8 +113,11 @@
>   */
>  cosmo.ui.event.handlers.mouseUpHandler = function (e) {
>      // Drop anything the user is dragging
> -    if (cosmo.app.dragItem) {
> -        cosmo.app.dragItem.drop();
> +    var d = cosmo.app.dragItem;
> +    if (d) {
> +        d.drop();
> +        // Allow text selection again after Draggable is dropped
> +        document.body.onselectstart = null;
>          // Clear out the app draggable
>          cosmo.app.dragItem = null;
>      }
> 
> 
>         Modified:
>         cosmo/trunk/cosmo/src/main/webapp/js/cosmo/ui/resize_area.js
>         (3972 => 3973)
> 
> --- cosmo/trunk/cosmo/src/main/webapp/js/cosmo/ui/resize_area.js	2007-03-30 17:35:34 UTC (rev 3972)
> +++ cosmo/trunk/cosmo/src/main/webapp/js/cosmo/ui/resize_area.js	2007-03-30 19:21:28 UTC (rev 3973)
> @@ -26,9 +26,9 @@
>  ResizeAreaAdjacent = cosmo.ui.resize_area.ResizeAreaAdjacent;
>  
>  cosmo.ui.resize_area.ResizeArea = function (id, handleId) {
> -    
> +
>      var self = this;
> -    
> +
>      this.id = id;
>      this.handleId = handleId;
>      this.contentDiv = null;
> @@ -45,10 +45,12 @@
>          self.handleDiv = document.getElementById(this.handleId);
>          self.handleDiv.onmousedown = function() { cosmo.app.dragItem = self };
>          self.direction = dir ? dir : this.direction;
> -        self.origSize = this.getHeight(this.contentDiv) + 
> +        self.origSize = this.getHeight(this.contentDiv) +
>              self.getHeight(this.handleDiv);
>          self.dragSize = self.origSize;
> -        
> +        if (navigator.appVersion.indexOf('MSIE 6') > -1) {
> +            self.contentDiv.style.height = this.dragSize + 'px';
> +        }
>      };
>      this.addAdjacent = function(id) {
>          var div = document.getElementById(id);
> @@ -57,19 +59,22 @@
>              div, this.getAbsTop(div), this.getHeight(div));
>      };
>      this.setDragLimit = function() {
> -        this.dragLimit = this.adjacentArea[0].origPos + 
> -            this.adjacentArea[0].origSize - TOP_MENU_HEIGHT - 
> +        this.dragLimit = this.adjacentArea[0].origPos +
> +            this.adjacentArea[0].origSize - TOP_MENU_HEIGHT -
>              ALL_DAY_RESIZE_HANDLE_HEIGHT;
>      };
>      this.compareNumbers = function(a, b) { return a - b };
>      this.doDrag = function () {
> -        this.resize();  
> +        this.resize();
>      };
>      this.resize = function() {
>          var offset = this.contentDiv.offsetTop;
>          var pos = yPos - TOP_MENU_HEIGHT;
>          var size = (pos - offset);
>          var div = null;
> +        if (navigator.appVersion.indexOf('MSIE 6') > -1) {
> +            self.contentDiv.style.display = 'none';
> +        }
>          if (pos > offset && pos < this.dragLimit) {
>              this.contentDiv.style.height = size + 'px';
>              this.dragSize = (size + ALL_DAY_RESIZE_HANDLE_HEIGHT);
> @@ -77,15 +82,18 @@
>              for (var i = 0; i < this.adjacentArea.length; i++) {
>                  div = this.adjacentArea[i].div;
>                  div.style.top = (pos+8) + 'px';
> -                div.style.height = (((this.adjacentArea[i].origPos-yPos) + 
> +                div.style.height = (((this.adjacentArea[i].origPos-yPos) +
>                      this.adjacentArea[i].origSize) - 8) + 'px';
>              }
>          }
>      };
>      this.drop = function() {
> -        // Do nothing
> -        // This function is called when ResizeArea is the draggable
> -        // So drop method must be defined here
> +        // IE6 -- workaround z-index issue by actually truncating
> +        // inner content div height to visible height of area
> +        if (navigator.appVersion.indexOf('MSIE 6') > -1) {
> +            self.contentDiv.style.height = this.dragSize + 'px';
> +            self.contentDiv.style.display= 'block';
> +        }
>      };
>      this.getAbsTop = function(div) {
>          return div.offsetTop + Cal.top;
> 
> 
>         Modified:
>         cosmo/trunk/cosmo/src/main/webapp/js/cosmo/view/cal/canvas.js
>         (3972 => 3973)
> 
> --- cosmo/trunk/cosmo/src/main/webapp/js/cosmo/view/cal/canvas.js	2007-03-30 17:35:34 UTC (rev 3972)
> +++ cosmo/trunk/cosmo/src/main/webapp/js/cosmo/view/cal/canvas.js	2007-03-30 19:21:28 UTC (rev 3973)
> @@ -846,17 +846,15 @@
>              // Subtract one px for border per asinine CSS spec
>              var halfHourHeight = (HOUR_UNIT_HEIGHT/2) - 1;
>              
> -            function workingHoursLine() {
> -                var r = '';
> -                // Working/non-working hours line
> -                r += '<div class="';
> -                r += (j < 8 || j > 17) ? 'nonWorkingHours' : 'workingHours';
> -                r += '" style="width:' + workingHoursBarWidth + 
> -                    'px; height:' + (halfHourHeight+1) + 
> -                    'px; float:left; font-size:1px;">&nbsp;</div>';
> -                return r;
> -            }
> -            
> +            var w = '';
> +            // Working/non-working hours line
> +            w += '<div class="';
> +            w += (j < 8 || j > 17) ? 'nonWorkingHours' : 'workingHours';
> +            w += '" style="width:' + workingHoursBarWidth + 
> +                'px; height:' + (halfHourHeight+1) + 
> +                'px; float:left; font-size:1px;">&nbsp;</div>';
> +            var workingHoursLine = '';
> +
>              str = '';
>              viewDiv = timelineNode; 
>              timeLineWidth = parseInt(viewDiv.offsetWidth);
> @@ -880,7 +878,7 @@
>                  row += '<div class="hourDivSubLeft">' + hour + 
>                      meridian + '</div>';
>                  row += '</div>\n';
> -                row += workingHoursLine();
> +                row += workingHoursLine;
>                  row += '<br class="clearAll"/>'
>                  
>                  idstr = i + '-' + j + '30';
> @@ -898,7 +896,7 @@
>                  }
>                  row += ' width:' + timeLineWidth + 
>                      'px; float:left;">&nbsp;</div>\n';
> -                row += workingHoursLine();
> +                row += workingHoursLine;
>                  row += '<br class="clearAll"/>'
>                  
>                  str += row;
> @@ -1012,7 +1010,6 @@
>          showMonthHeader();
>          showDayNameHeaders();
>          showAllDayCols();
> -        showHours();
>          
>          // Create event listeners
>          if (!initRender) {
> @@ -1020,6 +1017,8 @@
>              dojo.event.connect(allDayColsNode, 'onmousedown', mouseDownHandler);
>              dojo.event.connect(hoursNode, 'ondblclick', dblClickHandler);
>              dojo.event.connect(allDayColsNode, 'ondblclick', dblClickHandler);
> +            
> +            showHours();
>          }
>  
>          initRender = true;
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Commits-Cosmo mailing list
> Commits-Cosmo at osafoundation.org
> http://lists.osafoundation.org/cgi-bin/mailman/listinfo/commits-cosmo



More information about the Commits-Cosmo mailing list