Commit 7dbb995a authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Muestra PDF en detalles de documento, corrige bugs

Siguiendo el ejemplo del resto de vistas de detalle,
documentos/bibliografía sigue el mismo camino, unificando la vista de
detalle con la del visor integrado de PDF.

Corrige bug de actualización de nuevos contenidos integrados, como el
mapa de especies o el visor de PDF, tras cambiar de elemento
visualizado.

Adapta info de actividad a nuevo esquema de recursos.
parent dd796d76
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -64,9 +64,7 @@ define([
						},{
							icon: "fa-file-pdf-o",
							btnId: "downloadPdf",
							condition: "url",
							title: "openViewer",
							href: this.viewPaths.documentPDF
							condition: "url"
						}]
					},
					shownOptionTemplate: {
+1 −2
Original line number Diff line number Diff line
@@ -90,8 +90,7 @@ define([
							listButton: [{
								icon: "fa-file-pdf-o",
								btnId: "downloadPdf",
								condition: "url",
								href: redmicConfig.viewPaths.documentPDF
								condition: "url"
							},{
								icon: "fa-info-circle",
								btnId: "details",
+79 −10
Original line number Diff line number Diff line
define([
	"app/redmicConfig"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "templates/DocumentInfo"
	, "./_DetailsBase"
	'app/redmicConfig'
	, 'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'templates/DocumentInfo'
	, './_DetailsBase'
	, './DocumentPDF'
], function(
	redmicConfig
	, declare
	, lang
	, TemplateInfo
	, _DetailsBase
	, DocumentPDF
) {
	return declare([_DetailsBase], {

	return declare(_DetailsBase, {
		//	summary:
		//		Vista detalle de Document.

@@ -19,8 +22,8 @@ define([

			this.config = {
				_titleRightButtonsList: [{
					icon: "fa-print",
					btnId: "report",
					icon: 'fa-print',
					btnId: 'report',
					title: this.i18n.printToPdf
				}],

@@ -28,10 +31,76 @@ define([
				activitiesTargetBase: redmicConfig.services.activityDocuments,
				templateInfo: TemplateInfo,

				reportService: "document"
				reportService: 'document'
			};

			lang.mixin(this, this.config, args);
		},

		_setMainOwnCallbacksForEvents: function() {

			this._onEvt('ME_OR_ANCESTOR_HIDDEN', lang.hitch(this, this._onDocumentDetailsHidden));
		},

		_setMainConfigurations: function() {

			this.inherited(arguments);

			this.widgetConfigs = this._merge([
				this.widgetConfigs || {},
				{
					info: {
						height: 4
					},
					activityList: {
						height: 4
					},
					pdf: {
						width: 6,
						height: 6,
						hidden: true,
						type: DocumentPDF,
						props: {
							title: this.i18n.document,
							pathVariableId: this.pathVariableId
						}
					}
				}
			]);
		},

		_itemAvailable: function(res, resWrapper) {

			this.inherited(arguments);

			if (resWrapper.target === redmicConfig.services.document) {
				if (res.data.url) {
					this._showWidget('pdf');
				}
			}
		},

		_clearModules: function() {

			this.inherited(arguments);

			this._publish(this._getWidgetInstance('pdf').getChannel('CLEAR'));
		},

		_refreshModules: function() {

			this.inherited(arguments);

			this._checkPathVariableId();

			this._publish(this._getWidgetInstance('pdf').getChannel('SET_PROPS'), {
				pathVariableId: this.pathVariableId
			});
		},

		_onDocumentDetailsHidden: function() {

			this._hideWidget('pdf');
		}
	});
});
+23 −25
Original line number Diff line number Diff line
define([
	"app/designs/base/_Main"
	, "app/designs/details/Controller"
	, "app/designs/details/Layout"
	, "app/designs/details/_AddTitle"
	, "app/designs/details/_TitleSelection"
	, "app/redmicConfig"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "redmic/modules/components/PDFViewer/PDFViewer"
	'app/designs/base/_Main'
	, 'app/designs/details/Controller'
	, 'app/designs/details/Layout'
	, 'app/redmicConfig'
	, 'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'redmic/modules/components/PDFViewer/PDFViewer'
], function(
	_Main
	, Controller
	, Layout
	, _AddTitle
	, _TitleSelection
	, redmicConfig
	, declare
	, lang
	, PDFViewer
) {
	return declare([Layout, Controller, _Main, _AddTitle, _TitleSelection], {

	return declare([Layout, Controller, _Main], {
		//	summary:
		//		Vista detalle de documento PDF.

		constructor: function(args) {

			this.target = redmicConfig.services.document;

			this.config = {
				noScroll: true,
				propsWidget: {
@@ -45,17 +43,13 @@ define([
					height: 6,
					type: PDFViewer,
					props: {
						classWindowContent: "view",
						title: "PDF"
						classWindowContent: 'view',
						title: 'PDF'
					}
				}
			}, this.widgetConfigs || {}]);
		},

		_clearModules: function() {

		},

		_refreshModules: function() {

			this._checkPathVariableId();
@@ -69,12 +63,16 @@ define([

		_itemAvailable: function(item) {

			if (item.data.url)
				this._publish(this._widgets.pdf.getChannel("LOAD_PDF"), {
					url: item.data.url
			var pdfUrl = item.data.url,
				widgetInstance = this._getWidgetInstance('pdf');

			if (!pdfUrl || !widgetInstance) {
				return;
			}

			this._publish(widgetInstance.getChannel('LOAD_PDF'), {
				url: pdfUrl
			});
			else
				this._goTo404();
		}
	});
});
+5 −1
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ define([
								btnId: "downloadPdf",
								title: this.i18n.download,
								condition: "url",
								href: redmicConfig.viewPaths.bibliographyPDF
								href: redmicConfig.viewPaths.bibliographyDetails
							},{
								icon: "fa-info-circle",
								btnId: "details",
@@ -148,6 +148,10 @@ define([

		_refreshChildrenDataModules: function() {

			this._publish(this._getWidgetInstance('map').getChannel('SET_PROPS'), {
				pathVariableId: this.pathVariableId
			});

			this.target[1] = lang.replace(redmicConfig.services.documentsBySpecies, {
				id: this.pathVariableId
			});
Loading