summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2008-11-22 11:33:09 +0100
committerYorhel <git@yorhel.nl>2008-11-22 11:33:09 +0100
commitddda142999398ab8b8e4aab7d8dede80a8fb5e56 (patch)
treeb8ca8db4bef7b222ec3f1dc3e64a232699547f28 /lib
parent7127e3d70fc98ff0ceabb41afaa4b3021b3fd337 (diff)
General info part of the VN edit form
...the easy part
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Handler/VNEdit.pm56
-rw-r--r--lib/VNDB/Util/FormHTML.pm8
2 files changed, 55 insertions, 9 deletions
diff --git a/lib/VNDB/Handler/VNEdit.pm b/lib/VNDB/Handler/VNEdit.pm
index 97ed5457..2cf8eb99 100644
--- a/lib/VNDB/Handler/VNEdit.pm
+++ b/lib/VNDB/Handler/VNEdit.pm
@@ -25,15 +25,59 @@ sub edit {
$self->htmlHeader(title => 'Edit '.$v->{title});
$self->htmlMainTabs('v', $v, 'edit');
$self->htmlEditMessage('v', $v);
- $self->htmlForm({ frm => $frm, action => "/v$vid/edit", editsum => 1 }, 'General info' => [
- ], 'Categories' => [
- ], 'Image' => [
- ], 'Relations' => [
- ], 'Screenshots' => [
- ]);
+ _form($self, $v, $frm);
$self->htmlFooter;
}
+sub _form {
+ my($self, $v, $frm) = @_;
+ $self->htmlForm({ frm => $frm, action => "/v$v->{id}/edit", editsum => 1 },
+ 'General info' => [
+ [ input => short => 'title', name => 'Title (romaji)' ],
+ [ input => short => 'original', name => 'Original title' ],
+ [ static => content => 'The original title of this visual novel, leave blank if it already is in the Latin alphabet.' ],
+ [ textarea => short => 'alias', name => 'Aliases', rows => 4 ],
+ [ static => content => q|
+ Comma seperated list of alternative titles or abbreviations. Can include both official
+ (japanese/english) titles and unofficial titles used around net.<br />
+ <b>Titles that are listed in the releases do not have to be added here.</b>
+ |],
+ [ textarea => short => 'desc', name => 'Description', rows => 10 ],
+ [ static => content => q|
+ Short description of the main story. Please do not include spoilers, and don't forget to list
+ the source in case you didn't write the description yourself. (formatting codes are allowed)
+ |],
+ [ select => short => 'length', name => 'Length', width => 300, options =>
+ [ map [ $_ => $self->{vn_lengths}[$_][0].($_ ? " ($self->{vn_lengths}[$_][2])" : '') ], 0..$#{$self->{vn_lengths}} ] ],
+
+ [ input => short => 'l_wp', name => 'External links', pre => 'http://en.wikipedia.org/wiki/' ],
+ [ input => short => 'l_encubed', pre => 'http://novelnews.net/tag/', post => '/' ],
+ [ input => short => 'l_renai', pre => 'http://renai.us/game/', post => '.shtml' ],
+ [ input => short => 'l_vnn', pre => 'http://visual-novels.net/vn/index.php?option=com_content&amp;task=view&amp;id=', width => 40 ],
+
+ [ input => short => 'anime', name => 'Anime' ],
+ [ static => content => q|
+ Whitespace seperated list of <a href="http://anidb.net/">AniDB</a> anime IDs.
+ E.g. "1015 3348" will add <a href="http://anidb.net/a1015">Shingetsutan Tsukihime</a>
+ and <a href="http://anidb.net/a3348">Fate/stay night</a> as related anime.<br />
+ <b>Note:</b> It can take a few minutes for the anime titles to appear on the VN page.
+ |],
+ ],
+
+ 'Categories' => [
+ ],
+
+ 'Image' => [
+ ],
+
+ 'Relations' => [
+ ],
+
+ 'Screenshots' => [
+ ]);
+}
+
+
1;
diff --git a/lib/VNDB/Util/FormHTML.pm b/lib/VNDB/Util/FormHTML.pm
index 7de2e5d0..96c1ad1f 100644
--- a/lib/VNDB/Util/FormHTML.pm
+++ b/lib/VNDB/Util/FormHTML.pm
@@ -82,11 +82,11 @@ sub htmlFormError {
# A form part is a arrayref, with the first element being the type of the part,
# and all other elements forming a hash with options specific to that type.
# Type Options
-# input short, name, width
+# input short, name, width, pre, post
# passwd short, name
# static content, label
# check name, short, (value)
-# select name, short, options
+# select name, short, options, width
# text name, short, (rows, cols)
# part title
# TODO: Find a way to write this function in a readable way...
@@ -130,8 +130,10 @@ sub htmlFormPart {
end;
td class => 'field';
if(/input/) {
+ lit $o{pre} if $o{pre};
input type => 'text', class => 'text', name => $o{short}, id => $o{short},
value => $frm->{$o{short}}||'', $o{width} ? (style => "width: $o{width}px") : ();
+ lit $o{post} if $o{post};
}
if(/passwd/) {
input type => 'password', class => 'text', name => $o{short}, id => $o{short},
@@ -141,7 +143,7 @@ sub htmlFormPart {
lit $o{content};
}
if(/select/) {
- Select name => $o{short}, id => $o{short};
+ Select name => $o{short}, id => $o{short}, $o{width} ? (style => "width: $o{width}px") : ();
option value => $_->[0], ($frm->{$o{short}}||'') eq $_->[0] ? (selected => 'selected') : (), $_->[1]
for @{$o{options}};
end;