Skip to content
Snippets Groups Projects
Commit 3f5e850f authored by Chris Hallberg's avatar Chris Hallberg
Browse files

Removed unused functions. Moved html_entity_decode to the only file it's used in.

parent fd427225
Branches
Tags
No related merge requests found
......@@ -23,30 +23,6 @@ function extractClassParams(str) {
}
return params;
}
function jqEscape(myid) {
return String(myid).replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
}
function html_entity_decode(string, quote_style)
{
var hash_map = {},
symbol = '',
tmp_str = '',
entity = '';
tmp_str = string.toString();
delete(hash_map['&']);
hash_map['&'] = '&amp;';
hash_map['>'] = '&gt;';
hash_map['<'] = '&lt;';
for (symbol in hash_map) {
entity = hash_map[symbol];
tmp_str = tmp_str.split(entity).join(symbol);
}
tmp_str = tmp_str.split('&#039;').join("'");
return tmp_str;
}
// Turn GET string into array
function deparam(url) {
......
/*global hierarchySettings, html_entity_decode, jqEscape, path, vufindString*/
/*global hierarchySettings, path, vufindString*/
var hierarchyID, recordID, htmlID, hierarchyContext;
var baseTreeSearchFullURL;
function getRecord(recordID)
{
/* Utility functions */
function htmlEncodeId(id) {
return id.replace(/\W/g, "-"); // Also change Hierarchy/TreeRenderer/JSTree.php
}
function html_entity_decode(string, quote_style) {
var hash_map = {
'&': '&amp;',
'>': '&gt;',
'<': '&lt;'
};
var tmp_str = string.toString();
for (var symbol in hash_map) {
var entity = hash_map[symbol];
tmp_str = tmp_str.split(entity).join(symbol);
}
tmp_str = tmp_str.split('&#039;').join("'");
return tmp_str;
}
function getRecord(recordID) {
$.ajax({
url: path + '/Hierarchy/GetRecord?' + $.param({id: recordID}),
dataType: 'html',
......@@ -24,8 +43,7 @@ function getRecord(recordID)
});
}
function changeNoResultLabel(display)
{
function changeNoResultLabel(display) {
if (display) {
$("#treeSearchNoResults").removeClass('hidden');
} else {
......@@ -33,8 +51,7 @@ function changeNoResultLabel(display)
}
}
function changeLimitReachedLabel(display)
{
function changeLimitReachedLabel(display) {
if (display) {
$("#treeSearchLimitReached").removeClass('hidden');
} else {
......@@ -42,14 +59,8 @@ function changeLimitReachedLabel(display)
}
}
function htmlEncodeId(id)
{
return id.replace(/\W/g, "-"); // Also change Hierarchy/TreeRenderer/JSTree.php
}
var searchAjax = false;
function doTreeSearch()
{
function doTreeSearch() {
$('#treeSearchLoadingImg').removeClass('hidden');
var keyword = $("#treeSearchText").val();
var type = $("#treeSearchType").val();
......@@ -93,8 +104,7 @@ function doTreeSearch()
}
}
function buildJSONNodes(xml)
{
function buildJSONNodes(xml) {
var jsonNode = [];
$(xml).children('item').each(function() {
var content = $(this).children('content');
......@@ -116,8 +126,7 @@ function buildJSONNodes(xml)
});
return jsonNode;
}
function buildTreeWithXml(cb)
{
function buildTreeWithXml(cb) {
$.ajax({'url': path + '/Hierarchy/GetTree',
'data': {
'hierarchyID': hierarchyID,
......@@ -132,19 +141,18 @@ function buildTreeWithXml(cb)
});
}
$(document).ready(function()
{
$(document).ready(function() {
// Code for the search button
hierarchyID = $("#hierarchyTree").find(".hiddenHierarchyId")[0].value;
recordID = $("#hierarchyTree").find(".hiddenRecordId")[0].value;
htmlID = htmlEncodeId(recordID);
hierarchyContext = $("#hierarchyTree").find(".hiddenContext")[0].value;
$("#hierarchyLoading").removeClass('hide');
$("#hierarchyLoading").removeClass('hide');
$("#hierarchyTree")
.bind("ready.jstree", function (event, data) {
$("#hierarchyLoading").addClass('hide');
$("#hierarchyLoading").addClass('hide');
var tree = $("#hierarchyTree").jstree(true);
tree.select_node(htmlID);
tree._open_to(htmlID);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment