dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26237
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12995: in data-element mgmt, removed old 'select data dictionary', implement 'select domain type' instead
------------------------------------------------------------
revno: 12995
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-11-21 10:28:42 +0100
message:
in data-element mgmt, removed old 'select data dictionary', implement 'select domain type' instead
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js
--
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/user/UserSettingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java 2013-09-19 12:43:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java 2013-11-21 09:28:42 +0000
@@ -46,6 +46,7 @@
final String AUTO_SAVE_DATA_ENTRY_FORM = "autoSaveDataEntryForm";
final String KEY_CURRENT_DATADICTIONARY = "currentDataDictionary";
+ final String KEY_CURRENT_DOMAIN_TYPE = "currentDomainType";
final String KEY_STYLE = "stylesheet";
final String KEY_STYLE_DIRECTORY = "stylesheetDirectory";
final String KEY_MESSAGE_EMAIL_NOTIFICATION = "keyMessageEmailNotification";
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java 2013-11-21 09:28:42 +0000
@@ -28,13 +28,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.apache.commons.lang.StringUtils.isNotBlank;
-import static org.hisp.dhis.user.UserSettingService.KEY_CURRENT_DATADICTIONARY;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.datadictionary.DataDictionary;
import org.hisp.dhis.datadictionary.DataDictionaryService;
@@ -43,6 +36,13 @@
import org.hisp.dhis.paging.ActionPagingSupport;
import org.hisp.dhis.user.UserSettingService;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.user.UserSettingService.KEY_CURRENT_DOMAIN_TYPE;
+
/**
* @author Torgeir Lorange Ostby
*/
@@ -85,31 +85,24 @@
return dataElements;
}
- private List<DataDictionary> dataDictionaries;
-
- public List<DataDictionary> getDataDictionaries()
- {
- return dataDictionaries;
- }
-
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
- private Integer dataDictionaryId;
+ private String domainType;
- public Integer getDataDictionaryId()
+ public String getDomainType()
{
- return dataDictionaryId;
+ return domainType;
}
- public void setDataDictionaryId( Integer dataDictionaryId )
+ public void setDomainType( String domainType )
{
- this.dataDictionaryId = dataDictionaryId;
+ this.domainType = domainType;
}
private String key;
-
+
public String getKey()
{
return key;
@@ -126,24 +119,20 @@
public String execute()
{
- if ( dataDictionaryId == null ) // None, get current data dictionary
- {
- dataDictionaryId = (Integer) userSettingService.getUserSetting( KEY_CURRENT_DATADICTIONARY );
- }
- else if ( dataDictionaryId == -1 ) // All, reset current data dictionary
- {
- userSettingService.saveUserSetting( KEY_CURRENT_DATADICTIONARY, null );
-
- dataDictionaryId = null;
- }
- else // Specified, set current data dictionary
- {
- userSettingService.saveUserSetting( KEY_CURRENT_DATADICTIONARY, dataDictionaryId );
- }
-
- dataDictionaries = new ArrayList<DataDictionary>( dataDictionaryService.getAllDataDictionaries() );
-
- Collections.sort( dataDictionaries, IdentifiableObjectNameComparator.INSTANCE );
+ if ( domainType == null ) // None, get current domain type
+ {
+ domainType = (String) userSettingService.getUserSetting( KEY_CURRENT_DOMAIN_TYPE );
+ }
+ else if ( "all".equals( domainType ) ) // All, reset current domain type
+ {
+ userSettingService.saveUserSetting( KEY_CURRENT_DOMAIN_TYPE, null );
+
+ domainType = null;
+ }
+ else // Specified, set current domain type
+ {
+ userSettingService.saveUserSetting( KEY_CURRENT_DOMAIN_TYPE, domainType );
+ }
// ---------------------------------------------------------------------
// Criteria
@@ -152,21 +141,19 @@
if ( isNotBlank( key ) ) // Filter on key only if set
{
this.paging = createPaging( dataElementService.getDataElementCountByName( key ) );
-
+
dataElements = new ArrayList<DataElement>( dataElementService.getDataElementsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
}
- else if ( dataDictionaryId != null )
+ else if ( domainType != null )
{
- dataElements = new ArrayList<DataElement>( dataDictionaryService.getDataElementsByDictionaryId( dataDictionaryId ) );
-
- this.paging = createPaging( dataElements.size() );
-
- dataElements = getBlockElement( dataElements, paging.getStartPos(), paging.getPageSize() );
+ this.paging = createPaging( dataElementService.getDataElementCountByDomainType( domainType ) );
+
+ dataElements = new ArrayList<DataElement>( dataElementService.getDataElementsByDomainType( domainType, paging.getStartPos(), paging.getPageSize() ) );
}
else
{
this.paging = createPaging( dataElementService.getDataElementCount() );
-
+
dataElements = new ArrayList<DataElement>( dataElementService.getDataElementsBetween( paging.getStartPos(), paging.getPageSize() ) );
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2013-10-07 17:59:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2013-11-21 09:28:42 +0000
@@ -93,6 +93,7 @@
updating_datadictionary_failed=Updating data dictionary failed
edit_data_dictionary=Edit data dictionary
select_data_dictionary=Select data dictionary
+select_domain_type=Select domain type
current=Current
date=Date
selected_data_elements=Selected data elements
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm 2013-10-13 16:15:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm 2013-11-21 09:28:42 +0000
@@ -38,21 +38,16 @@
<td>#filterDiv( "dataElement" )</td>
<td>
<div style="inline">
- <select id="dataDictionaryList" name="dataDictionaryList" onchange="criteriaChanged()" style="width:160px">
- <option value="-1">[ $i18n.getString( "select_data_dictionary" ) ]</option>
- #foreach( $dictionary in $dataDictionaries )
- <option value="$dictionary.id" #if ( $!dataDictionaryId && $dictionary.id == $dataDictionaryId ) selected="selected"#end>$dictionary.name</option>
- #end
- </select>
+ <select id="domainTypeList" name="domainTypeList" onchange="criteriaChanged()" style="width:160px">
+ <option value="all">[ $i18n.getString( "select_domain_type" ) ]</option>
+ <option value="aggregate" #if ( $!domainType && $domainType == "aggregate" ) selected="selected" #end>$i18n.getString("aggregate")</option>
+ <option value="patient" #if ( $!domainType && $domainType == "patient" ) selected="selected" #end>$i18n.getString("patient")</option>
+ </select>
</div>
</td>
<td style="text-align:right">
<input type="button" value="$i18n.getString( 'sort' )" onclick="window.location.href='showSortDataElementForm.action'" style="width:80px"/>
- #if ( $!dataDictionaryMode && $dataDictionaryMode == "extended" )
- <input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddExtendedDataElementForm.action'" style="width:80px"/>
- #else
- <input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddDataElementForm.action'" style="width:80px"/>
- #end
+ <input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddDataElementForm.action'" style="width:80px"/>
</td>
</tr>
</table>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js 2013-01-24 12:08:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js 2013-11-21 09:28:42 +0000
@@ -68,9 +68,9 @@
function criteriaChanged()
{
- var dataDictionaryId = getListValue( "dataDictionaryList" );
+ var domainType = getListValue( "domainTypeList" );
- var url = "dataElement.action?&dataDictionaryId=" + dataDictionaryId;
+ var url = "dataElement.action?&domainType=" + domainType;
window.location.href = url;
}