diff --git a/productMods/js/visualization/mapofscience/ControlPanel.js b/productMods/js/visualization/mapofscience/ControlPanel.js
index c30cd91e..1d066ac8 100644
--- a/productMods/js/visualization/mapofscience/ControlPanel.js
+++ b/productMods/js/visualization/mapofscience/ControlPanel.js
@@ -21,7 +21,6 @@ var ControlPanel = Class.extend({
opt.jQueryDiv.addClass(opt.divClass);
}
this.div = opt.jQueryDiv[0];
- opt.map.controls[opt.controlPositions].push(this.div);
},
getDiv: function() {
/* Allow to edit everything start from div level by returning div jquery object */
@@ -38,6 +37,14 @@ var ControlPanel = Class.extend({
if (div) {
div.style.display = "block";
}
+ },
+ addToMap: function() {
+ var opt = this.options;
+ opt.map.controls[opt.controlPositions].push(this.div);
+ },
+ removeFromMap: function() {
+ var opt = this.options;
+ opt.map.controls[opt.controlPositions].pop();
}
});
@@ -141,6 +148,7 @@ var CopyrightPanel = ControlPanel.extend({
init: function(options) {
this._super(options);
this.initCopyRight();
+ this.addToMap();
},
initCopyRight: function() {
var me = this;
diff --git a/productMods/js/visualization/mapofscience/ErrorDisplayWidget.js b/productMods/js/visualization/mapofscience/ErrorDisplayWidget.js
index 19b9ac7a..1959505e 100644
--- a/productMods/js/visualization/mapofscience/ErrorDisplayWidget.js
+++ b/productMods/js/visualization/mapofscience/ErrorDisplayWidget.js
@@ -75,7 +75,7 @@ var ErrorDisplayWidget = Class.extend({
var publicationsText = (responseData.pubsWithNoJournals > 1) ? "publications" : "publication";
- newErrorMessage += "
" + responseData.pubsWithNoJournals + " " + publicationsText + " with no journal"
+ newErrorMessage += "" + responseData.pubsWithNoJournals + " " + publicationsText + " have no journal"
+ " information."
}
diff --git a/productMods/js/visualization/mapofscience/InitializeMap.js b/productMods/js/visualization/mapofscience/InitializeMap.js
index b7a35534..96a421ac 100644
--- a/productMods/js/visualization/mapofscience/InitializeMap.js
+++ b/productMods/js/visualization/mapofscience/InitializeMap.js
@@ -1,7 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
var map;
var downloader;
-var sliderControl;
var currentVisMode;
var currentController;
var visModeControllers = {};
@@ -63,18 +62,13 @@ function initMap() {
var mapName = 'Scimap';
createScimapType(map, mapName);
map.setMapTypeId(mapName);
-
- sliderControl = new SliderControlPanel({
- map:map,
- controlPositions: google.maps.ControlPosition.RIGHT_BOTTOM
- });
downloader = new DownloadManager();
}
function initVisModeController() {
- var controller = new EntityVisModeController(map, sliderControl);
+ var controller = new EntityVisModeController(map);
visModeControllers[controller.visMode] = controller;
switchVisMode(controller.visMode);
currentController.loadData(scienceMapDataURL, false);
diff --git a/productMods/js/visualization/mapofscience/ScimapWidget.js b/productMods/js/visualization/mapofscience/ScimapWidget.js
index 1bf7dadf..85611105 100644
--- a/productMods/js/visualization/mapofscience/ScimapWidget.js
+++ b/productMods/js/visualization/mapofscience/ScimapWidget.js
@@ -1,39 +1,61 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
var ScimapWidget = Class.extend({
- init: function(map, sliderControl) {
+ init: function(map) {
var me = this;
me.activeManager = null;
me.isUnloaded = true;
me.map = map;
- me.sliderControl = sliderControl;
- me.labelsMarkerManager = new DisciplineLabelsMarkerManager(map);
- me.disciplineLabelsControl = new CheckBoxPanel({
- map: map,
- checked: true,
- text: "Show discipline labels",
- click: function() {
- if($(this).attr('checked')) {
- me.labelsMarkerManager.showMarkers();
- } else {
- me.labelsMarkerManager.hideMarkers();
- }
- }
- });
me.initView();
},
initView: function(){
var me = this;
+ me.initControlPanels();
+ me.initMarkerManagers();
+ me.show(SCIMAP_TYPE.SUBDISCIPLINE);
+ },
+ initControlPanels: function() {
+ var me = this;
+
+ /* Create slider control panel */
+ if (me.sliderControl == null) {
+ me.sliderControl = new SliderControlPanel({
+ map:me.map,
+ controlPositions: google.maps.ControlPosition.RIGHT_BOTTOM
+ });
+ }
+
+ /* Register event */
+ me.sliderControl.addToMap();
+ me.sliderControl.setChangeEventHandler(function(event, ui) {
+ if (me.keyToMarkerManagers) {
+ me.updateDisplayedMarkers(ui.value);
+ }
+ });
+
+ /* create */
+ if (me.disciplineLabelsControl == null) {
+ me.labelsMarkerManager = new DisciplineLabelsMarkerManager(map);
+ me.disciplineLabelsControl = new CheckBoxPanel({
+ map: map,
+ checked: true,
+ text: "Show discipline labels",
+ click: function() {
+ if($(this).attr('checked')) {
+ me.labelsMarkerManager.showMarkers();
+ } else {
+ me.labelsMarkerManager.hideMarkers();
+ }
+ }
+ });
+ }
+
/* Display labels if checked */
+ me.disciplineLabelsControl.addToMap();
if (me.disciplineLabelsControl.isChecked()) {
me.labelsMarkerManager.showMarkers();
}
- me.initMarkerManagers();
- me.sliderControl.setChangeEventHandler(function(event, ui) {
- me.updateDisplayedMarkers(ui.value);
- });
- me.show(SCIMAP_TYPE.SUBDISCIPLINE);
},
initMarkerManagers: function() {
if (this.keyToMarkerManagers == null) {
@@ -146,23 +168,29 @@ var ScimapWidget = Class.extend({
hide: function(key) {
var manager = this.getMarkerManager(key);
if (this.activeManager == manager) {
- this.cleanup();
+ this._cleanupMarkers();
}
},
_switchActiveManager: function(manager) {
if (this.activeManager != manager) {
- this.cleanUp();
+ this._cleanUpMarkers();
manager.addMarkersToMap();
this.activeManager = manager;
this.updateMap();
}
},
- cleanUp: function() {
+ _cleanUpMarkers: function() {
if (this.activeManager) {
this.activeManager.removeMarkersFromMap();
INFO_WINDOW.close();
}
},
+ cleanup: function() {
+ var me = this;
+ me._cleanUpMarkers();
+ me.sliderControl.RemoveFromMap();
+ me.disciplineLabelsControl.RemoveFromMap();
+ },
updateDisplayedMarkers: function(numberOfMarkers) {
this.activeManager.display(numberOfMarkers);
},
diff --git a/productMods/js/visualization/mapofscience/VisModeControllers.js b/productMods/js/visualization/mapofscience/VisModeControllers.js
index c9721348..e6d8d059 100644
--- a/productMods/js/visualization/mapofscience/VisModeControllers.js
+++ b/productMods/js/visualization/mapofscience/VisModeControllers.js
@@ -1,11 +1,46 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
var ENTITY_VIS_MODE = "ENTITY";
+var COMPARISON_VIS_MODE = "COMPARISON";
-var EntityVisModeController = Class.extend({
- init: function(map, sliderControl) {
+var VisModeController = Class.extend({
+ init: function(map) {
this.visMode = ENTITY_VIS_MODE;
this.isUnloaded = true;
- this.initWidgets(map, sliderControl);
+ this.initWidgets(map);
+ },
+ initWidgets: function(map) {
+ this.widgets = {};
+ },
+ needLoaded: function() {
+ return this.isUnloaded;
+ },
+ initView: function() {
+ $.each(this.widgets, function(i, widget) {
+ widget.initView();
+ });
+ },
+ // key can be discippline or subdiscipline
+ show: function(key) {
+ $.each(this.widgets, function(i, widget) {
+ widget.show(key);
+ });
+ },
+ hide: function(key) {
+ $.each(this.widgets, function(i, widget) {
+ widget.hide(key);
+ });
+ },
+ cleanUp: function() {
+ $.each(this.widgets, function(i, widget) {
+ widget.cleanUp(key);
+ });
+ }
+});
+
+var EntityVisModeController = VisModeController.extend({
+ init: function(map) {
+ this._super(map);
+ this.visMode = ENTITY_VIS_MODE;
this.initFilter();
},
initFilter: function() {
@@ -39,21 +74,13 @@ var EntityVisModeController = Class.extend({
/* Init default filter */
$("#" + dom.subdisciplinesFilterID).trigger('click');
},
- initWidgets: function(map, sliderControl) {
+ initWidgets: function(map) {
var widgets = {};
- widgets['scimap'] = new ScimapWidget(map, sliderControl);
+ widgets['scimap'] = new ScimapWidget(map);
widgets['sci_area_table'] = new DataTableWidget(widgets['scimap']);
this.widgets = widgets;
},
- needLoaded: function() {
- return this.isUnloaded;
- },
- initView: function() {
- $.each(this.widgets, function(i, widget) {
- widget.initView();
- });
- },
loadData: function(url, sync) {
// Download data from server and add to markerManager if not gotten already
@@ -139,21 +166,137 @@ var EntityVisModeController = Class.extend({
}
});
});
+ }
+});
+
+var ComparisonVisModeController = Class.extend({
+ init: function(map) {
+ this._super(map);
+ this.visMode = COMPARISON_VIS_MODE;
+ this.initFilter();
},
- // key can be discippline or subdiscipline
- show: function(key) {
- $.each(this.widgets, function(i, widget) {
- widget.show(key);
+ initFilter: function() {
+ var widgets = this.widgets;
+ var dom = {
+ disciplineFilterID: "discipline-filter",
+ subdisciplinesFilterID: "subdisciplines-filter",
+ filterOptionClass: "filter-option",
+ activeFilterClass: "active-filter"
+ };
+
+ $("." + dom.filterOptionClass).live('click', function() {
+ if (!$(this).hasClass(dom.activeFilterClass)) {
+ if ($(this).attr('id') === dom.subdisciplinesFilterID) {
+ $("#" + dom.disciplineFilterID).removeClass(dom.activeFilterClass);
+ $.each(widgets, function(i, widget) {
+ widget.changeFilter(SCIMAP_TYPE.SUBDISCIPLINE);
+ });
+
+ } else if ($(this).attr('id') === dom.disciplineFilterID) {
+ $("#" + dom.subdisciplinesFilterID).removeClass(dom.activeFilterClass);
+ $.each(widgets, function(i, widget) {
+ widget.changeFilter(SCIMAP_TYPE.DISCIPLINE);
+ });
+ }
+
+ $(this).addClass('active-filter');
+ }
});
+
+ /* Init default filter */
+ $("#" + dom.subdisciplinesFilterID).trigger('click');
},
- hide: function(key) {
- $.each(this.widgets, function(i, widget) {
- widget.hide(key);
+ initWidgets: function(map) {
+ var widgets = {};
+ widgets['scimap'] = new ScimapWidget(map);
+ widgets['sci_area_table'] = new DataTableWidget(widgets['scimap']);
+
+ this.widgets = widgets;
+ },
+ loadData: function(url, sync) {
+
+ // Download data from server and add to markerManager if not gotten already
+ var me = this;
+ if (me.isUnloaded) {
+ if (sync) {
+ downloader.downloadAndWait(url, function(data) {
+ me.loadJsonData(me, data);
+ });
+ } else {
+ downloader.download(url, function(data) {
+ me.loadJsonData(me, data);
+ });
+ }
+ } // end if
+ },
+ loadJsonData: function(me, data) {
+
+ $("#" + responseContainerID).unblock();
+
+ if (ERROR_DISPLAY_WIDGET.isErrorConditionTriggered(data)) {
+ $("#map-of-science-response").hide();
+ ERROR_DISPLAY_WIDGET.show(ENTITY_TYPE, data);
+ return;
+ }
+
+ data = data[0];
+
+ $.each(me.widgets, function(i, widget) {
+ widget.loadJsonData(data);
});
+ me.isUnloaded = false;
+ me.initToolTipInfo();
+
},
- cleanUp: function() {
- $.each(this.widgets, function(i, widget) {
- widget.cleanUp(key);
+ initToolTipInfo: function() {
+
+ $('.filterInfoIcon').each(function () {
+
+ var me = $(this);
+
+ var tipText;
+ var tipLocation = "topLeft";
+
+ if (me.attr('id') == 'imageIconOne') {
+ tipText = $('#toolTipOne').html();
+ } else if (me.attr('id') == 'imageIconTwo') {
+ tipText = $('#toolTipTwo').html();
+ } else if (me.attr('id') == 'searchInfoIcon') {
+ tipText = $('#searchInfoTooltipText').html();
+ } else {
+ tipText = $('#toolTipThree').html();
+ tipLocation = "topRight";
+ }
+
+ me.qtip({
+ content: {
+ text: tipText
+ },
+ position: {
+ corner: {
+ target: 'center',
+ tooltip: tipLocation
+ }
+ },
+ show: {
+ when: {
+ event: 'mouseover'
+ }
+ },
+ hide: {
+ fixed: true // Make it fixed so it can be hovered over
+ },
+ style: {
+ padding: '6px 6px',
+ // Give it some extra padding
+ width: 500,
+ textAlign: 'left',
+ backgroundColor: '#ffffc0',
+ fontSize: '.7em',
+ padding: '6px 10px 6px 10px',
+ lineHeight: '14px'
+ }
+ });
});
}
});
\ No newline at end of file