=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties 2013-09-20 13:43:24 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties 2013-09-30 12:20:27 +0000 @@ -387,4 +387,5 @@ user_organisation_units=User organisation units dataset=Data set select_all_children=Select all children -select_groupset = Select group set \ No newline at end of file +select_groupset = Select group set +allow_external_access=Allow external access \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module_fr.properties' --- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module_fr.properties 2013-07-02 15:58:13 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module_fr.properties 2013-09-30 12:20:27 +0000 @@ -361,3 +361,4 @@ assign=Assigner add_new=Ajouter nouvelle select_outer_boundary=Choisir les frontieres +allow_external_access=Permettre l'acc\u00E8s externe \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2013-09-24 16:41:42 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2013-09-30 12:45:28 +0000 @@ -295,6 +295,65 @@ w.hasDestroyOnBlurHandler = true; }; + + util.gui.window.setAnchorPosition = function(w, target) { + var vpw = gis.viewport.getWidth(), + targetx = target ? target.getPosition()[0] : 4, + winw = w.getWidth(), + y = target ? target.getPosition()[1] + target.getHeight() + 4 : 33; + + if ((targetx + winw) > vpw) { + w.setPosition((vpw - winw - 2), y); + } + else { + w.setPosition(targetx, y); + } + }; + + util.layout = {}; + + util.layout.getAnalytical = function(map) { + var layout, + id; + + map = map || gis.map; + + if (!(Ext.isObject(map) && Ext.isArray(map.mapViews) && map.mapViews.length)) { + return; + } + + for (var key in gis.layer) { + if (gis.layer.hasOwnProperty(key) && gis.layer[key].layerCategory === gis.conf.finals.layer.category_thematic) { + id = gis.layer[key].id; + + for (var j = 0, view; j < map.mapViews.length; j++) { + view = map.mapViews[j]; + + if (view.layer === id) { + layout = gis.api.layout.Layout(Ext.clone(view)); + + if (layout) { + return layout; + } + } + } + } + } + + return; + }; + + util.layout.setSessionStorage = function(obj, session, url) { + if (GIS.isSessionStorage) { + var dhis2 = JSON.parse(sessionStorage.getItem('dhis2')) || {}; + dhis2[session] = obj; + sessionStorage.setItem('dhis2', JSON.stringify(dhis2)); + + if (Ext.isString(url)) { + window.location.href = url; + } + } + }; }()); // init @@ -657,7 +716,7 @@ bodyStyle: 'padding-top: 4px' }, { - width: 104, + width: 106, html: this.text, bodyStyle: 'padding-top: 4px' }, @@ -912,6 +971,7 @@ imageUrl: 'images/' + layer.id + '_14.png', value: layer.id === visibleLayer.id && window.google ? true : false, opacity: layer.layerOpacity, + defaultOpacity: layer.layerOpacity, numberFieldDisabled: layer.id !== visibleLayer.id }); @@ -1503,6 +1563,7 @@ userGroupField, userGroupButton, userGroupRowContainer, + externalAccess, publicGroup, window; @@ -1598,6 +1659,7 @@ id: sharing.object.id, name: sharing.object.name, publicAccess: publicGroup.down('combobox').getValue(), + externalAccess: externalAccess ? externalAccess.getValue() : false, user: { id: gis.init.user.id, name: gis.init.user.name @@ -1673,6 +1735,16 @@ userGroupRowContainer = Ext.create('Ext.container.Container', { bodyStyle: 'border:0 none' }); + + if (sharing.meta.allowExternalAccess) { + externalAccess = userGroupRowContainer.add({ + xtype: 'checkbox', + fieldLabel: GIS.i18n.allow_external_access, + labelSeparator: '', + labelWidth: 250, + checked: !!sharing.object.externalAccess + }); + } publicGroup = userGroupRowContainer.add(UserGroupRow({ id: sharing.object.id, @@ -1689,8 +1761,7 @@ window = Ext.create('Ext.window.Window', { title: 'Sharing settings', - bodyStyle: 'padding:8px 8px 3px; background-color:#fff', - width: 434, + bodyStyle: 'padding:6px 6px 0; background-color:#fff', resizable: false, modal: true, destroyOnBlur: true, @@ -5785,7 +5856,7 @@ } // Item - layer.item.setValue(false); + layer.item.setValue(false, layer.item.defaultOpacity); }; setGui = function(view) { @@ -5960,6 +6031,7 @@ eastRegion, downloadButton, interpretationButton, + defaultButton, layersPanel, resizeButton, viewport, @@ -5973,6 +6045,18 @@ } }); + defaultButton = Ext.create('Ext.button.Button', { + text: GIS.i18n.map, + iconCls: 'gis-button-icon-table', + toggleGroup: 'module', + pressed: true, + handler: function() { + if (!this.pressed) { + this.toggle(); + } + } + }); + centerRegion = new GeoExt.panel.Map({ region: 'center', map: gis.olmap, @@ -6102,8 +6186,55 @@ text: GIS.i18n.table, iconCls: 'gis-button-icon-table', toggleGroup: 'module', + menu: {}, handler: function(b) { - window.location.href = '../../dhis-web-pivot/app/index.html'; + b.menu = Ext.create('Ext.menu.Menu', { + closeAction: 'destroy', + shadow: false, + showSeparator: false, + items: [ + { + text: 'Go to pivot tables' + '  ', //i18n + cls: 'gis-menu-item-noicon', + handler: function() { + window.location.href = gis.init.contextPath + '/dhis-web-pivot/app/index.html'; + } + }, + '-', + { + text: 'Open this map as table' + '  ', //i18n + cls: 'gis-menu-item-noicon', + disabled: !GIS.isSessionStorage || !gis.util.layout.getAnalytical(), + handler: function() { + if (GIS.isSessionStorage) { + gis.util.layout.setSessionStorage(gis.util.layout.getAnalytical(), 'analytical', gis.init.contextPath + '/dhis-web-pivot/app/index.html?s=analytical'); + } + } + }, + { + text: 'Open last table' + '  ', //i18n + cls: 'gis-menu-item-noicon', + disabled: !(GIS.isSessionStorage && JSON.parse(sessionStorage.getItem('dhis2')) && JSON.parse(sessionStorage.getItem('dhis2'))['chart']), + handler: function() { + window.location.href = gis.init.contextPath + '/dhis-web-pivot/app/index.html?s=chart'; + } + } + ], + listeners: { + show: function() { + gis.util.gui.window.setAnchorPosition(b.menu, b); + }, + hide: function() { + b.menu.destroy(); + defaultButton.toggle(); + }, + destroy: function(m) { + b.menu = null; + } + } + }); + + b.menu.show(); } }); @@ -6111,17 +6242,59 @@ text: GIS.i18n.chart, iconCls: 'gis-button-icon-chart', toggleGroup: 'module', + menu: {}, handler: function(b) { - window.location.href = '../../dhis-web-visualizer/app/index.html'; + b.menu = Ext.create('Ext.menu.Menu', { + closeAction: 'destroy', + shadow: false, + showSeparator: false, + items: [ + { + text: 'Go to charts' + '  ', //i18n + cls: 'gis-menu-item-noicon', + handler: function() { + window.location.href = gis.init.contextPath + '/dhis-web-visualizer/app/index.html'; + } + }, + '-', + { + text: 'Open this map as chart' + '  ', //i18n + cls: 'gis-menu-item-noicon', + disabled: !GIS.isSessionStorage || !gis.util.layout.getAnalytical(), + handler: function() { + if (GIS.isSessionStorage) { + gis.util.layout.setSessionStorage(gis.util.layout.getAnalytical(), 'analytical', gis.init.contextPath + '/dhis-web-visualizer/app/index.html?s=analytical'); + } + } + }, + { + text: 'Open last chart' + '  ', //i18n + cls: 'gis-menu-item-noicon', + disabled: !(GIS.isSessionStorage && JSON.parse(sessionStorage.getItem('dhis2')) && JSON.parse(sessionStorage.getItem('dhis2'))['chart']), + handler: function() { + window.location.href = gis.init.contextPath + '/dhis-web-visualizer/app/index.html?s=chart'; + } + } + ], + listeners: { + show: function() { + gis.util.gui.window.setAnchorPosition(b.menu, b); + }, + hide: function() { + b.menu.destroy(); + defaultButton.toggle(); + }, + destroy: function(m) { + b.menu = null; + } + } + }); + + b.menu.show(); } }); - a.push({ - text: GIS.i18n.map, - iconCls: 'gis-button-icon-map', - toggleGroup: 'module', - pressed: true - }); + a.push(defaultButton); a.push({ xtype: 'tbseparator', @@ -6158,7 +6331,8 @@ a.push({ title: GIS.i18n.layer_stack_transparency, - bodyStyle: 'padding: 3px 2px 2px 5px', + bodyStyle: 'padding: 3px 2px 2px 5px; border:0 none; border-bottom: 1px solid #d0d0d0; border-top: 1px solid #d0d0d0', + style: 'border:0 none', items: layersPanel, collapsible: true, animCollapse: false @@ -6166,7 +6340,7 @@ a.push({ title: GIS.i18n.facility_layer_legend, - bodyStyle: 'padding: 4px 6px 6px; border: 0 none', + bodyStyle: 'padding: 5px 6px 3px; border: 0 none; border-bottom: 1px solid #d0d0d0; border-top: 1px solid #d0d0d0', collapsible: true, collapsed: true, animCollapse: false, @@ -6179,7 +6353,7 @@ a.push({ title: GIS.i18n.thematic_layer_1_legend, - bodyStyle: 'padding: 4px 6px 6px; border: 0 none', + bodyStyle: 'padding: 4px 6px 6px; border: 0 none; border-bottom: 1px solid #d0d0d0; border-top: 1px solid #d0d0d0', collapsible: true, collapsed: true, animCollapse: false, @@ -6192,7 +6366,7 @@ a.push({ title: GIS.i18n.thematic_layer_2_legend, - bodyStyle: 'padding: 4px 6px 6px; border: 0 none', + bodyStyle: 'padding: 4px 6px 6px; border: 0 none; border-bottom: 1px solid #d0d0d0; border-top: 1px solid #d0d0d0', collapsible: true, collapsed: true, animCollapse: false, @@ -6205,7 +6379,7 @@ a.push({ title: GIS.i18n.thematic_layer_3_legend, - bodyStyle: 'padding: 4px 6px 6px; border: 0 none', + bodyStyle: 'padding: 4px 6px 6px; border: 0 none; border-bottom: 1px solid #d0d0d0', collapsible: true, collapsed: true, animCollapse: false, @@ -6280,7 +6454,9 @@ // Favorite var id = gis.util.url.getUrlParam('id'), - base = gis.util.url.getUrlParam('base'); + session = gis.util.url.getUrlParam('s'), + base = gis.util.url.getUrlParam('base'), + layout; if (id) { gis.map = { @@ -6288,6 +6464,13 @@ }; GIS.core.MapLoader(gis).load(); } + else if (Ext.isString(session) && GIS.isSessionStorage && Ext.isObject(JSON.parse(sessionStorage.getItem('dhis2'))) && session in JSON.parse(sessionStorage.getItem('dhis2'))) { + layout = gis.api.layout.Layout(JSON.parse(sessionStorage.getItem('dhis2'))[session]); + + if (layout) { + GIS.core.MapLoader(gis).load([layout]); + } + } if (base.length) { === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js 2013-09-24 16:18:10 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js 2013-09-26 13:35:07 +0000 @@ -106,7 +106,8 @@ GIS.core.getLayers = function(gis) { var layers = {}, - createSelectionHandlers; + createSelectionHandlers, + layerNumbers = ['1', '2', '3', '4']; if (window.google) { layers.googleStreets = new OpenLayers.Layer.Google('Google Streets', { @@ -151,7 +152,7 @@ }); layers.openStreetMap.id = 'openStreetMap'; - layers.facility = GIS.core.VectorLayer(gis, 'facility', GIS.i18n.facility_layer, {opacity: 0.8}); + layers.facility = GIS.core.VectorLayer(gis, 'facility', GIS.i18n.facility_layer, {opacity: 1}); layers.facility.core = new mapfish.GeoStat.Facility(gis.olmap, { layer: layers.facility, gis: gis @@ -162,30 +163,17 @@ layer: layers.boundary, gis: gis }); - - layers.thematic1 = GIS.core.VectorLayer(gis, 'thematic1', GIS.i18n.thematic_layer + ' 1', {opacity: 0.8}); - layers.thematic1.core = new mapfish.GeoStat.Thematic1(gis.olmap, { - layer: layers.thematic1, - gis: gis - }); - - layers.thematic2 = GIS.core.VectorLayer(gis, 'thematic2', GIS.i18n.thematic_layer + ' 2', {opacity: 0.8}); - layers.thematic2.core = new mapfish.GeoStat.Thematic2(gis.olmap, { - layer: layers.thematic2, - gis: gis - }); - - layers.thematic3 = GIS.core.VectorLayer(gis, 'thematic3', GIS.i18n.thematic_layer + ' 3', {opacity: 0.8}); - layers.thematic3.core = new mapfish.GeoStat.Thematic3(gis.olmap, { - layer: layers.thematic3, - gis: gis - }); - - layers.thematic4 = GIS.core.VectorLayer(gis, 'thematic4', GIS.i18n.thematic_layer + ' 4', {opacity: 0.8}); - layers.thematic4.core = new mapfish.GeoStat.Thematic4(gis.olmap, { - layer: layers.thematic4, - gis: gis - }); + + for (var i = 0, number; i < layerNumbers.length; i++) { + number = layerNumbers[i]; + + layers['thematic' + number] = GIS.core.VectorLayer(gis, 'thematic' + number, GIS.i18n.thematic_layer + ' ' + number, {opacity: 0.8}); + layers['thematic' + number].layerCategory = gis.conf.finals.layer.category_thematic, + layers['thematic' + number].core = new mapfish.GeoStat['Thematic' + number](gis.olmap, { + layer: layers['thematic' + number], + gis: gis + }); + } return layers; }; @@ -768,7 +756,7 @@ return; } - if (gis.viewport.favoriteWindow && gis.viewport.favoriteWindow.isVisible()) { + if (gis.viewport && gis.viewport.favoriteWindow && gis.viewport.favoriteWindow.isVisible()) { gis.viewport.favoriteWindow.destroy(); } @@ -815,13 +803,19 @@ }; loader = { - load: function() { + load: function(views) { gis.olmap.mask.show(); - - if (gis.map.id) { + + if (gis.map && gis.map.id) { getMap(); } else { + if (views) { + gis.map = { + mapViews: views + }; + } + setMap(); } } @@ -1688,7 +1682,8 @@ }, layer: { type_base: 'base', - type_vector: 'vector' + type_vector: 'vector', + category_thematic: 'thematic' }, dimension: { data: { @@ -1947,9 +1942,11 @@ // api (function() { + var dimConf = gis.conf.finals.dimension; + api.layout = {}; api.response = {}; - + api.layout.Record = function(config) { var record = {}; @@ -2074,80 +2071,39 @@ return dimensionArray.length ? dimensionArray : null; }; - validateSpecialCases = function() { - var dimConf = conf.finals.dimension, - dimensions, - objectNameDimensionMap = {}; - - if (!layout) { - return; - } - - dimensions = Ext.Array.clean([].concat(layout.columns, layout.rows, layout.filters)); - - for (var i = 0; i < dimensions.length; i++) { - objectNameDimensionMap[dimensions[i].dimension] = dimensions[i]; - } - - if (layout.filters && layout.filters.length) { - for (var i = 0; i < layout.filters.length; i++) { - - // Indicators as filter - if (layout.filters[i].dimension === dimConf.indicator.objectName) { - util.message.alert(GIS.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter'); - return; - } - - // Categories as filter - if (layout.filters[i].dimension === dimConf.category.objectName) { - util.message.alert(GIS.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter'); - return; - } - - // Data sets as filter - if (layout.filters[i].dimension === dimConf.dataSet.objectName) { - util.message.alert(GIS.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter'); - return; - } - } - } - - // dc and in - if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.indicator.objectName]) { - util.message.alert('Indicators and detailed data elements cannot be specified together'); - return; - } - - // dc and de - if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataElement.objectName]) { - util.message.alert('Detailed data elements and totals cannot be specified together'); - return; - } - - // dc and ds - if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataSet.objectName]) { - util.message.alert('Data sets and detailed data elements cannot be specified together'); - return; - } - - // dc and co - if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.category.objectName]) { - util.message.alert('Categories and detailed data elements cannot be specified together'); - return; - } - - // Degs and datasets in the same query - //if (Ext.Array.contains(dimensionNames, dimConf.data.dimensionName) && store.dataSetSelected.data.length) { - //for (var i = 0; i < init.degs.length; i++) { - //if (Ext.Array.contains(dimensionNames, init.degs[i].id)) { - //alert(GIS.i18n.data_element_group_sets_cannot_be_specified_together_with_data_sets); - //return; - //} - //} - //} - - return true; - }; + validateSpecialCases = function(config) { + var dimensions = [].concat(config.columns || [], config.rows || [], config.filters || []), + dxDim, + peDim, + ouDim; + + for (var i = 0, dim; i < dimensions.length; i++) { + dim = dimensions[i]; + + if (dim.dimension === dimConf.indicator.objectName || + dim.dimension === dimConf.dataElement.objectName || + dim.dimension === dimConf.operand.objectName || + dim.dimension === dimConf.dataSet.objectName) { + dxDim = dim; + } + else if (dim.dimension === dimConf.period.objectName) { + peDim = dim; + } + else if (dim.dimension === dimConf.organisationUnit.objectName) { + ouDim = dim; + } + } + + if (!(dxDim && peDim && ouDim)) { + return; + } + + config.columns = [dxDim]; + config.rows = [ouDim]; + config.filters = [peDim]; + + return config; + }; return function() { var a = [], @@ -2160,24 +2116,12 @@ config.columns = getValidatedDimensionArray(config.columns); config.rows = getValidatedDimensionArray(config.rows); config.filters = getValidatedDimensionArray(config.filters); + + config = validateSpecialCases(config); // Config must be an object if (!(config && Ext.isObject(config))) { - alert(init.el + ': Layout config is not an object'); - return; - } - - // Columns, rows, filter - if (!config.columns) { - alert('No data specified'); - return; - } - if (!config.rows) { - alert('No organisation units specified'); - return; - } - if (!config.filters) { - alert('No periods specified'); + alert(init.el + ': Data, period and organisation unit dimensions required'); return; } @@ -2228,7 +2172,7 @@ layout.colorHigh = Ext.isString(config.colorHigh) && !Ext.isEmpty(config.colorHigh) ? config.colorHigh : '00ff00'; layout.radiusLow = Ext.isNumber(config.radiusLow) && !Ext.isEmpty(config.radiusLow) ? config.radiusLow : 5; layout.radiusHigh = Ext.isNumber(config.radiusHigh) && !Ext.isEmpty(config.radiusHigh) ? config.radiusHigh : 15; - layout.opacity = Ext.isNumber(config.opacity) && !Ext.isEmpty(config.opacity) ? config.opacity : 80; + layout.opacity = Ext.isNumber(config.opacity) && !Ext.isEmpty(config.opacity) ? config.opacity : 0.8; layout.userOrganisationUnit = isOu; layout.userOrganisationUnitChildren = isOuc; @@ -2238,10 +2182,6 @@ layout.legendSet = config.legendSet; - if (!validateSpecialCases()) { - return; - } - return Ext.clone(layout); }(); }; @@ -2340,6 +2280,7 @@ gis.olmap = GIS.core.getOLMap(gis); gis.layer = GIS.core.getLayers(gis); + gis.thematicLayers = [gis.layer.thematic1, gis.layer.thematic2, gis.layer.thematic3, gis.layer.thematic4]; if (window.google) { layers.push(gis.layer.googleStreets, gis.layer.googleHybrid); === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/all.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/all.js 2013-09-23 13:31:48 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/all.js 2013-09-25 13:17:00 +0000 @@ -304,32 +304,20 @@ child = document.createElement("div"), items = this.gis.store.groupsByGroupSet.data.items; - //child.style.height = "14px"; - //child.style.overflow = "hidden"; - //child.title = config.where; - //child.innerHTML = config.where; - //element.appendChild(child); - - //child = document.createElement("div"); - //child.style.clear = "left"; - //element.appendChild(child); - - //child = document.createElement("div"); - //child.style.width = "1px"; - //child.style.height = "5px"; - //element.appendChild(child); - for (var i = 0; i < items.length; i++) { child = document.createElement("div"); child.style.backgroundImage = 'url(../../images/orgunitgroup/' + items[i].data.symbol + ')'; child.style.backgroundRepeat = 'no-repeat'; child.style.width = "21px"; - child.style.height = "18px"; + child.style.height = "16px"; + child.style.marginBottom = "2px"; child.style.cssFloat = "left"; element.appendChild(child); child = document.createElement("div"); child.innerHTML = items[i].data.name; + child.style.height = "16px"; + child.style.lineHeight = "17px"; element.appendChild(child); child = document.createElement("div"); === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css 2013-09-24 13:48:21 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css 2013-09-25 13:07:30 +0000 @@ -299,6 +299,7 @@ .x-panel-header { /* Panel header */ height: 30px; padding: 7px 4px 4px 7px; + border: 0 none; } === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm 2013-09-20 13:43:24 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm 2013-09-30 12:20:27 +0000 @@ -411,6 +411,7 @@ user_organisation_units: '$encoder.jsEscape($i18n.getString( 'user_organisation_units' ) , "'")', dataset: '$encoder.jsEscape($i18n.getString( 'dataset' ) , "'")', select_all_children: '$encoder.jsEscape($i18n.getString( 'select_all_children' ) , "'")', - select_groupset: '$encoder.jsEscape($i18n.getString( 'select_groupset' ) , "'")' + select_groupset: '$encoder.jsEscape($i18n.getString( 'select_groupset' ) , "'")', + allow_external_access: '$encoder.jsEscape($i18n.getString( 'allow_external_access' ) , "'")' }; \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties 2013-08-15 11:35:41 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties 2013-09-30 12:20:27 +0000 @@ -129,4 +129,5 @@ totals=Totals details=Details select_boundaries_and_groups=Select boundaries and groups -select_organisation_unit_groups=Select organisation unit groups \ No newline at end of file +select_organisation_unit_groups=Select organisation unit groups +allow_external_access=Allow external access \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module_fr.properties' --- dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module_fr.properties 2013-07-02 15:58:13 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module_fr.properties 2013-09-30 12:20:27 +0000 @@ -121,4 +121,5 @@ select_boundaries_and_level=S\u00E9lectionner limites et le niveau select_organisation_unit_level=S\u00E9lectionner le niveau de l'unit\u00E9 d'organisation details=D\u00E9tails -totals=Totaux \ No newline at end of file +totals=Totaux +allow_external_access=Permettre l'acc\u00E8s externe \ No newline at end of file === 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 2013-09-16 10:14:59 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2013-09-30 12:45:28 +0000 @@ -1822,6 +1822,7 @@ userGroupField, userGroupButton, userGroupRowContainer, + externalAccess, publicGroup, window; @@ -1917,6 +1918,7 @@ id: sharing.object.id, name: sharing.object.name, publicAccess: publicGroup.down('combobox').getValue(), + externalAccess: externalAccess ? externalAccess.getValue() : false, user: { id: pt.init.user.id, name: pt.init.user.name @@ -1992,6 +1994,16 @@ userGroupRowContainer = Ext.create('Ext.container.Container', { bodyStyle: 'border:0 none' }); + + if (sharing.meta.allowExternalAccess) { + externalAccess = userGroupRowContainer.add({ + xtype: 'checkbox', + fieldLabel: PT.i18n.allow_external_access, + labelSeparator: '', + labelWidth: 250, + checked: !!sharing.object.externalAccess + }); + } publicGroup = userGroupRowContainer.add(UserGroupRow({ id: sharing.object.id, @@ -2009,7 +2021,6 @@ window = Ext.create('Ext.window.Window', { title: PT.i18n.sharing_settings, bodyStyle: 'padding:6px 6px 0px; background-color:#fff', - width: 434, resizable: false, modal: true, destroyOnBlur: true, @@ -3353,55 +3364,48 @@ } }, multipleExpand: function(id, path, doUpdate) { - this.expandPath('/' + pt.conf.finals.root.id + path, 'id', '/', function() { + var rootId = pt.conf.finals.root.id; + + if (path.substr(0, rootId.length + 1) !== ('/' + rootId)) { + path = '/' + rootId + path; + } + + this.expandPath('/' + path, 'id', '/', function() { var record = this.getRootNode().findChild('id', id, true); this.recordsToSelect.push(record); this.multipleSelectIf(doUpdate); }, this); }, - select: function(url, params) { - if (!params) { - params = {}; - } - Ext.Ajax.request({ - url: url, - method: 'GET', - params: params, - scope: this, - success: function(r) { - var a = Ext.decode(r.responseText).organisationUnits; - this.numberOfRecords = a.length; - for (var i = 0; i < a.length; i++) { - this.multipleExpand(a[i].id, a[i].path); - } - } - }); - }, - selectByGroup: function(id) { - if (id) { - var url = pt.init.contextPath + pt.conf.finals.url.path_module + pt.conf.finals.url.organisationunit_getbygroup, - params = {id: id}; - this.select(url, params); - } - }, - selectByLevel: function(level) { - if (level) { - var url = pt.init.contextPath + pt.conf.finals.url.path_module + pt.conf.finals.url.organisationunit_getbylevel, - params = {level: level}; - this.select(url, params); - } - }, - selectByIds: function(ids) { - if (ids) { - var url = pt.init.contextPath + pt.conf.finals.url.path_module + pt.conf.finals.url.organisationunit_getbyids; - Ext.Array.each(ids, function(item) { - url = Ext.String.urlAppend(url, 'ids=' + item); - }); - if (!this.rendered) { - pt.cmp.dimension.organisationUnit.panel.expand(); - } - this.select(url); - } + select: function(url, params) { + if (!params) { + params = {}; + } + Ext.Ajax.request({ + url: url, + method: 'GET', + params: params, + scope: this, + success: function(r) { + var a = Ext.decode(r.responseText).organisationUnits; + this.numberOfRecords = a.length; + for (var i = 0; i < a.length; i++) { + this.multipleExpand(a[i].id, a[i].path); + } + } + }); + }, + getParentGraphMap: function() { + var selection = this.getSelectionModel().getSelection(), + map = {}; + + if (Ext.isArray(selection) && selection.length) { + for (var i = 0, pathArray, key; i < selection.length; i++) { + pathArray = selection[i].getPath().split('/'); + map[pathArray.pop()] = pathArray.join('/'); + } + } + + return map; }, store: Ext.create('Ext.data.TreeStore', { proxy: { @@ -4279,17 +4283,18 @@ }, '-', { - text: 'View table as chart' + '  ', //i18n + text: 'Open this table as chart' + '  ', //i18n cls: 'pt-menu-item-noicon', disabled: !PT.isSessionStorage || !pt.layout, handler: function() { if (PT.isSessionStorage) { + pt.layout.parentGraphMap = treePanel.getParentGraphMap(); pt.engine.setSessionStorage(pt.layout, 'analytical', pt.init.contextPath + '/dhis-web-visualizer/app/index.html?s=analytical'); } } }, { - text: 'View last chart' + '  ', //i18n + text: 'Open last chart' + '  ', //i18n cls: 'pt-menu-item-noicon', disabled: !(PT.isSessionStorage && JSON.parse(sessionStorage.getItem('dhis2')) && JSON.parse(sessionStorage.getItem('dhis2'))['chart']), handler: function() { @@ -4318,9 +4323,55 @@ text: PT.i18n.map, iconCls: 'pt-button-icon-map', toggleGroup: 'module', - //menu: {}, + menu: {}, handler: function(b) { - window.location.href = pt.init.contextPath + '/dhis-web-mapping/app/index.html'; + b.menu = Ext.create('Ext.menu.Menu', { + closeAction: 'destroy', + shadow: false, + showSeparator: false, + items: [ + { + text: 'Go to maps' + '  ', //i18n + cls: 'pt-menu-item-noicon', + handler: function() { + window.location.href = pt.init.contextPath + '/dhis-web-mapping/app/index.html'; + } + }, + '-', + { + text: 'Open this table as map' + '  ', //i18n + cls: 'pt-menu-item-noicon', + disabled: !PT.isSessionStorage || !pt.layout, + handler: function() { + if (PT.isSessionStorage) { + pt.engine.setSessionStorage(pt.layout, 'analytical', pt.init.contextPath + '/dhis-web-mapping/app/index.html?s=analytical'); + } + } + }, + { + text: 'Open last chart' + '  ', //i18n + cls: 'pt-menu-item-noicon', + disabled: !(PT.isSessionStorage && JSON.parse(sessionStorage.getItem('dhis2')) && JSON.parse(sessionStorage.getItem('dhis2'))['map']), + handler: function() { + window.location.href = pt.init.contextPath + '/dhis-web-mapping/app/index.html?s=chart'; + } + } + ], + listeners: { + show: function() { + pt.util.window.setAnchorPosition(b.menu, b); + }, + hide: function() { + b.menu.destroy(); + defaultButton.toggle(); + }, + destroy: function(m) { + b.menu = null; + } + } + }); + + b.menu.show(); } }, { === 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 2013-08-28 12:12:31 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-09-25 15:50:46 +0000 @@ -2601,7 +2601,7 @@ showSeparator: false, items: [ { - text: 'View selection as chart' + '  ', //i18n + text: 'Open selection as chart' + '  ', //i18n iconCls: 'pt-button-icon-chart', param: 'chart', handler: function() { @@ -2620,12 +2620,23 @@ } }, { - text: 'View selection as map' + '  ', //i18n + text: 'Open selection as map' + '  ', //i18n iconCls: 'pt-button-icon-map', param: 'map', disabled: true, handler: function() { - that.setSessionStorage(layoutConfig, pt.init.contextPath + '/dhis-web-mapping/app/index.html'); + that.setSessionStorage(layoutConfig, pt.init.contextPath + '/dhis-web-mapping/app/index.html?s=analytical'); + }, + listeners: { + render: function() { + this.getEl().on('mouseover', function() { + that.onMouseHover(uuid, 'mouseover', 'map', pt); + }); + + this.getEl().on('mouseout', function() { + that.onMouseHover(uuid, 'mouseout', 'map', pt); + }); + } } } ] === modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/i18n.vm' --- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/i18n.vm 2013-08-15 11:35:41 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/i18n.vm 2013-09-30 12:20:27 +0000 @@ -130,5 +130,6 @@ details: '$encoder.jsEscape($i18n.getString( 'details' ) , "'")', select_boundaries_and_groups: '$encoder.jsEscape($i18n.getString( 'select_boundaries_and_groups' ) , "'")', select_organisation_unit_groups: '$encoder.jsEscape($i18n.getString( 'select_organisation_unit_groups' ) , "'")', - user_organisation_unit_grandchildren: '$encoder.jsEscape($i18n.getString( 'user_organisation_unit_grandchildren' ) , "'")' + user_organisation_unit_grandchildren: '$encoder.jsEscape($i18n.getString( 'user_organisation_unit_grandchildren' ) , "'")', + allow_external_access: '$encoder.jsEscape($i18n.getString( 'allow_external_access' ) , "'")' }; === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties 2013-08-16 14:44:33 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties 2013-09-30 12:20:27 +0000 @@ -200,4 +200,5 @@ select_boundaries_and_levels=Select boundaries and levels select_organisation_unit_levels=Select organisation unit levels select_boundaries_and_groups=Select boundaries and groups -select_organisation_unit_groups=Select organisation unit groups \ No newline at end of file +select_organisation_unit_groups=Select organisation unit groups +allow_external_access=Allow external access \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr.properties' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr.properties 2013-07-24 10:33:49 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr.properties 2013-09-30 12:20:27 +0000 @@ -180,4 +180,5 @@ select_organisation_unit_level=S\u00E9lectionner le niveau de l'unit\u00E9 d'organisation details=D\u00E9tails totals=Totaux -radar_chart=Graphique en radar \ No newline at end of file +radar_chart=Graphique en radar +allow_external_access=Permettre l'acc\u00E8s externe \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2013-09-16 10:14:59 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2013-09-30 12:20:27 +0000 @@ -1695,6 +1695,7 @@ userGroupField, userGroupButton, userGroupRowContainer, + externalAccess, publicGroup, window; @@ -1791,6 +1792,7 @@ id: sharing.object.id, name: sharing.object.name, publicAccess: publicGroup.down('combobox').getValue(), + externalAccess: externalAccess ? externalAccess.getValue() : false, user: { id: dv.init.user.id, name: dv.init.user.name @@ -1866,6 +1868,16 @@ userGroupRowContainer = Ext.create('Ext.container.Container', { bodyStyle: 'border:0 none' }); + + if (sharing.meta.allowExternalAccess) { + externalAccess = userGroupRowContainer.add({ + xtype: 'checkbox', + fieldLabel: DV.i18n.allow_external_access, + labelSeparator: '', + labelWidth: 250, + checked: !!sharing.object.externalAccess + }); + } publicGroup = userGroupRowContainer.add(UserGroupRow({ id: sharing.object.id, @@ -3539,12 +3551,18 @@ } }, multipleExpand: function(id, path, doUpdate) { - this.expandPath('/' + dv.conf.finals.root.id + path, 'id', '/', function() { - var record = this.getRootNode().findChild('id', id, true); - this.recordsToSelect.push(record); - this.multipleSelectIf(doUpdate); - }, this); - }, + var rootId = dv.conf.finals.root.id; + + if (path.substr(0, rootId.length + 1) !== ('/' + rootId)) { + path = '/' + rootId + path; + } + + this.expandPath('/' + path, 'id', '/', function() { + var record = this.getRootNode().findChild('id', id, true); + this.recordsToSelect.push(record); + this.multipleSelectIf(doUpdate); + }, this); + }, select: function(url, params) { if (!params) { params = {}; @@ -3563,32 +3581,6 @@ } }); }, - selectByGroup: function(id) { - if (id) { - var url = dv.conf.finals.ajax.path_module + dv.conf.finals.ajax.organisationunit_getbygroup, - params = {id: id}; - this.select(url, params); - } - }, - selectByLevel: function(level) { - if (level) { - var url = dv.conf.finals.ajax.path_module + dv.conf.finals.ajax.organisationunit_getbylevel, - params = {level: level}; - this.select(url, params); - } - }, - selectByIds: function(ids) { - if (ids) { - var url = dv.conf.finals.ajax.path_module + dv.conf.finals.ajax.organisationunit_getbyids; - Ext.Array.each(ids, function(item) { - url = Ext.String.urlAppend(url, 'ids=' + item); - }); - if (!this.rendered) { - dv.cmp.dimension.organisationUnit.panel.expand(); - } - this.select(url); - } - }, store: Ext.create('Ext.data.TreeStore', { proxy: { type: 'ajax', @@ -4526,7 +4518,7 @@ }, '-', { - text: 'View chart as table' + '  ', //i18n + text: 'Open this chart as table' + '  ', //i18n cls: 'dv-menu-item-noicon', disabled: !DV.isSessionStorage || !dv.layout, handler: function() { @@ -4536,7 +4528,7 @@ } }, { - text: 'View last table' + '  ', //i18n + text: 'Open last table' + '  ', //i18n cls: 'dv-menu-item-noicon', disabled: !(DV.isSessionStorage && JSON.parse(sessionStorage.getItem('dhis2')) && JSON.parse(sessionStorage.getItem('dhis2'))['table']), handler: function() { === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm 2013-08-16 14:44:33 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm 2013-09-30 12:20:27 +0000 @@ -200,5 +200,6 @@ radar_chart: '$encoder.jsEscape($i18n.getString( 'radar_chart' ) , "'")', select_boundaries_and_groups: '$encoder.jsEscape($i18n.getString( 'select_boundaries_and_groups' ) , "'")', select_organisation_unit_groups: '$encoder.jsEscape($i18n.getString( 'select_organisation_unit_groups' ) , "'")', - user_organisation_unit_grandchildren: '$encoder.jsEscape($i18n.getString( 'user_organisation_unit_grandchildren' ) , "'")' + user_organisation_unit_grandchildren: '$encoder.jsEscape($i18n.getString( 'user_organisation_unit_grandchildren' ) , "'")', + allow_external_access: '$encoder.jsEscape($i18n.getString( 'allow_external_access' ) , "'")' };