diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 2bbea3ae..253b6e1e 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -68,9 +68,16 @@ var orbitDesktop = function(dom){ }); } }); - $("select#change_theme").change(function(){ - o.changeTheme($(this).val()); - }) + $("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); + }); + } + }); + $(window).resize(function(){ var ww = $(window).width(); $("img#thmbackground").attr({"width":ww}); @@ -140,14 +147,32 @@ var orbitDesktop = function(dom){ }); $('#holder').tinyscrollbar({ axis: 'x'}); + $("div.scrollbar").hover(function(){ + $(this).removeClass('op01'); + }, function(){ + $(this).addClass('op01'); + }); + var $sdm = $('.sdm'); + + if( !$sdm.children('.sdm_o') ){ + return; + } else { + $sdm.hover(function(){ + $(this).addClass('thmc2'); + }, function(){ + $(this).removeClass('thmc2'); + }); + } } if(!o.desktopData[o.currentface]){ $(o.contentHolder).empty().load("/desktop/"+target,function(){ bindHandlers(); + o.initializeWidgets(); }); }else{ $(o.contentHolder).html(o.desktopData[o.currentface]); bindHandlers(); + o.initializeWidgets(); } }; this.tempFunc = function(){ @@ -200,15 +225,16 @@ var orbitDesktop = function(dom){ if(!o.desktopData[o.currentface]){ $(o.contentHolder).empty().load("/desktop/"+target,function(){ bindHandlers(); + }); }else{ $(o.contentHolder).html(o.desktopData[o.currentface]); - bindHandlers(); + bindHandlers(); } }; this.initializeSectionsManager = function(target){ o.currenthtml = target; - o.currentface = "settings"; + o.currentface = "sections"; var elementParent,element; var bindHandlers = function(){ $(".group").width(530); @@ -236,6 +262,17 @@ var orbitDesktop = function(dom){ $(this).toggleClass("op06"); })//.mouseleave(function(){$(this).addClass("op06");}); $('#holder').tinyscrollbar({ axis: 'x'}); + var $sdm = $('.sdm'); + + if( !$sdm.children('.sdm_o') ){ + return; + } else { + $sdm.hover(function(){ + $(this).addClass('thmc2'); + }, function(){ + $(this).removeClass('thmc2'); + }); + } }; if(!o.desktopData[o.currentface]){ $(o.contentHolder).empty().load("/desktop/"+target,function(){ @@ -247,6 +284,23 @@ var orbitDesktop = function(dom){ } }; + this.initializeSettings = function(target){ + o.currenthtml = target; + o.currentface = "settings"; + var bindHandlers = function(){ + $("select#change_theme").change(function(){ + o.changeTheme($(this).val()); + }) + } + if(!o.desktopData[o.currentface]){ + $(o.contentHolder).empty().load("/desktop/"+target,function(){ + bindHandlers(); + }); + }else{ + $(o.contentHolder).html(o.desktopData[o.currentface]); + bindHandlers(); + } + }; this.loadWallpaper = function(wallpaper){ if(!wallpaper)wallpaper = o.themesettings.background; var ww = $(window).width(); @@ -264,11 +318,26 @@ var orbitDesktop = function(dom){ var setting_name = $(this).attr("id").replace("_icon",""); $(this).attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons[setting_name]) }) + }; + this.initializeWidgets = function(){ + var elements = $("#group_wrapper li.element"); + $.each(elements,function(){ + var widget = $(this); + if(widget.attr("data-category")=="widget"){ + var widgename =widget.attr("data-content"); + $.getScript("/desktop_widgets/"+widgename+"/"+widgename+".js",function(){ + widget.find("div.appholder").load("/desktop_widgets/"+widgename+"/index.html.erb"); + }); + // $(this).find("div.appholder").append( $('').attr('href', "/desktop_widgets/"+widgename+"/css/"+widgename+".css")); + } + + }) } o.initialize(); } orbitDesktop.prototype.themefolder = "themes"; +orbitDesktop.prototype.widgetfolder = "desktop_widgets"; orbitDesktop.prototype.desktopId = "1"; orbitDesktop.prototype.notifyImgPath = "temp"; diff --git a/app/assets/stylesheets/desktopmain.css b/app/assets/stylesheets/desktopmain.css index 5c8bd8cf..de18a161 100644 --- a/app/assets/stylesheets/desktopmain.css +++ b/app/assets/stylesheets/desktopmain.css @@ -62,7 +62,7 @@ body { a, a:hover { text-decoration: none; } /* desktop layout */ #container { - margin: 72px 0 0 156px; + margin: 48px 0 0 156px; } #header { padding: 0 0 12px 0; @@ -72,7 +72,7 @@ a, a:hover { text-decoration: none; } width: 156px; height: 540px; position: absolute; - top: 144px; + top: 120px; left: 0; z-index: 9; } @@ -154,7 +154,35 @@ a, a:hover { text-decoration: none; } height:516px; } -.appname { font-size: 15px; } +.appname { + font-size: 15px; + height: 30px; + line-height: 30px; + overflow: hidden; + cursor: default; + z-index: 2; + } +.w1.h1 .appname { text-align: center; } +.w2.h2 .appname { font-size: 21px; } +.appicon { + display: block; + width: 60px; + height: 60px; + margin: 0 auto; + position: relative; + } +.appholder { + position: relative; + padding-bottom: 12px; + } +.holder_f { + position: absolute; + width: 100%; + height: 100%; + padding: 0; +/* left: 0; + top: 0; */ + } .dtitle { font-size: 30px; line-height: 60px; @@ -163,22 +191,8 @@ a, a:hover { text-decoration: none; } position: relative; z-index: 9; } -.dtitle:hover { - /* $(this).addClass( .thmc1 or .thmc2 ); */ - } -.dtitle:hover .section_slc { display: block; } -.section_slc { - display: none; - position: absolute; - width: 252px; - left: 0; - top: 60px; - font-size: 15px; - line-height: 34px; - } -.section_slc li { border-top: solid 1px #f2f2f2; padding: 0 12px; } -.section_slc li:first-child { border: none; } -.section_slc li:hover { background-color: #F0F0F0; } +/*.section_slc { width: 252px; }*/ + .admbg { background-color: #fff; } .admtxt { color: #666; } .admtxt:hover { color: #666; } @@ -198,6 +212,21 @@ a, a:hover { text-decoration: none; } left: 0; top: 0; } + +/* simple dropdown menu */ +.sdm {} +.sdm:hover .sdm_o { display: block; } +.sdm_o { + display: none; + position: absolute; + left: 0; + top: 60px; + font-size: 15px; + } +.sdm_o li { border-top: solid 1px #f2f2f2; } +.sdm_o li:first-child { border: none; } +.sdm_o .admtxt { display: block; line-height: 36px; } +.sdm_o .admtxt:hover { background-color: #F0F0F0; } /* theme color opacity */ .op10 { opacity: 1; } .op09 { opacity: 0.9; } @@ -231,6 +260,7 @@ a, a:hover { text-decoration: none; } .element { margin: 0 12px 12px 0; float: left; + position: relative; /*display:inline-block;*/ } .group{ @@ -250,7 +280,7 @@ a, a:hover { text-decoration: none; } max-width: 340px; } .g_sep { width: 11px; border-left: solid 1px #fff; } -.appicon { width: 60px; height: 60px; } + .clear { clear: both; } @@ -270,7 +300,7 @@ a, a:hover { text-decoration: none; } /* Orbit Notification */ #orbitnote { - position: absolute; + position: fixed; top: 0; left: 50%; margin-left: -206px; diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb index 37cbb90e..987f09ce 100644 --- a/app/controllers/desktop_controller.rb +++ b/app/controllers/desktop_controller.rb @@ -30,4 +30,8 @@ class DesktopController< ApplicationController @desktop = Desktop.find(params["id"]) render :json => @desktop.to_json end + + def settings + render :layout => false + end end \ No newline at end of file diff --git a/app/views/desktop/desktop.html.erb b/app/views/desktop/desktop.html.erb index c852ded9..aef45911 100755 --- a/app/views/desktop/desktop.html.erb +++ b/app/views/desktop/desktop.html.erb @@ -1,113 +1,99 @@ -
-
-Change Theme: +
+ + + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index ef15c587..8735b7e7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -105,6 +105,7 @@ Orbit::Application.routes.draw do match '/desktop/desktop'=>'desktop#desktop' match '/desktop/app_manager'=>'desktop#app_manager' match '/desktop/sections'=>'desktop#sections' + match '/desktop/settings'=>'desktop#settings' match '/desktop/get_desktop_settings/'=>'desktop#get_desktop_settings' match '/desktop/save_desktop_settings/'=>'desktop#save_desktop_settings' match '/panel/:app_name/front_end/:app_action/:id' => 'pages#show_from_link', :constraints => lambda { |request| diff --git a/public/desktop_pages/app_manager.html b/public/desktop_pages/app_manager.html deleted file mode 100755 index 570799f9..00000000 --- a/public/desktop_pages/app_manager.html +++ /dev/null @@ -1,121 +0,0 @@ -
- -
- -
-
- -
- - - -
-
-
-
diff --git a/public/desktop_pages/desktop.html b/public/desktop_pages/desktop.html deleted file mode 100755 index 1089b596..00000000 --- a/public/desktop_pages/desktop.html +++ /dev/null @@ -1,110 +0,0 @@ -
- -
-
-
-
    -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Aperture

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Aperture

    -
  • -
  • -

    Aperture

    -
  • -
  • -

    Aperture

    -
  • -
  • -

    Aperture

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Aperture

    -
  • -
  • -

    Aperture

    -
  • -
  • -

    Aperture

    -
  • -
  • -

    Aperture

    -
  • -

    Aperture

    -
  • -

    Garage Band

    -
  • -

    Aperture

    -
  • -
-
-
-
    -
  • -

    Garage Band

    -
  • -

    Aperture

    -
  • -
  • -

    Aperture

    -
  • -
  • -

    Aperture

    -
  • -

    Aperture

    -
  • -

    Aperture

    -
  • -

    Garage Band

    -
  • -

    Aperture

    -
  • -

    Aperture

    -
  • -

    Aperture

    -
  • -

    Aperture

    -
  • -

    Aperture

    -
  • -

    Garage Band

    -
  • -

    Aperture

    -
  • -

    Aperture

    -
  • -

    Aperture

    -
  • -
-
-
-
-
- -
-
- \ No newline at end of file diff --git a/public/desktop_pages/sections.html b/public/desktop_pages/sections.html deleted file mode 100644 index 50ecaa93..00000000 --- a/public/desktop_pages/sections.html +++ /dev/null @@ -1,171 +0,0 @@ -
- -
-
-
- -
    -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • - - -
-
-
- -
    -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • -
  • -

    Garage Band

    -
  • - -
-
-
-
-
-
\ No newline at end of file diff --git a/public/desktop_widgets/clock/bg_blue.png b/public/desktop_widgets/clock/bg_blue.png new file mode 100755 index 00000000..ea275d1b Binary files /dev/null and b/public/desktop_widgets/clock/bg_blue.png differ diff --git a/public/desktop_widgets/clock/bg_green.png b/public/desktop_widgets/clock/bg_green.png new file mode 100755 index 00000000..393618c2 Binary files /dev/null and b/public/desktop_widgets/clock/bg_green.png differ diff --git a/public/desktop_widgets/clock/bg_orange.png b/public/desktop_widgets/clock/bg_orange.png new file mode 100755 index 00000000..84d32207 Binary files /dev/null and b/public/desktop_widgets/clock/bg_orange.png differ diff --git a/public/desktop_widgets/clock/clock.css b/public/desktop_widgets/clock/clock.css new file mode 100755 index 00000000..7bba2ba0 --- /dev/null +++ b/public/desktop_widgets/clock/clock.css @@ -0,0 +1,69 @@ +.clock{ + /* The .clock div. Created dynamically by jQuery */ + background-color:#252525; + height:200px; + width:200px; + position:relative; + overflow:hidden; + float:left; +} + +.clock .rotate{ + /* There are two .rotate divs - one for each half of the background */ + position:absolute; + width:200px; + height:200px; + top:0; + left:0; +} + +.rotate.right{ + display:none; + z-index:11; +} + +.clock .bg, .clock .front{ + width:100px; + height:200px; + background-color:#252525; + position:absolute; + top:0; +} + +.clock .display{ + /* Holds the number of seconds, minutes or hours respectfully */ + position:absolute; + width:200px; + font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif; + z-index:20; + color:#F5F5F5; + font-size:60px; + text-align:center; + top:65px; + left:0; + + /* CSS3 text shadow: */ + text-shadow:4px 4px 5px #333333; +} + +/* The left part of the background: */ + +.clock .bg.left{ left:0; } + +/* Individual styles for each color: */ +.orange .bg.left{ background:url(bg_orange.png) no-repeat left top; } +.green .bg.left{ background:url(bg_green.png) no-repeat left top; } +.blue .bg.left{ background:url(bg_blue.png) no-repeat left top; } + +/* The right part of the background: */ +.clock .bg.right{ left:100px; } + +.orange .bg.right{ background:url(bg_orange.png) no-repeat right top; } +.green .bg.right{ background:url(bg_green.png) no-repeat right top; } +.blue .bg.right{ background:url(bg_blue.png) no-repeat right top; } + + +.clock .front.left{ + left:0; + z-index:10; +} diff --git a/public/desktop_widgets/clock/clock.js b/public/desktop_widgets/clock/clock.js new file mode 100755 index 00000000..d4237c01 --- /dev/null +++ b/public/desktop_widgets/clock/clock.js @@ -0,0 +1,171 @@ +/*! + * jquery.tzineClock.js - Tutorialzine Colorful Clock Plugin + * + * Copyright (c) 2009 Martin Angelov + * http://tutorialzine.com/ + * + * Licensed under MIT + * http://www.opensource.org/licenses/mit-license.php + * + * Launch : December 2009 + * Version : 1.0 + * Released: Monday 28th December, 2009 - 00:00 + */ + +(function($){ + + // A global array used by the functions of the plug-in: + var gVars = {}; + + // Extending the jQuery core: + $.fn.tzineClock = function(opts){ + + // "this" contains the elements that were selected when calling the plugin: $('elements').tzineClock(); + // If the selector returned more than one element, use the first one: + + var container = this.eq(0); + + if(!container) + { + try{ + console.log("Invalid selector!"); + } catch(e){} + + return false; + } + + if(!opts) opts = {}; + + var defaults = { + /* Additional options will be added in future versions of the plugin. */ + }; + + /* Merging the provided options with the default ones (will be used in future versions of the plugin): */ + $.each(defaults,function(k,v){ + opts[k] = opts[k] || defaults[k]; + }) + + // Calling the setUp function and passing the container, + // will be available to the setUp function as "this": + setUp.call(container); + + return this; + } + + function setUp() + { + // The colors of the dials: + var colors = ['orange','blue','green']; + + var tmp; + + for(var i=0;i<3;i++) + { + // Creating a new element and setting the color as a class name: + + tmp = $('
').attr('class',colors[i]+' clock').html( + '
'+ + + '
'+ + + '
'+ + '
'+ + '
'+ + + '
'+ + '
'+ + '
' + ); + + // Appending to the container: + $(this).append(tmp); + + // Assigning some of the elements as variables for speed: + tmp.rotateLeft = tmp.find('.rotate.left'); + tmp.rotateRight = tmp.find('.rotate.right'); + tmp.display = tmp.find('.display'); + + // Adding the dial as a global variable. Will be available as gVars.colorName + gVars[colors[i]] = tmp; + } + + // Setting up a interval, executed every 1000 milliseconds: + setInterval(function(){ + + var currentTime = new Date(); + var h = currentTime.getHours(); + var m = currentTime.getMinutes(); + var s = currentTime.getSeconds(); + + animation(gVars.green, s, 60); + animation(gVars.blue, m, 60); + animation(gVars.orange, h, 24); + + },1000); + } + + function animation(clock, current, total) + { + // Calculating the current angle: + var angle = (360/total)*(current+1); + + var element; + + if(current==0) + { + // Hiding the right half of the background: + clock.rotateRight.hide(); + + // Resetting the rotation of the left part: + rotateElement(clock.rotateLeft,0); + } + + if(angle<=180) + { + // The left part is rotated, and the right is currently hidden: + element = clock.rotateLeft; + } + else + { + // The first part of the rotation has completed, so we start rotating the right part: + clock.rotateRight.show(); + clock.rotateLeft.show(); + + rotateElement(clock.rotateLeft,180); + + element = clock.rotateRight; + angle = angle-180; + } + + rotateElement(element,angle); + + // Setting the text inside of the display element, inserting a leading zero if needed: + clock.display.html(current<10?'0'+current:current); + } + + function rotateElement(element,angle) + { + // Rotating the element, depending on the browser: + var rotate = 'rotate('+angle+'deg)'; + + if(element.css('MozTransform')!=undefined) + element.css('MozTransform',rotate); + + else if(element.css('WebkitTransform')!=undefined) + element.css('WebkitTransform',rotate); + + // A version for internet explorer using filters, works but is a bit buggy (no surprise here): + else if(element.css("filter")!=undefined) + { + var cos = Math.cos(Math.PI * 2 / 360 * angle); + var sin = Math.sin(Math.PI * 2 / 360 * angle); + + element.css("filter","progid:DXImageTransform.Microsoft.Matrix(M11="+cos+",M12=-"+sin+",M21="+sin+",M22="+cos+",SizingMethod='auto expand',FilterType='nearest neighbor')"); + + element.css("left",-Math.floor((element.width()-200)/2)); + element.css("top",-Math.floor((element.height()-200)/2)); + } + + } + +})(jQuery) \ No newline at end of file diff --git a/public/desktop_widgets/clock/img/bg_blue.png b/public/desktop_widgets/clock/img/bg_blue.png new file mode 100644 index 00000000..7f53ed5c Binary files /dev/null and b/public/desktop_widgets/clock/img/bg_blue.png differ diff --git a/public/desktop_widgets/clock/img/bg_green.png b/public/desktop_widgets/clock/img/bg_green.png new file mode 100644 index 00000000..ce092cfc Binary files /dev/null and b/public/desktop_widgets/clock/img/bg_green.png differ diff --git a/public/desktop_widgets/clock/img/bg_orange.png b/public/desktop_widgets/clock/img/bg_orange.png new file mode 100644 index 00000000..f13fdc7c Binary files /dev/null and b/public/desktop_widgets/clock/img/bg_orange.png differ diff --git a/public/desktop_widgets/clock/index.html.erb b/public/desktop_widgets/clock/index.html.erb new file mode 100755 index 00000000..8fda567a --- /dev/null +++ b/public/desktop_widgets/clock/index.html.erb @@ -0,0 +1,76 @@ + +
+ \ No newline at end of file diff --git a/public/desktop_widgets/school_events/events.json b/public/desktop_widgets/school_events/events.json new file mode 100644 index 00000000..c4c6fd5e --- /dev/null +++ b/public/desktop_widgets/school_events/events.json @@ -0,0 +1 @@ +{"first":{"date":"25 Feb","event":"國立政治大學101學年度碩士班暨…","timing":"時間:07:00-17:00"},"second":{"date":"26 Feb","event":"國立政治大學101學年度碩士班暨…","timing":"時間:07:00-17:00"}} \ No newline at end of file diff --git a/public/desktop_widgets/school_events/index.html.erb b/public/desktop_widgets/school_events/index.html.erb new file mode 100644 index 00000000..e6ac921a --- /dev/null +++ b/public/desktop_widgets/school_events/index.html.erb @@ -0,0 +1,7 @@ +
+


+
+ + \ No newline at end of file diff --git a/public/desktop_widgets/school_events/school_events.js b/public/desktop_widgets/school_events/school_events.js new file mode 100644 index 00000000..78240c72 --- /dev/null +++ b/public/desktop_widgets/school_events/school_events.js @@ -0,0 +1,21 @@ +var eventsjson = new Array; +var loadEvents = function(){ + $.getJSON(o.widgetfolder+"/school_events/events.json",function(events){ + $.each(events,function(i,event){ + eventsjson.push(event); + }) + + displayevents(); + }) +} +var i = 0; +var displayevents = function(){ + $("#school_events").fadeOut(500); + $("span#date").text(eventsjson[i].date); + $("span#event").text(eventsjson[i].event); + $("span#timings").text(eventsjson[i].timing); + $("#school_events").fadeIn(500); + i++; + if(i==eventsjson.length)i=0; + setTimeout(displayevents,5000); +} \ No newline at end of file diff --git a/public/desktop_widgets/weather/img/clouds_180x150_bg.jpg b/public/desktop_widgets/weather/img/clouds_180x150_bg.jpg new file mode 100644 index 00000000..744cdaec Binary files /dev/null and b/public/desktop_widgets/weather/img/clouds_180x150_bg.jpg differ diff --git a/public/desktop_widgets/weather/index.html.erb b/public/desktop_widgets/weather/index.html.erb new file mode 100644 index 00000000..1dfa1849 --- /dev/null +++ b/public/desktop_widgets/weather/index.html.erb @@ -0,0 +1,6 @@ +
\ No newline at end of file diff --git a/public/desktop_widgets/weather/weather.js b/public/desktop_widgets/weather/weather.js new file mode 100644 index 00000000..e69de29b