diff options
author | Yorhel <git@yorhel.nl> | 2009-05-10 16:18:16 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-05-10 16:18:16 +0200 |
commit | e7f34568a82dce5f54de860451db7a6ab995e338 (patch) | |
tree | 764d9075ac6fe728537820b936581b710e2cee97 | |
parent | dca26d601127d6c3e5761bce4e60b9f5ef4f3d1d (diff) |
Moved date input field from Handler/Releases.pm to Util/FormHTML.pm
-rw-r--r-- | data/style.css | 2 | ||||
-rw-r--r-- | lib/VNDB/Handler/Releases.pm | 19 | ||||
-rw-r--r-- | lib/VNDB/Util/FormHTML.pm | 19 |
3 files changed, 20 insertions, 20 deletions
diff --git a/data/style.css b/data/style.css index 6f643b97..1048e547 100644 --- a/data/style.css +++ b/data/style.css @@ -903,8 +903,6 @@ ul#catselect li li.exc { background-position: 0px -33px; color: $statnok$; } } /* edit */ -#released, #released_d { width: 70px } -#released_m { width: 100px } .platforms { padding-left: 20px; } .platforms span { display: block; float: left; width: 150px; } diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm index 2a2ea21b..c7b2cb60 100644 --- a/lib/VNDB/Handler/Releases.pm +++ b/lib/VNDB/Handler/Releases.pm @@ -5,7 +5,6 @@ use strict; use warnings; use YAWF ':html'; use VNDB::Func; -use POSIX 'strftime'; YAWF::register( @@ -341,23 +340,7 @@ sub _form { [ input => short => 'gtin', name => 'JAN/UPC/EAN' ], [ input => short => 'catalog', name => 'Catalog number' ], [ input => short => 'website', name => 'Official website' ], - [ static => label => 'Release date', content => sub { - Select id => 'released', name => 'released'; - option value => $_, $frm->{released} && $frm->{released}[0] == $_ ? (selected => 'selected') : (), - !$_ ? '-year-' : $_ < 9999 ? $_ : 'TBA' - for (0, 1980..((localtime())[5]+1905), 9999); - end; - Select id => 'released_m', name => 'released'; - option value => $_, $frm->{released} && $frm->{released}[1] == $_ ? (selected => 'selected') : (), - !$_ ? '-month-' : strftime '%B', 0, 0, 0, 0, $_, 0, 0, 0 - for(0..12); - end; - Select id => 'released_d', name => 'released'; - option value => $_, $frm->{released} && $frm->{released}[2] == $_ ? (selected => 'selected') : (), - !$_ ? '-day-' : $_ - for(0..31); - end; - }], + [ date => short => 'released', name => 'Release date' ], [ static => content => 'Leave month or day blank if they are unknown' ], [ select => short => 'minage', name => 'Age rating', options => [ map [ $_, $self->{age_ratings}{$_} ], sort { $a <=> $b } keys %{$self->{age_ratings}} ] ], diff --git a/lib/VNDB/Util/FormHTML.pm b/lib/VNDB/Util/FormHTML.pm index 17de6663..cc4f7411 100644 --- a/lib/VNDB/Util/FormHTML.pm +++ b/lib/VNDB/Util/FormHTML.pm @@ -5,6 +5,7 @@ use strict; use warnings; use YAWF ':html'; use Exporter 'import'; +use POSIX 'strftime'; our @EXPORT = qw| htmlFormError htmlFormPart htmlForm |; @@ -116,6 +117,7 @@ sub htmlFormError { # check name, short, (value) # select name, short, options, (width) # text name, short, (rows, cols) +# date name, short # part title # TODO: Find a way to write this function in a readable way... sub htmlFormPart { @@ -189,6 +191,23 @@ sub htmlFormPart { for @{$o{options}}; end; } + if(/date/) { + Select name => $o{short}, id => $o{short}, style => 'width: 70px'; + option value => $_, $frm->{$o{short}} && $frm->{$o{short}}[0] == $_ ? (selected => 'selected') : (), + !$_ ? '-year-' : $_ < 9999 ? $_ : 'TBA' + for (0, 1980..((localtime())[5]+1905), 9999); + end; + Select id => "$o{short}_m", name => $o{short}, style => 'width: 100px'; + option value => $_, $frm->{$o{short}} && $frm->{$o{short}}[1] == $_ ? (selected => 'selected') : (), + !$_ ? '-month-' : strftime '%B', 0, 0, 0, 0, $_, 0, 0, 0 + for(0..12); + end; + Select id => "$o{short}_d", name => $o{short}, style => 'width: 70px'; + option value => $_, $frm->{$o{short}} && $frm->{$o{short}}[2] == $_ ? (selected => 'selected') : (), + !$_ ? '-day-' : $_ + for(0..31); + end; + } if(/text/) { (my $txt = $frm->{$o{short}}||'') =~ s/&/&/; $txt =~ s/</</; |