use JQuery for select all link and support deselection, too

This commit is contained in:
Roland Gruber 2010-02-17 17:57:04 +00:00
parent 5c615e3892
commit 1931b2ac49
2 changed files with 19 additions and 10 deletions

View File

@ -361,14 +361,8 @@ class lamList {
" onMouseOut=\"list_out(this, '" . $rowID . "', '" . $this->type . "')\"\n" .
" onClick=\"list_click(this, '" . $rowID . "', '" . $this->type . "')\"\n" .
" onDblClick=\"top.location.href='../account/edit.php?type=" . $this->type . "&DN=" . rawurlencode($info[$i]['dn']) . "'\">\n");
if (isset($_GET['selectall'])) {
echo " <td align=\"center\"><input onClick=\"list_click(this, '" . $rowID . "', '" . $this->type . "')\"" .
" type=\"checkbox\" checked name=\"" . $rowID . "\"></td>\n";
}
else {
echo " <td align=\"center\"><input onClick=\"list_click(this, '" . $rowID . "', '" . $this->type . "')\"" .
" type=\"checkbox\" name=\"" . $rowID . "\"></td>\n";
}
echo " <td align=\"center\"><input class=\"accountBoxUnchecked\" onClick=\"list_click(this, '" . $rowID . "', '" . $this->type . "')\"" .
" type=\"checkbox\" name=\"" . $rowID . "\"></td>\n";
echo " <td align='center' style=\"white-space: nowrap;\">";
$this->listPrintToolLinks($info[$i], $rowID);
echo "</td>\n";
@ -384,8 +378,7 @@ class lamList {
$colspan = sizeof($this->attrArray) + 1;
echo "<tr class=\"" . $this->type . "list\">\n";
echo "<td align=\"center\"><img src=\"../../graphics/select.png\" alt=\"select all\"></td>\n";
echo "<td colspan=$colspan>&nbsp;<a href=\"list.php?type=" . $this->type . "&amp;norefresh=y&amp;page=" . $this->page .
"&amp;sort=" . $this->sortColumn . $this->filterText . "&amp;selectall=yes\">" .
echo "<td colspan=$colspan>&nbsp;<a href=\"#\" onClick=\"list_switchAccountSelection();\">" .
"<font color=\"black\"><b>" . _("Select all") . "</b></font></a></td>\n";
echo "</tr>\n";
echo ("</table>");

View File

@ -83,3 +83,19 @@ function addResizeHandler(item, min, max) {
}
);
}
/**
* Selects/deselects all accounts on the page.
*/
function list_switchAccountSelection() {
// set checkbox selection
jQuery('.accountBoxUnchecked').attr('checked', 'checked');
jQuery('.accountBoxChecked').removeAttr('checked');
// switch CSS class
nowChecked = jQuery('.accountBoxUnchecked');
nowUnchecked = jQuery('.accountBoxChecked');
nowChecked.addClass('accountBoxChecked');
nowChecked.removeClass('accountBoxUnchecked');
nowUnchecked.addClass('accountBoxUnchecked');
nowUnchecked.removeClass('accountBoxChecked');
}