new stuff for gmail and fb
This commit is contained in:
parent
270559f340
commit
6c3f4bff8c
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 820 B |
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -32,7 +32,6 @@
|
|||
//enableLanguageSelect( dom ) children <a> will be binded with language, data-lang = string ex "en"|"zh_tw" will toggle all data-langunage throughout the page
|
||||
//enableSharing( dom ) children <a> will be binded with share, data-mode = string ex "public"|"private" will change the mode for all the selected items. the dom with class should have data-link = url data-var = vaiable_name, default will be mode
|
||||
|
||||
|
||||
$.extend($.expr[':'], {
|
||||
'containsi': function (elem, i, match, array) {
|
||||
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
||||
|
@ -1349,12 +1348,13 @@ var orbitDesktop = function(dom){
|
|||
this.initializeSettings.connection = function(){
|
||||
|
||||
var bindHandlers = function(){
|
||||
$("#connection_setting ul a").click(function(){
|
||||
$("#connection_setting ul div.s_action a").click(function(){
|
||||
var what = $(this).attr("for"),
|
||||
type = $(this).attr("href"),
|
||||
$ul = $("#"+type+"_connection"),
|
||||
usernm = $ul.find("input[type=text]").val(),
|
||||
pwd = $ul.find("input[type=password]").val();
|
||||
|
||||
switch(what){
|
||||
case "save":
|
||||
case "new":
|
||||
|
@ -1367,6 +1367,7 @@ var orbitDesktop = function(dom){
|
|||
if(what=="save")
|
||||
what="edit";
|
||||
saveaccount(usernm,pwd,type,what);
|
||||
|
||||
}
|
||||
break;
|
||||
case "edit":
|
||||
|
@ -1418,17 +1419,17 @@ var orbitDesktop = function(dom){
|
|||
})
|
||||
}
|
||||
|
||||
// $.getJSON("/otheraccounts/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(".c_status").text("Connected").addClass("c_status_on");
|
||||
// })
|
||||
// bindHandlers();
|
||||
// })
|
||||
$.getJSON("/otheraccounts/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(".c_status").text("Connected").addClass("c_status_on");
|
||||
})
|
||||
bindHandlers();
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -52,7 +52,8 @@ class DesktopController< ApplicationController
|
|||
end
|
||||
|
||||
def connections
|
||||
@url = "http://fb.tp.rulingcom.com/login?callback=http://harry.tp.rulingcom.com/facebook/register_fb?user="+current_user.id.to_s
|
||||
# @url = "http://fb.tp.rulingcom.com/login?callback=http://harry.tp.rulingcom.com/facebook/register_fb?user="+current_user.id.to_s
|
||||
@user_id = current_user.id.to_s
|
||||
render "desktop/settings/connections", :layout => false
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Desktop::OtheraccountsController< ApplicationController
|
||||
class OtheraccountsController < ApplicationController
|
||||
require 'open-uri'
|
||||
require 'rexml/document'
|
||||
require 'net/http'
|
||||
|
@ -11,12 +11,13 @@ class Desktop::OtheraccountsController< ApplicationController
|
|||
@email = params['email']
|
||||
@password = params['password']
|
||||
@account = params['account']
|
||||
|
||||
case @dowhat
|
||||
when "new"
|
||||
OtherAccount.create(user_id: current_user.id, email: @email, encrypted_password: @password, type: @account)
|
||||
when "edit"
|
||||
@otheraccount = OtherAccount.where(:type.all => [@account],:user_id.all => [current_user.id]) rescue nil
|
||||
@otheraccount.first.update_attributes(:email => @email, :encrypted_password => @password)
|
||||
@otheraccount = current_user.other_accounts.where(:type => @account).first rescue nil
|
||||
@otheraccount.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
|
||||
|
@ -27,7 +28,7 @@ class Desktop::OtheraccountsController< ApplicationController
|
|||
end
|
||||
|
||||
def gmail
|
||||
@gmailaccount = OtherAccount.where(:type.all => ["gmail"],:user_id.all => [current_user.id]) rescue nil
|
||||
@gmailaccount = current_user.other_accounts.where(:type => "gmail") rescue nil
|
||||
if @gmailaccount.first != nil
|
||||
@decrypted_password = @gmailaccount.first.encrypted_password.decrypt
|
||||
@email = @gmailaccount.first.email
|
||||
|
@ -44,7 +45,7 @@ class Desktop::OtheraccountsController< ApplicationController
|
|||
root = Document.new(response.read_body).root
|
||||
render :text=>root
|
||||
else
|
||||
msg = "<HEAD><ERROR>true</ERROR><ERRORMSG>Account setting problem.</ERRORMSG></HEAD>"
|
||||
msg = "<HEAD><TITLE>Unauthorized</TITLE><H1>No account connected.</H1></HEAD>"
|
||||
respond_to do |m|
|
||||
m.xml {render :xml=>msg}
|
||||
end
|
||||
|
@ -72,7 +73,7 @@ class Desktop::OtheraccountsController< ApplicationController
|
|||
end
|
||||
|
||||
def getaccounts
|
||||
@accounts = OtherAccount.where(:user_id.all => [current_user.id]).without(:encrypted_password)
|
||||
@accounts = current_user.other_accounts.without(:encrypted_password)
|
||||
render :json => @accounts.to_json
|
||||
end
|
||||
end
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
<div id="connection_setting" class="overview vp" content-layout="simple">
|
||||
<a href="" onclick="window.open('<%= facebook_server_path %>','login_window','height=250,width=400,titlebar=0,statusbar=0,location=0');return false;">Connect FaceBook</a>
|
||||
<div id="connection_setting" class="overview vp" content-layout="simple" isotope="true">
|
||||
<!-- <a href="" onclick="window.open('<%= facebook_server_path %>','login_window','height=250,width=400,titlebar=0,statusbar=0,location=0');return false;">Connect FaceBook</a>
|
||||
|
||||
<a href="/facebook/get_friends" ajax-remote="get" >Get Friends</a>
|
||||
<a href="/facebook/disconnect" ajax-remote="get" >Disconnect from facebook</a>
|
||||
<!-- <ul class="s_form w2 hp" id="facebook_connection">
|
||||
<li><span class="c_status">No Connection</span></li>
|
||||
<a href="/facebook/disconnect" ajax-remote="get" >Disconnect from facebook</a> -->
|
||||
<ul class="s_form w2 hp" id="facebook_connection" >
|
||||
<!-- <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><label for="">Account</label><input type="text"></li>
|
||||
<li><label for="">Password</label><input type="password"></li>
|
||||
|
@ -14,7 +14,8 @@
|
|||
<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>
|
||||
</li>
|
||||
</li> -->
|
||||
<li><a href="javascript:void(0);" onclick="window.open('<%= facebook_server_path(:user_id=>@user_id) %>','login_window','height=668,width=1124,titlebar=0,statusbar=0,location=0');"><img src="/assets/facebook-logo.png" alt="" class="c_icon"></a></li>
|
||||
</ul>
|
||||
<ul class="s_form w2 hp" id="twitter_connection">
|
||||
<li><span class="c_status">No Connection</span></li>
|
||||
|
@ -39,7 +40,7 @@
|
|||
<a href="gmail" class="setting_btn thmc1 thmtxt hp" onclick="return false;" for="delete" style="display:none;">Remove</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul> -->
|
||||
</ul>
|
||||
</div>
|
||||
<!-- <div style="z-index:999;position:relative;"><button onclick="o.tempFunc()">Twitter</button> -->
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="overview tab_holder" content-layout="simple">
|
||||
<div class="overview tab_holder" content-layout="simple" base-width="300">
|
||||
<div id="st1" class="st_c" style="display:block;">
|
||||
<div class="theme_list ssl">
|
||||
<% @themes.each do |theme| %>
|
||||
|
|
|
@ -317,7 +317,7 @@ Orbit::Application.routes.draw do
|
|||
match '/twitter/'=>'otheraccounts#twitter'
|
||||
match '/forgmail/'=>'otheraccounts#gmail'
|
||||
match '/otheraccounts/getaccounts'=>'otheraccounts#getaccounts'
|
||||
match '/save_account_info/'=>'otheraccounts#saveaccountinfo'
|
||||
match '/desktop/save_account_info/'=>'otheraccounts#saveaccountinfo'
|
||||
|
||||
match '/desktop_appstore/appstore'=>'desktop_appstore#appstore'
|
||||
match '/desktop_appstore/onlinestore'=>'desktop_appstore#onlinestore'
|
||||
|
|
Reference in New Issue