diff --git a/.gitignore b/.gitignore index b57fdb65..41292061 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ public/assets config/application.rb .rvmrc + +app/assets/javascripts/.DS_Store diff --git a/Gemfile b/Gemfile index 7e63e353..abf87c59 100644 --- a/Gemfile +++ b/Gemfile @@ -27,9 +27,12 @@ gem 'resque-restriction' gem 'ruby-debug19' gem 'rubyzip' gem 'sinatra' +#gem 'sinatra-contrib' gem 'sprockets' gem 'tinymce-rails' gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux") +gem 'mongoid-encryptor', :require => 'mongoid/encryptor' +#gem 'contacts' gem "impressionist", :require => "impressionist", :path => "vendor/impressionist" diff --git a/Gemfile.lock b/Gemfile.lock index f6bc8bfd..c96a64f0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -84,6 +84,7 @@ GEM orm_adapter (~> 0.0.3) warden (~> 1.1) diff-lcs (1.1.3) + encrypted_strings (0.3.3) erubis (2.7.0) exception_notification (2.5.2) actionmailer (>= 3.0.4) @@ -128,6 +129,10 @@ GEM tzinfo (~> 0.3.22) mongoid-tree (0.7.0) mongoid (~> 2.0) + mongoid-encryptor (0.0.5) + activesupport (~> 3.0) + encrypted_strings (~> 0.3.3) + mongoid (~> 2) multi_json (1.1.0) nokogiri (1.5.2) nokogiri (1.5.2-x86-mingw32) @@ -289,6 +294,7 @@ DEPENDENCIES mongo_session_store-rails3 mongoid mongoid-tree + mongoid-encryptor nokogiri radius rails (>= 3.1.0, < 3.2.0) diff --git a/app/assets/fonts/desktop/fontawesome-webfont.eot b/app/assets/fonts/desktop/fontawesome-webfont.eot new file mode 100755 index 00000000..3f669a7e Binary files /dev/null and b/app/assets/fonts/desktop/fontawesome-webfont.eot differ diff --git a/app/assets/fonts/desktop/fontawesome-webfont.svg b/app/assets/fonts/desktop/fontawesome-webfont.svg new file mode 100755 index 00000000..73c0ad9a --- /dev/null +++ b/app/assets/fonts/desktop/fontawesome-webfont.svg @@ -0,0 +1,175 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Designer : Dave Gandy +Foundry : Fort Awesome + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/assets/fonts/desktop/fontawesome-webfont.svgz b/app/assets/fonts/desktop/fontawesome-webfont.svgz new file mode 100755 index 00000000..2a73cd7c Binary files /dev/null and b/app/assets/fonts/desktop/fontawesome-webfont.svgz differ diff --git a/app/assets/fonts/desktop/fontawesome-webfont.ttf b/app/assets/fonts/desktop/fontawesome-webfont.ttf new file mode 100755 index 00000000..4972eb45 Binary files /dev/null and b/app/assets/fonts/desktop/fontawesome-webfont.ttf differ diff --git a/app/assets/fonts/desktop/fontawesome-webfont.woff b/app/assets/fonts/desktop/fontawesome-webfont.woff new file mode 100755 index 00000000..6e4cb41f Binary files /dev/null and b/app/assets/fonts/desktop/fontawesome-webfont.woff differ diff --git a/app/assets/images/connection/Thumbs.db b/app/assets/images/connection/Thumbs.db new file mode 100755 index 00000000..47897e3f Binary files /dev/null and b/app/assets/images/connection/Thumbs.db differ diff --git a/app/assets/images/connection/facebook.png b/app/assets/images/connection/facebook.png new file mode 100755 index 00000000..f8c4f219 Binary files /dev/null and b/app/assets/images/connection/facebook.png differ diff --git a/app/assets/images/connection/gmail.png b/app/assets/images/connection/gmail.png new file mode 100755 index 00000000..ec897f23 Binary files /dev/null and b/app/assets/images/connection/gmail.png differ diff --git a/app/assets/images/connection/twitter.png b/app/assets/images/connection/twitter.png new file mode 100755 index 00000000..a8071eea Binary files /dev/null and b/app/assets/images/connection/twitter.png differ diff --git a/app/assets/images/facebook.png b/app/assets/images/facebook.png new file mode 100644 index 00000000..3bfe4bac Binary files /dev/null and b/app/assets/images/facebook.png differ diff --git a/app/assets/images/gmail.png b/app/assets/images/gmail.png new file mode 100644 index 00000000..dd2d70a8 Binary files /dev/null and b/app/assets/images/gmail.png differ diff --git a/app/assets/images/icons/bookkeeper.png b/app/assets/images/icons/bookkeeper.png new file mode 100755 index 00000000..41b3bf26 Binary files /dev/null and b/app/assets/images/icons/bookkeeper.png differ diff --git a/app/assets/images/icons/calendar.png b/app/assets/images/icons/calendar.png new file mode 100755 index 00000000..a2f6ae71 Binary files /dev/null and b/app/assets/images/icons/calendar.png differ diff --git a/app/assets/images/icons/dailyenglish.png b/app/assets/images/icons/dailyenglish.png new file mode 100644 index 00000000..c820bd61 Binary files /dev/null and b/app/assets/images/icons/dailyenglish.png differ diff --git a/app/assets/images/icons/diary.png b/app/assets/images/icons/diary.png new file mode 100755 index 00000000..38bfa20c Binary files /dev/null and b/app/assets/images/icons/diary.png differ diff --git a/app/assets/images/icons/doc.png b/app/assets/images/icons/doc.png new file mode 100755 index 00000000..36cb273b Binary files /dev/null and b/app/assets/images/icons/doc.png differ diff --git a/app/assets/images/icons/facebook.png b/app/assets/images/icons/facebook.png new file mode 100755 index 00000000..03c3ddd5 Binary files /dev/null and b/app/assets/images/icons/facebook.png differ diff --git a/app/assets/images/icons/gmail.png b/app/assets/images/icons/gmail.png new file mode 100755 index 00000000..44ff25b7 Binary files /dev/null and b/app/assets/images/icons/gmail.png differ diff --git a/app/assets/images/icons/iclock.png b/app/assets/images/icons/iclock.png new file mode 100755 index 00000000..4200755e Binary files /dev/null and b/app/assets/images/icons/iclock.png differ diff --git a/app/assets/images/icons/movies.png b/app/assets/images/icons/movies.png new file mode 100755 index 00000000..6e75b450 Binary files /dev/null and b/app/assets/images/icons/movies.png differ diff --git a/app/assets/images/icons/musicbox.png b/app/assets/images/icons/musicbox.png new file mode 100755 index 00000000..6071215f Binary files /dev/null and b/app/assets/images/icons/musicbox.png differ diff --git a/app/assets/images/icons/newsfeed.png b/app/assets/images/icons/newsfeed.png new file mode 100755 index 00000000..cb20cd92 Binary files /dev/null and b/app/assets/images/icons/newsfeed.png differ diff --git a/app/assets/images/icons/quotes.png b/app/assets/images/icons/quotes.png new file mode 100644 index 00000000..d22866fd Binary files /dev/null and b/app/assets/images/icons/quotes.png differ diff --git a/app/assets/images/icons/talk.png b/app/assets/images/icons/talk.png new file mode 100755 index 00000000..6f498870 Binary files /dev/null and b/app/assets/images/icons/talk.png differ diff --git a/app/assets/images/icons/ted.png b/app/assets/images/icons/ted.png new file mode 100755 index 00000000..d9063ce0 Binary files /dev/null and b/app/assets/images/icons/ted.png differ diff --git a/app/assets/images/icons/weather.png b/app/assets/images/icons/weather.png new file mode 100755 index 00000000..d7033439 Binary files /dev/null and b/app/assets/images/icons/weather.png differ diff --git a/app/assets/images/icons/youtube.png b/app/assets/images/icons/youtube.png new file mode 100755 index 00000000..400ce4c1 Binary files /dev/null and b/app/assets/images/icons/youtube.png differ diff --git a/app/assets/images/linkedin.png b/app/assets/images/linkedin.png new file mode 100644 index 00000000..3c989802 Binary files /dev/null and b/app/assets/images/linkedin.png differ diff --git a/app/assets/images/miniColors/circle.gif b/app/assets/images/miniColors/circle.gif new file mode 100755 index 00000000..599f7f13 Binary files /dev/null and b/app/assets/images/miniColors/circle.gif differ diff --git a/app/assets/images/miniColors/gradient.png b/app/assets/images/miniColors/gradient.png new file mode 100755 index 00000000..561cdd9c Binary files /dev/null and b/app/assets/images/miniColors/gradient.png differ diff --git a/app/assets/images/miniColors/line.gif b/app/assets/images/miniColors/line.gif new file mode 100755 index 00000000..9eb19837 Binary files /dev/null and b/app/assets/images/miniColors/line.gif differ diff --git a/app/assets/images/miniColors/rainbow.png b/app/assets/images/miniColors/rainbow.png new file mode 100755 index 00000000..8d6c71bf Binary files /dev/null and b/app/assets/images/miniColors/rainbow.png differ diff --git a/app/assets/images/miniColors/trigger.png b/app/assets/images/miniColors/trigger.png new file mode 100755 index 00000000..8c169fd6 Binary files /dev/null and b/app/assets/images/miniColors/trigger.png differ diff --git a/app/assets/images/note_alert.png b/app/assets/images/note_alert.png new file mode 100644 index 00000000..6ebda48e Binary files /dev/null and b/app/assets/images/note_alert.png differ diff --git a/app/assets/images/note_imp.png b/app/assets/images/note_imp.png new file mode 100644 index 00000000..eb1306a9 Binary files /dev/null and b/app/assets/images/note_imp.png differ diff --git a/app/assets/images/note_success.png b/app/assets/images/note_success.png new file mode 100644 index 00000000..5d5ae2ad Binary files /dev/null and b/app/assets/images/note_success.png differ diff --git a/app/assets/images/sample_theme.jpg b/app/assets/images/sample_theme.jpg new file mode 100755 index 00000000..03945979 Binary files /dev/null and b/app/assets/images/sample_theme.jpg differ diff --git a/app/assets/images/stockBackground/1.jpg b/app/assets/images/stockBackground/1.jpg new file mode 100755 index 00000000..5981dcf2 Binary files /dev/null and b/app/assets/images/stockBackground/1.jpg differ diff --git a/app/assets/images/stockBackground/10.jpg b/app/assets/images/stockBackground/10.jpg new file mode 100755 index 00000000..3b1faa7f Binary files /dev/null and b/app/assets/images/stockBackground/10.jpg differ diff --git a/app/assets/images/stockBackground/11.jpg b/app/assets/images/stockBackground/11.jpg new file mode 100755 index 00000000..88ab7bdf Binary files /dev/null and b/app/assets/images/stockBackground/11.jpg differ diff --git a/app/assets/images/stockBackground/12.jpg b/app/assets/images/stockBackground/12.jpg new file mode 100755 index 00000000..e9385131 Binary files /dev/null and b/app/assets/images/stockBackground/12.jpg differ diff --git a/app/assets/images/stockBackground/2.jpg b/app/assets/images/stockBackground/2.jpg new file mode 100755 index 00000000..9fed12fc Binary files /dev/null and b/app/assets/images/stockBackground/2.jpg differ diff --git a/app/assets/images/stockBackground/3.jpg b/app/assets/images/stockBackground/3.jpg new file mode 100755 index 00000000..7a2cf18a Binary files /dev/null and b/app/assets/images/stockBackground/3.jpg differ diff --git a/app/assets/images/stockBackground/4.jpg b/app/assets/images/stockBackground/4.jpg new file mode 100755 index 00000000..c2bfc14e Binary files /dev/null and b/app/assets/images/stockBackground/4.jpg differ diff --git a/app/assets/images/stockBackground/5.jpg b/app/assets/images/stockBackground/5.jpg new file mode 100755 index 00000000..0db9de93 Binary files /dev/null and b/app/assets/images/stockBackground/5.jpg differ diff --git a/app/assets/images/stockBackground/6.jpg b/app/assets/images/stockBackground/6.jpg new file mode 100755 index 00000000..867ad0f9 Binary files /dev/null and b/app/assets/images/stockBackground/6.jpg differ diff --git a/app/assets/images/stockBackground/7.jpg b/app/assets/images/stockBackground/7.jpg new file mode 100755 index 00000000..370313a2 Binary files /dev/null and b/app/assets/images/stockBackground/7.jpg differ diff --git a/app/assets/images/stockBackground/8.jpg b/app/assets/images/stockBackground/8.jpg new file mode 100755 index 00000000..919fabf4 Binary files /dev/null and b/app/assets/images/stockBackground/8.jpg differ diff --git a/app/assets/images/stockBackground/9.jpg b/app/assets/images/stockBackground/9.jpg new file mode 100755 index 00000000..3bba544e Binary files /dev/null and b/app/assets/images/stockBackground/9.jpg differ diff --git a/app/assets/images/stockBackground/thumb/1.jpg b/app/assets/images/stockBackground/thumb/1.jpg new file mode 100755 index 00000000..38b23586 Binary files /dev/null and b/app/assets/images/stockBackground/thumb/1.jpg differ diff --git a/app/assets/images/stockBackground/thumb/10.jpg b/app/assets/images/stockBackground/thumb/10.jpg new file mode 100755 index 00000000..481bc866 Binary files /dev/null and b/app/assets/images/stockBackground/thumb/10.jpg differ diff --git a/app/assets/images/stockBackground/thumb/11.jpg b/app/assets/images/stockBackground/thumb/11.jpg new file mode 100755 index 00000000..ca304ded Binary files /dev/null and b/app/assets/images/stockBackground/thumb/11.jpg differ diff --git a/app/assets/images/stockBackground/thumb/12.jpg b/app/assets/images/stockBackground/thumb/12.jpg new file mode 100755 index 00000000..83cd444a Binary files /dev/null and b/app/assets/images/stockBackground/thumb/12.jpg differ diff --git a/app/assets/images/stockBackground/thumb/2.jpg b/app/assets/images/stockBackground/thumb/2.jpg new file mode 100755 index 00000000..14254a1e Binary files /dev/null and b/app/assets/images/stockBackground/thumb/2.jpg differ diff --git a/app/assets/images/stockBackground/thumb/3.jpg b/app/assets/images/stockBackground/thumb/3.jpg new file mode 100755 index 00000000..cc2047e6 Binary files /dev/null and b/app/assets/images/stockBackground/thumb/3.jpg differ diff --git a/app/assets/images/stockBackground/thumb/4.jpg b/app/assets/images/stockBackground/thumb/4.jpg new file mode 100755 index 00000000..2fbe5929 Binary files /dev/null and b/app/assets/images/stockBackground/thumb/4.jpg differ diff --git a/app/assets/images/stockBackground/thumb/5.jpg b/app/assets/images/stockBackground/thumb/5.jpg new file mode 100755 index 00000000..d9395737 Binary files /dev/null and b/app/assets/images/stockBackground/thumb/5.jpg differ diff --git a/app/assets/images/stockBackground/thumb/6.jpg b/app/assets/images/stockBackground/thumb/6.jpg new file mode 100755 index 00000000..9661a8c7 Binary files /dev/null and b/app/assets/images/stockBackground/thumb/6.jpg differ diff --git a/app/assets/images/stockBackground/thumb/7.jpg b/app/assets/images/stockBackground/thumb/7.jpg new file mode 100755 index 00000000..697ae27a Binary files /dev/null and b/app/assets/images/stockBackground/thumb/7.jpg differ diff --git a/app/assets/images/stockBackground/thumb/8.jpg b/app/assets/images/stockBackground/thumb/8.jpg new file mode 100755 index 00000000..25a47979 Binary files /dev/null and b/app/assets/images/stockBackground/thumb/8.jpg differ diff --git a/app/assets/images/stockBackground/thumb/9.jpg b/app/assets/images/stockBackground/thumb/9.jpg new file mode 100755 index 00000000..e7dd60e0 Binary files /dev/null and b/app/assets/images/stockBackground/thumb/9.jpg differ diff --git a/app/assets/images/twitter.png b/app/assets/images/twitter.png new file mode 100644 index 00000000..8b8fac07 Binary files /dev/null and b/app/assets/images/twitter.png differ diff --git a/app/assets/javascripts/.DS_Store b/app/assets/javascripts/.DS_Store deleted file mode 100644 index 9134f2a5..00000000 Binary files a/app/assets/javascripts/.DS_Store and /dev/null differ diff --git a/app/assets/javascripts/desktop.js b/app/assets/javascripts/desktop.js new file mode 100644 index 00000000..281a0b3d --- /dev/null +++ b/app/assets/javascripts/desktop.js @@ -0,0 +1,15 @@ +// This is a manifest file that'll be compiled into including all the files listed below. +// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically +// be included in the compiled file accessible from http://example.com/assets/application.js +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +//= require jquery +//= require jquery_ujs +//= require jquery-ui +//= require jquery.tinyscrollbar.min +//= require jquery.miniColors.min +//= require bootstrap +//= require orbitdesktopAPI +//= require orbitTimeline +//= require orbitdesktop \ No newline at end of file diff --git a/app/assets/javascripts/desktopload.js.erb b/app/assets/javascripts/desktopload.js.erb new file mode 100644 index 00000000..c4e9d1e7 --- /dev/null +++ b/app/assets/javascripts/desktopload.js.erb @@ -0,0 +1,6 @@ + +orbitDesktop.prototype.themefolder = "desktop_themes"; +orbitDesktopAPI.prototype.notifyImgPath = "/assets/"; +alert("<%= @desktop.inspect %>") +var od = new orbitDesktop("#ajax_container"); + diff --git a/app/assets/javascripts/jquery.miniColors.min.js b/app/assets/javascripts/jquery.miniColors.min.js new file mode 100755 index 00000000..25dcfa0e --- /dev/null +++ b/app/assets/javascripts/jquery.miniColors.min.js @@ -0,0 +1,9 @@ +/* + * jQuery miniColors: A small color selector + * + * Copyright 2011 Cory LaViska for A Beautiful Site, LLC. (http://abeautifulsite.net/) + * + * Dual licensed under the MIT or GPL Version 2 licenses + * +*/ +if(jQuery)(function($){$.extend($.fn,{miniColors:function(o,data){var create=function(input,o,data){var color=expandHex(input.val());if(!color)color='ffffff';var hsb=hex2hsb(color);var trigger=$('');trigger.insertAfter(input);input.addClass('miniColors').data('original-maxlength',input.attr('maxlength')||null).data('original-autocomplete',input.attr('autocomplete')||null).data('letterCase','uppercase').data('trigger',trigger).data('hsb',hsb).data('change',o.change?o.change:null).attr('maxlength',7).attr('autocomplete','off').val('#'+convertCase(color,o.letterCase));if(o.readonly)input.prop('readonly',true);if(o.disabled)disable(input);trigger.bind('click.miniColors',function(event){event.preventDefault();if(input.val()==='')input.val('#');show(input)});input.bind('focus.miniColors',function(event){if(input.val()==='')input.val('#');show(input)});input.bind('blur.miniColors',function(event){var hex=expandHex(input.val());input.val(hex?'#'+convertCase(hex,input.data('letterCase')):'')});input.bind('keydown.miniColors',function(event){if(event.keyCode===9)hide(input)});input.bind('keyup.miniColors',function(event){setColorFromInput(input)});input.bind('paste.miniColors',function(event){setTimeout(function(){setColorFromInput(input)},5)})};var destroy=function(input){hide();input=$(input);input.data('trigger').remove();input.attr('autocomplete',input.data('original-autocomplete')).attr('maxlength',input.data('original-maxlength')).removeData().removeClass('miniColors').unbind('.miniColors');$(document).unbind('.miniColors')};var enable=function(input){input.prop('disabled',false).data('trigger').css('opacity',1)};var disable=function(input){hide(input);input.prop('disabled',true).data('trigger').css('opacity',0.5)};var show=function(input){if(input.prop('disabled'))return false;hide();var selector=$('
');selector.append('
').append('
').css({top:input.is(':visible')?input.offset().top+input.outerHeight():input.data('trigger').offset().top+input.data('trigger').outerHeight(),left:input.is(':visible')?input.offset().left:input.data('trigger').offset().left,display:'none'}).addClass(input.attr('class'));var hsb=input.data('hsb');selector.find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100}));var colorPosition=input.data('colorPosition');if(!colorPosition)colorPosition=getColorPositionFromHSB(hsb);selector.find('.miniColors-colorPicker').css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');var huePosition=input.data('huePosition');if(!huePosition)huePosition=getHuePositionFromHSB(hsb);selector.find('.miniColors-huePicker').css('top',huePosition.y+'px');input.data('selector',selector).data('huePicker',selector.find('.miniColors-huePicker')).data('colorPicker',selector.find('.miniColors-colorPicker')).data('mousebutton',0);$('BODY').append(selector);selector.fadeIn(100);selector.bind('selectstart',function(){return false});$(document).bind('mousedown.miniColors touchstart.miniColors',function(event){input.data('mousebutton',1);if($(event.target).parents().andSelf().hasClass('miniColors-colors')){event.preventDefault();input.data('moving','colors');moveColor(input,event)}if($(event.target).parents().andSelf().hasClass('miniColors-hues')){event.preventDefault();input.data('moving','hues');moveHue(input,event)}if($(event.target).parents().andSelf().hasClass('miniColors-selector')){event.preventDefault();return}if($(event.target).parents().andSelf().hasClass('miniColors'))return;hide(input)});$(document).bind('mouseup.miniColors touchend.miniColors',function(event){event.preventDefault();input.data('mousebutton',0).removeData('moving')}).bind('mousemove.miniColors touchmove.miniColors',function(event){event.preventDefault();if(input.data('mousebutton')===1){if(input.data('moving')==='colors')moveColor(input,event);if(input.data('moving')==='hues')moveHue(input,event)}})};var hide=function(input){if(!input)input='.miniColors';$(input).each(function(){var selector=$(this).data('selector');$(this).removeData('selector');$(selector).fadeOut(100,function(){$(this).remove()})});$(document).unbind('.miniColors')};var moveColor=function(input,event){var colorPicker=input.data('colorPicker');colorPicker.hide();var position={x:event.pageX,y:event.pageY};if(event.originalEvent.changedTouches){position.x=event.originalEvent.changedTouches[0].pageX;position.y=event.originalEvent.changedTouches[0].pageY}position.x=position.x-input.data('selector').find('.miniColors-colors').offset().left-5;position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-5;if(position.x<=-5)position.x=-5;if(position.x>=144)position.x=144;if(position.y<=-5)position.y=-5;if(position.y>=144)position.y=144;input.data('colorPosition',position);colorPicker.css('left',position.x).css('top',position.y).show();var s=Math.round((position.x+5)*0.67);if(s<0)s=0;if(s>100)s=100;var b=100-Math.round((position.y+5)*0.67);if(b<0)b=0;if(b>100)b=100;var hsb=input.data('hsb');hsb.s=s;hsb.b=b;setColor(input,hsb,true)};var moveHue=function(input,event){var huePicker=input.data('huePicker');huePicker.hide();var position={y:event.pageY};if(event.originalEvent.changedTouches){position.y=event.originalEvent.changedTouches[0].pageY}position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-1;if(position.y<=-1)position.y=-1;if(position.y>=149)position.y=149;input.data('huePosition',position);huePicker.css('top',position.y).show();var h=Math.round((150-position.y-1)*2.4);if(h<0)h=0;if(h>360)h=360;var hsb=input.data('hsb');hsb.h=h;setColor(input,hsb,true)};var setColor=function(input,hsb,updateInput){input.data('hsb',hsb);var hex=hsb2hex(hsb);if(updateInput)input.val('#'+convertCase(hex,input.data('letterCase')));input.data('trigger').css('backgroundColor','#'+hex);if(input.data('selector'))input.data('selector').find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100}));if(input.data('change')){if(hex===input.data('lastChange'))return;input.data('change').call(input.get(0),'#'+hex,hsb2rgb(hsb));input.data('lastChange',hex)}};var setColorFromInput=function(input){input.val('#'+cleanHex(input.val()));var hex=expandHex(input.val());if(!hex)return false;var hsb=hex2hsb(hex);var currentHSB=input.data('hsb');if(hsb.h===currentHSB.h&&hsb.s===currentHSB.s&&hsb.b===currentHSB.b)return true;var colorPosition=getColorPositionFromHSB(hsb);var colorPicker=$(input.data('colorPicker'));colorPicker.css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');input.data('colorPosition',colorPosition);var huePosition=getHuePositionFromHSB(hsb);var huePicker=$(input.data('huePicker'));huePicker.css('top',huePosition.y+'px');input.data('huePosition',huePosition);setColor(input,hsb);return true};var convertCase=function(string,letterCase){if(letterCase==='lowercase')return string.toLowerCase();if(letterCase==='uppercase')return string.toUpperCase();return string};var getColorPositionFromHSB=function(hsb){var x=Math.ceil(hsb.s/0.67);if(x<0)x=0;if(x>150)x=150;var y=150-Math.ceil(hsb.b/0.67);if(y<0)y=0;if(y>150)y=150;return{x:x-5,y:y-5}};var getHuePositionFromHSB=function(hsb){var y=150-(hsb.h/2.4);if(y<0)h=0;if(y>150)h=150;return{y:y-1}};var cleanHex=function(hex){return hex.replace(/[^A-F0-9]/ig,'')};var expandHex=function(hex){hex=cleanHex(hex);if(!hex)return null;if(hex.length===3)hex=hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];return hex.length===6?hex:null};var hsb2rgb=function(hsb){var rgb={};var h=Math.round(hsb.h);var s=Math.round(hsb.s*255/100);var v=Math.round(hsb.b*255/100);if(s===0){rgb.r=rgb.g=rgb.b=v}else{var t1=v;var t2=(255-s)*v/255;var t3=(t1-t2)*(h%60)/60;if(h===360)h=0;if(h<60){rgb.r=t1;rgb.b=t2;rgb.g=t2+t3}else if(h<120){rgb.g=t1;rgb.b=t2;rgb.r=t1-t3}else if(h<180){rgb.g=t1;rgb.r=t2;rgb.b=t2+t3}else if(h<240){rgb.b=t1;rgb.r=t2;rgb.g=t1-t3}else if(h<300){rgb.b=t1;rgb.g=t2;rgb.r=t2+t3}else if(h<360){rgb.r=t1;rgb.g=t2;rgb.b=t1-t3}else{rgb.r=0;rgb.g=0;rgb.b=0}}return{r:Math.round(rgb.r),g:Math.round(rgb.g),b:Math.round(rgb.b)}};var rgb2hex=function(rgb){var hex=[rgb.r.toString(16),rgb.g.toString(16),rgb.b.toString(16)];$.each(hex,function(nr,val){if(val.length===1)hex[nr]='0'+val});return hex.join('')};var hex2rgb=function(hex){hex=parseInt(((hex.indexOf('#')>-1)?hex.substring(1):hex),16);return{r:hex>>16,g:(hex&0x00FF00)>>8,b:(hex&0x0000FF)}};var rgb2hsb=function(rgb){var hsb={h:0,s:0,b:0};var min=Math.min(rgb.r,rgb.g,rgb.b);var max=Math.max(rgb.r,rgb.g,rgb.b);var delta=max-min;hsb.b=max;hsb.s=max!==0?255*delta/max:0;if(hsb.s!==0){if(rgb.r===max){hsb.h=(rgb.g-rgb.b)/delta}else if(rgb.g===max){hsb.h=2+(rgb.b-rgb.r)/delta}else{hsb.h=4+(rgb.r-rgb.g)/delta}}else{hsb.h=-1}hsb.h*=60;if(hsb.h<0){hsb.h+=360}hsb.s*=100/255;hsb.b*=100/255;return hsb};var hex2hsb=function(hex){var hsb=rgb2hsb(hex2rgb(hex));if(hsb.s===0)hsb.h=360;return hsb};var hsb2hex=function(hsb){return rgb2hex(hsb2rgb(hsb))};switch(o){case'readonly':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).prop('readonly',data)});return $(this);case'disabled':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;if(data){disable($(this))}else{enable($(this))}});return $(this);case'value':if(data===undefined){if(!$(this).hasClass('miniColors'))return;var input=$(this),hex=expandHex(input.val());return hex?'#'+convertCase(hex,input.data('letterCase')):null}$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).val(data);setColorFromInput($(this))});return $(this);case'destroy':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;destroy($(this))});return $(this);default:if(!o)o={};$(this).each(function(){if($(this)[0].tagName.toLowerCase()!=='input')return;if($(this).data('trigger'))return;create($(this),o,data)});return $(this)}}})})(jQuery); \ No newline at end of file diff --git a/app/assets/javascripts/orbitTimeline.js b/app/assets/javascripts/orbitTimeline.js new file mode 100644 index 00000000..5eecb48c --- /dev/null +++ b/app/assets/javascripts/orbitTimeline.js @@ -0,0 +1,90 @@ +//for timeline parent library, will be accessable by main library and API library for other people to use.. default inherits orbitDesktopAPI +// Harry Bomrah + +var orbitTimeline = function(dom){ + t = this; + this.dom = $("#"+dom); + this.timelineHtml = $("
"); + //this.marker = t.timelineHtml.find("#timline_marker"); + this.scale = t.timelineHtml.find("#timeline_scale"); + //this.container = t.timelineHtml.find("#t_container"); + this.events = new Array; + this.monthList = ["","January","February","March","April","May","June","July","August","September","October","November","December"]; + this.initialize = function(){ + t.dom.html(t.timelineHtml); + $("div.scrollbar").hide(); + t.constructTimeScale(function(timelineScale){ + console.log(timelineScale); + $("#timeline_scale").html(timelineScale); + var totalyearwidth =timelineScale.find(".year").length * 100; + var totalul = 0; + for(eve in t.events){ + t.makeBubble(t.events[eve]); + totalul = $("#scale_wrapper ul").length + $(".t_scale").width((totalul*350) + totalyearwidth); + } + + $('.tinycanvas').tinyscrollbar({ axis: 'x'}); + }); + } + this.constructTimeScale = function(callbackFn){ + var mon ="",year=""; + var scale = $("
"); + $.getJSON("desktop_orbit/getevents",{"event":"papers"},function(journals){ + $.each(journals,function(x,journal){ + $.each(journal.papers,function(i,paper){ + var dt = new Date(paper.created_at); + var cur_mon = paper.created_at.substr(5,2); + var cur_year = dt.getFullYear(); + var cdt = paper.created_at.substr(0,7).replace("-",""); + var formname = (cur_mon.charAt(0) == "0"?cur_mon.charAt(1) : cur_mon) + var bubbleData = {"fulldate" : t.monthList[parseInt(formname)] +", " + dt.getDate() + ", " + cur_year,"title":paper.title,"jtitle":journal.title,"coauthors":paper.coauthors,"abstract":paper.abstract,"timestamp":cdt} + t.events.push(bubbleData); + if(cur_year != year){ + year = cur_year; + scale.append($("
"+(year+1)+"
")); + } + if(cur_mon != mon){ + mon = cur_mon; + console.log(parseInt(cur_mon)); + scale.append($("
"+t.monthList[parseInt(formname)]+"
")) + } + }); + }) + scale.append($("
"+year+"
")); + if(typeof callbackFn == "function"){ + callbackFn.call(this,scale); + } + + }); + } + this.makeBubble = function(bubbleData){ + var totalul = $("#scale_wrapper").find("div[data-content="+bubbleData.timestamp+"] ul").length; + var targetul = $("#scale_wrapper div[data-content="+bubbleData.timestamp+"] div.bubble_list ul").eq(totalul-1); + if(totalul == 0){ + var ul = $(""); + $("#scale_wrapper").find("div[data-content="+bubbleData.timestamp+"] div.bubble_list").append(ul); + targetul = ul; + }else{ + var totalli = targetul.find("li").length; + if(totalli >= 5){ + var ul = $(""); + $("#scale_wrapper").find("div[data-content="+bubbleData.timestamp+"] div.bubble_list").append(ul); + targetul = ul; + } + } + var bt = (bubbleData.title.length > 70? bubbleData.title.substr(0,70) + "..." : bubbleData.title); + var bubble = $("
  • "+bt+" - "+bubbleData.fulldate+"
  • "); + bubble.css("margin-left","25px"); + targetul.prepend(bubble); + bubble.show(); + bubble.click(function(){ + o.toolPopup({ + parent: $(this), + html : "

    "+bubbleData.jtitle+"

    Co-Authors:

    "+bubbleData.coauthors+"

    Abstract:

    "+bubbleData.abstract+"
    ", + height: "auto", + width:"300px" + }); + })//.mouseout(function(){t.oapi.toolPopup("destroy");}) + } +} \ No newline at end of file diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js new file mode 100755 index 00000000..cd437550 --- /dev/null +++ b/app/assets/javascripts/orbitdesktop.js @@ -0,0 +1,1383 @@ +// JavaScript Document +//harry +//Inititialize function will initialize desktop +$.extend($.expr[':'], { + 'containsi': function (elem, i, match, array) { + return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; + } +}); +$.fn.sort = function(c) { + return this.pushStack([].sort.apply(this, arguments), []); + }; +var sortAscending = function(a, b) { + return $(a).find("h1").text() > $(b).find("h1").text() ? 1 : -1; +}; +var sortDescending = function(a, b) { + return $(a).find("h1").text() < $(b).find("h1").text() ? 1 : -1; +}; +var orbitDesktop = function(dom){ + orbitDesktopAPI.apply(this); + o = this; + this.contentHolder = dom; + this.themesettings = ""; + this.theme = "4f8d3f493b67fcd05f086359"; + this.transitionTime = 500; + this.currenthtml = "desktop.html"; + this.currentface = "home"; + this.desktopData = {"home":"","settings":"","work":"","favorite":"","apps_manager":"","sections":"","journal_p":"","appstore":"","orbit":""}; + this.tp = ""; + this.sectionList; + this.initialize = function(){ + var theme = o.theme; + var custom = false; + $.getJSON("/desktop/get_desktop_settings",{"get":"desktop","desktopid":o.desktopId},function(desktopSettings){ + if(desktopSettings){ + if(desktopSettings.theme!="custom"){ + theme = desktopSettings.theme; + }else{ + theme = "4f8d3f493b67fcd05f086359"; + custom = true; + } + o.theme = theme; + loadTheme(desktopSettings.customtheme,desktopSettings.wallpaper); + }else{loadTheme();} + }) + var loadTheme = function(customtheme,customwallpaper){ //This function will load the theme from database + $.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){ + o.themesettings = eval(ts); + $('head').append( $('').attr('href', "/"+o.themefolder+"/"+theme+"/css/"+ts.css)); + if(custom){ + $("head").find("#dyn_css").remove(); + $("head").append(customtheme); + } + $(document).ready(function(){o.loadWallpaper(customwallpaper);o.bindDesktopEvents();o.loadIconCache();o.initializeDesktop();}); + }) + } + } + this.changeTheme = function(theme){ // this function is used for changing theme + o.theme = theme; + $.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){ + o.themesettings = eval(ts); + $('head').find("#dyn_css").remove(); + $('head').append( $('').attr('href', "/"+o.themefolder+"/"+theme+"/css/"+ts.css)); + o.loadWallpaper(); + o.loadIconCache(); + }) + }; + this.bindDesktopEvents = function(){ //this function will bind the global handlers to thd desktop, for example doc + $("a#d_app_manager").click(function(){ + var target = $(this).attr("href"); + if(o.currenthtml!=target){ + o.desktopData[o.currentface] = $(o.contentHolder).html(); + $("#content").hide("drop",o.transitionTime,function(){ + o.initializeAppSearch(target); + }); + } + }); + $("a#d_desktop").click(function(){ + var target = $(this).attr("href"); + if(o.currenthtml!=target){ + o.desktopData[o.currentface] = $(o.contentHolder).html(); + $("#content").hide("drop",o.transitionTime,function(){ + o.initializeDesktop(target); + }); + } + }); + $("a#d_sections").click(function(){ + var target = $(this).attr("href"); + if(o.currenthtml!=target){ + o.desktopData[o.currentface] = $(o.contentHolder).html(); + $("#content").hide("drop",o.transitionTime,function(){ + o.initializeSectionsManager(target); + }); + } + }); + $("#d_journal_p").click(function(){ + var target = $(this).attr("href"); + if(o.currenthtml!=target){ + o.desktopData[o.currentface] = $(o.contentHolder).html(); + $("#content").hide("drop",o.transitionTime,function(){ + o.initializeJournalPapers(target); + }); + } + }); + $("a#d_settings").click(function(){ + var target = $(this).attr("href"); + if(o.currenthtml!=target){ + o.desktopData[o.currentface] = $(o.contentHolder).html(); + $("#content").hide("drop",o.transitionTime,function(){ + o.initializeSettings(target); + }); + } + }); + $("a#d_appstore").click(function(){ + var target = $(this).attr("href"); + if(o.currenthtml!=target){ + o.desktopData[o.currentface] = $(o.contentHolder).html(); + $("#content").hide("drop",o.transitionTime,function(){ + o.initializeAppstore(target); + }); + } + }); + $("a#d_orbit").click(function(){ + var target = $(this).attr("href"); + if(o.currenthtml!=target){ + o.desktopData[o.currentface] = $(o.contentHolder).html(); + $("#content").hide("drop",o.transitionTime,function(){ + o.initializeOrbitTimeline(target); + }); + } + }); + $(window).resize(function(){ + var ww = $(window).width(); + $("img#thmbackground").attr({"width":ww}); + if( $('.tinycanvas') ){ $('.tinycanvas').tinyscrollbar_update(); } + if($(o.contentHolder).find("div.app_frame").length > 0){ + $(o.contentHolder).find("div.app_frame").each(function(){ + var app_holder_height = $(this).height() - 72; + var app_holder_width = $(this).width(); + $(this).find("div.app_holder").height(app_holder_height); + $(this).find("div.app_holder iframe").attr({"height":app_holder_height,"width":app_holder_width}); + }) + } + }); + var $widget_fn = $('.widget_fn'),$fn_des = $('.fn_des'); + $widget_fn.hover(function(){ + var fn_name = $(this).find('img').attr('alt'),nth = $(this).parents('.d_cate').index(),des_left = $('.dock_child').eq(nth).width(); + $(this).addClass('thmc1'); + $fn_des.text(fn_name).css({'top':nth * 60,'left': des_left + 60}).stop(true, true).fadeIn(); + },function(){ + $(this).removeClass('thmc1'); + $fn_des.stop(true, true).fadeOut(); + }); + }; + + this.initializeDesktop = function(target){ //this is for initializing main desktops that are sections and tiles + if(!target)target = "desktop"; + o.currenthtml = target; + o.currentface = "home"; + + var bindHandlers = function(){ // this function will bind all the handlers in the desktop + var groupWrapperWidth = 0; + $("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);}); + var grps = new Array; + $("div#desktop #group_wrapper").css("width",groupWrapperWidth); + var first = true; + $("div#desktop .g_col").sortable({ + connectWith: ".g_col", + tolerance: 'pointer' , + revert: 300, + containment: '#group_wrapper', + helper: 'clone', + stop:function(){ + first = true; + var grpwidth = 0; + for(i in grps){ + var grp = grps[i]; + if(grp.find(".element").length == 0){ + grp.animate({"width":"0px"},500,function(){$(this).remove();}); + grpwidth+=225; + } + } + grps = []; + $("#group_wrapper").width($("#group_wrapper").width()-grpwidth); + }, + start:function(){ + $("#group_wrapper").find("div.group").each(function(i,par){ + var nextnumber = $(this).find("ul").length; + $newcol = $('