2009/dap/calendar Overview.html,1.14,1.15

Update of /sources/public/2009/dap/calendar
In directory hutz:/tmp/cvs-serv9716/calendar

Modified Files:
	Overview.html 
Log Message:
Added save and update examples to section 'Adding and Updating Calendar Events'.

Index: Overview.html
===================================================================
RCS file: /sources/public/2009/dap/calendar/Overview.html,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- Overview.html	11 Jan 2011 15:04:59 -0000	1.14
+++ Overview.html	11 Jan 2011 15:11:07 -0000	1.15
@@ -1289,7 +1289,19 @@
             <pre class="sh_javascript">&lt;a id=&quot;ical&quot;&gt;Save our Event in your Calendar&lt;/a&gt;
 
 &lt;script type=&quot;text/javascript&quot;&gt;
-  // include example here
+  // obtain an ArrayBuffer consisting of valid iCalendar syntax (out of scope)
+  var iCalObj = getICalendar( /* ... */ );
+            
+  // create a new iCalendar Blob [[FILE-WRITER]]
+  var calendarEventBlobBuilder = new BlobBuilder();
+  calendarEventBlobBuilder.append( iCalObj );
+  var calendarEventBlob = calendarEventBlobBuilder.getBlob( &quot;text/calendar&quot; );
+
+  // obtain an iCalendar Blob URL [[FILE-API]]
+  var calendarEventBlobURL = window.URL.createObjectUrl( calendarEventBlob );
+
+  // assign iCalendar Blob URL to an anchor element for presentation and download by the user
+  document.getElementById('ical').href = calendarEventBlobURL; 
 &lt;/script&gt;
 </pre>
          </div>
@@ -1320,7 +1332,27 @@
                <pre class="sh_javascript">&lt;a id=&quot;vcard&quot;&gt;Update our Event in your Calendar&lt;/a&gt;
 
 &lt;script type=&quot;text/javascript&quot;&gt;
-  // include example here
+  // Obtain a single existing Calendar Event object resulting from navigator.service.calendar.find()
+  var existingCalendarEventObj = ...;
+  
+  // Modify some parameters as required. e.g. add a new phone number
+  existingCalendarEventObj.location = 'Conf call number change: #XXX';
+  
+  // With the existing Calendar Event object, create an ArrayBuffer consisting of valid iCalendar 
+  // syntax (out of scope) making sure to set the resulting iCalendar UID property to 
+  // the id parameter returned in the existing Calendar Event object
+  var iCalObj = getICalendar( existingCalendarEventObj );
+
+  // create a new iCalendar Blob [[FILE-WRITER]]
+  var calendarEventBlobBuilder = new BlobBuilder();
+  calendarEventBlobBuilder.append( iCalObj );
+  var calendarEventBlob = calendarEventBlobBuilder.getBlob( &quot;text/calendar&quot; );
+
+  // obtain an iCalendar Blob URL [[FILE-API]]
+  var calendarEventBlobURL = window.URL.createObjectUrl( calendarEventBlob );
+
+  // assign iCalendar Blob URL to an anchor element for presentation and download by the user
+  document.getElementById('ical').href = calendarEventBlobURL; 
 &lt;/script&gt;
 </pre>
             </div>

Received on Tuesday, 11 January 2011 15:11:10 UTC