new themes added to desktop plus theme uploader created

This commit is contained in:
harrybomrah authored and saurabhbhatia committed 2013-07-30 16:43:32 +08:00
1 parent 6d89eab98a
commit f7dbbf1bca
238 files changed
+299 -545

No files matched your search

+63 -18
View File
@@ -117,7 +117,7 @@ var orbitDesktop = function(dom){
// o = this;
this.contentHolder = dom;
this.themesettings = "";
this.theme = "4f8d3f493b67fcd05f086359";
this.theme = null;
this.transitionTime = 1000;
this.currenthtml = "home";
this.currentface = "home";
@@ -134,22 +134,21 @@ var orbitDesktop = function(dom){
var theme = o.theme;
var custom = false;
o.getlocation();
o.minimizeBarManager();
$.getJSON("/desktop/get_desktop_settings",{"get":"desktop","desktopid":o.desktopId},function(desktopSettings){
if(desktopSettings){
if(desktopSettings.theme!="custom"){
theme = desktopSettings.theme;
}else{
theme = "4f8d3f493b67fcd05f086359";
if(desktopSettings.theme=="custom"){
custom = true;
}
theme = desktopSettings.theme;
o.theme = theme;
loadTheme(desktopSettings.customtheme,desktopSettings.wallpaper);
}else{loadTheme();}
});
var loadTheme = function(customtheme,customwallpaper){ //This function will load the theme from database
$.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){
o.themesettings = eval(ts);
$('head').append( $('<link rel="stylesheet" id="dyn_css" type="text/css" />').attr('href', "/"+o.themefolder+"/"+theme+"/css/"+ts.css));
$.getJSON("/desktop_themes/settings",{"id":theme},function(ts){
o.themesettings = ts;
$('head').append( $('<link rel="stylesheet" id="dyn_css" type="text/css" />').attr('href', o.themesettings.css));
if(custom){
$("head").find("#dyn_css").remove();
$("head").append(customtheme);
@@ -182,10 +181,10 @@ var orbitDesktop = function(dom){
};
this.changeTheme = function(theme){ // this function is used for changing theme
o.theme = theme;
$.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){
o.themesettings = eval(ts);
$.getJSON("/desktop_themes/settings",{"id":theme},function(ts){
o.themesettings = ts;
$('head').find("#dyn_css").remove();
$('head').append( $('<link rel="stylesheet" id="dyn_css" type="text/css" />').attr('href', "/"+o.themefolder+"/"+theme+"/css/"+ts.css));
$('head').append( $('<link rel="stylesheet" id="dyn_css" type="text/css" />').attr('href', o.themesettings.css));
o.loadWallpaper();
o.loadIconCache();
})
@@ -553,7 +552,7 @@ var orbitDesktop = function(dom){
var target = dom.attr("id");
var url = dom.attr("href");
if(!url)return false;
o.lastlink = url;
o.data_method = dom.attr("callback-method");
if(o.currenthtml!=target){
if(o.desktopData[o.currentface] == "undefined"){
@@ -599,7 +598,8 @@ var orbitDesktop = function(dom){
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),o.desktopData[o.currentface]);
}
}catch(EX){}
cache = true;
cache = (o.lastlink == "/desktop/app_manager" ? false : true);
if(typeof o.data_method != "undefined"){
if(o.data_method != ""){
window.o[o.data_method](target,url,cache);
@@ -622,6 +622,7 @@ var orbitDesktop = function(dom){
$(this).hide().delay(i*100).fadeIn(600,'easeInOutQuint');
});
}
o.lastlink = url;
}
this.sub_menu_item = function(dom,data){
var sub_data_method = dom.attr('callback-method');
@@ -745,7 +746,7 @@ var orbitDesktop = function(dom){
$("#desktop #group_wrapper").empty();
$.getJSON("/desktop/getgroups",{sectionid:id},function(tiles){
// tiles.sort(o.sortJSON("position",true,parseInt));
var tilecolors = o.themesettings.tilecolor;
var tilecolors = (o.themesettings.tilecolor ? o.themesettings.tilecolor : ["thmc1","thmc2","thmc3","thmc4"]) ;
var totaltiles_in_a_row = 4;
var opacity = ["op07","op08","op09",""];
var row = 0, col = 1, x = 1, y = 1, total_x = 0, prev_y = 0;
@@ -804,7 +805,7 @@ var orbitDesktop = function(dom){
}
var loadSectionList = function(){ //This will load the section list from the db
$.getJSON("/desktop/getsectionlist",{desktopid:o.desktopId},function(sectionlist){
o.sectionList = eval(sectionlist);
o.sectionList = sectionlist;
$.each(sectionlist,function(i,section){
var tempstyle="";
if(i==0){
@@ -1512,9 +1513,8 @@ var orbitDesktop = function(dom){
}
this.loadWallpaper = function(wallpaper){ // this is to load new wallpaper
wallpapernm = (!wallpaper) ? o.themesettings.background : wallpaper;
if(!wallpaper){
$("#thmbackground").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+wallpapernm);
$("#thmbackground").attr("src",o.themesettings.background);
} else {
$("#thmbackground").attr("src",o.wallpaperPath+wallpaper);
}
@@ -1524,7 +1524,7 @@ var orbitDesktop = function(dom){
var imgs = $(".docklist img");
$.each(imgs,function(){
var setting_name = $(this).attr("id").replace("_icon","");
$(this).attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons[setting_name])
$(this).attr("src","/assets/desktop/icons/"+o.themesettings.icons[setting_name])
})
};
this.initializeWidgets = function(){ // this function will initialize all the widgets in the desktop
@@ -1818,6 +1818,51 @@ var orbitDesktop = function(dom){
}
}
}
this.minimizeBarManager = function(){
var minimizedApps = [],
minimizeBar = $("#minimizebar");
this.minimizeBarManager.minimize = function(win){
minimizedApps.push(win.attr("id"));
var $e = generateMiniBar(win.attr("id"));
$e.find("span[for=title]").text(win.data('title'));
$e.one("click",function(){
o.minimizeBarManager.maximize(win);
});
$e.find("span.icon-remove").one("click",function(e){
o.appWindow.close(win);
e.stopPropagation();
});
minimizeBar.append($e);
win.hide();
// var minimizeOffset = minimizeBar.offset();
// win.animate({"left":minimizeOffset.left + "px","top":minimizeOffset.top + "px","height":"25px","width":"200px"},function(){
// });
}
this.minimizeBarManager.maximize = function(win){
var position = minimizedApps.indexOf(win.attr("id"));
minimizedApps.splice(position,1);
getMiniBar(position).remove();
win.show();
updatePositions();
}
var getMiniBar = function(position){
return minimizeBar.find("div[data-position="+position+"]");
}
var generateMiniBar = function(id){
var position = minimizedApps.indexOf(id),
template = '<div id="mini_'+id+'" data-app-id="'+id+'" data-position="'+position+'" style="height:25px; width:200px; bottom:0; margin:3px 3px 3px 3px; float:right; cursor:pointer;" class="minimize thmc2"><span class="thmtxth" style="font-size:18px;margin 3px 3px;" for="title"></span><span class="icon-remove hh2 hp thmtxt" style="float:right;cursor:pointer;"></span></div>',
$e = $(template);
return $e;
}
var updatePositions = function(){
minimizeBar.find("div.minimize").each(function(){
$(this).attr("data-position",minimizedApps.indexOf($(this).data("app-id")));
})
}
}
o.initialize();
}
@@ -116,29 +116,35 @@ var orbitDesktopAPI = function(){
})
return tempArray;
};
this.appWindow = function(settings,callbackfn){
this.appWindow = function(options,callbackfn){
//takes set of arguments as array and gives callback
//settings.method (string) : like open and close
//settings.title (string) : the window title
//settings.extUrl (boolean) : true for opening external url else false
//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 = {};
var settings = {
method : "open",
extUrl : true,
title : "New Window"
}
$.extend(settings,options);
if(!settings.appid){
o.notify("Invalid AppID.","imp",3);
return;
}
if(!settings.method)settings.method = "open";
if(!settings.extUrl)settings.extUrl = true;
var isWindow = ($("div.app_frame[data-app="+settings.appid+"]").length > 0 ? $("div.app_frame[data-app="+settings.appid+"]") : null);
if(isWindow){
o.minimizeBarManager.maximize(isWindow);
return;
}
if(settings.method == 'open'){
var appurl = "http://www.rulingcom.com";
o.windowcounter++;
if(!settings.title)settings.title = "New Window "+o.windowcounter;
if(settings.extUrl){
if(settings.url){
if(settings.url.substr(0,4)!="http")settings.url = "http://"+settings.url;
console.log(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;
@@ -152,20 +158,34 @@ var orbitDesktopAPI = function(){
return;
}
}
var whtml =$('<div id="app_frame_'+o.windowcounter+'" class="thmc2 app_frame" data-app="'+settings.appid+'"><div class="app_frame_header"><div class="dtitle hh2 hp"><span class="thmtxth">'+settings.title+'</span></div><span class="icon-remove hh2 hp thmtxt"></span></div><div id="holder_'+o.windowcounter+'" class="app_holder clear"><iframe src="'+appurl+'" frameborder="0" scrolling="auto"></iframe></div></div>');
$(o.contentHolder).append(whtml);
var whtml =$('<div id="app_frame_'+o.windowcounter+'" class="thmc2 app_frame" data-app="'+settings.appid+'" data-title="'+ settings.title +'"><div class="app_frame_header"><div class="dtitle hh2 hp"><span class="thmtxth">'+settings.title+'</span></div><span class="icon-remove hh2 hp thmtxt"></span><span class="icon-minus hh2 hp thmtxt"></span></div><div id="holder_'+o.windowcounter+'" class="app_holder clear"><iframe src="'+appurl+'" frameborder="0" scrolling="auto"></iframe></div></div>');
$("body").append(whtml);
var parentwindow = $(o.contentHolder).find("#app_frame_"+o.windowcounter);
var app_holder_height = parentwindow.height() - 72;
var app_holder_width = parentwindow.width();
parentwindow.find("iframe").attr({"height":app_holder_height,"width":app_holder_width});
parentwindow.find(".app_holder").height(app_holder_height);
parentwindow.find(".icon-remove").click(function(){
parentwindow.remove();
o.appWindow.close(parentwindow);
});
parentwindow.find(".icon-minus").click(function(){
o.appWindow.minimize(parentwindow);
})
}
this.appWindow.close = function(win){
win.remove();
}
this.appWindow.minimize = function(win){
o.minimizeBarManager.minimize(win)
}
if(typeof callbackfn=="function"){
callbackfn.call(this);
callbackfn.call(this,parentwindow);
}
return parentwindow;
};
this.toolPopup = function(settings){
if(settings == "destroy"){