Эх сурвалжийг харах

HUE-727 [fb] filechooser.js should not always open on / by default
Changed filechooser.js
Added initial path to the places where filechooser is used

Enrico Berti 13 жил өмнө
parent
commit
1cde9c4bfe

+ 1 - 1
apps/beeswax/src/beeswax/templates/choose_file.mako

@@ -175,4 +175,4 @@ ${layout.menubar(section='tables')}
     });
 </script>
 
-${commonfooter()}
+${commonfooter()}

+ 0 - 1
apps/beeswax/src/beeswax/templates/create_table_manually.mako

@@ -424,7 +424,6 @@ ${layout.menubar(section='tables')}
             $("#chooseFile").modal("show");
         });
 
-
         $(".step").click(function(event){
             event.preventDefault();
             $(".stepDetails").hide();

+ 32 - 33
apps/beeswax/src/beeswax/templates/describe_table.mako

@@ -191,42 +191,41 @@ ${layout.menubar(section='tables')}
 </div>
 </div>
 <style>
-	#filechooser {
-		display:none;
-		min-height:100px;
-		overflow-y:scroll;
-		margin-top:10px;
-	}
+    #filechooser {
+        display:none;
+        min-height:100px;
+        overflow-y:scroll;
+        margin-top:10px;
+    }
 </style>
 
 <script type="text/javascript" charset="utf-8">
-	$(document).ready(function(){
-
-		$("#filechooser").jHueFileChooser({
-			onFileChoose: function(filePath){
-				$(".loadPath").val(filePath);
-				$("#filechooser").slideUp();
-			},
-			createFolder: false
-		});
-		$(".datatables").dataTable({
-			"bPaginate": false,
-		    "bLengthChange": false,
-			"bInfo": false,
-			"bFilter": false
-		});
-
-		$.getJSON("${ url("beeswax.views.drop_table", table=table_name) }",function(data){
-			$("#dropTableMessage").text(data.title);
-		});
-		$(".hideModal").click(function(){
-			$(this).closest(".modal").modal("hide");
-		});
-		$(".loadPath").click(function(){
-			$("#filechooser").slideDown();
-		});
-
-	});
+    $(document).ready(function(){
+        $("#filechooser").jHueFileChooser({
+            initialPath: $(".loadPath").val(),
+            onFileChoose: function(filePath){
+                $(".loadPath").val(filePath);
+                $("#filechooser").slideUp();
+            },
+            createFolder: false
+        });
+        $(".datatables").dataTable({
+            "bPaginate": false,
+            "bLengthChange": false,
+            "bInfo": false,
+            "bFilter": false
+        });
+
+        $.getJSON("${ url("beeswax.views.drop_table", table=table_name) }",function(data){
+            $("#dropTableMessage").text(data.title);
+        });
+        $(".hideModal").click(function(){
+            $(this).closest(".modal").modal("hide");
+        });
+        $(".loadPath").click(function(){
+            $("#filechooser").slideDown();
+        });
+    });
 </script>
 
 ${commonfooter()}

+ 312 - 311
apps/beeswax/src/beeswax/templates/execute.mako

@@ -23,39 +23,39 @@
 <%namespace name="util" file="util.mako" />
 
 <%def name="query()">
-	<h1>Hive Query</h1>
-	<fieldset>
-		% if design and not design.is_auto and design.name:
-	          <legend>${design.name}</legend>
-	          % if design.desc:
-	            <p>${design.desc}</p>
-	          % endif
-
-	      % else:
-	        <legend>Query</legend>
-	      % endif
+    <h1>Hive Query</h1>
+    <fieldset>
+        % if design and not design.is_auto and design.name:
+              <legend>${design.name}</legend>
+              % if design.desc:
+                <p>${design.desc}</p>
+              % endif
+
+          % else:
+            <legend>Query</legend>
+          % endif
 
       <div class="clearfix">
         <div class="input">
             <textarea class="span9" rows="9" placeholder="Example: SELECT * FROM tablename" name="${form.query["query"].html_name | n}" id="queryField">${extract_field_data(form.query["query"]) or ''}</textarea>
-			<div id="validationResults">
-			% if len(form.query["query"].errors):
-				${unicode(form.query["query"].errors) | n}
-			 % endif
-			</div>
+            <div id="validationResults">
+            % if len(form.query["query"].errors):
+                ${unicode(form.query["query"].errors) | n}
+             % endif
+            </div>
         </div>
       </div>
     </fieldset>
 
-	<div class="actions">
-		<a id="executeQuery" class="btn primary">Execute</a>
-		% if design and not design.is_auto and design.name:
+    <div class="actions">
+        <a id="executeQuery" class="btn primary">Execute</a>
+        % if design and not design.is_auto and design.name:
         <a id="saveQuery" class="btn">Save</a>
         % endif
         <a id="saveQueryAs" class="btn">Save as...</a>
         <a id="explainQuery" class="btn">Explain</a>
-		&nbsp; or create a &nbsp;<a class="btn" href="${ url('beeswax.views.execute_query') }">New query</a>
-	</div>
+        &nbsp; or create a &nbsp;<a class="btn" href="${ url('beeswax.views.execute_query') }">New query</a>
+    </div>
 </%def>
 
 
@@ -63,161 +63,161 @@ ${commonheader("Hive Query", "beeswax", "100px")}
 ${layout.menubar(section='query')}
 
 <div class="container-fluid">
-	<div class="row-fluid">
-		<div class="span3">
-			<div class="well sidebar-nav">
-				<form id="advancedSettingsForm" action="${action}" method="POST" class="form form-horizontal noPadding">
-					<ul class="nav nav-list">
-						<li class="nav-header">Hive settings</li>
-						<li>
-							% for i, f in enumerate(form.settings.forms):
-							<div class="param">
-								<div class="remove">
-									${comps.field(f['_deleted'], tag="button", button_text="x", notitle=True, attrs=dict(
-										type="submit",
-										title="Delete this setting",
-										klass="btn btn-mini settingsDelete"
-									), value=True)}
-								</div>
-
-								<div class="control-group">
-									${comps.label(f['key'])}
-									${comps.field(f['key'], attrs=dict(
-										placeholder="mapred.reduce.tasks",
-										klass="settingsField span8"
-									))}
-							    </div>
-
-								<div class="control-group">
-									${comps.label(f['value'])}
-									${comps.field(f['value'], attrs=dict(
-										placeholder="1",
-										klass="span8"
-									))}
-								</div>
-							</div>
-							${comps.field(f['_exists'], hidden=True)}
-
-						    % endfor
-							<div class="control-group">
-								<a class="btn btn-small" data-form-prefix="settings">Add</a>
-							</div>
-						</li>
-						<li class="nav-header">File Resources</li>
-						<li>
-							% for i, f in enumerate(form.file_resources.forms):
-							<div class="param">
-								<div class="remove">
-									${comps.field(f['_deleted'], tag="button", button_text="x", notitle=True, attrs=dict(
-										type="submit",
-										title="Delete this setting",
-										klass="btn btn-mini file_resourcesDelete"
-									), value=True)}
-								</div>
-
-								<div class="control-group">
-									${comps.label(f['type'])}
-									${comps.field(f['type'], render_default=True, attrs=dict(
-										klass="span8"
-									))}
-							    </div>
-
-								<div class="control-group">
-									${comps.label(f['path'])}
-									${comps.field(f['path'], attrs=dict(
-										placeholder="/user/foo/udf.jar",
-										klass="input-small file_resourcesField",
-										data_filters=f['path'].html_name
-									))}
-								</div>
-							</div>
-							${comps.field(f['_exists'], hidden=True)}
-
-				            % endfor
-							<div class="control-group">
-								<a class="btn btn-small" data-form-prefix="file_resources">Add</a>
-							</div>
-						</li>
-						<li class="nav-header">User-defined Functions</li>
-						<li>
-							% for i, f in enumerate(form.functions.forms):
-								<div class="param">
-									<div class="remove">
-										${comps.field(f['_deleted'], tag="button", button_text="x", notitle=True, attrs=dict(
-											type="submit",
-											title="Delete this setting",
-											klass="btn btn-mini file_resourcesDelete"
-										), value=True)}
-									</div>
-
-									<div class="control-group">
-										${comps.label(f['name'])}
-										${comps.field(f['name'], attrs=dict(
-											placeholder="myFunction",
-											klass="span8 functionsField"
-										))}
-								    </div>
-
-									<div class="control-group">
-										${comps.label(f['class_name'])}
-										${comps.field(f['class_name'], attrs=dict(
-											placeholder="com.acme.example",
-											klass="span8"
-										))}
-									</div>
-								</div>
-
-					          ${comps.field(f['_exists'], hidden=True)}
-					        % endfor
-							<div class="control-group">
-								<a class="btn btn-small" data-form-prefix="functions">Add</a>
-							</div>
-						</li>
-						<li class="nav-header">Parametrization</li>
-						<li>
-							${comps.field(form.query["is_parameterized"],
-					            notitle = True,
-					            tag = "checkbox",
-					            button_text = "Enable Parameterization",
-					            help = "If checked (the default), you can include parameters like $parameter_name in your query, and users will be prompted for a value when the query is run.",
-					            help_attrs= dict(
-					              data_help_direction='11'
-					            )
-					        )}
-						</li>
-						<li class="nav-header">Email Notification</li>
-						<li>
-							${comps.field(form.query["email_notify"],
-		                      notitle = True,
-		                      tag = "checkbox",
-		                      button_text = "Email me on complete",
-		                      help = "If checked, you will receive an email notification when the query completes.",
-		                      help_attrs= dict(
-		                        data_help_direction='11'
-		                      )
-		                     )}
-						</li>
-					</ul>
-					<input type="hidden" name="${form.query["query"].html_name | n}" class="query" value="" />
-				</form>
-			</div>
-		</div>
-		<div class="span9">
-			% if error_message:
-				<div class="alert alert-error">
-					<p><strong>Your query has the following error(s):</strong></p>
-					<p>${error_message}</p>
-					% if log:
-						<small>click the <b>Error Log</b> tab below for details</small>
-					% endif
-				</div>
-			% endif
-
-	        % if on_success_url:
-	          <input type="hidden" name="on_success_url" value="${on_success_url}"/>
-	        % endif
-
-	        % if error_messages or log:
+    <div class="row-fluid">
+        <div class="span3">
+            <div class="well sidebar-nav">
+                <form id="advancedSettingsForm" action="${action}" method="POST" class="form form-horizontal noPadding">
+                    <ul class="nav nav-list">
+                        <li class="nav-header">Hive settings</li>
+                        <li>
+                            % for i, f in enumerate(form.settings.forms):
+                            <div class="param">
+                                <div class="remove">
+                                    ${comps.field(f['_deleted'], tag="button", button_text="x", notitle=True, attrs=dict(
+                                        type="submit",
+                                        title="Delete this setting",
+                                        klass="btn btn-mini settingsDelete"
+                                    ), value=True)}
+                                </div>
+
+                                <div class="control-group">
+                                    ${comps.label(f['key'])}
+                                    ${comps.field(f['key'], attrs=dict(
+                                        placeholder="mapred.reduce.tasks",
+                                        klass="settingsField span8"
+                                    ))}
+                                </div>
+
+                                <div class="control-group">
+                                    ${comps.label(f['value'])}
+                                    ${comps.field(f['value'], attrs=dict(
+                                        placeholder="1",
+                                        klass="span8"
+                                    ))}
+                                </div>
+                            </div>
+                            ${comps.field(f['_exists'], hidden=True)}
+
+                            % endfor
+                            <div class="control-group">
+                                <a class="btn btn-small" data-form-prefix="settings">Add</a>
+                            </div>
+                        </li>
+                        <li class="nav-header">File Resources</li>
+                        <li>
+                            % for i, f in enumerate(form.file_resources.forms):
+                            <div class="param">
+                                <div class="remove">
+                                    ${comps.field(f['_deleted'], tag="button", button_text="x", notitle=True, attrs=dict(
+                                        type="submit",
+                                        title="Delete this setting",
+                                        klass="btn btn-mini file_resourcesDelete"
+                                    ), value=True)}
+                                </div>
+
+                                <div class="control-group">
+                                    ${comps.label(f['type'])}
+                                    ${comps.field(f['type'], render_default=True, attrs=dict(
+                                        klass="span8"
+                                    ))}
+                                </div>
+
+                                <div class="control-group">
+                                    ${comps.label(f['path'])}
+                                    ${comps.field(f['path'], attrs=dict(
+                                        placeholder="/user/foo/udf.jar",
+                                        klass="input-small file_resourcesField",
+                                        data_filters=f['path'].html_name
+                                    ))}
+                                </div>
+                            </div>
+                            ${comps.field(f['_exists'], hidden=True)}
+
+                            % endfor
+                            <div class="control-group">
+                                <a class="btn btn-small" data-form-prefix="file_resources">Add</a>
+                            </div>
+                        </li>
+                        <li class="nav-header">User-defined Functions</li>
+                        <li>
+                            % for i, f in enumerate(form.functions.forms):
+                                <div class="param">
+                                    <div class="remove">
+                                        ${comps.field(f['_deleted'], tag="button", button_text="x", notitle=True, attrs=dict(
+                                            type="submit",
+                                            title="Delete this setting",
+                                            klass="btn btn-mini file_resourcesDelete"
+                                        ), value=True)}
+                                    </div>
+
+                                    <div class="control-group">
+                                        ${comps.label(f['name'])}
+                                        ${comps.field(f['name'], attrs=dict(
+                                            placeholder="myFunction",
+                                            klass="span8 functionsField"
+                                        ))}
+                                    </div>
+
+                                    <div class="control-group">
+                                        ${comps.label(f['class_name'])}
+                                        ${comps.field(f['class_name'], attrs=dict(
+                                            placeholder="com.acme.example",
+                                            klass="span8"
+                                        ))}
+                                    </div>
+                                </div>
+
+                              ${comps.field(f['_exists'], hidden=True)}
+                            % endfor
+                            <div class="control-group">
+                                <a class="btn btn-small" data-form-prefix="functions">Add</a>
+                            </div>
+                        </li>
+                        <li class="nav-header">Parametrization</li>
+                        <li>
+                            ${comps.field(form.query["is_parameterized"],
+                                notitle = True,
+                                tag = "checkbox",
+                                button_text = "Enable Parameterization",
+                                help = "If checked (the default), you can include parameters like $parameter_name in your query, and users will be prompted for a value when the query is run.",
+                                help_attrs= dict(
+                                  data_help_direction='11'
+                                )
+                            )}
+                        </li>
+                        <li class="nav-header">Email Notification</li>
+                        <li>
+                            ${comps.field(form.query["email_notify"],
+                              notitle = True,
+                              tag = "checkbox",
+                              button_text = "Email me on complete",
+                              help = "If checked, you will receive an email notification when the query completes.",
+                              help_attrs= dict(
+                                data_help_direction='11'
+                              )
+                             )}
+                        </li>
+                    </ul>
+                    <input type="hidden" name="${form.query["query"].html_name | n}" class="query" value="" />
+                </form>
+            </div>
+        </div>
+        <div class="span9">
+            % if error_message:
+                <div class="alert alert-error">
+                    <p><strong>Your query has the following error(s):</strong></p>
+                    <p>${error_message}</p>
+                    % if log:
+                        <small>click the <b>Error Log</b> tab below for details</small>
+                    % endif
+                </div>
+            % endif
+
+            % if on_success_url:
+              <input type="hidden" name="on_success_url" value="${on_success_url}"/>
+            % endif
+
+            % if error_messages or log:
                 <ul class="nav nav-tabs">
                     <li class="active">
                         <a href="#queryPane" data-toggle="tab">Query</a>
