aboutsummaryrefslogtreecommitdiff
path: root/mod/ecml
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-15 23:24:10 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-15 23:24:10 +0000
commit08441e1e99bbae49418c4b06c302f1a2057c2179 (patch)
treee9c0750ad0ede0e0722ac68bfb5cd6b4ef52cdc4 /mod/ecml
parent0aac4dadcbe972f6aecef078e1435e79ea07c7ee (diff)
downloadelgg-08441e1e99bbae49418c4b06c302f1a2057c2179.tar.gz
elgg-08441e1e99bbae49418c4b06c302f1a2057c2179.tar.bz2
Added ability to check all rows or columns in ecml permissions page.
git-svn-id: http://code.elgg.org/elgg/trunk@5758 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/ecml')
-rw-r--r--mod/ecml/views/default/ecml/admin/ecml_admin.php54
1 files changed, 34 insertions, 20 deletions
diff --git a/mod/ecml/views/default/ecml/admin/ecml_admin.php b/mod/ecml/views/default/ecml/admin/ecml_admin.php
index 34f777414..0bd7793c8 100644
--- a/mod/ecml/views/default/ecml/admin/ecml_admin.php
+++ b/mod/ecml/views/default/ecml/admin/ecml_admin.php
@@ -27,7 +27,8 @@ $form_body = <<<___END
___END;
foreach ($views as $view => $view_desc) {
- $form_body .= "<th><acronym title=\"$view\">$view_desc</acronym></th>";
+ $form_body .= "<th><acronym class=\"ecml_view ecml_check_all\" title=\"$view\">$view_desc</acronym></th>";
+ $n++;
}
$form_body .= '</tr>';
@@ -36,7 +37,7 @@ foreach ($keywords as $keyword => $keyword_info) {
$keyword_desc = $keyword_info['description'];
$form_body .= "
<tr class=\"ecml_row_$odd\">
- <td class=\"ecml_keyword_desc\"><acronym title=\"$keyword_desc\">$keyword</acryonym></td>
+ <td class=\"ecml_keyword_desc\"><acronym class=\"ecml_keyword ecml_check_all\" title=\"$keyword_desc\">$keyword</acronym></td>
";
foreach ($views as $view => $view_info) {
// if this is restricted and we're not on the specified view don't allow changes
@@ -65,21 +66,34 @@ echo elgg_view('input/form', array(
'action' => $vars['url'] . 'action/ecml/save_permissions'
));
-//foreach ($views as $view => $desc) {
-// echo elgg_view_title($desc);
-// echo '<ul>';
-// foreach ($keywords as $keyword => $info) {
-// $description = $info['description'];
-//
-// echo "<li>$keyword</li>";
-// }
-// echo '</ul>';
-//
-//echo <<<___END
-// <br />
-// </li>
-//
-//___END;
-//}
-//
-//echo '</ul>'; \ No newline at end of file
+?>
+<script type="text/javascript">
+
+$(document).ready(function() {
+ // append check all link
+ $('.ecml_check_all').before('<input type="checkbox" class="check_all">');
+
+ $('input.check_all').click(function() {
+ // yoinked from
+ // http://stackoverflow.com/questions/788225/table-row-and-column-number-in-jquery
+ var rowIndex = $(this).parent().parent().children().index($(this).parent());
+ var check = $(this).attr('checked');
+
+ // clicked on a keyword on the left, check all boxes in the tr
+ if (rowIndex == 0) {
+ $(this).parent().parent().find('input').each(function() {
+ if (!$(this).attr('disabled')) {
+ $(this).attr('checked', check);
+ }
+ });
+ } else {
+ boxes = $('.ecml_admin_table > tbody > tr td:nth-child(' + (rowIndex + 1) + ') input[type=checkbox]');
+ boxes.each(function() {
+ if (!$(this).attr('disabled')) {
+ $(this).attr('checked', check);
+ }
+ });
+ }
+ });
+});
+</script>