Pimki 1.6.092 → 1.7.092
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/README-PIMKI +13 -4
- data/app/controllers/wiki.rb +157 -62
- data/app/models/chunks/acronym.rb +19 -0
- data/app/models/chunks/category.rb +4 -2
- data/app/models/chunks/todo.rb +0 -1
- data/app/models/chunks/wiki.rb +19 -5
- data/app/models/revision.rb +2 -0
- data/app/models/web.rb +38 -38
- data/app/models/web_test.rb +1 -1
- data/app/models/wiki_service.rb +8 -7
- data/app/models/wiki_words.rb +3 -2
- data/app/models/wiki_words_test.rb +10 -0
- data/app/views/error.rhtml +4 -2
- data/app/views/menu.rhtml +1 -5
- data/app/views/navigation.rhtml +6 -6
- data/app/views/static_style_sheet.rhtml +25 -5
- data/app/views/textile_help.rhtml +1 -1
- data/app/views/top.rhtml +59 -57
- data/app/views/wiki/adv_search.rhtml +2 -2
- data/app/views/wiki/authors.rhtml +1 -1
- data/app/views/wiki/bliki.rhtml +7 -5
- data/app/views/wiki/bliki_edit.rhtml +2 -1
- data/app/views/wiki/bliki_new.rhtml +2 -1
- data/app/views/wiki/bliki_revision.rhtml +12 -19
- data/app/views/wiki/edit.rhtml +4 -4
- data/app/views/wiki/edit_menu.rhtml +2 -1
- data/app/views/wiki/edit_web.rhtml +83 -21
- data/app/views/wiki/export.rhtml +7 -0
- data/app/views/wiki/feeds.rhtml +7 -3
- data/app/views/wiki/glossary.rhtml +27 -0
- data/app/views/wiki/list.rhtml +5 -1
- data/app/views/wiki/login.rhtml +1 -0
- data/app/views/wiki/mind.rhtml +14 -2
- data/app/views/wiki/new_system.rhtml +3 -3
- data/app/views/wiki/new_web.rhtml +5 -1
- data/app/views/wiki/page.rhtml +1 -8
- data/app/views/wiki/published.rhtml +38 -0
- data/app/views/wiki/recently_revised.rhtml +6 -0
- data/app/views/wiki/rss_feed.rhtml +46 -0
- data/app/views/wiki/test.rhtml +25 -0
- data/app/views/wiki/todo.rhtml +5 -2
- data/app/views/wiki/web_list.rhtml +5 -1
- data/libraries/secure_web_controller_server.rb +106 -0
- data/pimki.rb +11 -7
- metadata +11 -4
data/README-PIMKI
CHANGED
|
@@ -31,12 +31,15 @@ Pimki added features:
|
|
|
31
31
|
* Bliki: a blog integrated with the wiki. Blog entries are simply wiki-pages in
|
|
32
32
|
a special space. Can link from an entry to wiki pages via PageName or [[page name]]
|
|
33
33
|
and from pages to Bliki entries via [bliki[page name]].
|
|
34
|
+
* c2 Wiki links, via [c2[PageName]]. If you run multiple webs within Pimki, you
|
|
35
|
+
can now link between them using [web_address[PageName]].
|
|
34
36
|
* Todo Items & List:
|
|
35
37
|
* 'todo:' items are highlighted on each page.
|
|
36
38
|
* Added a capacity to pull and list todo items from all pages.
|
|
37
39
|
* On main list, items are highlighted according to date (if there is one).
|
|
38
40
|
* Added capacity to (persistently :) delete/rename pages through the 'All Pages'
|
|
39
41
|
list.
|
|
42
|
+
* Lots of web customization and administration options through the edit_web template.
|
|
40
43
|
* Added left-side menu. Content options are:
|
|
41
44
|
* Only pages that reference other pages (default)
|
|
42
45
|
* Only pages that belong to a specific category
|
|
@@ -45,6 +48,7 @@ Pimki added features:
|
|
|
45
48
|
* All pages: recently visited
|
|
46
49
|
* All pages: most often visited
|
|
47
50
|
* User definable wiki-text
|
|
51
|
+
* Added Glossary function: shows all acronyms defined in the web
|
|
48
52
|
* Expanded Search:
|
|
49
53
|
* Search also tries to match the page names (not just contents).
|
|
50
54
|
* Now showing part of sentance around match in search-results page
|
|
@@ -63,11 +67,16 @@ Pimki added features:
|
|
|
63
67
|
Command-line options:
|
|
64
68
|
Run "ruby pimki.rb --help"
|
|
65
69
|
|
|
66
|
-
Please note also that RedCloth (http://redcloth.rubyforge.org) is set to
|
|
67
|
-
version 2.0.11 by default. Version 3.0.1 is a bit experimental. You can select
|
|
68
|
-
which version of redcloth via --redcloth command line argument.
|
|
69
|
-
|
|
70
70
|
History:
|
|
71
|
+
|
|
72
|
+
1.7.092 New features
|
|
73
|
+
- Better control on multiple webs, including web administration and links between webs via [web_address[PageName]]
|
|
74
|
+
- Added Glossary function: shows all acronyms defined in the web
|
|
75
|
+
- Better export in anticipation of Pimki2
|
|
76
|
+
- Moved things back to the nav-bar
|
|
77
|
+
- Even more and better things at the web setup (edit_web) template
|
|
78
|
+
- Lots of bug fixes
|
|
79
|
+
|
|
71
80
|
1.6.092 Mainly bug fixes with some minor enhancements
|
|
72
81
|
- Squashed horrible restart bug
|
|
73
82
|
- Several bug fixes
|
data/app/controllers/wiki.rb
CHANGED
|
@@ -4,17 +4,27 @@ require "redcloth_for_tex"
|
|
|
4
4
|
RenderedTodo = Struct.new( :text, :context, :due_date )
|
|
5
5
|
|
|
6
6
|
class WikiController < ActionControllerServlet
|
|
7
|
-
EXPORT_DIRECTORY = WikiService.storage_path
|
|
7
|
+
EXPORT_DIRECTORY = WikiService.storage_path
|
|
8
8
|
|
|
9
9
|
def index
|
|
10
10
|
if web_address
|
|
11
|
-
|
|
11
|
+
check_external_req_and_redirect web
|
|
12
12
|
elsif !wiki.setup?
|
|
13
13
|
redirect_path "/new_system/"
|
|
14
14
|
elsif wiki.webs.length == 1
|
|
15
|
-
|
|
15
|
+
check_external_req_and_redirect wiki.webs.values.first
|
|
16
16
|
else
|
|
17
|
-
|
|
17
|
+
wiki.default_web ?
|
|
18
|
+
check_external_req_and_redirect(wiki.webs[wiki.default_web]) :
|
|
19
|
+
redirect_path("/web_list/")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def check_external_req_and_redirect web
|
|
24
|
+
if web.default_to_published and @req.addr[2] != @req.peeraddr[2]
|
|
25
|
+
redirect_action("published/", web.address)
|
|
26
|
+
else
|
|
27
|
+
redirect_show("HomePage", web.address)
|
|
18
28
|
end
|
|
19
29
|
end
|
|
20
30
|
|
|
@@ -166,8 +176,28 @@ class WikiController < ActionControllerServlet
|
|
|
166
176
|
redirect_path("/#{web_address}/bliki_revision/#{@bliki_results.first.name}?rev=#{@bliki_results.first.revisions.size-1}") if @results.length == 0 && @bliki_results.length == 1
|
|
167
177
|
render_action "search"
|
|
168
178
|
end
|
|
169
|
-
|
|
179
|
+
|
|
180
|
+
def glossary
|
|
181
|
+
set_menu_pages
|
|
182
|
+
|
|
183
|
+
rex = %r{([A-Z\d]+)\(([\w\s]+)\)}
|
|
184
|
+
scan_results = web.select.map { |page| [page.link, page.content.scan(rex)] }
|
|
185
|
+
scan_results += web.bliki.values.map { |entry| [link_to_bliki(entry), entry.content.scan(rex)] }
|
|
186
|
+
results = Hash.new { Array.new }
|
|
187
|
+
scan_results.each { |page, acronyms| acronyms.each { |ac| results[ac] += [page] } }
|
|
188
|
+
@results = results.map{ |(ac, df), pg|[[ac,df], pg.uniq] }.sort_by{ |(ac, df), pg| ac }
|
|
189
|
+
|
|
190
|
+
acronyms = @results.map { |(ac, df), pg| ac }
|
|
191
|
+
rex = %r{(#{acronyms.join('|')})[^\(]}
|
|
192
|
+
results = web.select.map { |page| [page.link, page.content.scan(rex)] }
|
|
193
|
+
results += web.bliki.values.map { |entry| [link_to_bliki(entry), entry.content.scan(rex)] }
|
|
194
|
+
@undefined_on = Hash.new { Array.new }
|
|
195
|
+
results.each { |page, acronyms| acronyms.each { |ac| @undefined_on[ac[0]] += [page] } }
|
|
196
|
+
@undefined_on = @undefined_on.inject({}) { |hsh, (k, v)| hsh[k] = v.uniq; hsh }
|
|
197
|
+
end
|
|
198
|
+
|
|
170
199
|
def authors
|
|
200
|
+
set_menu_pages
|
|
171
201
|
@authors = web.select.authors
|
|
172
202
|
end
|
|
173
203
|
|
|
@@ -178,7 +208,7 @@ class WikiController < ActionControllerServlet
|
|
|
178
208
|
end
|
|
179
209
|
|
|
180
210
|
def rss_with_content
|
|
181
|
-
@pages_by_revision = web.select.by_revision.first(15)
|
|
211
|
+
@pages_by_revision = @rss_bliki_only ? [] : web.select.by_revision.first(15)
|
|
182
212
|
@bliki_entries = web.bliki_entries_by_date
|
|
183
213
|
@uri = @req.request_uri
|
|
184
214
|
host = @req.meta_vars["HTTP_X_FORWARDED_HOST"] || "#{@uri.host}:#{@uri.port.to_s}"
|
|
@@ -191,7 +221,22 @@ class WikiController < ActionControllerServlet
|
|
|
191
221
|
@hide_description = true
|
|
192
222
|
rss_with_content
|
|
193
223
|
end
|
|
194
|
-
|
|
224
|
+
|
|
225
|
+
def rss_bliki_only
|
|
226
|
+
@rss_bliki_only = true
|
|
227
|
+
rss_with_content
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
def rss_todo_items
|
|
231
|
+
todo
|
|
232
|
+
@display_todo = true
|
|
233
|
+
rss_with_content
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
def feeds
|
|
237
|
+
set_menu_pages
|
|
238
|
+
end
|
|
239
|
+
|
|
195
240
|
def list
|
|
196
241
|
parse_category
|
|
197
242
|
set_menu_pages
|
|
@@ -200,16 +245,16 @@ class WikiController < ActionControllerServlet
|
|
|
200
245
|
@pages_that_are_orphaned = @pages_in_category.orphaned_pages
|
|
201
246
|
|
|
202
247
|
if @req.query['Action']
|
|
203
|
-
redirect_action 'list/' if web.check_pass_on_edit and not
|
|
248
|
+
# redirect_action 'list/' if web.check_pass_on_edit and not password_check(@params['password'])
|
|
204
249
|
|
|
205
250
|
case @req.query['Action']
|
|
206
251
|
when 'Delete' # Handle page deletion
|
|
207
252
|
wiki.delete_page(web_address, @req.query['del_sel_page_name'])
|
|
208
253
|
redirect_action "list/"
|
|
209
|
-
|
|
254
|
+
|
|
210
255
|
when 'Create' # Handle page creation
|
|
211
256
|
redirect_show @req.query['newpage']
|
|
212
|
-
|
|
257
|
+
|
|
213
258
|
when 'Rename' # Handle page rename
|
|
214
259
|
wiki.rename_page(web_address, @req.query['ren_sel_page_name'], @req.query['newpage'])
|
|
215
260
|
redirect_action "list/"
|
|
@@ -218,9 +263,13 @@ class WikiController < ActionControllerServlet
|
|
|
218
263
|
|
|
219
264
|
end
|
|
220
265
|
|
|
266
|
+
def export
|
|
267
|
+
set_menu_pages
|
|
268
|
+
end
|
|
269
|
+
|
|
221
270
|
def export_html
|
|
222
271
|
file_name = "#{web.address}-html-#{web.revised_on.strftime("%Y-%m-%d-%H-%M")}.zip"
|
|
223
|
-
file_path = EXPORT_DIRECTORY
|
|
272
|
+
file_path = File.join EXPORT_DIRECTORY, file_name
|
|
224
273
|
|
|
225
274
|
export_pages_to_zip_file(file_path) unless FileTest.exists?(file_path)
|
|
226
275
|
send_export(file_name, file_path)
|
|
@@ -228,7 +277,7 @@ class WikiController < ActionControllerServlet
|
|
|
228
277
|
|
|
229
278
|
def export_markup
|
|
230
279
|
file_name = "#{web.address}-markup-#{web.revised_on.strftime("%Y-%m-%d-%H-%M")}.zip"
|
|
231
|
-
file_path = EXPORT_DIRECTORY
|
|
280
|
+
file_path = File.join EXPORT_DIRECTORY, file_name
|
|
232
281
|
|
|
233
282
|
export_markup_to_zip_file(file_path) unless FileTest.exists?(file_path)
|
|
234
283
|
send_export(file_name, file_path)
|
|
@@ -236,7 +285,7 @@ class WikiController < ActionControllerServlet
|
|
|
236
285
|
|
|
237
286
|
def export_pdf
|
|
238
287
|
file_name = "#{web.address}-tex-#{web.revised_on.strftime('%Y-%m-%d-%H-%M')}"
|
|
239
|
-
file_path = EXPORT_DIRECTORY
|
|
288
|
+
file_path = File.join EXPORT_DIRECTORY, file_name
|
|
240
289
|
|
|
241
290
|
export_web_to_tex(file_path + ".tex") unless FileTest.exists?(file_path + ".tex")
|
|
242
291
|
convert_tex_to_pdf(file_path + ".tex")
|
|
@@ -245,7 +294,7 @@ class WikiController < ActionControllerServlet
|
|
|
245
294
|
|
|
246
295
|
def export_tex
|
|
247
296
|
file_name = "#{web.address}-tex-#{web.revised_on.strftime('%Y-%m-%d-%H-%M')}.tex"
|
|
248
|
-
file_path = EXPORT_DIRECTORY
|
|
297
|
+
file_path = File.join EXPORT_DIRECTORY, file_name
|
|
249
298
|
|
|
250
299
|
export_web_to_tex(file_path) unless FileTest.exists?(file_path)
|
|
251
300
|
send_export(file_name, file_path)
|
|
@@ -268,7 +317,8 @@ class WikiController < ActionControllerServlet
|
|
|
268
317
|
@params["color"], @params["additional_style"],
|
|
269
318
|
@params["safe_mode"] ? true : false,
|
|
270
319
|
@params["password"].empty? ? nil : @params["password"],
|
|
271
|
-
@params["published"] ? true : false,
|
|
320
|
+
@params["published"] ? true : false,
|
|
321
|
+
@params['default_to_published'] ? true : false,
|
|
272
322
|
@params["brackets_only"] ? true : false,
|
|
273
323
|
@params["count_pages"] ? true : false,
|
|
274
324
|
@params['mind_map_size'],
|
|
@@ -276,6 +326,7 @@ class WikiController < ActionControllerServlet
|
|
|
276
326
|
@params['links_map'],
|
|
277
327
|
@params['snapshots_interval'],
|
|
278
328
|
@params['enable_dclick_edit'],
|
|
329
|
+
@params['enable_menu'],
|
|
279
330
|
@params['check_pass_on_edit'] == 'each_edit',
|
|
280
331
|
@prog, @graph_type, @missing, @show_authors, @show_leaves, @selected_categories
|
|
281
332
|
)
|
|
@@ -285,30 +336,34 @@ class WikiController < ActionControllerServlet
|
|
|
285
336
|
|
|
286
337
|
def administrate
|
|
287
338
|
@logger.info "Taking administrative action: #{@params['action']}"
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
339
|
+
redirect_show 'HomePage' unless wiki.authenticate(@params['system_password'])
|
|
340
|
+
case @params['action']
|
|
341
|
+
when 'Delete Orphan Pages'
|
|
342
|
+
wiki.remove_orphaned_pages(web_address)
|
|
343
|
+
|
|
344
|
+
when 'Clear Render Cache'
|
|
345
|
+
clear_render_cache true
|
|
346
|
+
|
|
347
|
+
when 'Force Data Snapshot'
|
|
348
|
+
WikiService.take_snapshot
|
|
292
349
|
|
|
293
|
-
|
|
294
|
-
|
|
350
|
+
when 'Clean Storage'
|
|
351
|
+
WikiService.clean_old_snapshots
|
|
295
352
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
when 'Clean Storage'
|
|
300
|
-
WikiService.clean_old_snapshots
|
|
353
|
+
when 'Make This Web Default'
|
|
354
|
+
wiki.default_web = web_address
|
|
301
355
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
redirect_show 'HomePage'
|
|
356
|
+
when 'Remove This Web'
|
|
357
|
+
wiki.webs.delete web_address
|
|
358
|
+
redirect_path '/'
|
|
359
|
+
|
|
307
360
|
end
|
|
361
|
+
@message = 'Operation succeeded'
|
|
362
|
+
redirect_action 'edit_web/'
|
|
308
363
|
end
|
|
309
364
|
|
|
310
365
|
FAR_FUTURE = Date.new(4000,1,1).freeze
|
|
311
|
-
TODO_RE = %r{<todo-tag context='(.*?)' due_date='(.*?)'><span class="todo"><strong>TODO(
|
|
366
|
+
TODO_RE = %r{<todo-tag context='(.*?)' due_date='(.*?)'><span class="todo"><strong>TODO(?:[^:]*)?:</strong> (.*?)</span></todo-tag>}
|
|
312
367
|
|
|
313
368
|
def todo #{{{
|
|
314
369
|
parse_category
|
|
@@ -441,14 +496,14 @@ class WikiController < ActionControllerServlet
|
|
|
441
496
|
case @graph_type
|
|
442
497
|
when 'normal'
|
|
443
498
|
@pngFile, @mapFile = web.create_mind_map(@prog, @missing,
|
|
444
|
-
@show_authors, @show_leaves, @selected_categories)
|
|
499
|
+
@show_authors, @show_leaves, @selected_categories, @mm_size)
|
|
445
500
|
|
|
446
501
|
when 'author'
|
|
447
|
-
@pngFile, @mapFile = web.create_author_graph(@prog, @selected_categories)
|
|
502
|
+
@pngFile, @mapFile = web.create_author_graph(@prog, @selected_categories, @mm_size)
|
|
448
503
|
|
|
449
504
|
when 'category'
|
|
450
505
|
@pngFile, @mapFile = web.create_category_graph(@prog,
|
|
451
|
-
@show_authors, @selected_categories)
|
|
506
|
+
@show_authors, @selected_categories, @mm_size)
|
|
452
507
|
end
|
|
453
508
|
end #}}}
|
|
454
509
|
|
|
@@ -460,6 +515,7 @@ class WikiController < ActionControllerServlet
|
|
|
460
515
|
@show_authors = web.mm_show_authors
|
|
461
516
|
@show_leaves = web.mm_show_leaves
|
|
462
517
|
@selected_categories = web.mm_selected_categories
|
|
518
|
+
@mm_size = web.mind_map_size
|
|
463
519
|
else
|
|
464
520
|
@prog = @req.query['draw_type'] || 'neato'
|
|
465
521
|
@graph_type = @req.query['graph_type'] || 'normal'
|
|
@@ -469,6 +525,7 @@ class WikiController < ActionControllerServlet
|
|
|
469
525
|
|
|
470
526
|
@selected_categories = parse_multi_select 'selected_categs'
|
|
471
527
|
@selected_categories = [] if @selected_categories.include? 'all'
|
|
528
|
+
@mm_size = @params['mind_map_size'] || web.mind_map_size
|
|
472
529
|
end
|
|
473
530
|
end #}}}
|
|
474
531
|
|
|
@@ -487,6 +544,7 @@ class WikiController < ActionControllerServlet
|
|
|
487
544
|
@menu_content = web.menu_content
|
|
488
545
|
@list_limit = web.menu_limit
|
|
489
546
|
@list_limit += 1 if @list_limit >= -1
|
|
547
|
+
@author = default_author
|
|
490
548
|
end #}}}
|
|
491
549
|
|
|
492
550
|
def save_menu #{{{
|
|
@@ -506,20 +564,7 @@ class WikiController < ActionControllerServlet
|
|
|
506
564
|
wiki.save_menu_pref(web_address, type, limit, content, category, Author.new(author, remote_ip))
|
|
507
565
|
end
|
|
508
566
|
|
|
509
|
-
|
|
510
|
-
if web_address
|
|
511
|
-
pname = begin
|
|
512
|
-
web.select{ true }.by_last_visited.first.name
|
|
513
|
-
rescue
|
|
514
|
-
"HomePage"
|
|
515
|
-
end
|
|
516
|
-
redirect_show pname
|
|
517
|
-
elsif wiki.webs.length == 1
|
|
518
|
-
# only one web, so go there.
|
|
519
|
-
redirect_show "HomePage", wiki.webs.values.first.address
|
|
520
|
-
else
|
|
521
|
-
redirect_path "/web_list/"
|
|
522
|
-
end
|
|
567
|
+
redirect_action 'edit_web/' # go back to web options page
|
|
523
568
|
end #}}}
|
|
524
569
|
|
|
525
570
|
def get_map_img
|
|
@@ -528,6 +573,11 @@ class WikiController < ActionControllerServlet
|
|
|
528
573
|
send_export(file_name, file_path, "image/png")
|
|
529
574
|
end
|
|
530
575
|
|
|
576
|
+
def adv_search
|
|
577
|
+
parse_category
|
|
578
|
+
set_menu_pages
|
|
579
|
+
end
|
|
580
|
+
|
|
531
581
|
# Within a single page --------------------------------------------------------
|
|
532
582
|
|
|
533
583
|
def show
|
|
@@ -571,7 +621,7 @@ class WikiController < ActionControllerServlet
|
|
|
571
621
|
page = wiki.read_page(web_address, page_name)
|
|
572
622
|
safe_page_name = page.name.gsub(/\W/, "")
|
|
573
623
|
file_name = "#{safe_page_name}-#{web.address}-#{page.created_at.strftime("%Y-%m-%d-%H-%M")}"
|
|
574
|
-
file_path = EXPORT_DIRECTORY
|
|
624
|
+
file_path = File.join EXPORT_DIRECTORY, file_name
|
|
575
625
|
|
|
576
626
|
export_page_to_tex(file_path + ".tex") unless FileTest.exists?(file_path + ".tex")
|
|
577
627
|
convert_tex_to_pdf(file_path + ".tex")
|
|
@@ -579,7 +629,7 @@ class WikiController < ActionControllerServlet
|
|
|
579
629
|
end
|
|
580
630
|
|
|
581
631
|
def new
|
|
582
|
-
redirect_show("HomePage") if web.check_pass_on_edit and not
|
|
632
|
+
# redirect_show("HomePage") if web.check_pass_on_edit and not password_check(@params['password'])
|
|
583
633
|
@page_name, @author = page_name, default_author
|
|
584
634
|
end
|
|
585
635
|
|
|
@@ -602,10 +652,10 @@ class WikiController < ActionControllerServlet
|
|
|
602
652
|
end
|
|
603
653
|
|
|
604
654
|
def save
|
|
605
|
-
if web.check_pass_on_edit and not
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
end
|
|
655
|
+
# if web.check_pass_on_edit and not password_check(@params['password'])
|
|
656
|
+
# wiki.read_page(web_address, page_name).unlock if web.pages[page_name]
|
|
657
|
+
# redirect_show("HomePage")
|
|
658
|
+
# end
|
|
609
659
|
|
|
610
660
|
if web.pages[page_name]
|
|
611
661
|
page = wiki.revise_page(
|
|
@@ -626,12 +676,14 @@ class WikiController < ActionControllerServlet
|
|
|
626
676
|
end
|
|
627
677
|
|
|
628
678
|
def revision
|
|
679
|
+
redirect_show 'HomePage' if page_name.nil?
|
|
680
|
+
set_menu_pages
|
|
629
681
|
@page = wiki.read_page(web_address, page_name)
|
|
630
682
|
@revision = @page.revisions[@params["rev"].to_i]
|
|
631
683
|
end
|
|
632
684
|
|
|
633
685
|
def rollback
|
|
634
|
-
redirect_show("HomePage") if web.check_pass_on_edit and not
|
|
686
|
+
# redirect_show("HomePage") if web.check_pass_on_edit and not password_check(@params['password'])
|
|
635
687
|
|
|
636
688
|
@page = wiki.read_page(web_address, page_name)
|
|
637
689
|
@revision = @page.revisions[@params["rev"].to_i]
|
|
@@ -640,14 +692,14 @@ class WikiController < ActionControllerServlet
|
|
|
640
692
|
# Bliki ----------------------------------------------------------------------
|
|
641
693
|
|
|
642
694
|
def bliki_delete
|
|
643
|
-
redirect_bliki if web.check_pass_on_edit and not
|
|
695
|
+
# redirect_bliki if web.check_pass_on_edit and not password_check(@params['password'])
|
|
644
696
|
|
|
645
697
|
wiki.delete_bliki_entry(web_address, page_name)
|
|
646
698
|
redirect_bliki
|
|
647
699
|
end
|
|
648
700
|
|
|
649
701
|
def bliki_edit
|
|
650
|
-
redirect_bliki if web.check_pass_on_edit and not
|
|
702
|
+
# redirect_bliki if web.check_pass_on_edit and not password_check(@params['password'])
|
|
651
703
|
|
|
652
704
|
@page = wiki.read_bliki_entry(web_address, page_name)
|
|
653
705
|
|
|
@@ -656,7 +708,8 @@ class WikiController < ActionControllerServlet
|
|
|
656
708
|
@author = default_author
|
|
657
709
|
render
|
|
658
710
|
else
|
|
659
|
-
|
|
711
|
+
@bliki_entry = true
|
|
712
|
+
render "wiki/locked"
|
|
660
713
|
end
|
|
661
714
|
end
|
|
662
715
|
|
|
@@ -666,8 +719,13 @@ class WikiController < ActionControllerServlet
|
|
|
666
719
|
redirect_bliki
|
|
667
720
|
end
|
|
668
721
|
|
|
722
|
+
def bliki_new
|
|
723
|
+
@entry_name = @params['entry_name']
|
|
724
|
+
@author = default_author
|
|
725
|
+
end
|
|
726
|
+
|
|
669
727
|
def bliki_save
|
|
670
|
-
redirect_bliki if web.check_pass_on_edit and not
|
|
728
|
+
# redirect_bliki if web.check_pass_on_edit and not password_check(@params['password'])
|
|
671
729
|
|
|
672
730
|
pname = page_name || @params["pagename"]
|
|
673
731
|
if web.bliki[pname]
|
|
@@ -689,7 +747,7 @@ class WikiController < ActionControllerServlet
|
|
|
689
747
|
end
|
|
690
748
|
|
|
691
749
|
def rollback_bliki
|
|
692
|
-
redirect_bliki if web.check_pass_on_edit and not
|
|
750
|
+
# redirect_bliki if web.check_pass_on_edit and not password_check(@params['password'])
|
|
693
751
|
|
|
694
752
|
@page = wiki.read_bliki_entry(web_address, page_name)
|
|
695
753
|
wiki.rollback_bliki_entry(web_address, page_name, @params["rev"].to_i, Time.now)
|
|
@@ -777,6 +835,21 @@ class WikiController < ActionControllerServlet
|
|
|
777
835
|
zos.put_next_entry(@page.name + ".html")
|
|
778
836
|
zos.puts(template_engine("print").result(binding))
|
|
779
837
|
end
|
|
838
|
+
|
|
839
|
+
zos.put_next_entry "pages-metadata.txt"
|
|
840
|
+
web.select.by_name.each do |page|
|
|
841
|
+
zos.puts "#{page.name}: by #{page.author}, created on #{page.pretty_created_at}"
|
|
842
|
+
end
|
|
843
|
+
|
|
844
|
+
web.select_bliki.by_name.each do |@page|
|
|
845
|
+
zos.put_next_entry("bliki/#{@page.name}.html")
|
|
846
|
+
zos.puts(template_engine("print").result(binding))
|
|
847
|
+
end
|
|
848
|
+
|
|
849
|
+
zos.put_next_entry "bliki/bliki-metadata.txt"
|
|
850
|
+
web.select_bliki.by_name.each do |page|
|
|
851
|
+
zos.puts "#{page.name}: by #{page.author}, created on #{page.revisions.first.pretty_created_at}"
|
|
852
|
+
end
|
|
780
853
|
|
|
781
854
|
zos.put_next_entry("index.html")
|
|
782
855
|
zos.puts('<html><head><META HTTP-EQUIV="Refresh" CONTENT="0;URL=HomePage.html"></head></html>')
|
|
@@ -789,6 +862,21 @@ class WikiController < ActionControllerServlet
|
|
|
789
862
|
zos.put_next_entry(page.name + ".#{web.markup}")
|
|
790
863
|
zos.puts(page.content)
|
|
791
864
|
end
|
|
865
|
+
|
|
866
|
+
zos.put_next_entry "pages-metadata.txt"
|
|
867
|
+
web.select.by_name.each do |page|
|
|
868
|
+
zos.puts "#{page.name}: by #{page.author}, created on #{page.pretty_created_at}"
|
|
869
|
+
end
|
|
870
|
+
|
|
871
|
+
web.select_bliki.by_name.each do |page|
|
|
872
|
+
zos.put_next_entry("bliki/#{page.name}.#{web.markup}")
|
|
873
|
+
zos.puts(page.content)
|
|
874
|
+
end
|
|
875
|
+
|
|
876
|
+
zos.put_next_entry "bliki/bliki-metadata.txt"
|
|
877
|
+
web.select_bliki.by_name.each do |page|
|
|
878
|
+
zos.puts "#{page.name}: by #{page.author}, created on #{page.revisions.first.pretty_created_at}"
|
|
879
|
+
end
|
|
792
880
|
end
|
|
793
881
|
end
|
|
794
882
|
|
|
@@ -799,10 +887,17 @@ class WikiController < ActionControllerServlet
|
|
|
799
887
|
end
|
|
800
888
|
|
|
801
889
|
def render_tex_web
|
|
802
|
-
web.select.by_name.inject({}) do |tex_web, page|
|
|
890
|
+
pages = web.select.by_name.inject({}) do |tex_web, page|
|
|
803
891
|
tex_web[page.name] = RedClothForTex.new(page.content).to_tex
|
|
804
892
|
tex_web
|
|
805
893
|
end
|
|
894
|
+
|
|
895
|
+
bliki_entries = web.select_bliki.by_name.inject({}) do |tex_web, page|
|
|
896
|
+
tex_web["bliki/#{page.name}"] = RedClothForTex.new(page.content).to_tex
|
|
897
|
+
tex_web
|
|
898
|
+
end
|
|
899
|
+
|
|
900
|
+
pages.update bliki_entries
|
|
806
901
|
end
|
|
807
902
|
|
|
808
903
|
def export_page_to_tex(file_path)
|