=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2012-04-12 12:39:47 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2012-06-03 16:26:12 +0000 @@ -45,6 +45,7 @@ page menu + hideMenu offline === added file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/InitAction.java' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/InitAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/InitAction.java 2012-06-03 16:26:12 +0000 @@ -0,0 +1,47 @@ +package org.hisp.dhis.dashboard.action; + +import org.hisp.dhis.interpretation.InterpretationService; +import org.hisp.dhis.message.MessageService; + +import com.opensymphony.xwork2.Action; + +public class InitAction + implements Action +{ + private MessageService messageService; + + public void setMessageService( MessageService messageService ) + { + this.messageService = messageService; + } + + private InterpretationService interpretationService; + + public void setInterpretationService( InterpretationService interpretationService ) + { + this.interpretationService = interpretationService; + } + + private long messageCount; + + public long getMessageCount() + { + return messageCount; + } + + private long interpretationCount; + + public long getInterpretationCount() + { + return interpretationCount; + } + + public String execute() + { + messageCount = messageService.getUnreadMessageConversationCount(); + + interpretationCount = interpretationService.getNewInterpretationCount(); + + return SUCCESS; + } +} === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java 2012-05-29 21:23:47 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java 2012-06-03 16:26:12 +0000 @@ -27,9 +27,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import static org.hisp.dhis.user.UserSettingService.DEFAULT_CHARTS_IN_DASHBOARD; -import static org.hisp.dhis.user.UserSettingService.KEY_CHARTS_IN_DASHBOARD; - import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -40,9 +37,6 @@ import org.hisp.dhis.chart.ChartService; import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; import org.hisp.dhis.dashboard.DashboardManager; -import org.hisp.dhis.interpretation.InterpretationService; -import org.hisp.dhis.message.MessageService; -import org.hisp.dhis.user.UserSettingService; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionContext; @@ -72,25 +66,15 @@ this.chartService = chartService; } - private UserSettingService userSettingService; - - public void setUserSettingService( UserSettingService userSettingService ) - { - this.userSettingService = userSettingService; - } - - private MessageService messageService; - - public void setMessageService( MessageService messageService ) - { - this.messageService = messageService; - } - - private InterpretationService interpretationService; - - public void setInterpretationService( InterpretationService interpretationService ) - { - this.interpretationService = interpretationService; + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + private Integer noCharts; + + public void setNoCharts( Integer noCharts ) + { + this.noCharts = noCharts; } // ------------------------------------------------------------------------- @@ -118,20 +102,6 @@ return chartAreas; } - private long messageCount; - - public long getMessageCount() - { - return messageCount; - } - - private long interpretationCount; - - public long getInterpretationCount() - { - return interpretationCount; - } - // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -148,9 +118,9 @@ Collections.sort( charts, IdentifiableObjectNameComparator.INSTANCE ); - int chartsInDashboardCount = (Integer) userSettingService.getUserSetting( KEY_CHARTS_IN_DASHBOARD, DEFAULT_CHARTS_IN_DASHBOARD ); + noCharts = noCharts == null ? 6 : noCharts; - for ( int i = 1; i <= chartsInDashboardCount; i++ ) + for ( int i = 1; i <= noCharts; i++ ) { Object id = content.get( DashboardManager.CHART_AREA_PREFIX + i ); @@ -164,10 +134,6 @@ chartAreas.add( chart ); } - messageCount = messageService.getUnreadMessageConversationCount(); - - interpretationCount = interpretationService.getNewInterpretationCount(); - return SUCCESS; } } === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml 2012-05-29 21:23:47 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml 2012-06-03 16:26:12 +0000 @@ -5,13 +5,16 @@ + + + + + - - - - + /main.vm /dhis-web-dashboard-integration/mainForm.vm /dhis-web-dashboard-integration/menu.vm @@ -18,6 +18,10 @@ javascript/dropdown.js + + /dhis-web-dashboard-integration/dashboard.vm + + /dhis-web-dashboard-integration/responseSuccess.vm plainTextError === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm 2012-06-03 16:26:12 +0000 @@ -0,0 +1,90 @@ + +#macro ( linkDropDownButtonDiv $dropDownId $areaDivId ) + +#end + +#macro ( chartDropDownButtonDiv $dropDownId $areaDivId $chart ) + +#end + +#macro ( linkDropDownListDiv $divId $listId $page ) +
+ + #if ( $page ) + #parse( "/dhis-web-dashboard-integration/${page}.vm" ) + #else +
$i18n.getString( 'this_is_a_link_area' )
+ #end +
+#end + +#macro ( chartDropDownListDiv $divId $listId $chart ) +
+ + #if ( $chart ) + + #else +
$i18n.getString( 'this_is_a_chart_area' )
+ #end +
+#end + + + + + + +
+ #linkDropDownButtonDiv( "dropDownA" "areaA" ) + #linkDropDownListDiv( "areaA" "dropDownA" $areaA ) + + #linkDropDownButtonDiv( "dropDownB" "areaB" ) + #linkDropDownListDiv( "areaB" "dropDownB" $areaB ) + + #linkDropDownButtonDiv( "dropDownC" "areaC" ) + #linkDropDownListDiv( "areaC" "dropDownC" $areaC ) + + + + +#set( $sizeHalf = $chartAreas.size() / 2 ) + +#foreach( $chart in $chartAreas ) +#set( $count0 = $velocityCount - 1 ) +#set( $count1 = $velocityCount ) +#set( $startHr = ($count0 % $sizeHalf) == 0 ) +#set( $endHr = ($count0 % $sizeHalf) == ($sizeHalf - 1) ) + +#if( $startHr ) #end + +#end +#if( $endHr ) #end +
+ #chartDropDownButtonDiv( "chartDropDown${count1}" "chartArea${count1}" $chart ) + #chartDropDownListDiv( "chartArea${count1}" "chartDropDown${count1}" $chart ) +
+ +
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dropdown.js' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dropdown.js 2012-05-05 19:13:56 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dropdown.js 2012-06-03 16:26:12 +0000 @@ -1,3 +1,20 @@ + +$( document ).ready( function() +{ + var viewportWidth = parseInt( $( window ).width() ); + var linkWidth = parseInt( 355 ); + var chartWidth = parseInt( 325 ); + + if ( viewportWidth == undefined ) + { + viewportWidth = parseInt( 1366 ); + } + + var noCharts = 2 * Math.floor( ( viewportWidth - linkWidth ) / chartWidth ); + + $( "#contentDiv" ).load( "provideContent.action?noCharts=" + noCharts + "&_dc=" + getRandomNumber() ); +} ); + function setAreaItem( area, item ) { $.get( "setAreaItem.action", { === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm 2012-05-29 21:23:47 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm 2012-06-03 16:26:12 +0000 @@ -1,99 +1,11 @@ -#macro ( linkDropDownButtonDiv $dropDownId $areaDivId ) - -#end - -#macro ( chartDropDownButtonDiv $dropDownId $areaDivId $chart ) - -#end - -#macro ( linkDropDownListDiv $divId $listId $page ) -
- - #if ( $page ) - #parse( "/dhis-web-dashboard-integration/${page}.vm" ) - #else -
$i18n.getString( 'this_is_a_link_area' )
- #end -
-#end - -#macro ( chartDropDownListDiv $divId $listId $chart ) -
- - #if ( $chart ) - - #else -
$i18n.getString( 'this_is_a_chart_area' )
- #end -
-#end -

