Changeset 2918

Show
Ignore:
Timestamp:
05/24/10 17:11:00
Author:
johnsa
Message:

user client: scheduling widget duration fields now interact with the widget and main form

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/eventForm.xsl

    r2913 r2918  
    426426              <xsl:choose> 
    427427                <xsl:when test="form/end/type='E'"> 
    428                   <input type="radio" name="eventEndType" value="E" checked="checked" onclick="changeClass('endDateTime','shown');changeClass('endDuration','invisible');"/> 
     428                  <input type="radio" name="eventEndType" id="eventEndTypeDateTime" value="E" checked="checked" onclick="changeClass('endDateTime','shown');changeClass('endDuration','invisible');"/> 
    429429                </xsl:when> 
    430430                <xsl:otherwise> 
    431                   <input type="radio" name="eventEndType" value="E" onclick="changeClass('endDateTime','shown');changeClass('endDuration','invisible');"/> 
     431                  <input type="radio" name="eventEndType" id="eventEndTypeDateTime" value="E" onclick="changeClass('endDateTime','shown');changeClass('endDuration','invisible');"/> 
    432432                </xsl:otherwise> 
    433433              </xsl:choose> 
     
    520520                <xsl:choose> 
    521521                  <xsl:when test="form/end/type='D'"> 
    522                     <input type="radio" name="eventEndType" value="D" checked="checked" onclick="changeClass('endDateTime','invisible');changeClass('endDuration','shown');"/> 
     522                    <input type="radio" name="eventEndType" id="eventEndTypeDuration" value="D" checked="checked" onclick="changeClass('endDateTime','invisible');changeClass('endDuration','shown');"/> 
    523523                  </xsl:when> 
    524524                  <xsl:otherwise> 
    525                     <input type="radio" name="eventEndType" value="D" onclick="changeClass('endDateTime','invisible');changeClass('endDuration','shown');"/> 
     525                    <input type="radio" name="eventEndType" id="eventEndTypeDuration" value="D" onclick="changeClass('endDateTime','invisible');changeClass('endDuration','shown');"/> 
    526526                  </xsl:otherwise> 
    527527                </xsl:choose> 
     
    612612                <xsl:choose> 
    613613                  <xsl:when test="form/end/type='N'"> 
    614                     <input type="radio" name="eventEndType" value="N" checked="checked" onclick="changeClass('endDateTime','invisible');changeClass('endDuration','invisible');"/> 
     614                    <input type="radio" name="eventEndType" id="eventEndTypeNone" value="N" checked="checked" onclick="changeClass('endDateTime','invisible');changeClass('endDuration','invisible');"/> 
    615615                  </xsl:when> 
    616616                  <xsl:otherwise> 
    617                     <input type="radio" name="eventEndType" value="N" onclick="changeClass('endDateTime','invisible');changeClass('endDuration','invisible');"/> 
     617                    <input type="radio" name="eventEndType" id="eventEndTypeNone" value="N" onclick="changeClass('endDateTime','invisible');changeClass('endDuration','invisible');"/> 
    618618                  </xsl:otherwise> 
    619619                </xsl:choose> 
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/javascript/bedeworkScheduling.js

    r2913 r2918  
    102102      }   
    103103    } 
    104   } 
    105 } 
     104  }; 
     105}; 
    106106 
    107107/* A Freebusy object 
     
    163163    } 
    164164    return false; 
    165   } 
    166 } 
     165  }; 
     166}; 
    167167 
    168168/* Object to model the freebusy grid 
     
    238238      this.display(); 
    239239    } 
    240   } 
     240  }; 
    241241   
    242242  // add/update attendees 
     
    263263    } 
    264264     
    265   } 
     265  }; 
    266266   
    267267  this.removeAttendee = function(index) { 
    268268    this.attendees.splice(index, 1); 
    269269    this.requestFreeBusy();  
    270   } 
     270  }; 
    271271   
    272272  this.requestFreeBusy = function() { 
     
    297297      bwGrid.display(); 
    298298    }); 
    299   } 
     299  }; 
    300300   
    301301  this.pickNext = function() { 
     
    325325    // this flag lets us highlight the very first free time window on first click 
    326326    pickNextClicked = true; 
    327   }  
     327  }; 
    328328   
    329329  this.pickPrevious = function() { 
     
    347347      } 
    348348    }); 
    349   } 
     349  }; 
    350350   
    351351  // create the lookup values for a free window for use with picknext/previous 
     
    369369      } 
    370370    } 
    371   } 
     371  }; 
    372372   
    373373  this.setIncrement = function(val) { 
    374374    this.hourDivision = val; 
    375375    this.display(); 
    376   } 
    377    
    378   this.display = function(width) { 
     376  }; 
     377   
     378  // The scheduling duration fields have been modified. 
     379  // Update the corresponding form elements and set the  
     380  // duration for selection in the grid. 
     381  this.bwSchedChangeDuration = function(inputId) {         
     382    var days = parseInt($("#durationDaysSched").val()); 
     383    var hours = parseInt($("#durationHoursSched").val()); 
     384    var mins = parseInt($("#durationMinutesSched").val()); 
     385         
     386    //do some form validation - make sure the durations are integers 
     387    if (isNaN(days) || isNaN(hours) || isNaN(mins)) { 
     388      alert("Please enter an integer value for durations.") 
     389      //$(inputId).focus(); // this doesn't work at the moment... 
     390      return false; 
     391    } 
     392     
     393    // force duration on the basic tab 
     394    $("#standardForm input[name='eventEndType']").val("D"); 
     395    $("#eventEndTypeDuration").attr("checked","checked"); 
     396    changeClass('endDateTime','invisible'); 
     397    changeClass('endDuration','shown'); 
     398     
     399    // set the basic tab's duration values 
     400    $("#durationDays").val(days); 
     401    $("#durationHours").val(hours); 
     402    $("#durationMinutes").val(mins); 
     403     
     404    // set the scheduling duration field values from the parsed values 
     405    // -- this strips any floating point values from user input 
     406    $("#durationDaysSched").val(days); 
     407    $("#durationHoursSched").val(hours); 
     408    $("#durationMinutesSched").val(mins); 
     409     
     410    // set the duration in the bwGrid and recalculate cells  
     411    durationMils = (days * 86400000) + (hours * 3600000) + (mins * 60000); 
     412    cellsInDuration = durationMils / incrementMils; 
     413    // repopulate the free time lookup 
     414    this.setFreeTime(); 
     415  }; 
     416   
     417  this.display = function() { 
    379418    try { 
    380419      // number of days to display 
     
    800839      ); 
    801840       
    802       // now add some actions  
    803       // to the elements of the freebusy control buttons ... 
    804       // while these are not actually part of the grid, the 
    805       // actions exposed interact with it 
     841      // now add some interactions between the freebusy control buttons, 
     842      // the scheduling widget, and the rest of the form. 
    806843       
    807844      $("#bwSchedOptions").click(function() { 
    808         alert("?"); 
    809845        $("bwFbOptionsMenu").show("fast"); 
     846      }); 
     847       
     848      $("#durationDaysSched").change(function() { 
     849        bwGrid.bwSchedChangeDuration("#durationDaysSched"); 
     850      }); 
     851       
     852      $("#durationHoursSched").change(function() { 
     853        bwGrid.bwSchedChangeDuration("#durationHoursSched"); 
     854      }); 
     855       
     856      $("#durationMinutesSched").change(function() { 
     857        bwGrid.bwSchedChangeDuration("#durationMinutesSched"); 
    810858      }); 
    811859       
     
    821869    alert("Fb values:\n" + myString); 
    822870    */ 
    823   } 
    824 } 
     871  }; 
     872}; 
    825873 
    826874// Utilities 
     
    829877  // 86400000 is the number of milliseconds in a day; 
    830878  return Math.round((Math.abs(startDate.getTime() - endDate.getTime())) / 86400000) 
    831 } 
     879}; 
    832880 
    833881// DATE PROTOTYPE OVERRIDES - should be pulled into a library 
     
    836884  var m = ['January','February','March','April','May','June','July','August','September','October','November','December']; 
    837885  return m[this.getMonth()]; 
    838 } 
     886}; 
    839887Date.prototype.getDayName = function() { 
    840888  var d = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; 
    841889  return d[this.getDay()]; 
    842 }  
     890};  
    843891Date.prototype.addDays = function(days) { 
    844892  this.setDate(this.getDate() + days); 
    845 }  
     893};  
    846894Date.prototype.addHours = function(hours) { 
    847895  this.setHours(this.getHours() + hours); 
    848 } 
     896}; 
    849897Date.prototype.addMinutes = function(minutes) { 
    850898  this.setMinutes(this.getMinutes() + minutes); 
    851 } 
     899}; 
    852900// return a twelve-hour hour 
    853901Date.prototype.getHours12 = function() { 
     
    857905  }  
    858906  return hours12; 
    859 } 
     907}; 
    860908// prepend minutes with zero if needed 
    861909Date.prototype.getMinutesFull = function() { 
     
    865913  }   
    866914  return hours12; 
    867 } 
     915}; 
    868916 
    869917/* UTC FORMATTERS */ 
     
    876924  }   
    877925  return monthFull; 
    878 } 
     926}; 
    879927// return a formatted UTC day date, prepended with zero if needed 
    880928Date.prototype.getUTCDateFull = function() { 
     
    884932  }   
    885933  return dateFull; 
    886 } 
     934}; 
    887935// return formatted UTC hours, prepended with zero if needed 
    888936Date.prototype.getUTCHoursFull = function() { 
     
    892940  }   
    893941  return hoursFull; 
    894 } 
     942}; 
    895943// return formatted UTC minutes, prepended with zero if needed 
    896944Date.prototype.getUTCMinutesFull = function() { 
     
    900948  }   
    901949  return minutesFull; 
    902 } 
     950}; 
    903951 
    904952/*