gf-Soks 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE.txt +66 -0
- data/README.txt +64 -0
- data/bin/soks-create-wiki.rb +193 -0
- data/contrib/diff/lcs.rb +1105 -0
- data/contrib/diff/lcs/array.rb +21 -0
- data/contrib/diff/lcs/block.rb +51 -0
- data/contrib/diff/lcs/callbacks.rb +322 -0
- data/contrib/diff/lcs/change.rb +169 -0
- data/contrib/diff/lcs/hunk.rb +257 -0
- data/contrib/diff/lcs/ldiff.rb +226 -0
- data/contrib/diff/lcs/string.rb +19 -0
- data/contrib/diff_licence.txt +76 -0
- data/contrib/easyprompt.rb +58 -0
- data/contrib/easyprompt_licence.txt +504 -0
- data/contrib/redcloth-3.0.3.rb +1113 -0
- data/contrib/redcloth_license.txt +27 -0
- data/lib/authenticators.rb +121 -0
- data/lib/helpers/counter-helpers.rb +132 -0
- data/lib/helpers/default-helpers.rb +416 -0
- data/lib/helpers/mail2wiki-helper.rb +105 -0
- data/lib/helpers/maintenance-helpers.rb +149 -0
- data/lib/helpers/rss2wiki-helper.rb +47 -0
- data/lib/helpers/wiki2html.rb +60 -0
- data/lib/soks-model.rb +271 -0
- data/lib/soks-servlet.rb +177 -0
- data/lib/soks-storage.rb +187 -0
- data/lib/soks-upgrade-0.0.2.rb +70 -0
- data/lib/soks-utils.rb +327 -0
- data/lib/soks-view.rb +399 -0
- data/lib/soks.rb +27 -0
- data/rakefile +109 -0
- data/templates/default/attachment/favicon.ico +0 -0
- data/templates/default/attachment/logo.jpg +0 -0
- data/templates/default/attachment/logo.png +0 -0
- data/templates/default/attachment/logo.tiff +0 -0
- data/templates/default/attachment/newpage.js +41 -0
- data/templates/default/attachment/print_stylesheet.css +2 -0
- data/templates/default/attachment/robots.txt +6 -0
- data/templates/default/attachment/rss.png +0 -0
- data/templates/default/attachment/stylesheet.css +219 -0
- data/templates/default/banned_titles.txt +67 -0
- data/templates/default/caches/readme.txt +1 -0
- data/templates/default/content/Api%20for%20classes%20to%20modify%20the%20wiki.textile +30 -0
- data/templates/default/content/Author.textile +16 -0
- data/templates/default/content/Automatic%20Summaries.textile +40 -0
- data/templates/default/content/Automatic%20counters.textile +22 -0
- data/templates/default/content/Automatic%20exporters.textile +23 -0
- data/templates/default/content/Automatic%20importers.textile +59 -0
- data/templates/default/content/Automatic%20linking.textile +7 -0
- data/templates/default/content/Automatic%20maintenance%20helpers.textile +39 -0
- data/templates/default/content/Bug%3A%20Competing%20edits.textile +22 -0
- data/templates/default/content/Bug%3A%20Does%20not%20make%20use%20of%20if%2Dmodified%2Dsince%20r.textile +3 -0
- data/templates/default/content/Bug%3A%20Email%20adresses%20in%20page%20titles%20cause%20incorrec.textile +3 -0
- data/templates/default/content/Bug%3A%20GEM%20limits%20title%20lengths.textile +3 -0
- data/templates/default/content/Bug%3A%20Memory%20leak.textile +13 -0
- data/templates/default/content/Bug%3A%20Page%2Einserted%5Finto%20is%20never%20purged.textile +17 -0
- data/templates/default/content/Bug%3A%20Pages%20that%20link%20here%20may%20not%20appear%20on%20r.textile +13 -0
- data/templates/default/content/Bug%3A%20Textile%20mishandles%20paragraphs.textile +37 -0
- data/templates/default/content/Bug%3A%20Unanticipated%20Rollbacks.textile +23 -0
- data/templates/default/content/Bug%3A%20notextile%20does%20not%20prevent%20page%20inserts.textile +3 -0
- data/templates/default/content/Home%20Page.textile +22 -0
- data/templates/default/content/How%20to%20administrate%20this%20wiki.textile +57 -0
- data/templates/default/content/How%20to%20change%20the%20way%20this%20wiki%20looks.textile +32 -0
- data/templates/default/content/How%20to%20export%20a%20site%20from%20this%20wiki.textile +82 -0
- data/templates/default/content/How%20to%20get%20the%20latest%20Soks%20from%20cvs.textile +45 -0
- data/templates/default/content/How%20to%20hack%20soks.textile +66 -0
- data/templates/default/content/How%20to%20import%20a%20site%20from%20instiki.textile +15 -0
- data/templates/default/content/How%20to%20import%20data.textile +41 -0
- data/templates/default/content/How%20to%20install%20Soks.textile +33 -0
- data/templates/default/content/How%20to%20password%20protect%20your%20wiki.textile +53 -0
- data/templates/default/content/How%20to%20re%2Dbuild%20the%20page%20cache.textile +71 -0
- data/templates/default/content/How%20to%20report%20a%20bug.textile +9 -0
- data/templates/default/content/How%20to%20upgrade%20soks.textile +32 -0
- data/templates/default/content/How%20to%20use%20the%20Automatic%20Helper%20classes.textile +12 -0
- data/templates/default/content/How%20to%20use%20this%20wiki.textile +30 -0
- data/templates/default/content/List%20of%20changes.textile +10 -0
- data/templates/default/content/News%3A%20Version%201%2D0%2D0%20released.textile +19 -0
- data/templates/default/content/News%3A%20Version%201%2D0%2D1%20released.textile +12 -0
- data/templates/default/content/Pages%20to%20include%20in%20the%20distribution.textile +55 -0
- data/templates/default/content/Per%20Wiki%20Templates.textile +37 -0
- data/templates/default/content/Picture%20of%20a%20pair%20of%20soks.textile +1 -0
- data/templates/default/content/Planned%20Features.textile +74 -0
- data/templates/default/content/README.textile +64 -0
- data/templates/default/content/RSS%20feed.textile +9 -0
- data/templates/default/content/Recent%20changes%20to%20this%20site.textile +352 -0
- data/templates/default/content/SOKS%20features.textile +19 -0
- data/templates/default/content/Sidebar%20Page.textile +6 -0
- data/templates/default/content/Site%20Index.textile +241 -0
- data/templates/default/content/Soks%27s%20Licence.textile +66 -0
- data/templates/default/content/Tag%3A%20Include%20this%20page%20in%20the%20distribution.textile +6 -0
- data/templates/default/start.rb +90 -0
- data/templates/default/version.txt +1 -0
- data/templates/default/views/Page_content.rhtml +1 -0
- data/templates/default/views/Page_edit.rhtml +79 -0
- data/templates/default/views/Page_find.rhtml +35 -0
- data/templates/default/views/Page_linksfromrss.rhtml +24 -0
- data/templates/default/views/Page_listrss.rhtml +46 -0
- data/templates/default/views/Page_meta.rhtml +44 -0
- data/templates/default/views/Page_print.rhtml +6 -0
- data/templates/default/views/Page_revision.rhtml +39 -0
- data/templates/default/views/Page_revisions.rhtml +36 -0
- data/templates/default/views/Page_rss.rhtml +57 -0
- data/templates/default/views/Page_view.rhtml +8 -0
- data/templates/default/views/UploadPage_edit.rhtml +63 -0
- data/templates/default/views/frame.rhtml +63 -0
- data/templates/default/views/messages.yaml +7 -0
- data/test/html/2006Mar.html +66 -0
- data/test/html/poignant.html +36 -0
- data/test/html/poignant.textile +36 -0
- data/test/mock-objects.rb +69 -0
- data/test/test_counter-helper.rb +162 -0
- data/test/test_soks-helper-maintenance.rb +106 -0
- data/test/test_soks-helpers.rb +145 -0
- data/test/test_soks-model.rb +144 -0
- data/test/test_soks-servlet.rb +240 -0
- data/test/test_soks-storage.rb +108 -0
- data/test/test_soks-utils.rb +226 -0
- data/test/test_soks-view.rb +193 -0
- data/test/test_soks.rb +9 -0
- metadata +182 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function trim(str)
|
|
2
|
+
{
|
|
3
|
+
return str.replace(/^\s+/,'').replace(/\s+$/,'');
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
function editSelected(web_root)
|
|
7
|
+
{
|
|
8
|
+
if (window.getSelection)
|
|
9
|
+
{
|
|
10
|
+
txt = window.getSelection();
|
|
11
|
+
}
|
|
12
|
+
else if (document.getSelection)
|
|
13
|
+
{
|
|
14
|
+
txt = document.getSelection();
|
|
15
|
+
}
|
|
16
|
+
else if (document.selection)
|
|
17
|
+
{
|
|
18
|
+
txt = document.selection.createRange().text;
|
|
19
|
+
}
|
|
20
|
+
if(!txt){
|
|
21
|
+
void(txt=prompt('Please enter the title of the page you wish to create',''))
|
|
22
|
+
}
|
|
23
|
+
if(txt){
|
|
24
|
+
window.location = web_root+escape(txt)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function hotkey( event, web_root )
|
|
29
|
+
{
|
|
30
|
+
event = (event) ? event : ((window.event) ? event : null);
|
|
31
|
+
if (event)
|
|
32
|
+
{
|
|
33
|
+
if (event.ctrlKey )
|
|
34
|
+
{
|
|
35
|
+
var charCode = (event.charCode) ? event.charCode : ((event.which) ? event.which : event.keyCode);
|
|
36
|
+
if (charCode == 14 ) {
|
|
37
|
+
editSelected(web_root);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
body { margin:0px;
|
|
2
|
+
padding:0px;
|
|
3
|
+
font-size:small;
|
|
4
|
+
color:#333;
|
|
5
|
+
font-family: arial, sans-serif;
|
|
6
|
+
background-color:white;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
h1, h1 a, h1 a:visited { color:#008000; }
|
|
10
|
+
h2, h2 a, h2 a:visited { color:#008000; }
|
|
11
|
+
|
|
12
|
+
a {
|
|
13
|
+
color:#888;
|
|
14
|
+
text-decoration:none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
pre {
|
|
18
|
+
overflow: auto;
|
|
19
|
+
padding: 10px;
|
|
20
|
+
background: #eee;
|
|
21
|
+
border: 1px solid #ccc;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
a:visited {color:#888;}
|
|
25
|
+
|
|
26
|
+
a:hover {
|
|
27
|
+
text-decoration:underline;
|
|
28
|
+
color: #000;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
a.missing {
|
|
32
|
+
color:#E00000;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
img {
|
|
37
|
+
border-style: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
#content {
|
|
41
|
+
margin:0px 210px 50px 10px;
|
|
42
|
+
padding:10px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Based, with permission, on bluerobot.com */
|
|
46
|
+
#menu {
|
|
47
|
+
position:absolute;
|
|
48
|
+
top:40px;
|
|
49
|
+
right:10px;
|
|
50
|
+
width:162px;
|
|
51
|
+
text-align: center;
|
|
52
|
+
background-color:#E00000;
|
|
53
|
+
border:1px solid #000000;
|
|
54
|
+
/* Again, the ugly brilliant hack. */ voice-family: "\"}\""; voice-family:inherit; width:152px; }/* Again, "be nice to Opera 5". */body>#menu {width:152px;}
|
|
55
|
+
|
|
56
|
+
#menu input.search {
|
|
57
|
+
width:149px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
#menu h1 {
|
|
61
|
+
font-size: smaller;
|
|
62
|
+
background-color: #900000;
|
|
63
|
+
color: white;
|
|
64
|
+
padding: 5px;
|
|
65
|
+
margin: 0px;
|
|
66
|
+
font-weight: bold;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
#menu h2 {
|
|
70
|
+
font-size: smaller;
|
|
71
|
+
background-color: #900000;
|
|
72
|
+
color: white;
|
|
73
|
+
padding: 5px;
|
|
74
|
+
margin: 12px 0px 0px 0px;
|
|
75
|
+
font-weight: bold;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#menu h2 a, #menu h2 a:visited {
|
|
79
|
+
color: white;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.linklist {
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.linklist a, .linklist a:visited {
|
|
86
|
+
margin: 0px;
|
|
87
|
+
padding: 3px 5px;
|
|
88
|
+
color: black;
|
|
89
|
+
display: block;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.linklist a:hover {
|
|
93
|
+
background-color:#F4E600;
|
|
94
|
+
text-decoration: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.pagename {
|
|
98
|
+
font-size: xx-small;
|
|
99
|
+
display: block;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.command {
|
|
103
|
+
border-top: 1px solid #333;
|
|
104
|
+
padding-top: 5px;
|
|
105
|
+
margin-top: 20px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.subpage {
|
|
109
|
+
padding: 10px;
|
|
110
|
+
margin: 10px;
|
|
111
|
+
border: solid 1px #AAAAAA;
|
|
112
|
+
font-size:x-small;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
p.more {
|
|
116
|
+
font-size: xx-small;
|
|
117
|
+
text-align: right;
|
|
118
|
+
padding: 0px;
|
|
119
|
+
font-color: #grey;
|
|
120
|
+
color: gray;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.subpage h1 {
|
|
124
|
+
color:#008000;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.calendar td {
|
|
128
|
+
border: solid 1px #AAAAAA;
|
|
129
|
+
text-align: center;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.upcomingevents {
|
|
133
|
+
padding: 0px 10px 0px 10px;
|
|
134
|
+
margin: 0px;
|
|
135
|
+
border: solid 1px #AAAAAA;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
a.pageview {
|
|
139
|
+
display: inline;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
pre.change {
|
|
143
|
+
margin: 0px;
|
|
144
|
+
padding: 0px;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.change {
|
|
148
|
+
margin-top: 20px;
|
|
149
|
+
border-top: solid 1px #AAAAAA;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
#fileedittitle input {
|
|
153
|
+
width: 85%;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
#edittitle input {
|
|
157
|
+
width: 95%;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
#editcontent textarea {
|
|
161
|
+
width: 100%;
|
|
162
|
+
height: 75%;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
.help {
|
|
167
|
+
color: red;
|
|
168
|
+
text-align: center;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
#tips h1 {
|
|
172
|
+
padding-left: 5px;
|
|
173
|
+
margin-top: 0px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
#tips li, #tips ul {
|
|
177
|
+
list-style-type: none;
|
|
178
|
+
padding-left: 5px;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.metacolumn {
|
|
182
|
+
display: inline;
|
|
183
|
+
font-size: smaller;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
form.editpage {
|
|
187
|
+
display: inline;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
fieldset {
|
|
191
|
+
border: none;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
div.undochange {
|
|
195
|
+
border-top: solid 1px #AAAAAA;
|
|
196
|
+
margin-top: 10px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.undochange li {
|
|
200
|
+
list-style-type: none;
|
|
201
|
+
padding-left: 0px;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.undochange input {
|
|
205
|
+
margin-left: 40px;
|
|
206
|
+
margin-top: 0px;
|
|
207
|
+
margin-bottom: 10px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.undochange p {
|
|
211
|
+
font-weight: bold;
|
|
212
|
+
margin-top: 5px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
.recentchanges li, .recentchanges ul {
|
|
217
|
+
list-style-type: none;
|
|
218
|
+
padding-left: 5px;
|
|
219
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Each line contains a title that will NOT be automatically linked in the wiki (can still be manually linked)
|
|
2
|
+
the
|
|
3
|
+
of
|
|
4
|
+
and
|
|
5
|
+
a
|
|
6
|
+
b
|
|
7
|
+
c
|
|
8
|
+
d
|
|
9
|
+
e
|
|
10
|
+
f
|
|
11
|
+
g
|
|
12
|
+
h
|
|
13
|
+
i
|
|
14
|
+
j
|
|
15
|
+
k
|
|
16
|
+
l
|
|
17
|
+
m
|
|
18
|
+
n
|
|
19
|
+
o
|
|
20
|
+
p
|
|
21
|
+
q
|
|
22
|
+
r
|
|
23
|
+
s
|
|
24
|
+
t
|
|
25
|
+
u
|
|
26
|
+
v
|
|
27
|
+
w
|
|
28
|
+
x
|
|
29
|
+
y
|
|
30
|
+
z
|
|
31
|
+
0
|
|
32
|
+
1
|
|
33
|
+
2
|
|
34
|
+
3
|
|
35
|
+
4
|
|
36
|
+
5
|
|
37
|
+
6
|
|
38
|
+
7
|
|
39
|
+
8
|
|
40
|
+
9
|
|
41
|
+
0
|
|
42
|
+
to
|
|
43
|
+
in
|
|
44
|
+
is
|
|
45
|
+
that
|
|
46
|
+
it
|
|
47
|
+
was
|
|
48
|
+
he
|
|
49
|
+
for
|
|
50
|
+
as
|
|
51
|
+
on
|
|
52
|
+
with
|
|
53
|
+
his
|
|
54
|
+
be
|
|
55
|
+
at
|
|
56
|
+
you
|
|
57
|
+
I
|
|
58
|
+
are
|
|
59
|
+
this
|
|
60
|
+
by
|
|
61
|
+
from
|
|
62
|
+
had
|
|
63
|
+
have
|
|
64
|
+
they
|
|
65
|
+
not
|
|
66
|
+
or
|
|
67
|
+
one
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This folder contains various caches for the wiki, to speed up restarts. If you are having problems, try deleting everything in here before starting soks again.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
h1. API for classes to modify the wiki
|
|
2
|
+
|
|
3
|
+
There is a very simple API for classes to modify the wiki.
|
|
4
|
+
|
|
5
|
+
Any class can register to be notified of changes to the wiki by:
|
|
6
|
+
|
|
7
|
+
* @@wiki.watch_for( :start ) { |event, wiki, view| do whatever you want }@
|
|
8
|
+
* @@wiki.watch_for( :page_created ) { |event, page, revision| do whatever you want }@
|
|
9
|
+
* @@wiki.watch_for( :page_revised ) { |event, page, revision| do whatever you want }@
|
|
10
|
+
* @@wiki.watch_for( :page_deleted ) { |event, page, revision| do whatever you want }@
|
|
11
|
+
* @@wiki.watch_for( :page_viewed ) { |event,page,view,author| do whatever you want }@
|
|
12
|
+
* @@wiki.watch_for( :shutdown ) { |event| do whatever you want }@
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
These notifications are sent by a separate low priority thread from the one that is interacting with the user. Using these notifications a class can make changes to the wiki by calling:
|
|
16
|
+
|
|
17
|
+
<code>
|
|
18
|
+
@wiki.revise( pagename, newcontent, author )
|
|
19
|
+
</code>
|
|
20
|
+
|
|
21
|
+
The normal place for these classes to be initialized is from the start.rb file. The normal place for these classes to be stored is in the soks/lib/helpers directory.
|
|
22
|
+
|
|
23
|
+
Examples of helpers that use this api:
|
|
24
|
+
* [[AutomaticSummary => automatic summaries]] (which in turn are used by the SiteIndex and RecentChanges classes.
|
|
25
|
+
* AutomaticCalendar and AutomaticUpcomingEvents
|
|
26
|
+
* rss2wiki
|
|
27
|
+
* mail2wiki
|
|
28
|
+
* wiki2html
|
|
29
|
+
|
|
30
|
+
Tag: Include this page in the distribution
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
h1. The Author
|
|
2
|
+
|
|
3
|
+
Soks was written by Tom Counsell. He can be reached at tamc@rubyforge.org.
|
|
4
|
+
|
|
5
|
+
h2. Thanks to
|
|
6
|
+
|
|
7
|
+
* Pavel Sykora for a fix to the print stylesheet.
|
|
8
|
+
* Bil Kleb for new page categories, meta page improvements and many other suggestsions.
|
|
9
|
+
* Sebastien Clediere for a patch to fix uploads on windows and other bugfixes
|
|
10
|
+
* Giovanni Ferro for a patch to allow soks to be used from a memory stick
|
|
11
|
+
* Guillaume Marcais for table of contents code for RedCloth
|
|
12
|
+
* _why for the RedCloth library
|
|
13
|
+
* Austin Ziegler for the Diff:LCS library
|
|
14
|
+
* Matz and ruby-core for the ruby language
|
|
15
|
+
|
|
16
|
+
Tag: Include this page in the distribution
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
h1. Automatic Summaries
|
|
2
|
+
|
|
3
|
+
In lib/helpers/default-helpers.rb you will find an AutomaticSummary class, and its subclasses AutomaticList and AutomaticDetailedList. This uses the [[api => api for classes to modify the wiki ]] to watch for changes to the wiki, and if the page that is changed matches a given regexp, adds it to a summary page.
|
|
4
|
+
|
|
5
|
+
You can use it by creating a line in your soks-wiki/start.rb file of the form @AutomaticSummary.new( wiki, settings ) { |page| page.name =~ /Something you are interested in/ }@ where settings can be (defaults shown):
|
|
6
|
+
|
|
7
|
+
<pre>
|
|
8
|
+
<code>
|
|
9
|
+
DEFAULT_SETTINGS = {
|
|
10
|
+
:max_pages_to_show => nil,
|
|
11
|
+
:description => 'This summary was created automatically',
|
|
12
|
+
:author => 'AutomaticSummary',
|
|
13
|
+
:lines_to_include => 10,
|
|
14
|
+
:sort_pages_by => :created_on, # Could be :revised_on or :score or :name or :name_for_index, or :author
|
|
15
|
+
:reverse_sort => false,
|
|
16
|
+
:event => :page_created, # Only summarises new pages. :page_revised would summarise changed pages
|
|
17
|
+
:remove_deleted_pages => true, # If false will keep references to deleted pages
|
|
18
|
+
:summarise_revisions => false, # If true will list revisions rather than pages
|
|
19
|
+
:merge_revisions_within => false, # If set to a number, repeats with the same author within that many seconds will be merged
|
|
20
|
+
}
|
|
21
|
+
</code>
|
|
22
|
+
</pre>
|
|
23
|
+
|
|
24
|
+
h2. Examples
|
|
25
|
+
|
|
26
|
+
Four examples of its use, included in the default start.rb file are:
|
|
27
|
+
|
|
28
|
+
<pre>
|
|
29
|
+
<code>
|
|
30
|
+
AutomaticDetailedList.new( wiki, 'Known bugs' ) do |page|
|
|
31
|
+
page.name =~ /^Bug:/i && page.name !~ /^Bug: Type a title here/i
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
AutomaticList.new( wiki, 'Instructions and Howtos' ) { |page| page.name =~ /^How to /i }
|
|
35
|
+
AutomaticSummary.new( wiki, 'Latest News', :max_pages_to_show => 1, :reverse_sort => true) { |page| page.name =~ /^News:/i }
|
|
36
|
+
AutomaticSummary.new( wiki, 'All News', :reverse_sort => true) { |page| page.name =~ /^News:/i }
|
|
37
|
+
</code>
|
|
38
|
+
</pre>
|
|
39
|
+
|
|
40
|
+
Tag: Include this page in the distribution
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
h1. Automatic Counters
|
|
2
|
+
|
|
3
|
+
There are three automatic counter classes:
|
|
4
|
+
# ViewCountHelper - Counts what is looked on the page 'Popular Pages'
|
|
5
|
+
# ViewerCountHelper - Counts who looks on the page 'Prolific Viewers'
|
|
6
|
+
# AuthorCountHelper - Counts who edits on the page 'Principal Authors'
|
|
7
|
+
|
|
8
|
+
By default the results tables are updated once an hour, and show the top 20.
|
|
9
|
+
|
|
10
|
+
The simplest way to use them is to put the following in your start.rb file:
|
|
11
|
+
<pre>
|
|
12
|
+
<code>
|
|
13
|
+
require 'counter-helpers'
|
|
14
|
+
ViewCountHelper.new( wiki ) # Counts which are the most popular pages
|
|
15
|
+
ViewerCountHelper.new( wiki ) # Counts who visits the wiki most
|
|
16
|
+
AuthorCountHelper.new(wiki)
|
|
17
|
+
</code>
|
|
18
|
+
</pre>
|
|
19
|
+
|
|
20
|
+
They can take extra arguments to adjust their settings: @new( page_name = 'Principal Authors', update_page_every = :hour, show_top = 20, cache_name = 'authorcount' )@
|
|
21
|
+
|
|
22
|
+
Tag: Include this page in the distribution
|