1 |
wakaba |
1.1 |
#?SuikaWikiConfig/2.0 |
2 |
|
|
|
3 |
|
|
Plugin: |
4 |
|
|
@Name: WikiPageRemove |
5 |
|
|
@Description: |
6 |
|
|
@@@: WikiPage removing |
7 |
|
|
@@lang:en |
8 |
|
|
@License: %%GPL%% |
9 |
|
|
@Author: |
10 |
|
|
@@Name: |
11 |
|
|
@@@@: Wakaba |
12 |
|
|
@@@lang:ja |
13 |
|
|
@@@script:Latn |
14 |
|
|
@@Mail[list]: w@suika.fam.cx |
15 |
|
|
@Date.RCS: $Date: 2003/12/26 06:37:44 $ |
16 |
|
|
@RequiredPlugin[list]: |
17 |
|
|
Error |
18 |
|
|
WikiEdit |
19 |
|
|
WikiFormCore |
20 |
|
|
WikiResource |
21 |
|
|
|
22 |
|
|
PluginConst: |
23 |
|
|
@NS_XHTML1: |
24 |
|
|
http://www.w3.org/1999/xhtml |
25 |
|
|
|
26 |
|
|
ViewDefinition: |
27 |
|
|
@Mode: wpr--remove |
28 |
|
|
@Condition: |
29 |
|
|
@@http-method[list]: |
30 |
|
|
POST |
31 |
|
|
@Description: |
32 |
|
|
@@@: Removing a WikiPage |
33 |
|
|
@@lang: en |
34 |
|
|
@method: |
35 |
|
|
@@Name: main |
36 |
|
|
@@@: |
37 |
|
|
$self->{view}->{wiki}->{var}->{db}->{read_only}->{'content'} = 0; |
38 |
|
|
$self->{view}->{wiki}->{var}->{db}->{read_only}->{'lastmodified'} = 0; |
39 |
|
|
$self->{view}->init_db; |
40 |
|
|
my $page = $self->{view}->{wiki}->{var}->{page}; |
41 |
|
|
|
42 |
|
|
## Check confliction |
43 |
|
|
my $current_content = $self->{view}->{wiki}->{db}->get (content => $page); |
44 |
|
|
if (length $current_content) { |
45 |
|
|
my $current_digest = SuikaWiki::Plugin->module_package ('WikiEdit') |
46 |
|
|
->digest ($current_content, |
47 |
|
|
normalize => 1); |
48 |
|
|
my $prev_digest |
49 |
|
|
= $self->{view}->{wiki}->{input}->parameter ('we--digest'); |
50 |
|
|
if ($current_digest ne $prev_digest) { |
51 |
|
|
SuikaWiki::Plugin->module_package ('Error') |
52 |
|
|
->report_error_simple |
53 |
|
|
($self->{view}->{wiki}, |
54 |
|
|
WikiPageRename => SuikaWiki::Plugin |
55 |
|
|
->module_package |
56 |
|
|
('WikiResource') |
57 |
|
|
->get_text |
58 |
|
|
(name => |
59 |
|
|
'WikiPageRename:Modified', |
60 |
|
|
param => {wiki => $self->{view}->{wiki}}, |
61 |
|
|
wiki => $self->{view}->{wiki})); |
62 |
|
|
$self->{view}->{wiki}->view_in_mode (mode => '-general-error'); |
63 |
|
|
throw SuikaWiki::View::Implementation::error -type => 'ERROR_REPORTED'; |
64 |
|
|
} |
65 |
|
|
} |
66 |
|
|
|
67 |
|
|
for (qw/content lastmodified/) { |
68 |
|
|
$self->{view}->{wiki}->{db}->delete ($_, $page); |
69 |
|
|
} |
70 |
|
|
$self->{view}->{wiki}->view_in_mode (mode => '-deleted'); |
71 |
|
|
|
72 |
|
|
FormattingRule: |
73 |
|
|
@Category[list]: view |
74 |
|
|
@Name: wpr--remove-button |
75 |
|
|
@Description: |
76 |
|
|
@@@: Removing button |
77 |
|
|
@@lang: en |
78 |
|
|
@Parameter: |
79 |
|
|
@@Name: page |
80 |
|
|
@@Type: WikiName |
81 |
|
|
@@Default: (auto) |
82 |
|
|
@@Description: |
83 |
|
|
@@@@: WikiPage that is editing |
84 |
|
|
@@@lang:en |
85 |
|
|
@Formatting: |
86 |
|
|
__ATTRTEXT:%page__; |
87 |
|
|
|
88 |
|
|
my $page = $p->{page} ? [split m#//#, $p->{page}] |
89 |
|
|
: $o->{wiki}->{var}->{page}; |
90 |
|
|
local $o->{var} = { |
91 |
|
|
#content |
92 |
|
|
is_admin_mode => 0, |
93 |
|
|
is_conflict_mode => 0, |
94 |
|
|
#is_new_page_template |
95 |
|
|
}; |
96 |
|
|
$o->{var}->{content} = SuikaWiki::Plugin->module_package ('WikiEdit') |
97 |
|
|
->get_content ($o, $page); |
98 |
|
|
SuikaWiki::Plugin->module_package ('WikiFormCore') |
99 |
|
|
->make_form_in_html |
100 |
|
|
($p->{-parent}, ' ', |
101 |
|
|
wiki => $o->{wiki}, |
102 |
|
|
o => $o, |
103 |
|
|
index => -1, |
104 |
|
|
output => { |
105 |
|
|
mode => 'wpr--remove', |
106 |
|
|
page => $page, |
107 |
|
|
hidden => sub { |
108 |
|
|
my ($hidden, $o) = @_; |
109 |
|
|
for ($hidden->append_new_node (type => '#element', |
110 |
|
|
namespace_uri => $NS_XHTML1, |
111 |
|
|
local_name => 'input')) { |
112 |
|
|
$_->set_attribute (type => 'hidden'); |
113 |
|
|
$_->set_attribute (name => 'we--digest'); |
114 |
|
|
$_->set_attribute (value => ($o->{var}->{is_new_page_template}?'': |
115 |
|
|
SuikaWiki::Plugin->module_package ('WikiEdit') |
116 |
|
|
->digest ($o->{var}->{content}, |
117 |
|
|
normalize => 1))); |
118 |
|
|
$_->option (use_EmptyElemTag => 1); |
119 |
|
|
} |
120 |
|
|
for ($hidden->append_new_node (type => '#element', |
121 |
|
|
namespace_uri => $NS_XHTML1, |
122 |
|
|
local_name => 'input')) { |
123 |
|
|
$_->set_attribute (type => 'submit'); |
124 |
|
|
$_->set_attribute (value => SuikaWiki::Plugin |
125 |
|
|
->module_package ('WikiResource') |
126 |
|
|
->append_node |
127 |
|
|
(name => 'WikiPageRemove:Remove:Label', |
128 |
|
|
param => $o, |
129 |
|
|
wiki => $o->{wiki})->inner_text); |
130 |
|
|
$_->set_attribute (title => SuikaWiki::Plugin |
131 |
|
|
->module_package ('WikiResource') |
132 |
|
|
->append_node |
133 |
|
|
(name => |
134 |
|
|
'WikiPageRemove:Remove:Description', |
135 |
|
|
param => $o, |
136 |
|
|
wiki => $o->{wiki})->inner_text); |
137 |
|
|
$_->option (use_EmptyElemTag => 1); |
138 |
|
|
} |
139 |
|
|
}, |
140 |
|
|
}); |
141 |
|
|
|
142 |
|
|
|
143 |
|
|
Resource: |
144 |
|
|
@WikiPageRename:Modified: |
145 |
|
|
@@@: |
146 |
|
|
WikiPage you are attempting to remove ("%page-name;") has been modified. |
147 |
|
|
Please review latest version of the page before removal. |
148 |
|
|
@@lang:en |
149 |
|
|
@WikiPageRemove:Remove:Description: |
150 |
|
|
@@@:Removing WikiPage "%page-name;", w/o any caution nor backup. |
151 |
|
|
@@lang:en |
152 |
|
|
@WikiPageRemove:Remove:Label: |
153 |
|
|
@@@:Remove WikiPage |
154 |
|
|
@@lang:en |