| 
									
										
										
										
											2012-03-28 10:53:30 +00:00
										 |  |  | class DesktopController< ApplicationController | 
					
						
							|  |  |  |   layout 'desktop' | 
					
						
							| 
									
										
										
										
											2012-04-03 10:25:41 +00:00
										 |  |  |   before_filter :authenticate_user! | 
					
						
							| 
									
										
										
										
											2013-09-06 08:41:02 +00:00
										 |  |  |   before_filter :check_desktop_open, :only => [:index,:show] | 
					
						
							| 
									
										
										
										
											2012-04-26 06:47:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-12 06:44:08 +00:00
										 |  |  |   #to load pages... | 
					
						
							| 
									
										
										
										
											2013-09-06 08:41:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   # caches_page :index | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-28 10:53:30 +00:00
										 |  |  |   def index | 
					
						
							| 
									
										
										
										
											2012-04-05 12:32:56 +00:00
										 |  |  |     @desktop = current_user.desktop | 
					
						
							| 
									
										
										
										
											2012-04-19 12:26:21 +00:00
										 |  |  |     @currentusername = current_user.name | 
					
						
							| 
									
										
										
										
											2013-09-25 10:11:02 +00:00
										 |  |  |     @currentname = current_user.first_name + current_user.last_name | 
					
						
							| 
									
										
										
										
											2012-04-19 12:26:21 +00:00
										 |  |  |     @title = "Desktop - " + @currentusername | 
					
						
							| 
									
										
										
										
											2012-04-11 07:31:10 +00:00
										 |  |  |     @section = @desktop.sections.first | 
					
						
							| 
									
										
										
										
											2012-03-28 10:53:30 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2013-03-12 07:23:38 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def compatibility | 
					
						
							|  |  |  |     render :layout => "compatibility"  | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-03-29 07:23:48 +00:00
										 |  |  |    | 
					
						
							|  |  |  |   def desktop | 
					
						
							|  |  |  |     render :layout => false | 
					
						
							| 
									
										
										
										
											2012-03-29 11:50:23 +00:00
										 |  |  |   end | 
					
						
							|  |  |  |    | 
					
						
							|  |  |  |   def app_manager | 
					
						
							|  |  |  |      render :layout => false | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  |    | 
					
						
							| 
									
										
										
										
											2012-12-07 02:10:38 +00:00
										 |  |  |   def allsections | 
					
						
							| 
									
										
										
										
											2012-03-29 11:50:23 +00:00
										 |  |  |     render :layout => false | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-04-26 06:47:49 +00:00
										 |  |  |    | 
					
						
							| 
									
										
										
										
											2012-04-12 06:44:08 +00:00
										 |  |  |   def settings | 
					
						
							|  |  |  |     render :layout => false | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  |    | 
					
						
							| 
									
										
										
										
											2013-07-25 09:18:24 +00:00
										 |  |  |   def get_themes | 
					
						
							| 
									
										
										
										
											2013-08-01 13:50:49 +00:00
										 |  |  |     desktop = current_user.desktop | 
					
						
							| 
									
										
										
										
											2012-04-23 13:04:02 +00:00
										 |  |  |     @themes = DesktopTheme.all | 
					
						
							| 
									
										
										
										
											2013-08-01 13:50:49 +00:00
										 |  |  |     @wallpapers = desktop.desktop_wallpapers.all | 
					
						
							| 
									
										
										
										
											2012-04-12 06:44:08 +00:00
										 |  |  |     render "desktop/settings/themes", :layout => false | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  |    | 
					
						
							| 
									
										
										
										
											2012-11-08 09:01:59 +00:00
										 |  |  |   def sections | 
					
						
							| 
									
										
										
										
											2012-04-12 06:44:08 +00:00
										 |  |  |     render "desktop/settings/sections", :layout => false | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  |    | 
					
						
							| 
									
										
										
										
											2012-11-08 09:01:59 +00:00
										 |  |  |   def connections | 
					
						
							| 
									
										
										
										
											2013-06-14 08:08:30 +00:00
										 |  |  |     @url = "http://fb.tp.rulingcom.com/login?callback=http://harry.tp.rulingcom.com/facebook/register_fb?user="+current_user.id.to_s | 
					
						
							| 
									
										
										
										
											2012-04-26 13:30:13 +00:00
										 |  |  |     render "desktop/settings/connections", :layout => false | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2013-08-01 13:50:49 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   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 | 
					
						
							| 
									
										
										
										
											2012-04-26 13:30:13 +00:00
										 |  |  |    | 
					
						
							| 
									
										
										
										
											2012-05-03 13:30:12 +00:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2012-04-12 06:44:08 +00:00
										 |  |  |   #ajax data load.... | 
					
						
							| 
									
										
										
										
											2012-04-05 12:09:01 +00:00
										 |  |  |    | 
					
						
							| 
									
										
										
										
											2012-04-05 12:32:56 +00:00
										 |  |  |   def save_desktop_settings | 
					
						
							| 
									
										
										
										
											2012-04-12 14:18:58 +00:00
										 |  |  |     @desktop = Desktop.find(params["desktopid"]) | 
					
						
							|  |  |  |     @savewhat = params["save"] | 
					
						
							|  |  |  |     case @savewhat | 
					
						
							|  |  |  |     when "theme" | 
					
						
							|  |  |  |       @desktop.update_attributes(:theme => params["theme"]) | 
					
						
							| 
									
										
										
										
											2012-04-18 14:01:12 +00:00
										 |  |  |       @desktop.update_attributes(:wallpaper => nil) | 
					
						
							| 
									
										
										
										
											2012-04-12 14:18:58 +00:00
										 |  |  |     when "desktopnames" | 
					
						
							|  |  |  |       @sections = @desktop.sections | 
					
						
							|  |  |  |       x = 0; | 
					
						
							|  |  |  |       @sections.each do |section| | 
					
						
							|  |  |  |         @desktopnewnames = params["desktopnms"] | 
					
						
							|  |  |  |         section.update_attributes(:name => @desktopnewnames[x] ) | 
					
						
							|  |  |  |         x = x+1
 | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2012-04-17 08:33:41 +00:00
										 |  |  |     when "appnewsection" | 
					
						
							|  |  |  |       @section = Section.find(params["newsectionid"]) | 
					
						
							|  |  |  |       @groups = @section.groups | 
					
						
							|  |  |  |       @app = Tile.find(params["appid"]) | 
					
						
							|  |  |  |       @groups.each do |group| | 
					
						
							|  |  |  |         @tiles = group.tiles.where(:data_category.all => ["app"]) | 
					
						
							|  |  |  |         if @tiles.length < 12
 | 
					
						
							|  |  |  |           @app.update_attributes(:group_id => group.id) | 
					
						
							|  |  |  |           break | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2012-04-17 13:15:40 +00:00
										 |  |  |       when "customtheme" | 
					
						
							|  |  |  |         @desktop.update_attributes(:theme => "custom") | 
					
						
							|  |  |  |         @desktop.update_attributes(:customtheme => params['theme']) | 
					
						
							| 
									
										
										
										
											2012-04-18 14:01:12 +00:00
										 |  |  |       when "wallpaper" | 
					
						
							|  |  |  |         @desktop.update_attributes(:wallpaper => params["wallpapernm"]) | 
					
						
							| 
									
										
										
										
											2012-04-17 13:15:40 +00:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2012-04-05 12:32:56 +00:00
										 |  |  |      a = Array.new | 
					
						
							|  |  |  |      a << {"success"=>"true"} | 
					
						
							|  |  |  |      render :json=>a.to_json | 
					
						
							| 
									
										
										
										
											2012-04-03 10:25:41 +00:00
										 |  |  |   end | 
					
						
							|  |  |  |    | 
					
						
							| 
									
										
										
										
											2012-04-05 12:32:56 +00:00
										 |  |  |   def get_desktop_settings | 
					
						
							| 
									
										
										
										
											2012-04-12 14:18:58 +00:00
										 |  |  |      @desktop = Desktop.find(params["desktopid"]) | 
					
						
							|  |  |  |      @getwhat = params["get"] | 
					
						
							|  |  |  |      case @getwhat | 
					
						
							|  |  |  |       when "desktop" | 
					
						
							|  |  |  |         render :json => @desktop.to_json | 
					
						
							|  |  |  |       when "sectionnames" | 
					
						
							|  |  |  |         secnames = Array.new | 
					
						
							|  |  |  |         @sections = @desktop.sections | 
					
						
							|  |  |  |         @sections.each do |section| | 
					
						
							|  |  |  |           secnames << section.name | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  |         render :json => secnames.to_json | 
					
						
							|  |  |  |       when "theme" | 
					
						
							|  |  |  |         @theme = @desktop.theme | 
					
						
							|  |  |  |         render :json => @theme.to_json | 
					
						
							|  |  |  |      end | 
					
						
							| 
									
										
										
										
											2012-04-03 10:25:41 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-04-11 09:26:25 +00:00
										 |  |  |    | 
					
						
							| 
									
										
										
										
											2012-04-11 07:31:10 +00:00
										 |  |  |   def getgroups | 
					
						
							|  |  |  |     @section = Section.find(params["sectionid"]) | 
					
						
							|  |  |  |     @groups = @section.groups | 
					
						
							| 
									
										
										
										
											2012-11-05 15:04:54 +00:00
										 |  |  |     gr = Array.new | 
					
						
							| 
									
										
										
										
											2012-04-11 07:31:10 +00:00
										 |  |  |     @groups.each do |group| | 
					
						
							| 
									
										
										
										
											2012-11-05 15:04:54 +00:00
										 |  |  |       a = Array.new | 
					
						
							| 
									
										
										
										
											2013-06-24 11:19:58 +00:00
										 |  |  |       @t = group.tiles | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       @t.each do |tile| | 
					
						
							| 
									
										
										
										
											2012-11-05 15:04:54 +00:00
										 |  |  |         data_content = "" | 
					
						
							|  |  |  |         jsfile = [] | 
					
						
							|  |  |  |         cssfile = "" | 
					
						
							|  |  |  |         shape = "w1 h1" | 
					
						
							| 
									
										
										
										
											2013-03-25 10:44:06 +00:00
										 |  |  |         link = "" | 
					
						
							| 
									
										
										
										
											2013-05-14 09:18:05 +00:00
										 |  |  |         icon= "" | 
					
						
							| 
									
										
										
										
											2013-05-02 08:45:33 +00:00
										 |  |  |         fullsize = false | 
					
						
							| 
									
										
										
										
											2012-11-05 15:04:54 +00:00
										 |  |  |         if tile.data_category == "widget" | 
					
						
							|  |  |  |           widge = DesktopWidget.find(tile.desktop_widget_id.to_s) | 
					
						
							|  |  |  |           # data_content = widge.widget_layout.file | 
					
						
							| 
									
										
										
										
											2012-11-08 09:01:59 +00:00
										 |  |  |           data_content = "/desktop/widget_layout?id="+tile.desktop_widget_id.to_s | 
					
						
							| 
									
										
										
										
											2013-01-08 03:01:23 +00:00
										 |  |  |           jsfile = widge.javascripts.collect{|js| js.file.as_json[:file]} | 
					
						
							|  |  |  |           cssfile = widge.css_default.file.as_json[:file] | 
					
						
							| 
									
										
										
										
											2012-11-05 15:04:54 +00:00
										 |  |  |           shape = widge.shape | 
					
						
							|  |  |  |           title = widge.name | 
					
						
							| 
									
										
										
										
											2013-05-14 09:18:05 +00:00
										 |  |  |           icon = widge.images.where(:name => widge.icon).first.file.url | 
					
						
							| 
									
										
										
										
											2013-03-25 10:44:06 +00:00
										 |  |  |           # binding.pry | 
					
						
							| 
									
										
										
										
											2013-05-02 08:45:33 +00:00
										 |  |  |           fullsize = widge.fullsize | 
					
						
							| 
									
										
										
										
											2012-11-05 15:04:54 +00:00
										 |  |  |         else | 
					
						
							| 
									
										
										
										
											2013-05-14 09:18:05 +00:00
										 |  |  |           app = DesktopApp.find(tile.desktop_app_id.to_s) | 
					
						
							|  |  |  |           title = app.name | 
					
						
							|  |  |  |           link = app.url | 
					
						
							|  |  |  |           icon = app.images.where(:name => app.icon).first.file.url | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-05 15:04:54 +00:00
										 |  |  |         end | 
					
						
							| 
									
										
										
										
											2013-05-14 09:18:05 +00:00
										 |  |  |           gr << {"id"=>tile.id,"data_category"=>tile.data_category,"data_content"=>data_content,"js"=>jsfile,"css"=>cssfile,"shape"=>shape,"position"=>tile.position,"row"=>tile.row,"column"=>tile.column, "title"=>title,"fullsize"=>fullsize,"link"=>link,"icon"=>icon} | 
					
						
							| 
									
										
										
										
											2013-04-01 10:00:47 +00:00
										 |  |  |         | 
					
						
							|  |  |  |          | 
					
						
							| 
									
										
										
										
											2012-11-05 15:04:54 +00:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2013-02-23 07:23:24 +00:00
										 |  |  |       # gr << a | 
					
						
							| 
									
										
										
										
											2012-04-11 07:31:10 +00:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-11-05 15:04:54 +00:00
										 |  |  |     render :json =>gr.to_json | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def widget_layout | 
					
						
							|  |  |  |     widget = DesktopWidget.find(params[:id]) | 
					
						
							| 
									
										
										
										
											2013-06-14 08:08:30 +00:00
										 |  |  |      # link = '<link href="'+widget.css_default.file.to_s+'" media="screen" rel="stylesheet" type="text/css" />' | 
					
						
							|  |  |  |     css = widget.css_default.content; | 
					
						
							|  |  |  |     css = "<style>" + css + "</style>" | 
					
						
							| 
									
										
										
										
											2012-11-05 15:04:54 +00:00
										 |  |  |     content = widget.widget_layout.body | 
					
						
							| 
									
										
										
										
											2013-06-14 08:08:30 +00:00
										 |  |  |     dhtml = css + content | 
					
						
							| 
									
										
										
										
											2012-11-05 15:04:54 +00:00
										 |  |  |     render :text => dhtml.html_safe | 
					
						
							| 
									
										
										
										
											2012-04-11 07:31:10 +00:00
										 |  |  |   end | 
					
						
							|  |  |  |    | 
					
						
							|  |  |  |   def getsectionlist | 
					
						
							|  |  |  |     @desktop = Desktop.find(params["desktopid"]) | 
					
						
							|  |  |  |     @sections = @desktop.sections | 
					
						
							|  |  |  |     render :json => @sections.to_json  | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  |    | 
					
						
							|  |  |  |   def temp_func | 
					
						
							|  |  |  |      @section = Section.find(params["sectionid"]) | 
					
						
							|  |  |  |       @groups = @section.groups | 
					
						
							|  |  |  |        | 
					
						
							|  |  |  |       @groups.each do |group| | 
					
						
							|  |  |  |         a = 1; | 
					
						
							|  |  |  |         @tiles = group.tiles | 
					
						
							|  |  |  |         @tiles.each do |tile| | 
					
						
							|  |  |  |           tile.update_attributes({:data_category => "widget",:data_content => "temp", :position => a}) | 
					
						
							|  |  |  |           a = a+1; | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |       b = Array.new | 
					
						
							|  |  |  |        b << {"success"=>"true"} | 
					
						
							|  |  |  |        render :json=>b.to_json | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-04-12 06:44:08 +00:00
										 |  |  |    | 
					
						
							|  |  |  |   def getapplist | 
					
						
							|  |  |  |      @desktop = Desktop.find(params["desktopid"]) | 
					
						
							|  |  |  |      @sections = @desktop.sections | 
					
						
							|  |  |  |      a = Array.new | 
					
						
							|  |  |  |      @sections.each do |section| | 
					
						
							|  |  |  |        @groups = section.groups | 
					
						
							|  |  |  |        @groups.each do |group| | 
					
						
							|  |  |  |          @tiles = group.tiles.where(:data_category.all => ["app"]) | 
					
						
							|  |  |  |          a << @tiles | 
					
						
							|  |  |  |        end | 
					
						
							|  |  |  |      end | 
					
						
							|  |  |  |      render :json=>a.to_json | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2013-05-02 08:45:33 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    def getapplistforManager | 
					
						
							|  |  |  |     @dwss = DesktopWidget.all | 
					
						
							| 
									
										
										
										
											2013-05-14 09:18:05 +00:00
										 |  |  |     @dapps = DesktopApp.all | 
					
						
							| 
									
										
										
										
											2013-05-02 08:45:33 +00:00
										 |  |  |     @tiles = Array.new | 
					
						
							|  |  |  |     desktop = Desktop.find(params['desktopid']) | 
					
						
							|  |  |  |     sections = desktop.sections | 
					
						
							|  |  |  |     sections.each do |section| | 
					
						
							|  |  |  |       groups = section.groups | 
					
						
							|  |  |  |       groups.each do |group| | 
					
						
							|  |  |  |         @tiles += group.tiles | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |     @validtiles = Array.new | 
					
						
							|  |  |  |     @allWidgets = Array.new | 
					
						
							|  |  |  |     @dwss.each do |dw| | 
					
						
							|  |  |  |       @id = dw.id | 
					
						
							|  |  |  |       @validtiles = @tiles.select{|t| t.desktop_widget_id == @id} | 
					
						
							|  |  |  |       @sections = Array.new | 
					
						
							|  |  |  |       @validtiles.each do |vt| | 
					
						
							|  |  |  |         grp = Group.find(vt.group_id) | 
					
						
							|  |  |  |         sec = Section.find(grp.section_id); | 
					
						
							|  |  |  |         @sections << {"id"=>sec.id,"name"=>sec.name} | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2013-05-13 09:13:44 +00:00
										 |  |  |       @allWidgets << {"id"=>dw.id, "data_category"=> "widget","title" => dw.name, "version" => dw.version, "author"=>dw.author, "last_update"=>dw.updated_at, "icon"=>dw.images.where(:name=>dw.icon).first.file.url, "text_color" => dw.text_color, "background" => dw.bg_color, "sections" => @sections} | 
					
						
							| 
									
										
										
										
											2013-05-02 08:45:33 +00:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2013-05-14 09:18:05 +00:00
										 |  |  |     validtiles = Array.new | 
					
						
							|  |  |  |     @dapps.each do |da| | 
					
						
							|  |  |  |       @id = da.id | 
					
						
							|  |  |  |       @validtiles = @tiles.select{|t| t.desktop_app_id == @id} | 
					
						
							|  |  |  |       @sections = Array.new | 
					
						
							|  |  |  |       @validtiles.each do |vt| | 
					
						
							|  |  |  |         grp = Group.find(vt.group_id) | 
					
						
							|  |  |  |         sec = Section.find(grp.section_id); | 
					
						
							|  |  |  |         @sections << {"id"=>sec.id,"name"=>sec.name} | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |       @allWidgets << {"id"=>da.id, "data_category"=> "app","title" => da.name, "version" => da.version, "author"=>da.author, "last_update"=>da.updated_at, "icon"=>da.images.where(:name=>da.icon).first.file.url, "sections" => @sections} | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2013-05-02 08:45:33 +00:00
										 |  |  |     render :json=>@allWidgets.to_json | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-04-17 08:33:41 +00:00
										 |  |  |    | 
					
						
							|  |  |  |   def newpositions | 
					
						
							| 
									
										
										
										
											2013-04-01 10:00:47 +00:00
										 |  |  |     @newpositions = params[:newpositions] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @newpositions.each do |t| | 
					
						
							|  |  |  |       @this_tile = t.last | 
					
						
							|  |  |  |       @tile = Tile.find(@this_tile['id']) | 
					
						
							|  |  |  |       @tile.update_attributes({:row => @this_tile['row'],:column => @this_tile['col']}) | 
					
						
							| 
									
										
										
										
											2012-04-17 08:33:41 +00:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2013-04-01 10:00:47 +00:00
										 |  |  |     # @newpositions = params["newpos"] | 
					
						
							|  |  |  |     # @section = Section.find(params["sectionid"]) | 
					
						
							|  |  |  |     # @groupids = params["groupids"] | 
					
						
							|  |  |  |     # @groups = @section.groups | 
					
						
							|  |  |  |     #  z = 0 | 
					
						
							|  |  |  |     # @newpositions.each do |grp| | 
					
						
							|  |  |  |     #   x = 1 | 
					
						
							|  |  |  |     #   grp.each do |tileid| | 
					
						
							|  |  |  |     #     if x != 1 | 
					
						
							|  |  |  |     #       y = 1 | 
					
						
							|  |  |  |     #       tileid.each do |id| | 
					
						
							|  |  |  |     #         @tile = Tile.find(id) | 
					
						
							|  |  |  |     #         @tile.update_attributes({:position => y}) | 
					
						
							|  |  |  |     #         if @tile.group_id != @groupids[z] | 
					
						
							|  |  |  |     #           @tile.update_attributes({:group_id => @groupids[z]}) | 
					
						
							|  |  |  |     #         end | 
					
						
							|  |  |  |     #          y = y + 1 | 
					
						
							|  |  |  |     #       end | 
					
						
							|  |  |  |     #       z = z + 1 | 
					
						
							|  |  |  |     #     end | 
					
						
							|  |  |  |     #     x = x + 1 | 
					
						
							|  |  |  |     #   end | 
					
						
							|  |  |  |     # end | 
					
						
							| 
									
										
										
										
											2012-04-17 08:33:41 +00:00
										 |  |  |     b = Array.new | 
					
						
							|  |  |  |     b << {"success"=>"true"} | 
					
						
							|  |  |  |     render :json=>b.to_json | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  |    | 
					
						
							| 
									
										
										
										
											2012-04-26 06:47:49 +00:00
										 |  |  |   def forgmail | 
					
						
							|  |  |  |     | 
					
						
							|  |  |  |     feed = Net::HTTP.get_response(URI.parse("https://mail.google.com/mail/feed/atom")).body | 
					
						
							|  |  |  |     render :xml=>feed | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2013-05-02 08:45:33 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def appactivation | 
					
						
							|  |  |  |     @group = Section.find(params[:section_id]).groups.first | 
					
						
							| 
									
										
										
										
											2013-05-14 09:18:05 +00:00
										 |  |  |     @type = params[:type] | 
					
						
							|  |  |  |     if @type == "widget" | 
					
						
							|  |  |  |       @widget = DesktopWidget.find(params[:id]) | 
					
						
							|  |  |  |       status = params[:status] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       case status | 
					
						
							|  |  |  |       when "true" | 
					
						
							|  |  |  |         tile = Tile.new(data_category: "widget", position: 8, desktop_widget_id: @widget.id) | 
					
						
							|  |  |  |         @group.tiles+=[tile] | 
					
						
							|  |  |  |         @group.save | 
					
						
							|  |  |  |       when "false" | 
					
						
							|  |  |  |         tile = @group.tiles.where("desktop_widget_id"=>@widget.id).first | 
					
						
							|  |  |  |         if tile != nil | 
					
						
							|  |  |  |           tile.destroy | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2013-05-02 08:45:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-14 09:18:05 +00:00
										 |  |  |     if @type == "app" | 
					
						
							|  |  |  |       @app = DesktopApp.find(params[:id]) | 
					
						
							|  |  |  |       status = params[:status] | 
					
						
							|  |  |  |       case status | 
					
						
							|  |  |  |       when "true" | 
					
						
							|  |  |  |         tile = Tile.new(data_category: "app", position: 8, desktop_app_id: @app.id) | 
					
						
							|  |  |  |         @group.tiles+=[tile] | 
					
						
							|  |  |  |         @group.save | 
					
						
							|  |  |  |       when "false" | 
					
						
							|  |  |  |         tile = @group.tiles.where("desktop_app_id"=>@app.id).first | 
					
						
							|  |  |  |         if tile != nil | 
					
						
							|  |  |  |           tile.destroy | 
					
						
							|  |  |  |         end | 
					
						
							| 
									
										
										
										
											2013-05-02 08:45:33 +00:00
										 |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     b = Array.new | 
					
						
							|  |  |  |     b = {"success"=>"true"} | 
					
						
							|  |  |  |     render :json=>b.to_json | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2013-09-06 08:41:02 +00:00
										 |  |  |   | 
					
						
							|  |  |  |   private | 
					
						
							| 
									
										
										
										
											2013-06-14 08:08:30 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-06 08:41:02 +00:00
										 |  |  |   def check_desktop_open | 
					
						
							|  |  |  |     if Me.desktop_closed && current_user.nil?  #Need to be change | 
					
						
							|  |  |  |       redirect_to '/admin/dashboards'   | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2013-06-14 08:08:30 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-26 06:47:49 +00:00
										 |  |  |    | 
					
						
							| 
									
										
										
										
											2013-01-08 03:01:23 +00:00
										 |  |  | end |