diff options
author | Yorhel <git@yorhel.nl> | 2008-11-22 10:04:35 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2008-11-22 10:04:35 +0100 |
commit | 91c9b4428260c9a4b22de78d41d946a95503c50f (patch) | |
tree | e7e5b8c24172b67042b41d2e89fc7cf0231a5a01 /lib/VNDB/Util/CommonHTML.pm | |
parent | aac83c8b840f62d3febf2212b86bf7cf40eb3fa1 (diff) |
Created htmlEditMessage() and started on /v+/edit
It'll take a while before the VN edit form is finished... it's
one of the most complex things of VNDB.
Diffstat (limited to 'lib/VNDB/Util/CommonHTML.pm')
-rw-r--r-- | lib/VNDB/Util/CommonHTML.pm | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm index 7a41f81e..48509d65 100644 --- a/lib/VNDB/Util/CommonHTML.pm +++ b/lib/VNDB/Util/CommonHTML.pm @@ -9,7 +9,7 @@ use Algorithm::Diff::XS 'compact_diff'; use VNDB::Func; use Encode 'encode_utf8', 'decode_utf8'; -our @EXPORT = qw|htmlMainTabs htmlDenied htmlHiddenMessage htmlBrowse htmlBrowseNavigate htmlRevision|; +our @EXPORT = qw|htmlMainTabs htmlDenied htmlHiddenMessage htmlBrowse htmlBrowseNavigate htmlRevision htmlEditMessage|; # generates the "main tabs". These are the commonly used tabs for @@ -326,4 +326,35 @@ sub revdiff { } +# Generates a generic message to show as the header of the edit forms +# Arguments: v/r/p, obj +sub htmlEditMessage { + my($self, $type, $obj) = @_; + my $full = {v => 'visual novel', r => 'release', p => 'producer'}->{$type}; + my $guidelines = {v => 2, r => 3, p => 4}->{$type}; + + div class => 'mainbox'; + h1 $obj ? "Edit $obj->{name}" : "Add new $full"; + div class => 'notice'; + h2 'Before editing:'; + ul; + li; lit qq|Read the <a href="/d$guidelines">guidelines</a>!|; end; + if($obj) { + li; lit qq|Check for any existing discussions on the <a href="/t/$type$obj->{id}">discussion board</a>|; end; + li; lit qq|Browse the <a href="/$type$obj->{id}/hist">edit history</a> for any recent changes related to what you want to change.|; end; + } elsif($type ne 'r') { + li; lit qq|<a href="/$type/all">Search the database</a> to see if we already have information about this $full|; end; + } + end; + end; + if($obj && $obj->{latest} != $obj->{cid}) { + div class => 'warning'; + h2 'Reverting'; + p qq|You are editing an old revision of this $full. If you save it, all changes made after this revision will be reverted!|; + end; + } + end; +} + + 1; |