1 |
wakaba |
1.1 |
Name: |
2 |
|
|
WikiEdit |
3 |
|
|
FullName: |
4 |
|
|
SuikaWiki: WikiPage editing core |
5 |
|
|
URI: |
6 |
|
|
IW:SuikaWiki:SuikaWiki |
7 |
|
|
Description: |
8 |
|
|
This module provides editing modes of WikiPage. Without this module, |
9 |
|
|
the Wiki is to be uneditable. |
10 |
|
|
Initialize: |
11 |
|
|
my $NS_XHTML1 = 'http://www.w3.org/1999/xhtml'; |
12 |
|
|
my $HAS_XML = SuikaWiki::Plugin->feature ('SuikaWiki::Markup::XML'); |
13 |
|
|
|
14 |
|
|
{ |
15 |
|
|
Name: |
16 |
|
|
wikiview/edit-form |
17 |
|
|
FullName: |
18 |
|
|
Edit-form of WikiPage |
19 |
|
|
Format: |
20 |
|
|
if (not &main::is_editable ($o->{page})) { |
21 |
|
|
$r = '<p>'.$o->resource('Error:ThisPageIsUneditable',escape=>1).'</p>'; |
22 |
|
|
} elsif (!$p->{admin} && &main::is_frozen ($o->{page})) { |
23 |
|
|
$r = '<p>'.$o->resource('Error:ThisPageIsUneditable',escape=>1).'</p>'; |
24 |
|
|
} else { |
25 |
|
|
$r = '<p>'.$o->resource('Error:PasswordIsNotSpecified',escape=>1).'</p>' if $p->{admin}; |
26 |
|
|
$r .= &main::editform (page => $o->{page}, admin => $p->{admin}); |
27 |
|
|
} |
28 |
|
|
} |
29 |
|
|
|
30 |
|
|
{ |
31 |
|
|
Name: |
32 |
|
|
wikiview/conflict-form |
33 |
|
|
FullName: |
34 |
|
|
Edit-form of WikiPage (conflict) |
35 |
|
|
Format: |
36 |
|
|
$r = &main::editform (page => $o->{page}, content => $o->{param}->{mymsg}, last_modified => $o->{param}->{myLastModified}, frozen=>0, conflict=>1); |
37 |
|
|
} |
38 |
|
|
{ |
39 |
|
|
Name: |
40 |
|
|
wikiview/conflict-diff |
41 |
|
|
FullName: |
42 |
|
|
Edit-form of WikiPage (conflict) |
43 |
|
|
Format: |
44 |
|
|
require Algorithm::Diff; |
45 |
|
|
for (Algorithm::Diff::diff([split /\x0D?\x0A/, $o->{param}->{mymsg}],[split /\x0D?\x0A/, $main::database{$o->{page}}])){ |
46 |
|
|
for (@{$_}) { |
47 |
|
|
my ($sign, $lineno, $text) = @{$_}; |
48 |
|
|
my $ename = $sign eq '+' ? 'ins' : $sign eq '-' ? 'del' : 'span'; |
49 |
|
|
$r .= qq(<$ename class="line"><span class="lineno">@{[$o->escape($lineno)]}</span> <span class="sign">@{[$o->escape($sign)]}</span> <span class="content">@{[$o->escape($text)]}</span></$ename>\n); |
50 |
|
|
} |
51 |
|
|
$r .= "\n"; |
52 |
|
|
} |
53 |
|
|
$r =~ s/\n+$/\n/; |
54 |
|
|
$r = qq(<pre class="diff">$r</pre>); |
55 |
|
|
} |
56 |
|
|
|
57 |
|
|
|
58 |
|
|
MODULE: |
59 |
|
|
SuikaWiki::View->template ('links')->add_line (q(%link-wiki(mode=>edit,rel=>edit,class=>wiki-cmd,title=>{%res(name=>EditThisPageLink);}p,up-to-date); |
60 |
|
|
%link-wiki(mode=>adminedit,rel=>edit,class=>wiki-cmd,title=>{%res(name=>AdminEditThisPageLink);}p,up-to-date);)); |
61 |
|
|
SuikaWiki::View->definition (edit => { |
62 |
|
|
media => {type => 'text/html', charset => 1, expires => 60}, |
63 |
|
|
#xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60}, |
64 |
|
|
template => <<'EOH'}); |
65 |
|
|
%html-document(title=>{%res(name=>{Edit:WebPageTitle});}p,link-meta=>{%predefined-template(name=>links);%html-meta(name=>ROBOTS,content=>NOINDEX);}p,content=>{ |
66 |
|
|
%section(level=>1,add-to-toc=>0,type=>body,title=>{%page-name;}p,heading,content=>{ |
67 |
|
|
%section(id=>tools1,class=>tools,add-to-toc=>0,content=>{%predefined-template(name=>navbar);}p); |
68 |
|
|
%section(level=>2,id=>edit,title=>{%res(name=>{Edit:Title});}p,heading,content=>{ |
69 |
|
|
%edit-form; |
70 |
|
|
%section(level=>3,id=>edit-help,add-to-toc=>0,content=>{%read(page=>{Wiki//Help//Edit});}p); |
71 |
|
|
}p); |
72 |
|
|
%section(level=>2,id=>children,title=>{%res(name=>{Children:Title});}p,heading, |
73 |
|
|
content=>{%page-list(ns=>{%page-name;}p,recursive=>0,type=>both,template=>{ |
74 |
|
|
%wiki-link(label=>{%ns-short-page-or-ns-name;}p); |
75 |
|
|
});}p); |
76 |
|
|
%section(level=>2,id=>see-also,title=>{%res(name=>SeeAlso);}p,heading,content=>{%search-result;}p); |
77 |
|
|
%section(level=>2,id=>referer,title=>{%res(name=>Referer);}p,heading,content=>{%referer-list;}p); |
78 |
|
|
%section(id=>last-modified,add_to_toc=>0,content=>{%res(name=>{LastModified=});%last-modified;}p); |
79 |
|
|
%section(level=>2,id=>toc,title=>{%res(name=>{TOC:Title};}p,heading,add_to_toc=>0,content=>{%toc(drag);}p); |
80 |
|
|
%section(class=>tools,add_to_toc=>0,content=>{%predefined-template(name=>navbar);}p); |
81 |
|
|
%section(id=>footer,add-to-toc=>0,content=>{%predefined-template(name=>footer);}p); |
82 |
|
|
}p); |
83 |
|
|
}p); |
84 |
|
|
EOH |
85 |
|
|
SuikaWiki::View->definition (adminedit => { |
86 |
|
|
media => {type => 'text/html', charset => 1, expires => 60}, |
87 |
|
|
xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60}, |
88 |
|
|
template => <<'EOH'}); |
89 |
|
|
%html-document(title=>{%res(name=>{Edit:Admin:WebPageTitle});}p,link-meta=>{%predefined-template(name=>links);%html-meta(name=>ROBOTS,content=>NOINDEX);}p,content=>{ |
90 |
|
|
%section(level=>1,add-to-toc=>0,type=>body,title=>{%page-name;}p,heading,content=>{ |
91 |
|
|
%section(id=>tools1,class=>tools,add-to-toc=>0,content=>{%predefined-template(name=>navbar);}p); |
92 |
|
|
%section(level=>2,id=>edit,title=>{%res(name=>{Edit:Title});}p,heading,content=>{%edit-form(admin);}p); |
93 |
|
|
%section(level=>2,title=>{%res(name=>{Edit:Rename:Title});}p,heading,content=>{ |
94 |
|
|
%wp-rename-form(content=>{ |
95 |
|
|
%format(context=>form_input,template=>{ |
96 |
|
|
%text(id=>to,label=>{%res(name=>{Edit:Rename:To=});}p,size=>10,default=>{%page-name;}p); |
97 |
|
|
%submit; |
98 |
|
|
}); |
99 |
|
|
}p); |
100 |
|
|
}p); |
101 |
|
|
%section(id=>last-modified,add_to_toc=>0,content=>{%res(name=>{LastModified=});%last-modified;}p); |
102 |
|
|
%section(level=>2,id=>toc,title=>{%res(name=>{TOC:Title});}p,heading,add_to_toc=>0,content=>{%toc(drag);}p); |
103 |
|
|
%section(class=>tools,add_to_toc=>0,content=>{%predefined-template(name=>navbar);}p); |
104 |
|
|
%section(id=>footer,add-to-toc=>0,content=>{%predefined-template(name=>footer);}p); |
105 |
|
|
}p); |
106 |
|
|
}p); |
107 |
|
|
EOH |
108 |
|
|
SuikaWiki::View->definition (-conflict => { |
109 |
|
|
media => {type => 'text/html', charset => 1, expires => 60}, |
110 |
|
|
#xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60}, |
111 |
|
|
template => <<'EOH'}); |
112 |
|
|
%html-document(title=>{%res(name=>{Edit:Conflict:WebPageTitle});}p,link-meta=>{%predefined-template(name=>links);%html-meta(name=>ROBOTS,content=>NOINDEX);}p,content=>{ |
113 |
|
|
%section(level=>1,add-to-toc=>0,type=>body,title=>{%page-name;}p,heading,content=>{ |
114 |
|
|
%section(id=>tools1,class=>tools,add-to-toc=>0,content=>{%predefined-template(name=>navbar);}p); |
115 |
|
|
%section(level=>2,title=>{%res(name=>{Edit:Conflict:Title});}p,heading,content=>{ |
116 |
|
|
%paragraph(content=>{%res(name=>{Edit:Conflict:Description});}p); |
117 |
|
|
%conflict-form; |
118 |
|
|
%section(level=>3,id=>edit-conflict-diff,title=>{%res(name=>{Edit:Conflict:Diff:Title});}p,heading,content=>{ |
119 |
|
|
%paragraph(content=>{%res(name=>{Edit:Conflict:Diff:Description});}p); |
120 |
|
|
%conflict-diff; |
121 |
|
|
}p); |
122 |
|
|
}p); |
123 |
|
|
%section(level=>2,id=>edit,title=>{%res(name=>{Edit:Title});}p,heading,content=>{ |
124 |
|
|
%paragraph(name=>{%res(name=>{Edit:Conflict:Edit:Description});}p); |
125 |
|
|
%edit-form; |
126 |
|
|
%section(level=>3,id=>edit-help,add-to-toc=>0,content=>{%read(page=>{Wiki//Help//Edit});}p); |
127 |
|
|
}p); |
128 |
|
|
%section(level=>2,id=>toc,title=>{%res(name=>{TOC:Title});}p,heading,add_to_toc=>0,content=>{%toc(drag);}p); |
129 |
|
|
%section(class=>tools,add_to_toc=>0,content=>{%predefined-template(name=>navbar);}p); |
130 |
|
|
%section(id=>footer,add-to-toc=>0,content=>{%predefined-template(name=>footer);}p); |
131 |
|
|
}p); |
132 |
|
|
}p); |
133 |
|
|
EOH |
134 |
|
|
SuikaWiki::View->definition (-wrote => { |
135 |
|
|
media => {type => 'text/html', charset => 1, expires => 60}, |
136 |
|
|
xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60}, |
137 |
|
|
template => <<'EOH'}); |
138 |
|
|
%html-document(title=>{%res(name=>{Edit:Wrote:WebPageTitle});}p,link-meta=>{%predefined-template(name=>links);%html-meta(name=>ROBOTS,content=>NOINDEX);}p,content=>{ |
139 |
|
|
%section(level=>1,add-to-toc=>0,type=>body,title=>{%page-name;}p,heading,content=>{ |
140 |
|
|
%section(id=>tools1,class=>tools,add-to-toc=>0,content=>{%predefined-template(name=>navbar);}p); |
141 |
|
|
%section(level=>2,add-to-toc=>0,content=>{ |
142 |
|
|
%paragraph(content=>{%res(name=>{Edit:SavedSuccessfully});}p); |
143 |
|
|
}p); |
144 |
|
|
%section(id=>footer,add-to-toc=>0,content=>{%predefined-template(name=>footer);}p); |
145 |
|
|
}p); |
146 |
|
|
}p); |
147 |
|
|
EOH |
148 |
|
|
SuikaWiki::View->definition (-deleted => { |
149 |
|
|
media => {type => 'text/html', charset => 1, expires => 60}, |
150 |
|
|
xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60}, |
151 |
|
|
template => <<'EOH'}); |
152 |
|
|
%html-document(title=>{%res(name=>{Edit:Deleted:WebPageTitle});}p,link-meta=>{%predefined-template(name=>links);%html-meta(name=>ROBOTS,content=>NOINDEX);}p,content=>{ |
153 |
|
|
%section(level=>1,add-to-toc=>0,type=>body,title=>{%page-name;}p,heading,content=>{ |
154 |
|
|
%section(id=>tools1,class=>tools,add-to-toc=>0,content=>{%predefined-template(name=>navbar);}p); |
155 |
|
|
%section(level=>2,add-to-toc=>0,content=>{ |
156 |
|
|
%paragraph(content=>{%res(name=>{Edit:PageIsDeletedSuccessfully});}p); |
157 |
|
|
}p); |
158 |
|
|
%section(id=>footer,add-to-toc=>0,content=>{%predefined-template(name=>footer);}p); |
159 |
|
|
}p); |
160 |
|
|
}p); |
161 |
|
|
EOH |
162 |
|
|
|
163 |
|
|
POD:LICENSE: |
164 |
|
|
Copyright 2003 Wakaba <w@suika.fam.cx> |
165 |
|
|
|
166 |
|
|
%%GNUGPL2%% |