Modified confirm box…

This commit is contained in:
Harry Bomrah 2012-04-19 15:36:03 +08:00
parent 4bad25e682
commit 3c5b7a5de3
2 changed files with 31 additions and 27 deletions

View File

@ -619,25 +619,29 @@ var orbitDesktop = function(dom){
});
$("a#theme_submit").click(function(){
o.confirm("Are you sure that you want to set this custom theme?",["Yes","No"],3,function(reply){
o.confirm({
message : "Are you sure that you want to save custom theme?",
highlighted : 1,
buttons : ["Yes","No"]
},function(reply){
if(reply){
var colors = new Array;
$("#color_input input").each(function(){
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>";
$("head").find("#dyn_css").remove();
$("head").append(dhtml);
$.post("/desktop/save_desktop_settings",{"save":"customtheme","desktopid":o.desktopId,"theme":dhtml},function(result,status){
if(status=="success"){
if(result[0].success=="true")
o.notify("Custom theme saved!!","success",2);
else
o.notify("Custom theme saving failed!!","imp",2);
}else{
o.notify("Connection problem!!","alert",2);
}
})
var colors = new Array;
$("#color_input input").each(function(){
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>";
$("head").find("#dyn_css").remove();
$("head").append(dhtml);
$.post("/desktop/save_desktop_settings",{"save":"customtheme","desktopid":o.desktopId,"theme":dhtml},function(result,status){
if(status=="success"){
if(result[0].success=="true")
o.notify("Custom theme saved!!","success",2);
else
o.notify("Custom theme saving failed!!","imp",2);
}else{
o.notify("Connection problem!!","alert",2);
}
})
}
})
});

View File

@ -54,24 +54,24 @@ var orbitDesktopAPI = function(){
$("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?"
this.confirm = function(settings,callbackfn){
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?"
var $confirm = $("#orbitdiag");
$confirm.find(".diag_action a").addClass("admbg admtxt");
$confirm.find(".diag_message").text(msg);
if(highlighted == 1)
$confirm.find(".diag_message").text(settings.message);
if(settings.highlighted == 1)
$confirm.find("#diag_confirm").removeClass("admbg admtxt").addClass("thmc1 thmtxt");
if(highlighted == 2)
if(settings.highlighted == 2)
$confirm.find("#diag_cancel").removeClass("admbg admtxt").addClass("thmc1 thmtxt");
$confirm.find("#diag_confirm").text(btnvalues[0]).one("click",function(){
$confirm.find("#diag_confirm").text(settings.buttons[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.find("#diag_cancel").text(settings.buttons[1]).one("click",function(){
$confirm.hide();
$confirm.find(".diag_action a").unbind();
if(typeof callbackfn=="function")