Merge branch 'desktop_harry' into desktop_devin
This commit is contained in:
		
						commit
						1fce99c96f
					
				| 
						 | 
					@ -1,9 +1,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// JavaScript Document
 | 
					// JavaScript Document
 | 
				
			||||||
//harry
 | 
					//harry
 | 
				
			||||||
//Inititialize function will initialize desktop
 | 
					//Inititialize function will initialize desktop
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$.extend($.expr[':'], {
 | 
					$.extend($.expr[':'], {
 | 
				
			||||||
	'containsi': function (elem, i, match, array) {
 | 
						'containsi': function (elem, i, match, array) {
 | 
				
			||||||
		return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
 | 
							return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
 | 
				
			||||||
| 
						 | 
					@ -25,7 +23,6 @@ var orbitDesktop = function(dom){
 | 
				
			||||||
	this.contentHolder = dom;
 | 
						this.contentHolder = dom;
 | 
				
			||||||
	this.themesettings = "";
 | 
						this.themesettings = "";
 | 
				
			||||||
	this.theme = "4f8d3f493b67fcd05f086359";
 | 
						this.theme = "4f8d3f493b67fcd05f086359";
 | 
				
			||||||
//	this.themefolder = "themes";
 | 
					 | 
				
			||||||
	this.transitionTime = 500;
 | 
						this.transitionTime = 500;
 | 
				
			||||||
	this.currenthtml = "desktop.html";
 | 
						this.currenthtml = "desktop.html";
 | 
				
			||||||
	this.currentface = "home";
 | 
						this.currentface = "home";
 | 
				
			||||||
| 
						 | 
					@ -137,11 +134,11 @@ var orbitDesktop = function(dom){
 | 
				
			||||||
		o.currentface = "home";
 | 
							o.currentface = "home";
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
		var bindHandlers = function(){ // this function will bind all the handlers in the desktop
 | 
							var bindHandlers = function(){ // this function will bind all the handlers in the desktop
 | 
				
			||||||
 | 
					 | 
				
			||||||
			var groupWrapperWidth = 0;
 | 
								var groupWrapperWidth = 0;
 | 
				
			||||||
			$("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);});
 | 
								$("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			$("div#desktop #group_wrapper").css("width",groupWrapperWidth);
 | 
								$("div#desktop #group_wrapper").css("width",groupWrapperWidth);
 | 
				
			||||||
 | 
								var first = true;
 | 
				
			||||||
			$("div#desktop .g_col").sortable({
 | 
								$("div#desktop .g_col").sortable({
 | 
				
			||||||
				connectWith: ".g_col",
 | 
									connectWith: ".g_col",
 | 
				
			||||||
				tolerance: 'pointer' ,
 | 
									tolerance: 'pointer' ,
 | 
				
			||||||
| 
						 | 
					@ -149,37 +146,37 @@ var orbitDesktop = function(dom){
 | 
				
			||||||
				containment: '#group_wrapper',
 | 
									containment: '#group_wrapper',
 | 
				
			||||||
				helper: 'clone',
 | 
									helper: 'clone',
 | 
				
			||||||
				stop:function(){
 | 
									stop:function(){
 | 
				
			||||||
					var newpostitions = new Array;
 | 
										first = true;
 | 
				
			||||||
					var groupids = new Array;
 | 
					 | 
				
			||||||
					$.each($("div#desktop .group"),function(i,grp){
 | 
					 | 
				
			||||||
						var groupone = new Array;
 | 
					 | 
				
			||||||
						groupids.push($(grp).attr("id"));
 | 
					 | 
				
			||||||
						$ul = $(grp).find(".g_col .element");
 | 
					 | 
				
			||||||
						$.each($ul,function(){
 | 
					 | 
				
			||||||
							groupone.push($(this).attr("id"));
 | 
					 | 
				
			||||||
						})
 | 
					 | 
				
			||||||
						newpostitions.push(groupone);
 | 
					 | 
				
			||||||
					});
 | 
					 | 
				
			||||||
					$.post("/desktop/newpositions",{"sectionid":o.sectionId,"newpos":newpostitions,"groupids":groupids});
 | 
					 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
				update:function(){
 | 
									update:function(){
 | 
				
			||||||
 | 
										if(first){
 | 
				
			||||||
 | 
											first = false;
 | 
				
			||||||
 | 
											var newpostitions = new Array;
 | 
				
			||||||
 | 
											var groupids = new Array;
 | 
				
			||||||
 | 
											$.each($("div#desktop .group"),function(i,grp){
 | 
				
			||||||
 | 
												var groupone = new Array;
 | 
				
			||||||
 | 
												groupids.push($(grp).attr("id"));
 | 
				
			||||||
 | 
												$ul = $(grp).find(".g_col .element");
 | 
				
			||||||
 | 
												$.each($ul,function(){
 | 
				
			||||||
 | 
													groupone.push($(this).attr("id"));
 | 
				
			||||||
 | 
												})
 | 
				
			||||||
 | 
												newpostitions.push(groupone);
 | 
				
			||||||
 | 
											});
 | 
				
			||||||
 | 
											$.post("/desktop/newpositions",{"sectionid":o.sectionId,"newpos":newpostitions,"groupids":groupids});
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
					var s = $(this).find('.element').length;
 | 
										var s = $(this).find('.element').length;
 | 
				
			||||||
						if(s!=0){
 | 
											if(s!=0){
 | 
				
			||||||
							last = $(this).find('.element').eq(s-1).position(),
 | 
												last = $(this).find('.element').eq(s-1).position(),
 | 
				
			||||||
							lasth = $(this).find('.element').eq(s-1).outerHeight(true);
 | 
												lasth = $(this).find('.element').eq(s-1).outerHeight(true);
 | 
				
			||||||
					
 | 
					 | 
				
			||||||
							if ((last.top+lasth)>528){
 | 
												if ((last.top+lasth)>528){
 | 
				
			||||||
								$(this).sortable('cancel');
 | 
													$(this).sortable('cancel');
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
						}else{$(this).remove();}
 | 
											}else{$(this).remove();}
 | 
				
			||||||
 | 
					 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
				receive: function(event, ui){
 | 
									receive: function(event, ui){
 | 
				
			||||||
				
 | 
					 | 
				
			||||||
					var s = $(this).find('.element').length,
 | 
										var s = $(this).find('.element').length,
 | 
				
			||||||
						last = $(this).find('.element').eq(s-1).position(),
 | 
											last = $(this).find('.element').eq(s-1).position(),
 | 
				
			||||||
						lasth = $(this).find('.element').eq(s-1).outerHeight(true);
 | 
											lasth = $(this).find('.element').eq(s-1).outerHeight(true);
 | 
				
			||||||
 | 
					 | 
				
			||||||
					if ((last.top+lasth)>528){
 | 
										if ((last.top+lasth)>528){
 | 
				
			||||||
						$(ui.sender).sortable('cancel');
 | 
											$(ui.sender).sortable('cancel');
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
| 
						 | 
					@ -228,12 +225,12 @@ var orbitDesktop = function(dom){
 | 
				
			||||||
							bw = parseInt(brick[0].substr(1)),
 | 
												bw = parseInt(brick[0].substr(1)),
 | 
				
			||||||
							bh = parseInt(brick[1].substr(1)),
 | 
												bh = parseInt(brick[1].substr(1)),
 | 
				
			||||||
							bd = bw * bh;
 | 
												bd = bw * bh;
 | 
				
			||||||
							
 | 
					 | 
				
			||||||
						if(bh==1 && bw==1){
 | 
											if(bh==1 && bw==1){
 | 
				
			||||||
							small++;
 | 
												small++;
 | 
				
			||||||
						}else if(bh!=1 && bw!=1){
 | 
											}else if(bh!=1 && bw!=1){
 | 
				
			||||||
							single = true;
 | 
												single = true;
 | 
				
			||||||
						}
 | 
											}		
 | 
				
			||||||
 | 
										
 | 
				
			||||||
						if(small==2){
 | 
											if(small==2){
 | 
				
			||||||
							small=0;
 | 
												small=0;
 | 
				
			||||||
							single=false;
 | 
												single=false;
 | 
				
			||||||
| 
						 | 
					@ -755,15 +752,52 @@ var orbitDesktop = function(dom){
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		var connection = function(){
 | 
							var connection = function(){
 | 
				
			||||||
			var bindHandlers = function(){
 | 
								var bindHandlers = function(){
 | 
				
			||||||
				$("#gmail_connect_btn").click(function(){
 | 
									$("#connection_setting ul a").click(function(){
 | 
				
			||||||
						var usernm = $("input#gmail_username").val(),
 | 
										var what = $(this).attr("for"),
 | 
				
			||||||
							pwd = $("input#gmail_password").val(),
 | 
											type = $(this).attr("href"),
 | 
				
			||||||
							type = $(this).attr("href"),
 | 
											$ul = $("#"+type+"_connection"),
 | 
				
			||||||
							what = "edit";
 | 
											usernm = $ul.find("input[type=text]").val(),
 | 
				
			||||||
						if(usernm!="" && pwd!="")
 | 
											pwd = $ul.find("input[type=password]").val();
 | 
				
			||||||
							saveaccount(usernm,pwd,type,what);
 | 
											switch(what){
 | 
				
			||||||
							
 | 
												case "save":
 | 
				
			||||||
				});
 | 
												case "new":
 | 
				
			||||||
 | 
													if(usernm!="" && pwd!=""){
 | 
				
			||||||
 | 
														$ul.find("input[type=text]").replaceWith("<div class='c_info usrnm'>"+usernm+"</div>")
 | 
				
			||||||
 | 
														$ul.find("input[type=password]").replaceWith("<div class='c_info pwd'>••••••</div>");
 | 
				
			||||||
 | 
														$(this).text("Edit").attr("for","edit");
 | 
				
			||||||
 | 
														$(this).parent().find("a[for=delete]").show();
 | 
				
			||||||
 | 
														$ul.find("span.c_status").text("Connected").addClass("c_status_on");
 | 
				
			||||||
 | 
														if(what=="save")
 | 
				
			||||||
 | 
															what="edit";
 | 
				
			||||||
 | 
														saveaccount(usernm,pwd,type,what);
 | 
				
			||||||
 | 
													}
 | 
				
			||||||
 | 
													break;
 | 
				
			||||||
 | 
												case "edit":
 | 
				
			||||||
 | 
													var un = $ul.find("div.usrnm").text();
 | 
				
			||||||
 | 
													$ul.find("div.usrnm").replaceWith('<input type="text" value="'+un+'">');
 | 
				
			||||||
 | 
													$ul.find("div.pwd").replaceWith('<input type="password">');
 | 
				
			||||||
 | 
													$(this).text("Save").attr("for","save");
 | 
				
			||||||
 | 
													break;
 | 
				
			||||||
 | 
												case "delete":
 | 
				
			||||||
 | 
												var $this = $(this);
 | 
				
			||||||
 | 
													o.confirm({
 | 
				
			||||||
 | 
														message : "Are you sure that you want to remove this account?",
 | 
				
			||||||
 | 
														buttons : ["Yes","No"],
 | 
				
			||||||
 | 
														highlighted : 2
 | 
				
			||||||
 | 
													},function(reply){
 | 
				
			||||||
 | 
														if(reply){
 | 
				
			||||||
 | 
															$this.hide();
 | 
				
			||||||
 | 
															$ul.find("div.usrnm").replaceWith('<input type="text">');
 | 
				
			||||||
 | 
															$ul.find("div.pwd").replaceWith('<input type="password">');
 | 
				
			||||||
 | 
															$ul.find("span.c_status").text("No Connection").removeClass("c_status_on");
 | 
				
			||||||
 | 
															$this.parent().find("a[for=edit]").text("Connect").attr("for","new");
 | 
				
			||||||
 | 
															saveaccount("","",type,what);
 | 
				
			||||||
 | 
														}
 | 
				
			||||||
 | 
													})
 | 
				
			||||||
 | 
													break;
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
											
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				var $conlist = $('.s_form'),
 | 
									var $conlist = $('.s_form'),
 | 
				
			||||||
					conlist_w = $conlist.length * $conlist.outerWidth(true) + ($conlist.length - 1) * 25;
 | 
										conlist_w = $conlist.length * $conlist.outerWidth(true) + ($conlist.length - 1) * 25;
 | 
				
			||||||
| 
						 | 
					@ -779,14 +813,32 @@ var orbitDesktop = function(dom){
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			var saveaccount = function(usernm,pwd,type,what){
 | 
								var saveaccount = function(usernm,pwd,type,what){
 | 
				
			||||||
					$.post("/desktop/save_account_info",{email:usernm,password:pwd,account:type,dowhat:what},function(result){
 | 
										$.post("/desktop/save_account_info",{email:usernm,password:pwd,account:type,dowhat:what},function(result){
 | 
				
			||||||
						if(result[0].success=="true")
 | 
											if(what!="delete"){
 | 
				
			||||||
							o.notify("Gmail account connected!!","success",2);
 | 
												if(result[0].success=="true")
 | 
				
			||||||
						else
 | 
													o.notify(type+" account connected!!","success",2);
 | 
				
			||||||
							o.notify("Gmail account connection failed!!","imp",2);
 | 
												else
 | 
				
			||||||
 | 
													o.notify(type+" account connection failed!!","imp",2);
 | 
				
			||||||
 | 
											}else{
 | 
				
			||||||
 | 
												if(result[0].success=="true")
 | 
				
			||||||
 | 
													o.notify(type+" account removed!!","success",2);
 | 
				
			||||||
 | 
												else
 | 
				
			||||||
 | 
													o.notify(type+" account removal failed!!","imp",2);
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
					})
 | 
										})
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			$("div#settings div#panel_r").load("/desktop/settingconnection",function(){
 | 
								$("div#settings div#panel_r").load("/desktop/settingconnection",function(){
 | 
				
			||||||
				bindHandlers();
 | 
									$.getJSON("desktop/getaccounts",function(accounts){
 | 
				
			||||||
 | 
										$.each(accounts,function(i,account){
 | 
				
			||||||
 | 
											$ul = $("#"+account.type+"_connection");
 | 
				
			||||||
 | 
											$ul.find("input[type=text]").replaceWith("<div class='c_info usrnm'>"+account.email+"</div>")
 | 
				
			||||||
 | 
											$ul.find("input[type=password]").replaceWith("<div class='c_info pwd'>••••••</div>");
 | 
				
			||||||
 | 
											$ul.find("a[for=new]").text("Edit").attr("for","edit");
 | 
				
			||||||
 | 
											$ul.find("a[for=delete]").show();
 | 
				
			||||||
 | 
											$ul.find("span.c_status").text("Connected").addClass("c_status_on");
 | 
				
			||||||
 | 
										})
 | 
				
			||||||
 | 
										bindHandlers();
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
									
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -940,4 +992,3 @@ orbitDesktop.prototype.currentUsername = "Harry";
 | 
				
			||||||
var uselessfunction = function(){
 | 
					var uselessfunction = function(){
 | 
				
			||||||
	$.post("/desktop/temp_func",{sectionid:"4f83e7bbbd98eb041600001d"});
 | 
						$.post("/desktop/temp_func",{sectionid:"4f83e7bbbd98eb041600001d"});
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,8 +14,11 @@ class OtheraccountsController< ApplicationController
 | 
				
			||||||
    when "new"
 | 
					    when "new"
 | 
				
			||||||
      OtherAccount.create(user_id: current_user.id, email: @email, encrypted_password: @password, type: @account)
 | 
					      OtherAccount.create(user_id: current_user.id, email: @email, encrypted_password: @password, type: @account)
 | 
				
			||||||
    when "edit"
 | 
					    when "edit"
 | 
				
			||||||
      @otheraccount = OtherAccount.where(:type.all => [@account],:user_id.all => [current_user.id])
 | 
					      @otheraccount = OtherAccount.where(:type.all => [@account],:user_id.all => [current_user.id]) rescue nil
 | 
				
			||||||
      @otheraccount.first.update_attributes(:email => @email, :encrypted_password => @password)
 | 
					      @otheraccount.first.update_attributes(:email => @email, :encrypted_password => @password)
 | 
				
			||||||
 | 
					    when "delete"
 | 
				
			||||||
 | 
					      @otheraccount = OtherAccount.where(:type.all => [@account], :user_id.all => [current_user.id]) rescue nil
 | 
				
			||||||
 | 
					      @otheraccount.destroy_all
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    a = Array.new
 | 
					    a = Array.new
 | 
				
			||||||
    a << {"success"=>"true"}
 | 
					    a << {"success"=>"true"}
 | 
				
			||||||
| 
						 | 
					@ -23,19 +26,31 @@ class OtheraccountsController< ApplicationController
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def gmail
 | 
					  def gmail
 | 
				
			||||||
    @gmailaccount = OtherAccount.where(:type.all => ["gmail"],:user_id.all => [current_user.id])
 | 
					    @gmailaccount = OtherAccount.where(:type.all => ["gmail"],:user_id.all => [current_user.id]) rescue nil
 | 
				
			||||||
    @decrypted_password = @gmailaccount.first.encrypted_password.decrypt 
 | 
					    if @gmailaccount.first != nil
 | 
				
			||||||
    @email = @gmailaccount.first.email
 | 
					      @decrypted_password = @gmailaccount.first.encrypted_password.decrypt 
 | 
				
			||||||
    url = URI.parse("https://mail.google.com/mail/feed/atom")
 | 
					      @email = @gmailaccount.first.email
 | 
				
			||||||
    req = Net::HTTP::Get.new(url.path)
 | 
					      url = URI.parse("https://mail.google.com/mail/feed/atom")
 | 
				
			||||||
    req.basic_auth @email, @decrypted_password
 | 
					      req = Net::HTTP::Get.new(url.path)
 | 
				
			||||||
    req.content_type = 'text/xml'
 | 
					      req.basic_auth @email, @decrypted_password
 | 
				
			||||||
 | 
					      req.content_type = 'text/xml'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    http = Net::HTTP.new(url.host, url.port)
 | 
					      http = Net::HTTP.new(url.host, url.port)
 | 
				
			||||||
    http.use_ssl = true
 | 
					      http.use_ssl = true
 | 
				
			||||||
    response = http.start { |http| http.request(req) }
 | 
					      response = http.start { |http| http.request(req) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    root = Document.new(response.read_body).root
 | 
					      root = Document.new(response.read_body).root
 | 
				
			||||||
    render :text=>root
 | 
					      render :text=>root
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      msg = "<HEAD><ERROR>true</ERROR><ERRORMSG>Account setting problem.</ERRORMSG></HEAD>"
 | 
				
			||||||
 | 
					      respond_to do |m|
 | 
				
			||||||
 | 
					        m.xml {render :xml=>msg}
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def getaccounts
 | 
				
			||||||
 | 
					    @accounts = OtherAccount.where(:user_id.all => [current_user.id])
 | 
				
			||||||
 | 
					    render :json => @accounts.to_json
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					@ -27,37 +27,39 @@
 | 
				
			||||||
					<td><label for="s_name1">Password</label><input type="password" /></td>
 | 
										<td><label for="s_name1">Password</label><input type="password" /></td>
 | 
				
			||||||
				</tr>
 | 
									</tr>
 | 
				
			||||||
			</table> -->
 | 
								</table> -->
 | 
				
			||||||
			<ul class="s_form w2 hp">
 | 
								<ul class="s_form w2 hp" id="facebook_connection">
 | 
				
			||||||
				<li><span class="c_status">No Connection</span></li>
 | 
									<li><span class="c_status">No Connection</span></li>
 | 
				
			||||||
				<li><img src="assets/connection/facebook.png" alt="" class="c_icon"><h1 class="c_name">Facebook</h1></li>
 | 
									<li><img src="assets/connection/facebook.png" alt="" class="c_icon"><h1 class="c_name">Facebook</h1></li>
 | 
				
			||||||
				<li><label for="">Account</label><input type="text"></li>
 | 
									<li><label for="">Account</label><input type="text"></li>
 | 
				
			||||||
				<li><label for="">Password</label><input type="password"></li>
 | 
									<li><label for="">Password</label><input type="password"></li>
 | 
				
			||||||
				<li>
 | 
									<li>
 | 
				
			||||||
					<div class="s_action">
 | 
										<div class="s_action">
 | 
				
			||||||
						<a href="" class="setting_btn thmc1 thmtxt hp disable">Connecting</a>
 | 
											<a href="facebook" class="setting_btn thmc1 thmtxt hp" onclick="return false;" for="new">Connect</a>
 | 
				
			||||||
 | 
											<a href="facebook" class="setting_btn thmc1 thmtxt hp" onclick="return false;" for="delete" style="display:none;">Remove</a>
 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
				</li>
 | 
									</li>
 | 
				
			||||||
			</ul>
 | 
								</ul>
 | 
				
			||||||
			<ul class="s_form w2 hp">
 | 
								<ul class="s_form w2 hp" id="twitter_connection">
 | 
				
			||||||
				<li><spanspan class="c_status">No Connection</span></li>
 | 
									<li><span class="c_status">No Connection</span></li>
 | 
				
			||||||
				<li><img src="assets/connection/twitter.png" alt="" class="c_icon"><h1 class="c_name">Twitter</h1></li>
 | 
									<li><img src="assets/connection/twitter.png" alt="" class="c_icon"><h1 class="c_name">Twitter</h1></li>
 | 
				
			||||||
				<li><label for="">Account</label><input type="text"></li>
 | 
									<li><label for="">Account</label><input type="text"></li>
 | 
				
			||||||
				<li><label for="">Password</label><input type="password"></li>
 | 
									<li><label for="">Password</label><input type="password"></li>
 | 
				
			||||||
				<li>
 | 
									<li>
 | 
				
			||||||
					<div class="s_action">
 | 
										<div class="s_action">
 | 
				
			||||||
						<a href="" class="setting_btn thmc1 thmtxt hp">Connect</a>
 | 
											<a href="twitter" class="setting_btn thmc1 thmtxt hp" onclick="return false;" for="new">Connect</a>
 | 
				
			||||||
 | 
											<a href="twitter" class="setting_btn thmc1 thmtxt hp" onclick="return false;" for="delete" style="display:none;">Remove</a>
 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
				</li>
 | 
									</li>
 | 
				
			||||||
			</ul>
 | 
								</ul>
 | 
				
			||||||
			<ul class="s_form w2 hp">
 | 
								<ul class="s_form w2 hp" id="gmail_connection">
 | 
				
			||||||
				<li><span class="c_status c_status_on">Connected</span></li>
 | 
									<li><span class="c_status">No Connection</span></li>
 | 
				
			||||||
				<li><img src="assets/connection/gmail.png" alt="" class="c_icon"><h1 class="c_name">gmail</h1></li>
 | 
									<li><img src="assets/connection/gmail.png" alt="" class="c_icon"><h1 class="c_name">Gmail</h1></li>
 | 
				
			||||||
				<li><label for="">Account</label><div class="c_info">Harry</div></li>
 | 
									<li><label for="">Account</label><input type="text"></li><!-- <div class="c_info">Harry</div></li> -->
 | 
				
			||||||
				<li><label for="">Password</label><div class="c_info">••••••</div></li>
 | 
									<li><label for="">Password</label><input type="password"></li><!-- <div class="c_info">••••••</div></li> -->
 | 
				
			||||||
				<li>
 | 
									<li>
 | 
				
			||||||
					<div class="s_action">
 | 
										<div class="s_action">
 | 
				
			||||||
						<a href="" class="setting_btn thmc1 thmtxt hp">Edit</a>
 | 
											<a href="gmail" class="setting_btn thmc1 thmtxt hp" onclick="return false;" for="new">Connect</a>
 | 
				
			||||||
						<a href="" class="setting_btn thmc1 thmtxt hp">Remove</a>
 | 
											<a href="gmail" class="setting_btn thmc1 thmtxt hp" onclick="return false;" for="delete" style="display:none;">Remove</a>
 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
				</li>
 | 
									</li>
 | 
				
			||||||
			</ul>
 | 
								</ul>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -119,6 +119,7 @@ Orbit::Application.routes.draw do
 | 
				
			||||||
  match '/desktop/journal_p_add/'=>'desktop#journal_p_add'
 | 
					  match '/desktop/journal_p_add/'=>'desktop#journal_p_add'
 | 
				
			||||||
  match '/desktop/settingconnection/'=>'desktop#settingconnection'
 | 
					  match '/desktop/settingconnection/'=>'desktop#settingconnection'
 | 
				
			||||||
  match '/desktop/forgmail/'=>'otheraccounts#gmail'
 | 
					  match '/desktop/forgmail/'=>'otheraccounts#gmail'
 | 
				
			||||||
 | 
					  match '/desktop/getaccounts'=>'otheraccounts#getaccounts'
 | 
				
			||||||
  match '/desktop/save_account_info/'=>'otheraccounts#saveaccountinfo'
 | 
					  match '/desktop/save_account_info/'=>'otheraccounts#saveaccountinfo'
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  match '/desktop/temp_func/'=>'desktop#temp_func'
 | 
					  match '/desktop/temp_func/'=>'desktop#temp_func'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,32 +3,37 @@ var gmail = function(){
 | 
				
			||||||
	   		url: "/desktop/forgmail",
 | 
						   		url: "/desktop/forgmail",
 | 
				
			||||||
			dataType : "xml",
 | 
								dataType : "xml",
 | 
				
			||||||
			success:function(data){
 | 
								success:function(data){
 | 
				
			||||||
				if($(data).find("HEAD").find("TITLE").text()=="Unauthorized"){
 | 
									if($(data).find("HEAD").find("ERROR").text()=="true"){
 | 
				
			||||||
					$("#gmail #forerror").text($(data).find("HEAD").find("TITLE").text()).show();
 | 
										$("#gmail #content #msgbody").text($(data).find("HEAD").find("ERRORMSG").text());
 | 
				
			||||||
				}else{
 | 
									}else{
 | 
				
			||||||
					if($(data).find("fullcount").text()=="0"){
 | 
										if($(data).find("HEAD").find("TITLE").text()=="Unauthorized"){
 | 
				
			||||||
						$("#gmail #forerror").hide();
 | 
											$("#gmail #forerror").text($(data).find("HEAD").find("TITLE").text()).show();
 | 
				
			||||||
						$("#gmail #content #msgbody").text("No new mails");
 | 
					 | 
				
			||||||
					}else{
 | 
										}else{
 | 
				
			||||||
						var msg;
 | 
											if($(data).find("fullcount").text()=="0"){
 | 
				
			||||||
						if($(data).find("fullcount").text()=="1")
 | 
												$("#gmail #forerror").hide();
 | 
				
			||||||
							msg = $(data).find("fullcount").text()+" unread message in your inbox.";
 | 
												$("#gmail #content #msgbody").text("No new mails");
 | 
				
			||||||
						else
 | 
											}else{
 | 
				
			||||||
							msg = $(data).find("fullcount").text()+" unread messages in your inbox.";
 | 
												var msg;
 | 
				
			||||||
						o.notify(msg,"alert",2);
 | 
												if($(data).find("fullcount").text()=="1")
 | 
				
			||||||
						$(data).find("entry").each(function(i,val){
 | 
													msg = $(data).find("fullcount").text()+" unread message in your inbox.";
 | 
				
			||||||
							if(i==0){
 | 
												else
 | 
				
			||||||
								$("#gmail #forerror").hide();
 | 
													msg = $(data).find("fullcount").text()+" unread messages in your inbox.";
 | 
				
			||||||
								var atag = $("<a href='"+$(this).find("link").attr("href")+"'>"+$(this).find("title").text()+"</a>");
 | 
												o.notify(msg,"alert",2);
 | 
				
			||||||
								$("#gmail #content #subject").html($(this).find("title").text());
 | 
												$(data).find("entry").each(function(i,val){
 | 
				
			||||||
								$("#gmail #content #date").text($(this).find("issued").text());
 | 
													if(i==0){
 | 
				
			||||||
								$("#gmail #content #msgbody").text($(this).find("summary").text());
 | 
														$("#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 #loading").hide();
 | 
				
			||||||
				$("#gmail #content").show();
 | 
									$("#gmail #content").show();
 | 
				
			||||||
 | 
									
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in New Issue