Pimki 1.3.092 → 1.4.092
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,92 +1,92 @@
|
|
1
|
-
require 'chunks/uri'
|
2
|
-
require 'chunks/match'
|
3
|
-
require 'test/unit'
|
4
|
-
|
5
|
-
class URITest < Test::Unit::TestCase
|
6
|
-
include ChunkMatch
|
7
|
-
|
8
|
-
def test_non_matches
|
9
|
-
assert_no_match(URIChunk.pattern, 'There is no URI here')
|
10
|
-
assert_no_match(URIChunk.pattern, 'One gemstone is the garnet:reddish in colour, like ruby')
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_simple_uri
|
14
|
-
match(URIChunk, 'http://www.example.com',
|
15
|
-
:scheme =>'http', :host =>'www.example.com', :path => nil,
|
16
|
-
:link_text => 'http://www.example.com'
|
17
|
-
)
|
18
|
-
match(URIChunk, 'http://www.example.com/',
|
19
|
-
:scheme =>'http', :host =>'www.example.com', :path => '/',
|
20
|
-
:link_text => 'http://www.example.com/'
|
21
|
-
)
|
22
|
-
match(URIChunk, 'www.example.com',
|
23
|
-
:scheme =>'http', :host =>'www.example.com', :link_text => 'www.example.com'
|
24
|
-
)
|
25
|
-
match(URIChunk, 'example.com',
|
26
|
-
:scheme =>'http',:host =>'example.com', :link_text => 'example.com'
|
27
|
-
)
|
28
|
-
match(URIChunk, 'http://example.com.au/',
|
29
|
-
:scheme =>'http', :host =>'example.com.au', :link_text => 'http://example.com.au/'
|
30
|
-
)
|
31
|
-
match(URIChunk, 'example.com.au',
|
32
|
-
:scheme =>'http', :host =>'example.com.au', :link_text => 'example.com.au'
|
33
|
-
)
|
34
|
-
match(URIChunk, 'http://www.example.co.uk/',
|
35
|
-
:scheme =>'http', :host =>'www.example.co.uk',
|
36
|
-
:link_text => 'http://www.example.co.uk/'
|
37
|
-
)
|
38
|
-
match(URIChunk, 'example.co.uk',
|
39
|
-
:scheme =>'http', :host =>'example.co.uk', :link_text => 'example.co.uk'
|
40
|
-
)
|
41
|
-
match(URIChunk, 'http://moinmoin.wikiwikiweb.de/HelpOnNavigation',
|
42
|
-
:scheme => 'http', :host => 'moinmoin.wikiwikiweb.de', :path => '/HelpOnNavigation',
|
43
|
-
:link_text => 'http://moinmoin.wikiwikiweb.de/HelpOnNavigation'
|
44
|
-
)
|
45
|
-
match(URIChunk, 'moinmoin.wikiwikiweb.de/HelpOnNavigation',
|
46
|
-
:scheme => 'http', :host => 'moinmoin.wikiwikiweb.de', :path => '/HelpOnNavigation',
|
47
|
-
:link_text => 'moinmoin.wikiwikiweb.de/HelpOnNavigation'
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_email_uri
|
52
|
-
match(URIChunk, 'mail@example.com',
|
53
|
-
:user => 'mail', :host => 'example.com', :link_text => 'mail@example.com'
|
54
|
-
)
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_non_email
|
58
|
-
# The @ is part of the normal text, but 'example.com' is marked up.
|
59
|
-
match(URIChunk, 'Not an email: @example.com', :user => nil, :uri => 'http://example.com')
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_non_uri
|
63
|
-
assert_no_match(URIChunk.pattern, 'httpd.conf')
|
64
|
-
assert_no_match(URIChunk.pattern, 'libproxy.so')
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_uri_in_text
|
68
|
-
match(URIChunk, 'Go to: http://www.example.com/', :host => 'www.example.com', :path =>'/')
|
69
|
-
match(URIChunk, 'http://www.example.com/ is a link.', :host => 'www.example.com')
|
70
|
-
match(URIChunk,
|
71
|
-
'Email david@loudthinking.com',
|
72
|
-
:scheme =>'mailto', :user =>'david', :host =>'loudthinking.com'
|
73
|
-
)
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_uri_in_parentheses
|
77
|
-
match(URIChunk, 'URI (http://brackets.com.de) in brackets', :host => 'brackets.com.de')
|
78
|
-
match(URIChunk, 'because (as shown at research.net) the results', :host => 'research.net')
|
79
|
-
match(URIChunk,
|
80
|
-
'A wiki (http://wiki.org/wiki.cgi?WhatIsWiki) page',
|
81
|
-
:scheme => 'http', :host => 'wiki.org', :path => '/wiki.cgi', :query => 'WhatIsWiki'
|
82
|
-
)
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_uri_list_item
|
86
|
-
match(
|
87
|
-
URIChunk,
|
88
|
-
'* http://www.btinternet.com/~mail2minh/SonyEricssonP80xPlatform.sis',
|
89
|
-
:path => '/~mail2minh/SonyEricssonP80xPlatform.sis'
|
90
|
-
)
|
91
|
-
end
|
92
|
-
end
|
1
|
+
require 'chunks/uri'
|
2
|
+
require 'chunks/match'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class URITest < Test::Unit::TestCase
|
6
|
+
include ChunkMatch
|
7
|
+
|
8
|
+
def test_non_matches
|
9
|
+
assert_no_match(URIChunk.pattern, 'There is no URI here')
|
10
|
+
assert_no_match(URIChunk.pattern, 'One gemstone is the garnet:reddish in colour, like ruby')
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_simple_uri
|
14
|
+
match(URIChunk, 'http://www.example.com',
|
15
|
+
:scheme =>'http', :host =>'www.example.com', :path => nil,
|
16
|
+
:link_text => 'http://www.example.com'
|
17
|
+
)
|
18
|
+
match(URIChunk, 'http://www.example.com/',
|
19
|
+
:scheme =>'http', :host =>'www.example.com', :path => '/',
|
20
|
+
:link_text => 'http://www.example.com/'
|
21
|
+
)
|
22
|
+
match(URIChunk, 'www.example.com',
|
23
|
+
:scheme =>'http', :host =>'www.example.com', :link_text => 'www.example.com'
|
24
|
+
)
|
25
|
+
match(URIChunk, 'example.com',
|
26
|
+
:scheme =>'http',:host =>'example.com', :link_text => 'example.com'
|
27
|
+
)
|
28
|
+
match(URIChunk, 'http://example.com.au/',
|
29
|
+
:scheme =>'http', :host =>'example.com.au', :link_text => 'http://example.com.au/'
|
30
|
+
)
|
31
|
+
match(URIChunk, 'example.com.au',
|
32
|
+
:scheme =>'http', :host =>'example.com.au', :link_text => 'example.com.au'
|
33
|
+
)
|
34
|
+
match(URIChunk, 'http://www.example.co.uk/',
|
35
|
+
:scheme =>'http', :host =>'www.example.co.uk',
|
36
|
+
:link_text => 'http://www.example.co.uk/'
|
37
|
+
)
|
38
|
+
match(URIChunk, 'example.co.uk',
|
39
|
+
:scheme =>'http', :host =>'example.co.uk', :link_text => 'example.co.uk'
|
40
|
+
)
|
41
|
+
match(URIChunk, 'http://moinmoin.wikiwikiweb.de/HelpOnNavigation',
|
42
|
+
:scheme => 'http', :host => 'moinmoin.wikiwikiweb.de', :path => '/HelpOnNavigation',
|
43
|
+
:link_text => 'http://moinmoin.wikiwikiweb.de/HelpOnNavigation'
|
44
|
+
)
|
45
|
+
match(URIChunk, 'moinmoin.wikiwikiweb.de/HelpOnNavigation',
|
46
|
+
:scheme => 'http', :host => 'moinmoin.wikiwikiweb.de', :path => '/HelpOnNavigation',
|
47
|
+
:link_text => 'moinmoin.wikiwikiweb.de/HelpOnNavigation'
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_email_uri
|
52
|
+
match(URIChunk, 'mail@example.com',
|
53
|
+
:user => 'mail', :host => 'example.com', :link_text => 'mail@example.com'
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_non_email
|
58
|
+
# The @ is part of the normal text, but 'example.com' is marked up.
|
59
|
+
match(URIChunk, 'Not an email: @example.com', :user => nil, :uri => 'http://example.com')
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_non_uri
|
63
|
+
assert_no_match(URIChunk.pattern, 'httpd.conf')
|
64
|
+
assert_no_match(URIChunk.pattern, 'libproxy.so')
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_uri_in_text
|
68
|
+
match(URIChunk, 'Go to: http://www.example.com/', :host => 'www.example.com', :path =>'/')
|
69
|
+
match(URIChunk, 'http://www.example.com/ is a link.', :host => 'www.example.com')
|
70
|
+
match(URIChunk,
|
71
|
+
'Email david@loudthinking.com',
|
72
|
+
:scheme =>'mailto', :user =>'david', :host =>'loudthinking.com'
|
73
|
+
)
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_uri_in_parentheses
|
77
|
+
match(URIChunk, 'URI (http://brackets.com.de) in brackets', :host => 'brackets.com.de')
|
78
|
+
match(URIChunk, 'because (as shown at research.net) the results', :host => 'research.net')
|
79
|
+
match(URIChunk,
|
80
|
+
'A wiki (http://wiki.org/wiki.cgi?WhatIsWiki) page',
|
81
|
+
:scheme => 'http', :host => 'wiki.org', :path => '/wiki.cgi', :query => 'WhatIsWiki'
|
82
|
+
)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_uri_list_item
|
86
|
+
match(
|
87
|
+
URIChunk,
|
88
|
+
'* http://www.btinternet.com/~mail2minh/SonyEricssonP80xPlatform.sis',
|
89
|
+
:path => '/~mail2minh/SonyEricssonP80xPlatform.sis'
|
90
|
+
)
|
91
|
+
end
|
92
|
+
end
|
data/app/models/chunks/wiki.rb
CHANGED
@@ -43,14 +43,14 @@ module WikiChunk
|
|
43
43
|
|
44
44
|
def initialize(match_data, revision)
|
45
45
|
super(match_data, revision)
|
46
|
-
@
|
47
|
-
|
46
|
+
@escaped = match_data[1] || match_data[3]
|
47
|
+
@text.delete! '\\' if @escaped
|
48
48
|
@page_name = @link_text = match_data[2]
|
49
49
|
end
|
50
50
|
|
51
51
|
def mask(content) pre_mask + post_mask; end
|
52
52
|
def regexp() Regexp.new(pre_mask + post_mask) end
|
53
|
-
def escaped_text() (@
|
53
|
+
def escaped_text() (@escaped.nil? ? nil : page_name) end
|
54
54
|
def link_text() WikiWords.separate(page_name) end
|
55
55
|
end
|
56
56
|
|
@@ -84,7 +84,7 @@ module WikiChunk
|
|
84
84
|
|
85
85
|
def mask(content) pre_mask + post_mask; end
|
86
86
|
def regexp() Regexp.new(pre_mask + post_mask) end
|
87
|
-
def escaped_text() (@escape.nil? ? nil : page_name) end
|
87
|
+
def escaped_text() (@escape.nil? ? nil : page_name) end # TODO: never set?
|
88
88
|
def link_text() WikiWords.separate(page_name) end
|
89
89
|
end
|
90
90
|
|
@@ -1,22 +1,22 @@
|
|
1
|
-
|
2
|
-
class WikiSymbol < Chunk::Abstract
|
3
|
-
def self.pattern() /<:(.*?)>/ end
|
4
|
-
|
5
|
-
attr_accessor :symbol_code
|
6
|
-
|
7
|
-
def initialize(match_data, revision)
|
8
|
-
super(match_data, revision)
|
9
|
-
@symbol_code = match_data[1]
|
10
|
-
end
|
11
|
-
|
12
|
-
def unmask(content)
|
13
|
-
tag = case symbol_code
|
14
|
-
when 'cbx' then '<input type="checkbox" disabled />'
|
15
|
-
when 'cbxc' then '<input type="checkbox" disabled checked />'
|
16
|
-
else symbol_code
|
17
|
-
end
|
18
|
-
|
19
|
-
return self if content.gsub!( Regexp.new(mask(content)), tag )
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
1
|
+
|
2
|
+
class WikiSymbol < Chunk::Abstract
|
3
|
+
def self.pattern() /<:(.*?)>/ end
|
4
|
+
|
5
|
+
attr_accessor :symbol_code
|
6
|
+
|
7
|
+
def initialize(match_data, revision)
|
8
|
+
super(match_data, revision)
|
9
|
+
@symbol_code = match_data[1]
|
10
|
+
end
|
11
|
+
|
12
|
+
def unmask(content)
|
13
|
+
tag = case symbol_code
|
14
|
+
when 'cbx' then '<input type="checkbox" disabled />'
|
15
|
+
when 'cbxc' then '<input type="checkbox" disabled checked />'
|
16
|
+
else symbol_code
|
17
|
+
end
|
18
|
+
|
19
|
+
return self if content.gsub!( Regexp.new(mask(content)), tag )
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -1,36 +1,36 @@
|
|
1
|
-
require 'chunks/wiki'
|
2
|
-
require 'chunks/match'
|
3
|
-
require 'test/unit'
|
4
|
-
|
5
|
-
class WikiTest < Test::Unit::TestCase
|
6
|
-
include ChunkMatch
|
7
|
-
|
8
|
-
def test_simple
|
9
|
-
match(WikiChunk::Word, 'This is a WikiWord okay?', :page_name => 'WikiWord')
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_escaped
|
13
|
-
match(WikiChunk::Word, 'Do not link to an \EscapedWord',
|
14
|
-
:page_name => 'EscapedWord', :escaped_text => 'EscapedWord'
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_simple_brackets
|
19
|
-
match(WikiChunk::Link, 'This is a [[bracketted link]]',
|
20
|
-
:page_name => 'bracketted link', :escaped_text => nil
|
21
|
-
)
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_complex_brackets
|
25
|
-
match(WikiChunk::Link, 'This is a tricky link [[Sperberg-McQueen]]',
|
26
|
-
:page_name => 'Sperberg-McQueen', :escaped_text => nil
|
27
|
-
)
|
28
|
-
end
|
29
|
-
|
30
|
-
# MDR: I'm not sure how to deal with this case just yet...
|
31
|
-
#
|
32
|
-
# def test_textile_link
|
33
|
-
# assert_no_match(WikiChunk::Word.pattern, '"Here is a special link":SpecialLink')
|
34
|
-
# end
|
35
|
-
|
36
|
-
end
|
1
|
+
require 'chunks/wiki'
|
2
|
+
require 'chunks/match'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class WikiTest < Test::Unit::TestCase
|
6
|
+
include ChunkMatch
|
7
|
+
|
8
|
+
def test_simple
|
9
|
+
match(WikiChunk::Word, 'This is a WikiWord okay?', :page_name => 'WikiWord')
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_escaped
|
13
|
+
match(WikiChunk::Word, 'Do not link to an \EscapedWord',
|
14
|
+
:page_name => 'EscapedWord', :escaped_text => 'EscapedWord'
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_simple_brackets
|
19
|
+
match(WikiChunk::Link, 'This is a [[bracketted link]]',
|
20
|
+
:page_name => 'bracketted link', :escaped_text => nil
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_complex_brackets
|
25
|
+
match(WikiChunk::Link, 'This is a tricky link [[Sperberg-McQueen]]',
|
26
|
+
:page_name => 'Sperberg-McQueen', :escaped_text => nil
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
# MDR: I'm not sure how to deal with this case just yet...
|
31
|
+
#
|
32
|
+
# def test_textile_link
|
33
|
+
# assert_no_match(WikiChunk::Word.pattern, '"Here is a special link":SpecialLink')
|
34
|
+
# end
|
35
|
+
|
36
|
+
end
|
data/app/models/page.rb
CHANGED
@@ -17,13 +17,27 @@ class Page
|
|
17
17
|
revise(content, created_at, author)
|
18
18
|
end
|
19
19
|
|
20
|
-
def revise(content, created_at, author)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
def revise(content, created_at, author, edit_type='default')
|
21
|
+
case edit_type
|
22
|
+
when 'major'
|
23
|
+
revise_major(content, created_at, author)
|
24
|
+
|
25
|
+
when 'minor'
|
26
|
+
if !@revisions.empty? # sanity check
|
27
|
+
revise_minor(content, created_at, author)
|
28
|
+
else
|
29
|
+
revise_major(content, created_at, author)
|
30
|
+
end
|
31
|
+
|
32
|
+
when 'default'
|
33
|
+
if !@revisions.empty? && continous_revision?(created_at, author)
|
34
|
+
revise_minor(content, created_at, author)
|
35
|
+
else
|
36
|
+
revise_major(content, created_at, author)
|
37
|
+
end
|
38
|
+
|
39
|
+
else
|
40
|
+
revise_major(content, created_at, author)
|
27
41
|
end
|
28
42
|
|
29
43
|
web.refresh_pages_with_references(name) if @revisions.length == 1
|
@@ -61,6 +75,10 @@ class Page
|
|
61
75
|
def references
|
62
76
|
web.select.pages_that_reference(name)
|
63
77
|
end
|
78
|
+
|
79
|
+
def bliki_references
|
80
|
+
web.select_bliki.pages_that_reference(name)
|
81
|
+
end
|
64
82
|
|
65
83
|
# Returns the original wiki-word name as separate words, so "MyPage" becomes "My Page".
|
66
84
|
def plain_name
|
@@ -78,6 +96,9 @@ class Page
|
|
78
96
|
def last_visited() @last_visited || revisions.last.created_at end
|
79
97
|
def viewed() @viewed ||= 0 end
|
80
98
|
|
99
|
+
def has_todos?
|
100
|
+
not display_content.find_chunks(Todo).empty?
|
101
|
+
end
|
81
102
|
|
82
103
|
private
|
83
104
|
def continous_revision?(created_at, author)
|
@@ -88,6 +109,17 @@ class Page
|
|
88
109
|
def method_missing(method_symbol)
|
89
110
|
revisions.last.send(method_symbol)
|
90
111
|
end
|
112
|
+
|
113
|
+
def revise_minor(content, created_at, author) #{{{
|
114
|
+
@revisions.last.created_at = Time.now
|
115
|
+
@revisions.last.content = content
|
116
|
+
@revisions.last.clear_display_cache
|
117
|
+
end #}}}
|
118
|
+
|
119
|
+
def revise_major(content, created_at, author) #{{{
|
120
|
+
@revisions << Revision.new(self, @revisions.length, content, created_at, author)
|
121
|
+
end #}}}
|
122
|
+
|
91
123
|
end
|
92
124
|
|
93
125
|
# jEdit :folding=indent:collapseFolds=1:
|
data/app/models/page_lock.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
# Contains all the lock methods to be mixed in with the page
|
2
|
-
module PageLock
|
3
|
-
LOCKING_PERIOD = 30 * 60 # 30 minutes
|
4
|
-
|
5
|
-
def lock(time, locked_by)
|
6
|
-
@locked_at, @locked_by = time, locked_by
|
7
|
-
end
|
8
|
-
|
9
|
-
def lock_duration(time)
|
10
|
-
((time - @locked_at) / 60).to_i unless @locked_at.nil?
|
11
|
-
end
|
12
|
-
|
13
|
-
def unlock
|
14
|
-
@locked_at = nil
|
15
|
-
end
|
16
|
-
|
17
|
-
def locked?(comparison_time)
|
18
|
-
@locked_at + LOCKING_PERIOD > comparison_time unless @locked_at.nil?
|
19
|
-
end
|
20
|
-
|
21
|
-
def locked_by_link
|
22
|
-
web.make_link(@locked_by)
|
23
|
-
end
|
1
|
+
# Contains all the lock methods to be mixed in with the page
|
2
|
+
module PageLock
|
3
|
+
LOCKING_PERIOD = 30 * 60 # 30 minutes
|
4
|
+
|
5
|
+
def lock(time, locked_by)
|
6
|
+
@locked_at, @locked_by = time, locked_by
|
7
|
+
end
|
8
|
+
|
9
|
+
def lock_duration(time)
|
10
|
+
((time - @locked_at) / 60).to_i unless @locked_at.nil?
|
11
|
+
end
|
12
|
+
|
13
|
+
def unlock
|
14
|
+
@locked_at = nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def locked?(comparison_time)
|
18
|
+
@locked_at + LOCKING_PERIOD > comparison_time unless @locked_at.nil?
|
19
|
+
end
|
20
|
+
|
21
|
+
def locked_by_link
|
22
|
+
web.make_link(@locked_by)
|
23
|
+
end
|
24
24
|
end
|