diff --git a/productMods/js/visualization/entitycomparison/gui-event-manager.js b/productMods/js/visualization/entitycomparison/gui-event-manager.js
index fff1d041..388eff71 100644
--- a/productMods/js/visualization/entitycomparison/gui-event-manager.js
+++ b/productMods/js/visualization/entitycomparison/gui-event-manager.js
@@ -18,6 +18,45 @@ $(document).ready(function() {
//temporalGraphProcessor.initiateTemporalGraphRenderProcess(graphContainer, jsonString);
+ /*
+ * When the intra-entity parameters are clicked,
+ * update the status accordingly.
+ */
+
+ $("select.comparisonValues").change(function(){
+
+ var selectedValue = $("select.comparisonValues option:selected").val();
+
+ var selectedParameter;
+
+ $.each(COMPARISON_PARAMETERS_INFO, function(index, parameter) {
+
+ if (parameter.value === selectedValue) {
+ selectedParameter = parameter;
+ window.location = parameter.viewLink;
+ }
+
+ });
+
+ //$("#body").empty().html("
Loading " + selectedValue + "

");
+
+ /*
+ * This piece of code is not executed at all because the redirect happens before there is a chance
+ * to render the below contents.
+ * */
+
+ /*
+
+ $("#comparisonParameter").text("Total Number of " + selectedValue);
+ $('#yaxislabel').html("Number of " + selectedValue).mbFlipText(false);
+ $('#yaxislabel').css("color", "#595B5B");
+ $('#comparisonHeader').html(selectedValue).css('font-weight', 'bold');
+
+
+ */
+
+ });
+
});
//click event handler for clear button
@@ -25,45 +64,6 @@ $("a.clear-selected-entities").live('click', function(){
clearRenderedObjects();
});
-/*
- * When the intra-entity parameters are clicked,
- * update the status accordingly.
- */
-
-$("select.comparisonValues").live('change', function(){
-
- var selectedValue = $("select.comparisonValues option:selected").val();
-
- var selectedParameter;
-
- $.each(COMPARISON_PARAMETERS_INFO, function(index, parameter) {
-
- if (parameter.value === selectedValue) {
- selectedParameter = parameter;
- window.location = parameter.viewLink;
- }
-
- });
-
- //$("#body").empty().html("Loading " + selectedValue + "

");
-
- /*
- * This piece of code is not executed at all because the redirect happens before there is a chance
- * to render the below contents.
- * */
-
- /*
-
- $("#comparisonParameter").text("Total Number of " + selectedValue);
- $('#yaxislabel').html("Number of " + selectedValue).mbFlipText(false);
- $('#yaxislabel').css("color", "#595B5B");
- $('#comparisonHeader').html(selectedValue).css('font-weight', 'bold');
-
-
- */
-
-});
-
$("input[type=checkbox].easyDeselectCheckbox").live('click', function(){
var checkbox = $(this);
@@ -189,9 +189,57 @@ function entityCheckboxOperatedOnEventListener() {
}
-function getTemporalGraphDataFromServer() {
+/*
+ * This method will setup the options for loading screen & then activate the
+ * loading screen.
+ * */
+function setupLoadingScreen(visContainerDIV) {
+ $.blockUI.defaults.overlayCSS = {
+ backgroundColor: '#fff',
+ opacity: 1.0
+ };
+
+ $.blockUI.defaults.css.width = '500px';
+ $.blockUI.defaults.css.border = '0px';
+ $.blockUI.defaults.css.top = '15%';
+ visContainerDIV.block({
+ message: '
Loading data for '
+ + organizationLabel
+ + '
'
+ });
+
+}
+
+/*
+ * This function gets json data for temporal graph & after rendering removes the
+ * loading message. It will also display the error container in case of any error.
+ * */
+function getTemporalGraphData(temporalGraphDataURL,
+ graphBodyDIV,
+ errorBodyDIV,
+ visContainerDIV) {
+
+ $.ajax({
+ url: temporalGraphDataURL,
+ dataType: "json",
+ success: function (data) {
+
+ if (data.error) {
+ graphBodyDIV.remove();
+ errorBodyDIV.show();
+ visContainerDIV.unblock();
+
+ } else {
+ graphBodyDIV.show();
+ errorBodyDIV.remove();
+ temporalGraphProcessor.initiateTemporalGraphRenderProcess(graphContainer, data);
+ visContainerDIV.unblock();
+ }
+ }
+ });
}
diff --git a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonOnGrantsStandalone.ftl b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonOnGrantsStandalone.ftl
index 016084d5..dda437a1 100644
--- a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonOnGrantsStandalone.ftl
+++ b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonOnGrantsStandalone.ftl
@@ -21,37 +21,12 @@ var subOrganizationTemporalGraphURL = "${subOrganizationGrantTemporalGraphCommon
$(document).ready(function () {
- $.blockUI.defaults.overlayCSS = {
- backgroundColor: '#fff',
- opacity: 1.0
- };
-
- $.blockUI.defaults.css.width = '500px';
- $.blockUI.defaults.css.border = '0px';
- $.blockUI.defaults.css.top = '15%';
-
- $("div#temporal-graph-response").block({
- message: '
Loading data for ${organizationLabel}
'
- });
+ setupLoadingScreen($("div#temporal-graph-response"));
- $.ajax({
- url: '${temporalGraphDataURL}',
- dataType: "json",
- success: function (data) {
-
- if (data.error) {
- $("#body").remove();
- $("#error-container").show();
- $("div#temporal-graph-response").unblock();
-
- } else {
- $("#body").show();
- $("#error-container").remove();
- temporalGraphProcessor.initiateTemporalGraphRenderProcess(graphContainer, data);
- $("div#temporal-graph-response").unblock();
- }
- }
- });
+ getTemporalGraphData('${temporalGraphDataURL}',
+ $("#body"),
+ $("#error-container"),
+ $("div#temporal-graph-response"));
});
diff --git a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonOnPublicationsStandalone.ftl b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonOnPublicationsStandalone.ftl
index 5ecbbe84..a68b4371 100644
--- a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonOnPublicationsStandalone.ftl
+++ b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonOnPublicationsStandalone.ftl
@@ -21,37 +21,12 @@ var subOrganizationTemporalGraphURL = "${subOrganizationPublicationTemporalGraph
$(document).ready(function () {
- $.blockUI.defaults.overlayCSS = {
- backgroundColor: '#fff',
- opacity: 1.0
- };
-
- $.blockUI.defaults.css.width = '500px';
- $.blockUI.defaults.css.border = '0px';
- $.blockUI.defaults.css.top = '15%';
-
- $("div#temporal-graph-response").block({
- message: '
Loading data for ${organizationLabel}
'
- });
+ setupLoadingScreen($("div#temporal-graph-response"));
- $.ajax({
- url: '${temporalGraphDataURL}',
- dataType: "json",
- success: function (data) {
-
- if (data.error) {
- $("#body").remove();
- $("#error-container").show();
- $("div#temporal-graph-response").unblock();
-
- } else {
- $("#body").show();
- $("#error-container").remove();
- temporalGraphProcessor.initiateTemporalGraphRenderProcess(graphContainer, data);
- $("div#temporal-graph-response").unblock();
- }
- }
- });
+ getTemporalGraphData('${temporalGraphDataURL}',
+ $("#body"),
+ $("#error-container"),
+ $("div#temporal-graph-response"));
});