//Function to invoke the search of the FlickrStore
functioninvokeSearch(){
varrequest={
query:{},
onComplete:onComplete,
onError:onError
};
if(idWidget){
varuserid=idWidget.getValue();
if(userid&&userid!==""){
request.query.userid=userid;
}
}
if(tagsWidget){
vartags=tagsWidget.getValue();
if(tags&&tags!==""){
vartagsArray=tags.split(" ");
tags="";
for(vari=0;i<tagsArray.length;i++){
tags=tags+tagsArray[i];
if(i<(tagsArray.length-1)){
tags+=","
}
}
request.query.tags=tags;
}
}
if(countWidget){
request.count=countWidget.getValue();
}
if(startWidget){
request.query.start=startWidget.getValue();
}
if(statusWidget){
statusWidget.setValue("PROCESSING REQUEST");
}
flickrStore.fetch(request);
}
//Lastly, link up the search event.
varbutton=dijit.byId("searchButton");
dojo.connect(button,"onClick",invokeSearch);
}
dojo.addOnLoad(init);
</script>
</head>
<bodyclass="tundra">
<h1>
DEMO: PicasaStore Search
</h1>
<hr>
<h3>
Description:
</h3>
<p>
This simple demo shows how services, such as Flickr, can be wrapped by the datastore API. In this demo, you can search public Flickr images through a simple FlickrStore by specifying a series of tags (separated by spaces) to search on. The results will be displayed below the search box.