mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.9 to HEAD
10531: Merged V2.2 to V2.9 9928: Optimise & consolidate get web project user role (ETWOTWO-568) 9962: Reverted rev 9902 of RuleServiceImpl 9964: Fixed transaction read-only declaration 9979: ETWOTWO-572: Allow OpenOffice to be called remotely 9987: Second attempt at fixing ETWOTWO-438: versionable aspect and invite user 10096: Fix for ETWOTWO-507 FSR Service Port 10224: Fix for ETWOTWO-507 (inconsistent results with add and delete together) 10225: Adding logging and making FSR work with absolute directories (ETWOTWO-70 and ETWOONE-81) 10254: ALFCOM-242, ALFCOM-230, ETWOTWO-437 10283: Fixed deployment installer builder to use IJ v1.2.7 10359: Add Display Group for deployment servers to JSF client (ETWOTWO-474) 10536: MT - simple setup/system test 10553: Hid domain objects completely within the UsageDeltaDAO git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10613 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
75
source/web/scripts/select-all.js
Normal file
75
source/web/scripts/select-all.js
Normal file
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// Select All JS
|
||||
//
|
||||
// Java script utilities to support "select all" checkboxes.
|
||||
// which consist of a parent checkbox and a collection of one or more
|
||||
// child checkboxes.
|
||||
// Clicking the parent checkbox sets the children.
|
||||
// Clicking the children may affect the parent.
|
||||
//
|
||||
// select_all is called to set or reset all child checkboxes.
|
||||
//
|
||||
// select_child is called when a child is selected and may set or
|
||||
// reset the parent depending upon whether all its siblings are set.
|
||||
//
|
||||
// prepare_select_all initialises this package
|
||||
//
|
||||
var formblock;
|
||||
var forminputs;
|
||||
|
||||
function prepare_select_all() {
|
||||
formblock= document.getElementById('dialog');
|
||||
forminputs = formblock.getElementsByTagName('input');
|
||||
}
|
||||
|
||||
/**
|
||||
* call after a child to set the value of the parent.
|
||||
* @param parentId the id of the parent
|
||||
* @param childname the name of the child checkbox
|
||||
*/
|
||||
function select_one(parentId, childname) {
|
||||
var isSelected = true;
|
||||
for (i = 0; i < forminputs.length; i++) {
|
||||
var regex = new RegExp(childname, "i");
|
||||
var x = forminputs[i];
|
||||
if (regex.test(x.getAttribute('name'))) {
|
||||
if(x.getAttribute('type') == 'checkbox') {
|
||||
if(x.checked == false) {
|
||||
isSelected = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var parent = document.getElementById(parentId);
|
||||
parent.checked = isSelected;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called after the parent is clicked to set the value of the children.
|
||||
* @param childname the name of the child checkboxes.
|
||||
* @param value the value to set.
|
||||
* @return
|
||||
*/
|
||||
function select_all(childname, value) {
|
||||
for (i = 0; i < forminputs.length; i++) {
|
||||
if(childname == forminputs[i].getAttribute('name')) {
|
||||
if (value == '1') {
|
||||
forminputs[i].checked = true;
|
||||
} else {
|
||||
forminputs[i].checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (window.addEventListener) {
|
||||
window.addEventListener("load", prepare_select_all, false);
|
||||
} else if (window.attachEvent) {
|
||||
window.attachEvent("onload", prepare_select_all)
|
||||
} else if (document.getElementById) {
|
||||
window.onload = prepare_select_all;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user