dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19342
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8394: Implemented search for charts, maps, reports etc directly from search field in dashboard
------------------------------------------------------------
revno: 8394
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-10-05 18:00:19 +0200
message:
Implemented search for charts, maps, reports etc directly from search field in dashboard
added:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/chart_small.png
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/dataset_small.png
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/document_small.png
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/map_small.png
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/table_small.png
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/SearchAction.java
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/hits.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
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/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/chart.png
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/org/hisp/dhis/dashboard/i18n_module.properties
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/struts.xml
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/mainForm.vm
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== 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 2012-07-03 21:19:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardService.java 2012-10-05 16:00:19 +0000
@@ -27,6 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.document.Document;
import org.hisp.dhis.mapping.MapView;
import org.hisp.dhis.report.Report;
@@ -34,6 +35,7 @@
import org.hisp.dhis.user.User;
import java.util.Collection;
+import java.util.List;
/**
* @author Lars Helge Overland
@@ -42,6 +44,8 @@
{
final String ID = DashboardService.class.getName();
+ List<IdentifiableObject> search( String query );
+
void saveDashboardContent( DashboardContent dashboardContent );
void updateDashboardContent( DashboardContent dashboardContent );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2012-07-01 11:33:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2012-10-05 16:00:19 +0000
@@ -159,6 +159,8 @@
Collection<MapView> getMapViewsByFeatureType( String featureType );
Collection<MapView> getMapViewsByUser( User user );
+
+ Collection<MapView> getMapViewsBetweenByName( String name, int first, int max );
// -------------------------------------------------------------------------
// MapLayer
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2012-07-01 11:33:07 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2012-10-05 16:00:19 +0000
@@ -603,6 +603,11 @@
{
return mapViewStore.getByUser( user );
}
+
+ public Collection<MapView> getMapViewsBetweenByName( String name, int first, int max )
+ {
+ return mapViewStore.getBetweenByName( name, first, max );
+ }
// -------------------------------------------------------------------------
// MapLayer
=== 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 2012-07-03 21:19:51 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java 2012-10-05 16:00:19 +0000
@@ -27,15 +27,23 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
+import org.hisp.dhis.chart.ChartService;
+import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.dashboard.DashboardContent;
import org.hisp.dhis.dashboard.DashboardContentStore;
import org.hisp.dhis.dashboard.DashboardService;
import org.hisp.dhis.document.Document;
+import org.hisp.dhis.document.DocumentService;
import org.hisp.dhis.mapping.MapView;
+import org.hisp.dhis.mapping.MappingService;
import org.hisp.dhis.report.Report;
+import org.hisp.dhis.report.ReportService;
import org.hisp.dhis.reporttable.ReportTable;
+import org.hisp.dhis.reporttable.ReportTableService;
import org.hisp.dhis.user.User;
import org.springframework.transaction.annotation.Transactional;
@@ -48,6 +56,9 @@
public class DefaultDashboardService
implements DashboardService
{
+ private static final int MAX_PER_OBJECT = 6;
+ private static final int MAX_OBJECTS = 18;
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -58,11 +69,75 @@
{
this.dashboardContentStore = dashboardContentStore;
}
+
+ private ChartService chartService;
+
+ public void setChartService( ChartService chartService )
+ {
+ this.chartService = chartService;
+ }
+
+ private MappingService mappingService;
+
+ public void setMappingService( MappingService mappingService )
+ {
+ this.mappingService = mappingService;
+ }
+
+ private ReportService reportService;
+
+ public void setReportService( ReportService reportService )
+ {
+ this.reportService = reportService;
+ }
+
+ private ReportTableService reportTableService;
+
+ public void setReportTableService( ReportTableService reportTableService )
+ {
+ this.reportTableService = reportTableService;
+ }
+
+ private DocumentService documentService;
+
+ public void setDocumentService( DocumentService documentService )
+ {
+ this.documentService = documentService;
+ }
// -------------------------------------------------------------------------
// DashboardService implementation
// -------------------------------------------------------------------------
+ public List<IdentifiableObject> search( String query )
+ {
+ //TODO users
+
+ List<IdentifiableObject> objects = new ArrayList<IdentifiableObject>();
+
+ int remaining = 0;
+
+ objects.addAll( chartService.getChartsBetweenByName( query, 0, MAX_PER_OBJECT ) );
+ objects.addAll( mappingService.getMapViewsBetweenByName( query, 0, MAX_PER_OBJECT ) );
+ objects.addAll( reportService.getReportsBetweenByName( query, 0, MAX_PER_OBJECT ) );
+
+ remaining = MAX_OBJECTS - objects.size();
+
+ if ( remaining > 0 )
+ {
+ objects.addAll( reportTableService.getReportTablesBetweenByName( query, 0, Math.min( remaining, MAX_OBJECTS ) ) );
+ }
+
+ remaining = MAX_OBJECTS - objects.size();
+
+ if ( remaining > 0 )
+ {
+ objects.addAll( documentService.getDocumentsBetweenByName( query, 0, Math.min( remaining, MAX_OBJECTS ) ) );
+ }
+
+ return objects;
+ }
+
public void saveDashboardContent( DashboardContent dashboardContent )
{
dashboardContentStore.save( dashboardContent );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-09-24 12:52:15 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-10-05 16:00:19 +0000
@@ -155,6 +155,11 @@
<bean id="org.hisp.dhis.dashboard.DashboardService" class="org.hisp.dhis.dashboard.impl.DefaultDashboardService">
<property name="dashboardContentStore" ref="org.hisp.dhis.dashboard.DashboardContentStore" />
+ <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
+ <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
+ <property name="reportService" ref="org.hisp.dhis.report.ReportService" />
+ <property name="reportTableService" ref="org.hisp.dhis.reporttable.ReportTableService" />
+ <property name="documentService" ref="org.hisp.dhis.document.DocumentService" />
</bean>
<!-- Dashboard Content providers -->
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java 2012-10-01 13:44:31 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java 2012-10-05 16:00:19 +0000
@@ -77,11 +77,17 @@
public enum CacheStrategy
{
NO_CACHE,
+ CACHE_1_HOUR,
CACHE_6AM_TOMORROW,
CACHE_TWO_WEEKS,
RESPECT_SYSTEM_SETTING
}
+ public void configureResponse( HttpServletResponse response, String contentType, CacheStrategy cacheStrategy )
+ {
+ configureResponse( response, contentType, cacheStrategy, null, false );
+ }
+
public void configureResponse( HttpServletResponse response, String contentType, CacheStrategy cacheStrategy,
String filename, boolean attachment )
{
@@ -107,6 +113,14 @@
response.setHeader( HEADER_CACHE_CONTROL, "max-age=1" );
response.setHeader( HEADER_EXPIRES, DateUtils.getExpiredHttpDateString() );
}
+ else if ( cacheStrategy.equals( CacheStrategy.CACHE_1_HOUR ) )
+ {
+ Calendar cal = Calendar.getInstance();
+ cal.add( Calendar.HOUR_OF_DAY, 1 );
+
+ response.setHeader( HEADER_CACHE_CONTROL, "public, max-age=3600" );
+ response.setHeader( HEADER_EXPIRES, DateUtils.getHttpDateString( cal.getTime() ) );
+ }
else if ( cacheStrategy.equals( CacheStrategy.CACHE_6AM_TOMORROW ) )
{
response.setHeader( HEADER_CACHE_CONTROL, "public, max-age=" + DateUtils.getSecondsUntilTomorrow( 6 ) );
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/chart.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/chart.png 2012-10-04 10:34:08 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/chart.png 2012-10-05 16:00:19 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/chart_small.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/chart_small.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/chart_small.png 2012-10-05 16:00:19 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/dataset_small.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/dataset_small.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/dataset_small.png 2012-10-05 16:00:19 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/document_small.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/document_small.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/document_small.png 2012-10-05 16:00:19 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/map_small.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/map_small.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/map_small.png 2012-10-05 16:00:19 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/table_small.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/table_small.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/table_small.png 2012-10-05 16:00:19 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/SearchAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/SearchAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/SearchAction.java 2012-10-05 16:00:19 +0000
@@ -0,0 +1,95 @@
+package org.hisp.dhis.dashboard.action;
+
+/*
+ * Copyright (c) 2004-2012, 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.
+ */
+
+import static org.hisp.dhis.api.utils.ContextUtils.CONTENT_TYPE_HTML;
+
+import java.util.List;
+
+import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.api.utils.ContextUtils;
+import org.hisp.dhis.api.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.dashboard.DashboardService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class SearchAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private DashboardService dashboardService;
+
+ @Autowired
+ private ContextUtils contextUtils;
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String q;
+
+ public void setQ( String q )
+ {
+ this.q = q;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private List<IdentifiableObject> objects;
+
+ public List<IdentifiableObject> getObjects()
+ {
+ return objects;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ objects = dashboardService.search( q );
+
+ // TODO search and cache per user
+
+ contextUtils.configureResponse( ServletActionContext.getResponse(), CONTENT_TYPE_HTML, CacheStrategy.CACHE_1_HOUR );
+
+ 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-06-03 16:26:12 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml 2012-10-05 16:00:19 +0000
@@ -55,6 +55,10 @@
<property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
</bean>
+ <bean id="org.hisp.dhis.dashboard.action.SearchAction" class="org.hisp.dhis.dashboard.action.SearchAction"
+ scope="prototype">
+ </bean>
+
<!-- Message -->
<bean id="org.hisp.dhis.dashboard.message.action.GetMessagesAction" class="org.hisp.dhis.dashboard.message.action.GetMessagesAction"
=== 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 2012-10-05 08:36:10 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2012-10-05 16:00:19 +0000
@@ -62,4 +62,6 @@
generate_data_set_report_click_share=generate a data set report and click 'Share' on the top menu
data_visualizer=Data visualizer
report_table=Report table
-data_set_report=Data set report
\ No newline at end of file
+data_set_report=Data set report
+search_for_charts_maps_reports=Search for charts, maps and reports
+no_hits=No hits, try again
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/struts.xml 2012-09-30 17:45:22 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/struts.xml 2012-10-05 16:00:19 +0000
@@ -48,6 +48,11 @@
<result name="success" type="redirect">index.action</result>
</action>
+ <action name="search" class="org.hisp.dhis.dashboard.action.SearchAction">
+ <result name="success" type="velocity">/dhis-web-dashboard-integration/hits.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
<!-- Message -->
<action name="message" class="org.hisp.dhis.dashboard.message.action.GetMessagesAction">
=== added file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/hits.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/hits.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/hits.vm 2012-10-05 16:00:19 +0000
@@ -0,0 +1,21 @@
+<ul>
+#if( $objects.size() > 0 )
+#foreach( $o in $objects )
+#if( $o )
+#if( "Chart" == $o.getClass().getSimpleName() )
+<li><a href="../dhis-web-visualizer/app/index.html?id=${o.uid}"><img src="../images/chart_small.png"> $encoder.htmlEncode( $o.name )</a></li>
+#elseif( "MapView" == $o.getClass().getSimpleName() )
+<li><a href="../dhis-web-mapping/mapping/index.html?id=${o.uid}"><img src="../images/map_small.png"> $encoder.htmlEncode( $o.name )</a></li>
+#elseif( "Report" == $o.getClass().getSimpleName() )
+<li><a href="../dhis-web-reporting/getReportParams.action?uid=${o.uid}&mode=report"><img src="../images/table_small.png"> $encoder.htmlEncode( $o.name )</a></li>
+#elseif( "ReportTable" == $o.getClass().getSimpleName() )
+<li><a href="../dhis-web-reporting/getReportParams.action?uid=${o.uid}&mode=table"><img src="../images/table_small.png"> $encoder.htmlEncode( $o.name )</a></li>
+#elseif( "Document" == $o.getClass().getSimpleName() )
+<li><a href="../api/documents/${o.uid}/data"><img src="../images/document_small.png"> $encoder.htmlEncode( $o.name )</a></li>
+#end
+#end
+#end
+#else
+<li>$i18n.getString( "no_hits" )</li>
+#end
+</ul>
\ No newline at end of file
=== 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-07-27 12:38:08 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dropdown.js 2012-10-05 16:00:19 +0000
@@ -3,6 +3,10 @@
{
$( "#interpretationArea" ).autogrow();
+ $( document ).click( hideSearch );
+
+ $( "#searchField" ).keyup( search );
+
var viewportWidth = parseInt( $( window ).width() );
var linkWidth = parseInt( 338 );
var chartWidth = parseInt( 325 );
@@ -109,3 +113,23 @@
title: "Share your data interpretations"
} );
}
+
+function search( e )
+{
+ var query = $.trim( $( "#searchField" ).val() );
+
+ if ( query.length == 0 )
+ {
+ hideSearch();
+ return false;
+ }
+
+ var hits = $.get( "search.action", { q:query }, function( data ) {
+ $( "#hitDiv" ).show().html( data );
+ } );
+}
+
+function hideSearch()
+{
+ $( "#hitDiv" ).hide();
+}
=== 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-10-05 08:36:10 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm 2012-10-05 16:00:19 +0000
@@ -13,9 +13,15 @@
</h3>
<div id="subMenu">
- <ul><li><a href="message.action">$i18n.getString( "messages" )</a></li><li><a href="interpretation.action">$i18n.getString( "interpretations" )</a></li></ul>
+ <ul>
+ <li><a href="message.action">$i18n.getString( "messages" )</a></li>
+ <li><a href="interpretation.action">$i18n.getString( "interpretations" )</a></li>
+ </ul>
</div>
+<div id="searchDiv"><input type="text" id="searchField" autocomplete="off" placeholder="$i18n.getString( 'search_for_charts_maps_reports' )"></div>
+<div id="hitDiv"></div>
+
<div id="contentDiv"></div>
<div id="chartView">
=== 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 2012-10-04 10:34:08 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css 2012-10-05 16:00:19 +0000
@@ -5,71 +5,72 @@
.contentProviderTable
{
- width:295px;
+ width: 295px;
}
.contentProviderTable td
{
- padding-top:3px;
- padding-bottom:3px;
- border-bottom:1px solid #cad5e5;
+ padding-top: 3px;
+ padding-bottom: 3px;
+ border-bottom: 1px solid #cad5e5;
}
#contentDiv
{
- position:relative;
- top: 38px;
+ position: relative;
+ top: 44px;
}
.removeIcon
{
- padding:2px 2px 1px 2px;
+ padding: 2px 2px 1px 2px;
}
.linkArea
{
- border:1px solid #d0d0d0;
- padding:1px;
- height:196px;
- width:295px;
- overflow:hidden;
- margin-bottom:15px;
+ border: 1px solid #d0d0d0;
+ padding: 1px;
+ height: 196px;
+ width: 295px;
+ overflow: hidden;
+ margin-bottom: 15px;
}
.linkArea div
{
- position:absolute;
+ position: absolute;
}
.chartArea
{
- border:1px solid #d0d0d0;
- padding:1px;
- height:310px;
- width:310px;
- overflow:hidden;
- margin-bottom:15px;
+ border: 1px solid #d0d0d0;
+ padding: 1px;
+ height: 310px;
+ width: 310px;
+ overflow: hidden;
+ margin-bottom: 15px;
}
.chartArea div
{
- position:absolute;
+ position: absolute;
}
.buttonArea
{
- margin-bottom:2px;
+ margin-bottom: 2px;
}
.labelText
{
- color:#888;
- padding:3px;
+ color: #888;
+ padding: 3px;
}
#subMenu
{
- position:absolute;
+ position: absolute;
+ margin-top: 6px;
}
#subMenu ul
@@ -102,6 +103,51 @@
background-color: #f8f8f8;
}
+#searchDiv
+{
+ position: absolute;
+ left: 260px;
+ height: 25px;
+ width: 330px;
+ border: 1px solid #ccc;
+ padding: 2px 6px 0 6px;
+}
+
+#searchField
+{
+ width: 300px;
+ border: 0;
+ outline: none;
+ width: 100%;
+ vertical-align: top;
+ font-size: 10pt;
+}
+
+#hitDiv
+{
+ position: absolute;
+ margin-top: 29px;
+ left: 260px;
+ width: 342px;
+ border-right: 1px solid #bbb;
+ border-bottom: 1px solid #bbb;
+ border-left: 1px solid #bbb;
+ background-color: #fff;
+ display: none;
+ overflow: hidden;
+ z-index: 20;
+}
+
+#hitDiv ul
+{
+ list-style-type: none;
+}
+
+#hitDiv li
+{
+ padding: 5px 5px 5px 10px;
+}
+
#shareForm
{
display: none;
@@ -161,42 +207,42 @@
.plainList
{
- border-collapse:collapse;
+ border-collapse: collapse;
}
.plainList td
{
- border-bottom:1px solid #c0c0c0;
- cursor:pointer;
+ border-bottom: 1px solid #c0c0c0;
+ cursor: pointer;
}
.unread td
{
- background-color:#ebf0f6;
+ background-color: #ebf0f6;
}
.messageDiv
{
- width:50%;
- border-bottom:1px solid #cccccc;
- margin-bottom:15px;
- padding-bottom:15px;
+ width: 50%;
+ border-bottom: 1px solid #cccccc;
+ margin-bottom: 15px;
+ padding-bottom: 15px;
}
.messageBottomDiv
{
- width:50%;
- border-top:1px solid #cccccc;
- margin-top:20px;
- padding-top:15px;
- margin-bottom:20px;
- padding-bottom:15px;
+ width: 50%;
+ border-top: 1px solid #cccccc;
+ margin-top: 20px;
+ padding-top: 15px;
+ margin-bottom: 20px;
+ padding-bottom: 15px;
}
.replyArea
{
- width:495px;
- height:80px;
+ width: 495px;
+ height: 80px;
border: 1px solid #ccc;
resize: none;
overflow: auto;
@@ -205,7 +251,7 @@
div#selectionTree
{
- height:200px;
+ height: 200px;
}
.grey
@@ -292,4 +338,3 @@
{
cursor:pointer;
}
-