You can now arrange events calendar entries by time.
This commit is contained in:
parent
c645a1908f
commit
423ff3e223
3 changed files with 38 additions and 11 deletions
|
|
@ -326,6 +326,14 @@ The the base name for this form element. This form element actually returns two
|
|||
|
||||
The date and time. Pass as an epoch value. Defaults to today and now.
|
||||
|
||||
=item dateExtras
|
||||
|
||||
Extra parameters to add to the date form element such as javascript or stylesheet information.
|
||||
|
||||
=item timeExtras
|
||||
|
||||
Extra parameters to add to the time form element such as javascript or stylesheet information.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
@ -333,11 +341,13 @@ The date and time. Pass as an epoch value. Defaults to today and now.
|
|||
sub dateTime {
|
||||
my $output = date({
|
||||
name=>$_[0]->{name}."_date",
|
||||
value=>$_[0]->{value}
|
||||
value=>$_[0]->{value},
|
||||
extras=>$_[0]->{dateExtras}
|
||||
});
|
||||
$output .= time({
|
||||
name=>$_[0]->{name}."_time",
|
||||
value=>WebGUI::DateTime::getSecondsFromEpoch($_[0]->{value})
|
||||
value=>WebGUI::DateTime::getSecondsFromEpoch($_[0]->{value}),
|
||||
extras=>$_[0]->{timeExtras}
|
||||
});
|
||||
return $output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -482,7 +482,7 @@ sub date {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 dateTime ( name [ label, value, subtext, uiLevel ] )
|
||||
=head2 dateTime ( name [ label, value, subtext, uiLevel, dateExtras, timeExtras ] )
|
||||
|
||||
Adds a date time row to this form.
|
||||
|
||||
|
|
@ -508,6 +508,14 @@ Extra text to describe this form element or to provide special instructions.
|
|||
|
||||
The UI level for this field. See the WebGUI developer's site for details. Defaults to "0".
|
||||
|
||||
=item dateExtras
|
||||
|
||||
Extra parameters such as javascript or style sheet information that you wish to add to the date form element.
|
||||
|
||||
=item timeExtras
|
||||
|
||||
Extra parameters such as javascript or style sheet information that you wish to add to the time form element.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
@ -515,11 +523,14 @@ The UI level for this field. See the WebGUI developer's site for details. Defaul
|
|||
sub dateTime {
|
||||
my ($output);
|
||||
my ($self, @p) = @_;
|
||||
my ($name, $label, $value, $subtext, $uiLevel) = rearrange([qw(name label value subtext uiLevel)], @p);
|
||||
my ($name, $label, $value, $subtext, $uiLevel, $dateExtras, $timeExtras) =
|
||||
rearrange([qw(name label value subtext uiLevel dateExtras timeExtras)], @p);
|
||||
if (_uiLevelChecksOut($uiLevel)) {
|
||||
$output = WebGUI::Form::dateTime({
|
||||
"name"=>$name,
|
||||
"value"=>$value
|
||||
"value"=>$value,
|
||||
"dateExtras"=>$dateExtras,
|
||||
"timeExtras"=>$timeExtras
|
||||
});
|
||||
$output .= _subtext($subtext);
|
||||
$output = $self->_tableFormRow($label,$output);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use strict;
|
|||
use HTML::CalendarMonthSimple;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::FormProcessor;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::International;
|
||||
|
|
@ -336,13 +337,18 @@ sub www_editEvent {
|
|||
$f->hidden("func","editEventSave");
|
||||
$f->text("name",WebGUI::International::get(99),$event{name});
|
||||
$f->HTMLArea("description",WebGUI::International::get(85),$event{description});
|
||||
$f->date("startDate",WebGUI::International::get(14,$_[0]->get("namespace")),$event{startDate},
|
||||
'onBlur="this.form.endDate.value=this.form.startDate.value;this.form.until.value=this.form.startDate.value;"');
|
||||
$f->date(
|
||||
$f->dateTime(
|
||||
-name=>"startDate",
|
||||
-label=>WebGUI::International::get(14,$_[0]->get("namespace")),
|
||||
-value=>$event{startDate},
|
||||
-dateExtras=>'onBlur="this.form.endDate_date.value=this.form.startDate_date.value;this.form.until.value=this.form.startDate_date.value;"',
|
||||
-timeExtras=>'onBlur="this.form.endDate_time.value=this.form.startDate_time.value"'
|
||||
);
|
||||
$f->dateTime(
|
||||
-name=>"endDate",
|
||||
-label=>WebGUI::International::get(15,$_[0]->get("namespace")),
|
||||
-value=>$event{endDate},
|
||||
-extras=>'onBlur="this.form.until.value=this.form.endDate.value;"'
|
||||
-dateExtras=>'onBlur="this.form.until.value=this.form.endDate_date.value;"'
|
||||
);
|
||||
$f->raw($special);
|
||||
if ($session{form}{eid} eq "new") {
|
||||
|
|
@ -363,9 +369,9 @@ sub www_editEvent {
|
|||
sub www_editEventSave {
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
|
||||
my (@startDate, @endDate, $until, @eventId, $i, $recurringEventId);
|
||||
$startDate[0] = setToEpoch($session{form}{startDate});
|
||||
$startDate[0] = WebGUI::FormProcessor::dateTime("startDate");
|
||||
$startDate[0] = time() unless ($startDate[0] > 0);
|
||||
$endDate[0] = setToEpoch($session{form}{endDate});
|
||||
$endDate[0] = WebGUI::FormProcessor::dateTime("endDate");
|
||||
$endDate[0] = $startDate[0] unless ($endDate[0] >= $startDate[0]);
|
||||
if ($session{form}{eid} eq "new") {
|
||||
$session{form}{name} = $session{form}{name} || "unnamed";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue