2012-04-26 06:47:49 +00:00
|
|
|
var gmail = function(){
|
|
|
|
var usernm = $("#gmail input[type=text]").val();
|
|
|
|
var pwd = $("#gmail input[type=password]").val();
|
|
|
|
// usernm = "hr@rulingcom.com";
|
|
|
|
// pwd = "hr08973"
|
|
|
|
if(usernm!="" && pwd!=""){
|
|
|
|
$("#gmail a#gmail_button").text("Check again");
|
|
|
|
$("#gmail #loading").show();
|
|
|
|
$("#gmail table#form").hide();
|
|
|
|
$.ajax({
|
|
|
|
url: "/desktop/forgmail",
|
|
|
|
dataType : "xml",
|
|
|
|
data : {username:usernm,password:pwd},
|
|
|
|
success:function(data){
|
|
|
|
if($(data).find("HEAD").find("TITLE").text()=="Unauthorized"){
|
|
|
|
$("#gmail #forerror").text($(data).find("HEAD").find("TITLE").text()).show();
|
|
|
|
$("#gmail table#form").show();
|
|
|
|
}else{
|
|
|
|
if($(data).find("fullcount").text()=="0"){
|
|
|
|
$("#gmail #forerror").hide();
|
|
|
|
$("#gmail #content #msgbody").text("No new mails");
|
|
|
|
}else{
|
|
|
|
var msg;
|
|
|
|
if($(data).find("fullcount").text()=="1")
|
2012-04-26 09:23:47 +00:00
|
|
|
msg = $(data).find("fullcount").text()+" unread message in your inbox."
|
2012-04-26 06:47:49 +00:00
|
|
|
else
|
2012-04-26 09:23:47 +00:00
|
|
|
msg = $(data).find("fullcount").text()+" unread messages in your inbox."
|
2012-04-26 06:47:49 +00:00
|
|
|
o.notify(msg,"alert",2);
|
|
|
|
$(data).find("entry").each(function(i,val){
|
|
|
|
if(i==0){
|
|
|
|
$("#gmail #forerror").hide();
|
|
|
|
var atag = $("<a href='"+$(this).find("link").attr("href")+"'>"+$(this).find("title").text()+"</a>");
|
|
|
|
$("#gmail #content #subject").html($(this).find("title").text());
|
|
|
|
$("#gmail #content #date").text($(this).find("issued").text());
|
|
|
|
$("#gmail #content #msgbody").text($(this).find("summary").text());
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$("#gmail #loading").hide();
|
|
|
|
$("#gmail #content").show();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2012-04-26 13:30:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var saveaccount = function(){
|
|
|
|
var usernm = $("#gmail input[type=text]").val();
|
|
|
|
var pwd = $("#gmail input[type=password]").val();
|
|
|
|
usernm = "hr@rulingcom.com";
|
|
|
|
pwd = "hr08973";
|
|
|
|
if(usernm!="" && pwd!=""){
|
|
|
|
$.post("/desktop/save_account_info",{email:usernm,password:pwd,account:"gmail"})
|
|
|
|
}
|
2012-04-26 06:47:49 +00:00
|
|
|
}
|