1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
\r
4 <title>Rico LiveGrid-Photo Example</title>
\r
7 require "LoadRicoClient.php";
\r
9 <link href="../demo.css" type="text/css" rel="stylesheet" />
\r
11 <script type='text/javascript'>
\r
12 Rico.loadModule('LiveGridAjax','LiveGridMenu');
\r
14 var photoGrid, photoBuffer, imgctl, img_popup, animator;
\r
16 Rico.onLoad( function() {
\r
17 imgctl=new Rico.TableColumn.image();
\r
19 prefetchBuffer: false,
\r
21 useUnformattedColWidth:false,
\r
22 headingSort : 'hover',
\r
23 columnSpecs : [{control:imgctl,width:90},,,
\r
24 {type:'datetime'},{width:200}]
\r
26 photoBuffer=new Rico.Buffer.AjaxXML('flickrPhotos.php');
\r
27 photoGrid=new Rico.LiveGrid ('photogrid', photoBuffer, opts);
\r
28 photoGrid.menu=new Rico.GridMenu();
\r
30 // do something special when the mouse hovers over an image
\r
31 for (var i=0; i<imgctl._img.length; i++) {
\r
32 Rico.eventBind(imgctl._img[i],'mouseover',Rico.eventHandle(window,'img_mouseover'));
\r
33 Rico.eventBind(imgctl._img[i],'mouseout',Rico.eventHandle(window,'img_mouseout'));
\r
35 img_popup=document.getElementById('img_popup');
\r
38 function img_mouseover(e) {
\r
40 var elem=Rico.eventElement(e);
\r
41 img_popup.style.display='block';
\r
42 var imgPos=Rico.cumulativeOffset(elem);
\r
43 img_popup.src=elem.src.replace(/_s\.jpg/,'_m.jpg');
\r
44 img_popup.style.left=(imgPos.left+elem.offsetWidth+10)+'px';
\r
45 var winHt=Rico.windowHeight();
\r
46 window.status='winHt='+winHt+' imgTop='+imgPos.top
\r
47 if (imgPos.top > winHt/2) {
\r
48 img_popup.style.bottom=(winHt-imgPos.top-elem.offsetHeight)+'px';
\r
49 img_popup.style.top='';
\r
51 img_popup.style.top=(imgPos.top)+'px';
\r
52 img_popup.style.bottom='';
\r
56 function img_mouseout(e) {
\r
58 img_popup.style.display='none';
\r
61 function UpdateGrid() {
\r
62 var tags=document.getElementById('tags').value;
\r
64 photoGrid.resetContents(false);
\r
65 photoBuffer.fetchData=true; // force another XML fetch
\r
66 photoBuffer.options.requestParameters=[{name:'tags',value:tags}];
\r
67 photoGrid.filterHandler();
\r
69 alert('Please enter one or more keywords separated by commas');
\r
74 <style type="text/css">
\r
75 .ricoLG_bottom div.ricoLG_cell { height:80px; } /* thumbnails are 75x75 pixels */
\r
76 #explanation * { font-size: 8pt; }
\r
83 <table id='explanation' border='0' cellpadding='0' cellspacing='5' style='clear:both'><tr valign='top'><td>
\r
84 <form onsubmit='UpdateGrid(); return false;'>
\r
85 <p>Get <a href="http://www.flickr.com">Flickr</a> photos tagged with these keywords (separate words with commas):
\r
86 <p><input type='text' id='tags'>
\r
87 <input type='submit' value='Get Photos'>
\r
91 <script type='text/javascript'>
\r
92 document.write(Rico.Lib+' '+Rico.LibVersion);
\r
95 When fetching data, this script issues an XMLHttpRequest to a proxy script which uses the Flickr API
\r
96 to process the query and format the response in the Rico LiveGrid XML format.
\r
97 <p>Try moving your cursor over each photo...
\r
100 <script type="text/javascript"><!--
\r
101 google_ad_client = "pub-7218597156507462";
\r
102 /* 125x125, created 5/11/09 */
\r
103 google_ad_slot = "9298106441";
\r
104 google_ad_width = 125;
\r
105 google_ad_height = 125;
\r
108 <script type="text/javascript"
\r
109 src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
\r
114 <p class="ricoBookmark"><span id="photogrid_bookmark"> </span></p>
\r
115 <table id="photogrid" class="ricoLiveGrid" cellspacing="0" cellpadding="0">
\r
120 <th>Date Taken</th>
\r
125 <img id='img_popup' style='display:none;position:absolute;'>
\r