@@ -235,38 +235,38 @@ ${layout.menubar(section='query')}
                     % endif
                 </ul>
 
-				<div class="tab-content">
-					<div class="active tab-pane" id="queryPane">
-						${query()}
-					</div>
-					% if error_message or log:
-						<div class="tab-pane" id="errorPane">
-						% if log:
-							<pre>${log | h}</pre>
-						% endif
-						</div>
-					% endif
-				</div>
-			% else:
-				${query()}
-			% endif
-			<br/>
-		</div>
-	</div>
+                <div class="tab-content">
+                    <div class="active tab-pane" id="queryPane">
+                        ${query()}
+                    </div>
+                    % if error_message or log:
+                        <div class="tab-pane" id="errorPane">
+                        % if log:
+                            <pre>${log | h}</pre>
+                        % endif
+                        </div>
+                    % endif
+                </div>
+            % else:
+                ${query()}
+            % endif
+            <br/>
+        </div>
+    </div>
 </div>
 
 
 <div id="chooseFile" class="modal hide fade">
-	<div class="modal-header">
-		<a href="#" class="close" data-dismiss="modal">&times;</a>
-		<h3>Choose a file</h3>
-	</div>
-	<div class="modal-body">
-		<div id="filechooser">
-		</div>
-	</div>
-	<div class="modal-footer">
-	</div>
+    <div class="modal-header">
+        <a href="#" class="close" data-dismiss="modal">&times;</a>
+        <h3>Choose a file</h3>
+    </div>
+    <div class="modal-body">
+        <div id="filechooser">
+        </div>
+    </div>
+    <div class="modal-footer">
+    </div>
 </div>
 
 <div id="saveAs" class="modal hide fade">
@@ -290,94 +290,95 @@ ${layout.menubar(section='query')}
 </div>
 
 <style>
-	#filechooser {
-		min-height:100px;
-		overflow-y:scroll;
-	}
-	.control-group label {
-	    float: left;
-	    padding-top: 5px;
-	    text-align: left;
-	    width: 40px;
-	}
-	.nav-list {
-		padding:0;
-	}
-	.param {
-		background:#FDFDFD;
-		padding: 8px 8px 1px 8px;
-		border-radius: 4px;
-	    -webkit-border-radius: 4px;
-	    -moz-border-radius: 4px;
-		margin-bottom:5px;
-		border:1px solid #EEE;
-	}
-	.remove {
-		float:right;
-	}
-	.file_resourcesField {
-		border-radius: 3px 0 0 3px;
-		border-right:0;
-	}
-	.fileChooserBtn {
-		border-radius: 0 3px 3px 0;
-	}
+    #filechooser {
+        min-height:100px;
+        overflow-y:scroll;
+    }
+    .control-group label {
+        float: left;
+        padding-top: 5px;
+        text-align: left;
+        width: 40px;
+    }
+    .nav-list {
+        padding:0;
+    }
+    .param {
+        background:#FDFDFD;
+        padding: 8px 8px 1px 8px;
+        border-radius: 4px;
+        -webkit-border-radius: 4px;
+        -moz-border-radius: 4px;
+        margin-bottom:5px;
+        border:1px solid #EEE;
+    }
+    .remove {
+        float:right;
+    }
+    .file_resourcesField {
+        border-radius: 3px 0 0 3px;
+        border-right:0;
+    }
+    .fileChooserBtn {
+        border-radius: 0 3px 3px 0;
+    }
 
 </style>
 
 
 <script type="text/javascript" charset="utf-8">
-	$(document).ready(function(){
-		$("*[rel=tooltip]").tooltip({
-			placement: 'right'
-		});
-		// hack!!!
-		$("select").addClass("span8");
-
-		$("a[data-form-prefix]").each(function(){
-			var _prefix = $(this).attr("data-form-prefix");
-			var _nextID = 0;
-			if ($("."+_prefix+"Field").length){
-				_nextID= ($("."+_prefix+"Field").last().attr("name").substr(_prefix.length+1).split("-")[0]*1)+1;
-			}
-			$("<input>").attr("type","hidden").attr("name",_prefix+"-next_form_id").attr("value",_nextID).appendTo($("#advancedSettingsForm"));
-			$("."+_prefix+"Delete").click(function(e){
-				e.preventDefault();
-				$("input[name="+_prefix+"-add]").attr("value","");
-				$("<input>").attr("type","hidden").attr("name", $(this).attr("name")).attr("value","True").appendTo($("#advancedSettingsForm"));
-				checkAndSubmit();
-			});
-		});
-
-		$("a[data-form-prefix]").click(function(){
-			var _prefix = $(this).attr("data-form-prefix");
-			$("<input>").attr("type","hidden").attr("name",_prefix+"-add").attr("value","True").appendTo($("#advancedSettingsForm"));
-			checkAndSubmit();
-		});
-
-		$(".file_resourcesField").each(function(){
-			var self = $(this);
-			self.after(getFileBrowseButton(self));
-		});
-
-		function getFileBrowseButton(inputElement) {
-			return $("<button>").addClass("btn").addClass("fileChooserBtn").text("..").click(function(e){
-				e.preventDefault();
-				$("#filechooser").jHueFileChooser({
-	                onFileChoose: function(filePath) {
-	                    inputElement.val(filePath);
-	                    $("#chooseFile").modal("hide");
-	                },
-	                createFolder: false
-	            });
-	            $("#chooseFile").modal("show");
-			})
-		}
-
-		$("#executeQuery").click(function(){
-			$("<input>").attr("type","hidden").attr("name","button-submit").attr("value","Execute").appendTo($("#advancedSettingsForm"));
-			checkAndSubmit();
-		});
+    $(document).ready(function(){
+        $("*[rel=tooltip]").tooltip({
+            placement: 'right'
+        });
+        // hack!!!
+        $("select").addClass("span8");
+
+        $("a[data-form-prefix]").each(function(){
+            var _prefix = $(this).attr("data-form-prefix");
+            var _nextID = 0;
+            if ($("."+_prefix+"Field").length){
+                _nextID= ($("."+_prefix+"Field").last().attr("name").substr(_prefix.length+1).split("-")[0]*1)+1;
+            }
+            $("<input>").attr("type","hidden").attr("name",_prefix+"-next_form_id").attr("value",_nextID).appendTo($("#advancedSettingsForm"));
+            $("."+_prefix+"Delete").click(function(e){
+                e.preventDefault();
+                $("input[name="+_prefix+"-add]").attr("value","");
+                $("<input>").attr("type","hidden").attr("name", $(this).attr("name")).attr("value","True").appendTo($("#advancedSettingsForm"));
+                checkAndSubmit();
+            });
+        });
+
+        $("a[data-form-prefix]").click(function(){
+            var _prefix = $(this).attr("data-form-prefix");
+            $("<input>").attr("type","hidden").attr("name",_prefix+"-add").attr("value","True").appendTo($("#advancedSettingsForm"));
+            checkAndSubmit();
+        });
+
+        $(".file_resourcesField").each(function(){
+            var self = $(this);
+            self.after(getFileBrowseButton(self));
+        });
+
+        function getFileBrowseButton(inputElement) {
+            return $("<button>").addClass("btn").addClass("fileChooserBtn").text("..").click(function(e){
+                e.preventDefault();
+                $("#filechooser").jHueFileChooser({
+                    initialPath: inputElement.val(),
+                    onFileChoose: function(filePath) {
+                        inputElement.val(filePath);
+                        $("#chooseFile").modal("hide");
+                    },
+                    createFolder: false
+                });
+                $("#chooseFile").modal("show");
+            })
+        }
+
+        $("#executeQuery").click(function(){
+            $("<input>").attr("type","hidden").attr("name","button-submit").attr("value","Execute").appendTo($("#advancedSettingsForm"));
+            checkAndSubmit();
+        });
 
         $("#saveQuery").click(function(){
             $("<input>").attr("type","hidden").attr("name","saveform-name")
@@ -388,10 +389,10 @@ ${layout.menubar(section='query')}
             checkAndSubmit();
         });
 
-		$("#saveQueryAs").click(function(){
-			$("<input>").attr("type","hidden").attr("name","saveform-saveas").attr("value","Save As...").appendTo($("#advancedSettingsForm"));
-			$("#saveAs").modal("show");
-		});
+        $("#saveQueryAs").click(function(){
+            $("<input>").attr("type","hidden").attr("name","saveform-saveas").attr("value","Save As...").appendTo($("#advancedSettingsForm"));
+            $("#saveAs").modal("show");
+        });
 
         $("#saveAsNameBtn").click(function(){
              $("<input>").attr("type","hidden").attr("name","saveform-name")
@@ -402,26 +403,26 @@ ${layout.menubar(section='query')}
             checkAndSubmit();
         });
 
-		$("#explainQuery").click(function(){
-			$("<input>").attr("type","hidden").attr("name","button-explain").attr("value","Explain").appendTo($("#advancedSettingsForm"));
-			checkAndSubmit();
-		});
-
-		$("#queryField").change(function(){
-			$(".query").val($(this).val());
-		});
-
-		$("#queryField").focus(function(){
-			$(this).removeClass("fieldError");
-			$("#validationResults").empty();
-		});
-
-		function checkAndSubmit(){
-			// TODO: client side validation
-			$(".query").val($("#queryField").val());
-			$("#advancedSettingsForm").submit();
-		}
-	});
+        $("#explainQuery").click(function(){
+            $("<input>").attr("type","hidden").attr("name","button-explain").attr("value","Explain").appendTo($("#advancedSettingsForm"));
+            checkAndSubmit();
+        });
+
+        $("#queryField").change(function(){
+            $(".query").val($(this).val());
+        });
+
+        $("#queryField").focus(function(){
+            $(this).removeClass("fieldError");
+            $("#validationResults").empty();
+        });
+
+        function checkAndSubmit(){
+            // TODO: client side validation
+            $(".query").val($("#queryField").val());
+            $("#advancedSettingsForm").submit();
+        }
+    });
 </script>
 
 

