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...> - 2001-12-19 05:34:48
|
ixjonez 01/12/18 21:34:47 Removed: lib/LiveFrame Action.pm Application.pm Errors.pm Form.pm Log: moved to commons |
|
From: <ix...@us...> - 2001-12-19 05:33:28
|
ixjonez 01/12/18 21:33:27
Modified: share/docs Tag: Æ `¶@h¶@h¶@
/tmp/cvs-serv8826/lab/share/docs/TODO.txt No tag
TODO.txt
Log:
sync
Revision Changes Path
No revision
No revision
No revision
No revision
1.2 +5 -4 lab/share/docs/TODO.txt
Index: /tmp/cvs-serv8826/lab/share/docs/TODO.txt
===================================================================
RCS file: /cvsroot/liveframe/lab/share/docs/TODO.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /tmp/cvs-serv8826/lab/share/docs/TODO.txt 2001/11/30 01:03:04 1.1
+++ /tmp/cvs-serv8826/lab/share/docs/TODO.txt 2001/12/19 05:33:27 1.2
@@ -15,11 +15,12 @@
Lab:
- o object model
- o classes
- o move start action stuff into start template
-
installation:
o automated installation
+docs:
+
+ o update template and configuration docs with latest info
+ o add design doc and "how to extend" doc with details of forms,
+ actions, etc
No revision
No revision
1.2 +5 -4 lab/share/docs/TODO.txt
Index: TODO.txt
===================================================================
RCS file: /cvsroot/liveframe/lab/share/docs/TODO.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TODO.txt 2001/11/30 01:03:04 1.1
+++ TODO.txt 2001/12/19 05:33:27 1.2
@@ -15,11 +15,12 @@
Lab:
- o object model
- o classes
- o move start action stuff into start template
-
installation:
o automated installation
+docs:
+
+ o update template and configuration docs with latest info
+ o add design doc and "how to extend" doc with details of forms,
+ actions, etc
|
|
From: <ix...@us...> - 2001-12-19 05:32:38
|
ixjonez 01/12/18 21:32:37
Modified: lib/LiveFrame/Lab Tag: @Ô `¶@h¶@h¶@ ¸ x¶@x¶@Ày
Ày ° ° ¶@¶@¶@¶@ ¶@ ¶@¨¶@¨¶@x x
¸¶@¸¶@À¶@À¶@ȶ@ȶ@P« P« ȹ ¯
à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@
/tmp/cvs-serv8512/lab/lib/LiveFrame/Lab/SpecForm.pm
No tag SpecForm.pm
Log:
make gallery position a required form field
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 +8 -2 lab/lib/LiveFrame/Lab/SpecForm.pm
Index: /tmp/cvs-serv8512/lab/lib/LiveFrame/Lab/SpecForm.pm
===================================================================
RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/SpecForm.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /tmp/cvs-serv8512/lab/lib/LiveFrame/Lab/SpecForm.pm 2001/12/02 12:48:11 1.1
+++ /tmp/cvs-serv8512/lab/lib/LiveFrame/Lab/SpecForm.pm 2001/12/19 05:32:37 1.2
@@ -83,9 +83,15 @@
sub validate {
my ($self, $lab) = @_;
- unless ($self->gallery_dir()) {
+ my $gallery_dir = $self->gallery_dir();
+ my $gallery_position = $self->gallery_position();
+
+ unless (defined $gallery_dir && defined $gallery_position) {
my $errors = LiveFrame::Errors->new();
- $errors->add_error('gallery directory not specified');
+ $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.2 +8 -2 lab/lib/LiveFrame/Lab/SpecForm.pm
Index: SpecForm.pm
===================================================================
RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/SpecForm.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SpecForm.pm 2001/12/02 12:48:11 1.1
+++ SpecForm.pm 2001/12/19 05:32:37 1.2
@@ -83,9 +83,15 @@
sub validate {
my ($self, $lab) = @_;
- unless ($self->gallery_dir()) {
+ my $gallery_dir = $self->gallery_dir();
+ my $gallery_position = $self->gallery_position();
+
+ unless (defined $gallery_dir && defined $gallery_position) {
my $errors = LiveFrame::Errors->new();
- $errors->add_error('gallery directory not specified');
+ $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...> - 2001-12-19 05:31:14
|
ixjonez 01/12/18 21:31:13
Modified: lib/LiveFrame/Lab Tag: Ó `¶@h¶@h¶@§ § Ðy Ðy øp
Hx y y ¶@¶@ Æ Æ
¶@ ¶@¨¶@¨¶@°¶@°¶@¸´ 0Ç
À¶@À¶@ȶ@ȶ@ж@ж@ض@ض@à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@
/tmp/cvs-serv8167/lab/lib/LiveFrame/Lab/GalleryAction.pm
No tag GalleryAction.pm
Log:
work in progress: stub creating the gallery on disk
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 +21 -1 lab/lib/LiveFrame/Lab/GalleryAction.pm
Index: /tmp/cvs-serv8167/lab/lib/LiveFrame/Lab/GalleryAction.pm
===================================================================
RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/GalleryAction.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /tmp/cvs-serv8167/lab/lib/LiveFrame/Lab/GalleryAction.pm 2001/12/02 12:48:11 1.2
+++ /tmp/cvs-serv8167/lab/lib/LiveFrame/Lab/GalleryAction.pm 2001/12/19 05:31:12 1.3
@@ -4,11 +4,31 @@
use strict;
use LiveFrame::Action ();
+use LiveFrame::Site ();
+use LiveFrame::Gallery ();
@LiveFrame::Lab::GalleryAction::ISA = ('LiveFrame::Action');
sub perform {
- my ($self, $lab) = @_;
+ my ($self, $lab, $form) = @_;
+
+ my $site = LiveFrame::Site->new($form->site_dir());
+ $site->galleries();
+
+ my $gallery = LiveFrame::Gallery->new($site, $form->gallery_dir());
+ $gallery->title($form->gallery_title());
+ $gallery->description($form->gallery_description());
+
+ my $pos = $form->gallery_position();
+ if ($pos eq 'hide') {
+ $gallery->hide();
+ }
+
+# $gallery->create();
+
+# $site->insert_gallery($pos);
+
+ use Data::Denter; warn Denter $gallery;
return $lab->send_page('image');
}
No revision
No revision
1.3 +21 -1 lab/lib/LiveFrame/Lab/GalleryAction.pm
Index: GalleryAction.pm
===================================================================
RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/GalleryAction.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GalleryAction.pm 2001/12/02 12:48:11 1.2
+++ GalleryAction.pm 2001/12/19 05:31:12 1.3
@@ -4,11 +4,31 @@
use strict;
use LiveFrame::Action ();
+use LiveFrame::Site ();
+use LiveFrame::Gallery ();
@LiveFrame::Lab::GalleryAction::ISA = ('LiveFrame::Action');
sub perform {
- my ($self, $lab) = @_;
+ my ($self, $lab, $form) = @_;
+
+ my $site = LiveFrame::Site->new($form->site_dir());
+ $site->galleries();
+
+ my $gallery = LiveFrame::Gallery->new($site, $form->gallery_dir());
+ $gallery->title($form->gallery_title());
+ $gallery->description($form->gallery_description());
+
+ my $pos = $form->gallery_position();
+ if ($pos eq 'hide') {
+ $gallery->hide();
+ }
+
+# $gallery->create();
+
+# $site->insert_gallery($pos);
+
+ use Data::Denter; warn Denter $gallery;
return $lab->send_page('image');
}
|
|
From: <ix...@us...> - 2001-12-19 05:29:22
|
ixjonez 01/12/18 21:29:21
Modified: lib/LiveFrame Tag: × `¶@h¶@h¶@ À
x¶@x¶@¶@¶@8² 8² ¶@¶@¶@¶@ ¶@ ¶@È©
È© ¨« ¨« ذ ذ À¶@À¶@ȶ@ȶ@ж@ж@¨± ¨±
à¶@à¶@è¶@è¶@ð¶@ð¶@8¼ 8¼
/tmp/cvs-serv7839/commons/lib/LiveFrame/Site.pm No
tag Site.pm
Log:
work in progress: add gallery loading and stub adding
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.2 +71 -23 commons/lib/LiveFrame/Site.pm
Index: /tmp/cvs-serv7839/commons/lib/LiveFrame/Site.pm
===================================================================
RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Site.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /tmp/cvs-serv7839/commons/lib/LiveFrame/Site.pm 2001/12/02 09:46:12 1.1
+++ /tmp/cvs-serv7839/commons/lib/LiveFrame/Site.pm 2001/12/19 05:29:21 1.2
@@ -32,33 +32,36 @@
}
sub galleries {
- my $self = shift;
+ my ($self, $include_hidden) = @_;
unless ($self->{galleries}) {
- $self->{galleries} = Tie::IxHash->new();
+ $self->{galleries} = Tie::IxHash->new(),
- my $order_file = $self->order_file();
- open FILE, $order_file or
- die "can't open order file $order_file: $!\n";
- while (defined($_ = <FILE>)) {
- next if /^\s*#/;
- next if /^\s*$/;
- chomp;
-
- my $gallery_path = $self->gallery_path($_);
- next unless -d $gallery_path;
-
- my $gallery = LiveFrame::Gallery->new($gallery_path);
- $self->{galleries}->Push($_ => $gallery);
- }
- close FILE;
+ $self->load_galleries($self->order_file());
+ $self->load_visibility($self->hidden_file);
}
- return $self->{galleries}->Values();
+ my @g = $include_hidden ?
+ $self->{galleries}->Values() :
+ grep { $_->shown() } $self->{galleries}->Values();
+
+ return wantarray ? @g : \@g;
+}
+
+sub gallery {
+ my ($self, $dir) = @_;
+ $self->galleries();
+ return $self->{galleries}->FETCH($dir);
}
## public methods
+sub add_gallery {
+ my ($self, $pos) = @_;
+
+ return 1;
+}
+
sub basename {
my ($self) = @_;
return File::Basename::basename($self->path());
@@ -70,16 +73,61 @@
}
sub num_galleries {
- my ($self) = @_;
+ my ($self, $include_hidden) = @_;
+
$self->galleries();
- return $self->{galleries}->Length();
+
+ my $len = $include_hidden ?
+ $self->{galleries}->Length() :
+ grep { $_->shown() } $self->{galleries}->Values();
+
+ return $len;
}
## private methods
+
+sub load_galleries {
+ my ($self) = @_;
+
+ my $file = $self->order_file();
+ open FILE, $file or
+ die "can't open site file $file: $!\n";
+ while (defined($_ = <FILE>)) {
+ next if /^\s*#/;
+ next if /^\s*$/;
+ chomp;
+
+ my $gallery = LiveFrame::Gallery->new($self, $_);
+ next unless $gallery->exists();
+
+ $gallery->show();
+
+ $self->{galleries}->Push($_ => $gallery);
+ }
+ close FILE;
+
+ return 1;
+}
+
+sub load_visibility {
+ my ($self) = @_;
+
+ my $file = $self->hidden_file();
+ open FILE, $file or
+ die "can't open site file $file: $!\n";
+ while (defined($_ = <FILE>)) {
+ next if /^\s*#/;
+ next if /^\s*$/;
+ chomp;
+
+ my $gallery = $self->gallery($_);
+ next unless $gallery;
+
+ $gallery->hide();
+ }
+ close FILE;
-sub gallery_path {
- my ($self, $name) = @_;
- return File::Spec->catdir($self->path(), $name);
+ return 1;
}
sub hidden_file {
No revision
No revision
1.2 +71 -23 commons/lib/LiveFrame/Site.pm
Index: Site.pm
===================================================================
RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Site.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Site.pm 2001/12/02 09:46:12 1.1
+++ Site.pm 2001/12/19 05:29:21 1.2
@@ -32,33 +32,36 @@
}
sub galleries {
- my $self = shift;
+ my ($self, $include_hidden) = @_;
unless ($self->{galleries}) {
- $self->{galleries} = Tie::IxHash->new();
+ $self->{galleries} = Tie::IxHash->new(),
- my $order_file = $self->order_file();
- open FILE, $order_file or
- die "can't open order file $order_file: $!\n";
- while (defined($_ = <FILE>)) {
- next if /^\s*#/;
- next if /^\s*$/;
- chomp;
-
- my $gallery_path = $self->gallery_path($_);
- next unless -d $gallery_path;
-
- my $gallery = LiveFrame::Gallery->new($gallery_path);
- $self->{galleries}->Push($_ => $gallery);
- }
- close FILE;
+ $self->load_galleries($self->order_file());
+ $self->load_visibility($self->hidden_file);
}
- return $self->{galleries}->Values();
+ my @g = $include_hidden ?
+ $self->{galleries}->Values() :
+ grep { $_->shown() } $self->{galleries}->Values();
+
+ return wantarray ? @g : \@g;
+}
+
+sub gallery {
+ my ($self, $dir) = @_;
+ $self->galleries();
+ return $self->{galleries}->FETCH($dir);
}
## public methods
+sub add_gallery {
+ my ($self, $pos) = @_;
+
+ return 1;
+}
+
sub basename {
my ($self) = @_;
return File::Basename::basename($self->path());
@@ -70,16 +73,61 @@
}
sub num_galleries {
- my ($self) = @_;
+ my ($self, $include_hidden) = @_;
+
$self->galleries();
- return $self->{galleries}->Length();
+
+ my $len = $include_hidden ?
+ $self->{galleries}->Length() :
+ grep { $_->shown() } $self->{galleries}->Values();
+
+ return $len;
}
## private methods
+
+sub load_galleries {
+ my ($self) = @_;
+
+ my $file = $self->order_file();
+ open FILE, $file or
+ die "can't open site file $file: $!\n";
+ while (defined($_ = <FILE>)) {
+ next if /^\s*#/;
+ next if /^\s*$/;
+ chomp;
+
+ my $gallery = LiveFrame::Gallery->new($self, $_);
+ next unless $gallery->exists();
+
+ $gallery->show();
+
+ $self->{galleries}->Push($_ => $gallery);
+ }
+ close FILE;
+
+ return 1;
+}
+
+sub load_visibility {
+ my ($self) = @_;
+
+ my $file = $self->hidden_file();
+ open FILE, $file or
+ die "can't open site file $file: $!\n";
+ while (defined($_ = <FILE>)) {
+ next if /^\s*#/;
+ next if /^\s*$/;
+ chomp;
+
+ my $gallery = $self->gallery($_);
+ next unless $gallery;
+
+ $gallery->hide();
+ }
+ close FILE;
-sub gallery_path {
- my ($self, $name) = @_;
- return File::Spec->catdir($self->path(), $name);
+ return 1;
}
sub hidden_file {
|
|
From: <ix...@us...> - 2001-12-19 05:27:47
|
ixjonez 01/12/18 21:27:47
Modified: lib/LiveFrame Tag: Ñ `¶@h¶@h¶@¨ à x¶@x¶@È´ È´
ð« @°
¶@¶@¶@¶@ ¶@ ¶@¨¶@¨¶@°¶@°¶@¸¶@¸¶@@x
@x ȶ@ȶ@ж@ж@°¯ °¯ à¶@à¶@X» X»
ð¶@ð¶@ø¶@ø¶@
/tmp/cvs-serv7620/commons/lib/LiveFrame/PhotoDir.pm
No tag PhotoDir.pm
Log:
work in progress: add the ability to create a photo dir on disk
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 +20 -0 commons/lib/LiveFrame/PhotoDir.pm
Index: /tmp/cvs-serv7620/commons/lib/LiveFrame/PhotoDir.pm
===================================================================
RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/PhotoDir.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /tmp/cvs-serv7620/commons/lib/LiveFrame/PhotoDir.pm 2001/12/02 09:46:45 1.1
+++ /tmp/cvs-serv7620/commons/lib/LiveFrame/PhotoDir.pm 2001/12/19 05:27:47 1.2
@@ -3,6 +3,7 @@
package LiveFrame::PhotoDir;
use File::Basename ();
+use File::Path ();
use LiveFrame::Photo ();
use Tie::IxHash ();
use strict;
@@ -72,9 +73,28 @@
return File::Basename::basename($self->path());
}
+sub create {
+ my ($self, $perms) = @_;
+
+ my $path = $self->path();
+ File::Path::mkpath($path, undef, $perms) or
+ die "can't mkdir $path: $!\n";
+ $self->{exists} = 1;
+
+ return 1;
+}
+
sub dirname {
my $self = shift;
return File::Basename::dirname($self->path());
+}
+
+sub exists {
+ my ($self) = @_;
+ unless (defined $self->{exists}) {
+ $self->{exists} = -d $self->path() ? 1 : 0;
+ }
+ return $self->{exists} || undef;
}
1;
No revision
No revision
1.2 +20 -0 commons/lib/LiveFrame/PhotoDir.pm
Index: PhotoDir.pm
===================================================================
RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/PhotoDir.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PhotoDir.pm 2001/12/02 09:46:45 1.1
+++ PhotoDir.pm 2001/12/19 05:27:47 1.2
@@ -3,6 +3,7 @@
package LiveFrame::PhotoDir;
use File::Basename ();
+use File::Path ();
use LiveFrame::Photo ();
use Tie::IxHash ();
use strict;
@@ -72,9 +73,28 @@
return File::Basename::basename($self->path());
}
+sub create {
+ my ($self, $perms) = @_;
+
+ my $path = $self->path();
+ File::Path::mkpath($path, undef, $perms) or
+ die "can't mkdir $path: $!\n";
+ $self->{exists} = 1;
+
+ return 1;
+}
+
sub dirname {
my $self = shift;
return File::Basename::dirname($self->path());
+}
+
+sub exists {
+ my ($self) = @_;
+ unless (defined $self->{exists}) {
+ $self->{exists} = -d $self->path() ? 1 : 0;
+ }
+ return $self->{exists} || undef;
}
1;
|
|
From: <ix...@us...> - 2001-12-19 05:26:52
|
ixjonez 01/12/18 21:26:51
Modified: lib/LiveFrame Tag: 8Ì `¶@h¶@h¶@øª à x¶@x¶@È´ È´
@° @°
¶@¶@¶@¶@ ¶@ ¶@¨¶@¨¶@°¶@°¶@¸¶@¸¶@@x
@x
ȶ@ȶ@ж@ж@ض@ض@à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@
/tmp/cvs-serv7384/commons/lib/LiveFrame/Gallery.pm
No tag Gallery.pm
Log:
work in process: add the ability to create a gallery on disk
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 +20 -9 commons/lib/LiveFrame/Gallery.pm
Index: /tmp/cvs-serv7384/commons/lib/LiveFrame/Gallery.pm
===================================================================
RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Gallery.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /tmp/cvs-serv7384/commons/lib/LiveFrame/Gallery.pm 2001/12/02 09:47:03 1.1
+++ /tmp/cvs-serv7384/commons/lib/LiveFrame/Gallery.pm 2001/12/19 05:26:51 1.2
@@ -3,17 +3,19 @@
package LiveFrame::Gallery;
use strict;
+use File::Spec ();
use LiveFrame::PhotoDir ();
@LiveFrame::Gallery::ISA = 'LiveFrame::PhotoDir';
sub new {
- my $type = shift;
+ my ($type, $site, $dir) = @_;
my $class = ref($type) || $type;
- my $self = $class->SUPER::new(@_);
+ my $self = $class->SUPER::new(File::Spec->catdir($site->path(), $dir));
$self->{description} = undef;
+ $self->{site} = $site;
$self->{title} = undef;
$self->{url} = undef;
$self->{visibility} = undef;
@@ -43,26 +45,35 @@
## public methods
+sub create {
+ my ($self, $pos, $perms) = @_;
+
+ $self->SUPER::create($perms);
+ $self->{site}->add_gallery($pos);
+
+ return 1;
+}
+
sub hidden {
- my $self = shift;
- return ! defined $self->{visibility};
+ my ($self) = @_;
+ return ! $self->{visibility};
}
sub hide {
- my $self = shift;
- $self->{visibility} = undef;
+ my ($self) = @_;
+ $self->{visibility} = 0;
return 1;
}
sub show {
- my $self = shift;
+ my ($self) = @_;
$self->{visibility} = 1;
return 1;
}
sub shown {
- my $self = shift;
- return defined $self->{visibility};
+ my ($self) = @_;
+ return $self->{visibility} || undef;
}
1;
No revision
No revision
1.2 +20 -9 commons/lib/LiveFrame/Gallery.pm
Index: Gallery.pm
===================================================================
RCS file: /cvsroot/liveframe/commons/lib/LiveFrame/Gallery.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Gallery.pm 2001/12/02 09:47:03 1.1
+++ Gallery.pm 2001/12/19 05:26:51 1.2
@@ -3,17 +3,19 @@
package LiveFrame::Gallery;
use strict;
+use File::Spec ();
use LiveFrame::PhotoDir ();
@LiveFrame::Gallery::ISA = 'LiveFrame::PhotoDir';
sub new {
- my $type = shift;
+ my ($type, $site, $dir) = @_;
my $class = ref($type) || $type;
- my $self = $class->SUPER::new(@_);
+ my $self = $class->SUPER::new(File::Spec->catdir($site->path(), $dir));
$self->{description} = undef;
+ $self->{site} = $site;
$self->{title} = undef;
$self->{url} = undef;
$self->{visibility} = undef;
@@ -43,26 +45,35 @@
## public methods
+sub create {
+ my ($self, $pos, $perms) = @_;
+
+ $self->SUPER::create($perms);
+ $self->{site}->add_gallery($pos);
+
+ return 1;
+}
+
sub hidden {
- my $self = shift;
- return ! defined $self->{visibility};
+ my ($self) = @_;
+ return ! $self->{visibility};
}
sub hide {
- my $self = shift;
- $self->{visibility} = undef;
+ my ($self) = @_;
+ $self->{visibility} = 0;
return 1;
}
sub show {
- my $self = shift;
+ my ($self) = @_;
$self->{visibility} = 1;
return 1;
}
sub shown {
- my $self = shift;
- return defined $self->{visibility};
+ my ($self) = @_;
+ return $self->{visibility} || undef;
}
1;
|
|
From: <ix...@us...> - 2001-12-02 12:48:12
|
ixjonez 01/12/02 04:48:11
Modified: lib/LiveFrame Tag: p`¶@h¶@h¶@X þ x¶@x¶@Ý X
î î ¶@¶@((
¨¶@¨¶@°¶@°¶@¸¶@¸¶@À¶@À¶@ȶ@ȶ@ж@ж@ض@ض@à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@
/tmp/cvs-serv2473/lib/LiveFrame/Lab.pm No tag
Lab.pm
lib/LiveFrame/Lab Tag: ·@·@·@·@·@·@ ·@
·@(·@(·@0·@0·@8·@8·@@·@@·@H·@H·@P·@P·@X·@X·@`·@`·@h·@h·@p·@p·@x·@x·@·@·@·@·@·@·@·@·@ ·@ ·@¨·@¨·@°·@°·@¸·@¸·@À·@À·@È·@È·@з@з@Ø·@Ø·@à·@à·@è·@è·@ð·@ð·@ø·@ø·@
/tmp/cvs-serv2473/lib/LiveFrame/Lab/GalleryAction.pm
No tag GalleryAction.pm
Added: lib/LiveFrame/Lab GalleryForm.pm SpecForm.pm
lib/LiveFrame/Template/Plugin LiveFrameLab.pm
share/tmpl spec.tmpl
Removed: lib/LiveFrame/Lab StartAction.pm
share/tmpl gallery.tmpl
Log:
moderate redesign of the workflow. no action necessary for the start page.
insert second step called "spec" for specifying the details of the new
gallery. submit that to a GalleryAction which creates the gallery (not
yet implemented) and moves on to the first image step.
Revision Changes Path
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/lib/LiveFrame/Lab.pm
Index: /tmp/cvs-serv2473/lib/LiveFrame/Lab.pm
===================================================================
RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /tmp/cvs-serv2473/lib/LiveFrame/Lab.pm 2001/11/30 01:03:03 1.1
+++ /tmp/cvs-serv2473/lib/LiveFrame/Lab.pm 2001/12/02 12:48:11 1.2
@@ -20,7 +20,6 @@
$config->define('site_dir=s@');
$config->define('upload_dir=s');
- $self->add_action('start', 'LiveFrame::Lab::StartAction');
$self->add_action('gallery', 'LiveFrame::Lab::GalleryAction');
$self->add_action('image', 'LiveFrame::Lab::ImageAction');
$self->add_action('review', 'LiveFrame::Lab::ReviewAction');
@@ -28,6 +27,7 @@
$self->add_action('notify', 'LiveFrame::Lab::NotifyAction');
$self->add_form('start', 'LiveFrame::Lab::StartForm');
+ $self->add_form('spec', 'LiveFrame::Lab::SpecForm');
return 1;
}
No revision
No revision
1.2 +1 -1 lab/lib/LiveFrame/Lab.pm
Index: Lab.pm
===================================================================
RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Lab.pm 2001/11/30 01:03:03 1.1
+++ Lab.pm 2001/12/02 12:48:11 1.2
@@ -20,7 +20,6 @@
$config->define('site_dir=s@');
$config->define('upload_dir=s');
- $self->add_action('start', 'LiveFrame::Lab::StartAction');
$self->add_action('gallery', 'LiveFrame::Lab::GalleryAction');
$self->add_action('image', 'LiveFrame::Lab::ImageAction');
$self->add_action('review', 'LiveFrame::Lab::ReviewAction');
@@ -28,6 +27,7 @@
$self->add_action('notify', 'LiveFrame::Lab::NotifyAction');
$self->add_form('start', 'LiveFrame::Lab::StartForm');
+ $self->add_form('spec', 'LiveFrame::Lab::SpecForm');
return 1;
}
No revision
No revision
No revision
No revision
1.2 +1 -2 lab/lib/LiveFrame/Lab/GalleryAction.pm
Index: /tmp/cvs-serv2473/lib/LiveFrame/Lab/GalleryAction.pm
===================================================================
RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/GalleryAction.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /tmp/cvs-serv2473/lib/LiveFrame/Lab/GalleryAction.pm 2001/11/30 01:03:03 1.1
+++ /tmp/cvs-serv2473/lib/LiveFrame/Lab/GalleryAction.pm 2001/12/02 12:48:11 1.2
@@ -10,8 +10,7 @@
sub perform {
my ($self, $lab) = @_;
- $lab->attr('gallery_dir', $lab->cgi()->param('upload_set_dir'));
- return $lab->send_page('gallery');
+ return $lab->send_page('image');
}
1;
No revision
No revision
1.2 +1 -2 lab/lib/LiveFrame/Lab/GalleryAction.pm
Index: GalleryAction.pm
===================================================================
RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/GalleryAction.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GalleryAction.pm 2001/11/30 01:03:03 1.1
+++ GalleryAction.pm 2001/12/02 12:48:11 1.2
@@ -10,8 +10,7 @@
sub perform {
my ($self, $lab) = @_;
- $lab->attr('gallery_dir', $lab->cgi()->param('upload_set_dir'));
- return $lab->send_page('gallery');
+ return $lab->send_page('image');
}
1;
1.1 lab/lib/LiveFrame/Lab/GalleryForm.pm
Index: GalleryForm.pm
===================================================================
# -*- Mode: Perl; indent-tabs-mode: nil; -*-
package LiveFrame::Lab::GalleryForm;
use strict;
use LiveFrame::Errors ();
use LiveFrame::Form ();
@LiveFrame::Lab::GalleryForm::ISA = ('LiveFrame::Form');
sub gallery_description {
my $self = shift;
$self->field('gallery_description', shift) if @_;
return $self->field('gallery_description');
}
sub gallery_dir {
my $self = shift;
$self->field('gallery_dir', shift) if @_;
return $self->field('gallery_dir');
}
sub gallery_position {
my $self = shift;
$self->field('gallery_position', shift) if @_;
return $self->field('gallery_position');
}
sub original_size {
my $self = shift;
$self->field('original_size', shift) if @_;
return $self->field('original_size');
}
sub gallery_title {
my $self = shift;
$self->field('gallery_title', shift) if @_;
return $self->field('gallery_title');
}
sub next_step {
my $self = shift;
$self->field('next_step', shift) if @_;
return $self->field('next_step');
}
sub site_dir {
my $self = shift;
$self->field('site_dir', shift) if @_;
return $self->field('site_dir');
}
sub thumbnail_height {
my $self = shift;
$self->field('thumbnail_height', shift) if @_;
return $self->field('thumbnail_height');
}
sub thumbnail_method {
my $self = shift;
$self->field('thumbnail_method', shift) if @_;
return $self->field('thumbnail_method');
}
sub thumbnail_percent {
my $self = shift;
$self->field('thumbnail_percent', shift) if @_;
return $self->field('thumbnail_percent');
}
sub thumbnail_width {
my $self = shift;
$self->field('thumbnail_width', shift) if @_;
return $self->field('thumbnail_width');
}
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) = @_;
unless ($self->gallery_dir()) {
my $errors = LiveFrame::Errors->new();
$errors->add_error('gallery directory not specified');
die $errors;
}
return 1;
}
1;
1.1 lab/lib/LiveFrame/Lab/SpecForm.pm
Index: SpecForm.pm
===================================================================
# -*- Mode: Perl; indent-tabs-mode: nil; -*-
package LiveFrame::Lab::SpecForm;
use strict;
use LiveFrame::Errors ();
use LiveFrame::Form ();
@LiveFrame::Lab::SpecForm::ISA = ('LiveFrame::Form');
sub gallery_description {
my $self = shift;
$self->field('gallery_description', shift) if @_;
return $self->field('gallery_description');
}
sub gallery_dir {
my $self = shift;
$self->field('gallery_dir', shift) if @_;
return $self->field('gallery_dir');
}
sub gallery_position {
my $self = shift;
$self->field('gallery_position', shift) if @_;
return $self->field('gallery_position');
}
sub original_size {
my $self = shift;
$self->field('original_size', shift) if @_;
return $self->field('original_size');
}
sub gallery_title {
my $self = shift;
$self->field('gallery_title', shift) if @_;
return $self->field('gallery_title');
}
sub next_step {
my $self = shift;
$self->field('next_step', shift) if @_;
return $self->field('next_step');
}
sub site_dir {
my $self = shift;
$self->field('site_dir', shift) if @_;
return $self->field('site_dir');
}
sub thumbnail_height {
my $self = shift;
$self->field('thumbnail_height', shift) if @_;
return $self->field('thumbnail_height');
}
sub thumbnail_method {
my $self = shift;
$self->field('thumbnail_method', shift) if @_;
return $self->field('thumbnail_method');
}
sub thumbnail_percent {
my $self = shift;
$self->field('thumbnail_percent', shift) if @_;
return $self->field('thumbnail_percent');
}
sub thumbnail_width {
my $self = shift;
$self->field('thumbnail_width', shift) if @_;
return $self->field('thumbnail_width');
}
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) = @_;
unless ($self->gallery_dir()) {
my $errors = LiveFrame::Errors->new();
$errors->add_error('gallery directory not specified');
die $errors;
}
return 1;
}
1;
1.1 lab/lib/LiveFrame/Template/Plugin/LiveFrameLab.pm
Index: LiveFrameLab.pm
===================================================================
# -*- Mode: Perl; indent-tabs-mode: nil; -*-
package LiveFrame::Template::Plugin::LiveFrame;
use strict;
use LiveFrame::Site ();
use LiveFrame::Template::Plugin::LiveFrame ();
@LiveFrame::Template::Plugin::LiveFrameLab::ISA =
('LiveFrame::Template::Plugin::LiveFrame');
sub site {
my ($self, $site_dir) = @_;
defined $site_dir or
die "site_dir not specified\n";
return LiveFrame::Site->new($site_dir);
}
sub site_dirs {
my ($self) = @_;
my $config = $self->variable('config') or
die "template variable [config] not found\n";
my $site_dirs = $config->site_dir() or
die "no gallery site directories defined\n";
return $site_dirs;
}
sub upload_dir {
my ($self) = @_;
my $config = $self->variable('config') or
die "template variable [config] not found\n";
my $upload_dir = $config->upload_dir() or
die "no upload directory defined\n";
return $upload_dir;
}
sub upload_photo_dirs {
my ($self) = @_;
my $upload_dir = $self->upload_dir() or
return undef;
opendir UPLOAD_DIR, $upload_dir or
die "can't open upload dir [$upload_dir]: $!\n";
my @upload_photo_dirs = grep { !/^\./ } readdir UPLOAD_DIR;
closedir UPLOAD_DIR;
@upload_photo_dirs or
die "no photo dirs within upload dir [$upload_dir]\n";
return \@upload_photo_dirs;
}
1;
1.1 lab/share/tmpl/spec.tmpl
Index: spec.tmpl
===================================================================
[% USE LiveFrameLab %]
[% INCLUDE header.tmpl %]
<form method="POST" action="[% LiveFrameLab.form_action('gallery') %]">
<input name="site_dir" value="[% LiveFrameLab.field('site_dir') %]" type="hidden">
<table cellpadding="0" cellspacing="0" border="0" width="550">
<tr>
<td>
<big><b>LiveFrame Lab</b></big><br>
Build a LiveFrame gallery in a few easy steps.
<br>
<br></td>
</tr>
<tr>
<td valign="top">
[% IF errors %]
<p>
<b>ERROR</b><br>
[% FOREACH e = errors.errors %]
[% e | html %]<br>
[% END %]
</p>
[% END %]
<b>GALLERY DIRECTORY</b><br>
<input name="gallery_dir" value="[% LiveFrameLab.field('gallery_dir') or LiveFrameLab.field('upload_photo_dir') %]" type="text" size="50">
<br>
<br>
<b>GALLERY TITLE</b><br>
<input name="gallery_title" value="[% LiveFrameLab.field('gallery_title') %]" type="text" size="50">
<br>
<br>
<b>GALLERY DESCRIPTION</b><br>
<textarea name="gallery_description" rows="2" cols="50" wrap="soft">
[% LiveFrameLab.field('gallery_description') %]
</textarea>
<br>
<br>
<b>ORIGINAL IMAGE SIZE</b><br>
Specify the approximate size of your originals to determine how they will be scaled for display:<br>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolor="#cccccc">
<table cellpadding="3" cellspacing="1" border="0">
<tr>
<td bgcolor="#ffffff"><br></td>
<td bgcolor="#ffffff" nowrap>
<b>ORIGINAL SIZE</b></td>
<td bgcolor="#ffffff" nowrap>
<b>IMAGES TO BUILD</b></td>
</tr>
<tr>
<td bgcolor="#ffffff" align="center">
[% IF LiveFrameLab.field('original_size') == 2048 %]
<input type="radio" name="original_size" value="2048" checked>
[% ELSE %]
<input type="radio" name="original_size" value="2048">
[% END %]
</td>
<td bgcolor="#ffffff" nowrap>
2048x1536 (or larger)</td>
<td bgcolor="#ffffff" nowrap>
<b>XL</b> (orig.), <b>L</b> (1024x768), <b>M</b> (640x480), <b>S</b> (400x300)</td>
</tr>
<tr>
<td bgcolor="#ffffff" align="center">
[% IF ! LiveFrameLab.field('original_size') or LiveFrameLab.field('original_size') == 1024 %]
<input type="radio" name="original_size" value="1024" checked>
[% ELSE %]
<input type="radio" name="original_size" value="1024">
[% END %]
</td>
<td bgcolor="#ffffff" nowrap>
1024x768</td>
<td bgcolor="#ffffff" nowrap>
<b>L</b> (orig.), <b>M</b> (640x480), <b>S</b> (400x300)</td>
</tr>
<tr>
<td bgcolor="#ffffff" align="center">
[% IF LiveFrameLab.field('original_size') == 640 %]
<input type="radio" name="original_size" value="640" checked>
[% ELSE %]
<input type="radio" name="original_size" value="640">
[% END %]
</td>
<td bgcolor="#ffffff" nowrap>
640x480</td>
<td bgcolor="#ffffff" nowrap>
<b>L</b> (orig.), <b>S</b> (400x300)</td>
</tr>
<tr>
<td bgcolor="#ffffff" align="center">
[% IF LiveFrameLab.field('original_size') == 512 %]
<input type="radio" name="original_size" value="512" checked>
[% ELSE %]
<input type="radio" name="original_size" value="512">
[% END %]
</td>
<td bgcolor="#ffffff" nowrap>
512x384 (or smaller)</td>
<td bgcolor="#ffffff" nowrap>
one size (orig.)</td>
</tr>
<tr>
<td bgcolor="#ffffff" align="center">
[% IF LiveFrameLab.field('original_size') == 'no' %]
<input type="radio" name="original_size" value="no" checked>
[% ELSE %]
<input type="radio" name="original_size" value="no">
[% END %]
</td>
<td bgcolor="#ffffff" nowrap colspan="2">
do not create scaled images</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td>
<br>
<b>THUMBNAIL SIZE</b><br>
Specify how the originals should be scaled to create thumbnails:<br>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolor="#cccccc">
<table cellpadding="3" cellspacing="1" border="0">
<tr>
<td bgcolor="#ffffff"><br></td>
<td bgcolor="#ffffff" nowrap>
<b>METHOD</b></td>
<td bgcolor="#ffffff" nowrap>
<b>SIZE</b></td>
</tr>
<tr>
<td bgcolor="#ffffff" align="center">
[% IF LiveFrameLab.field('thumbnail_method') == 'proportionally' %]
<input type="radio" name="thumbnail_method" value="proportionally" checked>
[% ELSE %]
<input type="radio" name="thumbnail_method" value="proportionally">
[% END %]
</td>
<td bgcolor="#ffffff" nowrap>
proportional (scale height and width)</td>
<td bgcolor="#ffffff" nowrap>
<select name="thumbnail_percent">
[% FOREACH p = [1..20] %]
[% IF p == LiveFrameLab.field('thumbnail_percent') %]
<option selected>[% p %]
[% ELSIF !LiveFrameLab.field('thumbnail_percent') and p == 11 %]
<option selected>[% p %]
[% ELSE %]
<option>[% p %]
[% END %]
[% END %]
</select> percent
</td>
</tr>
<tr>
<td bgcolor="#ffffff" align="center">
[% IF ! LiveFrameLab.field('thumbnail_method') or LiveFrameLab.field('thumbnail_method') == 'width' %]
<input type="radio" name="thumbnail_method" value="width" checked>
[% ELSE %]
<input type="radio" name="thumbnail_method" value="width">
[% END %]
</td>
<td bgcolor="#ffffff" nowrap>
standardized width, scaled height</td>
<td bgcolor="#ffffff" nowrap>
[% IF ! LiveFrameLab.field('thumbnail_width') %]
<input name="thumbnail_width" type="text" size="3" value="75">
[% ELSE %]
<input name="thumbnail_width" type="text" size="3" value="[% LiveFrameLab.field('thumbnail_width') %]">
[% END %]
pixels wide (proportional height)</td>
</tr>
<tr>
<td bgcolor="#ffffff" align="center">
[% IF LiveFrameLab.field('thumbnail_method') == 'height' %]
<input type="radio" name="thumbnail_method" value="height" checked>
[% ELSE %]
<input type="radio" name="thumbnail_method" value="height">
[% END %]
</td>
<td bgcolor="#ffffff" nowrap>
standardize height, scaled width</td>
<td bgcolor="#ffffff" nowrap>
[% IF ! LiveFrameLab.field('thumbnail_height') %]
<input name="thumbnail_height" type="text" size="3" value="75">
[% ELSE %]
<input name="thumbnail_height" type="text" size="3" value="[% LiveFrameLab.field('thumbnail_height') %]">
[% END %]
pixels high (proportional width)</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td>
<br>
<b>INDEX THIS GALLERY</b><br>
<table cellpadding="1" cellspacing="0" border="0">
<tr>
<td bgcolor="#cccccc">
<table cellpadding="0" cellspacing="0" border="0">
[% 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" rowspan="2">
[% g.basename | html %]
</td>
</tr>
[% ELSE %]
<tr>
<td bgcolor="#ffffff" rowspan="2">
[% 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" rowspan="2">
between
</td>
<td bgcolor="#ffffff" align="bottom">
<img src="[% LiveFrameLab.img_src('toparrow.gif') %]" align="bottom" width="14" height="10" border="0"></td>
</tr>
<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">
<b>or</b>
[% IF LiveFrameLab.field('gallery_position') == 'hide' %]
<input type="radio" name="gallery_position" value="hide" checked>
[% ELSE %]
<input type="radio" name="gallery_position" value="hide">
[% END %]
hide this gallery.
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td>
<br>
<b>WHAT'S NEXT?</b><br>
[% IF !LiveFrameLab.field('next_step') or LiveFrameLab.field('next_step') == 'continue' %]
<input type="radio" name="next_step" value="continue" checked>
[% ELSE %]
<input type="radio" name="next_step" value="continue">
[% END %]
<b>review each image</b>, specifying rotation and captioning, or
<br>
<br>
[% IF LiveFrameLab.field('next_step') == 'done' %]
<input type="radio" name="next_step" value="done" checked>
[% ELSE %]
<input type="radio" name="next_step" value="done">
[% END %]
<b>create gallery now</b>, with no image rotations, order changes or captions.
<br>
<br>
<input name="form_spec_save" type="submit" value="Save Changes and Continue...">
</td>
</tr>
</table>
</form>
[% INCLUDE footer.tmpl %]
|
|
From: <ix...@us...> - 2001-12-02 12:45:23
|
ixjonez 01/12/02 04:45:22
Modified: lib/LiveFrame/Lab Tag: ¸Å `¶@h¶@h¶@ x
¶@¶@°¯ hx È« àª
¶@¶@ ¶@ ¶@¨¶@¨¶@°¶@°¶@¸¶@¸¶@À¶@À¶@ȶ@ȶ@(¯
(¯ ض@ض@à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@
/tmp/cvs-serv2155/lib/LiveFrame/Lab/StartForm.pm No
tag StartForm.pm
Log:
/upload_set_dir/upload_photo_dir/g
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.2 +6 -12 lab/lib/LiveFrame/Lab/StartForm.pm
Index: /tmp/cvs-serv2155/lib/LiveFrame/Lab/StartForm.pm
===================================================================
RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/StartForm.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /tmp/cvs-serv2155/lib/LiveFrame/Lab/StartForm.pm 2001/11/30 01:03:03 1.1
+++ /tmp/cvs-serv2155/lib/LiveFrame/Lab/StartForm.pm 2001/12/02 12:45:22 1.2
@@ -14,29 +14,23 @@
return $self->field('site_dir');
}
-sub upload_set_dir {
+sub upload_photo_dir {
my $self = shift;
- $self->field('upload_set_dir', shift) if @_;
- return $self->field('upload_set_dir');
+ $self->field('upload_photo_dir', shift) if @_;
+ return $self->field('upload_photo_dir');
}
-sub perform {
- my ($self, $lab) = @_;
-
- return $lab->send_page('notify');
-}
-
sub validate {
my ($self, $lab) = @_;
my $site_dir = $self->site_dir();
- my $upload_set_dir = $self->upload_set_dir();
+ my $upload_photo_dir = $self->upload_photo_dir();
- unless (defined $site_dir && defined $upload_set_dir) {
+ unless (defined $site_dir && defined $upload_photo_dir) {
my $errors = LiveFrame::Errors->new();
defined $site_dir or
$errors->add_error('gallery site not specified');
- defined $upload_set_dir or
+ defined $upload_photo_dir or
$errors->add_error('upload_directory not specified');
die $errors;
}
No revision
No revision
1.2 +6 -12 lab/lib/LiveFrame/Lab/StartForm.pm
Index: StartForm.pm
===================================================================
RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Lab/StartForm.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StartForm.pm 2001/11/30 01:03:03 1.1
+++ StartForm.pm 2001/12/02 12:45:22 1.2
@@ -14,29 +14,23 @@
return $self->field('site_dir');
}
-sub upload_set_dir {
+sub upload_photo_dir {
my $self = shift;
- $self->field('upload_set_dir', shift) if @_;
- return $self->field('upload_set_dir');
+ $self->field('upload_photo_dir', shift) if @_;
+ return $self->field('upload_photo_dir');
}
-sub perform {
- my ($self, $lab) = @_;
-
- return $lab->send_page('notify');
-}
-
sub validate {
my ($self, $lab) = @_;
my $site_dir = $self->site_dir();
- my $upload_set_dir = $self->upload_set_dir();
+ my $upload_photo_dir = $self->upload_photo_dir();
- unless (defined $site_dir && defined $upload_set_dir) {
+ unless (defined $site_dir && defined $upload_photo_dir) {
my $errors = LiveFrame::Errors->new();
defined $site_dir or
$errors->add_error('gallery site not specified');
- defined $upload_set_dir or
+ defined $upload_photo_dir or
$errors->add_error('upload_directory not specified');
die $errors;
}
|
|
From: <ix...@us...> - 2001-12-02 12:44:27
|
ixjonez 01/12/02 04:44:26
Modified: share/tmpl Tag: 0Î `¶@h¶@h¶@°¬ °¬ x¶@x¶@ ° ° È
È
¶@¶@¶@¶@ ¶@ ¶@¨¶@¨¶@°¶@°¶@¸¶@¸¶@À¶@À¶@ȶ@ȶ@ж@ж@ض@ض@à¶@à¶@è¶@è¶@¨ª
¨ª » »
/tmp/cvs-serv2022/share/tmpl/start.tmpl No tag
start.tmpl
Log:
start using plugin
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.2 +8 -7 lab/share/tmpl/start.tmpl
Index: /tmp/cvs-serv2022/share/tmpl/start.tmpl
===================================================================
RCS file: /cvsroot/liveframe/lab/share/tmpl/start.tmpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /tmp/cvs-serv2022/share/tmpl/start.tmpl 2001/11/30 01:03:04 1.1
+++ /tmp/cvs-serv2022/share/tmpl/start.tmpl 2001/12/02 12:44:26 1.2
@@ -1,6 +1,7 @@
+[% USE LiveFrameLab %]
[% INCLUDE header.tmpl %]
-<form method="POST" action="[% self_url %]/gallery">
+<form method="POST" action="[% LiveFrameLab.form_action('spec') %]">
<table cellpadding="0" cellspacing="0" border="0" width="550">
<tr>
@@ -34,8 +35,8 @@
<td align="center">
<select name="site_dir">
-[% FOREACH dir = site_dirs %]
-[% IF dir == site_dir %]
+[% FOREACH dir = LiveFrameLab.site_dirs %]
+[% IF dir == LiveFrameLab.field('site_dir') %]
<option selected>[% dir | html %]
[% ELSE %]
<option>[% dir | html %]
@@ -55,10 +56,10 @@
<td> </td>
<td align="center">
-<b>[% upload_dir | html %]</b>
-<select name="upload_set_dir">
-[% FOREACH dir = upload_set_dirs %]
-[% IF dir == upload_set_dir %]
+<b>[% LiveFrameLab.upload_dir | html %]</b>
+<select name="upload_photo_dir">
+[% FOREACH dir = LiveFrameLab.upload_photo_dirs %]
+[% IF dir == LiveFrameLab.field('upload_photo_dir') %]
<option selected>[% dir | html %]
[% ELSE %]
<option>[% dir | html %]
No revision
No revision
1.2 +8 -7 lab/share/tmpl/start.tmpl
Index: start.tmpl
===================================================================
RCS file: /cvsroot/liveframe/lab/share/tmpl/start.tmpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- start.tmpl 2001/11/30 01:03:04 1.1
+++ start.tmpl 2001/12/02 12:44:26 1.2
@@ -1,6 +1,7 @@
+[% USE LiveFrameLab %]
[% INCLUDE header.tmpl %]
-<form method="POST" action="[% self_url %]/gallery">
+<form method="POST" action="[% LiveFrameLab.form_action('spec') %]">
<table cellpadding="0" cellspacing="0" border="0" width="550">
<tr>
@@ -34,8 +35,8 @@
<td align="center">
<select name="site_dir">
-[% FOREACH dir = site_dirs %]
-[% IF dir == site_dir %]
+[% FOREACH dir = LiveFrameLab.site_dirs %]
+[% IF dir == LiveFrameLab.field('site_dir') %]
<option selected>[% dir | html %]
[% ELSE %]
<option>[% dir | html %]
@@ -55,10 +56,10 @@
<td> </td>
<td align="center">
-<b>[% upload_dir | html %]</b>
-<select name="upload_set_dir">
-[% FOREACH dir = upload_set_dirs %]
-[% IF dir == upload_set_dir %]
+<b>[% LiveFrameLab.upload_dir | html %]</b>
+<select name="upload_photo_dir">
+[% FOREACH dir = LiveFrameLab.upload_photo_dirs %]
+[% IF dir == LiveFrameLab.field('upload_photo_dir') %]
<option selected>[% dir | html %]
[% ELSE %]
<option>[% dir | html %]
|
|
From: <ix...@us...> - 2001-12-02 12:44:08
|
ixjonez 01/12/02 04:44:07
Modified: share/tmpl Tag: Æ `¶@h¶@h¶@øt ð¬ x¶@x¶@H¯ H¯ ¯
¯ ¶@¶@¶@¶@à° à° ¨¶@¨¶@°¶@°¶@
/tmp/cvs-serv1863/share/tmpl/header.tmpl No tag
header.tmpl
Log:
start using <plugin
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 -4 lab/share/tmpl/header.tmpl
Index: /tmp/cvs-serv1863/share/tmpl/header.tmpl
===================================================================
RCS file: /cvsroot/liveframe/lab/share/tmpl/header.tmpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /tmp/cvs-serv1863/share/tmpl/header.tmpl 2001/11/30 01:03:04 1.1
+++ /tmp/cvs-serv1863/share/tmpl/header.tmpl 2001/12/02 12:44:07 1.2
@@ -1,10 +1,9 @@
+[% USE LiveFrameLab %]
+
<html>
<head>
<title>[ LiveFrame ] Lab</title>
-
-
-<link rel="stylesheet" href="[% css_url %]/lfstyles.css">
-
+<link rel="stylesheet" href="[% LiveFrameLab.css_href('lfstyles.css') %]">
</head>
<body bgcolor="#ffffff" text="#666666" link="#333333" vlink="#333333" alink="#cc0000">
No revision
No revision
1.2 +3 -4 lab/share/tmpl/header.tmpl
Index: header.tmpl
===================================================================
RCS file: /cvsroot/liveframe/lab/share/tmpl/header.tmpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- header.tmpl 2001/11/30 01:03:04 1.1
+++ header.tmpl 2001/12/02 12:44:07 1.2
@@ -1,10 +1,9 @@
+[% USE LiveFrameLab %]
+
<html>
<head>
<title>[ LiveFrame ] Lab</title>
-
-
-<link rel="stylesheet" href="[% css_url %]/lfstyles.css">
-
+<link rel="stylesheet" href="[% LiveFrameLab.css_href('lfstyles.css') %]">
</head>
<body bgcolor="#ffffff" text="#666666" link="#333333" vlink="#333333" alink="#cc0000">
|
|
From: <ix...@us...> - 2001-12-02 12:43:33
|
ixjonez 01/12/02 04:43:32
Modified: share/tmpl Tag: hÆ `¶@h¶@h¶@h¯ 8 x¶@x¶@¯ H±
¶@¶@ø³ ø³
¶@¶@ ¶@ ¶@¨¶@¨¶@°¶@°¶@¸¶@¸¶@À¶@À¶@ȶ@ȶ@y
y ض@ض@à¶@à¶@p© p© ð¶@ð¶@ø¶@ø¶@
/tmp/cvs-serv1749/share/tmpl/error.tmpl No tag
error.tmpl
Log:
handle both application and template errors with the error 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
1.2 +6 -1 lab/share/tmpl/error.tmpl
Index: /tmp/cvs-serv1749/share/tmpl/error.tmpl
===================================================================
RCS file: /cvsroot/liveframe/lab/share/tmpl/error.tmpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /tmp/cvs-serv1749/share/tmpl/error.tmpl 2001/11/30 01:03:04 1.1
+++ /tmp/cvs-serv1749/share/tmpl/error.tmpl 2001/12/02 12:43:32 1.2
@@ -25,7 +25,12 @@
<tr>
<td valign="top">
-<b>APPLICATION ERROR</b><br>
+<b>[% error_type | html | upper %] ERROR</b><br>
+[% IF error_type == 'template' %]
+<p>
+An error was encountered processing <i>[% error_tmpl | html %]</i>:
+</p>
+[% END %]
<pre>
[% error_msg | html %]
</pre>
No revision
No revision
1.2 +6 -1 lab/share/tmpl/error.tmpl
Index: error.tmpl
===================================================================
RCS file: /cvsroot/liveframe/lab/share/tmpl/error.tmpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- error.tmpl 2001/11/30 01:03:04 1.1
+++ error.tmpl 2001/12/02 12:43:32 1.2
@@ -25,7 +25,12 @@
<tr>
<td valign="top">
-<b>APPLICATION ERROR</b><br>
+<b>[% error_type | html | upper %] ERROR</b><br>
+[% IF error_type == 'template' %]
+<p>
+An error was encountered processing <i>[% error_tmpl | html %]</i>:
+</p>
+[% END %]
<pre>
[% error_msg | html %]
</pre>
|
|
From: <ix...@us...> - 2001-12-02 12:42:44
|
ixjonez 01/12/02 04:42:43
Modified: lib/LiveFrame Tag: 0`¶@h¶@h¶@È È È àt P P
°¦ ÈÀ ¶@¶@¶@¶@ ¶@ ¶@
°¶@°¶@¸¶@¸¶@`® `®
ȶ@ȶ@ж@ж@ض@ض@à¶@à¶@è¶@è¶@ð¶@ð¶@ø¶@ø¶@
/tmp/cvs-serv1406/lib/LiveFrame/Application.pm No
tag Application.pm
Log:
various fixs related to forms and the run() method. configure a PLUGIN_BASE
so templates can find plugins. make error page handling a bit more robust.
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
1.4 +86 -35 lab/lib/LiveFrame/Application.pm
Index: /tmp/cvs-serv1406/lib/LiveFrame/Application.pm
===================================================================
RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Application.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /tmp/cvs-serv1406/lib/LiveFrame/Application.pm 2001/11/30 02:25:16 1.3
+++ /tmp/cvs-serv1406/lib/LiveFrame/Application.pm 2001/12/02 12:42:42 1.4
@@ -21,6 +21,7 @@
actions => {},
attrs => {},
cgi => undef,
+ committed => undef,
config => undef,
config_processed => undef,
config_file => undef,
@@ -172,11 +173,7 @@
my $self = shift;
if (@_) {
- my $name = shift;
- unless ($self->action($name)) {
- die "current action $name is not defined\n";
- }
- $self->{current_action_name} = $name;
+ $self->{current_action_name} = shift;
} elsif (! defined $self->{current_action_name}) {
my $path_info = $self->cgi()->path_info();
if ($path_info) {
@@ -299,6 +296,7 @@
my $tproc_opts =
{
INCLUDE_PATH => $self->template_dir(),
+ PLUGIN_BASE => 'LiveFrame::Template::Plugin',
};
$self->{tproc} = Template->new($tproc_opts);
@@ -341,23 +339,44 @@
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());
+ $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());
+ $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) = @_;
-
- print $self->cgi()->header();
+ $self->send_header();
return $self->process_template($page);
}
@@ -371,13 +390,23 @@
}
sub send_error {
- my ($self, $msg) = @_;
+ my ($self, $msg, $tmpl) = @_;
- print $self->cgi()->header();
+ $self->send_header();
my $error_page = $self->default_error_page();
if (defined $error_page) {
- return $self->process_template($error_page, {error_msg => $msg});
+ 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);
@@ -386,6 +415,9 @@
<p>
<b>Application Error</b>
</p>
+<p>
+An internal application error was encountered:
+</p>
<pre>
$msg
</pre>
@@ -395,20 +427,34 @@
}
sub send_tmpl_error {
- my ($self, $error) = @_;
+ my ($self, $error, $page) = @_;
my $msg = $error->info() || '';
$msg =~ s|\\n|\n|g;
- $msg = HTML::Entities::encode_entities($msg);
+ my $tmpl = $self->template($page);
- print <<EOT;
+ 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;
}
@@ -544,7 +590,7 @@
$self->fill_in_form($form);
# XXX: requires the previous action to have the same name
- # as the form in the page that it sends
+ # as the form in the page htat it sends
$self->current_action_name($form->name());
$action = $self->current_action();
}
@@ -554,27 +600,32 @@
# XXX: how to signal that an action requires a form submission?
}
- # execute the action method, which will send a page when it
- # completes
- eval { $action->perform($self) };
- 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) };
+ if ($@) {
+ $self->send_error($@);
+ }
}
}
- else {
+
+ unless ($action) {
# no action exists for the specified action name so assume
# it's a page name
- my $msg = sprintf("requested action [%s] not defined",
- $self->current_action_name());
- $self->send_error($msg);
- return 0;
- # XXX: set a config switch to enable page sending?
-# eval {
-# $self->send_page($self->current_action_name());
-# };
-# if ($@) {
-# $self->send_error($@);
-# }
+ # 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;
No revision
No revision
1.4 +86 -35 lab/lib/LiveFrame/Application.pm
Index: Application.pm
===================================================================
RCS file: /cvsroot/liveframe/lab/lib/LiveFrame/Application.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Application.pm 2001/11/30 02:25:16 1.3
+++ Application.pm 2001/12/02 12:42:42 1.4
@@ -21,6 +21,7 @@
actions => {},
attrs => {},
cgi => undef,
+ committed => undef,
config => undef,
config_processed => undef,
config_file => undef,
@@ -172,11 +173,7 @@
my $self = shift;
if (@_) {
- my $name = shift;
- unless ($self->action($name)) {
- die "current action $name is not defined\n";
- }
- $self->{current_action_name} = $name;
+ $self->{current_action_name} = shift;
} elsif (! defined $self->{current_action_name}) {
my $path_info = $self->cgi()->path_info();
if ($path_info) {
@@ -299,6 +296,7 @@
my $tproc_opts =
{
INCLUDE_PATH => $self->template_dir(),
+ PLUGIN_BASE => 'LiveFrame::Template::Plugin',
};
$self->{tproc} = Template->new($tproc_opts);
@@ -341,23 +339,44 @@
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());
+ $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());
+ $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) = @_;
-
- print $self->cgi()->header();
+ $self->send_header();
return $self->process_template($page);
}
@@ -371,13 +390,23 @@
}
sub send_error {
- my ($self, $msg) = @_;
+ my ($self, $msg, $tmpl) = @_;
- print $self->cgi()->header();
+ $self->send_header();
my $error_page = $self->default_error_page();
if (defined $error_page) {
- return $self->process_template($error_page, {error_msg => $msg});
+ 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);
@@ -386,6 +415,9 @@
<p>
<b>Application Error</b>
</p>
+<p>
+An internal application error was encountered:
+</p>
<pre>
$msg
</pre>
@@ -395,20 +427,34 @@
}
sub send_tmpl_error {
- my ($self, $error) = @_;
+ my ($self, $error, $page) = @_;
my $msg = $error->info() || '';
$msg =~ s|\\n|\n|g;
- $msg = HTML::Entities::encode_entities($msg);
+ my $tmpl = $self->template($page);
- print <<EOT;
+ 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;
}
@@ -544,7 +590,7 @@
$self->fill_in_form($form);
# XXX: requires the previous action to have the same name
- # as the form in the page that it sends
+ # as the form in the page htat it sends
$self->current_action_name($form->name());
$action = $self->current_action();
}
@@ -554,27 +600,32 @@
# XXX: how to signal that an action requires a form submission?
}
- # execute the action method, which will send a page when it
- # completes
- eval { $action->perform($self) };
- 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) };
+ if ($@) {
+ $self->send_error($@);
+ }
}
}
- else {
+
+ unless ($action) {
# no action exists for the specified action name so assume
# it's a page name
- my $msg = sprintf("requested action [%s] not defined",
- $self->current_action_name());
- $self->send_error($msg);
- return 0;
- # XXX: set a config switch to enable page sending?
-# eval {
-# $self->send_page($self->current_action_name());
-# };
-# if ($@) {
-# $self->send_error($@);
-# }
+ # 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;
|
|
From: <ix...@us...> - 2001-12-02 09:53:41
|
ixjonez 01/12/02 01:53:40 lab/lib/LiveFrame/Template/Plugin - New directory |
|
From: <ix...@us...> - 2001-12-02 09:53:33
|
ixjonez 01/12/02 01:53:31 lab/lib/LiveFrame/Template - New directory |
|
From: <ix...@us...> - 2001-12-02 09:49:45
|
ixjonez 01/12/02 01:49:43
Added: lib/LiveFrame/Template/Plugin LiveFrame.pm
Log:
add a Template::Toolkit plugin that makes general configuration items
available to templates
Revision Changes Path
1.1 commons/lib/LiveFrame/Template/Plugin/LiveFrame.pm
Index: LiveFrame.pm
===================================================================
# -*- Mode: Perl; indent-tabs-mode: nil; -*-
package LiveFrame::Template::Plugin::LiveFrame;
use strict;
use Template::Plugin ();
@LiveFrame::Template::Plugin::LiveFrame::ISA = ('Template::Plugin');
sub load {
my ($class, $context) = @_;
return $class;
}
sub new {
my ($class, $context, %params) = @_;
my $self = bless
{
context => $context,
};
return $self;
}
sub css_href {
my ($self, $name) = @_;
my $application = $self->variable('application') or
die "template variable [application] not found\n";
return join('/', $application->url($application->config()->css_url()),
$name);
}
sub field {
my ($self, $name) = @_;
my $application = $self->variable('application') or
die "template variable [application] not found\n";
my $form = $self->variable('form');
if ($form) {
my $val = $form->$name();
return $val if defined $val && length($val);
}
return $self->param($name);
}
sub form_action {
my ($self, $name) = @_;
my $application = $self->variable('application') or
die "template variable [application] not found\n";
return join('/', $application->url($application->cgi()->script_name()),
$name);
}
sub img_src {
my ($self, $name) = @_;
my $application = $self->variable('application') or
die "template variable [application] not found\n";
return join('/', $application->url($application->config()->img_url()),
$name);
}
sub param {
my ($self, $name) = @_;
my $cgi = $self->variable('cgi') or
die "template variable [cgi] not found\n";
return $cgi->param($name);
}
sub variable {
my ($self, $name) = @_;
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...> - 2001-12-02 09:49:11
|
ixjonez 01/12/02 01:49:10
Added: lib/LiveFrame/ImageHelper ImageMagick.pm
Log:
add an implementation of ImageHelper that uses the Image::Magick library
Revision Changes Path
1.1 commons/lib/LiveFrame/ImageHelper/ImageMagick.pm
Index: ImageMagick.pm
===================================================================
# -*- Mode: Perl; indent-tabs-mode: nil; -*-
package LiveFrame::ImageHelper::ImageMagick;
use ImageMagick ();
use strict;
sub new {
my ($type) = @_;
my $class = ref($type) || $type;
my $self = bless
{
photo => undef,
magick => Image::Magick->new(),
}, $class;
return $self;
}
sub load {
my ($self, $photo) = @_;
$self->{magick}->Load($photo->path());
$self->{photo} = $photo;
$photo->height($self->{magick}->Get('height'));
$photo->width($self->{magick}->Get('width'));
return 1;
}
sub ping {
my ($self, $photo) = @_;
my ($width, $height) = $self->{magick}->Ping($photo->path());
$photo->height($height);
$photo->width($width);
return 1;
}
sub reset {
my ($self) = @_;
@{ $self->{magick} } = ();
$self->{photo} = undef;
return 1;
}
sub rotate {
my ($self, $degrees) = @_;
unless ($self->{photo}) {
die "no photo loaded\n";
}
$self->{magick}->Rotate(degrees => $degrees);
return 1;
}
sub save {
my ($self, $new_photo) = @_;
unless ($self->{photo}) {
die "no photo loaded\n";
}
if ($new_photo) {
$self->{magick}->Write($new_photo->path());
}
else {
$self->{magick}->Write($self->{photo}->path());
}
return 1;
}
sub scale {
my ($self, $params) = @_;
unless ($self->{photo}) {
die "no photo loaded\n";
}
$params ||= {};
my $new_height = $params->{height};
my $new_width = $params->{width};
my $percent = $params->{percent};
unless ($new_height || $new_width || $percent) {
die "must specify a non-zero height, width or percent\n";
}
my $old_height = $self->{photo}->height();
my $old_width = $self->{photo}->width();
if ($new_height && !$new_width) {
$percent = $old_height / $new_height;
$new_width = int($old_width * $percent);
}
elsif (!$new_height && $new_width) {
$percent = $old_width / $new_width;
$new_height = int($old_height * $percent);
}
elsif (!$new_height && !$new_width) {
$new_height = int($old_height * $percent);
$new_width = int($old_width * $new_width);
}
$self->{magick}->Scale(height => $new_height,
width => $new_width);
$self->{photo}->height($self->{magick}->Get('height'));
$self->{photo}->width($self->{magick}->Get('width'));
return 1;
}
1;
|
|
From: <ix...@us...> - 2001-12-02 09:48:42
|
ixjonez 01/12/02 01:48:42
Added: lib/LiveFrame ImageHelper.pm
Log:
add an interface for image manipulation utilities
Revision Changes Path
1.1 commons/lib/LiveFrame/ImageHelper.pm
Index: ImageHelper.pm
===================================================================
# -*- Mode: Perl; indent-tabs-mode: nil; -*-
package LiveFrame::ImageHelper;
use strict;
sub new {
my ($class, $driver) = @_;
defined $driver or
die "no driver defined\n";
$class .= "::$driver";
eval "require $class";
die $@ if $@;
return $class->new();
}
## interface public methods
sub load {
my ($self, $photo) = @_;
die __PACKAGE__ . "::load not implemented\n";
}
sub ping {
my ($self, $photo) = @_;
die __PACKAGE__ . "::ping not implemented\n";
}
sub reset {
my ($self) = @_;
die __PACKAGE__ . "::reset not implemented\n";
}
sub rotate {
my ($self, $degrees) = @_;
die __PACKAGE__ . "::rotate not implemented\n";
}
sub save {
my ($self, $new_photo) = @_;
die __PACKAGE__ . "::save not implemented\n";
return 1;
}
sub scale {
my ($self, $params) = @_;
die __PACKAGE__ . "::scale not implemented\n";
}
1;
|
|
From: <ix...@us...> - 2001-12-02 09:47:22
|
ixjonez 01/12/02 01:47:21
Added: lib/LiveFrame Photo.pm
Log:
add a class representing an individual Photo
Revision Changes Path
1.1 commons/lib/LiveFrame/Photo.pm
Index: Photo.pm
===================================================================
# -*- Mode: Perl; indent-tabs-mode: nil; -*-
package LiveFrame::Photo;
use File::Basename ();
use strict;
sub new {
my ($type, $path) = @_;
my $class = ref($type) || $type;
my $self = bless
{
caption => undef,
height => undef,
path => $path,
width => undef,
}, $class;
return $self;
}
## accessor methods
sub caption {
my $self = shift;
$self->{caption} = shift if @_;
return $self->{caption};
}
sub height {
my $self = shift;
$self->{height} = shift if @_;
return $self->{height};
}
sub path {
my $self = shift;
$self->{path} = shift if @_;
return $self->{path};
}
sub width {
my $self = shift;
$self->{width} = shift if @_;
return $self->{width};
}
## public methods
sub basename {
my ($self) = @_;
return File::Basename::basename($self->path());
}
sub clone {
my ($self) = @_;
return ref($self)->new($self->path());
}
sub dirname {
my ($self) = @_;
return File::Basename::dirname($self->path());
}
1;
|
|
From: <ix...@us...> - 2001-12-02 09:47:03
|
ixjonez 01/12/02 01:47:03
Added: lib/LiveFrame Gallery.pm
Log:
add a class representing a photo Gallery
Revision Changes Path
1.1 commons/lib/LiveFrame/Gallery.pm
Index: Gallery.pm
===================================================================
# -*- Mode: Perl; indent-tabs-mode: nil; -*-
package LiveFrame::Gallery;
use strict;
use LiveFrame::PhotoDir ();
@LiveFrame::Gallery::ISA = 'LiveFrame::PhotoDir';
sub new {
my $type = shift;
my $class = ref($type) || $type;
my $self = $class->SUPER::new(@_);
$self->{description} = undef;
$self->{title} = undef;
$self->{url} = undef;
$self->{visibility} = undef;
return $self;
}
## accessor methods
sub description {
my $self = shift;
$self->{description} = shift if @_;
return $self->{description};
}
sub title {
my $self = shift;
$self->{title} = shift if @_;
return $self->{title};
}
sub url {
my $self = shift;
$self->{url} = shift if @_;
return $self->{url};
}
## public methods
sub hidden {
my $self = shift;
return ! defined $self->{visibility};
}
sub hide {
my $self = shift;
$self->{visibility} = undef;
return 1;
}
sub show {
my $self = shift;
$self->{visibility} = 1;
return 1;
}
sub shown {
my $self = shift;
return defined $self->{visibility};
}
1;
|
|
From: <ix...@us...> - 2001-12-02 09:46:46
|
ixjonez 01/12/02 01:46:45
Added: lib/LiveFrame PhotoDir.pm
Log:
add a class representing a directory that contains one or more ordered
sets of photos
Revision Changes Path
1.1 commons/lib/LiveFrame/PhotoDir.pm
Index: PhotoDir.pm
===================================================================
# -*- Mode: Perl; indent-tabs-mode: nil; -*-
package LiveFrame::PhotoDir;
use File::Basename ();
use LiveFrame::Photo ();
use Tie::IxHash ();
use strict;
sub new {
my ($type, $path) = @_;
my $class = ref($type) || $type;
my $self = bless
{
path => $path,
photos => {},
}, $class;
return $self;
}
sub init {
my ($self, @params) = @_;
return 1;
}
## accessor methods
sub path {
my $self = shift;
$self->{path} = shift if @_;
return $self->{path};
}
sub photos {
my $self = shift;
my $set = shift || 'default';
unless ($self->{photos}->{$set}) {
$self->{photos}->{$set} = Tie::IxHash->new();
my $path = $set eq 'default' ?
$self->path() :
File::Spec->catdir($self->path(), $set);
# XXX: files are not guaranteed to be read in the order the
# photos were taken. find a way to access the internal photo
# data so we can sort by timestamp.
opendir DIR, $path or
die "can't opendir $path: $!\n";
for my $file (readdir DIR) {
next if /^\./;
next unless /\.jpg$/i;
my $filepath = File::Spec->catfile($path, $file);
my $photo = LiveFrame::Photo->new($filepath);
$self->{photos}->Push($file => $photo);
}
closedir DIR;
}
return $self->{photos}->{$set};
}
## public methods
sub basename {
my $self = shift;
return File::Basename::basename($self->path());
}
sub dirname {
my $self = shift;
return File::Basename::dirname($self->path());
}
1;
|
|
From: <ix...@us...> - 2001-12-02 09:46:13
|
ixjonez 01/12/02 01:46:12
Added: lib/LiveFrame Site.pm
Log:
add a class representing a Site of Galleries
Revision Changes Path
1.1 commons/lib/LiveFrame/Site.pm
Index: Site.pm
===================================================================
# -*- Mode: Perl; indent-tabs-mode: nil; -*-
package LiveFrame::Site;
use File::Basename ();
use LiveFrame::Gallery ();
use Tie::IxHash ();
use strict;
use constant HIDDEN_FILE => 'hidden.conf';
use constant ORDER_FILE => 'order.conf';
sub new {
my ($type, $path) = @_;
my $class = ref($type) || $type;
my $self = bless
{
path => $path,
galleries => undef,
}, $class;
return $self;
}
## accessor methods
sub path {
my $self = shift;
$self->{path} = shift if @_;
return $self->{path};
}
sub galleries {
my $self = shift;
unless ($self->{galleries}) {
$self->{galleries} = Tie::IxHash->new();
my $order_file = $self->order_file();
open FILE, $order_file or
die "can't open order file $order_file: $!\n";
while (defined($_ = <FILE>)) {
next if /^\s*#/;
next if /^\s*$/;
chomp;
my $gallery_path = $self->gallery_path($_);
next unless -d $gallery_path;
my $gallery = LiveFrame::Gallery->new($gallery_path);
$self->{galleries}->Push($_ => $gallery);
}
close FILE;
}
return $self->{galleries}->Values();
}
## public methods
sub basename {
my ($self) = @_;
return File::Basename::basename($self->path());
}
sub dirname {
my ($self) = @_;
return File::Basename::dirname($self->path());
}
sub num_galleries {
my ($self) = @_;
$self->galleries();
return $self->{galleries}->Length();
}
## private methods
sub gallery_path {
my ($self, $name) = @_;
return File::Spec->catdir($self->path(), $name);
}
sub hidden_file {
my ($self) = @_;
return File::Spec->catfile($self->path(), HIDDEN_FILE);
}
sub order_file {
my ($self) = @_;
return File::Spec->catfile($self->path(), ORDER_FILE);
}
1;
|
|
From: <ix...@us...> - 2001-12-02 09:45:03
|
ixjonez 01/12/02 01:45:02 commons/lib/LiveFrame/Template/Plugin - New directory |
|
From: <ix...@us...> - 2001-12-02 09:44:04
|
ixjonez 01/12/02 01:44:04 commons/lib/LiveFrame/Template - New directory |
|
From: <ix...@us...> - 2001-12-02 09:44:04
|
ixjonez 01/12/02 01:44:04 commons/lib/LiveFrame/ImageHelper - New directory |