// initialize orig_row_color if not defined already
if (!orig_row_colors[chkboxName]) {
orig_row_colors[chkboxName] = chkbox.parentNode.getAttribute('bgcolor');
+ if (orig_row_colors[chkboxName].indexOf("clicked_") == 0)
+ orig_row_colors[chkboxName] = orig_row_colors[chkboxName].substring(8, orig_row_colors[chkboxName].length);
}
chkbox.checked = (chkbox.checked ? false : true);
}
chkbox = document.getElementById(chkboxName);
if (chkbox) {
if (!orig_row_colors[chkboxName]) {
- rowClass = getCSSClass(chkbox.parentNode.parentNode);
+ rowClass = getCSSClass(chkbox.parentNode.parentNode);
+ if (rowClass.indexOf("clicked_") == 0)
+ rowClass = rowClass.substring(8, rowClass.length);
orig_row_colors[chkboxName] = rowClass;
} else {
rowClass = orig_row_colors[chkboxName];
}
- j = chkbox.name.length - 1
+ rowNum = chkboxName.substring(chkboxName.length - 1, chkboxName.length);
/*
* The mouseover and clicked CSS classes are always the same name!
*/
overClass = 'mouse_over';
clickedClass = 'clicked';
- setPointer(chkbox.parentNode.parentNode, j,'over' , rowClass, overClass, clickedClass);
+ setPointer(chkbox.parentNode.parentNode, rowNum, 'over' , rowClass, overClass, clickedClass);
}
}
if (TargetForm.elements[i].type == 'checkbox' && TargetForm.elements[i].name.substring(0,3) == 'msg') {
if (fancy) {
array_key = TargetForm.elements[i].getAttribute('id');
- if (TargetForm.elements[i].checked == false) {
- // initialize orig_row_color if not defined already
- if (!orig_row_colors[array_key]) {
- rowClass = getCSSClass(TargetForm.elements[i].parentNode.parentNode);
- orig_row_colors[array_key] = rowClass;
- }
+ // initialize orig_row_color if not defined already
+ if (!orig_row_colors[array_key]) {
+ rowClass = getCSSClass(TargetForm.elements[i].parentNode.parentNode);
+ if (rowClass.indexOf("clicked_") == 0)
+ rowClass = rowClass.substring(8, rowClass.length);
+ orig_row_colors[array_key] = rowClass;
}
origClass = orig_row_colors[array_key];
- clickedClass = 'clicked';
+ clickedClass = 'clicked';
setPointer(TargetForm.elements[i].parentNode.parentNode, j,'click' , origClass, origClass, clickedClass);
j++
}
/*
* Sets/unsets the pointer and marker in browse mode
*
- * @param object the table row
- * @param integer the row number
- * @param string the action calling this script (over, out or click)
- * @param string the default background CSS class
- * @param string the CSS class to use for mouseover
- * @param string the CSS class to use for marking a row
+ * @param object theRow the table row
+ * @param integer theRowNum the row number
+ * @param string theAction the action calling this script (over, out or click)
+ * @param string defaultClass the default background CSS class
+ * @param string mouseoverClass the CSS class to use for mouseover
+ * @param string clickedClass the CSS class to use for marking a row
*
* @return boolean whether pointer is set or not
*/
-function setPointer(theRow, theRowNum, theAction, theDefaultClass, thePointerClass, theMarkClass)
+function setPointer(theRow, theRowNum, theAction, defaultClass, mouseoverClass, clickedClass)
{
// 1. Pointer and mark feature are disabled or the browser can't get the
// row -> exits
- if ((thePointerClass == '' && theMarkClass == '')
+ if ((mouseoverClass == '' && clickedClass == '')
|| typeof(theRow.className) == 'undefined') {
return false;
}
// 3. Gets the current CSS class...
var newClass = null;
var currentClass = getCSSClass(theRow);
+ if (currentClass.indexOf("clicked_") == 0)
+ currentClass = 'clicked';
// 4. Defines the new class
// 4.1 Current class is the default one
if (currentClass == ''
- || currentClass.toLowerCase() == theDefaultClass.toLowerCase()) {
- if (theAction == 'over' && thePointerClass != '') {
- newClass = thePointerClass;
+ || currentClass.toLowerCase() == defaultClass.toLowerCase()) {
+ if (theAction == 'over' && mouseoverClass != '') {
+ newClass = mouseoverClass;
}
- else if (theAction == 'click' && theMarkClass != '') {
- newClass = theMarkClass;
+ else if (theAction == 'click' && clickedClass != '') {
+ newClass = clickedClass;
marked_row[theRowNum] = true;
// deactivated onclick marking of the checkbox because it's also executed
// when an action (clicking on the checkbox itself) on a single item is
//document.getElementById('msg[' + theRowNum + ']').checked = true;
}
}
- // 4.1.2 Current class is the pointer one
- else if (currentClass.toLowerCase() == thePointerClass.toLowerCase()
+ // 4.1.2 Current class is the mouseover one
+ else if (currentClass.toLowerCase() == mouseoverClass.toLowerCase()
&& (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
if (theAction == 'out') {
- newClass = theDefaultClass;
+ newClass = defaultClass;
}
- else if (theAction == 'click' && theMarkClass != '') {
- newClass = theMarkClass;
+ else if (theAction == 'click' && clickedClass != '') {
+ newClass = clickedClass;
marked_row[theRowNum] = true;
//document.getElementById('msg[' + theRowNum + ']').checked = true;
}
}
- // 4.1.3 Current color is the marker one
- else if (currentClass.toLowerCase() == theMarkClass.toLowerCase()) {
+ // 4.1.3 Current color is the clicked one
+ else if (currentClass.toLowerCase() == clickedClass.toLowerCase()) {
if (theAction == 'click') {
- newClass = (thePointerClass != '')
- ? thePointerClass
- : theDefaultClass;
- marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
- ? true
- : null;
+ newClass = (mouseoverClass != '')
+ ? mouseoverClass
+ : defaultClass;
+ marked_row[theRowNum] = false;
//document.getElementById('msg[' + theRowNum + ']').checked = false;
}
} // end 4
* $show_label_columns
* $compact_paginator
* $aErrors
+ * $checkall
*
* @copyright © 1999-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
-// set this to an empty string to turn off extra
-// highlighting of checked rows
-//
-//$clickedColor = '';
-$clickedColor = (empty($color[16])) ? $color[2] : $color[16];
-
-
?>
<div id="message_list">
<form id="<?php echo $form_name;?>" name="<?php echo $form_name;?>" method="post" action="<?php echo $php_self;?>">
switch ($iCol) {
case SQM_COL_CHECK:
if ($javascript_on) {
- echo '<input type="checkbox" name="toggleAll" title="'._("Toggle All").'" onclick="toggle_all(\''.$form_name."',".$fancy_index_highlite.')" />'."\n";
+ $checked = ($checkall ? ' checked="checked" ' : '');
+ echo '<input type="checkbox" name="toggleAll" title="'._("Toggle All").'" onclick="toggle_all(\''.$form_name."',".$fancy_index_highlite.')" ' . $checked . '/>'."\n";
} else {
- $link = $baseurl . "&startMessage=$pageOffset&checkall=";
- if (sqgetGlobalVar('checkall',$checkall,SQ_GET)) {
- $link .= ($checkall) ? '0' : '1';
- } else {
- $link .= '1';
- }
+ $link = $baseurl
+ . "&startMessage=$pageOffset&checkall="
+ . ($checkall ? '0' : '1');
echo "<a href=\"$link\">"._("All").'</a>';
}
break;
if ($javascript_on && $fancy_index_highlite) {
$mouseoverColor = $color[5];
$checkbox_javascript = ' onclick="this.checked = !this.checked;"';
- // $clickedColor is defined at top of this file
} else {
$checkbox_javascript = '';
}
$aColumns[SQM_COL_ATTACHMENT]['value'] = $sValue;
}
- $class = 'even';
+ $class = ($checkall && $javascript_on && $fancy_index_highlite ? 'clicked_even' : 'even');
+ $non_clicked_class = 'even';
+
/**
* If alternating row colors is set, adapt the CSS class
*/
if (isset($alt_index_colors) && $alt_index_colors) {
if (!($i % 2)) {
- $class = 'odd';
+ $class = ($checkall && $javascript_on && $fancy_index_highlite ? 'clicked_odd' : 'odd');
+ $non_clicked_class = 'odd';
}
}
// this stuff does the auto row highlighting on mouseover
//
if ($javascript_on && $fancy_index_highlite) {
- $row_extra = ' onmouseover="rowOver(\''.$form_id . '_msg' . $i.'\');" onmouseout="setPointer(this, ' . $i . ', \'out\', \'' . $class . '\', \'mouse_over\', \'clicked\');" onmousedown="setPointer(this, ' . $i . ', \'click\', \'' . $class . '\', \'mouse_over\', \'clicked\');"';
+ $row_extra = ' onmouseover="rowOver(\''.$form_id . '_msg' . $i.'\');" onmouseout="setPointer(this, ' . $i . ', \'out\', \'' . $non_clicked_class . '\', \'mouse_over\', \'clicked\');" onmousedown="setPointer(this, ' . $i . ', \'click\', \'' . $non_clicked_class . '\', \'mouse_over\', \'clicked\');"';
}
// this does the auto-checking of the checkbox no matter
// where on the row you click
* mouseover functionality. There is no harm in doing this when the mouseover
* functionality is disabled
*/
-if ($class != 'even' && $class != 'odd')
+if ($class != 'even' && $class != 'odd'
+ && $class != 'even_checked' && $class != 'odd_checked')
{
?>
<style type="text/css">
switch ($iCol) {
case SQM_COL_CHECK:
+ $checked = ($checkall ? ' checked="checked" ' : '');
if ($javascript_on) {
echo '<td class="col_check"'. $javascript_auto_click. '>' ?>
- <input type="checkbox" name="<?php echo "msg[$i]";?>" id="<?php echo $form_id."_msg$i";?>" value="<?php echo $iUid;?>" <?php echo $checkbox_javascript;?> /></td>
+ <input type="checkbox" name="<?php echo "msg[$i]";?>" id="<?php echo $form_id."_msg$i";?>" value="<?php echo $iUid;?>" <?php echo $checkbox_javascript . $checked;?> /></td>
<?php
} else {
echo '<td class="col_check">';
- $checked = ($checkall) ? ' checked=checked ' : '';
echo "<input type=\"checkbox\" name=\"msg[".$i."]\" id=\"".$form_id."_msg$i\" value=\"$iUid\" $checked/></td>";
}
break;
if ($link_extra) { $sText .= " $link_extra"; }
if ($javascript_on && $fancy_index_highlite) {
$sText .= " onmousedown=\"row_click('$form_id"."_msg$i'); setPointer(this." . (empty($bold) ? '' : 'parentNode.') .
- 'parentNode.parentNode, ' . $i . ', \'click\', \''. $class. '\', \'mouse_over\', \'' .
- $clickedColor .'\');"';
+ 'parentNode.parentNode, ' . $i . ', \'click\', \''. $non_clicked_class. '\', \'mouse_over\', \'clicked\');"';
}
$sText .= ">"
. $value . '</a>';