Re: [Dhis2-devs] Web portal CORS/preflight problem

2015-08-27 Thread Alex Tumwesigye
Dear Khan,

Look at this
http://api.jquery.com/jquery.ajax/
Read about crossDomain, by default it set to false so you may need to set
it to true.

Ideally, in your ajax request, add crossDomain:true

Alex



On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak  wrote:

> Hello Hanna,
>
> Did you add http:// (or https:// if you use a secure line) in front of
> the IP address?
>
> On the demo instance this is a bit confusing as the examples do not show
> that but it is required for it to work correctly.
>
> Regards,
>
> Mark
> 
> From: Dhis2-devs [dhis2-devs-bounces+markpo=ifi.uio...@lists.launchpad.net]
> on behalf of Hannan Khan [hann...@gmail.com]
> Sent: 27 August 2015 08:29
> To: DHIS 2 developers
> Subject: [Dhis2-devs] Web portal CORS/preflight problem
>
> Dear Experts
>
> I am facing problem to creating Web Portal, facing problem CORS.
> First I try portal from 103.247.238.68 not working and then put this
> address in the white list of the dhis2 server at 103.247.238.68:8080<
> http://103.247.238.68:8080>. But but still having the same problem the
> error message is 'which is disallowed for cross-origin requests that
> require preflight'.
>
> Now how I resolve this? The script is similar as on the developer guide,
> page 49.
>
> Please advice.
>
> Regards
>
> Hannan
>
> ___
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>



-- 
Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET
Kampala
Uganda

IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

IT Specialist (Servers, Networks and Security, Health Information Systems -
DHIS2 ) & Solar Consultant

+256 774149 775, + 256 759 800161

"I don't want to be anything other than what I have been - one tree hill "
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 19866: minor fix

2015-08-27 Thread noreply

revno: 19866
committer: Morten Olav Hansen 
branch nick: dhis2
timestamp: Thu 2015-08-27 15:15:43 +0700
message:
  minor fix
modified:
  
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java


--
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-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java	2015-08-24 03:20:05 +
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java	2015-08-27 08:15:43 +
@@ -60,7 +60,7 @@
 DateTimeUnit startOfYear = calendar.isoStartOfYear( year );
 DateTime time = new DateTime( year, startOfYear.getMonth(), startOfYear.getDay(), 1, 1 );
 
-return PERIODTYPE.createPeriod( time.toDate() );
+return PERIODTYPE.createPeriod( time.toDate(), calendar );
 }
 
 public static Date getEarliestDate( Integer lastYears )

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] Web portal CORS/preflight problem

2015-08-27 Thread Hannan Khan
Dear Alex

Thank you for sharing the resources. but the problem still persists. i
write as following:

