lots of small bug fixes
This commit is contained in:
parent
d361711600
commit
03adaddb81
3 changed files with 859 additions and 846 deletions
|
|
@ -1,247 +1,247 @@
|
|||
package WebGUI::Asset::Event;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2005 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Grouping;
|
||||
use WebGUI::HTML;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::HTTP;
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::Id;
|
||||
use WebGUI::International;
|
||||
use WebGUI::MessageLog;
|
||||
use WebGUI::Operation;
|
||||
use WebGUI::Paginator;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Style;
|
||||
use WebGUI::Asset::Template;
|
||||
use WebGUI::URL;
|
||||
use WebGUI::User;
|
||||
use WebGUI::Utility;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Asset::Wobject::EventsCalendar;
|
||||
|
||||
our @ISA = qw(WebGUI::Asset);
|
||||
package WebGUI::Asset::Event;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2005 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Grouping;
|
||||
use WebGUI::HTML;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::HTTP;
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::Id;
|
||||
use WebGUI::International;
|
||||
use WebGUI::MessageLog;
|
||||
use WebGUI::Operation;
|
||||
use WebGUI::Paginator;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Style;
|
||||
use WebGUI::Asset::Template;
|
||||
use WebGUI::URL;
|
||||
use WebGUI::User;
|
||||
use WebGUI::Utility;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Asset::Wobject::EventsCalendar;
|
||||
|
||||
our @ISA = qw(WebGUI::Asset);
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $definition = shift;
|
||||
push(@{$definition}, {
|
||||
tableName=>'EventsCalendar_Event',
|
||||
className=>'WebGUI::Asset::Event',
|
||||
properties=>{
|
||||
description => {
|
||||
fieldType=>"HTMLArea",
|
||||
defaultValue=>undef
|
||||
},
|
||||
eventStartDate => {
|
||||
fieldType=>"dateTime",
|
||||
defaultValue=>time()
|
||||
},
|
||||
eventEndDate => {
|
||||
fieldType=>"dateTime",
|
||||
defaultValue=>time()
|
||||
},
|
||||
EventsCalendar_recurringId => {
|
||||
fieldType=>"hidden",
|
||||
defaultValue=>undef
|
||||
},
|
||||
eventLocation => {
|
||||
fieldType=>"text",
|
||||
defaultValue=>undef
|
||||
},
|
||||
# allowRegistration => {
|
||||
# fieldType=>"yesNo",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# allowUnregistration => {
|
||||
# fieldType=>"yesNo",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# regConfirm => {
|
||||
# fieldType=>"yesNo",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# regNotify => {
|
||||
# fieldType=>"yesNo",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# regStartDate => {
|
||||
# fieldType=>"dateTime",
|
||||
# defaultValue=>time()
|
||||
# },
|
||||
# regEndDate => {
|
||||
# fieldType=>"dateTime",
|
||||
# defaultValue=>time()
|
||||
# },
|
||||
# allowReminders => {
|
||||
# fieldType=>"yesNo",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# reminderStartDate => {
|
||||
# fieldType=>"dateTime",
|
||||
# defaultValue=>time()
|
||||
# },
|
||||
# reminderEndDate => {
|
||||
# fieldType=>"dateTime",
|
||||
# defaultValue=>time()
|
||||
# },
|
||||
# reminderRecurs => {
|
||||
# fieldType=>"interval",
|
||||
# defaultValue=>604800
|
||||
# },
|
||||
# chargeForEvent => {
|
||||
# fieldType=>"yesNo",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# firstAttendeeFee => {
|
||||
# fieldType=>"float",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# secondAttendeeFee => {
|
||||
# fieldType=>"float",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# availableSeats => {
|
||||
# fieldType=>"integer",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
templateId => {
|
||||
fieldType=>"template",
|
||||
defaultValue=>'PBtmpl0000000000000023'
|
||||
},
|
||||
# regConfirmTemplateId => {
|
||||
# fieldType=>"template",
|
||||
# defaultValue=>'MWtmplregConfirm000001'
|
||||
# },
|
||||
# regNotifyTemplateId => {
|
||||
# fieldType=>"template",
|
||||
# defaultValue=>'MWtmplregNotify0000001'
|
||||
# },
|
||||
# reminderTemplateId => {
|
||||
# fieldType=>"template",
|
||||
# defaultValue=>'MWtmplreminder00000001'
|
||||
# },
|
||||
# groupCanRegister => {
|
||||
# fieldType=>"group",
|
||||
# defaultValue=>'2'
|
||||
# },
|
||||
# groupCanReminder => {
|
||||
# fieldType=>"group",
|
||||
# defaultValue=>'2'
|
||||
# },
|
||||
# groupRegNotify => {
|
||||
# fieldType=>"group",
|
||||
#-------------------------------------------------------------------
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $definition = shift;
|
||||
push(@{$definition}, {
|
||||
tableName=>'EventsCalendar_Event',
|
||||
className=>'WebGUI::Asset::Event',
|
||||
properties=>{
|
||||
description => {
|
||||
fieldType=>"HTMLArea",
|
||||
defaultValue=>undef
|
||||
},
|
||||
eventStartDate => {
|
||||
fieldType=>"dateTime",
|
||||
defaultValue=>time()
|
||||
},
|
||||
eventEndDate => {
|
||||
fieldType=>"dateTime",
|
||||
defaultValue=>time()
|
||||
},
|
||||
EventsCalendar_recurringId => {
|
||||
fieldType=>"hidden",
|
||||
defaultValue=>undef
|
||||
},
|
||||
eventLocation => {
|
||||
fieldType=>"text",
|
||||
defaultValue=>undef
|
||||
},
|
||||
# allowRegistration => {
|
||||
# fieldType=>"yesNo",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# allowUnregistration => {
|
||||
# fieldType=>"yesNo",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# regConfirm => {
|
||||
# fieldType=>"yesNo",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# regNotify => {
|
||||
# fieldType=>"yesNo",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# regStartDate => {
|
||||
# fieldType=>"dateTime",
|
||||
# defaultValue=>time()
|
||||
# },
|
||||
# regEndDate => {
|
||||
# fieldType=>"dateTime",
|
||||
# defaultValue=>time()
|
||||
# },
|
||||
# allowReminders => {
|
||||
# fieldType=>"yesNo",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# reminderStartDate => {
|
||||
# fieldType=>"dateTime",
|
||||
# defaultValue=>time()
|
||||
# },
|
||||
# reminderEndDate => {
|
||||
# fieldType=>"dateTime",
|
||||
# defaultValue=>time()
|
||||
# },
|
||||
# reminderRecurs => {
|
||||
# fieldType=>"interval",
|
||||
# defaultValue=>604800
|
||||
# },
|
||||
# chargeForEvent => {
|
||||
# fieldType=>"yesNo",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# firstAttendeeFee => {
|
||||
# fieldType=>"float",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# secondAttendeeFee => {
|
||||
# fieldType=>"float",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
# availableSeats => {
|
||||
# fieldType=>"integer",
|
||||
# defaultValue=>0
|
||||
# },
|
||||
templateId => {
|
||||
fieldType=>"template",
|
||||
defaultValue=>'PBtmpl0000000000000023'
|
||||
},
|
||||
# regConfirmTemplateId => {
|
||||
# fieldType=>"template",
|
||||
# defaultValue=>'MWtmplregConfirm000001'
|
||||
# },
|
||||
# regNotifyTemplateId => {
|
||||
# fieldType=>"template",
|
||||
# defaultValue=>'MWtmplregNotify0000001'
|
||||
# },
|
||||
# reminderTemplateId => {
|
||||
# fieldType=>"template",
|
||||
# defaultValue=>'MWtmplreminder00000001'
|
||||
# },
|
||||
# groupCanRegister => {
|
||||
# fieldType=>"group",
|
||||
# defaultValue=>'2'
|
||||
# },
|
||||
# groupCanReminder => {
|
||||
# fieldType=>"group",
|
||||
# defaultValue=>'2'
|
||||
# },
|
||||
# groupRegNotify => {
|
||||
# fieldType=>"group",
|
||||
# defaultValue=>'3'
|
||||
# }
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getEditForm {
|
||||
my $self = shift;
|
||||
|
||||
my $tabform = $self->SUPER::getEditForm();
|
||||
#return $tabform;
|
||||
$tabform->getTab("properties")->HTMLArea(
|
||||
-name=>"description", -label=>WebGUI::International::get(512,"EventsCalendar"),
|
||||
-value=>$self->getValue("description")
|
||||
);
|
||||
$tabform->getTab("properties")->dateTime(
|
||||
-name=>"eventStartDate", -label=>WebGUI::International::get(513,"EventsCalendar"),
|
||||
-extras=>'onBlur="this.form.eventEndDate.value=this.form.eventStartDate.value;this.form.until.value=this.form.eventStartDate.value;"',
|
||||
-value=>$self->getValue("eventStartDate")
|
||||
);
|
||||
$tabform->getTab("properties")->dateTime(
|
||||
-name=>"eventEndDate", -label=>WebGUI::International::get(514,"EventsCalendar"),
|
||||
-extras=>'onBlur="this.form.until.value=this.form.eventEndDate.value;"',
|
||||
-value=>$self->getValue("eventEndDate")
|
||||
);
|
||||
$tabform->getTab("properties")->text(
|
||||
-name=>"eventLocation", -label=>WebGUI::International::get(515,"EventsCalendar"),
|
||||
-value=>$self->getValue("eventLocation")
|
||||
);
|
||||
# $tabform->getTab("properties")->yesNo(
|
||||
# -name=>"allowRegistration", -label=>WebGUI::International::get(516,"EventsCalendar"),
|
||||
# -value=>$self->getValue("allowRegistration")
|
||||
# );
|
||||
# $tabform->getTab("properties")->yesNo(
|
||||
# -name=>"allowUnregistration", -label=>WebGUI::International::get(517,"EventsCalendar"),
|
||||
# -value=>$self->getValue("allowUnregistration")
|
||||
# );
|
||||
# $tabform->getTab("properties")->yesNo(
|
||||
# -name=>"regConfirm", -label=>WebGUI::International::get(518,"EventsCalendar"),
|
||||
# -value=>$self->getValue("regConfirm")
|
||||
# );
|
||||
# $tabform->getTab("properties")->yesNo(
|
||||
# -name=>"regNotify", -label=>WebGUI::International::get(519,"EventsCalendar"),
|
||||
# -value=>$self->getValue("regNotify")
|
||||
# );
|
||||
# $tabform->getTab("properties")->dateTime(
|
||||
# -name=>"regStartDate", -label=>WebGUI::International::get(520,"EventsCalendar"),
|
||||
# -extras=>'onBlur="this.form.regEndDate.value=this.form.regStartDate.value;this.form.until.value=this.form.regStartDate.value;"',
|
||||
# -value=>$self->getValue("regStartDate")
|
||||
# );
|
||||
# $tabform->getTab("properties")->dateTime(
|
||||
# -name=>"regEndDate", -label=>WebGUI::International::get(521,"EventsCalendar"),
|
||||
# -extras=>'onBlur="this.form.until.value=this.form.regEndDate.value;"',
|
||||
# -value=>$self->getValue("regEndDate")
|
||||
# );
|
||||
# $tabform->getTab("properties")->yesNo(
|
||||
# -name=>"allowReminders", -label=>WebGUI::International::get(522,"EventsCalendar"),
|
||||
# -value=>$self->getValue("allowReminders")
|
||||
# );
|
||||
# $tabform->getTab("properties")->dateTime(
|
||||
# -name=>"reminderStartDate", -label=>WebGUI::International::get(523,"EventsCalendar"),
|
||||
# -extras=>'onBlur="this.form.reminderEndDate.value=this.form.reminderStartDate.value;this.form.until.value=this.form.reminderStartDate.value;"',
|
||||
# -value=>$self->getValue("reminderStartDate")
|
||||
# );
|
||||
# $tabform->getTab("properties")->dateTime(
|
||||
# -name=>"reminderEndDate", -label=>WebGUI::International::get(524,"EventsCalendar"),
|
||||
# -extras=>'onBlur="this.form.until.value=this.form.reminderEndDate.value;"',
|
||||
# -value=>$self->getValue("regEndDate")
|
||||
# );
|
||||
# $tabform->getTab("properties")->interval(
|
||||
# -name=>"reminderRecurs",
|
||||
# -label=>WebGUI::International::get(524.5,"EventsCalendar"),
|
||||
# -value=>$self->getValue("reminderRecurs")
|
||||
# );
|
||||
# }
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getEditForm {
|
||||
my $self = shift;
|
||||
|
||||
my $tabform = $self->SUPER::getEditForm();
|
||||
#return $tabform;
|
||||
$tabform->getTab("properties")->HTMLArea(
|
||||
-name=>"description", -label=>WebGUI::International::get(512,"EventsCalendar"),
|
||||
-value=>$self->getValue("description")
|
||||
);
|
||||
$tabform->getTab("properties")->dateTime(
|
||||
-name=>"eventStartDate", -label=>WebGUI::International::get(513,"EventsCalendar"),
|
||||
-extras=>'onBlur="this.form.eventEndDate.value=this.form.eventStartDate.value;this.form.until.value=this.form.eventStartDate.value;"',
|
||||
-value=>$self->getValue("eventStartDate")
|
||||
);
|
||||
$tabform->getTab("properties")->dateTime(
|
||||
-name=>"eventEndDate", -label=>WebGUI::International::get(514,"EventsCalendar"),
|
||||
-extras=>'onBlur="this.form.until.value=this.form.eventEndDate.value;"',
|
||||
-value=>$self->getValue("eventEndDate")
|
||||
);
|
||||
$tabform->getTab("properties")->text(
|
||||
-name=>"eventLocation", -label=>WebGUI::International::get(515,"EventsCalendar"),
|
||||
-value=>$self->getValue("eventLocation")
|
||||
);
|
||||
# $tabform->getTab("properties")->yesNo(
|
||||
# -name=>"allowRegistration", -label=>WebGUI::International::get(516,"EventsCalendar"),
|
||||
# -value=>$self->getValue("allowRegistration")
|
||||
# );
|
||||
# $tabform->getTab("properties")->yesNo(
|
||||
# -name=>"allowUnregistration", -label=>WebGUI::International::get(517,"EventsCalendar"),
|
||||
# -value=>$self->getValue("allowUnregistration")
|
||||
# );
|
||||
# $tabform->getTab("properties")->yesNo(
|
||||
# -name=>"regConfirm", -label=>WebGUI::International::get(518,"EventsCalendar"),
|
||||
# -value=>$self->getValue("regConfirm")
|
||||
# );
|
||||
# $tabform->getTab("properties")->yesNo(
|
||||
# -name=>"regNotify", -label=>WebGUI::International::get(519,"EventsCalendar"),
|
||||
# -value=>$self->getValue("regNotify")
|
||||
# );
|
||||
# $tabform->getTab("properties")->dateTime(
|
||||
# -name=>"regStartDate", -label=>WebGUI::International::get(520,"EventsCalendar"),
|
||||
# -extras=>'onBlur="this.form.regEndDate.value=this.form.regStartDate.value;this.form.until.value=this.form.regStartDate.value;"',
|
||||
# -value=>$self->getValue("regStartDate")
|
||||
# );
|
||||
# $tabform->getTab("properties")->dateTime(
|
||||
# -name=>"regEndDate", -label=>WebGUI::International::get(521,"EventsCalendar"),
|
||||
# -extras=>'onBlur="this.form.until.value=this.form.regEndDate.value;"',
|
||||
# -value=>$self->getValue("regEndDate")
|
||||
# );
|
||||
# $tabform->getTab("properties")->yesNo(
|
||||
# -name=>"allowReminders", -label=>WebGUI::International::get(522,"EventsCalendar"),
|
||||
# -value=>$self->getValue("allowReminders")
|
||||
# );
|
||||
# $tabform->getTab("properties")->dateTime(
|
||||
# -name=>"reminderStartDate", -label=>WebGUI::International::get(523,"EventsCalendar"),
|
||||
# -extras=>'onBlur="this.form.reminderEndDate.value=this.form.reminderStartDate.value;this.form.until.value=this.form.reminderStartDate.value;"',
|
||||
# -value=>$self->getValue("reminderStartDate")
|
||||
# );
|
||||
# $tabform->getTab("properties")->dateTime(
|
||||
# -name=>"reminderEndDate", -label=>WebGUI::International::get(524,"EventsCalendar"),
|
||||
# -extras=>'onBlur="this.form.until.value=this.form.reminderEndDate.value;"',
|
||||
# -value=>$self->getValue("regEndDate")
|
||||
# );
|
||||
# $tabform->getTab("properties")->interval(
|
||||
# -name=>"reminderRecurs",
|
||||
# -label=>WebGUI::International::get(524.5,"EventsCalendar"),
|
||||
# -value=>$self->getValue("reminderRecurs")
|
||||
# );
|
||||
# Not quite implemented yet...
|
||||
# $tabform->getTab("properties")->yesNo(
|
||||
# -name=>"chargeForEvent", -label=>WebGUI::International::get(525,"EventsCalendar"),
|
||||
# -value=>$self->getValue("chargeForEvent")
|
||||
# );
|
||||
# $tabform->getTab("properties")->float(
|
||||
# -name=>"firstAttendeeFee", -label=>WebGUI::International::get(526,"EventsCalendar"),
|
||||
# -value=>$self->getValue("firstAttendeeFee")
|
||||
# );
|
||||
# $tabform->getTab("properties")->float(
|
||||
# -name=>"secondAttendeeFee", -label=>WebGUI::International::get(527,"EventsCalendar"),
|
||||
# -value=>$self->getValue("secondAttendeeFee")
|
||||
# );
|
||||
# $tabform->getTab("properties")->integer(
|
||||
# -name=>"availableSeats", -label=>WebGUI::International::get(528,"EventsCalendar"),
|
||||
# -value=>$self->getValue("availableSeats")
|
||||
# $tabform->getTab("properties")->yesNo(
|
||||
# -name=>"chargeForEvent", -label=>WebGUI::International::get(525,"EventsCalendar"),
|
||||
# -value=>$self->getValue("chargeForEvent")
|
||||
# );
|
||||
# $tabform->getTab("properties")->float(
|
||||
# -name=>"firstAttendeeFee", -label=>WebGUI::International::get(526,"EventsCalendar"),
|
||||
# -value=>$self->getValue("firstAttendeeFee")
|
||||
# );
|
||||
# $tabform->getTab("properties")->float(
|
||||
# -name=>"secondAttendeeFee", -label=>WebGUI::International::get(527,"EventsCalendar"),
|
||||
# -value=>$self->getValue("secondAttendeeFee")
|
||||
# );
|
||||
# $tabform->getTab("properties")->integer(
|
||||
# -name=>"availableSeats", -label=>WebGUI::International::get(528,"EventsCalendar"),
|
||||
# -value=>$self->getValue("availableSeats")
|
||||
# );
|
||||
if (($session{form}{func} eq "addStyledEvent") || ($session{form}{func} eq "addEvent")) {
|
||||
my %recursEvery;
|
||||
|
|
@ -261,98 +261,98 @@ sub getEditForm {
|
|||
$tabform->getTab("properties")->raw('<tr><td class="formdescription" valign="top">'.WebGUI::International::get(9,"EventsCalendar").'</td><td class="tableData">');
|
||||
$tabform->getTab("properties")->date("until");
|
||||
$tabform->getTab("properties")->raw("</td><tr>");
|
||||
}
|
||||
# $tabform->getTab("display")->template(
|
||||
# -name=>"confirmationTemplateId",
|
||||
# -value=>$self->getValue("confirmationTemplateId"),
|
||||
# -namespace=>"EventsCalendar/Event",
|
||||
# -label=>WebGUI::International::get(529,"EventsCalendar"),
|
||||
# -afterEdit=>'func=edit'
|
||||
# );
|
||||
$tabform->getTab("display")->template(
|
||||
-name=>"templateId",
|
||||
-value=>$self->getValue("templateId"),
|
||||
-namespace=>"EventsCalendar/Event",
|
||||
-label=>WebGUI::International::get(530,"EventsCalendar"),
|
||||
-afterEdit=>'func=edit&wid='.$self->get("wobjectId")
|
||||
);
|
||||
# $tabform->getTab("display")->template(
|
||||
# -name=>"regNotifyTemplateId",
|
||||
# -value=>$self->getValue("regNotifyTemplateId"),
|
||||
# -namespace=>"EventsCalendar/Event",
|
||||
# -label=>WebGUI::International::get(531,"EventsCalendar"),
|
||||
# -afterEdit=>'func=edit&wid='.$self->get("wobjectId")
|
||||
# );
|
||||
# $tabform->getTab("display")->template(
|
||||
# -name=>"reminderTemplateId",
|
||||
# -value=>$self->getValue("reminderTemplateId"),
|
||||
# -namespace=>"EventsCalendar/Event",
|
||||
# -label=>WebGUI::International::get(532,"EventsCalendar"),
|
||||
# -afterEdit=>'func=edit&wid='.$self->get("wobjectId")
|
||||
# );
|
||||
# $tabform->getTab("security")->group(
|
||||
# -name=>"groupCanRegister", -label=>WebGUI::International::get(533,"EventsCalendar"),
|
||||
# -value=>[$self->getValue("groupCanRegister")]
|
||||
# );
|
||||
# $tabform->getTab("security")->group(
|
||||
# -name=>"groupCanReminder", -label=>WebGUI::International::get(534,"EventsCalendar"),
|
||||
# -value=>[$self->getValue("groupCanReminder")]
|
||||
# );
|
||||
# $tabform->getTab("security")->group(
|
||||
# -name=>"groupNotify", -label=>WebGUI::International::get(535,"EventsCalendar"),
|
||||
# -value=>[$self->getValue("regNotifyGroupId")]
|
||||
# );
|
||||
return $tabform;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getIcon {
|
||||
my $self = shift;
|
||||
my $small = shift;
|
||||
return $session{config}{extrasURL}.'/assets/small/calendar.gif' if ($small);
|
||||
return $session{config}{extrasURL}.'/assets/calendar.gif';
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getName {
|
||||
return WebGUI::International::get(511,"EventsCalendar");
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub view {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::noAccess() unless $self->canView;
|
||||
$self->logView() if ($session{setting}{passiveProfilingEnabled});
|
||||
my ($output, $event, %var, $id);
|
||||
$event = $self;
|
||||
$var{title} = $event->getValue("title");
|
||||
$var{"start.label"} = WebGUI::International::get(14,"EventsCalendar");
|
||||
$var{"start.date"} = epochToHuman($self->getValue("eventStartDate"),"%z");
|
||||
$var{"start.time"} = epochToHuman($self->getValue("eventStartDate"),"%Z");
|
||||
$var{"end.label"} = WebGUI::International::get(15,"EventsCalendar");
|
||||
$var{"end.date"} = epochToHuman($self->getValue("eventEndDate"),"%z");
|
||||
$var{"end.time"} = epochToHuman($self->getValue("eventEndDate"),"%Z");
|
||||
$var{canEdit} = $self->canEdit;
|
||||
$var{"edit.url"} = WebGUI::URL::page('func=edit');
|
||||
$var{"edit.label"} = WebGUI::International::get(575);
|
||||
$var{"delete.url"} = WebGUI::URL::page('func=deleteEvent&rid='.$self->getValue("EventsCalendar_recurringId"));
|
||||
$var{"delete.label"} = WebGUI::International::get(576);
|
||||
# my $query = "select EventsCalendar_eventId from EventsCalendar_event where EventsCalendar_eventId<>".quote($event->getValue("EventsCalendar_eventId});
|
||||
# $query .= " and wobjectId=".quote($self->get("wobjectId")) unless ($self->get("isMaster"));
|
||||
# $query .= " and startDate<=$event->getValue("startDate} order by startDate desc, endDate desc";
|
||||
# ($id) = WebGUI::SQL->quickArray($query,WebGUI::SQL->getSlave);
|
||||
# $var{"previous.label"} = '«'.WebGUI::International::get(92,"EventsCalendar");
|
||||
# $var{"previous.url"} = WebGUI::URL::page("func=viewEvent&wid=".$self->get("wobjectId")."&eid=".$id) if ($id);
|
||||
# $query = "select EventsCalendar_eventId from EventsCalendar_event where EventsCalendar_eventId<>".quote($event->getValue("EventsCalendar_eventId});
|
||||
# $query .= " and wobjectId=".quote($self->get("wobjectId")) unless ($self->get("isMaster"));
|
||||
# $query .= " and startDate>=$event->getValue("eventStartDate") order by startDate, endDate";
|
||||
# ($id) = WebGUI::SQL->quickArray($query,WebGUI::SQL->getSlave);
|
||||
# $var{"next.label"} = WebGUI::International::get(93,"EventsCalendar").'»';
|
||||
# $var{"next.url"} = WebGUI::URL::page("func=viewEvent&wid=".$self->get("wobjectId")."&eid=".$id) if ($id);
|
||||
}
|
||||
# $tabform->getTab("display")->template(
|
||||
# -name=>"confirmationTemplateId",
|
||||
# -value=>$self->getValue("confirmationTemplateId"),
|
||||
# -namespace=>"EventsCalendar/Event",
|
||||
# -label=>WebGUI::International::get(529,"EventsCalendar"),
|
||||
# -afterEdit=>'func=edit'
|
||||
# );
|
||||
$tabform->getTab("display")->template(
|
||||
-name=>"templateId",
|
||||
-value=>$self->getValue("templateId"),
|
||||
-namespace=>"EventsCalendar/Event",
|
||||
-label=>WebGUI::International::get(530,"EventsCalendar"),
|
||||
-afterEdit=>'func=edit&wid='.$self->get("wobjectId")
|
||||
);
|
||||
# $tabform->getTab("display")->template(
|
||||
# -name=>"regNotifyTemplateId",
|
||||
# -value=>$self->getValue("regNotifyTemplateId"),
|
||||
# -namespace=>"EventsCalendar/Event",
|
||||
# -label=>WebGUI::International::get(531,"EventsCalendar"),
|
||||
# -afterEdit=>'func=edit&wid='.$self->get("wobjectId")
|
||||
# );
|
||||
# $tabform->getTab("display")->template(
|
||||
# -name=>"reminderTemplateId",
|
||||
# -value=>$self->getValue("reminderTemplateId"),
|
||||
# -namespace=>"EventsCalendar/Event",
|
||||
# -label=>WebGUI::International::get(532,"EventsCalendar"),
|
||||
# -afterEdit=>'func=edit&wid='.$self->get("wobjectId")
|
||||
# );
|
||||
# $tabform->getTab("security")->group(
|
||||
# -name=>"groupCanRegister", -label=>WebGUI::International::get(533,"EventsCalendar"),
|
||||
# -value=>[$self->getValue("groupCanRegister")]
|
||||
# );
|
||||
# $tabform->getTab("security")->group(
|
||||
# -name=>"groupCanReminder", -label=>WebGUI::International::get(534,"EventsCalendar"),
|
||||
# -value=>[$self->getValue("groupCanReminder")]
|
||||
# );
|
||||
# $tabform->getTab("security")->group(
|
||||
# -name=>"groupNotify", -label=>WebGUI::International::get(535,"EventsCalendar"),
|
||||
# -value=>[$self->getValue("regNotifyGroupId")]
|
||||
# );
|
||||
return $tabform;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getIcon {
|
||||
my $self = shift;
|
||||
my $small = shift;
|
||||
return $session{config}{extrasURL}.'/assets/small/calendar.gif' if ($small);
|
||||
return $session{config}{extrasURL}.'/assets/calendar.gif';
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getName {
|
||||
return WebGUI::International::get(511,"EventsCalendar");
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub view {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::noAccess() unless $self->canView;
|
||||
$self->logView() if ($session{setting}{passiveProfilingEnabled});
|
||||
my ($output, $event, %var, $id);
|
||||
$event = $self;
|
||||
$var{title} = $event->getValue("title");
|
||||
$var{"start.label"} = WebGUI::International::get(14,"EventsCalendar");
|
||||
$var{"start.date"} = epochToHuman($self->getValue("eventStartDate"),"%z");
|
||||
$var{"start.time"} = epochToHuman($self->getValue("eventStartDate"),"%Z");
|
||||
$var{"end.label"} = WebGUI::International::get(15,"EventsCalendar");
|
||||
$var{"end.date"} = epochToHuman($self->getValue("eventEndDate"),"%z");
|
||||
$var{"end.time"} = epochToHuman($self->getValue("eventEndDate"),"%Z");
|
||||
$var{canEdit} = $self->canEdit;
|
||||
$var{"edit.url"} = WebGUI::URL::page('func=edit');
|
||||
$var{"edit.label"} = WebGUI::International::get(575);
|
||||
$var{"delete.url"} = WebGUI::URL::page('func=deleteEvent&rid='.$self->getValue("EventsCalendar_recurringId"));
|
||||
$var{"delete.label"} = WebGUI::International::get(576);
|
||||
# my $query = "select EventsCalendar_eventId from EventsCalendar_event where EventsCalendar_eventId<>".quote($event->getValue("EventsCalendar_eventId});
|
||||
# $query .= " and wobjectId=".quote($self->get("wobjectId")) unless ($self->get("isMaster"));
|
||||
# $query .= " and startDate<=$event->getValue("startDate} order by startDate desc, endDate desc";
|
||||
# ($id) = WebGUI::SQL->quickArray($query,WebGUI::SQL->getSlave);
|
||||
# $var{"previous.label"} = '«'.WebGUI::International::get(92,"EventsCalendar");
|
||||
# $var{"previous.url"} = WebGUI::URL::page("func=viewEvent&wid=".$self->get("wobjectId")."&eid=".$id) if ($id);
|
||||
# $query = "select EventsCalendar_eventId from EventsCalendar_event where EventsCalendar_eventId<>".quote($event->getValue("EventsCalendar_eventId});
|
||||
# $query .= " and wobjectId=".quote($self->get("wobjectId")) unless ($self->get("isMaster"));
|
||||
# $query .= " and startDate>=$event->getValue("eventStartDate") order by startDate, endDate";
|
||||
# ($id) = WebGUI::SQL->quickArray($query,WebGUI::SQL->getSlave);
|
||||
# $var{"next.label"} = WebGUI::International::get(93,"EventsCalendar").'»';
|
||||
# $var{"next.url"} = WebGUI::URL::page("func=viewEvent&wid=".$self->get("wobjectId")."&eid=".$id) if ($id);
|
||||
$var{description} = $event->getValue("description");
|
||||
# my $where = "eventscalendar.type=2";
|
||||
# my $kiddos = $self->getLineage(["children"],{returnObjects=>1,joinClass=>"WebGUI::Asset::Wobject::EventsCalendar",whereClause=>$where});
|
||||
|
|
@ -363,17 +363,17 @@ sub view {
|
|||
# #These will be in order of lineage. Use the Asset Manager to change the order.
|
||||
# $tabform->getTab($agenda->getId)->raw($agenda->WebGUI::Asset::Wobject::EventsCalendar::view);
|
||||
# }
|
||||
# $var{agendas} = $tabform->print;
|
||||
my $vars = \%var;
|
||||
#get parent so we can get the parent's style. Hopefully the parent is an EventsCalendar. If not, oh well.
|
||||
my $parent = $self->getParent;
|
||||
return WebGUI::Style::process($self->processTemplate($vars,$self->getValue("templateId")),$parent->getValue("styleTemplateId"));
|
||||
}
|
||||
|
||||
# $var{agendas} = $tabform->print;
|
||||
my $vars = \%var;
|
||||
#get parent so we can get the parent's style. Hopefully the parent is an EventsCalendar. If not, oh well.
|
||||
my $parent = $self->getParent;
|
||||
return WebGUI::Style::process($self->processTemplate($vars,$self->getValue("templateId")),$parent->getValue("styleTemplateId"));
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteEvent {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
my ($output);
|
||||
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
|
|
@ -389,7 +389,7 @@ sub www_deleteEvent {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteEventConfirm {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
if ($session{form}{rid} ne "") {
|
||||
my $where = "EventsCalendar_Event.EventsCalendar_recurringId=".quote($session{form}{rid});
|
||||
|
|
@ -404,13 +404,13 @@ sub www_deleteEventConfirm {
|
|||
return $self->getParent->getContainer->www_view;;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
$self->getAdminConsole->setHelp("event add/edit");
|
||||
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get('13', 'EventsCalendar'));
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
$self->getAdminConsole->setHelp("event add/edit");
|
||||
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get('13', 'EventsCalendar'));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -434,14 +434,14 @@ sub www_editSave {
|
|||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless ($self->canEdit);
|
||||
my (@startDate, @endDate, @regStartDate, @regEndDate, @reminderStartDate,
|
||||
@reminderEndDate, $until, @eventId, $i, $recurringEventId);
|
||||
$startDate[0] = WebGUI::DateTime::setToEpoch($session{form}{eventStartDate});
|
||||
$startDate[0] = time() unless ($startDate[0] > 0);
|
||||
$endDate[0] = WebGUI::DateTime::setToEpoch($session{form}{eventEndDate});
|
||||
$endDate[0] = $startDate[0] unless ($endDate[0] >= $startDate[0]);
|
||||
# $regStartDate[0] = WebGUI::DateTime::setToEpoch($session{form}{regStartDate});
|
||||
$startDate[0] = WebGUI::DateTime::setToEpoch($session{form}{eventStartDate});
|
||||
$startDate[0] = time() unless ($startDate[0] > 0);
|
||||
$endDate[0] = WebGUI::DateTime::setToEpoch($session{form}{eventEndDate});
|
||||
$endDate[0] = $startDate[0] unless ($endDate[0] >= $startDate[0]);
|
||||
# $regStartDate[0] = WebGUI::DateTime::setToEpoch($session{form}{regStartDate});
|
||||
# $regEndDate[0] = WebGUI::DateTime::setToEpoch($session{form}{regStartDate});
|
||||
# $regEndDate[0] = $regStartDate[0] unless ($regEndDate[0] >= $regStartDate[0]);
|
||||
# $reminderStartDate[0] = WebGUI::DateTime::setToEpoch($session{form}{reminderStartDate});
|
||||
# $reminderStartDate[0] = WebGUI::DateTime::setToEpoch($session{form}{reminderStartDate});
|
||||
# $reminderEndDate[0] = WebGUI::DateTime::setToEpoch($session{form}{reminderStartDate});
|
||||
# $reminderEndDate[0] = $reminderStartDate[0] unless ($reminderEndDate[0] >= $reminderStartDate[0]);
|
||||
$session{form}{title} = $session{form}{title} || WebGUI::International::get(557,"EventsCalendar");
|
||||
|
|
@ -475,21 +475,21 @@ sub www_editSave {
|
|||
$firstEvent->processPropertiesFromFormPost;
|
||||
$firstEvent->updateHistory("edited");
|
||||
$firstEvent->{_parent} = $self;
|
||||
while ($startDate[$i] < $until) {
|
||||
$i++;
|
||||
$eventId[$i] = WebGUI::Id::generate();
|
||||
if ($session{form}{recursEvery} eq "day") {
|
||||
$startDate[$i] = addToDate($startDate[0],0,0,($i*$session{form}{interval}));
|
||||
while ($startDate[$i] < $until) {
|
||||
$i++;
|
||||
$eventId[$i] = WebGUI::Id::generate();
|
||||
if ($session{form}{recursEvery} eq "day") {
|
||||
$startDate[$i] = addToDate($startDate[0],0,0,($i*$session{form}{interval}));
|
||||
$endDate[$i] = addToDate($endDate[0],0,0,($i*$session{form}{interval}));
|
||||
} elsif ($session{form}{recursEvery} eq "week") {
|
||||
$startDate[$i] = addToDate($startDate[0],0,0,(7*$i*$session{form}{interval}));
|
||||
$endDate[$i] = addToDate($endDate[0],0,0,(7*$i*$session{form}{interval}));
|
||||
} elsif ($session{form}{recursEvery} eq "month") {
|
||||
$startDate[$i] = addToDate($startDate[0],0,($i*$session{form}{interval}),0);
|
||||
$endDate[$i] = addToDate($endDate[0],0,($i*$session{form}{interval}),0);
|
||||
} elsif ($session{form}{recursEvery} eq "year") {
|
||||
$startDate[$i] = addToDate($startDate[0],($i*$session{form}{interval}),0,0);
|
||||
$endDate[$i] = addToDate($endDate[0],($i*$session{form}{interval}),0,0);
|
||||
} elsif ($session{form}{recursEvery} eq "week") {
|
||||
$startDate[$i] = addToDate($startDate[0],0,0,(7*$i*$session{form}{interval}));
|
||||
$endDate[$i] = addToDate($endDate[0],0,0,(7*$i*$session{form}{interval}));
|
||||
} elsif ($session{form}{recursEvery} eq "month") {
|
||||
$startDate[$i] = addToDate($startDate[0],0,($i*$session{form}{interval}),0);
|
||||
$endDate[$i] = addToDate($endDate[0],0,($i*$session{form}{interval}),0);
|
||||
} elsif ($session{form}{recursEvery} eq "year") {
|
||||
$startDate[$i] = addToDate($startDate[0],($i*$session{form}{interval}),0,0);
|
||||
$endDate[$i] = addToDate($endDate[0],($i*$session{form}{interval}),0,0);
|
||||
}
|
||||
my $newEvent = $self->duplicate($firstEvent);
|
||||
$newEvent->update({
|
||||
|
|
@ -499,7 +499,7 @@ sub www_editSave {
|
|||
print "\n$i\n";
|
||||
$newEvent->fixUrl;
|
||||
$newEvent->updateHistory("edited");
|
||||
$newEvent->{_parent} = $self;
|
||||
$newEvent->{_parent} = $self;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -526,6 +526,6 @@ sub www_editSave {
|
|||
# return WebGUI::Privilege::noAccess() unless (($parent->getValue("className") eq "WebGUI::Asset::Wobject::EventsCalendar") && #($parent->canEdit));
|
||||
# return WebGUI::Style::process($self->getEditForm->print,$parent->getValue("styleTemplateId"));
|
||||
#}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,91 +1,91 @@
|
|||
package WebGUI::Asset::Wobject::EventsCalendar;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2005 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::ErrorHandler;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
use WebGUI::Utility;
|
||||
package WebGUI::Asset::Wobject::EventsCalendar;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2005 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::ErrorHandler;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
use WebGUI::Utility;
|
||||
use WebGUI::Asset::Wobject;
|
||||
use WebGUI::Asset::Event;
|
||||
|
||||
our @ISA = qw(WebGUI::Asset::Wobject);
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
#sub canManage {
|
||||
# my $self = shift;
|
||||
# my $userId = shift || $session{user}{userId};
|
||||
# if ($userId eq $self->getValue("ownerUserId")) {
|
||||
# return 1;
|
||||
# }
|
||||
# return 0 unless $self->canView($userId);
|
||||
# return WebGUI::Grouping::isInGroup($self->getValue("groupIdManage"),$userId);
|
||||
#}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $definition = shift;
|
||||
push(@{$definition}, {
|
||||
tableName=>'eventscalendar',
|
||||
className=>'WebGUI::Asset::Wobject::EventsCalendar',
|
||||
properties=>{
|
||||
templateId =>{
|
||||
fieldType=>"template",
|
||||
defaultValue=>'PBtmpl0000000000000022'
|
||||
},
|
||||
eventTemplateId =>{
|
||||
fieldType=>"template",
|
||||
defaultValue=>'PBtmpl0000000000000023'
|
||||
},
|
||||
scope =>{
|
||||
fieldType=>"selectList",
|
||||
defaultValue=>'0'
|
||||
},
|
||||
# type =>{
|
||||
# fieldType=>"selectList",
|
||||
# defaultValue=>'0'
|
||||
# },
|
||||
# groupIdManage =>{
|
||||
# fieldType=>"group",
|
||||
# defaultValue=>'4'
|
||||
# },
|
||||
startMonth=>{
|
||||
fieldType=>"selectList",
|
||||
defaultValue=>"current"
|
||||
},
|
||||
endMonth=>{
|
||||
fieldType=>"selectList",
|
||||
defaultValue=>"after12"
|
||||
},
|
||||
defaultMonth=>{
|
||||
fieldType=>"selectList",
|
||||
defaultValue=>"current"
|
||||
},
|
||||
paginateAfter=>{
|
||||
fieldType=>"integer",
|
||||
defaultValue=>1
|
||||
}
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
use WebGUI::Asset::Event;
|
||||
|
||||
our @ISA = qw(WebGUI::Asset::Wobject);
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
#sub canManage {
|
||||
# my $self = shift;
|
||||
# my $userId = shift || $session{user}{userId};
|
||||
# if ($userId eq $self->getValue("ownerUserId")) {
|
||||
# return 1;
|
||||
# }
|
||||
# return 0 unless $self->canView($userId);
|
||||
# return WebGUI::Grouping::isInGroup($self->getValue("groupIdManage"),$userId);
|
||||
#}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $definition = shift;
|
||||
push(@{$definition}, {
|
||||
tableName=>'EventsCalendar',
|
||||
className=>'WebGUI::Asset::Wobject::EventsCalendar',
|
||||
properties=>{
|
||||
templateId =>{
|
||||
fieldType=>"template",
|
||||
defaultValue=>'PBtmpl0000000000000022'
|
||||
},
|
||||
eventTemplateId =>{
|
||||
fieldType=>"template",
|
||||
defaultValue=>'PBtmpl0000000000000023'
|
||||
},
|
||||
scope =>{
|
||||
fieldType=>"selectList",
|
||||
defaultValue=>'0'
|
||||
},
|
||||
# type =>{
|
||||
# fieldType=>"selectList",
|
||||
# defaultValue=>'0'
|
||||
# },
|
||||
# groupIdManage =>{
|
||||
# fieldType=>"group",
|
||||
# defaultValue=>'4'
|
||||
# },
|
||||
startMonth=>{
|
||||
fieldType=>"selectList",
|
||||
defaultValue=>"current"
|
||||
},
|
||||
endMonth=>{
|
||||
fieldType=>"selectList",
|
||||
defaultValue=>"after12"
|
||||
},
|
||||
defaultMonth=>{
|
||||
fieldType=>"selectList",
|
||||
defaultValue=>"current"
|
||||
},
|
||||
paginateAfter=>{
|
||||
fieldType=>"integer",
|
||||
defaultValue=>1
|
||||
}
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -96,118 +96,118 @@ sub duplicate {
|
|||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getEditForm {
|
||||
my $self = shift;
|
||||
my $tabform = $self->SUPER::getEditForm();
|
||||
# $tabform->getTab("properties")->selectList(
|
||||
# -name=>"type",
|
||||
# -label=>WebGUI::International::get(501,"EventsCalendar"),
|
||||
# -value=>[$self->getValue("type")],
|
||||
# -options=>{
|
||||
# 0=>WebGUI::International::get(502,"EventsCalendar"),
|
||||
# 1=>WebGUI::International::get(503,"EventsCalendar"),
|
||||
# 2=>WebGUI::International::get(504,"EventsCalendar"),
|
||||
# 3=>WebGUI::International::get(505,"EventsCalendar"),
|
||||
# 4=>WebGUI::International::get(506,"EventsCalendar")
|
||||
# },
|
||||
# );
|
||||
$tabform->getTab("properties")->selectList(
|
||||
-name=>"scope",
|
||||
-label=>WebGUI::International::get(507,"EventsCalendar"),
|
||||
-value=>[$self->getValue("scope")],
|
||||
-options=>{
|
||||
0=>WebGUI::International::get(508,"EventsCalendar"),
|
||||
1=>WebGUI::International::get(509,"EventsCalendar"),
|
||||
2=>WebGUI::International::get(510,"EventsCalendar"),
|
||||
}
|
||||
);
|
||||
$tabform->getTab("display")->template(
|
||||
-name=>"templateId",
|
||||
-label=>WebGUI::International::get(94,"EventsCalendar"),
|
||||
-value=>$self->getValue('templateId'),
|
||||
-namespace=>"EventsCalendar"
|
||||
);
|
||||
$tabform->getTab("display")->template(
|
||||
-name=>"eventTemplateId",
|
||||
-label=>WebGUI::International::get(80,"EventsCalendar"),
|
||||
-value=>$self->getValue('eventTemplateId'),
|
||||
-namespace=>"EventsCalendar/Event",
|
||||
-afterEdit=>'func=edit&wid='.$self->get("wobjectId")
|
||||
);
|
||||
$tabform->getTab("display")->selectList(
|
||||
-name=>"startMonth",
|
||||
-options=>{
|
||||
"january"=>WebGUI::International::get(15),
|
||||
"now"=>WebGUI::International::get(98,"EventsCalendar"),
|
||||
"current"=>WebGUI::International::get(82,"EventsCalendar"),
|
||||
"first"=>WebGUI::International::get(83,"EventsCalendar")
|
||||
},
|
||||
-label=>WebGUI::International::get(81,"EventsCalendar"),
|
||||
-value=>[$self->getValue("startMonth")]
|
||||
);
|
||||
my %options;
|
||||
tie %options, 'Tie::IxHash';
|
||||
%options = (
|
||||
"last"=>WebGUI::International::get(85,"EventsCalendar"),
|
||||
"after12"=>WebGUI::International::get(86,"EventsCalendar"),
|
||||
"after9"=>WebGUI::International::get(87,"EventsCalendar"),
|
||||
"after6"=>WebGUI::International::get(88,"EventsCalendar"),
|
||||
"after3"=>WebGUI::International::get(89,"EventsCalendar"),
|
||||
"current"=>WebGUI::International::get(82,"EventsCalendar")
|
||||
);
|
||||
$tabform->getTab("display")->selectList(
|
||||
-name=>"endMonth",
|
||||
-options=>\%options,
|
||||
-label=>WebGUI::International::get(84,"EventsCalendar"),
|
||||
-value=>[$self->getValue("endMonth")]
|
||||
);
|
||||
$tabform->getTab("display")->selectList(
|
||||
-name=>"defaultMonth",
|
||||
-options=>{
|
||||
"current"=>WebGUI::International::get(82,"EventsCalendar"),
|
||||
"last"=>WebGUI::International::get(85,"EventsCalendar"),
|
||||
"first"=>WebGUI::International::get(83,"EventsCalendar")
|
||||
},
|
||||
-label=>WebGUI::International::get(90,"EventsCalendar"),
|
||||
-value=>[$self->getValue("defaultMonth")]
|
||||
);
|
||||
$tabform->getTab("display")->integer(
|
||||
-name=>"paginateAfter",
|
||||
-label=>WebGUI::International::get(19,"EventsCalendar"),
|
||||
-value=>$self->getValue("paginateAfter")
|
||||
);
|
||||
# $tabform->getTab("security")->group(
|
||||
# -name=>"groupIdManage",
|
||||
# -label=>WebGUI::International::get(500,"EventsCalendar"),
|
||||
# -value=>[$self->getValue("groupIdManage")],
|
||||
# -uiLevel=>6
|
||||
# );
|
||||
return $tabform;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getIcon {
|
||||
my $self = shift;
|
||||
my $small = shift;
|
||||
return $session{config}{extrasURL}.'/assets/small/calendar.gif' if ($small);
|
||||
return $session{config}{extrasURL}.'/assets/calendar.gif';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getName {
|
||||
return WebGUI::International::get(2,"EventsCalendar");
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getUiLevel {
|
||||
return 9;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getEditForm {
|
||||
my $self = shift;
|
||||
my $tabform = $self->SUPER::getEditForm();
|
||||
# $tabform->getTab("properties")->selectList(
|
||||
# -name=>"type",
|
||||
# -label=>WebGUI::International::get(501,"EventsCalendar"),
|
||||
# -value=>[$self->getValue("type")],
|
||||
# -options=>{
|
||||
# 0=>WebGUI::International::get(502,"EventsCalendar"),
|
||||
# 1=>WebGUI::International::get(503,"EventsCalendar"),
|
||||
# 2=>WebGUI::International::get(504,"EventsCalendar"),
|
||||
# 3=>WebGUI::International::get(505,"EventsCalendar"),
|
||||
# 4=>WebGUI::International::get(506,"EventsCalendar")
|
||||
# },
|
||||
# );
|
||||
$tabform->getTab("properties")->selectList(
|
||||
-name=>"scope",
|
||||
-label=>WebGUI::International::get(507,"EventsCalendar"),
|
||||
-value=>[$self->getValue("scope")],
|
||||
-options=>{
|
||||
0=>WebGUI::International::get(508,"EventsCalendar"),
|
||||
1=>WebGUI::International::get(509,"EventsCalendar"),
|
||||
2=>WebGUI::International::get(510,"EventsCalendar"),
|
||||
}
|
||||
);
|
||||
$tabform->getTab("display")->template(
|
||||
-name=>"templateId",
|
||||
-label=>WebGUI::International::get(94,"EventsCalendar"),
|
||||
-value=>$self->getValue('templateId'),
|
||||
-namespace=>"EventsCalendar"
|
||||
);
|
||||
$tabform->getTab("display")->template(
|
||||
-name=>"eventTemplateId",
|
||||
-label=>WebGUI::International::get(80,"EventsCalendar"),
|
||||
-value=>$self->getValue('eventTemplateId'),
|
||||
-namespace=>"EventsCalendar/Event",
|
||||
-afterEdit=>'func=edit&wid='.$self->get("wobjectId")
|
||||
);
|
||||
$tabform->getTab("display")->selectList(
|
||||
-name=>"startMonth",
|
||||
-options=>{
|
||||
"january"=>WebGUI::International::get(15),
|
||||
"now"=>WebGUI::International::get(98,"EventsCalendar"),
|
||||
"current"=>WebGUI::International::get(82,"EventsCalendar"),
|
||||
"first"=>WebGUI::International::get(83,"EventsCalendar")
|
||||
},
|
||||
-label=>WebGUI::International::get(81,"EventsCalendar"),
|
||||
-value=>[$self->getValue("startMonth")]
|
||||
);
|
||||
my %options;
|
||||
tie %options, 'Tie::IxHash';
|
||||
%options = (
|
||||
"last"=>WebGUI::International::get(85,"EventsCalendar"),
|
||||
"after12"=>WebGUI::International::get(86,"EventsCalendar"),
|
||||
"after9"=>WebGUI::International::get(87,"EventsCalendar"),
|
||||
"after6"=>WebGUI::International::get(88,"EventsCalendar"),
|
||||
"after3"=>WebGUI::International::get(89,"EventsCalendar"),
|
||||
"current"=>WebGUI::International::get(82,"EventsCalendar")
|
||||
);
|
||||
$tabform->getTab("display")->selectList(
|
||||
-name=>"endMonth",
|
||||
-options=>\%options,
|
||||
-label=>WebGUI::International::get(84,"EventsCalendar"),
|
||||
-value=>[$self->getValue("endMonth")]
|
||||
);
|
||||
$tabform->getTab("display")->selectList(
|
||||
-name=>"defaultMonth",
|
||||
-options=>{
|
||||
"current"=>WebGUI::International::get(82,"EventsCalendar"),
|
||||
"last"=>WebGUI::International::get(85,"EventsCalendar"),
|
||||
"first"=>WebGUI::International::get(83,"EventsCalendar")
|
||||
},
|
||||
-label=>WebGUI::International::get(90,"EventsCalendar"),
|
||||
-value=>[$self->getValue("defaultMonth")]
|
||||
);
|
||||
$tabform->getTab("display")->integer(
|
||||
-name=>"paginateAfter",
|
||||
-label=>WebGUI::International::get(19,"EventsCalendar"),
|
||||
-value=>$self->getValue("paginateAfter")
|
||||
);
|
||||
# $tabform->getTab("security")->group(
|
||||
# -name=>"groupIdManage",
|
||||
# -label=>WebGUI::International::get(500,"EventsCalendar"),
|
||||
# -value=>[$self->getValue("groupIdManage")],
|
||||
# -uiLevel=>6
|
||||
# );
|
||||
return $tabform;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getIcon {
|
||||
my $self = shift;
|
||||
my $small = shift;
|
||||
return $session{config}{extrasURL}.'/assets/small/calendar.gif' if ($small);
|
||||
return $session{config}{extrasURL}.'/assets/calendar.gif';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getName {
|
||||
return WebGUI::International::get(2,"EventsCalendar");
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getUiLevel {
|
||||
return 9;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub view {
|
||||
|
||||
# All of this really needs to be redone like the old
|
||||
|
|
@ -216,253 +216,253 @@ sub view {
|
|||
# needs to be re-enabled. Also, see the note below at line
|
||||
# 407 - each dayloop event array needs to be sorted by startTime.
|
||||
|
||||
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::noAccess() unless $self->canView;
|
||||
#define default view month range. Note that this could be different from
|
||||
#the range a user is allowed to view - set by the events calendar limitations.
|
||||
my $monthRangeLength = int($self->getValue("paginateAfter"));
|
||||
# Let's limit the range to 72 for now; later we can make it definable in the calendar itself.
|
||||
$monthRangeLength = 1 if ($monthRangeLength < 0);
|
||||
$monthRangeLength = 72 if ($monthRangeLength > 72);
|
||||
#monthRangeLength is the number of months the user wishes to view
|
||||
# or the default number of the months per page the wobject is set to display.
|
||||
my $calMonthStart = $session{form}{calMonthStart} || 1;
|
||||
$calMonthStart = int($calMonthStart);
|
||||
my $calMonthEnd = $session{form}{calMonthEnd} || ($calMonthStart + $monthRangeLength - 1);
|
||||
$calMonthEnd = int($calMonthEnd);
|
||||
$calMonthStart = 1 if (($calMonthStart < 1) || ($calMonthStart > 72));
|
||||
$calMonthEnd = 1 if (($calMonthEnd < 1) || ($calMonthEnd > 72));
|
||||
$calMonthEnd = $calMonthStart if ($calMonthEnd < $calMonthStart);
|
||||
|
||||
my ( $junk, $sameDate, $p, @list, $date, $flag, %previous, $maxDate, $minDate);
|
||||
my $monthloop;
|
||||
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::noAccess() unless $self->canView;
|
||||
#define default view month range. Note that this could be different from
|
||||
#the range a user is allowed to view - set by the events calendar limitations.
|
||||
my $monthRangeLength = int($self->getValue("paginateAfter"));
|
||||
# Let's limit the range to 72 for now; later we can make it definable in the calendar itself.
|
||||
$monthRangeLength = 1 if ($monthRangeLength < 0);
|
||||
$monthRangeLength = 72 if ($monthRangeLength > 72);
|
||||
#monthRangeLength is the number of months the user wishes to view
|
||||
# or the default number of the months per page the wobject is set to display.
|
||||
my $calMonthStart = $session{form}{calMonthStart} || 1;
|
||||
$calMonthStart = int($calMonthStart);
|
||||
my $calMonthEnd = $session{form}{calMonthEnd} || ($calMonthStart + $monthRangeLength - 1);
|
||||
$calMonthEnd = int($calMonthEnd);
|
||||
$calMonthStart = 1 if (($calMonthStart < 1) || ($calMonthStart > 72));
|
||||
$calMonthEnd = 1 if (($calMonthEnd < 1) || ($calMonthEnd > 72));
|
||||
$calMonthEnd = $calMonthStart if ($calMonthEnd < $calMonthStart);
|
||||
|
||||
my ( $junk, $sameDate, $p, @list, $date, $flag, %previous, $maxDate, $minDate);
|
||||
my $monthloop;
|
||||
|
||||
#had to disable caching because each event can have its own security.
|
||||
# It can be re-added, of course.
|
||||
|
||||
my $scope = $self->getValue("scope");
|
||||
my $children;
|
||||
# get All My Children.
|
||||
if ($scope == 0) { #calendar's scope is regular (immediate descendants)
|
||||
$children = $self->getLineage(["children"],{returnObjects=>1,
|
||||
includeOnlyClasses=>["WebGUI::Asset::Event","WebGUI::Asset::Relation"]});
|
||||
} elsif ($scope == 1) { #calendar is master
|
||||
$children = $self->getLineage(["descendants"],{returnObjects=>1,
|
||||
includeOnlyClasses=>["WebGUI::Asset::Event","WebGUI::Asset::Relation"]});
|
||||
} elsif ($scope == 2) { #calendar is global
|
||||
$children = WebGUI::Asset::getRoot()->getLineage(["descendants"],{returnObjects=>1,
|
||||
includeOnlyClasses=>["WebGUI::Asset::Event","WebGUI::Asset::Relation"]});
|
||||
|
||||
my $scope = $self->getValue("scope");
|
||||
my $children;
|
||||
# get All My Children.
|
||||
if ($scope == 0) { #calendar's scope is regular (immediate descendants)
|
||||
$children = $self->getLineage(["children"],{returnObjects=>1,
|
||||
includeOnlyClasses=>["WebGUI::Asset::Event","WebGUI::Asset::Relation"]});
|
||||
} elsif ($scope == 1) { #calendar is master
|
||||
$children = $self->getLineage(["descendants"],{returnObjects=>1,
|
||||
includeOnlyClasses=>["WebGUI::Asset::Event","WebGUI::Asset::Relation"]});
|
||||
} elsif ($scope == 2) { #calendar is global
|
||||
$children = WebGUI::Asset::getRoot()->getLineage(["descendants"],{returnObjects=>1,
|
||||
includeOnlyClasses=>["WebGUI::Asset::Event","WebGUI::Asset::Relation"]});
|
||||
}
|
||||
# get Type of Calendar
|
||||
# my $calType = $self->getValue("type");
|
||||
|
||||
my $startMonth = $self->getValue("startMonth");
|
||||
#define range of allowed months from the wobject settings.
|
||||
if ($startMonth eq "first") {
|
||||
#Don't really do anything - leading months will not be pushed if there are no events.
|
||||
$minDate = WebGUI::DateTime::time();
|
||||
} elsif ($startMonth eq "january") {
|
||||
$minDate = WebGUI::DateTime::humanToEpoch(WebGUI::DateTime::epochToHuman("","%y")."-01-01 00:00:00");
|
||||
} else {
|
||||
$minDate = WebGUI::DateTime::time();
|
||||
}
|
||||
my $startsNow = 0;
|
||||
unless ($self->get("startMonth") eq "now") {
|
||||
($minDate,$junk) = WebGUI::DateTime::monthStartEnd($minDate);
|
||||
} else { $startsNow = 1;}
|
||||
tie %previous, 'Tie::CPHash';
|
||||
#This merely limits the months to publish. Month's processing is skipped if
|
||||
#the month is after the maxDate.
|
||||
my $endMonth = $self->getValue("endMonth");
|
||||
if ($endMonth eq "last") {
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,99,0,0);
|
||||
} elsif ($endMonth eq "after12") {
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,1,0,0);
|
||||
} elsif ($endMonth eq "after9") {
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,0,9,0);
|
||||
} elsif ($endMonth eq "after6") {
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,0,6,0);
|
||||
} elsif ($endMonth eq "after3") {
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,0,3,0);
|
||||
} elsif ($endMonth eq "current") {
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,0,1,0);
|
||||
}
|
||||
|
||||
my @now = WebGUI::DateTime::epochToArray(WebGUI::DateTime::time());
|
||||
my $calHasEvent = 0;
|
||||
#monthcount minus i is the number of months remaining to be processed.
|
||||
for (my $i=$calMonthStart;$i<=$calMonthEnd;$i++) {
|
||||
#for each month, do the following....
|
||||
my $monthHasEvent = 0;
|
||||
my $thisMonth = WebGUI::DateTime::addToDate($minDate,0,($i-1),0);
|
||||
my ($monthStart, $monthEnd) = WebGUI::DateTime::monthStartEnd($thisMonth);
|
||||
my @thisMonthDate = WebGUI::DateTime::epochToArray($thisMonth);
|
||||
#Check month to see if it is in the allowed month range. End loop if it's not.
|
||||
if ($thisMonth > $maxDate) {
|
||||
$i = $calMonthEnd;
|
||||
next;
|
||||
}
|
||||
|
||||
my %events;
|
||||
my %previous;
|
||||
|
||||
foreach my $event (@{$children}) {
|
||||
if (ref $event eq "WebGUI::Asset::Event") {
|
||||
my $eventStartDate = $event->getValue("eventStartDate");
|
||||
my $eventEndDate = $event->getValue("eventEndDate");
|
||||
if ($eventStartDate > $eventEndDate) {
|
||||
#Fix bad data. Everything that has a beginning must have an end [no earlier than its beginning].
|
||||
$event->update({ "eventEndDate"=>$eventStartDate });
|
||||
}
|
||||
#Prune events that don't appear in this month.
|
||||
next if (($eventStartDate > $monthEnd) || ($eventEndDate < $monthStart));
|
||||
#Prune events that have already ended if $startsNow
|
||||
next if (($eventEndDate < $minDate) && $startsNow);
|
||||
#Hide this event unless we are allowed to see it. Funny that each event has 4 date/time pairs.
|
||||
my $startMonth = $self->getValue("startMonth");
|
||||
#define range of allowed months from the wobject settings.
|
||||
if ($startMonth eq "first") {
|
||||
#Don't really do anything - leading months will not be pushed if there are no events.
|
||||
$minDate = WebGUI::DateTime::time();
|
||||
} elsif ($startMonth eq "january") {
|
||||
$minDate = WebGUI::DateTime::humanToEpoch(WebGUI::DateTime::epochToHuman("","%y")."-01-01 00:00:00");
|
||||
} else {
|
||||
$minDate = WebGUI::DateTime::time();
|
||||
}
|
||||
my $startsNow = 0;
|
||||
unless ($self->get("startMonth") eq "now") {
|
||||
($minDate,$junk) = WebGUI::DateTime::monthStartEnd($minDate);
|
||||
} else { $startsNow = 1;}
|
||||
tie %previous, 'Tie::CPHash';
|
||||
#This merely limits the months to publish. Month's processing is skipped if
|
||||
#the month is after the maxDate.
|
||||
my $endMonth = $self->getValue("endMonth");
|
||||
if ($endMonth eq "last") {
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,99,0,0);
|
||||
} elsif ($endMonth eq "after12") {
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,1,0,0);
|
||||
} elsif ($endMonth eq "after9") {
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,0,9,0);
|
||||
} elsif ($endMonth eq "after6") {
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,0,6,0);
|
||||
} elsif ($endMonth eq "after3") {
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,0,3,0);
|
||||
} elsif ($endMonth eq "current") {
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,0,1,0);
|
||||
}
|
||||
|
||||
my @now = WebGUI::DateTime::epochToArray(WebGUI::DateTime::time());
|
||||
my $calHasEvent = 0;
|
||||
#monthcount minus i is the number of months remaining to be processed.
|
||||
for (my $i=$calMonthStart;$i<=$calMonthEnd;$i++) {
|
||||
#for each month, do the following....
|
||||
my $monthHasEvent = 0;
|
||||
my $thisMonth = WebGUI::DateTime::addToDate($minDate,0,($i-1),0);
|
||||
my ($monthStart, $monthEnd) = WebGUI::DateTime::monthStartEnd($thisMonth);
|
||||
my @thisMonthDate = WebGUI::DateTime::epochToArray($thisMonth);
|
||||
#Check month to see if it is in the allowed month range. End loop if it's not.
|
||||
if ($thisMonth > $maxDate) {
|
||||
$i = $calMonthEnd;
|
||||
next;
|
||||
}
|
||||
|
||||
my %events;
|
||||
my %previous;
|
||||
|
||||
foreach my $event (@{$children}) {
|
||||
if (ref $event eq "WebGUI::Asset::Event") {
|
||||
my $eventStartDate = $event->getValue("eventStartDate");
|
||||
my $eventEndDate = $event->getValue("eventEndDate");
|
||||
if ($eventStartDate > $eventEndDate) {
|
||||
#Fix bad data. Everything that has a beginning must have an end [no earlier than its beginning].
|
||||
$event->update({ "eventEndDate"=>$eventStartDate });
|
||||
}
|
||||
#Prune events that don't appear in this month.
|
||||
next if (($eventStartDate > $monthEnd) || ($eventEndDate < $monthStart));
|
||||
#Prune events that have already ended if $startsNow
|
||||
next if (($eventEndDate < $minDate) && $startsNow);
|
||||
#Hide this event unless we are allowed to see it. Funny that each event has 4 date/time pairs.
|
||||
next unless $event->canView;
|
||||
# only display events for this person's Personal Calendar, if it's so set.
|
||||
# next unless (($calType != 1) || ($event->isMyEvent()));
|
||||
my $eventLength = WebGUI::DateTime::getDaysInInterval($eventStartDate,$eventEndDate);
|
||||
my ($startYear, $startMonth, $startDay, $startDate, $startTime) = split " ",
|
||||
WebGUI::DateTime::epochToHuman($eventStartDate, "%y %c %D %z %Z");
|
||||
my ($endYear, $endMonth, $endDay, $endDate, $endTime) = split " ",
|
||||
WebGUI::DateTime::epochToHuman($eventEndDate, "%y %c %D %z %Z");
|
||||
my $eventCycleStart = 0;
|
||||
# Fast-Forward Event Cycle to this month (for events spanning multiple months)
|
||||
$eventCycleStart = (WebGUI::DateTime::getDaysInInterval($eventStartDate,$monthStart) - 1) if ($eventStartDate < $monthStart);
|
||||
# also, skip leading days of this event if $startsNow is true. Doesn't work in Events List. Oh well.
|
||||
# $eventCycleStart = (WebGUI::DateTime::getDaysInInterval($eventStartDate,time)) if (($eventStartDate < time) && ($startsNow));
|
||||
# by default, stop processing this event at the end of its length.
|
||||
my $eventCycleStop = ($eventLength);
|
||||
#cycle through each day in the event, pushing the event's day listing into the proper day.
|
||||
for (my $i=$eventCycleStart; $i<=$eventCycleStop; $i++) {
|
||||
#create an array for the specific day in the event.
|
||||
my @date = WebGUI::DateTime::epochToArray(WebGUI::DateTime::addToDate($eventStartDate,0,0,$i));
|
||||
# if the event goes past the end of this month, halt the loop.
|
||||
# No need to continue processing days that aren't in this month.
|
||||
if ($monthEnd < (WebGUI::DateTime::addToDate($eventStartDate,0,0,$i) - 1)) {
|
||||
$i = ($eventCycleStop + 2);
|
||||
next;
|
||||
}
|
||||
#this conditional used to only test if we are in the proper month...
|
||||
# next unless (($calType != 1) || ($event->isMyEvent()));
|
||||
my $eventLength = WebGUI::DateTime::getDaysInInterval($eventStartDate,$eventEndDate);
|
||||
my ($startYear, $startMonth, $startDay, $startDate, $startTime) = split " ",
|
||||
WebGUI::DateTime::epochToHuman($eventStartDate, "%y %c %D %z %Z");
|
||||
my ($endYear, $endMonth, $endDay, $endDate, $endTime) = split " ",
|
||||
WebGUI::DateTime::epochToHuman($eventEndDate, "%y %c %D %z %Z");
|
||||
my $eventCycleStart = 0;
|
||||
# Fast-Forward Event Cycle to this month (for events spanning multiple months)
|
||||
$eventCycleStart = (WebGUI::DateTime::getDaysInInterval($eventStartDate,$monthStart) - 1) if ($eventStartDate < $monthStart);
|
||||
# also, skip leading days of this event if $startsNow is true. Doesn't work in Events List. Oh well.
|
||||
# $eventCycleStart = (WebGUI::DateTime::getDaysInInterval($eventStartDate,time)) if (($eventStartDate < time) && ($startsNow));
|
||||
# by default, stop processing this event at the end of its length.
|
||||
my $eventCycleStop = ($eventLength);
|
||||
#cycle through each day in the event, pushing the event's day listing into the proper day.
|
||||
for (my $i=$eventCycleStart; $i<=$eventCycleStop; $i++) {
|
||||
#create an array for the specific day in the event.
|
||||
my @date = WebGUI::DateTime::epochToArray(WebGUI::DateTime::addToDate($eventStartDate,0,0,$i));
|
||||
# if the event goes past the end of this month, halt the loop.
|
||||
# No need to continue processing days that aren't in this month.
|
||||
if ($monthEnd < (WebGUI::DateTime::addToDate($eventStartDate,0,0,$i) - 1)) {
|
||||
$i = ($eventCycleStop + 2);
|
||||
next;
|
||||
}
|
||||
#this conditional used to only test if we are in the proper month...
|
||||
#Now also test to see if we're at the maxDate yet and after the minDate.
|
||||
if (($date[1] == $thisMonthDate[1]) && (WebGUI::DateTime::addToDate($eventStartDate,0,0,$i) <= ($maxDate + 2678400))){
|
||||
push(@{$events{$date[2]}}, {
|
||||
description=>$event->getValue("description"),
|
||||
name=>$event->getValue("title"),
|
||||
'start.date.human'=>$startDate,
|
||||
'start.time.human'=>$startTime,
|
||||
'start.date.epoch'=>$eventStartDate,
|
||||
'start.year'=>$startYear,
|
||||
'start.month'=>$startMonth,
|
||||
'start.day'=>$startDay,
|
||||
'end.date.human'=>$endDate,
|
||||
'end.time.human'=>$endTime,
|
||||
'end.date.epoch'=>$eventEndDate,
|
||||
'end.year'=>$endYear,
|
||||
'end.month'=>$endMonth,
|
||||
'end.day'=>$endDay,
|
||||
'startEndYearMatch'=>($startYear eq $endYear),
|
||||
'startEndMonthMatch'=>($startMonth eq $endMonth),
|
||||
'startEndDayMatch'=>($startDay eq $endDay),
|
||||
isFirstDayOfEvent=>($i == 0),
|
||||
dateIsSameAsPrevious=>($startYear."-".$startMonth."-".$startDay eq $previous{start}
|
||||
&& $endYear."-".$endMonth."-".$endDay eq $previous{end}),
|
||||
daysInEvent=>($eventLength+1),
|
||||
url=>$event->getUrl()
|
||||
});
|
||||
$monthHasEvent = 1;
|
||||
$calHasEvent = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$previous{start} = $startYear."-".$startMonth."-".$startDay;
|
||||
$previous{end} = $endYear."-".$endMonth."-".$endDay;
|
||||
} elsif (ref $event eq "WebGUI::Asset::Relation") {
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
if (($startsNow || ($startMonth eq "first")) && ($calHasEvent == 0)) {
|
||||
#Let's process an extra month if this month had no events,
|
||||
#and if we're at the beginning of the calendar, and if
|
||||
#the calendar is supposed to start with the first event or now.
|
||||
$calMonthEnd++ unless $monthHasEvent;
|
||||
next unless $monthHasEvent;
|
||||
}
|
||||
my $dayOfWeekCounter = 1;
|
||||
my $firstDayInFirstWeek = WebGUI::DateTime::getFirstDayInMonthPosition($thisMonth);
|
||||
my $daysInMonth = WebGUI::DateTime::getDaysInMonth($thisMonth);
|
||||
my @prepad;
|
||||
while ($dayOfWeekCounter < $firstDayInFirstWeek) {
|
||||
push(@prepad,{
|
||||
count => $dayOfWeekCounter
|
||||
});
|
||||
$dayOfWeekCounter++;
|
||||
}
|
||||
my @date = WebGUI::DateTime::epochToArray($thisMonth);
|
||||
my @dayloop;
|
||||
for (my $dayCounter=1; $dayCounter <= $daysInMonth; $dayCounter++) {
|
||||
#----------------------------------------------------------------------------
|
||||
#sort each day's events here - still needs to be done!
|
||||
#----------------------------------------------------------------------------
|
||||
push(@dayloop, {
|
||||
dayOfWeek => $dayOfWeekCounter,
|
||||
day=>$dayCounter,
|
||||
isStartOfWeek=>($dayOfWeekCounter==1),
|
||||
isEndOfWeek=>($dayOfWeekCounter==7),
|
||||
isToday=>($date[0]."-".$date[1]."-".$dayCounter eq $now[0]."-".$now[1]."-".$now[2]),
|
||||
event_loop=>\@{$events{$dayCounter}},
|
||||
url=>$events{$dayCounter}->[0]->{url}
|
||||
});
|
||||
if ($dayOfWeekCounter == 7) {
|
||||
$dayOfWeekCounter = 1;
|
||||
} else {
|
||||
$dayOfWeekCounter++;
|
||||
}
|
||||
}
|
||||
my @postpad;
|
||||
while ($dayOfWeekCounter <= 7 && $dayOfWeekCounter > 1) {
|
||||
push(@postpad,{
|
||||
count => $dayOfWeekCounter
|
||||
});
|
||||
$dayOfWeekCounter++;
|
||||
}
|
||||
push(@$monthloop, {
|
||||
'daysInMonth'=>$daysInMonth,
|
||||
'day_loop'=>\@dayloop,
|
||||
'prepad_loop'=>\@prepad,
|
||||
'postpad_loop'=>\@postpad,
|
||||
'month'=>WebGUI::DateTime::getMonthName($date[1]),
|
||||
'year'=>$date[0]
|
||||
});
|
||||
}
|
||||
my %var;
|
||||
if (($date[1] == $thisMonthDate[1]) && (WebGUI::DateTime::addToDate($eventStartDate,0,0,$i) <= ($maxDate + 2678400))){
|
||||
push(@{$events{$date[2]}}, {
|
||||
description=>$event->getValue("description"),
|
||||
name=>$event->getValue("title"),
|
||||
'start.date.human'=>$startDate,
|
||||
'start.time.human'=>$startTime,
|
||||
'start.date.epoch'=>$eventStartDate,
|
||||
'start.year'=>$startYear,
|
||||
'start.month'=>$startMonth,
|
||||
'start.day'=>$startDay,
|
||||
'end.date.human'=>$endDate,
|
||||
'end.time.human'=>$endTime,
|
||||
'end.date.epoch'=>$eventEndDate,
|
||||
'end.year'=>$endYear,
|
||||
'end.month'=>$endMonth,
|
||||
'end.day'=>$endDay,
|
||||
'startEndYearMatch'=>($startYear eq $endYear),
|
||||
'startEndMonthMatch'=>($startMonth eq $endMonth),
|
||||
'startEndDayMatch'=>($startDay eq $endDay),
|
||||
isFirstDayOfEvent=>($i == 0),
|
||||
dateIsSameAsPrevious=>($startYear."-".$startMonth."-".$startDay eq $previous{start}
|
||||
&& $endYear."-".$endMonth."-".$endDay eq $previous{end}),
|
||||
daysInEvent=>($eventLength+1),
|
||||
url=>$event->getUrl()
|
||||
});
|
||||
$monthHasEvent = 1;
|
||||
$calHasEvent = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$previous{start} = $startYear."-".$startMonth."-".$startDay;
|
||||
$previous{end} = $endYear."-".$endMonth."-".$endDay;
|
||||
} elsif (ref $event eq "WebGUI::Asset::Relation") {
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
if (($startsNow || ($startMonth eq "first")) && ($calHasEvent == 0)) {
|
||||
#Let's process an extra month if this month had no events,
|
||||
#and if we're at the beginning of the calendar, and if
|
||||
#the calendar is supposed to start with the first event or now.
|
||||
$calMonthEnd++ unless $monthHasEvent;
|
||||
next unless $monthHasEvent;
|
||||
}
|
||||
my $dayOfWeekCounter = 1;
|
||||
my $firstDayInFirstWeek = WebGUI::DateTime::getFirstDayInMonthPosition($thisMonth);
|
||||
my $daysInMonth = WebGUI::DateTime::getDaysInMonth($thisMonth);
|
||||
my @prepad;
|
||||
while ($dayOfWeekCounter < $firstDayInFirstWeek) {
|
||||
push(@prepad,{
|
||||
count => $dayOfWeekCounter
|
||||
});
|
||||
$dayOfWeekCounter++;
|
||||
}
|
||||
my @date = WebGUI::DateTime::epochToArray($thisMonth);
|
||||
my @dayloop;
|
||||
for (my $dayCounter=1; $dayCounter <= $daysInMonth; $dayCounter++) {
|
||||
#----------------------------------------------------------------------------
|
||||
#sort each day's events here - still needs to be done!
|
||||
#----------------------------------------------------------------------------
|
||||
push(@dayloop, {
|
||||
dayOfWeek => $dayOfWeekCounter,
|
||||
day=>$dayCounter,
|
||||
isStartOfWeek=>($dayOfWeekCounter==1),
|
||||
isEndOfWeek=>($dayOfWeekCounter==7),
|
||||
isToday=>($date[0]."-".$date[1]."-".$dayCounter eq $now[0]."-".$now[1]."-".$now[2]),
|
||||
event_loop=>\@{$events{$dayCounter}},
|
||||
url=>$events{$dayCounter}->[0]->{url}
|
||||
});
|
||||
if ($dayOfWeekCounter == 7) {
|
||||
$dayOfWeekCounter = 1;
|
||||
} else {
|
||||
$dayOfWeekCounter++;
|
||||
}
|
||||
}
|
||||
my @postpad;
|
||||
while ($dayOfWeekCounter <= 7 && $dayOfWeekCounter > 1) {
|
||||
push(@postpad,{
|
||||
count => $dayOfWeekCounter
|
||||
});
|
||||
$dayOfWeekCounter++;
|
||||
}
|
||||
push(@$monthloop, {
|
||||
'daysInMonth'=>$daysInMonth,
|
||||
'day_loop'=>\@dayloop,
|
||||
'prepad_loop'=>\@prepad,
|
||||
'postpad_loop'=>\@postpad,
|
||||
'month'=>WebGUI::DateTime::getMonthName($date[1]),
|
||||
'year'=>$date[0]
|
||||
});
|
||||
}
|
||||
my %var;
|
||||
$var{month_loop} = \@$monthloop;
|
||||
# $var{"canManage"} = $self->canManage;
|
||||
$var{"addevent.url"} = $self->getUrl().'?func=addStyledEvent&class=WebGUI::Asset::Event';
|
||||
$var{"addevent.label"} = WebGUI::International::get(20,"EventsCalendar");
|
||||
$var{'sunday.label'} = WebGUI::DateTime::getDayName(7);
|
||||
$var{'monday.label'} = WebGUI::DateTime::getDayName(1);
|
||||
$var{'tuesday.label'} = WebGUI::DateTime::getDayName(2);
|
||||
$var{'wednesday.label'} = WebGUI::DateTime::getDayName(3);
|
||||
$var{'thursday.label'} = WebGUI::DateTime::getDayName(4);
|
||||
$var{'friday.label'} = WebGUI::DateTime::getDayName(5);
|
||||
$var{'saturday.label'} = WebGUI::DateTime::getDayName(6);
|
||||
$var{'sunday.label.short'} = substr(WebGUI::DateTime::getDayName(7),0,1);
|
||||
$var{'monday.label.short'} = substr(WebGUI::DateTime::getDayName(1),0,1);
|
||||
$var{'tuesday.label.short'} = substr(WebGUI::DateTime::getDayName(2),0,1);
|
||||
$var{'wednesday.label.short'} = substr(WebGUI::DateTime::getDayName(3),0,1);
|
||||
$var{'thursday.label.short'} = substr(WebGUI::DateTime::getDayName(4),0,1);
|
||||
$var{'friday.label.short'} = substr(WebGUI::DateTime::getDayName(5),0,1);
|
||||
$var{'saturday.label.short'} = substr(WebGUI::DateTime::getDayName(6),0,1);
|
||||
#use Data::Dumper; return '<pre>'.Dumper(\%var).'</pre>';
|
||||
my $vars = \%var;
|
||||
return $self->processTemplate($vars,$self->get("templateId"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
# $var{"canManage"} = $self->canManage;
|
||||
$var{"addevent.url"} = $self->getUrl().'?func=addStyledEvent&class=WebGUI::Asset::Event';
|
||||
$var{"addevent.label"} = WebGUI::International::get(20,"EventsCalendar");
|
||||
$var{'sunday.label'} = WebGUI::DateTime::getDayName(7);
|
||||
$var{'monday.label'} = WebGUI::DateTime::getDayName(1);
|
||||
$var{'tuesday.label'} = WebGUI::DateTime::getDayName(2);
|
||||
$var{'wednesday.label'} = WebGUI::DateTime::getDayName(3);
|
||||
$var{'thursday.label'} = WebGUI::DateTime::getDayName(4);
|
||||
$var{'friday.label'} = WebGUI::DateTime::getDayName(5);
|
||||
$var{'saturday.label'} = WebGUI::DateTime::getDayName(6);
|
||||
$var{'sunday.label.short'} = substr(WebGUI::DateTime::getDayName(7),0,1);
|
||||
$var{'monday.label.short'} = substr(WebGUI::DateTime::getDayName(1),0,1);
|
||||
$var{'tuesday.label.short'} = substr(WebGUI::DateTime::getDayName(2),0,1);
|
||||
$var{'wednesday.label.short'} = substr(WebGUI::DateTime::getDayName(3),0,1);
|
||||
$var{'thursday.label.short'} = substr(WebGUI::DateTime::getDayName(4),0,1);
|
||||
$var{'friday.label.short'} = substr(WebGUI::DateTime::getDayName(5),0,1);
|
||||
$var{'saturday.label.short'} = substr(WebGUI::DateTime::getDayName(6),0,1);
|
||||
#use Data::Dumper; return '<pre>'.Dumper(\%var).'</pre>';
|
||||
my $vars = \%var;
|
||||
return $self->processTemplate($vars,$self->get("templateId"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_addStyledEvent ( )
|
||||
|
|
@ -495,15 +495,15 @@ sub www_addStyledEvent {
|
|||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
$self->getAdminConsole->setHelp("events calendar add/edit");
|
||||
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get("12","EventsCalendar"));
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
|
||||
$self->getAdminConsole->setHelp("events calendar add/edit");
|
||||
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get("12","EventsCalendar"));
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue