Changeset 1503

Show
Ignore:
Timestamp:
08/09/07 17:05:45
Author:
johnsa
Message:

personal client: making rdate and exdate into javascript widgets

Files:

Legend:

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

    r1485 r1503  
    26852685            <xsl:if test="form/recurringEntity = 'true'"><xsl:attribute name="class">visible</xsl:attribute></xsl:if> 
    26862686 
    2687             <!-- show or hide rrules fields: --> 
    2688             <input type="checkbox" name="rrulesFlag" onclick="swapRrules(this)" value="on"/> 
    2689             <span id="rrulesSwitch"> 
    2690               <xsl:choose> 
    2691                 <xsl:when test="form/recurrence"> 
    2692                   change recurrence rules 
    2693                 </xsl:when> 
    2694                 <xsl:otherwise> 
    2695                   create recurrence rules 
    2696                 </xsl:otherwise> 
    2697               </xsl:choose> 
    2698             </span> 
    2699             <span id="rrulesUiSwitch" class="invisible"> 
     2687            <!-- show or hide rrules fields when editing: --> 
     2688            <xsl:if test="form/recurrence"> 
     2689              <input type="checkbox" name="rrulesFlag" onclick="swapRrules(this)" value="on"/> 
     2690              <span id="rrulesSwitch"> 
     2691                change recurrence rules 
     2692              </span> 
     2693            </xsl:if> 
     2694            <span id="rrulesUiSwitch"> 
     2695              <xsl:if test="form/recurrence"> 
     2696                <xsl:attribute name="class">invisible</xsl:attribute> 
     2697              </xsl:if> 
    27002698              <input type="checkbox" name="rrulesUiSwitch" value="advanced" onchange="swapVisible(this,'advancedRrules')"/> 
    27012699              show advanced recurrence rules 
     
    28202818 
    28212819            <!-- wrapper for rrules: --> 
    2822             <table id="rrulesTable" cellspacing="0" class="invisible"> 
     2820            <table id="rrulesTable" cellspacing="0"> 
     2821              <xsl:if test="form/recurrence"> 
     2822                <xsl:attribute name="class">invisible</xsl:attribute> 
     2823              </xsl:if> 
    28232824              <tr> 
    28242825                <td id="recurrenceFrequency" rowspan="2"> 
     
    30883089            </table> 
    30893090            <!-- recurrence dates (rdates) --> 
    3090             <div id="recurrenceDatesButton"> 
     3091            <!--<div id="recurrenceDatesButton"> 
    30913092              <input type="button" value="manage recurrence &amp; exception dates" onclick="launchSizedWindow('{$event-showRdates}','560','400')"/> 
     3093            </div>--> 
     3094            <h4 id="dialogTitle"> 
     3095              Recurrence and Exception Dates 
     3096            </h4> 
     3097            <div id="raContent"> 
     3098              <div class="dateStartEndBox" id="rdatesFormFields"> 
     3099                <div class="dateFields"> 
     3100                  <input name="eventRdate.date" 
     3101                         dojoType="dropdowndatepicker" 
     3102                         formatLength="medium" 
     3103                         value="today" 
     3104                         saveFormat="yyyyMMdd" 
     3105                         id="bwEventWidgeRdate" 
     3106                         iconURL="{$resourcesRoot}/resources/calIcon.gif"/> 
     3107                </div> 
     3108                <div id="rdateTimeFields" class="timeFields"> 
     3109                 <select name="eventRdate.hour"> 
     3110                    <option value="00">00</option> 
     3111                    <option value="01">01</option> 
     3112                    <option value="02">02</option> 
     3113                    <option value="03">03</option> 
     3114                    <option value="04">04</option> 
     3115                    <option value="05">05</option> 
     3116                    <option value="06">06</option> 
     3117                    <option value="07">07</option> 
     3118                    <option value="08">08</option> 
     3119                    <option value="09">09</option> 
     3120                    <option value="10">10</option> 
     3121                    <option value="11">11</option> 
     3122                    <option value="12" selected="selected">12</option> 
     3123                    <option value="13">13</option> 
     3124                    <option value="14">14</option> 
     3125                    <option value="15">15</option> 
     3126                    <option value="16">16</option> 
     3127                    <option value="17">17</option> 
     3128                    <option value="18">18</option> 
     3129                    <option value="19">19</option> 
     3130                    <option value="20">20</option> 
     3131                    <option value="21">21</option> 
     3132                    <option value="22">22</option> 
     3133                    <option value="23">23</option> 
     3134                  </select> 
     3135                  <select name="eventRdate.minute"> 
     3136                    <option value="00" selected="selected">00</option> 
     3137                    <option value="05">05</option> 
     3138                    <option value="10">10</option> 
     3139                    <option value="15">15</option> 
     3140                    <option value="20">20</option> 
     3141                    <option value="25">25</option> 
     3142                    <option value="30">30</option> 
     3143                    <option value="35">35</option> 
     3144                    <option value="40">40</option> 
     3145                    <option value="45">45</option> 
     3146                    <option value="50">50</option> 
     3147                    <option value="55">55</option> 
     3148                  </select> 
     3149                 <xsl:text> </xsl:text> 
     3150     
     3151                  <select name="tzid" id="rdateTzid" class="timezones"> 
     3152                    <xsl:if test="form/floating/input/@checked='checked'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if> 
     3153                    <option value="-1">select timezone...</option> 
     3154                    <xsl:variable name="rdateTzId" select="/bedework/rdates/tzid"/> 
     3155                    <xsl:for-each select="/bedework/timezones/timezone"> 
     3156                      <option> 
     3157                        <xsl:attribute name="value"><xsl:value-of select="id"/></xsl:attribute> 
     3158                        <xsl:if test="$rdateTzId = id"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if> 
     3159                        <xsl:value-of select="name"/> 
     3160                      </option> 
     3161                    </xsl:for-each> 
     3162                  </select> 
     3163                </div> 
     3164                <xsl:text> </xsl:text> 
     3165                <!--bwRdates.update() accepts: date, time, allDay, floating, utc, tzid--> 
     3166                <input type="button" name="rdate" value="add recurrence" onclick="bwRdates.update(this.form['eventRdate.date'].value,this.form['eventRdate.hour'].value + this.form['eventRdate.minute'].value,false,false,false,this.form.tzid.value)"/> 
     3167                <input type="button" name="exdate" value="add exception" onclick="bwExdates.update(this.form['eventRdate.date'].value,this.form['eventRdate.hour'].value + this.form['eventRdate.minute'].value,false,false,false,this.form.tzid.value)"/> 
     3168                <br/> 
     3169                <!-- dateonly (anniversary) event: this is temporary - should be determined by the main event --> 
     3170                <input type="checkbox" name="dateOnly" id="rdateDateOnly" onclick="swapRdateAllDay(this)" value="true"/> 
     3171                all day 
     3172                <!-- floating event: no timezone (and not UTC) --> 
     3173                <input type="checkbox" name="floating" id="rdateFloating" onclick="swapRdateFloatingTime(this)" value="true"/> 
     3174                floating 
     3175                <!-- store time as coordinated universal time (UTC) --> 
     3176                <input type="checkbox" name="storeUTC" id="rdateStoreUTC" onclick="swapRdateStoreUTC(this)" value="true"/> 
     3177                store as UTC 
     3178              </div> 
     3179     
     3180     
     3181              <h3>Recurrence Dates</h3> 
     3182              <table cellspacing="0" class="rdatesTable" id="bwCurrentRdates"> 
     3183                <xsl:choose> 
     3184                  <xsl:when test="/bedework/rdates/rdate"> 
     3185                    <xsl:for-each select="/bedework/rdates/rdate"> 
     3186                      <tr> 
     3187                        <td> 
     3188                          <xsl:value-of select="longdate"/> 
     3189                          <xsl:if test="allday='false'"> 
     3190                            <xsl:text> </xsl:text> 
     3191                            <xsl:value-of select="time"/> 
     3192                            <xsl:if test="floating='false'"> 
     3193                              <xsl:text> </xsl:text> 
     3194                              <xsl:value-of select="timezone/id"/> 
     3195                            </xsl:if> 
     3196                          </xsl:if> 
     3197                          <script type="text/javascript"> 
     3198                            <xsl:comment> 
     3199                              bwRdates.update('<xsl:value-of select="longdate"/>',  
     3200                                              '<xsl:value-of select="time"/>',  
     3201                                              <xsl:value-of select="allDay"/>,  
     3202                                              <xsl:value-of select="floating"/>,  
     3203                                              false,  
     3204                                              '<xsl:value-of select="timezone/id"/>'); 
     3205                            </xsl:comment> 
     3206                          </script> 
     3207                        </td> 
     3208                        <td class="trash"> 
     3209                          <xsl:variable name="datetime"><xsl:value-of select="unformatted"/></xsl:variable> 
     3210                          <xsl:variable name="tzid" select="timezone/id"/> 
     3211                          <xsl:variable name="dateOnly"><xsl:if test="allday = 'true'">&amp;dateOnly=true</xsl:if></xsl:variable> 
     3212                          <xsl:variable name="floating"><xsl:if test="floating = 'true'">&amp;floating=true</xsl:if></xsl:variable> 
     3213                          <xsl:variable name="storeUTC"><xsl:if test="utc = 'true'">&amp;storeUTC=true</xsl:if></xsl:variable> 
     3214                          <a href="{$event-setRdate}&amp;datetime={$datetime}&amp;tzid={$tzid}{$dateOnly}{$floating}{$storeUTC}&amp;delete=true" title="remove"> 
     3215                            <img src="{$resourcesRoot}/resources/trashIcon.gif" width="13" height="13" border="0" alt="remove"/> 
     3216                          </a> 
     3217                        </td> 
     3218                      </tr> 
     3219                    </xsl:for-each> 
     3220                  </xsl:when> 
     3221                  <xsl:otherwise> 
     3222                    <tr> 
     3223                      <td colspan="2">No recurrence dates</td> 
     3224                    </tr> 
     3225                  </xsl:otherwise> 
     3226                </xsl:choose> 
     3227              </table> 
     3228     
     3229              <table cellspacing="0" class="rdatesTable" id="bwCurrentExdates"> 
     3230                <tr> 
     3231                  <th colspan="2">Exception Dates</th> 
     3232                </tr> 
     3233                <tr> 
     3234                  <td colspan="2" class="note"> 
     3235                    exception dates are created by deleting an instance of a 
     3236                    recurring event 
     3237                  </td> 
     3238                </tr> 
     3239                <xsl:choose> 
     3240                  <xsl:when test="/bedework/exdates/exdate"> 
     3241                    <xsl:for-each select="/bedework/exdates/exdate"> 
     3242                      <tr> 
     3243                        <td> 
     3244                          <xsl:value-of select="longdate"/> 
     3245                          <xsl:if test="allday='false'"> 
     3246                            <xsl:value-of select="time"/> 
     3247                            <xsl:if test="floating='false'"> 
     3248                              <xsl:value-of select="timezone/id"/> 
     3249                            </xsl:if> 
     3250                          </xsl:if> 
     3251                        </td> 
     3252                        <td class="trash"> 
     3253                          <xsl:variable name="datetime"><xsl:value-of select="unformatted"/></xsl:variable> 
     3254                          <xsl:variable name="tzid" select="timezone/id"/> 
     3255                          <xsl:variable name="dateOnly"><xsl:if test="allday = 'true'">&amp;dateOnly=true</xsl:if></xsl:variable> 
     3256                          <xsl:variable name="floating"><xsl:if test="floating = 'true'">&amp;floating=true</xsl:if></xsl:variable> 
     3257                          <xsl:variable name="storeUTC"><xsl:if test="utc = 'true'">&amp;storeUTC=true</xsl:if></xsl:variable> 
     3258                          <a href="{$event-setRdate}&amp;datetime={$datetime}&amp;tzid={$tzid}{$dateOnly}{$floating}{$storeUTC}&amp;exdelete=true" title="remove"> 
     3259                            <img src="{$resourcesRoot}/resources/trashIcon.gif" width="13" height="13" border="0" alt="remove"/> 
     3260                          </a> 
     3261                        </td> 
     3262                      </tr> 
     3263                    </xsl:for-each> 
     3264                  </xsl:when> 
     3265                  <xsl:otherwise> 
     3266                    <tr> 
     3267                      <td colspan="2">No exception dates</td> 
     3268                    </tr> 
     3269                  </xsl:otherwise> 
     3270                </xsl:choose> 
     3271              </table> 
    30923272            </div> 
    30933273          </div> 
  • trunk/deployment/webuser/webapp/resources/demoskins/resources/bedeworkEventForm.js

    r1502 r1503  
    3737//   file. 
    3838 
    39 var deleteStr = "remove"; 
     39var rdateDeleteStr = "remove"; 
    4040 
    4141// ======================================================================== 
     
    4343// ======================================================================== 
    4444 
    45 /* val: String: internal date 
    46  * dateOnly: boolean 
    47  */ 
    48 function 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  
    6145/* An rdate 
    62  * val: date or datetime value 
     46/* date: String: internal date 
     47 * time: String 
    6348 * tzid timezone id or null 
    6449 */ 
    65 function bwRdate(val, tzid) { 
    66   this.val = val; 
     50function BwREXdate(date, time, allDay, floating, utc, tzid) { 
     51  this.date = date; 
     52  this.time = time; 
     53  this.allDay = allDay; 
     54  this.floating = floating; 
     55  this.utc = utc; 
    6756  this.tzid = tzid; 
    6857 
     
    7362   * rdi: index of rdate fro delete 
    7463   */ 
    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>"; 
     64  this.toFormRow = function(reqPar, row, rdi) { 
     65    row.insertCell(0).appendChild(document.createTextNode(this.date)); 
     66    row.insertCell(1).appendChild(document.createTextNode(this.time)); 
     67    row.insertCell(2).appendChild(document.createTextNode(this.tzid)); 
     68    row.insertCell(3).innerHTML = "<a href=\"javascript:bwRdates.deleteRdate('" + 
     69                                   rdi + "')\">" + rdateDeleteStr + "</a>" + 
     70                                   "<input type='hidden' name='" + reqPar +  
     71                                   "' value='" + this.format() + "'/>"; 
     72  } 
     73   
     74  this.format= function() { 
     75    var res = this.date + "\t" + this.time + "\t"; 
     76     
     77    if (this.tzid != null) { 
     78      res += "\t" + this.tzid; 
     79    } 
     80     
     81    return res; 
    8082  } 
    8183 
     
    8587} 
    8688 
    87 var bwRdates = new function() { 
     89var bwRdates = new BwREXdates("rdate", "bwCurrentRdates"); 
     90var bwExdates = new BwREXdates("exdate", "bwCurrentExdates"); 
     91 
     92function BwREXdates(reqPar, tableId) { 
    8893  var rdates = new Array(); 
     94 
     95  this.reqPar = reqPar; 
     96  this.tableId = tableId; 
    8997 
    9098  /* val: String: internal date 
     
    92100   * tzid: String or null 
    93101   */ 
    94   this.addRdate(val, dateOnly, tzid) { 
    95     var newRdate = new bwRdate(new bwDate(val, dateOnly), tzid); 
     102  this.addRdate = function(date, time, allDay, floating, utc, tzid) { 
     103    var newRdate = new BwREXdate(date, time, allDay, floating, utc, tzid); 
    96104 
    97105    if (!this.contains(newRdate)) { 
     
    100108  } 
    101109 
    102   this.contains(rdate) { 
     110  this.contains = function(rdate) { 
    103111    for (var j = 0; j < rdates.length; j++) { 
    104112      var curRdate = rdates[j]; 
     
    112120 
    113121  // Update the list - expects the browser form object 
    114   this.update = function(formObj) { 
    115     var dateVal = formObj.rddateVal.value; 
    116     var dateOnly = false; // hidden field? 
    117     var tzid = formObj.rdtzid.value; 
    118  
    119     this.addRdate(dateVal, dateOnly, tzid); 
    120  
    121     // set a bunch of hidden rdate reqeust parameters? 
    122     // ... 
    123     // this.toRequest(); 
     122  this.update = function(date, time, allDay, floating, utc, tzid) { 
     123    this.addRdate(date, time, allDay, floating, utc, tzid); 
    124124 
    125125    // redraw the display 
     
    138138    try { 
    139139      // get the table body 
    140       var rdTableBody = document.getElementById("bwCurrentRdates").tBodies[0]; 
     140      var rdTableBody = document.getElementById(this.tableId).tBodies[0]; 
    141141 
    142142      // remove existing rows 
     
    150150        var tr = rdTableBody.insertRow(j); 
    151151 
    152         curRdate.toFormRow(tr, j); 
     152        curRdate.toFormRow(this.reqPar, tr, j); 
    153153      } 
    154154    } catch (e) { 
    155155      alert(e); 
    156     } 
    157   } 
    158  
    159   // generate request parameters 
    160   this.toRequest = function() { 
    161     for (var j = 0; j < rdates.length; j++) { 
    162156    } 
    163157  } 
     
    293287  if (obj.value == 'true') { 
    294288    changeClass('recurrenceFields','visible'); 
    295     changeClass('rrulesSwitch','visible'); 
     289    if (document.getElementById('rrulesSwitch')) { 
     290      changeClass('rrulesSwitch','visible'); 
     291    } 
    296292  } else { 
    297293    changeClass('recurrenceFields','invisible'); 
    298     changeClass('rrulesSwitch','invisible'); 
     294    if (document.getElementById('rrulesSwitch')) { 
     295      changeClass('rrulesSwitch','invisible'); 
     296    } 
    299297  } 
    300298}