summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-08-18 09:23:11 +0200
committerYorhel <git@yorhel.nl>2009-08-18 09:23:11 +0200
commit6be3db128ffa7c16ff4967ddf08a8577d9f25eaf (patch)
tree385184908592f267fe5e44e01f0d99353c18df66 /lib
parente7a73f04525ad18b0bd2be8996431ecaf8eff330 (diff)
htmlForm(): Don't generate subform id from the title
The subform id is now passed to htmlForm() as first formpart item. This way the id won't change even if the title does, which will be the case with the interface translation.
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Handler/Discussions.pm2
-rw-r--r--lib/VNDB/Handler/Producers.pm2
-rw-r--r--lib/VNDB/Handler/Releases.pm8
-rw-r--r--lib/VNDB/Handler/Tags.pm4
-rw-r--r--lib/VNDB/Handler/Users.pm8
-rw-r--r--lib/VNDB/Handler/VNEdit.pm8
-rw-r--r--lib/VNDB/Util/FormHTML.pm9
7 files changed, 20 insertions, 21 deletions
diff --git a/lib/VNDB/Handler/Discussions.pm b/lib/VNDB/Handler/Discussions.pm
index 311b1344..7056a1ac 100644
--- a/lib/VNDB/Handler/Discussions.pm
+++ b/lib/VNDB/Handler/Discussions.pm
@@ -233,7 +233,7 @@ sub edit {
'_postedit_edit';
my $url = !$tid ? "/t/$board/new" : !$num ? "/t$tid/reply" : "/t$tid.$num/edit";
$self->htmlHeader(title => $title, noindex => 1);
- $self->htmlForm({ frm => $frm, action => $url }, $title => [
+ $self->htmlForm({ frm => $frm, action => $url }, 'postedit' => [$title,
[ static => label => mt('_postedit_form_username'), content => $self->{l10n}->userstr($self->authInfo->{id}, $self->authInfo->{username}) ],
!$tid || $num == 1 ? (
[ input => short => 'title', name => mt('_postedit_form_title') ],
diff --git a/lib/VNDB/Handler/Producers.pm b/lib/VNDB/Handler/Producers.pm
index 1b192e2d..c6d507e2 100644
--- a/lib/VNDB/Handler/Producers.pm
+++ b/lib/VNDB/Handler/Producers.pm
@@ -133,7 +133,7 @@ sub edit {
$self->htmlHeader(title => $title, noindex => 1);
$self->htmlMainTabs('p', $p, 'edit') if $pid;
$self->htmlEditMessage('p', $p, $title);
- $self->htmlForm({ frm => $frm, action => $pid ? "/p$pid/edit" : '/p/new', editsum => 1 }, mt('_pedit_form_generalinfo') => [
+ $self->htmlForm({ frm => $frm, action => $pid ? "/p$pid/edit" : '/p/new', editsum => 1 }, 'pedit_geninfo' => [mt('_pedit_form_generalinfo'),
[ select => name => mt('_pedit_form_type'), short => 'type',
options => [ map [ $_, mt "_ptype_$_" ], sort @{$self->{producer_types}} ] ],
[ input => name => mt('_pedit_form_name'), short => 'name' ],
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index 51715e72..a334ea90 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -380,7 +380,7 @@ sub _form {
my($self, $r, $v, $frm, $copy) = @_;
$self->htmlForm({ frm => $frm, action => $r ? "/r$r->{id}/".($copy ? 'copy' : 'edit') : "/v$v->{id}/add", editsum => 1 },
- "General info" => [
+ rel_geninfo => [ "General info",
[ select => short => 'type', name => 'Type',
options => [ map [ $_, mt "_rtype_$_" ], @{$self->{release_types}} ] ],
[ check => short => 'patch', name => 'This release is a patch to another release.' ],
@@ -404,7 +404,7 @@ sub _form {
.'E.g.: Censored/uncensored or for which releases this patch applies. Max. 250 characters.' ],
],
- 'Format' => [
+ rel_format => [ 'Format',
[ select => short => 'resolution', name => 'Resolution', options => [
map [ $_, @{$self->{resolutions}[$_]} ], 0..$#{$self->{resolutions}} ] ],
[ select => short => 'voiced', name => 'Voiced', options => [
@@ -440,7 +440,7 @@ sub _form {
}],
],
- 'Producers' => [
+ rel_prod => [ 'Producers',
[ hidden => short => 'producers' ],
[ static => nolabel => 1, content => sub {
h2 'Selected producers';
@@ -454,7 +454,7 @@ sub _form {
}],
],
- 'Visual novels' => [
+ rel_vn => [ 'Visual novels',
[ hidden => short => 'vn' ],
[ static => nolabel => 1, content => sub {
h2 'Selected visual novels';
diff --git a/lib/VNDB/Handler/Tags.pm b/lib/VNDB/Handler/Tags.pm
index ecdaebbc..81d0be37 100644
--- a/lib/VNDB/Handler/Tags.pm
+++ b/lib/VNDB/Handler/Tags.pm
@@ -316,7 +316,7 @@ sub tagedit {
end;
}
- $self->htmlForm({ frm => $frm, action => $par ? "/g$par->{id}/add" : $tag ? "/g$tag/edit" : '/g/new' }, $title => [
+ $self->htmlForm({ frm => $frm, action => $par ? "/g$par->{id}/add" : $tag ? "/g$tag/edit" : '/g/new' }, 'tagedit' => [ $title,
[ input => short => 'name', name => 'Primary name' ],
$self->authCan('tagmod') ? (
$tag ?
@@ -450,7 +450,7 @@ sub vntagmod {
end;
end;
end;
- $self->htmlForm({ frm => $frm, action => "/v$vid/tagmod", nosubmit => 1 }, 'Tags' => [
+ $self->htmlForm({ frm => $frm, action => "/v$vid/tagmod", nosubmit => 1 }, tagmod => [ 'Tags',
[ hidden => short => 'taglinks', value => '' ],
[ static => nolabel => 1, content => sub {
table id => 'tagtable';
diff --git a/lib/VNDB/Handler/Users.pm b/lib/VNDB/Handler/Users.pm
index dbf9dee4..ff1d9695 100644
--- a/lib/VNDB/Handler/Users.pm
+++ b/lib/VNDB/Handler/Users.pm
@@ -150,7 +150,7 @@ sub login {
}
$self->htmlHeader(title => 'Login', noindex => 1);
- $self->htmlForm({ frm => $frm, action => '/u/login' }, Login => [
+ $self->htmlForm({ frm => $frm, action => '/u/login' }, login => [ 'Login',
[ input => name => 'Username', short => 'usrname' ],
[ static => content => '<a href="/u/register">No account yet?</a>' ],
[ passwd => name => 'Password', short => 'usrpass' ],
@@ -215,7 +215,7 @@ __
."Don't worry! Just give us the email address you used to register on VNDB,\n"
."and we'll send you a new password within a few minutes!";
end;
- $self->htmlForm({ frm => $frm, action => '/u/newpass' }, 'Reset Password' => [
+ $self->htmlForm({ frm => $frm, action => '/u/newpass' }, newpass => [ 'Reset Password',
[ input => name => 'Email', short => 'mail' ],
]);
$self->htmlFooter;
@@ -284,7 +284,7 @@ sub register {
end;
end;
- $self->htmlForm({ frm => $frm, action => '/u/register' }, 'New Account' => [
+ $self->htmlForm({ frm => $frm, action => '/u/register' }, register => [ 'New Account',
[ input => short => 'usrname', name => 'Username' ],
[ static => content => 'Requested username. Must be lowercase and can only consist of alphanumeric characters.' ],
[ input => short => 'mail', name => 'Email' ],
@@ -363,7 +363,7 @@ sub edit {
end;
end
}
- $self->htmlForm({ frm => $frm, action => "/u$uid/edit" }, $title => [
+ $self->htmlForm({ frm => $frm, action => "/u$uid/edit" }, useredit => [ $title,
[ part => title => 'General Info' ],
$self->authCan('usermod') ? (
[ input => short => 'usrname', name => 'Username' ],
diff --git a/lib/VNDB/Handler/VNEdit.pm b/lib/VNDB/Handler/VNEdit.pm
index 9ab3862d..f718fbfa 100644
--- a/lib/VNDB/Handler/VNEdit.pm
+++ b/lib/VNDB/Handler/VNEdit.pm
@@ -140,7 +140,7 @@ sub _form {
my($self, $v, $frm) = @_;
my $r = $v ? $self->dbReleaseGet(vid => $v->{id}) : [];
$self->htmlForm({ frm => $frm, action => $v ? "/v$v->{id}/edit" : '/v/new', editsum => 1, upload => 1 },
- 'General info' => [
+ vn_geninfo => [ '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.' ],
@@ -172,7 +172,7 @@ sub _form {
|],
],
- 'Image' => [
+ vn_img => [ 'Image',
[ static => nolabel => 1, content => sub {
div class => 'img';
p 'No image uploaded yet' if !$v || !$v->{image};
@@ -195,7 +195,7 @@ sub _form {
}],
],
- 'Relations' => [
+ vn_rel => [ 'Relations',
[ hidden => short => 'relations' ],
[ static => nolabel => 1, content => sub {
h2 'Selected relations';
@@ -227,7 +227,7 @@ sub _form {
}],
],
- !@$r ? () : ( 'Screenshots' => [
+ !@$r ? () : ( vn_scr => [ 'Screenshots',
[ hidden => short => 'screenshots' ],
[ static => nolabel => 1, content => sub {
div class => 'warning';
diff --git a/lib/VNDB/Util/FormHTML.pm b/lib/VNDB/Util/FormHTML.pm
index 473f8e7d..7e3b6f67 100644
--- a/lib/VNDB/Util/FormHTML.pm
+++ b/lib/VNDB/Util/FormHTML.pm
@@ -246,9 +246,8 @@ sub htmlForm {
if(@subs > 2) {
ul class => 'maintabs notfirst', id => 'jt_select';
for (0..$#subs/2) {
- (my $short = lc $subs[$_*2]) =~ s/[^\w\d]+/_/g;
li class => 'left';
- a href => "#$short", id => "jt_sel_$short", $subs[$_*2];
+ a href => "#$subs[$_*2]", id => "jt_sel_$subs[$_*2]", $subs[$_*2+1][0];
end;
}
li class => 'left';
@@ -258,9 +257,9 @@ sub htmlForm {
}
# form subs
- while(my($name, $parts) = (shift(@subs), shift(@subs))) {
- last if !$name || !$parts;
- (my $short = lc $name) =~ s/[^\w\d]+/_/g;
+ while(my($short, $parts) = (shift(@subs), shift(@subs))) {
+ last if !$short || !$parts;
+ my $name = shift @$parts;
div class => 'mainbox', id => 'jt_box_'.$short;
h1 $name;
fieldset;