+ 54 - 53
apps/beeswax/src/beeswax/templates/watch_results.mako

@@ -161,61 +161,62 @@ ${layout.menubar(section='query')}
 
 
 <script type="text/javascript" charset="utf-8">
-	$(document).ready(function(){
-		$(".resultTable").dataTable({
-			"bPaginate": false,
-		    "bLengthChange": false,
-			"bInfo": false
-		});
-		$(".dataTables_wrapper").css("min-height","0");
-		$(".dataTables_filter").hide();
-		$("input[name='save_target']").change(function(){
-			$("#fieldRequired").addClass("hide");
-			$("input[name='target_dir']").removeClass("fieldError");
-			$("input[name='target_table']").removeClass("fieldError");
-			if ($(this).val().indexOf("HDFS")>-1){
-				$("input[name='target_table']").addClass("hide");
-				$("input[name='target_dir']").removeClass("hide");
-			}
-			else {
-				$("input[name='target_table']").removeClass("hide");
-				$("input[name='target_dir']").addClass("hide");
-			}
-		});
+    $(document).ready(function(){
+        $(".resultTable").dataTable({
+            "bPaginate": false,
+            "bLengthChange": false,
+            "bInfo": false
+        });
+        $(".dataTables_wrapper").css("min-height","0");
+        $(".dataTables_filter").hide();
+        $("input[name='save_target']").change(function(){
+            $("#fieldRequired").addClass("hide");
+            $("input[name='target_dir']").removeClass("fieldError");
+            $("input[name='target_table']").removeClass("fieldError");
+            if ($(this).val().indexOf("HDFS")>-1){
+                $("input[name='target_table']").addClass("hide");
+                $("input[name='target_dir']").removeClass("hide");
+            }
+            else {
+                $("input[name='target_table']").removeClass("hide");
+                $("input[name='target_dir']").addClass("hide");
+            }
+        });
 
-		$("#saveForm").submit(function(){
-			if ($("input[name='save_target']:checked").val().indexOf("HDFS")>-1){
-				if ($.trim($("input[name='target_dir']").val()) == ""){
-					$("#fieldRequired").removeClass("hide");
-					$("input[name='target_dir']").addClass("fieldError");
-					return false;
-				}
-			}
-			else {
-				if ($.trim($("input[name='target_table']").val()) == ""){
-					$("#fieldRequired").removeClass("hide");
-					$("input[name='target_table']").addClass("fieldError");
-					return false;
-				}
-			}
-			return true;
-		});
+        $("#saveForm").submit(function(){
+            if ($("input[name='save_target']:checked").val().indexOf("HDFS")>-1){
+                if ($.trim($("input[name='target_dir']").val()) == ""){
+                    $("#fieldRequired").removeClass("hide");
+                    $("input[name='target_dir']").addClass("fieldError");
+                    return false;
+                }
+            }
+            else {
+                if ($.trim($("input[name='target_table']").val()) == ""){
+                    $("#fieldRequired").removeClass("hide");
+                    $("input[name='target_table']").addClass("fieldError");
+                    return false;
+                }
+            }
+            return true;
+        });
 
-		$(".pathChooser").click(function(){
-			var self = this;
-			$("#fileChooserModal").jHueFileChooser({
-				onFileChoose: function(filePath) {
-					$(self).val(filePath);
-				},
-				onFolderChange: function(folderPath){
-					$(self).val(folderPath);
-				},
-				createFolder: false,
-				uploadFile: false
-			});
-			$("#fileChooserModal").slideDown();
-		});
-	});
+        $(".pathChooser").click(function(){
+            var self = this;
+            $("#fileChooserModal").jHueFileChooser({
+                initialPath: $(self).val(),
+                onFileChoose: function(filePath) {
+                    $(self).val(filePath);
+                },
+                onFolderChange: function(folderPath){
+                    $(self).val(folderPath);
+                },
+                createFolder: false,
+                uploadFile: false
+            });
+            $("#fileChooserModal").slideDown();
+        });
+    });
 </script>
 
 ${commonfooter()}

+ 47 - 49
apps/filebrowser/src/filebrowser/templates/chown.mako

@@ -84,8 +84,8 @@
 
     </div>
     <div class="modal-footer" style="padding-top: 10px;">
-		<div id="chownRequired" class="hide" style="position: absolute; left: 10;">
-			<span class="label label-important">Sorry, name is required.</span>
+        <div id="chownRequired" class="hide" style="position: absolute; left: 10;">
+            <span class="label label-important">Sorry, name is required.</span>
         </div>
         <input class="btn primary" type="submit" value="Submit" />
         <a class="btn" onclick="$('#changeOwnerModal').modal('hide');">Cancel</a>
@@ -93,53 +93,51 @@
 </form>
 
 <script type="text/javascript" charset="utf-8">
-	$(document).ready(function(){
-		$("select[name='user']").change(function(){
-			if ($(this).val() == "__other__"){
-				$("input[name='user_other']").show();
-			}
-			else {
-				$("input[name='user_other']").hide();
-			}
-		});
-		$("select[name='group']").change(function(){
-			if ($(this).val() == "__other__"){
-				$("input[name='group_other']").show();
-			}
-			else {
-				$("input[name='group_other']").hide();
-			}
-		});
+    $(document).ready(function(){
+        $("select[name='user']").change(function(){
+            if ($(this).val() == "__other__"){
+                $("input[name='user_other']").show();
+            }
+            else {
+                $("input[name='user_other']").hide();
+            }
+        });
+        $("select[name='group']").change(function(){
+            if ($(this).val() == "__other__"){
+                $("input[name='group_other']").show();
+            }
+            else {
+                $("input[name='group_other']").hide();
+            }
+        });
 
-		$("#chownForm").submit(function(){
-			console.log($("select[name='user']").val());
-			console.log($("select[name='group']").val());
-			if ($("select[name='user']").val() == null){
-				$("#chownRequired").find(".label").text("Sorry, user is required.");
-				$("#chownRequired").show();
-				return false;
-			}
-			else if ($("select[name='group']").val() == null){
-				$("#chownRequired").find(".label").text("Sorry, group is required.");
-				$("#chownRequired").show();
-				return false;
-			}
-			else {
-				if ($("select[name='group']").val() == "__other__" && $("input[name='group_other']").val() == ""){
-					$("#chownRequired").find(".label").text("Sorry, you need to specify another group.");
-					$("input[name='group_other']").addClass("fieldError");
-					$("#chownRequired").show();
-					return false;
-				}
-				if ($("select[name='user']").val() == "__other__" && $("input[name='user_other']").val() == ""){
-					$("#chownRequired").find(".label").text("Sorry, you need to specify another user.");
-					$("input[name='user_other']").addClass("fieldError");
-					$("#chownRequired").show();
-					return false;
-				}
-				return true;
-			}
-		});
-	});
+        $("#chownForm").submit(function(){
+            if ($("select[name='user']").val() == null){
+                $("#chownRequired").find(".label").text("Sorry, user is required.");
+                $("#chownRequired").show();
+                return false;
+            }
+            else if ($("select[name='group']").val() == null){
+                $("#chownRequired").find(".label").text("Sorry, group is required.");
+                $("#chownRequired").show();
+                return false;
+            }
+            else {
+                if ($("select[name='group']").val() == "__other__" && $("input[name='group_other']").val() == ""){
+                    $("#chownRequired").find(".label").text("Sorry, you need to specify another group.");
+                    $("input[name='group_other']").addClass("fieldError");
+                    $("#chownRequired").show();
+                    return false;
+                }
+                if ($("select[name='user']").val() == "__other__" && $("input[name='user_other']").val() == ""){
+                    $("#chownRequired").find(".label").text("Sorry, you need to specify another user.");
+                    $("input[name='user_other']").addClass("fieldError");
+                    $("#chownRequired").show();
+                    return false;
+                }
+                return true;
+            }
+        });
+    });
 </script>
 

+ 138 - 139
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -29,121 +29,121 @@ from django.utils.encoding import smart_str
   ${_table(files, path, current_request_path, 'view', cwd_set)}
 </%def>
 <%def name="_table(files, path, current_request_path, view, cwd_set=False)">
