Msg box added and background image saving complete
This commit is contained in:
		
							parent
							
								
									b4bf81d40a
								
							
						
					
					
						commit
						4bad25e682
					
				|  | @ -1,5 +1,20 @@ | ||||||
| // JavaScript Document
 | // JavaScript Document
 | ||||||
| //harry
 | //harry
 | ||||||
|  | $.extend($.expr[':'], { | ||||||
|  | 	'containsi': function (elem, i, match, array) { | ||||||
|  | 		return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; | ||||||
|  | 	} | ||||||
|  | }); | ||||||
|  | $.fn.sort = function(c) { | ||||||
|  | 	return this.pushStack([].sort.apply(this, arguments), []); | ||||||
|  |  }; | ||||||
|  | var sortAscending = function(a, b) { | ||||||
|  | 	 return $(a).find("h1").text() > $(b).find("h1").text() ? 1 : -1; | ||||||
|  | }; | ||||||
|  | var sortDescending = function(a, b) { | ||||||
|  | 	 return $(a).find("h1").text() < $(b).find("h1").text() ? 1 : -1; | ||||||
|  | }; | ||||||
|  |           | ||||||
| var orbitDesktop = function(dom){ | var orbitDesktop = function(dom){ | ||||||
| 	orbitDesktopAPI.apply(this); | 	orbitDesktopAPI.apply(this); | ||||||
| 	o = this; | 	o = this; | ||||||
|  | @ -25,18 +40,18 @@ var orbitDesktop = function(dom){ | ||||||
| 					custom = true; | 					custom = true; | ||||||
| 				} | 				} | ||||||
| 				o.theme = theme; | 				o.theme = theme; | ||||||
| 				loadTheme(desktopSettings.customtheme); | 				loadTheme(desktopSettings.customtheme,desktopSettings.wallpaper); | ||||||
| 			}else{loadTheme();} | 			}else{loadTheme();} | ||||||
| 		}) | 		}) | ||||||
| 		var loadTheme = function(dhtml){ | 		var loadTheme = function(customtheme,customwallpaper){ | ||||||
| 			$.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){ | 			$.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){ | ||||||
| 				o.themesettings = eval(ts); | 				o.themesettings = eval(ts); | ||||||
| 				$('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.themefolder+"/"+theme+"/css/"+ts.css)); | ||||||
| 				if(custom){ | 				if(custom){ | ||||||
| 					$("head").find("#dyn_css").remove(); | 					$("head").find("#dyn_css").remove(); | ||||||
| 					$("head").append(dhtml); | 					$("head").append(customtheme); | ||||||
| 				} | 				} | ||||||
| 				$(document).ready(function(){o.loadWallpaper();o.bindDesktopEvents();o.loadIconCache();o.initializeDesktop();}); | 				$(document).ready(function(){o.loadWallpaper(customwallpaper);o.bindDesktopEvents();o.loadIconCache();o.initializeDesktop();}); | ||||||
| 			}) | 			}) | ||||||
| 		} | 		} | ||||||
| 	}; | 	}; | ||||||
|  | @ -263,7 +278,9 @@ var orbitDesktop = function(dom){ | ||||||
| 		} | 		} | ||||||
| 	}; | 	}; | ||||||
| 	this.tempFunc = function(th){ | 	this.tempFunc = function(th){ | ||||||
| 	 | 		o.confirm("What","","",function(reply){ | ||||||
|  | 			alert(reply); | ||||||
|  | 		}) | ||||||
| 	} | 	} | ||||||
| 	this.initializeAppSearch = function(target){ | 	this.initializeAppSearch = function(target){ | ||||||
| 		o.currenthtml = target; | 		o.currenthtml = target; | ||||||
|  | @ -602,8 +619,10 @@ var orbitDesktop = function(dom){ | ||||||
| 						}); | 						}); | ||||||
| 						 | 						 | ||||||
| 						$("a#theme_submit").click(function(){ | 						$("a#theme_submit").click(function(){ | ||||||
|  | 							o.confirm("Are you sure that you want to set this custom theme?",["Yes","No"],3,function(reply){ | ||||||
|  | 								if(reply){ | ||||||
| 								var colors = new Array; | 								var colors = new Array; | ||||||
| 							$("tr#color_inputs input").each(function(){ | 								$("#color_input input").each(function(){ | ||||||
| 									colors[$(this).attr("for")] = $(this).val(); | 									colors[$(this).attr("for")] = $(this).val(); | ||||||
| 								}) | 								}) | ||||||
| 								var dhtml ="<style> .thmc1 { background: "+colors['thmc1']+"; }.thmc2 { background: "+colors['thmc2']+"; }.thmc3 { background: #FFFFFF; }.thmc4 { background: "+colors['thmc4']+"; }.thmtxt { color: "+colors['thmtxt']+"; }.thmtxth { color: "+colors['thmtxth']+"; }.g_sep { border-color: "+colors['g_sep']+";} body{background-color: "+colors['background']+"} </style>"; | 								var dhtml ="<style> .thmc1 { background: "+colors['thmc1']+"; }.thmc2 { background: "+colors['thmc2']+"; }.thmc3 { background: #FFFFFF; }.thmc4 { background: "+colors['thmc4']+"; }.thmtxt { color: "+colors['thmtxt']+"; }.thmtxth { color: "+colors['thmtxth']+"; }.g_sep { border-color: "+colors['g_sep']+";} body{background-color: "+colors['background']+"} </style>"; | ||||||
|  | @ -619,8 +638,14 @@ var orbitDesktop = function(dom){ | ||||||
| 										o.notify("Connection problem!!","alert",2); | 										o.notify("Connection problem!!","alert",2); | ||||||
| 									} | 									} | ||||||
| 								}) | 								}) | ||||||
|  | 								} | ||||||
| 							}) | 							}) | ||||||
|  | 						}); | ||||||
| 						 | 						 | ||||||
|  | 						$(".stock_wallpaper .ssl_item").click(function(){ | ||||||
|  | 							var wallpapername = $(this).find("img").attr("alt"); | ||||||
|  | 							o.changeWallpaper(wallpapername); | ||||||
|  | 						}) | ||||||
| 				} | 				} | ||||||
| 				var loadthmc = function(){ | 				var loadthmc = function(){ | ||||||
| 					$('.color-picker').each(function(){ | 					$('.color-picker').each(function(){ | ||||||
|  | @ -658,17 +683,19 @@ var orbitDesktop = function(dom){ | ||||||
| 			themes(); | 			themes(); | ||||||
| 		}); | 		}); | ||||||
| 	}; | 	}; | ||||||
|  | 	 | ||||||
| 	this.loadWallpaper = function(wallpaper){ | 	this.loadWallpaper = function(wallpaper){ | ||||||
| 		if(!wallpaper)wallpaper = o.themesettings.background; | 		if(!wallpaper)wallpapernm = o.themesettings.background;else wallpapernm = wallpaper | ||||||
| 		var ww = $(window).width(); | 		var ww = $(window).width(); | ||||||
| 		var wh = $(window).height(); | 		var wh = $(window).height(); | ||||||
| 		if(o.themesettings.background) | 		if(!wallpaper) | ||||||
| 			$("img#thmbackground").attr({"src":"/"+o.themefolder+"/"+o.theme+"/images/"+wallpaper,"width":ww}).css({"position":"fixed","top":"0px","left":"0px","z-index":"-1","height":"auto"}); | 			$("img#thmbackground").attr({"src":"/"+o.themefolder+"/"+o.theme+"/images/"+wallpapernm,"width":ww}).css({"position":"fixed","top":"0px","left":"0px","z-index":"-1","height":"auto"}); | ||||||
| 		else | 		else | ||||||
| 			$("img#thmbackground").attr({"src":"/"+"images/"+wallpaper,"width":ww}).css({"position":"fixed","top":"0px","left":"0px","z-index":"-1","height":"auto"}); | 			$("img#thmbackground").attr({"src":o.wallpaperPath+wallpaper,"width":ww}).css({"position":"fixed","top":"0px","left":"0px","z-index":"-1","height":"auto"}); | ||||||
| 			 | 			 | ||||||
| 		$("div#bgover").css({"position":"fixed","top":"0px","left":"0px","z-index":"-1","width":ww,"height":wh}); | 		$("div#bgover").css({"position":"fixed","top":"0px","left":"0px","z-index":"-1","width":ww,"height":wh}); | ||||||
| 	}; | 	}; | ||||||
|  | 	 | ||||||
| 	this.loadIconCache = function(){ | 	this.loadIconCache = function(){ | ||||||
| 		var imgs = $("ul.docklist img"); | 		var imgs = $("ul.docklist img"); | ||||||
| 		$.each(imgs,function(){ | 		$.each(imgs,function(){ | ||||||
|  | @ -690,6 +717,18 @@ var orbitDesktop = function(dom){ | ||||||
| 				 | 				 | ||||||
| 		}) | 		}) | ||||||
| 	}; | 	}; | ||||||
|  | 	this.saveWallpaper = function(wallpaper){ | ||||||
|  | 		$.post("desktop/save_desktop_settings",{"save":"wallpaper","wallpapernm":wallpaper,"desktopid":o.desktopId},function(result,status){ | ||||||
|  | 			if(status=="success"){ | ||||||
|  | 				if(result[0].success=="true") | ||||||
|  | 					o.notify("Wallpaper saved!!","success",2); | ||||||
|  | 				else | ||||||
|  | 					o.notify("Wallpaper saving failed!!","imp",2); | ||||||
|  | 			}else{ | ||||||
|  | 				o.notify("Connection problem!!","alert",2); | ||||||
|  | 			} | ||||||
|  | 		}) | ||||||
|  | 	} | ||||||
| 	o.initialize(); | 	o.initialize(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -697,6 +736,7 @@ orbitDesktop.prototype.themefolder = "themes"; | ||||||
| orbitDesktop.prototype.widgetfolder = "desktop_widgets"; | orbitDesktop.prototype.widgetfolder = "desktop_widgets"; | ||||||
| orbitDesktop.prototype.desktopId = "1"; | orbitDesktop.prototype.desktopId = "1"; | ||||||
| orbitDesktop.prototype.notifyImgPath = "temp"; | orbitDesktop.prototype.notifyImgPath = "temp"; | ||||||
|  | orbitDesktop.prototype.wallpaperPath = "/assets/stockBackground/"; | ||||||
| orbitDesktop.prototype.iconPath = "/assets/icons/"; | orbitDesktop.prototype.iconPath = "/assets/icons/"; | ||||||
| orbitDesktop.prototype.currentLanguage = "en"; | orbitDesktop.prototype.currentLanguage = "en"; | ||||||
| var uselessfunction = function(){ | var uselessfunction = function(){ | ||||||
|  |  | ||||||
|  | @ -1,18 +1,5 @@ | ||||||
| // JavaScript Document
 | // JavaScript Document
 | ||||||
| $.extend($.expr[':'], { | //Harry Bomrah
 | ||||||
| 	'containsi': function (elem, i, match, array) { |  | ||||||
| 		return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; |  | ||||||
| 	} |  | ||||||
| }); |  | ||||||
| $.fn.sort = function(c) { |  | ||||||
| 	return this.pushStack([].sort.apply(this, arguments), []); |  | ||||||
|  }; |  | ||||||
| var sortAscending = function(a, b) { |  | ||||||
| 	 return $(a).find("h1").text() > $(b).find("h1").text() ? 1 : -1; |  | ||||||
| }; |  | ||||||
| var sortDescending = function(a, b) { |  | ||||||
| 	 return $(a).find("h1").text() < $(b).find("h1").text() ? 1 : -1; |  | ||||||
| }; |  | ||||||
| var orbitDesktopAPI = function(){ | var orbitDesktopAPI = function(){ | ||||||
| 	o = this; | 	o = this; | ||||||
| 	this.notify = function(msg,type,time){ | 	this.notify = function(msg,type,time){ | ||||||
|  | @ -63,4 +50,35 @@ var orbitDesktopAPI = function(){ | ||||||
| 	    } | 	    } | ||||||
| 	    return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]); | 	    return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]); | ||||||
| 	}; | 	}; | ||||||
|  | 	this.changeWallpaper = function(wallpaper){ | ||||||
|  | 		$("img#thmbackground").attr("src",o.wallpaperPath+wallpaper); | ||||||
|  | 		o.saveWallpaper(wallpaper); | ||||||
|  | 	}; | ||||||
|  | 	this.confirm = function(msg,btnvalues,highlighted,callbackfn){ | ||||||
|  | 		if(!btnvalues)btnvalues=["Ok","Cancel"]; | ||||||
|  | 		if(highlighted!=1 || highlighted!=2)highlighted=2; | ||||||
|  | 		if(!msg)msg = "Are you sure?" | ||||||
|  | 		var $confirm = $("#orbitdiag"); | ||||||
|  | 		$confirm.find(".diag_action a").addClass("admbg admtxt"); | ||||||
|  | 		$confirm.find(".diag_message").text(msg); | ||||||
|  | 		if(highlighted == 1) | ||||||
|  | 			$confirm.find("#diag_confirm").removeClass("admbg admtxt").addClass("thmc1 thmtxt"); | ||||||
|  | 		if(highlighted == 2) | ||||||
|  | 			$confirm.find("#diag_cancel").removeClass("admbg admtxt").addClass("thmc1 thmtxt"); | ||||||
|  | 		$confirm.find("#diag_confirm").text(btnvalues[0]).one("click",function(){ | ||||||
|  | 			$confirm.hide(); | ||||||
|  | 			$confirm.find(".diag_action a").unbind(); | ||||||
|  | 			if(typeof callbackfn=="function") | ||||||
|  | 				callbackfn.call(this,true); | ||||||
|  | 		}); | ||||||
|  | 		$confirm.find("#diag_cancel").text(btnvalues[1]).one("click",function(){ | ||||||
|  | 			$confirm.hide(); | ||||||
|  | 			$confirm.find(".diag_action a").unbind(); | ||||||
|  | 			if(typeof callbackfn=="function") | ||||||
|  | 				callbackfn.call(this,false); | ||||||
|  | 		}); | ||||||
|  | 		$confirm.show(); | ||||||
|  | 	} | ||||||
| }; | }; | ||||||
|  | orbitDesktopAPI.prototype.notifyImgPath = "temp"; | ||||||
|  | orbitDesktopAPI.prototype.wallpaperPath = "temp"; | ||||||
|  |  | ||||||
|  | @ -42,6 +42,7 @@ class DesktopController< ApplicationController | ||||||
|     case @savewhat |     case @savewhat | ||||||
|     when "theme" |     when "theme" | ||||||
|       @desktop.update_attributes(:theme => params["theme"]) |       @desktop.update_attributes(:theme => params["theme"]) | ||||||
|  |       @desktop.update_attributes(:wallpaper => nil) | ||||||
|     when "desktopnames" |     when "desktopnames" | ||||||
|       @sections = @desktop.sections |       @sections = @desktop.sections | ||||||
|       x = 0; |       x = 0; | ||||||
|  | @ -64,6 +65,8 @@ class DesktopController< ApplicationController | ||||||
|       when "customtheme" |       when "customtheme" | ||||||
|         @desktop.update_attributes(:theme => "custom") |         @desktop.update_attributes(:theme => "custom") | ||||||
|         @desktop.update_attributes(:customtheme => params['theme']) |         @desktop.update_attributes(:customtheme => params['theme']) | ||||||
|  |       when "wallpaper" | ||||||
|  |         @desktop.update_attributes(:wallpaper => params["wallpapernm"]) | ||||||
|       end |       end | ||||||
|      a = Array.new |      a = Array.new | ||||||
|      a << {"success"=>"true"} |      a << {"success"=>"true"} | ||||||
|  |  | ||||||
|  | @ -4,6 +4,7 @@ class Desktop | ||||||
|    |    | ||||||
|   field :theme, default: "default" |   field :theme, default: "default" | ||||||
|   field :customtheme |   field :customtheme | ||||||
|  |   field :wallpaper | ||||||
|    |    | ||||||
|   belongs_to :user |   belongs_to :user | ||||||
|    |    | ||||||
|  |  | ||||||
|  | @ -81,8 +81,8 @@ | ||||||
| 		<div class="diag_holder_inner"> | 		<div class="diag_holder_inner"> | ||||||
| 			<div class="diag_message">Continue anyway?</div> | 			<div class="diag_message">Continue anyway?</div> | ||||||
| 			<div class="diag_action"> | 			<div class="diag_action"> | ||||||
| 				<a href="" id="diag_confirm" class="diag_btn thmc1 thmtxt w1 hh2 hp">Yes</a> | 				<a href="" id="diag_confirm" class="diag_btn admbg admtxt w1 hh2 hp" onclick="return false;">Yes</a> | ||||||
| 				<a href="" id="diag_cancel" class="diag_btn admbg admtxt w1 hh2 hp">Cancel</a> | 				<a href="" id="diag_cancel" class="diag_btn admbg admtxt w1 hh2 hp" onclick="return false;">Cancel</a> | ||||||
| 			</div> | 			</div> | ||||||
| 		</div> | 		</div> | ||||||
| 	</div> | 	</div> | ||||||
|  |  | ||||||
|  | @ -64,21 +64,21 @@ | ||||||
| 			</div> | 			</div> | ||||||
| 			<div id="st3" class="st_c"> | 			<div id="st3" class="st_c"> | ||||||
| 				<div class="stock_wallpaper ssl"> | 				<div class="stock_wallpaper ssl"> | ||||||
| 					<div class="sb1 ssl_item"><img src="assets/stockBackground/thumb/1.jpg" alt=""></div> | 					<div class="sb1 ssl_item"><img src="assets/stockBackground/thumb/1.jpg" alt="1.jpg"></div> | ||||||
| 					<div class="sb2 ssl_item"><img src="assets/stockBackground/thumb/2.jpg" alt=""></div> | 					<div class="sb2 ssl_item"><img src="assets/stockBackground/thumb/2.jpg" alt="2.jpg"></div> | ||||||
| 					<div class="sb3 ssl_item"><img src="assets/stockBackground/thumb/3.jpg" alt=""></div> | 					<div class="sb3 ssl_item"><img src="assets/stockBackground/thumb/3.jpg" alt="3.jpg"></div> | ||||||
| 					<div class="sb4 ssl_item"><img src="assets/stockBackground/thumb/4.jpg" alt=""></div> | 					<div class="sb4 ssl_item"><img src="assets/stockBackground/thumb/4.jpg" alt="4.jpg"></div> | ||||||
| 					<div class="sb5 ssl_item"><img src="assets/stockBackground/thumb/5.jpg" alt=""></div> | 					<div class="sb5 ssl_item"><img src="assets/stockBackground/thumb/5.jpg" alt="5.jpg"></div> | ||||||
| 					<div class="sb6 ssl_item"><img src="assets/stockBackground/thumb/6.jpg" alt=""></div> | 					<div class="sb6 ssl_item"><img src="assets/stockBackground/thumb/6.jpg" alt="6.jpg"></div> | ||||||
| 					<div class="sb7 ssl_item"><img src="assets/stockBackground/thumb/7.jpg" alt=""></div> | 					<div class="sb7 ssl_item"><img src="assets/stockBackground/thumb/7.jpg" alt="7.jpg"></div> | ||||||
| 					<div class="sb8 ssl_item"><img src="assets/stockBackground/thumb/8.jpg" alt=""></div> | 					<div class="sb8 ssl_item"><img src="assets/stockBackground/thumb/8.jpg" alt="8.jpg"></div> | ||||||
| 					<div class="sb9 ssl_item"><img src="assets/stockBackground/thumb/9.jpg" alt=""></div> | 					<div class="sb9 ssl_item"><img src="assets/stockBackground/thumb/9.jpg" alt="9.jpg"></div> | ||||||
| 					<div class="sb10 ssl_item"><img src="assets/stockBackground/thumb/10.jpg" alt=""></div> | 					<div class="sb10 ssl_item"><img src="assets/stockBackground/thumb/10.jpg" alt="10.jpg"></div> | ||||||
| 					<div class="sb11 ssl_item"><img src="assets/stockBackground/thumb/11.jpg" alt=""></div> | 					<div class="sb11 ssl_item"><img src="assets/stockBackground/thumb/11.jpg" alt="11.jpg"></div> | ||||||
| 					<div class="sb12 ssl_item"><img src="assets/stockBackground/thumb/12.jpg" alt=""></div> | 					<div class="sb12 ssl_item"><img src="assets/stockBackground/thumb/12.jpg" alt="12.jpg"></div> | ||||||
| 				</div> | 				</div> | ||||||
| 				<div class="s_action"> | 				<div class="s_action"> | ||||||
| 						<a href="" id="theme_submit" class="setting_btn thmc1 thmtxt w1 hh2 hp">Confirm</a> | 					<!--	<div href="" class="setting_btn thmc1 thmtxt w1 hh2 hp" onclick="o.tempFunc();return false;">Confirm</a> --> | ||||||
| 					</div> | 					</div> | ||||||
| 				<div class="clear"></div> | 				<div class="clear"></div> | ||||||
| 			</div> | 			</div> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue