HTML-CalendarMonthDB
view release on metacpan or search on metacpan
CalendarMonthDB.pm view on Meta::CPAN
my $weekdaybordercolor = $self->weekdaybordercolor() || $self->bordercolor();
my $weekendbordercolor = $self->weekendbordercolor() || $self->bordercolor();
my $todaybordercolor = $self->todaybordercolor() || $self->bordercolor();
my $weekdayheadercolor = $self->weekdayheadercolor() || $self->bgcolor();
my $weekendheadercolor = $self->weekendheadercolor() || $self->bgcolor();
my $headercolor = $self->headercolor() || $self->bgcolor();
# Get today's date, in case there's a todaycolor()
my($todayyear,$todaymonth,$todaydate) = Date::Calc::Today();
# add javascript popup description code
$html .= $self->jscode();
@days = (1 .. Date::Calc::Days_in_Month($self->year(),$self->month() ) );
foreach (1 .. (Date::Calc::Day_of_Week($self->year(),$self->month(),1)%7) ) {
unshift(@days,0);
}
$weeks = int((scalar(@days)+6)/7);
$html .= "<table width=\"$tablewidth\" border=\"$border\" bgcolor=\"$bgcolor\" bordercolor=\"$bordercolor\"><tr><td colspan=2 bgcolor=\"$headercolor\">$header</td></tr>";
CalendarMonthDB.pm view on Meta::CPAN
if (!$content) {
$content = ' ';
}
$html .= "<tr><td width=\"2%\"><b>$thisday</b>";
# Add admin links if specified in function call
if ($addurl) {
my $calid = $self->calendarid();
my $mdate = $self->month().'_'.$thisday.'_'.$self->year();
$html .= "<br><font size=\"1\"><a href=\"#\" onclick=popup(\"$addurl?date=$mdate&calid=$calid&view=list\")>[Add]</a></font>";
}
if ($editurl) {
my $calid = $self->calendarid();
my $mdate = $self->month().'_'.$thisday.'_'.$self->year();
$html .= "<br><font size=\"1\"><a href=\"#\" onclick=popup(\"$editurl?date=$mdate&calid=$calid&view=list\")>[Edit]</a></font>";
}
$html .= "</td><td bgcolor=\"$thisbgcolor\" bordercolor=\"$thisbordercolor\" align=\"$cellalignment\"><font color=\"$thiscontentcolor\">$content</font></td></tr>\n";
}
}
}
$html .= '</table>';
return $html;
}
sub as_HTML {
my $self = shift;
my $self1 = {}; %$self1 = @_; # Load ourselves up from the args
my $editurl = $self1->{'editurl'} if $self1->{'editurl'};
my $addurl = $self1->{'addurl'} if $self1->{'addurl'};
my $html = '';
my(@days,$weeks,$WEEK,$DAY);
# add javascript popup description code
$html .= $self->jscode();
# To make the grid even, pad the start of the series with 0s
@days = (1 .. Date::Calc::Days_in_Month($self->year(),$self->month() ) );
foreach (1 .. (Date::Calc::Day_of_Week($self->year(),$self->month(),1)%7) ) {
unshift(@days,0);
}
$weeks = int((scalar(@days)+6)/7);
# Define some scalars for generating the table
CalendarMonthDB.pm view on Meta::CPAN
$thiscontent = ' '; }
else { # A real date cell with potential content
# Get the content
if ($self->showdatenumbers()) {
$thiscontent = "<p><b>$thisday</b>";
# Add admin links if specified in function call
if ($addurl) {
my $calid = $self->calendarid();
my $mdate = $self->month().'_'.$thisday.'_'.$self->year();
$thiscontent .= " <font size=\"1\"><a href=\"#\" onclick=popup(\"$addurl?date=$mdate&calid=$calid&view=standard\")>[Add]</a></font>";
}
if ($editurl) {
my $calid = $self->calendarid();
my $mdate = $self->month().'_'.$thisday.'_'.$self->year();
$thiscontent .= " <font size=\"1\"><a href=\"#\" onclick=popup(\"$editurl?date=$mdate&calid=$calid&view=standard\")>[Edit]</a></font>";
}
$thiscontent .= "</p>\n";
}
# Content for this specific date
$thiscontent .= $self->getcontent($thisday);
# Content for "2nd Wednesday", etc.
$thiscontent .= $self->getcontent(int(1+($thisday/7.1)).('sunday','monday','tuesday','wednesday','thursday','friday','saturday')[$DAY]);
# Content for "Wednesdays", etc.
$thiscontent .= $self->getcontent(('sundays','mondays','tuesdays','wednesdays','thursdays','fridays','saturdays')[$DAY]);
# Normalize if there's no content
CalendarMonthDB.pm view on Meta::CPAN
}
$html .= "</TABLE>\n";
return $html;
}
sub jscode {
my $self = shift;
my $jscode = '<div id="object1" style="position:absolute; visibility:show; left:350px; top:-50px; z-index:2">layer hidden off the screen</div><SCRIPT LANGUAGE="JavaScript">
<!-- Begin
window.onLoad=setupDescriptions();
function popup(url) {
window.open(url, "popup", "height=480,width=580,menubar=no,scrollbars=yes,status=no,toolbar=no,screenX=100,screenY=0,left=100,top=100");
}
function setupDescriptions() {
var x = navigator.appVersion;
y = x.substring(0,4);
if (y>=4) setVariables();
}
var x,y,a,b;
function setVariables(){
if (navigator.appName == "Netscape") {
h=".left=";
( run in 2.913 seconds using v1.01-cache-2.11-cpan-364913b4093 )