diff --git a/app/assets/images/stockBackground/1.jpg b/app/assets/images/stockBackground/1.jpg deleted file mode 100755 index 5981dcf28..000000000 Binary files a/app/assets/images/stockBackground/1.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/10.jpg b/app/assets/images/stockBackground/10.jpg deleted file mode 100755 index 3b1faa7f3..000000000 Binary files a/app/assets/images/stockBackground/10.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/11.jpg b/app/assets/images/stockBackground/11.jpg deleted file mode 100755 index 88ab7bdfb..000000000 Binary files a/app/assets/images/stockBackground/11.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/12.jpg b/app/assets/images/stockBackground/12.jpg deleted file mode 100755 index e93851317..000000000 Binary files a/app/assets/images/stockBackground/12.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/2.jpg b/app/assets/images/stockBackground/2.jpg deleted file mode 100755 index 9fed12fc8..000000000 Binary files a/app/assets/images/stockBackground/2.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/3.jpg b/app/assets/images/stockBackground/3.jpg deleted file mode 100755 index 7a2cf18aa..000000000 Binary files a/app/assets/images/stockBackground/3.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/4.jpg b/app/assets/images/stockBackground/4.jpg deleted file mode 100755 index c2bfc14e7..000000000 Binary files a/app/assets/images/stockBackground/4.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/5.jpg b/app/assets/images/stockBackground/5.jpg deleted file mode 100755 index 0db9de938..000000000 Binary files a/app/assets/images/stockBackground/5.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/6.jpg b/app/assets/images/stockBackground/6.jpg deleted file mode 100755 index 867ad0f94..000000000 Binary files a/app/assets/images/stockBackground/6.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/7.jpg b/app/assets/images/stockBackground/7.jpg deleted file mode 100755 index 370313a28..000000000 Binary files a/app/assets/images/stockBackground/7.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/8.jpg b/app/assets/images/stockBackground/8.jpg deleted file mode 100755 index 919fabf47..000000000 Binary files a/app/assets/images/stockBackground/8.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/9.jpg b/app/assets/images/stockBackground/9.jpg deleted file mode 100755 index 3bba544eb..000000000 Binary files a/app/assets/images/stockBackground/9.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/thumb/1.jpg b/app/assets/images/stockBackground/thumb/1.jpg deleted file mode 100755 index 38b235866..000000000 Binary files a/app/assets/images/stockBackground/thumb/1.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/thumb/10.jpg b/app/assets/images/stockBackground/thumb/10.jpg deleted file mode 100755 index 481bc866c..000000000 Binary files a/app/assets/images/stockBackground/thumb/10.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/thumb/11.jpg b/app/assets/images/stockBackground/thumb/11.jpg deleted file mode 100755 index ca304dede..000000000 Binary files a/app/assets/images/stockBackground/thumb/11.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/thumb/12.jpg b/app/assets/images/stockBackground/thumb/12.jpg deleted file mode 100755 index 83cd444ab..000000000 Binary files a/app/assets/images/stockBackground/thumb/12.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/thumb/2.jpg b/app/assets/images/stockBackground/thumb/2.jpg deleted file mode 100755 index 14254a1e9..000000000 Binary files a/app/assets/images/stockBackground/thumb/2.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/thumb/3.jpg b/app/assets/images/stockBackground/thumb/3.jpg deleted file mode 100755 index cc2047e68..000000000 Binary files a/app/assets/images/stockBackground/thumb/3.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/thumb/4.jpg b/app/assets/images/stockBackground/thumb/4.jpg deleted file mode 100755 index 2fbe5929e..000000000 Binary files a/app/assets/images/stockBackground/thumb/4.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/thumb/5.jpg b/app/assets/images/stockBackground/thumb/5.jpg deleted file mode 100755 index d93957379..000000000 Binary files a/app/assets/images/stockBackground/thumb/5.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/thumb/6.jpg b/app/assets/images/stockBackground/thumb/6.jpg deleted file mode 100755 index 9661a8c7e..000000000 Binary files a/app/assets/images/stockBackground/thumb/6.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/thumb/7.jpg b/app/assets/images/stockBackground/thumb/7.jpg deleted file mode 100755 index 697ae27a1..000000000 Binary files a/app/assets/images/stockBackground/thumb/7.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/thumb/8.jpg b/app/assets/images/stockBackground/thumb/8.jpg deleted file mode 100755 index 25a479799..000000000 Binary files a/app/assets/images/stockBackground/thumb/8.jpg and /dev/null differ diff --git a/app/assets/images/stockBackground/thumb/9.jpg b/app/assets/images/stockBackground/thumb/9.jpg deleted file mode 100755 index e7dd60e0d..000000000 Binary files a/app/assets/images/stockBackground/thumb/9.jpg and /dev/null differ diff --git a/app/assets/javascripts/desktop/orbitdesktop.js b/app/assets/javascripts/desktop/orbitdesktop.js index fc9453904..09512bef2 100755 --- a/app/assets/javascripts/desktop/orbitdesktop.js +++ b/app/assets/javascripts/desktop/orbitdesktop.js @@ -1,5 +1,5 @@ // JavaScript Document -//harry +//harry bomrah //Inititialize function will initialize desktop //callback-method will be called after desktop controlled ajax call @@ -16,6 +16,11 @@ //"pagination-link" = "url" this url will be used for pagination.. this will override last link url. //"pagination-var" = "variable to send paramater with url for pagination" this will enable pagination with this attribute for that view. + +//for forms +//form-type = "ajax_form" will turn form to ajax submit +//notification = string will display after the form is succesfully submitted + //for layout tinyscrollbar //content-layout="datalist|column|simple" datalist is for data list from database.. column is usually for forms and some other pages.. simple is without any columns, the page will be displayed as it is.. base width will be considered the default width for tinyscrollbar //base-width="300" this is the basic width of each column and in case of simple layout it ll be the final width @@ -241,20 +246,24 @@ var orbitDesktop = function(dom){ },'*[content-type=menu] a'); $("body").on("submit","form[form-type=ajax_form]",function(){ - var callback_method = $(this).attr("callback-method"); - var dt = null; + var callback_method = $(this).attr("callback-method"), + dt = null, + notification = $(this).attr("notification"); dt = $(this).attr("response-type"); if(dt == null){ dt = "json"; } var options = { dataType : dt, + resetForm : true, success:function(responseText, statusText, xhr, $form){ if(typeof callback_method != "undefined"){ if(callback_method != ""){ window.o[o.data_method][callback_method](responseText,statusText,xhr,$form); } } + if(notification != "") + o.notify(notification,"success"); }, error:function(){ o.notify("Please try again later!","imp"); @@ -1242,8 +1251,8 @@ var orbitDesktop = function(dom){ }); $(".stock_wallpaper .ssl_item").click(function(){ - var wallpapername = $(this).find("img").attr("alt"); - o.changeWallpaper(wallpapername); + var wallpaper = $(this).find("img").data("link"); + o.changeWallpaper(wallpaper); }) } var loadthmc = function(){ // a general function to load the themecolor in color selector @@ -1516,7 +1525,7 @@ var orbitDesktop = function(dom){ if(!wallpaper){ $("#thmbackground").attr("src",o.themesettings.background); } else { - $("#thmbackground").attr("src",o.wallpaperPath+wallpaper); + $("#thmbackground").attr("src",wallpaper); } }; diff --git a/app/assets/javascripts/desktop/orbitdesktopAPI.js b/app/assets/javascripts/desktop/orbitdesktopAPI.js index 4480555b7..47b72d4ba 100644 --- a/app/assets/javascripts/desktop/orbitdesktopAPI.js +++ b/app/assets/javascripts/desktop/orbitdesktopAPI.js @@ -72,7 +72,7 @@ var orbitDesktopAPI = function(){ this.changeWallpaper = function(wallpaper){ //takes 1 parameter //wallpaper (string): takes wallpaper and sets the wallpaper - $("#thmbackground").attr("src",o.wallpaperPath+wallpaper); + $("#thmbackground").attr("src",wallpaper); o.saveWallpaper(wallpaper); }; this.confirm = function(settings,callbackfn){ diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index fc9453904..c94523c60 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -1,5 +1,5 @@ // JavaScript Document -//harry +//harry bomrah //Inititialize function will initialize desktop //callback-method will be called after desktop controlled ajax call diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb index b21db61ad..6c323d543 100644 --- a/app/controllers/desktop_controller.rb +++ b/app/controllers/desktop_controller.rb @@ -32,8 +32,9 @@ class DesktopController< ApplicationController end def get_themes + desktop = current_user.desktop @themes = DesktopTheme.all - # raise @themes.inspect + @wallpapers = desktop.desktop_wallpapers.all render "desktop/settings/themes", :layout => false end @@ -45,6 +46,23 @@ class DesktopController< ApplicationController @url = "http://fb.tp.rulingcom.com/login?callback=http://harry.tp.rulingcom.com/facebook/register_fb?user="+current_user.id.to_s render "desktop/settings/connections", :layout => false end + + def wallpaper_upload + desktop = current_user.desktop + wallpaper = desktop.desktop_wallpapers.new + + if params[:imagelink] != "" + wallpaper.type = "url" + wallpaper.link = params[:imagelink] + wallpaper.save! + elsif params[:imagefile] + wallpaper.file = params[:imagefile] + wallpaper.type = "file" + wallpaper.save! + end + + render :json=>{"success"=>true}.to_json + end #ajax data load.... diff --git a/app/controllers/facebook_controller.rb b/app/controllers/facebook_controller.rb index c79ed811d..b0f67b2ad 100644 --- a/app/controllers/facebook_controller.rb +++ b/app/controllers/facebook_controller.rb @@ -11,21 +11,36 @@ class FacebookController< ApplicationController user.save! end render :json=>{"success"=>true,"user"=>user.facebook.fb_identifier}.to_json + # respond_to do |format| + # format.js + # end end def get_friends - @url = "http://fb.tp.rulingcom.com/get_friends?identifier=" + current_user.facebook.fb_identifier - uri = URI.parse(@url) - http = Net::HTTP.new(uri.host, uri.port) - request = Net::HTTP::Get.new(uri.request_uri) - response = http.request(request) - friends = response.body - friends = JSON.parse(friends) - output = Array.new - friends.each do |friend| - output << friend['name'] - end - render :json=>{"count"=>friends.count,"friends"=>output}.to_json + if current_user.facebook + @url = "http://fb.tp.rulingcom.com/get_friends?identifier=" + current_user.facebook.fb_identifier + uri = URI.parse(@url) + http = Net::HTTP.new(uri.host, uri.port) + request = Net::HTTP::Get.new(uri.request_uri) + response = http.request(request) + friends = response.body + friends = JSON.parse(friends) + output = Array.new + friends.each do |friend| + output << {"name"=>friend['name'],"identifier"=>friend['identifier']} + end + render :json=>{"success"=>true,"count"=>friends.count,"friends"=>output}.to_json + else + render :json=>{"success"=>false,"message"=>"User is not connected to facebook."}.to_json + end + end + + def disconnect + user_fb = current_user.facebook + if user_fb + user_fb.destroy + end + render :json=>{"success"=>true}.to_json end end \ No newline at end of file diff --git a/app/models/desktop/desktop.rb b/app/models/desktop/desktop.rb index 123da2f0d..68692bc27 100644 --- a/app/models/desktop/desktop.rb +++ b/app/models/desktop/desktop.rb @@ -10,6 +10,7 @@ class Desktop has_and_belongs_to_many :desktop_widgets, :autosave => true has_many :sections, :autosave => true, :dependent => :destroy + has_many :desktop_wallpapers, :autosave => true, :dependent => :destroy # has_many :desktop_widgets, :autosave => true, :dependent => :destroy before_create :initialize_section diff --git a/app/models/desktop/desktop_wallpaper.rb b/app/models/desktop/desktop_wallpaper.rb new file mode 100644 index 000000000..cb85eaf95 --- /dev/null +++ b/app/models/desktop/desktop_wallpaper.rb @@ -0,0 +1,11 @@ +class DesktopWallpaper + include Mongoid::Document + include Mongoid::Timestamps + mount_uploader :file, ImageUploader + + field :type + field :link + + belongs_to :desktop + +end \ No newline at end of file diff --git a/app/views/desktop/settings/connections.html.erb b/app/views/desktop/settings/connections.html.erb index 0dff34418..1539718ba 100644 --- a/app/views/desktop/settings/connections.html.erb +++ b/app/views/desktop/settings/connections.html.erb @@ -3,6 +3,7 @@ Connect FaceBook Get Friends + Disconnect from facebook
+
+
+ + Or + + + +
+
+ diff --git a/app/views/js/register_fb.js.erb b/app/views/js/register_fb.js.erb new file mode 100644 index 000000000..705dff92f --- /dev/null +++ b/app/views/js/register_fb.js.erb @@ -0,0 +1 @@ +window.close(); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index f886b0843..81ab2d26a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -301,8 +301,9 @@ Orbit::Application.routes.draw do match "/facebook/register_fb" => "facebook#register_fb" match "/facebook/get_friends" => "facebook#get_friends" - + match "/facebook/disconnect" => "facebook#disconnect" + match "/desktop/wallpaper_upload" => "desktop#wallpaper_upload" #match '/desktop_orbit/eventajaxload' => 'desktop_publications#create_journal' #match '/desktop_orbit/eventajaxload' => 'desktop_publications#delete_journal'