Translation function - Stay at page after modified some thing

Dear all,

May I give to devs a small suggestion like this:
I think we should keep for non-redirecting page after we’ve got some of saving for the object’s translated value (name, shortname, description, ect …)

In the original case, after pressed Save button system would redirect from the sub-page (dhis/dhis-web-commons/i18n.action) to the main page (dhis-web-maintenance-datadictionary/dataElement.action).
But I realized that it would be very very inconvenient and waste of time if we have to add so many the other translated values of each object for each corresponding locale.

For example:

I’ve got a string as “Doctor” in English. And then, I want to add some of new translated values with “Bác sỹ” in Vietnamese or “醫生” in Chinese or “Доктор” in Ukrainian. So, in this case we must go to 3 times for doing the same page (dhis/dhis-web-commons/i18n.action).

Thanks !

···


Hieu.HISPVietnam
Good Health !

Hi all,

In this connection I also implemented server side pagination for dhis. This could be used in Dataelement listing, patient records, etc. There is also search facility working with pagination to narrow down scope. It may need speed comparison with existing single listings and other pros and cons.

regards,
murod

···

From: Hieu Dang Duy hieu.hispvietnam@gmail.com
To: Dhis2 dhis2-devs@lists.launchpad.net
Sent: Mon, March 8, 2010 2:49:55 PM
Subject: [Dhis2-devs] Translation function - Stay at page after modified some thing

Dear all,

May I give to devs a small suggestion like this:
I think we should keep for non-redirecting page after we’ve got some of saving for the object’s translated value (name, shortname, description, ect …)

In the original case, after pressed Save button system would redirect from the sub-page (dhis/dhis-web-commons/i18n.action) to the main page (dhis-web-maintenance-datadictionary/dataElement.action).
But I realized that it would be very very inconvenient and waste of time if we have to add so many the other translated values of each object for each corresponding locale.

For example:

I’ve got a string as “Doctor” in English. And then, I want to add some of new translated values with “Bác sỹ” in Vietnamese or “醫生” in Chinese or “Доктор” in Ukrainian. So, in this case we must go to 3 times for doing the same page (dhis/dhis-web-commons/i18n.action).

Thanks !


Hieu.HISPVietnam
Good Health !

Hi all,

In this connection I also implemented server side pagination for dhis. This could be used in Dataelement listing, patient records, etc. There is also search facility working with pagination to narrow down scope. It may need speed comparison with existing single listings and other pros and cons.

regards,
murod

Hi,

I’m also planing to implement a paging util for patient module.

May I see your code :slight_smile:

···

On Mon, Mar 8, 2010 at 3:04 PM, Murodullo Latifov murodlatifov@yahoo.com wrote:


From: Hieu Dang Duy hieu.hispvietnam@gmail.com

To: Dhis2 dhis2-devs@lists.launchpad.net
Sent: Mon, March 8, 2010 2:49:55 PM

Subject: [Dhis2-devs] Translation function - Stay at page after modified some thing

Dear all,

May I give to devs a small suggestion like this:
I think we should keep for non-redirecting page after we’ve got some of saving for the object’s translated value (name, shortname, description, ect …)

In the original case, after pressed Save button system would redirect from the sub-page (dhis/dhis-web-commons/i18n.action) to the main page (dhis-web-maintenance-datadictionary/dataElement.action).
But I realized that it would be very very inconvenient and waste of time if we have to add so many the other translated values of each object for each corresponding locale.

For example:

I’ve got a string as “Doctor” in English. And then, I want to add some of new translated values with “Bác sỹ” in Vietnamese or “醫生” in Chinese or “Доктор” in Ukrainian. So, in this case we must go to 3 times for doing the same page (dhis/dhis-web-commons/i18n.action).

Thanks !


Hieu.HISPVietnam
Good Health !


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


Viet Nguyen

Hi Viet,

