From: pdontthink Date: Wed, 7 May 2008 18:50:53 +0000 (+0000) Subject: Add real checkbox name and extra js args to row_click() and optional plugin input... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=109e876c350b95a12eefa4e6df0e389b7ba8417d;p=squirrelmail.git Add real checkbox name and extra js args to row_click() and optional plugin input to extra js arg and checkbox input; also add somem documentation git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13109 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/templates/default/js/default.js b/templates/default/js/default.js index 16077e9a..ca1321ac 100644 --- a/templates/default/js/default.js +++ b/templates/default/js/default.js @@ -12,9 +12,18 @@ var orig_row_colors = new Array(); * (un)Checks checkbox for the row that the current table cell is in * when it gets clicked. * - * @param string the name of the checkbox that should be (un)checked + * @param string The (internal) name of the checkbox + * that should be (un)checked + * @param JavaScript event object The JavaScript event associated + * with this mouse click + * @param string The name of the encapsulating form + * @param string The (real) name of the checkbox + * that should be (un)checked + * @param string Any extra JavaScript (that will + * be executed herein if non-empty); + * must be valid JavaScript expression(s) */ -function row_click(chkboxName, event, formName) { +function row_click(chkboxName, event, formName, checkboxRealName, extra) { var chkbox = document.getElementById(chkboxName); if (chkbox) { // initialize orig_row_color if not defined already @@ -24,6 +33,8 @@ function row_click(chkboxName, event, formName) { orig_row_colors[chkboxName] = orig_row_colors[chkboxName].substring(8, orig_row_colors[chkboxName].length); } chkbox.checked = (chkbox.checked ? false : true); + + if (extra != '') eval(extra); } } diff --git a/templates/default/message_list.tpl b/templates/default/message_list.tpl index 6272dbd9..c7daca55 100644 --- a/templates/default/message_list.tpl +++ b/templates/default/message_list.tpl @@ -263,8 +263,13 @@ if ($pageOffset < $end_msg) { // this stuff does the auto row highlighting on mouseover // + if (!empty($plugin_output['checkbox_javascript_onclick'])) $checkbox_javascript_onclick = $plugin_output['checkbox_javascript_onclick']; + else $checkbox_javascript_onclick = ''; + if ($javascript_on && $fancy_index_highlite) { - $checkbox_javascript = ' onclick="this.checked = !this.checked;"'; + $checkbox_javascript = ' onclick="this.checked = !this.checked; ' . $checkbox_javascript_onclick . '"'; + } else if (!empty($checkbox_javascript_onclick)) { + $checkbox_javascript = ' onclick="' . $checkbox_javascript_onclick . '"'; } else { $checkbox_javascript = ''; } @@ -359,9 +364,11 @@ if ($pageOffset < $end_msg) { // where on the row you click // $javascript_auto_click = ''; + $row_click_extra = ''; + if (!empty($plugin_output['row_click_extra'])) $row_click_extra = $plugin_output['row_click_extra']; if ($javascript_on && $fancy_index_highlite) { // include the form_id in order to show multiple messages lists. Otherwise id isn't unique - $javascript_auto_click = " onmousedown=\"row_click('$form_id"."_msg$i', event, '$form_name')\""; + $javascript_auto_click = " onmousedown=\"row_click('$form_id"."_msg$i', event, '$form_name', 'msg[' + $i + ']', '$row_click_extra')\""; } @@ -461,7 +468,7 @@ if ($non_clicked_class != 'even' && $non_clicked_class != 'odd' if ($onclick) { $sText .= " onclick=\"$onclick\""; } if ($link_extra) { $sText .= " $link_extra"; } if ($javascript_on && $fancy_index_highlite) { - $sText .= " onmousedown=\"row_click('$form_id"."_msg$i', event, '$form_name'); setPointer(this." . (empty($bold) ? '' : 'parentNode.') . + $sText .= " onmousedown=\"row_click('$form_id"."_msg$i', event, '$form_name', 'msg[' + $i + ']', '$row_click_extra'); setPointer(this." . (empty($bold) ? '' : 'parentNode.') . 'parentNode.parentNode, ' . $i . ', \'click\', \''. $non_clicked_class. '\', \'mouse_over\', \'clicked\');"'; } $sText .= ">"