diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js
index 88b34239..3dd51128 100755
--- a/app/assets/javascripts/orbitdesktop.js
+++ b/app/assets/javascripts/orbitdesktop.js
@@ -123,6 +123,14 @@ var orbitDesktop = function(dom){
var ww = $(window).width();
$("img#thmbackground").attr({"width":ww});
if( $('.tinycanvas') ){ $('.tinycanvas').tinyscrollbar_update(); }
+ if($(o.contentHolder).find("div.app_frame").length > 0){
+ $(o.contentHolder).find("div.app_frame").each(function(){
+ var app_holder_height = $(this).height() - 72;
+ var app_holder_width = $(this).width();
+ $(this).find("div.app_holder").height(app_holder_height);
+ $(this).find("div.app_holder iframe").attr({"height":app_holder_height,"width":app_holder_width});
+ })
+ }
});
var $widget_fn = $('.widget_fn'),$fn_des = $('.fn_des');
$widget_fn.hover(function(){
@@ -231,7 +239,12 @@ var orbitDesktop = function(dom){
$(this).removeClass('thmc2');
});
}
-
+ $("div#group_wrapper ul li[data-category=app]").click(function(){
+ o.appWindow({
+ title : $(this).find("a").attr("href"),
+ appid : $(this).find("a").attr("href")
+ });
+ })
}
var loadTiles = function(id){ //This will load tiles for a specific desktop .. id of section has to be passed here to load tiles
$("div#desktop div#group_wrapper").empty();
@@ -285,7 +298,7 @@ var orbitDesktop = function(dom){
if(j==0)$group.attr("id",tile.group_id);
if(tile.data_category == "app")
- $li = $('
'+tile.title+'
');
+ $li = $('
'+tile.title+'
');
else
$li = $('
'+tile.title+'
Loading...
');
diff --git a/app/assets/javascripts/orbitdesktopAPI.js b/app/assets/javascripts/orbitdesktopAPI.js
index de093973..2d91dbbb 100644
--- a/app/assets/javascripts/orbitdesktopAPI.js
+++ b/app/assets/javascripts/orbitdesktopAPI.js
@@ -2,7 +2,12 @@
//Harry Bomrah
var orbitDesktopAPI = function(){
o = this;
+ this.windowcounter = 0;
this.notify = function(msg,type,time){
+ //takes 3 arguments
+ //msg (string) : message to display
+ //type (string : success, imp, alert
+ //time (int) : duration for notification in seconds
var $notify = $("#orbitnote");
var img, n_height;
if(!type)type="";
@@ -31,12 +36,19 @@ var orbitDesktopAPI = function(){
.animate({top:-n_height,opacity:0},200);
};
this.executeFunc = function(func,callbackFn){
+ //takes 2 arguments
+ //func (object Function) : the function which has to be executed
+ //callbackFn (object function) : the function for callback
func.call(this);
if(callbackFn){
callbackFn.call(this,func);
}
};
this.sortJSON = function(field, reverse, primer){
+ //takes 3 arguments
+ //field (string): it is the field on which sorting has to be done
+ //reverse (boolean): this is for asc or desc
+ //primer (method): for example pass parseInt for converting the field attribute in integer
var key = function (x) {return primer ? primer(x[field]) : x[field]};
return function (a,b) {
var A = key(a), B = key(b);
@@ -44,6 +56,8 @@ var orbitDesktopAPI = function(){
}
};
this.rgb2hex = function(rgb) {
+ // takes 1 parameter
+ // rgb (string) : pass rgb string to convert
rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
var hex = function(x) {
return ("0" + parseInt(x).toString(16)).slice(-2);
@@ -51,10 +65,18 @@ var orbitDesktopAPI = function(){
return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
};
this.changeWallpaper = function(wallpaper){
+ //takes 1 parameter
+ //wallpaper (string): takes wallpaper and sets the wallpaper
$("img#thmbackground").attr("src",o.wallpaperPath+wallpaper);
o.saveWallpaper(wallpaper);
};
this.confirm = function(settings,callbackfn){
+ //takes set of arguments in array
+ //settings.buttons (array string) : name of buttons to be displayed
+ //settings.highlighted (integer) : takes either 1 or 2.. will highlight the button which is passed
+ //settings.message (string) : takes a string and message to be displayed on the confirmbox
+ //callbackfn (object function) : function to callback
+
if(!settings.buttons)settings.buttons=["Ok","Cancel"];
if(settings.highlighted!=1 && settings.highlighted!=2)settings.highlighted=2;
if(!settings.message)settings.message = "Are you sure?"
@@ -80,12 +102,62 @@ var orbitDesktopAPI = function(){
$confirm.stop(1,1).fadeIn();
};
this.getArrayfromJson = function(tjson,key){
+ // returns array and takes json object and key
+ //json (json object) : json object from which the key has to be extracted
+ // key (string) : key which has to be extracted
var tempArray = new Array;
$.each(tjson,function(i,val){
tempArray.push(val[key]);
})
return tempArray;
- }
+ };
+ this.appWindow = function(settings,callbackfn){
+ //takes set of arguments as array and gives callback
+ //settings.method (string) : like open and close
+ //settings.title (string) : the window title
+ //settings.appid (string) : appid.. user can use this appid to open or close or refresh the window
+ //settings.url (string) : it is the url if you want to force external url to open in appwindow... you have to pass extURL in appid if you want to open externalurl
+ if(typeof settings == "undefined")settings = {};
+ if(!settings.appid){
+ o.notify("Invalid AppID.","imp",3);
+ return;
+ }
+ if(!settings.method)settings.method = "open";
+ if(settings.method == 'open'){
+ var appurl = "http://www.rulingcom.com";
+ o.windowcounter++;
+ if(!settings.title)settings.title = "New Window "+o.windowcounter;
+ if(settings.appid=="extURL"){
+ if(settings.url){
+ if(settings.url.substr(0,3)!="http")settings.url = "http://"+settings.url;
+ var urlregex = new RegExp("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");
+ if(urlregex.test(settings.url))
+ appurl = settings.url;
+ else{
+ o.notify("Invalid URL","alert",3);
+ return;
+ }
+ }
+ else{
+ o.notify("Invalid URL","alert",3);
+ return;
+ }
+ }
+ var whtml =$('