Ext.onReady( function() {
  Ext.Ajax.request({
crossDomain: true,
url: base + "dhis-web-commons-security/login.action?authOnly=true",
method: 'POST',

Please check.

Regards

Hannan

On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye 
wrote:

> Dear Khan,
>
> Look at this
> http://api.jquery.com/jquery.ajax/
> Read about crossDomain, by default it set to false so you may need to set
> it to true.
>
> Ideally, in your ajax request, add crossDomain:true
>
> Alex
>
>
>
> On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak  wrote:
>
>> Hello Hanna,
>>
>> Did you add http:// (or https:// if you use a secure line) in front of
>> the IP address?
>>
>> On the demo instance this is a bit confusing as the examples do not show
>> that but it is required for it to work correctly.
>>
>> Regards,
>>
>> Mark
>> 
>> From: Dhis2-devs [dhis2-devs-bounces+markpo=
>> ifi.uio...@lists.launchpad.net] on behalf of Hannan Khan [
>> hann...@gmail.com]
>> Sent: 27 August 2015 08:29
>> To: DHIS 2 developers
>> Subject: [Dhis2-devs] Web portal CORS/preflight problem
>>
>> Dear Experts
>>
>> I am facing problem to creating Web Portal, facing problem CORS.
>> First I try portal from 103.247.238.68 not working and then put this
>> address in the white list of the dhis2 server at 103.247.238.68:8080<
>> http://103.247.238.68:8080>. But but still having the same problem the
>> error message is 'which is disallowed for cross-origin requests that
>> require preflight'.
>>
>> Now how I resolve this? The script is similar as on the developer guide,
>> page 49.
>>
>> Please advice.
>>
>> Regards
>>
>> Hannan
>>
>> ___
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>
>
>
> --
> Alex Tumwesigye
>
> Technical Advisor - DHIS2 (Consultant),
> Ministry of Health/AFENET
> Kampala
> Uganda
>
> IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya
>
> IT Specialist (Servers, Networks and Security, Health Information Systems
> - DHIS2 ) & Solar Consultant
>
> +256 774149 775, + 256 759 800161
>
> "I don't want to be anything other than what I have been - one tree hill "
>
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] Web portal CORS/preflight problem

2015-08-27 Thread Morten Olav Hansen
Hi Hannan

I haven't used the portal plugins (maybe Jan can help there), but what I
did when I implemented CORS for DHIS 2, was to simply test using this:

$.ajax({
  url: 'some-web-api-url.json',
  headers: { "Authorization": btoa('admin:district' }
}).done(...);

Also remember that there must be a 100% match between where your request is
coming from, and what is in the whitelist, this also means that you must
make the request from a http server, you can't make just a index.html file
and open it in a browser.

You can also enable a bit more debug output from your server by finding the
file in web-commons called log4j.properties (in your unpacked WAR file) and
add this line to the end:

log4j.logger.org.hisp.dhis.security.filter = DEBUG


--
Morten

On Thu, Aug 27, 2015 at 3:37 PM, Hannan Khan  wrote:

> Dear Alex
>
> Thank you for sharing the resources. but the problem still persists. i
> write as following:
>
> Ext.onReady( function() {
>   Ext.Ajax.request({
> crossDomain: true,
> url: base + "dhis-web-commons-security/login.action?authOnly=true",
> method: 'POST',
>
> Please check.
>
> Regards
>
> Hannan
>
> On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye 
> wrote:
>
>> Dear Khan,
>>
>> Look at this
>> http://api.jquery.com/jquery.ajax/
>> Read about crossDomain, by default it set to false so you may need to set
>> it to true.
>>
>> Ideally, in your ajax request, add crossDomain:true
>>
>> Alex
>>
>>
>>
>> On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak  wrote:
>>
>>> Hello Hanna,
>>>
>>> Did you add http:// (or https:// if you use a secure line) in front of
>>> the IP address?
>>>
>>> On the demo instance this is a bit confusing as the examples do not show
>>> that but it is required for it to work correctly.
>>>
>>> Regards,
>>>
>>> Mark
>>> 
>>> From: Dhis2-devs [dhis2-devs-bounces+markpo=
>>> ifi.uio...@lists.launchpad.net] on behalf of Hannan Khan [
>>> hann...@gmail.com]
>>> Sent: 27 August 2015 08:29
>>> To: DHIS 2 developers
>>> Subject: [Dhis2-devs] Web portal CORS/preflight problem
>>>
>>> Dear Experts
>>>
>>> I am facing problem to creating Web Portal, facing problem CORS.
>>> First I try portal from 103.247.238.68 not working and then put this
>>> address in the white list of the dhis2 server at 103.247.238.68:8080<
>>> http://103.247.238.68:8080>. But but still having the same problem the
>>> error message is 'which is disallowed for cross-origin requests that
>>> require preflight'.
>>>
>>> Now how I resolve this? The script is similar as on the developer guide,
>>> page 49.
>>>
>>> Please advice.
>>>
>>> Regards
>>>
>>> Hannan
>>>
>>> ___
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to : dhis2-devs@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>
>>
>>
>> --
>> Alex Tumwesigye
>>
>> Technical Advisor - DHIS2 (Consultant),
>> Ministry of Health/AFENET
>> Kampala
>> Uganda
>>
>> IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya
>>
>> IT Specialist (Servers, Networks and Security, Health Information Systems
>> - DHIS2 ) & Solar Consultant
>>
>> +256 774149 775, + 256 759 800161
>>
>> "I don't want to be anything other than what I have been - one tree hill "
>>
>
>
> ___
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] Web portal CORS/preflight problem

2015-08-27 Thread Morten Olav Hansen
On Thu, Aug 27, 2015 at 3:47 PM, Morten Olav Hansen 
wrote:

>   headers: { "Authorization": btoa('admin:district' }
>

That should be headers: { "Authorization": 'Basic ' + btoa('admin:district'
}

--
Morten
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] Web portal CORS/preflight problem

2015-08-27 Thread Jan Henrik Øverland
Hi Hannan,

I have done some testing and it seems the bundled Ext version is getting
old. CORS is not working well with it.

We need to look at this, but for now just include
https://code.jquery.com/jquery-2.1.4.min.js (minified, only 84k) and do the
authentication with jquery.

The good thing about CORS is that you can simply do a normal ajax request
and the browser will take care of the rest.

On Thu, Aug 27, 2015 at 10:37 AM, Hannan Khan  wrote:

> Dear Alex
>
> Thank you for sharing the resources. but the problem still persists. i
> write as following:
>
> Ext.onReady( function() {
>   Ext.Ajax.request({
> crossDomain: true,
> url: base + "dhis-web-commons-security/login.action?authOnly=true",
> method: 'POST',
>
> Please check.
>
> Regards
>
> Hannan
>
> On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye 
> wrote:
>
>> Dear Khan,
>>
>> Look at this
>> http://api.jquery.com/jquery.ajax/
>> Read about crossDomain, by default it set to false so you may need to set
>> it to true.
>>
>> Ideally, in your ajax request, add crossDomain:true
>>
>> Alex
>>
>>
>>
>> On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak  wrote:
>>
>>> Hello Hanna,
>>>
>>> Did you add http:// (or https:// if you use a secure line) in front of
>>> the IP address?
>>>
>>> On the demo instance this is a bit confusing as the examples do not show
>>> that but it is required for it to work correctly.
>>>
>>> Regards,
>>>
>>> Mark
>>> 
>>> From: Dhis2-devs [dhis2-devs-bounces+markpo=
>>> ifi.uio...@lists.launchpad.net] on behalf of Hannan Khan [
>>> hann...@gmail.com]
>>> Sent: 27 August 2015 08:29
>>> To: DHIS 2 developers
>>> Subject: [Dhis2-devs] Web portal CORS/preflight problem
>>>
>>> Dear Experts
>>>
>>> I am facing problem to creating Web Portal, facing problem CORS.
>>> First I try portal from 103.247.238.68 not working and then put this
>>> address in the white list of the dhis2 server at 103.247.238.68:8080<
>>> http://103.247.238.68:8080>. But but still having the same problem the
>>> error message is 'which is disallowed for cross-origin requests that
>>> require preflight'.
>>>
>>> Now how I resolve this? The script is similar as on the developer guide,
>>> page 49.
>>>
>>> Please advice.
>>>
>>> Regards
>>>
>>> Hannan
>>>
>>> ___
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to : dhis2-devs@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>
>>
>>
>> --
>> Alex Tumwesigye
>>
>> Technical Advisor - DHIS2 (Consultant),
>> Ministry of Health/AFENET
>> Kampala
>> Uganda
>>
>> IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya
>>
>> IT Specialist (Servers, Networks and Security, Health Information Systems
>> - DHIS2 ) & Solar Consultant
>>
>> +256 774149 775, + 256 759 800161
>>
>> "I don't want to be anything other than what I have been - one tree hill "
>>
>
>
> ___
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] [Dhis2-users] data mart deprecation - 2.21

2015-08-27 Thread Calle Hedberg
Paralytics??

On 27 August 2015 at 09:35, Hannan Khan  wrote:

> In Bangladesh we are not using Data Mart; instead we are using paralytics.
> So no problem from our end.
>
> Regards
>
> Hannan Khan
> HISP Bangladesh
>
>
> On Wed, Aug 26, 2015 at 5:27 PM, Lars Helge Øverland 
> wrote:
>
>> Hi,
>>
>> we are thinking of removing the data mart functionality in DHIS 2. This
>> refers to the ability to populate the "aggregateddatavalue" and
>> "aggregatedindicatorvalue" tables with pre-aggregated data.
>>
>> The data mart is no longer in use by DHIS 2. There might be third-party
>> report tools out there that connects directly to the data mart tables.
>>
>> We recommend that you connect reporting tools to the analytics web api
>>  for
>> the sake of  performance, accessibility and security. If you need to
>> connect with JDBC it is possible to create a SQL view to combine all
>> analytics partitions and perform aggregation using group by statements.
>>
>> If we do not hear strong objections within a week we will remove data
>> mart for version 2.21.
>>
>>
>> regards,
>>
>> Lars
>>
>>
>>
>>
>> --
>> Lars Helge Øverland
>> Lead developer, DHIS 2
>> University of Oslo
>> Skype: larshelgeoverland
>> http://www.dhis2.org 
>>
>>
>> ___
>> Mailing list: https://launchpad.net/~dhis2-users
>> Post to : dhis2-us...@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-users
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
> ___
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 

***

Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19274

Email: calle.hedb...@gmail.com

Skype: calle_hedberg

***
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 19867: program rule support for TEI attributes

2015-08-27 Thread noreply

revno: 19867
committer: Abyot Asalefew Gizaw 
branch nick: dhis2
timestamp: Thu 2015-08-27 12:06:06 +0200
message:
  program rule support for TEI attributes
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programrule/GetProgramRuleAction.java
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramRule.vm
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programRule.js
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramRule.vm


--
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/programrule/ProgramRuleAction.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java	2015-08-26 18:14:12 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java	2015-08-27 10:06:06 +
@@ -202,9 +202,9 @@
 this.dataElement = dataElement;
 }
 
-@JsonProperty( "trackedEntityAttribute" )
-@JsonView( { DetailedView.class, ExportView.class } )
-@JacksonXmlProperty( localName = "trackedEntityAttribute", namespace = DxfNamespaces.DXF_2_0 )
+@JsonProperty
+@JsonSerialize( as = BaseIdentifiableObject.class )
+@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
 public TrackedEntityAttribute getAttribute()
 {
 return attribute;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programrule/GetProgramRuleAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programrule/GetProgramRuleAction.java	2015-04-11 13:18:25 +
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programrule/GetProgramRuleAction.java	2015-08-27 10:06:06 +
@@ -27,9 +27,10 @@
  */
 package org.hisp.dhis.trackedentity.action.programrule;
 
-import java.util.ArrayList;
 import java.util.List;
 
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.programrule.ProgramRule;
 import org.hisp.dhis.programrule.ProgramRuleService;
 import org.hisp.dhis.programrule.ProgramRuleVariable;
@@ -55,6 +56,9 @@
 
 @Autowired
 private ProgramRuleVariableService variableService;
+
+@Autowired
+private ProgramService programService;
 
 // -
 // Input/Output
@@ -73,6 +77,13 @@
 {
 return programRule;
 }
+
+private Program program;
+
+public Program getProgram()
+{
+return program;
+}
 
 private List ruleVariables;
 
@@ -90,8 +101,10 @@
 throws Exception
 {
 programRule = programRuleService.getProgramRule( id );
-   
-ruleVariables = new ArrayList<>( variableService.getProgramRuleVariable( programRule.getProgram() ));
+
+program = programService.getProgram( programRule.getProgram().getId() );
+
+ruleVariables = variableService.getProgramRuleVariable( program ); 
 
 return SUCCESS;
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramRule.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramRule.vm	2015-06-23 09:02:05 +
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramRule.vm	2015-08-27 10:06:06 +
@@ -36,6 +36,13 @@
 	var i18n_please_enter_alert_message_when_hiding_a_field = '$encoder.jsEscape( $i18n.getString( "please_enter_alert_message_when_hiding_a_field_that_contains_value" ) , "'")';
 	var i18n_please_enter_alert_message_when_hiding_a_section = '$encoder.jsEscape( $i18n.getString( "please_enter_alert_message_when_hiding_a_section_that_contains_values" ) , "'")';
 	var i18n_hide_section = '$encoder.jsEscape( $i18n.getString( "hide_section" ) , "'" )';
+var i18n_data_element_label = '$encoder.jsEscape( $i18n.getString( "data_element" ) , "'" )';
+var i18n_program_attribute_label = '$encoder.jsEscape( $i18n.getString( "program_attribute" ) , "'" )';
+
+var attributeList = new Array();
+	#foreach(

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 19868: minor

2015-08-27 Thread noreply

revno: 19868
committer: Abyot Asalefew Gizaw 
branch nick: dhis2
timestamp: Thu 2015-08-27 12:10:19 +0200
message:
  minor
modified:
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programRule.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-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programRule.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programRule.js	2015-08-27 10:06:06 +
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programRule.js	2015-08-27 10:10:19 +
@@ -416,7 +416,7 @@
 	if( status == 1 )
 	{
 		status = 0;
-		//window.location.href='programRule.action?id=' + getFieldValue('programLocalId');
+		window.location.href='programRule.action?id=' + getFieldValue('programLocalId');
 	}
 }); 
 

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] Web portal CORS/preflight problem

2015-08-27 Thread Hannan Khan
Thanks Jan.

I added http://code.jquery.com/jquery-2.1.4.min.js>"> in the  but
still I get the error. What did I do wrong?

Regards

Hannan

On Thu, Aug 27, 2015 at 2:49 PM, Jan Henrik Øverland <
janhenrik.overl...@gmail.com> wrote:

> Hi Hannan,
>
> I have done some testing and it seems the bundled Ext version is getting
> old. CORS is not working well with it.
>
> We need to look at this, but for now just include
> https://code.jquery.com/jquery-2.1.4.min.js (minified, only 84k) and do
> the authentication with jquery.
>
> The good thing about CORS is that you can simply do a normal ajax request
> and the browser will take care of the rest.
>
> On Thu, Aug 27, 2015 at 10:37 AM, Hannan Khan  wrote:
>
>> Dear Alex
>>
>> Thank you for sharing the resources. but the problem still persists. i
>> write as following:
>>
>> Ext.onReady( function() {
>>   Ext.Ajax.request({
>> crossDomain: true,
>> url: base + "dhis-web-commons-security/login.action?authOnly=true",
>> method: 'POST',
>>
>> Please check.
>>
>> Regards
>>
>> Hannan
>>
>> On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye 
>> wrote:
>>
>>> Dear Khan,
>>>
>>> Look at this
>>> http://api.jquery.com/jquery.ajax/
>>> Read about crossDomain, by default it set to false so you may need to
>>> set it to true.
>>>
>>> Ideally, in your ajax request, add crossDomain:true
>>>
>>> Alex
>>>
>>>
>>>
>>> On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak  wrote:
>>>
 Hello Hanna,

 Did you add http:// (or https:// if you use a secure line) in front of
 the IP address?

 On the demo instance this is a bit confusing as the examples do not
 show that but it is required for it to work correctly.

 Regards,

 Mark
 
 From: Dhis2-devs [dhis2-devs-bounces+markpo=
 ifi.uio...@lists.launchpad.net] on behalf of Hannan Khan [
 hann...@gmail.com]
 Sent: 27 August 2015 08:29
 To: DHIS 2 developers
 Subject: [Dhis2-devs] Web portal CORS/preflight problem

 Dear Experts

 I am facing problem to creating Web Portal, facing problem CORS.
 First I try portal from 103.247.238.68 not working and then put this
 address in the white list of the dhis2 server at 103.247.238.68:8080<
 http://103.247.238.68:8080>. But but still having the same problem the
 error message is 'which is disallowed for cross-origin requests that
 require preflight'.

 Now how I resolve this? The script is similar as on the developer
 guide, page 49.

 Please advice.

 Regards

 Hannan

 ___
 Mailing list: https://launchpad.net/~dhis2-devs
 Post to : dhis2-devs@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~dhis2-devs
 More help   : https://help.launchpad.net/ListHelp

>>>
>>>
>>>
>>> --
>>> Alex Tumwesigye
>>>
>>> Technical Advisor - DHIS2 (Consultant),
>>> Ministry of Health/AFENET
>>> Kampala
>>> Uganda
>>>
>>> IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya
>>>
>>> IT Specialist (Servers, Networks and Security, Health Information
>>> Systems - DHIS2 ) & Solar Consultant
>>>
>>> +256 774149 775, + 256 759 800161
>>>
>>> "I don't want to be anything other than what I have been - one tree hill
>>> "
>>>
>>
>>
>> ___
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] Web portal CORS/preflight problem

2015-08-27 Thread Knut Staring
Hi Hannan,

Did you leave out "https:" ?

On Thu, Aug 27, 2015 at 12:19 PM, Hannan Khan  wrote:

> Thanks Jan.
>
> I added http://code.jquery.com/jquery-2.1.4.min.js>"> in the  but
> still I get the error. What did I do wrong?
>
> Regards
>
> Hannan
>
> On Thu, Aug 27, 2015 at 2:49 PM, Jan Henrik Øverland <
> janhenrik.overl...@gmail.com> wrote:
>
>> Hi Hannan,
>>
>> I have done some testing and it seems the bundled Ext version is getting
>> old. CORS is not working well with it.
>>
>> We need to look at this, but for now just include
>> https://code.jquery.com/jquery-2.1.4.min.js (minified, only 84k) and do
>> the authentication with jquery.
>>
>> The good thing about CORS is that you can simply do a normal ajax request
>> and the browser will take care of the rest.
>>
>> On Thu, Aug 27, 2015 at 10:37 AM, Hannan Khan  wrote:
>>
>>> Dear Alex
>>>
>>> Thank you for sharing the resources. but the problem still persists. i
>>> write as following:
>>>
>>> Ext.onReady( function() {
>>>   Ext.Ajax.request({
>>> crossDomain: true,
>>> url: base + "dhis-web-commons-security/login.action?authOnly=true",
>>> method: 'POST',
>>>
>>> Please check.
>>>
>>> Regards
>>>
>>> Hannan
>>>
>>> On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye 
>>> wrote:
>>>
 Dear Khan,

 Look at this
 http://api.jquery.com/jquery.ajax/
 Read about crossDomain, by default it set to false so you may need to
 set it to true.

 Ideally, in your ajax request, add crossDomain:true

 Alex



 On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak  wrote:

> Hello Hanna,
>
> Did you add http:// (or https:// if you use a secure line) in front
> of the IP address?
>
> On the demo instance this is a bit confusing as the examples do not
> show that but it is required for it to work correctly.
>
> Regards,
>
> Mark
> 
> From: Dhis2-devs [dhis2-devs-bounces+markpo=
> ifi.uio...@lists.launchpad.net] on behalf of Hannan Khan [
> hann...@gmail.com]
> Sent: 27 August 2015 08:29
> To: DHIS 2 developers
> Subject: [Dhis2-devs] Web portal CORS/preflight problem
>
> Dear Experts
>
> I am facing problem to creating Web Portal, facing problem CORS.
> First I try portal from 103.247.238.68 not working and then put this
> address in the white list of the dhis2 server at 103.247.238.68:8080<
> http://103.247.238.68:8080>. But but still having the same problem
> the error message is 'which is disallowed for cross-origin requests that
> require preflight'.
>
> Now how I resolve this? The script is similar as on the developer
> guide, page 49.
>
> Please advice.
>
> Regards
>
> Hannan
>
> ___
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>



 --
 Alex Tumwesigye

 Technical Advisor - DHIS2 (Consultant),
 Ministry of Health/AFENET
 Kampala
 Uganda

 IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

 IT Specialist (Servers, Networks and Security, Health Information
 Systems - DHIS2 ) & Solar Consultant

 +256 774149 775, + 256 759 800161

 "I don't want to be anything other than what I have been - one tree
 hill "

>>>
>>>
>>> ___
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to : dhis2-devs@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>
> ___
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
Knut Staring
Dept. of Informatics, University of Oslo
Norway: +4791880522
Skype: knutstar
http://dhis2.org
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] Web portal CORS/preflight problem

2015-08-27 Thread Jan Henrik Øverland
You need to do this part

Ext.onReady( function() {
  Ext.Ajax.request({
crossDomain: true,
url: base + "dhis-web-commons-security/login.action?authOnly=true",
method: 'POST'
 

with jquery instead of Ext.

See the code that Morten posted.

On Thu, Aug 27, 2015 at 12:19 PM, Hannan Khan  wrote:

> Thanks Jan.
>
> I added http://code.jquery.com/jquery-2.1.4.min.js>"> in the  but
> still I get the error. What did I do wrong?
>
> Regards
>
> Hannan
>
> On Thu, Aug 27, 2015 at 2:49 PM, Jan Henrik Øverland <
> janhenrik.overl...@gmail.com> wrote:
>
>> Hi Hannan,
>>
>> I have done some testing and it seems the bundled Ext version is getting
>> old. CORS is not working well with it.
>>
>> We need to look at this, but for now just include
>> https://code.jquery.com/jquery-2.1.4.min.js (minified, only 84k) and do
>> the authentication with jquery.
>>
>> The good thing about CORS is that you can simply do a normal ajax request
>> and the browser will take care of the rest.
>>
>> On Thu, Aug 27, 2015 at 10:37 AM, Hannan Khan  wrote:
>>
>>> Dear Alex
>>>
>>> Thank you for sharing the resources. but the problem still persists. i
>>> write as following:
>>>
>>> Ext.onReady( function() {
>>>   Ext.Ajax.request({
>>> crossDomain: true,
>>> url: base + "dhis-web-commons-security/login.action?authOnly=true",
>>> method: 'POST',
>>>
>>> Please check.
>>>
>>> Regards
>>>
>>> Hannan
>>>
>>> On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye 
>>> wrote:
>>>
 Dear Khan,

 Look at this
 http://api.jquery.com/jquery.ajax/
 Read about crossDomain, by default it set to false so you may need to
 set it to true.

 Ideally, in your ajax request, add crossDomain:true

 Alex



 On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak  wrote:

> Hello Hanna,
>
> Did you add http:// (or https:// if you use a secure line) in front
> of the IP address?
>
> On the demo instance this is a bit confusing as the examples do not
> show that but it is required for it to work correctly.
>
> Regards,
>
> Mark
> 
> From: Dhis2-devs [dhis2-devs-bounces+markpo=
> ifi.uio...@lists.launchpad.net] on behalf of Hannan Khan [
> hann...@gmail.com]
> Sent: 27 August 2015 08:29
> To: DHIS 2 developers
> Subject: [Dhis2-devs] Web portal CORS/preflight problem
>
> Dear Experts
>
> I am facing problem to creating Web Portal, facing problem CORS.
> First I try portal from 103.247.238.68 not working and then put this
> address in the white list of the dhis2 server at 103.247.238.68:8080<
> http://103.247.238.68:8080>. But but still having the same problem
> the error message is 'which is disallowed for cross-origin requests that
> require preflight'.
>
> Now how I resolve this? The script is similar as on the developer
> guide, page 49.
>
> Please advice.
>
> Regards
>
> Hannan
>
> ___
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>



 --
 Alex Tumwesigye

 Technical Advisor - DHIS2 (Consultant),
 Ministry of Health/AFENET
 Kampala
 Uganda

 IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

 IT Specialist (Servers, Networks and Security, Health Information
 Systems - DHIS2 ) & Solar Consultant

 +256 774149 775, + 256 759 800161

 "I don't want to be anything other than what I have been - one tree
 hill "

>>>
>>>
>>> ___
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to : dhis2-devs@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] [Dhis2-users] data mart deprecation - 2.21

2015-08-27 Thread Edward Ari Bichetero
That seems a little extreme, but whatever works. Desperate times call for 
desperate measures.
- Edward -
 


 On Thursday, August 27, 2015 9:53 AM, Calle Hedberg 
 wrote:
   
 

 Paralytics??
On 27 August 2015 at 09:35, Hannan Khan  wrote:

In Bangladesh we are not using Data Mart; instead we are using paralytics. So 
no problem from our end.
Regards
Hannan KhanHISP Bangladesh


On Wed, Aug 26, 2015 at 5:27 PM, Lars Helge Øverland  
wrote:

Hi,
we are thinking of removing the data mart functionality in DHIS 2. This refers 
to the ability to populate the "aggregateddatavalue" and 
"aggregatedindicatorvalue" tables with pre-aggregated data. 
The data mart is no longer in use by DHIS 2. There might be third-party report 
tools out there that connects directly to the data mart tables. 
We recommend that you connect reporting tools to the analytics web api for the 
sake of  performance, accessibility and security. If you need to connect with 
JDBC it is possible to create a SQL view to combine all analytics partitions 
and perform aggregation using group by statements.
If we do not hear strong objections within a week we will remove data mart for 
version 2.21.

regards,
Lars
 

-- 
Lars Helge Øverland
Lead developer, DHIS 2University of OsloSkype: larshelgeoverland
http://www.dhis2.org

___
Mailing list: https://launchpad.net/~dhis2-users
Post to     : dhis2-us...@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp




___
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp





-- 
***Calle Hedberg46D Alma Road, 7700 
Rosebank, SOUTH AFRICA Tel/fax (home): +27-21-685-6472Cell: 
+27-82-853-5352Iridium SatPhone: +8816-315-19274Email: 
calle.hedberg@gmail.comSkype: 
calle_hedberg***

___
Mailing list: https://launchpad.net/~dhis2-users
Post to    : dhis2-us...@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help  : https://help.launchpad.net/ListHelp


 
  ___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 19869: programRuleAction.attribute -> programRuleAction.trackedEntityAttribute

2015-08-27 Thread noreply

revno: 19869
committer: Abyot Asalefew Gizaw 
branch nick: dhis2
timestamp: Thu 2015-08-27 13:49:26 +0200
message:
  programRuleAction.attribute -> programRuleAction.trackedEntityAttribute
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java
  
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programRule.js
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramRule.vm


--
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/programrule/ProgramRuleAction.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java	2015-08-27 10:06:06 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java	2015-08-27 11:49:26 +
@@ -202,7 +202,7 @@
 this.dataElement = dataElement;
 }
 
-@JsonProperty
+@JsonProperty( "trackedEntityAttribute" )
 @JsonSerialize( as = BaseIdentifiableObject.class )
 @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
 public TrackedEntityAttribute getAttribute()

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-08-26 19:49:09 +
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-08-27 11:49:26 +
@@ -402,7 +402,7 @@
 //check if attribute has optionset
 if (att.optionSetValue) {
 var optionSetId = att.optionSet.id;
-newInputField = '' +
+newInputField = '' +
 '{{$select.selected.name || $select.selected}}' +
 '' +
@@ -415,12 +415,12 @@
 if (att.valueType === "number") {
 newInputField = '';
 }
 else if (att.valueType === "bool") {
 newInputField = ' ' +
 ' {{\'please_select\'| translate}}' +
 ' {{\'no\'| translate}}' +
@@ -432,22 +432,22 @@
 ' placeholder="{{dhis2CalendarFormat.keyDateFormat}}" ' +
 ' max-date="' + attMaxDate + '"' + '\'' +
 ' d2-date' +
-' blur-or-change="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
+' blur-or-change="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
 commonInputFieldProperty + ' >';
 }
 else if (att.valueType === "trueOnly") {
 newInputField = '';
 }
 else if (att.valueType === "email") {
 newInputField = '';
 }
 else {
 newInputField = '';
 }
 }
@@ -1207,7 +1207,6 @@
 location:action.location, 
 action:action.programRuleActionType,
 dataElement:action.dataElement,
-trackedEntityAttribute:action.trackedEntityAttribute,
 content:action.content,
 data:action.data,
 ineffect:undefined

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programRule.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programRule.js	2015-08-27 10:10:19 +
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-progr

Re: [Dhis2-devs] Web portal CORS/preflight problem

2015-08-27 Thread Alex Tumwesigye
Dear Hannan,

Use $.ajax()


or replace crossDomain:y=true with cors:true

and try!

I have not used it but give it a try.

Alex

On Thu, Aug 27, 2015 at 1:24 PM, Jan Henrik Øverland <
janhenrik.overl...@gmail.com> wrote:

> You need to do this part
>
> Ext.onReady( function() {
>   Ext.Ajax.request({
> crossDomain: true,
> url: base + "dhis-web-commons-security/login.action?authOnly=true",
> method: 'POST'
>  
>
> with jquery instead of Ext.
>
> See the code that Morten posted.
>
> On Thu, Aug 27, 2015 at 12:19 PM, Hannan Khan  wrote:
>
>> Thanks Jan.
>>
>> I added http://code.jquery.com/jquery-2.1.4.min.js>"> in the 
>> but still I get the error. What did I do wrong?
>>
>> Regards
>>
>> Hannan
>>
>> On Thu, Aug 27, 2015 at 2:49 PM, Jan Henrik Øverland <
>> janhenrik.overl...@gmail.com> wrote:
>>
>>> Hi Hannan,
>>>
>>> I have done some testing and it seems the bundled Ext version is getting
>>> old. CORS is not working well with it.
>>>
>>> We need to look at this, but for now just include
>>> https://code.jquery.com/jquery-2.1.4.min.js (minified, only 84k) and do
>>> the authentication with jquery.
>>>
>>> The good thing about CORS is that you can simply do a normal ajax
>>> request and the browser will take care of the rest.
>>>
>>> On Thu, Aug 27, 2015 at 10:37 AM, Hannan Khan  wrote:
>>>
 Dear Alex

 Thank you for sharing the resources. but the problem still persists. i
 write as following:

 Ext.onReady( function() {
   Ext.Ajax.request({
 crossDomain: true,
 url: base + "dhis-web-commons-security/login.action?authOnly=true",
 method: 'POST',

 Please check.

 Regards

 Hannan

 On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye >>> > wrote:

> Dear Khan,
>
> Look at this
> http://api.jquery.com/jquery.ajax/
> Read about crossDomain, by default it set to false so you may need to
> set it to true.
>
> Ideally, in your ajax request, add crossDomain:true
>
> Alex
>
>
>
> On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak  wrote:
>
>> Hello Hanna,
>>
>> Did you add http:// (or https:// if you use a secure line) in front
>> of the IP address?
>>
>> On the demo instance this is a bit confusing as the examples do not
>> show that but it is required for it to work correctly.
>>
>> Regards,
>>
>> Mark
>> 
>> From: Dhis2-devs [dhis2-devs-bounces+markpo=
>> ifi.uio...@lists.launchpad.net] on behalf of Hannan Khan [
>> hann...@gmail.com]
>> Sent: 27 August 2015 08:29
>> To: DHIS 2 developers
>> Subject: [Dhis2-devs] Web portal CORS/preflight problem
>>
>> Dear Experts
>>
>> I am facing problem to creating Web Portal, facing problem CORS.
>> First I try portal from 103.247.238.68 not working and then put this
>> address in the white list of the dhis2 server at 103.247.238.68:8080<
>> http://103.247.238.68:8080>. But but still having the same problem
>> the error message is 'which is disallowed for cross-origin requests that
>> require preflight'.
>>
>> Now how I resolve this? The script is similar as on the developer
>> guide, page 49.
>>
>> Please advice.
>>
>> Regards
>>
>> Hannan
>>
>> ___
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>
>
>
> --
> Alex Tumwesigye
>
> Technical Advisor - DHIS2 (Consultant),
> Ministry of Health/AFENET
> Kampala
> Uganda
>
> IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya
>
> IT Specialist (Servers, Networks and Security, Health Information
> Systems - DHIS2 ) & Solar Consultant
>
> +256 774149 775, + 256 759 800161
>
> "I don't want to be anything other than what I have been - one tree
> hill "
>


 ___
 Mailing list: https://launchpad.net/~dhis2-devs
 Post to : dhis2-devs@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~dhis2-devs
 More help   : https://help.launchpad.net/ListHelp


>>>
>>
>


-- 
Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET
Kampala
Uganda

IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

IT Specialist (Servers, Networks and Security, Health Information Systems -
DHIS2 ) & Solar Consultant

+256 774149 775, + 256 759 800161

"I don't want to be anything other than what I have been - one tree hill "
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https:/

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 19870: Fix for optionset datatype and trackedEntityAttributes in rules engine

2015-08-27 Thread noreply

revno: 19870
committer: Markus Bekken 
branch nick: dhis2
timestamp: Thu 2015-08-27 14:56:53 +0200
message:
  Fix for optionset datatype and trackedEntityAttributes in rules engine
modified:
  
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.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-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-08-27 11:49:26 +
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-08-27 12:56:53 +
@@ -402,7 +402,7 @@
 //check if attribute has optionset
 if (att.optionSetValue) {
 var optionSetId = att.optionSet.id;
-newInputField = '' +
+newInputField = '' +
 '{{$select.selected.name || $select.selected}}' +
 '' +
@@ -415,12 +415,12 @@
 if (att.valueType === "number") {
 newInputField = '';
 }
 else if (att.valueType === "bool") {
 newInputField = ' ' +
 ' {{\'please_select\'| translate}}' +
 ' {{\'no\'| translate}}' +
@@ -432,22 +432,22 @@
 ' placeholder="{{dhis2CalendarFormat.keyDateFormat}}" ' +
 ' max-date="' + attMaxDate + '"' + '\'' +
 ' d2-date' +
-' blur-or-change="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
+' blur-or-change="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
 commonInputFieldProperty + ' >';
 }
 else if (att.valueType === "trueOnly") {
 newInputField = '';
 }
 else if (att.valueType === "email") {
 newInputField = '';
 }
 else {
 newInputField = '';
 }
 }
@@ -721,11 +721,16 @@
 variableValue = $filter('trimquotes')(variableValue);
 
 //Append single quotation marks in case the variable is of text or date type:
-if(variableType === 'string' || variableType === 'date') {
-variableValue = "'" + variableValue + "'";
+if(variableType === 'string' || variableType === 'date' || variableType === 'optionSet') {
+if(variableValue) {
+variableValue = "'" + variableValue + "'";
+} else {
+variableValue = "''";
+}
+
 }
 else if(variableType === 'bool' || variableType === 'trueOnly') {
-if(eval(variableValue)) {
+if(variableValue && eval(variableValue)) {
 variableValue = true;
 }
 else {
@@ -733,7 +738,11 @@
 }
 }
 else if(variableType === "int" || variableType === "number") {
-variableValue = Number(variableValue);
+if(variableValue) {
+variableValue = Number(variableValue);
+} else {
+variableValue = 0;
+}  
 }
 else{
 $log.warn("unknown datatype:" + variableType);
@@ -1207,6 +1216,7 @@
 location:action.location, 
 action:action.programRuleActionType,
 dataElement:action.dataElement,
+trackedEntityAttribute:action.trackedEntityAttribute,
 content:action.content,
 data:action.data,
 ineffect:undefined

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@

Re: [Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 19856: Analaytics, implementd query parameter relativePeriodDate which will be used as basis for relativ...

2015-08-27 Thread Lars Helge Øverland
We are aiming for 2.21 for this one.

Lars


On Wed, Aug 26, 2015 at 11:15 PM, Calle Hedberg 
wrote:

> Hi,
>
> excellent - only in 2.21, or will you add this to 2.20 and earlier
> versions too?
>
> Regards
> Calle
>
> On 26 August 2015 at 14:08, Lars Helge Øverland 
> wrote:
>
>>
>> Hi Calle,
>>
>> On Wed, Aug 26, 2015 at 12:45 PM, Calle Hedberg 
>> wrote:
>>
>>> Lars,
>>>
>>> Will this work as an "anchor date" which will determine other relative
>>> periods? So that if you last month of usable data is July-2015, then
>>> setting this anchor data to some date in July will result in "last 6
>>> months" being Feb-Jul 2015 and
>>> "last 6 months previous year" (if existing) being Feb-Jul 2014? We had
>>> this type of anchor date way back in the DHIS 1.3 report generator, and it
>>> was useful...
>>>
>>
>> yes that is correct.
>>
>> The first application will be as a filter in the dashboard, to allow you
>> to "rewind" time for dashboards which contain favorites with relative
>> periods.
>>
>> Lars
>>
>>
>>
>>
>>
>
>
> --
>
> ***
>
> Calle Hedberg
>
> 46D Alma Road, 7700 Rosebank, SOUTH AFRICA
>
> Tel/fax (home): +27-21-685-6472
>
> Cell: +27-82-853-5352
>
> Iridium SatPhone: +8816-315-19274
>
> Email: calle.hedb...@gmail.com
>
> Skype: calle_hedberg
>
> ***
>
>


-- 
Lars Helge Øverland
Lead developer, DHIS 2
University of Oslo
Skype: larshelgeoverland
http://www.dhis2.org 
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 19871: minor fix in program rule for attributes

2015-08-27 Thread noreply

revno: 19871
committer: Abyot Asalefew Gizaw 
branch nick: dhis2
timestamp: Thu 2015-08-27 16:45:23 +0200
message:
  minor fix in program rule for attributes
modified:
  
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramRule.vm
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramRule.vm


--
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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-08-27 12:56:53 +
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-08-27 14:45:23 +
@@ -402,7 +402,7 @@
 //check if attribute has optionset
 if (att.optionSetValue) {
 var optionSetId = att.optionSet.id;
-newInputField = '' +
+newInputField = '' +
 '{{$select.selected.name || $select.selected}}' +
 '' +
@@ -415,12 +415,12 @@
 if (att.valueType === "number") {
 newInputField = '';
 }
 else if (att.valueType === "bool") {
 newInputField = ' ' +
 ' {{\'please_select\'| translate}}' +
 ' {{\'no\'| translate}}' +
@@ -432,22 +432,22 @@
 ' placeholder="{{dhis2CalendarFormat.keyDateFormat}}" ' +
 ' max-date="' + attMaxDate + '"' + '\'' +
 ' d2-date' +
-' blur-or-change="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
+' blur-or-change="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
 commonInputFieldProperty + ' >';
 }
 else if (att.valueType === "trueOnly") {
 newInputField = '';
 }
 else if (att.valueType === "email") {
 newInputField = '';
 }
 else {
 newInputField = '';
 }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramRule.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramRule.vm	2015-08-27 10:06:06 +
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramRule.vm	2015-08-27 14:45:23 +
@@ -121,11 +121,11 @@
 			#set($idx = $idx + 1 )
 			
 #if( $ruleVariable.sourceType == 'TEI_ATTRIBUTE')
-$!encoder.htmlEncode($ruleVariable.trackedEntityAttribute) $!encoder.htmlEncode($ruleVariable.trackedEntityAttribute.displayName)
- [ATT]
+$!encoder.htmlEncode($ruleVariable.trackedEntityAttribute) $!encoder.htmlEncode($ruleVariable.attribute.name)
+
 #else
 $!encoder.htmlEncode($ruleVariable.dataElement.displayName)
- [DE]
+
 

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 19872: tracker-captuer: program rules engine for attribute support - WIP

2015-08-27 Thread noreply

revno: 19872
committer: Abyot Asalefew Gizaw 
branch nick: dhis2
timestamp: Thu 2015-08-27 17:15:20 +0200
message:
  tracker-captuer: program rules engine for attribute support - WIP
modified:
  
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js
  
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.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-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2015-08-26 12:29:22 +
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2015-08-27 15:15:20 +
@@ -12,7 +12,6 @@
 CustomFormService,
 EnrollmentService,
 DialogService,
-ModalService,
 CurrentSelection,
 OptionSetService,
 EventUtils,
@@ -61,16 +60,17 @@
 $scope.trackedEntities.available = entities;   
 $scope.trackedEntities.selected = $scope.trackedEntities.available[0];
 });
-
-$scope.allProgramRules = [];
-TrackerRulesFactory.getRules($scope.selectedProgram.id).then(function(rules){
-$scope.allProgramRules = rules;
-});  
 
 //watch for selection of program
 $scope.$watch('selectedProgram', function() {
 $scope.trackedEntityForm = null;
 $scope.customForm = null;
+
+$scope.allProgramRules = [];
+TrackerRulesFactory.getRules($scope.selectedProgram.id).then(function(rules){
+$scope.allProgramRules = rules;
+});
+
 if($scope.registrationMode === 'REGISTRATION'){
 $scope.getAttributes($scope.registrationMode);
 }

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-08-27 14:45:23 +
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-08-27 15:15:20 +
@@ -1187,8 +1187,13 @@
 $rootScope.ruleeffects = {};
 }
 
-if(angular.isUndefined( $rootScope.ruleeffects[executingEvent.event] )){
-$rootScope.ruleeffects[executingEvent.event] = {};
+var ruleEffectKey = executingEvent.event ? executingEvent.event : executingEvent;
+if( executingEvent.event && angular.isUndefined( $rootScope.ruleeffects[ruleEffectKey] )){
+$rootScope.ruleeffects[ruleEffectKey] = {};
+}
+
+if(!angular.isObject(executingEvent) && angular.isUndefined( $rootScope.ruleeffects[ruleEffectKey] )){
+$rootScope.ruleeffects[ruleEffectKey] = {};
 }
 
 var updatedEffectsExits = false;
@@ -1210,8 +1215,8 @@
 
 angular.forEach(rule.programRuleActions, function(action){
 //In case the effect-hash is not populated, add entries
-if(angular.isUndefined( $rootScope.ruleeffects[executingEvent.event][action.id] )){
-$rootScope.ruleeffects[executingEvent.event][action.id] =  {
+if(angular.isUndefined( $rootScope.ruleeffects[ruleEffectKey][action.id] )){
+$rootScope.ruleeffects[ruleEffectKey][action.id] =  {
 id:action.id,
 location:action.location, 
 action:action.programRuleActionType,
@@ -1229,7 +1234,7 @@
 if(ruleEffective && action.data)
 {
 //Preserve old data for comparison:
-var oldData = $rootScope.ruleeffects[executingEvent.event][action.id].data;
+var oldData = $rootScope.ruleeffects[ruleEffectKey][action.id].data;
 
 //The key data might be containing a dollar sign denoting that the key data is a variable.
   

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 19873: Event analytics, added support for native date/timestamp column types

2015-08-27 Thread noreply

revno: 19873
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Thu 2015-08-27 17:28:24 +0200
message:
  Event analytics, added support for native date/timestamp column types
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
  
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java
  
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java
  
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java


--
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/common/ValueType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java	2015-07-15 13:33:44 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java	2015-08-27 15:28:24 +
@@ -32,7 +32,6 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
-import org.joda.time.DateTime;
 
 /**
  * @author Lars Helge Overland
@@ -47,7 +46,7 @@
 BOOLEAN( Boolean.class ),
 TRUE_ONLY( Boolean.class ),
 DATE( Date.class ),
-DATETIME( DateTime.class ),
+DATETIME( Date.class ),
 NUMBER( Double.class ),
 UNIT_INTERVAL( Double.class ),
 PERCENTAGE( Double.class ),

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2015-08-02 14:59:59 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2015-08-27 15:28:24 +
@@ -268,6 +268,14 @@
 }
 
 /**
+ * Indicates whether the value type of this data element is date.
+ */
+public boolean isDateType()
+{
+return VALUE_TYPE_DATE.equals( type ) || VALUE_TYPE_DATETIME.equals( type );
+}
+
+/**
  * Returns the value type. If value type is int and the number type exists,
  * the number type is returned, otherwise the type is returned.
  */

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java	2015-08-02 14:59:59 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java	2015-08-27 15:28:24 +
@@ -138,6 +138,14 @@
 }
 
 /**
+ * Indicates whether the value type of this attribute is date.
+ */
+public boolean isDateType()
+{
+return TYPE_DATE.equals( valueType );
+}
+
+/**
  * Indicates whether this attribute has an option set.
  */
 public boolean hasOptionSet()

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java	2015-08-19 08:08:11 +
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java	2015-08-27 15:28:24 +
@@ -69,6 +69,8 @@
 implements AnalyticsTableManager
 {
 protected static final Log log = LogFactory.getLog( JdbcAnalyticsTableManager.class );
+
+protected static final String DATE_REGEXP = "^\\d{4}-\\d{2}-\\d{2}(\\s|T)?(\\d{2}:\\d{2}:\\d{2})?$";
 
 public static final String PREFIX_ORGUNITGROUPSET = "ougs_";
 public static final String PREFIX_ORGUNITLEVEL = "uidlevel";

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java	2015-08-19 08:08:11 +
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java	2015-08-27 15:28:24 +
@@ -29,6 +29,7 @@
  */
 
 import static org.hisp.dhis.commons.util.TextUtils.removeLast;
+import static org.hisp.dhis.system.util.MathUtils.NUMERIC_LENIENT_REGEXP;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -49,7 +50,6 @@
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.system.util.DateUtils;
-import org.hisp.dhis.system.util.MathUtils;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.transaction.annotation.Transactional;
@

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 19874: Program indicator / event analytics. Impl support for d2:daysBetween / days between two dates.

2015-08-27 Thread noreply

revno: 19874
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Thu 2015-08-27 19:18:00 +0200
message:
  Program indicator / event analytics. Impl support for d2:daysBetween / days 
between two dates.
added:
  
dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/DaysBetweenSqlFunction.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java
  
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java
  
dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/OneIfZeroOrPositiveSqlFunction.java
  
dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/SqlFunction.java
  
dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/ZeroIfNegativeSqlFunction.java
  
dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionFunctions.java
  
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java
  
dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ExpressionUtilsTest.java
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm


--
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/program/ProgramIndicator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java	2015-08-25 14:09:25 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java	2015-08-27 17:18:00 +
@@ -74,7 +74,7 @@
 
 private static final String EXPRESSION_REGEXP = "(" + KEY_DATAELEMENT + "|" + KEY_ATTRIBUTE + "|" + KEY_PROGRAM_VARIABLE + "|" + KEY_CONSTANT + ")\\{(\\w+|" + 
 VAR_INCIDENT_DATE + "|" + VAR_ENROLLMENT_DATE + "|" + VAR_CURRENT_DATE + ")" + SEPARATOR_ID + "?(\\w*)\\}";
-private static final String SQL_FUNC_REGEXP = "d2:(.+?)\\((.+?)\\)";
+private static final String SQL_FUNC_REGEXP = "d2:(.+?)\\(([^,]+)\\,?([^,]*)\\,?([^,]*)\\)";
 
 public static final Pattern EXPRESSION_PATTERN = Pattern.compile( EXPRESSION_REGEXP );
 public static final Pattern SQL_FUNC_PATTERN = Pattern.compile( SQL_FUNC_REGEXP );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-08-25 18:37:50 +
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-08-27 17:18:00 +
@@ -38,6 +38,7 @@
 import java.util.Set;
 import java.util.regex.Matcher;
 
+import org.hisp.dhis.commons.sqlfunc.DaysBetweenSqlFunction;
 import org.hisp.dhis.commons.sqlfunc.OneIfZeroOrPositiveSqlFunction;
 import org.hisp.dhis.commons.sqlfunc.SqlFunction;
 import org.hisp.dhis.commons.sqlfunc.ZeroIfNegativeSqlFunction;
@@ -73,7 +74,8 @@
 {
 private static final Map SQL_FUNC_MAP = ImmutableMap.builder().
 put( ZeroIfNegativeSqlFunction.KEY, new ZeroIfNegativeSqlFunction() ).
-put( OneIfZeroOrPositiveSqlFunction.KEY, new OneIfZeroOrPositiveSqlFunction() ).build();
+put( OneIfZeroOrPositiveSqlFunction.KEY, new OneIfZeroOrPositiveSqlFunction() ).
+put( DaysBetweenSqlFunction.KEY, new DaysBetweenSqlFunction() ).build();
 
 // -
 // Dependencies
@@ -398,7 +400,9 @@
 while ( matcher.find() )
 {
 String func = matcher.group( 1 );
-String column = matcher.group( 2 );
+String arg1 = matcher.group( 2 );
+String arg2 = matcher.group( 3 );
+String arg3 = matcher.group( 4 );
 
 SqlFunction function = SQL_FUNC_MAP.get( func );
 
@@ -407,7 +411,7 @@
 throw new IllegalStateException( "Function not recognized: " + func );
 }
 
-String result = function.evaluate( column );
+String result = function.evaluate( arg1, arg2, arg3 );
 
 matcher.appendReplacement( buffer, result );
 }
@@ -481,7 +485,7 @@
 
 if ( programStage != null && dataElement != null )
 {
-String sample = dataElement.isNumericType() ? String.valueOf( 1 ) : "'A'";
+String sample = dataElement.is

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 19875: bug fix in programRuleVariable to expose attribute type variables

2015-08-27 Thread noreply

revno: 19875
committer: Abyot Asalefew Gizaw 
branch nick: dhis2
timestamp: Thu 2015-08-27 21:05:08 +0200
message:
  bug fix in programRuleVariable to expose attribute type variables
modified:
  
dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleVariable.java


--
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/programrule/ProgramRuleVariable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleVariable.java	2015-07-13 12:34:39 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleVariable.java	2015-08-27 19:05:08 +
@@ -168,8 +168,8 @@
 }
 
 @JsonProperty( "trackedEntityAttribute" )
-@JsonView( { DetailedView.class, ExportView.class } )
-@JacksonXmlProperty( localName = "trackedEntityAttribute", namespace = DxfNamespaces.DXF_2_0 )
+@JsonSerialize( as = BaseIdentifiableObject.class )
+@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
 public TrackedEntityAttribute getAttribute()
 {
 return attribute;

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 19876: tracker-capture: program rules are now supported during registration

2015-08-27 Thread noreply

revno: 19876
committer: Abyot Asalefew Gizaw 
branch nick: dhis2
timestamp: Thu 2015-08-27 21:05:47 +0200
message:
  tracker-capture: program rules are now supported during registration
modified:
  
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html
  
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js
  
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html
  
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramRule.vm
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramRule.vm


--
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-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2015-08-26 12:29:22 +
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2015-08-27 19:05:47 +
@@ -1,6 +1,6 @@
 {{'profile'| translate}}
 
-
+
 
 {{attribute.name}}*
 

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2015-08-27 15:15:20 +
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2015-08-27 19:05:47 +
@@ -26,7 +26,10 @@
 $scope.customForm = null;
 $scope.selectedTei = {};
 $scope.tei = {};
-$scope.registrationMode = null;
+$scope.registrationMode = null;
+$scope.hiddenFields = {};
+$scope.errorMessages = {};
+$scope.warningMessages = {};
 
 $scope.attributesById = CurrentSelection.getAttributesById();
 if(!$scope.attributesById){
@@ -272,11 +275,11 @@
 var processRuleEffect = function(){
 
 angular.forEach($rootScope.ruleeffects['registration'], function (effect) {
-if (effect.dataElement) {
+if (effect.trackedEntityAttribute) {
 //in the data entry controller we only care about the "hidefield", showerror and showwarning actions
 if (effect.action === "HIDEFIELD") {
-if (effect.dataElement) {
-if (effect.ineffect && affectedEvent[effect.dataElement.id]) {
+if (effect.trackedEntityAttribute) {
+if (effect.ineffect && $scope.selectedTei[effect.trackedEntityAttribute.id]) {
 //If a field is going to be hidden, but contains a value, we need to take action;
 if (effect.content) {
 //TODO: Alerts is going to be replaced with a proper display mecanism.
@@ -284,41 +287,40 @@
 }
 else {
 //TODO: Alerts is going to be replaced with a proper display mecanism.
-alert($scope.prStDes[effect.dataElement.id].dataElement.formName + "Was blanked out and hidden by your last action");
+alert($scope.attributesById[effect.trackedEntityAttribute.id].name + "Was blanked out and hidden by your last action");
 }
 
 //Blank out the value:
-affectedEvent[effect.dataElement.id] = "";
-$scope.saveDatavalueForEvent($scope.prStDes[effect.dataElement.id], null, affectedEvent);
+$scope.selectedTei[effect.trackedEntityAttribute.id] = "";
 }
 
-$scope.hiddenFields[effect.dataElement.id] = effect.ineffect;
+$scope.hiddenFields[effect.trackedEntityAttribute.id] = effect.ineffect;
 }
 else {
-$log.warn("ProgramRuleAction " + effect.id + " is of type HIDEFIELD, bot does not have a dataelement defined");
+$log.warn("ProgramRuleAction " + effect.id + " is of type HIDEFIELD, bot does not have an attribute def

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 19877: Minor

2015-08-27 Thread noreply

revno: 19877
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Thu 2015-08-27 22:45:58 +0200
message:
  Minor
modified:
  
dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionFunctions.java
  
dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionUtils.java
  
dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ExpressionUtilsTest.java


--
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-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionFunctions.java'
--- dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionFunctions.java	2015-08-27 17:18:00 +
+++ dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionFunctions.java	2015-08-27 20:45:58 +
@@ -79,7 +79,7 @@
  * @param end the end date.
  * @return number of days between dates.
  */
-public static Long daysBetween( String start, String end )
+public static Integer daysBetween( String start, String end )
 throws ParseException
 {
 SimpleDateFormat format = new SimpleDateFormat();
@@ -88,6 +88,6 @@
 Date startDate = format.parse( start );
 Date endDate = format.parse( end );
 
-return ( startDate.getTime() - endDate.getTime() ) / 3153600l;
+return new Long( ( endDate.getTime() - startDate.getTime() ) / 8640 ).intValue();
 }
 }

=== modified file 'dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionUtils.java'
--- dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionUtils.java	2015-08-21 12:47:08 +
+++ dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionUtils.java	2015-08-27 20:45:58 +
@@ -113,6 +113,28 @@
 }
 
 /**
+ * Evaluates the given expression. The given variables will be substituted 
+ * in the expression. Converts the result of the evaluation to an Integer.
+ * Throws an IllegalStateException if the result could not be converted to
+ * a Double
+ * 
+ * @param expression the expression.
+ * @param vars the variables, can be null.
+ * @return the result of the evaluation.
+ */
+public static Integer evaluateToInteger( String expression, Map vars )
+{
+Object result = evaluate( expression, vars );
+
+if ( result == null || !isNumeric( String.valueOf( result ) ) )
+{
+throw new IllegalStateException( "Result must be not null and numeric: " + result );
+}
+
+return Integer.valueOf( String.valueOf( result ) );
+}
+
+/**
  * Evaluates the given expression to true or false. The given variables will 
  * be substituted in the expression.
  * 

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ExpressionUtilsTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ExpressionUtilsTest.java	2015-08-27 17:18:00 +
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ExpressionUtilsTest.java	2015-08-27 20:45:58 +
@@ -51,7 +51,8 @@
 assertEquals( 3d, ExpressionUtils.evaluateToDouble( "3", null ), DELTA );
 assertEquals( 3.45, ExpressionUtils.evaluateToDouble( "3.45", null ), DELTA );
 assertEquals( 5d, ExpressionUtils.evaluateToDouble( "2 + 3", null ), DELTA );
-assertEquals( 15.6, ExpressionUtils.evaluateToDouble( "12.4 + 3.2", null ), DELTA );
+assertEquals( 15.6, ExpressionUtils.evaluateToDouble( "12.4 + 3.2", null ), DELTA );
+assertEquals( 2.0, ExpressionUtils.evaluateToDouble( "2 > 1 ? 2.0 : 1.0", null ), DELTA );
 assertEquals( 3d, ExpressionUtils.evaluateToDouble( "d2:zing(3)", null ), DELTA );
 assertEquals( 2d, ExpressionUtils.evaluateToDouble( "d2:zing(-3) + 2.0", null ), DELTA );
 assertEquals( 4d, ExpressionUtils.evaluateToDouble( "d2:zing(-1) + 4 + d2:zing(-2)", null ), DELTA );
@@ -61,6 +62,13 @@
 }
 
 @Test
+public void testEvaluateToInteger()
+{
+assertEquals( 21l, (long) ExpressionUtils.evaluateToInteger( "7*3", null ) );
+assertEquals( 3l, (long) ExpressionUtils.evaluateToInteger( "d2:daysBetween('2015-03-01','2015-03-04')", null ) );
+}
+
+@Test
 public void testEvaluateToDoubleWithVars()
 {
 Map vars = new HashMap();

___
Mailing list: https://launchpad.net/~dhis2-devs
Post 

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 19878: Event analytics / program indicators. Impl support for conditionals / function d2:condition( bool...

2015-08-27 Thread noreply

revno: 19878
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Fri 2015-08-28 00:22:39 +0200
message:
  Event analytics / program indicators. Impl support for conditionals / 
function d2:condition( boolean-expr, true-val, false-val ).
added:
  
dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/ConditionalSqlFunction.java
modified:
  
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java
  
dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/OneIfZeroOrPositiveSqlFunction.java
  
dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/SqlFunction.java
  
dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/ZeroIfNegativeSqlFunction.java
  
dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionFunctions.java
  
dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionUtils.java
  
dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/TextUtils.java
  
dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ExpressionUtilsTest.java


--
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-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-08-27 17:18:00 +
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-08-27 22:22:39 +
@@ -38,6 +38,7 @@
 import java.util.Set;
 import java.util.regex.Matcher;
 
+import org.hisp.dhis.commons.sqlfunc.ConditionalSqlFunction;
 import org.hisp.dhis.commons.sqlfunc.DaysBetweenSqlFunction;
 import org.hisp.dhis.commons.sqlfunc.OneIfZeroOrPositiveSqlFunction;
 import org.hisp.dhis.commons.sqlfunc.SqlFunction;
@@ -75,7 +76,8 @@
 private static final Map SQL_FUNC_MAP = ImmutableMap.builder().
 put( ZeroIfNegativeSqlFunction.KEY, new ZeroIfNegativeSqlFunction() ).
 put( OneIfZeroOrPositiveSqlFunction.KEY, new OneIfZeroOrPositiveSqlFunction() ).
-put( DaysBetweenSqlFunction.KEY, new DaysBetweenSqlFunction() ).build();
+put( DaysBetweenSqlFunction.KEY, new DaysBetweenSqlFunction() ).
+put( ConditionalSqlFunction.KEY, new ConditionalSqlFunction() ).build();
 
 // -
 // Dependencies

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java	2015-08-27 17:18:00 +
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java	2015-08-27 22:22:39 +
@@ -539,6 +539,16 @@
 assertEquals( expected, programIndicatorService.getAnalyticsSQl( expression ) );
 }
 
+@Test
+public void testGetAnalyticsSqlWithFunctionsD()
+{
+String col1 = COL_QUOTE + deA.getUid() + COL_QUOTE;
+String expected = "case when (" + col1 + " > 3) then '10' else '5' end";
+String expression = "d2:condition(" + col1 + " > 3,10,5)";
+
+assertEquals( expected, programIndicatorService.getAnalyticsSQl( expression ) );
+}
+
 @Test( expected = IllegalStateException.class )
 public void testGetAnalyticsSqlWithFunctionsInvalid()
 {

=== added file 'dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/ConditionalSqlFunction.java'
--- dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/ConditionalSqlFunction.java	1970-01-01 00:00:00 +
+++ dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/sqlfunc/ConditionalSqlFunction.java	2015-08-27 22:22:39 +
@@ -0,0 +1,48 @@
+package org.hisp.dhis.commons.sqlfunc;
+
+/*
+ * Copyright (c) 2004-2015, 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 l