=== 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 2014-12-19 15:47:38 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java 2015-01-13 18:53:55 +0000 @@ -74,6 +74,9 @@ 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_FULL_WIDTH = "full_width"; + private Chart chart; private EventChart eventChart; @@ -81,7 +84,7 @@ private Map map; private ReportTable reportTable; - + @Scanned private List users = new ArrayList<>(); @@ -96,6 +99,8 @@ private Boolean messages; + private String shape; + // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- @@ -403,6 +408,19 @@ this.messages = messages; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public String getShape() + { + return shape; + } + + public void setShape( String shape ) + { + this.shape = shape; + } + // ------------------------------------------------------------------------- // Merge with // ------------------------------------------------------------------------- @@ -424,6 +442,7 @@ reports = item.getReports() == null ? reports : item.getReports(); resources = item.getResources() == null ? resources : item.getResources(); messages = item.getMessages() == null ? messages : item.getMessages(); + shape = item.getShape() == null ? shape : item.getShape(); } } } === 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 2014-09-15 20:06:58 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardService.java 2015-01-13 18:53:55 +0000 @@ -63,6 +63,10 @@ Dashboard getDashboard( String uid ); + void updateDashboardItem( DashboardItem item ); + + DashboardItem getDashboardItem( String uid ); + int countMapDashboardItems( Map map ); int countChartDashboardItems( Chart chart ); === 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 2014-12-29 12:52:56 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java 2015-01-13 18:53:55 +0000 @@ -88,6 +88,10 @@ // DashboardService implementation // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- + // Dashboard + // ------------------------------------------------------------------------- + @Override public DashboardSearchResult search( String query ) { @@ -280,6 +284,22 @@ return dashboardStore.getByUid( uid ); } + // ------------------------------------------------------------------------- + // DashboardItem + // ------------------------------------------------------------------------- + + @Override + public void updateDashboardItem( DashboardItem item ) + { + dashboardItemStore.update( item ); + } + + @Override + public DashboardItem getDashboardItem( String uid ) + { + return dashboardItemStore.getByUid( uid ); + } + @Override public int countMapDashboardItems( Map map ) { === 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 2014-07-13 18:46:24 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardItem.hbm.xml 2015-01-13 18:53:55 +0000 @@ -49,5 +49,7 @@ + + \ No newline at end of file === 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-01-02 11:37:51 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java 2015-01-13 18:53:55 +0000 @@ -92,13 +92,13 @@ @Override @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json" ) - public void putJsonObject( @PathVariable( "uid" ) String pvUid, HttpServletRequest request, HttpServletResponse response ) throws Exception + public void putJsonObject( @PathVariable( "uid" ) String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception { - Dashboard dashboard = dashboardService.getDashboard( pvUid ); + Dashboard dashboard = dashboardService.getDashboard( uid ); if ( dashboard == null ) { - ContextUtils.notFoundResponse( response, "Dashboard does not exist: " + pvUid ); + ContextUtils.notFoundResponse( response, "Dashboard does not exist: " + uid ); return; } @@ -111,14 +111,14 @@ @Override @RequestMapping( value = "/{uid}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE ) - public void deleteObject( @PathVariable( "uid" ) String pvUid, HttpServletRequest request, HttpServletResponse response ) + public void deleteObject( @PathVariable( "uid" ) String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception { - List objects = getEntity( pvUid ); + List objects = getEntity( uid ); if ( objects.isEmpty() ) { - ContextUtils.conflictResponse( response, getEntityName() + " does not exist: " + pvUid ); + ContextUtils.conflictResponse( response, getEntityName() + " does not exist: " + uid ); return; } === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardItemController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardItemController.java 2014-12-12 17:48:12 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardItemController.java 2015-01-13 18:53:55 +0000 @@ -28,16 +28,28 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import com.google.common.collect.Lists; +import static org.hisp.dhis.dashboard.DashboardItem.SHAPE_FULL_WIDTH; +import static org.hisp.dhis.dashboard.DashboardItem.SHAPE_NORMAL; + +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import org.hisp.dhis.common.Pager; import org.hisp.dhis.dashboard.DashboardItem; +import org.hisp.dhis.dashboard.DashboardService; import org.hisp.dhis.schema.descriptors.DashboardItemSchemaDescriptor; +import org.hisp.dhis.webapi.utils.ContextUtils; import org.hisp.dhis.webapi.webdomain.WebMetaData; import org.hisp.dhis.webapi.webdomain.WebOptions; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; -import java.util.List; +import com.google.common.collect.Lists; /** * @author Morten Olav Hansen @@ -47,6 +59,9 @@ public class DashboardItemController extends AbstractCrudController { + @Autowired + private DashboardService dashboardService; + @Override protected List getEntityList( WebMetaData metaData, WebOptions options, List filters ) { @@ -68,4 +83,23 @@ return entityList; } + + @RequestMapping( value = "/{uid}/shape", method = RequestMethod.PUT ) + public void putDashboardItemShape( @PathVariable String uid, + HttpServletRequest request, HttpServletResponse response ) throws Exception + { + DashboardItem item = dashboardService.getDashboardItem( uid ); + + if ( item == null ) + { + ContextUtils.notFoundResponse( response, "Dashboard item does not exist: " + uid ); + return; + } + + String shape = item.getShape() == null || SHAPE_NORMAL.equals( item.getShape() ) ? SHAPE_FULL_WIDTH : SHAPE_NORMAL; + + item.setShape( shape ); + + dashboardService.updateDashboardItem( item ); + } } === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2015-01-07 13:32:22 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2015-01-13 18:53:55 +0000 @@ -48,7 +48,7 @@ sending_message=Sending message explore=Explore interpretations=Interpretations -share_your_own_interpretations_from=Share your own interpretations from +share_your_own_interpretations_from=resizeShare your own interpretations from gis=GIS pivot_table=Pivot table add_a_comment=Add a comment @@ -115,6 +115,7 @@ see_more_hits=See more hits see_fewer_hits=See fewer hits add=Add +resize=Resize add_items_to_current_dashboard=Add items to current dashboard could_not_delete_interpretation=Could not delete interpretation, please try again later could_not_delete_interpretation_comment=Could not delete interpretation comment, please try again later === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm 2015-01-13 18:05:35 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm 2015-01-13 18:53:55 +0000 @@ -15,6 +15,7 @@ var i18n_manage = '$encoder.jsEscape( $i18n.getString( "manage" ), "'")'; var i18n_share = '$encoder.jsEscape( $i18n.getString( "share" ), "'")'; var i18n_explore = '$encoder.jsEscape( $i18n.getString( "explore" ), "'")'; +var i18n_resize = '$encoder.jsEscape( $i18n.getString( "resize" ), "'")'; var i18n_share_interpretation = '$encoder.jsEscape( $i18n.getString( "share_interpretation" ), "'")'; var i18n_see_more_hits = '$encoder.jsEscape( $i18n.getString( "see_more_hits" ), "'")'; var i18n_see_fewer_hits = '$encoder.jsEscape( $i18n.getString( "see_fewer_hits" ), "'")'; === 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-01-13 18:05:35 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js 2015-01-13 18:53:55 +0000 @@ -78,14 +78,16 @@ "
  • " + "
    " + "
  • ", eventChartItem: "
  • " + "
  • " + "
    " + "
  • ", @@ -93,7 +95,8 @@ "
  • " + "
    " + "
  • ", @@ -101,7 +104,8 @@ "
  • " + "
    " + "
  • ", @@ -109,7 +113,8 @@ "
  • " + "
    " + "
  • " }; @@ -739,6 +744,14 @@ window.location.href = "../dhis-web-event-reports/index.html?id=" + uid; } +dhis2.db.resizeItem = function( uid ) +{ + $.ajax( { + url: "../api/dashboardItems/" + uid + "/shape", + type: "put" + } ); +} + dhis2.db.renderReportTable = function( tableId, itemId ) { $.get( "../api/reportTables/" + tableId + "/data.html", function( data ) {