dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12238
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3716: made dblclick functions return functions
------------------------------------------------------------
revno: 3716
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-05-24 09:32:08 +0200
message:
made dblclick functions return functions
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisPaging.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserGroupForm.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/jQuery/jquery.dhisPaging.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisPaging.js 2011-05-23 13:51:02 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisPaging.js 2011-05-24 07:32:08 +0000
@@ -51,63 +51,67 @@
*
*/
function dhisPaging_availableList_dblclick(sourceId, targetId, removeArray) {
- var jqAvailableList = jQuery("#" + sourceId);
- var jqSelectedList = jQuery("#" + targetId);
-
- var settings = jqAvailableList.data("settings");
-
- jqAvailableList.find(":selected").each(function(i) {
- var jqThis = jQuery(this);
- var option_id = +jqThis.attr("value");
-
- jqSelectedList.append( this );
-
- if( jQuery.isArray(settings[removeArray]) ) {
- settings[removeArray].push(option_id);
+ return function() {
+ var jqAvailableList = jQuery("#" + sourceId);
+ var jqSelectedList = jQuery("#" + targetId);
+
+ var settings = jqAvailableList.data("settings");
+
+ jqAvailableList.find(":selected").each(function(i) {
+ var jqThis = jQuery(this);
+ var option_id = +jqThis.attr("value");
+
+ jqSelectedList.append( this );
+
+ if( jQuery.isArray(settings[removeArray]) ) {
+ settings[removeArray].push(option_id);
+ } else {
+ settings[removeArray] = [option_id];
+ }
+ });
+
+ if(settings[removeArray] && settings[removeArray].length > 0) {
+ settings.params[removeArray] = settings[removeArray].join(",");
} else {
- settings[removeArray] = [option_id];
+ delete settings[removeArray];
+ delete settings.params[removeArray];
}
- });
-
- if(settings[removeArray] && settings[removeArray].length > 0) {
- settings.params[removeArray] = settings[removeArray].join(",");
- } else {
- delete settings[removeArray];
- delete settings.params[removeArray];
+
+ jqAvailableList.dhisPaging("load", sourceId);
}
-
- jqAvailableList.dhisPaging("load", sourceId);
}
/*
*
*/
function dhisPaging_selectedList_dblclick(sourceId, targetId, removeArray) {
- var jqAvailableList = jQuery("#" + targetId);
- var jqSelectedList = jQuery("#" + sourceId);
-
- var settings = jQuery("#" + targetId).data("settings");
-
- jqSelectedList.find(":selected").each(function(i) {
- var jqThis = jQuery(this);
- var option_id = +jqThis.attr("value");
- jqThis.remove();
-
- if( jQuery.isArray(settings[removeArray]) )
- {
- var remove_idx = jQuery.inArray(option_id, settings[removeArray]);
- settings[removeArray].splice(remove_idx, remove_idx+1);
+ return function() {
+ var jqAvailableList = jQuery("#" + targetId);
+ var jqSelectedList = jQuery("#" + sourceId);
+
+ var settings = jQuery("#" + targetId).data("settings");
+
+ jqSelectedList.find(":selected").each(function(i) {
+ var jqThis = jQuery(this);
+ var option_id = +jqThis.attr("value");
+ jqThis.remove();
+
+ if( jQuery.isArray(settings[removeArray]) )
+ {
+ var remove_idx = jQuery.inArray(option_id, settings[removeArray]);
+ settings[removeArray].splice(remove_idx, remove_idx+1);
+ }
+ });
+
+ if(settings[removeArray] && settings[removeArray].length > 0) {
+ settings.params[removeArray] = settings[removeArray].join(",");
+ } else {
+ delete settings[removeArray];
+ delete settings.params[removeArray];
}
- });
-
- if(settings[removeArray] && settings[removeArray].length > 0) {
- settings.params[removeArray] = settings[removeArray].join(",");
- } else {
- delete settings[removeArray];
- delete settings.params[removeArray];
+
+ jqAvailableList.dhisPaging("load", targetId);
}
-
- jqAvailableList.dhisPaging("load", targetId);
}
// -----------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm 2011-05-23 13:51:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm 2011-05-24 07:32:08 +0000
@@ -4,21 +4,11 @@
var jqDataElementsSelectedList = jQuery("#dataElementsSelectedList");
var jqIndicatorsSelectedList = jQuery("#indicatorsSelectedList");
- jQuery("#availableDataElementsList").dblclick(function() {
- dhisPaging_availableList_dblclick("availableDataElementsList", "dataElementsSelectedList", "removeDataElements");
- });
-
- jqDataElementsSelectedList.dblclick(function() {
- dhisPaging_selectedList_dblclick("dataElementsSelectedList", "availableDataElementsList", "removeDataElements");
- });
-
- jQuery("#availableIndicatorsList").dblclick(function() {
- dhisPaging_availableList_dblclick("availableIndicatorsList", "indicatorsSelectedList", "removeIndicators");
- });
-
- jqIndicatorsSelectedList.dblclick(function() {
- dhisPaging_selectedList_dblclick("indicatorsSelectedList", "availableIndicatorsList", "removeIndicators");
- });
+ jQuery("#availableDataElementsList").dblclick(dhisPaging_availableList_dblclick("availableDataElementsList", "dataElementsSelectedList", "removeDataElements"));
+ jqDataElementsSelectedList.dblclick(dhisPaging_selectedList_dblclick("dataElementsSelectedList", "availableDataElementsList", "removeDataElements"));
+
+ jQuery("#availableIndicatorsList").dblclick(dhisPaging_availableList_dblclick("availableIndicatorsList", "indicatorsSelectedList", "removeIndicators"));
+ jqIndicatorsSelectedList.dblclick(dhisPaging_selectedList_dblclick("indicatorsSelectedList", "availableIndicatorsList", "removeIndicators"));
jQuery("#availableDataElementsList").dhisPaging({
source: "../dhis-web-commons-ajax-json/getDataElements.action",
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm 2011-05-23 13:51:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm 2011-05-24 07:32:08 +0000
@@ -24,21 +24,11 @@
var jqDataElementsSelectedList = jQuery("#dataElementsSelectedList");
var jqIndicatorsSelectedList = jQuery("#indicatorsSelectedList");
- jQuery("#availableDataElementsList").dblclick(function() {
- dhisPaging_availableList_dblclick("availableDataElementsList", "dataElementsSelectedList", "removeDataElements");
- });
-
- jqDataElementsSelectedList.dblclick(function() {
- dhisPaging_selectedList_dblclick("dataElementsSelectedList", "availableDataElementsList", "removeDataElements");
- });
-
- jQuery("#availableIndicatorsList").dblclick(function() {
- dhisPaging_availableList_dblclick("availableIndicatorsList", "indicatorsSelectedList", "removeIndicators");
- });
-
- jqIndicatorsSelectedList.dblclick(function() {
- dhisPaging_selectedList_dblclick("indicatorsSelectedList", "availableIndicatorsList", "removeIndicators");
- });
+ jQuery("#availableDataElementsList").dblclick(dhisPaging_availableList_dblclick("availableDataElementsList", "dataElementsSelectedList", "removeDataElements"));
+ jqDataElementsSelectedList.dblclick(dhisPaging_selectedList_dblclick("dataElementsSelectedList", "availableDataElementsList", "removeDataElements"));
+
+ jQuery("#availableIndicatorsList").dblclick(dhisPaging_availableList_dblclick("availableIndicatorsList", "indicatorsSelectedList", "removeIndicators"));
+ jqIndicatorsSelectedList.dblclick(dhisPaging_selectedList_dblclick("indicatorsSelectedList", "availableIndicatorsList", "removeIndicators"));
removeDataElementsList = getRemoveDataElementsList();
removeIndicatorsList = getRemoveIndicatorsList();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm 2011-05-23 13:57:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm 2011-05-24 07:32:08 +0000
@@ -1,13 +1,8 @@
<script type="text/javascript" src="javascript/addUserGroupForm.js"></script>
<script type="text/javascript">
jQuery(function() {
- jQuery("#availableUsersList").dblclick(function() {
- dhisPaging_availableList_dblclick("availableUsersList", "groupMembersList", "removeUsers");
- });
-
- jQuery("#groupMembersList").dblclick(function() {
- dhisPaging_selectedList_dblclick("groupMembersList", "availableUsersList", "removeUsers");
- });
+ jQuery("#availableUsersList").dblclick(dhisPaging_availableList_dblclick("availableUsersList", "groupMembersList", "removeUsers"));
+ jQuery("#groupMembersList").dblclick(dhisPaging_selectedList_dblclick("groupMembersList", "availableUsersList", "removeUsers"));
jQuery("#availableUsersList").dhisPaging({
source: "../dhis-web-commons-ajax-json/getUsers.action",
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserGroupForm.vm 2011-05-23 13:57:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserGroupForm.vm 2011-05-24 07:32:08 +0000
@@ -11,13 +11,8 @@
}
jQuery(document).ready(function() {
- jQuery("#availableUsersList").dblclick(function() {
- dhisPaging_availableList_dblclick("availableUsersList", "groupMembersList", "removeUsers");
- });
-
- jQuery("#groupMembersList").dblclick(function() {
- dhisPaging_selectedList_dblclick("groupMembersList", "availableUsersList", "removeUsers");
- });
+ jQuery("#availableUsersList").dblclick(dhisPaging_availableList_dblclick("availableUsersList", "groupMembersList", "removeUsers"));
+ jQuery("#groupMembersList").dblclick(dhisPaging_selectedList_dblclick("groupMembersList", "availableUsersList", "removeUsers"));
var removeUsersList = getRemoveUsersList();