Follow this steps to add pagination. I am listing those areas that added/modified for this, for the rest look at corresponding files attached. SearchText could be handled in a way during Add/Remove so user comes back to the last search criteria hi left. If this works than user will be always focused into set of data, rather going back to the whole set and researching again.

Add these properties to GetDataElementListAction.java.

private String searchText ="";

public String getSearchText() {
    return searchText;
}

public void setSearchText(String searchText) {
     this.searchText

= searchText;
}

private int pageSize = 10;

public int getPageSize() {
    return pageSize;
}

public void setPageSize(int pageSize) {
    this.pageSize = pageSize;
}

private int currentPage = 0;

public int getCurrentPage() {
    return currentPage;
}

public void setCurrentPage(int currentPage) {
    this.currentPage = currentPage;
}

Change //dataElements = new ArrayList(
dataElementService.getAllDataElements() ); to
dataElements = new ArrayList( dataElementService.getDataElements(currentPage, pageSize, searchText) );

Create dataElementService.getDataElements(currentPage, pageSize, searchText) as such:

// helper method for query based search, needed to add %% to search string and test if it is not null

private String getSearchPattern(String criteria) {
if (StringUtils.hasText(criteria)) {
    return "%" + criteria.toLowerCase().replace('*', '%') + "%";
} else {
    return "%%";
    }
}

@SuppressWarnings("unchecked")

@Override
public Collection getDataElements(int currentPage,
int pageSize, String searchText) {
String pattern = getSearchPattern(searchText);
Session session = sessionFactory.getCurrentSession();

    Criteria criteria = session.createCriteria( DataElement.class );
    criteria.add(Restrictions.sqlRestriction("lower({alias}.name) like lower(?)", pattern, Hibernate.STRING)); //this is needed only if you want search functionality

    return criteria.setMaxResults(pageSize).setFirstResult(currentPage * pageSize).list();
}

Add these to dataelement.vm
for search at the top:

    #parse( "/dhis-web-maintenance-datadictionary/search.vm" )

for pagination (prev/next) at the ned of table:

#if($currentPage>0) #set( $prevPage = $currentPage - 1 ) $i18n.getString( "command.prev") #end &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp #if($count==$pageSize) #set( $nextPage = $currentPage + 1 ) $i18n.getString( "command.more") #end

pagination.7z (5.29 KB)

···

From: Viet Nguyen phamquocviet@gmail.com
To: Murodullo Latifov murodlatifov@yahoo.com
Cc: Hieu Dang Duy hieu.hispvietnam@gmail.com; Dhis2 dhis2-devs@lists.launchpad.net
Sent: Mon, March 8, 2010 3:10:45 PM
Subject: Re: [Dhis2-devs] Translation function - Stay at page after modified some thing

On Mon, Mar 8, 2010 at 3:04 PM, Murodullo Latifov murodlatifov@yahoo.com wrote:

Hi all,

In this connection I also implemented server side pagination for dhis. This could be used in Dataelement listing, patient records, etc. There is also search facility working with pagination to narrow down scope. It may need speed comparison with existing single listings and other pros and cons.

regards,
murod

Hi,

I’m also planing to implement a paging util for patient module.

May I see your code :slight_smile:

Hi Viet,

Follow this steps to add pagination. I am listing those areas that added/modified for this, for the rest look at corresponding files attached. SearchText could be handled in a way during Add/Remove so user comes back to the last search criteria hi left. If this works than user will be always focused into set of data, rather going back to the whole set and researching again.

Add these properties to GetDataElementListAction.java.

private String searchText ="";

public String getSearchText() {
    return searchText;
}

public void setSearchText(String searchText) {


    this.searchText = searchText;
}

private int pageSize = 10;

public int getPageSize() {
    return pageSize;
}

public void setPageSize(int pageSize) {
    this.pageSize = pageSize;


}

private int currentPage = 0;

public int getCurrentPage() {
    return currentPage;
}

public void setCurrentPage(int currentPage) {
    this.currentPage = currentPage;


}

