Changeset 1501

Show
Ignore:
Timestamp:
08/09/07 10:24:48
Author:
douglm
Message:

Partial javascript rdate support

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/deployment/webuser/webapp/resources/demoskins/resources/bedeworkAccess.js

    r1453 r1501  
    495495  } 
    496496 
     497  // row: current row in table 
     498  // aceI: index of the ace 
    497499  this.toFormRow = function(row, aceI) { 
    498500    row.insertCell(0).appendChild(document.createTextNode(this.principal.format())); 
  • trunk/deployment/webuser/webapp/resources/demoskins/resources/bedeworkEventForm.js

    r1448 r1501  
    3131dojo.require("dojo.widget.DropdownTimePicker"); 
    3232 
     33// ======================================================================== 
     34// ======================================================================== 
     35//   Language and customization 
     36//   These should come from values in the header or included as a separate cutomization 
     37//   file. 
     38 
     39var deleteStr = "remove"; 
     40 
     41// ======================================================================== 
     42// rdate functions 
     43// ======================================================================== 
     44 
     45/* val: String: internal date 
     46 * dateOnly: boolean 
     47 */ 
     48function bwDate(val, dateOnly) { 
     49  this.val = val; 
     50  this.dateOnly = dateOnly; 
     51 
     52  this.toString = function() { 
     53    return val; 
     54  } 
     55 
     56  this.format = function() { 
     57    return val; 
     58  } 
     59} 
     60 
     61/* An rdate 
     62 * val: date or datetime value 
     63 * tzid timezone id or null 
     64 */ 
     65function bwRdate(val, tzid) { 
     66  this.val = val; 
     67  this.tzid = tzid; 
     68 
     69  this.toString = function() { 
     70  } 
     71 
     72  /* row: current table row 
     73   * rdi: index of rdate fro delete 
     74   */ 
     75  this.toFormRow = function(row, rdi) { 
     76    row.insertCell(0).appendChild(document.createTextNode(this.val.format())); 
     77    row.insertCell(1).appendChild(document.createTextNode(this.tzid)); 
     78    row.insertCell(2).innerHTML = "<a href=\"javascript:bwRdates.deleteRdate('" + 
     79                                   rdi + "')\">" + rdateDeleteStr + "</a>"; 
     80  } 
     81 
     82  this.equals = function(that) { 
     83    return (that.val = this.val) && (that.tzid = this.tzid); 
     84  } 
     85} 
     86 
     87var bwRdates = new function() { 
     88  var rdates = new Array(); 
     89 
     90  /* val: String: internal date 
     91   * dateOnly: boolean 
     92   * tzid: String or null 
     93   */ 
     94  this.addRdate(val, dateOnly, tzid) { 
     95    var newRdate = new bwRdate(new bwDate(val, dateOnly), tzid); 
     96 
     97    if (!this.contains(newRdate)) { 
     98      rdates.push(newRdate); 
     99    } 
     100  } 
     101 
     102  this.contains(rdate) { 
     103    for (var j = 0; j < rdates.length; j++) { 
     104      var curRdate = rdates[j]; 
     105      if (curRdate.equals(rdate)) { 
     106        return true; 
     107      } 
     108    } 
     109 
     110    return false; 
     111  } 
     112 
     113  this.deleteRdate = function(index) { 
     114    rdates.splice(index, 1); 
     115 
     116    // redraw the display 
     117    this.display(); 
     118  } 
     119 
     120  // update the rdates table displayed on screen 
     121  this.display = function() { 
     122    try { 
     123      // get the table body 
     124      var rdTableBody = document.getElementById("bwCurrentRdates").tBodies[0]; 
     125 
     126      // remove existing rows 
     127      for (i = rdTableBody.rows.length - 1; i >= 0; i--) { 
     128        rdTableBody.deleteRow(i); 
     129      } 
     130 
     131      // recreate the table rows 
     132      for (var j = 0; j < rdates.length; j++) { 
     133        var curRdate = rdates[j]; 
     134        var tr = rdTableBody.insertRow(j); 
     135 
     136        curRdate.toFormRow(tr, j); 
     137      } 
     138    } catch (e) { 
     139      alert(e); 
     140    } 
     141  } 
     142 
     143  // generate request parameters 
     144  this.toRequest = function() { 
     145    var res = xmlHeader + "\n<D:acl " + nameSpaces + " >\n"; 
     146 
     147    for (var j = 0; j < aces.length; j++) { 
     148      res += aces[j].toXml(); 
     149    } 
     150 
     151    return res + "</D:acl>"; 
     152  } 
     153} 
     154 
     155// ======================================================================== 
     156// ======================================================================== 
     157 
    33158function setEventFields(formObj) { 
    34159  setDates(formObj); 
     
    37162  //setAccessAcl(formObj); 
    38163} 
     164 
    39165function setDates(formObj) { 
    40166  var startDate = new Date(); 
     
    50176  formObj["eventEndDate.day"].value = endDate.getDate(); 
    51177} 
     178 
    52179function swapAllDayEvent(obj) { 
    53180  allDayStartDateField = document.getElementById("allDayStartDateField"); 
     
    102229  } 
    103230} 
     231 
    104232function swapRdateAllDay(obj) { 
    105233  if (obj.checked) { 
     
    211339  } 
    212340} 
     341 
    213342function recurSelectWeekends(id) { 
    214343  chkBoxCollection = document.getElementById(id).getElementsByTagName('input'); 
     
    225354  } 
    226355} 
     356 
    227357function recurSelectWeekdays(id) { 
    228358  chkBoxCollection = document.getElementById(id).getElementsByTagName('input'); 
     
    239369  } 
    240370} 
     371 
    241372function selectRecurCountUntil(id) { 
    242373  document.getElementById(id).checked = true; 
    243374} 
     375 
    244376// Assemble the recurrence rules if recurrence is specified. 
    245377// Request params to set ('freq' is always set):