=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/Dashboard.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/Dashboard.java 2015-02-05 06:53:38 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/Dashboard.java 2015-09-15 10:15:00 +0000 @@ -130,7 +130,7 @@ * @param type the type of content to return. * @return an item. */ - public DashboardItem getAvailableItemByType( String type ) + public DashboardItem getAvailableItemByType( DashboardItemType type ) { for ( DashboardItem item : items ) { === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java 2015-07-13 12:34:39 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java 2015-09-15 10:15:00 +0000 @@ -66,17 +66,6 @@ { public static final int MAX_CONTENT = 8; - public static final String TYPE_CHART = "chart"; //TODO use enum - public static final String TYPE_EVENT_CHART = "eventChart"; //TODO use enum - public static final String TYPE_MAP = "map"; - public static final String TYPE_REPORT_TABLE = "reportTable"; - public static final String TYPE_EVENT_REPORT = "eventReport"; - public static final String TYPE_USERS = "users"; - public static final String TYPE_REPORT_TABLES = "reportTables"; - public static final String TYPE_REPORTS = "reports"; - public static final String TYPE_RESOURCES = "resources"; - public static final String TYPE_MESSAGES = "messages"; - public static final String SHAPE_NORMAL = "normal"; public static final String SHAPE_DOUBLE_WIDTH = "double_width"; public static final String SHAPE_FULL_WIDTH = "full_width"; @@ -124,43 +113,43 @@ @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getType() + public DashboardItemType getType() { if ( chart != null ) { - return TYPE_CHART; + return DashboardItemType.CHART; } else if ( eventChart != null ) { - return TYPE_EVENT_CHART; + return DashboardItemType.EVENT_CHART; } else if ( map != null ) { - return TYPE_MAP; + return DashboardItemType.MAP; } else if ( reportTable != null ) { - return TYPE_REPORT_TABLE; + return DashboardItemType.REPORT_TABLE; } else if ( eventReport != null ) { - return TYPE_EVENT_REPORT; + return DashboardItemType.EVENT_REPORT; } else if ( !users.isEmpty() ) { - return TYPE_USERS; + return DashboardItemType.USERS; } else if ( !reports.isEmpty() ) { - return TYPE_REPORTS; + return DashboardItemType.REPORTS; } else if ( !resources.isEmpty() ) { - return TYPE_RESOURCES; + return DashboardItemType.RESOURCES; } else if ( messages != null ) { - return TYPE_MESSAGES; + return DashboardItemType.MESSAGES; } return null; === added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItemType.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItemType.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItemType.java 2015-09-15 10:15:00 +0000 @@ -0,0 +1,39 @@ +package org.hisp.dhis.dashboard; + +/* + * Copyright (c) 2004-2015, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @author Lars Helge Overland + */ +public enum DashboardItemType +{ + CHART, EVENT_CHART, MAP, REPORT_TABLE, EVENT_REPORT, USERS, + REPORTS, RESOURCES, MESSAGES; + +} === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardService.java 2015-01-22 11:23:36 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardService.java 2015-09-15 10:15:00 +0000 @@ -49,9 +49,9 @@ DashboardSearchResult search( String query ); - DashboardSearchResult search( String query, Set maxTypes ); + DashboardSearchResult search( String query, Set maxTypes ); - DashboardItem addItemContent( String dashboardUid, String type, String contentUid ); + DashboardItem addItemContent( String dashboardUid, DashboardItemType type, String contentUid ); void mergeDashboard( Dashboard dashboard ); === modified file 'dhis-2/dhis-api/src/test/java/org/hisp/dhis/dashboard/DashboardTest.java' --- dhis-2/dhis-api/src/test/java/org/hisp/dhis/dashboard/DashboardTest.java 2015-01-22 11:23:36 +0000 +++ dhis-2/dhis-api/src/test/java/org/hisp/dhis/dashboard/DashboardTest.java 2015-09-15 10:15:00 +0000 @@ -125,9 +125,9 @@ dashboard.getItems().add( diB ); dashboard.getItems().add( diC ); - assertEquals( diB, dashboard.getAvailableItemByType( DashboardItem.TYPE_REPORTS ) ); - assertEquals( diC, dashboard.getAvailableItemByType( DashboardItem.TYPE_RESOURCES ) ); - assertNull( dashboard.getAvailableItemByType( DashboardItem.TYPE_REPORT_TABLES ) ); + assertEquals( diB, dashboard.getAvailableItemByType( DashboardItemType.REPORTS ) ); + assertEquals( diC, dashboard.getAvailableItemByType( DashboardItemType.RESOURCES ) ); + assertNull( dashboard.getAvailableItemByType( DashboardItemType.MAP ) ); } @Test === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java 2015-07-13 12:34:39 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java 2015-09-15 10:15:00 +0000 @@ -28,7 +28,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import com.google.common.collect.Sets; +import static org.hisp.dhis.common.IdentifiableObjectUtils.getUids; + +import java.util.HashSet; +import java.util.Set; + import org.hisp.dhis.chart.Chart; import org.hisp.dhis.common.IdentifiableObjectManager; import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore; @@ -36,6 +40,7 @@ import org.hisp.dhis.dashboard.Dashboard; import org.hisp.dhis.dashboard.DashboardItem; import org.hisp.dhis.dashboard.DashboardItemStore; +import org.hisp.dhis.dashboard.DashboardItemType; import org.hisp.dhis.dashboard.DashboardSearchResult; import org.hisp.dhis.dashboard.DashboardService; import org.hisp.dhis.document.Document; @@ -49,11 +54,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; -import java.util.HashSet; -import java.util.Set; - -import static org.hisp.dhis.common.IdentifiableObjectUtils.getUids; -import static org.hisp.dhis.dashboard.DashboardItem.*; +import com.google.common.collect.Sets; /** * Note: The remove associations methods must be altered if caching is introduced. @@ -98,30 +99,30 @@ @Override public DashboardSearchResult search( String query ) { - return search( query, new HashSet() ); + return search( query, new HashSet() ); } @Override - public DashboardSearchResult search( String query, Set maxTypes ) + public DashboardSearchResult search( String query, Set maxTypes ) { Set words = Sets.newHashSet( query.split( TextUtils.SPACE ) ); DashboardSearchResult result = new DashboardSearchResult(); - result.setUsers( userService.getAllUsersBetweenByName( query, 0, getMax( TYPE_USERS, maxTypes ) ) ); - result.setCharts( objectManager.getBetweenLikeName( Chart.class, words, 0, getMax( TYPE_CHART, maxTypes ) ) ); - result.setEventCharts( objectManager.getBetweenLikeName( EventChart.class, words, 0, getMax( TYPE_EVENT_CHART, maxTypes ) ) ); - result.setMaps( objectManager.getBetweenLikeName( Map.class, words, 0, getMax( TYPE_MAP, maxTypes ) ) ); - result.setReportTables( objectManager.getBetweenLikeName( ReportTable.class, words, 0, getMax( TYPE_REPORT_TABLE, maxTypes ) ) ); - result.setEventReports( objectManager.getBetweenLikeName( EventReport.class, words, 0, getMax( TYPE_EVENT_REPORT, maxTypes ) ) ); - result.setReports( objectManager.getBetweenLikeName( Report.class, words, 0, getMax( TYPE_REPORTS, maxTypes ) ) ); - result.setResources( objectManager.getBetweenLikeName( Document.class, words, 0, getMax( TYPE_RESOURCES, maxTypes ) ) ); + result.setUsers( userService.getAllUsersBetweenByName( query, 0, getMax( DashboardItemType.USERS, maxTypes ) ) ); + result.setCharts( objectManager.getBetweenLikeName( Chart.class, words, 0, getMax( DashboardItemType.CHART, maxTypes ) ) ); + result.setEventCharts( objectManager.getBetweenLikeName( EventChart.class, words, 0, getMax( DashboardItemType.EVENT_CHART, maxTypes ) ) ); + result.setMaps( objectManager.getBetweenLikeName( Map.class, words, 0, getMax( DashboardItemType.MAP, maxTypes ) ) ); + result.setReportTables( objectManager.getBetweenLikeName( ReportTable.class, words, 0, getMax( DashboardItemType.REPORT_TABLE, maxTypes ) ) ); + result.setEventReports( objectManager.getBetweenLikeName( EventReport.class, words, 0, getMax( DashboardItemType.EVENT_REPORT, maxTypes ) ) ); + result.setReports( objectManager.getBetweenLikeName( Report.class, words, 0, getMax( DashboardItemType.REPORTS, maxTypes ) ) ); + result.setResources( objectManager.getBetweenLikeName( Document.class, words, 0, getMax( DashboardItemType.RESOURCES, maxTypes ) ) ); return result; } @Override - public DashboardItem addItemContent( String dashboardUid, String type, String contentUid ) + public DashboardItem addItemContent( String dashboardUid, DashboardItemType type, String contentUid ) { Dashboard dashboard = getDashboard( dashboardUid ); @@ -132,32 +133,32 @@ DashboardItem item = new DashboardItem(); - if ( TYPE_CHART.equals( type ) ) + if ( DashboardItemType.CHART.equals( type ) ) { item.setChart( objectManager.get( Chart.class, contentUid ) ); dashboard.getItems().add( 0, item ); } - else if ( TYPE_EVENT_CHART.equals( type ) ) + else if ( DashboardItemType.EVENT_CHART.equals( type ) ) { item.setEventChart( objectManager.get( EventChart.class, contentUid ) ); dashboard.getItems().add( 0, item ); } - else if ( TYPE_MAP.equals( type ) ) + else if ( DashboardItemType.MAP.equals( type ) ) { item.setMap( objectManager.get( Map.class, contentUid ) ); dashboard.getItems().add( 0, item ); } - else if ( TYPE_REPORT_TABLE.equals( type ) ) + else if ( DashboardItemType.REPORT_TABLE.equals( type ) ) { item.setReportTable( objectManager.get( ReportTable.class, contentUid ) ); dashboard.getItems().add( 0, item ); } - else if ( TYPE_EVENT_REPORT.equals( type ) ) + else if ( DashboardItemType.EVENT_REPORT.equals( type ) ) { item.setEventReport( objectManager.get( EventReport.class, contentUid ) ); dashboard.getItems().add( 0, item ); } - else if ( TYPE_MESSAGES.equals( type ) ) + else if ( DashboardItemType.MESSAGES.equals( type ) ) { item.setMessages( true ); dashboard.getItems().add( 0, item ); @@ -168,15 +169,15 @@ item = availableItem == null ? new DashboardItem() : availableItem; - if ( TYPE_USERS.equals( type ) ) + if ( DashboardItemType.USERS.equals( type ) ) { item.getUsers().add( objectManager.get( User.class, contentUid ) ); } - else if ( TYPE_REPORTS.equals( type ) ) + else if ( DashboardItemType.REPORTS.equals( type ) ) { item.getReports().add( objectManager.get( Report.class, contentUid ) ); } - else if ( TYPE_RESOURCES.equals( type ) ) + else if ( DashboardItemType.RESOURCES.equals( type ) ) { item.getResources().add( objectManager.get( Document.class, contentUid ) ); } @@ -344,7 +345,7 @@ // Supportive methods // ------------------------------------------------------------------------- - private int getMax( String type, Set maxTypes ) + private int getMax( DashboardItemType type, Set maxTypes ) { return maxTypes != null && maxTypes.contains( type ) ? MAX_HITS_PER_OBJECT : HITS_PER_OBJECT; } === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/dashboard/DashboardServiceTest.java' --- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/dashboard/DashboardServiceTest.java 2015-07-13 12:34:39 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/dashboard/DashboardServiceTest.java 2015-09-15 10:15:00 +0000 @@ -162,7 +162,7 @@ dashboardService.saveDashboard( dA ); dashboardService.saveDashboard( dB ); - DashboardItem itemA = dashboardService.addItemContent( dA.getUid(), DashboardItem.TYPE_CHART, chartA.getUid() ); + DashboardItem itemA = dashboardService.addItemContent( dA.getUid(), DashboardItemType.CHART, chartA.getUid() ); assertNotNull( itemA ); assertNotNull( itemA.getUid() ); === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java 2015-07-16 07:53:57 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java 2015-09-15 10:15:00 +0000 @@ -31,6 +31,7 @@ import org.hisp.dhis.common.IdentifiableObject; import org.hisp.dhis.dashboard.Dashboard; import org.hisp.dhis.dashboard.DashboardItem; +import org.hisp.dhis.dashboard.DashboardItemType; import org.hisp.dhis.dashboard.DashboardSearchResult; import org.hisp.dhis.dashboard.DashboardService; import org.hisp.dhis.dxf2.common.ImportOptions; @@ -53,6 +54,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import java.util.List; import java.util.Map; import java.util.Set; @@ -75,7 +77,7 @@ // ------------------------------------------------------------------------- @RequestMapping( value = "/q/{query}", method = RequestMethod.GET ) - public String search( @PathVariable String query, @RequestParam( required = false ) Set max, + public String search( @PathVariable String query, @RequestParam( required = false ) Set max, Model model, HttpServletResponse response ) throws Exception { DashboardSearchResult result = dashboardService.search( query, max ); @@ -173,7 +175,7 @@ @RequestMapping( value = "/{dashboardUid}/items/content", method = RequestMethod.POST ) public void postJsonItemContent( HttpServletResponse response, HttpServletRequest request, - @PathVariable String dashboardUid, @RequestParam String type, @RequestParam( "id" ) String contentUid ) throws Exception + @PathVariable String dashboardUid, @RequestParam DashboardItemType type, @RequestParam( "id" ) String contentUid ) throws Exception { Dashboard dashboard = dashboardService.getDashboard( dashboardUid ); === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js 2015-08-19 16:21:12 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js 2015-09-15 10:15:00 +0000 @@ -33,7 +33,7 @@ dhis2.db.shapeFullWidth = "full_width"; dhis2.db.widthNormal = 408; dhis2.db.widthDouble = 847; -dhis2.db.visualItemTypes = ["chart", "eventChart", "map", "reportTable", "eventReport"]; +dhis2.db.visualItemTypes = ["CHART", "EVENT_CHART", "MAP", "REPORT_TABLE", "EVENT_REPORT"]; dhis2.db.itemContentHeight = 308; dhis2.db.itemScrollbarWidth = /\bchrome\b/.test(navigator.userAgent.toLowerCase()) ? 8 : 17; @@ -591,7 +591,7 @@ var tableStyle = "width:" + width + "px;"; var userOrgUnit = dhis2.db.currentUserOrgUnit || []; - if ( "chart" == dashboardItem.type ) + if ( "CHART" == dashboardItem.type ) { var content = $.tmpl( dhis2.db.tmpl.chartItem, { "itemId": dashboardItem.id, "id": dashboardItem.chart.id, "name": dashboardItem.chart.name, "style": graphStyle, "i18n_remove": i18n_remove, "i18n_get_as_image": i18n_get_as_image, "i18n_share": i18n_share_interpretation, @@ -629,7 +629,7 @@ } }); } - else if ( "eventChart" == dashboardItem.type ) + else if ( "EVENT_CHART" == dashboardItem.type ) { var content = $.tmpl( dhis2.db.tmpl.eventChartItem, { "itemId": dashboardItem.id, "id": dashboardItem.eventChart.id, "name": dashboardItem.eventChart.name, "style": graphStyle, "i18n_remove": i18n_remove, "i18n_get_as_image": i18n_get_as_image, @@ -667,7 +667,7 @@ } }); } - else if ( "map" == dashboardItem.type ) + else if ( "MAP" == dashboardItem.type ) { var content = $.tmpl( dhis2.db.tmpl.mapItem, { "itemId": dashboardItem.id, "id": dashboardItem.map.id, "name": dashboardItem.map.name, "style": graphStyle, "height": dhis2.db.itemContentHeight, "i18n_remove": i18n_remove, "i18n_get_as_image": i18n_get_as_image, @@ -687,7 +687,7 @@ }] }); } - else if ( "reportTable" == dashboardItem.type ) + else if ( "REPORT_TABLE" == dashboardItem.type ) { var content = $.tmpl( dhis2.db.tmpl.reportTableItem, { "itemId": dashboardItem.id, "id": dashboardItem.reportTable.id, "name": dashboardItem.reportTable.name, "style": tableStyle, "i18n_remove": i18n_remove, "i18n_share": i18n_share_interpretation, "i18n_click_and_drag_to_new_position": i18n_click_and_drag_to_new_position } ); @@ -705,7 +705,7 @@ userOrgUnit: userOrgUnit }); } - else if ( "eventReport" == dashboardItem.type ) + else if ( "EVENT_REPORT" == dashboardItem.type ) { var content = $.tmpl( dhis2.db.tmpl.eventReportItem, { "itemId": dashboardItem.id, "id": dashboardItem.eventReport.id, "name": dashboardItem.eventReport.name, "style": tableStyle, "i18n_remove": i18n_remove, "i18n_share": i18n_share_interpretation, "i18n_click_and_drag_to_new_position": i18n_click_and_drag_to_new_position } ); @@ -723,23 +723,19 @@ userOrgUnit: userOrgUnit }); } - else if ( "users" == dashboardItem.type ) + else if ( "USERS" == dashboardItem.type ) { dhis2.db.renderLinkItem( $d, dashboardItem.id, dashboardItem.users, "Users", "../dhis-web-dashboard-integration/profile.action?id=", "" ); } - else if ( "reportTables" == dashboardItem.type ) - { - dhis2.db.renderLinkItem( $d, dashboardItem.id, dashboardItem.reportTables, "Pivot tables", "../dhis-web-pivot/index.html?id=", "" ); - } - else if ( "reports" == dashboardItem.type ) + else if ( "REPORTS" == dashboardItem.type ) { dhis2.db.renderLinkItem( $d, dashboardItem.id, dashboardItem.reports, "Reports", "../dhis-web-reporting/getReportParams.action?mode=report&uid=", "" ); } - else if ( "resources" == dashboardItem.type ) + else if ( "RESOURCES" == dashboardItem.type ) { dhis2.db.renderLinkItem( $d, dashboardItem.id, dashboardItem.resources, "Resources", "../api/documents/", "/data" ); } - else if ( "messages" == dashboardItem.type ) + else if ( "MESSAGES" == dashboardItem.type ) { dhis2.db.renderMessagesItem( $d, dashboardItem.id ); } @@ -1018,89 +1014,89 @@ { if ( data.userCount > 0 ) { - $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Users", "type": "users", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Users", "type": "USERS", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); for ( var i in data.users ) { var o = data.users[i]; - $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "profile.action?id=" + o.id, "img": "user_small", "name": o.name, "type": "users", "id": o.id, "i18n_add": i18n_add } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "profile.action?id=" + o.id, "img": "user_small", "name": o.name, "type": "USERS", "id": o.id, "i18n_add": i18n_add } ) ); } } if ( data.chartCount > 0 ) { - $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Charts", "type": "chart", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Charts", "type": "CHART", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); for ( var i in data.charts ) { var o = data.charts[i]; - $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "../dhis-web-visualizer/index.html?id=" + o.id, "img": "chart_small", "name": o.name, "type": "chart", "id": o.id, "i18n_add": i18n_add } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "../dhis-web-visualizer/index.html?id=" + o.id, "img": "chart_small", "name": o.name, "type": "CHART", "id": o.id, "i18n_add": i18n_add } ) ); } } if ( data.eventChartCount > 0 ) { - $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Event charts", "type": "eventChart", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Event charts", "type": "EVENT_CHART", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); for ( var i in data.eventCharts ) { var o = data.eventCharts[i]; - $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "../dhis-web-event-visualizer/index.html?id=" + o.id, "img": "chart_small", "name": o.name, "type": "eventChart", "id": o.id, "i18n_add": i18n_add } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "../dhis-web-event-visualizer/index.html?id=" + o.id, "img": "chart_small", "name": o.name, "type": "EVENT_CHART", "id": o.id, "i18n_add": i18n_add } ) ); } } if ( data.mapCount > 0 ) { - $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Maps", "type": "map", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Maps", "type": "MAP", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); for ( var i in data.maps ) { var o = data.maps[i]; - $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "../dhis-web-mapping/index.html?id=" + o.id, "img": "map_small", "name": o.name, "type": "map", "id": o.id, "i18n_add": i18n_add } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "../dhis-web-mapping/index.html?id=" + o.id, "img": "map_small", "name": o.name, "type": "MAP", "id": o.id, "i18n_add": i18n_add } ) ); } } if ( data.reportTableCount > 0 ) { - $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Pivot tables", "type": "reportTable", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Pivot tables", "type": "REPORT_TABLE", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); for ( var i in data.reportTables ) { var o = data.reportTables[i]; - $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "../dhis-web-pivot/index.html?id=" + o.id, "img": "table_small", "name": o.name, "type": "reportTable", "id": o.id, "i18n_add": i18n_add } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "../dhis-web-pivot/index.html?id=" + o.id, "img": "table_small", "name": o.name, "type": "REPORT_TABLE", "id": o.id, "i18n_add": i18n_add } ) ); } } if ( data.eventReportCount > 0 ) { - $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Event reports", "type": "eventReport", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Event reports", "type": "EVENT_REPORT", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); for ( var i in data.eventReports ) { var o = data.eventReports[i]; - $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "../dhis-web-event-reports/index.html?id=" + o.id, "img": "table_small", "name": o.name, "type": "eventReport", "id": o.id, "i18n_add": i18n_add } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "../dhis-web-event-reports/index.html?id=" + o.id, "img": "table_small", "name": o.name, "type": "EVENT_REPORT", "id": o.id, "i18n_add": i18n_add } ) ); } } if ( data.reportCount > 0 ) { - $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Standard reports", "type": "reports", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Standard reports", "type": "REPORTS", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); for ( var i in data.reports ) { var o = data.reports[i]; - $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "../dhis-web-reporting/getReportParams.action?uid=" + o.id, "img": "standard_report_small", "name": o.name, "type": "reports", "id": o.id, "i18n_add": i18n_add } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "../dhis-web-reporting/getReportParams.action?uid=" + o.id, "img": "standard_report_small", "name": o.name, "type": "REPORTS", "id": o.id, "i18n_add": i18n_add } ) ); } } if ( data.resourceCount > 0 ) { - $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Resources", "type": "resources", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Resources", "type": "RESOURCES", "i18n_see_more_hits": i18n_see_more_hits, "i18n_see_fewer_hits": i18n_see_fewer_hits } ) ); for ( var i in data.resources ) { var o = data.resources[i]; - $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "../api/documents/" + o.id, "img": "document_small", "name": o.name, "type": "resources", "id": o.id, "i18n_add": i18n_add } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "canManage": canManage, "link": "../api/documents/" + o.id, "img": "document_small", "name": o.name, "type": "RESOURCES", "id": o.id, "i18n_add": i18n_add } ) ); } } }