-	<script src="/static/ext/js/fileuploader.js" type="text/javascript" charset="utf-8"></script>
-	<script src="/static/ext/js/datatables-paging-0.1.js" type="text/javascript" charset="utf-8"></script>
-	<link rel="stylesheet" href="/static/ext/css/fileuploader.css" type="text/css" media="screen" title="no title" charset="utf-8" />
-	<style type="text/css">
-		.pull-right {
-			margin: 4px;
-		}
-		.sortable {
-			cursor: pointer;
-		}
-	</style>
-	<div class="well hueWell">
-		<p class="pull-right">
-			<a href="#" class="btn upload-link">Upload files</a>
-			<a href="#" class="btn create-directory-link">New directory</a>
-		</p>
-		<form class="form-search">
-			Filter: <input id="filterInput" class="input-xlarge search-query" placeholder="Search for file name">
-		</form>
-	</div>
-
-	<table class="table table-condensed table-striped datatables">
-		<thead>
-			<tr>
-			% if cwd_set:
-				<th>Name</th>
-			% else:
-				<th>Path</th>
-			% endif
-				<th>Size</th>
-				<th>User</th>
-				<th>Group</th>
-				<th>Permissions</th>
-				<th>Date</th>
-				<th>&nbsp;</th>
-			</tr>
-		</thead>
-		<tbody>
-			% for file in files:
-			<%
-	          cls = ''
-	          if (file_filter == 'dir' and file['type'] != 'dir') or (file_filter != 'dir' and file['type'] == 'dir'):
-	            if (file_filter != 'any'):
-	              cls = ' not-selectable'
-
-	          if cwd_set:
-	            display_name = file['name']
-	          else:
-	            display_name = file['path']
-	          endif
-	        %>
-
-			<% path = file['path'] %>
-			<tr class="file-row" data-search="${display_name}">
-				<td>
-					<h5><a href="${url('filebrowser.views.'+view, path=urlencode(path))}?file_filter=${file_filter}" data-row-selector="true">${display_name}</a></h5>
-				</td>
-				<td>
-					% if "dir" == file['type']:
-					<span>~</span>
-					% else:
-					<span>${file['stats']['size']|filesizeformat}</span>
-					% endif
-				</td>
-				<td>${file['stats']['user']}</td>
-				<td>${file['stats']['group']}</td>
-				<td>${file['rwx']}</td>
-				<td>${date(datetime.datetime.fromtimestamp(file['stats']['mtime']))} ${time(datetime.datetime.fromtimestamp(file['stats']['mtime'])).replace("p.m.","PM").replace("a.m.","AM")}</td>
-				<td>
-					% if ".." != file['name']:
-					<%
-					path_digest = urlencode(md5.md5(smart_str(path)).hexdigest())
-					%>
-					<div class="btn-group">
-				    	<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
-							Options
-				    		<span class="caret"></span>
-				    	</a>
-				    	<ul class="dropdown-menu">
-				    		% if "dir" == file['type']:
-							<li><a class="delete" delete-type="rmdir" file-to-delete="${path}" data-backdrop="static" data-keyboard="true">Delete</a></li>
-							<li><a class="delete" delete-type="rmtree" file-to-delete="${path}" data-backdrop="static" data-keyboard="true">Delete Recursively</a></li>
-							% else:
-							<li><a class="delete" delete-type="remove" file-to-delete="${path}" data-backdrop="static" data-keyboard="true">Delete</a></li>
-							<li><a href="${url('filebrowser.views.view', path=urlencode(path))}">View File</a></li>
-							<li><a href="${url('filebrowser.views.edit', path=urlencode(path))}">Edit File</a></li>
-							<li><a href="${url('filebrowser.views.download', path=urlencode(path))}" target="_blank">Download File</a></li>
-							% endif
-							<li><a class="rename" file-to-rename="${path}">Rename</a></li>
-							<li><a onclick="openChownWindow('${path}','${file['stats']['user']}','${file['stats']['group']}','${current_request_path}')">Change Owner / Group</a></li>
-							<li><a onclick="openChmodWindow('${path}','${stringformat(file['stats']['mode'], "o")}','${current_request_path}')">Change Permissions</a></li>
-							<li><a onclick="openMoveModal('${path}','${stringformat(file['stats']['mode'], "o")}', '${current_request_path}')">Move</a></li>
-				    	</ul>
-				    </div>
-					% endif
-				</td>
-			</tr>
-			% endfor
-		</tbody>
-	</table>
+    <script src="/static/ext/js/fileuploader.js" type="text/javascript" charset="utf-8"></script>
+    <script src="/static/ext/js/datatables-paging-0.1.js" type="text/javascript" charset="utf-8"></script>
+    <link rel="stylesheet" href="/static/ext/css/fileuploader.css" type="text/css" media="screen" title="no title" charset="utf-8" />
+    <style type="text/css">
+        .pull-right {
+            margin: 4px;
+        }
+        .sortable {
+            cursor: pointer;
+        }
+    </style>
+    <div class="well hueWell">
+        <p class="pull-right">
+            <a href="#" class="btn upload-link">Upload files</a>
+            <a href="#" class="btn create-directory-link">New directory</a>
+        </p>
+        <form class="form-search">
+            Filter: <input id="filterInput" class="input-xlarge search-query" placeholder="Search for file name">
+        </form>
+    </div>
+
+    <table class="table table-condensed table-striped datatables">
+        <thead>
+            <tr>
+            % if cwd_set:
+                <th>Name</th>
+            % else:
+                <th>Path</th>
+            % endif
+                <th>Size</th>
+                <th>User</th>
+                <th>Group</th>
+                <th>Permissions</th>
+                <th>Date</th>
+                <th>&nbsp;</th>
+            </tr>
+        </thead>
+        <tbody>
+            % for file in files:
+            <%
+              cls = ''
+              if (file_filter == 'dir' and file['type'] != 'dir') or (file_filter != 'dir' and file['type'] == 'dir'):
+                if (file_filter != 'any'):
+                  cls = ' not-selectable'
+
+              if cwd_set:
+                display_name = file['name']
+              else:
+                display_name = file['path']
+              endif
+            %>
+
+            <% path = file['path'] %>
+            <tr class="file-row" data-search="${display_name}">
+                <td>
+                    <h5><a href="${url('filebrowser.views.'+view, path=urlencode(path))}?file_filter=${file_filter}" data-row-selector="true">${display_name}</a></h5>
+                </td>
+                <td>
+                    % if "dir" == file['type']:
+                    <span>~</span>
+                    % else:
+                    <span>${file['stats']['size']|filesizeformat}</span>
+                    % endif
+                </td>
+                <td>${file['stats']['user']}</td>
+                <td>${file['stats']['group']}</td>
+                <td>${file['rwx']}</td>
+                <td>${date(datetime.datetime.fromtimestamp(file['stats']['mtime']))} ${time(datetime.datetime.fromtimestamp(file['stats']['mtime'])).replace("p.m.","PM").replace("a.m.","AM")}</td>
+                <td>
+                    % if ".." != file['name']:
+                    <%
+                    path_digest = urlencode(md5.md5(smart_str(path)).hexdigest())
+                    %>
+                    <div class="btn-group">
+                        <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
+                            Options
+                            <span class="caret"></span>
+                        </a>
+                        <ul class="dropdown-menu">
+                            % if "dir" == file['type']:
+                            <li><a class="delete" delete-type="rmdir" file-to-delete="${path}" data-backdrop="static" data-keyboard="true">Delete</a></li>
+                            <li><a class="delete" delete-type="rmtree" file-to-delete="${path}" data-backdrop="static" data-keyboard="true">Delete Recursively</a></li>
+                            % else:
+                            <li><a class="delete" delete-type="remove" file-to-delete="${path}" data-backdrop="static" data-keyboard="true">Delete</a></li>
+                            <li><a href="${url('filebrowser.views.view', path=urlencode(path))}">View File</a></li>
+                            <li><a href="${url('filebrowser.views.edit', path=urlencode(path))}">Edit File</a></li>
+                            <li><a href="${url('filebrowser.views.download', path=urlencode(path))}" target="_blank">Download File</a></li>
+                            % endif
+                            <li><a class="rename" file-to-rename="${path}">Rename</a></li>
+                            <li><a onclick="openChownWindow('${path}','${file['stats']['user']}','${file['stats']['group']}','${current_request_path}')">Change Owner / Group</a></li>
+                            <li><a onclick="openChmodWindow('${path}','${stringformat(file['stats']['mode'], "o")}','${current_request_path}')">Change Permissions</a></li>
+                            <li><a onclick="openMoveModal('${path}','${stringformat(file['stats']['mode'], "o")}', '${current_request_path}')">Move</a></li>
+                        </ul>
+                    </div>
+                    % endif
+                </td>
+            </tr>
+            % endfor
+        </tbody>
+    </table>
 
 <!-- delete modal -->
 <div id="deleteModal" class="modal hide fade">
-	<div class="modal-header">
-		<a href="#" class="close" data-dismiss="modal">&times;</a>
-		<h3>Please Confirm</h3>
+    <div class="modal-header">
+        <a href="#" class="close" data-dismiss="modal">&times;</a>
+        <h3>Please Confirm</h3>
     </div>
     <div class="modal-body">
         <p>Are you sure you want to delete this file?</p>
     </div>
     <div class="modal-footer">
         <form id="deleteForm" action="" method="POST" enctype="multipart/form-data" class="form-stacked">
-			<input type="submit" value="Yes" class="btn primary" />
-			<a id="cancelDeleteBtn" class="btn">No</a>
-        	<input id="fileToDeleteInput" type="hidden" name="path" />
+            <input type="submit" value="Yes" class="btn primary" />
+            <a id="cancelDeleteBtn" class="btn">No</a>
+            <input id="fileToDeleteInput" type="hidden" name="path" />
         </form>
     </div>
 </div>
@@ -156,11 +156,11 @@ from django.utils.encoding import smart_str
         <h3>Renaming: <span id="renameFileName">file name</span></h3>
     </div>
     <div class="modal-body">
-		<label>New name <input id="newNameInput" name="dest_path" value="" type="text" class="input-xlarge"/></label>
+        <label>New name <input id="newNameInput" name="dest_path" value="" type="text" class="input-xlarge"/></label>
     </div>
     <div class="modal-footer">
         <div id="renameNameRequiredAlert" class="hide" style="position: absolute; left: 10;">
-			<span class="label label-important">Sorry, name is required.</span>
+            <span class="label label-important">Sorry, name is required.</span>
         </div>
 
         <input id="renameSrcPath" type="hidden" name="src_path" type="text">
@@ -179,14 +179,12 @@ from django.utils.encoding import smart_str
     </div>
     <div class="modal-body">
         <form action="/filebrowser/upload?next=${current_dir_path}" method="POST" enctype="multipart/form-data" class="form-stacked">
-			<div id="fileUploader">
-		<noscript>
-			<p>Please enable JavaScript to use file uploader.</p>
-			<!-- or put a simple form for upload here -->
-		</noscript>
-	</div>
+            <div id="fileUploader">
+            <noscript>
+                <p>Please enable JavaScript to use file uploader.</p>
+            </noscript>
+            </div>
         </form>
-
     </div>
     <div class="modal-footer"></div>
     </form>
@@ -200,8 +198,8 @@ from django.utils.encoding import smart_str
         <h3>Create Directory</h3>
     </div>
     <div class="modal-body">
-		<label>Directory Name <input id="newDirectoryNameInput" name="name" value="" type="text" class="input-xlarge"/></label>
-		<input type="hidden" name="path" type="text" value="${current_dir_path}"/>
+        <label>Directory Name <input id="newDirectoryNameInput" name="name" value="" type="text" class="input-xlarge"/></label>
+        <input type="hidden" name="path" type="text" value="${current_dir_path}"/>
     </div>
     <div class="modal-footer">
          <div id="directoryNameRequiredAlert" class="alert-message error hide" style="position: absolute; left: 10;">
@@ -236,10 +234,10 @@ from django.utils.encoding import smart_str
             success: function(data){
                 $("#changeOwnerModal").html(data);
                 $("#changeOwnerModal").modal({
-					backdrop: "static",
-					keyboard: true,
-					show: true
-				});
+                    backdrop: "static",
+                    keyboard: true,
+                    show: true
+                });
             }
         });
     }
@@ -255,10 +253,10 @@ from django.utils.encoding import smart_str
             success: function(data){
                 $("#changePermissionModal").html(data);
                 $("#changePermissionModal").modal({
-					backdrop: "static",
-					keyboard: true,
-					show: true
-				});
+                    backdrop: "static",
+                    keyboard: true,
+                    show: true
+                });
             }
         });
     }
