X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=templates%2Fdefault%2Fjs%2Fdefault.js;h=9dda30bb4f8dff7fed40a68345fadfac6be595d8;hb=1977ab5587905d225c6288141b82f7a6e3d29d02;hp=16077e9a2ee5e7664aac767603ec98cba356bb5e;hpb=6418400a1451ced5378038264a37772142f44c51;p=squirrelmail.git diff --git a/templates/default/js/default.js b/templates/default/js/default.js index 16077e9a..9dda30bb 100644 --- a/templates/default/js/default.js +++ b/templates/default/js/default.js @@ -1,7 +1,7 @@ /** * This array is used to remember mark status of rows in browse mode * - * @copyright © 2005-2006 The SquirrelMail Project Team + * @copyright 2005-2010 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ */ @@ -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); } } @@ -93,14 +104,15 @@ function rowOver(chkboxName) { * when it gets clicked. * * @param string the id of the form where all checkboxes should be (un)checked + * @param string the first three characters of target checkboxes, if any * @param boolean use fancy row coloring when a checkbox is checked * @param string new color of the checked rows */ -function toggle_all(formname, fancy) { +function toggle_all(formname, name_prefix, fancy) { var TargetForm = document.getElementById(formname); var j = 0; for (var i = 0; i < TargetForm.elements.length; i++) { - if (TargetForm.elements[i].type == 'checkbox' && TargetForm.elements[i].name.substring(0,3) == 'msg') { + if (TargetForm.elements[i].type == 'checkbox' && (name_prefix == '' || TargetForm.elements[i].name.substring(0,3) == name_prefix)) { if (fancy) { array_key = TargetForm.elements[i].getAttribute('id'); // initialize orig_row_color if not defined already @@ -259,7 +271,7 @@ function checkForm(smaction) { var e = document.forms[i].elements.length; var j = 0; while( pos == -1 && j < e ) { - if ( document.forms[i].elements[j].type == 'text' || document.forms[i].elements[j].type == 'password' ) { + if ( document.forms[i].elements[j].type == 'text' || document.forms[i].elements[j].type == 'password' || document.forms[i].elements[j].type == 'textarea' ) { pos = j; } j++; @@ -271,3 +283,23 @@ function checkForm(smaction) { } } } + +function printThis() +{ + parent.frames['right'].focus(); + parent.frames['right'].print(); +} + +/* JS implementation of more/less links in To/CC. Could later be extended + * show/hide other interface items */ +function showhide (item, txtmore, txtless) { + var oTemp=document.getElementById("recpt_tail_" + item); + var oClick=document.getElementById("toggle_" + item); + if (oTemp.style.display=="inline") { + oTemp.style.display="none"; + oClick.innerHTML=txtmore; + } else { + oTemp.style.display="inline"; + oClick.innerHTML=txtless; + } +}