Procházet zdrojové kódy

HUE-290. Make JFrame work stand-alone

* Removing / adapting / moving existing code that is now managed by the JFrame repo
Aaron Newton před 15 roky
rodič
revize
e7ce698940
69 změnil soubory, kde provedl 58 přidání a 6751 odebrání
  1. 5 6
      desktop/core/src/desktop/templates/index.mako
  2. 4 0
      desktop/core/static/css/shared.css
  3. 2 2
      desktop/core/static/css/windows.css
  4. 0 81
      desktop/core/static/js/Source/BehaviorFilters/Behavior.Autocomplete.js
  5. 0 42
      desktop/core/static/js/Source/BehaviorFilters/Behavior.CollapsingElements.js
  6. 0 81
      desktop/core/static/js/Source/BehaviorFilters/Behavior.ContextMenu.js
  7. 0 95
      desktop/core/static/js/Source/BehaviorFilters/Behavior.DataGroupToggle.js
  8. 0 100
      desktop/core/static/js/Source/BehaviorFilters/Behavior.FilterInput.js
  9. 0 136
      desktop/core/static/js/Source/BehaviorFilters/Behavior.FitText.js
  10. 0 36
      desktop/core/static/js/Source/BehaviorFilters/Behavior.FormValidatorScroller.js
  11. 0 43
      desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableCheckSelected.js
  12. 0 33
      desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableChromeHack.js
  13. 0 36
      desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableKeyboard.js
  14. 0 90
      desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableKeyboardKids.js
  15. 0 54
      desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableLiveTreeKeyboard.js
  16. 0 69
      desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableMultiSelectMenu.js
  17. 0 52
      desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableRestore.js
  18. 0 41
      desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableUpdate.js
  19. 0 66
      desktop/core/static/js/Source/BehaviorFilters/Behavior.MultiChecks.js
  20. 0 30
      desktop/core/static/js/Source/BehaviorFilters/Behavior.PostEditor.js
  21. 0 61
      desktop/core/static/js/Source/BehaviorFilters/Behavior.SelectWithOther.js
  22. 0 45
      desktop/core/static/js/Source/BehaviorFilters/Behavior.SideBySideSelect.js
  23. 0 74
      desktop/core/static/js/Source/BehaviorFilters/Behavior.SizeTo.js
  24. 0 37
      desktop/core/static/js/Source/BehaviorFilters/Behavior.SplitViewPostFold.js
  25. 0 54
      desktop/core/static/js/Source/BehaviorFilters/Behavior.SplitViewScroller.js
  26. 0 80
      desktop/core/static/js/Source/BehaviorFilters/Behavior.SubmitOnChange.js
  27. 0 45
      desktop/core/static/js/Source/BehaviorFilters/Behavior.Tabs.js
  28. 0 45
      desktop/core/static/js/Source/BehaviorFilters/Behavior.Timer.js
  29. 0 85
      desktop/core/static/js/Source/BehaviorFilters/Behavior.Tips.js
  30. 0 185
      desktop/core/static/js/Source/CCS/CCS.ContextMenu.js
  31. 1 139
      desktop/core/static/js/Source/CCS/CCS.Desktop.Config.js
  32. 6 60
      desktop/core/static/js/Source/CCS/CCS.Desktop.FlashMessage.js
  33. 0 188
      desktop/core/static/js/Source/CCS/CCS.Desktop.Keys.js
  34. 0 50
      desktop/core/static/js/Source/CCS/CCS.DropDown.js
  35. 0 39
      desktop/core/static/js/Source/CCS/CCS.Error.js
  36. 12 334
      desktop/core/static/js/Source/CCS/CCS.JBrowser.js
  37. 2 1027
      desktop/core/static/js/Source/CCS/CCS.JFrame.js
  38. 1 2
      desktop/core/static/js/Source/CCS/CCS.Request.js
  39. 0 195
      desktop/core/static/js/Source/CCS/CCS.SideScroller.js
  40. 0 106
      desktop/core/static/js/Source/CCS/CCS.js
  41. 0 177
      desktop/core/static/js/Source/Forms/EditInline.js
  42. 0 54
      desktop/core/static/js/Source/Forms/Form.Request.JSON.js
  43. 0 134
      desktop/core/static/js/Source/JFrameFilters/CCS.JFrame.AutoRefresh.js
  44. 0 32
      desktop/core/static/js/Source/JFrameFilters/CCS.JFrame.Clearfix.js
  45. 0 58
      desktop/core/static/js/Source/JFrameFilters/CCS.JFrame.DoubleClickDelegate.js
  46. 0 88
      desktop/core/static/js/Source/JFrameFilters/CCS.JFrame.FormRequest.js
  47. 0 40
      desktop/core/static/js/Source/JFrameFilters/CCS.JFrame.ToggleHistory.js
  48. 0 109
      desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.AjaxLoad.js
  49. 0 37
      desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.CheckAllOrNone.js
  50. 18 14
      desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.Chooser.js
  51. 0 47
      desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.ConfirmAndPost.js
  52. 0 38
      desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.FakeRefresh.js
  53. 0 34
      desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.HideParent.js
  54. 0 95
      desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.LivePath.js
  55. 0 37
      desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.Nav.js
  56. 0 34
      desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.NoScroll.js
  57. 0 49
      desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.PromptAndPost.js
  58. 0 33
      desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.Refresh.js
  59. 0 37
      desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.RefreshWithParams.js
  60. 0 69
      desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.SplitViewLinkers.js
  61. 0 54
      desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.SubmitLink.js
  62. 0 100
      desktop/core/static/js/Source/JFrameRenderers/CCS.JFrame.Alert.js
  63. 0 252
      desktop/core/static/js/Source/JFrameRenderers/CCS.JFrame.PartialRefresh.js
  64. 0 94
      desktop/core/static/js/Source/JFrameRenderers/CCS.JFrame.Prompt.js
  65. 0 480
      desktop/core/static/js/Source/JFrameRenderers/PartialUpdate.js
  66. 0 24
      desktop/core/static/js/Source/Native/Element.Data.js
  67. 0 399
      desktop/core/static/js/Source/UI/ART.SideBySideSelect.js
  68. 0 123
      desktop/core/static/js/Source/UI/StickyWin.Drawer.js
  69. 7 65
      desktop/core/static/js/package.yml

+ 5 - 6
desktop/core/src/desktop/templates/index.mako

@@ -32,7 +32,7 @@
   <link rel="stylesheet" href="/static/oocss/Grid.css">
   <link rel="stylesheet" href="/static/oocss/Icon.css">
 
-  <script src="/depender/build?client=true&require=dbug,DomReady,Cookie,Element.Dimensions,Element.Style,CCS.Desktop.BackgroundManager,Cookie,Clientcide"></script>
+  <script src="/depender/build?client=true&require=clientcide/dbug,Core/DomReady,Core/Cookie,Core/Element.Dimensions,Core/Element.Style,ccs-shared/CCS.Desktop.BackgroundManager,Core/Cookie,clientcide/Clientcide,ccs-shared/CCS.Request,ccs-shared/CCS.User,ccs-shared/CCS.Desktop.Config,JFrame/MooTools.Config,JFrame/FlashMessage,JFrame/JFrame.Keys,ccs-shared/CCS.Login,clientcide/StickyWin.PointyTip,More/Element.Delegation,Core/Fx.Tween"></script>
   <!--[if IE 8]>
       <script>
           window.ie8 = true;
