PageRenderTime 47ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/desktop/core/src/desktop/templates/index.mako

https://github.com/kryton/hue
Mako | 220 lines | 194 code | 11 blank | 15 comment | 0 complexity | 215161a828d2fd5dc18132c1390589a2 MD5 | raw file
Possible License(s): BSD-3-Clause, MPL-2.0-no-copyleft-exception, Apache-2.0
  1. ## Licensed to Cloudera, Inc. under one
  2. ## or more contributor license agreements. See the NOTICE file
  3. ## distributed with this work for additional information
  4. ## regarding copyright ownership. Cloudera, Inc. licenses this file
  5. ## to you under the Apache License, Version 2.0 (the
  6. ## "License"); you may not use this file except in compliance
  7. ## with the License. You may obtain a copy of the License at
  8. ##
  9. ## http://www.apache.org/licenses/LICENSE-2.0
  10. ##
  11. ## Unless required by applicable law or agreed to in writing, software
  12. ## distributed under the License is distributed on an "AS IS" BASIS,
  13. ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ## See the License for the specific language governing permissions and
  15. ## limitations under the License.
  16. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  17. <html>
  18. <head>
  19. <meta http-equiv="X-UA-Compatible" content="IE=8" />
  20. <title>Hue</title>
  21. <link rel="shortcut icon" href="/static/art/favicon_solid.png" type="image/x-icon" />
  22. <link rel="icon" href="/static/art/favicon_solid.png" type="image/x-icon" />
  23. <link rel="stylesheet" href="/static/css/shared.css" type="text/css" media="screen" title="no title" charset="utf-8">
  24. <link rel="stylesheet" href="/static/css/reset.css" type="text/css" media="screen" charset="utf-8">
  25. <link rel="stylesheet" href="/static/css/windows.css" type="text/css" media="screen" charset="utf-8">
  26. <link rel="stylesheet" href="/static/css/desktop.css" type="text/css" media="screen" charset="utf-8">
  27. <script src="/depender/build?client=true&require=dbug,DomReady,Cookie"></script>
  28. <!--[if IE 8]>
  29. <script>
  30. window.ie8 = true;
  31. </script>
  32. <![endif]-->
  33. <script>
  34. window.addEvent('domready', function(){
  35. if (Browser.Engine.trident) {
  36. $('closeWarning').addEvent('click', function(){
  37. Cookie.write('desktop-browser-warned', true);
  38. $(document.body).removeClass('warned');
  39. });
  40. if (!Cookie.read('desktop-browser-warned')) $(document.body).addClass('warned');
  41. if (!ie8) alert("Hue does not currently support any version of Internet Explorer other than IE8.");
  42. }
  43. var appName = "Hue";
  44. Depender.require({
  45. scripts: ["CCS.Request", "CCS.User", "CCS.Desktop", "CCS.Desktop.Config", "CCS.Desktop.FlashMessage", "CCS.Desktop.Keys", "CCS.Login", "StickyWin.PointyTip", "Element.Delegation", "Fx.Tween", "Fx.Elements"],
  46. callback: function(){
  47. $('bg').set('tween', {duration:500}).tween('opacity', 0, 1);
  48. $(document.body).addEvent('click:relay(img.desktop-logo)', rotateBG);
  49. rotateBG.periodical(300000); //rotate the background every 5 min
  50. Clientcide.setAssetLocation("/static/js/ThirdParty/clientcide/Assets");
  51. var growled = {};
  52. var launchGrowl = function(component){
  53. var appName = CCS.Desktop.getAppName(component);
  54. var loading = 'Loading ' + appName;
  55. var launching = 'Launching ' + appName;
  56. var msg = loading;
  57. if (CCS.Desktop.hasLoaded(component)) msg = launching;
  58. if (!CCS.Desktop.checkForFlashMessage(loading) &&
  59. !CCS.Desktop.checkForFlashMessage(launching) &&
  60. !$$('.loadingmsg').length) {
  61. growled[component] = CCS.Desktop.flashMessage(msg, 10000);
  62. }
  63. };
  64. var clearGrowl = function(component) {
  65. if (growled[component]) {
  66. growled[component]();
  67. delete growled[component];
  68. }
  69. };
  70. CCS.Desktop.initialize({
  71. onBeforeLoad: launchGrowl,
  72. onBeforeLaunch: launchGrowl,
  73. onAfterLaunch: clearGrowl
  74. });
  75. (function(){
  76. $('ccs-loading').fade('out').get('tween').clearChain().chain(function(){
  77. $('ccs-loading').destroy();
  78. });
  79. }).delay(300);
  80. //when the user logs in
  81. CCS.User.withUser(function(user){
  82. var bsLoaded;
  83. var bootstrapped = function(){
  84. if (bsLoaded) return;
  85. bsLoaded = true;
  86. //if there's no desktop to restore
  87. var linked = CCS.Desktop.launchLinked();
  88. // If a link was opened it chooses how to restore the desktop
  89. var restored;
  90. //we need to delay this slightly for IE; don't ask me why
  91. var finalize = function(){
  92. if (!linked) {
  93. //this is how we hide things in IE because it hates opacity/visibility stuff w/ VML
  94. $('ccs-desktop').setStyle('top', -10000);
  95. restored = CCS.Desktop.restoreDesktop();
  96. $('ccs-desktop').setStyle('top', null);
  97. }
  98. if (!linked && !restored) {
  99. //call the autolaunchers
  100. CCS.Desktop.autolaunchers.each(function(fn){
  101. fn();
  102. });
  103. }
  104. $('ccs-profileLink').set('text', user.username).addClass('loggedIn');
  105. $(document.body).addClass('ccs-loaded');
  106. window.scrollTo(0,0);
  107. $('ccs-toolbar').show().tween('opacity', 0, 1);
  108. $('ccs-dock').tween('opacity', 0, 1);
  109. };
  110. if (Browser.Engine.trident) finalize.delay(100);
  111. else finalize();
  112. };
  113. new Element('script', {
  114. src: '/bootstrap.js',
  115. events: {
  116. load: function() {
  117. bootstrapped();
  118. },
  119. readystatechange: function(){
  120. if (['loaded', 'complete'].contains(this.readyState)) bootstrapped();
  121. }
  122. }
  123. }).inject(document.head);
  124. });
  125. }
  126. });
  127. });
  128. </script>
  129. </head>
  130. <body>
  131. <div id="bg">
  132. <script>
  133. (function(){
  134. var NUMBER_OF_BACKGROUNDS = 13; //number of backgrounds in /static/art/desktops
  135. var r = $random(1, NUMBER_OF_BACKGROUNDS);
  136. //inject a random background
  137. document.write('<img src="/static/art/desktops/' + r + '.jpg" class="desktop-bg"><img src="/static/art/desktops/' + r + '.logo.png" class="desktop-logo">');
  138. //background rotation function
  139. this.rotateBG = function(){
  140. //grab the images there now
  141. var bg = $('bg').getElement('.desktop-bg');
  142. var logo = $('bg').getElement('.desktop-logo');
  143. //pick a new random one
  144. if (r < NUMBER_OF_BACKGROUNDS) r++;
  145. else r = 1;
  146. //inject them
  147. new Element('img', {
  148. src: '/static/art/desktops/' + r + '.logo.png',
  149. 'class': 'desktop-logo'
  150. }).inject($('bg'), 'top');
  151. new Element('img', {
  152. src: '/static/art/desktops/' + r + '.jpg',
  153. 'class': 'desktop-bg',
  154. events: {
  155. load: function(){
  156. //after they load, crossfade
  157. new Fx.Elements([bg, logo], {duration: 500}).start({
  158. '0': {
  159. 'opacity': 0
  160. },
  161. '1': {
  162. 'opacity': 0
  163. }
  164. }).chain(function(){
  165. bg.destroy();
  166. logo.destroy();
  167. });
  168. }
  169. }
  170. }).inject($('bg'), 'top');
  171. };
  172. })();
  173. </script>
  174. </div>
  175. <div id="browserWarn">Hue is best experienced in <a target="browsers" href="http://getfirefox.com">Mozilla Firefox</a>, <a target="browsers" href="http://www.apple.com/safari/">Apple Safari</a>, or <a target="browsers" href="http://www.google.com/chrome">Google Chrome</a> <a id="closeWarning"></a></div>
  176. <div id="ccs-desktop" class="ccs-shared">
  177. <div id="ccs-topnav">
  178. <div id="ccs-toolbar">
  179. <img src="/static/art/favicon.png" width="16" height="16" class="ccs-swoosh">
  180. <span>
  181. Hi
  182. <span id="ccs-profileLink"></span>
  183. <span id="ccs-logout">
  184. [<a href="/accounts/logout">logout</a>]
  185. </span>
  186. </span>
  187. <a id="hotkeys" title="show keyboard shortcuts">
  188. <img src="/static/art/shortcut.png"> Shortcuts
  189. </a>
  190. </div>
  191. </div>
  192. <div id="ccs-dock">
  193. <div id="ccs-dock-content">
  194. <div id="ccs-dock-status" class="ccs-inline">
  195. <div id="ccs-dock-status-content">
  196. </div>
  197. </div>
  198. <span id="ccs-dock-icons">
  199. </span>
  200. </div>
  201. </div>
  202. <div id="ccs-loading">Launching Hue</div>
  203. <a id="ccs-feedback" href="${feedback_url}" target="_blank"><img src="/static/art/feedback-tab.png" width="76" height="26"/></a>
  204. </div>
  205. <script>
  206. if (Browser.Engine.trident) $(document.body).addClass('IEroot');
  207. </script>
  208. </body>
  209. </html>