Bangladesh Random Picture

From OpenSocial Directory

Jump to: navigation, search
Thumbnail
bangladeshccn.gif
Application Details
Description Bangladesh Gallery Random Picture
Publisher SJ Innovation
Author SJ Innovation
Code http://www.bangladesh.cc/api/bangla.xml
Genre Photo
Supports OpenSocial

Image:Example.jpg==Reviews== Add a Review
http://opensocialdevelopment.biz/2008/01/15/open-social-and-gallery2/

[edit] Comments

Leave a comment

Your Name:
Heading:
Comment:


[edit] Code

View Code

<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs 
title="Bangladesh Random Picture"
title_url="http://www.bangladesh.cc/"
description="Bangladesh Gallery Random Picture"
thumbnail="http://www.bangladesh.cc/images/bangladeshccn.gif"
author=""
author_affiliation=""
author_email=""
author_location=""
>

<Require feature="opensocial-0.5"/>
<Require feature="dynamic-height"/>
</ModulePrefs>

<Content type="html"><![CDATA[

<table>
	<tr>
		<td>
			<div id="container">
			</div>
		</td>
	</tr>
	<tr>
		<td><a href="javascript:void(0);" onclick="getRandomPicture();">Random Picture</a></td>
	</tr>
</table>

<script type="text/javascript">

var is_opensocial = 1;
var viewer_id = "0";
var viewer_name = "";
var profile = "";

var viewer_friends_list = "";
var base_url = "http://www.bangladesh.cc/random_picture.php";

function getViewerId()
{
	return viewer_id;
}

function getViewerFriends()
{
	return viewer_friends_list;
}

function getRandomPictureResponse(response)
{
  html = response;
  
  _gel("container").innerHTML = html;
  _IG_AdjustIFrameHeight();  
}

function getRandomPicture()
{
  var url = base_url;
  url += "?random_picture=true";
  url += "&apid="+viewer_id;
     
  _IG_FetchContent(url, getRandomPictureResponse, { refreshInterval: 0 });
}

function getRateResponse(response)
{
  html = response;
  
  _gel("container").innerHTML = html;
  _IG_AdjustIFrameHeight();  
}

function getRate(id, rate)
{
  var url = base_url;
  url += "?rate=true";
  url += "&id="+id;
  url += "&set="+rate;
  url += "&apid="+viewer_id;
	 
  _IG_FetchContent(url, getRateResponse, { refreshInterval: 0 });
}

function response(data) {
  
  var viewer = data.get("viewer").getData();  
  viewer_id = viewer.getId();
  viewer_name = viewer.getDisplayName();
  profile = viewer.getField(opensocial.Person.Field.PROFILE_URL);
    
  var viewer_friends = data.get("viewer_friends").getData(); 
  viewer_friends.each(function(person) {
	viewer_friends_list += person.getId() + ";";
  });
  
  getRandomPicture();
} 

function viewerRequest() 
{
  var req = opensocial.newDataRequest();
  req.add(req.newFetchPersonRequest("VIEWER"), "viewer");
  req.add(req.newFetchPeopleRequest("VIEWER_FRIENDS"), "viewer_friends");
  req.send(response);
}

_IG_RegisterOnloadHandler( viewerRequest() );

</script>

]]></Content>
</Module>

Page Rating

Rating: 2.7/5 (9 votes cast)

Personal tools
communication