@@ -274,10 +272,10 @@ from django.utils.encoding import smart_str
             success: function(data){
                 $("#moveModal").html(data);
                 $("#moveModal").modal({
-					backdrop: "static",
-					keyboard: true,
-					show: true
-				});
+                    backdrop: "static",
+                    keyboard: true,
+                    show: true
+                });
             }
         });
     }
@@ -308,22 +306,22 @@ from django.utils.encoding import smart_str
     // don"t wait for the window to load
     window.onload = createUploader;
 
-	$(document).ready(function(){
+    $(document).ready(function(){
         //filter handlers
         var oTable = $('.datatables').dataTable( {
           "sPaginationType": "bootstrap",
           "bLengthChange": false,
           "iDisplayLength": 15,
           "sDom": "<'row'r>t<'row'<'span8'i><''p>>",
-		  "aoColumns": [
-				null,
-				null,
-				null,
-				null,
-				null,
-				{ "sType": "date" },
-				null
-			]
+          "aoColumns": [
+                null,
+                null,
+                null,
+                null,
+                null,
+                { "sType": "date" },
+                null
+            ]
         });
 
         $("#filterInput").keyup(function() {
@@ -427,6 +425,7 @@ from django.utils.encoding import smart_str
         $(".pathChooser").click(function(){
             var self = this;
             $("#fileChooserRename").jHueFileChooser({
+                initialPath: $(self).val(),
                 onFileChoose: function(filePath) {
                     $(self).val(filePath);
                 },

+ 22 - 21
apps/filebrowser/src/filebrowser/templates/move.mako

@@ -25,33 +25,34 @@
         ${edit.render_field(form["src_path"], hidden=True)}
         ${edit.render_field(form["dest_path"], notitle=True, klass="input-xlarge pathChooser")}
         </div>
-		<br/>
-		<div id="fileChooserModal" class="smallModal well hide">
-			<a href="#" class="close" data-dismiss="modal">&times;</a>
-		</div>
+        <br/>
+        <div id="fileChooserModal" class="smallModal well hide">
+            <a href="#" class="close" data-dismiss="modal">&times;</a>
+        </div>
     </div>
     <div class="modal-footer">
-		<div id="moveNameRequiredAlert" class="hide" style="position: absolute; left: 10;">
-			<span class="label label-important">Sorry, name is required.</span>
-    	</div>
+        <div id="moveNameRequiredAlert" class="hide" style="position: absolute; left: 10;">
+            <span class="label label-important">Sorry, name is required.</span>
+        </div>
         <input class="btn primary" type="submit" value="Submit"/>
         <a class="btn" onclick="$('#moveModal').modal('hide');">Cancel</a>
     </div>
 </form>
 
 <script type="text/javascript" charset="utf-8">
-	$(".pathChooser").click(function(){
-		var self = this;
-		$("#fileChooserModal").jHueFileChooser({
-			onFileChoose: function(filePath) {
-				$(self).val(filePath);
-			},
-			onFolderChange: function(folderPath){
-				$(self).val(folderPath);
-			},
-			createFolder: false,
-			uploadFile: false
-		});
-		$("#fileChooserModal").slideDown();
-	});
+    $(".pathChooser").click(function(){
+        var self = this;
+        $("#fileChooserModal").jHueFileChooser({
+            initialPath: $(self).val(),
+            onFileChoose: function(filePath) {
+                $(self).val(filePath);
+            },
+            onFolderChange: function(folderPath){
+                $(self).val(folderPath);
+            },
+            createFolder: false,
+            uploadFile: false
+        });
+        $("#fileChooserModal").slideDown();
+    });
 </script>

+ 2 - 2
apps/filebrowser/src/filebrowser/views.py

@@ -353,8 +353,8 @@ def chooser(request, path):
     """
     # default_to_home is set in bootstrap.js
     home_dir_path = request.user.get_home_directory()
-    if request.GET.get('default_to_home') and request.fs.isdir(home_dir_path):
-        return format_preserving_redirect(request, urlresolvers.reverse(view, kwargs=dict(path=home_dir_path)))
+    if 'default_to_home' in request.GET and request.fs.isdir(home_dir_path):
+        return listdir(request, home_dir_path, True)
 
     if request.fs.isdir(path):
         return listdir(request, path, True)

+ 38 - 40
apps/jobsub/src/jobsub/templates/edit_design.mako

@@ -179,33 +179,30 @@ ${layout.menubar(section='designs')}
 
 
 <style>
-	.pathChooser, .pathChooserKo {
-		border-radius: 3px 0 0 3px;
-		border-right:0;
-	}
-	.fileChooserBtn {
-		border-radius: 0 3px 3px 0;
-	}
-
+    .pathChooser, .pathChooserKo {
+        border-radius: 3px 0 0 3px;
+        border-right:0;
+    }
+    .fileChooserBtn {
+        border-radius: 0 3px 3px 0;
+    }
     #fileChooserModal {
         padding:14px;
         height:270px;
     }
-
-    #fileChooserModal > ul {
+    #fileChooserModal > ul.unstyled {
         height:230px;
         overflow-y:auto;
     }
-
-	.designTable {
-		margin-left:0;
-	}
-	.designTable th, .designTable td {
-	    padding-left: 0;
-	}
-	.designTable th {
-		text-align:left;
-	}
+    .designTable {
+        margin-left:0;
+    }
+    .designTable th, .designTable td {
+        padding-left: 0;
+    }
+    .designTable th {
+        text-align:left;
+    }
 </style>
 
 
@@ -306,31 +303,32 @@ ${layout.menubar(section='designs')}
 
         ko.bindingHandlers.fileChooser = {
             init: function(element, valueAccessor, allBindings, model) {
-				var self = $(element);
-				self.after(getFileBrowseButton(self));
+                var self = $(element);
+                self.after(getFileBrowseButton(self));
             }
         };
 
         ko.applyBindings(viewModel);
 
-		$(".pathChooser").each(function(){
-			var self = $(this);
-			self.after(getFileBrowseButton(self));
-		});
-
-		function getFileBrowseButton(inputElement) {
-			return $("<button>").addClass("btn").addClass("fileChooserBtn").text("..").click(function(e){
-				e.preventDefault();
-				$("#fileChooserModal").jHueFileChooser({
-	                onFileChoose: function(filePath) {
-	                    inputElement.val(filePath);
-	                    $("#chooseFile").modal("hide");
-	                },
-	                createFolder: false
-	            });
-	            $("#chooseFile").modal("show");
-			})
-		}
+        $(".pathChooser").each(function(){
+            var self = $(this);
+            self.after(getFileBrowseButton(self));
+        });
+
+        function getFileBrowseButton(inputElement) {
+            return $("<button>").addClass("btn").addClass("fileChooserBtn").text("..").click(function(e){
+                e.preventDefault();
+                $("#fileChooserModal").jHueFileChooser({
+                    initialPath: inputElement.val(),
+                    onFileChoose: function(filePath) {
+                        inputElement.val(filePath);
+                        $("#chooseFile").modal("hide");
+                    },
+                    createFolder: false
+                });
+                $("#chooseFile").modal("show");
+            })
+        }
 
 
         $(".propKey").each(addAutoComplete);

+ 270 - 267
desktop/core/static/css/hue2.css

@@ -1,7 +1,7 @@
 .navbar .brand {
     color: #FFFFFF;
 }
-    
+
 .subnav {
     background-color: #EEEEEE;
     background-image: -moz-linear-gradient(center top , #F5F5F5 0%, #EEEEEE 100%);
@@ -76,47 +76,47 @@
 }
 
 .navbar-inner {
-  padding-left: 20px;
-  padding-right: 20px;
-  background-color: #2c2c2c;
-  background-image: -moz-linear-gradient(top, #2c7fb3, #01639c);
-  background-image: -ms-linear-gradient(top, #2c7fb3, #01639c);
-  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#2c7fb3), to(#01639c));
-  background-image: -webkit-linear-gradient(top, #2c7fb3, #01639c);
-  background-image: -o-linear-gradient(top, #2c7fb3, #01639c);
-  background-image: linear-gradient(top, #2c7fb3, #01639c);
-  background-repeat: repeat-x;
-  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#'2c7fb3, endColorstr='#'01639c, GradientType=0);
-  -webkit-border-radius: 4px;
-  -moz-border-radius: 4px;
-  border-radius: 4px;
-  -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
-  -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
-  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
+    padding-left: 20px;
+    padding-right: 20px;
+    background-color: #2c2c2c;
+    background-image: -moz-linear-gradient(top, #2c7fb3, #01639c);
+    background-image: -ms-linear-gradient(top, #2c7fb3, #01639c);
+    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#2c7fb3), to(#01639c));
+    background-image: -webkit-linear-gradient(top, #2c7fb3, #01639c);
+    background-image: -o-linear-gradient(top, #2c7fb3, #01639c);
+    background-image: linear-gradient(top, #2c7fb3, #01639c);
+    background-repeat: repeat-x;
+    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#'2c7fb3, endColorstr='#'01639c, GradientType=0);
+    -webkit-border-radius: 4px;
+    -moz-border-radius: 4px;
+    border-radius: 4px;
+    -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
+    -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
+    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
 }
 
 .navbar .divider-vertical {
-  height: 40px;
-  width: 1px;
-  margin: 0 9px;
-  overflow: hidden;
-  background-color: #01639c;
-  border-right: 1px solid #2c7fb3;
+    height: 40px;
+    width: 1px;
+    margin: 0 9px;
+    overflow: hidden;
+    background-color: #01639c;
+    border-right: 1px solid #2c7fb3;
 }
 
 .navbar .nav > li > a {
-  float: none;
-  padding: 5px 10px 7px;
-  line-height: 28px;
-  font-size: 13px;
-  color: #e5e5e5;
-  text-decoration: none;
-  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
+    float: none;
+    padding: 5px 10px 7px;
+    line-height: 28px;
+    font-size: 13px;
+    color: #e5e5e5;
+    text-decoration: none;
+    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
 }
 .navbar .nav > li > a:hover {
-  background-color: transparent;
-  color: #ffffff !important;
-  text-decoration: none;
+    background-color: transparent;
+    color: #ffffff !important;
+    text-decoration: none;
 }
 .navbar .nav .active > a, .navbar .nav .active > a:hover {
     background-color: rgba(0, 0, 0, 0.5);
@@ -159,19 +159,19 @@ h1 {
 }
 
 .btn.primary, .btn-primary {
-  background-color: #006dcc;
-  color: #ffffff;
-  background-image: -moz-linear-gradient(top, #2c7fb3, #01639c);
-  background-image: -ms-linear-gradient(top, #2c7fb3, #01639c);
-  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#2c7fb3), to(#01639c));
-  background-image: -webkit-linear-gradient(top, #2c7fb3, #01639c);
-  background-image: -o-linear-gradient(top, #2c7fb3, #01639c);
-  background-image: linear-gradient(top, #2c7fb3, #01639c);
-  background-repeat: repeat-x;
-  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#'2c7fb3, endColorstr='#'01639c, GradientType=0);
-  border-color: #0044cc #0044cc #002a80;
-  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
-  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
+    background-color: #006dcc;
+    color: #ffffff;
+    background-image: -moz-linear-gradient(top, #2c7fb3, #01639c);
+    background-image: -ms-linear-gradient(top, #2c7fb3, #01639c);
+    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#2c7fb3), to(#01639c));
+    background-image: -webkit-linear-gradient(top, #2c7fb3, #01639c);
+    background-image: -o-linear-gradient(top, #2c7fb3, #01639c);
+    background-image: linear-gradient(top, #2c7fb3, #01639c);
+    background-repeat: repeat-x;
+    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#'2c7fb3, endColorstr='#'01639c, GradientType=0);
+    border-color: #0044cc #0044cc #002a80;
+    border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
+    filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
 }
 .btn.primary:hover,
 .btn-primary:hover,
@@ -179,85 +179,85 @@ h1 {
 .btn-primary.active,
 .btn-primary.disabled,
 .btn-primary[disabled] {
-  background-color: #01639c;
+    background-color: #01639c;
 }
 
 .withTitle {
-	top: 60px!important;
+    top: 60px!important;
 }
 
 .clear {
-	clear:both;
+    clear:both;
 }
 
 .sectionbar {
-	background-color: #E5E5E5;
-	background-image: linear-gradient(top, rgb(255,255,255) 0%, rgb(229,229,229) 100%);
-	background-image: -o-linear-gradient(top, rgb(255,255,255) 0%, rgb(229,229,229) 100%);
-	background-image: -moz-linear-gradient(top, rgb(255,255,255) 0%, rgb(229,229,229) 100%);
-	background-image: -webkit-linear-gradient(top, rgb(255,255,255) 0%, rgb(229,229,229) 100%);
-	background-image: -ms-linear-gradient(top, rgb(255,255,255) 0%, rgb(229,229,229) 100%);
-
-	background-image: -webkit-gradient(
-		linear,
-		left top,
-		left bottom,
-		color-stop(0, rgb(255,255,255)),
-		color-stop(1, rgb(229,229,229))
-	);
-	height:40px;
-	border-bottom:1px solid #CBCBCB;
-	padding-top:10px;
+    background-color: #E5E5E5;
+    background-image: linear-gradient(top, rgb(255,255,255) 0%, rgb(229,229,229) 100%);
+    background-image: -o-linear-gradient(top, rgb(255,255,255) 0%, rgb(229,229,229) 100%);
+    background-image: -moz-linear-gradient(top, rgb(255,255,255) 0%, rgb(229,229,229) 100%);
+    background-image: -webkit-linear-gradient(top, rgb(255,255,255) 0%, rgb(229,229,229) 100%);
+    background-image: -ms-linear-gradient(top, rgb(255,255,255) 0%, rgb(229,229,229) 100%);
+
+    background-image: -webkit-gradient(
+        linear,
+        left top,
+        left bottom,
+        color-stop(0, rgb(255,255,255)),
+        color-stop(1, rgb(229,229,229))
+    );
+    height:40px;
+    border-bottom:1px solid #CBCBCB;
+    padding-top:10px;
 }
 .sectionbar h2 {
-	font-size: 20px;
-	font-weight: 400;
-	padding-left:20px;
-	float:left;
+    font-size: 20px;
+    font-weight: 400;
+    padding-left:20px;
+    float:left;
 }
 .sectionbar h2.selected {
-	color:#01639C;
+    color:#01639C;
 }
 .sectionbar h2.subsection, .sectionbar h2.subsubsection {
-	padding-left:6px;
+    padding-left:6px;
 }
 
 .sectionbar h3 {
-	float:left;
-	padding-left:6px;
-	color:#CCC;
-	font-size:12px;
+    float:left;
+    padding-left:6px;
+    color:#CCC;
+    font-size:12px;
 }
 
 
 .sectionbar a {
-	float:right;
-	margin-right:14px;
-	color:#1F92D8;
-	padding-top:7px;
-	text-shadow: 0 -1px 0 #E5E5E5;
+    float:right;
+    margin-right:14px;
+    color:#1F92D8;
+    padding-top:7px;
+    text-shadow: 0 -1px 0 #E5E5E5;
 }
 
 .toolbar {
-	float:right;
+    float:right;
 }
 
 .toolbar ul {
-	list-style: none outside none;
-	display: inline;
+    list-style: none outside none;
+    display: inline;
 }
 
 .toolbar li {
-	display: inline;
+    display: inline;
 }
 
 .wordbreak {
-	max-width:500px;
-	word-wrap:break-word;
+    max-width:500px;
+    word-wrap:break-word;
 }
 
 .menubar {
-	height: 30px;
+    height: 30px;
     left: 0;
     overflow: visible;
     position: fixed;
@@ -269,61 +269,61 @@ h1 {
 .menubar-inner, .menubar .fill {
     background-color: #d0e1f4;
     background-image: -moz-linear-gradient(center top , #d0e1f4, #d0e1f4);
-	background-image: -webkit-linear-gradient(top, #d0e1f4, #d0e1f4);
+    background-image: -webkit-linear-gradient(top, #d0e1f4, #d0e1f4);
     background-repeat: repeat-x;
 }
 
 .menubar-inner a {
-	color:#333;
-	font-weight:bold;
+    color:#333;
+    font-weight:bold;
 }
 
 .menubar-inner a:hover {
-	color:#01639C;
+    color:#01639C;
 }
 
 
 .menubar-inner a.selected {
-	color:#FFFFFF;
-	padding:2px;
-	padding-left:10px;
-	padding-right:10px;
-	margin-top:8px;
-	background-color: #01639C;
+    color:#FFFFFF;
+    padding:2px;
+    padding-left:10px;
+    padding-right:10px;
+    margin-top:8px;
+    background-color: #01639C;
     background-image: -moz-linear-gradient(center top , #01639C, #015382);
     background-repeat: repeat-x;
-	box-shadow: 0 0 3px #015382 inset;
-	-moz-box-shadow: 0 0 3px #015382 inset;
-	-webkit-box-shadow: 0 0 3px #015382 inset;
-	border-radius: 30px;
+    box-shadow: 0 0 3px #015382 inset;
+    -moz-box-shadow: 0 0 3px #015382 inset;
+    -webkit-box-shadow: 0 0 3px #015382 inset;
+    border-radius: 30px;
 }
 
 .menubar-inner a.disabled {
-	cursor: default;
+    cursor: default;
     opacity: 0.65;
 }
 
 .menubar-inner a.disabled:hover {
-	color:#333;
+    color:#333;
 }
 
 
 code {
-	line-height:1.4em;
+    line-height:1.4em;
 }
 
 .noPadding {
-	padding:0;
+    padding:0;
 }
 
 .folder {
-	background: url(../images/folder.png) no-repeat left center;
-	padding-left:20px;
+    background: url(../images/folder.png) no-repeat left center;
+    padding-left:20px;
 }
 
 .file {
-	background: url(../images/file.png) no-repeat left center;
-	padding-left:20px;
+    background: url(../images/file.png) no-repeat left center;
+    padding-left:20px;
 }
 
 .contextMenu {
@@ -331,24 +331,24 @@ code {
 }
 
 .contextItem {
-	cursor:pointer;
+    cursor:pointer;
 }
 
 .fieldError {
-	border-color: #EE5F5B;
-	color: #B94A48;
+    border-color: #EE5F5B;
+    color: #B94A48;
 }
 
 ul.errorlist {
-	list-style: none outside none;
-	margin: 0;
+    list-style: none outside none;
+    margin: 0;
 }
 
 ul.errorlist li {
-	color: #B94A48;
-	padding:2px;
-	font-weight:bold;
-	font-style:italic;
+    color: #B94A48;
+    padding:2px;
+    font-weight:bold;
+    font-style:italic;
 }
 
 .hueBreadcrumb {
@@ -367,6 +367,9 @@ ul.errorlist li {
 .hueBreadcrumb .active a {
     color: #333333;
 }
+.hueBreadcrumb a.nounderline:hover {
+    text-decoration:none;
+}
 
 .hueBreadcrumb > li:last-child > a {
     font-weight:bold;
@@ -390,20 +393,20 @@ div.dataTables_length label {
     float: left;
     text-align: left;
 }
- 
+
 div.dataTables_length select {
     width: 75px;
 }
- 
+
 div.dataTables_filter label {
     float: right;
     width: 460px;
 }
- 
+
 div.dataTables_info {
     padding-top: 8px;
 }
- 
+
 div.dataTables_paginate {
     float: right;
     margin: 0;
@@ -412,29 +415,29 @@ div.dataTables_paginate {
 /*
  *********************************************************/
 
- 
+
 /* Pagination nested */
 .paginate_disabled_previous, .paginate_enabled_previous, .paginate_disabled_next, .paginate_enabled_next {
-	height: 19px;
-	width: 19px;
-	margin-left: 3px;
-	float: left;
+    height: 19px;
+    width: 19px;
+    margin-left: 3px;
+    float: left;
 }
 
 .paginate_disabled_previous {
-	background-image: url('../art/datatables/back_disabled.jpg');
+    background-image: url('../art/datatables/back_disabled.jpg');
 }
 
 .paginate_enabled_previous {
-	background-image: url('../art/datatables/back_enabled.jpg');
+    background-image: url('../art/datatables/back_enabled.jpg');
 }
 
 .paginate_disabled_next {
-	background-image: url('../art/datatables/forward_disabled.jpg');
+    background-image: url('../art/datatables/forward_disabled.jpg');
 }
 
 .paginate_enabled_next {
-	background-image: url('../art/datatables/forward_enabled.jpg');
+    background-image: url('../art/datatables/forward_enabled.jpg');
 }
 
 
@@ -443,48 +446,48 @@ div.dataTables_paginate {
  * DataTables display
  */
 table.display {
-	margin: 0 auto;
-	clear: both;
-	width: 100%;
-
-	/* Note Firefox 3.5 and before have a bug with border-collapse
-	 * ( https://bugzilla.mozilla.org/show%5Fbug.cgi?id=155955 )
-	 * border-spacing: 0; is one possible option. Conditional-css.com is
-	 * useful for this kind of thing
-	 *
-	 * Further note IE 6/7 has problems when calculating widths with border width.
-	 * It subtracts one px relative to the other browsers from the first column, and
-	 * adds one to the end...
-	 *
-	 * If you want that effect I'd suggest setting a border-top/left on th/td's and
-	 * then filling in the gaps with other borders.
-	 */
+    margin: 0 auto;
+    clear: both;
+    width: 100%;
+
+    /* Note Firefox 3.5 and before have a bug with border-collapse
+      * ( https://bugzilla.mozilla.org/show%5Fbug.cgi?id=155955 )
+      * border-spacing: 0; is one possible option. Conditional-css.com is
+      * useful for this kind of thing
+      *
+      * Further note IE 6/7 has problems when calculating widths with border width.
+      * It subtracts one px relative to the other browsers from the first column, and
+      * adds one to the end...
+      *
+      * If you want that effect I'd suggest setting a border-top/left on th/td's and
+      * then filling in the gaps with other borders.
+      */
 }
 
 table.display thead th {
-	padding: 3px 18px 3px 10px;
-	border-bottom: 1px solid black;
-	font-weight: bold;
-	cursor: pointer;
-	* cursor: hand;
+    padding: 3px 18px 3px 10px;
+    border-bottom: 1px solid black;
+    font-weight: bold;
+    cursor: pointer;
+    * cursor: hand;
 }
 
 table.display tfoot th {
-	padding: 3px 18px 3px 10px;
-	border-top: 1px solid black;
-	font-weight: bold;
+    padding: 3px 18px 3px 10px;
+    border-top: 1px solid black;
+    font-weight: bold;
 }
 
 table.display tr.heading2 td {
-	border-bottom: 1px solid #aaa;
+    border-bottom: 1px solid #aaa;
 }
 
 table.display td {
-	padding: 3px 10px;
+    padding: 3px 10px;
 }
 
 table.display td.center {
-	text-align: center;
+    text-align: center;
 }
 
 
@@ -494,23 +497,23 @@ table.display td.center {
  */
 
 .sorting_asc {
-	background: url('../art/datatables/sort_asc.png') no-repeat center right;
+    background: url('../art/datatables/sort_asc.png') no-repeat center right;
 }
 
 .sorting_desc {
-	background: url('../art/datatables/sort_desc.png') no-repeat center right;
+    background: url('../art/datatables/sort_desc.png') no-repeat center right;
 }
 
 .sorting {
-	background: url('../art/datatables/sort_both.png') no-repeat center right;
+    background: url('../art/datatables/sort_both.png') no-repeat center right;
 }
 
 .sorting_asc_disabled {
-	background: url('../art/datatables/sort_asc_disabled.png') no-repeat center right;
+    background: url('../art/datatables/sort_asc_disabled.png') no-repeat center right;
 }
 
 .sorting_desc_disabled {
-	background: url('../art/datatables/sort_desc_disabled.png') no-repeat center right;
+    background: url('../art/datatables/sort_desc_disabled.png') no-repeat center right;
 }
 
 
@@ -519,86 +522,86 @@ table.display td.center {
  * Misc
  */
 .dataTables_scroll {
-	clear: both;
+    clear: both;
 }
 
 .dataTables_scrollBody {
-	*margin-top: -1px;
+    *margin-top: -1px;
 }
 
 .top .dataTables_info {
-	float: none;
+    float: none;
 }
 
 .clear {
-	clear: both;
+    clear: both;
 }
 
 .dataTables_empty {
-	text-align: center;
+    text-align: center;
 }
 
 tfoot input {
-	margin: 0.5em 0;
-	width: 100%;
-	color: #444;
+    margin: 0.5em 0;
+    width: 100%;
+    color: #444;
 }
 
 tfoot input.search_init {
-	color: #999;
+    color: #999;
 }
 
 td.group {
-	background-color: #d1cfd0;
-	border-bottom: 2px solid #A19B9E;
-	border-top: 2px solid #A19B9E;
+    background-color: #d1cfd0;
+    border-bottom: 2px solid #A19B9E;
+    border-top: 2px solid #A19B9E;
 }
 
 td.details {
-	background-color: #d1cfd0;
-	border: 2px solid #A19B9E;
+    background-color: #d1cfd0;
+    border: 2px solid #A19B9E;
 }
 
 
 .example_alt_pagination div.dataTables_info {
-	width: 40%;
+    width: 40%;
 }
 
 .paging_full_numbers {
-	width: 400px;
-	height: 22px;
-	line-height: 22px;
+    width: 400px;
+    height: 22px;
+    line-height: 22px;
 }
 
 .paging_full_numbers span.paginate_button,
- 	.paging_full_numbers span.paginate_active {
-	border: 1px solid #aaa;
-	-webkit-border-radius: 5px;
-	-moz-border-radius: 5px;
-	padding: 2px 5px;
-	margin: 0 3px;
-	cursor: pointer;
-	*cursor: hand;
+.paging_full_numbers span.paginate_active {
+    border: 1px solid #aaa;
+    -webkit-border-radius: 5px;
+    -moz-border-radius: 5px;
+    padding: 2px 5px;
+    margin: 0 3px;
+    cursor: pointer;
+    *cursor: hand;
 }
 
 .paging_full_numbers span.paginate_button {
-	background-color: #ddd;
+    background-color: #ddd;
 }
 
 .paging_full_numbers span.paginate_button:hover {
-	background-color: #ccc;
+    background-color: #ccc;
 }
 
 .paging_full_numbers span.paginate_active {
-	background-color: #99B3FF;
+    background-color: #99B3FF;
 }
 
 table.display tr.even.row_selected td {
-	background-color: #B0BED9;
+    background-color: #B0BED9;
 }
 
 table.display tr.odd.row_selected td {
-	background-color: #9FAFD1;
+    background-color: #9FAFD1;
 }
 
 
@@ -642,99 +645,99 @@ tr.even td.sorting_3 {
 	  ee > e2
  */
 tr.odd.gradeA td.sorting_1 {
-	background-color: #c4ffc4;
+    background-color: #c4ffc4;
 }
 
 tr.odd.gradeA td.sorting_2 {
-	background-color: #d1ffd1;
+    background-color: #d1ffd1;
 }
 
 tr.odd.gradeA td.sorting_3 {
-	background-color: #d1ffd1;
+    background-color: #d1ffd1;
 }
 
 tr.even.gradeA td.sorting_1 {
-	background-color: #d5ffd5;
+    background-color: #d5ffd5;
 }
 
 tr.even.gradeA td.sorting_2 {
-	background-color: #e2ffe2;
+    background-color: #e2ffe2;
 }
 
 tr.even.gradeA td.sorting_3 {
-	background-color: #e2ffe2;
+    background-color: #e2ffe2;
 }
 
 tr.odd.gradeC td.sorting_1 {
-	background-color: #c4c4ff;
+    background-color: #c4c4ff;
 }
 
 tr.odd.gradeC td.sorting_2 {
-	background-color: #d1d1ff;
+    background-color: #d1d1ff;
 }
 
 tr.odd.gradeC td.sorting_3 {
-	background-color: #d1d1ff;
+    background-color: #d1d1ff;
 }
 
 tr.even.gradeC td.sorting_1 {
-	background-color: #d5d5ff;
+    background-color: #d5d5ff;
 }
 
 tr.even.gradeC td.sorting_2 {
-	background-color: #e2e2ff;
+    background-color: #e2e2ff;
 }
 
 tr.even.gradeC td.sorting_3 {
-	background-color: #e2e2ff;
+    background-color: #e2e2ff;
 }
 
 tr.odd.gradeX td.sorting_1 {
-	background-color: #ffc4c4;
+    background-color: #ffc4c4;
 }
 
 tr.odd.gradeX td.sorting_2 {
-	background-color: #ffd1d1;
+    background-color: #ffd1d1;
 }
 
 tr.odd.gradeX td.sorting_3 {
-	background-color: #ffd1d1;
+    background-color: #ffd1d1;
 }
 
 tr.even.gradeX td.sorting_1 {
-	background-color: #ffd5d5;
+    background-color: #ffd5d5;
 }
 
 tr.even.gradeX td.sorting_2 {
-	background-color: #ffe2e2;
+    background-color: #ffe2e2;
 }
 
 tr.even.gradeX td.sorting_3 {
-	background-color: #ffe2e2;
+    background-color: #ffe2e2;
 }
 
 tr.odd.gradeU td.sorting_1 {
-	background-color: #c4c4c4;
+    background-color: #c4c4c4;
 }
 
 tr.odd.gradeU td.sorting_2 {
-	background-color: #d1d1d1;
+    background-color: #d1d1d1;
 }
 
 tr.odd.gradeU td.sorting_3 {
-	background-color: #d1d1d1;
+    background-color: #d1d1d1;
 }
 
 tr.even.gradeU td.sorting_1 {
-	background-color: #d5d5d5;
+    background-color: #d5d5d5;
 }
 
 tr.even.gradeU td.sorting_2 {
-	background-color: #e2e2e2;
+    background-color: #e2e2e2;
 }
 
 tr.even.gradeU td.sorting_3 {
-	background-color: #e2e2e2;
+    background-color: #e2e2e2;
 }
 
 
@@ -742,43 +745,43 @@ tr.even.gradeU td.sorting_3 {
  * Row highlighting example
  */
 .ex_highlight #example tbody tr.even:hover, #example tbody tr.even td.highlighted {
-	background-color: #ECFFB3;
+    background-color: #ECFFB3;
 }
 
 .ex_highlight #example tbody tr.odd:hover, #example tbody tr.odd td.highlighted {
-	background-color: #E6FF99;
+    background-color: #E6FF99;
 }
 
 .ex_highlight_row #example tr.even:hover {
-	background-color: #ECFFB3;
+    background-color: #ECFFB3;
 }
 
 .ex_highlight_row #example tr.even:hover td.sorting_1 {
-	background-color: #DDFF75;
+    background-color: #DDFF75;
 }
 
 .ex_highlight_row #example tr.even:hover td.sorting_2 {
-	background-color: #E7FF9E;
+    background-color: #E7FF9E;
 }
 
 .ex_highlight_row #example tr.even:hover td.sorting_3 {
-	background-color: #E2FF89;
+    background-color: #E2FF89;
 }
 
 .ex_highlight_row #example tr.odd:hover {
-	background-color: #E6FF99;
+    background-color: #E6FF99;
 }
 
 .ex_highlight_row #example tr.odd:hover td.sorting_1 {
-	background-color: #D6FF5C;
+    background-color: #D6FF5C;
 }
 
 .ex_highlight_row #example tr.odd:hover td.sorting_2 {
-	background-color: #E0FF84;
+    background-color: #E0FF84;
 }
 
 .ex_highlight_row #example tr.odd:hover td.sorting_3 {
-	background-color: #DBFF70;
+    background-color: #DBFF70;
 }
 
 
@@ -786,35 +789,35 @@ tr.even.gradeU td.sorting_3 {
  * KeyTable
  */
 table.KeyTable td {
-	border: 3px solid transparent;
+    border: 3px solid transparent;
 }
 
 table.KeyTable td.focus {
-	border: 3px solid #3366FF;
+    border: 3px solid #3366FF;
 }
 
 table.display tr.gradeA {
-	background-color: #eeffee;
+    background-color: #eeffee;
 }
 
 table.display tr.gradeC {
-	background-color: #ddddff;
+    background-color: #ddddff;
 }
 
 table.display tr.gradeX {
-	background-color: #ffdddd;
+    background-color: #ffdddd;
 }
 
 table.display tr.gradeU {
-	background-color: #ddd;
+    background-color: #ddd;
 }
 
 div.box {
-	height: 100px;
-	padding: 10px;
-	overflow: auto;
-	border: 1px solid #8080FF;
-	background-color: #E5E5FF;
+    height: 100px;
+    padding: 10px;
+    overflow: auto;
+    border: 1px solid #8080FF;
+    background-color: #E5E5FF;
 }
 
 /*
@@ -822,19 +825,19 @@ div.box {
  */
 
 .jHueSelector {
-	border:1px solid #CCC;
-	padding:0;
-	margin:0;
-	width:300px;
+    border:1px solid #CCC;
+    padding:0;
+    margin:0;
+    width:300px;
 }
 .jHueSelectorHeader {
-	background-color:#CCC;
-	padding:4px;
+    background-color:#CCC;
+    padding:4px;
 }
 
 .jHueSelector label {
-	float: none;
-	padding-left:4px;
+    float: none;
+    padding-left:4px;
 }
 .jHueSelector label input[type=checkbox] {
     display: inline;
@@ -843,10 +846,10 @@ div.box {
 }
 
 .jHueSelectorHeader input[type=text] {
-	position:absolute;
+    position:absolute;
     margin-left:180px;
-	width:100px;
-	height:11px;
+    width:100px;
+    height:11px;
     border: 1px solid #CCCCCC;
     border-radius: 5.5px;
     -webkit-border-radius: 5.5px;
@@ -856,31 +859,31 @@ div.box {
 }
 
 .jHueSelectorBody {
-	height:150px;
-	overflow:auto;
+    height:150px;
+    overflow:auto;
 }
 .jHueSelector ul, li {
-	margin: 0;
-	padding: 0;
-} 
+    margin: 0;
+    padding: 0;
+}
 .jHueSelector ul {
-	padding:4px;
-	list-style: none;
+    padding:4px;
+    list-style: none;
 }
 .jHueSelector li.selectorDivider {
-	background-color:#EEE;
-	padding:4px;
+    background-color:#EEE;
+    padding:4px;
 }
 
 .modal-body iframe {
-	border:0;
-	width:100%;
-	height:100%;
-	overflow:hidden;
+    border:0;
+    width:100%;
+    height:100%;
+    overflow:hidden;
 }
 
 .modal-body iframe.scroll {
-	overflow:auto;
+    overflow:auto;
 }
 
 .form-padding-fix{
@@ -891,4 +894,4 @@ div.box {
 
 .table tbody tr:hover td, .table tbody tr:hover th {
     background-color: #E8F7FB;
-}
+}

+ 131 - 95
desktop/core/static/js/Source/jHue/jquery.filechooser.js

@@ -1,61 +1,97 @@
 /*
-* jHue fileChooser plugin
-*/
-;(function ($, window, document, undefined) {
+ * jHue fileChooser plugin
+ */
+;
+(function ($, window, document, undefined) {
 
-	var pluginName = "jHueFileChooser",
-	defaults = {
-		initialPath: "",
-		createFolder: true,
-		uploadFile: true,
-		onFileChoose: function(){},
-        onFolderChange: function(){}
-	};
+    var pluginName = "jHueFileChooser",
+        defaults = {
+            initialPath:"",
+            createFolder:true,
+            uploadFile:true,
+            onFileChoose:function () {
+            },
+            onFolderChange:function () {
+            }
+        };
 
-	function Plugin(element, options) {
-		this.element = element;
-		this.options = $.extend({}, defaults, options) ;
-		this._defaults = defaults;
-		this._name = pluginName;
+    function Plugin(element, options) {
+        this.element = element;
+        this.options = $.extend({}, defaults, options);
+        this._defaults = defaults;
+        this._name = pluginName;
         this.previousPath = "";
-		this.init();
-	}
-	
-	Plugin.prototype.setOptions = function(options) {
-		this.options = $.extend({}, defaults, options) ;
-	};
+        this.init();
+    }
+
+    Plugin.prototype.setOptions = function (options) {
+        this.options = $.extend({}, defaults, options);
+    };
 
-	Plugin.prototype.navigateTo = function (path) {
-		var _parent = this;
-		currentPath = path;
-		$(_parent.element).empty();
-		$.getJSON("/filebrowser/chooser"+path, function(data){
-			var _flist = $("<ul>").addClass("unstyled");
-            if (data.title != null && data.title == "Error"){
+    Plugin.prototype.navigateTo = function (path) {
+        var _parent = this;
+        $(_parent.element).empty();
+        $.getJSON("/filebrowser/chooser" + path, function (data) {
+            var _flist = $("<ul>").addClass("unstyled");
+            if (data.title != null && data.title == "Error") {
                 var _errorMsg = $("<div>").addClass("alert").addClass("alert-error").text(data.message);
                 _errorMsg.appendTo($(_parent.element));
-                var _previousLink = $("<button>").addClass("btn").addClass("bnt-small").text("Back").click(function(){
+                var _previousLink = $("<button>").addClass("btn").addClass("bnt-small").text("Back").click(function () {
                     _parent.options.onFolderChange(_parent.previousPath);
                     _parent.navigateTo(_parent.previousPath);
                 });
-                _previousLink.appendTo($(_parent.element));                
+                _previousLink.appendTo($(_parent.element));
             }
             else {
+                if (data.type == "file") {
+                    _parent.navigateTo(data.view.dirname);
+                    return;
+                }
                 _parent.previousPath = path;
-                $(data.files).each(function(cnt, file){
+                var _breadcrumbs = $("<ul>").addClass("hueBreadcrumb").css("padding", "0");
+                var _home = $("<li>");
+                var _homelink = $("<a>").addClass("nounderline").html('<i class="icon-home"></i> Home').css("cursor", "pointer").click(function () {
+                    _parent.navigateTo("/?default_to_home");
+                });
+                _homelink.appendTo(_home);
+                $("<span>").addClass("divider").css("margin-right", "20px").appendTo(_home);
+                _home.appendTo(_breadcrumbs);
+                var _bLength = data.breadcrumbs.length;
+                $(data.breadcrumbs).each(function (cnt, crumb) {
+                    var _crumb = $("<li>");
+                    var _crumbLink = $("<a>");
+                    var _crumbLabel = (crumb.label != null && crumb.label != "") ? crumb.label : "/";
+                    _crumbLink.attr("href", "javascript:void(0)").text(_crumbLabel).appendTo(_crumb);
+                    if (cnt < _bLength - 1) {
+                        if (cnt > 0) {
+                            $("<span>").addClass("divider").text("/").appendTo(_crumb);
+                        }
+                        else {
+                            $("<span>").html("&nbsp;").appendTo(_crumb);
+                        }
+                    }
+                    _crumb.click(function () {
+                        var _url = (crumb.url != null && crumb.url != "") ? crumb.url : "/";
+                        _parent.navigateTo(_url);
+                    });
+                    _crumb.appendTo(_breadcrumbs);
+                });
+                _breadcrumbs.appendTo($(_parent.element));
+
+                $(data.files).each(function (cnt, file) {
                     var _f = $("<li>");
                     var _flink = $("<a>");
-                    _flink.attr("href","javascript:void(0)").text(file.name).appendTo(_f);
-                    if (file.type == "dir"){
+                    _flink.attr("href", "javascript:void(0)").text(file.name).appendTo(_f);
+                    if (file.type == "dir") {
                         _f.addClass("folder");
-                        _f.click(function(){
+                        _f.click(function () {
                             _parent.options.onFolderChange(file.path);
                             _parent.navigateTo(file.path);
                         });
                     }
-                    if (file.type == "file"){
+                    if (file.type == "file") {
                         _f.addClass("file");
-                        _f.click(function(){
+                        _f.click(function () {
                             _parent.options.onFileChoose(file.path);
                         });
                     }
@@ -65,45 +101,45 @@
                 var _actions = $("<div>").addClass("clearfix").attr('id', 'actionsDiv');
                 var _uploadFileBtn;
                 var _createFolderBtn;
-                if (_parent.options.uploadFile){
+                if (_parent.options.uploadFile) {
                     _uploadFileBtn = $("<div>").attr('id', 'file-uploader');
                     _uploadFileBtn.appendTo(_actions);
                     initUploader(path, _parent, _uploadFileBtn);
                 }
                 $("<span> </span>").appendTo(_actions);
-                if (_parent.options.createFolder){
+                if (_parent.options.createFolder) {
                     _createFolderBtn = $("<button>").addClass("btn").addClass("small").text("Create folder");
                     _createFolderBtn.appendTo(_actions);
-                    var _createFolderDetails = $("<div>").css("padding-top","10px");
+                    var _createFolderDetails = $("<div>").css("padding-top", "10px");
                     _createFolderDetails.hide();
-                    
-                    var _folderName = $("<input>").attr("type","text").attr("placeholder","Folder name").appendTo(_createFolderDetails);
+
+                    var _folderName = $("<input>").attr("type", "text").attr("placeholder", "Folder name").appendTo(_createFolderDetails);
                     $("<span> </span>").appendTo(_createFolderDetails);
-                    var _folderBtn = $("<input>").attr("type","button").attr("value","Create").addClass("btn primary").appendTo(_createFolderDetails);
+                    var _folderBtn = $("<input>").attr("type", "button").attr("value", "Create").addClass("btn primary").appendTo(_createFolderDetails);
                     $("<span> or </span>").appendTo(_createFolderDetails);
-                    var _folderCancel = $("<a>").attr("href","#").text("cancel").appendTo(_createFolderDetails);
-                    _folderCancel.click(function(){
-                        if (_uploadFileBtn){
+                    var _folderCancel = $("<a>").attr("href", "#").text("cancel").appendTo(_createFolderDetails);
+                    _folderCancel.click(function () {
+                        if (_uploadFileBtn) {
                             _uploadFileBtn.removeClass("disabled");
                         }
                         _createFolderBtn.removeClass("disabled");
                         _createFolderDetails.slideUp();
                     });
-                    _folderBtn.click(function(){
+                    _folderBtn.click(function () {
                         $.ajax({
-                            type: "POST",
-                            url: "/filebrowser/mkdir",
-                            data: {
-                                name: _folderName.val(),
-                                path: path
+                            type:"POST",
+                            url:"/filebrowser/mkdir",
+                            data:{
+                                name:_folderName.val(),
+                                path:path
                             },
-                            beforeSend: function(xhr){ 
+                            beforeSend:function (xhr) {
                                 xhr.setRequestHeader("X-Requested-With", "Hue"); // need to override the default one because otherwise Django returns HTTP 500
                             },
-                            success: function(xhr, status){
-                                if (status == "success"){
+                            success:function (xhr, status) {
+                                if (status == "success") {
                                     _parent.navigateTo(path);
-                                    if (_uploadFileBtn){
+                                    if (_uploadFileBtn) {
                                         _uploadFileBtn.removeClass("disabled");
                                     }
                                     _createFolderBtn.removeClass("disabled");
@@ -111,13 +147,13 @@
                                 }
                             }
                         });
-                        
+
                     });
-				
+
                     _createFolderDetails.appendTo(_actions);
-                    
-                    _createFolderBtn.click(function(){
-                        if (_uploadFileBtn){
+
+                    _createFolderBtn.click(function () {
+                        if (_uploadFileBtn) {
                             _uploadFileBtn.addClass("disabled");
                         }
                         _createFolderBtn.addClass("disabled");
@@ -125,44 +161,44 @@
                     });
                     _actions.appendTo($(_parent.element));
                 }
-			}
-		});
-		
-	};
-	function initUploader(path, _parent, el){
-		completeRefreshPath = path;
-		var uploader = new qq.FileUploader({
-            element: el[0],
-            action: '/filebrowser/upload',
+            }
+        });
+
+    };
+    function initUploader(path, _parent, el) {
+        completeRefreshPath = path;
+        var uploader = new qq.FileUploader({
+            element:el[0],
+            action:'/filebrowser/upload',
             params:{
-                dest: path,
-                fileFieldLabel: 'hdfs_file'
+                dest:path,
+                fileFieldLabel:'hdfs_file'
             },
-            onComplete:function(id, fileName, responseJSON){
-				_parent.navigateTo(path);
+            onComplete:function (id, fileName, responseJSON) {
+                _parent.navigateTo(path);
             },
-            debug: false
+            debug:false
         });
-	}
+    }
 
-	Plugin.prototype.init = function () {
-		if ($.trim(this.options.initialPath)!=""){
-			this.navigateTo(this.options.initialPath);
-		}
-		else {
-			this.navigateTo("/");
-		}
-	};
+    Plugin.prototype.init = function () {
+        if ($.trim(this.options.initialPath) != "") {
+            this.navigateTo(this.options.initialPath);
+        }
+        else {
+            this.navigateTo("/?default_to_home");
+        }
+    };
 
-	$.fn[pluginName] = function (options) {
-		return this.each(function () {
-			if (!$.data(this, 'plugin_' + pluginName)) {
-				$.data(this, 'plugin_' + pluginName, new Plugin( this, options));
-			}
-			else {
-				$.data(this, 'plugin_' + pluginName).setOptions(options);
-			}
-		});
-	}
+    $.fn[pluginName] = function (options) {
+        return this.each(function () {
+            if (!$.data(this, 'plugin_' + pluginName)) {
+                $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
+            }
+            else {
+                $.data(this, 'plugin_' + pluginName).setOptions(options);
+            }
+        });
+    }
 
-})(jQuery, window, document );
+})(jQuery, window, document);