diff --git a/productMods/css/visualization/entitycomparison/layout.css b/productMods/css/visualization/entitycomparison/layout.css index 381646e6..ae99242c 100644 --- a/productMods/css/visualization/entitycomparison/layout.css +++ b/productMods/css/visualization/entitycomparison/layout.css @@ -13,6 +13,10 @@ display: none; } +#subject-parent-entity { + display: none; +} + #error-container { display: none; } @@ -49,6 +53,7 @@ img.bar-count-icon { .legend-bar { margin-bottom: 3px; + cursor:default; } .unknown-legend-bar { diff --git a/productMods/js/visualization/entitycomparison/gui-event-manager.js b/productMods/js/visualization/entitycomparison/gui-event-manager.js index c9f0a8b8..d46ef482 100644 --- a/productMods/js/visualization/entitycomparison/gui-event-manager.js +++ b/productMods/js/visualization/entitycomparison/gui-event-manager.js @@ -24,7 +24,7 @@ $(document).ready(function() { * update the status accordingly. */ - $("select.comparisonValues").change(function(){ + $("select.comparisonValues").change(function() { var selectedValue = $("select.comparisonValues option:selected").val(); @@ -36,6 +36,8 @@ $(document).ready(function() { currentParameter = parameter.name; selectedDataURL = parameter.dataLink; + temporalGraphCommonURL = parameter.viewBaseLink; + csvDownloadURL = parameter.csvLink; } }); @@ -175,47 +177,79 @@ function performEntityCheckboxClickedRedrawActions() { } -/* - * function to populate the labelToEntityRecord object with the - * values from the json file and - * dynamically generate checkboxes - */ -function loadData(jsonData, dataTableParams) { - - $.each(jsonData, function (index, val) { - setOfLabels.push(val.label); - URIToEntityRecord[val.entityURI] = val; - if (val.lastCachedAtDateTime) { - lastCachedAtDateTimes[lastCachedAtDateTimes.length] = val.lastCachedAtDateTime; - } - }); - - prepareTableForDataTablePagination(jsonData, dataTableParams); - setEntityLevel(getEntityVisMode(jsonData)); - - entityCheckboxOperatedOnEventListener(); - -} - -/* - * function to populate the labelToEntityRecord object with the - * values from the json file and - * dynamically generate checkboxes - */ -function reloadData(preselectedEntityURIs, jsonData) { - - $.each(jsonData, function (index, val) { - setOfLabels.push(val.label); - URIToEntityRecord[val.entityURI] = val; - if (val.lastCachedAtDateTime) { - lastCachedAtDateTimes[lastCachedAtDateTimes.length] = val.lastCachedAtDateTime; - } - }); - - reloadDataTablePagination(preselectedEntityURIs, jsonData); - setEntityLevel(getEntityVisMode(jsonData)); -} - +var processJSONData = { + + isParentEntityAvailable: false, + + setupGlobals: function(jsonContent) { + $.each(jsonContent, function (index, val) { + + /* + * We are checking if the "label" attribute is present, because that pertains to + * data used for linegraph visualization. + * */ + if (val.label) { + + setOfLabels.push(val.label); + URIToEntityRecord[val.entityURI] = val; + if (val.lastCachedAtDateTime) { + lastCachedAtDateTimes[lastCachedAtDateTimes.length] = val.lastCachedAtDateTime; + } + } else if (val.subjectEntityLabel) { + + /* + * This is to set the drill-up visualization URLs. + * */ + $.each(val.parentURIToLabel, function(index, value) { + + $("a#subject-parent-entity-temporal-url").attr("href", getTemporalVisURL(index)); + + $("a#subject-parent-entity-profile-url").attr("href", getVIVOURL(index)); + $("a#subject-parent-entity-profile-url").text(value); + + processJSONData.isParentEntityAvailable = true; + }); + } + }); + + if (processJSONData.isParentEntityAvailable) { + $("#subject-parent-entity").show(); + } else { + $("#subject-parent-entity").hide(); + } + }, + + /* + * function to populate the labelToEntityRecord object with the + * values from the json file and + * dynamically generate checkboxes + */ + loadData: function(jsonData, dataTableParams) { + + processJSONData.setupGlobals(jsonData); + + prepareTableForDataTablePagination(jsonData, dataTableParams); + setEntityLevel(getEntityVisMode(jsonData)); + + entityCheckboxOperatedOnEventListener(); + }, + + /* + * function to populate the labelToEntityRecord object with the + * values from the json file and + * dynamically generate checkboxes + */ + reloadData: function(preselectedEntityURIs, jsonData) { + + processJSONData.setupGlobals(jsonData); + + reloadDataTablePagination(preselectedEntityURIs, jsonData); + setEntityLevel(getEntityVisMode(jsonData)); + + $("a#csv").attr("href", csvDownloadURL); + } + +}; function entityCheckboxOperatedOnEventListener() { @@ -394,7 +428,7 @@ temporalGraphProcessor = { /* * render the temporal graph per the sent content. * */ - loadData(jsonData, this.dataTableParams); + processJSONData.loadData(jsonData, this.dataTableParams); lastCachedAtDateTimes.sort(lastCachedAtDateTimeParser.ascendingDateSorter); @@ -438,7 +472,7 @@ temporalGraphProcessor = { /* * render the temporal graph per the sent content. * */ - reloadData(currentSelectedEntityURIs, jsonData); + processJSONData.reloadData(currentSelectedEntityURIs, jsonData); lastCachedAtDateTimes.sort(lastCachedAtDateTimeParser.ascendingDateSorter); diff --git a/productMods/js/visualization/entitycomparison/util.js b/productMods/js/visualization/entitycomparison/util.js index aafe6c20..0a7b5cc5 100644 --- a/productMods/js/visualization/entitycomparison/util.js +++ b/productMods/js/visualization/entitycomparison/util.js @@ -640,7 +640,7 @@ function createLegendRow(entity, bottomDiv) { * there is no drill-down possible, so don't diaply the temporal graph icon. * */ if (entity.visMode !== "PERSON") { - labelDiv.append(''); + labelDiv.append(''); } @@ -649,7 +649,7 @@ function createLegendRow(entity, bottomDiv) { checkbox.attr('checked', true); checkbox.attr('id', 'checkbox'); checkbox.attr('class', 'easyDeselectCheckbox'); - checkbox.attr('value', entity.label); + checkbox.attr('value', entity.entityURI); var hiddenLabel = $('