sub theme_icons_table
{
local ($i, $need_tr);
local $cols = $_[3] ? $_[3] : 4;
local $per = int(100.0 / $cols);
print "
\n";
for($i=0; $i<@{$_[0]}; $i++) {
if ($i%$cols == 0) { print "\n"; }
print "\n";
&generate_icon($_[2]->[$i], $_[1]->[$i], $_[0]->[$i],
$_[4], $_[5], $_[6], $_[7]->[$i], $_[8]->[$i]);
print " \n";
if ($i%$cols == $cols-1) { print " \n"; }
}
while($i++%$cols) { print " \n"; $need_tr++; }
print "\n" if ($need_tr);
print "
\n";
}
sub theme_generate_icon
{
local $w = !defined($_[4]) ? "width=48" : $_[4] ? "width=$_[4]" : "";
local $h = !defined($_[5]) ? "height=48" : $_[5] ? "height=$_[5]" : "";
if ($tconfig{'noicons'}) {
if ($_[2]) {
print "$_[6]$_[1] $_[7]\n";
}
else {
print "$_[6]$_[1]$_[7]\n";
}
}
elsif ($_[2]) {
print "\n",
"
\n";
print "$_[6]$_[1] $_[7]\n";
}
else {
print "\n",
" ",
"
\n$_[6]$_[1]$_[7]\n";
}
}
sub theme_post_save_domain
{
print "\n";
}
sub theme_prebody
{
if ($script_name =~ /session_login.cgi/) {
# Generate CSS link
print " \n";
}
}
sub theme_postbody
{
# If we just came from a folder editing page, refresh the folder list
if ($module_name eq "mailbox" && $ENV{'HTTP_REFERER'} =~ /(edit|save)_(folder|comp|imap|pop3|virt)\.cgi|mail_search\.cgi|delete_folders\.cgi/) {
print "refreshing!\n";
print "\n";
}
}
sub theme_prehead
{
print " \n";
print "\n";
}
# theme_ui_columns_start(&headings, [width-percent], [noborder], [&tdtags], [heading])
# Returns HTML for a multi-column table, with the given headings
sub theme_ui_columns_start
{
local ($heads, $width, $noborder, $tdtags, $heading) = @_;
local ($href) = grep { $_ =~ /\n";
if ($heading) {
$rv .= " $heading \n";
}
$rv .= " \n";
local $i;
for($i=0; $i<@$heads; $i++) {
$rv .= "[$i].">".
($heads->[$i] eq "" ? " " : $heads->[$i])." \n";
}
$rv .= " \n";
$theme_ui_columns_count++;
return $rv;
}
# theme_ui_columns_row(&columns, &tdtags)
# Returns HTML for a row in a multi-column table
sub theme_ui_columns_row
{
$theme_ui_columns_row_toggle = $theme_ui_columns_row_toggle ? '0' : '1';
local ($cols, $tdtags) = @_;
local $rv;
$rv .= "\n";
local $i;
for($i=0; $i<@$cols; $i++) {
$rv .= "[$i].">".
($cols->[$i] !~ /\S/ ? " " : $cols->[$i])." \n";
}
$rv .= " \n";
return $rv;
}
# theme_ui_columns_end()
# Returns HTML to end a table started by ui_columns_start
sub theme_ui_columns_end
{
return " \n";
}
# theme_select_all_link(field, form, text)
# Adds support for row highlighting to the normal select all
sub theme_select_all_link
{
local ($field, $form, $text) = @_;
$form = int($form);
$text ||= $text{'ui_selall'};
return " $text ";
}
# theme_select_invert_link(field, form, text)
# Adds support for row highlighting to the normal invert selection
sub theme_select_invert_link
{
local ($field, $form, $text) = @_;
$form = int($form);
$text ||= $text{'ui_selinv'};
return "$text ";
}
# theme_select_status_link(name, form, &folder, &mails, start, end, status, label)
# Adds support for row highlighting to read mail module selector
sub theme_select_status_link
{
local ($name, $formno, $folder, $mail, $start, $end, $status, $label) = @_;
$formno = int($formno);
local @sel;
for(my $i=$start; $i<=$end; $i++) {
local $m = $mail->[$i];
push(@sel, &get_mail_read($folder, $m) == $status ? 1 : 0);
}
local $js = "var sel = [ ".join(",", @sel)." ]; ";
$js .= "var f = document.forms[$formno]; ";
$js .= "for(var i=0; i$label";
}
sub theme_ui_checked_columns_row
{
$theme_ui_columns_row_toggle = $theme_ui_columns_row_toggle ? '0' : '1';
local ($cols, $tdtags, $checkname, $checkvalue, $checked) = @_;
local $rv;
local $cbid = "e_escape(quotemeta("${checkname}_${checkvalue}"));
local $rid = "e_escape(quotemeta("row_${checkname}_${checkvalue}"));
local $ridtr = "e_escape("row_${checkname}_${checkvalue}");
local $mycb = $cb;
if ($checked) {
$mycb =~ s/mainbody/mainsel/g;
}
$mycb =~ s/class='/class='row$theme_ui_columns_row_toggle /;
$rv .= "\n";
$rv .= "[0].">".
&ui_checkbox($checkname, $checkvalue, undef, $checked, "onClick=\"document.getElementById('$rid').className = this.checked ? 'mainhighsel' : 'mainhigh';\"").
" \n";
local $i;
for($i=0; $i<@$cols; $i++) {
$rv .= "[$i+1].">";
if ($cols->[$i] !~ /";
}
$rv .= ($cols->[$i] !~ /\S/ ? " " : $cols->[$i]);
if ($cols->[$i] !~ / \n";
$rv .= " [0].">".
&ui_oneradio($checkname, $checkvalue, undef, $checked, "onClick=\"for(i=0; i\n";
local $i;
for($i=0; $i<@$cols; $i++) {
$rv .= "[$i+1].">";
if ($cols->[$i] !~ /";
}
$rv .= ($cols->[$i] !~ /\S/ ? " " : $cols->[$i]);
if ($cols->[$i] !~ / $heading \n" if (defined($heading));
$rv .= "