Pimki 1.7.092 → 1.8.092

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/README-PIMKI +182 -178
  2. data/app/controllers/wiki.rb +950 -942
  3. data/app/models/chunks/category.rb +33 -33
  4. data/app/models/chunks/category_test.rb +21 -21
  5. data/app/models/chunks/chunk.rb +20 -20
  6. data/app/models/chunks/engines.rb +48 -48
  7. data/app/models/chunks/include.rb +1 -1
  8. data/app/models/chunks/match.rb +1 -1
  9. data/app/models/chunks/nowiki.rb +1 -1
  10. data/app/models/chunks/nowiki_test.rb +5 -0
  11. data/app/models/chunks/todo.rb +1 -0
  12. data/app/models/chunks/wiki.rb +130 -130
  13. data/app/models/page.rb +124 -124
  14. data/app/models/revision.rb +92 -92
  15. data/app/models/web.rb +314 -316
  16. data/app/models/wiki_content.rb +2 -2
  17. data/app/models/wiki_service.rb +170 -166
  18. data/app/models/wiki_words.rb +28 -28
  19. data/app/views/error.rhtml +37 -37
  20. data/app/views/navigation.rhtml +1 -1
  21. data/app/views/static_style_sheet.rhtml +10 -5
  22. data/app/views/top.rhtml +1 -1
  23. data/app/views/wiki/adv_search.rhtml +61 -61
  24. data/app/views/wiki/bliki.rhtml +7 -6
  25. data/app/views/wiki/bliki_edit.rhtml +26 -37
  26. data/app/views/wiki/bliki_new.rhtml +58 -64
  27. data/app/views/wiki/bliki_revision.rhtml +5 -3
  28. data/app/views/wiki/edit.rhtml +44 -44
  29. data/app/views/wiki/edit_menu.rhtml +26 -19
  30. data/app/views/wiki/edit_web.rhtml +303 -305
  31. data/app/views/wiki/glossary.rhtml +35 -27
  32. data/app/views/wiki/list.rhtml +175 -174
  33. data/app/views/wiki/list.rhtml.bak +175 -0
  34. data/app/views/wiki/mind.rhtml +70 -70
  35. data/app/views/wiki/new.rhtml +34 -32
  36. data/app/views/wiki/published.rhtml +34 -49
  37. data/app/views/wiki/revision.rhtml +88 -87
  38. data/app/views/wiki/rollback.rhtml +36 -35
  39. data/app/views/wiki/todo.rhtml +2 -2
  40. data/app/views/wiki_words_help.rhtml +8 -8
  41. data/libraries/action_controller_servlet.rb +202 -202
  42. data/libraries/madeleine_service.rb +162 -162
  43. data/pimki.rb +181 -181
  44. metadata +11 -12
  45. data/README +0 -172
  46. data/app/models/chunks/acronym.rb +0 -19
  47. data/app/views/wiki/test.rhtml +0 -25
  48. data/libraries/secure_web_controller_server.rb +0 -106
@@ -1,14 +1,17 @@
1
1
  <%
2
2
  @title = "Editing Left-Side Menu Options"
3
- @content_width = 700
3
+ @content_width = 810
4
4
  @hide_navigation = true
5
5
  @hide_menu = true
6
- @style_additions = "#Container { margin-left: 100px;}"
6
+ @inline_style = true
7
+ @style_additions = "#Content, #Container {width = 820px; padding-left:100px;}"
7
8
  %>
8
9
  <%= sub_template "top" %>
9
10
 
10
11
  <%= render_markup_help %>
11
12
 
13
+ <div id='main'>
14
+
12
15
  <form id="editForm" action="./save_menu" method="post">
13
16
  <p>Please choose the format you prefer for the left-size menu:</p>
14
17
  <p><input type="radio" name="type" value="linkers" <%= 'checked' if @menu_type == 'linkers' %>>Only pages that link other pages (default)</p>
@@ -16,17 +19,17 @@
16
19
  <p><input type="radio" name="type" value="revised" <%= 'checked' if @menu_type == 'revised' %>>Recently revised pages</p>
17
20
  <p><input type="radio" name="type" value="recent" <%= 'checked' if @menu_type == 'recent' %>>Recently visited pages</p>
18
21
  <p><input type="radio" name="type" value="viewed" <%= 'checked' if @menu_type == 'viewed' %>>Most viewed pages</p>
19
- <p><input type="radio" name="type" value="category" <%= 'checked' if @menu_type == 'category' %>>Pages in a specific category:
20
- <select id="category" name="category" size="1" style="width:190">
22
+ <p><input type="radio" name="type" value="category" id='menu_rb_categ' <%= 'checked' if @menu_type == 'category' %>>Pages in a specific category:
23
+ <select id="sel_category" name="sel_category" size="1" style="width:190" onChange="forms.editForm.menu_rb_categ.checked = true;">
21
24
  <option value="noselect">------------
