Commit 9b2574e9 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Refactoriza y muestra datos de actividad restantes

Aplica mejora de vista detalle de actividad a las otras categorías
restantes, para mostrar datos geográficos al primer nivel.
parent ba7df7d5
Loading
Loading
Loading
Loading
+15 −81
Original line number Diff line number Diff line
define([
	'app/details/views/ActivityCitationMapBase'
	, 'app/details/views/ActivityLayerMapBase'
	, "app/redmicConfig"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "redmic/modules/map/_ImportWkt"
	, "redmic/modules/map/LeafletImpl"
	, "redmic/modules/map/Map"
	, "templates/ActivityInfo"
	, "./_ActivityBase"
	'app/redmicConfig'
	, 'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'redmic/modules/map/_ImportWkt'
	, 'redmic/modules/map/LeafletImpl'
	, 'redmic/modules/map/Map'
	, 'templates/ActivityInfo'
	, './_ActivityBase'
	, './_ActivityCategoryWidgets'
], function(
	ActivityCitationMapBase
	, ActivityLayerMapBase
	, redmicConfig
	redmicConfig
	, declare
	, lang
	, _ImportWkt
@@ -20,19 +17,20 @@ define([
	, Map
	, TemplateInfo
	, _ActivityBase
	, _ActivityCategoryWidgets
) {

	return declare([_ActivityBase], {
	return declare([_ActivityBase, _ActivityCategoryWidgets], {
		//	summary:
		//		Vista detalle de Activity.

		constructor: function(args) {

			this.target = redmicConfig.services.activity;
			this.reportService = "activity";
			this.reportService = 'activity';
			this.ancestorsTarget = redmicConfig.services.activityAncestors;

			this.infoTarget = "infoWidgetTarget";
			this.infoTarget = 'infoWidgetTarget';
		},

		_setMainConfigurations: function() {
@@ -90,7 +88,7 @@ define([
			});

			this._emitEvt('REQUEST', {
				method: "POST",
				method: 'POST',
				target: ancestorsTarget,
				action: '_search',
				query: {
@@ -146,62 +144,6 @@ define([
			});
		},

		_prepareActivityCategoryCustomWidgets: function() {

			if (!this._activityCategoryCustomWidgets) {
				this._activityCategoryCustomWidgets = [];
			}

			var activityCategory = this._activityData.activityCategory,
				widgetKey;

			if (activityCategory === 'ci') {
				widgetKey = this._prepareCitationActivityWidgets();
			} else if (activityCategory === 'ml') {
				widgetKey = this._prepareMapLayerActivityWidgets();
			}

			widgetKey && this._activityCategoryCustomWidgets.push(widgetKey);
		},

		_prepareCitationActivityWidgets: function() {

			var key = 'activityCitation';

			var config = {
				width: 6,
				height: 6,
				type: ActivityCitationMapBase,
				props: {
					title: this.i18n.citations,
					pathVariableId: this._activityData.id
				}
			};

			this._addWidget(key, config);

			return key;
		},

		_prepareMapLayerActivityWidgets: function() {

			var key = 'activityMapLayer';

			var config = {
				width: 6,
				height: 6,
				type: ActivityLayerMapBase,
				props: {
					title: this.i18n.layers,
					pathVariableId: this._activityData.id
				}
			};

			this._addWidget(key, config);

			return key;
		},

		_onActivityDetailsHidden: function() {

			if (this._lastWktLayer) {
@@ -215,14 +157,6 @@ define([
			this._hideWidget('spatialExtensionMap');

			this._removeActivityCategoryCustomWidgets();
		},

		_removeActivityCategoryCustomWidgets: function() {

			while (this._activityCategoryCustomWidgets.length) {
				var key = this._activityCategoryCustomWidgets.pop();
				this._destroyWidget(key);
			}
		}
	});
});
+5 −3
Original line number Diff line number Diff line
@@ -74,8 +74,9 @@ define([

		_clearModules: function() {

			this._publish(this._widgets.geographic.getChannel("CLEAR"));
			this._publish(this._widgets.geographic.getChannel("REFRESH"));
			var widgetInstance = this._getWidgetInstance('geographic');
			this._publish(widgetInstance.getChannel("CLEAR"));
			this._publish(widgetInstance.getChannel("REFRESH"));
		},

		_refreshModules: function() {
@@ -90,7 +91,8 @@ define([

			this.targetChange = lang.replace(this.templateTargetChange, {id: this.pathVariableId});

			this._publish(this._widgets.geographic.getChannel("UPDATE_TARGET"), {
			var widgetInstance = this._getWidgetInstance('geographic');
			this._publish(widgetInstance.getChannel("UPDATE_TARGET"), {
				target: this.targetChange,
				refresh: true
			});
+28 −26
Original line number Diff line number Diff line
@@ -100,23 +100,25 @@ define([
			this._layerDefinition = declare(this.definitionLayer);
		},

		_afterShow: function(request) {
		_afterShow: function() {

			if (!this.layerInstance) {
			if (this.layerInstance) {
				this.startup();
				return;
			}

			var widgetInstance = this._getWidgetInstance('geographic');

			this.layerConfig = this._merge([{
					mapChannel: this._widgets.geographic.getChildChannel("map"),
					selectorChannel: this._widgets.geographic.getChannel()
				mapChannel: widgetInstance.getChildChannel("map"),
				selectorChannel: widgetInstance.getChannel()
			}, this.layerConfig || {}]);

			this.layerInstance = new this._layerDefinition(this.layerConfig);

				this._publish(this._widgets.geographic.getChildChannel("map", "ADD_LAYER"), this.layerInstance);

				var widgetInstance = this._widgets.geographic;
			this._publish(widgetInstance.getChildChannel("map", "ADD_LAYER"), this.layerInstance);

				this._publish(
					widgetInstance.getChildChannel("mapCenteringGateway", "ADD_CHANNELS_DEFINITION"), {
			this._publish(widgetInstance.getChildChannel("mapCenteringGateway", "ADD_CHANNELS_DEFINITION"), {
				channelsDefinition: [{
					input: widgetInstance.getChildChannel("browser", "BUTTON_EVENT"),
					output: this.layerInstance.getChannel("SET_CENTER"),
@@ -126,17 +128,16 @@ define([
					output: this.layerInstance.getChannel("ANIMATE_MARKER"),
					subMethod: "animateMarker"
				}]
					}
				);
			}
			});

			this.startup();
		},

		_clearModules: function() {

			this._publish(this._widgets.geographic.getChannel("CLEAR"));
			this._publish(this._widgets.geographic.getChannel("REFRESH"));
			var widgetInstance = this._getWidgetInstance('geographic');
			this._publish(widgetInstance.getChannel("CLEAR"));
			this._publish(widgetInstance.getChannel("REFRESH"));
		},

		_refreshModules: function() {
@@ -155,7 +156,8 @@ define([
				target: this.targetChange
			});

			this._publish(this._widgets.geographic.getChannel("UPDATE_TARGET"), {
			var widgetInstance = this._getWidgetInstance('geographic');
			this._publish(widgetInstance.getChannel("UPDATE_TARGET"), {
				target: this.targetChange,
				refresh: true
			});
+9 −10
Original line number Diff line number Diff line
@@ -3,8 +3,6 @@ define([
	, "app/designs/base/_Main"
	, "app/designs/details/Controller"
	, "app/designs/details/Layout"
	, "app/designs/details/_AddTitle"
	, "app/designs/details/_TitleSelection"
	, "app/designs/mapWithSideContent/main/Tracking"
	, "app/designs/mapWithSideContent/main/_TrackingWithListByFilter"
	, "app/redmicConfig"
@@ -15,16 +13,14 @@ define([
	, _Main
	, Controller
	, Layout
	, _AddTitle
	, _TitleSelection
	, Tracking
	, _TrackingWithListByFilter
	, redmicConfig
	, declare
	, lang
) {
	return declare([Layout, Controller, _Main, _AddTitle, _TitleSelection,
		_ListenActivityDataAndAccessByActivityCategory], {

	return declare([Layout, Controller, _Main, _ListenActivityDataAndAccessByActivityCategory], {
		//	summary:
		//		Vista detalle de Activity tracking.

@@ -62,14 +58,16 @@ define([

		_clearModules: function() {

			this._publish(this._widgets.tracking.getChannel("CLEAR"));
			var widgetInstance = this._getWidgetInstance('tracking');
			this._publish(widgetInstance.getChannel("CLEAR"));
		},

		_refreshModules: function() {

			this._checkPathVariableId();

			this._publish(this._widgets.tracking.getChannel("SET_PROPS"), {
			var widgetInstance = this._getWidgetInstance('tracking');
			this._publish(widgetInstance.getChannel("SET_PROPS"), {
				pathVariableId: this.pathVariableId
			});

@@ -86,7 +84,8 @@ define([

			this.target[1] = target;

			this._publish(this._widgets.tracking.getChannel("UPDATE_TARGET"), {
			var widgetInstance = this._getWidgetInstance('tracking');
			this._publish(widgetInstance.getChannel("UPDATE_TARGET"), {
				target: target,
				refresh: true
			});
+148 −0
Original line number Diff line number Diff line
define([
	'app/designs/details/main/ActivityTrackingMap'
	, 'app/details/views/ActivityAreaMapBase'
	, 'app/details/views/ActivityCitationMapBase'
	, 'app/details/views/ActivityInfrastructureMapBase'
	, 'app/details/views/ActivityLayerMapBase'
	, 'dojo/_base/declare'
], function(
	ActivityTrackingMap
	, ActivityAreaMapBase
	, ActivityCitationMapBase
	, ActivityInfrastructureMapBase
	, ActivityLayerMapBase
	, declare
) {

	return declare(null, {
		//	summary:
		//		Adiciones a vista detalle de Activity, para mostrar datos según su categoría.

		_prepareActivityCategoryCustomWidgets: function() {

			if (!this._activityCategoryCustomWidgets) {
				this._activityCategoryCustomWidgets = [];
			}

			var activityCategory = this._activityData.activityCategory,
				widgetKey;

			if (activityCategory === 'ci') {
				widgetKey = this._prepareCitationActivityWidgets();
			} else if (activityCategory === 'ml') {
				widgetKey = this._prepareMapLayerActivityWidgets();
			} else if (['tr', 'at', 'pt'].indexOf(activityCategory) !== -1) {
				widgetKey = this._prepareTrackingActivityWidgets();
			} else if (activityCategory === 'if') {
				widgetKey = this._prepareInfrastructureActivityWidgets();
			} else if (activityCategory === 'ar') {
				widgetKey = this._prepareAreaActivityWidgets();
			}

			widgetKey && this._activityCategoryCustomWidgets.push(widgetKey);
		},

		_prepareCitationActivityWidgets: function() {

			var key = 'activityCitation';

			var config = {
				width: 6,
				height: 6,
				type: ActivityCitationMapBase,
				props: {
					title: this.i18n.citations,
					pathVariableId: this._activityData.id
				}
			};

			this._addWidget(key, config);

			return key;
		},

		_prepareMapLayerActivityWidgets: function() {

			var key = 'activityMapLayer';

			var config = {
				width: 6,
				height: 6,
				type: ActivityLayerMapBase,
				props: {
					title: this.i18n.layers,
					pathVariableId: this._activityData.id
				}
			};

			this._addWidget(key, config);

			return key;
		},

		_prepareTrackingActivityWidgets: function() {

			var key = 'activityTracking';

			var config = {
				width: 6,
				height: 6,
				type: ActivityTrackingMap,
				props: {
					title: this.i18n.tracking,
					pathVariableId: this._activityData.id
				}
			};

			this._addWidget(key, config);

			return key;
		},

		_prepareInfrastructureActivityWidgets: function() {

			var key = 'activityInfrastructure';

			var config = {
				width: 6,
				height: 6,
				type: ActivityInfrastructureMapBase,
				props: {
					title: this.i18n.infrastructures,
					pathVariableId: this._activityData.id
				}
			};

			this._addWidget(key, config);

			return key;
		},

		_prepareAreaActivityWidgets: function() {

			var key = 'activityArea';

			var config = {
				width: 6,
				height: 6,
				type: ActivityAreaMapBase,
				props: {
					title: this.i18n.area,
					pathVariableId: this._activityData.id
				}
			};

			this._addWidget(key, config);

			return key;
		},

		_removeActivityCategoryCustomWidgets: function() {

			while (this._activityCategoryCustomWidgets.length) {
				var key = this._activityCategoryCustomWidgets.pop();
				this._destroyWidget(key);
			}
		}
	});
});
Loading