devinci99
04-09-2004, 08:20 PM
NOTE: please make a backup copy of any files notes to modify on this topic before you modify!
I wanted to be able to use <!--MAILBOX_USAGE--> in the footer template. I thought it would just work, but it didnt, so it appeared I had to do some minor hacking.
File to modify, messenger.cgi.
Look for this function in the code:
### Process Footer
sub Footer {
my($is_sched);
my @my_date = Get_Date(time,1);
if(Is_Sched($user,($my_date[4] + 1),($my_date[5] + 1900),$my_date[3]) ne"") {
$is_sched = $settings{'reminder'};
$is_sched =~ s/<!--ICON_PATH-->/$settings{'icon_path'}/gm;
}
@footer = Get_Template("$settings{\"basepath\"}/templates","footer.htm");
foreach $item (@footer) {
$item =~ s/<!--URL-->/$url/gm;
$item =~ s/<!--USER-->/$user/gm;
$item =~ s/<!--IS_SCHED-->/$is_sched/gm;
$item =~ s/<!--ICON_PATH-->/$settings{"icon_path"}/gm;
$item =~ s/<!--FOLDER_LIST_LINKS-->/$folder_list_links/gm;
$item =~ s/<!--ADMIN_LINK-->/$settings{'admin_link'}/gm unless (lc($user) ne lc($settings{'admin'}));
}
print @footer;
#$end_time = [ gettimeofday ];
#$elapsed = tv_interval($start_time,$end_time);
#print "<P><CENTER>Execution took $elapsed secs."
}
replace with this:
### Process Footer
sub Footer {
my @mailbox_usage = Get_Mail_Usage($user);
my($is_sched);
my @my_date = Get_Date(time,1);
if(Is_Sched($user,($my_date[4] + 1),($my_date[5] + 1900),$my_date[3]) ne"") {
$is_sched = $settings{'reminder'};
$is_sched =~ s/<!--ICON_PATH-->/$settings{'icon_path'}/gm;
}
@footer = Get_Template("$settings{\"basepath\"}/templates","footer.htm");
foreach $item (@footer) {
$item =~ s/<!--MAILBOX_USAGE-->/@mailbox_usage/gm;
$item =~ s/<!--URL-->/$url/gm;
$item =~ s/<!--USER-->/$user/gm;
$item =~ s/<!--IS_SCHED-->/$is_sched/gm;
$item =~ s/<!--ICON_PATH-->/$settings{"icon_path"}/gm;
$item =~ s/<!--FOLDER_LIST_LINKS-->/$folder_list_links/gm;
$item =~ s/<!--ADMIN_LINK-->/$settings{'admin_link'}/gm unless (lc($user) ne lc($settings{'admin'}));
}
print @footer;
#$end_time = [ gettimeofday ];
#$elapsed = tv_interval($start_time,$end_time);
#print "<P><CENTER>Execution took $elapsed secs."
}
Now you can use the <!--MAILBOX_USAGE--> in your footer.htm template. If you need to change the look and feel of the <!--MAILBOX_USAGE--> display, you'll need to edit the mailbox_usage.htm template.
I wanted to be able to use <!--MAILBOX_USAGE--> in the footer template. I thought it would just work, but it didnt, so it appeared I had to do some minor hacking.
File to modify, messenger.cgi.
Look for this function in the code:
### Process Footer
sub Footer {
my($is_sched);
my @my_date = Get_Date(time,1);
if(Is_Sched($user,($my_date[4] + 1),($my_date[5] + 1900),$my_date[3]) ne"") {
$is_sched = $settings{'reminder'};
$is_sched =~ s/<!--ICON_PATH-->/$settings{'icon_path'}/gm;
}
@footer = Get_Template("$settings{\"basepath\"}/templates","footer.htm");
foreach $item (@footer) {
$item =~ s/<!--URL-->/$url/gm;
$item =~ s/<!--USER-->/$user/gm;
$item =~ s/<!--IS_SCHED-->/$is_sched/gm;
$item =~ s/<!--ICON_PATH-->/$settings{"icon_path"}/gm;
$item =~ s/<!--FOLDER_LIST_LINKS-->/$folder_list_links/gm;
$item =~ s/<!--ADMIN_LINK-->/$settings{'admin_link'}/gm unless (lc($user) ne lc($settings{'admin'}));
}
print @footer;
#$end_time = [ gettimeofday ];
#$elapsed = tv_interval($start_time,$end_time);
#print "<P><CENTER>Execution took $elapsed secs."
}
replace with this:
### Process Footer
sub Footer {
my @mailbox_usage = Get_Mail_Usage($user);
my($is_sched);
my @my_date = Get_Date(time,1);
if(Is_Sched($user,($my_date[4] + 1),($my_date[5] + 1900),$my_date[3]) ne"") {
$is_sched = $settings{'reminder'};
$is_sched =~ s/<!--ICON_PATH-->/$settings{'icon_path'}/gm;
}
@footer = Get_Template("$settings{\"basepath\"}/templates","footer.htm");
foreach $item (@footer) {
$item =~ s/<!--MAILBOX_USAGE-->/@mailbox_usage/gm;
$item =~ s/<!--URL-->/$url/gm;
$item =~ s/<!--USER-->/$user/gm;
$item =~ s/<!--IS_SCHED-->/$is_sched/gm;
$item =~ s/<!--ICON_PATH-->/$settings{"icon_path"}/gm;
$item =~ s/<!--FOLDER_LIST_LINKS-->/$folder_list_links/gm;
$item =~ s/<!--ADMIN_LINK-->/$settings{'admin_link'}/gm unless (lc($user) ne lc($settings{'admin'}));
}
print @footer;
#$end_time = [ gettimeofday ];
#$elapsed = tv_interval($start_time,$end_time);
#print "<P><CENTER>Execution took $elapsed secs."
}
Now you can use the <!--MAILBOX_USAGE--> in your footer.htm template. If you need to change the look and feel of the <!--MAILBOX_USAGE--> display, you'll need to edit the mailbox_usage.htm template.