From 14a841603a60022d4eff0793ba48915b7d896f7a Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Fri, 23 Jan 2015 12:37:45 -0500
Subject: [PATCH] JS checkstyles.

---
 themes/bootstrap3/js/hierarchyTree.js | 89 ++++++++++++++-------------
 1 file changed, 46 insertions(+), 43 deletions(-)

diff --git a/themes/bootstrap3/js/hierarchyTree.js b/themes/bootstrap3/js/hierarchyTree.js
index 596b0257224..d6b2990de3a 100644
--- a/themes/bootstrap3/js/hierarchyTree.js
+++ b/themes/bootstrap3/js/hierarchyTree.js
@@ -93,6 +93,45 @@ function doTreeSearch()
   }
 }
 
+function buildTreeWithXml(cb)
+{
+  $.ajax({'url': path + '/Hierarchy/GetTree',
+    'data': {
+      'hierarchyID': hierarchyID,
+      'id': recordID,
+      'context': hierarchyContext,
+      'mode': 'Tree'
+    },
+    'success': function(xml) {
+      var nodes = buildJSONNodes($(xml).find('root'));
+      cb.call(this, nodes);
+    }
+  });
+}
+function buildJSONNodes(xml)
+{
+  var jsonNode = [];
+  $(xml).children('item').each(function() {
+    var content = $(this).children('content');
+    var id = content.children("name[class='JSTreeID']");
+    var name = content.children('name[href]');
+    jsonNode.push({
+      'id': htmlEncodeId(id.text()),
+      'text': name.text(),
+      'li_attr': {
+        'recordid': id.text()
+      },
+      'a_attr': {
+        'href': name.attr('href'),
+        'title': name.text()
+      },
+      'type': name.attr('href').match(/\/Collection\//) ? 'collection' : 'record',
+      children: buildJSONNodes(this)
+    });
+  });
+  return jsonNode;
+}
+
 $(document).ready(function()
 {
   // Code for the search button
@@ -148,9 +187,12 @@ $(document).ready(function()
               200: function(json, status, request) {
                 cb.call(this, json);
               },
-              204: buildTreeWithXml, // No Content
-              503: buildTreeWithXml  // Service Unavailable
-
+              204: function(json, status, request) { // No Content
+                buildTreeWithXml(cb);
+              },
+              503: function(json, status, request) { // Service Unavailable
+                buildTreeWithXml(cb);
+              }
             }
           });
         },
@@ -176,43 +218,4 @@ $(document).ready(function()
       doTreeSearch();
     }
   });
-});
-
-function buildTreeWithXml()
-{
-  $.ajax({'url': path + '/Hierarchy/GetTree',
-    'data': {
-      'hierarchyID': hierarchyID,
-      'id': recordID,
-      'context': hierarchyContext,
-      'mode': 'Tree'
-    },
-    'success': function(xml) {
-      var nodes = buildJSONNodes($(xml).find('root'));
-      cb.call(this, nodes);
-    }
-  });
-}
-function buildJSONNodes(xml)
-{
-  var jsonNode = [];
-  $(xml).children('item').each(function() {
-    var content = $(this).children('content');
-    var id = content.children("name[class='JSTreeID']");
-    var name = content.children('name[href]');
-    jsonNode.push({
-      'id': htmlEncodeId(id.text()),
-      'text': name.text(),
-      'li_attr': {
-        'recordid': id.text()
-      },
-      'a_attr': {
-        'href': name.attr('href'),
-        'title': name.text()
-      },
-      'type': name.attr('href').match(/\/Collection\//) ? 'collection' : 'record',
-      children: buildJSONNodes(this)
-    });
-  });
-  return jsonNode;
-}
\ No newline at end of file
+});
\ No newline at end of file
-- 
GitLab