=== 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 2013-07-24 15:55:13 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java 2013-08-08 17:05:40 +0000 @@ -58,6 +58,7 @@ public static final String TYPE_CHART = "chart"; public static final String TYPE_MAP = "map"; + public static final String TYPE_REPORT_TABLE = "reportTable"; public static final String TYPE_USERS = "users"; public static final String TYPE_REPORT_TABLES = "reportTables"; public static final String TYPE_REPORTS = "reports"; @@ -67,6 +68,8 @@ private Map map; + private ReportTable reportTable; + private List users = new ArrayList(); private List reportTables = new ArrayList(); @@ -105,6 +108,10 @@ { return TYPE_MAP; } + else if ( reportTable != null ) + { + return TYPE_REPORT_TABLE; + } else if ( !users.isEmpty() ) { return TYPE_USERS; @@ -208,6 +215,18 @@ this.map = map; } + @JsonProperty + @JsonSerialize( as = BaseIdentifiableObject.class ) + public ReportTable getReportTable() + { + return reportTable; + } + + public void setReportTable( ReportTable reportTable ) + { + this.reportTable = reportTable; + } + @JsonProperty( value = "users" ) @JsonSerialize( contentAs = BaseIdentifiableObject.class ) @JacksonXmlElementWrapper( localName = "users", namespace = DxfNamespaces.DXF_2_0) @@ -279,6 +298,7 @@ chart = item.getChart() == null ? chart : item.getChart(); map = item.getMap() == null ? map : item.getMap(); + reportTable = item.getReportTable() == null ? reportTable : item.getReportTable(); users = item.getUsers() == null ? users : item.getUsers(); reportTables = item.getReportTables() == null ? reportTables : item.getReportTables(); reports = item.getReports() == null ? reports : item.getReports(); === 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 2013-07-23 17:21:14 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java 2013-08-08 17:05:40 +0000 @@ -30,6 +30,7 @@ import static org.hisp.dhis.common.IdentifiableObjectUtils.getUids; import static org.hisp.dhis.dashboard.DashboardItem.TYPE_CHART; import static org.hisp.dhis.dashboard.DashboardItem.TYPE_MAP; +import static org.hisp.dhis.dashboard.DashboardItem.TYPE_REPORT_TABLE; import static org.hisp.dhis.dashboard.DashboardItem.TYPE_REPORTS; import static org.hisp.dhis.dashboard.DashboardItem.TYPE_REPORT_TABLES; import static org.hisp.dhis.dashboard.DashboardItem.TYPE_RESOURCES; @@ -113,6 +114,12 @@ item.setMap( objectManager.get( Map.class, contentUid ) ); dashboard.getItems().add( 0, item ); } + else if ( TYPE_REPORT_TABLE.equals( type ) ) + { + DashboardItem item = new DashboardItem(); + item.setReportTable( objectManager.get( ReportTable.class, contentUid ) ); + dashboard.getItems().add( 0, item ); + } else // Link item { DashboardItem availableItem = dashboard.getAvailableItemByType( type ); @@ -168,6 +175,11 @@ item.setMap( objectManager.get( Map.class, item.getMap().getUid() ) ); } + if ( item.getReportTable() != null ) + { + item.setReportTable( objectManager.get( ReportTable.class, item.getReportTable().getUid() ) ); + } + if ( item.getUsers() != null ) { item.setUsers( objectManager.getByUid( User.class, getUids( item.getUsers() ) ) ); === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardItem.hbm.xml' --- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardItem.hbm.xml 2013-07-22 21:08:05 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardItem.hbm.xml 2013-08-08 17:05:40 +0000 @@ -19,6 +19,8 @@ + + === 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 2013-08-08 10:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js 2013-08-08 17:05:40 +0000 @@ -7,6 +7,8 @@ dhis2.db.currentShareType; dhis2.db.currentShareId; +// TODO remove position from template +// TODO support table as link and embedded // TODO double horizontal size // TODO dashboard list horizontal scroll // TODO report type in link @@ -57,13 +59,20 @@ "
  • ", + "", mapItem: "
  • " + "
  • " + "", + + reportTableItem: "
  • " + + "
  • " + + "
    " + + "
  • " }; dhis2.db.dashboardReady = function( id ) @@ -303,6 +312,11 @@ $d.append( $.tmpl( dhis2.db.tmpl.mapItem, { "itemId": item.id, "id": item.map.id, "name": item.map.name, "position": position, "i18n_remove": i18n_remove, "i18n_view": i18n_view_full_size, "i18n_share": i18n_share, "i18n_click": i18n_click_to_explore_drag_to_new_position } ) ) } + else if ( "reportTable" == item.type ) + { + $d.append( $.tmpl( dhis2.db.tmpl.reportTableItem, { "itemId": item.id, "id": item.reportTable.id, "name": item.reportTable.name, "position": position, + "i18n_remove": i18n_remove, "i18n_view": i18n_view_full_size, "i18n_share": i18n_share, "i18n_click": i18n_click_to_explore_drag_to_new_position } ) ) + } else if ( "users" == item.type ) { dhis2.db.renderLinkItem( $d, item.id, item.users, "Users", position, "../dhis-web-dashboard-integration/profile.action?id=", "" ); @@ -419,6 +433,28 @@ return parseInt( $( ".liDropItem" ).index( $( "#liDrop-" + itemId ) ) ); } +dhis2.db.exploreChart = function( uid ) +{ + window.location.href = "../dhis-web-visualizer/app/index.html?id=" + uid; +} + +dhis2.db.exploreMap = function( uid ) +{ + window.location.href = "../dhis-web-mapping/app/index.html?id=" + uid; +} + +dhis2.db.exploreReportTable = function( uid ) +{ + window.location.href = "../dhis-web-pivot/app/index.html?id=" + uid; +} + +dhis2.db.renderReportTable = function( tableId, itemId ) +{ + $.get( "../api/reportTables/" + tableId + "/data.html", function( data ) { + $( "#pivot-" + itemId ).html( data ); + } ); +} + //------------------------------------------------------------------------------ // Search //------------------------------------------------------------------------------ @@ -486,7 +522,7 @@ for ( var i in data.reportTables ) { var o = data.reportTables[i]; - $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "link": "../dhis-web-pivot/app/index.html?id=" + o.id, "img": "table_small", "name": o.name, "type": "reportTables", "id": o.id } ) ); + $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "link": "../dhis-web-pivot/app/index.html?id=" + o.id, "img": "table_small", "name": o.name, "type": "reportTable", "id": o.id } ) ); } } @@ -598,14 +634,3 @@ title : title } ); } - -dhis2.db.exploreChart = function( uid ) -{ - window.location.href = "../dhis-web-visualizer/app/index.html?id=" + uid; -} - -dhis2.db.exploreMap = function( uid ) -{ - window.location.href = "../dhis-web-mapping/app/index.html?id=" + uid; -} - === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css 2013-08-07 14:32:02 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css 2013-08-08 17:05:40 +0000 @@ -86,6 +86,20 @@ cursor: pointer; box-shadow: #ddd 0px 1px 3px 0px; background-color: #fff; + overflow: auto; +} + +.item h3 +{ + font-size: 12px; + font-family: LiberationSansBold, sans-serif; + color: #39547d; + margin: 2px 5px; +} + +.item h4 +{ + margin: 0; } .item:hover