Change //dataElements = new ArrayList( dataElementService.getAllDataElements() ); to
dataElements = new ArrayList( dataElementService.getDataElements(currentPage, pageSize, searchText) );

Create dataElementService.getDataElements(currentPage, pageSize, searchText) as such:

// helper method for query based search, needed to add %% to search string and test if it is not null

private String getSearchPattern(String criteria) {
if (StringUtils.hasText(criteria)) {


    return "%" + criteria.toLowerCase().replace('*', '%') + "%";
} else {
    return "%%";
    }
}

@SuppressWarnings("unchecked")


@Override
public Collection<DataElement> getDataElements(int currentPage,
        int pageSize, String searchText) {
    String pattern = getSearchPattern(searchText);
    Session session = sessionFactory.getCurrentSession();



    Criteria criteria = session.createCriteria( DataElement.class );
    criteria.add(Restrictions.sqlRestriction("lower({alias}.name) like lower(?)", pattern, Hibernate.STRING)); //this is needed only if you want search functionality



    return criteria.setMaxResults(pageSize).setFirstResult(currentPage * pageSize).list();
}

Add these to dataelement.vm
for search at the top:
#parse( “/dhis-web-maintenance-datadictionary/search.vm” )
for pagination (prev/next) at the ned of table:

#if($currentPage>0) #set( $prevPage = $currentPage - 1 )

$i18n.getString( “command.prev”)
#end
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp

#if($count==$pageSize)
#set( $nextPage = $currentPage + 1 )
$i18n.getString( “command.more”)

#end

Thank you very much Murodullo.

I will try to implement this to the patient list and update to you soon.

Regards,

PS : Sorry Hieu, we are disturbing your thread …next time update this Paging things I will create new thread :slight_smile:

···

On Mon, Mar 8, 2010 at 3:56 PM, Murodullo Latifov murodlatifov@yahoo.com wrote:


From: Viet Nguyen phamquocviet@gmail.com
To: Murodullo Latifov murodlatifov@yahoo.com

Cc: Hieu Dang Duy hieu.hispvietnam@gmail.com; Dhis2 dhis2-devs@lists.launchpad.net

Sent: Mon, March 8, 2010 3:10:45 PM
Subject: Re: [Dhis2-devs] Translation function - Stay at page after modified some thing

On Mon, Mar 8, 2010 at 3:04 PM, Murodullo Latifov murodlatifov@yahoo.com wrote:

Hi all,

In this connection I also implemented server side pagination for dhis. This could be used in Dataelement listing, patient records, etc. There is also search facility working with pagination to narrow down scope. It may need speed comparison with existing single listings and other pros and cons.

regards,
murod

Hi,

I’m also planing to implement a paging util for patient module.

May I see your code :slight_smile:


Viet Nguyen

Dear all,

May I give to devs a small suggestion like this:
I think we should keep for non-redirecting page after we’ve got some of saving for the object’s translated value (name, shortname, description, ect …)

In the original case, after pressed Save button system would redirect from the sub-page (dhis/dhis-web-commons/i18n.action) to the main page (dhis-web-maintenance-datadictionary/dataElement.action).
But I realized that it would be very very inconvenient and waste of time if we have to add so many the other translated values of each object for each corresponding locale.

For example:

I’ve got a string as “Doctor” in English. And then, I want to add some of new translated values with “Bác sỹ” in Vietnamese or “醫生” in Chinese or “Доктор” in Ukrainian. So, in this case we must go to 3 times for doing the same page (dhis/dhis-web-commons/i18n.action).

Thanks !

Hi Hieu,

thanks for raising this issue. This sounds just fine to me, go ahead. Just make sure you include sensible user feedback on save so that it is clear that the translation actually has been saved.

regards, Lars

···

On Mon, Mar 8, 2010 at 10:19 AM, Hieu Dang Duy hieu.hispvietnam@gmail.com wrote:


Hieu.HISPVietnam
Good Health !


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