Pimki 1.3.092 → 1.4.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 +145 -131
- data/README-PIMKI +15 -5
- data/app/controllers/wiki.rb +167 -54
- data/app/models/author.rb +3 -3
- data/app/models/chunks/chunk.rb +3 -3
- data/app/models/chunks/engines.rb +18 -21
- data/app/models/chunks/include.rb +29 -29
- data/app/models/chunks/literal.rb +20 -20
- data/app/models/chunks/match.rb +19 -19
- data/app/models/chunks/nowiki.rb +31 -31
- data/app/models/chunks/nowiki_test.rb +14 -14
- data/app/models/chunks/test.rb +18 -18
- data/app/models/chunks/todo.rb +44 -23
- data/app/models/chunks/uri.rb +97 -97
- data/app/models/chunks/uri_test.rb +92 -92
- data/app/models/chunks/wiki.rb +4 -4
- data/app/models/chunks/wiki_symbols.rb +22 -22
- data/app/models/chunks/wiki_test.rb +36 -36
- data/app/models/page.rb +39 -7
- data/app/models/page_lock.rb +23 -23
- data/app/models/page_set.rb +72 -72
- data/app/models/page_test.rb +75 -75
- data/app/models/revision.rb +1 -1
- data/app/models/revision_test.rb +251 -251
- data/app/models/web.rb +19 -6
- data/app/models/web_test.rb +52 -52
- data/app/models/wiki_content.rb +131 -119
- data/app/models/wiki_service.rb +31 -16
- data/app/models/wiki_service_test.rb +15 -15
- data/app/models/wiki_words.rb +1 -1
- data/app/models/wiki_words_test.rb +12 -12
- data/app/views/bottom.rhtml +3 -3
- data/app/views/markdown_help.rhtml +15 -15
- data/app/views/menu.rhtml +20 -20
- data/app/views/navigation.rhtml +26 -26
- data/app/views/rdoc_help.rhtml +15 -15
- data/app/views/static_style_sheet.rhtml +237 -237
- data/app/views/style.rhtml +178 -178
- data/app/views/textile_help.rhtml +27 -27
- data/app/views/top.rhtml +7 -2
- data/app/views/wiki/authors.rhtml +15 -15
- data/app/views/wiki/bliki.rhtml +101 -101
- data/app/views/wiki/bliki_edit.rhtml +3 -0
- data/app/views/wiki/bliki_new.rhtml +3 -0
- data/app/views/wiki/bliki_revision.rhtml +90 -90
- data/app/views/wiki/edit.rhtml +12 -3
- data/app/views/wiki/edit_menu.rhtml +64 -47
- data/app/views/wiki/edit_web.rhtml +65 -18
- data/app/views/wiki/export.rhtml +14 -14
- data/app/views/wiki/feeds.rhtml +10 -10
- data/app/views/wiki/list.rhtml +17 -15
- data/app/views/wiki/locked.rhtml +13 -13
- data/app/views/wiki/login.rhtml +10 -10
- data/app/views/wiki/mind.rhtml +0 -1
- data/app/views/wiki/new.rhtml +8 -3
- data/app/views/wiki/new_system.rhtml +77 -77
- data/app/views/wiki/new_web.rhtml +63 -63
- data/app/views/wiki/page.rhtml +88 -82
- data/app/views/wiki/print.rhtml +15 -15
- data/app/views/wiki/published.rhtml +2 -1
- data/app/views/wiki/recently_revised.rhtml +31 -31
- data/app/views/wiki/revision.rhtml +1 -7
- data/app/views/wiki/rollback.rhtml +31 -0
- data/app/views/wiki/rss_feed.rhtml +21 -21
- data/app/views/wiki/search.rhtml +48 -48
- data/app/views/wiki/tex.rhtml +22 -22
- data/app/views/wiki/tex_web.rhtml +34 -34
- data/app/views/wiki/todo.rhtml +90 -67
- data/app/views/wiki/web_list.rhtml +12 -12
- data/app/views/wiki_words_help.rhtml +1 -1
- data/favicon.png +0 -0
- data/libraries/action_controller_servlet.rb +17 -2
- data/libraries/bluecloth.rb +1127 -1127
- data/libraries/diff/diff.rb +474 -474
- data/libraries/diff/diff_test.rb +79 -79
- data/libraries/erb.rb +490 -490
- data/libraries/madeleine/automatic.rb +418 -357
- data/libraries/madeleine/clock.rb +94 -94
- data/libraries/madeleine/files.rb +19 -0
- data/libraries/madeleine/zmarshal.rb +60 -0
- data/libraries/madeleine_service.rb +14 -15
- data/libraries/rdocsupport.rb +155 -155
- data/libraries/redcloth_for_tex.rb +869 -869
- data/libraries/redcloth_for_tex_test.rb +40 -40
- data/libraries/view_helper.rb +32 -32
- data/libraries/web_controller_server.rb +96 -94
- data/pimki.rb +47 -6
- metadata +18 -4
data/README
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
|
2
|
-
What is Instiki?
|
3
|
-
================
|
1
|
+
===What is Instiki?
|
4
2
|
|
5
|
-
Admitted, it's
|
3
|
+
Admitted, it's YetAnotherWikiClone[http://c2.com/cgi/wiki?WikiWikiClones], but with a strong focus
|
6
4
|
on simplicity of installation and running:
|
7
5
|
|
8
6
|
Step 1. Download
|
9
|
-
|
10
|
-
Step
|
7
|
+
|
8
|
+
Step 2. Run "instiki"
|
9
|
+
|
10
|
+
Step 3. Chuckle... "There's no step three!" (TM)
|
11
11
|
|
12
12
|
You're now running a perfectly suitable wiki on port 2500
|
13
13
|
that'll present you with one-step setup, followed by a textarea for the home page
|
@@ -18,7 +18,7 @@ using a wiki. It's so simple to get running that you'll find yourself
|
|
18
18
|
using it for anything -- taking notes, brainstorming, organizing a
|
19
19
|
gathering.
|
20
20
|
|
21
|
-
Features:
|
21
|
+
===Features:
|
22
22
|
* Regular expression search: Find deep stuff really fast
|
23
23
|
* Revisions: Follow the changes on every page from birth. Rollback to an earlier rev
|
24
24
|
* Export to HTML or markup in a zip: Take the entire wiki with you home or for reference
|
@@ -27,132 +27,146 @@ Features:
|
|
27
27
|
* Password-protected webs: Keep it private
|
28
28
|
* Authors: Each revision is associated with an author, so you can see who changed what
|
29
29
|
* Reference tracker: Which other pages are pointing to the current?
|
30
|
-
* Speed: Using Madelein for persistence (all pages are in memory)
|
31
|
-
* Three markup choices: Textile
|
32
|
-
|
30
|
+
* Speed: Using Madelein[http://madeleine.sourceforge.net] for persistence (all pages are in memory)
|
31
|
+
* Three markup choices: Textile[http://www.textism.com/tools/textile]
|
32
|
+
(default / RedCloth[http://www.whytheluckystiff.net/ruby/redcloth]),
|
33
|
+
Markdown (BlueCloth[http://bluecloth.rubyforge.org]), and RDoc[http://rdoc.sourceforge.net/doc]
|
34
|
+
* Embedded webserver: Through WEBrick[http://www.webrick.org]
|
33
35
|
* Internationalization: Wiki words in any latin, greek, cyrillian, or armenian characters
|
34
36
|
* Color diffs: Track changes through revisions
|
35
37
|
|
36
|
-
Missing:
|
38
|
+
===Missing:
|
37
39
|
* File attachments
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
*
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
*
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
* 0.
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
* 0.
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
41
|
+
===Install from gem:
|
42
|
+
* Install rubygems
|
43
|
+
* Run "gem install instiki"
|
44
|
+
* Change to a directory where you want Instiki to keep its data files (for example, ~/instiki/)
|
45
|
+
* Run "instiki" - this will create a "storage" directory (for example, ~/instiki/storage), and start a new Wiki service
|
46
|
+
|
47
|
+
Make sure that you always launch Instiki from the same working directory, or specify the storage directory in runtime parameters, such as:
|
48
|
+
instiki --storage ~/instiki/storage
|
49
|
+
|
50
|
+
===Command-line options:
|
51
|
+
* Run "instiki --help"
|
52
|
+
|
53
|
+
===History:
|
54
|
+
* 0.9.2: Rollback takes the user to an edit form. The form has to be submitted for the change to take place.
|
55
|
+
Changed to use inline style on published pages
|
56
|
+
Fixed "forward in time" on the last revision before current page
|
57
|
+
Instiki won't log bogus error messages when creating a new Wiki.
|
58
|
+
Fixed deprecation warning for Object.id (introduced in Ruby 1.8.2)
|
59
|
+
Madeleine upgraded to 0.7.1
|
60
|
+
Madeleine snapshots are compressed
|
61
|
+
Packaged as a gem
|
62
|
+
* 0.9.1: Added performance improvements for updating existing pages
|
63
|
+
Fixed IP logging and RSS feeds behind proxies [With help from Guan Yang]
|
64
|
+
Fixed default storage directory (borked running on Windows) [Spotted by Curt Hibbs]
|
65
|
+
* 0.9.0: Added aliased links such as [[HomePage|that nice home page]] [Mark Reid]
|
66
|
+
Added include other page content with [[!include TableOfContents]] [Mark Reid]
|
67
|
+
Added delete orphan pages from the Edit Web screen [by inspiration from Simon Arnaud]
|
68
|
+
Added logging of IP address for authors (who's behind the rollback wars)
|
69
|
+
Added Categories pages through backlinks (use "categories: news, instiki" on start of line) [Mark Reid]
|
70
|
+
Added option to use bracket-style wiki links only (and hence ban WikiWords)
|
71
|
+
Added command-line option to specify different storage path
|
72
|
+
Added print view without navigation
|
73
|
+
Added character and page (2275 characters including spaces) counter (important for student papers)
|
74
|
+
Off by default, activate it on the Edit Web screen
|
75
|
+
Added LaTeX/PDF integration on Textile installations with pdflatex installed on system (EXPERIMENTAL)
|
76
|
+
Use the home page as a table of contents with a unordered list to control sections
|
77
|
+
Added limit of 15 to the number of pages included in RSS feed
|
78
|
+
Moved static parts of stylesheet to separate file [Lau T�rnskov]
|
79
|
+
Fixed better semantics for revision movement [Ryan Singer]
|
80
|
+
Fixed color diffs to work much better [Xen/Mertz/Atkins]
|
81
|
+
Fixed performance problems for All Pages list [Dennis Mertz]
|
82
|
+
Fixed lots of rendering bugs [Mark Reid]
|
83
|
+
Upgraded to RedCloth 2.0.11 [integrating the fine work of Dennis Mertz]
|
84
|
+
* 0.8.9: Added color diffs to see changes between revisions [Bill Atkins]
|
85
|
+
They're aren't quite perfect yet as new paragraphs split the <ins> tags (hence 0.8.9, not 0.9.0)
|
86
|
+
Added redirect to edit if content of page generates an error
|
87
|
+
(so the page doesn't become unusable on bugs in the markup engines)
|
88
|
+
Fixed update Web with different address bug [Denis Metz]
|
89
|
+
Fixed a bunch of wiki word rendering issues by doing wiki word detection and replacment at once
|
90
|
+
Upgraded to BlueCloth 0.0.3b (should fix loads of problems on Markdown wikis)
|
91
|
+
* 0.8.5: Instiki can now serve as a CMS by running a password-protected web with a published front
|
92
|
+
Added version check at startup (Instiki needs Ruby 1.8.1)
|
93
|
+
* 0.8.1: Actually included RedCloth 2.0.7 in the release
|
94
|
+
* 0.8.0: NOTE: Single-web wikis created in versions prior to 0.8.0 have "instiki" as their system password
|
95
|
+
Accepts wiki words in bracket style. Ex: [[wiki word]], [[c]], [[We could'nt have done it!]]
|
96
|
+
Accepts camel-case wiki words in all latin, greek, cyrillian, and armenian unicode characters
|
97
|
+
Many thanks to Guan Yang for building the higher- and lower-case lookup tables
|
98
|
+
And thanks to Simon Arnaud for the initial patch that got the work started
|
99
|
+
Changed charset to UTF-8
|
100
|
+
Cut down on command-line options and replaced them with an per-web config screen
|
101
|
+
Added option to extend the stylesheet on a per-web basis to tweak the look in details
|
102
|
+
Added simple color options for variety
|
103
|
+
Added option to add/remove password protection on each web
|
104
|
+
Added the wiki name of the author locking a given page (instead of just "someone")
|
105
|
+
Removed single/multi-web distinction -- all Instikis are now multi-web
|
106
|
+
Load libraries from an unshifted load path, so that old installed libraries doesn't clash [Emiel van de Laar]
|
107
|
+
Keeps the author cookie forever, so you don't have to enter your name again and again
|
108
|
+
Fixed XHTML so it validates [Bruce D'Arcus]
|
109
|
+
Authors are no longer listed under orphan pages
|
110
|
+
Added export to markup (great for backups, potentially for switching wiki engine)
|
111
|
+
Don't link wiki words that proceeds from either /, = or ?
|
112
|
+
(http://c2.com/cgi/wiki?WikiWikiClones, /show/HomePage, cgi.pl?show=WikiWord without escaping)
|
113
|
+
Accessing an unexisting page redirects to a different url (/new/PageName)
|
114
|
+
Increased snapshot time to just once a day (cuts down on disk storage requirements)
|
115
|
+
Made RDoc support work better with 1.8.1 [Mauricio Fern�ndez]
|
116
|
+
Added convinient redirect from /wiki/ to /wiki/show/HomePage
|
117
|
+
Fixed BlueCloth bug with backticks at start of line
|
118
|
+
Updated to RedCloth 2.0.7 (and linked to the new Textile reference)
|
119
|
+
* 0.7.0: Added Markdown (BlueCloth) and RDoc [Mauricio Fern�ndez] as command-line markup choices
|
120
|
+
Added wanted and orphan page lists to All pages (only show up if there's actually orphan or wanted pages)
|
121
|
+
Added ISO-8859-1 as XML encoding in RSS feeds (makes FeedReader among others happy for special entities)
|
122
|
+
Added proper links in the RSS feed (but the body links are still relative, which NNW and others doesn't grok)
|
123
|
+
Added access keys: E => Edit, H => HomePage, A => All Pages, U => Recently Revised, X => Export
|
124
|
+
Added password-login through URL (so you can subscribe to feed on a protected web)
|
125
|
+
Added web passwords to the feed links for protected webs, so they work without manual login
|
126
|
+
Added the web name in small letters above all pages within a web
|
127
|
+
Polished authors and recently revised
|
128
|
+
Updated to RedCloth 2.0.6
|
129
|
+
Changed content type for RSS feeds to text/xml (makes Mozilla Aggreg8 happy)
|
130
|
+
Changed searching to be case insensitive
|
131
|
+
Changed HomePage to display the name of the web instead
|
132
|
+
Changed exported HTML pages to be valid XHTML (which can be preprocessed by XSLT)
|
133
|
+
Fixed broken recently revised
|
134
|
+
* 0.6.0: Fixed Windows compatibility [Florian]
|
135
|
+
Fixed bug that would prevent Madeleine from taking snapshots in Daemon mode
|
136
|
+
Added export entire web as HTML in a zip file
|
137
|
+
Added RSS feeds
|
138
|
+
Added proper getops support for the growing number of options [Florian]
|
139
|
+
Added safe mode that forbids style options in RedCloth [Florian]
|
140
|
+
Updated RedCloth to 2.0.5
|
141
|
+
* 0.5.0: NOTE: 0.5.0 is NOT compatible with databases from earlier versions
|
142
|
+
Added revisions
|
143
|
+
Added multiple webs
|
144
|
+
Added password protection for webs on multi-web setups
|
145
|
+
Added the notion of authors (that are saved in a cookie)
|
146
|
+
Added command-line option for not running as a Daemon on Unix
|
147
|
+
* 0.3.1: Added option to escape wiki words with \
|
148
|
+
* 0.3.0: Brought all files into common style (including Textile help on the edit page)
|
149
|
+
Added page locking (if someone already is editing a page there's a warning)
|
150
|
+
Added daemon abilities on Unix (keep Instiki running after you close the terminal)
|
151
|
+
Made port 2500 the default port, so Instiki can be launched by dobbelt-click
|
152
|
+
Added Textile cache to speed-up rendering of large pages
|
153
|
+
Made WikiWords look like "Wiki Words"
|
154
|
+
Updated RedCloth to 2.0.4
|
155
|
+
* 0.2.5: Upgraded to RedCloth 2.0.2 and Madeleine 0.6.1, which means the
|
156
|
+
Windows problems are gone. Also fixed a problem with wikiwords
|
157
|
+
that used part of other wikiwords.
|
158
|
+
* 0.2.0: First public release
|
159
|
+
|
160
|
+
===Download latest from:
|
161
|
+
* http://rubyforge.org/project/showfiles.php?group_id=186
|
162
|
+
|
163
|
+
===Visit the official Instiki wiki:
|
164
|
+
* http://www.instiki.org
|
165
|
+
|
166
|
+
===License:
|
167
|
+
* same as Ruby's
|
168
|
+
|
169
|
+
---
|
170
|
+
Author:: David Heinemeier Hansson
|
171
|
+
Email:: david@loudthinking.com
|
172
|
+
Weblog:: http://www.loudthinking.com
|
data/README-PIMKI
CHANGED
@@ -52,20 +52,30 @@ Pimki added features:
|
|
52
52
|
Moved to bottom of Home Page.
|
53
53
|
* Minor stylesheet tweaks.
|
54
54
|
|
55
|
-
|
55
|
+
ToDo:
|
56
56
|
|
57
|
-
* Expand todo with
|
58
|
-
*
|
57
|
+
* Expand todo with @Context
|
58
|
+
* Advanced Search
|
59
|
+
* Advanced Search options (not just regexp, case sensitivity etc)
|
59
60
|
* Highlight match on individual page when clicked form search results
|
60
|
-
* Advanced Search (not just regexp, case sensitivity)?
|
61
61
|
* Editable left-side menu options: by search results? by author?
|
62
|
-
* Bliki entries revision diff.
|
63
62
|
|
64
63
|
|
65
64
|
Command-line options:
|
66
65
|
Run "ruby pimki.rb --help"
|
67
66
|
|
68
67
|
History:
|
68
|
+
1.4.092 New features release
|
69
|
+
- Added a major/minor edit override for the default 'continous edit' when
|
70
|
+
revising a page.
|
71
|
+
- MarkDown can now be through RedCloth 3.0.0 (experimental) or BlueCloth.
|
72
|
+
- Integrated Instiki release 0.9.2 features and bug fixes.
|
73
|
+
- Todo@Context
|
74
|
+
- Edit page on double click (based on Mark Reid's patch to Instiki)
|
75
|
+
- Possibility to require edit password for each edit
|
76
|
+
- Persist user changes to free-wiki menu content
|
77
|
+
- Numerous bug fixes.
|
78
|
+
|
69
79
|
1.3.092 New features and bug fixes release
|
70
80
|
- Updated to RedCloth v3.0.0.
|
71
81
|
- Fixed problem with incorrect handling of some complex link formats and
|
data/app/controllers/wiki.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require "cgi"
|
2
2
|
require "redcloth_for_tex"
|
3
3
|
|
4
|
+
RenderedTodo = Struct.new( :text, :context, :due_date )
|
5
|
+
|
4
6
|
class WikiController < ActionControllerServlet
|
5
7
|
EXPORT_DIRECTORY = WikiService.storage_path unless const_defined?("EXPORT_DIRECTORY")
|
6
8
|
|
@@ -112,17 +114,22 @@ class WikiController < ActionControllerServlet
|
|
112
114
|
@pages_by_name = @pages_in_category.by_name
|
113
115
|
@page_names_that_are_wanted = @pages_in_category.wanted_pages
|
114
116
|
@pages_that_are_orphaned = @pages_in_category.orphaned_pages
|
115
|
-
case @req.query['Action']
|
116
|
-
when 'Delete' # Handle page deletion
|
117
|
-
wiki.delete_page(web_address, @req.query['sel_page_name'])
|
118
|
-
redirect_action "list/"
|
119
|
-
|
120
|
-
when 'Create' # Handle page creation
|
121
|
-
redirect_show @req.query['newpage']
|
122
117
|
|
123
|
-
|
124
|
-
|
125
|
-
|
118
|
+
if @req.query['Action']
|
119
|
+
redirect_action 'list/' if web.check_pass_on_edit and not authenticate
|
120
|
+
|
121
|
+
case @req.query['Action']
|
122
|
+
when 'Delete' # Handle page deletion
|
123
|
+
wiki.delete_page(web_address, @req.query['sel_page_name'])
|
124
|
+
redirect_action "list/"
|
125
|
+
|
126
|
+
when 'Create' # Handle page creation
|
127
|
+
redirect_show @req.query['newpage']
|
128
|
+
|
129
|
+
when 'Rename' # Handle page rename
|
130
|
+
wiki.rename_page(web_address, @req.query['sel_page_name'], @req.query['newpage'])
|
131
|
+
redirect_action "list/"
|
132
|
+
end
|
126
133
|
end
|
127
134
|
|
128
135
|
end
|
@@ -160,9 +167,16 @@ class WikiController < ActionControllerServlet
|
|
160
167
|
send_export(file_name, file_path)
|
161
168
|
end
|
162
169
|
|
170
|
+
def edit_web #{{{
|
171
|
+
parse_category
|
172
|
+
set_mm_options
|
173
|
+
end #}}}
|
174
|
+
|
163
175
|
def update_web
|
164
176
|
redirect_show("HomePage") unless wiki.authenticate(@params["system_password"])
|
165
177
|
|
178
|
+
set_mm_options
|
179
|
+
|
166
180
|
wiki.update_web(
|
167
181
|
web.address, @params["address"], @params["name"],
|
168
182
|
@params["markup"].intern,
|
@@ -174,7 +188,10 @@ class WikiController < ActionControllerServlet
|
|
174
188
|
@params["count_pages"] ? true : false,
|
175
189
|
@params['mind_map_size'],
|
176
190
|
@params['symbols_map'],
|
177
|
-
@params['links_map']
|
191
|
+
@params['links_map'],
|
192
|
+
@params['enable_dclick_edit'],
|
193
|
+
@params['check_pass_on_edit'] == 'each_edit',
|
194
|
+
@prog, @graph_type, @missing, @show_authors, @show_leaves, @selected_categories
|
178
195
|
)
|
179
196
|
|
180
197
|
redirect_show("HomePage", @params["address"])
|
@@ -189,29 +206,85 @@ class WikiController < ActionControllerServlet
|
|
189
206
|
end
|
190
207
|
end
|
191
208
|
|
209
|
+
FAR_FUTURE = Date.new(4000,1,1).freeze
|
210
|
+
TODO_RE = %r{<todo-tag context='(.*?)' due_date='(.*?)'><span class="todo"><strong>TODO(?:.*)?:</strong> (.*?)</span></todo-tag>}
|
211
|
+
|
192
212
|
def todo #{{{
|
193
213
|
parse_category
|
194
214
|
set_menu_pages
|
195
|
-
|
196
|
-
@
|
197
|
-
@
|
198
|
-
|
199
|
-
|
215
|
+
|
216
|
+
@context = @params['context']
|
217
|
+
@sort_order = @params['sort_order']
|
218
|
+
|
219
|
+
clear_render_cache # hack to make sure we don't have old-style rendered todos.
|
220
|
+
@todo_items = analyse_rendered_todo_items @pages_in_category.by_name
|
221
|
+
@bliki_todo_items = analyse_rendered_todo_items web.bliki.values
|
222
|
+
|
223
|
+
@context_links = @todo_items.clone.update(@bliki_todo_items).map { |page, items|
|
224
|
+
# 'items' contain the full 'todo' info
|
225
|
+
items.map { |item| item.context }
|
226
|
+
}.flatten.compact.uniq.reject { |c| c.nil? || c.empty? }.map { |context|
|
227
|
+
@context == context ?
|
228
|
+
"[<span class='selected'>#{context}</span>]" :
|
229
|
+
"<a href='?context=#{context}#{"&sort_order=#{@sort_order}" if @sort_order}'>#{context}</a>"
|
230
|
+
}
|
231
|
+
|
232
|
+
@todo_items = sort_and_filter_todo_items @todo_items, @sort_order, @context
|
233
|
+
@bliki_todo_items = sort_and_filter_todo_items @bliki_todo_items, @sort_order, @context
|
234
|
+
|
235
|
+
end #}}}
|
236
|
+
|
237
|
+
def analyse_rendered_todo_items pages
|
238
|
+
items = Hash.new { Array.new }
|
239
|
+
pages.each do |page|
|
240
|
+
if page.has_todos?
|
200
241
|
# Page has todo items. Get the rendered version (marked-up and with links):
|
242
|
+
# I specifically don't use the todo chunkss because I want the fully marked-up
|
243
|
+
# text of the item.
|
201
244
|
content = page.revisions.last.display_content
|
202
|
-
|
245
|
+
items[page] = content.scan(TODO_RE).map { |match|
|
246
|
+
RenderedTodo.new match[2], (match[0].empty? ? [] : match[0].split(',') ), (Date.parse(match[1]) rescue FAR_FUTURE)
|
247
|
+
}
|
203
248
|
end
|
204
249
|
end
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
250
|
+
items
|
251
|
+
end
|
252
|
+
|
253
|
+
def sort_and_filter_todo_items items, sort_order, context
|
254
|
+
case sort_order
|
255
|
+
when 'due_date'
|
256
|
+
result = items.map { |page, todos|
|
257
|
+
# sort the to items themselves
|
258
|
+
[page, todos.sort_by { |i| i.due_date } ]
|
259
|
+
}.sort_by { |page, todos|
|
260
|
+
# sort the pages by the one with the most urgent todo
|
261
|
+
todos.map{ |i| i.due_date }.min
|
262
|
+
}
|
263
|
+
|
264
|
+
else # default = sort by page name
|
265
|
+
result = items.sort_by { |page, items| page.name }
|
266
|
+
|
212
267
|
end
|
213
|
-
|
214
|
-
|
268
|
+
|
269
|
+
if context
|
270
|
+
# filter the items to those that are in context
|
271
|
+
result = result.map { |page, items|
|
272
|
+
[ page, items.select { |item| item.context.include? context } ]
|
273
|
+
}.select { |page, items| not items.empty? }
|
274
|
+
end
|
275
|
+
result
|
276
|
+
end
|
277
|
+
|
278
|
+
def get_todo_display_style due_date
|
279
|
+
# default is the muted 'darkred', to prevent to many bright red
|
280
|
+
# items on one page: (See also chunks/todo.rb)
|
281
|
+
(due_date <=> Date.today) > -1 ? "todoFuture" : "todo"
|
282
|
+
end
|
283
|
+
|
284
|
+
def clear_render_cache do_redirect=false
|
285
|
+
web.refresh_revisions
|
286
|
+
redirect_show 'HomePage' if do_redirect
|
287
|
+
end
|
215
288
|
|
216
289
|
def set_menu_pages #{{{
|
217
290
|
parse_category
|
@@ -221,7 +294,7 @@ class WikiController < ActionControllerServlet
|
|
221
294
|
when 'recent' then @all_pages.by_last_visited
|
222
295
|
when 'viewed' then @all_pages.by_most_viewed
|
223
296
|
when 'revised' then @all_pages.by_revision
|
224
|
-
when 'user' then @menu_content = web.
|
297
|
+
when 'user' then @menu_content = web.menu_content.revisions.last.display_content; nil
|
225
298
|
when 'category' then web.select { |page| page.in_category?(web.menu_category) }
|
226
299
|
when 'linkers'
|
227
300
|
web.select { |page|
|
@@ -250,32 +323,47 @@ class WikiController < ActionControllerServlet
|
|
250
323
|
@authors = web.authors
|
251
324
|
end #}}}
|
252
325
|
|
253
|
-
require 'pp'
|
254
326
|
def mind #{{{
|
255
327
|
parse_category
|
256
328
|
set_menu_pages
|
257
|
-
|
258
|
-
@prog = @req.query['draw_type'] || 'neato'
|
259
|
-
@graph_type = @req.query['graph_type'] || 'normal'
|
260
|
-
missing = @pages_in_category.wanted_pages if @req.query['missing']
|
261
|
-
show_authors = !@req.query.empty? && @req.query['show_authors'] == 'on'
|
262
|
-
show_leaves = @req.query.empty? || @req.query['show_leaves'] == 'on'
|
263
|
-
|
264
|
-
# TODO: fix handling of multiple-select for whole application
|
265
|
-
@selected_categories = @req.body.split('&').map { |pair|
|
266
|
-
pair.split('=') }.select { |k,v|
|
267
|
-
k == 'selected_categs' }.map { |k,v| v } if @req.body
|
268
|
-
@selected_categories ||= []
|
269
|
-
@selected_categories = [] if @selected_categories.include? 'all'
|
329
|
+
set_mm_options
|
270
330
|
|
271
331
|
@pngFile = @mapFile = nil
|
272
332
|
case @graph_type
|
273
|
-
when 'normal'
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
when '
|
278
|
-
|
333
|
+
when 'normal'
|
334
|
+
@pngFile, @mapFile = web.create_mind_map(@prog, @missing,
|
335
|
+
@show_authors, @show_leaves, @selected_categories)
|
336
|
+
|
337
|
+
when 'author'
|
338
|
+
@pngFile, @mapFile = web.create_author_graph(@prog, @selected_categories)
|
339
|
+
|
340
|
+
when 'category'
|
341
|
+
@pngFile, @mapFile = web.create_category_graph(@prog,
|
342
|
+
@show_authors, @selected_categories)
|
343
|
+
end
|
344
|
+
end #}}}
|
345
|
+
|
346
|
+
def set_mm_options #{{{
|
347
|
+
if @req.query.empty?
|
348
|
+
@prog = web.mm_prog
|
349
|
+
@graph_type = web.mm_graph_type
|
350
|
+
@missing = @pages_in_category.wanted_pages if web.mm_show_missing
|
351
|
+
@show_authors = web.mm_show_authors
|
352
|
+
@show_leaves = web.mm_show_leaves
|
353
|
+
@selected_categories = web.mm_selected_categories
|
354
|
+
else
|
355
|
+
@prog = @req.query['draw_type'] || 'neato'
|
356
|
+
@graph_type = @req.query['graph_type'] || 'normal'
|
357
|
+
@missing = @pages_in_category.wanted_pages if @req.query['missing']
|
358
|
+
@show_authors = @req.query['show_authors'] == 'on'
|
359
|
+
@show_leaves = @req.query.empty? || @req.query['show_leaves'] == 'on'
|
360
|
+
|
361
|
+
# TODO: fix handling of multiple-select for whole application
|
362
|
+
@selected_categories = @req.body.split('&').map { |pair|
|
363
|
+
pair.split('=') }.select { |k,v|
|
364
|
+
k == 'selected_categs' }.map { |k,v| v } if @req.body
|
365
|
+
@selected_categories ||= []
|
366
|
+
@selected_categories = [] if @selected_categories.include? 'all'
|
279
367
|
end
|
280
368
|
end #}}}
|
281
369
|
|
@@ -293,17 +381,18 @@ require 'pp'
|
|
293
381
|
type = @req.query['type']
|
294
382
|
content = @req.query['content']
|
295
383
|
category = @req.query['category']
|
384
|
+
author = @req.query['author']
|
296
385
|
|
297
386
|
limit = @req.query['limit'].to_i rescue nil
|
298
387
|
limit = 20 unless limit
|
299
388
|
limit -= 1 if limit >= 0
|
300
389
|
|
301
390
|
# need to go through the WikiService to persist the command:
|
302
|
-
wiki.save_menu_pref
|
391
|
+
wiki.save_menu_pref(web_address, type, limit, content, category, Author.new(author, remote_ip))
|
303
392
|
end
|
304
393
|
|
394
|
+
# redirect to the most recently viewed page, or the home page.
|
305
395
|
if web_address
|
306
|
-
# redirect to the most recently viewed page, or the home page.
|
307
396
|
pname = begin
|
308
397
|
web.select{ true }.by_last_visited.first.name
|
309
398
|
rescue
|
@@ -374,6 +463,7 @@ require 'pp'
|
|
374
463
|
end
|
375
464
|
|
376
465
|
def new
|
466
|
+
redirect_show("HomePage") if web.check_pass_on_edit and not authenticate
|
377
467
|
@page_name, @author = page_name, default_author
|
378
468
|
end
|
379
469
|
|
@@ -396,10 +486,15 @@ require 'pp'
|
|
396
486
|
end
|
397
487
|
|
398
488
|
def save
|
489
|
+
if web.check_pass_on_edit and not authenticate
|
490
|
+
wiki.read_page(web_address, page_name).unlock if web.pages[page_name]
|
491
|
+
redirect_show("HomePage")
|
492
|
+
end
|
493
|
+
|
399
494
|
if web.pages[page_name]
|
400
495
|
page = wiki.revise_page(
|
401
496
|
web_address, page_name, @params["content"], Time.now,
|
402
|
-
Author.new(@params["author"], remote_ip)
|
497
|
+
Author.new(@params["author"], remote_ip), @params['edit_type']
|
403
498
|
)
|
404
499
|
|
405
500
|
page.unlock
|
@@ -420,19 +515,24 @@ require 'pp'
|
|
420
515
|
end
|
421
516
|
|
422
517
|
def rollback
|
518
|
+
redirect_show("HomePage") if web.check_pass_on_edit and not authenticate
|
519
|
+
|
423
520
|
@page = wiki.read_page(web_address, page_name)
|
424
|
-
|
425
|
-
redirect_show
|
521
|
+
@revision = @page.revisions[@params["rev"].to_i]
|
426
522
|
end
|
427
523
|
|
428
524
|
# Bliki ----------------------------------------------------------------------
|
429
525
|
|
430
526
|
def bliki_delete
|
527
|
+
redirect_bliki if web.check_pass_on_edit and not authenticate
|
528
|
+
|
431
529
|
wiki.delete_bliki_entry(web_address, page_name)
|
432
530
|
redirect_bliki
|
433
531
|
end
|
434
532
|
|
435
533
|
def bliki_edit
|
534
|
+
redirect_bliki if web.check_pass_on_edit and not authenticate
|
535
|
+
|
436
536
|
@page = wiki.read_bliki_entry(web_address, page_name)
|
437
537
|
|
438
538
|
if !@page.locked?(Time.now) || @params["break_lock"]
|
@@ -451,6 +551,8 @@ require 'pp'
|
|
451
551
|
end
|
452
552
|
|
453
553
|
def bliki_save
|
554
|
+
redirect_bliki if web.check_pass_on_edit and not authenticate
|
555
|
+
|
454
556
|
pname = page_name || @params["pagename"]
|
455
557
|
if web.bliki[pname]
|
456
558
|
page = wiki.revise_bliki_entry(web_address, pname, @params["content"], Time.now, @params["author"])
|
@@ -464,11 +566,15 @@ require 'pp'
|
|
464
566
|
end
|
465
567
|
|
466
568
|
def bliki_revision
|
569
|
+
parse_category
|
570
|
+
set_menu_pages
|
467
571
|
@page = wiki.read_bliki_entry(web_address, page_name || @params['pagename'])
|
468
572
|
@revision = @page.revisions[@params["rev"].to_i] || @page.revisions.last
|
469
573
|
end
|
470
574
|
|
471
575
|
def rollback_bliki
|
576
|
+
redirect_bliki if web.check_pass_on_edit and not authenticate
|
577
|
+
|
472
578
|
@page = wiki.read_bliki_entry(web_address, page_name)
|
473
579
|
wiki.rollback_bliki_entry(web_address, page_name, @params["rev"].to_i, Time.now)
|
474
580
|
redirect_bliki
|
@@ -535,7 +641,8 @@ require 'pp'
|
|
535
641
|
end
|
536
642
|
|
537
643
|
def authorized?(web_address)
|
538
|
-
|
644
|
+
web.nil? ||
|
645
|
+
web.password.nil? ||
|
539
646
|
(read_cookie(web_address) && read_cookie(web_address) == web.password) ||
|
540
647
|
password_check(@params["password"])
|
541
648
|
end
|
@@ -596,7 +703,13 @@ require 'pp'
|
|
596
703
|
end
|
597
704
|
|
598
705
|
def render_markup_help
|
599
|
-
|
706
|
+
if web
|
707
|
+
markup = web.markup
|
708
|
+
markup = 'markdown' if markup.to_s =~ /markdown/
|
709
|
+
sub_template("#{markup}_help")
|
710
|
+
else
|
711
|
+
''
|
712
|
+
end
|
600
713
|
end
|
601
714
|
|
602
715
|
def send_export(file_name, file_path, content_type = "application/zip")
|