← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13563: PT, embed plugin config, providing full html.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 13563 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-01-03 17:28:53 +0100
message:
  PT, embed plugin config, providing full html.
modified:
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2014-01-02 19:49:41 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2014-01-03 16:26:42 +0000
@@ -4798,11 +4798,31 @@
 			handler: function() {
 				var textArea,
 					window,
-					text = 'DHIS.getTable(' + JSON.stringify(ns.core.service.layout.layout2plugin(ns.app.layout)) + ');';
+					text = '';
+
+				text += '<!DOCTYPE html>\n<html>\n<head>\n\n';
+				text += '<link rel="stylesheet" href="http://dhis2-cdn.org/v214/ext/resources/css/ext-plugin-gray.css"; />\n';
+				text += '<script src="http://dhis2-cdn.org/v214/ext/ext-all.js";></script>\n';
+				text += '<script src="http://dhis2-cdn.org/v214/plugin/table.js";></script>\n\n';
+				text += '<script>\n';
+				text += 'var base = "http://apps.dhis2.org/demo";\n\n';
+				text += 'Ext.onReady( function() {\n';
+				text += '  Ext.Ajax.request({\n';
+				text += '    url: base + "dhis-web-commons-security/login.action",\n';
+				text += '    method: "POST",\n';
+				text += '    params: { j_username: "portal", j_password: "Portal123" },\n';
+				text += '    success: setLinks\n';
+				text += '  })\n';
+				text += '})\n\n';
+				text += 'function setLinks() {\n\n';
+				text += 'DHIS.getTable(' + JSON.stringify(ns.core.service.layout.layout2plugin(ns.app.layout, 'table1'), null, 2) + ');\n\n';
+				text += '}\n</script>\n</head>\n\n<body>\n';
+				text += '  <div id="table1"></div>\n';
+				text += '</body>\n</html>';
 
 				textArea = Ext.create('Ext.form.field.TextArea', {
-					width: 400,
-					height: 200,
+					width: 700,
+					height: 400,
 					readOnly: true,
 					cls: 'ns-textarea monospaced',
 					value: text
@@ -4818,12 +4838,6 @@
 					bbar: [
 						'->',
 						{
-							text: 'Format',
-							handler: function() {
-								textArea.setValue('DHIS.getTable(' + JSON.stringify(ns.core.service.layout.layout2plugin(ns.app.layout), null, 2) + ');');
-							}
-						},
-						{
 							text: 'Select',
 							handler: function() {
 								textArea.selectText();

=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2014-01-02 19:49:41 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2014-01-03 16:26:42 +0000
@@ -1517,12 +1517,16 @@
 				return layout.showHierarchy && Ext.isObject(response.metaData.ouHierarchy) && response.metaData.ouHierarchy.hasOwnProperty(id);
 			};
 
-			service.layout.layout2plugin = function(layout) {
+			service.layout.layout2plugin = function(layout, el) {
 				var layout = Ext.clone(layout),
 					dimensions = Ext.Array.clean([].concat(layout.columns || [], layout.rows || [], layout.filters || []));
 
 				layout.url = init.contextPath;
 
+				if (el) {
+					layout.el = el;
+				}
+
 				if (Ext.isString(layout.id)) {
 					return {id: layout.id};
 				}
@@ -1543,6 +1547,7 @@
 						delete item.code;
 						delete item.created;
 						delete item.lastUpdated;
+						delete item.value;
 					}
 				}