@@ -55,8 +55,7 @@
     }
     var appName = "Hue";
     Depender.require({
-      scripts: ["CCS.Request", "CCS.User", "CCS.Desktop.Config", "CCS.Desktop.FlashMessage",
-        "CCS.Desktop.Keys", "CCS.Login", "StickyWin.PointyTip", "Element.Delegation", "Fx.Tween", "Fx.Elements"],
+      scripts: ["More/Fx.Elements"],
       callback: function(){
         //get the background images
         var bgEls = $('bg').getElements('img');
@@ -85,10 +84,10 @@
           var launching = 'Launching ' + appName;
           var msg = loading;
           if (CCS.Desktop.hasLoaded(component)) msg = launching;
-          if (!CCS.Desktop.checkForFlashMessage(loading) && 
-              !CCS.Desktop.checkForFlashMessage(launching) && 
+          if (!FlashMessage.checkForFlashMessage(loading) && 
+              !FlashMessage.checkForFlashMessage(launching) && 
               !$$('.loadingmsg').length) {
-                growled[component] = CCS.Desktop.flashMessage(msg, 10000);
+                growled[component] = FlashMessage.flash(msg, 10000);
           }
         };
         var clearGrowl = function(component) {

+ 4 - 0
desktop/core/static/css/shared.css

@@ -8,6 +8,10 @@
 	font-family: "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", Helvetica, Arial, sans-serif;
 	font-size: 12px;
 }
+.hue-shared .view {
+	height: inherit;
+	width: inherit;
+}
 /* all links default styles */
 .ccs-shared a:visited,
 .ccs-shared a:link {

+ 2 - 2
desktop/core/static/css/windows.css

@@ -30,8 +30,8 @@ div.solid-win a.ccs-close {
 	z-index: 1;
 	bottom: -48px;
 	left: 81px;
-	width: 33px;
-	height: 33px;
+	width: 37px;
+	height: 37px;
 	border: none;
 	background: url(/static/art/blue-continue.png) top left;
 	text-indent: -200px;

+ 0 - 81
desktop/core/static/js/Source/BehaviorFilters/Behavior.Autocomplete.js

@@ -1,81 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*
----
-description: Adds support for Autocompletion on form inputs.
-provides: [Behavior.Autocomplete]
-requires: [Widgets/Behavior, clientcide/Autocompleter.Local, clientcide/Autocompleter.Remote]
-script: Behavior.Autocomplete.js
-
-...
-*/
-
-Behavior.addGlobalFilters({
-
-	/*
-		takes elements (inputs) with the data filter "Autocomplete" and creates a autocompletion ui for them
-		that either completes against a list of terms supplied as a property of the element (dtaa-autocomplete-tokens)
-		or fetches them from a server. In both cases, the tokens must be an array of values. Example:
-
-		<input data-filters="Autocomplete" data-autocomplete-tokens="['foo', 'bar', 'baz']"/>
-
-		Alternately, you can specify a url to submit the current typed token to get back a list of valid values in the
-		same format (i.e. a JSON response; an array of strings). Example:
-
-		<input data-filters="Autocomplete" data-autocomplete-url="/some/API/for/autocomplete"/>
-
-		When the values ar fetched from the server, the server is sent the current term (what the user is typing) as
-		a post variable "term" as well as the entire contents of the input as "value".
-
-		An additional data property for autocomplete-options can be specified; this must be a JSON encoded string
-		of key/value pairs that configure the Autocompleter instance (see documentation for the Autocompleter classes
-		online at http://www.clientcide.com/docs/3rdParty/Autocompleter but also available as a markdown file in the
-		clientcide repo fetched by hue in the thirdparty directory).
-
-		Note that this JSON string can't include functions as callbacks; if you require amore advanced usage you should
-		write your own Behavior filter or filter plugin.
-
-	*/
-
-	Autocomplete: function(element, methods){
-		var options = $merge({
-			minLength: 1,
-			selectMode: 'type-ahead',
-			overflow: true,
-			selectFirst: true,
-			multiple: true,
-			separator: ' ',
-			allowDupes: true,
-			postVar: 'term'
-		}, element.getJSONData('autocomplete-options'));
-
-		if (element.getData('autocomplete-url')) {
-			var aaj = new Autocompleter.Ajax.Json(element, element.getData('autocomplete-url'), options);
-			aaj.addEvent('request', function(el, req, data, value){
-				data['value'] = el.get('value');
-			});
-		} else {
-			var tokens = element.getJSONData('autocomplete-tokens');
-			if (!tokens) {
-				dbug.warn('Could not set up autocompleter; no local tokens found.');
-				return;
-			}
-			new Autocompleter.Local(element, tokens, options);
-		}
-	}
-
-});

+ 0 - 42
desktop/core/static/js/Source/BehaviorFilters/Behavior.CollapsingElements.js

@@ -1,42 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Instantiates a Collapsible class for all matched elements with .collapser and .collapsible css classes within an element with the CollapsingElements data-filters property.
-provides: [Behavior.CollapsingElements]
-requires: [Widgets/Behavior, More/Fx.Reveal]
-script: Behavior.Collapsible.js
-
-...
-*/
-
-Behavior.addGlobalFilters({
-
-	CollapsingElements: function(element, methods) {
-		element.addEvent('click:relay(.collapser)', function(event, clicked) {
-			event.preventDefault();
-			var togglers = element.getElements('.collapser');
-			var sections = element.getElements('.collapsible');
-			if(togglers.length != sections.length) {
-				dbug.warn("CollapsingElements filter exiting; togglers length (%s) != sections length (%s)", togglers.length, sections.length);
-				return;
-			}
-			var section = sections[togglers.indexOf(clicked)];
-			if (section) section.get('reveal').toggle();
-		});
-	}
-
-});

+ 0 - 81
desktop/core/static/js/Source/BehaviorFilters/Behavior.ContextMenu.js

@@ -1,81 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*
----
-description: Adds context menu support for any element with a data-context-menu-actions property and the ContextMenu data-filter. See the CCS.ContextMenu class for details on usage.
-provides: [Behavior.ContextMenu]
-requires: [Widgets/Behavior, /CCS.ContextMenu]
-script: Behavior.ContextMenu.js
-...
-*/
-
-(function(){
-
-//subclass CCS.ContextMenu to create one that knows about JFrame
-
-var JframeContextMenu = new Class({
-	Extends: CCS.ContextMenu,
-	options: {
-		//jframe: null,
-		adjustLocation: false
-	},
-	initialize: function(){
-		//create a placeholder for when we pop menus out of the jframe (so we can put them back)
-		this._placeHolder = new Element('div').hide();
-		this.parent.apply(this, arguments);
-		//pointer to the jframe; it's wrapped in function to prevent a recurssion issue - 
-		//when you run a class instance through $merge (which setOptions does) you get one...
-		//this._jframe = $lambda(this.options.jframe)();
-		this.applyDelegates = this.options.applyDelegates;
-	},
-	show: function(x, y){
-		if (this.disabled || !this.activeMenu) return;
-		//when the menu is shown, put the place holder after the menu
-		this._placeHolder.inject(this.activeMenu, 'after');
-		//move the menu into the container
-		this.activeMenu.inject(this.options.container);
-		//apply click delegates to it since it's likely no longer in the jframe (where the delegates start)
-		this.applyDelegates(this.activeMenu);
-		this.parent(x, y);
-	},
-	hide: function(){
-		if (this.disabled || !this.activeMenu) return;
-		//when we hide the menu, put the menu back where it was and pop the placeholder out of the DOM
-		this.activeMenu.inject(this._placeHolder, 'after');
-		this._placeHolder.dispose();
-		this.parent();
-	}
-});
-
-Behavior.addGlobalFilters({
-
-	//intercept right click behaviors
-	ContextMenu: function(element, methods){
-		//create an instance of CCS.Context menu for each delegate
-		var menu = new JframeContextMenu(element, {
-			applyDelegates: methods.applyDelegates, //pass a function that wraps this jframe instance
-			container: methods.getContentElement() //inject the menu into the container outside the jframe
-		});
-		//detatch these whenever we unload jframe
-		this.markForCleanup(element, function(){
-				menu.detach();
-		});
-	}
-
-});
-
-})();

+ 0 - 95
desktop/core/static/js/Source/BehaviorFilters/Behavior.DataGroupToggle.js

@@ -1,95 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Toggles the display of a group of elements when an element with DataGroupToggle in its data-filters property is clicked or changed 
-provides: [Behavior.DataGroupToggle]
-requires: [Widgets/Behavior, Widgets/Element.Data]
-script: Behavior.DataGroupToggle.js
-
-...
-*/
-
-Behavior.addGlobalFilters({
-	DataGroupToggle: function(element, methods){
-		container = methods.getContentElement();
-		var selectHandler = function(event) {
-			var selected = element.getSelected()[0];
-			var toggleData = selected.get('data', 'group-toggle', true);
-			if(!toggleData) {
-				dbug.warn("data-group-toggle either not present or unparseable.");
-				return;
-			}
-			var sections = container.getElements(toggleData.group);
-			if(!sections.length) {
-				dbug.warn("Search using data-group-toggle[group] as selector returned no elements.");
-				return;
-			}
-			//If toggleData.show is undefined, then display none of the sections.
-			var show = [];
-			if(toggleData.show) show = container.getElements(toggleData.show);
-			if(toggleData.show && !show.length) {
-				dbug.warn("Search using data-group-toggle[show] as selector returned no elements.");
-				return;
-			}
-			sections.each(function(section) {
-				if(!show.contains(section)) {
-					section.hide();
-				} else if (!section.isDisplayed()) {
-					section.show();
-				}
-			});
-		};
-		var linkHandler = function(event) {
-			var toggleData = element.get('data', 'group-toggle', true);
-			if(!toggleData) {
-				dbug.warn("data-group-toggle either not present or unparseable.");
-				return;
-			} 
-			var sections = container.getElements(toggleData.group);
-			if(!sections.length) {
-				dbug.warn("Search using data-group-toggle[group] as selector returned no elements.");
-				return;
-			}
-			var show = container.getElements(toggleData.show);
-			if(!show.length) {
-				dbug.warn("search using data-group-toggle[show] as selector returned no elements.");
-				return;
-			}
-			sections.each(function(section) {
-				if(!show.contains(section)) {
-					section.hide();
-				} else if (!section.isDisplayed()) {
-					section.show();
-				}
-			});
-		};
-		if(element.tagName == 'SELECT') {
-			element.addEvent('change', selectHandler);
-			selectHandler();
-			this.markForCleanup(element, function(){
-				element.removeEvent('change', selectHandler);
-			});
-		} else {
-			element.addEvent('click', linkHandler);
-			this.markForCleanup(element, function(){
-				element.removeEvent('click', linkHandler);
-			}); 
-		}
-	}
-
-});
-

+ 0 - 100
desktop/core/static/js/Source/BehaviorFilters/Behavior.FilterInput.js

@@ -1,100 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*
----
-description: Behavior filter to filter elements based on the value of a text box with "FilterInput" in its data-filters property, when that text box is changed.
-provides: [Behavior.FilterInput]
-requires: [Widgets/Behavior, Widgets/Element.Data]
-script: Behavior.FilterInput.js
-...
-*/
-
-Behavior.addGlobalFilters({
-	/*
-		data-filter-elements: css selector for group of elements to filter against
-		data-filter-parent: optional, css parent selector, from element, of element to hide/display
-		TODO:  Deal with other types of data to filter relationships.  (sibling, child, etc.)
-	*/
-
-	FilterInput: function(element, methods){
-		var container = methods.getContentElement();
-		//this method will find all the elements and check them for the value
-		var selector = element.get('data', 'filter-elements');
-		if (!selector) {
-			dbug.warn('warning, there was no selector defined for data-filter-elements for this element: ', element);
-			return;
-		}
-		var filterParents = element.get('data', 'filter-parents');
-		var filter = function (){
-			var elements = container.getElements(selector);
-			if (!elements.length) {
-				dbug.warn('warning, this filter element %o has data-filter-elements selector defined as %s but this selector matches no elements.', element, selector);
-				return;
-			}
-			var value = element.get('value').toLowerCase();
-			var parents = new Table();
-			elements.each(function(el){
-				//if the filter value is empty, or the element contains the value
-				var show = !value || el.get('html').toLowerCase().contains(value);
-				//then show the parent:
-				//get the parent or, if there is no parent defined, show/hide the element
-				var parent = filterParents ? el.getParent(filterParents) : el;
-				//if we haven't defined a value for this parent yet, then set it
-				if (parents.get(parent) == undefined) parents.set(parent, show);
-				//else, if we're showing set it to true
-				else if (show) parents.set(parent, true);
-			});
-			//for each parent, check its state and show it
-			parents.each(function(parent, show) {
-				if(show) {
-					display = "block";
-					switch(parent.get('tag')){
-						case "tr":
-							display = "table-row";
-							break;
-						case "td":
-							display = "table-cell";
-							break;
-						case "table":
-							display = "table";
-							break;
-					}
-					parent.show(display);
-				} else {
-					parent.hide();
-				}
-			});
-			element.fireEvent('filter', parents);
-		};
-		var inputValue = element.get('value');
-		//if there's a predefined value on startup, run the filter
-		if (inputValue) filter();
-
-		var fitEvent = function(){
-			if (inputValue != element.get('value')){
-				inputValue = element.get('value');
-				filter();
-			}
-		};
-
-		element.addEvent('change', fitEvent);
-		this.markForCleanup(element, function(){
-			element.removeEvent('change', fitEvent);
-		});
-	}
-	
-});

+ 0 - 136
desktop/core/static/js/Source/BehaviorFilters/Behavior.FitText.js

@@ -1,136 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Automatically sizes text to fit an element adding an elipse to the text using the FitText plugin for any elements with the FitText data-filter.
-provides: [Behavior.FitText]
-requires: [Widgets/Behavior, FitText/FitText]
-script: Behavior.FitText.js
-
-...
-*/
-
-(function(){
-	if (Browser.Engine.trident) return; //disable this for now as it's broken IE; bug #
-	/*
-		implements the FitText filter on an element; attaches to Behavior for events on resize
-		filter - the Behavior filter instance
-		element - the element to instantiate FitText against
-		methods - the Behavior methods object passed into the filter
-		garbageElement - (optional) if the element passed to the filter is not the one having 
-		     FitText applied, pass in the filter element for garbage collection marking
-	*/
-	var fitIt = function(filter, element, methods, garbageElement){
-		if (element.get('tag') == 'td' || element.getParent('table')) {
-			fixTable(element.getParent('table'));
-			if (element.get('tag') == 'td') element.setStyles(tdStyles);
-			else element.getParent('td').setStyles(tdStyles);
-		}
-		
-		if (element.getChildren().length > 0) {
-			dbug.warn('attempting to truncate an element (%o) that has child elements; this is not permitted.', element);
-			return;
-		}
-		var text = element.get('text');
-		var span = new Element('span', {
-			text: text,
-			styles: {
-				'white-space': 'nowrap'
-			}
-		}).inject(element.empty());
-
-		//because FitText requires element measurement, don't create an instance
-		//until after the element is visible.
-		var fitter = function(){
-			if (!element.isVisible()) {
-				//not ready; call again when the thread is released
-				fitter.delay(1);
-			} else {
-				var options = {};
-				var offset = element.get('data', 'fit-text-offset', true);
-				if (offset != null) options.offset = offset;
-				var fitText = new FitText(element, span, options);
-				//detach the window resize events that FitText attaches itself
-				fitText.detach();
-				fitText.fit();
-				element.store('FitText', fitText).set('title', text);
-				var fitTextFit = fitText.fit.bind(fitText);
-				//rerun this after a while, as some filters muck about w/ the DOM
-				//I'm not crazy about this solution, but it'll have to do for now
-				fitTextFit.delay(10); 
-				methods.addEvent('show', fitTextFit);
-				filter.markForCleanup(garbageElement || element, function(){
-					methods.removeEvent('show', fitTextFit);
-				});
-			}
-		};
-		fitter();
-	};
-
-	var tdStyles = {
-		'max-width': 200, //this number doesn't seem to matter, really
-		'overflow': 'hidden'
-	};
-
-	var fixTable = function(table) {
-		if (!table || table.retrieve('fittext:fixed')) return;
-		table.store('fittext:fixed', true);
-		table.getElements('tbody td').setStyles(tdStyles);
-	};
-	
-
-	Behavior.addGlobalFilters({
-
-		/*
-			truncates text automatically for elements with the class .ccs-truncate
-			elements cannot have child elements (only text)
-		*/
-
-		FitText: function(element, methods) {
-			fitIt(this, element, methods);
-		},
-
-		/*
-			finds all elements wth data-fit-text properties - these properties must be selectors
-			for the elements to apply the FitText class to.
-		*/
-		'FitText-Children': function(element, methods){
-			var selector = element.get('data', 'fit-text');
-			element.getElements(selector).each(function(el){
-				fitIt(this, el, methods, element);
-			}, this);
-		}
-
-	});
-
-	Behavior.addGlobalPlugin('HtmlTable', 'FitTextResize', function(element, methods) {
-		if(element.hasClass('resizable')) {
-			htmlTable = element.retrieve('HtmlTable');
-			htmlTable.addEvent('columnResize', function() {
-				if(element.hasDataFilter('FitText-Children')) {
-					var selector = element.get('data', 'fit-text');
-					element.getElements(selector).each(function(el){
-						el.retrieve('FitText').fit();
-					}, this);
-				}
-				element.getElements('[data-filters*=FitText]').each(function(el) {
-					el.retrieve('FitText').fit();
-				});
-			});
-		}
-	});
-
-})();

+ 0 - 36
desktop/core/static/js/Source/BehaviorFilters/Behavior.FormValidatorScroller.js

@@ -1,36 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Makes form validator instances scroll the jframe to the errors.
-provides: [Behavior.FormValidatorScroller]
-requires: [Widgets/Behavior.FormValidator]
-script: Behavior.FormValidatorScroller.js
-...
-*/
-
-Behavior.addGlobalPlugin('FormValidator', 'FormValidatorScroller', function(element, methods){
-	var validator = element.retrieve('validator');
-	validator.setOptions({
-		onShow: function(input, advice, className) {
-			//scroll to errors within the jframe
-			/*JFrame Reference */
-			methods.getScroller().toElement(input);
-		},
-		//not the window
-		scrollToErrorsOnSubmit: false
-	});
-});

+ 0 - 43
desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableCheckSelected.js

@@ -1,43 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Adds support for automatically selecting a hidden checkbox/radio button for each selected row of an HtmlTable.
-provides: [Behavior.HtmlTableCheckSelected]
-requires: [Widgets/Behavior.HtmlTable]
-script: Behavior.HtmlTableCheckSelected.js
-...
-*/
-;(function(){
-
-function rowFocusHandler(row, selectedRows){
-	var box = row.getElement('input[type=checkbox], input[type=radio]');
-	if (!box) return;
-	box.set('checked', selectedRows.contains(row));
-}
-
-var events = {
-	rowFocus: rowFocusHandler,
-	rowUnfocus: rowFocusHandler
-};
-
-function HtmlTableCheckSelected(element){
-	element.retrieve('HtmlTable').addEvents(events);
-}
-
-Behavior.addGlobalPlugin('HtmlTable', 'HtmlTableCheckSelected', HtmlTableCheckSelected);
-
-}());

+ 0 - 33
desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableChromeHack.js

@@ -1,33 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Hack to make tables not jump around in Chrome.
-provides: [Behavior.HtmlTableChromeHack]
-requires: [Widgets/Behavior.HtmlTable]
-script: Behavior.HtmlTableChromeHack.js
-...
-*/
-
-if (Browser.Engine.webkit) {
-	Behavior.addGlobalPlugin('HtmlTable', 'HtmlTableChromeHack', function(element, methods) {
-		var width = element.style.width;
-		element.setStyle('width', '99%');
-		(function() {
-			element.style.width = width;
-		}).delay(1);
-	});
-}

+ 0 - 36
desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableKeyboard.js

@@ -1,36 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Makes form validator instances scroll the jframe to the errors.
-provides: [Behavior.HtmlTableKeyboard]
-requires: [Widgets/Behavior.HtmlTable]
-script: Behavior.HtmlTableKeyboard.js
-...
-*/
-
-Behavior.addGlobalPlugin('HtmlTable', 'HtmlTableJFrame', function(element, methods){
-	var table = element.retrieve('HtmlTable');
-	if (table.keyboard) {
-		table.keyboard.relinquish();
-		methods.registerKeyboard(table.keyboard);
-		table.keyboard.activate();
-		this.markForCleanup(element, function(){
-			methods.unregisterKeyboard(table.keyboard);
-		});
-		ART.Popup.DefaultManager.keyboard.activate();
-	}
-});

+ 0 - 90
desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableKeyboardKids.js

@@ -1,90 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Adds support for children of an HtmlTable to declare keyboard shortcuts
-provides: [Behavior.HtmlTableKeyboardKids]
-requires: [Widgets/Behavior.HtmlTable]
-script: Behavior.HtmlTableKeyboardKids.js
-...
-*/
-;(function(){
-
-function buildShortcutForElement(shortcutElement, attrMap, shortcutMap){
-	/*
-		shortcutElement     -- the element that defines this shortcut
-		attrMap             -- object that maps the attribute to get the keys value from
-		attrMap.keys        -- string to use to lookup the `keys` attribute for ths shortcut
-		attrMap.description -- string to use to lookup the `description` attribute for ths shortcut
-		attrMap.handler     -- function to call when the shortcut event gets triggered.
-		                         function(event, shortcutElement){ Cf. Keyboard for more info }
-		                         Note: This function is loosely referenced by key,
-		                           Changing attrMap.handler instantly updates the shortcut handler.
-		shortcutMap         -- (optional) an existing object to append to
-	*/
-	if (!shortcutMap) shortcutMap = {};
-	var shortcutObject = {};
-	shortcutObject.keys = shortcutElement.get(attrMap.keys || 'data-accesskey');
-	// Don't add this shortcut if there's no `keys`
-	if (!shortcutObject.keys) return shortcutMap;
-	shortcutObject.description = shortcutElement.get(attrMap.description || 'title') || shortcutElement.get('alt');
-	shortcutObject.handler = function(event){
-		// delay to work around an issue where...
-		//   keydown triggers this & another action
-		//   keyup then may trigger a third action unexpectedly
-		//   this delay works around unintentionally triggering that third action
-		//   by allowing some time for the first action to be completely handled
-		attrMap.handler.delay(100, this, [event, shortcutElement]);
-	};
-	shortcutMap[shortcutElement.get(attrMap.name || 'text')] = shortcutObject;
-	return shortcutMap;
-}
-
-function buildShortcuts(shortcutElements, attrMap, shortcutMap){
-	// Same as buildShortcutForElement,
-	//   but it takes an array-like object of elements instead of a single element
-	if (!shortcutMap) shortcutMap = {};
-	for (var i = -1, el; el = shortcutElements[++i];){
-		buildShortcutForElement(el, attrMap, shortcutMap)
-	}
-	return shortcutMap;
-}
-
-Behavior.addGlobalPlugin('HtmlTable', 'HtmlTableKeyboardKids', function(htmlTableElement, behaviorAPI){
-	// Since every HtmlTable Behavior GlobalPlugin runs for every HtmlTable instance,
-	//   we need to limit this plugin to only those instances that opt-in
-	if (!(htmlTableElement && htmlTableElement.hasClass('keyboardkids'))) return;
-	var htmlTable = htmlTableElement.retrieve('HtmlTable');
-	if (!htmlTable) return;
-	var keyboard = htmlTable.keyboard;
-	if (!keyboard) return;
-
-	keyboard.addShortcuts(
-		buildShortcuts(
-			htmlTableElement.getElements('thead [data-accesskey]'),
-			{
-				name: 'text',
-				keys: 'data-accesskey',
-				description: 'title',
-				handler: function(event, shortcutElement) {
-					behaviorAPI.callClick(event, shortcutElement, true);
-				}
-			}
-		)
-	);
-});
-
-}());

+ 0 - 54
desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableLiveTreeKeyboard.js

@@ -1,54 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Adds keyboard support for live loading trees - integrates key navigation with the livepath linker.
-provides: [Behavior.HtmlTableLiveTreeKeyboard]
-requires: [Widgets/Behavior.HtmlTable]
-script: Behavior.HtmlTableLiveTreeKeyboard.js
-...
-*/
-(function(){
-
-var checkLinkerForLivePath = function(anchor, methods){
-	['[data-livepath-toggle]', '[data-livepath-add]', '[data-livepath-replace]'].some(function(selector){
-		if (anchor.match(selector)) {
-			methods.invokeLinker(selector, anchor, { stop: $empty, preventDefault: $empty, stopPropagation: $empty});
-			return true;
-		}
-	});
-};
-
-Behavior.addGlobalPlugin('HtmlTable', 'HtmlTableLiveTreeKeyboard', function(element, methods){
-	if (!element.hasClass('treeView')) return;
-	var table = element.retrieve('HtmlTable');
-	table.addEvent('onHideRow', function(row){
-		if (row.get('data-partial-line-id')) row.destroy();
-	});
-	table.addEvent('expandSection', function(row){
-		var anchor = row.getElement('.expand');
-		if (anchor) methods.callClick({ stop: $empty, preventDefault: $empty, stopPropagation: $empty}, anchor, true);
-	}.bind(this));
-	table.addEvent('closeSection', function(row){
-		var anchor = row.getElement('.expand');
-		if (anchor) checkLinkerForLivePath(anchor, methods);
-	});
-	$(table).addEvent('click:relay(.expand)', function(event, link){
-		event.stop();
-	});
-});
-
-})();

+ 0 - 69
desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableMultiSelectMenu.js

@@ -1,69 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Adds support for HtmlTable context menus for multiple selected rows.
-provides: [Behavior.HtmlTableMultiSelectMenu]
-requires: [Widgets/Behavior.HtmlTable, /Behavior.ContextMenu]
-script: Behavior.HtmlTableMultiSelectMenu.js
-...
-*/
-Behavior.addGlobalPlugin('HtmlTable', 'HtmlTableMutiSelect', function(element, methods){
-	var table = element.retrieve('HtmlTable');
-	var previousSelected;
-	//check if the table has a context menu for bulk edits
-	//and we can multi-select things
-	if (table.options.allowMultiSelect && element.hasDataFilter('ContextMenu')) {
-		//wait for a short period to get the table's context menu; we have no guarantee
-		//that its been created before this filter runs
-		var tableMenu;
-		(function(){
-			tableMenu = element.retrieve('ContextMenu');
-			if (tableMenu) tableMenu.disable();
-		}).delay(10);
-		//when the user selects a row
-		table.addEvent('rowFocus', function(row, selectedRows){
-			//if there is no context menu on the table, then exit
-			if (!tableMenu) return;
-			var action;
-			//if there was a previously selected group of menus, re-enable them.
-			if (previousSelected) {
-				previousSelected.each(function(trMenu){
-					trMenu.enable();
-				});
-				previousSelected.empty();
-			}
-			//if the user has selected more than one row
-			if (selectedRows.length > 1) {
-				//enable the table's menu
-				tableMenu.enable();
-				//loop through the selected rows and disable their menus
-				//this allows the right click event to travel past the table row level and up to the table
-				//so the bulk action menu is displayed
-				previousSelected = selectedRows.map(function(tr){
-					var trMenu = tr.retrieve('ContextMenu');
-					if (trMenu) trMenu.disable();
-					return trMenu;
-				}).clean();
-			} else {
-				if (row.hasDataFilter('ContextMenu')) tableMenu.disable();
-				//otherwise, if there aren't multiple rows selected, disable the table's menu
-				else tableMenu.enable();
-			}
-		});
-	}
-
-});

+ 0 - 52
desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableRestore.js

@@ -1,52 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Makes HtmlTable instances retain their state on refresh.
-provides: [Behavior.HtmlTableRestore]
-requires: [Widgets/Behavior.HtmlTable]
-script: Behavior.HtmlTableRestore.js
-...
-*/
-
-Behavior.addGlobalPlugin('HtmlTable', 'HtmlTableRestore', function(element, methods){
-	var table = element.retrieve('HtmlTable');
-	//Get tables in the current frame
-	var tables = methods.getContentElement().getElements('[data-filters*=HtmlTable]');
-	var tableIndex = tables.indexOf(element);
-	var tableState = methods.getBehaviorState().tableState;
-	var loadEvent = function(loadOptions) {
-		//On load, if there is a previous page and it's the same as the current page, and there's a state array and this state array has the same number of entries as there are tables in the frame, restore the state.
-		if(loadOptions.previousPath && loadOptions.previousPath == loadOptions.requestPath && tableState && tableState.length == tables.length && tableState[tableIndex]) {
-			table.restore(tableState[tableIndex]);
-		} else if(tableState && tableState[tableIndex]) {
-			delete tableState;
-		}
-	};
-	methods.addEvent('load', loadEvent);
-	var changeEvent = function() {
-		//On change, create the tableState array and the particular index needed, if necessary.  Then store the serialized state.
-		if(!methods.getBehaviorState().tableState) methods.getBehaviorState().tableState = [];
-		tableState = methods.getBehaviorState().tableState;
-		if(!tableState[tableIndex]) tableState[tableIndex] = {};
-		tableState[tableIndex] = this.serialize();
-	};
-	table.addEvent('stateChanged', changeEvent);
-	this.markForCleanup(element, function() {
-		methods.removeEvent('load', loadEvent);
-		table.removeEvent('stateChanged', changeEvent);
-	});
-});

+ 0 - 41
desktop/core/static/js/Source/BehaviorFilters/Behavior.HtmlTableUpdate.js

@@ -1,41 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Updates HtmlTable states when the JFrame contents are updated (via Ajax/partial refresh).
-provides: [Behavior.HtmlTableUpdate]
-requires: [Widgets/Behavior.HtmlTable]
-script: Behavior.HtmlTableUpdate.js
-...
-*/
-
-Behavior.addGlobalPlugin('HtmlTable', 'HtmlTableUpdate', function(element, methods){
-	var table = element.retrieve('HtmlTable');
-	var refresh = function(data, options){
-		var refresh;
-		data.elements.each(function(element){
-			if (!refresh && ['td','th','tbody','tr','thead','tfoot'].contains(element.get('tag')) && $(table).hasChild(element)) {
-				refresh = true;
-			}
-		});
-		if (refresh) table.refresh();
-		$(table).getElements('.table-expanded a.expand').addClass('jframe_ignore');
-	};
-	methods.addEvent('update', refresh);
-	this.markForCleanup(element, function(){
-		methods.removeEvent('update', refresh);
-	});
-});

+ 0 - 66
desktop/core/static/js/Source/BehaviorFilters/Behavior.MultiChecks.js

@@ -1,66 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*
----
-description: Allows users to hold down shift to select multiple check boxes.
-provides: [Behavior.MultiChecks]
-requires: [Widgets/Behavior]
-script: Behavior.MultiChecks.js
-...
-*/
-(function(){
-	var checkInput = function(input, checked) {
-		input.set('checked', checked).fireEvent('change');
-	};
-	
-	Behavior.addGlobalFilters({
-
-		MultiChecks: function(element, events) {
-			var prev;
-			//this method handles clicks to our checkboxes
-			var clickHandler = function(e, input){
-				//if there's a previously clicked input and the shift button is held
-				if (prev && e.shift) {
-					var active, check;
-					//get the state of the input, if it's checked, we're selecting things
-					//otherwise we're deselecting them
-					check = input.get('checked');
-					//get all the checkboxes in the element
-					element.getElements('input[type=checkbox]').each(function(el){
-						//if it's the element we checked, or it's the previous one checked
-						if (el == input || el == prev) {
-							//then check it and toggle our start state
-							checkInput(el, check);
-							active = !active;
-							return;
-						}
-						//if we're active, check the input
-						if (active) checkInput(el, check);
-					});
-				}
-				//store the clicked element as the new one.
-				prev = input;
-			};
-			element.addEvent('click:relay(input[type=checkbox])', clickHandler);
-			this.markForCleanup(element, function(){
-				element.removeEvent('click:relay(input[type=checkbox])', clickHandler);
-			});
-		}
-
-	});
-
-})();

+ 0 - 30
desktop/core/static/js/Source/BehaviorFilters/Behavior.PostEditor.js

@@ -1,30 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Creates a SimplePostEditor of any textarea with PostEditor in its data-filters property. 
-provides: [Behavior.PostEditor]
-requires: [Widgets/Behavior, clientcide/PostEditor]
-script: Behavior.PostEditor.js
-...
-*/
-
-Behavior.addGlobalFilters({
-        PostEditor: function(element, methods) {
-                var postEditor = new PostEditor(element);
-        }
-});
-

+ 0 - 61
desktop/core/static/js/Source/BehaviorFilters/Behavior.SelectWithOther.js

@@ -1,61 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Displays an input field when the user chooses "other" in a select input in an element with "SelectWithOther" in its data-filters property.
-provides: [Behavior.SelectWithOther]
-requires: [Widgets/Behavior,More/Fx.Reveal,More/OverText]
-script: Behavior.SelectWithOther.js
-...
-*/
-
-Behavior.addGlobalFilters({
-	SelectWithOther: function(element, methods) {
-		//get the 'other' input / container
-		var other = element.getElement(element.get('data', 'other-input') || 'input');
-		var input = other;
-		var otherOptions = element.getElements(element.get('data', 'other-options') || 'option[value=__other__]');
-		//if the "other" element is not an input, it must be a container that contains one
-		if (!['input', 'select', 'textarea'].contains(other.get('tag'))) input = other.getElement('input, textarea');
-		other.hide();
-		//get the select input
-		var sel = element.getElement('select');
-		//when the select changes, if the user chooses "other"
-		//reveal the input, enable the overtext
-		sel.addEvent('change', function() {
-			var ot = input.retrieve('OverText');
-			if (otherOptions.contains(sel.getSelected()[0])) {
-				input.removeClass('ignoreValidation');
-				if (ot) {
-					other.get('reveal').chain(function(){
-						ot.enable();
-					});
-				}
-				other.reveal();
-			//else hide and disable the input
-			} else {
-				if (ot) ot.disable();
-				input.addClass('ignoreValidation');
-				other.dissolve();
-			}
-		});
-		if (ot) {
-			this.markForCleanup(element, function(){
-				ot.destroy();
-			});
-		}
-	}
-});

+ 0 - 45
desktop/core/static/js/Source/BehaviorFilters/Behavior.SideBySideSelect.js

@@ -1,45 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*
----
-description: Automatically turns multi select inputs into an instance of ART.SideBySideSelect.
-provides: [Behavior.SideBySideSelect]
-requires: [Widgets/Behavior, /ART.SideBySideSelect]
-script: Behavior.SideBySideSelect.js
-...
-*/
-
-Behavior.addGlobalFilters({
-
-	SideBySideSelect: function(element, events) {
-		if (element.get('tag') != 'select' && element.get('multiple')){
-			dbug.warn("Side_by_side_select element %o does not contain multiple=true.", element);
-			return;
-		}
-		var parent = element.get('parentWidget');
-		var sbs = new ART.SideBySideSelect(element);
-
-		//inject our new widget into the DOM and the widget tree (if there is a parent widget)
-		if (parent) sbs.inject(parent, element, 'after');
-		else widget.inject(element, element, 'after');
-
-		this.markForCleanup(element, function(){
-			sbs.destroy();
-		});
-	}
-
-});

+ 0 - 74
desktop/core/static/js/Source/BehaviorFilters/Behavior.SizeTo.js

@@ -1,74 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Allows an element with the SizeTo value in its data-filters property to be sized to the dimensions of the jframe portion of the window.
-provides: [Behavior.SizeTo]
-requires: [Widgets/Element.Data]
-script: Behavior.SizeTo.js
-
-...
-*/
-
-Behavior.addGlobalFilters({
-
-	/*
-		elements are given data properties for data-size-to-height or data-size-to-width
-		these values are either offsets or percentages. So, for example:
-		
-			<div data-filters="SizeTo" data-size-to-height="-100"></div>
-		
-		will size that div to the height of the window -100 pixels and
-                        <div data-filters="SizeTo" data-size-to-width="90%"></div>
-                        
-                will size that div to 90% of the width of the window.
-                
-                Both values are not required, although one is.
- 	*/
-	SizeTo: function(element, methods) {
-		var sizeTo = {
-			x: element.get('data', 'size-to-width'),
-			y: element.get('data', 'size-to-height')
-		};
-		if (!sizeTo.x && !sizeTo.y) {
-			dbug.log('this element has the SizeTo filter, but no sizes defined for size-to-height/width: ', element);
-			return;
-		}
-		resize = function(x, y){
-			if (sizeTo.x) element.setStyle('width', calcSize(x, sizeTo.x));
-			if (sizeTo.y) element.setStyle('height', calcSize(y, sizeTo.y));
-		};
-                var calcSize = function(value, sizeTo) {
-                        if (sizeTo.contains("%")) {
-                                sizeTo = sizeTo.replace("%", "");
-                                sizeTo = parseFloat(sizeTo)/100.0;
-                                return value * sizeTo;
-                        } else {
-                                return value + sizeTo.toInt();
-                        }
-                };
-
-		size = methods.getContainerSize();
-		resize(size.x, size.y);
-		methods.addEvent('resize', resize);
-		this.markForCleanup(element, function(){
-			methods.removeEvent('resize', resize);
-		});
-	}
-
-});
-
-

+ 0 - 37
desktop/core/static/js/Source/BehaviorFilters/Behavior.SplitViewPostFold.js

@@ -1,37 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: When splitviews are folded open or shut, it will refresh the JFrame with the fake_refresh linker for partial refresh compontents. The clicked link must have a data-splitview-resize or data-splitview-toggle value with a JSON string value for "partialRefresh" = true.
-provides: [Behavior.SplitViewPostFold]
-requires: [Widgets/Behavior.SplitView]
-script: Behavior.SplitViewPostFold.js
-...
-*/
-Behavior.addGlobalPlugin('SplitView', 'SplitViewPostFoldRefresh', function(element, methods){
-	var splitview = element.retrieve('SplitView');
-	if (!splitview) {
-		methods.warn("warning, couldn't find splitview instance for %o", element);
-		return;
-	}
-	splitview.addEvent('postFold', function(data, event, link){
-		if (!document.id(document.body).hasChild(link)) return;
-		if (data.partialRefresh) {
-			if ($type(data.partialRefresh) == "string") link = new Element('a', { href: data.partialRefresh });
-			methods.invokeLinker('.ccs-fake_refresh', link, event);
-		}
-	});
-});

+ 0 - 54
desktop/core/static/js/Source/BehaviorFilters/Behavior.SplitViewScroller.js

@@ -1,54 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Enables smooth scrolling for in-page anchors in SplitView.
-provides: [Behavior.SplitViewScroller]
-requires: [Widgets/Behavior.SplitView]
-script: Behavior.SplitViewScroller.js
-...
-*/
-
-Behavior.addGlobalPlugin('SplitView', 'SplitViewScroller', function(element, methods) {
-	var splitview = element.retrieve('SplitView');
-	var el = $(splitview);
-	var sides = splitview.getSides();
-	var tabAnchorScroller = function(e, link){
-		var name = link.get('href').split('#')[1];
-		var anchor = el.getElement('[name=' + name + ']');
-		if (!anchor) {
-			dbug.warn('warning, link name "%s" found no corresponding anchor', name);
-			return;
-		}
-		var scrollSide;
-		for (sideName in sides) {
-			if (sides[sideName].hasChild(anchor)) scrollSide = sides[sideName];
-		}
-		if (scrollSide) {
-			var scroller = scrollSide.retrieve('_scroller');
-			if (!scroller) {
-				scroller = new Fx.Scroll(scrollSide);
-				scrollSide.store('_scroller', scroller);
-			}
-			scroller.toElement(anchor);
-			e.stop();
-		}
-	};
-	el.addEvent('click:relay([href*=#])', tabAnchorScroller);
-	this.markForCleanup(element, function() {
-		el.removeEvent('click:relay([href*=#]', tabAnchorScroller);
-	});
-});

+ 0 - 80
desktop/core/static/js/Source/BehaviorFilters/Behavior.SubmitOnChange.js

@@ -1,80 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*
----
-
-description: Makes any form with the data-filter SubmitOnChange submit itself whenever any input is changed.
-provides: [Behavior.SubmitOnChange]
-requires: [Widgets/Behavior, Core/Browser]
-script: Behavior.SubmitOnChange.js
-
-...
-*/
-
-(function(){
-
-var setupInput = function(input, cleanupElement){
-	var events = {
-		change: function(e){
-			var form = input.getParent('form');
-			if (e) form.fireEvent('submit', e);
-			else form.fireEvent('submit');
-		},
-				click: function(event) {
-						var form = input.getParent('form');
-						if ((input.get('type') == 'checkbox') && Browser.Engine.name == "trident") {
-							form.fireEvent('submit', event);
-						}
-				}, 
-		keydown: function(e) {
-			var form = input.getParent('form');
-			if (e.key == 'enter' && document.id(e.target).get('tag') != 'textarea') form.fireEvent('submit', e);
-		}
-	};
-	input.addEvents(events);
-	this.markForCleanup(cleanupElement, function(){
-		input.removeEvents(events);
-	});
-};
-
-Behavior.addGlobalFilters({
-	
-	/*
-		Notes:
-		This filter doesn't really work as it should because the event delegation functionality in MooTools
-		doesn't currently support events that don't bubble (change, submit, blur, focus, etc). Consequently
-		this filter must select all the inputs and apply event listeners to them individually. This breaks
-		the rule of behavior filters (which are supposed to alter the element the filter is applied to).
-		The alternative is to add the SubmitOnChange filter to every input which I think is too onerous.
-		The consequence here is that elements retired on the fly (inputs) won't have this behavior,
-		but that's a terrible idea anyway (what if I'm filling out the form?). I'm going to leave it here for
-		now.
-	*/
-
-	SubmitOnChange: function(element, methods) {
-		if (['input', 'select', 'textarea'].contains(element.get('tag'))) {
-			setupInput.call(this, element);
-		} else {
-			element.getElements('input, select, textarea').each(function(el){
-				setupInput.call(this, el, element);
-			}, this);
-		}
-	}
-
-});
-
-})();

+ 0 - 45
desktop/core/static/js/Source/BehaviorFilters/Behavior.Tabs.js

@@ -1,45 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*
----
-description: Adds a tab interface (TabSwapper instance) for elements with .css-tab_ui. Matched with tab elements that are .tabs and sections that are .tab_sections.
-provides: [Behavior.Tabs]
-requires: [Widgets/Behavior, clientcide/TabSwapper]
-script: Behavior.Tabs.js
-
-...
-*/
-
-Behavior.addGlobalFilters({
-
-	Tabs: function(element, methods) {
-		var tabs = element.getElements(element.get('data', 'tabs-selector') || '.tabs>li');
-		var sections = element.getElements(element.get('data', 'sections-selector') || '.tab_sections>li');
-		if (tabs.length != sections.length || tabs.length == 0) {
-			methods.error('warning; sections and sections are not of equal number. tabs: %o, sections: %o', tabs, sections);
-			return;
-		}
-		var ts = new TabSwapper({
-			tabs: tabs,
-			sections: sections,
-			smooth: true,
-			smoothSize: true
-		});
-		element.store('TabSwapper', ts);
-	}
-
-});

+ 0 - 45
desktop/core/static/js/Source/BehaviorFilters/Behavior.Timer.js

@@ -1,45 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*
----
-description: Adds a timer that counts forward from zero or a given value.
-provides: [Behavior.Timer]
-requires: [Widgets/Behavior, More/Date.Extras]
-script: Behavior.Timer.js
-
-...
-*/
-
-Behavior.addGlobalFilters({
-
-	Timer: function(element, methods){
-		var start = element.getData('start-time');
-		var showSeconds = element.hasClass('showSeconds');
-		if (start) start = Date.parse(start);
-		else start = new Date();
-		var timer = (function(){
-			var now = new Date();
-			var diff = start.diff(now, 'second');
-			if (diff > 60 || !showSeconds) element.set('html', start.timeDiffInWords());
-			else element.set('html', diff + ' sec');
-		}).periodical(100);
-		this.markForCleanup(element, function(){
-			$clear(timer);
-		});
-	}
-
-});

+ 0 - 85
desktop/core/static/js/Source/BehaviorFilters/Behavior.Tips.js

@@ -1,85 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*
----
-description: Attaches Tips.Pointy objects to elements with PointyTip in their data-filters property and turns elements with HelpTip or InfoTip in their data-filters property into elements which show a Tips.Pointy object which contains their content, on rollover.
-provides: [Behavior.Tips]
-requires: [Widgets/Behavior, clientcide/Tips.Pointy]
-script: Behavior.Tips.js
-...
-*/
-
-(function() {
-
-var createLink = function(element) {
-	var isHelp = element.hasDataFilter('HelpTip');
-	var link = new Element('a', {
-		'class': element.get('class'),
-		'data-filters': (isHelp ? 'HelpTip' : 'InfoTip'),
-		'html': isHelp ? '?' : 'i'
-	}).inject(element, 'after').store('tip:text', element.get('html'));
-	//see where that text is supposed to have its pointer and group them by point
-	var point = element.get('data', 'help-direction', false, 1);
-	return {point: point, link: link};
-};
-
-var createTip = function(link, point) {
-	var tip = new Tips.Pointy(link, {
-		pointyTipOptions: {
-			destroyOnClose: false,
-			width: 250,
-			point: point.toInt()
-		}
-	});
-	return tip;
-};
-
-Behavior.addGlobalFilters({
-
-	PointyTip: function(element, methods){
-		var point = element.get('data', 'tip-direction', false, 12);
-		var tip = createTip(element, point);
-		//destroy the tips on cleanup
-		this.markForCleanup(element, function(){
-			tip.destroy();
-		});
-	},
-
-	//display help tips for users
-	HelpTip: function(element, methods) {
-		var help = element.hide();
-		var link = createLink(help);
-		//for each point, create a new instance of Tips.Pointy (clientcide plugin)
-		var tip = createTip(link.link, link.point); 
-		//destroy the tips on cleanup
-		this.markForCleanup(element, function(){
-			tip.destroy();
-		});
-	},
-
-	InfoTip: function(element, methods) {
-		var info = element.hide();
-		var link = createLink(info);
-		var tip = createTip(link.link, link.point);
-		this.markForCleanup(element, function(){
-			tip.destroy();
-		});
-	}
-
-});
-
-})();

+ 0 - 185
desktop/core/static/js/Source/CCS/CCS.ContextMenu.js

@@ -1,185 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Right-click context menu for CCS.JFrame
-provides: [CCS.ContextMenu]
-requires: [More/Element.Shortcuts, Core/Element.Event, Core/Class.Extras, Widgets/Element.Data,
-  Core/Element.Dimensions, Core/Selectors]
-script: CCS.ContextMenu.js
-
-...
-*/
-
-(function(){
-
-	var eventStopper = $lambda(false);
-	/*
-		ContextMenu class adds right-click style menus to a jframe environment
-		arguments:
-			delegate - (element) the parent element that one right-clicks to show the context menu and also, usually, contains the menu element.
-		
-		note:
-			delegate also has an object defined in it's css value; a JSON decodable set of properties like so:
-			<div data-context-menu-actions="[{'events':['contextmenu','click:relay(.fb-item-options)'],'menu':'ul.context-menu'}]">
-			
-			where the data is structured like so:
-			
-				[ //array of actions; this allows support for more than one context menu in a single parent
-					{
-						'events':['contextmenu','click:relay(.fb-item-options)'], //when the user right clicks, or clicks a .fb-item-options element
-						'menu':'ul.context-menu' //it shows this menu
-					}
-				]
-	*/
-	document.addEvents({
-		mousedown: function(e) {
-			//if there is a menu visible, hide it on any click
-			var menu = CCS.ContextMenu.active;
-			var active = $(menu);
-			if (active && e.target != active && !active.hasChild(e.target)) {
-				active.hide();
-				menu.fireEvent('hide', active);
-			}
-		}.bind(this),
-		keyup: function(e) {
-			//or if the user hits escape
-			if (e.key == "esc" && CCS.ContextMenu.active) CCS.ContextMenu.active.hide();
-		}.bind(this)
-	});
-	CCS.ContextMenu = new Class({
-		Implements: [Options, Events],
-		options: {
-			//onShow: $empty(menu),
-			//onHide: $empty(menu)
-		},
-		initialize: function(delegate, options){
-			this.setOptions(options);
-			this.delegate = $(delegate).store('ContextMenu', this);
-			this._eventStopper = function(){
-				if (this.disabled) return false;
-			};
-			this.attach();
-		},
-		detachers: [],
-		attach: function(){
-			//get the menu data in the css property
-			var menudata = this.delegate.get('data', 'context-menu-actions', true);
-			if (menudata) {
-				//for each menu item defined
-				menudata.each(function(data){
-					var events = {};
-					//get the menu
-					var menu = this.delegate.getElement(data.menu);
-					if (!menu) {
-						//if there is no menu, but there was data, we want to kill right-click support
-						//on this element; we assume that the right-click behavior is still intended,
-						//but there's simply no menu
-						this.delegate.addEvent('contextmenu', this._eventStopper);
-						this.detachers.push(function(){
-							this.delegate.removeEvent('contextmenu', this._eventStopper);
-						}.bind(this));
-						return;
-					}
-					menu.addEvents({
-						//prevent the menu item itself from having default right click actions displayed
-						contextmenu: eventStopper,
-						//hide the menu when a value is selected
-						click: this.hide.bind(this)
-					});
-					this.detachers.push(function(){
-						menu.removeEvent('contextmenu', this._eventStopper);
-					}.bind(this));
-					//for each event defined in the data, delegate that event to the container
-					//contextmenu, click:relay(selector), etc
-					data.events.each(function(event) {
-						events[event] = function(e){
-							if (!this.disabled) {
-								e.preventDefault();
-								//let's only show one menu like this at a time
-								this.activeMenu = menu;
-								//put the menu on the mouse
-								this.show(e.page.x, e.page.y);
-							}
-						}.bind(this);
-					}, this);
-					this.delegate.addEvents(events);
-					this.detachers.push(function(){
-						this.delegate.removeEvents(events);
-					}.bind(this));
-				}, this);
-			}
-		},
-		//removes all the bound functions from the DOM
-		detach: function(){
-			this.detachers.each(function(fn){
-				fn();
-			});
-		},
-		disable: function(){
-			this.hide();
-			this.disabled = true;
-		},
-		enable: function(){
-			this.disabled = false;
-		},
-		toElement: function(){
-			return this.activeMenu;
-		},
-		//shows the menu at the given x/y position
-		show: function(x, y){
-			if (this.disabled) return;
-			//if there is a menu visible, hide it on any click
-			if (CCS.ContextMenu.active && CCS.ContextMenu.active != this) CCS.ContextMenu.active.hide();
-			if (this.activeMenu) {
-				this.activeMenu.show();
-				this.position(x, y);
-				CCS.ContextMenu.active = this;
-				this.fireEvent('show', [x, y, this.activeMenu]);
-			}
-		},
-		position: function(x, y){
-			relativeTo = this.activeMenu.getOffsetParent();
-			var relpos = relativeTo.getPosition();
-			//position the menu next to the cursor so that the menu is to the right and below it
-			var newpos = {
-				left: x - relpos.x,
-				top: y - relpos.y
-			};
-			//now do a bunch of math to figure out if the menu is out of view
-			var wSize = window.getSize();
-			var mSize = this.activeMenu.getSize();
-			var bottomRight = {
-				x: x + mSize.x,
-				y: y + mSize.y
-			};
-			if (bottomRight.x > wSize.x) newpos.left = newpos.left - mSize.x - 5;
-			if (bottomRight.y > wSize.y) newpos.top = newpos.top - mSize.y - 5;
-			
-			this.activeMenu.setStyles(newpos);
-		},
-		//hides the active menu
-		hide: function(){
-			if (this.disabled) return;
-			var menu = this.activeMenu;
-			if (menu) menu.hide();
-			this.activeMenu = null;
-			if (CCS.ContextMenu.active == this) CCS.ContextMenu.active = null;
-			if (menu) this.fireEvent('hide', menu);
-		}
-	});
-
-})();

+ 1 - 139
desktop/core/static/js/Source/CCS/CCS.Desktop.Config.js

@@ -23,110 +23,11 @@ script: CCS.Desktop.Config.js
 ...
 */
 
-HtmlTable.implement({
-	options: {
-		classNoSort: 'noSort'
-	}
-});
-
-//by default, make all StickyWin instances load inside of div#ccs-desktop
-StickyWin.implement({
-	options: {
-		inject: {
-			target: 'ccs-desktop'
-		}
-	},
-	destroyOnClose: true
-});
-
-//same for ART.Popup instances
-ART.Popup.implement({
-	destroyOnClose: true,
-	options: {
-		cascaded: true
-	}
-});
-ART.Sheet.define('window.art', {
-	'min-height': 88,
-	'width':800
-});
-
-ART.Sheet.define('window.art.browser.logo_header', {
-	'header-height': 90,
-	'header-overflow': 'visible',
-	'min-width': 620
-});
-
-ART.Sheet.define('window.art.browser.logo_header history.art', {
-	'padding': [0, 8, 0, 70]
-});
-
-ART.Sheet.define('window.art.browser.logo_header history.art', {
-	'top':32
-}, 'css');
-
-ART.Sheet.define('window.art.browser history.art ul', {
-	'z-index': 101
-}, 'css');
-
-UI.Sheet.define('window.art button.art.wincontrol', {
-	'background-color': ['hsb(0, 0, 100)', 'hsb(0, 0, 85)'],
-	'border-color': ['hsb(0, 0, 60)', 'hsb(0, 0, 50)'],
-	'font-family': 'Moderna',
-	'font-size': 13,
-	'font-color': 'black'
-});
-
-(function(){
-	var button = {
-		'height': 19,
-		'width': 22,
-		'padding': [0, 0, 0, 0],
-		'float': 'left',
-		'marginLeft': -1,
-		'corner-radius-top-right': 4,
-		'corner-radius-bottom-right': 4,
-		'corner-radius-top-left': 0,
-		'corner-radius-bottom-left': 0,
-		'glyph': ART.Glyphs.refresh,
-		'glyph-stroke': 0,
-		'glyph-fill': true,
-		'glyph-height': 12,
-		'glyph-width': 12,
-		'glyph-top': 4,
-		'glyph-left': 5
-	};
-	var large = {
-		'height': 24,
-		'width': 24,
-		'glyph-top': 6,
-		'glyph-left': 6
-	};
-	ART.Sheet.define('button.art.ccs-refresh', button);
-	ART.Sheet.define('button.art.ccs-refresh.large', large);
-	button.glyph = ART.Glyphs.triangleLeft;
-	button['glyph-top'] = 5;
-	button['glyph-left'] = 6;
-	ART.Sheet.define('button.art.ccs-back', button);
-	ART.Sheet.define('button.art.ccs-back.large', large);
-	button.glyph = ART.Glyphs.triangleRight;
-	button['glyph-left'] = 8;
-	ART.Sheet.define('button.art.ccs-next', button);
-	ART.Sheet.define('button.art.ccs-next.large', large);
-})();
-
-if (Browser.Engine.trident) {
-	UI.Sheet.define('window.art:dragging', {
-		'background-color': hsb(202, 20, 38, 1)
-	});
-}
-
-
 window.addEvent('domready', function(){
 	$(document.body).addEvent('contextmenu', function(e){
 		if (!dbug.enabled) e.preventDefault();
 	});
-	
+
 	//this sizer method will ensure that windows are always reachable and ever larger than the window
 	//(so you can always reach it's bottom corner to resize it)
 	var sizer = function(){
@@ -176,47 +77,8 @@ window.addEvent('domready', function(){
 		window.scrollTo(0,0);
 	});
 
-	//given an element, determine if it's cool to double click and select text within it
-	var canSelectOnDblClick = function(elem) {
-		//if it's a textarea or input, go for it
-		if (elem.match('input') || elem.match('textarea')) return true;
-		//otherwise, we only allow double click selection inside of window contents
-		if (elem.getParent('.jframe_contents')) {
-			//except if the double clicked element is inside an html table that has selectable rows
-			var parentTable = elem.getParent('[data-filters*=HtmlTable]');
-			if(parentTable && (parentTable.hasClass('.selectable') || parentTable.hasClass('.multiselect'))){
-				return false;
-			}
-			//or if the element is part of a double click action
-			if(elem.match('[data-dblclick-delegate]') || elem.getParent('[data-dblclick-delegate]')) return false;
-			return true;
-		}
-		return false;
-	};
-	
-	$(document.body).addEvent('dblclick', function(e){
-		if(!canSelectOnDblClick(e.target)){ 
-			if(document.selection && document.selection.empty) document.selection.empty();
-			else if(window.getSelection) window.getSelection().removeAllRanges();
-		}
-	});
 });
 
-//Although implement checks for a pre-existing implementation of the method, it has to be forced for IE to overwrite the MooTools version.
-//Thus, the IE check.
-if (Browser.Engine.trident) {
-	Array.implement({
-		forEach: function(fn, bind){
-			var len = this.length;
-			for (var i=0; i < len; i++) {
-				if(i in this) fn.call(bind, this[i], i, this);
-			}
-		}       
-	}, true);
-
-	Array.alias('forEach', 'each', true); 
-}
-
 // Monkey-patch the dbug.* functions to also log their events to the server. We don't want to
 // crush the server either with too-many or too-frequent messages, so we only send every 5 seconds,
 // unless there are more than 100 messages in the message queue.

+ 6 - 60
desktop/core/static/js/Source/CCS/CCS.Desktop.FlashMessage.js

@@ -17,7 +17,7 @@
 ---
 description: Flash Messaging (notifications) for Desktop
 provides: [CCS.Desktop.FlashMessage]
-requires: [/CCS.Desktop, Core/Fx.Tween, Core/Fx.Transitions]
+requires: [/CCS.Desktop, Core/Fx.Tween, Core/Fx.Transitions, JFrame/FlashMessage]
 script: CCS.Desktop.FlashMessage.js
 
 ...
@@ -31,64 +31,10 @@ script: CCS.Desktop.FlashMessage.js
 	returns: a function that will hide the message when called. There is no consequence to calling it if the message
 	  has already been cleaned (or calling it more than once).
 */
-CCS.Desktop.flashMessages = [];
 CCS.Desktop.flashMessage = function(message, duration, noCleanup){
-	var b = 100; // offset for get satifaction 
-	
-	var growls = $$('.growl');
-	if(growls.length){ // if growls already exist
-		var bottom = growls[growls.length-1].getStyle('bottom').toInt();
-		b = bottom + growls[growls.length-1].getSize().y + 12;
-	}
-	//store the message as displayed so we don't show dupes
-	CCS.Desktop.flashMessages.push(message);
-	var el, cleaned, cleanupCallbackCalledAlready, okToClean, timeout;
-	//create a timeout for a minimum amount of time for a message to be displayed
-	//if the cleanup method is called before this timeout, wait until the timer expires
-	//to hide the message
-	(function(){ 
-		okToClean = true;
-		if (cleanupCallbackCalledAlready) cleanup();
-	}).delay(2000);
-	//this function removes the message
-	var cleanup = function(clicked){
-		//if the user clicked the message, or the timer has expired,
-		//then it's ok to clean up the message, otherwise defer to the timer
-		if (!okToClean && !clicked) {
-			cleanupCallbackCalledAlready = true;
-			return;
-		}
-		//if we've already called this, break
-		if (cleaned) return;
-		cleaned = true;
-		$clear(timeout);
-		//slide the element out to the right, then destroy it and remove the message from the stack
-		el.tween('right', -300).get('tween').chain(function(){
-			CCS.Desktop.flashMessages.erase(message);
-			el.destroy();
-		});
-	};
-	//create the element and inject it into the DOM
-	el = new Element('div',{
-		'class': 'growl', 
-		html: message,
-		tween: {
-			transition: 'back:in'
-		},
-		events: {
-			click: cleanup
-		},
-		styles: {
-			right : 0,
-			bottom: b
-		}
-	}).inject(document.body);
-	//set a timeout to hide the message
-	if (!noCleanup) timeout = cleanup.delay(duration || 4500);
-	//return the cleanup function so that the code that called this method can optionally
-	//clean it before the timeout.
-	return cleanup;
+	return FlashMessage.flash({
+		message: message,
+		duration: duration,
+		noCleanup: noCleanup
+	});
 };
-CCS.Desktop.checkForFlashMessage = function(message) {
-	return CCS.Desktop.flashMessages.contains(message);
-};

+ 0 - 188
desktop/core/static/js/Source/CCS/CCS.Desktop.Keys.js

@@ -1,188 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Keyboard shortcuts for Desktop
-provides: [CCS.Desktop.Keys]
-requires: [More/Keyboard.Extras, Widgets/ART.Popup, More/HtmlTable, More/Element.Shortcuts]
-script: CCS.Desktop.Keys.js
-
-...
-*/
-/*
-	adds window level keys to desktop as well as a method to display the active keys in use.
-*/
-(function(){
-
-	var keyShower;
-
-	//prevent accidental scrolling
-	var stopper = function(e) {
-		if (e.target.tagName.toLowerCase() == 'html') e.stop();
-	};
-	Keyboard.manager.addEvents({
-		'space': stopper,
-		'down': stopper,
-		'pagedown': stopper,
-		'end': stopper,
-		'keydown:backspace': stopper
-	});
-
-	Keyboard.manager.addShortcuts({
-		'Previous Window': {
-			keys: 'alt+left',
-			shortcut: 'alt + left',
-			handler: function(e){
-				ART.Popup.DefaultManager.cycle('back', 'default');
-				Keyboard.stop(e);
-				e.stop();
-			},
-			description: 'Bring the previous window to the foreground.'
-		},
-		'Next Window': {
-			keys: 'alt+right',
-			shortcut: 'alt + right',
-			handler: function(e){
-				ART.Popup.DefaultManager.cycle('forward', 'default');
-				Keyboard.stop(e);
-				e.stop();
-			},
-			description: 'Bring the next window to the foreground.'
-		},
-		'New Window': {
-			keys: 'alt+shift+n',
-			shortcut: 'alt + shift + n',
-			handler: function(e){
-				var app = CCS.Desktop.getAppComponentName(ART.Popup.DefaultManager.focused);
-				if (app) CCS.Desktop.launch(app);
-				Keyboard.stop(e);
-			},
-			description: 'Launch a new window for the current application (if it allows it).'
-		},
-		'Close Window': {
-			keys: 'alt+shift+w',
-			shortcut: 'alt + shift + w',
-			handler: function(e){
-				if (ART.Popup.DefaultManager.focused) ART.Popup.DefaultManager.focused.hide();
-				Keyboard.stop(e);
-			},
-			description: 'Close the current window.'
-		},
-		'Show/Hide Shortcuts': {
-			keys: 'alt+/',
-			shortcut: 'alt + /',
-			handler: function(e){
-				keyShower.toggle();
-				Keyboard.stop(e);
-			},
-			description: 'Show or hide the list of all active shortcuts.'
-		}
-	});
-	Keyboard.manager.addEvents({
-		'esc': function(e){
-			keyShower.hide();
-		}
-	});
-
-	//functionality to display the shortcuts to the user.
-	ART.Popup.DefaultManager.setLayer('shortcuts', 150);
-
-	CCS.KeyList = new Class({
-
-		Implements: Events,
-
-		initialize: function(){
-			//create a table for the active shortcuts
-			this.table = new HtmlTable({
-				headers: ['Key', 'Shortcut Name', 'Description'],
-				properties: {
-					'data-filters':'HtmlTable'
-				}
-			});
-			//a holder for styling
-			this.win = new Element('div', {
-				'id':'ccs-shortcut_list',
-				styles: {
-					display: 'none'
-				}
-			}).inject(document.body).adopt(this.table);
-			//a local instance of Mask for the document
-			this.mask = new Mask(document.body, {
-				hideOnClick: true,
-				onHide: this.hide.bind(this, true)
-			});
-		},
-
-		//show the shortcut list
-		show: function(){
-			if (this.win.isDisplayed()) return;
-			this.fill();
-			this.mask.show();
-			this.win.show().position();
-			this.fireEvent('show');
-		},
-
-		//hide the shortcut list
-		hide: function(dontHideMask){
-			if (!this.win.isDisplayed()) return;
-			if (dontHideMask) {
-				this.win.hide();
-				this.fireEvent('hide');
-			} else {
-				this.mask.hide();
-			}
-		},
-
-		//toggle visibility of the shortcut list
-		toggle: function(){
-			if (this.win.isDisplayed()) this.hide();
-			else this.show();
-		},
-
-		//fills the shortcut element with a list of active shortcuts
-		fill: function(){
-			var keys = Keyboard.getActiveShortcuts();
-			this.table.empty();
-			var wname;
-			keys.reverse().each(function(key){
-				var widget = key.getKeyboard().widget;
-				var widgetName = widget ? CCS.Desktop.getAppName(CCS.Desktop.getAppComponentName(widget)) : "Desktop";
-				if (wname != widgetName) {
-					wname = widgetName;
-					this.table.push([{
-						content: wname,
-						properties: {
-							colspan: 3,
-							styles: {
-								'font-weight': 'bold'
-							}
-						}
-					}]);
-				}
-				this.table.push([key.shortcut, key.name, key.description || ""]);
-			}, this);
-		}
-
-	});
-
-	window.addEvent('domready', function(){
-		keyShower = new CCS.KeyList();
-		$('hotkeys').addEvent('click', function(){
-			keyShower.show();
-		});
-	});
-
-})();

+ 0 - 50
desktop/core/static/js/Source/CCS/CCS.DropDown.js

@@ -1,50 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: DropDown
-provides: [CCS.DropDown]
-requires: [ccs-shared/CCS, clientcide/MenuSlider]
-script: CCS.DropDown.js
-
-...
-*/
-CCS.DropDown = new Class({
-
-	Extends: MenuSlider,
-
-	options: {
-		useIframeShim: false,
-		hoverGroupOptions: {
-			start: ['click'],
-			remain: ['mouseenter'],
-			end: []
-		},
-		slideOut: true
-	},
-
-	initialize: function(menu, options) {
-		var submenu = $($(menu).get('id') + '-menu').getElement('ul');
-		submenu.show().setStyle('visibility', 'hidden');
-		this.parent(menu, submenu, options);
-		submenu.setStyle('visibility', 'visible');
-		var hider = function(e) {
-			if (e.target != this.menu && this.isVisible()) this.slideOut();
-		}.bind(this);
-		document.addEvent('click', hider);
-	}
-
-});

+ 0 - 39
desktop/core/static/js/Source/CCS/CCS.Error.js

@@ -1,39 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Error Dialog box
-provides: [CCS.Error]
-requires: [/CCS, Widgets/ART.Alerts]
-script: CCS.Error.js
-
-...
-*/
-CCS.error = function(caption, message){
-	message = message || "unknown";
-	if (['element', 'string'].contains($type(message))) {
-		var alerter =  ART.alert(caption || 'Woops!', message || 'Something has gone horribly, horribly wrong.', function(){
-			alerter.keyboard.relinquish();
-		}, {
-				width: 400,
-				height: 150,
-				mask: true
-		}).inject(document.body);
-		return alerter;
-	} else {
-		dbug.log('not alerting message, as it\'s not a string or element', caption, message);
-	}
-};

+ 12 - 334
desktop/core/static/js/Source/CCS/CCS.JBrowser.js

@@ -17,346 +17,24 @@
 ---
 description: A JBrowser is a window that encapsulates a JFrame and a linked HistoryMenu.
 provides: [CCS.JBrowser]
-requires: 
- - /CCS.JFrame
- - Widgets/ART.Browser
- - Widgets/ART.SolidWindow
- - /CCS.ContextMenu
-
- - /CCS.JFrame.Alert
- - /CCS.JFrame.PartialRefresh
- - /CCS.JFrame.Prompt
-
- - /CCS.JFrame.AutoRefresh
- - /CCS.JFrame.DoubleClickDelegate
- - /CCS.JFrame.FormRequest
- - /CCS.JFrame.ToggleHistory
-
- - /CCS.JFrame.AjaxLoad
- - /CCS.JFrame.CheckAllOrNone
- - /CCS.JFrame.Chooser
- - /CCS.JFrame.ConfirmAndPost
- - /CCS.JFrame.FakeRefresh
- - /CCS.JFrame.HideParent
- - /CCS.JFrame.LivePath
- - /CCS.JFrame.Nav
- - /CCS.JFrame.NoScroll
- - /CCS.JFrame.PromptAndPost
- - /CCS.JFrame.Refresh
- - /CCS.JFrame.RefreshWithParams
- - /CCS.JFrame.SplitViewLinkers
- - /CCS.JFrame.SubmitLink
- - /CCS.JFrame.Target
+requires: [/CCS, JFrame/JFrame.Browser]
 script: CCS.JBrowser.js
 
 ...
 */
-(function(){
-
-	var jbrowser = {
-
-		options: {
-			//the onLoad event fires when new content loads
-			//onLoad: $empth(view),
-			
-			//display the history widget in the header?
-			displayHistory: true,
-			//showNow: if true, the window is displayed on instantiation
-			showNow: false,
-			//draggable: if true, the window can be dragged around
-			draggable: true,
-			//windowTitler: passed the default title from the response, returns a title for the window.
-			windowTitler: function(title) {
-				return title || this.options.windowOptions.caption || '';
-			},
-			jframeOptions: {}
-		},
-
-		initialize: function(path, options) {
-			options = options || {};
-			var show = $pick(options.showNow, true);
-			options.showNow = false;
-			this.parent(options);
-			this._setupHistory(path);
-			this._makeJFrame(path);
-			if (show) {
-				this.options.showNow = true;
-				this.show();
-			}
-			if (Browser.Engine.trident) {
-				$(this).setStyle('top', -111111111);
-			} else {
-				$(this).setStyle('visibility', 'hidden');
-				if (this.history) $(this.history).setStyle('visibility', 'hidden');
-			}
-
-			this.addEvents({
-				maximize: function(){
-					if (!this._jbrowserMinMaxState) this._jbrowserMinMaxState = this.element.getStyles('top', 'left');
-					this.element.setStyles({
-						top: 0,
-						left: 0
-					});
-				}.bind(this),
-				restore: function(){
-					//restore
-					this.element.setStyles(this._jbrowserMinMaxState);
-					this._jbrowserMinMaxState = null;
-				}.bind(this)
-			});
-		},
-		
-		draw: function(){
-			this.parent.apply(this, arguments);
-			var cur = this.jframe.currentSize;
-			if (cur.x != this.contentSize.x || cur.y != this.contentSize.y) {
-				this.jframe.resize(this.contentSize.x, this.contentSize.y);
-			}
-		},
-		
-		_setupHistory: function(path){
-			if (this.history) {
-				if (!this.options.displayHistory) this.hideHistory();
-				//prevent clicks to the history element from starting the drag behavior attached to the entire header
-				$(this.history).addEvent('click', function(e) { e.stopPropagation(); });
-				this.history.addEvents({
-					refresh: function(){
-						this.refresh();
-					}.bind(this),
-					select: function(path, title){
-						if (path != this.jframe.currentPath) this.load({requestPath: path, suppressHistory: true });
-					}.bind(this)
-				});
-			}
-		},
-
-		_makeJFrame: function(path){
-			var opt = $merge({
-				onLoadComplete: this._jframeLoaded.bind(this),
-				onLoadError: this._jframeError.bind(this),
-				onRedirect: function(){
-					//do not restore scroll offsets when jframe is redirected
-					this._scrolled = null;
-				}.bind(this),
-				size: {
-					width: this.contentSize.x,
-					height: this.contentSize.y
-				},
-				getScroller: function(){
-					return this.content;
-				}.bind(this),
-				spinnerTarget: this.content
-			}, this.options.jframeOptions);
-			opt.parentWidget = this;
-			this.jframe = new CCS.JFrame(path, opt);
-			this.jframe.inject(this, this.content);
-			
-			//adds mouseover/mouseout behaviors for all links that have the class
-			//.frame_tip; when the user mouses over such an object, the "status"
-			//area in the window footer displays the title of that element.
-			this.jframe.addFilters({
-				statusTips: function(container) {
-					container.addEvents({
-						'mouseover:relay(.frame_tip)': function(e, element){
-							var tipTitle = element.retrieve('tip:title', element.get('title') || '');
-							element.set('title', '');
-							this.setFooter(tipTitle);
-						}.bind(this),
-						'mouseout:relay(.frame_tip)': function(e, element){
-							this.setFooter('');
-						}.bind(this)
-					});
-				}.bind(this)
-			});
-
-			this.toolbar = new Element('div', {
-				'class':'ccs-window-toolbar',
-				events: {
-					mousedown: function(e){
-						//prevent clicks to the toolbar element from starting the drag behavior attached to the entire header
-						//note that OBJECT tags in IE won't give you a .match method - they aren't extended
-						if ($(e.target).match && !$(e.target).match('.draggable') && !$(e.target).getParent('.draggable')) e.stopPropagation();
-					}
-				}
-			}).inject(this.header);
-			this.jframe.applyDelegates(this.toolbar);
-			this.jframe.applyDelegates(this.footerText);
-			this.addEvents({
-				focus: function(){
-					this.jframe.focus();
-				}.bind(this),
-				destroy: function(){
-					this.jframe.destroy();
-				}.bind(this),
-				unshade: function(){
-					this.jframe.behavior.show();
-				},
-				shade: function(){
-					this.jframe.behavior.hide();
-				}
-			});
-			this.jframe.addEvent('refresh', this._storeScroll.bind(this));
-			
-		},
-
-		wait: function(start){
-			start = $pick(start, true);
-			if (start) this.content.spin({ fxOptions: {duration: 200} });
-			else this.content.unspin();
-		},
-
-		load: function(options) {
-			this.jframe.load(options);
-			return this;
-		},
-
-	/*
-		options are passed to jframe's renderContent method
-		*/
-
-		setContent: function(options){
-			this.jframe.renderContent(options);
-			return this;
-		},
-
-		refresh: function() {
-			this.jframe.refresh();
-			return this;
-		},
-
-		resize: function(w, h) {
-			if (w == this.currentWidth && h == this.currentHeight) return;
-			this.parent(w, h);
-			this.jframe.resize(this.contentSize.x, this.contentSize.y);
-		},
-
-		_jframeLoaded: function(data) {
-			if (!Browser.Engine.trident) {
-				(function(){
-					$(this).setStyle('visibility', 'visible');
-					if (this.history) $(this.history).setStyle('visibility', 'visible');
-				}).delay(20, this);
-			}
-			this.setCaption(this.options.windowTitler(data.title || data.repsonsePath));
-			this.jframe.behavior.cleanup(this.toolbar);
-			this.toolbar.empty();
-			this.jframe.behavior.cleanup(this.footerText);
-			this.footerText.empty();
-			if (data.toolbar) this.toolbar.adopt(data.toolbar);
-			if (data.footer) this.footerText.adopt(data.footer);
-			if (!data.suppressHistory && this.history) this.history.push({ path: data.responsePath, title: data.title || data.repsonsePath});
-			if (this._jframe_view != data.view) {
-				if (this._jframe_view) {
-					this.contents.removeClass(this._jframe_view);
-					this.removeClass(this._jframe_view);
-				}
-				if (data.view) {
-					this.contents.addClass(data.view);
-					this.addClass(data.view);
-					this._jframe_view = data.view;
-				}
-			}
-			this.fireEvent('load', data.view);
-			if (this.getState('focused')) this.jframe.focus();
-			/*
-				I hate this delay, but the browser apparently needs it to render the HTML. You can't set the scroll offset of something
-				thats empty (because there's no where to scroll). The duration may require some additional care with diff. browsers or
-				slower computers.
-			*/
-			this._restoreScroll.delay(50, this);
-		},
-
-		_jframeError: function(error) {
-			if (this.refreshButton) this.refreshButton.unspin();
-		},
-
-		//returns an object with the dimensions, location, path, and options
-		serialize: function(){
-			return {
-				styles: $(this).getStyles(['top', 'left']),
-				size: this.getSize(),
-				path: this.jframe.currentPath,
-				options: this.options
-			};
-		},
-
-		//restore's a window to a given location and size
-		restore: function(state){
-			//restore the position
-			$(this).setStyles(state.styles);
-			//restore the size
-			this.resize(state.size.width, state.size.height);
-			return this;
-		},
-		
-		resetMinMaxState: function(){
-			this.parent.apply(this, arguments);
-			this._jbrowserMinMaxState = null;
-		},
-		
-		//returns the elements whose scroll offset we want to store
-		//this includes any element with the .save_scroll class
-		//and also the contents of the window itself.
-		_getScrollElements: function(){
-			var scrollers = $(this).getElements('.save_scroll');
-			scrollers.include(this.content);
-			return scrollers;
-		},
 
-		//stores the scroll offset for all the elements that we are saving
-		_storeScroll: function(){
-			this._storedScrollPath = this.jframe.currentPath;
-			this._scrolled = this._getScrollElements().map(function(el){
-				return el.getScroll();
-			});
-		},
+JFrame.Browser.implement({
 
-		//restores the scroll offsets to the elements we saved
-		//but only if we found a matched number of each
-		//note: that this behavior is only triggered on refresh. The main issue with refresh is if there's a redirect.
-		_restoreScroll: function(){
-			if (!this._scrolled || this.jframe.currentPath != this._storedScrollPath) return;
-			var scrollers = this._getScrollElements();
-			if (scrollers.length == this._scrolled.length) {
-				this._scrolled.each(function(data, i) {
-					scrollers[i].scrollTo(data.x, data.y);
-				});
-			}
-			this._scrolled = null;
+	options: {
+		help: function(){
+			var help = $(this).getElement('a[target=Help].help');
+			CCS.Desktop.showHelp(this, help ? help.get('href') : null);
 		}
+	}
 
-	};
+});
 
-	CCS.JBrowser = new Class(
-		$merge({
-			Extends: ART.Browser,
-			options: {
-				help: function(){
-					var help = $(this).getElement('a[target=Help].help');
-					CCS.Desktop.showHelp(this, help ? help.get('href') : null);
-				}
-			}
-		}, jbrowser)
-	);
-	CCS.JBrowser.Solid = new Class(
-		$merge({
-			Extends: ART.SolidWindow
-		}, jbrowser)
-	);
-	//a window alert w/ a jframe
-	CCS.JBrowser.Confirm = new Class(
-		$merge({
-			Extends: ART.Confirm,
-			displayHistory: false
-		}, jbrowser)
-	);
-	//shortcut for JBrowser.Confirm
-	CCS.JBrowser.confirm = function(caption, content, callback, options) {
-		return new CCS.JBrowser.Confirm(options.path,
-			$extend(options || {}, {
-				caption: caption,
-				onConfirm: callback || $empty
-			})
-		);
-	};
-})();
+CCS.JBrowser = JFrame.Browser;
+CCS.JBrowser.Solid = JFrame.Browser.Solid;
+CCS.JBrowser.Confirm = JFrame.Browser.Confirm;
+CCS.JBrowser.confirm = JFrame.Browser.confirm;

+ 2 - 1027
desktop/core/static/js/Source/CCS/CCS.JFrame.js

@@ -18,1035 +18,10 @@
 description: JFrame--Configurable "container" for simple HTML pages, within the CCS framework.
 provides: [CCS.JFrame]
 requires:
- - Core/Request
- - More/Element.Delegation
- - More/Elements.From
- - More/Fx.Scroll
- - More/String.Extras
- - More/Spinner
- - clientcide/Collapsible
- - Widgets/ART.Alerts
- - Widgets/Behavior
- - Widgets/Behavior.ArtButton
- - Widgets/Behavior.ArtInput
- - Widgets/Behavior.SplitView
- - More-Behaviors/Behavior.FxAccordion
- - More-Behaviors/Behavior.FormRequest
- - More-Behaviors/Behavior.FormValidator
- - More-Behaviors/Behavior.HtmlTable
- - More-Behaviors/Behavior.OverText
- - More-Behaviors/Behavior.Resizable
- - More-Behaviors/Behavior.Sortable
- - /Behavior.Autocomplete
- - /Behavior.CollapsingElements
- - /Behavior.ContextMenu
- - /Behavior.DataGroupToggle
- - /Behavior.FilterInput
- - /Behavior.FitText
- - /Behavior.HtmlTableCheckSelected
- - /Behavior.HtmlTableChromeHack
- - /Behavior.HtmlTableKeyboard
- - /Behavior.HtmlTableKeyboardKids
- - /Behavior.HtmlTableLiveTreeKeyboard
- - /Behavior.HtmlTableMultiSelectMenu
- - /Behavior.HtmlTableRestore
- - /Behavior.HtmlTableUpdate
- - /Behavior.InputFilterHtmlTableZebra
- - /Behavior.MultiChecks
- - /Behavior.PostEditor
- - /Behavior.SelectWithOther
- - /Behavior.SideBySideSelect
- - /Behavior.SizeTo
- - /Behavior.SplitViewPostFold
- - /Behavior.SplitViewScroller
- - /Behavior.SubmitOnChange
- - /Behavior.Tabs
- - /Behavior.Tips
- - /Behavior.Timer
  - /CCS
+ - JFrame/JFrame
 
 script: CCS.JFrame.js
 ...
 */
-CCS.JFrame = new Class({
-
-	Extends: ART.Widget,
-
-	Implements: [ART.WindowTools, ART.Window.AlertTools],
-
-	ns: 'hue',
-
-	name: 'jframe',
-
-	options: {
-		/**
-		//EVENTS:
-		//all the events in ART.Widget, plus:
-		onRequest: $empty(requestPath, userData),
-		onBeforeRenderer: $empty(content, options), //see _applyRenderers method for details
-		afterRenderer: $empty(content, options) //ditto
-		onLoadComplete: $empty(data),
-		onLoadError: $empty(error), //the jframe failed to load. An error alert has already displayed.
-		onRedirect: empty(redirectedTo, originalRequestedURL), //the response was redirected (before content has been rendered)
-		redirectAfterRender: empty(redirectedTo, originalRequestedURL), //after content is rendered
-		size: {
-			width: ,
-			height:
-		},
-
-		**/
-		//evaluateJs: if true, script tags are evaluated when content is loaded
-		evaluateJs: false,
-		//includeLinkTags: if true, css <link> tags are injected into the DOM
-		includeLinkTags: false,
-		//useSpinner: if true, the content of the jFrame is masked when loading
-		useSpinner: true,
-		//linkers: a key/value set of linkers (see the addLinker method for docs)
-		linkers: {},
-		//filters: a key/value set of JFrame filters
-		filters: {},
-		//behaviors: a key/value set of behavior filters passed along to Behavior.addFilters
-		behaviors: {},
-		//the selector to match clicks against for delegation; defaults to only links
-		clickRelays: 'a',
-		//given the response and response text, this method determines if there's been a serverside error
-		errorDetector: function(requestInstance, responseText) {
-			//flag this as an error
-			return responseText.contains('ccs-error-popup');
-		},
-		getScroller: function(){
-			return this.element;
-		},
-		//passed the options that generated the request; see renderContent's options
-		spinnerCondition: function(options){
-			if (!this.loadedOnce) return false;
-			if (options.autorefreshed && this._noSpinnerOnAutoRefresh) return false;
-			return this.options.useSpinner;
-		}
-	},
-
-	// path: initial page to load
-	initialize: function(path, options){
-		this.parent(options);
-		new ART.Keyboard(this, this.keyboardOptions);
-		this.addLinkers(this.options.linkers);
-		this.addFilters(this.options.filters);
-		this.behavior = new Behavior(this.element, {
-			onError: function(){
-				dbug.warn.apply(dbug, arguments);
-			}
-		});
-		if(this.options.size) this.behavior.resize(this.options.size.width, this.options.size.height);
-		['attachKeys', 'detachKeys', 'addShortcut', 'addShortcuts', 'removeShortcut', 'removeShortcuts',
-		 'applyDelegates', 'getScroller', 'getContentElement', 'invokeLinker', 'configureRequest', 'getBehaviorState'].each(function(method){
-			this.behavior.passMethod(method, this[method].bind(this));
-		}, this);
-		this.behavior.passMethods({
-			getContainerSize: this.getCurrentSize.bind(this),
-			registerKeyboard: function(keyboard){
-				this.keyboard.manage(keyboard);
-			}.bind(this),
-			unregisterKeyboard: function(keyboard){
-				this.keyboard.drop(keyboard);
-			}.bind(this),
-			callClick: function(){
-				this.callClick.apply(this, arguments);
-			}.bind(this)
-		});
-		this.addEvent('resize', this.behavior.resize.bind(this.behavior));
-		this.addEvent('livePathUpdate', function(uri) {
-			this.behavior.fireEvent('livePathUpdate', uri);
-		}.bind(this));
-		this.addBehaviors(this.options.behaviors);
-
-		this.element.addClass('jframe_wrapper').addClass('ccs-shared');
-		this.scroller = new Fx.Scroll(this.options.getScroller.call(this));
-		this.content = new Element('div', {
-			'class': 'jframe_contents'
-		}).inject(this.element);
-
-		if (this.options.size) this.resize(this.options.size.width, this.options.size.height);
-		this.load({requestPath: path});
-	},
-	
-	/*
-		configureRequest - configures a passed in request to be have its response rendered within JFrame..
-		request - (* request object *) request object to be configured
-	*/
-	configureRequest: function(request, options){
-		this._setRequestOptions(request, $merge({
-			onSuccess: function(nodes, elements, text){
-				this._requestSuccessHandler(request, text, options);
-			}.bind(this)
-		}, options));
-	},
-
-
-	toElement: function(){
-		return this.element;
-	},
-
-	_createElement: function(){
-		this.element = this.element || new Element('div').setStyles({display: 'block', position: 'relative', outline: 'none'}).store('widget', this);
-	},
-
-	delegatedTo: [],
-
-/*
-	
-	the JFrame callClick event invokes the click handler for links/elements, matching against any JFrameLinkers and,
-	if none are found, running the default click handler (which is to load the link's href, if defined, into the JFrame).
-	event - (*object*) the event object that was fired; a click, usually
-	link - (*element*) typically an anchor tag, though that's not a requirement
-	force - (*boolean*) forces the link to be activated even if it has the css class .disabled or .jframe_ignore
-	callClick: function(event, link, force) {
-		//this function is defined in the applyDelegates function below;
-		//this commented out version added here for visibility's sake
-	},
-
-*/
-	/*
-		applies the default link handling delegates to a specific target, allowing you to attach link handling to any container
-		target - (*element*) the element to which you wish to attach delegates
-	*/
-	applyDelegates: function(target){
-		target = document.id(target) || this.content;
-		//make sure we only apply this once per target
-		if (this.delegatedTo.contains(target)) return;
-		this.delegatedTo.push(target);
-		
-		var handler = function(e, elem, url, options){
-			if (elem.get('tag') == 'a') e.preventDefault();
-			if (!this._checkLinkers(e, elem)) {
-				// If it's an anchor link, do scrolling
-				if (url && url.get('fragment')) {
-					// hrefs are url-encoded, but the "name" for the links isn't
-					target = this.content.getElement('a[name=' + unescape(url.get('fragment')) + ']');
-					if (target) {
-						this.scroller.toElement(target);
-						return;
-					}
-				}
-				var path = url ? url.toString() : '';
-				if (!path) return;
-
-				options = $merge({
-					requestPath: path
-				}, options);
-				var spinnerTarget = elem.get('data', 'spinner-target');
-				if (spinnerTarget) {
-					spinnerTarget = $(this).getElement(spinnerTarget);
-					options.spinnerTarget = spinnerTarget;
-				}
-				this.load(options);
-
-			}
-		}.bind(this);
-		this.callClick = function(e, elem, force, options){
-			//allow links to force jframe to nerf them
-			//this is required for doubleclick support
-			//as otherwise there's no way to prevent this default jframe handler per link
-			if (!force && (elem.hasClass('jframe_ignore') || elem.hasClass('disabled'))) return e.preventDefault();
-			// Fix relative links
-			if (elem.get('href')) {
-				var url = new URI(elem.get('href'), {base: this.currentPath});
-				if (url) elem.set('href', url.toString());
-				var me = new URI();
-				// If it's an external link
-				if (url.get('scheme') != me.get('scheme') ||
-						url.get('host') != me.get('host') ||
-						url.get('port') != me.get('port')) {
-					// Open external URLs in a new window.
-					// TODO(todd) should also check that the URL begins with
-					// whatever our prefix is, but "prefix" isn't really known
-					// by this class with the current design.
-					elem.set('target', '_blank');
-				} else {
-					handler(e, elem, url, options);
-				}
-			} else {
-				handler(e, elem, false, options);
-			}
-		}.bind(this);
-		target.addEvent('click:relay(' + this.options.clickRelays + ')', this.callClick);
-	},
-
-	/**
-	 * Cause the content of this JFrame to load a particular URL.
-	 *   options: see renderContent's options
-	 */
-	load: function(options){
-		options = $merge({
-			//by default, requests reload the entire jframe
-			fullFrameLoad: true
-		}, options);
-		this.fireEvent('request', [options.requestPath, options.userData, options]);
-		var req = new Request();
-		this._setRequestOptions(req,
-			$merge(options, {
-				method: options.method || 'get',
-				url: new URI(options.requestPath).toString()
-			})
-		);
-		req.send();
-	},
-
-	disableSpinnerUsage: function(){
-		this._noSpinnerOnAutoRefresh = true;
-	},
-
-	enableSpinnerUsage: function(){
-		this._noSpinnerOnAutoRefresh = false;
-	},
-
-	/** refresh the current content */
-	refresh: function(options){
-		this.fireEvent('refresh');
-		this.load(
-			$merge(options, {
-				noScroll: true,
-				requestPath: this.currentPath
-			})
-		);
-	},
-
-	getBehaviorState: function() {
-		if(!this.options.behaviorState) this.options.behaviorState = {};
-		return this.options.behaviorState;
-	},
-
-	/*
-	options:
-		content: content to render (html, dom element, or $$ collection of dom elements),
-		responsePath: the path to this content,
-		title: the title for the frame for this content,
-		userData: data to be passed along to the loadComplete event,
-		target: dom element or id to fill with content; defaults to this.content
-		suppressLoadComplete: (boolean) if true, the loadComplete event is not fired
-		callback: a callback to execute after rendering; passed an object with content, responsePath, title, and target
-		error: the server has returned an error
-		autorefreshed: (boolean) whether or not this refresh was user initiated
-		blankWindowWithError: the window is empty (and will remain so)
-
-	notes:
-		the loadComplete and callback methods are passed an object with the following attributes:
-		content: the content returned from the server, unaltered
-		elements: an array of DOM elements rendered from that response, excluding the script, style, and meta tags
-		scripts: the inline js in the response (any text in a script tag)
-		styles: all the link and style tags
-		meta: all the meta tags in teh response
-		responsePath: the path of what was returned (url),
-		title: the title, stripped from the content as the inner text of the *title* tag, or the inner text of the first *h1*, or the path
-		userData: any data passed in to the request (used for login)
-		view: the view (string; see below)
-		viewElement: the view element (DOM element, see below)
-		target: the target where the content was loaded
-		toolbar: the toolbar elements (see below),
-		footer: the footer elements (see below)
-		everything else: used to pass along options to filters, renderers, etc.
-		
-	views:
-		The content of a JFrame request is searched for the first element with the class "view".
-		If found, the id of this element is treated as the current view. This id is stripped (all
-		Desktop apps do not use ids, as there may be more than one of them). The data object passed
-		to the loadComplete event and the callback in the options contains this view (the value of
-		the id of the element) as well as the viewElement. This allows your code to attach logic
-		based on the view (a 'controler'). Just wrap your response in a div with the class "view" and
-		an id and you can switch on that in the event handler you attach.
-		
-		example html response:
-		<div id="jobbrowser_job_list" class="view">
-			<!-- the html for your view -->
-		</div>
-		
-		in your script:
-		myJframe.addEvent('loadComplete', function(data) {
-			if (data.view == 'jobbrowser_job_list') new CCS.JobBrowser.JobView(data.viewElement);
-		})
-	
-	toolbars:
-		The content of a JFrame request is searched for elements with the class "toolbar" and "footer".
-		These elements are referenced in the data passed to the loadComplete callback as the toolbar and footer
-		for the current view. This allows you to do special things to the navigation. By default, JBrowser
-		injects the contents of this toolbar into the area above the content and the footer content into
-		the footer. By simply putting links and other elements into a div with the class "toolbar" it
-		will be added to the header (and the same for the footer).
-		You must include the toolbar / footer in every response for it to remain there.
-	*/
-	renderContent: function(options){
-		var content = {};
-		if ($(options.content)) {
-			//if the content is an element, cast it into an Elements array
-			content.elements = $$($(options.content));
-		} else if ($type(options.content) == "string") {
-			//if it's a string, parse it
-			content = this._parseContent(options.content);
-		} else {
-			//the only other valid option is that it's an array of elements,
-			//cast it into an Elements array in case it's just a vanilla array
-			content.elements = $$(options.content);
-		}
-		//determine view and view element
-		var view,
-		    viewElement = content.elements.filter('.view')[0] || content.elements.getElement('.view')[0];
-		if (viewElement) {
-			view = viewElement.get('id');
-			viewElement.set('id', '');
-			content.view = view;
-			content.viewElement = viewElement;
-		}
-		content.options = options;
-		this._applyRenderers(content);
-	},
-
-	/*
-		fill: fills a given target with the appropriate content
-		target - (*element*) the target to fill with content
-		content - (*object*) an object with the following properties:
-			options - (*object*) the options object that created the request; see renderContent
-			js - (*string*) any the inline javascript to evalutate,
-			links - (*elements array*) css links to be injected into the target
-			elements - (*elements array*) elements to inject into the target (i.e. the actual content)
-			title - (*string*) the title of the content
-			view - (*string*; optional) if defined, the view of the content
-			viewElement - (*element*; optional) if defined, the element for the view
-			behavior - (*behavior object*; optional) if defined, the behavior instance to use
-		
-	*/
-
-	fill: function(target, content, behavior){
-		target.empty().adopt(content.elements);
-		if (content.links && content.links.length && this.options.includeLinkTags) target.adopt(content.links);
-		if (this.options.evaluateJs && content.js) $exec(content.js);
-		this.applyDelegates(target);
-		this.applyFilters(target, content, behavior || this.behavior);
-		if (Browser.Engine.webkit) {
-				var width = target.style.width;
-				target.setStyle('width', '99%');
-				(function() {
-					target.style.width = width;
-				}).delay(1);
-		}
-	},
-
-	resize: function(x, y){
-		this.element.setStyles({
-			width: 'auto',
-			height: y
-		});
-		this.currentSize = {
-			x: x,
-			y: y
-		};
-		this.fireEvent('resize', [x, y]);
-	},
-	
-	getCurrentSize: function(){
-		return this.currentSize;
-	},
-
-	getContentElement: function(){
-		return this.getWindow().contents;
-	},
-
-	getScroller: function(){
-		return this.scroller;
-	},
-
-	filters: {},
-
-	/*
-		addFilter:
-		name - (*string*) the unique name of the filter
-		fn - (*function*) callback executed
-	*/
-
-	addFilter: function(name, fn){
-		this.filters[name] = fn;
-		return this;
-	},
-
-	/*
-		addFilters
-		obj - (*object*) a key/value set of filters to add
-	*/
-	addFilters: function(obj){
-		for (var name in obj) {
-			this.addFilter(name, obj[name]);
-		}
-		return this;
-	},
-
-	/*
-		add a new behavior filter
-		name - (*string*) the name fo the behavior (no spaces or commas; preferably CamelCase)
-		fn - (*function*) the function for the behavior filter.
-		overwrite - (*boolean*) if true, will overwrite any pre-existing filter if one is present
-	*/
-	addBehavior: function(name, fn, overwrite){
-		this.behavior.addFilter(name, fn, overwrite);
-	},
-	
-	/*
-		add a group of behavior filters
-		obj - (*object*) an object of key/value pairs of name/functions for filters (see addBehavior)
-		overwrite - (*boolean*) if true, will overwrite any pre-existing filter if one is present
-	*/
-	addBehaviors: function(obj, overwrite){
-		this.behavior.addFilters(obj, overwrite);
-	},
-	/*
-		add a new behavior plugin
-		filterName - (*string*) the name of the filter this plugin is for (no spaces or commas; preferably CamelCase)
-		name - (*string*) the name of the plugin (no spaces or commas; preferably CamelCase)
-		fn - (*string*) the attachment function for the plugin
-		overwrite - (*boolean*) if true, will overwite any pre-existing filter if one is present
-	*/
-
-	addBehaviorPlugin: function(filterName, name, fn, overwrite) {
-		this.behavior.addPlugin(filterName, name, fn, overwrite);
-	},
-	/*
-		add a group of behavior plugins
-		obj - (*object*) an object containing objects containing the filter name, the plugin name, and the attachment function for the plugin
-		overwrite - (*boolean*) if true, will overwrite any pre-existing filter if one is present
-	*/
-
-	addBehaviorPlugins: function(obj, overwrite){
-		this.behavior.addPlugins(obj, overwrite);
-	},
-
-	/*
-		apply a specific behavior to an element
-		name - (*string*) the name fo the behavior (no spaces or commas; preferably CamelCase)
-		element - (*element*) the DOM element to apply the behavior to
-		force - (*boolean*) forces the behavior to reapply, even if it has already been applied; defaults to *false*.
-	*/
-	applyBehavior: function(name, element, force){
-		var behavior = this.behavior.getBehavior(name);
-		this.behavior.applyBehavior(element, behavior, force);
-	},
-
-	//Applies all the behavior filters for an element.
-	//element - (element) an element to apply the filters registered with this Behavior instance to.
-	//behavior - (behavior object) behavior instance to use
-	//force - (boolean; optional) passed through to applyBehavior (see it for docs)
-	applyBehaviors: function(element, behavior, force){
-		behavior.apply(element, force);
-	},
-
-	//garbage collects all applied filters for the specified element
-	collectElement: function(element){
-		this.behavior.cleanup(element);
-	},
-
-	/*
-		applyFilters:
-		container - (*element*) applies all the filters on this instance of jFrame to the contents of the container.
-		content - (*object*) optional object containing various metadata about the content; js tags, meta tags, title, view, etc. See the "notes" section of the renderContent method comments in this file.
-		behavior - (*behavior object*) optional behavior instance to be used for application of behaviors
-			
-	*/
-
-	applyFilters: function(container, content, behavior){
-		for (var name in this.filters) {
-			this.applyFilter(name, container, content);
-		}
-		this.applyBehaviors(container, behavior || this.behavior);
-	},
-
-
-	/*
-		applyFilter:
-		name - (*string*) the name of the JFrame filter to apply
-		container - (*element*) applies all the filters on this instance of jFrame to the contents of the container.
-		content - (*object*) optional object containing various metadata about the content; js tags, meta tags, title, view, etc. See the "notes" section of the renderContent method comments in this file.
-	*/
-	applyFilter: function(name, container, content){
-		dbug.conditional(this.filters[name].bind(this, [container, content]), function(e) {
-			dbug.error('filter failed, name %s, error: ', name, e);
-		});
-	},
-
-	marked: [],
-
-	/*
-		marks a function to execute when the jFrame is unloaded (before new content is loaded)
-		fn - (*function*) the function to mark. Executed only once.
-	*/
-	markForCleanup: function(fn) {
-		this.marked.push(fn);
-	},
-
-	/*
-		linkers are custom event handlers for links that match a specific selector. Ideally, the selector is just a classname.
-		When any link in a jFrame is clicked, it is checked against all registered linkers. If no matches are found, the link
-		is handled by jFrame and loads new content. If there is a match, the matcher's function handles the event.
-		selector - (*string*) a css selector that the link is tested against.
-		fn - (*function*) callback that handles links that match the selector
-		
-		example:
-		
-		//when any link with the class .alert is clicked, alert its href:
-		myjFrame.addLinker('.alert', function(event, link) {
-			event.preventDefault();
-			alert(link.get('href'));
-		});
-	*/
-	addLinker: function(selector, fn){
-		this.linkers[selector] = fn;
-		return this;
-	},
-
-	/*
-		addLinkers:
-		add a group of linkers
-		obj - (*object*) a key/value set of linkers
-	*/
-	addLinkers: function(obj){
-		$each(obj, function(fn, selector){
-			this.addLinker(selector, fn);
-		}, this);
-		return this;
-	},
-
-
-	/*
-		invokeLinker:
-		invokes a specific linker to handle an event (allows you to manually fire a click for a specific linker)
-		selector - (*string*) a css selector that maps to the linker
-		element - (*element*) the element that will have fired the event
-		event - (*event; optional*) the event object to pass along
-	*/
-
-	invokeLinker: function(selector, element, event){
-		dbug.conditional(this.linkers[selector].bind(this, [event, element]), function(e) {
-			dbug.error('linker failed, selector %s, error: ', selector, e);
-		});
-	},
-
-	/*
-		addRenderer: adds an renderer to this instance
-		name - (*string*) a unique name for this renderer
-		fn - (*function*) method, passed the contents (see renderer method above), that may handle those contents if it chooses
-		
-		To remove an renderer, overwrite it thusly:
-		
-		myJFrame.addRenderer('rendererToRemove', $empty);
-	*/
-
-	addRenderer: function(name, fn) {
-		this._renderers[name] = fn;
-	},
-
-	/*
-		addRenderers: adds a group of renderers
-		obj - (*object*) a key/value set of renderers.
-	*/
-
-	addRenderers: function(obj) {
-		$each(obj, function(fn, name) {
-			this.addRenderer(name, fn);
-		}, this);
-	},
-
-	/*
-		destroy: removes the jframe element and cleans up any events that may be attached
-	*/
-
-	destroy: function(){
-		this._sweep(this.element);
-	},
-
-/****************************************************************************************
-	PRIVATE METHODS BELOW
-*****************************************************************************************/
-
-	/*
-		_parseContent
-		html - (*string*) given a string of html, return the js, css links, and body>elements, etc based on the content parsers.
-	*/
-
-	_parseContent: function(html) {
-		var data = {
-			html: html
-		};
-		for(parser in this._contentParsers) {
-			this._contentParsers[parser].call(this, data);
-		}
-		return data;
-	},
-
-	_contentParsers: {
-		scripts: function(data) {
-			//get the inline scripts, take their js out, and remove them from the html
-			var js;
-			data.html = data.html.stripScripts(function(script){
-				js += script;
-			});
-			data.js = js;
-		},
-		styles: function(data) {
-			//get all the link and style tags, remove them from the html
-			data.links = Elements.from(data.html.getTags('links').join(' '));
-			data.links = data.links.filter('[rel=stylesheet]');
-			data.links.concat(Elements.from(data.html.getTags('style').join(' ')));
-			data.html = data.html.stripTags('links');
-		},
-		title: function(data) {
-			//grab the title value
-			data.title = this._getTitleFromHTML(data.html);
-		},
-		meta: function(data) {
-			//grab any meta tags and remove them from the html
-			data.meta = Elements.from(data.html.getTags('meta').join(' ').replace(/(<|<\/)meta/g, '$1span'));
-			data.html = data.html.stripTags('meta');
-		},
-		elements: function(data) {
-			//grab the contents of the body tag
-			data.elements = Elements.from(data.html.getTags('body', true)[0] || data.html);
-		}
-	},
-
-	/*
-		options:
-			see renderContent
-	*/
-	_setRequestOptions: function(request, options) {
-		/*
-			By default, there's only ever one request running per-jframe.
-			The linkers involved all create a new instance of request every time
-			they are invoked. However, Form.Request re-uses its instance. To prevent
-			that request instance from being "set up" twice, exit if there's already
-			a request and it's already been set up.
-		*/
-		if (request._jframeConfigured) return;
-		request._jframeConfigured = true;
-		request.setOptions($merge({
-			//determine if this request should be appearent to the user
-			useSpinner: this.options.spinnerCondition.apply(this, [options]),
-			//where to put the spinner
-			spinnerTarget: this.options.spinnerTarget || this.element,
-			//any options specific to spinner
-			spinnerOptions: { fxOptions: {duration: 200} },
-			//when there's an exception, invoke an error handler
-			onFailure: this.error.bind(this),
-			//do not eval scripts in the response; in theory this should never been overridden
-			evalScripts: false,
-			onRequest: function(){
-				/*
-					Here we cancel any running request if we kick off a new one.
-					The exception here is when we are re-using the running request.
-					FormRequest, for instance, reuses a Request instance. So we check
-					that the current request is not the one we're sending; if it is
-					the one we're sending, don't cancel it; only cancel if it's a different
-					one.
-				*/
-				if (this._request && this._request != request) this._request.cancel();
-				this._request = request;
-			}.bind(this),
-			onSuccess: function(requestTxt){
-				//if there's a method called requestChecker defined in the options, run our response through it
-				//if it returns false, then throw out the response.
-				if (!options.requestChecker || options.requestChecker(requestTxt, request, options)) {
-					this._requestSuccessHandler(request, requestTxt, options);
-				}
-				//we're done with this request
-				this._request = null;
-			}.bind(this),
-			onCcsErrorPopup: function(alert){
-				//when the request shows a popup error because there's been an exception of some sort
-				//attach some logic to that popup so that when the user closes the alert the app window,
-				//if it's never been displayed and is still hidden, is destroyed.
-				alert.addEvent('destroy', function(){
-					if (!this.loadedOnce) {
-						var win = this.getWindow();
-						if (win) win.hide();
-					}
-				}.bind(this));
-			}.bind(this)
-		}, options));
-		//whenever the request completes, destroy it's spinner
-		request.addEvent('complete', function(){
-			if (this.spinner) {
-				this.spinner.destroy();
-				this.spinner = null;
-			}
-		}.bind(request));
-		//custom header for Hue
-		request.setHeader('X-Hue-JFrame', 'true');
-	},
-
-	_checkForEmptyErrorState: function(request, html){
-		return this.options.errorDetector(request, html) || false;
-	},
-
-	_requestSuccessHandler: function(request, html, options) {
-		var error, blankWindowWithError, previousPath;
-		previousPath = this.currentPath;
-		if (this._checkForEmptyErrorState(request, html)) {
-			error = true;
-			if (!this.loadedOnce) blankWindowWithError = true;
-		}
-		var responsePath = request.getHeader('X-Hue-JFrame-Path');
-		var redirected = responsePath && responsePath != this.currentPath;
-
-		if (redirected) this.fireEvent('redirect', [this.currentPath, responsePath]);
-		
-		this.renderContent($merge({
-			content: html,
-			responsePath: responsePath || request.options.url,
-			error: error,
-			blankWindowWithError: blankWindowWithError
-		}, options || {}));
-		var flash = request.getHeader('X-Hue-Flash-Messages');
-		if (flash) {
-			var data = eval(flash);
-			data.each(function(msg) {
-				CCS.Desktop.flashMessage(msg);
-			});
-		}
-		if (redirected) this.fireEvent('redirectAfterRender', [this.currentPath, responsePath]);
-		var loadOptions = $merge({
-			content: html,
-			responsePath: responsePath || request.options.url,
-			error: error,
-			blankWindowWithError: blankWindowWithError,
-			previousPath: previousPath
-		}, options || {});
-		this.behavior.fireEvent('load', loadOptions);
-	},
-
-	/*
-		given an HTML string, find the contents of the <title> tag or the first <h1>
-	*/
-
-	_getTitleFromHTML: function(html){
-		var title = html.getTags('title', true);
-		if (!title.length) title = html.getTags('h1', true);
-		if (title.length) return title[0].stripTags();
-		return '';
-	},
-
-	/*
-		checks the link clicked to see if it matches the selectors in any linkers.
-		returns true if any were found. This allows for custom link handling; by default
-		links load their contents into the jFrame (unless their link hrefs are not on the
-		same domain; in that case, they are loaded in a new tab/window).
-	*/
-	_checkLinkers: function(event, link){
-		var linked;
-		for (selector in this.linkers) {
-			if (link.match(selector)) {
-				linked = true;
-				this.invokeLinker(selector, link, event);
-			}
-		}
-		return linked;
-	},
-	
-	/*
-		default error handler for jframe; passes to CCS.error...
-	*/
-	
-	error: function(message){
-		//TODO(nutron) insert some sort of logging report when this happens
-		this.fireEvent('loadError');
-	},
-
-	/*
-		filters:
-		Filters are functions that are called every time the contents of the jFrame is updated.
-		The method defined is passed the container and can then apply its own logic to the contents
-		of that container. The name specified is not used, except that you can overwrite a filter
-		by using the same name.
-		
-		example: images links with class "alert" shall allert their source url:
-		
-			myjFrame.addFilter('alerts', function(container){
-				var alerter = function(){
-					alert(img.get('alt'));
-				};
-				var imgs = container.getElements('img');
-				imgs.addEvent('click', alerter);
-				//this could be accomplished with delegation too of course; just an example
-				
-				//you can mark a function for execution when the jframe contents are cleaned up when new content is loaded:
-				this.markForCleanup(function(){
-					imgs.removeEvent('click', alerter);
-				});
-			});
-	*/
-
-	/*
-		sweeps all marked functions.
-		target - (*element*) the element to garbage collect;
-	*/
-	_sweep: function(target){
-		this.marked.each(function(fn) {
-			dbug.conditional(fn.bind(this), function(e) {
-				dbug.error('sweeper failed, error: ', e);
-			});
-		});
-		this.marked.empty();
-		this.behavior.cleanup(target);
-		//if there are any child widgets that were not destroyed, destroy them
-		if (this._childWidgets.length) this._childWidgets.each(function(w) { w.eject(); });
-	},
-
-	/*
-		_applyRenderers: renders content into the target
-		content - (*object*) an object with the following props:
-			options - (*object*) the object that created the request
-			html - (*string*) the source html, if it was present
-			js - (*string*) any the inline javascript to evalutate,
-			links - (*elements array*) css links and style tags to be injected into the target
-			elements - (*elements array*) elements to inject into the target (i.e. the actual content)
-			meta - (*elements array*) any meta tags from the content
-			title - (*string*) the title of the content
-			view - (*string*; optional) if defined, the view of the content
-			viewElement - (*element*; optional) if defined, the element for the view
-		
-		Iterates over all the renderers for this instance (including global renderers on the JFrame prototype, which
-		includes the default renderer). Each renderer may inspect the content and elect to handle it instead of the
-		default handler. If it handles it and wishes to prevent the default handler, the renderer returns *true*,
-		otherwise, if it returns *false* (or nothing) the default handler will fill the contents and set up events
-		and filters, linkers, etc. as usual.
-	*/
-
-	_applyRenderers: function(content){
-		var rendered;
-		this.fireEvent('beforeRenderer', [content, content.options]);
-		//loop through all the renderers
-		for (name in this._renderers) {
-			var renderer = this._renderers[name];
-			dbug.conditional(function(){
-				rendered = renderer.call(this, content);
-			}.bind(this), function(e) {
-				dbug.error('renderer failed: name %s, error: ', e);
-			});
-			if (rendered) break;
-		}
-		//if no renderers returned true, then call the default one
-		if (!rendered) this._defaultRenderer(content);
-		this.fireEvent('afterRenderer', [content, content.options]);
-	},
-
-	/*
-		renderers:
-		a key/value set of renderers; see _applyRenderers above
-	*/
-	_renderers: {},
-	
-	/*
-		the default renderer, if no other renderers apply
-		this is the default behavior for jframe which fills the content of the window and updates
-		the history (if history is enabled). It also picks out the view if there is one defined
-		as well as assigns the toolbar to the callback object for JBrowser to do with it what it will.
-		Finally, it calls the callback in the options (if specified) and fires the loadComplete event.
-	*/
-	_defaultRenderer: function(content){
-		var options = content.options;
-		//store the path as the current one
-		if (!options.retainPath) this.currentPath = options.responsePath || this.currentPath;
-
-		if (options.filter) {
-			if (!content.elements.length) return content.elements;
-			var holder = new Element('div').adopt(content.elements);
-			content.elements = holder.getElements(options.filter);
-		}
-
-		//grab the target
-		var target = options.target ? $$(options.target)[0] || this.content : this.content;
-		this._resetOverflow(target);
-
-		//if we're injecting into the main content body, cleanup and scrollto the top
-		if (!options.noScroll) this.scroller.toTop();
-		if (target == this.content) this._sweep(target);
-
-
-		//if we're injecting into the main content body apply the view classes and remove the old one
-		if (target == this.content) {
-			if (this.view) this.content.removeClass(this.view.view);
-			if (content.viewElement) {
-				this.view = {
-					view: content.view,
-					element: content.viewElement,
-					target: target
-				};
-				target.addClass(content.view);
-			}
-		}
-
-		this.loadedOnce = true;
-		//fill the target
-		this.fill(target, content);
-
-		//see if the content has a toolbar in it
-		var toolbar = target.getElements('.toolbar');
-		var footer = target.getElements('.footer');
-
-		//define the callback data
-		var data = {
-			content: options.content,
-			elements: content.elements,
-			requestOptions: content.options,
-			responsePath: options.responsePath,
-			title: content.title || options.title || options.responsePath,
-			userData: options.userData,
-			view: content.view,
-			viewElement: content.viewElement,
-			target: target,
-			toolbar: toolbar,
-			footer: footer,
-			suppressHistory: options.suppressHistory
-		};
-
-		// Let observers know
-		if (!options.suppressLoadComplete) this.fireEvent('loadComplete', data);
-		if (options.callback) options.callback(data);
-	},
-
-	_resetOverflow: function(target) {
-		//reset the overflow style for those filters which alter the content
-		//such as splitview, etc.:
-		target.setStyle('overflow', '');
-	}
-
-});
-
-/****************************************************************************************
-	PUBLIC STATIC METHODS BELOW
-*****************************************************************************************/
-
-/*
-	Static method: CCS.JFrame.addGlobalLinkers
-	Adds a group of linkers to all instances of JFrame.
-	linkers - (*object*) a key/value set of linkers
-*/
-CCS.JFrame.addGlobalLinkers = function(linkers) {
-	CCS.JFrame.implement({
-		linkers: linkers
-	});
-};
-/*
-	Static method: CCS.JFrame.addGlobalFilters
-	Adds a group of filters to all instances of JFrame.
-	filters - (*object*) a key/value set of filters
-*/
-CCS.JFrame.addGlobalFilters = function(filters) {
-	CCS.JFrame.implement({
-		filters: filters
-	});
-};
-
-/*
-	Static method: CCS.JFrame.addGlobalRenderers
-	Adds a group of renderers to all instances of JFrame.
-	renderers - (*object*) a key/value set of renderers
-*/
-CCS.JFrame.addGlobalRenderers = function(renderers) {
-	CCS.JFrame.implement({
-		_renderers: renderers
-	});
-};
+CCS.JFrame = JFrame;

+ 1 - 2
desktop/core/static/js/Source/CCS/CCS.Request.js

@@ -17,7 +17,7 @@
 ---
 description: Refactor of MooTools Request to manage Desktop logins
 provides: [CCS.Request]
-requires: [More/Class.Refactor, /CCS.Error, Core/Request.JSON, Core/Request.HTML]
+requires: [JFrame/JFrame.Request]
 script: CCS.Request.js
 
 ...
@@ -32,7 +32,6 @@ script: CCS.Request.js
 (function() {
 	var loginFormInstance = undefined;
 	var pendingRequests = [];
-
 	var refactoring = {
 		
 		options: {

+ 0 - 195
desktop/core/static/js/Source/CCS/CCS.SideScroller.js

@@ -1,195 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Side Scroller
-provides: [CCS.SideScroller]
-requires: [More/Fx.Elements, More/Element.Shortcuts]
-script: CCS.SideScroller.js
-
-...
-*/
-CCS.SideScroller = new Class({
-	Implements: [Options, Events, Chain],
-	options: {
-		/*
-		onStart: $empty(currentIndex, currentSlide, toIndex, toSlide),
-		onComplete: $empty(index, slide),
-		filter: null,
-		slideWidth: null,
-		*/
-		activeClass: 'active',
-		slides: []
-	},
-	initialize: function(container, options) {
-		this.element = $(container);
-		this.setOptions(options);
-		this.slideNames = $H();
-		if (!this.options.slides.length) {
-			var slides = this.element.getChildren(this.options.filter);
-			if (slides) slides.each(function(slide) {
-				this.addSlide(slide, slide.get('id'));
-			}, this);
-		} else {
-			this.options.slides.each(function(slide){
-				this.addSlide.apply(this, $splat(slide));
-			}, this);
-		}
-		this.slide(0, false);
-		this.fx = new Fx.Elements([], {
-			link: 'cancel',
-			transition: 'expo:in:out',
-			onComplete: function(){
-				this.fireEvent('complete', [this.current, this.slides[this.current]]);
-			}.bind(this)
-		});
-		this.internalChain = new Chain();
-	},
-	toElement: function(){
-		return this.element;
-	},
-	slides: [],
-	current: 0,
-
-	getSlide: function(slide) {
-		switch($type(slide)) {
-			case 'number': 
-				return this.slides[slide];
-			case 'string': 
-				return this.slideNames[slide];
-			default: return slide;
-		}
-	},
-
-	getSlideName: function(slide) {
-		slide = this.getSlide(slide);
-		return this.slideNames.keyOf(slide);
-	},
-
-	getCurrent: function(type){
-		switch(type) {
-			case 'name': return this.getSlideName(this.current);
-			case 'number': return this.current;
-			case 'element': return this.slides[this.current];
-		} 
-	},
-
-	addSlide: function(slide, name){
-		slide = $(slide);
-		this.element.adopt(slide);
-		this.slides.include(slide);
-		if (name) this.slideNames[name] = slide;
-		if(this.current != null && this.slides.indexOf(slide) != this.current) slide.hide();
-		return this;
-	},
-	removeSlide: function(slide) {
-		slide = this.getSlide(slide);
-		if (!slide) return this;
-		if (this.current == this.slides.indexOf(slide) && this.slides.length > 1) {
-			this.internalChain.chain(function(){
-				this.removeSlide(slide);
-			}.bind(this));
-			this[this.current == 0 ? 'slideForward' : 'slideBack']();
-		} else {
-			this.slides.erase(slide);
-			slide.dispose();
-		}
-		return this;
-	},
-	getWidth: function(slide, subMargins){
-		subMargins = $pick(subMargins, true);
-		if (this.options.slideWidth) return this.options.slideWidth;
-		var x = this.element.getSize().x;
-		if (!subMargins) return x;
-		var calc = function(w, i) {
-			if (i%2) x = x - w.toInt();
-		};
-		slide.measure(function(){
-			slide.getStyle('padding').split(' ').each(calc);
-			slide.getStyle('margin').split(' ').each(calc);
-		});
-		return x;
-	},
-	slide: function(slide, useFx) {
-		var current = this.slides[this.current||0];
-		var next = this.getSlide(slide);	
-		if (next == current) return;
-		var index = this.slides.indexOf(next);
-		this.fireEvent('start', [this.current, current, index, next]);
-		next.addClass(this.options.activeClass);
-		if (current) current.removeClass(this.options.activeClass);
-
-		this.fx.elements = this.fx.subject = [current, next];
-		var dir = index > (this.current||0) ? 'forward' : 'back';
-		if ($pick(useFx, true)) {
-			var width = this.getWidth(next, false);
-			var overflow = this.element.getStyle('overflow');
-
-			current.setStyles({
-				position: 'absolute',
-				top: 0
-			});
-
-			next.setStyles({
-				left: dir == 'forward' ? width : -width,
-				position: 'relative',
-				display: 'block'
-			});
-
-			this.element.setStyle('overflow', 'visible');
-
-			this.fx.start({
-				'0': {
-					left: dir == 'forward' ? -width : width
-				},
-				'1': {
-					left: 0
-				}
-			}).chain(function(){
-				current.setStyles({
-					display: 'none',
-					position: 'relative',
-					left: 0
-				});
-				this.element.setStyles({
-					overflow: overflow || 'visible'
-				});
-				next.setStyles({
-					position: 'relative',
-					width: 'auto'
-				});
-				this.callChain();
-				this.internalChain.callChain();
-			}.bind(this));
-		} else {
-			current.hide();
-			next.show();
-			this.scroller.fireEvent('complete', [this.current, this.slides[this.current]]);
-			this.callChain();
-			this.internalChain.callChain();
-		}
-		this.current = index;
-		return this;
-	},
-	slideForward: function(){
-		if (this.slides[this.current + 1]) this.slide(this.current + 1);
-		return this;
-	},
-	slideBack: function(){
-		if (this.current > 0) this.slide(this.current - 1);
-		return this;
-	}
-});

+ 0 - 106
desktop/core/static/js/Source/CCS/CCS.js

@@ -24,109 +24,3 @@ script: CCS.js
 ...
 */
 var CCS = new Events();
-/* config */
-Request.implement({
-	options: {
-		evalScripts: true,
-		noCache: true
-	}
-});
-
-Spinner.implement({
-	options: {
-		fxOptions: {
-			link: 'cancel'
-		}
-	}
-});
-
-Hash.implement({
-	//implements the ability to serialize arrays into query strings without brackets
-	//foo[0]=bar&foo[1]=baz
-	//vs
-	//foo=bar&foo=baz
-	toQueryString: function(base, useBrackets){
-		useBrackets = useBrackets == null ? true : useBrackets;
-		var queryString = [];
-		Hash.each(this, function(value, key){
-			if (base && useBrackets) key = base + '[' + key + ']';
-			var result;
-			switch ($type(value)){
-				case 'object': result = Hash.toQueryString(value, key); break;
-				case 'array':
-					if (useBrackets) {
-						var qs = {};
-						value.each(function(val, i){
-							qs[i] = val;
-						});
-						result = Hash.toQueryString(qs, key);
-					} else {
-						result = value.map(function(val){
-							return key + '=' + encodeURIComponent(val);
-						}).join('&');
-					}
-				break;
-				default: result = key + '=' + encodeURIComponent(value);
-			}
-			if (value != undefined) queryString.push(result);
-		});
-		return queryString.join('&');
-	}
-});
-
-URI.implement({
-
-	options: {
-		useBrackets: false
-	},
-
-	setData: function(values, merge, part){
-		if (typeof values == 'string'){
-			data = this.getData();
-			data[arguments[0]] = arguments[1];
-			values = data;
-		} else if (merge) {
-			values = $merge(this.getData(), values);
-		}
-		return this.set(part || 'query', Hash.toQueryString(values, null, this.options.useBrackets));
-	}
-
-});
-
-Element.Events.esc = {
-	base: 'keydown', //we set a base type
-	condition: function(event){ //and a function to perform additional checks.
-		return (event.escape == true); //this means the event is free to fire
-	}
-};
-StickyWin.implement({
-	options: {
-		destroyOnClose: true,
-		allowNegative: false
-	}
-});
-ART.Popup.implement({
-	options: {
-		destroyOnClose: true,
-		allowNegative: false,
-		posMin: {x: 0, y: 0}
-	}
-});
-StickyWin.Stacker.implement({
-	options: {
-		zIndexBase: 10003
-	}
-});
-StickyWin.WM.setOptions({
-	zIndexBase: 10003
-});
-HtmlTable.implement({
-
-	options: {
-		setStylesOnStartup: false
-	}
-
-});
-
-//allows for selectors like $$('[data-foo-bar]'); TODO: move this up at some point. Note that it'll be in Moo 1.3
-// Selectors.RegExps.combined = (/\.([\w-]+)|\[([\w-]+)(?:([!*^$~|]?=)(["']?)([^\4]*?)\4)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g);

+ 0 - 177
desktop/core/static/js/Source/Forms/EditInline.js

@@ -1,177 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: EditInline
-provides: [EditInline]
-requires: [Core/Class.Extras, More/Class.Binds, More/Class.Occlude, Core/Element.Event,
-  More/Element.Shortcuts]
-script: EditInline.js
-
-...
-*/
-
-//positions an input over an object to edit it inline
-var EditInline = new Class({
-	Implements: [Options, Class.Occlude, Events],
-	Binds: ['edit', 'mouseenter', 'mouseleave', 'handleDocKey', 'handleDocClick'],
-	options: {
-		//onEnter: $empty,
-		//onEdit: $empty(input),
-		tag: 'input',
-		hoverClass: 'edit_highlight',
-		activeClass: 'edit_activated',
-		props: {
-			styles: {}
-		},
-		injectWhere: 'after',
-		onEdit: $empty,
-		positionOptions: {},
-		preventDefault: false,
-		editEvent: 'click',
-		selectBegin: null,
-		selectEnd: null,
-		applySize: true,
-		applyPosition: true,
-		value: false, //value or function, if true, uses innerHTML of element
-		/** if true, clicking out of the edit box acts like cancel. If false, acts like enter
-		 TODO(nutron) can I make this default false, plz? kthxbye -todd */
-		clickOutCancels: true
-	},
-	property: 'EditInline',
-	initialize: function(container, options){
-		this.container = $(container);
-		if (this.occlude(this.property, this.container)) return this.occluded;
-		this.setOptions(options);
-		this.attach();
-	},
-	toElement: function(){
-		return this.element;
-	},
-	attach: function(attach) {
-		var method = $pick(attach, true) ? 'addEvents' : 'removeEvents';
-		//mouseover/out behavior to allow for highlight invitation
-		var events = {
-			mouseenter: this.mouseenter,
-			mouseleave: this.mouseleave
-		};
-		//if we're attaching an edit event (like "click") attach it
-		if (this.options.editEvent) events[this.options.editEvent] = this.edit;
-		this.container[method](events);
-		//add document listener for out-clicks and esc key
-		document[method]({
-			keyup: this.handleDocKey,
-			click: this.handleDocClick
-		});
-	},
-	detach: function(){
-		this.attach(false);
-	},
-
-	// If the user hits escape, abort the edit
-	handleDocKey: function(e) {
-		if (e.key == "esc") {
-			this.close();
-		}
-	},
-
-	//if user clicks out, close or commit depending on the options
-	handleDocClick: function(e) {
-		if (!this.activating && this.active && e.type == "click" && e.target != this.element) {
-			if (this.options.clickOutCancels) {
-				this.close();
-			} else {
-				this.enter();
-			}
-		}
-	},
-
-	/** "commit" the value that the user has entered */
-	enter: function() {
-		this.close();
-		this.fireEvent('enter', this.element.get('value'));
-	},
-
-	mouseenter: function(){
-		this.container.addClass(this.options.hoverClass);
-	},
-	mouseleave: function(){
-		this.container.removeClass(this.options.hoverClass);
-	},
-	//shows input with the given value defaulted and selected
-	edit: function(value, begin, end){
-		if (this.activating || this.active) return;
-		this.activating = true;
-		//if this was used as an event listener, reset the value
-		if ($type(value) == "event") value = null;
-		if (!this.element) {
-			//make the input; if the user hits enter, fire the enter event
-			this.element = new Element(this.options.tag, this.options.props);
-			this.element.addEvent('keydown', function(e) {
-				if (this.active && !this.activating && e.key == "enter") this.enter();
-			}.bind(this)).store(this.property, this);
-		}
-		var input = this.element;
-		//inject it after the element we're editing
-		input.hide().inject(this.container, this.options.injectWhere);
-		value = value || this.options.value;
-		if (value) input.set('value', $type(value) == "boolean" ? this.container.get('html') : $lambda(value)());
-		//position it
-		var dim = this.container.getComputedSize();
-		if (this.options.applySize) {
-			input.setStyles({
-				width: this.options.props.styles.width||(this.container.getScrollSize().x),
-				height: this.options.props.styles.height||(this.container.getScrollSize().y)
-			});
-		}
-		if (this.options.applyPosition) {
-			input.position(
-				$merge(this.options.positionOptions, {
-					relativeTo: this.container,
-					position: 'upperLeft'
-				})
-			);
-		}
-	
-		begin = (typeof begin == "number") ? begin : (typeof this.options.selectBegin == "number") ? this.options.selectBegin : 0;
-		end = (typeof end == "number") ? end : (typeof this.options.selectEnd == "number") ? this.options.selectEnd : value.length;
-	
-		this.active = true;
-		this.fireEvent('edit', input);
-		input.show();
-		if (input.createTextRange) {
-		  var range = input.createTextRange();
-		  range.collapse(true);
-		  range.moveEnd('character', end);
-		  range.moveStart('character', begin);
-		  range.select();
-		} else if (input.setSelectionRange) {
-		  input.focus();
-		  input.setSelectionRange(begin, end);
-		} else {
-		  input.select();
-		}
-		(function(){
-			this.activating = false;
-		}).delay(30, this);
-	},
-	close: function(){
-		if (!this.active) return;
-		this.element.hide();
-		this.active = false;
-		this.fireEvent('hide');
-	}
-});

+ 0 - 54
desktop/core/static/js/Source/Forms/Form.Request.JSON.js

@@ -1,54 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Handles the basic functionality of submitting a form and recieving JSON as a result.
-provides: [Form.Request.JSON]
-requires: [Core/Request.JSON, More/Form.Request]
-script: Form.Request.JSON.js
-
-...
-*/
-Form.Request.JSON = new Class({
-
-	Extends: Form.Request,
-
-	initialize: function(form, options){
-		this.parent(form, form, options);
-	},
-
-	makeRequest: function(){
-		this.request = new Request.JSON($merge({
-				url: this.element.get('action'),
-				emulation: false,
-				spinnerTarget: this.element,
-				method: this.element.get('method') || 'post'
-		}, this.options.requestOptions)).addEvents({
-			success: function(obj, text){
-				['success', 'complete'].each(function(evt){
-					this.fireEvent(evt, [obj, text]);
-				}, this);
-			}.bind(this),
-			failure: function(xhr){
-				this.fireEvent('failure', xhr);
-			}.bind(this),
-			exception: function(){
-				this.fireEvent('failure', xhr);
-			}.bind(this)
-		});
-	}
-
-});

+ 0 - 134
desktop/core/static/js/Source/JFrameFilters/CCS.JFrame.AutoRefresh.js

@@ -1,134 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: An auto refresh filter for Jframe keyed on the meta-refresh tag.
-provides: [CCS.JFrame.AutoRefresh]
-requires: [/CCS.JFrame, More/Date, More/Table]
-script: CCS.JFrame.AutoRefresh.js
-
-...
-*/
-
-(function(){
-var urlRE = /^url=/;
-
-CCS.JFrame.addGlobalFilters({
-
-	autorefresh: function(container, content){
-		$clear(refreshTable.get(this));
-		//get the first input.autorefresh and use its value as the duration before
-		//it auto refreshes the input. if span.sec_to_autorefresh is present, fill its
-		//contents with the number of seconds until a refresh.
-		var ignoreAutoRefresh = content && content.options && content.options.ignoreAutoRefresh;
-		if (!ignoreAutoRefresh && content && content.meta) setupAutoRefresh.call(this, content);
-	}
-
-});
-
-//given the content object from the filter handler, set up an auto refresher if the meta tag
-//for it is present
-var setupAutoRefresh = function(content) {
-	var sec, url;
-	//get the meta tags from the content and check them for a refresh tag
-	content.meta.each(function(meta) {
-		var parts = meta.get('content').split(';');
-		if(meta.get('http-equiv') == "refresh") {
-			sec = parts[0].toInt();
-			if (parts[1]) url = unescape(parts[1].replace(urlRE, ''));
-		}
-	}, this);
-	//if there's no refresh variable, exit
-	if (!sec) return;
-	//determin the timestamp for when we should refresh
-	var end = new Date().increment('second', sec);
-	var until, diff, span;
-	//this method updates the DOM when the counter decrements
-	var update = function() {
-		span = $(this).getElement('span.sec_to_autorefresh');
-		diff = ((end - new Date()) / Date.units['second']());
-		until = diff.toInt();
-		if (span) span.set('html', until);
-	}.bind(this);
-	update();
-
-	//this method compares to urls to see if they match
-	var compareURI = function(one, two) {
-		return new URI(unescape(one)).toString() == new URI(unescape(two)).toString();
-	};
-
-	//this method checks a request to see if it's been spoiled
-	//with the ajax linkers and the live url, it's possible that
-	//the user clicked a link that updated the url for this frame
-	//while a request was running
-	var requestChecker = function(text, request, options) {
-		var valid = compareURI(options.url, url ? url : this.currentPath);
-		if (!valid) load();
-		return valid;
-	}.bind(this);
-
-	//this method refreshs the frame either with the url from the meta
-	//tag or from the current path
-	var load = function(){
-		if (url && url != unescape(this.currentPath)) {
-			this.load({
-				requestPath: url,
-				autorefreshed: true,
-				requestChecker: requestChecker
-			});
-		} else {
-			this.refresh({ autorefreshed: true, requestChecker: requestChecker });
-		}
-	}.bind(this);
-
-	//this timer goes off ever .25 seconds and checks to see if we've reached our
-	//target refresh time
-	var timer = (function(){
-		if (diff < 1) {
-			if (span) span.set('html', 0);
-			load();
-			$clear(timer);
-		} else {
-			update();
-		}
-	}).periodical(250, this);
-
-	//this stores the timer in a universal table object.
-	refreshTable.set(this, timer);
-
-	//when a new request is generated (i.e. the user clicks a link, or refresh, or autorefresh)
-	//check to see if the options for the request have the fullFrameLoad flag set to true; if not
-	//restart our counter. For example, if a user does an AJAX request to update a dom (as we do
-	//in the AjaxLoad jframe linker), that's still a request, but it's not a request for the entire
-	//page so has no refresh handling of its own
-	var clearer = function(requestPath, userData, options){
-		if (!options.fullFrameLoad) {
-			setupAutoRefresh.call(this, content);
-		} else {
-			$clear(timer);
-			this.removeEvent('request', clearer);
-		}
-	};
-
-	this.addEvent('request', clearer);
-	this.markForCleanup(function(){
-		$clear(timer);
-	});
-};
-
-var refreshTable = new Table();
-
-})();

+ 0 - 32
desktop/core/static/js/Source/JFrameFilters/CCS.JFrame.Clearfix.js

@@ -1,32 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Adds clearfix classes to the root elements every time JFrame loads.
-provides: [CCS.JFrame.Clearfix]
-requires: [/CCS.JFrame]
-script: CCS.JFrame.Clearfix.js
-
-...
-*/
-
-CCS.JFrame.addGlobalFilters({
-
-	clearfix: function(container) {
-		container.getChildren().addClass('clearfix');
-	}
-
-});

+ 0 - 58
desktop/core/static/js/Source/JFrameFilters/CCS.JFrame.DoubleClickDelegate.js

@@ -1,58 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Creates a double click action for any element with the class .dbclick_delegate.
-provides: [CCS.JFrame.DoubleClickDelegate]
-requires: [/CCS.JFrame, Widgets/Element.Data]
-script: CCS.JFrame.DoubleClickDelegate.js
-
-...
-*/
-
-CCS.JFrame.doubleClickHandler = function(jframe, event, delegate){
-	var getLink = function(delegate){
-		//retrieve configuration from the css property JSON
-		var data = delegate.get('data', 'dblclick-delegate', true);
-		if (data && data.dblclick_loads) {
-			//find the link that is to be activated when we double click the delegate
-			//and load its contents
-			return delegate.getElement(data.dblclick_loads);
-		}
-	};
-	
-	var link = getLink(delegate);
-	if (link) jframe.callClick(event, link, true);
-};
-
-CCS.JFrame.addGlobalFilters({
-
-	//intercept double click behaviors
-	doubleClickDelegates: function(container) {
-
-		//define our handler
-		var handler = function(e, delegate){
-			CCS.JFrame.doubleClickHandler(this, e, delegate);
-		}.bind(this);
-		//add this behavior to the delegate
-		container.addEvent('dblclick:relay([data-dblclick-delegate])', handler);
-		//remove it when we unload (incase we delegate to the jframe container)
-		this.markForCleanup(function(){
-			container.removeEvent('dblclick:relay([data-dblclick-delegate])', handler);
-		});
-	}
-
-});

+ 0 - 88
desktop/core/static/js/Source/JFrameFilters/CCS.JFrame.FormRequest.js

@@ -1,88 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Configures every form to use the Form.Request behavior.
-provides: [CCS.JFrame.FormRequest]
-requires: [/CCS.JFrame, More/Form.Request]
-script: CCS.JFrame.FormRequest.js
-
-...
-*/
-
-CCS.JFrame.addGlobalFilters({
-
-	//this runs BEFORE Behavior.FormRequest
-	formRequest: function(container){
-		//get all forms in the response
-		container.getElements('form').each(function(form){
-			//set their action url and add the FormRequest filter
-			if(form.get('action')){
-				form.set('action', new URI(form.get('action'), {base: this.currentPath}));
-			} else {
-				form.set('action', new URI(this.currentPath));
-				form.set('data', 'live-path', true);
-			}
-			form.addDataFilter("FormRequest");
-		}, this);
-	}
-
-});
-
-//this runs AFTER Behavior.FormRequest
-Behavior.addGlobalPlugin('FormRequest', 'JFrameFormRequest', function(element, methods){
-	//get the Form.Request instance
-	var formRequest = element.get('formRequest');
-	//tell it not to update anything
-	formRequest.request.options.update = null;
-	var options = {};
-	['append', 'replace', 'target', 'after', 'before'].each(function(action){
-		var selector = element.get('data', 'ajax-' + action);
-		if (selector) {
-			var target = methods.getContentElement().getElement(selector);
-			if (target) {
-				$extend(options, {
-					target: target,
-					spinnerTarget: target,
-					noScroll: true,
-					onlyProcessPartials: true,
-					ignoreAutoRefresh: true,
-					suppressLoadComplete: true,
-					fullFrameLoad: false,
-					retainPath: true
-				});
-			}
-		}
-	});
-	//configure its request to use JFrame's response handler
-	methods.configureRequest(formRequest.request, options);
-	//if the element does not initially have an action, update its action to the new path, on livePathUpdate
-	var pathUpdate = function(uri) {
-		element.set('action', uri);
-	};
-	if (element.get('data', 'live-path')){
-		methods.addEvent('livePathUpdate', pathUpdate);
-	}
-	formRequest.addEvent('send', function(form, query){
-		formRequest.request.setOptions({
-			formAction: form.get('action'),
-			formData: query
-		});
-	});
-	this.markForCleanup(element, function() {
-		methods.removeEvent('livePathUpdate', pathUpdate);
-	});
-});

+ 0 - 40
desktop/core/static/js/Source/JFrameFilters/CCS.JFrame.ToggleHistory.js

@@ -1,40 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*
----
-description: Shows or hides the history component from the widget.
-provides: [CCS.JFrame.ToggleHistory]
-requires: [/CCS.JFrame, Widgets/ART.History]
-script: CCS.JFrame.ToggleHistory.js
-
-...
-*/
-
-CCS.JFrame.addGlobalFilters({
-
-	toggleHistory: function(container) {
-		var win = this.getWindow();
-		if (!win || !win.history) return;
-		var defaultState = win.options.displayHistory;
-		var history = win.history;
-		var hiding = container.get('html').contains('ccs-hide_history');
-		var showing = container.get('html').contains('ccs-show_history');
-		if (showing || (defaultState && !hiding)) win.showHistory();
-		else win.hideHistory();
-	}
-
-});

+ 0 - 109
desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.AjaxLoad.js

@@ -1,109 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Provides functionality for links that load content into a target element via ajax.
-provides: [CCS.JFrame.AjaxLoad]
-requires: [/CCS.JFrame]
-script: CCS.JFrame.AjaxLoad.js
-...
-*/
-
-(function(){
-
-	/*
-		loads the contents of a link into a specific target
-		* event - the event object from the link click
-		* link - the link clicked
-		
-		notes:
-		* links have properties for one of data-ajax-append, data-ajax-replace, and data-ajax-target
-		* replace means destroy the target and replace it entirely with the response.
-		* append means leave everything in place and inject the response after the target.
-		* target means empty the target and fill it with the response
-		* links with a "data-ajax-filter" property will inject only the elements that match the selector it specifies.
-		  For example, if you have a table that you want to add rows to, and your request returns an HTML document that
-		  includes an entire table, you would specify data-ajax-filter="table tbody tr" to only inject the rows from
-		  the body in the response.
-	*/
-
-	var linkers = {};
-
-	['append', 'replace', 'target', 'after', 'before'].each(function(action){
-
-		linkers['[data-ajax-' + action + ']'] = function(event, link){
-			var target = $(this).getElement(link.get('data', 'ajax-' + action));
-			if (!target) {
-				link.erase('data-ajax-' + action);
-				dbug.log('could not ' + action + ' the target element with response; element matching selector %s was not found', link.get('data', 'ajax-' + action));
-				this.callClick(event, link, true);
-				return;
-			}
-
-			var requestTarget = target;
-			if (action != 'target') requestTarget = new Element('div');
-
-			var options = {
-				filter: link.get('data', 'ajax-filter'),
-				requestPath: link.get('href'),
-				spinnerTarget: target,
-				target: requestTarget,
-				onlyProcessPartials: true,
-				ignoreAutoRefresh: true,
-				suppressLoadComplete: true,
-				fullFrameLoad: false,
-				retainPath: true,
-				callback: function(data){
-					switch(action){
-						case 'replace':
-							//reverse the elements and inject them
-							//reversal is required since it injects each after the target
-							//pushing down the previously added element
-							data.elements.reverse().injectAfter(target);
-							target.destroy();
-							break;
-						case 'append':
-						case 'after':
-							//see note above in 'replace' case as to why we use reverse here
-							data.elements.reverse().injectAfter(target);
-							break;
-						case 'before':
-							data.elements.reverse().injectBefore(target);
-						//do nothing for update, as Request.HTML already does it for you
-					}
-					var state = {
-						event: event,
-						link: link,
-						target: target,
-						action: action
-					};
-					//pass along the data that came back from JFrame's response handler as well as the state of this ajax load.
-					this.fireEvent('ajaxLoad', [data, state]);
-					this.behavior.fireEvent('update', [data, state]);
-				}.bind(this)
-			};
-			var spinnerTarget = link.get('data', 'spinner-target');
-			if (spinnerTarget) {
-				spinnerTarget = $(this).getElement(spinnerTarget);
-				options.spinnerTarget = spinnerTarget;
-			}
-
-			this.load(options);
-		};
-	});
-	CCS.JFrame.addGlobalLinkers(linkers);
-
-})();

+ 0 - 37
desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.CheckAllOrNone.js

@@ -1,37 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Checks all or none of a group of checkboxes.
-provides: [CCS.JFrame.CheckAllOrNone]
-requires: [/CCS.JFrame]
-script: CCS.JFrame.CheckAllOrNone.js
-
-...
-*/
-
-CCS.JFrame.addGlobalLinkers({
-
-	'.ccs-checkAll': function(event, link){
-		$(this).getElements(link.get('data', 'check-group')).set('checked', true);
-	},
-	
-	'.ccs-checkNone': function(event, link){
-		$(this).getElements(link.get('data', 'check-group')).set('checked', false);
-	}
-	
-
-});

+ 18 - 14
desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.Chooser.js

@@ -15,10 +15,10 @@
 // limitations under the License.
 /*
 ---
-description: Opens a CCS.FileChooser for any element with the ccs-choose_file, ccs-choose_dir, or ccs-choose_path  class and places the chosen path in the input field whose "name" attribute is equal to the data stored in  the "chooseFor" attribute of the element.
-provides: [CCS.JFrame.Chooser]
-requires: [/CCS.JFrame]
-script: CCS.JFrame.Chooser.js
+description: Opens a Hue.FileChooser for any element with the hue-choose_file, hue-choose_dir, or hue-choose_path  class and places the chosen path in the input field whose "name" attribute is equal to the data stored in  the "chooseFor" attribute of the element.
+provides: [Hue.JFrame.Chooser, CCS.JFrame.Chooser]
+requires: [/Hue.JFrame]
+script: Hue.JFrame.Chooser.js
 ...
 */
 
@@ -35,14 +35,14 @@ var chooser = function(filter){
 		//Stop link from its standard action
 		e.preventDefault();
 		var targetName = link.get('data-chooseFor');
-		var parent = link.getParent('form') || $(this.parentWidget);
+		var jbrowser = this.getWindow();
+		var parent = link.getParent('form') || $(jbrowser);
 		var targetInput = parent.getElement('input[name=' + targetName + ']');
-		var jbrowser = this.parentWidget;
-		//use parent widget to get jbrowser for CCS.chooseFile
-		//CCS.chooseFile creates an ART alert which contains a FileChooser from which teh user can select a file.
+		//use parent widget to get jbrowser for Hue.chooseFile
+		//Hue.chooseFile creates an ART alert which contains a FileChooser from which teh user can select a file.
 		//The function argument is the callback which is called after the OK button in the ART alert is clicked.
-		CCS.Desktop.load("FileBrowser", function(){
-			CCS.chooseFile(jbrowser, '/', caption[filter], function(data){
+		Hue.Desktop.load("FileBrowser", function(){
+			Hue.chooseFile(jbrowser, '/', caption[filter], function(data){
 				targetInput.set('value', data.path);
 				targetInput.fireEvent('change');
 				//hide overtext on targetInput
@@ -55,10 +55,14 @@ var chooser = function(filter){
 	};
 };
 
-CCS.JFrame.addGlobalLinkers({
-	'.ccs-choose_file': chooser('file'),
-	'.ccs-choose_dir': chooser('dir'),
-	'.ccs-choose_path': chooser('any')
+Hue.JFrame.addGlobalLinkers({
+	'.hue-choose_file': chooser('file'),
+	'.hue-choose_dir': chooser('dir'),
+	'.hue-choose_path': chooser('any'),
+	//deprecated
+	'.hue-choose_file': chooser('file'),
+	'.hue-choose_dir': chooser('dir'),
+	'.hue-choose_path': chooser('any')
 });
 
 })();

+ 0 - 47
desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.ConfirmAndPost.js

@@ -1,47 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Makes all links with the css class .confirm_and_post prompt the user and then send the link url as a post if they confirm.
-provides: [CCS.JFrame.ConfirmAndPost]
-requires: [/CCS.JFrame, Widgets/ART.Alerts]
-script: CCS.JFrame.ConfirmAndPost.js
-
-...
-*/
-
-CCS.JFrame.addGlobalLinkers({
-
-	'.confirm_and_post': function(e, link){
-		//for each link with the class .confirm_and_post, confirm with the user and then post the url
-		//use the link's title for the caption of the popup, and the alt as the body, 
-		//defaulting to "Confirm" and "Are you sure?" respectively.
-		if (e) e.preventDefault();
-		
-		var win = this.getWindow();
-		var confirmer;
-		if (win) confirmer = win.confirm.bind(win);
-		else confirmer = ART.confirm;
-		confirmer(link.get('title') || link.retrieve('tip:title') || 'Confirm', link.get('alt') || "Are you sure?", function(){
-			this.load({
-				requestPath: link.get('href').split('?')[0],
-				data: new URI(link.get('href')).get('data'),
-				method: 'post'
-			});
-		}.bind(this));
-	}
-
-});

+ 0 - 38
desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.FakeRefresh.js

@@ -1,38 +0,0 @@
-/*
----
-description: Loads a new url into the view but tells JFrame it's a refresh action rather than a normal load. This is only useful for forcing a partial refresh to a different url than the original.
-provides: [CCS.JFrame.FakeRefresh]
-requires: [/CCS.JFrame]
-script: CCS.JFrame.FakeRefresh.js
-
-...
-*/
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-CCS.JFrame.addGlobalLinkers({
-
-	//any link with a target value launches the app named as the target if there is one
-	//else opens new browser window/tab
-	'.ccs-fake_refresh': function(event, link) {
-		this.fireEvent('refresh');
-		this.load({
-			requestPath: new URI(link.get('href'), {base: this.currentPath}).toString(),
-			autorefreshed: true,
-			forcePartial: true
-		});
-	}
-
-});

+ 0 - 34
desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.HideParent.js

@@ -1,34 +0,0 @@
-/*
----
-description: Hides the parent of a link when clicked.
-provides: [CCS.JFrame.HideParent]
-requires: [/CCS.JFrame]
-script: CCS.JFrame.HideParent.js
-
-...
-*/
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-CCS.JFrame.addGlobalLinkers({
-
-	'[data-hide-parent]': function(event, link){
-		var parent = link.getParent(link.getData('hide-parent'));
-		if (parent) parent.hide();
-		else dbug.warn('could not locate parent element to hide', link);
-	}
-
-});

+ 0 - 95
desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.LivePath.js

@@ -1,95 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Provides functionality for links that update the window path on the fly.
-provides: [CCS.JFrame.LivePath]
-requires: [/CCS.JFrame]
-script: CCS.JFrame.LivePath.js
-...
-*/
-
-(function(){
-
-	CCS.JFrame.addGlobalLinkers({
-
-		'[data-livepath-toggle]': function(event, link){
-			this.currentPath = updateLivePath.call(this, link, this.currentPath);
-		},
-		//these are a bit silly, but mootools 1.2 selector engine doesn't support
-		//complex selectors for element.match, so we have to do a bit of repetition here
-		'[data-livepath-add]': function(event, link){
-			this.currentPath = updateLivePath.call(this, link, this.currentPath);
-		},
-		'[data-livepath-remove]': function(event, link){
-			this.currentPath = updateLivePath.call(this, link, this.currentPath);
-		}
-	});
-
-	var updateLivePath = function(link, currentPath){
-		var setData = function(uri, paths, action){
-			var okToRemove = action == "toggle" || action == "remove";
-			var okToAdd = action == "toggle" || action == "add";
-			for (path in paths){
-				var state = uri.getData(path);
-				if (!state) {
-					uri.setData(path, paths[path]);
-				} else if ($type(state) == "string") {
-					if (state == paths[path] && okToRemove)
-						uri.setData(path, null);
-					else if (okToAdd)
-						uri.setData(path, [state, paths[path]]);
-				} else if ($type(state) == "array") {
-					if (state.contains(paths[path]) && okToRemove) state.erase(paths[path]);
-					else if (okToAdd) state.push(paths[path]);
-
-					if (state.length) uri.setData(path, state);
-					else uri.clearData(path);
-				}
-			}
-		};
-		
-		var getDataObject = function(dataString) {
-			var dataObject;
-			if (dataString == "true") {
-				dataObject = {};
-				dataObject[link.get('name')] = link.get('value');
-			} else {
-				dataObject = dataString.parseQueryString();
-			}
-			return dataObject;
-		};
-		
-		var toggle = link.get('data', 'livepath-toggle'),
-		    add = link.get('data', 'livepath-add'),
-		    remove = link.get('data', 'livepath-remove'),
-		    uri = new URI(currentPath);
-		if (toggle) {
-			toggle = getDataObject(toggle);
-			setData(uri, toggle, 'toggle');
-			
-		} else if (add) {
-			add = getDataObject(add);
-			setData(uri, add, 'add');
-		} else if (remove) {
-			remove = getDataObject(remove);
-			setData(uri, remove, 'remove');
-		}
-		this.fireEvent('livePathUpdate', uri);
-		return uri.toString();
-	};
-
-})();

+ 0 - 37
desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.Nav.js

@@ -1,37 +0,0 @@
-/*
----
-description: Makes links with .css-nav_back and .ccs-nav_next navigate forward and back.
-provides: [CCS.JFrame.Nav]
-requires: [/CCS.JFrame]
-script: CCS.JFrame.Nav.js
-
-...
-*/
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-CCS.JFrame.addGlobalLinkers({
-
-	//any link with a target value launches the app named as the target if there is one
-	//else opens new browser window/tab
-	'.ccs-nav_next': function(event, link) {
-		this.getWindow().history.forward();
-	},
-
-	'.ccs-nav_back': function(event, link) {
-		this.getWindow().history.back();
-	}
-
-});

+ 0 - 34
desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.NoScroll.js

@@ -1,34 +0,0 @@
-
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Provides functionality for links that prevent the window from scrolling to the top after they are loaded.
-provides: [CCS.JFrame.NoScroll]
-requires: [/CCS.JFrame]
-script: CCS.JFrame.NoScroll.js
-...
-*/
-CCS.JFrame.addGlobalLinkers({
-
-	'.noScroll': function(event, link){
-		link.removeClass('noScroll');
-		this.callClick(event, link, false, {
-			noScroll: true
-		});
-	}
-
-});

+ 0 - 49
desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.PromptAndPost.js

@@ -1,49 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Makes all links with the css class .prompt_and_post prompt the user with the contents of the url in the link and then send the values they input when they hit ok.
-provides: [CCS.JFrame.PromptAndPost]
-requires: [/CCS.JFrame, Widgets/ART.Alerts]
-script: CCS.JFrame.PromptAndPost.js
-
-...
-*/
-
-CCS.JFrame.addGlobalLinkers({
-
-	'.prompt_and_post': function(e, link){
-		//for each link with the class .prompt_and_post, prompt the user to fill out a form in a popup
-		//with the contents of the link's href, applying delegates to the popup, and handling the 
-		//form submission with a Form.Request.
-		if (e) e.preventDefault();
-		var target = new Element('div', {'class': 'jframe_prompt'});
-		this.load({
-			target: target,
-			suppressLoadComplete: true,
-			requestPath: link.get('href'),
-			callback: function(data){
-				var size = this.content.getSize();
-				this.prompt(data.title || 'Enter Details', target, function(){
-					target.getElement('form').retrieve('form.request').send();
-				}, {
-					resizable: true
-				});
-			}.bind(this)
-		});
-	}
-
-});

+ 0 - 33
desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.Refresh.js

@@ -1,33 +0,0 @@
-/*
----
-description: Makes all links with the css class .ccs-refresh refresh the JFrame.
-provides: [CCS.JFrame.Refresh]
-requires: [/CCS.JFrame]
-script: CCS.JFrame.Refresh.js
-
-...
-*/
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-CCS.JFrame.addGlobalLinkers({
-
-	'.ccs-refresh': function(event, link){
-		//for every link with the class .css-refresh, refresh the current view when clicked.
-		this.refresh();
-	}
-
-});

+ 0 - 37
desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.RefreshWithParams.js

@@ -1,37 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*
----
-description: Refreshes the current URL (including any GET parameters) with additional get parameters as specified.
-provides: [CCS.JFrame.RefreshWithParams]
-requires: [/CCS.JFrame]
-script: CCS.JFrame.RefreshWithParams.js
-
-...
-*/
-
-CCS.JFrame.addGlobalLinkers({
-	/*
-		submit the form that the element is in.
-	*/
-	'.ccs-refresh_with_params': function(event, link) {
-		this.load({
-			requestPath: new URI(this.currentPath).setData(String.parseQueryString(link.getData('refresh-params')), true).toString()
-		});
-	}
-
-});

+ 0 - 69
desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.SplitViewLinkers.js

@@ -1,69 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*
----
-description: Handles the resize linkers for the SplitView behavior.
-provides: [CCS.JFrame.SplitViewLinkers]
-requires: [/CCS.JFrame]
-script: CCS.JFrame.SplitViewLinkers.js
-
-...
-*/
-
-(function(){
-
-var getWidget = function(link) {
-	var splitview = link.getParent('.splitview');
-	if (!splitview) return;
-	return splitview.get('widget');
-};
-CCS.JFrame.addGlobalLinkers({
-
-	'[data-splitview-resize]': function(e, link){
-		if ($(e.target).get('tag') == 'a') e.preventDefault();
-		var widget = getWidget(link);
-		if (!widget) return;
-		var resize = link.get('data', 'splitview-resize', true);
-		if (!resize) return;
-		var side;
-		var sides = ['left', 'right', 'top', 'bottom'];
-		for (key in resize) {
-			if (sides.contains(key)) side = key;
-		}
-		widget.fold(side, resize[side], resize.hideSplitter).chain(partialPostFold.bind(this, [resize, e, link]));
-	},
-
-	'[data-splitview-toggle]': function(e, link){
-		if ($(e.target).get('tag') == 'a') e.preventDefault();
-		var widget = getWidget(link);
-		if (!widget) return;
-		var resize = link.get('data', 'splitview-toggle', true);
-		if (!resize) return;
-		widget.toggle(resize.side, resize.hideSplitter).chain(partialPostFold.bind(this, [resize, e, link]));
-	}
-
-});
-
-var partialPostFold = function(data, event, link){
-	if (!$(document.body).hasChild(link)) return;
-	if (data.partialRefresh) {
-		if ($type(data.partialRefresh) == "string") link = new Element('a', { href: data.partialRefresh });
-		this.invokeLinker('.ccs-fake_refresh', link, event);
-	}
-};
-
-})();

+ 0 - 54
desktop/core/static/js/Source/JFrameLinkers/CCS.JFrame.SubmitLink.js

@@ -1,54 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*
----
-description: When the user clicks a link with the class '.ccs-submit_form' submit the parent form.
-provides: [CCS.JFrame.SubmitLink]
-requires: [/CCS.JFrame]
-script: CCS.JFrame.SubmitLink.js
-
-...
-*/
-
-;(function(){
-
-function getFormForElement(el){
-	var formSelector = el.get('data-form') || 'form';
-	var form = el.getParent(formSelector) || this.getWindowElement().getElement(formSelector);
-	if (!form){
-		if (formSelector) dbug.error('Cannot find data-form="' +formSelector+ '" for ccs-submit_form');
-		else dbug.error('Cannot find FORM parent of ccs-submit_form');
-	}
-	return form;
-}
-
-
-CCS.JFrame.addGlobalLinkers({
-	/*
-		submit the form that the element is in
-		or the form that it specifies
-	*/
-	'.ccs-submit_form': function(event, el){
-		var rq = getFormForElement.call(this, el).retrieve('form.request');
-		if (rq) rq.setOptions({extraData:el.getJSONData('extra-data')}).send();
-		else dbug.error('Form Request not found');
-	}
-
-});
-
-
-}());

+ 0 - 100
desktop/core/static/js/Source/JFrameRenderers/CCS.JFrame.Alert.js

@@ -1,100 +0,0 @@
-/*
----
-description: Any JFrame response that has a root-level child element with the class .alert_popup is displayed in an alert overlaying the previous state which is restored when the alert is closed. If the class .jframe_renders is also applied to that element, the jframe is not restored but displays the remaining portion of the response as normal.
-provides: [CCS.JFrame.Alert]
-requires: [/CCS.JFrame, Widgets/ART.Alerts]
-script: CCS.JFrame.Alert.js
-
-...
-*/
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-CCS.JFrame.addGlobalRenderers({
-
-	alert: function(content) {
-		var options = content.options;
-		//if the contents have an element with .alert_popup *at the root*
-		//then display those contents in an alert
-		var popup = content.elements.filter('.alert_popup')[0];
-		if (!popup) return;
-		
-		//does the jframe still get to render?
-		var jframe_renders = popup.hasClass('jframe_renders');
-
-		var target = new Element('div', {'class': 'jframe_alert'}).hide().inject($(this));
-		var popupBehavior = new Behavior({
-			onError: function(){
-				dbug.warn.apply(dbug, arguments);
-			}
-		});
-		var fillAndShow = function() {
-			if (!jframe_renders) {
-				//if we aren't rendering the jframe, fill the popup
-				//and remove the toolbar
-				this.fill(target, content, popupBehavior);
-				var toolbar = content.elements.filter('.toolbar');
-				if (toolbar.length) toolbar.hide();
-			} else {
-				//otherwise we're going to leave the content object alone and clone
-				//the popup, hiding the original
-				this.fill(target, {
-					elements: $$(popup.clone())
-				}, popupBehavior);
-				popup.hide();
-			}
-			target.show();
-		}.bind(this);
-
-		//our method to actually show the alert
-		var alerter = function(){
-			if(!Browser.Engine.trident) fillAndShow();
-			if (options.blankWindowWithError) {
-				CCS.error(content.title, target);
-				if (Browser.Engine.trident) fillAndShow();
-				this.getWindow().hide();
-			} else {
-				var alert = this.alert(content.title, target);
-				if (Browser.Engine.trident) fillAndShow();
-				target.getElements(":widget").each(function(widget) {
-					widget.get("widget").register(widget.getParent(":widget").get("widget"));
-				});
-				if (options) {
-					if (options.blankWindowWithError) {
-						alert.addEvent('destroy', function(){
-							this.getWindow().hide();
-						}.bind(this));
-					}
-				}
-				alert.addEvent('destroy', function() {popupBehavior.cleanup(target);});
-				alert.position().show();
-				
-				//if jframe is rendering we remove this event which we're going to add a few lines down
-				if (jframe_renders) this.removeEvent('afterRenderer', alerter);
-				if (options.callback) options.callback(data);
-			}
-		}.bind(this);
-
-		//if jframe is rendering, we need to give it the thread
-		//otherwise it trashes the content AFTER we position
-		//which throws it off
-		if (jframe_renders) this.addEvent('afterRenderer', alerter);
-		else alerter();
-		
-		//if jframe is rendering, return false (so it will continue as if nothing happened)
-		return !jframe_renders;
-	}
-
-});

+ 0 - 252
desktop/core/static/js/Source/JFrameRenderers/CCS.JFrame.PartialRefresh.js

@@ -1,252 +0,0 @@
-/*
----
-description: Any JFrame response that has elements that have a property defined for data-partial-id will have each auto-refresh response only update them.
-provides: [CCS.JFrame.PartialRefresh]
-requires: [/CCS.JFrame, Widgets/ART.Alerts, More/Table, Widgets/Element.Data, /PartialUpdate]
-script: CCS.JFrame.PartialRefresh.js
-
-...
-*/
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-(function(){
-
-	CCS.JFrame.addGlobalRenderers({
-
-		/*
-			Partials are comprised of instructions in HTML responses that mark areas of the document that should be
-			compaired against previous responses. These areas's raw HTML (the HTML returned from the server, not the
-			current DOM state, which may have classes or style attributes or even new DOM elements in place) is compared
-			to the previous response. When there's a mis-match in the response, only those elements that have changed
-			are run through the JFrame filters to configure them for display and then replace their expired counterparts.
-
-			Each individual item that might be refreshed must be marked with a data-single-partial-id property that is unique
-			to the JFrame (i.e. multiple app windows can have id overlap) OR have a data-partial-id property and be the
-			child of a container with app-unique data-partial-container-id.
-
-			If you need to support the loading of additional content after the fact, such as with loading additional Ajax
-			elements within the frame or if the response may return more or fewer items than the previous response, then
-			you must add some additional instrumentation to your HTML. Specifically, you *must* define a container where
-			new elements are injected. This MUST be the immediate parent of the partials, like so:
-
-			Example w/ just partials and container
-			<div data-partial-container-id="div1">
-				<p data-partial-id="p1">foo</p>
-				<p data-partial-id="p2">bar</p>
-			</div>
-
-			The only exception to this requirement, such as with tables, you may wish to add "lines" between
-			the partials and the container. A good example here is a table which has partials for individual
-			td elements, but new tr elements may come and go. In this case the "lines" must be immediate children
-			of the parent, but the individual partials need not be immediate children of the lines.
-
-			Example w/ partials, container, and lines
-			<tbody data-partial-container-id="tbody1">
-				<tr data-partial-line-id="tr1">
-					<td data-partial-id="id1"></td>
-					<td data-partial-id="id2"></td>
-				</tr>
-			</tbody>
-
-			When the above markup is used, new partials may appear (the tds) and the parent element with the data-partial-line-id
-			will be used for injection instead. Note that this id, and the container id, must also be unique to the frame.
-
-			Both lines and partials will be injected in their relative position; i.e. if in the above example our response returned
-			a new tr line afer tr1, the new row would be found in the response, the reponse's DOM tree would be inspected and
-			the previous row would be found there. It's id is "tr1". The *live* DOM tree - the one the user sees - would be searched
-			for an element with that line-id. The new line would be injected after it.
-
-			It is possible to support the possibility of the server returning a new sort order. This is a little more expensive
-			so it must be "turned on" by giving the container the class name "ordered_partial_refresh".
-
-			Example w/ partials, container, and lines that will obey sort order.
-			<tbody data-partial-container-id="tbody1" class="ordered_partial_refresh">
-				<tr data-partial-line-id="tr1">
-					<td data-partial-id="id1"></td>
-					<td data-partial-id="id2"></td>
-				</tr>
-				<tr data-partial-line-id="tr2">
-					<td data-partial-id="id3"></td>
-					<td data-partial-id="id4"></td>
-				</tr>
-			</tbody>
-
-			In the above example, if the server replied with tr2 preceding tr1, the order would update in the view because
-			of the "ordered_partial_refresh" class.
-
-			When using ajax to load in new content (such as with the AjaxLoad linker) you'll likely load new content in ouside
-			the scope of this refresh handler. I.e. you'll handle the response and inject the new items yourself. In this case
-			partial refresh needs only to store the original request state for future checksums. To accomplish this, set the
-			options of the request to have the onlyProcessPartials flag set to true. This will run the ajax response through
-			this renderer, find the new partial elements, and store their initial state for checking later.
-
-		*/
-
-		partialRefresh: function(content){
-			dbug.timeEnd('partial refresh');
-			dbug.time('partial refresh');
-			var options = content.options || {};
-			//if the request options include the ignorePartialRequest flag, exit
-			if (options.ignorePartialRefresh) return;
-			//when we load content via ajax, we don't want the response being parsed for partials
-			var jState = getJState(this);
-			//get the partial containers; containers that have elements in them to be partially refreshed
-			var elements = new Element('div').adopt(content.elements);
-			//find all the containers in the response that have data-partial-container-id
-			var partialContainers = elements.getElements('[data-partial-container-id]');
-
-			dbug.time('create');
-			//and either fetch or create instances of PartialUpdate for them
-			var updaters = partialContainers.map(function(container){
-				return {
-					updater: getUpdater(container, jState, {
-						//when an element is destroyed, call jframe's garbage collection method
-						onElementDestroy: function(el){
-							this.collectElement(el);
-						}.bind(this),
-						//before individual elements are inserted in the DOM, run them through the jframe filters
-						onBeforeUpdate: function(checked){
-							dbug.time('update:filters');
-							this.applyFilters(checked.target);
-							dbug.timeEnd('update:filters');
-						}.bind(this)
-					}),
-					responseContainer: container
-				};
-			}, this);
-			dbug.timeEnd('create');
-
-			//find stand-alone partials; these have no containers
-			var standAlones = elements.getElements('[data-single-partial-id]'),
-			    tmpTarget = new Element('div');
-			dbug.time('stand alone');
-			
-			for (var i = 0; i < standAlones.length; i++){
-				var element = standAlones[i];
-				var id = element.get('data-single-partial-id');
-				if (!jState.standAlones[id]){
-					//create an instance of the single partial updater for each of these
-					jState.standAlones[id] = new PartialUpdate.Single(element, {
-						onElementDestroy: function(el){
-							this.collectElement(el);
-						}.bind(this),
-						partialIdProperty: 'data-single-partial-id',
-						updateStateOnStartup: false,
-						onBeforeUpdate: function(element){
-							dbug.time('update:filters');
-							this.applyFilters(tmpTarget.adopt(element));
-							dbug.timeEnd('update:filters');
-						}.bind(this)
-					});
-				}
-				updaters.push({
-					updater: jState.standAlones[id],
-					responseContainer: elements
-				});
-			}
-			dbug.timeEnd('stand alone');
-
-			//this method just updates the state of each updater to match that of the response
-			var updateState = function(){
-				dbug.time('update state');
-				updaters.each(function(updaterObj){
-					updaterObj.updater.updateState(updaterObj.responseContainer);
-				});
-				dbug.timeEnd('update state');
-			};
-
-			//for requests that want to handle the element injection themselves (ajaxload, for example)
-			//they can instruct this filter to process the partials in the response and then exit
-			if (options.onlyProcessPartials) {
-				updateState();
-				return;
-			}
-			//store the previous path to be the current one
-			jState.prevPath = options ? options.responsePath : null;
-
-			if (!updaters.length) {
-				//no partial containers, reset and fall through to other renderers
-				jState.updaters = {};
-				jState.standAlones = {};
-				this.enableSpinnerUsage();
-				return;
-			}
-
-			//disable spinner for the next autorefresh
-			this.disableSpinnerUsage();
-
-			//if the options aren't defined or if we didn't auto refresh fall through to other renderers
-			if (!options || !(options.autorefreshed || options.forcePartial)) {
-				//...then store the state and render as usual (fall through to other renderers)
-				updateState();
-				return;
-			}
-
-			/*******************************
-			FORM HERE ON OUT
-			this filter will handle the response; we return true and other renderers are excluded
-			UNLESS there is a partial returned that we cannot find the proper place to put it
-			(i.e. it has no partial-container).
-			*******************************/
-			//store the path as the current one
-			this.currentPath = options.responsePath || this.currentPath;
-
-			dbug.time('update');
-			updaters.each(function(updaterObj){
-				updaterObj.updater.update(updaterObj.responseContainer);
-			});
-			dbug.timeEnd('update');
-			dbug.time('apply filters to content');
-			this.applyFilters(new Element('div'), content);
-			dbug.timeEnd('apply filters to content');
-
-			//we've updated the display, so tell filters that are waiting that they may need to update their display, too
-			this.behavior.fireEvent('show');
-			//prevent other renderers from handling the response
-			dbug.timeEnd('partial refresh');
-			return true;
-		}
-
-	});
-
-	var jframeStates = new Table();
-
-	//gets the state for the given jframe
-	var getJState = function(jframe) {
-		var jState = jframeStates.get(jframe);
-		if (!jState) {
-			jState = {
-				updaters: {},
-				standAlones: {}
-			};
-			jframeStates.set(jframe, jState);
-		}
-		return jState;
-	};
-
-	var getUpdater = function(container, jState, options){
-		var id = container.get('data-partial-container-id');
-		if (!jState.updaters[id]) {
-			jState.updaters[id] = new PartialUpdate(container, $merge({
-				sorted: container.hasClass('ordered_partial_refresh'),
-				clone: container.get('html').contains('data-filter'),
-				updateStateOnStartup: false
-			}, options));
-		}
-		return jState.updaters[id];
-	};
-
-})();

+ 0 - 94
desktop/core/static/js/Source/JFrameRenderers/CCS.JFrame.Prompt.js

@@ -1,94 +0,0 @@
-/*
----
-description: Any JFrame response that has a root-level child element with the class .prompt_popup is displayed in a prompt overlaying the previous state which is restored when the prompt is canceled.
-provides: [CCS.JFrame.Prompt]
-requires: [/CCS.JFrame, Widgets/ART.Alerts, Widgets/Behavior]
-script: CCS.JFrame.Prompt.js
-
-...
-*/
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-CCS.JFrame.addGlobalRenderers({
-
-	prompt: function(content) {
-		var options = content.options;
-		
-		//if the contents have an element with .prompt_popup *at the root*
-		//then display those contents in a prompt, submitting the form (if present)
-		//when the user clicks "ok"
-		var popup = content.elements.filter('.prompt_popup')[0];
-		if (!popup) return;
-		var target = new Element('div', {'class': 'jframe_prompt'}).hide().inject($(this));
-		var popupBehavior = new Behavior({
-			onError: function(){
-				dbug.warn.apply(dbug, arguments);
-			}
-		});
-		popupBehavior.passMethods({
-			getContentElement: $lambda(target),
-			configureRequest: this.configureRequest.bind(this)
-		});
-		var fillAndShow = function() {
-			this.fill(target, content, popupBehavior);
-			target.show();
-		}.bind(this);
-		//VML in IE doesn't like being hidden and redisplayed.  Delaying filling and showing the target for 
-		if(!Browser.Engine.trident) {
-			fillAndShow();
-		}
-		var toolbar = content.elements.filter('.toolbar');
-		if (toolbar.length) toolbar.hide();
-
-		var size = this.content.getSize();
-		var form = popup.getElement('form');
-		var hasInput = !!popup.getElement('form') && !!popup.getElement('input, textarea, select');
-		var prompt = this.prompt(content.title || 'Enter Details', target, function(){
-			if (form) form.retrieve('form.request').send();
-		}, {
-			detectInput: !hasInput,
-			resizable: true
-		});
-		prompt.addEvent('resize', function() {popupBehavior.resize.bind(popupBehavior);});
-		prompt.addEvent('destroy', function() {popupBehavior.cleanup(target); });
-		
-		if(Browser.Engine.trident) {
-			fillAndShow();
-			prompt.findInputs();
-		}
-		target.getElements(":widget").each(function(widget) {
-			widget.get("widget").register(widget.getParent(":widget").get("widget"));
-		});
-		if (form) {
-			form.addEvent('submit', function(){
-				prompt.hide();
-			});
-			var inputs = form.getElements('input[type=text], textarea');
-			var focused;
-			inputs.some(function(input){
-				if (focused) return;
-				if (input.isVisible()) {
-					focused = true;
-					input.select();
-				}
-			});
-
-		}
-		if (options.callback) options.callback(data);
-
-		return true;
-	}
-});

+ 0 - 480
desktop/core/static/js/Source/JFrameRenderers/PartialUpdate.js

@@ -1,480 +0,0 @@
-/*
----
-description: Any JFrame response that has a root-level child element with the class .partial_refresh will find all elements that have a property defined for data-partial-id that is unique to the response and only update them. If there is a mismatch in the response such that the number of and ids of partials in the previous state do not match the return state, an alert will be shown the user that the entire view will be updated that they can cancel, if they so choose.
-provides: [PartialUpdate]
-requires: [Core/Element.Dimensions, Core/Options, Core/Events, Behavior/DashSelectors]
-script: PartialUpdate.js
-
-...
-*/
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-;(function(){
-
-	this.PartialUpdate = new Class({
-
-		Implements: [Options, Events],
-
-		options: {
-			// onFailure: function(){},
-			// onNoUpdate: function(){},
-			// onBeforeUpdate: function(){},
-			// initialPartials: null,
-
-			sorted: true,
-			clone: false,
-			ejectToUpdate: true,
-			updateClass: 'partial-refresh-updated partial-refresh-transitionable',
-			updateClassToRemove: 'partial-refresh-updated',
-			flagRemovalDelay: 1000,
-			partialIdProperty: 'data-partial-id',
-			partialLineIdProperty: 'data-partial-line-id',
-			updateStateOnStartup: true
-		},
-
-		initialize: function(container, options){
-			this.container = document.id(container);
-			this.setOptions(options);
-			if (this.options.updateStateOnStartup) this.updateState(this.container);
-		},
-
-		//update the current state from the container (the "live" DOM)
-		updateState: function(container){
-			var partials = this._getPartials(container);
-			if (partials) {
-				//if there are partials already, merge the result
-				if (this.partials) {
-					for (id in partials) {
-						this._validateId(id);
-						this.partials[id] = partials[id];
-					}
-				//else there were no partials in the previous response; so assign these.
-				} else {
-					this.partials = partials;
-				}
-			}
-		},
-
-		/*
-			takes the given container and updates the live DOM with the state of the given
-			container. This container must contain immediate children that either have partials
-			or partial lines.
-		*/
-		update: function(container){
-			//dbug.time('partial update completed');
-			var restore = this._eject();
-			//keep an un-altered version of the response to use for sorting
-			var untouched = this.options.sorted && container.clone(true, true);
-			//get the partials from the container
-			var partials = this._getPartials(container);
-			if (partials) {
-				//check the partials for changes
-				var checked = this._checkPartials(partials);
-				if (!checked) {
-					//if there aren't any partials in the response, then clean any in the DOM
-					this._cleanRemainingPartials(partials);
-					//put the container back in place
-					restore();
-					//exit
-					return false;
-				}
-				//if we're cloning, fire our event for jframe to run its filters
-				if (this.options.clone) {
-					//dbug.time('fireEvent: beforeUpdate');
-					this.fireEvent('beforeUpdate', checked);
-					//dbug.timeEnd('fireEvent: beforeUpdate');
-					//restore the clones to the response container
-					this._restorePartials(checked, partials);
-				}
-				//inject the response updates into the DOM
-				this._injectPartials(partials, checked);
-				//clean any partials that don't belong
-				this._cleanRemainingPartials(partials);
-				//sort if necessary
-				if (this.options.sorted) this._sortPartials(untouched);
-			} else {
-				//clean any partials that don't belong
-				this._cleanRemainingPartials(partials);
-			}
-			//return the container to the DOM
-			restore();
-			//clean up the "updated" flag after a delay
-			if (this.options.updateClassToRemove) this._cleanUpdateFlag.delay(this.options.flagRemovalDelay, this);
-			//dbug.timeEnd('partial update completed');
-			return true;
-		},
-
-		toElement: function(){
-			return this.container;
-		},
-
-		// ejects the container from the DOM, returning a function that puts it back
-		_eject: function(){
-			//dbug.time('eject');
-			if (this.container.parentNode && this.options.ejectToUpdate){
-				var scroll = this.container.getParent().getScroll();
-				var s = new Element('span').inject(this.container, 'after');
-				this.container.dispose();
-				return function(){
-					//dbug.time('restore');
-					s.parentNode.replaceChild(this.container, s);
-					this.container.getParent().scrollTo(scroll.x, scroll.y);
-					//dbug.timeEnd('restore');
-				}.bind(this);
-			} else {
-				return function(){};
-			}
-			//dbug.timeEnd('eject');
-		},
-
-		//find all elements marked as updated and remove the updated class name
-		_cleanUpdateFlag: function(){
-			var els = this.container.getElements('.' + this.options.updateClassToRemove);
-			for (var i = 0; i < els.length; i++){
-				els[i].removeClass(this.options.updateClassToRemove);
-			}
-		},
-
-		/*
-			gets the partials from the given container
-			returns a map of partial ids to objects with
-			pointers to the element and the html of that element
-			e.g. data[id] = {element: partialElement, html: partialElement.innerHTML}
-
-			if the container has no partial elements, it returns the boolean false
-		*/
-
-		_getPartials: function(container) {
-			//dbug.time('get partials');
-			var data = {};
-			//if there are no partial elements, return now
-			if (!container.innerHTML.contains(this.options.partialIdProperty)) return false;
-			//get all the elements with a partial id
-			var partial, id,
-			    els = container.getElements('[' + this.options.partialIdProperty + ']');
-			for (var i = 0; i < els.length; i++){
-				partial = els[i];
-				id = partial.getAttribute(this.options.partialIdProperty);
-				//store a pointer to that element to return it
-				data[id] = {
-					element: partial,
-					html: partial.innerHTML
-				};
-			}
-			//dbug.timeEnd('get partials');
-			return data;
-		},
-
-		/*
-			given a list of partial objects ({element:el, html:html[, line:line]})
-			go through and find which ones require updating. if options.clone is true
-			clone these into a target.
-		*/
-		_checkPartials: function(partials){
-			//dbug.time('check partials');
-			var data = {
-				updates: {},
-				target: new Element('div')
-			};
-			//loop through the partials and figure out which ones need updating so that we can
-			//run only those through the filters
-			var checked = false;
-			for (id in partials){
-				var partial = partials[id];
-				//get the corresponding element in the dom
-				var before = this.partials && this.partials[id];
-				//if there isn't one, or thier raw html don't match, we'll update it, so we must render it
-				if (!before || before.html != partial.html) {
-					//we must preserve the DOM structure to be able to find partial containers and partial lines
-					//so clone the partial for rendering
-					if (this.options.clone){
-						var clone = document.id(partial.element.cloneNode(true));
-						data.target.appendChild(clone);
-						//we also need a key/value map of all the updates for quick lookups
-						data.updates[id] = clone;
-					} else {
-						data.updates[id] = partial.element;
-					}
-					checked = true;
-				}
-			}
-			//dbug.timeEnd('check partials');
-			return checked ? data : false;
-		},
-
-		//given a partial, attempts to find the line it is in
-		//example: for a td that is a partial, it may have the tr as its line
-		_getPartialLine: function(partial, forceUpdate){
-			if (!partial.line || forceUpdate) partial.line = partial.element.getParent('[' + this.options.partialLineIdProperty + ']');
-			return partial.line;
-		},
-
-		//this method destroys a partial given its partial id
-		_destroyPartial: function(id){
-			//get the element
-			var element = this.partials[id].element;
-
-			this._clean(element);
-			//delete it from the state
-			delete this.partials[id];
-		},
-
-		//this method takes a group of cloned partials (that have been passed through filters)
-		//and puts them back into the DOM from which they came, replacing the elements they
-		//were cloned from. This allows us to retain the DOM structure of the response, while
-		//only running through the filters the elements that need it.
-		_restorePartials: function(checked, partials){
-			//dbug.time('restore partials');
-			for (id in checked.updates) {
-				var clone = checked.updates[id],
-				    partial = partials[id];
-				partial.element.parentNode.replaceChild(clone, partial.element);
-				partial.element = clone;
-			}
-			//dbug.timeEnd('restore partials');
-		},
-
-		_injectPartials: function(partials, checked) {
-			//dbug.time('inject partials');
-			var insertedPartials = {},
-			    partial,
-			    prevId;
-			//iterate over all the partials to inject them into the live DOM
-			for (id in partials) {
-				partial = partials[id];
-				//if it's in a line that's been injected, skip it
-				//if it was passed through the renderers, it means that it needs an update or insertion
-				if (checked.updates[id] && !insertedPartials[id]) {
-					//get the corresponding partial in the DOM
-					var before = this.partials && this.partials[id];
-					//if there's a corresponding partial already in the DOM, replace it
-					if (before) {
-						if (this.options.updateClass) partial.element.addClass(this.options.updateClass);
-						partial.element.replaces(before.element);
-						this._clean(before.element);
-					} else {
-						//else it's not in the DOM
-						//look to see if this partial is in a line item (for example, the tr for a td that is a partial)
-						var line = partial.line || this._getPartialLine(partial);
-						//if there is no line, inject it into the DOM in the container
-						if (line) this._injectPartialLine(partial, insertedPartials);
-						else this._injectPartial(partial, prevId);
-					}
-				}
-				if (!this.partials) this.partials = {};
-				if (checked.updates[id]) this.partials[id] = partial;
-				prevId = id;
-			}
-			//dbug.timeEnd('inject partials');
-		},
-
-		_cleanRemainingPartials: function(partials){
-			//dbug.time('clean partials');
-			var linesToDestroy = {}, partial;
-			//for any partials that were in the DOM but not in the response, remove them
-			for (id in this.partials) {
-				partial = this.partials[id];
-				//if the partial is in the DOM but not the response
-				if (!partials || !partials[id]) {
-					//get its line; assume that we have to remove that, too
-					var line = partial.line || this._getPartialLine(partial);
-					if (line) linesToDestroy[line.getAttribute(this.options.partialLineIdProperty)] = line;
-					//destroy the partial
-					this._destroyPartial(id);
-				}
-			}
-			for (id in linesToDestroy) {
-				this.fireEvent('elementDestroy', line);
-				line.destroy();
-			}
-			//dbug.timeEnd('clean partials');
-		},
-
-		//inject a partial into the container; prevId is the previous partial's id, used
-		//to inject the partial in the proper place
-		_injectPartial: function(partial, prevId){
-			this._validateId(partial.get(this.options.partialIdProperty));
-			var previousPartial = this.partials[prevId];
-			if (previousPartial) {
-				//if this isn't the first one, inject it after the previous id
-				partial.element.inject(previousPartial.element, 'after');
-			} else {
-				partial.inject(this.container, 'top');
-			}
-		},
-
-		//inject a partial line into the container; insertedPartials is a map of partial ids to
-		//partials that have been injected; used to ensure partials aren't injected twice when
-		//a line that contains several is injected into the DOM
-		_injectPartialLine: function(partial, insertedPartials){
-			//there is a line, so we inject it instead of the partial.
-			//get the previous line (from the response)
-			var line = partial.line || this._getPartialLine(partial);
-			var prevLine = line.getPrevious('[' + this.options.partialLineIdProperty + ']'),
-			    prevLineInDOM;
-			this._validateId(line.get(this.options.partialLineIdProperty));
-
-			//now find it's counterpart in the live DOM
-			var injected = false;
-			if (!this.options.sorted) {
-				if (prevLine) prevLineInDOM = this.container.getElement('[' + this.options.partialLineIdProperty + '=' + prevLine.getAttribute(this.options.partialLineIdProperty) + ']');
-				//if it's there, inject this line after it
-				if (prevLineInDOM) {
-					line.inject(prevLineInDOM, 'after');
-				} else {
-					line.inject(this.container, 'top');
-				}
-				injected = true;
-			}
-			if (!injected) line.inject(this.container);
-			//store the fact that we just injected all the partials in this line
-			var linePartials = line.getElements('[' + this.options.partialIdProperty + ']');
-			for (var p = 0; p < linePartials.length; p++) {
-				this._validateId(linePartials[p].get(this.options.partialIdProperty));
-				if (this.options.updateClass) linePartials[p].addClass(this.options.updateClass);
-				insertedPartials[linePartials[p].getAttribute(this.options.partialIdProperty)] = true;
-			};
-		},
-
-		_sortPartials: function(responseContainer) {
-			//dbug.time('sort partials');
-			this._sortCount = 0;
-			//get all the children of the update container that are partially updatable
-			var kids = responseContainer.getChildren('[' + this.options.partialIdProperty + ']');
-			//for each kid, inject it into this container
-			for (var kid = 0; kid < kids.length; kid++){
-				var id = kids[kid].getAttribute(this.options.partialIdProperty);
-				this.partials[id].element.inject(this.container);
-			}
-			//get all the lines that are children of the update container
-			var lines = responseContainer.getChildren('[' + this.options.partialLineIdProperty + ']');
-			if (lines.length){
-				//get the lines in this.container
-				var liveLines = this.container.getChildren('[' + this.options.partialLineIdProperty + ']');
-				var liveLineMap = {}, liveLineOrder = [];
-				//create a map of all the live lines to their ids
-				for (var liveLine = 0; liveLine < liveLines.length; liveLine++) {
-					var liveLineId = liveLines[liveLine].getAttribute(this.options.partialLineIdProperty);
-					liveLineMap[liveLineId] = liveLines[liveLine];
-					liveLineOrder.push(liveLineId);
-				}
-				//loop through all the lines in the response
-				var prev;
-				for (var line = 0; line < lines.length; line++){
-					//get the id of the response line
-					var lineId = lines[line].getAttribute(this.options.partialLineIdProperty);
-					if (lineId != liveLineOrder[line]) {
-						//inject the live line into that location
-						if (!prev) liveLineMap[lineId].inject(this.container, 'top');
-						else liveLineMap[lineId].inject(prev, 'after');
-						var index = liveLineOrder.indexOf(lineId);
-						liveLineOrder.splice(index, 1);
-						liveLineOrder.splice(line, 0, lineId);
-						this._sortCount++;
-					}
-					prev = liveLineMap[lineId];
-				}
-			}
-			//dbug.log('items: %s, sorted: %s', lines.length, this._sortCount);
-			//dbug.timeEnd('sort partials');
-		},
-
-		_toGC: [],
-
-		_clean: function(element){
-			this.fireEvent('elementDestroy', element);
-			if (!this._gcTimer) this._gcTimer = this._gc.periodical(100, this);
-			this._toGC.push({
-				element: element
-			});
-		},
-
-		//this is a "threadsafe" garbage collection routine
-		//if we call element.destroy on, say, 1000 nodes, the MooTools gc goes through
-		//all of them at once. This version does them in batches, releasing the thread
-		//as it goes.
-		_gc: function(){
-			if (this._toGC.length) {
-				var i = 0;
-				while (this._toGC.length && i < Math.max(100, this._toGC.length/100)) {
-					var data = this._toGC.shift();
-					//destroy the element
-					this._destroy(data.element);
-					i++;
-				}
-				if (i == 0) clearInterval(this._gcTimer);
-			}
-		},
-
-		//implementing a custom destroy method; this is slightly faster than the MooTools version
-		//but doesn't do some of it's less-important garbage collection
-		_destroy: function(el){
-			for (var i = 0; i < el.childNodes.length; i++) {
-				this._destroy(el.childNodes[i]);
-			}
-			if (el.removeEvents) el.removeEvents();
-		},
-
-		//ids must be alpha-numeric
-		_validateId: function(id){
-			if (id.test(validIdRE)) throw ('invalid partial id: "' + id + '"');
-		}
-
-	});
-
-	var validIdRE = /[^a-zA-Z0-9_\-]/;
-
-	PartialUpdate.Single = new Class({
-
-		Extends: PartialUpdate,
-
-		initialize: function(element, options){
-			this.element = document.id(element);
-			this.html = this.element.innerHTML;
-			this.setOptions(options);
-			this.partialId = this.element.get(this.options.partialIdProperty);
-			this._validateId(this.partialId);
-		},
-
-		update: function(container){
-			var partial = container.getElement('[' + this.options.partialIdProperty + '=' + this.partialId + ']');
-			var html = partial && partial.innerHTML;
-			if (partial && html != this.element.innerHTML) {
-				this.fireEvent('beforeUpdate', partial);
-				if (this.options.updateClass) partial.addClass(this.options.updateClass);
-				partial.replaces(this.element);
-				var element = this.element;
-				this.element = partial;
-				this.html = html;
-				this._clean(element);
-				this._cleanUpdateFlag.delay(this.options.flagRemovalDelay, this);
-			}
-		},
-
-		updateState: function(container){
-			var partial = container.getElement('[' + this.options.partialIdProperty + '=' + this.partialId + ']');
-			var html = partial && partial.innerHTML;
-			this.html = html;
-		},
-
-		_cleanUpdateFlag: function(){
-			this.element.removeClass(this.options.updateClassToRemove);
-		}
-
-	});
-
-})();

+ 0 - 24
desktop/core/static/js/Source/Native/Element.Data.js

@@ -1,24 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: This file is deprecated; the functionality has been moved to the ART Widgets repo. This is here for dependency backwards compatibility.
-provides: [Element.Data]
-requires: [Widgets/Element.Data]
-script: Element.Data.js
-
-...
-*/

+ 0 - 399
desktop/core/static/js/Source/UI/ART.SideBySideSelect.js

@@ -1,399 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Turns a mutli-select input into two side-by-side areas that items move between when selected/deselected.
-provides: [ART.SideBySideSelect]
-requires: [Widgets/ART.Widget, Widgets/ART.Keyboard, More/HtmlTable.Zebra, Core/Fx.Tween, Core/Selectors]
-script: ART.SideBySideSelect.js
-...
-*/
-
-ART.SideBySideSelect = new Class({
-	
-	Extends: ART.Widget,
-	
-	Implements: [Options, Events],
-	
-	options: {
-		// onSelect: $empty(name, row),
-		// onDeselect: $empty(name, row),
-		className: 'sideBySideSelect clearfix',
-		deselectedOptions: {
-			properties: {
-				'data-filters': 'HtmlTable',
-				'class':'noKeyboard'
-			},
-			headers: ['Deselected']
-		},
-		selectedOptions: {
-			properties: {
-				'data-filters': 'HtmlTable',
-				'class':'noKeyboard'
-			},
-			headers: ['Selected']
-		},
-		makeContent: function(name, selected){
-			return new Element('span', { html: name });
-		}
-	},
-	
-	initialize: function(select, options){
-		this.select = $(select).setStyle('display', 'none');
-		this.parent(options);
-		this._build();
-		this.element.setStyle('display', 'block');
-		this.select.store('SideBySideSelect', this);
-		new ART.Keyboard(this);
-		this._attachKeys();
-	},
-	
-	// creates the DOM elements for the UI
-	_build: function(){
-		this.deselectedContainer = new Element('div', { 'class':'deselected' });
-		this.deselected = new HtmlTable(this.options.deselectedOptions);
-		this.deselectedContainer.adopt(this.deselected);
-		
-		this.spacer = new Element('div', {
-			'class': 'spacer'
-		});
-		this.moveRight = new Element('a', {
-			text: 'select',
-			'class': 'moveRight',
-			events: {
-				click: this.moveSelection.bind(this, 'right')
-			}
-		}).inject(this.spacer);
-		this.moveLeft = new Element('a', {
-			text: 'select',
-			'class': 'moveLeft',
-			events: {
-				click: this.moveSelection.bind(this, 'left')
-			}
-		}).inject(this.spacer);
-		
-		this.selectedContainer = new Element('div', { 'class':'selected' });
-		this.selected = new HtmlTable(this.options.selectedOptions);
-		this.selectedContainer.adopt(this.selected);
-
-		this.element.adopt(this.deselectedContainer);
-		this.element.adopt(this.spacer);
-		this.element.adopt(this.selectedContainer);
-
-		this.makeRows();
-
-		//click a row, select it; double click, move it
-		this.element.addEvent('click:relay(tbody tr)', this.clickRow.bind(this));
-		this.element.addEvent('dblclick:relay(tbody tr)', function(e, tr){
-			e.stop();
-			this.moveRow(tr);
-		}.bind(this));
-	},
-	
-	makeRows: function(){
-		this.selected.body.empty();
-		this.deselected.body.empty();
-		this.select.getElements('option').each(function(option){
-			var name = option.get('text') || option.get('value');
-			this._options[name] = option;
-			var row = this._makeRow(name, option.get('selected') ? 'selected' : 'deselected');
-		}, this);
-	},
-	
-	_attachKeys: function(){
-		//selects all rows in the focused table
-		var selectAll = function(e){
-			e.preventDefault();
-			var trs;
-			if (this._rangeStart) trs = this._rangeStart.getSiblings('tr');
-			else if (this._focusedRow) trs = this._focusedRow.getSiblings('tr');
-			else trs = $(this.deselected).getElements('tbody tr');
-			trs.each(function(tr) {
-				this.selectRow(tr, true);
-			}, this);
-		}.bind(this);
-		//returns the focused row or our best guess as to which one is our starting point
-		//defaults to the left side's first row if nothing else matches
-		var getCurrentRow = function(){
-			if (this._focusedRow) return this._focusedRow;
-			if (this._rangeStart) return this._rangeStart;
-			else return $(this.deselected).getElement('tbody tr');
-		}.bind(this);
-		//return the sibling rows for a given row
-		var getSiblings = function(row){
-			return row.getParent('tbody').getChildren('tr');
-		};
-		//selects the next row from the current focused row
-		var selectNext = function(e){
-			e.preventDefault();
-			var row = getCurrentRow();
-			var rows = getSiblings(row);
-			var next = rows[rows.indexOf(row) + 1];
-			if (!next) return;
-			//if shift is held, don't clear the selection; add to it
-			if (!e.shift) this.clearSelection(rows);
-			if (!next.hasClass('selected')) this.selectRow(next, true);
-			else this.deselectRow(row, true);
-			this._focusedRow = next;
-		}.bind(this);
-		//same as selectNext, only the other way
-		var selectPrev = function(e){
-			e.preventDefault();
-			var row = getCurrentRow();
-			var rows = getSiblings(row);
-			var prev = rows[rows.indexOf(row) - 1];
-			if (!prev) return;
-			if (!e.shift) this.clearSelection(rows);
-			if (!prev.hasClass('selected')) this.selectRow(prev, true);
-			else this.deselectRow(row, true);
-			this._focusedRow = prev;
-		}.bind(this);
-		//move selected rows to the left
-		var moveLeft = function(e){
-			e.preventDefault();
-			$(this.selected).getElements('tr.selected').each(function(row){
-				this.moveRow(row);
-			}, this);
-		}.bind(this);
-		//move selected rows to the right
-		var moveRight = function(e){
-			e.preventDefault();
-			$(this.deselected).getElements('tr.selected').each(function(row){
-				this.moveRow(row);
-			}, this);
-		}.bind(this);
-		//add keyboard entries for the above actions
-		this.addShortcuts({
-			'Select All': {
-				keys: 'ctrl+a',
-				shortcut: 'control/command + a',
-				handler: selectAll,
-				description: 'Select the previous row in the table.'
-			},
-			'Select Previous Row': {
-				keys: 'up',
-				shortcut: 'up arrow',
-				handler: selectPrev,
-				description: 'Select the previous row in the table.'
-			},
-			'Select Next Row': {
-				keys: 'down',
-				shortcut: 'down arrow',
-				handler: selectNext,
-				description: 'Select the next row in the table.'
-			},
-			'Move Row(s) Right': {
-				keys: 'right',
-				shortcut: 'right arrow',
-				handler: moveRight,
-				description: 'Select the next row in the table.'
-			},
-			'Move Row(s) Left': {
-				keys: 'left',
-				shortcut: 'left arrow',
-				handler: moveLeft,
-				description: 'Select the next row in the table.'
-			}
-		});
-		
-		this.attachKeys({
-			'meta+a': selectAll,
-			'shift+up': selectPrev,
-			'shift+down': selectNext,
-			'shift+right': moveRight,
-			'shift+left': moveLeft
-		});
-	},
-	
-	_options: {},
-	_rows: {},
-	
-	//return a row given the name (the text of the option the row correlates to)
-	_getRow: function(name){
-		return this._rows[name];
-	},
-	
-	//given a row, return the name (the option text)
-	_getName: function(row){
-		return row.retrieve('_sideBySide:name');
-	},
-	
-	//given an option name, get the value of it.
-	getValue: function(name){
-		return this._options[name].get('value') || this._options[name].get('text');
-	},
-	
-	//remove a row from the layout; pass in noEffect (boolean) as *true* to do this instantly
-	_destroyRow: function(row, noEffect){
-		if (noEffect) {
-			row.destroy();
-		} else {
-			row.fade('out', { duration: 500 }).get('tween').chain(function(){
-				row.destroy();
-			});
-		}
-	},
-	
-	//select a given row; pass *true* for noMove to leave it where it is, otherwise move it to the opposite side
-	selectRow: function(row, noMove){
-		if (noMove) {
-			row.addClass('selected');
-		} else {
-			this.moveRow(row, 'selected');
-			row.setStyle('opacity', 0).fade('in');
-		}
-		return row;
-	},
-
-	//same as selectRow, only the other direction
-	deselectRow: function(row, noMove){
-		if (noMove) {
-			row.removeClass('selected');
-		} else {
-			this.moveRow(row, 'deselected');
-			row.setStyle('opacity', 0).fade('in');
-		}
-		return row;
-	},
-
-	//given a name, create a row in the specified table; either 'selected' or 'deselected'
-	_makeRow: function(name, where){
-		var row = this[where].push([this.options.makeContent.call(this, name, where)]).tr.store('_sideBySide:name', name);
-		this._options[name].set('selected', where == 'selected');
-		this._rows[name] = row;
-		return row;
-	},
-
-	//move a row to the specified table ('selected' or 'deselected');
-	//if no *where* value is defined, move it to whatever table it isn't in.
-	moveRow: function(row, where){
-		var name = this._getName(row);
-		if (!where) where = $(this.selected).hasChild(row) ? 'deselected' : 'selected';
-		this[where].push(row);
-		this[where + 'Container'].scrollTo(0, 999999);
-		this._options[name].set('selected', where == 'selected');
-		this.fireEvent(where == 'selected' ? 'select' : 'deselect', [name, row]);
-		this._rangeStart = null;
-		return row;
-	},
-	
-	//given a click event, determine if the user intended to select/move a row.
-	//allows for rows to contain elements like links or checkboxes, for example.
-	ignore: function(event, row){
-		var target = $(event.target);
-		var valid = !['a', 'input'].every(function(str){
-			return !target.match(str);
-		});
-		//if the row doesn't have a stored name, then it is the header or something so ignore it
-		if (valid && this._getName(row)) return true;
-		return false;
-	},
-	
-	//select or deselect a row depending on its current state.
-	toggleSelect: function(row){
-		if (row.hasClass('selected')) this.deselectRow(row, true);
-		else this.selectRow(row, true);
-	},
-	
-	//select a range of rows. pass in a row element; if a start row is defined,
-	//this row will be used as the end of the selection, otherwise stored as the start.
-	selectRange: function(row){
-		if (!this._rangeStart) {
-			this._rangeStart = row;
-		} else {
-			var start = this._rangeStart;
-			//see if the start of the selection is a child of the selected table
-			var startSelected = $(this.selected).hasChild(start);
-			var end = row;
-			//see if the end is a child of the selected table
-			var endSelected = $(this.selected).hasChild(end);
-			//if both are in the same table, select the range
-			if (startSelected == endSelected) {
-				var rows;
-				//get the selected rows
-				if (startSelected) {
-					rows = $(this.selected).getElements('tr');
-					$(this.deselected).getElements('.selected').removeClass('selected');
-				} else {
-					rows = $(this.deselected).getElements('tr');
-					$(this.selected).getElements('.selected').removeClass('selected');
-				}
-				var toToggle = [], started;
-				//go through each row in the respective table and find the rows to mark and mark them
-				rows.each(function(row) {
-					if (row == start || row == end) started = !started;
-					if (started || row == start || row == end) row.addClass('selected');
-					else row.removeClass('selected');
-				}, this);
-			} else {
-				//here the selected row wasn't in the same table as the previous marker, so we clear
-				//the selection and reset the start.
-				this.clearSelection();
-				this._rangeStart = row;
-			}
-		}
-	},
-
-	//clear the selection state
-	//if you pass in a collection of rows, remove their selected class.
-	clearSelection: function(rows){
-		this._rangeStart = null;
-		if (rows) rows.removeClass('selected');
-	},
-
-	//handles a row being clicked
-	clickRow: function(event, row){
-		//check if we should ignore this click
-		if (this.ignore(event, row)) return;
-		//store the new focus point
-		this._focusedRow = row;
-		//if the user is holding shift, select the row and then the range
-		if (event.shift) {
-			this.toggleSelect(row);
-			this.selectRange(row);
-		//if meta/control, then toggle but don't clear the selection
-		} else if (event.meta || event.control) {
-			this.toggleSelect(row);
-		} else {
-			//else it's a naked click; clear the selection and select only the clicked row
-			this.clearSelection($(this).getElements('tr'));
-			this.toggleSelect(row);
-			this._rangeStart = row;
-		}
-		return this;
-	},
-	
-	//moves all selected rows from one side to the other
-	//direction = 'left' or 'right'
-	moveSelection: function(direction){
-		var selected = $(this.selected).getElements('tr.selected');
-		var deselected = $(this.deselected).getElements('tr.selected');
-		var source = direction == 'left' ? selected : deselected;
-		source.each(function(row){
-			var name = this._getName(row);
-			this.moveRow(row, direction == 'left' ? 'deselected' : 'selected');
-		}, this);
-	},
-	
-	//destroys this widget
-	destroy: function(){
-		this.element.destroy();
-		this.fireEvent('destroy');
-		this.eject();
-		return this;
-	}
-
-});

+ 0 - 123
desktop/core/static/js/Source/UI/StickyWin.Drawer.js

@@ -1,123 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
----
-description: Drawer for StickyWin
-provides: [StickyWin.Drawer]
-requires: [Core/Fx.Tween, clientcide/StickyWin.UI]
-script: StickyWin.Drawer.js
-
-...
-*/
-StickyWin.UI.implement({
-	options: {
-		drawer: {
-			content: '',
-			side: 'right',
-			styles: {
-				width: 200,
-				minHeight: 100,
-				padding: 10,
-				background: '#fff',
-				position: 'absolute',
-				background: 'url(/static/art/drawer.png) no-repeat'
-			},
-			fxOptions: {
-				duration: 700,
-				transition: 'expo:out'
-			}
-		}
-	},
-	fillDrawer: function(content){
-		if (!this.drawer) return this.makeDrawer(content);
-		if ($(content) || $type(content) == "array") this.drawer_content.empty().adopt(content);
-		else this.drawer_content.set('html', content);
-		return this;
-	},
-	makeDrawer: function(content){
-		content = content || this.options.drawer.content;
-		this.drawer = new Element('div', {
-			'class':'sw_drawer'
-		}).setStyles(this.options.drawer.styles).inject(this.element).set('tween', this.options.drawer.fxOptions);
-		this.drawer_content = new Element('div', {
-			'class':'sw_drawer_content'
-		}).inject(this.drawer);
-		this.drawer_footer = new Element('div', {
-			'class':'sw_drawer_footer'
-		}).setStyles(this.options.drawer.styles).setStyle('height', 20);
-		this.fillDrawer(content);
-		this.drawer_footer.inject(this.drawer);
-		switch(this.options.drawer.side) {
-			case 'right':
-				this.drawer.setStyles({
-					right: 14, //-this.options.drawer.styles.width - 14,
-					top: 15,
-					zIndex: -1,
-					backgroundPosition: (-775 + this.options.drawer.styles.width) + 'px 0'
-				});
-				this.drawer_footer.setStyles({
-					bottom: -30,
-					left: 0,
-					minHeight: 10,
-					height: 10,
-					backgroundPosition: (-775 + this.options.drawer.styles.width) + 'px -782px'
-				});
-		}
-		return this;
-	},
-	toggleDrawer: function() {
-		this[this.drawerVisible ? 'hideDrawer' : 'showDrawer']();
-		return this;
-	},
-	showDrawer: function(){
-		if (!this.drawer) this.makeDrawer();
-		this.drawer.tween('right', -this.options.drawer.styles.width - 13);
-		this.drawerVisible = true;
-		return this;
-	},
-	hideDrawer: function(){
-		if (this.drawer) this.drawer.tween('right', 13);
-		this.drawerVisible = false;
-		return this;
-	}
-});
-
-StickyWin.implement({
-	getUI: function(){
-		var div = this.element.getElement('.DefaultStickyWin');
-		return div ? div.retrieve('StickyWinUI') : null;
-	},
-	fillDrawer: function(content) {
-		var ui = this.getUI();
-		if (ui) ui.fillDrawer(content);
-		return this;
-	},
-	toggleDrawer: function(show){
-		var ui = this.getUI();
-		if (ui) {
-			if (show) ui.showDrawer();
-			else if (show != undefined) ui.hideDrawer();
-			else ui.toggleDrawer();
-		}
-		return this;
-	},
-	hideDrawer: function(){
-		return this.toggleDrawer(false);
-	},
-	showDrawer: function(){
-		return this.toggleDrawer(true);
-	}
-});

+ 7 - 65
desktop/core/static/js/package.yml

@@ -2,90 +2,32 @@ copyright: Apache License v2.0
 description: Shared components for Hue
 name: ccs-shared
 sources: [
-  Source/JFrameFilters/CCS.JFrame.FormRequest.js,
-  Source/JFrameFilters/CCS.JFrame.Clearfix.js,
-  Source/JFrameFilters/CCS.JFrame.AutoRefresh.js,
-  Source/JFrameFilters/CCS.JFrame.DoubleClickDelegate.js,
-  Source/JFrameFilters/CCS.JFrame.ToggleHistory.js,
-  Source/JFrameFilters/CCS.JFrame.Deprecated.js,
   Source/Fx/Fx.Shake.js,
-  Source/JFrameRenderers/CCS.JFrame.Alert.js,
-  Source/JFrameRenderers/CCS.JFrame.Prompt.js,
-  Source/JFrameRenderers/CCS.JFrame.PartialRefresh.js,
-  Source/JFrameRenderers/PartialUpdate.js,
+  Source/JFrameFilters/CCS.JFrame.Deprecated.js,
   Source/CCS/CCS.js,
-  Source/CCS/CCS.ContextMenu.js,
+  Source/CCS/CCS.Desktop.js,
+  Source/CCS/CCS.Desktop.FlashMessage.js,
+  Source/CCS/CCS.Desktop.Config.js,
   Source/CCS/CCS.Desktop.BackgroundManager.js,
+  Source/CCS/CCS.Dock.js,
   Source/CCS/CCS.JBrowser.js,
-  Source/CCS/CCS.Error.js,
   Source/CCS/CCS.JFrame.js,
+  Source/CCS/CCS.Login.js,
   Source/CCS/CCS.Request.js,
-  Source/CCS/CCS.SideScroller.js,
   Source/CCS/CCS.SolidWindow.js,
-  Source/CCS/CCS.DropDown.js,
-  Source/CCS/CCS.Desktop.js,
-  Source/CCS/CCS.Desktop.FlashMessage.js,
-  Source/CCS/CCS.Desktop.Config.js,
-  Source/CCS/CCS.Dock.js,
-  Source/CCS/CCS.Desktop.Keys.js,
   Source/CCS/CCS.User.js,
-  Source/CCS/CCS.Login.js,
   Source/CCS/HueChart.js,
   Source/CCS/HueChart.Box.js,
   Source/CCS/HueChart.Area.js,
   Source/CCS/HueChart.Line.js,
   Source/CCS/HueChart.Circle.js,
   Source/CCS/HueChart.GroupValueManager.js,
-  Source/Forms/Form.Request.JSON.js,
-  Source/Forms/EditInline.js,
-  Source/UI/StickyWin.Drawer.js,
   Source/UI/StickyWin.UI.Solid.js,
   Source/UI/ThumbTack.js,
-  Source/JFrameLinkers/CCS.JFrame.AjaxLoad.js,
-  Source/JFrameLinkers/CCS.JFrame.CheckAllOrNone.js,
   Source/JFrameLinkers/CCS.JFrame.Chooser.js,
-  Source/JFrameLinkers/CCS.JFrame.ConfirmAndPost.js,
-  Source/JFrameLinkers/CCS.JFrame.FakeRefresh.js,
-  Source/JFrameLinkers/CCS.JFrame.HideParent.js,
-  Source/JFrameLinkers/CCS.JFrame.LivePath.js,
-  Source/JFrameLinkers/CCS.JFrame.Nav.js,
-  Source/JFrameLinkers/CCS.JFrame.NoScroll.js,
-  Source/JFrameLinkers/CCS.JFrame.PromptAndPost.js,
-  Source/JFrameLinkers/CCS.JFrame.Refresh.js,
-  Source/JFrameLinkers/CCS.JFrame.RefreshWithParams.js,
-  Source/JFrameLinkers/CCS.JFrame.SubmitLink.js,
-  Source/JFrameLinkers/CCS.JFrame.SplitViewLinkers.js,
-  Source/JFrameLinkers/CCS.JFrame.Target.js,
   Source/Native/String.CCS.js,
-  Source/Native/Element.Data.js,
   Source/Native/Number.Files.js,
   Source/StaticThirdParty/DynamicTextarea.js,
-  Source/UI/ART.SideBySideSelect.js,
-  Source/BehaviorFilters/Behavior.Autocomplete.js,
-  Source/BehaviorFilters/Behavior.CollapsingElements.js,
-  Source/BehaviorFilters/Behavior.ContextMenu.js,
-  Source/BehaviorFilters/Behavior.DataGroupToggle.js,
-  Source/BehaviorFilters/Behavior.FilterInput.js,
-  Source/BehaviorFilters/Behavior.FitText.js,
-  Source/BehaviorFilters/Behavior.HtmlTableCheckSelected.js,
-  Source/BehaviorFilters/Behavior.HtmlTableChromeHack.js,
-  Source/BehaviorFilters/Behavior.HtmlTableKeyboard.js,
-  Source/BehaviorFilters/Behavior.HtmlTableKeyboardKids.js,
-  Source/BehaviorFilters/Behavior.HtmlTableLiveTreeKeyboard.js,
-  Source/BehaviorFilters/Behavior.HtmlTableMultiSelectMenu.js,
-  Source/BehaviorFilters/Behavior.HtmlTableRestore.js,
-  Source/BehaviorFilters/Behavior.HtmlTableUpdate.js,
-  Source/BehaviorFilters/Behavior.InputFilterHtmlTableZebra.js,
-  Source/BehaviorFilters/Behavior.MultiChecks.js,
-  Source/BehaviorFilters/Behavior.PostEditor.js,
-  Source/BehaviorFilters/Behavior.SelectWithOther.js,
-  Source/BehaviorFilters/Behavior.SideBySideSelect.js,
-  Source/BehaviorFilters/Behavior.SizeTo.js,
-  Source/BehaviorFilters/Behavior.SplitViewPostFold.js,
-  Source/BehaviorFilters/Behavior.SplitViewScroller.js,
-  Source/BehaviorFilters/Behavior.SubmitOnChange.js,
-  Source/BehaviorFilters/Behavior.Tabs.js,
-  Source/BehaviorFilters/Behavior.Tips.js,
-  Source/BehaviorFilters/Behavior.Timer.js,
+
 ]
 version: Unknown