#?SuikaWikiConfig/2.0 Plugin: @Name: WikiPageRemove @Description: @@@: WikiPage removing @@lang:en @License: %%Perl%% @Author: @@Name: @@@@: Wakaba @@@lang:ja @@@script:Latn @@Mail[list]: w@suika.fam.cx @Date.RCS: $Date: 2004/04/25 07:06:50 $ @RequiredPlugin[list]: Error WikiEdit WikiFormCore WikiResource @Use: use Message::Util::Error; PluginConst: @NS_XHTML1: http://www.w3.org/1999/xhtml ViewDefinition: @Mode: wpr--remove @Condition: @@http-method[list]: POST @Description: @@@: Removing a WikiPage @@lang: en @method: @@Name: main @@@: $self->{view}->{wiki}->{var}->{db}->{read_only}->{'content'} = 0; $self->{view}->{wiki}->{var}->{db}->{read_only}->{'content_prop'} = 0; $self->{view}->{wiki}->{var}->{db}->{read_only}->{'lastmodified'} = 0; $self->{view}->init_db; my $page = $self->{view}->{wiki}->{var}->{page}; ## Check confliction my $current_content; try { $current_content = $self->{view}->{wiki}->{db}->get (content => $page); } catch SuikaWiki::DB::Util::Error with { my $err = shift; $err->throw if $err->{-type} eq 'ERROR_REPORTED'; $self->{view}->{wiki}->view_in_mode (mode => '-wdb--fatal-error'); throw SuikaWiki::DB::Util::Error -type => 'ERROR_REPORTED'; }; if (length $current_content) { my $current_digest = SuikaWiki::Plugin->module_package ('WikiEdit') ->digest ($current_content, normalize => 1); my $prev_digest = $self->{view}->{wiki}->{input}->parameter ('we--digest'); if ($current_digest ne $prev_digest) { SuikaWiki::Plugin->module_package ('Error') ->report_error_simple ($self->{view}->{wiki}, WikiPageRemove => SuikaWiki::Plugin ->module_package ('WikiResource') ->get_text (name => 'WikiPageRemove:Modified', param => {wiki => $self->{view}->{wiki}}, wiki => $self->{view}->{wiki})); $self->{view}->{wiki}->view_in_mode (mode => '-general-error'); throw SuikaWiki::View::Implementation::error -type => 'ERROR_REPORTED'; } } try { $self->{view}->{wiki}->{db}->delete (content => $page); $self->{view}->{wiki}->{db}->delete (content_prop => $page); $self->{view}->{wiki}->{db}->delete (lastmodified => $page); } catch SuikaWiki::DB::Util::Error with { my $err = shift; $err->throw if $err->{-type} eq 'ERROR_REPORTED'; $self->{view}->{wiki}->view_in_mode (mode => '-wdb--fatal-error'); throw SuikaWiki::DB::Util::Error -type => 'ERROR_REPORTED'; }; $self->{view}->{wiki}->view_in_mode (mode => '-deleted'); FormattingRule: @Category[list]: view @Name: wpr--remove-button @Description: @@@: Removing button @@lang: en @Parameter: @@Name: page @@Type: WikiName @@Default: (auto) @@Description: @@@@: WikiPage that is editing @@@lang:en @Formatting: __ATTRTEXT:%page__; my $page = $o->{wiki}->name ($p->{page} || $o->{wiki}->{var}->{page}); local $o->{var} = { #content is_admin_mode => 0, is_conflict_mode => 0, #is_new_page_template }; $o->{var}->{content} = SuikaWiki::Plugin->module_package ('WikiEdit') ->get_content ($o, $page)->{content}; SuikaWiki::Plugin->module_package ('WikiFormCore') ->make_form_in_html ($p->{-parent}, ' ', wiki => $o->{wiki}, o => $o, index => -1, output => { mode => 'wpr--remove', page => $page, hidden => sub { my ($hidden, $o) = @_; for ($hidden->append_new_node (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'input')) { $_->set_attribute (type => 'hidden'); $_->set_attribute (name => 'we--digest'); $_->set_attribute (value => ($o->{var}->{is_new_page_template}?'': SuikaWiki::Plugin->module_package ('WikiEdit') ->digest ($o->{var}->{content}, normalize => 1))); $_->option (use_EmptyElemTag => 1); } for ($hidden->append_new_node (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'input')) { $_->set_attribute (type => 'submit'); $_->set_attribute (value => SuikaWiki::Plugin ->module_package ('WikiResource') ->append_node (name => 'WikiPageRemove:Remove:Label', param => $o, wiki => $o->{wiki})->inner_text); $_->set_attribute (title => SuikaWiki::Plugin ->module_package ('WikiResource') ->append_node (name => 'WikiPageRemove:Remove:Description', param => $o, wiki => $o->{wiki})->inner_text); $_->option (use_EmptyElemTag => 1); } }, }); Resource: @WikiPageRemove:Modified: @@@: WikiPage you are attempting to remove ("%page-name;") has been modified. Please review latest version of the page before removal. @@lang:en @WikiPageRemove:Remove:Description: @@@:Removing WikiPage "%page-name;", w/o any caution nor backup. @@lang:en @WikiPageRemove:Remove:Label: @@@:Remove WikiPage @@lang:en