------------------------------------------------------------ revno: 860 committer: Lars Helge Ă˜verland <larshe...@gmail.com> branch nick: dhis2-docbook-docs timestamp: Tue 2013-11-12 12:50:21 +0100 message: Indentation in plugin docs modified: src/docbkx/en/dhis2_user_man_web_api.xml
-- lp:~dhis2-documenters/dhis2/dhis2-docbook-docs https://code.launchpad.net/~dhis2-documenters/dhis2/dhis2-docbook-docs Your team DHIS 2 developers is subscribed to branch lp:~dhis2-documenters/dhis2/dhis2-docbook-docs. To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-documenters/dhis2/dhis2-docbook-docs/+edit-subscription
=== modified file 'src/docbkx/en/dhis2_user_man_web_api.xml' --- src/docbkx/en/dhis2_user_man_web_api.xml 2013-11-12 08:46:58 +0000 +++ src/docbkx/en/dhis2_user_man_web_api.xml 2013-11-12 11:50:21 +0000 @@ -1097,39 +1097,34 @@ <title>Embedding pivot tables with the Pivot table plug-in</title> <para>In this example we will see how we can embed good-looking, light-weight html pivot tables with data served from a DHIS back-end into a Web page. To accomplish this we will use the Pivot table plug-in. The plug-in is written in Javascript and depends on the Ext JS library only. A complete working example can be found at <ulink url="http://apps.dhis2.org/portal/table.html"/>. Open the page in a web browser and view the source to see how it is set up.</para> <para>We start by including three files in the header section of the HTML document. The first two files are the Ext JS javascript library (we use the Google content delivery network in this case) and its css stylesheet. The third file is the Pivot table plug-in. Make sure the path is pointing to your DHIS server installation.</para> - <screen> <link rel="stylesheet" type="text/css" href="http://extjs-public.googlecode.com/ - svn/tags/extjs-4.0.7/release/resources/css/ext-plugin-gray.css" /> - - <script src="http://extjs-public.googlecode.com/svn/tags/extjs-4.0.7/release/ - ext-all.js"></script> - - <script src="http://apps.dhis2.org/demo/dhis-web-commons/javascripts/plugin/ - table.js"></script></screen> + <screen><link rel="stylesheet" type="text/css" href="http://extjs-public.googlecode.com/svn/tags/extjs-4.0.7/release/resources/css/ext-plugin-gray.css" /> +<script src="http://extjs-public.googlecode.com/svn/tags/extjs-4.0.7/release/ext-all.js"></script> +<script src="http://apps.dhis2.org/demo/dhis-web-commons/javascripts/plugin/table.js"></script></screen> <para>To authenticate with the DHIS server we use the same approach as in the previous section. In the header of the HTML document we include the following Javascript inside a script element. The <emphasis role="italic">setLinks</emphasis> method will be implemented later. Make sure the <emphasis role="italic">base</emphasis> variable is pointing to your DHIS installation.</para> - <screen> var base = "http://apps.dhis2.org/demo/"; + <screen>var base = "http://apps.dhis2.org/demo/"; - Ext.onReady( function() { - Ext.Ajax.request({ - url: base + "dhis-web-commons-security/login.action", - method: "POST", - params: { j_username: "portal", j_password: "Portal123" }, - success: setLinks - }); - });</screen> +Ext.onReady( function() { + Ext.Ajax.request({ + url: base + "dhis-web-commons-security/login.action", + method: "POST", + params: { j_username: "portal", j_password: "Portal123" }, + success: setLinks + }); +});</screen> <para>Now let us have a look at the various options for the Pivot table plug-in. Two properies are required: <emphasis role="italic">el</emphasis> and <emphasis role="italic">url</emphasis> (please refer to the table below). Now, if you want to refer to pre-defined tables already made inside DHIS it is sufficient to provide the additional <emphasis role="italic">id</emphasis> parameter. If you instead want to configure a pivot table dynamically you shoud omit the id parameter and provide data dimensions inside a <emphasis role="italic">columns</emphasis> array (chart series), a <emphasis role="italic">rows</emphasis> array (chart categories) and optionally a <emphasis role="italic">filters</emphasis> array instead.</para> <para>A data dimension is defined as an object with a text property called <emphasis role="italic">dimension</emphasis>. This property accepts the following values: <emphasis role="italic">in</emphasis> (indicator), <emphasis role="italic">de</emphasis> (data element), <emphasis role="italic">ds</emphasis> (data set), <emphasis role="italic">dc</emphasis> (data element operand), <emphasis role="italic">pe</emphasis> (period), <emphasis role="italic">ou</emphasis> (organisation unit) or the id of any organisation unit group set or data element group set (can be found in the web api). The data dimension also has an array property called <emphasis role="italic">items</emphasis> which accepts objects with an <emphasis role="italic">id</emphasis> property.</para> <para>To sum up, if you want to have e.g. "ANC 1 Coverage", "ANC 2 Coverage" and "ANC 3 Coverage" on the columns in your chart you can make the following <emphasis role="italic">columns</emphasis> config:</para> - <screen> columns: [{ - dimension: "in", // "in", "de", "ds", "dc", "pe", "ou" or any dimension id - items: [ - {id: "Uvn6LCg7dVU"}, // the id of ANC 1 Coverage - {id: "OdiHJayrsKo"}, // the id of ANC 2 Coverage - {id: "sB79w2hiLp8"} // the id of ANC 3 Coverage - ] - }]</screen> + <screen>columns: [{ + dimension: "in", // "in", "de", "ds", "dc", "pe", "ou" or any dimension id + items: [ + {id: "Uvn6LCg7dVU"}, // the id of ANC 1 Coverage + {id: "OdiHJayrsKo"}, // the id of ANC 2 Coverage + {id: "sB79w2hiLp8"} // the id of ANC 3 Coverage + ] +}]</screen> <table> <title>Pivot table plug-in configuration</title> @@ -1256,35 +1251,35 @@ </tgroup> </table> <para>We continue by adding one pre-defined and one dynamic pivot table to our HTML document. You can browse the list of available pivot tables using the Web API here: <ulink url="http://apps.dhis2.org/demo/api/reportTables"/>.</para> - <screen> function setLinks() { - DV.plugin.getTable({ url: base, el: 'chartA1', id: 'R0DVGvXDUNP' }); + <screen>function setLinks() { + DV.plugin.getTable({ url: base, el: 'chartA1', id: 'R0DVGvXDUNP' }); - DV.plugin.getTable({ - url: base, - el: 'chartB1', - type: 'stackedBar', - columns: [ - {dimension: 'de', items: [{id: 'YtbsuPPo010'}, {id: 'l6byfWFUGaP'}]} - ], - rows: [ - {dimension: 'pe', items: [{id: 'LAST_12_MONTHS'}]} - ], - filters: [ - {dimension: 'ou', items: [{id: 'USER_ORGUNIT'}]} - ], - //showTotals: false, - //showSubTotals: false, - //hideEmptyRows: true, - //showHierarchy: true, - //displayDensity: "comfortable", - //fontSize: "large", - //digitGroupSeparator: "comma", - //legendSet: {id: "BtxOoQuLyg1"} - }); - };</screen> + DV.plugin.getTable({ + url: base, + el: 'chartB1', + type: 'stackedBar', + columns: [ + {dimension: 'de', items: [{id: 'YtbsuPPo010'}, {id: 'l6byfWFUGaP'}]} + ], + rows: [ + {dimension: 'pe', items: [{id: 'LAST_12_MONTHS'}]} + ], + filters: [ + {dimension: 'ou', items: [{id: 'USER_ORGUNIT'}]} + ], + showTotals: false, // All following options are optional + showSubTotals: false, + hideEmptyRows: true, + showHierarchy: true, + displayDensity: "comfortable", + fontSize: "large", + digitGroupSeparator: "comma", + legendSet: {id: "BtxOoQuLyg1"} + }); +;</screen> <para>Finally we include some <emphasis role="italic">div</emphasis> elements in the body section of the HTML document with the identifiers referred to in the plug-in Javascript.</para> - <screen> <div id="tableA1" class="chart"></div> - <div id="tableB1" class="chart"></div></screen> + <screen><div id="tableA1" class="chart"></div> +<div id="tableB1" class="chart"></div></screen> <para>To see a complete working example please visit <ulink url="http://apps.dhis2.org/portal/table.html"/>.</para> </section> @@ -1302,39 +1297,34 @@ <title>Embedding charts with the Visualizer chart plug-in</title> <para>In this example we will see how we can embed good-looking Ext JS charts (<ulink url="http://www.sencha.com/products/extjs"/>) with data served from a DHIS back-end into a Web page. To accomplish this we will use the DHIS Visualizer plug-in. The plug-in is written in Javascript and depends on the Ext JS library only. A complete working example can be found at <ulink url="http://apps.dhis2.org/portal/chart.html"/>. Open the page in a web browser and view the source to see how it is set up.</para> <para>We start by including three files in the header section of the HTML document. The first two files are the Ext JS javascript library (we use the Google content delivery network in this case) and its stylesheet. The third file is the Visualizer plug-in. Make sure the path is pointing to your DHIS server installation.</para> - <screen> <link rel="stylesheet" type="text/css" href="http://extjs-public.googlecode.com/ - svn/tags/extjs-4.0.7/release/resources/css/ext-plugin-gray.css" /> - - <script src="http://extjs-public.googlecode.com/svn/tags/extjs-4.0.7/release/ - ext-all.js"></script> - - <script src="http://apps.dhis2.org/demo/dhis-web-commons/javascripts/plugin/ - table.js"></script></screen> + <screen><link rel="stylesheet" type="text/css" href="http://extjs-public.googlecode.com/svn/tags/extjs-4.0.7/release/resources/css/ext-plugin-gray.css" /> +<script src="http://extjs-public.googlecode.com/svn/tags/extjs-4.0.7/release/ext-all.js"></script> +<script src="http://apps.dhis2.org/demo/dhis-web-commons/javascripts/plugin/table.js"></script></screen> <para>To authenticate with the DHIS server we use the same approach as in the previous section. In the header of the HTML document we include the following Javascript inside a script element. The <emphasis role="italic">setLinks</emphasis> method will be implemented later. Make sure the <emphasis role="italic">base</emphasis> variable is pointing to your DHIS installation.</para> - <screen> var base = "http://apps.dhis2.org/demo/"; + <screen>var base = "http://apps.dhis2.org/demo/"; - Ext.onReady( function() { - Ext.Ajax.request({ - url: base + "dhis-web-commons-security/login.action", - method: "POST", - params: { j_username: "portal", j_password: "Portal123" }, - success: setLinks - }); - });</screen> +Ext.onReady( function() { + Ext.Ajax.request({ + url: base + "dhis-web-commons-security/login.action", + method: "POST", + params: { j_username: "portal", j_password: "Portal123" }, + success: setLinks + }); +});</screen> <para>Now let us have a look at the various options for the Visualizer plug-in. Two properies are required: <emphasis role="italic">el</emphasis> and <emphasis role="italic">url</emphasis> (please refer to the table below). Now, if you want to refer to pre-defined charts already made inside DHIS it is sufficient to provide the additional <emphasis role="italic">id</emphasis> parameter. If you instead want to configure a chart dynamically you shoud omit the id parameter and provide data dimensions inside a <emphasis role="italic">columns</emphasis> array (chart series), a <emphasis role="italic">rows</emphasis> array (chart categories) and optionally a <emphasis role="italic">filters</emphasis> array instead.</para> <para>A data dimension is defined as an object with a text property called <emphasis role="italic">dimension</emphasis>. This property accepts the following values: <emphasis role="italic">in</emphasis> (indicator), <emphasis role="italic">de</emphasis> (data element), <emphasis role="italic">ds</emphasis> (data set), <emphasis role="italic">dc</emphasis> (data element operand), <emphasis role="italic">pe</emphasis> (period), <emphasis role="italic">ou</emphasis> (organisation unit) or the id of any organisation unit group set or data element group set (can be found in the web api). The data dimension also has an array property called <emphasis role="italic">items</emphasis> which accepts objects with an <emphasis role="italic">id</emphasis> property.</para> <para>To sum up, if you want to have e.g. "ANC 1 Coverage", "ANC 2 Coverage" and "ANC 3 Coverage" as series in your chart you can make the following <emphasis role="italic">columns</emphasis> config:</para> - <screen> columns: [{ - dimension: "in", // could be "in", "de", "ds", "dc", "pe", "ou" or any dimension id - items: [ - {id: "Uvn6LCg7dVU"}, // the id of ANC 1 Coverage - {id: "OdiHJayrsKo"}, // the id of ANC 2 Coverage - {id: "sB79w2hiLp8"} // the id of ANC 3 Coverage - ] - }]</screen> + <screen>columns: [{ + dimension: "in", // could be "in", "de", "ds", "dc", "pe", "ou" or any dimension id + items: [ + {id: "Uvn6LCg7dVU"}, // the id of ANC 1 Coverage + {id: "OdiHJayrsKo"}, // the id of ANC 2 Coverage + {id: "sB79w2hiLp8"} // the id of ANC 3 Coverage + ] +}]</screen> <table> <title>Visualizer chart plug-in configuration</title> @@ -1496,35 +1486,35 @@ </tgroup> </table> <para>We continue by including two pre-defined charts and to dynamic charts to our HTML document. You can browse the list of available charts using the Web API here: <ulink url="http://apps.dhis2.org/demo/api/charts"/>.</para> - <screen> function setLinks() { - DV.plugin.getChart({ url: base, el: 'chartA1', id: 'R0DVGvXDUNP' }); + <screen>function setLinks() { + DV.plugin.getChart({ url: base, el: 'chartA1', id: 'R0DVGvXDUNP' }); - DV.plugin.getChart({ - url: base, - el: 'chartB1', - type: 'stackedBar', - columns: [ - {dimension: 'de', items: [{id: 'YtbsuPPo010'}, {id: 'l6byfWFUGaP'}, {id: 's46m5MS0hxu'}]} - ], - rows: [ - {dimension: 'pe', items: [{id: 'LAST_12_MONTHS'}]} - ], - filters: [ - {dimension: 'ou', items: [{id: 'USER_ORGUNIT'}]} - ], - showData: false, - //targetLineValue: 70, - //baseLineValue: 20, - //showTrendLine: true, - //hideLegend: true, - //title: 'My chart title', - //domainAxisTitle: 'Periods', - //rangeAxisTitle: 'Percent' - }); - };</screen> + DV.plugin.getChart({ + url: base, + el: 'chartB1', + type: 'stackedBar', + columns: [ + {dimension: 'de', items: [{id: 'YtbsuPPo010'}, {id: 'l6byfWFUGaP'}, {id: 's46m5MS0hxu'}]} + ], + rows: [ + {dimension: 'pe', items: [{id: 'LAST_12_MONTHS'}]} + ], + filters: [ + {dimension: 'ou', items: [{id: 'USER_ORGUNIT'}]} + ], + showData: false, // All following options are optional + targetLineValue: 70, + baseLineValue: 20, + showTrendLine: true, + hideLegend: true, + title: 'My chart title', + domainAxisTitle: 'Periods', + rangeAxisTitle: 'Percent' + }); +};</screen> <para>Finally we include some <emphasis role="italic">div</emphasis> elements in the body section of the HTML document with the identifiers referred to in the plug-in Javascript.</para> - <screen> <div id="chartA1" class="chart"></div> - <div id="chartB1" class="chart"></div> + <screen><div id="chartA1" class="chart"></div> +<div id="chartB1" class="chart"></div> </screen> <para>To see a complete working example please visit <ulink url="http://apps.dhis2.org/portal/chart.html"/>.</para> </section> @@ -1546,41 +1536,33 @@ <title>Embedding maps with the GIS map plug-in</title> <para>In this example we will see how we can embed maps with data served from a DHIS back-end into a Web page. To accomplish this we will use the GIS map plug-in. The plug-in is written in Javascript and depends on the Ext JS library only. A complete working example can be found at <ulink url="http://apps.dhis2.org/portal/map.html"/>. Open the page in a web browser and view the source to see how it is set up.</para> <para>We start by including four files and Google Maps in the header section of the HTML document. The first two files are the Ext JS javascript library (we use the Google content delivery network in this case) and its stylesheet. The third file is the OpenLayers javascript mapping framework (<ulink url="http://openlayers.org"/>) and finally we include the GIS map plug-in. Make sure the path is pointing to your DHIS server installation.</para> - <screen> <link rel="stylesheet" type="text/css" href="http://extjs-public.googlecode.com/ - svn/tags/extjs-4.0.7/release/resources/css/ext-plugin-gray.css" /> - - <script src="http://extjs-public.googlecode.com/svn/tags/extjs-4.0.7/release/ - ext-all.js"></script> - - <script src="https://maps.google.com/maps/api/js?sensor=false"></script> - - <script src="http://apps.dhis2.org/demo/dhis-web-commons/javascripts/openlayers/ - OpenLayers.js"></script> - - <script src="http://apps.dhis2.org/demo/dhis-web-commons/javascripts/plugin/ - map.js"></script></screen> + <screen><link rel="stylesheet" type="text/css" href="http://extjs-public.googlecode.com/svn/tags/extjs-4.0.7/release/resources/css/ext-plugin-gray.css" /> +<script src="http://extjs-public.googlecode.com/svn/tags/extjs-4.0.7/release/ext-all.js"></script> +<script src="https://maps.google.com/maps/api/js?sensor=false"></script> +<script src="http://apps.dhis2.org/demo/dhis-web-commons/javascripts/openlayers/OpenLayers.js"></script> +<script src="http://apps.dhis2.org/demo/dhis-web-commons/javascripts/plugin/map.js"></script></screen> <para>To authenticate with the DHIS server we use the same approach as in the previous section. In the header of the HTML document we include the following Javascript inside a script element. The <emphasis role="italic">setLinks</emphasis> method will be implemented later. Make sure the <emphasis role="italic">base</emphasis> variable is pointing to your DHIS installation.</para> - <screen> var base = "http://apps.dhis2.org/demo/"; + <screen>var base = "http://apps.dhis2.org/demo/"; - Ext.onReady( function() { - Ext.Ajax.request({ - url: base + "dhis-web-commons-security/login.action", - method: "POST", - params: { j_username: "portal", j_password: "Portal123" }, - success: setLinks - }); - });</screen> +Ext.onReady( function() { + Ext.Ajax.request({ + url: base + "dhis-web-commons-security/login.action", + method: "POST", + params: { j_username: "portal", j_password: "Portal123" }, + success: setLinks + }); +});</screen> <para>Now let us have a look at the various options for the GIS plug-in. Two properies are required: <emphasis role="italic">el</emphasis> and <emphasis role="italic">url</emphasis> (please refer to the table below). Now, if you want to refer to pre-defined charts already made inside DHIS it is sufficient to provide the additional <emphasis role="italic">id</emphasis> parameter. If you instead want to configure a chart dynamically you shoud omit the id parameter and provide <emphasis role="italic">mapViews</emphasis> (layers) instead. They should be configured with data dimensions inside a <emphasis role="italic">columns</emphasis> array (chart series), a <emphasis role="italic">rows</emphasis> array (chart categories) and optionally a <emphasis role="italic">filters</emphasis> array instead.</para> <para>A data dimension is defined as an object with a text property called <emphasis role="italic">dimension</emphasis>. This property accepts the following values: <emphasis role="italic">in</emphasis> (indicator), <emphasis role="italic">de</emphasis> (data element), <emphasis role="italic">ds</emphasis> (data set), <emphasis role="italic">dc</emphasis> (data element operand), <emphasis role="italic">pe</emphasis> (period), <emphasis role="italic">ou</emphasis> (organisation unit) or the id of any organisation unit group set or data element group set (can be found in the web api). The data dimension also has an array property called <emphasis role="italic">items</emphasis> which accepts objects with an <emphasis role="italic">id</emphasis> property.</para> <para>To sum up, if you want to have a layer with e.g. "ANC 1 Coverage" in your map you can make the following <emphasis role="italic">columns</emphasis> config:</para> - <screen> columns: [{ - dimension: "in", // could be "in", "de", "ds", "dc", "pe", "ou" or any dimension id - items: [{id: "Uvn6LCg7dVU"}], // the id of ANC 1 Coverage - }]</screen> + <screen>columns: [{ + dimension: "in", // could be "in", "de", "ds", "dc", "pe", "ou" or any dimension id + items: [{id: "Uvn6LCg7dVU"}], // the id of ANC 1 Coverage +}]</screen> <table> <title>Visualizer chart plug-in configuration</title> @@ -1745,35 +1727,35 @@ </tgroup> </table> <para>We continue by adding one pre-defined and one dynamically configured map to our HTML document. You can browse the list of available maps using the Web API here: <ulink url="http://apps.dhis2.org/demo/api/maps"/>.</para> - <screen> function setLinks() { - Ext.onReady(function() { - var url = "http://apps.dhis2.org/demo/"; - - GIS.plugin.getMap({ - url: url, - el: "mapA1", - id: "ytkZY3ChM6J" - }); - - GIS.plugin.getMap({ - url: url, - el: "mapB1", - mapViews: [{ - columns: [{dimension: 'in', items: [{id: 'Uvn6LCg7dVU'}]}], // data - rows: [{dimension: 'ou', items: [{id: 'LEVEL-3'}, {id: 'ImspTQPwCqd'}]}], // organisation units - filters: [{dimension: 'pe', items: [{id: 'LAST_3_MONTHS'}]}], // period - classes: 7, - colorLow: '02079c', - colorHigh: 'e5ecff', - opacity: 0.9 - //legendSet: {id: 'fqs276KXCXi'} - }] - }); - }); - };</screen> + <screen>function setLinks() { + Ext.onReady(function() { + var url = "http://apps.dhis2.org/demo/"; + + GIS.plugin.getMap({ + url: url, + el: "mapA1", + id: "ytkZY3ChM6J" + }); + + GIS.plugin.getMap({ + url: url, + el: "mapB1", + mapViews: [{ + columns: [{dimension: 'in', items: [{id: 'Uvn6LCg7dVU'}]}], // data + rows: [{dimension: 'ou', items: [{id: 'LEVEL-3'}, {id: 'ImspTQPwCqd'}]}], // organisation units + filters: [{dimension: 'pe', items: [{id: 'LAST_3_MONTHS'}]}], // period + classes: 7, + colorLow: '02079c', + colorHigh: 'e5ecff', + opacity: 0.9 + legendSet: {id: 'fqs276KXCXi'} // Optional + }] + }); +}); +};</screen> <para>Finally we include some <emphasis role="italic">div</emphasis> elements in the body section of the HTML document with the identifiers referred to in the plug-in Javascript.</para> - <screen> <div id="mapA1" class="chart"></div> - <div id="mapB1" class="chart"></div> + <screen><div id="mapA1" class="chart"></div> +<div id="mapB1" class="chart"></div> </screen> <para>To see a complete working example please visit <ulink url="http://apps.dhis2.org/portal/map.html"/>.</para> </section>
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp