dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19879
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8856: Improved nasty js function for paging
------------------------------------------------------------
revno: 8856
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-11-04 14:24:19 +0300
message:
Improved nasty js function for paging
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicator.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/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2012-11-01 15:33:54 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2012-11-04 11:24:19 +0000
@@ -1678,37 +1678,20 @@
{
var baseLink = jQuery( "#baseLink" ).val();
var url = baseLink + "currentPage=" + currentPage + "&pageSize=" + pageSize;
-
+
var index = url.indexOf( '?' );
var link = url.substring( 0, index );
var data = url.substring( index + 1 );
if ( !isAjax )
{
- var keyParam = data.split( '&' )[0];
-
- if ( keyParam.split( '=' )[0] == "key" )
- {
- setFieldValue( 'key', keyParam.split( '=' )[1] )
- }
-
- url = link + "?currentPage=" + currentPage + "&pageSize=" + pageSize;
-
- if ( $( '#filterKeyForm' ).length )
- {
- $( '#filterKeyForm' ).attr( 'action', url );
- $( '#filterKeyForm' ).submit();
- }
- else
- {
- window.location.href = url;
- }
+ window.location.href = encodeURI( url );
}
else
{
jQuery.postUTF8( link, data, function( html ) {
setInnerHTML( contentDiv, html );
- });
+ } );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm 2012-05-03 04:09:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm 2012-11-04 11:24:19 +0000
@@ -94,16 +94,12 @@
#end
#macro( filterDiv $action )
-$i18n.getString( "filter_by_name" ):
-<form id="filterKeyForm" action="${action}.action" method="POST">
- <div style="inline">
- #set ($value = $encoder.htmlEncode( ${key} ))
- <input type="text" id="key" name="key" value="$!value"/>
- <input type="hidden" id="curKey" name="curKey" value="$!value"/>
- <input type="submit" value="$i18n.getString( 'filter' )"/>
- <input type="button" value="$i18n.getString( 'clear' )"
- onclick="window.location.href='${action}.action'"/>
- </div>
+<form id="filterKeyForm" action="${action}.action" method="POST">
+ <input type="text" id="key" name="key" value="$!encoder.htmlEncode( $key )" placeholder="$i18n.getString( 'filter_by_name' )" style="width:140px"/>
+ <input type="hidden" id="curKey" name="curKey" value="$!encoder.htmlEncode( $key )"/>
+ <input type="submit" value="$i18n.getString( 'filter' )" style="width:55px"/>
+ <input type="button" value="$i18n.getString( 'clear' )"
+ onclick="window.location.href='${action}.action'" style="width:55px"/>
</form>
#end
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm 2012-10-18 13:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm 2012-11-04 11:24:19 +0000
@@ -33,10 +33,9 @@
<tr valign="bottom">
<td>#filterDiv( "dataElement" )</td>
<td>
- $i18n.getString( "select_data_dictionary" ):
<div style="inline">
- <select id="dataDictionaryList" name="dataDictionaryList" onchange="criteriaChanged()" style="min-width:180px">
- <option value="-1">[ $i18n.getString( "all" ) ]</option>
+ <select id="dataDictionaryList" name="dataDictionaryList" onchange="criteriaChanged()" style="width:160px">
+ <option value="-1">[ $i18n.getString( "select_data_dictionary" ) ]</option>
#foreach( $dictionary in $dataDictionaries )
<option value="$dictionary.id" #if ( $!dataDictionaryId && $dictionary.id == $dataDictionaryId ) selected="selected"#end>$dictionary.name</option>
#end
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicator.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicator.vm 2012-10-18 13:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicator.vm 2012-11-04 11:24:19 +0000
@@ -20,10 +20,10 @@
<table width="100%">
<tr>
<td>#filterDiv( "indicator" )</td>
- <td>$i18n.getString( "select_data_dictionary" ):
+ <td>
<div style="inline">
- <select id="dataDictionaryList" name="dataDictionaryList" onchange="criteriaChanged()" style="min-width:140px">
- <option value="-1">[ $i18n.getString( "all" ) ]</option>
+ <select id="dataDictionaryList" name="dataDictionaryList" onchange="criteriaChanged()" style="width:160px">
+ <option value="-1">[ $i18n.getString( "select_data_dictionary" ) ]</option>
#foreach( $dictionary in $dataDictionaries )
<option value="$dictionary.id"#if ( $dictionary.id == $dataDictionaryId ) selected="selected"#end>$dictionary.displayName</option>
#end