1 |
wakaba |
1.1 |
use strict; |
2 |
|
|
package SuikaWiki::Plugin::Registry; |
3 |
|
|
|
4 |
|
|
|
5 |
|
|
our %Info; |
6 |
|
|
$Info{q#PropEdit#}->{Name} = q#PropEdit#; |
7 |
|
|
$Info{q#PropEdit#}->{q#Version#} = q#2005.0315.0839#; |
8 |
|
|
$Info{q#PropEdit#}->{q#InterfaceVersion#} = q#2.9.1#; |
9 |
|
|
$Info{q#PropEdit#}->{q#mkpluginVersion#} = q#2.1.21#; |
10 |
|
|
$Info{q#PropEdit#}->{q#module_name#} = q#SuikaWiki::Plugin::plugin::PropEdit1050215083940axZ0#; |
11 |
|
|
$Info{q#PropEdit#}->{q#Date.RCS#} = q#$Date: 2005/02/06 12:24:08 $#; |
12 |
|
|
$Info{q#PropEdit#}->{RequiredPlugin} = [q#WikiEdit#, q#WikiFormCore#]; |
13 |
|
|
$Info{q#PropEdit#}->{Description} = [[q#WikiPage Property Editor#, q#en#, q##]]; |
14 |
|
|
$Info{q#PropEdit#}->{License} = [[q#%%Perl%%#, q##, q##]]; |
15 |
|
|
$Info{q#PropEdit#}->{Author} = [[[[q#Wakaba#, q#ja#, q#Latn#]], [[q#w@suika.fam.cx#]], [q##]]]; |
16 |
|
|
|
17 |
|
|
push @SuikaWiki::View::Implementation::CommonViewDefs, { |
18 |
|
|
condition => {q#mode#, q#pe__propedit#, q#http_method#, [q#GET#, q#HEAD#]}, |
19 |
|
|
object_class => q#SuikaWiki::Plugin::plugin::PropEdit1050215083940axZ0::pe__propedit1050215083940d0B_#, |
20 |
|
|
}; |
21 |
|
|
package SuikaWiki::Plugin::plugin::PropEdit1050215083940axZ0::pe__propedit1050215083940d0B_; |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
our @ISA = q#SuikaWiki::View::template#; |
25 |
|
|
|
26 |
|
|
sub main ($$$) { |
27 |
|
|
my ($self, $opt, $opt2) = @_; |
28 |
|
|
require SuikaWiki::Output::HTTP; |
29 |
|
|
$opt2->{output} = SuikaWiki::Output::HTTP->new |
30 |
|
|
(wiki => $self->{view}->{wiki}, |
31 |
|
|
view => $self->{view}, viewobj => $self); |
32 |
|
|
for (@{$self->{view}->{wiki}->{var}->{client}->{used_for_negotiate}}, |
33 |
|
|
'Accept-Language') { |
34 |
|
|
$opt2->{output}->add_negotiate_header_field ($_); |
35 |
|
|
} |
36 |
|
|
|
37 |
|
|
$opt2->{template} = q#%html-document ( |
38 |
|
|
title => {%res(name=>{PropEdit:WebPageTitle});}p, |
39 |
|
|
link-meta => {%template (name => links); |
40 |
|
|
%html-meta(name => ROBOTS, content => NOINDEX);}p, |
41 |
|
|
content => { |
42 |
|
|
%template ( |
43 |
|
|
name => ws--page, |
44 |
|
|
-content => { |
45 |
|
|
%section ( |
46 |
|
|
title => {%res (name => {PropEdit:Title});}p, heading, |
47 |
|
|
content => { |
48 |
|
|
%pe--propedit (template => { |
49 |
|
|
%resource-as-plain-text (name => {PropEdit:Template}); |
50 |
|
|
}p); |
51 |
|
|
}p, |
52 |
|
|
); |
53 |
|
|
}, |
54 |
|
|
); |
55 |
|
|
}p, |
56 |
|
|
);#; |
57 |
|
|
$opt2->{o} = bless { |
58 |
|
|
## SuikaWiki 3 WikiPlugin interface |
59 |
|
|
wiki => $self->{view}->{wiki}, |
60 |
|
|
plugin => $self->{view}->{wiki}->{plugin}, |
61 |
|
|
var => {}, |
62 |
|
|
}, 'SuikaWiki::Plugin'; |
63 |
|
|
$opt2->{output}->{status_code} = 200; |
64 |
|
|
|
65 |
|
|
$opt2->{output}->{entity}->{media_type} = q#text/html#; |
66 |
|
|
|
67 |
|
|
$opt2->{output}->{entity}->{charset} = $self->{view}->{wiki}->{config}->{charset}->{output}; |
68 |
|
|
$opt2->{output}->set_expires (%{$self->{view}->{wiki}->{config}->{entity}->{expires}->{q#edit#}}); |
69 |
|
|
$opt2->{output}->{entity}->{body_is_octet_stream} = 0; |
70 |
|
|
|
71 |
|
|
$self->{view}->{wiki}->init_db; |
72 |
|
|
$self->main_pre ($opt, $opt2); |
73 |
|
|
|
74 |
|
|
require Message::Markup::XML::Serialize::HTML; |
75 |
|
|
use Message::Util::Error; |
76 |
|
|
try { |
77 |
|
|
$opt2->{output}->{entity}->{body} |
78 |
|
|
= Message::Markup::XML::Serialize::HTML::html_simple |
79 |
|
|
(SuikaWiki::Plugin->formatter ('view') |
80 |
|
|
->replace ($opt2->{template}, param => $opt2->{o})); |
81 |
|
|
} $self->{view}->{wiki}->{config}->{catch}->{ formatter_view }; |
82 |
|
|
$opt2->{output}->output (output => 'http-cgi'); |
83 |
|
|
|
84 |
|
|
$self->main_post ($opt, $opt2); |
85 |
|
|
} |
86 |
|
|
|
87 |
|
|
push @SuikaWiki::View::Implementation::CommonViewDefs, { |
88 |
|
|
condition => {q#mode#, q#-pe__conflict#, q#http_method#, [q#GET#]}, |
89 |
|
|
object_class => q#SuikaWiki::Plugin::plugin::PropEdit1050215083940axZ0::pe__conflict10502150839409v13#, |
90 |
|
|
}; |
91 |
|
|
package SuikaWiki::Plugin::plugin::PropEdit1050215083940axZ0::pe__conflict10502150839409v13; |
92 |
|
|
|
93 |
|
|
|
94 |
|
|
our @ISA = q#SuikaWiki::View::template#; |
95 |
|
|
|
96 |
|
|
sub main ($$$) { |
97 |
|
|
my ($self, $opt, $opt2) = @_; |
98 |
|
|
require SuikaWiki::Output::HTTP; |
99 |
|
|
$opt2->{output} = SuikaWiki::Output::HTTP->new |
100 |
|
|
(wiki => $self->{view}->{wiki}, |
101 |
|
|
view => $self->{view}, viewobj => $self); |
102 |
|
|
for (@{$self->{view}->{wiki}->{var}->{client}->{used_for_negotiate}}, |
103 |
|
|
'Accept-Language') { |
104 |
|
|
$opt2->{output}->add_negotiate_header_field ($_); |
105 |
|
|
} |
106 |
|
|
|
107 |
|
|
$opt2->{template} = q#%html-document ( |
108 |
|
|
title => {%res(name=>{PropEdit:Conflict:WebPageTitle});}p, |
109 |
|
|
link-meta => {%template (name => links); |
110 |
|
|
%html-meta(name => ROBOTS, content => NOINDEX);}p, |
111 |
|
|
content => { |
112 |
|
|
%template ( |
113 |
|
|
name => ws--page, |
114 |
|
|
-content => { |
115 |
|
|
%section ( |
116 |
|
|
title => {%res (name => {PropEdit:Conflict:Title});}p, heading, |
117 |
|
|
content => { |
118 |
|
|
%paragraph (content => { |
119 |
|
|
%res (name => {PropEdit:Conflict:Description}); |
120 |
|
|
}p); |
121 |
|
|
%pe--propedit (template => { |
122 |
|
|
%resource-as-plain-text (name => {PropEdit:Template}); |
123 |
|
|
}p, |
124 |
|
|
); |
125 |
|
|
}p);}, |
126 |
|
|
); |
127 |
|
|
}p, |
128 |
|
|
);#; |
129 |
|
|
$opt2->{o} = bless { |
130 |
|
|
## SuikaWiki 3 WikiPlugin interface |
131 |
|
|
wiki => $self->{view}->{wiki}, |
132 |
|
|
plugin => $self->{view}->{wiki}->{plugin}, |
133 |
|
|
var => {}, |
134 |
|
|
}, 'SuikaWiki::Plugin'; |
135 |
|
|
$opt2->{output}->{status_code} = 409; |
136 |
|
|
|
137 |
|
|
$opt2->{output}->{entity}->{media_type} = q#text/html#; |
138 |
|
|
|
139 |
|
|
$opt2->{output}->{entity}->{charset} = $self->{view}->{wiki}->{config}->{charset}->{output}; |
140 |
|
|
$opt2->{output}->set_expires (%{$self->{view}->{wiki}->{config}->{entity}->{expires}->{q#error#}}); |
141 |
|
|
$opt2->{output}->{entity}->{body_is_octet_stream} = 0; |
142 |
|
|
|
143 |
|
|
$self->{view}->{wiki}->init_db; |
144 |
|
|
$self->main_pre ($opt, $opt2); |
145 |
|
|
|
146 |
|
|
require Message::Markup::XML::Serialize::HTML; |
147 |
|
|
use Message::Util::Error; |
148 |
|
|
try { |
149 |
|
|
$opt2->{output}->{entity}->{body} |
150 |
|
|
= Message::Markup::XML::Serialize::HTML::html_simple |
151 |
|
|
(SuikaWiki::Plugin->formatter ('view') |
152 |
|
|
->replace ($opt2->{template}, param => $opt2->{o})); |
153 |
|
|
} $self->{view}->{wiki}->{config}->{catch}->{ formatter_view }; |
154 |
|
|
$opt2->{output}->output (output => 'http-cgi'); |
155 |
|
|
|
156 |
|
|
$self->main_post ($opt, $opt2); |
157 |
|
|
} |
158 |
|
|
|
159 |
|
|
package SuikaWiki::Plugin::plugin::PropEdit1050215083940axZ0; |
160 |
|
|
|
161 |
|
|
$SuikaWiki::Plugin::Rule{view}->{pe__propedit} = {q#Parameter#, {q#template#, {q#Type#, q#template#, q#Default#, q#(required)#, q#Description#, [[q#Template of the content#, q#en#, q##]]}, q#page#, {q#Type#, q#WikiName#, q#Default#, q#(auto)#, q#Description#, [[q#WikiPage to be edited#, q#en#, q##]]}}, q#Description#, [[q#A property editor form#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; |
162 |
|
|
|
163 |
|
|
#line 1 "(WikiPlugin module source propedit.wp2, block FormattingRule[name()='[q#view#]/pe__propedit']/Formatting)" |
164 |
|
|
$p->{q#page#} = do { my $r = $f->parse_attr ($p=>q#page#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r};$p->{q#template#} = do { my $r = $f->parse_attr ($p=>q#template#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; |
165 |
|
|
my $page = $o->{wiki}->name ($p->{page} || $o->{wiki}->{var}->{page}); |
166 |
|
|
my $template = $p->{template}; |
167 |
|
|
my $content = ($SuikaWiki::Plugin::Registry::Info{q#WikiEdit#}->{module_name} || SuikaWiki::Plugin->module_package (q#WikiEdit#))->get_content ($o, $page); |
168 |
|
|
local $o->{var}->{content} = $content->{content}; |
169 |
|
|
local $o->{var}->{content_prop} = $content->{content_prop}; |
170 |
|
|
local $o->{var}->{source}->{prop} = sub { |
171 |
|
|
my %opt = @_; |
172 |
|
|
my $key = $opt{p}->{id}; |
173 |
|
|
my $uri = $opt{o}->{wiki}->{config}->{q#http://suika.fam.cx/~wakaba/archive/2004/7/20/sw-propedit\#prop#}->{$key}->{uri}; |
174 |
|
|
my $rv = {}; |
175 |
|
|
if ($uri) { |
176 |
|
|
if (my $nv = $opt{o}->{wiki}->{input}->parameter ('PE--CTRL--'.$key)) { |
177 |
|
|
$rv->{value} = $nv; |
178 |
|
|
$rv->{class} = [qw/pe--from-parameter/]; |
179 |
|
|
} else { |
180 |
|
|
$rv->{value} = $opt{o}->{var}->{content_prop} |
181 |
|
|
->get_attribute_value ($uri, |
182 |
|
|
default => $opt{p}->{default}); |
183 |
|
|
} |
184 |
|
|
} else { |
185 |
|
|
$rv->{value} = $opt{p}->{default}; |
186 |
|
|
} |
187 |
|
|
$rv; |
188 |
|
|
}; |
189 |
|
|
($SuikaWiki::Plugin::Registry::Info{q#WikiFormCore#}->{module_name} || SuikaWiki::Plugin->module_package (q#WikiFormCore#))->make_form_in_html |
190 |
|
|
($p->{-parent}, $template, |
191 |
|
|
wiki => $o->{wiki}, |
192 |
|
|
o => $o, |
193 |
|
|
index => -1, |
194 |
|
|
local_id_prefix => 'PE--CTRL--', |
195 |
|
|
output => { |
196 |
|
|
mode => 'pe--write', |
197 |
|
|
page => $page, |
198 |
|
|
submit_button => 1, |
199 |
|
|
hidden => sub { |
200 |
|
|
my ($hidden, $o) = @_; |
201 |
|
|
for ($hidden->append_new_node (type => '#element', |
202 |
|
|
namespace_uri => q#http://www.w3.org/1999/xhtml#, |
203 |
|
|
local_name => 'input')) { |
204 |
|
|
$_->set_attribute (type => 'hidden'); |
205 |
|
|
$_->set_attribute (name => 'pe--seq'); |
206 |
|
|
$_->set_attribute (value => $o->{var}->{content_prop} |
207 |
|
|
->get_attribute_value (q#http://suika.fam.cx/~wakaba/archive/2004/7/20/sw-propedit\#seq#, |
208 |
|
|
default => 0)); |
209 |
|
|
$_->option (use_EmptyElemTag => 1); |
210 |
|
|
} |
211 |
|
|
}, |
212 |
|
|
});}} |
213 |
|
|
#line 1 "(WikiPlugin module PropEdit, chunk 1)" |
214 |
|
|
; |
215 |
|
|
|
216 |
|
|
push @{$SuikaWiki::View::Implementation::TemplateFragment{q#links#}}, { |
217 |
|
|
Main => q#%link-wiki(mode => pe--propedit, up-to-date, |
218 |
|
|
rel => edit, class => wiki-cmd, |
219 |
|
|
description => {%res(name=>{PropEdit:Link:Description});}p);#, |
220 |
|
|
Order => 0, |
221 |
|
|
Description => [[q#Link to property edit mode of the WikiPage#, q#en#, q##]], |
222 |
|
|
}; |
223 |
|
|
|
224 |
|
|
push @SuikaWiki::View::Implementation::CommonViewDefs, { |
225 |
|
|
condition => {q#mode#, q#pe__write#, q#http_method#, [q#POST#]}, |
226 |
|
|
object_class => q#SuikaWiki::Plugin::plugin::PropEdit1050215083940axZ0::pe__write1050215083940kTAg#, |
227 |
|
|
}; |
228 |
|
|
package SuikaWiki::Plugin::plugin::PropEdit1050215083940axZ0::pe__write1050215083940kTAg; |
229 |
|
|
|
230 |
|
|
|
231 |
|
|
our @ISA = q#SuikaWiki::View::template#; |
232 |
|
|
|
233 |
|
|
#line 1 "(WikiPlugin module source propedit.wp2, block ViewDefinition[Mode='pe__write']/Use)" |
234 |
|
|
use Message::Util::Error; |
235 |
|
|
|
236 |
|
|
sub main ($$) { |
237 |
|
|
my ($self, $opt, $opt2) = @_; |
238 |
|
|
|
239 |
|
|
#line 1 "(WikiPlugin module source propedit.wp2, block ViewDefinition[Mode='pe__write']/method[Name='main'])" |
240 |
|
|
my $wiki = $self->{view}->{wiki}; |
241 |
|
|
$wiki->{var}->{db}->{read_only}->{'content'} = 1; |
242 |
|
|
$wiki->{var}->{db}->{read_only}->{'content_prop'} = 0; |
243 |
|
|
$wiki->{var}->{db}->{read_only}->{'lastmodified'} = 1; |
244 |
|
|
$wiki->{var}->{db}->{read_only}->{'referer'} = 0; |
245 |
|
|
$wiki->init_db; |
246 |
|
|
my $page = $wiki->{var}->{page}; |
247 |
|
|
my $old_content = $wiki->{db}->get (content => $page); |
248 |
|
|
my $prop = $wiki->{db}->get (content_prop => $page); |
249 |
|
|
my $seq = $wiki->{input}->parameter ('pe--seq') || 0; |
250 |
|
|
if ($seq != $prop->get_attribute_value (q#http://suika.fam.cx/~wakaba/archive/2004/7/20/sw-propedit\#seq#, default => 0)) { |
251 |
|
|
$self->{view}->{wiki}->view_in_mode (mode => '-pe--conflict'); |
252 |
|
|
throw SuikaWiki::DB::Util::Error -type => 'ERROR_REPORTED'; |
253 |
|
|
} |
254 |
|
|
my %pprop; |
255 |
|
|
$pprop{my $page_name = $page->stringify (wiki => $wiki)} |
256 |
|
|
= {prop => $prop, page => $page}; |
257 |
|
|
my $this_page_name = $page_name; |
258 |
|
|
MODIFICATION: { |
259 |
|
|
my $old_mt; |
260 |
|
|
my $new_mt; |
261 |
|
|
my %depend; |
262 |
|
|
KEY: for my $key (grep s/^PE--CTRL--//, $wiki->{input}->parameter_names) { |
263 |
|
|
my $propinfo = $wiki->{config}->{q#http://suika.fam.cx/~wakaba/archive/2004/7/20/sw-propedit\#prop#}->{$key}; |
264 |
|
|
next KEY unless $propinfo->{uri}; |
265 |
|
|
my $new_value = [$wiki->{input}->parameter ('PE--CTRL--'.$key)]; |
266 |
|
|
if (@$new_value == 1) { |
267 |
|
|
if ($propinfo->{is_list}) { |
268 |
|
|
$new_value = [split /\x0A|\x0D\x0A?/, $new_value->[0]]; |
269 |
|
|
} |
270 |
|
|
if ($propinfo->{type} eq q#http://suika.fam.cx/~wakaba/-temp/2004/04/24/mt\#media-type#) { |
271 |
|
|
next KEY if $new_value->[0] eq '#asis'; |
272 |
|
|
} |
273 |
|
|
} |
274 |
|
|
my $old_value = $prop->get_attribute_value ($propinfo->{uri}); |
275 |
|
|
if (ref $old_value and @$new_value == @$old_value) { |
276 |
|
|
CHK: { |
277 |
|
|
for my $i (0..$#$new_value) { |
278 |
|
|
last CHK if $old_value->[$i] ne $new_value->[$i]; |
279 |
|
|
} |
280 |
|
|
next KEY; |
281 |
|
|
} |
282 |
|
|
} elsif (not ref $old_value and @$new_value == 1) { |
283 |
|
|
next KEY if $old_value eq $new_value->[0]; |
284 |
|
|
} |
285 |
|
|
if ($propinfo->{uri} eq q#http://suika.fam.cx/~wakaba/-temp/2004/04/24/mt\#media-type#) { |
286 |
|
|
$old_mt = $old_value; |
287 |
|
|
$new_mt = $new_value->[0]; |
288 |
|
|
} |
289 |
|
|
if (@$new_value) { |
290 |
|
|
if ($propinfo->{is_list}) { |
291 |
|
|
$prop->set_attribute ($propinfo->{uri} => $new_value); |
292 |
|
|
} elsif (length $new_value->[0]) { |
293 |
|
|
$prop->set_attribute ($propinfo->{uri} => $new_value->[0]); |
294 |
|
|
} else { |
295 |
|
|
$prop->remove_attribute ($propinfo->{uri}); |
296 |
|
|
} |
297 |
|
|
if ($propinfo->{type} eq q#http://suika.fam.cx/~wakaba/archive/2004/7/20/sw\#WikiName# and |
298 |
|
|
defined $propinfo->{q#http://suika.fam.cx/~wakaba/archive/2004/7/20/sw-propedit\#revWNList#}) { |
299 |
|
|
PV: for my $wn (@$new_value) { |
300 |
|
|
my $wiki_name = $wiki->name ($wn); |
301 |
|
|
unless ($pprop{$wn}->{prop}) { |
302 |
|
|
$pprop{$wn}->{prop} |
303 |
|
|
= $wiki->{db}->get (content_prop => $wiki_name); |
304 |
|
|
$pprop{$wn}->{page} = $wiki_name; |
305 |
|
|
} |
306 |
|
|
my $pv = $pprop{$wn}->{prop}->get_attribute_value |
307 |
|
|
($propinfo->{q#http://suika.fam.cx/~wakaba/archive/2004/7/20/sw-propedit\#revWNList#}, |
308 |
|
|
as_array => 1); |
309 |
|
|
for (@$pv) { |
310 |
|
|
next PV if $_ eq $this_page_name; |
311 |
|
|
} |
312 |
|
|
push @$pv, $this_page_name; |
313 |
|
|
$pprop{$wn}->{prop}->set_attribute |
314 |
|
|
($propinfo->{q#http://suika.fam.cx/~wakaba/archive/2004/7/20/sw-propedit\#revWNList#} => $pv); |
315 |
|
|
$pprop{$wn}->{modified} = 1; |
316 |
|
|
} |
317 |
|
|
} |
318 |
|
|
} else { |
319 |
|
|
$prop->remove_attribute ($propinfo->{uri}); |
320 |
|
|
} |
321 |
|
|
$pprop{$page_name}->{modified} = 1; |
322 |
|
|
$depend{$key} = $propinfo->{depend} if $propinfo->{depend}; |
323 |
|
|
} |
324 |
|
|
DEPEND: for my $sub (keys %depend) { |
325 |
|
|
for my $main (@{$depend{$sub}}) { |
326 |
|
|
unless ($prop->get_attribute ($wiki->{config}->{q#http://suika.fam.cx/~wakaba/archive/2004/7/20/sw-propedit\#prop#} |
327 |
|
|
->{$main}->{uri})) { |
328 |
|
|
$prop->remove_attribute ($wiki->{config}->{q#http://suika.fam.cx/~wakaba/archive/2004/7/20/sw-propedit\#prop#} |
329 |
|
|
->{$sub}->{uri}); |
330 |
|
|
next DEPEND; |
331 |
|
|
} |
332 |
|
|
} |
333 |
|
|
} |
334 |
|
|
last MODIFICATION unless $pprop{$page_name}->{modified}; |
335 |
|
|
for my $wn (keys %pprop) { |
336 |
|
|
next unless $pprop{$wn}->{modified}; |
337 |
|
|
my $prop = $pprop{$wn}->{prop}; |
338 |
|
|
my $seq = $prop->get_attribute_value (q#http://suika.fam.cx/~wakaba/archive/2004/7/20/sw-propedit\#seq#, default => 0); |
339 |
|
|
$prop->set_attribute (q#http://suika.fam.cx/~wakaba/archive/2004/7/20/sw-propedit\#seq# => $seq + 1); |
340 |
|
|
try { |
341 |
|
|
$self->{view}->{wiki}->{db}->set |
342 |
|
|
(content_prop => $pprop{$wn}->{page} => $prop); |
343 |
|
|
} catch SuikaWiki::DB::Util::Error with { |
344 |
|
|
my $err = shift; |
345 |
|
|
if ($err->{-type} eq 'ERROR_REPORTED') { |
346 |
|
|
$err->throw; |
347 |
|
|
} else { |
348 |
|
|
$self->{view}->{wiki}->view_in_mode (mode => '-wdb--fatal-error'); |
349 |
|
|
throw SuikaWiki::DB::Util::Error -type => 'ERROR_REPORTED'; |
350 |
|
|
} |
351 |
|
|
}; |
352 |
|
|
} |
353 |
|
|
if ($new_mt) { |
354 |
|
|
my $format = ($SuikaWiki::Plugin::Registry::Info{q#WikiFormat#}->{module_name} || SuikaWiki::Plugin->module_package (q#WikiFormat#)) |
355 |
|
|
->handler (\$old_content, |
356 |
|
|
serialized_media_type => $old_mt, |
357 |
|
|
content_prop => $prop, |
358 |
|
|
wiki => $wiki); |
359 |
|
|
$format->content_type_changed_from (wiki => $wiki, |
360 |
|
|
page => $page, |
361 |
|
|
old_content => \$old_content, |
362 |
|
|
new_content => \$old_content, |
363 |
|
|
new_serialized_media_type => $new_mt, |
364 |
|
|
content_prop => $prop); |
365 |
|
|
} |
366 |
|
|
my $format = ($SuikaWiki::Plugin::Registry::Info{q#WikiFormat#}->{module_name} || SuikaWiki::Plugin->module_package (q#WikiFormat#)) |
367 |
|
|
->handler (\$old_content, |
368 |
|
|
serialized_media_type => $new_mt, |
369 |
|
|
content_prop => $prop, |
370 |
|
|
wiki => $wiki); |
371 |
|
|
$format->content_prop_modified (wiki => $wiki, |
372 |
|
|
page => $page, |
373 |
|
|
content_prop => $prop); |
374 |
|
|
} # MODIFICATION |
375 |
|
|
my $new_mode = $self->{view}->{wiki}->{input}->parameter |
376 |
|
|
('we--mode-modified'); |
377 |
|
|
$new_mode =~ s/[^0-9A-Za-z._-]+//g; |
378 |
|
|
my $uri = $self->{view}->{wiki}->uri_reference |
379 |
|
|
(page => $page, |
380 |
|
|
mode => $new_mode, |
381 |
|
|
up_to_date => 1, |
382 |
|
|
param => {we__mode_modified => $new_mode}); |
383 |
|
|
require SuikaWiki::Output::HTTP; |
384 |
|
|
my $output = SuikaWiki::Output::HTTP->new |
385 |
|
|
(wiki => $self->{view}->{wiki}); |
386 |
|
|
$output->set_redirect (uri => $uri, status_code => 303); |
387 |
|
|
$output->output (output => 'http-cgi');} |
388 |
|
|
|
389 |
|
|
#line 1 "(WikiPlugin module PropEdit, chunk 3)" |
390 |
|
|
|
391 |
|
|
package SuikaWiki::Plugin::plugin::PropEdit1050215083940axZ0; |
392 |
|
|
|
393 |
|
|
$SuikaWiki::Plugin::Rule{form_input}->{pe__texts} = {q#Parameter#, {}, q#Description#, [[q#Multiple texts input#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; |
394 |
|
|
|
395 |
|
|
#line 1 "(WikiPlugin module source propedit.wp2, block FormattingRule[name()='[q#form-input#]/pe__texts']/Formatting)" |
396 |
|
|
$p->{q#id#} = do { my $r = $f->parse_attr ($p=>q#id#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r};$f->parse_attr ($p=>q#label#, $o, -non_parsed_to_node => 1, %opt); |
397 |
|
|
my $id = ($SuikaWiki::Plugin::Registry::Info{q#WikiFormCore#}->{module_name} || SuikaWiki::Plugin->module_package (q#WikiFormCore#)) |
398 |
|
|
->control_id ($o, |
399 |
|
|
local_id => $p->{id}, |
400 |
|
|
require_local_id => 1); |
401 |
|
|
my $has_label = 0; |
402 |
|
|
if ($p->{label}->count) { |
403 |
|
|
$has_label = 1; |
404 |
|
|
for ($p->{-parent}->append_new_node |
405 |
|
|
(type => '#element', |
406 |
|
|
namespace_uri => q#http://www.w3.org/1999/xhtml#, |
407 |
|
|
local_name => 'label')) { |
408 |
|
|
$_->set_attribute (for => $id->{global_id}); |
409 |
|
|
$_->append_node ($p->{label}); |
410 |
|
|
} |
411 |
|
|
$p->{-parent}->append_new_node |
412 |
|
|
(type => '#element', |
413 |
|
|
namespace_uri => q#http://www.w3.org/1999/xhtml#, |
414 |
|
|
local_name => 'br') |
415 |
|
|
->option (use_EmptyElemTag => 1); |
416 |
|
|
} |
417 |
|
|
for ($p->{-parent}->append_new_node (type => '#element', |
418 |
|
|
namespace_uri => q#http://www.w3.org/1999/xhtml#, |
419 |
|
|
local_name => 'textarea')) { |
420 |
|
|
$_->set_attribute (name => $id->{local_id}); |
421 |
|
|
$_->set_attribute (id => $id->{global_id}) if $has_label; |
422 |
|
|
$p->{q#size#} = do { my $r = $f->parse_attr ($p=>q#size#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r};$p->{q#lines#} = do { my $r = $f->parse_attr ($p=>q#lines#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r};$p->{q#description#} = do { my $r = $f->parse_attr ($p=>q#description#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; |
423 |
|
|
$_->set_attribute (cols => ($p->{size}||20)*2); ## Length |
424 |
|
|
$_->set_attribute (title => $p->{description}) if $p->{description}; |
425 |
|
|
$_->set_attribute (disabled => 'disabled') if $o->{form}->{disabled}; |
426 |
|
|
$p->{q#class#} = do { my $r = $f->parse_attr ($p=>q#class#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; |
427 |
|
|
my @class = split /\s+/, $p->{class}; |
428 |
|
|
push @class, 'require' if $o->{form}->{require}->{id}->{$p->{id}}; |
429 |
|
|
$p->{q#source#} = do { my $r = $f->parse_attr ($p=>q#source#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; |
430 |
|
|
my $items = 5; |
431 |
|
|
if ($p->{source}) { |
432 |
|
|
if (ref $o->{var}->{source}->{$p->{source}}) { |
433 |
|
|
my $d = $o->{var}->{source}->{$p->{source}} |
434 |
|
|
->(p=>$p, o=>$o, type => q#http://suika.fam.cx/~wakaba/archive/2004/7/20/sw-propedit\#texts#); |
435 |
|
|
$_->append_text (ref $d->{value} eq 'ARRAY' ? |
436 |
|
|
join "\n", @{$d->{value}} : $d->{value}); |
437 |
|
|
push @class, @{$d->{class}||[]}; |
438 |
|
|
$items = @{$d->{value}} + 1 if ref $d->{value} eq 'ARRAY'; |
439 |
|
|
} else { |
440 |
|
|
$_->append_text (ref $o->{var}->{$p->{source}} eq 'ARRAY' ? |
441 |
|
|
join "\n", @{$o->{var}->{$p->{source}}} : |
442 |
|
|
$o->{var}->{$p->{source}}); |
443 |
|
|
$items = @{$o->{var}->{$p->{source}}} + 1 |
444 |
|
|
if ref $o->{var}->{$p->{source}} eq 'ARRAY'; |
445 |
|
|
} |
446 |
|
|
} else { |
447 |
|
|
$p->{q#default#} = do { my $r = $f->parse_attr ($p=>q#default#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; |
448 |
|
|
$_->append_text ($p->{default}); ## Default value |
449 |
|
|
} |
450 |
|
|
$_->set_attribute (rows => ($p->{lines} || $items)); ## Lines |
451 |
|
|
$_->set_attribute (class => join ' ', @class) if @class; |
452 |
|
|
}}} |
453 |
|
|
#line 1 "(WikiPlugin module PropEdit, chunk 4)" |
454 |
|
|
; |
455 |
|
|
|
456 |
|
|
package SuikaWiki::Plugin::Resource; |
457 |
|
|
|
458 |
|
|
our $BaseResource; |
459 |
|
|
$BaseResource->{q#en#}->{q##}->{q#Edit:SaveAnd:pe--propedit:Description#} = q#Save modified property values and show this property-editing mode again.#; |
460 |
|
|
$BaseResource->{q#en#}->{q##}->{q#Edit:SaveAnd:pe--propedit:Label#} = q#Editing Properties#; |
461 |
|
|
$BaseResource->{q#en#}->{q##}->{q#PropEdit:Conflict:Description#} = q#Properties for WikiPage %link-to-wikipage (label => {%link-to-it ( label => {%page-name;}p);}); has been modified during you are editing them. Please ensure that third-party's modification does not affect your submitting changes. #; |
462 |
|
|
$BaseResource->{q#en#}->{q##}->{q#PropEdit:Conflict:Title#} = q#Confliction - Editing Content Properties#; |
463 |
|
|
$BaseResource->{q#en#}->{q##}->{q#PropEdit:Conflict:WebPageTitle#} = q#CONFLICTION - %page-name; (Editing Content Properties)#; |
464 |
|
|
$BaseResource->{q#en#}->{q##}->{q#PropEdit:Link:Description#} = q#Edit properties of this WikiPage#; |
465 |
|
|
$BaseResource->{q#und#}->{q##}->{q#PropEdit:Template#} = q##; |
466 |
|
|
$BaseResource->{q#en#}->{q##}->{q#PropEdit:Title#} = q#Editing Content Properties#; |
467 |
|
|
$BaseResource->{q#en#}->{q##}->{q#PropEdit:WebPageTitle#} = q#%page-name; (Editing Content Properties)#; |
468 |
|
|
package SuikaWiki::Plugin::Registry; |
469 |
|
|
|
470 |
|
|
$Info{q#PropEdit#}->{provide} = {q#rule#, {q#form_input#, [q#pe__texts#], q#view#, [q#pe__propedit#]}, q#viewfragment#, [{q#Name#, q#links#}], q#viewdef#, [{q#Description#, [q#Editing WikiPage Properties#, q#en#, q##], q#Name#, q#pe__propedit#}, {q#Description#, [q#Editing WikiPage Properties -- Report Confliction#, q#en#, q##], q#Name#, q#-pe__conflict#}, {q#Description#, [q#Saving modified (new) WikiPage properties#, q#en#, q##], q#Name#, q#pe__write#}]}; |
471 |
|
|
|
472 |
|
|
1; |