cvsuser 05/09/27 09:51:28
Modified: App-Context/lib/App Context.pm
Log:
default dates can be {today}+6. context->widget() now defaults to class
App::Widget
Revision Changes Path
1.22 +11 -4 p5ee/App-Context/lib/App/Context.pm
Index: Context.pm
===================================================================
RCS file: /cvs/public/p5ee/App-Context/lib/App/Context.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- Context.pm 9 Aug 2005 19:11:17 -0000 1.21
+++ Context.pm 27 Sep 2005 16:51:28 -0000 1.22
@@ -579,8 +579,8 @@
if (defined $service->{default}) {
$default = $service->{default};
- if ($default eq "{today}") {
- $default = time2str("%Y-%m-%d",time);
+ if ($default =~ /^\{today\}\+?(-?[0-9]+)?$/) {
+ $default = time2str("%Y-%m-%d",time + 2*3600 + ($1 ?
($1*3600*24) : 0));
}
if (defined $default) {
$self->so_get($name, "", $default, 1);
@@ -673,9 +673,16 @@
# Extended Services: provided in the App-Widget and App-Repository
distributions
# this is kind of cheating for the core to know about the extensions, but OK
-sub widget { my $self = shift; return
$self->service("SessionObject",@_); }
sub template_engine { my $self = shift; return
$self->service("TemplateEngine",@_); }
sub repository { my $self = shift; return
$self->service("Repository",@_); }
+sub widget {
+ my $self = shift;
+ my @args = @_;
+ if ($#args <= 0) {
+ push(@args, ("class", "App::Widget"));
+ }
+ return $self->service("SessionObject",@args);
+}
#############################################################################
# session_object_exists()