- From: WonSuk Lee via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 03 Nov 2010 16:25:55 +0000
- To: public-dap-commits@w3.org
Update of /sources/public/2009/dap/gallery In directory hutz:/tmp/cvs-serv19593/2009/dap/gallery Modified Files: Overview.html Log Message: change the example and add more option to GalleryFindOptions for supporting the targeting to scope when apps to file the media objects Index: Overview.html =================================================================== RCS file: /sources/public/2009/dap/gallery/Overview.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Overview.html 3 Nov 2010 09:58:29 -0000 1.7 +++ Overview.html 3 Nov 2010 16:25:53 -0000 1.8 @@ -12,9 +12,11 @@ var respecConfig = { specStatus: "ED", shortName: "gallery-api", - editors: [{name: "이원석(Wonsuk Lee)", company: "Electronics and Telecommunications Research Institute (ETRI)"}, - {name: "이강찬(Kangchan Lee)", company: "Electronics and Telecommunications Research Institute (ETRI)"}], - // publishDate: "2009-08-06", + editors: [{name: "이원석(Wonsuk Lee)", company: "ETRI", companyURL: "http://www.etri.re.kr/"}, + {name: "이강찬(Kangchan Lee)", company: "ETRI", companyURL: "http://www.etri.re.kr/"}, + {name: "Anssi Kostiainen", company: "Nokia", companyURL: "http://www.nokia.com/"}], + + // publishDate: "2009-08-06", // previousPublishDate: "1977-03-15", edDraftURI: "http://dev.w3.org/2009/dap/gallery/", // lcEnd: "2009-08-05", @@ -43,29 +45,51 @@ <p class="note">Further examples are required to give better understanding concerning the overall functions of the gallery API. </p> <p>The following code extracts illustrate how to work with a gallery API in the device: </p> <div> - <p>Opening the gallery and changing the view of gallery.</p> <pre class="example sh_javascript_dom"> - function successGalleryFindCallback(mediaobject) { - // do something with resulting media objects - for (var i in mediaobject) alert(mediaobject[i].title); - // ... + // append images with a title matching 'foobar' from galleries + // not older than 3 months to the document.body + + var gallery = navigator.service.gallery; + + function getGalleriesSuccess(galleryInfoObjs) { + var galleries = []; + for (var i in galleryInfoObjs) { + if ((new Date().getTime())-galleryInfoObjs[i].createDate < 100*60*60*24*3) { + galleries.push(galleryInfoObjs[i]); + } + } + appendMedia(galleries); } - function generalErrorCB(error) { - // do something with resulting errors - alert(error.code); - // ... + function appendMedia(galleries) { + function findSuccess(mediaObjs) { + var container = document.createElement("div"); + for (var i in mediaObjs) { + var img = document.createElement("img"); + var title = document.createElement("div"); + title.innerHTML = "Title: " + mediaObjs[i].title; + // create blob URI using window.createObjectURL(): + // http://dev.w3.org/2006/webapi/FileAPI/#creating-revoking + img.src = createObjectURL(mediaObjs[i]); + container.appendChild(img); + container.appendChild(title); + } + document.body.appendChild(container); + } + + function findError() { + console.log('whoops, something went wrong!'); + } + + gallery.find(['title', 'uri'], findSuccess, findError, + {filter: 'foobar', galleries: galleries, mediaType: gallery.IMAGE_TYPE }); } - // Search the media objects. initially filter the list to media objects containing 'seoul' in their metadata: - navigator.service.gallery.find(['keyword', 'description'], - successGalleryFindCallback, - generalErrorCB, - {filter: 'Seoul', firstSortOption:MEDIA_SORT_BY_DATE} - ); + gallery.getGalleries(getGalleriesSuccess); + </pre> - </div> + </div> </section> </section> <section> @@ -104,25 +128,29 @@ <p>The <code>Gallery</code> interface exposes an interface to access media gallery located on the device.</p> <dl title="[NoInterfaceObject] interface Gallery" class="idl"> - <dt>const unsigned short MEDIA_SORT_NONE = 0</dt> - <dd>Constant used to identify no sort ordering. </dd> - <dt>const unsigned short MEDIA_SORT_BY_FILENAME = 1</dt> + <dt>const unsigned short AUDIO_TYPE = 0</dt> + <dd>Constant used to identify audio type of media. </dd> + <dt>const unsigned short VIDEO_TYPE = 1</dt> + <dd>Constant used to identify video type of media. </dd> + <dt>const unsigned short IMAGE_TYPE = 2</dt> + <dd>Constant used to identify image type of media. </dd> + <dt>const unsigned short SORT_BY_FILENAME = 3</dt> <dd>Constant used to identify sort by filename. </dd> - <dt>const unsigned short MEDIA_SORT_BY_FILEDATE = 2</dt> + <dt>const unsigned short SORT_BY_FILEDATE = 4</dt> <dd>Constant used to identify sort by file date. </dd> - <dt>const unsigned short MEDIA_SORT_BY_MEDIATYPE = 3</dt> + <dt>const unsigned short SORT_BY_MEDIATYPE = 5</dt> <dd>Constant used to identify sort by media type. </dd> - <dt>const unsigned short MEDIA_SORT_BY_TITLE = 4</dt> + <dt>const unsigned short SORT_BY_TITLE = 6</dt> <dd>Constant used to identify sort by title.</dd> - <dt>const unsigned short MEDIA_SORT_BY_AUTHOR = 5</dt> + <dt>const unsigned short SORT_BY_AUTHOR = 7</dt> <dd>Constant used to identify sort by author.</dd> - <dt>const unsigned short MEDIA_SORT_BY_ALBUM = 6</dt> + <dt>const unsigned short SORT_BY_ALBUM = 8</dt> <dd>Constant used to identify sort by album. </dd> - <dt>const unsigned short MEDIA_SORT_BY_DATE = 7</dt> + <dt>const unsigned short SORT_BY_DATE = 9</dt> <dd>Constant used to identify sort by date</dd> - <dt>const unsigned short MEDIA_SORT_BY_ASCENDING = 8</dt> + <dt>const unsigned short SORT_BY_ASCENDING = 10</dt> <dd>Constant used to identify ascending sort order.</dd> - <dt>const unsigned short MEDIA_SORT_BY_DESCENDING = 9</dt> + <dt>const unsigned short SORT_BY_DESCENDING = 11</dt> <dd>Constant used to identify ascending sort order. </dd> <!--dt>readonly attribute GalleryProperties metadata</dt> <dd>Generic metadata information regarding to the gallery.</dd--> @@ -217,7 +245,7 @@ <dl class='parameters'> <dt> - GalleryFindCB successCB + GalleryInfoCB successCB </dt> <dd> Function to call when the asynchronous operation completes @@ -466,6 +494,10 @@ <dl title="[NoInterfaceObject] interface GalleryFindOptions" class="idl"> <dt>attribute DOMString? filter </dt> <dd>A DOMString-based search filter with which to search. It's working based on the metadata of media object.</dd> + <dt>attribute short? mediaType </dt> + <dd>Specify the scope of media type for finding the media object<dd> + <dt>attribute GalleryInfo[]? gallery </dt> + <dd>Specify the scope of gallery for finding the media object<dd> <dt>attribute short? order </dt> <dd>Specify wheither media objects are ordered in ascending or descending order. Default is an ascending order. </dd> <dt>attribute short? firstSortOption</dt> @@ -505,6 +537,17 @@ </dd> </dl> </section> + <section> + <h2><code>GalleryInfoCB</code> interface</h2> + <dl title="[Callback=FunctionOnly, NoInterfaceObject] interface GalleryInfoCB : PendingOp" class="idl"> + <dt>void onSuccess (in GalleryInfo[] galleryInfoObjs)</dt> + <dd><dl class="parameters"> + <dt>GalleryInfo[] galleryInfoObjs </dt> + <dd>The GalleryInfo Objects resulting from the given Gallery getGalleries() method.</dd> + </dl> + </dd> + </dl> + </section> <section id="galleryerror-interface"> <h2><code>GalleryErrorCB</code> interface</h2> <dl title="[Callback=FunctionOnly, NoInterfaceObject] interface GalleryErrorCB : PendingOp" class="idl">
Received on Wednesday, 3 November 2010 16:25:57 UTC