dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17921
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7331: Searching inputted value by ajax instead of loading suggested values for attributes and dataeleme...
------------------------------------------------------------
revno: 7331
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-06-20 13:32:51 +0700
message:
Searching inputted value by ajax instead of loading suggested values for attributes and dataelement in Tabular report.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetOptionsByDataElementAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonOptions.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReportResult.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.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-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetOptionsByDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetOptionsByDataElementAction.java 2012-06-15 04:41:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetOptionsByDataElementAction.java 2012-06-20 06:32:51 +0000
@@ -72,11 +72,11 @@
this.id = id;
}
- private String key;
+ private String query;
- public void setKey( String key )
+ public void setQuery( String query )
{
- this.key = key;
+ this.query = query;
}
// -------------------------------------------------------------------------
@@ -98,7 +98,7 @@
{
DataElement dataElement = dataElementService.getDataElement( id );
- options = optionService.getOptions( dataElement.getOptionSet(), key );
+ options = optionService.getOptions( dataElement.getOptionSet(), query );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 2012-06-14 13:07:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 2012-06-20 06:32:51 +0000
@@ -400,10 +400,6 @@
values.add( i18n.getString( "yes" ) );
values.add( i18n.getString( "no" ) );
}
- else if ( dataElement.getOptionSet() != null )
- {
- values = dataElement.getOptionSet().getOptions();
- }
return values;
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-06-14 13:07:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-06-20 06:32:51 +0000
@@ -55,7 +55,8 @@
favorite_delete: 'deleteTabularReport.action',
datavalue_save: 'saveValue.action',
datavalue_delete: 'removeCurrentEncounter.action',
- redirect: 'index.action'
+ suggested_dataelement_get: 'getOptions.action',
+ redirect: 'index.action'
},
params: {
data: {
@@ -1236,7 +1237,6 @@
editable: true,
valueField: 'name',
displayField: 'name',
- allowBlank: true,
store: new Ext.data.ArrayStore({
fields: ['name'],
data: TR.value.columns[index].suggested
@@ -1444,69 +1444,68 @@
},
createColumn: function( type, id, compulsory, cols, index )
{
+ var objectType = id.split('_')[0];
+ var objectId = id.split('_')[1];
+
+ var params = {};
+ params.header = TR.value.columns[index].name;
+ params.dataIndex = 'col' + index;
+ params.name = id;
+ params.hidden = eval(TR.value.columns[index].hidden );
+ params.menuFilterText = TR.value.filter;
+ params.sortable = false;
+ params.draggable = true;
+ params.isEditAllowed = true;
+ params.compulsory = compulsory;
+
+ params.editor = {};
+ params.editor.xtype = TR.value.covertXType( type );
+ params.editor.editable = true;
+
+ params.filter = {};
+ params.filter.type = TR.value.covertValueType( type );
+
if( type.toLowerCase() == 'date' )
{
- return {
- header: TR.value.columns[index].name,
- dataIndex: 'col' + index,
- name: id,
- hidden: eval(TR.value.columns[index].hidden ),
- menuFilterText: TR.value.filter,
- sortable: false,
- draggable: true,
- isEditAllowed: true,
- compulsory: compulsory,
- renderer: Ext.util.Format.dateRenderer( TR.i18n.format_date ),
- filter: {
- type:TR.value.covertValueType( type ),
- dateFormat: TR.i18n.format_date,
- beforeText: TR.i18n.before,
- afterText: TR.i18n.after,
- onText: TR.i18n.on
- },
- editor: {
- xtype: TR.value.covertXType( type ),
- format: TR.i18n.format_date,
- queryMode: 'local',
- editable: true,
- valueField: 'name',
- displayField: 'name',
- allowBlank: true,
- store: new Ext.data.ArrayStore({
- fields: ['name'],
- data: TR.value.columns[index].suggested
- })
+ params.renderer = Ext.util.Format.dateRenderer( TR.i18n.format_date );
+ params.filter.dateFormat = TR.i18n.format_date;
+ params.filter.beforeText = TR.i18n.before;
+ params.filter.afterText = TR.i18n.after;
+ params.filter.onText = TR.i18n.on;
+
+ params.editor.format = TR.i18n.format_date;
+ }
+ else if( type.toLowerCase() == 'list' )
+ {
+ params.editor.xtype = 'combobox';
+ params.editor.typeAhead = true;
+ params.editor.triggerAction = 'all';
+ params.editor.transform = 'light';
+ params.editor.lazyRender = true;
+ params.editor.forceSelection = true;
+ params.editor.minChars = 2;
+ params.editor.hideTrigger = true;
+ params.editor.validateOnBlur = true;
+ params.editor.queryMode = 'remote';
+ params.editor.valueField = 'o';
+ params.editor.displayField = 'o';
+ params.editor.store = Ext.create('Ext.data.Store', {
+ fields: ['o'],
+ data:[],
+ expandData: true,
+ proxy: {
+ type: 'ajax',
+ url: TR.conf.finals.ajax.path_commons + TR.conf.finals.ajax.suggested_dataelement_get,
+ extraParams:{id: objectId},
+ reader: {
+ type: 'json',
+ root: 'options'
+ }
}
- }
+ })
}
- return {
- header: TR.value.columns[index].name,
- dataIndex: 'col' + index,
- name: id,
- hidden: eval(TR.value.columns[index].hidden ),
- menuFilterText: TR.value.filter,
- sortable: false,
- draggable: true,
- isEditAllowed: true,
- compulsory: compulsory,
- filter: {
- type:TR.value.covertValueType( type ),
- options: TR.value.columns[index].suggested
- },
- editor: {
- xtype: TR.value.covertXType( type ),
- queryMode: 'local',
- editable: true,
- valueField: 'name',
- displayField: 'name',
- allowBlank: true,
- store: new Ext.data.ArrayStore({
- fields: ['name'],
- data: TR.value.columns[index].suggested
- })
- }
- }
+ return params;
},
setPagingToolbarStatus: function() {
Ext.getCmp('currentPage').enable();
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-06-18 02:36:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-06-20 06:32:51 +0000
@@ -115,8 +115,8 @@
function getDateField( container )
{
- var dateField = '<select id="dateOperator" name="dateOperator" ><option value=">"> > </option><option value="="> = </option><option value="<"> < </option></select>';
- dateField += '<input type="text" id="searchText" name="searchText" maxlength="30" style="width:18em" onkeyup="searchPatientsOnKeyUp( event );">';
+ var dateField = '<select id="dateOperator" style="width:30px;" name="dateOperator" ><option value=">"> > </option><option value="="> = </option><option value="<"> < </option></select>';
+ dateField += '<input type="text" id="searchText" name="searchText" maxlength="30" style="width:15.6em" onkeyup="searchPatientsOnKeyUp( event );">';
return dateField;
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2012-06-18 09:40:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2012-06-20 06:32:51 +0000
@@ -811,13 +811,13 @@
minLength: 0,
source: function( request, response ){
$.ajax({
- url: "getOptions.action?id=" + dataElementId + "&key=" + input.val(),
+ url: "getOptions.action?id=" + dataElementId + "&query=" + input.val(),
dataType: "json",
success: function(data) {
response($.map(data.options, function(item) {
return {
- label: item,
- id: item
+ label: item.o,
+ id: item.o
};
}));
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js 2012-06-07 04:23:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js 2012-06-20 06:32:51 +0000
@@ -65,7 +65,7 @@
jQuery("#patientList input[name='programStageBtn']").each(function(i,item){
jQuery(item).removeClass('stage-object-selected');
});
- jQuery( '#' + prefixStageId + programStageInstanceId ).addClass('stage-object-selected');
+ jQuery( '#' + prefixId + programStageInstanceId ).addClass('stage-object-selected');
$('#contentDataRecord').dialog('destroy').remove();
$('<div id="contentDataRecord">' ).load("viewProgramStageRecords.action",
@@ -73,13 +73,13 @@
programStageInstanceId: programStageInstanceId
}).dialog(
{
- title: 'ProgramStage',
- maximize: true,
- closable: true,
+ title:i18n_program_stage,
+ maximize:true,
+ closable:true,
modal:false,
overlay:{background:'#000000', opacity:0.1},
- width: 800,
- height: 400
+ width:800,
+ height:400
});
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonOptions.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonOptions.vm 2012-06-15 04:41:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonOptions.vm 2012-06-20 06:32:51 +0000
@@ -1,7 +1,2 @@
-{ "options": [
- #foreach( $option in $options )
- "$option",
- #end
- ""
- ]
+{ "options": [#foreach( $option in $options ){"o":"$option"}#if( $velocityCount < $options.size() ),#end #end]
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReportResult.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReportResult.vm 2012-06-14 13:07:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReportResult.vm 2012-06-20 06:32:51 +0000
@@ -8,19 +8,19 @@
#set($index = 0)
#foreach( $col in $grid.getHeaders() )
{
- #set( $mapIndx = $index - $metaData )
- "xtype": #if( $mapSuggestedValues.get($mapIndx) && $index > $metaData && $mapSuggestedValues.get($mapIndx).size() > 0 )
+ #set( $mapIndx = $index - $metaData )
+ "xtype": #if( $mapSuggestedValues.get($mapIndx) && $index > $metaData && $mapSuggestedValues.get($mapIndx).size() > 0 )
"combobox"
#else
"textfield"
#end,
- "suggested": [#set( $suggestedValues = $mapSuggestedValues.get($mapIndx) )
+ "suggested": [#set( $suggestedValues = $mapSuggestedValues.get($mapIndx) )
#foreach( $suggestedValue in $suggestedValues )
["$!encoder.jsonEncode( ${suggestedValue} )"]
#if( $velocityCount < $suggestedValues.size() ),#end
#end],
- "name": "$col.name",
- "hidden": "$col.hidden"
+ "name": "$col.name",
+ "hidden": "$col.hidden"
}#if( $velocityCount < $noHeader ),#end
#set($index = $index + 1)
#end
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm 2012-06-05 08:47:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm 2012-06-20 06:32:51 +0000
@@ -45,4 +45,5 @@
var i18n_date_of_birth = '$encoder.jsEscape( $i18n.getString( "date_of_birth" ), "'")';
var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';
var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
-</script>
\ No newline at end of file
+ var i18n_program_stage = '$encoder.jsEscape( $i18n.getString( "program_stage" ) , "'")';
+</script>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2012-06-18 08:38:51 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2012-06-20 06:32:51 +0000
@@ -133,7 +133,7 @@
white-space: normal;
border:2px solid;
border-color:#bbbbbb;
- background-color:#cccccc
+ background-color:#cccccc;
cursor:pointer;
}