You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(18) |
Dec
(30) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(20) |
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ix...@us...> - 2002-02-06 17:41:30
|
ixjonez 02/02/06 09:41:28 Modified: lib/LiveFrame/Lab ConfirmAction.pm GalleryAction.pm ImageAction.pm NotifyAction.pm ReviewAction.pm Log: actions now return page names rather than processing pages themselves. Revision Changes Path 1.2 +1 -1 lab/lib/LiveFrame/Lab/ConfirmAction.pm Index: ConfirmAction.pm =================================================================== RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/ConfirmAction.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ConfirmAction.pm 2001/11/30 01:03:03 1.1 +++ ConfirmAction.pm 2002/02/06 17:41:27 1.2 @@ -10,7 +10,7 @@ sub perform { my ($self, $lab) = @_; - return $lab->send_page('confirm'); + return 'confirm'; } 1; 1.6 +1 -1 lab/lib/LiveFrame/Lab/GalleryAction.pm Index: GalleryAction.pm =================================================================== RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/GalleryAction.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- GalleryAction.pm 2002/01/04 01:10:51 1.5 +++ GalleryAction.pm 2002/02/06 17:41:27 1.6 @@ -35,7 +35,7 @@ $gallery->create(); $site->insert_gallery($gallery, $pos); - return $lab->send_page('image'); + return 'image'; } 1; 1.2 +1 -1 lab/lib/LiveFrame/Lab/ImageAction.pm Index: ImageAction.pm =================================================================== RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/ImageAction.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ImageAction.pm 2001/11/30 01:03:03 1.1 +++ ImageAction.pm 2002/02/06 17:41:27 1.2 @@ -10,7 +10,7 @@ sub perform { my ($self, $lab) = @_; - return $lab->send_page('image'); + return 'image'; } 1; 1.2 +1 -1 lab/lib/LiveFrame/Lab/NotifyAction.pm Index: NotifyAction.pm =================================================================== RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/NotifyAction.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- NotifyAction.pm 2001/11/30 01:03:03 1.1 +++ NotifyAction.pm 2002/02/06 17:41:27 1.2 @@ -10,7 +10,7 @@ sub perform { my ($self, $lab) = @_; - return $lab->send_page('notify'); + return 'notify'; } 1; 1.2 +1 -1 lab/lib/LiveFrame/Lab/ReviewAction.pm Index: ReviewAction.pm =================================================================== RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/ReviewAction.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ReviewAction.pm 2001/11/30 01:03:03 1.1 +++ ReviewAction.pm 2002/02/06 17:41:27 1.2 @@ -10,7 +10,7 @@ sub perform { my ($self, $lab) = @_; - return $lab->send_page('review'); + return 'review'; } 1; |
From: <ix...@us...> - 2002-02-06 17:40:56
|
ixjonez 02/02/06 09:40:55 Added: lib/LiveFrame/Lab ImageForm.pm Log: add form class for image manipulation form Revision Changes Path 1.1 lab/lib/LiveFrame/Lab/ImageForm.pm Index: ImageForm.pm =================================================================== # -*- Mode: Perl; indent-tabs-mode: nil; -*- package LiveFrame::Lab::ImageForm; use strict; use LiveFrame::Errors (); use LiveFrame::Form (); @LiveFrame::Lab::ImageForm::ISA = ('LiveFrame::Form'); sub gallery_dir { my $self = shift; $self->field('gallery_dir', shift) if @_; return $self->field('gallery_dir'); } sub site_dir { my $self = shift; $self->field('site_dir', shift) if @_; return $self->field('site_dir'); } sub upload_photo_dir { my $self = shift; $self->field('upload_photo_dir', shift) if @_; return $self->field('upload_photo_dir'); } sub validate { my ($self, $lab) = @_; my $gallery_dir = $self->gallery_dir(); my $site_dir = $self->site_dir(); my $upload_photo_dir = $self->upload_photo_dir(); unless (defined $gallery_dir && defined $site_dir && defined $upload_photo_dir) { my $errors = LiveFrame::Errors->new(); defined $gallery_dir or $errors->add_error('gallery directory not specified'); defined $site_dir or $errors->add_error('gallery site not specified'); defined $upload_photo_dir or $errors->add_error('upload directory not specified'); die $errors; } return 1; } 1; |
From: <ix...@us...> - 2002-02-06 17:40:36
|
ixjonez 02/02/06 09:40:36 Modified: bin lab.PL Log: add image action and opts. when populating a form, look for an opt for every field defined on the form. Revision Changes Path 1.3 +7 -3 lab/bin/lab.PL Index: lab.PL =================================================================== RCS file: /cvsroot/liveframe/lab/bin/lab.PL,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- lab.PL 2002/01/07 18:25:08 1.2 +++ lab.PL 2002/02/06 17:40:35 1.3 @@ -69,6 +69,7 @@ use constant FORMS => { gallery => 'spec', + image => 'image', }; # variable declarations (configurable) @@ -76,6 +77,7 @@ my ($opt_debug, $opt_help, $opt_version); # make visible for use in symbolic refs later use vars qw($opt_site_dir $opt_gallery_dir $opt_gallery_position); +use vars qw($opt_img_caption $opt_img_orientation); # process command line options Getopt::Long::GetOptions( @@ -83,6 +85,8 @@ "s=s" => \$opt_site_dir, "g=s" => \$opt_gallery_dir, "p=s" => \$opt_gallery_position, + "c=s" => \$opt_img_caption, + "o=s" => \$opt_img_orientation, "d" => \$opt_debug, "h" => \$opt_help, "v" => \$opt_version, @@ -137,10 +141,10 @@ } # load up the form with command line options -for (qw(site_dir gallery_dir gallery_position)) { +for my $field ($form->fields())) { no strict 'refs'; - my $opt = join '_', 'opt', $_; - $form->$_($$opt) if defined $$opt; + my $opt = join '_', 'opt', $field; + $form->$field($$opt) if defined $$opt; } # validate the form |
From: <ix...@us...> - 2002-02-06 17:37:19
|
ixjonez 02/02/06 09:37:17 Log: imported gallery demo Status: Vendor Tag: LIVEFRAME Release Tags: INIT N gallery-demo/liveframe.cgi N gallery-demo/index.html N gallery-demo/lfdir/index.html N gallery-demo/lfdir/templates/display.tmpl N gallery-demo/lfdir/templates/error.tmpl N gallery-demo/lfdir/templates/navsize.tmpl N gallery-demo/lfdir/templates/photononav.tmpl N gallery-demo/lfdir/templates/lfstyles.css N gallery-demo/lfdir/templates/starttop.tmpl N gallery-demo/lfdir/templates/frameset.tmpl N gallery-demo/lfdir/templates/galleryindextop.tmpl N gallery-demo/lfdir/templates/galleryindexbottom.tmpl N gallery-demo/lfdir/templates/galleryindexitem.tmpl N gallery-demo/lfdir/templates/startbottom.tmpl N gallery-demo/lfdir/templates/startmiddle.tmpl N gallery-demo/lfdir/templates/photo.tmpl N gallery-demo/lfdir/templates/navright.tmpl N gallery-demo/lfdir/templates/navleft.tmpl N gallery-demo/lfdir/templates/navslide.tmpl N gallery-demo/lfdir/templates/previewtop.tmpl N gallery-demo/lfdir/templates/previewbottom.tmpl N gallery-demo/lfdir/templates/previewmiddle.tmpl N gallery-demo/lfdir/templates/index.html N gallery-demo/lfdir/templates/img/useslideshow.gif N gallery-demo/lfdir/templates/img/dotgrey.gif N gallery-demo/lfdir/templates/img/dotwhite.gif N gallery-demo/lfdir/templates/img/forward.gif N gallery-demo/lfdir/templates/img/hidenav.gif N gallery-demo/lfdir/templates/img/left.gif N gallery-demo/lfdir/templates/img/leftgal.gif N gallery-demo/lfdir/templates/img/leftsm.gif N gallery-demo/lfdir/templates/img/liveframe.gif N gallery-demo/lfdir/templates/img/resize.gif N gallery-demo/lfdir/templates/img/right.gif N gallery-demo/lfdir/templates/img/rightgal.gif N gallery-demo/lfdir/templates/img/rightsm.gif N gallery-demo/lfdir/templates/img/shownav.gif N gallery-demo/lfdir/templates/img/no.gif N gallery-demo/lfdir/templates/img/slideshow.gif N gallery-demo/lfdir/templates/img/slideshowpause.gif N gallery-demo/lfdir/templates/img/usearrows.gif N gallery-demo/lfdir/templates/img/usepreviews.gif N gallery-demo/lfdir/templates/img/back.gif N gallery-demo/lfdir/galleries/hidden.conf N gallery-demo/lfdir/galleries/order.conf N gallery-demo/lfdir/galleries/sample/config N gallery-demo/lfdir/galleries/sample/display/water.jpg N gallery-demo/lfdir/galleries/sample/display/engine.jpg N gallery-demo/lfdir/galleries/sample/display/engineless.jpg N gallery-demo/lfdir/galleries/sample/display/jal.jpg N gallery-demo/lfdir/galleries/sample/display/site.jpg N gallery-demo/lfdir/galleries/sample/display/tenerife.jpg N gallery-demo/lfdir/galleries/sample/display/united.jpg N gallery-demo/lfdir/galleries/sample/display/boac.jpg N gallery-demo/lfdir/galleries/sample/preview/water.jpg N gallery-demo/lfdir/galleries/sample/preview/engine.jpg N gallery-demo/lfdir/galleries/sample/preview/engineless.jpg N gallery-demo/lfdir/galleries/sample/preview/jal.jpg N gallery-demo/lfdir/galleries/sample/preview/site.jpg N gallery-demo/lfdir/galleries/sample/preview/tenerife.jpg N gallery-demo/lfdir/galleries/sample/preview/united.jpg N gallery-demo/lfdir/galleries/sample/preview/boac.jpg N gallery-demo/lfdir/galleries/sample2/config N gallery-demo/lfdir/galleries/sample2/large/lagoonnebula.jpg N gallery-demo/lfdir/galleries/sample2/large/cygnusloop.jpg N gallery-demo/lfdir/galleries/sample2/large/etacarinae.jpg N gallery-demo/lfdir/galleries/sample2/large/abell2218.jpg N gallery-demo/lfdir/galleries/sample2/large/m100nucleus.jpg N gallery-demo/lfdir/galleries/sample2/large/nebulam2-9.jpg N gallery-demo/lfdir/galleries/sample2/large/ngc4039.jpg N gallery-demo/lfdir/galleries/sample2/preview/lagoonnebula.jpg N gallery-demo/lfdir/galleries/sample2/preview/cygnusloop.jpg N gallery-demo/lfdir/galleries/sample2/preview/etacarinae.jpg N gallery-demo/lfdir/galleries/sample2/preview/abell2218.jpg N gallery-demo/lfdir/galleries/sample2/preview/m100nucleus.jpg N gallery-demo/lfdir/galleries/sample2/preview/nebulam2-9.jpg N gallery-demo/lfdir/galleries/sample2/preview/ngc4039.jpg N gallery-demo/lfdir/galleries/sample2/small/lagoonnebula.jpg N gallery-demo/lfdir/galleries/sample2/small/cygnusloop.jpg N gallery-demo/lfdir/galleries/sample2/small/etacarinae.jpg N gallery-demo/lfdir/galleries/sample2/small/abell2218.jpg N gallery-demo/lfdir/galleries/sample2/small/m100nucleus.jpg N gallery-demo/lfdir/galleries/sample2/small/nebulam2-9.jpg N gallery-demo/lfdir/galleries/sample2/small/ngc4039.jpg N gallery-demo/lfdir/galleries/sample3/config N gallery-demo/lfdir/galleries/sample3/display/eleanorroosevelt.jpg N gallery-demo/lfdir/galleries/sample3/display/ellenaxson.jpg N gallery-demo/lfdir/galleries/sample3/display/jacquelinebouvierkennedy.jpg N gallery-demo/lfdir/galleries/sample3/display/mamieeisenhower.jpg N gallery-demo/lfdir/galleries/sample3/display/patnixon.jpg N gallery-demo/lfdir/galleries/sample3/display/rosalynncarter.jpg N gallery-demo/lfdir/galleries/sample3/preview/eleanorroosevelt.jpg N gallery-demo/lfdir/galleries/sample3/preview/ellenaxson.jpg N gallery-demo/lfdir/galleries/sample3/preview/jacquelinebouvierkennedy.jpg N gallery-demo/lfdir/galleries/sample3/preview/mamieeisenhower.jpg N gallery-demo/lfdir/galleries/sample3/preview/patnixon.jpg N gallery-demo/lfdir/galleries/sample3/preview/rosalynncarter.jpg N gallery-demo/docs/UPGRADE N gallery-demo/docs/README N gallery-demo/docs/INSTALL N gallery-demo/docs/CHANGES No conflicts created by this import |
From: <ix...@us...> - 2002-01-07 21:30:56
|
ixjonez 02/01/07 13:30:56 Modified: . config Log: turn off permission preservation Revision Changes Path 1.3 +1 -1 CVSROOT/config Index: config =================================================================== RCS file: /cvsroot/liveframe/CVSROOT/config,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- config 2001/11/29 23:15:52 1.2 +++ config 2002/01/07 21:30:56 1.3 @@ -3,7 +3,7 @@ # Set `PreservePermissions' to `yes' to save file status information # in the repository. -PreservePermissions=no +#PreservePermissions=yes # Set `TopLevelAdmin' to `yes' to create a CVS directory at the top # level of the new working directory when using the `cvs checkout' |
From: <ix...@us...> - 2002-01-07 18:46:09
|
ixjonez 02/01/07 10:46:08 Modified: lib/LiveFrame Tag: p`¶@°è °è ¨Ì àÅ x¶@x¶@8È 8È ¶@¶@¶@¶@¶@¶@Ðy Ðy ¨¶@¨¶@Û Û ¸¶@¸¶@`Ü `Ü Ã Ã Ã Ã ¨Ç ¨Ç à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@ /tmp/cvs-serv15347/lib/LiveFrame/Site.pm No tag Site.pm Log: if the specified gallery position is out of bounds, just put the gallery on the end of the list. Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.5 +4 -2 commons/lib/LiveFrame/Site.pm Index: /tmp/cvs-serv15347/lib/LiveFrame/Site.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Site.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /tmp/cvs-serv15347/lib/LiveFrame/Site.pm 2002/01/04 01:12:53 1.4 +++ /tmp/cvs-serv15347/lib/LiveFrame/Site.pm 2002/01/07 18:46:08 1.5 @@ -68,8 +68,10 @@ $self->galleries(); my $num_galleries = $self->num_galleries(); - # if no position was indicated, push the gallery on the end of the list - $pos = $num_galleries unless defined $pos; + # if no position was indicated or if the position is out of bounds, push + # the gallery on the end of the list + $pos = $num_galleries if (! defined $pos || + defined $pos && $pos > $num_galleries); if ($pos == $num_galleries) { # we can simply add the new gallery to the end No revision No revision 1.5 +4 -2 commons/lib/LiveFrame/Site.pm Index: Site.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Site.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Site.pm 2002/01/04 01:12:53 1.4 +++ Site.pm 2002/01/07 18:46:08 1.5 @@ -68,8 +68,10 @@ $self->galleries(); my $num_galleries = $self->num_galleries(); - # if no position was indicated, push the gallery on the end of the list - $pos = $num_galleries unless defined $pos; + # if no position was indicated or if the position is out of bounds, push + # the gallery on the end of the list + $pos = $num_galleries if (! defined $pos || + defined $pos && $pos > $num_galleries); if ($pos == $num_galleries) { # we can simply add the new gallery to the end |
From: <ix...@us...> - 2002-01-07 18:28:50
|
ixjonez 02/01/07 10:28:49 Modified: lib/LiveFrame Tag: ðû `¶@hæ hæ àÛ XÅ Â Â hÇ hÇ ¶@¶@¶@¶@¶@¶@ ¶@ ¶@¨¶@¨¶@°¶@°¶@¸¶@¸¶@À¶@À¶@ȶ@ȶ@ж@ж@ØÆ ØÆ à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@à à ·@·@·@·@·@·@ ·@ ·@(·@(·@0·@0·@8·@8·@@·@@·@H·@H·@Ú Ú X·@X·@`·@`·@h·@h·@p·@p·@x·@x·@·@·@·@·@·@·@·@·@ ·@ ·@¨·@¨·@°·@°·@¸·@¸·@À·@À·@È·@È·@з@з@Ø·@Ø·@à·@à·@è·@è·@ð·@ð·@ø·@ø·@ /tmp/cvs-serv10555/lib/LiveFrame/Gallery.pm No tag Gallery.pm Log: uuv crusher Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.5 +2 -2 commons/lib/LiveFrame/Gallery.pm Index: /tmp/cvs-serv10555/lib/LiveFrame/Gallery.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Gallery.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /tmp/cvs-serv10555/lib/LiveFrame/Gallery.pm 2002/01/04 01:11:35 1.4 +++ /tmp/cvs-serv10555/lib/LiveFrame/Gallery.pm 2002/01/07 18:28:49 1.5 @@ -77,8 +77,8 @@ die "can't write $config_file: $!\n"; binmode CONFIG; - my $title = $self->title(); - my $description = $self->description(); + my $title = $self->title() || ''; + my $description = $self->description() || ''; print CONFIG <<EOT; # LiveFrame configuration file No revision No revision 1.5 +2 -2 commons/lib/LiveFrame/Gallery.pm Index: Gallery.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Gallery.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Gallery.pm 2002/01/04 01:11:35 1.4 +++ Gallery.pm 2002/01/07 18:28:49 1.5 @@ -77,8 +77,8 @@ die "can't write $config_file: $!\n"; binmode CONFIG; - my $title = $self->title(); - my $description = $self->description(); + my $title = $self->title() || ''; + my $description = $self->description() || ''; print CONFIG <<EOT; # LiveFrame configuration file |
From: <ix...@us...> - 2002-01-07 18:28:32
|
ixjonez 02/01/07 10:28:31 Modified: lib/LiveFrame Tag: `þ `¶@h¶@h¶@ঠH Pv P P ø¸ ø¸ ¶@¶@¶@¶@ ¶@ ¶@¨¶@¨¶@°¶@°¶@¸¶@¸¶@À¶@À¶@ȶ@ȶ@ж@ж@ض@ض@à¶@à¶@ X¸ ð¶@ð¶@ø¶@ø¶@ /tmp/cvs-serv10056/lib/LiveFrame/Application.pm No tag Application.pm Log: Application now sends the page itself, rather than delegating that behavior to the action's perform() method. this allows actions to be used for non-web applications as well. Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.3 +12 -18 commons/lib/LiveFrame/Application.pm Index: /tmp/cvs-serv10056/lib/LiveFrame/Application.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Application.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /tmp/cvs-serv10056/lib/LiveFrame/Application.pm 2002/01/04 00:23:41 1.2 +++ /tmp/cvs-serv10056/lib/LiveFrame/Application.pm 2002/01/07 18:28:31 1.3 @@ -598,31 +598,25 @@ # XXX: how to signal that an action requires a form submission? } - # if the action wasn't unset (usually by an invalid form - # submission), execute the action method, which will send a - # page when it completes + my $page; if ($action) { - eval { $action->perform($self, $form) }; + # execute the action and return the name of the next page + eval { $page = $action->perform($self, $form) }; if ($@) { $self->send_error($@); } } - - unless ($action) { + else { # no action exists for the specified action name so assume # it's a page name - # XXX: set a config switch to disable page sending? -# my $msg = sprintf("requested action [%s] not defined", -# $self->current_action_name()); -# $self->send_error($msg); -# return 0; - eval { - $self->send_page($self->current_action_name() || - $self->default_action_name()); - }; - if ($@) { - $self->send_error($@); - } + $page = $self->current_action_name() || $self->default_action_name(); + } + + eval { + $self->send_page($page); + }; + if ($@) { + $self->send_error($@); } return 0; No revision No revision 1.3 +12 -18 commons/lib/LiveFrame/Application.pm Index: Application.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Application.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Application.pm 2002/01/04 00:23:41 1.2 +++ Application.pm 2002/01/07 18:28:31 1.3 @@ -598,31 +598,25 @@ # XXX: how to signal that an action requires a form submission? } - # if the action wasn't unset (usually by an invalid form - # submission), execute the action method, which will send a - # page when it completes + my $page; if ($action) { - eval { $action->perform($self, $form) }; + # execute the action and return the name of the next page + eval { $page = $action->perform($self, $form) }; if ($@) { $self->send_error($@); } } - - unless ($action) { + else { # no action exists for the specified action name so assume # it's a page name - # XXX: set a config switch to disable page sending? -# my $msg = sprintf("requested action [%s] not defined", -# $self->current_action_name()); -# $self->send_error($msg); -# return 0; - eval { - $self->send_page($self->current_action_name() || - $self->default_action_name()); - }; - if ($@) { - $self->send_error($@); - } + $page = $self->current_action_name() || $self->default_action_name(); + } + + eval { + $self->send_page($page); + }; + if ($@) { + $self->send_error($@); } return 0; |
From: <ix...@us...> - 2002-01-07 18:25:09
|
ixjonez 02/01/07 10:25:08 Modified: bin Tag: Øà `¶@Ðà Ðà Hx @¯ °® °® ¶@¶@¶@¶@¶@¶@¶@¶@ ¶@ ¶@¨¶@¨¶@Ø® H« ¸¶@¸¶@À¶@À¶@ȶ@ȶ@ж@ж@ض@ض@à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@ /tmp/cvs-serv9141/bin/lab.PL No tag lab.PL Log: allow gallery position to be specified as a string instead of an integer, so that we can use the value 'hide' Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.2 +1 -1 lab/bin/lab.PL Index: /tmp/cvs-serv9141/bin/lab.PL =================================================================== RCS file: /cvsroot/liveframe/lab/bin/lab.PL,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /tmp/cvs-serv9141/bin/lab.PL 2002/01/04 00:29:57 1.1 +++ /tmp/cvs-serv9141/bin/lab.PL 2002/01/07 18:25:08 1.2 @@ -82,7 +82,7 @@ "f=s" => \$opt_config_file, "s=s" => \$opt_site_dir, "g=s" => \$opt_gallery_dir, - "p=i" => \$opt_gallery_position, + "p=s" => \$opt_gallery_position, "d" => \$opt_debug, "h" => \$opt_help, "v" => \$opt_version, No revision No revision 1.2 +1 -1 lab/bin/lab.PL Index: lab.PL =================================================================== RCS file: /cvsroot/liveframe/lab/bin/lab.PL,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- lab.PL 2002/01/04 00:29:57 1.1 +++ lab.PL 2002/01/07 18:25:08 1.2 @@ -82,7 +82,7 @@ "f=s" => \$opt_config_file, "s=s" => \$opt_site_dir, "g=s" => \$opt_gallery_dir, - "p=i" => \$opt_gallery_position, + "p=s" => \$opt_gallery_position, "d" => \$opt_debug, "h" => \$opt_help, "v" => \$opt_version, |
From: <ix...@us...> - 2002-01-04 01:12:54
|
ixjonez 02/01/03 17:12:53 Modified: lib/LiveFrame Tag: Ð `¶@Ü Ü °Ã ¸½ x¶@x¶@À À ¶@¶@¶@¶@¶@¶@ ¶@ ¶@¨¶@¨¶@°¶@°¶@¸¶@¸¶@ /tmp/cvs-serv20703/lib/LiveFrame/Site.pm No tag Site.pm Log: refactor config file writing. write files when a gallery is added. Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.4 +64 -32 commons/lib/LiveFrame/Site.pm Index: /tmp/cvs-serv20703/lib/LiveFrame/Site.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Site.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /tmp/cvs-serv20703/lib/LiveFrame/Site.pm 2002/01/04 00:27:03 1.3 +++ /tmp/cvs-serv20703/lib/LiveFrame/Site.pm 2002/01/04 01:12:53 1.4 @@ -94,6 +94,9 @@ $self->{galleries} = $new; } + $self->write_hidden_file() if $gallery->hidden(); + $self->write_order_file(); + return 1; } @@ -107,48 +110,19 @@ $perms ||= 0755; if ($self->exists()) { - die "can't create: site previously exists\n"; + die "can't create site ", $self->path(), ": site previously exists\n"; } my $old_umask = umask; umask 0000; my $path = $self->path(); - warn "mkpath $path\n"; File::Path::mkpath($path, undef, $perms) or die "can't mkdir $path: $!\n"; - - my $order_file = $self->order_file(); - sysopen ORDER, $order_file, Fcntl::O_WRONLY|Fcntl::O_CREAT, 0644 or - die "can't write $order_file: $!\n"; - binmode ORDER; - print ORDER <<EOT; -# -# to specify the order of LiveFrame galleries manually, set the manual -# gallery ordering variable in your liveframe script to "yes" and enter -# the name of each gallery directory, each on it's own line, below. -# -EOT - close ORDER; + $self->write_order_file(); + $self->write_hidden_file(); - my $hidden_file = $self->hidden_file(); - sysopen HIDDEN, $hidden_file, Fcntl::O_WRONLY|Fcntl::O_CREAT, 0644 or - die "can't write $hidden_file: $!\n"; - binmode HIDDEN; - print HIDDEN <<EOT; -# -# to prevent LiveFrame galleries from being displayed in the gallery -# index or in the previous/next gallery interface on the start page, -# enter their names, each on it's own line, below. -# -# e.g.; to hide the gallery "sample" from the index, uncomment the -# following line: -# - -EOT - close HIDDEN; - umask $old_umask; $self->{exists} = 1; @@ -235,6 +209,64 @@ sub order_file { my ($self) = @_; return File::Spec->catfile($self->path(), ORDER_FILE); +} + +sub write_hidden_file { + my $self = shift; + + my $hidden_file = $self->hidden_file(); + sysopen HIDDEN, $hidden_file, Fcntl::O_WRONLY|Fcntl::O_CREAT, 0644 or + die "can't write $hidden_file: $!\n"; + binmode HIDDEN; + + print HIDDEN <<EOT; +# +# to prevent LiveFrame galleries from being displayed in the gallery +# index or in the previous/next gallery interface on the start page, +# enter their names, each on it's own line, below. +# +# e.g.; to hide the gallery "sample" from the index, uncomment the +# following line: +# + +EOT + + $self->galleries(); + for my $gallery ($self->{galleries}->Values()) { + next unless $gallery->hidden(); + print HIDDEN $gallery->basename(), "\n"; + } + + close HIDDEN; + + return 1; +} + +sub write_order_file { + my $self = shift; + + my $order_file = $self->order_file(); + sysopen ORDER, $order_file, Fcntl::O_WRONLY|Fcntl::O_CREAT|Fcntl::O_TRUNC, 0644 or + die "can't write $order_file: $!\n"; + binmode ORDER; + + print ORDER <<EOT; +# +# to specify the order of LiveFrame galleries manually, set the manual +# gallery ordering variable in your liveframe script to "yes" and enter +# the name of each gallery directory, each on it's own line, below. +# + +EOT + + $self->galleries(); + for my $gallery ($self->{galleries}->Values()) { + print ORDER $gallery->basename(), "\n"; + } + + close ORDER; + + return 1; } 1; No revision No revision 1.4 +64 -32 commons/lib/LiveFrame/Site.pm Index: Site.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Site.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Site.pm 2002/01/04 00:27:03 1.3 +++ Site.pm 2002/01/04 01:12:53 1.4 @@ -94,6 +94,9 @@ $self->{galleries} = $new; } + $self->write_hidden_file() if $gallery->hidden(); + $self->write_order_file(); + return 1; } @@ -107,48 +110,19 @@ $perms ||= 0755; if ($self->exists()) { - die "can't create: site previously exists\n"; + die "can't create site ", $self->path(), ": site previously exists\n"; } my $old_umask = umask; umask 0000; my $path = $self->path(); - warn "mkpath $path\n"; File::Path::mkpath($path, undef, $perms) or die "can't mkdir $path: $!\n"; - - my $order_file = $self->order_file(); - sysopen ORDER, $order_file, Fcntl::O_WRONLY|Fcntl::O_CREAT, 0644 or - die "can't write $order_file: $!\n"; - binmode ORDER; - print ORDER <<EOT; -# -# to specify the order of LiveFrame galleries manually, set the manual -# gallery ordering variable in your liveframe script to "yes" and enter -# the name of each gallery directory, each on it's own line, below. -# -EOT - close ORDER; + $self->write_order_file(); + $self->write_hidden_file(); - my $hidden_file = $self->hidden_file(); - sysopen HIDDEN, $hidden_file, Fcntl::O_WRONLY|Fcntl::O_CREAT, 0644 or - die "can't write $hidden_file: $!\n"; - binmode HIDDEN; - print HIDDEN <<EOT; -# -# to prevent LiveFrame galleries from being displayed in the gallery -# index or in the previous/next gallery interface on the start page, -# enter their names, each on it's own line, below. -# -# e.g.; to hide the gallery "sample" from the index, uncomment the -# following line: -# - -EOT - close HIDDEN; - umask $old_umask; $self->{exists} = 1; @@ -235,6 +209,64 @@ sub order_file { my ($self) = @_; return File::Spec->catfile($self->path(), ORDER_FILE); +} + +sub write_hidden_file { + my $self = shift; + + my $hidden_file = $self->hidden_file(); + sysopen HIDDEN, $hidden_file, Fcntl::O_WRONLY|Fcntl::O_CREAT, 0644 or + die "can't write $hidden_file: $!\n"; + binmode HIDDEN; + + print HIDDEN <<EOT; +# +# to prevent LiveFrame galleries from being displayed in the gallery +# index or in the previous/next gallery interface on the start page, +# enter their names, each on it's own line, below. +# +# e.g.; to hide the gallery "sample" from the index, uncomment the +# following line: +# + +EOT + + $self->galleries(); + for my $gallery ($self->{galleries}->Values()) { + next unless $gallery->hidden(); + print HIDDEN $gallery->basename(), "\n"; + } + + close HIDDEN; + + return 1; +} + +sub write_order_file { + my $self = shift; + + my $order_file = $self->order_file(); + sysopen ORDER, $order_file, Fcntl::O_WRONLY|Fcntl::O_CREAT|Fcntl::O_TRUNC, 0644 or + die "can't write $order_file: $!\n"; + binmode ORDER; + + print ORDER <<EOT; +# +# to specify the order of LiveFrame galleries manually, set the manual +# gallery ordering variable in your liveframe script to "yes" and enter +# the name of each gallery directory, each on it's own line, below. +# + +EOT + + $self->galleries(); + for my $gallery ($self->{galleries}->Values()) { + print ORDER $gallery->basename(), "\n"; + } + + close ORDER; + + return 1; } 1; |
From: <ix...@us...> - 2002-01-04 01:11:35
|
ixjonez 02/01/03 17:11:35 Modified: lib/LiveFrame Tag: °ð `¶@ Ú Ú Ð h½ À¹ À¹ x¿ x¿ ¶@¶@¶@¶@¶@¶@ ¶@ ¶@¨¶@¨¶@°¶@°¶@¸¶@¸¶@À¶@À¶@ȶ@ȶ@ж@ж@è¾ è¾ à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@ /tmp/cvs-serv20608/lib/LiveFrame/Gallery.pm No tag Gallery.pm Log: minor fixes Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.4 +2 -2 commons/lib/LiveFrame/Gallery.pm Index: /tmp/cvs-serv20608/lib/LiveFrame/Gallery.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Gallery.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /tmp/cvs-serv20608/lib/LiveFrame/Gallery.pm 2002/01/04 00:25:11 1.3 +++ /tmp/cvs-serv20608/lib/LiveFrame/Gallery.pm 2002/01/04 01:11:35 1.4 @@ -54,7 +54,7 @@ $perms ||= 0755; if ($self->exists()) { - die "can't create: site previously exists\n"; + die "can't create gallery ", $self->path(), ": gallery previously exists\n"; } my $old_umask = umask; @@ -133,7 +133,7 @@ sub shown { my ($self) = @_; - return $self->{visibility} || undef; + return $self->{visibility}; } # private methods No revision No revision 1.4 +2 -2 commons/lib/LiveFrame/Gallery.pm Index: Gallery.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Gallery.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Gallery.pm 2002/01/04 00:25:11 1.3 +++ Gallery.pm 2002/01/04 01:11:35 1.4 @@ -54,7 +54,7 @@ $perms ||= 0755; if ($self->exists()) { - die "can't create: site previously exists\n"; + die "can't create gallery ", $self->path(), ": gallery previously exists\n"; } my $old_umask = umask; @@ -133,7 +133,7 @@ sub shown { my ($self) = @_; - return $self->{visibility} || undef; + return $self->{visibility}; } # private methods |
From: <ix...@us...> - 2002-01-04 01:10:51
|
ixjonez 02/01/03 17:10:51 Modified: lib/LiveFrame/Lab Tag: ¨ú `¶@h¶@h¶@`á `á æ ¸{ HO ÷ PÊ PÊ ¶@¶@¶@¶@ æ ðË ¨¶@¨¶@hö hö ¸¶@¸¶@À¶@À¶@x½ x½ ж@ж@Xõ Xõ à¶@à¶@è¶@è¶@ð¶@ð¶@Xô Xô /tmp/cvs-serv20431/lib/LiveFrame/Lab/GalleryAction.pm No tag GalleryAction.pm Log: must explicitly call show() Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.5 +2 -2 lab/lib/LiveFrame/Lab/GalleryAction.pm Index: /tmp/cvs-serv20431/lib/LiveFrame/Lab/GalleryAction.pm =================================================================== RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/GalleryAction.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /tmp/cvs-serv20431/lib/LiveFrame/Lab/GalleryAction.pm 2002/01/04 00:31:48 1.4 +++ /tmp/cvs-serv20431/lib/LiveFrame/Lab/GalleryAction.pm 2002/01/04 01:10:51 1.5 @@ -28,12 +28,12 @@ $gallery->hide(); # make sure the gallery will be inserted after existing galleries undef $pos; + } else { + $gallery->show(); } $gallery->create(); $site->insert_gallery($gallery, $pos); - -# use Data::Denter; warn Denter $site; return $lab->send_page('image'); } No revision No revision 1.5 +2 -2 lab/lib/LiveFrame/Lab/GalleryAction.pm Index: GalleryAction.pm =================================================================== RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/GalleryAction.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- GalleryAction.pm 2002/01/04 00:31:48 1.4 +++ GalleryAction.pm 2002/01/04 01:10:51 1.5 @@ -28,12 +28,12 @@ $gallery->hide(); # make sure the gallery will be inserted after existing galleries undef $pos; + } else { + $gallery->show(); } $gallery->create(); $site->insert_gallery($gallery, $pos); - -# use Data::Denter; warn Denter $site; return $lab->send_page('image'); } |
From: <ix...@us...> - 2002-01-04 00:34:39
|
ixjonez 02/01/03 16:34:38 Modified: share/tmpl Tag: (õ `¶@h¶@h¶@@~ Ð x¶@x¶@X° ¨ ¶@¶@¶@¶@¶@¶@8 8 ¨¶@¨¶@°¶@°¶@¸¶@¸¶@À¶@À¶@ȶ@ȶ@ж@ж@ض@ض@à¶@à¶@è¶@è¶@8u 8u ø¶@ø¶@8t 8t ·@·@ ·@·@ ·@ ·@8³ 8³ 0·@0·@8·@8·@@·@@·@H·@H·@P·@P·@X·@X·@`·@`·@h·@h·@p·@p·@(¯ (¯ ·@·@·@·@·@·@·@·@ ·@ ·@¨·@¨·@°·@°·@¸·@¸·@À·@À·@È·@È·@з@з@Ø·@Ø·@à·@à·@è·@è·@ð·@ð·@ø·@ø·@ /tmp/cvs-serv13680/share/tmpl/spec.tmpl No tag spec.tmpl Log: upgrade gallery position table to have first and last selections and to collapse nicely when the site has no galleries. Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.2 +42 -15 lab/share/tmpl/spec.tmpl Index: /tmp/cvs-serv13680/share/tmpl/spec.tmpl =================================================================== RCS file: /cvsroot/liveframe/lab/share/tmpl/spec.tmpl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /tmp/cvs-serv13680/share/tmpl/spec.tmpl 2001/12/02 12:48:11 1.1 +++ /tmp/cvs-serv13680/share/tmpl/spec.tmpl 2002/01/04 00:34:38 1.2 @@ -252,15 +252,45 @@ [% pos = 0 %] [% site = LiveFrameLab.site(LiveFrameLab.field('site_dir')) %] + [% FOREACH g = site.galleries %] + [% IF pos == 0 %] <tr> -<td bgcolor="#ffffff" colspan="3"> -<br></td> +<td bgcolor="#ffffff"> +[% IF LiveFrameLab.field('gallery_position') == pos %] +<input type="radio" name="gallery_position" value="[% pos %]" checked> +[% ELSE %] +<input type="radio" name="gallery_position" value="[% pos %]"> +[% END %] +</td> +<td bgcolor="#ffffff"> +first</td> +<td bgcolor="#ffffff" valign="bottom"> +<img src="[% LiveFrameLab.img_src('toparrow.gif') %]" align="bottom" width="14" height="10" border="0"><br><img src="[% LiveFrameLab.img_src('bottomarrow.gif') %]" align="top" width="14" height="10" border="0"></td> +[% END %] + <td bgcolor="#ffffff" rowspan="2"> [% g.basename | html %] </td> </tr> + +[% pos = pos + 1 %] + +[% IF pos == site.num_galleries%] +<tr> +<td bgcolor="#ffffff"> +[% IF LiveFrameLab.field('gallery_position') == pos %] +<input type="radio" name="gallery_position" value="[% pos %]" checked> +[% ELSE %] +<input type="radio" name="gallery_position" value="[% pos %]"> +[% END %] +</td> +<td bgcolor="#ffffff"> +last</td> +<td bgcolor="#ffffff" valign="top"> +<img src="[% LiveFrameLab.img_src('toparrow.gif') %]" align="bottom" width="14" height="10" border="0"><br><img src="[% LiveFrameLab.img_src('bottomarrow.gif') %]" align="top" width="14" height="10" border="0"></td> +</tr> [% ELSE %] <tr> <td bgcolor="#ffffff" rowspan="2"> @@ -271,7 +301,7 @@ [% END %] </td> <td bgcolor="#ffffff" rowspan="2"> -between +between </td> <td bgcolor="#ffffff" align="bottom"> <img src="[% LiveFrameLab.img_src('toparrow.gif') %]" align="bottom" width="14" height="10" border="0"></td> @@ -280,23 +310,20 @@ <tr> <td bgcolor="#ffffff"> <img src="[% LiveFrameLab.img_src('bottomarrow.gif') %]" align="top" width="14" height="10" border="0"></td> -<td bgcolor="#ffffff" rowspan="2"> -[% g.basename | html %] -</td> -</tr> [% END %] -[% IF pos == (site.num_galleries - 1) %] -<tr> -<td bgcolor="#ffffff" colspan="3"> -<br> -</td> -</tr> -[% END %] -[% pos = pos + 1 %] + [% END %] <tr> <td bgcolor="#ffffff" colspan="4"> +[% IF site.num_galleries < 1 %] +[% IF LiveFrameLab.field('gallery_position') == 0 %] +<input type="radio" name="gallery_position" value="0" checked> +[% ELSE %] +<input type="radio" name="gallery_position" value="0"> +[% END %] +first +[% END %] <b>or</b> [% IF LiveFrameLab.field('gallery_position') == 'hide' %] <input type="radio" name="gallery_position" value="hide" checked> No revision No revision 1.2 +42 -15 lab/share/tmpl/spec.tmpl Index: spec.tmpl =================================================================== RCS file: /cvsroot/liveframe/lab/share/tmpl/spec.tmpl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- spec.tmpl 2001/12/02 12:48:11 1.1 +++ spec.tmpl 2002/01/04 00:34:38 1.2 @@ -252,15 +252,45 @@ [% pos = 0 %] [% site = LiveFrameLab.site(LiveFrameLab.field('site_dir')) %] + [% FOREACH g = site.galleries %] + [% IF pos == 0 %] <tr> -<td bgcolor="#ffffff" colspan="3"> -<br></td> +<td bgcolor="#ffffff"> +[% IF LiveFrameLab.field('gallery_position') == pos %] +<input type="radio" name="gallery_position" value="[% pos %]" checked> +[% ELSE %] +<input type="radio" name="gallery_position" value="[% pos %]"> +[% END %] +</td> +<td bgcolor="#ffffff"> +first</td> +<td bgcolor="#ffffff" valign="bottom"> +<img src="[% LiveFrameLab.img_src('toparrow.gif') %]" align="bottom" width="14" height="10" border="0"><br><img src="[% LiveFrameLab.img_src('bottomarrow.gif') %]" align="top" width="14" height="10" border="0"></td> +[% END %] + <td bgcolor="#ffffff" rowspan="2"> [% g.basename | html %] </td> </tr> + +[% pos = pos + 1 %] + +[% IF pos == site.num_galleries%] +<tr> +<td bgcolor="#ffffff"> +[% IF LiveFrameLab.field('gallery_position') == pos %] +<input type="radio" name="gallery_position" value="[% pos %]" checked> +[% ELSE %] +<input type="radio" name="gallery_position" value="[% pos %]"> +[% END %] +</td> +<td bgcolor="#ffffff"> +last</td> +<td bgcolor="#ffffff" valign="top"> +<img src="[% LiveFrameLab.img_src('toparrow.gif') %]" align="bottom" width="14" height="10" border="0"><br><img src="[% LiveFrameLab.img_src('bottomarrow.gif') %]" align="top" width="14" height="10" border="0"></td> +</tr> [% ELSE %] <tr> <td bgcolor="#ffffff" rowspan="2"> @@ -271,7 +301,7 @@ [% END %] </td> <td bgcolor="#ffffff" rowspan="2"> -between +between </td> <td bgcolor="#ffffff" align="bottom"> <img src="[% LiveFrameLab.img_src('toparrow.gif') %]" align="bottom" width="14" height="10" border="0"></td> @@ -280,23 +310,20 @@ <tr> <td bgcolor="#ffffff"> <img src="[% LiveFrameLab.img_src('bottomarrow.gif') %]" align="top" width="14" height="10" border="0"></td> -<td bgcolor="#ffffff" rowspan="2"> -[% g.basename | html %] -</td> -</tr> [% END %] -[% IF pos == (site.num_galleries - 1) %] -<tr> -<td bgcolor="#ffffff" colspan="3"> -<br> -</td> -</tr> -[% END %] -[% pos = pos + 1 %] + [% END %] <tr> <td bgcolor="#ffffff" colspan="4"> +[% IF site.num_galleries < 1 %] +[% IF LiveFrameLab.field('gallery_position') == 0 %] +<input type="radio" name="gallery_position" value="0" checked> +[% ELSE %] +<input type="radio" name="gallery_position" value="0"> +[% END %] +first +[% END %] <b>or</b> [% IF LiveFrameLab.field('gallery_position') == 'hide' %] <input type="radio" name="gallery_position" value="hide" checked> |
From: <ix...@us...> - 2002-01-04 00:33:53
|
ixjonez 02/01/03 16:33:52 Modified: lib/LiveFrame/Lab Tag: XÚ `¶@h¶@h¶@¸ ¸ àz P ÀQ ÀQ @¹ @¹ ¶@¶@P¸ P¸ ¶@ ¶@¨¶@¨¶@°¶@°¶@¸¸ ¸¸ À¶@À¶@ȶ@ȶ@´ ´ ض@ض@à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@ /tmp/cvs-serv13287/lib/LiveFrame/Lab/StartForm.pm No tag StartForm.pm Log: untaint site_dir so it can be used for filesystem commands. create the specified site if it does not already exist so that its order file can be listed on the spec page. Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.3 +17 -0 lab/lib/LiveFrame/Lab/StartForm.pm Index: /tmp/cvs-serv13287/lib/LiveFrame/Lab/StartForm.pm =================================================================== RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/StartForm.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /tmp/cvs-serv13287/lib/LiveFrame/Lab/StartForm.pm 2001/12/02 12:45:22 1.2 +++ /tmp/cvs-serv13287/lib/LiveFrame/Lab/StartForm.pm 2002/01/04 00:33:52 1.3 @@ -34,6 +34,23 @@ $errors->add_error('upload_directory not specified'); die $errors; } + + # untaint $site_dir so the directory can be created if necessary. + # XXX: what characters would be considered unsafe? all valid UTF-8 + # should be allowed + ($site_dir) = ($site_dir =~ /(.+)/); + + # pre-create the site if necessary, so that gallery ordering will + # work on the next page + my $site = LiveFrame::Site->new($site_dir); + unless ($site->exists()) { + eval { $site->create() }; + if ($@) { + my $errors = LiveFrame::Errors->new(); + $errors->add_error("problem creating site: $@"); + die $errors; + } + } } 1; No revision No revision 1.3 +17 -0 lab/lib/LiveFrame/Lab/StartForm.pm Index: StartForm.pm =================================================================== RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/StartForm.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- StartForm.pm 2001/12/02 12:45:22 1.2 +++ StartForm.pm 2002/01/04 00:33:52 1.3 @@ -34,6 +34,23 @@ $errors->add_error('upload_directory not specified'); die $errors; } + + # untaint $site_dir so the directory can be created if necessary. + # XXX: what characters would be considered unsafe? all valid UTF-8 + # should be allowed + ($site_dir) = ($site_dir =~ /(.+)/); + + # pre-create the site if necessary, so that gallery ordering will + # work on the next page + my $site = LiveFrame::Site->new($site_dir); + unless ($site->exists()) { + eval { $site->create() }; + if ($@) { + my $errors = LiveFrame::Errors->new(); + $errors->add_error("problem creating site: $@"); + die $errors; + } + } } 1; |
From: <ix...@us...> - 2002-01-04 00:32:17
|
ixjonez 02/01/03 16:32:16 Modified: lib/LiveFrame/Lab Tag: °ß `¶@h¶@h¶@Æ ¶ ày ày ¶@¶@`¸ `¸ ¶@¶@¶@¶@ ¶@ ¶@¨¶@¨¶@°¶@°¶@¸¶@¸¶@À¶@À¶@෠෠ж@ж@Xy à³ à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@ /tmp/cvs-serv13077/lib/LiveFrame/Lab/SpecForm.pm No tag SpecForm.pm Log: gallery_position is not required (if not specified, the gallery will be added last) Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.3 +4 -3 lab/lib/LiveFrame/Lab/SpecForm.pm Index: /tmp/cvs-serv13077/lib/LiveFrame/Lab/SpecForm.pm =================================================================== RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/SpecForm.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /tmp/cvs-serv13077/lib/LiveFrame/Lab/SpecForm.pm 2001/12/19 05:32:37 1.2 +++ /tmp/cvs-serv13077/lib/LiveFrame/Lab/SpecForm.pm 2002/01/04 00:32:16 1.3 @@ -83,15 +83,16 @@ sub validate { my ($self, $lab) = @_; + my $site_dir = $self->site_dir(); my $gallery_dir = $self->gallery_dir(); my $gallery_position = $self->gallery_position(); - unless (defined $gallery_dir && defined $gallery_position) { + unless (defined $site_dir && defined $gallery_dir) { my $errors = LiveFrame::Errors->new(); + $errors->add_error('site directory not specified') unless + defined $site_dir; $errors->add_error('gallery directory not specified') unless defined $gallery_dir; - $errors->add_error('gallery position not specified') unless - defined $gallery_position; die $errors; } No revision No revision 1.3 +4 -3 lab/lib/LiveFrame/Lab/SpecForm.pm Index: SpecForm.pm =================================================================== RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/SpecForm.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SpecForm.pm 2001/12/19 05:32:37 1.2 +++ SpecForm.pm 2002/01/04 00:32:16 1.3 @@ -83,15 +83,16 @@ sub validate { my ($self, $lab) = @_; + my $site_dir = $self->site_dir(); my $gallery_dir = $self->gallery_dir(); my $gallery_position = $self->gallery_position(); - unless (defined $gallery_dir && defined $gallery_position) { + unless (defined $site_dir && defined $gallery_dir) { my $errors = LiveFrame::Errors->new(); + $errors->add_error('site directory not specified') unless + defined $site_dir; $errors->add_error('gallery directory not specified') unless defined $gallery_dir; - $errors->add_error('gallery position not specified') unless - defined $gallery_position; die $errors; } |
From: <ix...@us...> - 2002-01-04 00:31:49
|
ixjonez 02/01/03 16:31:49 Modified: lib/LiveFrame/Lab Tag: Xä `¶@h¶@h¶@`y `y ¸Ð ¿ @z @z ¨Á ¨Á ¶@¶@¶@¶@ ¶@ ¶@¨¶@¨¶@°¶@°¶@¸¶@¸¶@À¶@À¶@PÜ p½ Á Á pÛ pÛ à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@hÚ hÚ ·@·@@á @á ·@·@ ·@ ·@(·@(·@0·@0·@8·@8·@@·@@·@H·@H·@P·@P·@X·@X·@`·@`·@h·@h·@p·@p·@x·@x·@·@·@·@·@·@·@·@·@ ·@ ·@¨·@¨·@°·@°·@¸·@¸·@À·@À·@È·@È·@з@з@Ø·@Ø·@à·@à·@è·@è·@ð·@ð·@ø·@ø·@ /tmp/cvs-serv12875/lib/LiveFrame/Lab/GalleryAction.pm No tag GalleryAction.pm Log: untaint site and gallery directories so that filesystem commands work. adjust to latest api. Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.4 +13 -8 lab/lib/LiveFrame/Lab/GalleryAction.pm Index: /tmp/cvs-serv12875/lib/LiveFrame/Lab/GalleryAction.pm =================================================================== RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/GalleryAction.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /tmp/cvs-serv12875/lib/LiveFrame/Lab/GalleryAction.pm 2001/12/19 05:31:12 1.3 +++ /tmp/cvs-serv12875/lib/LiveFrame/Lab/GalleryAction.pm 2002/01/04 00:31:48 1.4 @@ -12,23 +12,28 @@ sub perform { my ($self, $lab, $form) = @_; - my $site = LiveFrame::Site->new($form->site_dir()); - $site->galleries(); + # untaint site and gallery directories so they can be created. + # XXX: what characters would be considered unsafe? all valid UTF-8 + # should be allowed + my ($site_dir) = ($form->site_dir() =~ /(.+)/); + my ($gallery_dir) = ($form->gallery_dir() =~ /(.+)/); - my $gallery = LiveFrame::Gallery->new($site, $form->gallery_dir()); + my $site = LiveFrame::Site->new($site_dir); + my $gallery = LiveFrame::Gallery->new($site, $gallery_dir); $gallery->title($form->gallery_title()); $gallery->description($form->gallery_description()); my $pos = $form->gallery_position(); - if ($pos eq 'hide') { + if ($pos && $pos eq 'hide') { $gallery->hide(); + # make sure the gallery will be inserted after existing galleries + undef $pos; } -# $gallery->create(); + $gallery->create(); + $site->insert_gallery($gallery, $pos); -# $site->insert_gallery($pos); - - use Data::Denter; warn Denter $gallery; +# use Data::Denter; warn Denter $site; return $lab->send_page('image'); } No revision No revision 1.4 +13 -8 lab/lib/LiveFrame/Lab/GalleryAction.pm Index: GalleryAction.pm =================================================================== RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/GalleryAction.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- GalleryAction.pm 2001/12/19 05:31:12 1.3 +++ GalleryAction.pm 2002/01/04 00:31:48 1.4 @@ -12,23 +12,28 @@ sub perform { my ($self, $lab, $form) = @_; - my $site = LiveFrame::Site->new($form->site_dir()); - $site->galleries(); + # untaint site and gallery directories so they can be created. + # XXX: what characters would be considered unsafe? all valid UTF-8 + # should be allowed + my ($site_dir) = ($form->site_dir() =~ /(.+)/); + my ($gallery_dir) = ($form->gallery_dir() =~ /(.+)/); - my $gallery = LiveFrame::Gallery->new($site, $form->gallery_dir()); + my $site = LiveFrame::Site->new($site_dir); + my $gallery = LiveFrame::Gallery->new($site, $gallery_dir); $gallery->title($form->gallery_title()); $gallery->description($form->gallery_description()); my $pos = $form->gallery_position(); - if ($pos eq 'hide') { + if ($pos && $pos eq 'hide') { $gallery->hide(); + # make sure the gallery will be inserted after existing galleries + undef $pos; } -# $gallery->create(); + $gallery->create(); + $site->insert_gallery($gallery, $pos); -# $site->insert_gallery($pos); - - use Data::Denter; warn Denter $gallery; +# use Data::Denter; warn Denter $site; return $lab->send_page('image'); } |
From: <ix...@us...> - 2002-01-04 00:31:07
|
ixjonez 02/01/03 16:31:06 Modified: etc Tag: ¸Ô `¶@h¶@h¶@ /tmp/cvs-serv12647/etc/lab.conf No tag lab.conf Log: configure default urls such that the distribuation can be unpacked and run out of the box. Revision Changes Path No revision No revision No revision 1.3 +5 -1 lab/etc/lab.conf Index: /tmp/cvs-serv12647/etc/lab.conf =================================================================== RCS file: /cvsroot/liveframe/lab/etc/lab.conf,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /tmp/cvs-serv12647/etc/lab.conf 2001/11/30 01:47:47 1.2 +++ /tmp/cvs-serv12647/etc/lab.conf 2002/01/04 00:31:06 1.3 @@ -17,14 +17,18 @@ # # the url to the images directory # img_url = ../lab/img +img_url = ../../lab/share/web/img # # the url to the css directory # css_url = ../lab +css_url = ../../lab/share/web # # a list of filesystem paths to gallery site directories # site_dir = ~/work/code/liveframe/gallery-demo/lfdir/galleries site_dir = ~/work/code/maz/site/html/bcm/lfdir/galleries +site_dir = ~/work/code/maz/site/html/bcm/au/lfdir/galleries +site_dir = ~/work/code/maz/site/html/bcm/sg/lfdir/galleries # # the filesystem path to the image upload directory -upload_dir = ~/work/code/liveframe/uploads +upload_dir = ~/photos No revision No revision 1.3 +5 -1 lab/etc/lab.conf Index: lab.conf =================================================================== RCS file: /cvsroot/liveframe/lab/etc/lab.conf,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- lab.conf 2001/11/30 01:47:47 1.2 +++ lab.conf 2002/01/04 00:31:06 1.3 @@ -17,14 +17,18 @@ # # the url to the images directory # img_url = ../lab/img +img_url = ../../lab/share/web/img # # the url to the css directory # css_url = ../lab +css_url = ../../lab/share/web # # a list of filesystem paths to gallery site directories # site_dir = ~/work/code/liveframe/gallery-demo/lfdir/galleries site_dir = ~/work/code/maz/site/html/bcm/lfdir/galleries +site_dir = ~/work/code/maz/site/html/bcm/au/lfdir/galleries +site_dir = ~/work/code/maz/site/html/bcm/sg/lfdir/galleries # # the filesystem path to the image upload directory -upload_dir = ~/work/code/liveframe/uploads +upload_dir = ~/photos |
From: <ix...@us...> - 2002-01-04 00:30:11
|
ixjonez 02/01/03 16:30:10 Modified: . Tag: à `¶@h¶@h¶@Øx ps X³ X³ Ø ` ¶@¶@p¨ p¨ ¶@¶@ ¶@ ¶@¨¶@¨¶@°¶@°¶@¸¶@¸¶@À¶@À¶@ȶ@ȶ@ж@ж@ض@ض@à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@ /tmp/cvs-serv12594/test.pl No tag test.pl Log: find commons libs Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.2 +1 -0 lab/test.pl Index: /tmp/cvs-serv12594/test.pl =================================================================== RCS file: /cvsroot/liveframe/lab/test.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /tmp/cvs-serv12594/test.pl 2001/11/30 01:03:03 1.1 +++ /tmp/cvs-serv12594/test.pl 2002/01/04 00:30:10 1.2 @@ -5,6 +5,7 @@ use Test; BEGIN { plan tests => 1 }; +use lib "../commons/lib"; use LiveFrame::Lab; ok(1); # If we made it this far, we're ok. No revision No revision 1.2 +1 -0 lab/test.pl Index: test.pl =================================================================== RCS file: /cvsroot/liveframe/lab/test.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- test.pl 2001/11/30 01:03:03 1.1 +++ test.pl 2002/01/04 00:30:10 1.2 @@ -5,6 +5,7 @@ use Test; BEGIN { plan tests => 1 }; +use lib "../commons/lib"; use LiveFrame::Lab; ok(1); # If we made it this far, we're ok. |
From: <ix...@us...> - 2002-01-04 00:29:58
|
ixjonez 02/01/03 16:29:57 Modified: . Tag: Ü `¶@h¶@h¶@@Q 8² PÏ PÏ ØÑ ` ¶@¶@¶@¶@¶@¶@ ¶@ ¶@¨¶@¨¶@ðË ðË ¸¶@¸¶@À¶@À¶@ȶ@ȶ@ж@ж@ض@ض@à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@ /tmp/cvs-serv12409/Makefile.PL No tag Makefile.PL Added: bin .cvsignore lab.PL Log: add bin directory with lab command line script Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.2 +3 -3 lab/Makefile.PL Index: /tmp/cvs-serv12409/Makefile.PL =================================================================== RCS file: /cvsroot/liveframe/lab/Makefile.PL,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /tmp/cvs-serv12409/Makefile.PL 2001/11/30 01:03:03 1.1 +++ /tmp/cvs-serv12409/Makefile.PL 2002/01/04 00:29:56 1.2 @@ -10,9 +10,9 @@ HTML::Entities => 0, Template => 2.0.6, URI => 0}, - PL_FILES => {'cgi-bin/lab.cgi.PL' => - 'cgi-bin/lab.cgi'}, - clean => {FILES => 'cgi-bin/lab.cgi'}, + PL_FILES => {'cgi-bin/lab.cgi.PL' => 'cgi-bin/lab.cgi', + 'bin/lab.PL' => 'bin/lab'}, + clean => {FILES => 'cgi-bin/lab.cgi bin/lab'}, ($] >= 5.005 ? (ABSTRACT_FROM => 'lib/LiveFrame/Lab.pm', AUTHOR => 'Brian Moseley <bc...@ma...>') : ()), No revision No revision 1.2 +3 -3 lab/Makefile.PL Index: Makefile.PL =================================================================== RCS file: /cvsroot/liveframe/lab/Makefile.PL,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile.PL 2001/11/30 01:03:03 1.1 +++ Makefile.PL 2002/01/04 00:29:56 1.2 @@ -10,9 +10,9 @@ HTML::Entities => 0, Template => 2.0.6, URI => 0}, - PL_FILES => {'cgi-bin/lab.cgi.PL' => - 'cgi-bin/lab.cgi'}, - clean => {FILES => 'cgi-bin/lab.cgi'}, + PL_FILES => {'cgi-bin/lab.cgi.PL' => 'cgi-bin/lab.cgi', + 'bin/lab.PL' => 'bin/lab'}, + clean => {FILES => 'cgi-bin/lab.cgi bin/lab'}, ($] >= 5.005 ? (ABSTRACT_FROM => 'lib/LiveFrame/Lab.pm', AUTHOR => 'Brian Moseley <bc...@ma...>') : ()), 1.1 lab/bin/.cvsignore Index: .cvsignore =================================================================== lab 1.1 lab/bin/lab.PL Index: lab.PL =================================================================== # -*- Mode: Perl; indent-tabs-mode: nil; -*- # ripped off from LWP. Thanks! use strict; use Config; use File::Basename qw(basename dirname); use File::Spec::Functions qw(catfile); chdir dirname $0; (my $file = basename $0) =~ s/\.PL$//; $file =~ s/\.pl$// if ($Config{'osname'} eq 'VMS' or $Config{'osname'} eq 'OS2'); # "case-forgiving" open OUT,">$file" or die "Can't create $file: $!"; chmod 0755, $file; print "Extracting $file (with variable substitutions)\n"; my $default_config_file = catfile($Config{prefix}, 'etc', 'lab.conf'); print OUT <<"!GROK!THIS!"; $Config{startperl} -wT !GROK!THIS! print OUT <<'!NO!SUBS!'; use lib "./lib"; use lib "../commons/lib"; use strict; use File::Basename (); use Getopt::Long (); use LiveFrame::Lab (); BEGIN { $0 = File::Basename::basename($0) } use constant VERSION => '0.01'; use constant PROGRAM => 'LiveFrame Lab'; use constant USAGE => <<EOT; Usage: $0 [OPTIONS...] action Actions: $0 -s <site> -g <gallery> [-p <position>] gallery create gallery directory <gallery> within site directory <site> and add the gallery at position <order> in the site's order file (or last, if no position is specified) Options: -f specify the location of the configuration file (defaults to !NO!SUBS! print OUT <<"!GROK!THIS!"; ${default_config_file}) !GROK!THIS! print OUT <<'!NO!SUBS!'; -s specify the location of the site directory -g specify the basename of the gallery directory within the site directory -p specify the position (as an integer from 0..n) of the gallery within the site's order file -d print debugging information to STDOUT -h list available command line options (this page) -v print version information and exit EOT use constant FORMS => { gallery => 'spec', }; # variable declarations (configurable) my ($opt_config_file); my ($opt_debug, $opt_help, $opt_version); # make visible for use in symbolic refs later use vars qw($opt_site_dir $opt_gallery_dir $opt_gallery_position); # process command line options Getopt::Long::GetOptions( "f=s" => \$opt_config_file, "s=s" => \$opt_site_dir, "g=s" => \$opt_gallery_dir, "p=i" => \$opt_gallery_position, "d" => \$opt_debug, "h" => \$opt_help, "v" => \$opt_version, ); (print USAGE and exit) if $opt_help; (print sprintf("%s/%s\n", PROGRAM, VERSION) and exit) if $opt_version; # # MAIN PROGRAM # my $action_name = shift @ARGV or die USAGE; my $config_file = $opt_config_file || !NO!SUBS! print OUT <<"!GROK!THIS!"; '${default_config_file}'; !GROK!THIS! print OUT <<'!NO!SUBS!'; my $lab = LiveFrame::Lab->new(); eval { $lab->start({config_file => $config_file}) }; if ($@) { die "$0: application could not be started: $@\n"; } # force the config file to be read. eval { $lab->process_config() }; if ($@) { die "$0: config file error: $@\n"; } $lab->current_action_name($action_name); my $action = eval { $lab->current_action() }; if ($@) { die "$0: error finding action `$action_name': $@\n"; } unless ($action) { die "$0: no action `", $lab->current_action_name(), "' defined\n"; } $lab->current_form_name(FORMS->{$action_name}); my $form = eval { $lab->current_form() }; if ($@) { die "$0: can't get current form: $@\n"; } unless ($form) { die "$0: no form `", $lab->current_form_name(), "' defined\n"; } # load up the form with command line options for (qw(site_dir gallery_dir gallery_position)) { no strict 'refs'; my $opt = join '_', 'opt', $_; $form->$_($$opt) if defined $$opt; } # validate the form eval { $form->validate($lab) }; if ($@) { die "$0: invalid input:\n - ", join("\n - ", $@->errors()), "\n"; } # perform the action eval { $action->perform($lab, $form) }; if ($@) { die "$0: error performing action: $@\n"; } exit; !NO!SUBS! |
From: <ix...@us...> - 2002-01-04 00:28:30
|
ixjonez 02/01/03 16:28:29 lab/bin - New directory |
From: <ix...@us...> - 2002-01-04 00:27:39
|
ixjonez 02/01/03 16:27:39 Modified: lib/LiveFrame/Template/Plugin Tag: ÀÐ `¶@h¶@h¶@¸´ ¸´ ¬ 8® ¶@¶@p¬ p¬ ¶@¶@« « pÉ pÉ ° ° °¶@°¶@P¹ P¹ À¶@À¶@ȶ@ȶ@ж@ж@ض@ض@à¶@à¶@è¶@è¶@ð¶@ð¶@XÈ XÈ /tmp/cvs-serv11635/lib/LiveFrame/Template/Plugin/LiveFrame.pm No tag LiveFrame.pm Log: remove stray obsolete code Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.2 +0 -3 commons/lib/LiveFrame/Template/Plugin/LiveFrame.pm Index: /tmp/cvs-serv11635/lib/LiveFrame/Template/Plugin/LiveFrame.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Template/Plugin/LiveFrame.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /tmp/cvs-serv11635/lib/LiveFrame/Template/Plugin/LiveFrame.pm 2001/12/02 09:49:43 1.1 +++ /tmp/cvs-serv11635/lib/LiveFrame/Template/Plugin/LiveFrame.pm 2002/01/04 00:27:38 1.2 @@ -74,7 +74,4 @@ return $self->{context}->stash()->get($name); } -# $tparams->{img_url} = $self->url($config->img_url()); -# $tparams->{css_url} = $self->url($config->css_url()); - 1; No revision No revision 1.2 +0 -3 commons/lib/LiveFrame/Template/Plugin/LiveFrame.pm Index: LiveFrame.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Template/Plugin/LiveFrame.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- LiveFrame.pm 2001/12/02 09:49:43 1.1 +++ LiveFrame.pm 2002/01/04 00:27:38 1.2 @@ -74,7 +74,4 @@ return $self->{context}->stash()->get($name); } -# $tparams->{img_url} = $self->url($config->img_url()); -# $tparams->{css_url} = $self->url($config->css_url()); - 1; |
From: <ix...@us...> - 2002-01-04 00:27:04
|
ixjonez 02/01/03 16:27:03 Modified: lib/LiveFrame Tag: ÷ `¶@@Ò @Ò X à¶ 8È ¸ h¹ h¹ ¶@¶@¶@¶@¶@¶@ ¶@ ¶@z z °¶@°¶@¸¶@¸¶@À¶@À¶@ȶ@ȶ@ж@ж@ظ ظ à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@ /tmp/cvs-serv11191/lib/LiveFrame/Site.pm No tag Site.pm Log: allow the site to not exist and don't attempt to load galleries if it does not exist. implement directory and file creation. implement inserting a gallery (altho without order.conf rewriting for now). Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.3 +106 -9 commons/lib/LiveFrame/Site.pm Index: /tmp/cvs-serv11191/lib/LiveFrame/Site.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Site.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /tmp/cvs-serv11191/lib/LiveFrame/Site.pm 2001/12/19 05:29:21 1.2 +++ /tmp/cvs-serv11191/lib/LiveFrame/Site.pm 2002/01/04 00:27:03 1.3 @@ -2,6 +2,7 @@ package LiveFrame::Site; +use Fcntl (); use File::Basename (); use LiveFrame::Gallery (); use Tie::IxHash (); @@ -16,6 +17,7 @@ my $self = bless { + exists => undef, path => $path, galleries => undef, }, $class; @@ -34,17 +36,20 @@ sub galleries { my ($self, $include_hidden) = @_; + my @g; unless ($self->{galleries}) { - $self->{galleries} = Tie::IxHash->new(), + $self->{galleries} = Tie::IxHash->new(); - $self->load_galleries($self->order_file()); - $self->load_visibility($self->hidden_file); + if ($self->exists()) { + $self->load_galleries($self->order_file()); + $self->load_visibility($self->hidden_file); + } + + @g = $include_hidden ? + $self->{galleries}->Values() : + grep { $_->shown() } $self->{galleries}->Values(); } - my @g = $include_hidden ? - $self->{galleries}->Values() : - grep { $_->shown() } $self->{galleries}->Values(); - return wantarray ? @g : \@g; } @@ -55,9 +60,39 @@ } ## public methods + +sub insert_gallery { + my ($self, $gallery, $pos) = @_; + return undef unless $gallery; + + $self->galleries(); + my $num_galleries = $self->num_galleries(); + + # if no position was indicated, push the gallery on the end of the list + $pos = $num_galleries unless defined $pos; + + if ($pos == $num_galleries) { + # we can simply add the new gallery to the end + $self->{galleries}->Push($gallery->basename() => $gallery); + } + else { + # create a new galleries structure + my $new = Tie::IxHash->new(); + + # pop each gallery off the old structure and push it on the + # new one, inserting the specified gallery in the specified + # position + for (my $ix = 0; $ix < $num_galleries; $ix++) { + if ($ix == $pos) { + $new->Push($gallery->basename() => $gallery); + } + + my ($name, $gallery) = $self->{galleries}->Shift(); + $new->Push($name => $gallery); + } -sub add_gallery { - my ($self, $pos) = @_; + $self->{galleries} = $new; + } return 1; } @@ -67,9 +102,71 @@ return File::Basename::basename($self->path()); } +sub create { + my ($self, $perms) = @_; + $perms ||= 0755; + + if ($self->exists()) { + die "can't create: site previously exists\n"; + } + + my $old_umask = umask; + umask 0000; + + my $path = $self->path(); + warn "mkpath $path\n"; + File::Path::mkpath($path, undef, $perms) or + die "can't mkdir $path: $!\n"; + + my $order_file = $self->order_file(); + sysopen ORDER, $order_file, Fcntl::O_WRONLY|Fcntl::O_CREAT, 0644 or + die "can't write $order_file: $!\n"; + binmode ORDER; + print ORDER <<EOT; +# +# to specify the order of LiveFrame galleries manually, set the manual +# gallery ordering variable in your liveframe script to "yes" and enter +# the name of each gallery directory, each on it's own line, below. +# + +EOT + close ORDER; + + my $hidden_file = $self->hidden_file(); + sysopen HIDDEN, $hidden_file, Fcntl::O_WRONLY|Fcntl::O_CREAT, 0644 or + die "can't write $hidden_file: $!\n"; + binmode HIDDEN; + print HIDDEN <<EOT; +# +# to prevent LiveFrame galleries from being displayed in the gallery +# index or in the previous/next gallery interface on the start page, +# enter their names, each on it's own line, below. +# +# e.g.; to hide the gallery "sample" from the index, uncomment the +# following line: +# + +EOT + close HIDDEN; + + umask $old_umask; + + $self->{exists} = 1; + + return 1; +} + sub dirname { my ($self) = @_; return File::Basename::dirname($self->path()); +} + +sub exists { + my ($self) = @_; + unless (defined $self->{exists}) { + $self->{exists} = -f $self->hidden_file() ? 1 : 0; + } + return $self->{exists}; } sub num_galleries { No revision No revision 1.3 +106 -9 commons/lib/LiveFrame/Site.pm Index: Site.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Site.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Site.pm 2001/12/19 05:29:21 1.2 +++ Site.pm 2002/01/04 00:27:03 1.3 @@ -2,6 +2,7 @@ package LiveFrame::Site; +use Fcntl (); use File::Basename (); use LiveFrame::Gallery (); use Tie::IxHash (); @@ -16,6 +17,7 @@ my $self = bless { + exists => undef, path => $path, galleries => undef, }, $class; @@ -34,17 +36,20 @@ sub galleries { my ($self, $include_hidden) = @_; + my @g; unless ($self->{galleries}) { - $self->{galleries} = Tie::IxHash->new(), + $self->{galleries} = Tie::IxHash->new(); - $self->load_galleries($self->order_file()); - $self->load_visibility($self->hidden_file); + if ($self->exists()) { + $self->load_galleries($self->order_file()); + $self->load_visibility($self->hidden_file); + } + + @g = $include_hidden ? + $self->{galleries}->Values() : + grep { $_->shown() } $self->{galleries}->Values(); } - my @g = $include_hidden ? - $self->{galleries}->Values() : - grep { $_->shown() } $self->{galleries}->Values(); - return wantarray ? @g : \@g; } @@ -55,9 +60,39 @@ } ## public methods + +sub insert_gallery { + my ($self, $gallery, $pos) = @_; + return undef unless $gallery; + + $self->galleries(); + my $num_galleries = $self->num_galleries(); + + # if no position was indicated, push the gallery on the end of the list + $pos = $num_galleries unless defined $pos; + + if ($pos == $num_galleries) { + # we can simply add the new gallery to the end + $self->{galleries}->Push($gallery->basename() => $gallery); + } + else { + # create a new galleries structure + my $new = Tie::IxHash->new(); + + # pop each gallery off the old structure and push it on the + # new one, inserting the specified gallery in the specified + # position + for (my $ix = 0; $ix < $num_galleries; $ix++) { + if ($ix == $pos) { + $new->Push($gallery->basename() => $gallery); + } + + my ($name, $gallery) = $self->{galleries}->Shift(); + $new->Push($name => $gallery); + } -sub add_gallery { - my ($self, $pos) = @_; + $self->{galleries} = $new; + } return 1; } @@ -67,9 +102,71 @@ return File::Basename::basename($self->path()); } +sub create { + my ($self, $perms) = @_; + $perms ||= 0755; + + if ($self->exists()) { + die "can't create: site previously exists\n"; + } + + my $old_umask = umask; + umask 0000; + + my $path = $self->path(); + warn "mkpath $path\n"; + File::Path::mkpath($path, undef, $perms) or + die "can't mkdir $path: $!\n"; + + my $order_file = $self->order_file(); + sysopen ORDER, $order_file, Fcntl::O_WRONLY|Fcntl::O_CREAT, 0644 or + die "can't write $order_file: $!\n"; + binmode ORDER; + print ORDER <<EOT; +# +# to specify the order of LiveFrame galleries manually, set the manual +# gallery ordering variable in your liveframe script to "yes" and enter +# the name of each gallery directory, each on it's own line, below. +# + +EOT + close ORDER; + + my $hidden_file = $self->hidden_file(); + sysopen HIDDEN, $hidden_file, Fcntl::O_WRONLY|Fcntl::O_CREAT, 0644 or + die "can't write $hidden_file: $!\n"; + binmode HIDDEN; + print HIDDEN <<EOT; +# +# to prevent LiveFrame galleries from being displayed in the gallery +# index or in the previous/next gallery interface on the start page, +# enter their names, each on it's own line, below. +# +# e.g.; to hide the gallery "sample" from the index, uncomment the +# following line: +# + +EOT + close HIDDEN; + + umask $old_umask; + + $self->{exists} = 1; + + return 1; +} + sub dirname { my ($self) = @_; return File::Basename::dirname($self->path()); +} + +sub exists { + my ($self) = @_; + unless (defined $self->{exists}) { + $self->{exists} = -f $self->hidden_file() ? 1 : 0; + } + return $self->{exists}; } sub num_galleries { |
From: <ix...@us...> - 2002-01-04 00:25:12
|
ixjonez 02/01/03 16:25:11 Modified: lib/LiveFrame Tag: Èå `¶@¨Ð ¨Ð Æ °µ @y Pt À· À· ¶@¶@¶@¶@¶@¶@ ¶@ ¶@èx èx °¶@°¶@¸¶@¸¶@À¶@À¶@ȶ@ȶ@ж@ж@0· 0· à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@ /tmp/cvs-serv10850/lib/LiveFrame/Gallery.pm No tag Gallery.pm Log: implement directory and file creation Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.3 +79 -2 commons/lib/LiveFrame/Gallery.pm Index: /tmp/cvs-serv10850/lib/LiveFrame/Gallery.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Gallery.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /tmp/cvs-serv10850/lib/LiveFrame/Gallery.pm 2001/12/19 05:26:51 1.2 +++ /tmp/cvs-serv10850/lib/LiveFrame/Gallery.pm 2002/01/04 00:25:11 1.3 @@ -8,6 +8,10 @@ @LiveFrame::Gallery::ISA = 'LiveFrame::PhotoDir'; +use constant CONFIG_FILE => 'config'; +use constant DISPLAY_DIR => 'display'; +use constant PREVIEW_DIR => 'preview'; + sub new { my ($type, $site, $dir) = @_; my $class = ref($type) || $type; @@ -46,11 +50,67 @@ ## public methods sub create { - my ($self, $pos, $perms) = @_; + my ($self, $perms) = @_; + $perms ||= 0755; + + if ($self->exists()) { + die "can't create: site previously exists\n"; + } + + my $old_umask = umask; + umask 0000; $self->SUPER::create($perms); - $self->{site}->add_gallery($pos); + undef $self->{exists}; + + my $display_dir = $self->display_dir(); + File::Path::mkpath($display_dir, undef, $perms) or + die "can't mkdir $display_dir: $!\n"; + + my $preview_dir = $self->preview_dir(); + File::Path::mkpath($preview_dir, undef, $perms) or + die "can't mkdir $preview_dir: $!\n"; + + my $config_file = $self->config_file(); + sysopen CONFIG, $config_file, Fcntl::O_WRONLY|Fcntl::O_CREAT, 0644 or + die "can't write $config_file: $!\n"; + binmode CONFIG; + + my $title = $self->title(); + my $description = $self->description(); + + print CONFIG <<EOT; +# LiveFrame configuration file +# +# the first uncommented line MUST contain the title of your series. you can +# optionally specify a description for the series. +# +# format - +# title} description +# +# (note that if you changed the seperator configuration option to something +# other than "}" you should use that to seperate the title from the description # instead.) + +$title} $description + +# the rest of the file should contain the filename of each photo on a single +# line. you optionally specify a caption for each photo. +# +# format - +# title} caption +# +# (note that if you changed the seperator configuration option to something +# other than "}" you should use that to seperate the title from the caption +# instead.) + +EOT + close CONFIG; + + umask $old_umask; + + $self->{exists} = 1; + return 1; } @@ -74,6 +134,23 @@ sub shown { my ($self) = @_; return $self->{visibility} || undef; +} + +# private methods + +sub config_file { + my ($self) = @_; + return File::Spec->catfile($self->path(), CONFIG_FILE); +} + +sub display_dir { + my ($self) = @_; + return File::Spec->catdir($self->path(), DISPLAY_DIR); +} + +sub preview_dir { + my ($self) = @_; + return File::Spec->catdir($self->path(), PREVIEW_DIR); } 1; No revision No revision 1.3 +79 -2 commons/lib/LiveFrame/Gallery.pm Index: Gallery.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Gallery.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Gallery.pm 2001/12/19 05:26:51 1.2 +++ Gallery.pm 2002/01/04 00:25:11 1.3 @@ -8,6 +8,10 @@ @LiveFrame::Gallery::ISA = 'LiveFrame::PhotoDir'; +use constant CONFIG_FILE => 'config'; +use constant DISPLAY_DIR => 'display'; +use constant PREVIEW_DIR => 'preview'; + sub new { my ($type, $site, $dir) = @_; my $class = ref($type) || $type; @@ -46,11 +50,67 @@ ## public methods sub create { - my ($self, $pos, $perms) = @_; + my ($self, $perms) = @_; + $perms ||= 0755; + + if ($self->exists()) { + die "can't create: site previously exists\n"; + } + + my $old_umask = umask; + umask 0000; $self->SUPER::create($perms); - $self->{site}->add_gallery($pos); + undef $self->{exists}; + + my $display_dir = $self->display_dir(); + File::Path::mkpath($display_dir, undef, $perms) or + die "can't mkdir $display_dir: $!\n"; + + my $preview_dir = $self->preview_dir(); + File::Path::mkpath($preview_dir, undef, $perms) or + die "can't mkdir $preview_dir: $!\n"; + + my $config_file = $self->config_file(); + sysopen CONFIG, $config_file, Fcntl::O_WRONLY|Fcntl::O_CREAT, 0644 or + die "can't write $config_file: $!\n"; + binmode CONFIG; + + my $title = $self->title(); + my $description = $self->description(); + + print CONFIG <<EOT; +# LiveFrame configuration file +# +# the first uncommented line MUST contain the title of your series. you can +# optionally specify a description for the series. +# +# format - +# title} description +# +# (note that if you changed the seperator configuration option to something +# other than "}" you should use that to seperate the title from the description # instead.) + +$title} $description + +# the rest of the file should contain the filename of each photo on a single +# line. you optionally specify a caption for each photo. +# +# format - +# title} caption +# +# (note that if you changed the seperator configuration option to something +# other than "}" you should use that to seperate the title from the caption +# instead.) + +EOT + close CONFIG; + + umask $old_umask; + + $self->{exists} = 1; + return 1; } @@ -74,6 +134,23 @@ sub shown { my ($self) = @_; return $self->{visibility} || undef; +} + +# private methods + +sub config_file { + my ($self) = @_; + return File::Spec->catfile($self->path(), CONFIG_FILE); +} + +sub display_dir { + my ($self) = @_; + return File::Spec->catdir($self->path(), DISPLAY_DIR); +} + +sub preview_dir { + my ($self) = @_; + return File::Spec->catdir($self->path(), PREVIEW_DIR); } 1; |
From: <ix...@us...> - 2002-01-04 00:23:42
|
ixjonez 02/01/03 16:23:41 Modified: lib/LiveFrame Tag: hõ `¶@h¶@h¶@Øt @{ À ® ¶@¶@0n h° ¶@¶@¶@¶@ ¶@ ¶@¨¶@¨¶@°¶@°¶@¸¶@¸¶@À¶@À¶@ȶ@ȶ@@ @ à¶@à¶@ð Pu ð¶@ð¶@ø¶@ø¶@ /tmp/cvs-serv10210/lib/LiveFrame/Application.pm No tag Application.pm Log: rearrange the order and requirements for form validation and action performing. Revision Changes Path No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.2 +29 -32 commons/lib/LiveFrame/Application.pm Index: /tmp/cvs-serv10210/lib/LiveFrame/Application.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Application.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /tmp/cvs-serv10210/lib/LiveFrame/Application.pm 2001/12/19 05:36:13 1.1 +++ /tmp/cvs-serv10210/lib/LiveFrame/Application.pm 2002/01/04 00:23:41 1.2 @@ -42,7 +42,6 @@ sub action { my ($self, $name) = @_; - return undef unless $name; return $self->{actions}->{$name}; } @@ -573,41 +572,39 @@ return 0; } - if ($action) { - my $form = eval { $self->current_form() }; + my $form = eval { $self->current_form() }; + if ($@) { + $self->send_error("can't get current form: $@"); + return 0; + } + + if ($form) { + # validate the form + eval { $form->validate($self) }; if ($@) { - $self->send_error("can't get current form: $@"); - return 0; - } + # the form did not validate successfully. reset form + # variables and set errors. send the previous page again. + $self->attr('errors', $@); + $self->fill_in_form($form); - if ($form) { - # validate the form - eval { $form->validate($self) }; - if ($@) { - # the form did not validate successfully. reset form - # variables and set errors. send the previous page again. - $self->attr('errors', $@); - $self->fill_in_form($form); - - # XXX: requires the previous action to have the same name - # as the form in the page htat it sends - $self->current_action_name($form->name()); - $action = $self->current_action(); - } - } - else { - # the action did not involve a form - # XXX: how to signal that an action requires a form submission? + # XXX: requires the previous action to have the same name + # as the form in the page htat it sends + $self->current_action_name($form->name()); + $action = $self->current_action(); } + } + else { + # the action did not involve a form + # XXX: how to signal that an action requires a form submission? + } - # if the action wasn't unset (usually by an invalid form - # submission), execute the action method, which will send a - # page when it completes - if ($action) { - eval { $action->perform($self, $form) }; - if ($@) { - $self->send_error($@); - } + # if the action wasn't unset (usually by an invalid form + # submission), execute the action method, which will send a + # page when it completes + if ($action) { + eval { $action->perform($self, $form) }; + if ($@) { + $self->send_error($@); } } No revision No revision 1.2 +29 -32 commons/lib/LiveFrame/Application.pm Index: Application.pm =================================================================== RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Application.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Application.pm 2001/12/19 05:36:13 1.1 +++ Application.pm 2002/01/04 00:23:41 1.2 @@ -42,7 +42,6 @@ sub action { my ($self, $name) = @_; - return undef unless $name; return $self->{actions}->{$name}; } @@ -573,41 +572,39 @@ return 0; } - if ($action) { - my $form = eval { $self->current_form() }; + my $form = eval { $self->current_form() }; + if ($@) { + $self->send_error("can't get current form: $@"); + return 0; + } + + if ($form) { + # validate the form + eval { $form->validate($self) }; if ($@) { - $self->send_error("can't get current form: $@"); - return 0; - } + # the form did not validate successfully. reset form + # variables and set errors. send the previous page again. + $self->attr('errors', $@); + $self->fill_in_form($form); - if ($form) { - # validate the form - eval { $form->validate($self) }; - if ($@) { - # the form did not validate successfully. reset form - # variables and set errors. send the previous page again. - $self->attr('errors', $@); - $self->fill_in_form($form); - - # XXX: requires the previous action to have the same name - # as the form in the page htat it sends - $self->current_action_name($form->name()); - $action = $self->current_action(); - } - } - else { - # the action did not involve a form - # XXX: how to signal that an action requires a form submission? + # XXX: requires the previous action to have the same name + # as the form in the page htat it sends + $self->current_action_name($form->name()); + $action = $self->current_action(); } + } + else { + # the action did not involve a form + # XXX: how to signal that an action requires a form submission? + } - # if the action wasn't unset (usually by an invalid form - # submission), execute the action method, which will send a - # page when it completes - if ($action) { - eval { $action->perform($self, $form) }; - if ($@) { - $self->send_error($@); - } + # if the action wasn't unset (usually by an invalid form + # submission), execute the action method, which will send a + # page when it completes + if ($action) { + eval { $action->perform($self, $form) }; + if ($@) { + $self->send_error($@); } } |
From: <ix...@us...> - 2001-12-19 05:36:13
|
ixjonez 01/12/18 21:36:13 Added: lib/LiveFrame Action.pm Application.pm Errors.pm Form.pm Log: move application classes to commons Revision Changes Path 1.1 commons/lib/LiveFrame/Action.pm Index: Action.pm =================================================================== # -*- Mode: Perl; indent-tabs-mode: nil; -*- package LiveFrame::Action; use strict; sub new { my ($type, $params) = @_; my $class = ref($type) || $type; my $self = bless { name => undef, }, $class; $self->init($params || {}); return $self; } sub init { my ($self, $params) = @_; $self->name($params->{name}) if $params->{name}; return 1; } sub name { my $self = shift; $self->{name} = shift if @_; return $self->{name}; } 1; 1.1 commons/lib/LiveFrame/Application.pm Index: Application.pm =================================================================== # -*- Mode: Perl; indent-tabs-mode: nil; -*- package LiveFrame::Application; use strict; use AppConfig (); use CGI (); use Cwd (); use File::Spec (); use HTML::Entities (); use Template 2.0.6 (); use URI (); $LiveFrame::Application::VERSION = '0.01'; sub new { my ($type) = @_; my $class = ref($type) || $type; my $self = bless { actions => {}, attrs => {}, cgi => undef, committed => undef, config => undef, config_processed => undef, config_file => undef, current_action_name => undef, current_control_name => undef, current_form_name => undef, default_action_name => undef, default_error_page => undef, forms => {}, template_dir => undef, tproc => undef, }, $class; return $self; } ## accessor methods sub action { my ($self, $name) = @_; return undef unless $name; return $self->{actions}->{$name}; } sub actions { my ($self) = @_; my @actions = values %{ $self->{actions} }; return wantarray ? @actions : \@actions; } sub add_action { my ($self, $name, $class) = @_; return undef unless $name && $class; eval "require $class"; die "can't load action class $class: $@\n" if $@; my $action = $class->new(); $action->name($name); $self->{actions}->{$name} = $action; return 1; } sub add_form { my ($self, $name, $class) = @_; return undef unless $name && $class; eval "require $class"; die "can't load action class $class: $@\n" if $@; my $form = $class->new(); $form->name($name); $self->{forms}->{$name} = $form; return 1; } sub attr { my $self = shift; my $name = shift or return undef; $self->{attrs}->{$name} = shift if @_; return $self->{attrs}->{$name}; } sub attrs { my ($self) = @_; my @names = keys %{ $self->{attrs} }; return wantarray ? @names : \@names; } sub cgi { my ($self) = @_; $self->{cgi} ||= CGI->new(); return $self->{cgi}; } sub config_vars { my ($self) = @_; $self->{config}->define("template_dir=s", { DEFAULT => '../share/tmpl' }); $self->{config}->define("img_url=s", { DEFAULT => '../lab/img' }); $self->{config}->define("css_url=s", { DEFAULT => '../lab' }); return 1; } sub config { my ($self) = @_; my $config_error = sub { die @_, "\n"; }; unless ($self->{config}) { my $config_opts = { PEDANTIC => 1, ERROR => $config_error, GLOBAL => {EXPAND => AppConfig::EXPAND_ALL}, }; $self->{config} = AppConfig->new($config_opts); $self->config_vars(); } return $self->{config}; } sub config_file { my $self = shift; my $orig = shift if @_; if (defined $orig || ! defined $self->{config_file}) { $orig ||= $self->config()->config_file(); my $file = File::Spec->file_name_is_absolute($orig) ? File::Spec->canonpath($orig) : File::Spec->rel2abs($orig, Cwd::getcwd()); -f $file or die "config file $file not found\n"; $self->{config_file} = $file; } return $self->{config_file}; } sub control { my ($self) = @_; $self->form() unless defined $self->{control}; return $self->{control}; } sub css_url { my ($self) = @_; return $self->config()->css_url(); } sub current_action { my ($self) = @_; my $name = $self->current_action_name(); return defined $name ? $self->action($name) : $self->default_action(); } sub current_action_name { my $self = shift; if (@_) { $self->{current_action_name} = shift; } elsif (! defined $self->{current_action_name}) { my $path_info = $self->cgi()->path_info(); if ($path_info) { $path_info =~ s|^/||; if ($path_info) { ($self->{current_action_name} = $path_info) =~ s|/|_|g; } } } return $self->{current_action_name}; } sub current_form { my ($self) = @_; my $form = $self->form($self->current_form_name()) or return undef; $form->control($self->current_control_name()); my $cgi = $self->cgi(); for my $name ($cgi->param()) { $form->$name($cgi->param($name)) if $form->can($name); } return $form; } sub current_control_name { my $self = shift; $self->{current_control_name} = shift if @_; return $self->{current_control_name}; } sub current_form_name { my $self = shift; if (@_) { my $name = shift; unless ($self->form($name)) { die "current form $name is not defined\n"; } $self->{current_form_name} = $name; } elsif (! defined $self->{current_form_name}) { for my $name ($self->cgi()->param()) { ($self->{current_form_name}, $self->{current_control_name}) = ($name =~ m|^form_(.+)_(.+)$|); last if defined $self->{current_form_name}; } } return $self->{current_form_name}; } sub default_action { my ($self) = @_; return $self->action($self->default_action_name()); } sub default_action_name { my $self = shift; $self->{default_action_name} = shift if @_; return $self->{default_action_name}; } sub default_error_page { my $self = shift; $self->{default_error_page} = shift if @_; return $self->{default_error_page}; } sub form { my ($self, $name) = @_; return undef unless $name; return $self->{forms}->{$name}; } sub forms { my ($self) = @_; my @forms = values %{ $self->{forms} }; return wantarray ? @forms : \@forms; } sub img_url { my ($self) = @_; return $self->config()->img_url(); } sub remove_action { my ($self, $name) = @_; return undef unless $name; delete $self->{actions}->{name}; return 1; } sub remove_form { my ($self, $name) = @_; return undef unless $name; delete $self->{forms}->{name}; return 1; } sub template_dir { my ($self) = @_; unless (defined $self->{template_dir}) { my $orig = $self->config()->template_dir(); $self->{template_dir} = File::Spec->file_name_is_absolute($orig) ? File::Spec->canonpath($orig) : File::Spec->rel2abs($orig, Cwd::getcwd()); } return $self->{template_dir}; } sub tproc { my ($self) = @_; unless ($self->{tproc}) { my $tproc_opts = { INCLUDE_PATH => $self->template_dir(), PLUGIN_BASE => 'LiveFrame::Template::Plugin', }; $self->{tproc} = Template->new($tproc_opts); } return $self->{tproc}; } ## application utility methods sub fill_in_form { my ($self, $form) = @_; for my $name ($form->fields()) { $self->attr($name, $form->field($name)); } return 1; } sub process_config { my ($self) = @_; unless ($self->{config_processed}) { $self->config()->file($self->config_file()); $self->{config_processed} = 1; } return 1; } sub process_template { my ($self, $page, $tparams) = @_; $tparams ||= {}; my $cgi = $self->cgi(); my $config = $self->config(); my $tproc = $self->tproc(); for my $name ($self->attrs()) { $tparams->{$name} = $self->attr($name); } $tparams->{application} = $self; $tparams->{config} = $self->config(); $tparams->{cgi} = $self->cgi(); $tparams->{page} = $page; my $current_form_name = $self->current_form_name() || ''; if ($current_form_name eq $page) { my $form = $self->current_form(); if ($form) { $tparams->{form} = $form; } } $tparams->{self_url} = $self->url($cgi->script_name()); $tparams->{img_url} = $self->url($config->img_url()); $tparams->{css_url} = $self->url($config->css_url()); $tproc->process($self->template($page), $tparams) or do { $self->send_tmpl_error($tproc->error(), $page); }; return 1; } sub send_header { my ($self) = @_; print $self->cgi()->header() unless $self->{committed}; $self->{committed} = 1; return 1; } sub send_page { my ($self, $page) = @_; $self->send_header(); return $self->process_template($page); } sub send_redirect { my ($self, $page) = @_; my $cgi = $self->cgi(); print $cgi->redirect(join('/', $cgi->script_name(), $page)); return 1; } sub send_error { my ($self, $msg, $tmpl) = @_; $self->send_header(); my $error_page = $self->default_error_page(); if (defined $error_page) { my $tparams = { error_msg => $msg }; if (defined $tmpl) { $tparams->{error_type} = 'template'; $tparams->{error_tmpl} = $tmpl; } else { $tparams->{error_type} = 'application'; } return $self->process_template($error_page, $tparams); } $msg = HTML::Entities::encode_entities($msg); print <<EOT; <p> <b>Application Error</b> </p> <p> An internal application error was encountered: </p> <pre> $msg </pre> EOT return 1; } sub send_tmpl_error { my ($self, $error, $page) = @_; my $msg = $error->info() || ''; $msg =~ s|\\n|\n|g; my $tmpl = $self->template($page); eval { $self->send_error($msg, $tmpl) }; if ($@) { $msg = HTML::Entities::encode_entities($msg); print <<EOT; <p> <b>Template Error</b> </p> <p> An error was encountered processing <i>$tmpl</i>: </p> <pre> $msg </pre> <p> Additionally, an error was encountered processing the default error page: </p> <pre> $@ </pre> EOT } return 1; } sub template { my ($self, $page) = @_; return join('.', $page, 'tmpl'); } sub url { my ($self, $path) = @_; my $cgi = $self->cgi(); my $scheme = $cgi->https() ? 'https' : 'http'; my $url = URI->new($path, $scheme); my $abs = $url->abs($cgi->script_name()); $abs =~ s|/$||; return $abs; } ## run methods sub start { my ($self, $params) = @_; return 1 unless $params; $self->config_file($params->{config_file}); $self->default_action_name($params->{default_action_name} || 'default'); $self->default_error_page($params->{default_error_page}); if ($params->{config_vars}) { unless (UNIVERSAL::isa($params->{config_vars}, 'ARRAY')) { die "application init param 'config_vars' must be an array ref\n"; } my $config = $self->config(); for my $var (@{ $params->{config_vars} }) { $config->define($var); } } if ($params->{actions}) { unless (UNIVERSAL::isa($params->{actions}, 'ARRAY')) { die "application init param 'actions' must be an array ref\n"; } for (my $i = 0; $i < @{ $params->{actions} }; $i++) { my $action_params = $params->{actions}->[$i]; unless (UNIVERSAL::isa($params, 'HASH')) { die "application init param 'actions[$i]'", " must be an array ref\n"; } unless (defined $action_params->{name}) { die "application init param 'actions[$i]", "->name'", " must be defined\n"; } unless (defined $action_params->{class}) { die "application init param 'actions[$i]", "->class'", " must be defined\n"; } $self->add_action($action_params->{name}, $action_params->{class}); } } if ($params->{forms}) { unless (UNIVERSAL::isa($params->{forms}, 'ARRAY')) { die "application init param 'forms' must be an array ref\n"; } for (my $i = 0; $i < @{ $params->{forms} }; $i++) { my $form_params = $params->{forms}->[$i]; unless (UNIVERSAL::isa($params, 'HASH')) { die "application init param 'forms[$i]'", " must be an array ref\n"; } unless (defined $form_params->{name}) { die "application init param 'forms[$i]", "->name'", " must be defined\n"; } unless (defined $form_params->{class}) { die "application init param 'forms[$i]", "->class'", " must be defined\n"; } $self->add_form($form_params->{name}, $form_params->{class}); } } return 1; } sub run { my ($self, $params) = @_; eval { $self->start($params) }; if ($@) { $self->send_error("application could not be started: $@"); return 0; } # force the config file to be read. eval { $self->process_config() }; if ($@) { $self->send_error("config file error: $@"); return 0; } my $action = eval { $self->current_action() }; if ($@) { $self->send_error("can't get current action: $@"); return 0; } if ($action) { my $form = eval { $self->current_form() }; if ($@) { $self->send_error("can't get current form: $@"); return 0; } if ($form) { # validate the form eval { $form->validate($self) }; if ($@) { # the form did not validate successfully. reset form # variables and set errors. send the previous page again. $self->attr('errors', $@); $self->fill_in_form($form); # XXX: requires the previous action to have the same name # as the form in the page htat it sends $self->current_action_name($form->name()); $action = $self->current_action(); } } else { # the action did not involve a form # XXX: how to signal that an action requires a form submission? } # if the action wasn't unset (usually by an invalid form # submission), execute the action method, which will send a # page when it completes if ($action) { eval { $action->perform($self, $form) }; if ($@) { $self->send_error($@); } } } unless ($action) { # no action exists for the specified action name so assume # it's a page name # XXX: set a config switch to disable page sending? # my $msg = sprintf("requested action [%s] not defined", # $self->current_action_name()); # $self->send_error($msg); # return 0; eval { $self->send_page($self->current_action_name() || $self->default_action_name()); }; if ($@) { $self->send_error($@); } } return 0; } 1; 1.1 commons/lib/LiveFrame/Errors.pm Index: Errors.pm =================================================================== # -*- Mode: Perl; indent-tabs-mode: nil; -*- package LiveFrame::Errors; use strict; sub new { my ($type, $params) = @_; my $class = ref($type) || $type; my $self = bless { errors => {}, }, $class; $self->init($params || {}); return $self; } sub init { my ($self, $params) = @_; return 1; } sub add_error { my ($self, $msg, $name) = @_; return undef unless defined $msg; $name ||= 'default'; $self->{errors}->{$name} ||= []; push @{ $self->{errors}->{$name} }, $msg; return 1; } sub errors { my ($self, $name) = @_; $name ||= 'default'; return undef unless exists $self->{errors}->{$name}; my @errors = @{ $self->{errors}->{$name} }; return wantarray ? @errors : \@errors; } sub error_types { my ($self) = @_; my @types = keys %{ $self->{types} }; return wantarray ? @types : \@types; } sub remove_errors { my ($self, $name) = @_; return undef unless $name; delete $self->{errors}->{name}; return 1; } 1; 1.1 commons/lib/LiveFrame/Form.pm Index: Form.pm =================================================================== # -*- Mode: Perl; indent-tabs-mode: nil; -*- package LiveFrame::Form; use strict; sub new { my ($type, $params) = @_; my $class = ref($type) || $type; my $self = bless { control => undef, name => undef, fields => {}, }, $class; $self->init($params || {}); return $self; } sub init { my ($self, $params) = @_; $self->name($params->{name}) if $params->{name}; $self->control($params->{control}) if $params->{control}; return 1; } ## accessors sub control { my $self = shift; $self->{control} = shift if @_; return $self->{control}; } sub field { my $self = shift; my $name = shift or return undef; $self->{fields}->{$name} = shift if @_; return $self->{fields}->{$name}; } sub fields { my $self = shift; my @names = keys %{ $self->{fields} }; return wantarray ? @names : \@names; } sub name { my $self = shift; $self->{name} = shift if @_; return $self->{name}; } ## public methods sub validate { my ($self, $lab) = @_; return 1; } 1; |