22
25
  <% for category in web.categories %>
23
- <option value="<%= category %>"><%= category %>
26
+ <option value="<%= category %>" <%= 'selected' if category == web.menu_category %>><%= category %></option>
24
27
  <% end %>
25
28
  </select>
26
29
  </p>
27
30
  <p>For the above options you can choose if you want to limit the number of results. Enter the number of items you wish, or 0 for all items: <input type="textfield" size="20", name="limit" value="<%= @list_limit %>" /></p>
28
- <p><input type="radio" name="type" value="user" <%= 'checked' if @menu_type == 'user' %>>Or just write your own menu contents (as a regular Wiki page):
29
- <textarea name="content" style="width: 400px; height: 300px"><%= !@menu_content.nil? && Page === @menu_content ? @menu_content.content : @menu_content %></textarea>
31
+ <p><input type="radio" name="type" value="user" id="menu_rb_freetext" <%= 'checked' if @menu_type == 'user' %>>Or just write your own menu contents (as a regular Wiki page):
32
+ <textarea name="content" style="width: 400px; height: 300px" onClick="forms.editForm.menu_rb_freetext.checked = true;"><%= !@menu_content.nil? && Page === @menu_content ? @menu_content.content : @menu_content %></textarea>
30
33
  </p>
31
34
 
32
35
  <% if Page === @menu_content && @menu_content.revisions.length > 1
@@ -48,20 +51,24 @@
48
51
  <tr><td>&nbsp;</td></tr>
49
52
  <tr>
50
53
  <td align="right">
51
- <small>
52
- Enter system password
53
- <input style="font-size:small;" type="password" id="system_password" name="system_password">
54
- and
55
- <input type="submit" name='action' value="Update">
56
- </small>
57
- </tr></td>
58
- <tr><td align="right">
59
- <small>
60
- ...or forget changes and <input type="submit" name='action' value="Cancel Update">
61
- </small>
62
- </tr></td>
54
+ <small>
55
+ Enter system password
56
+ <input style="font-size:small;" type="password" id="system_password" name="system_password">
57
+ and
58
+ <input type="submit" name='action' value="Update">
59
+ </small>
60
+ </td>
61
+ </tr>
62
+ <tr>
63
+ <td align="right">
64
+ <small>
65
+ ...or forget changes and <input type="submit" name='action' value="Cancel Update">
66
+ </small>
67
+ </td>
68
+ </tr>
63
69
  </table>
64
70
 
65
71
  </form>
72
+ </div>
66
73
 
67
74
  <%= sub_template "bottom" %>