$i18n.getString( "dashboard" ) #openHelp( "dashboards_setup" ) • $i18n.getString( "write_feedback" ) #if( $messageCount > 0 )• $messageCount #if( $messageCount > 1 )$i18n.getString( "unread_messages" )#else$i18n.getString( "unread_message" )#end #end #if( $interpretationCount > 0 )• $interpretationCount #if( $interpretationCount > 1 )$i18n.getString( "new_interpretations" )#else$i18n.getString( "new_interpretation" )#end #end

- - - - - -
- #linkDropDownButtonDiv( "dropDownA" "areaA" ) - #linkDropDownListDiv( "areaA" "dropDownA" $areaA ) - - #linkDropDownButtonDiv( "dropDownB" "areaB" ) - #linkDropDownListDiv( "areaB" "dropDownB" $areaB ) - - #linkDropDownButtonDiv( "dropDownC" "areaC" ) - #linkDropDownListDiv( "areaC" "dropDownC" $areaC ) - - - - -#set( $sizeHalf = $chartAreas.size() / 2 ) - -#foreach( $chart in $chartAreas ) -#set( $count0 = $velocityCount - 1 ) -#set( $count1 = $velocityCount ) -#set( $startHr = ($count0 % $sizeHalf) == 0 ) -#set( $endHr = ($count0 % $sizeHalf) == ($sizeHalf - 1) ) - -#if( $startHr ) #end - -#end -#if( $endHr ) #end -
- #chartDropDownButtonDiv( "chartDropDown${count1}" "chartArea${count1}" $chart ) - #chartDropDownListDiv( "chartArea${count1}" "chartDropDown${count1}" $chart ) -
- -
+