summaryrefslogtreecommitdiff
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
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.
-rw-r--r--data/style.css44
-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
-rw-r--r--static/f/forms.js6
-rw-r--r--static/f/script.js6
10 files changed, 48 insertions, 49 deletions
diff --git a/data/style.css b/data/style.css
index 9dd34953..bf9bacfb 100644
--- a/data/style.css
+++ b/data/style.css
@@ -721,15 +721,15 @@ a.addnew {
/***** VN edit *****/
-#jt_box_relations table { margin-bottom: 10px; }
-#jt_box_relations h2 { margin: 0 0 3px 0px; }
-#jt_box_relations td { padding: 1px 2px; vertical-align: middle; }
-#jt_box_relations td.tc1 { width: 300px; text-align: right }
-#jt_box_relations td.tc2 { width: 170px; white-space: nowrap }
-#jt_box_relations td.tc3 { width: 200px; }
-#jt_box_relations td.tc4 { width: 40px; text-align: right }
-#jt_box_relations td.tc1 input { width: 280px; }
-#jt_box_relations td.tc2 select { width: 130px; }
+#jt_box_vn_rel table { margin-bottom: 10px; }
+#jt_box_vn_rel h2 { margin: 0 0 3px 0px; }
+#jt_box_vn_rel td { padding: 1px 2px; vertical-align: middle; }
+#jt_box_vn_rel td.tc1 { width: 300px; text-align: right }
+#jt_box_vn_rel td.tc2 { width: 170px; white-space: nowrap }
+#jt_box_vn_rel td.tc3 { width: 200px; }
+#jt_box_vn_rel td.tc4 { width: 40px; text-align: right }
+#jt_box_vn_rel td.tc1 input { width: 280px; }
+#jt_box_vn_rel td.tc2 select { width: 130px; }
#ds_box {
border: 1px solid $border$;
@@ -747,16 +747,16 @@ a.addnew {
width: 100%;
}
-#jt_box_image div.img {
+#jt_box_vn_img div.img {
float: left;
height: 400px;
padding-right: 20px;
}
-#jt_box_image h2 {
+#jt_box_vn_img h2 {
margin: 0;
}
-#jt_box_screenshots table { width: 95% }
+#jt_box_vn_scr table { width: 95% }
#scr_table td { height: 108px; border-top: 1px solid #258; padding: 0; padding-right: 5px }
#scr_table td.thumb { width: 136px; vertical-align: middle }
#scr_table select { width: 400px; }
@@ -854,19 +854,19 @@ a.addnew {
.platforms { padding-left: 20px; }
.platforms span { display: block; float: left; width: 150px; }
-#jt_box_format h2 { clear: left; padding-top: 10px; }
+#jt_box_rel_format h2 { clear: left; padding-top: 10px; }
#media_div select.qty { width: 90px; }
#media_div select.medium { width: 150px }
#media_div { padding-left: 20px; }
#media_div span { display: block }
-#jt_box_visual_novels h2, #jt_box_producers h2 { clear: left; padding-top: 10px; }
-#jt_box_visual_novels div, #jt_box_producers div { padding-left: 20px }
-#jt_box_visual_novels input, #jt_box_producers input { margin-right: 10px; width: 300px }
-#jt_box_visual_novels span, #jt_box_producers span { clear: left; display: block; padding: 2px; }
-#jt_box_visual_novels span.odd, #jt_box_producers span.odd { background: url($_boxbg$) repeat; }
-#jt_box_visual_novels i, #jt_box_producers i { font-style: normal; display: block; float: left; width: 310px }
-#jt_box_visual_novels b, #jt_box_producers b { font-weight: normal; }
+#jt_box_rel_vn h2, #jt_box_rel_prod h2 { clear: left; padding-top: 10px; }
+#jt_box_rel_vn div, #jt_box_rel_prod div { padding-left: 20px }
+#jt_box_rel_vn input, #jt_box_rel_prod input { margin-right: 10px; width: 300px }
+#jt_box_rel_vn span, #jt_box_rel_prod span { clear: left; display: block; padding: 2px; }
+#jt_box_rel_vn span.odd, #jt_box_rel_prod span.odd { background: url($_boxbg$) repeat; }
+#jt_box_rel_vn i, #jt_box_rel_prod i { font-style: normal; display: block; float: left; width: 310px }
+#jt_box_rel_vn b, #jt_box_rel_prod b { font-weight: normal; }
@@ -967,7 +967,7 @@ div.browse.uposts td.tc1 {
/***** VN tagmod *****/
-#jt_box_tags .formtable table td { padding: 1px 5px }
+#jt_box_tagmod .formtable table td { padding: 1px 5px }
#tagtable tfoot td { padding-top: 20px!important; }
#tagtable .tc2_1 { border-right: 1px solid $border$; border-left: 1px solid $border$; width: 150px; text-align: center }
#tagtable .tc3_1 { border-left: 1px solid $border$; width: 150px; text-align: center }
@@ -988,7 +988,7 @@ a.taglvl:hover { border-bottom: 1px solid transparent!important }
.taglvlsel.taglvl1 { background-color: #cf0; border-color: #cf0 }
.taglvlsel.taglvl2 { background-color: #8f0; border-color: #8f0 }
.taglvlsel.taglvl3 { background-color: #0f0; border-color: #0f0 }
-#jt_box_tags #tagtable .tc3 { padding: 0 }
+#jt_box_tagmod #tagtable .tc3 { padding: 0 }
#tagtable .tc3 select { width: 90px; height: 15px; border: 0; margin: 0; font-size: 11px; background-color: $_blendbg$; text-align: right }
#tagtable .odd .tc3 select { background-color: $secbg$ }
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;
diff --git a/static/f/forms.js b/static/f/forms.js
index ec4b818b..1558358c 100644
--- a/static/f/forms.js
+++ b/static/f/forms.js
@@ -213,7 +213,7 @@ function relLoad() {
// make sure the title is up-to-date
x('title').onchange = function() {
- l = x('jt_box_relations').getElementsByTagName('td');
+ l = x('jt_box_vn_rel').getElementsByTagName('td');
for(i=0;i<l.length;i++)
if(l[i].className == 'tc3')
l[i].innerHTML = shorten(this.value, 40);
@@ -720,7 +720,7 @@ function vnpLoad(type) {
vnpCheckEmpty(type);
// dropdown
- var n = x('jt_box_'+(type == 'vn' ? 'visual_novels' : type)).getElementsByTagName('div')[1];
+ var n = x('jt_box_'+(type == 'vn' ? 'rel_vn' : 'rel_prod')).getElementsByTagName('div')[1];
dsInit(n.getElementsByTagName('input')[0], '/xml/'+type+'.xml?q=', function(item, tr) {
var td = document.createElement('td');
td.innerHTML = type.substr(0,1)+item.getAttribute('id');
@@ -771,7 +771,7 @@ function vnpStripe(type) {
}
function vnpFormAdd(type) {
- var n = x('jt_box_'+(type == 'vn' ? 'visual_novels' : type)).getElementsByTagName('div')[1];
+ var n = x('jt_box_'+(type == 'vn' ? 'rel_vn' : 'rel_prod')).getElementsByTagName('div')[1];
var txt = n.getElementsByTagName('input')[0];
var lnk = n.getElementsByTagName('a')[0];
var input = txt.value;
diff --git a/static/f/script.js b/static/f/script.js
index c94d781a..41a823b5 100644
--- a/static/f/script.js
+++ b/static/f/script.js
@@ -607,13 +607,13 @@ DOMLoad(function() {
// forms.js
if(x('relations'))
relLoad();
- if(x('jt_box_screenshots'))
+ if(x('jt_box_vn_scr'))
scrLoad();
if(x('media'))
medLoad();
- if(x('jt_box_visual_novels'))
+ if(x('jt_box_rel_vn'))
vnpLoad('vn');
- if(x('jt_box_producers'))
+ if(x('jt_box_rel_prod'))
vnpLoad('producers');
if(x('taglinks'))
tglLoad();