@@ -1,306 +1,304 @@
1
- <% @title = "Web Setup"
2
- @hide_menu = true
3
- @style_additions = "
4
- #Container { width: 600px; margin-left: 180px;}
5
- input { vertical-align: bottom }
6
- "
7
- %>
8
- <%= sub_template "top" %>
9
-
10
- <%= "<p style='font-size: 15px; font-variant: italic; color: red;'>#{@message}</span>" if @message %>
11
-
12
- <form action="../update_web" id="setup" method="post" onSubmit="cleanAddress(); return validateSetup()">
13
- <h2 style="margin-bottom: 3px">Name and address</h2>
14
- <div class="help">
15
- The name of the web is included in the title on all pages. The address is the base path that all pages within the web live beneath.
16
- Ex: the address "rails" gives URLs like <i>/rails/show/HomePage</i>.
17
- </div>
18
-
19
- <div class="inputBox">
20
- Name: <input type="text" id="name" name="name" value="<%= @web.name %>" onChange="proposeAddress();"> &nbsp;&nbsp;
21
- Address: <input type="text" id="address" name="address" value="<%= @web.address %>" onChange="cleanAddress();">
22
- <i>(Letters & digits only)</i>
23
- </div>
24
-
25
- <h2 style="margin-bottom: 3px">Specialize</h2>
26
- <script>
27
- function see_styles() {
28
- document.getElementById('additionalStyle').style.display='block';
29
- document.getElementById('see_styles').style.display='none';
30
- document.getElementById('hide_styles').style.display='inline';
31
- return false;
32
- }
33
- function hide_styles() {
34
- document.getElementById('additionalStyle').style.display='none';
35
- document.getElementById('see_styles').style.display='inline';
36
- document.getElementById('hide_styles').style.display='none';
37
- return false;
38
- }
39
- </script>
40
- <div class="help">
41
- Turning safe mode on will strip HTML tags and stylesheet options from the content of all pages.
42
- Turning on "brackets only" will require all wiki words to be as [[wiki word]] and WikiWord won't work.
43
- Additions to the stylesheet take precedence over the existing styles. <i>Hint:</i> View source on a page you want to style to find ID names on individual tags.
44
-
45
- </div>
46
- <div class="inputBox">
47
- Markup:
48
- <select name="markup">
49
- <%= html_options({ "Textile" => :textile, "Markdown via RedCloth (experimental)" => :red_markdown, "Markdown via BlueCloth" => :blue_markdown, "RDoc" => :rdoc }, @web.markup) %>
50
- </select>
51
-
52
- &nbsp;&nbsp;
53
-
54
- Color:
55
- <select name="color">
56
- <%= html_options({ "Green" => "008B26", "Purple" => "504685", "Red" => "DA0006", "Orange" => "FA6F00", "Grey" => "8BA2B0" },
57
- @web.color) %>
58
- </select>
59
-
60
- &nbsp;&nbsp;
61
-
62
- <br />
63
-
64
- <small>
65
-
66
- <input type="checkbox" name="safe_mode"<%= " CHECKED" if @web.safe_mode %>> Safe mode
67
-
68
- &nbsp;&nbsp;
69
-
70
- <input type="checkbox" name="brackets_only"<%= " CHECKED" if @web.brackets_only %>> Brackets only
71
-
72
- &nbsp;&nbsp;
73
-
74
- <input type="checkbox" name="count_pages"<%= " CHECKED" if @web.count_pages %>> Count pages
75
-
76
- </small>
77
-
78
- <br />
79
- <a style='font-size:smaller;' id='see_styles' href="#" onClick="return see_styles();">See styles >></a>
80
- <a style='font-size:smaller; display:none;' id='hide_styles' href="#" onClick="return hide_styles();">Hide styles <<</a>
81
- <textarea id="additionalStyle" style="display: none; margin-top: 10px; margin-bottom: 5px; width: 100%; height: 200px" name="additional_style"><%= @web.additional_style %></textarea>
82
- </div>
83
-
84
- <h2 style="margin-bottom: 3px">Persistence Options (all webs)</h2>
85
- <div class="help">
86
- You can set how often to take snapshots of the web data. (All incremental changes are saved as command_logs; snapshots supercede those with the full data). Recommended values are 1-2 hours if you turn the web on and off often, or 24-48 hours if this is a long running service.<br />
87
- Snapshots will not be taken if there are no incremental changes (in the form of command_logs). You can always force a snapshot in the administrative tasks below.
88
- </div>
89
- <div class="inputBox">
90
- <input align='right' type="text" name="snapshots_interval" value='<%= @snapshot_interval %>' /> hour(s).
91
- </div>
92
-
93
- <h2 style="margin-bottom: 3px">Password protection for this PIM (<%= @web.name %>)</h2>
94
- <div class="help">
95
- This is the password that visitors need to login to view and edit this web. Setting the password to nothing will remove the password protection.
96
- </div>
97
- <div class="inputBox">
98
- Password: <input type="password" id="password" name="password" value="<%= @web.password %>"> &nbsp;&nbsp;
99
- Verify: <input type="password" id="password_check" value="<%= @web.password %>" name="password_check"><br />
100
- <!--
101
- <input type="radio" id="check_pass_on_edit" name="check_pass_on_edit" value='each_edit' <%= 'checked' if @web.password && @web.check_pass_on_edit %>>Require password for each edit
102
- <input type="radio" id="check_pass_on_edit" name="check_pass_on_edit" value='login_only' <%= 'checked' if @web.password && !@web.check_pass_on_edit %>>Require password once on logon
103
- -->
104
- </div>
105
-
106
- <h2 style="margin-bottom: 3px">Publish read-only version of this web (<%= @web.name %>)</h2>
107
- <div class="help">
108
- You can turn on a read-only version of this web that's accessible even when the regular web is password protected.
109
- The published version is accessible through URLs like /wiki/published/HomePage.<br /><br />
110
-
111
- Defaulting non-localhost requests to the 'published' version means that requests coming from other machines to the root (e.g. http://host:2500/) will be passed to /web/published and not /web/show.<br />
112
-
113
- Other machines can still explicitly request the /web/show versions, for which you need to set editing password etc. This is just to make referring colleagues to your PIM easier.
114
- </div>
115
- <div class="inputBox">
116
- <script>
117
- function checkPublished() {
118
- if (!document.getElementById("published").checked) {
119
- document.getElementById("default_to_published").checked = false;
120
- document.getElementById("default_to_published").disabled = true;
121
- } else {
122
- document.getElementById("default_to_published").disabled = false;
123
- }
124
- };
125
- function checkPublishedDefault() {
126
- if (document.getElementById("default_to_published").checked) {
127
- document.getElementById("published").checked = true;
128
- }
129
- };
130
- </script>
131
- <input type="checkbox" id="published" name="published" onClick='return checkPublished();' <%= "CHECKED" if @web.published %>> Publish this web
132
- <br />
133
- <input type="checkbox" id="default_to_published" name="default_to_published" onClick='return checkPublishedDefault();'
134
- <%= "disabled" unless @web.published %>
135
- <%= "checked" if @web.default_to_published %>> Default non-localhost requests to the 'published' version
136
- </div>
137
-
138
- <h2 style="margin-bottom: 3px">Customise this PIM</h2>
139
- <div class="help">
140
- Here are a few setting you can use to tweak the appearance and behaviour of your Pimki.
141
- </div>
142
- <div class="inputBox">
143
- <h4>Interface Options</h4>
144
-
145
- <input type="checkbox" name="enable_dclick_edit" <%= "checked" if @web.enable_dclick_edit %>> Edit page on double click.<br />
146
-
147
- <input type="checkbox" name="enable_menu" <%= "checked" if @web.enable_menu %>> Enable menu on left. Don't forget to <a href='../edit_menu'>set the menu contents</a>.
148
-
149
- <h4>Mind Map</h4>
150
- <i>Size</i>:<br />
151
- Limit the size of the Mind Map image. Format is "width,height" in inches. Leave blank for no size limit.<br />
152
- <input type="text" name="mind_map_size" id="mind_map_size" value="<%= web.mind_map_size %>">
153
- <table>
154
- <tr style="font-style:italic;">
155
- <td>Graph Type</td>
156
- <td style="width:200px">Layout Type</td>
157
- <td style="width:500px">Content Options</td>
158
- <td>Categories</td>
159
- </tr>
160
- <tr>
161
- <td style="vertical-align:top;" width="30%">
162
- <input type="radio" name="graph_type" value="normal" <%= 'checked' if @graph_type == 'normal' %>>Draw Normal Graph<br>
163
- <input type="radio" name="graph_type" value="author" <%= 'checked' if @graph_type == 'author' %>>Draw Authors Graph<br>
164
- <input type="radio" name="graph_type" value="category" <%= 'checked' if @graph_type == 'category' %>>Draw Category Graph<br>
165
- </td>
166
- <td width="100" style="vertical-align:top;" >
167
- <input type="radio" name="draw_type" value="neato" <% if @prog == 'neato' %> checked <% end %>>Neato<br>
168
- <input type="radio" name="draw_type" value="dot" <% if @prog == 'dot' %> checked <% end %>>Dot</br>
169
- <input type="radio" name="draw_type" value="circo" <% if @prog == 'circo' %> checked <% end %>>Circo</br>
170
- <input type="radio" name="draw_type" value="twopi" <% if @prog == 'twopi' %> checked <% end %>>Twopi</br>
171
- </td>
172
- <td style="vertical-align:top;width:400px;">
173
- <input type="checkbox" id="show_authors" name="show_authors" <%= 'checked' if @show_authors %>>Show author pages<br>
174
- <input type="checkbox" id="missing" name="missing" <%= 'checked' if @missing %>>Show missing pages<br>
175
- <input type="checkbox" id="show_leaves" name="show_leaves" <%= 'checked' if @show_leaves %>>Show leaf pages<br>
176
- </td>
177
- <td>
178
- <select id="selected_categs" name="selected_categs" size="4" style="width:120px;" multiple>
179
- <option value="all" <%= 'selected' if @selected_categories.empty? %>>&lt;all categories&gt;</option>
180
- <option value="none" <%= 'selected' if @selected_categories.include? 'none' %>>&lt;no categories&gt;</option>
181
- <% for category in @categories %>
182
- <option value="<%= category %>" <%= 'selected' if @selected_categories.include? category %>><%= category %></option>
183
- <% end %>
184
- </select>
185
- </td>
186
- </tr>
187
- </table>
188
-
189
-
190
- <!--
191
-
192
- <br /><br />
193
- <h4>Bliki Options</h4>
194
-
195
- <br /><br />
196
- <h4>Content & Symbols mapping</h4>
197
-
198
- Extra special symbols. The format of the map is: "code=text" on separate lines. This will map an element of <i>&lt;:code&gt;</i> to <i>text</i>, e.g. &lt;:cbx&gt; is mapped to &lt;input type="checkbox" disabled /&gt;<br />
199
- <textarea name="symbols_map" id="symbols_map" style="width: 100%; height: 100px"></textarea>
200
-
201
- <br /><br />
202
-
203
- Extra special links. The format of the map is: "link_name=link_format" on separate lines. This will map an element of <i>[link_name[link_text]]</i> to your specified format. e.g. to use google's redirection enter: <pre>google=http://www.google.com/url?sa=D&amp;q=#{link_text}</pre> and use as: <pre>[[!goggle http://pimki.rubyforge.org/]]</pre> to map to: <pre>http://www.google.com/url?sa=D&amp;q=http://pimki.rubyforge.org/</pre><br />
204
- <textarea name="links_map" id="links_map" style="width: 100%; height: 100px"></textarea>
205
-
206
- -->
207
- </div>
208
-
209
- <p align="right">
210
- <small>
211
- Enter system password
212
- <input type="password" id="system_password" name="system_password">
213
- and
214
- <input type="submit" value="Update Web">
215
- </small>
216
- </p>
217
- </form>
218
-
219
- <p style='font-size: 10px; text-align: right;'>...or forget all your changes and <a href="/new_web/">create a new web</a>.<br />
220
- <% num_webs = WikiService.instance.webs.length %>
221
- (There <%= num_webs > 1 ? 'are' : 'is' %> currently <a href='/web_list/'><%= WikiService.instance.webs.length %> web<%= 's' if num_webs > 1 %></a>)</p>
222
-
223
- <hr />
224
- <br/>
225
-
226
- <h2>Other administrative tasks</h2>
227
- <form action="../administrate" id="administrate" method="post" class="inputBox">
228
- <p style="font-size: 10px;">
229
- Clean up by entering system password
230
- <input type="password" id="system_password" name="system_password">
231
- and...
232
- </p>
233
- <p align='right'>
234
- <input type="submit" name='action' value="Delete Orphan Pages"><br/>
235
- <input type="submit" name='action' value="Clear Render Cache"><br/>
236
- <input type="submit" name='action' value="Force Data Snapshot"><br/>
237
- <input type="submit" name='action' value="Clean Storage"><br/>
238
- <% if wiki.webs.size > 1 %>
239
- <input type="submit" name='action' value="Make This Web Default"><br/>
240
- <% end %>
241
- <br/>
242
- <input type="submit" name='action' value="Remove This Web" onClick="return confirm('Are you absolutely sure you want to delete the \'<%= web.name %>\' web?')"><br/>
243
- </p>
244
- </form>
245
-
246
- <hr />
247
- <br/>
248
-
249
- <h2>Stop Pimki</h2>
250
- <p style="color:red">Please note that stopping the server will stop all pimki webs running on this server!</p>
251
- <form action="../stop" id="stop" method="post">
252
- <p style="font-size: 10px;" class="inputBox">
253
- Enter system password
254
- <input type="password" id="system_password" name="system_password">
255
- and
256
- <input type="submit" name='stop' value="Stop Pimki">
257
- in
258
- <input type="text" name='seconds' value="3" size='5' style="text-align:right;">
259
- seconds.
260
- </p>
261
- </form>
262
-
263
- <script>
264
- function proposeAddress() {
265
- document.getElementById('address').value =
266
- document.getElementById('name').value.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
267
- }
268
-
269
- function cleanAddress() {
270
- document.getElementById('address').value =
271
- document.getElementById('address').value.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
272
- }
273
-
274
- function validateSetup() {
275
- if (document.getElementById('system_password').value == "") {
276
- alert("You must enter the system password");
277
- return false;
278
- }
279
-
280
- if (document.getElementById('name').value == "") {
281
- alert("You must pick a name for the web");
282
- return false;
283
- }
284
-
285
- if (document.getElementById('address').value == "") {
286
- alert("You must pick an address for the web");
287
- return false;
288
- }
289
-
290
- if (document.getElementById('password').value != "" &&
291
- document.getElementById('password').value != document.getElementById('password_check').value) {
292
- alert("The password and its verification doesn't match");
293
- return false;
294
- }
295
-
296
- if (document.getElementById('mind_map_size').value != "" &&
297
- !(/^\d+,\d+$/.test(document.getElementById('mind_map_size').value))) {
298
- alert("The Mind Map size must be in the format of 'digit(s),digit(s)'!");
299
- return false;
300
- }
301
-
302
- return true;
303
- }
304
- </script>
305
-
1
+ <% @title = "Web Setup"
2
+ @hide_menu = true
3
+ @style_additions = "input { vertical-align: bottom }"
4
+ @style_additions += "#Container { margin-left: 180px; }" if web.enable_menu
5
+ %>
6
+ <%= sub_template "top" %>
7
+
8
+ <%= "<p style='font-size: 15px; font-variant: italic; color: red;'>#{@message}</span>" if @message %>
9
+
10
+ <form action="../update_web" id="setup" method="post" onSubmit="cleanAddress(); return validateSetup()">
11
+ <h2 style="margin-bottom: 3px">Name and address</h2>
12
+ <div class="help">
13
+ The name of the web is included in the title on all pages. The address is the base path that all pages within the web live beneath.
14
+ Ex: the address "rails" gives URLs like <i>/rails/show/HomePage</i>.
15
+ </div>
16
+
17
+ <div class="inputBox">
18
+ Name: <input type="text" id="name" name="name" value="<%= @web.name %>" onChange="proposeAddress();"> &nbsp;&nbsp;
19
+ Address: <input type="text" id="address" name="address" value="<%= @web.address %>" onChange="cleanAddress();">
20
+ <i>(Letters & digits only)</i>
21
+ </div>
22
+
23
+ <h2 style="margin-bottom: 3px">Specialize</h2>
24
+ <script>
25
+ function see_styles() {
26
+ document.getElementById('additionalStyle').style.display='block';
27
+ document.getElementById('see_styles').style.display='none';
28
+ document.getElementById('hide_styles').style.display='inline';
29
+ return false;
30
+ }
31
+ function hide_styles() {
32
+ document.getElementById('additionalStyle').style.display='none';
33
+ document.getElementById('see_styles').style.display='inline';
34
+ document.getElementById('hide_styles').style.display='none';
35
+ return false;
36
+ }
37
+ </script>
38
+ <div class="help">
39
+ Turning safe mode on will strip HTML tags and stylesheet options from the content of all pages.
40
+ Turning on "brackets only" will require all wiki words to be as [[wiki word]] and WikiWord won't work.
41
+ Additions to the stylesheet take precedence over the existing styles. <i>Hint:</i> View source on a page you want to style to find ID names on individual tags.
42
+
43
+ </div>
44
+ <div class="inputBox">
45
+ Markup:
46
+ <select name="markup">
47
+ <%= html_options({ "Textile" => :textile, "Markdown via RedCloth (experimental)" => :red_markdown, "Markdown via BlueCloth" => :blue_markdown, "RDoc" => :rdoc }, @web.markup) %>
48
+ </select>
49
+
50
+ &nbsp;&nbsp;
51
+
52
+ Color:
53
+ <select name="color">
54
+ <%= html_options({ "Green" => "008B26", "Purple" => "504685", "Red" => "DA0006", "Orange" => "FA6F00", "Grey" => "8BA2B0" },
55
+ @web.color) %>
56
+ </select>
57
+
58
+ &nbsp;&nbsp;
59
+
60
+ <br />
61
+
62
+ <small>
63
+
64
+ <input type="checkbox" name="safe_mode"<%= " CHECKED" if @web.safe_mode %>> Safe mode
65
+
66
+ &nbsp;&nbsp;
67
+
68
+ <input type="checkbox" name="brackets_only"<%= " CHECKED" if @web.brackets_only %>> Brackets only
69
+
70
+ &nbsp;&nbsp;
71
+
72
+ <input type="checkbox" name="count_pages"<%= " CHECKED" if @web.count_pages %>> Count pages
73
+
74
+ </small>
75
+
76
+ <br />
77
+ <a style='font-size:smaller;' id='see_styles' href="#" onClick="return see_styles();">See styles >></a>
78
+ <a style='font-size:smaller; display:none;' id='hide_styles' href="#" onClick="return hide_styles();">Hide styles <<</a>
79
+ <textarea id="additionalStyle" style="display: none; margin-top: 10px; margin-bottom: 5px; width: 100%; height: 200px" name="additional_style"><%= @web.additional_style %></textarea>
80
+ </div>
81
+
82
+ <h2 style="margin-bottom: 3px">Persistence Options (all webs)</h2>
83
+ <div class="help">
84
+ You can set how often to take snapshots of the web data. (All incremental changes are saved as command_logs; snapshots supercede those with the full data). Recommended values are 1-2 hours if you turn the web on and off often, or 24-48 hours if this is a long running service.<br />
85
+ Snapshots will not be taken if there are no incremental changes (in the form of command_logs). You can always force a snapshot in the administrative tasks below.
86
+ </div>
87
+ <div class="inputBox">
88
+ <input align='right' type="text" name="snapshots_interval" value='<%= @snapshot_interval %>' /> hour(s).
89
+ </div>
90
+
91
+ <h2 style="margin-bottom: 3px">Password protection for this PIM (<%= @web.name %>)</h2>
92
+ <div class="help">
93
+ This is the password that visitors need to login to view and edit this web. Setting the password to nothing will remove the password protection.
94
+ </div>
95
+ <div class="inputBox">
96
+ Password: <input type="password" id="password" name="password" value="<%= @web.password %>"> &nbsp;&nbsp;
97
+ Verify: <input type="password" id="password_check" value="<%= @web.password %>" name="password_check"><br />
98
+ <!--
99
+ <input type="radio" id="check_pass_on_edit" name="check_pass_on_edit" value='each_edit' <%= 'checked' if @web.password && @web.check_pass_on_edit %>>Require password for each edit
100
+ <input type="radio" id="check_pass_on_edit" name="check_pass_on_edit" value='login_only' <%= 'checked' if @web.password && !@web.check_pass_on_edit %>>Require password once on logon
101
+ -->
102
+ </div>
103
+
104
+ <h2 style="margin-bottom: 3px">Publish read-only version of this web (<%= @web.name %>)</h2>
105
+ <div class="help">
106
+ You can turn on a read-only version of this web that's accessible even when the regular web is password protected.
107
+ The published version is accessible through URLs like /wiki/published/HomePage.<br /><br />
108
+
109
+ Defaulting non-localhost requests to the 'published' version means that requests coming from other machines to the root (e.g. http://host:2500/) will be passed to /web/published and not /web/show.<br />
110
+
111
+ Other machines can still explicitly request the /web/show versions, for which you need to set editing password etc. This is just to make referring colleagues to your PIM easier.
112
+ </div>
113
+ <div class="inputBox">
114
+ <script>
115
+ function checkPublished() {
116
+ if (!document.getElementById("published").checked) {
117
+ document.getElementById("default_to_published").checked = false;
118
+ document.getElementById("default_to_published").disabled = true;
119
+ } else {
120
+ document.getElementById("default_to_published").disabled = false;
121
+ }
122
+ };
123
+ function checkPublishedDefault() {
124
+ if (document.getElementById("default_to_published").checked) {
125
+ document.getElementById("published").checked = true;
126
+ }
127
+ };
128
+ </script>
129
+ <input type="checkbox" id="published" name="published" onClick='return checkPublished();' <%= "CHECKED" if @web.published %>> Publish this web
130
+ <br />
131
+ <input type="checkbox" id="default_to_published" name="default_to_published" onClick='return checkPublishedDefault();'
132
+ <%= "disabled" unless @web.published %>
133
+ <%= "checked" if @web.default_to_published %>> Default non-localhost requests to the 'published' version
134
+ </div>
135
+
136
+ <h2 style="margin-bottom: 3px">Customise this PIM</h2>
137
+ <div class="help">
138
+ Here are a few setting you can use to tweak the appearance and behaviour of your Pimki.
139
+ </div>
140
+ <div class="inputBox">
141
+ <h4>Interface Options</h4>
142
+
143
+ <input type="checkbox" name="enable_dclick_edit" <%= "checked" if @web.enable_dclick_edit %>> Edit page on double click.<br />
144
+
145
+ <input type="checkbox" name="enable_menu" <%= "checked" if @web.enable_menu %>> Enable menu on left. Don't forget to <a href='../edit_menu'>set the menu contents</a>.
146
+
147
+ <h4>Mind Map</h4>
148
+ <i>Size</i>:<br />
149
+ Limit the size of the Mind Map image. Format is "width,height" in inches. Leave blank for no size limit.<br />
150
+ <input type="text" name="mind_map_size" id="mind_map_size" value="<%= web.mind_map_size %>">
151
+ <table>
152
+ <tr style="font-style:italic;">
153
+ <td>Graph Type</td>
154
+ <td style="width:200px">Layout Type</td>
155
+ <td style="width:500px">Content Options</td>
156
+ <td>Categories</td>
157
+ </tr>
158
+ <tr>
159
+ <td style="vertical-align:top;" width="30%">
160
+ <input type="radio" name="graph_type" value="normal" <%= 'checked' if @graph_type == 'normal' %>>Draw Normal Graph<br>
161
+ <input type="radio" name="graph_type" value="author" <%= 'checked' if @graph_type == 'author' %>>Draw Authors Graph<br>
162
+ <input type="radio" name="graph_type" value="category" <%= 'checked' if @graph_type == 'category' %>>Draw Category Graph<br>
163
+ </td>
164
+ <td width="100" style="vertical-align:top;" >
165
+ <input type="radio" name="draw_type" value="neato" <% if @prog == 'neato' %> checked <% end %>>Neato<br>
166
+ <input type="radio" name="draw_type" value="dot" <% if @prog == 'dot' %> checked <% end %>>Dot</br>
167
+ <input type="radio" name="draw_type" value="circo" <% if @prog == 'circo' %> checked <% end %>>Circo</br>
168
+ <input type="radio" name="draw_type" value="twopi" <% if @prog == 'twopi' %> checked <% end %>>Twopi</br>
169
+ </td>
170
+ <td style="vertical-align:top;width:400px;">
171
+ <input type="checkbox" id="show_authors" name="show_authors" <%= 'checked' if @show_authors %>>Show author pages<br>
172
+ <input type="checkbox" id="missing" name="missing" <%= 'checked' if @missing %>>Show missing pages<br>
173
+ <input type="checkbox" id="show_leaves" name="show_leaves" <%= 'checked' if @show_leaves %>>Show leaf pages<br>
174
+ </td>
175
+ <td>
176
+ <select id="selected_categs" name="selected_categs" size="4" style="width:120px;" multiple>
177
+ <option value="all" <%= 'selected' if @selected_categories.empty? %>>&lt;all categories&gt;</option>
178
+ <option value="none" <%= 'selected' if @selected_categories.include? 'none' %>>&lt;no categories&gt;</option>
179
+ <% for category in @categories %>
180
+ <option value="<%= category %>" <%= 'selected' if @selected_categories.include? category %>><%= category %></option>
181
+ <% end %>
182
+ </select>
183
+ </td>
184
+ </tr>
185
+ </table>
186
+
187
+
188
+ <!--
189
+
190
+ <br /><br />
191
+ <h4>Bliki Options</h4>
192
+
193
+ <br /><br />
194
+ <h4>Content & Symbols mapping</h4>
195
+
196
+ Extra special symbols. The format of the map is: "code=text" on separate lines. This will map an element of <i>&lt;:code&gt;</i> to <i>text</i>, e.g. &lt;:cbx&gt; is mapped to &lt;input type="checkbox" disabled /&gt;<br />
197
+ <textarea name="symbols_map" id="symbols_map" style="width: 100%; height: 100px"></textarea>
198
+
199
+ <br /><br />
200
+
201
+ Extra special links. The format of the map is: "link_name=link_format" on separate lines. This will map an element of <i>[link_name[link_text]]</i> to your specified format. e.g. to use google's redirection enter: <pre>google=http://www.google.com/url?sa=D&amp;q=#{link_text}</pre> and use as: <pre>[[!goggle http://pimki.rubyforge.org/]]</pre> to map to: <pre>http://www.google.com/url?sa=D&amp;q=http://pimki.rubyforge.org/</pre><br />
202
+ <textarea name="links_map" id="links_map" style="width: 100%; height: 100px"></textarea>
203
+
204
+ -->
205
+ </div>
206
+
207
+ <p align="right">
208
+ <small>
209
+ Enter system password
210
+ <input type="password" id="system_password" name="system_password">
211
+ and
212
+ <input type="submit" value="Update Web">
213
+ </small>
214
+ </p>
215
+ </form>
216
+
217
+ <p style='font-size: 10px; text-align: right;'>...or forget all your changes and <a href="/new_web/">create a new web</a>.<br />
218
+ <% num_webs = WikiService.instance.webs.length %>
219
+ (There <%= num_webs > 1 ? 'are' : 'is' %> currently <a href='/web_list/'><%= WikiService.instance.webs.length %> web<%= 's' if num_webs > 1 %></a>)</p>
220
+
221
+ <hr />
222
+ <br/>
223
+
224
+ <h2>Other administrative tasks</h2>
225
+ <form action="../administrate" id="administrate" method="post" class="inputBox">
226
+ <p style="font-size: 10px;">
227
+ Clean up by entering system password
228
+ <input type="password" id="system_password" name="system_password">
229
+ and...
230
+ </p>
231
+ <p align='right'>
232
+ <input type="submit" name='action' value="Delete Orphan Pages"><br/>
233
+ <input type="submit" name='action' value="Clear Render Cache"><br/>
234
+ <input type="submit" name='action' value="Force Data Snapshot"><br/>
235
+ <input type="submit" name='action' value="Clean Storage"><br/>
236
+ <% if wiki.webs.size > 1 %>
237
+ <input type="submit" name='action' value="Make This Web Default"><br/>
238
+ <% end %>
239
+ <br/>
240
+ <input type="submit" name='action' value="Remove This Web" onClick="return confirm('Are you absolutely sure you want to delete the \'<%= web.name %>\' web?')"><br/>
241
+ </p>
242
+ </form>
243
+
244
+ <hr />
245
+ <br/>
246
+
247
+ <h2>Stop Pimki</h2>
248
+ <p style="color:red">Please note that stopping the server will stop all pimki webs running on this server!</p>
249
+ <form action="../stop" id="stop" method="post">
250
+ <p style="font-size: 10px;" class="inputBox">
251
+ Enter system password
252
+ <input type="password" id="system_password" name="system_password">
253
+ and
254
+ <input type="submit" name='stop' value="Stop Pimki">
255
+ in
256
+ <input type="text" name='seconds' value="3" size='5' style="text-align:right;">
257
+ seconds.
258
+ </p>
259
+ </form>
260
+
261
+ <script>
262
+ function proposeAddress() {
263
+ document.getElementById('address').value =
264
+ document.getElementById('name').value.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
265
+ }
266
+
267
+ function cleanAddress() {
268
+ document.getElementById('address').value =
269
+ document.getElementById('address').value.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
270
+ }
271
+
272
+ function validateSetup() {
273
+ if (document.getElementById('system_password').value == "") {
274
+ alert("You must enter the system password");
275
+ return false;
276
+ }
277
+
278
+ if (document.getElementById('name').value == "") {
279
+ alert("You must pick a name for the web");
280
+ return false;
281
+ }
282
+
283
+ if (document.getElementById('address').value == "") {
284
+ alert("You must pick an address for the web");
285
+ return false;
286
+ }
287
+
288
+ if (document.getElementById('password').value != "" &&
289
+ document.getElementById('password').value != document.getElementById('password_check').value) {
290
+ alert("The password and its verification doesn't match");
291
+ return false;
292
+ }
293
+
294
+ if (document.getElementById('mind_map_size').value != "" &&
295
+ !(/^\d+,\d+$/.test(document.getElementById('mind_map_size').value))) {
296
+ alert("The Mind Map size must be in the format of 'digit(s),digit(s)'!");
297
+ return false;
298
+ }
299
+
300
+ return true;
301
+ }
302
+ </script>
303
+
306
304
  <%= sub_template "bottom" %>