Changeset 1510

Show
Ignore:
Timestamp:
08/11/07 23:56:26
Author:
douglm
Message:

Bring admin rdates up to date with user

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/deployment/webadmin/webapp/resources/default/default/default.xsl

    r1508 r1510  
    16671667                        </select> 
    16681668                       <xsl:text> </xsl:text> 
    1669            
     1669 
    16701670                        <select name="tzid" id="rdateTzid" class="timezones"> 
    16711671                          <xsl:if test="form/floating/input/@checked='checked'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if> 
     
    16961696                      store as UTC 
    16971697                    </div> 
    1698            
     1698 
    16991699                    <!-- if there are no recurence dates, the following table will show --> 
    1700                     <table cellspacing="0" id="bwCurrentRdates"> 
     1700                    <table cellspacing="0" id="bwCurrentRdatesNone"> 
    17011701                      <tr><th>Recurrence Dates</th></tr> 
    17021702                      <tr><td>No recurrence dates</td></tr> 
    17031703                    </table> 
    1704                      
     1704 
    17051705                    <!-- if there are no recurence dates, the following table will show --> 
    17061706                    <table cellspacing="0" id="bwCurrentRdates"> 
     
    17151715                      </tr> 
    17161716                    </table> 
    1717                      
     1717 
    17181718                    <!-- if there are no recurence dates, the following table will show --> 
    17191719                    <table cellspacing="0" id="bwCurrentExdatesNone"> 
     
    17211721                      <tr><td>No exception dates</td></tr> 
    17221722                    </table> 
    1723                      
     1723 
    17241724                    <!-- if there are no recurence dates, the following table will show --> 
    17251725                    <table cellspacing="0" id="bwCurrentExdates"> 
     
    51285128      </table> 
    51295129    </form> 
    5130      
     5130 
    51315131    <div id="sharingBox"> 
    51325132      <xsl:apply-templates select="acl" mode="currentAccess"> 
     
    52435243                        <xsl:when test="contains($who,/bedeworkadmin/syspars/userPrincipalRoot)"><xsl:value-of select="substring-after(substring-after($who,normalize-space(/bedeworkadmin/syspars/userPrincipalRoot)),'/')"/></xsl:when> 
    52445244                        <xsl:when test="contains($who,/bedeworkadmin/syspars/groupPrincipalRoot)"><xsl:value-of select="substring-after(substring-after($who,normalize-space(/bedeworkadmin/syspars/groupPrincipalRoot)),'/')"/></xsl:when> 
    5245                         <xsl:otherwise></xsl:otherwise>  
     5245                        <xsl:otherwise></xsl:otherwise> 
    52465246                      </xsl:choose> 
    52475247                    </xsl:variable> 
  • trunk/deployment/webadmin/webapp/resources/resources/bedeworkEventForm.js

    r1508 r1510  
    5959  } 
    6060 
    61   /* row: current table row 
     61  /* varName: NOT GOOD - name of object 
     62   * reqPar: request par for hidden field 
     63   * row: current table row 
    6264   * rdi: index of rdate fro delete 
    6365   */ 
    64   this.toFormRow = function(reqPar, row, rdi) { 
     66  this.toFormRow = function(varName, reqPar, row, rdi) { 
    6567    row.insertCell(0).appendChild(document.createTextNode(this.date)); 
    6668    row.insertCell(1).appendChild(document.createTextNode(this.time)); 
    6769    row.insertCell(2).appendChild(document.createTextNode(this.tzid)); 
    68     row.insertCell(3).innerHTML = "<a href=\"javascript:bwRdates.deleteRdate('" + 
     70    row.insertCell(3).innerHTML = "<a href=\"javascript:" + varName + ".deleteDate('" + 
    6971                                   rdi + "')\">" + rdateDeleteStr + "</a>" + 
    70                                    "<input type='hidden' name='" + reqPar +  
     72                                   "<input type='hidden' name='" + reqPar + 
    7173                                   "' value='" + this.format() + "'/>"; 
    7274  } 
    73    
     75 
    7476  this.format= function() { 
    7577    var res = this.date + "\t" + this.time + "\t"; 
    76      
     78 
    7779    if (this.tzid != null) { 
    7880      res += "\t" + this.tzid; 
    7981    } 
    80      
     82 
    8183    return res; 
    8284  } 
    8385 
    8486  this.equals = function(that) { 
    85     return (that.val = this.val) && (that.tzid = this.tzid); 
    86   } 
    87 
    88  
    89 var bwRdates = new BwREXdates("rdate", "bwCurrentRdates", "bwCurrentRdatesNone", "visible", "invisible", 2); 
    90 var bwExdates = new BwREXdates("exdate", "bwCurrentExdates", "bwCurrentExdatesNone", "visible", "invisible", 2); 
    91  
    92 function BwREXdates(reqPar, tableId, noDatesId, visibleClass, invisibleClass, numHeaderRows) { 
    93   var rdates = new Array(); 
    94  
     87    return this.compareTo(that) == 0; 
     88  } 
     89 
     90  this.compareTo = function(that) { 
     91    var res = compareTo(that.date, this.date); 
     92    if (res != 0) { 
     93      return res; 
     94    } 
     95 
     96    res = compareTo(that.time, this.time); 
     97    if (res != 0) { 
     98      return res; 
     99    } 
     100 
     101    return compareTo(that.tzid, this.tzid); 
     102  } 
     103
     104 
     105function compareTo(thys, that) { 
     106  if (that < thys) { 
     107    return -1; 
     108  } 
     109 
     110  if (that > thys) { 
     111    return 1; 
     112  } 
     113 
     114  return 0; 
     115
     116 
     117function sortCompare(thys, that) { 
     118  return thys.compareTo(that); 
     119
     120 
     121var bwRdates = new BwREXdates("bwRdates", "rdate", "bwCurrentRdates", "bwCurrentRdatesNone", 
     122                              "visible", "invisible", 2); 
     123var bwExdates = new BwREXdates("bwExdates", "exdate", "bwCurrentExdates", "bwCurrentExdatesNone", 
     124                               "visible", "invisible", 2); 
     125 
     126/** Manipulate table of exception or recurrence dates. 
     127 * 
     128 * @param varName: NOT GOOD - name of object 
     129 * @param reqPar:    request parameter we gernate (multi-valued) 
     130 * @param tableId:   id of table we are manipulating 
     131 * @param noDatesId: some info to display when we have nothing 
     132 * @param visibleClass: class to set to make something visible 
     133 * @param invisibleClass: class to set to make something invisible 
     134 * @param numHeaderRows: Number of header rows in the table. 
     135 */ 
     136function BwREXdates(varName, reqPar, tableId, noDatesId, 
     137                    visibleClass, invisibleClass, numHeaderRows) { 
     138  var dates = new Array(); 
     139 
     140  this.varName = varName; 
    95141  this.reqPar = reqPar; 
    96142  this.tableId = tableId; 
     143  this.noDatesId = noDatesId; 
     144  this.visibleClass = visibleClass; 
     145  this.invisibleClass = invisibleClass; 
     146  this.numHeaderRows = numHeaderRows; 
    97147 
    98148  /* val: String: internal date 
     
    104154 
    105155    if (!this.contains(newRdate)) { 
    106       rdates.push(newRdate); 
     156      dates.push(newRdate); 
    107157    } 
    108158  } 
    109159 
    110160  this.contains = function(rdate) { 
    111     for (var j = 0; j < rdates.length; j++) { 
    112       var curRdate = rdates[j]; 
     161    for (var j = 0; j < dates.length; j++) { 
     162      var curRdate = dates[j]; 
    113163      if (curRdate.equals(rdate)) { 
    114164        return true; 
     
    119169  } 
    120170 
    121   // Update the list - expects the browser form object 
     171  // Update the list - 
    122172  this.update = function(date, time, allDay, floating, utc, tzid) { 
    123173    this.addRdate(date, time, allDay, floating, utc, tzid); 
     
    127177  } 
    128178 
    129   this.deleteRdate = function(index) { 
    130     rdates.splice(index, 1); 
     179  this.deleteDate = function(index) { 
     180    dates.splice(index, 1); 
    131181 
    132182    // redraw the display 
     
    138188    try { 
    139189      // get the table body 
    140       var rdTableBody = document.getElementById(this.tableId).tBodies[0]; 
     190      var rdTableBody = document.getElementById(tableId).tBodies[0]; 
    141191 
    142192      // remove existing rows 
    143       for (i = rdTableBody.rows.length - 1; i >= 0; i--) { 
     193      for (i = rdTableBody.rows.length - 1; i >= numHeaderRows; i--) { 
    144194        rdTableBody.deleteRow(i); 
    145195      } 
    146196 
     197      dates.sort(sortCompare); 
     198 
    147199      // recreate the table rows 
    148       for (var j = 0; j < rdates.length; j++) { 
    149         var curRdate = rdates[j]; 
    150         var tr = rdTableBody.insertRow(j); 
    151  
    152         curRdate.toFormRow(this.reqPar, tr, j); 
     200      for (var j = 0; j < dates.length; j++) { 
     201        var curRdate = dates[j]; 
     202        var tr = rdTableBody.insertRow(j + numHeaderRows); 
     203 
     204        curRdate.toFormRow(varName, reqPar, tr, j); 
     205      } 
     206 
     207      if (dates.length == 0) { 
     208        changeClass(tableId, invisibleClass); 
     209        changeClass(noDatesId, visibleClass); 
     210      } else { 
     211        changeClass(tableId, visibleClass); 
     212        changeClass(noDatesId, invisibleClass); 
    153213      } 
    154214    } catch (e) { 
     
    164224  setDates(formObj); 
    165225  setRecurrence(formObj); 
     226  setAccessHow(formObj,1); 
     227  //setAccessAcl(formObj); 
    166228} 
    167229function setDates(formObj) {