Soks 0.0.5 → 0.0.6
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.txt +14 -4
- data/bin/soks-create-wiki.rb +2 -2
- data/contrib/redcloth-3.0.3.rb +0 -1
- data/lib/helpers/default-helpers.rb +13 -12
- data/lib/helpers/mail2wiki-helper.rb +12 -7
- data/lib/helpers/mail2wiki-test.rb +15 -0
- data/lib/helpers/wiki2html.rb +60 -0
- data/lib/soks-drb.rb +20 -0
- data/lib/soks-fcgi.rb +127 -0
- data/lib/soks-model.rb +11 -3
- data/lib/soks-servlet.rb +68 -45
- data/lib/soks-storage.rb +11 -3
- data/lib/soks-utils.rb +32 -3
- data/lib/soks-view.rb +48 -69
- data/lib/soks.rb +6 -3
- data/templates/default/attachment/blank.gif +0 -0
- data/templates/default/attachment/logo.jpg +0 -0
- data/templates/default/attachment/newpage.js +9 -0
- data/templates/default/attachment/pngbehavior.htc +86 -0
- data/templates/default/attachment/robots.txt +2 -1
- data/templates/default/attachment/stylesheet.css +144 -37
- data/templates/default/banned_titles.txt +36 -0
- data/templates/default/content/Api%20for%20classes%20to%20modify%20the%20wiki.textile +24 -0
- data/templates/default/content/Author.textile +3 -3
- data/templates/default/content/Automatic%20Summaries.textile +14 -14
- data/templates/default/content/Automatic%20linking%20between%20pages.textile +2 -0
- data/templates/default/content/Bug%3A%20RSS%20feed%20does%20not%20validate.textile +10 -0
- data/templates/default/content/Bug%3A%20Textile%20mishandles%20paragraphs.textile +33 -0
- data/templates/default/content/Bug%3A%20Unanticipated%20Rollbacks.textile +21 -0
- data/templates/default/content/Home%20Page.textile +3 -2
- data/templates/default/content/How%20to%20administrate%20this%20wiki.textile +4 -19
- data/templates/default/content/How%20to%20get%20the%20latest%20Soks%20from%20cvs.textile +21 -0
- data/templates/default/content/How%20to%20import%20data%20to%20this%20wiki.textile +45 -0
- data/templates/default/content/How%20to%20install%20Soks.textile +12 -8
- data/templates/default/content/How%20to%20password%20protect%20your%20wiki.textile +43 -0
- data/templates/default/content/How%20to%20report%20a%20bug.textile +1 -1
- data/templates/default/content/How%20to%20use%20the%20keyboard%20shortcuts.textile +2 -0
- data/templates/default/content/How%20to%20use%20this%20wiki.textile +1 -0
- data/templates/default/content/Instructions%20and%20Howtos.textile +4 -1
- data/templates/default/content/Known%20bugs.textile +5 -2
- data/templates/default/content/List%20of%20changes.textile +49 -0
- data/templates/default/content/New%20Recent%20Changes%20class.textile +58 -0
- data/templates/default/content/New%20page%20templates%20or%20categories%20code.textile +68 -0
- data/templates/default/content/Per%20Wiki%20Templates.textile +35 -0
- data/templates/default/content/Planned%20Features.textile +29 -8
- data/templates/default/content/README.textile +14 -4
- data/templates/default/content/RSS%20feed.textile +2 -0
- data/templates/default/content/Recent%20Changes%20to%20This%20Site.textile +200 -202
- data/templates/default/content/SOKS%20features.textile +2 -1
- data/templates/default/content/Sidebar%20Page.textile +3 -0
- data/templates/default/content/Type%20a%20title%20here.textile +1 -0
- data/templates/default/content/bug%3A%20competing%20edits.textile +13 -0
- data/templates/default/content/ctrl%2Dn.textile +1 -0
- data/templates/default/content/tamc.textile +1 -0
- data/templates/default/start.rb +38 -15
- data/templates/default/version.txt +1 -1
- data/templates/default/views/Page_edit.rhtml +71 -57
- data/templates/default/views/Page_meta.rhtml +6 -2
- data/templates/default/views/Page_revisions.rhtml +17 -9
- data/templates/default/views/Page_rss.rhtml +3 -1
- data/templates/default/views/Page_search_results.rhtml +11 -1
- data/templates/default/views/Page_view.rhtml +6 -2
- data/templates/default/views/UploadPage_edit.rhtml +58 -33
- data/templates/default/views/frame.rhtml +46 -27
- data/test/test_soks-utils.rb +37 -0
- metadata +27 -229
- data/templates/default/content/Bug%3A%20%5BFATAL%5D%20When%20renaming%20upload%20%2F%20picture%2.textile +0 -1
- data/templates/default/content/Bug%3A%20Automatic%20link%20links%20to%20stuff%20inside%20%3Chtml.textile +0 -1
- data/templates/default/content/Bug%3A%20Does%20not%20make%20use%20of%20if%2Dmodified%2Dsince%20r.textile +0 -1
- data/templates/default/content/Bug%3A%20Duplicate%20links%2Dto%20a%20page%20sometimes%20appear.textile +0 -1
- data/templates/default/content/Bug%3A%20External%20links%20incorrectly%20include%20trailing%20pu.textile +0 -1
- data/templates/default/content/Bug%3A%20In%20a%20list%20of%20links%2C%20the%20last%20link%20is%2.textile +0 -1
- data/templates/default/content/Bug%3A%20Inserted%20pages%20are%20not%20refreshed%20when%20new%20.textile +0 -1
- data/templates/default/content/Bug%3A%20No%20robots%2Etxt%20or%20favicon%2Eico.textile +0 -1
- data/templates/default/content/Bug%3A%20Page%20titles%20cannot%20have%20html%20tags%20in%20them.textile +0 -1
- data/templates/default/content/Bug%3A%20Punctuation%20in%20page%20titles%20still%20problematic.textile +0 -7
- data/templates/default/content/Bug%3A%20RSS%20feed%20shows%20oldest%2015%20revisions%20%28not%20.textile +0 -1
- data/templates/default/content/Bug%3A%20Search%20box%20width%20does%20not%20match%20column%20wid.textile +0 -1
- data/templates/default/content/Bug%3A%20Search%20includes%20leading%20and%20trailing%20spaces.textile +0 -1
- data/templates/default/content/Bug%3A%20Search%20inluced%20leading%20and%20trailing%20spaces.textile +0 -1
- data/templates/default/content/Bug%3A%20Site%20Index%20updates%20on%20every%20revision.textile +0 -1
- data/templates/default/content/Bug%3A%20Symbols%20are%20not%20always%20correctly%20rendered%20in.textile +0 -1
- data/templates/default/content/Bug%3A%20Uploads%20are%20not%20password%20protected.textile +0 -3
- data/templates/default/content/Bug%3A%20no%20superclass%20method%20%60%5Fdeprecated%5Fbase64.textile +0 -1
- data/templates/default/content/Fixed%20Bug%3A%20%5BFATAL%5D%20When%20renaming%20upload%20%2F%20p.textile +0 -34
- data/templates/default/content/Fixed%20Bug%3A%20Duplicate%20links%2Dto%20a%20page%20sometimes%20.textile +0 -3
- data/templates/default/content/Fixed%20Bug%3A%20External%20links%20incorrectly%20include%20trail.textile +0 -3
- data/templates/default/content/Fixed%20Bug%3A%20In%20a%20list%20of%20links%2C%20the%20last%20lin.textile +0 -13
- data/templates/default/content/Fixed%20Bug%3A%20Inserted%20pages%20are%20not%20refreshed%20when%.textile +0 -9
- data/templates/default/content/Fixed%20Bug%3A%20No%20robots%2Etxt%20or%20favicon%2Eico.textile +0 -4
- data/templates/default/content/Fixed%20Bug%3A%20RSS%20feed%20shows%20oldest%2015%20revisions%20%.textile +0 -15
- data/templates/default/content/Fixed%20Bug%3A%20Search%20box%20width%20does%20not%20match%20colu.textile +0 -3
- data/templates/default/content/Fixed%20Bug%3A%20Search%20includes%20leading%20and%20trailing%20s.textile +0 -3
- data/templates/default/content/Fixed%20Bug%3A%20Site%20Index%20updates%20on%20every%20revision.textile +0 -3
- data/templates/default/content/Fixed%20Bug%3A%20Symbols%20are%20not%20always%20correctly%20rende.textile +0 -5
- data/templates/default/content/Fixed%20Bug%3A%20no%20superclass%20method%20%60%5Fdeprecated%5Fba.textile +0 -3
- data/templates/default/content/Site%20Index.textile +0 -60
- data/templates/default/content/fixed%20bug%3A%20automatic%20link%20links%20to%20stuff%20inside%2.textile +0 -3
- data/templates/default/content/sandbox.textile +0 -2
- data/templates/default/content/test%20page.textile +0 -1
- data/templates/instiki/attachment/header_backdrop.png +0 -0
- data/templates/instiki/attachment/instiki_style_sheet.css +0 -199
- data/templates/instiki/attachment/logo.tiff +0 -0
- data/templates/instiki/attachment/logotext.png +0 -0
- data/templates/instiki/attachment/newpage.js +0 -41
- data/templates/instiki/attachment/rss.png +0 -0
- data/templates/instiki/banned_titles.txt +0 -31
- data/templates/instiki/content/All%20News.textile +0 -9
- data/templates/instiki/content/Attached%20ruby%20logo.textile +0 -1
- data/templates/instiki/content/Attached%20test%20thing.textile +0 -1
- data/templates/instiki/content/Author.textile +0 -12
- data/templates/instiki/content/Automatic%20Summaries.textile +0 -77
- data/templates/instiki/content/Automatic%20linking%20between%20pages.textile +0 -5
- data/templates/instiki/content/Bug%3A%20%5BFATAL%5D%20When%20renaming%20upload%20%2F%20picture%2.textile +0 -1
- data/templates/instiki/content/Bug%3A%20Automatic%20link%20links%20to%20stuff%20inside%20%3Chtml.textile +0 -1
- data/templates/instiki/content/Bug%3A%20Does%20not%20make%20use%20of%20if%2Dmodified%2Dsince%20r.textile +0 -1
- data/templates/instiki/content/Bug%3A%20Duplicate%20links%2Dto%20a%20page%20sometimes%20appear.textile +0 -1
- data/templates/instiki/content/Bug%3A%20External%20links%20incorrectly%20include%20trailing%20pu.textile +0 -1
- data/templates/instiki/content/Bug%3A%20GEM%20limits%20title%20lengths.textile +0 -1
- data/templates/instiki/content/Bug%3A%20In%20a%20list%20of%20links%2C%20the%20last%20link%20is%2.textile +0 -1
- data/templates/instiki/content/Bug%3A%20Inserted%20pages%20are%20not%20refreshed%20when%20new%20.textile +0 -1
- data/templates/instiki/content/Bug%3A%20No%20robots%2Etxt%20or%20favicon%2Eico.textile +0 -1
- data/templates/instiki/content/Bug%3A%20Page%20titles%20cannot%20have%20html%20tags%20in%20them.textile +0 -1
- data/templates/instiki/content/Bug%3A%20Punctuation%20in%20page%20titles%20still%20problematic.textile +0 -7
- data/templates/instiki/content/Bug%3A%20RSS%20feed%20shows%20oldest%2015%20revisions%20%28not%20.textile +0 -1
- data/templates/instiki/content/Bug%3A%20Search%20box%20width%20does%20not%20match%20column%20wid.textile +0 -1
- data/templates/instiki/content/Bug%3A%20Search%20includes%20leading%20and%20trailing%20spaces.textile +0 -1
- data/templates/instiki/content/Bug%3A%20Search%20inluced%20leading%20and%20trailing%20spaces.textile +0 -1
- data/templates/instiki/content/Bug%3A%20Site%20Index%20updates%20on%20every%20revision.textile +0 -1
- data/templates/instiki/content/Bug%3A%20Symbols%20are%20not%20always%20correctly%20rendered%20in.textile +0 -1
- data/templates/instiki/content/Bug%3A%20Uploads%20are%20not%20password%20protected.textile +0 -3
- data/templates/instiki/content/Bug%3A%20no%20superclass%20method%20%60%5Fdeprecated%5Fbase64.textile +0 -1
- data/templates/instiki/content/Bug%3A%20notextile%20does%20not%20prevent%20page%20inserts.textile +0 -1
- data/templates/instiki/content/Fixed%20Bug%3A%20%5BFATAL%5D%20When%20renaming%20upload%20%2F%20p.textile +0 -34
- data/templates/instiki/content/Fixed%20Bug%3A%20Duplicate%20links%2Dto%20a%20page%20sometimes%20.textile +0 -3
- data/templates/instiki/content/Fixed%20Bug%3A%20External%20links%20incorrectly%20include%20trail.textile +0 -3
- data/templates/instiki/content/Fixed%20Bug%3A%20In%20a%20list%20of%20links%2C%20the%20last%20lin.textile +0 -13
- data/templates/instiki/content/Fixed%20Bug%3A%20Inserted%20pages%20are%20not%20refreshed%20when%.textile +0 -9
- data/templates/instiki/content/Fixed%20Bug%3A%20No%20robots%2Etxt%20or%20favicon%2Eico.textile +0 -4
- data/templates/instiki/content/Fixed%20Bug%3A%20RSS%20feed%20shows%20oldest%2015%20revisions%20%.textile +0 -15
- data/templates/instiki/content/Fixed%20Bug%3A%20Search%20box%20width%20does%20not%20match%20colu.textile +0 -3
- data/templates/instiki/content/Fixed%20Bug%3A%20Search%20includes%20leading%20and%20trailing%20s.textile +0 -3
- data/templates/instiki/content/Fixed%20Bug%3A%20Site%20Index%20updates%20on%20every%20revision.textile +0 -3
- data/templates/instiki/content/Fixed%20Bug%3A%20Symbols%20are%20not%20always%20correctly%20rende.textile +0 -5
- data/templates/instiki/content/Fixed%20Bug%3A%20no%20superclass%20method%20%60%5Fdeprecated%5Fba.textile +0 -3
- data/templates/instiki/content/Home%20Page.textile +0 -19
- data/templates/instiki/content/How%20to%20administrate%20this%20wiki.textile +0 -62
- data/templates/instiki/content/How%20to%20change%20the%20way%20this%20wiki%20looks.textile +0 -30
- data/templates/instiki/content/How%20to%20export%20a%20site%20from%20this%20wiki.textile +0 -60
- data/templates/instiki/content/How%20to%20hack%20soks.textile +0 -61
- data/templates/instiki/content/How%20to%20import%20a%20site%20from%20instiki.textile +0 -13
- data/templates/instiki/content/How%20to%20install%20Soks.textile +0 -27
- data/templates/instiki/content/How%20to%20report%20a%20bug.textile +0 -8
- data/templates/instiki/content/How%20to%20use%20the%20keyboard%20shortcuts.textile +0 -13
- data/templates/instiki/content/How%20to%20use%20this%20wiki.textile +0 -27
- data/templates/instiki/content/Instructions%20and%20Howtos.textile +0 -18
- data/templates/instiki/content/Known%20bugs.textile +0 -15
- data/templates/instiki/content/Latest%20News.textile +0 -9
- data/templates/instiki/content/List%20of%20changes.textile +0 -67
- data/templates/instiki/content/Picture%20of%20Type%20a%20title%20here.textile +0 -1
- data/templates/instiki/content/Picture%20of%20a%20logo%20for%20the%20ruby%20language.textile +0 -1
- data/templates/instiki/content/Picture%20of%20a%20pair%20of%20soks.textile +0 -1
- data/templates/instiki/content/Picture%20of%20powered%20by%20ruby%20logo.textile +0 -1
- data/templates/instiki/content/Planned%20Features.textile +0 -19
- data/templates/instiki/content/README.textile +0 -63
- data/templates/instiki/content/RSS%20feed.textile +0 -7
- data/templates/instiki/content/Recent%20Blog%20Entries.textile +0 -5
- data/templates/instiki/content/Recent%20Changes%20to%20This%20Site.textile +0 -211
- data/templates/instiki/content/Recent%20News.textile +0 -9
- data/templates/instiki/content/Ruby.textile +0 -9
- data/templates/instiki/content/SOKS%20features.textile +0 -16
- data/templates/instiki/content/Site%20Index.textile +0 -60
- data/templates/instiki/content/Soks%20Licence.textile +0 -64
- data/templates/instiki/content/fixed%20bug%3A%20automatic%20link%20links%20to%20stuff%20inside%2.textile +0 -3
- data/templates/instiki/content/let%20me%20know.textile +0 -1
- data/templates/instiki/content/sandbox.textile +0 -2
- data/templates/instiki/content/tamc2.textile +0 -1
- data/templates/instiki/content/test%20page.textile +0 -1
- data/templates/instiki/start.rb +0 -112
- data/templates/instiki/version.txt +0 -1
- data/templates/instiki/views/Page_content.rhtml +0 -1
- data/templates/instiki/views/Page_edit.rhtml +0 -8
- data/templates/instiki/views/Page_meta.rhtml +0 -34
- data/templates/instiki/views/Page_print.rhtml +0 -6
- data/templates/instiki/views/Page_revisions.rhtml +0 -17
- data/templates/instiki/views/Page_rss.rhtml +0 -55
- data/templates/instiki/views/Page_search_results.rhtml +0 -18
- data/templates/instiki/views/Page_view.rhtml +0 -2
- data/templates/instiki/views/UploadPage_edit.rhtml +0 -16
- data/templates/instiki/views/frame.rhtml +0 -90
- data/templates/instiki/views/messages.yaml +0 -6
- data/templates/rails/attachment/2colheader.css +0 -77
- data/templates/rails/attachment/basics.css +0 -98
- data/templates/rails/attachment/header_backdrop.png +0 -0
- data/templates/rails/attachment/logo.tiff +0 -0
- data/templates/rails/attachment/logotext.png +0 -0
- data/templates/rails/attachment/newpage.js +0 -41
- data/templates/rails/attachment/rss.png +0 -0
- data/templates/rails/banned_titles.txt +0 -31
- data/templates/rails/content/All%20News.textile +0 -9
- data/templates/rails/content/Attached%20ruby%20logo.textile +0 -1
- data/templates/rails/content/Attached%20test%20thing.textile +0 -1
- data/templates/rails/content/Author.textile +0 -12
- data/templates/rails/content/Automatic%20Summaries.textile +0 -77
- data/templates/rails/content/Automatic%20linking%20between%20pages.textile +0 -5
- data/templates/rails/content/Bug%3A%20%5BFATAL%5D%20When%20renaming%20upload%20%2F%20picture%2.textile +0 -1
- data/templates/rails/content/Bug%3A%20Automatic%20link%20links%20to%20stuff%20inside%20%3Chtml.textile +0 -1
- data/templates/rails/content/Bug%3A%20Does%20not%20make%20use%20of%20if%2Dmodified%2Dsince%20r.textile +0 -1
- data/templates/rails/content/Bug%3A%20Duplicate%20links%2Dto%20a%20page%20sometimes%20appear.textile +0 -1
- data/templates/rails/content/Bug%3A%20External%20links%20incorrectly%20include%20trailing%20pu.textile +0 -1
- data/templates/rails/content/Bug%3A%20GEM%20limits%20title%20lengths.textile +0 -1
- data/templates/rails/content/Bug%3A%20In%20a%20list%20of%20links%2C%20the%20last%20link%20is%2.textile +0 -1
- data/templates/rails/content/Bug%3A%20Inserted%20pages%20are%20not%20refreshed%20when%20new%20.textile +0 -1
- data/templates/rails/content/Bug%3A%20No%20robots%2Etxt%20or%20favicon%2Eico.textile +0 -1
- data/templates/rails/content/Bug%3A%20Page%20titles%20cannot%20have%20html%20tags%20in%20them.textile +0 -1
- data/templates/rails/content/Bug%3A%20Punctuation%20in%20page%20titles%20still%20problematic.textile +0 -7
- data/templates/rails/content/Bug%3A%20RSS%20feed%20shows%20oldest%2015%20revisions%20%28not%20.textile +0 -1
- data/templates/rails/content/Bug%3A%20Search%20box%20width%20does%20not%20match%20column%20wid.textile +0 -1
- data/templates/rails/content/Bug%3A%20Search%20includes%20leading%20and%20trailing%20spaces.textile +0 -1
- data/templates/rails/content/Bug%3A%20Search%20inluced%20leading%20and%20trailing%20spaces.textile +0 -1
- data/templates/rails/content/Bug%3A%20Site%20Index%20updates%20on%20every%20revision.textile +0 -1
- data/templates/rails/content/Bug%3A%20Symbols%20are%20not%20always%20correctly%20rendered%20in.textile +0 -1
- data/templates/rails/content/Bug%3A%20Uploads%20are%20not%20password%20protected.textile +0 -3
- data/templates/rails/content/Bug%3A%20no%20superclass%20method%20%60%5Fdeprecated%5Fbase64.textile +0 -1
- data/templates/rails/content/Bug%3A%20notextile%20does%20not%20prevent%20page%20inserts.textile +0 -1
- data/templates/rails/content/Fixed%20Bug%3A%20%5BFATAL%5D%20When%20renaming%20upload%20%2F%20p.textile +0 -34
- data/templates/rails/content/Fixed%20Bug%3A%20Duplicate%20links%2Dto%20a%20page%20sometimes%20.textile +0 -3
- data/templates/rails/content/Fixed%20Bug%3A%20External%20links%20incorrectly%20include%20trail.textile +0 -3
- data/templates/rails/content/Fixed%20Bug%3A%20In%20a%20list%20of%20links%2C%20the%20last%20lin.textile +0 -13
- data/templates/rails/content/Fixed%20Bug%3A%20Inserted%20pages%20are%20not%20refreshed%20when%.textile +0 -9
- data/templates/rails/content/Fixed%20Bug%3A%20No%20robots%2Etxt%20or%20favicon%2Eico.textile +0 -4
- data/templates/rails/content/Fixed%20Bug%3A%20RSS%20feed%20shows%20oldest%2015%20revisions%20%.textile +0 -15
- data/templates/rails/content/Fixed%20Bug%3A%20Search%20box%20width%20does%20not%20match%20colu.textile +0 -3
- data/templates/rails/content/Fixed%20Bug%3A%20Search%20includes%20leading%20and%20trailing%20s.textile +0 -3
- data/templates/rails/content/Fixed%20Bug%3A%20Site%20Index%20updates%20on%20every%20revision.textile +0 -3
- data/templates/rails/content/Fixed%20Bug%3A%20Symbols%20are%20not%20always%20correctly%20rende.textile +0 -5
- data/templates/rails/content/Fixed%20Bug%3A%20no%20superclass%20method%20%60%5Fdeprecated%5Fba.textile +0 -3
- data/templates/rails/content/Home%20Page.textile +0 -19
- data/templates/rails/content/How%20to%20administrate%20this%20wiki.textile +0 -62
- data/templates/rails/content/How%20to%20change%20the%20way%20this%20wiki%20looks.textile +0 -30
- data/templates/rails/content/How%20to%20export%20a%20site%20from%20this%20wiki.textile +0 -60
- data/templates/rails/content/How%20to%20hack%20soks.textile +0 -61
- data/templates/rails/content/How%20to%20import%20a%20site%20from%20instiki.textile +0 -13
- data/templates/rails/content/How%20to%20install%20Soks.textile +0 -27
- data/templates/rails/content/How%20to%20report%20a%20bug.textile +0 -8
- data/templates/rails/content/How%20to%20use%20the%20keyboard%20shortcuts.textile +0 -13
- data/templates/rails/content/How%20to%20use%20this%20wiki.textile +0 -27
- data/templates/rails/content/Instructions%20and%20Howtos.textile +0 -18
- data/templates/rails/content/Known%20bugs.textile +0 -15
- data/templates/rails/content/Latest%20News.textile +0 -9
- data/templates/rails/content/List%20of%20changes.textile +0 -67
- data/templates/rails/content/Picture%20of%20Type%20a%20title%20here.textile +0 -1
- data/templates/rails/content/Picture%20of%20a%20logo%20for%20the%20ruby%20language.textile +0 -1
- data/templates/rails/content/Picture%20of%20a%20pair%20of%20soks.textile +0 -1
- data/templates/rails/content/Picture%20of%20powered%20by%20ruby%20logo.textile +0 -1
- data/templates/rails/content/Planned%20Features.textile +0 -19
- data/templates/rails/content/README.textile +0 -63
- data/templates/rails/content/RSS%20feed.textile +0 -7
- data/templates/rails/content/Recent%20Blog%20Entries.textile +0 -5
- data/templates/rails/content/Recent%20Changes%20to%20This%20Site.textile +0 -211
- data/templates/rails/content/Recent%20News.textile +0 -9
- data/templates/rails/content/Ruby.textile +0 -9
- data/templates/rails/content/SOKS%20features.textile +0 -16
- data/templates/rails/content/Site%20Index.textile +0 -60
- data/templates/rails/content/Soks%20Licence.textile +0 -64
- data/templates/rails/content/fixed%20bug%3A%20automatic%20link%20links%20to%20stuff%20inside%2.textile +0 -3
- data/templates/rails/content/let%20me%20know.textile +0 -1
- data/templates/rails/content/sandbox.textile +0 -2
- data/templates/rails/content/tamc2.textile +0 -1
- data/templates/rails/content/test%20page.textile +0 -1
- data/templates/rails/start.rb +0 -113
- data/templates/rails/version.txt +0 -1
- data/templates/rails/views/Page_content.rhtml +0 -1
- data/templates/rails/views/Page_edit.rhtml +0 -61
- data/templates/rails/views/Page_meta.rhtml +0 -38
- data/templates/rails/views/Page_print.rhtml +0 -6
- data/templates/rails/views/Page_revisions.rhtml +0 -19
- data/templates/rails/views/Page_rss.rhtml +0 -55
- data/templates/rails/views/Page_search_results.rhtml +0 -19
- data/templates/rails/views/Page_view.rhtml +0 -3
- data/templates/rails/views/UploadPage_edit.rhtml +0 -38
- data/templates/rails/views/frame.rhtml +0 -60
- data/templates/rails/views/messages.yaml +0 -6
- /data/templates/default/attachment/{logo_thumb.bmp → tiny-logo thumb.bmp} +0 -0
data/README.txt
CHANGED
|
@@ -2,6 +2,7 @@ h1. SOKS: Another Ruby Wiki
|
|
|
2
2
|
|
|
3
3
|
* This application is a Wiki (a system to allow the easy and collaborative editing of web pages).
|
|
4
4
|
* The project has been kindly hosted at http://rubyforge.org/projects/soks/
|
|
5
|
+
* The project wiki/home page is at www.soks.org
|
|
5
6
|
|
|
6
7
|
Quickstart:
|
|
7
8
|
# gem install Soks
|
|
@@ -17,12 +18,13 @@ h2. AUTHOR
|
|
|
17
18
|
|
|
18
19
|
* This software is copyright (c) Thomas Counsell 2004, 2005. tamc@rubyforge.org
|
|
19
20
|
* It is licensed under the Ruby Licence, a liberal open source licence. See LICENCE for more details.
|
|
21
|
+
* The author appreciates the code, suggestions and libraries provided by a buch of other people, see www.soks.org/author for individual acknowledgements.
|
|
20
22
|
|
|
21
23
|
h2. INSTALL
|
|
22
24
|
|
|
23
25
|
Preferably:
|
|
24
26
|
# Install rubygems from http://rubyforge.org/projects/rubygems/
|
|
25
|
-
# gem install Soks (you may need to be root first)
|
|
27
|
+
# @gem install Soks@ (you may need to be root first)
|
|
26
28
|
|
|
27
29
|
Alternatively
|
|
28
30
|
# Download the tar or zip file from http://rubyforge.org/projects/soks/
|
|
@@ -31,13 +33,17 @@ Alternatively
|
|
|
31
33
|
|
|
32
34
|
h2. USE
|
|
33
35
|
|
|
34
|
-
execute soks-create-wiki.rb (will be in your path if installed by gems, otherwise
|
|
36
|
+
execute @soks-create-wiki.rb@ (will be in your path if installed by gems, otherwise @./bin/soks-create-wiki.rb@ from the soks directory)
|
|
35
37
|
This will create a folder called soks-wiki in the current directory and launch the wiki. Surfing to http://localhost:8000 to see it (it is initially accessible from localhost only)
|
|
36
38
|
|
|
37
39
|
To restart the wiki change into the soks-wiki directory and execute ruby start.rb
|
|
38
40
|
|
|
39
41
|
To change the settings (url, port, etc) edit the start.rb file in the soks-wiki directory.
|
|
40
42
|
|
|
43
|
+
h2. UPGRADE
|
|
44
|
+
|
|
45
|
+
If you already have a previous version of soks then to upgrade, run @soks-create-wiki.rb --destination-dir=path/to/your/wiki@ and it will guide you through the upgrade.
|
|
46
|
+
|
|
41
47
|
h2. FEATURES
|
|
42
48
|
|
|
43
49
|
# Runs on its own webrick server (no independent web server required)
|
|
@@ -52,12 +58,16 @@ h2. FEATURES
|
|
|
52
58
|
h2. BUGS
|
|
53
59
|
|
|
54
60
|
I suspect there are many, as befits its version number. In particular it has:
|
|
55
|
-
* No authentication on pictures and attachments
|
|
56
|
-
* Punctuation in page titles problematic. ? <> and [] cause problems. : and / are ok.
|
|
57
61
|
* Insert page commands are not inhibited by notextile, pre or code tags
|
|
62
|
+
* Does not permit browsers to cache pages
|
|
63
|
+
* Not user friendly in the way it handles simultaneous edits of a page (last person to save wins)
|
|
64
|
+
* Some bugs in layout and formatting of text.
|
|
65
|
+
|
|
66
|
+
See http://www.soks.org/wiki/KnownBugs for details.
|
|
58
67
|
|
|
59
68
|
h2. RELEASES
|
|
60
69
|
|
|
70
|
+
# 2005 Mar 15 - soks-0.0.6 - Fourth public release (alpha)
|
|
61
71
|
# 2005 Feb 12 - soks-0.0.5 - Third public release (alpha)
|
|
62
72
|
# 2005 Jan 24 - soks-0.0.4 - Second public release (alpha)
|
|
63
73
|
# 2005 Jan 11 - soks-0.0.2 - First public release (alpha)
|
data/bin/soks-create-wiki.rb
CHANGED
|
@@ -95,7 +95,7 @@ if create && !File.exists?( destination)
|
|
|
95
95
|
end
|
|
96
96
|
puts "Creating wiki at #{destination} from #{source}"
|
|
97
97
|
copy_template( source, destination )
|
|
98
|
-
fill_out_script_template( destination, 'start.rb', { :root_directory => File.expand_path( destination ), :soks_libraries => soks_library, :url => url, :port => port } )
|
|
98
|
+
fill_out_script_template( destination, 'start.rb', { :root_directory => File.expand_path( destination ), :soks_libraries => soks_library, :url => url, :port => port, :version => version_number_from_wiki( destination ) } )
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
if upgrade
|
|
@@ -166,7 +166,7 @@ if upgrade
|
|
|
166
166
|
old_port = prompt.ask("What port will this wiki be accessed from?",old_port )
|
|
167
167
|
end
|
|
168
168
|
|
|
169
|
-
fill_out_script_template( destination, 'start.rb', { :root_directory => File.expand_path( destination ), :soks_libraries => soks_library, :url => old_url, :port => old_port } )
|
|
169
|
+
fill_out_script_template( destination, 'start.rb', { :root_directory => File.expand_path( destination ), :soks_libraries => soks_library, :url => old_url, :port => old_port, :version => version_number_from_wiki( destination ) } )
|
|
170
170
|
|
|
171
171
|
puts "\nI'm very sorry, but if you modified the authenticators, or added any AutomaticSummaries or AutomaticCalendars or suchlike, then you will need to copy them across manually from #{old_wiki}/start.rb to #{destination}/start.rb.\n Note that their api may have changed, so please look at the examples in #{destination}/start.rb\n\nOnce you have done that, run ruby #{destination}/start.rb to start."
|
|
172
172
|
exit
|
data/contrib/redcloth-3.0.3.rb
CHANGED
|
@@ -114,7 +114,7 @@ class AutomaticSummary
|
|
|
114
114
|
content, tail = $1, $2
|
|
115
115
|
end
|
|
116
116
|
end
|
|
117
|
-
content ||= "h2. #{@settings[:pagename]}\n\np{font-size: x-small;}. #{@settings[:pagename]} was created automatically from pages whose title matches
|
|
117
|
+
content ||= "h2. #{@settings[:pagename]}\n\np{font-size: x-small;}. #{@settings[:pagename]} was created automatically from pages whose title matches ==#{@settings[:regexp_for_title].inspect}==.\n\n<automaticsummary>"
|
|
118
118
|
tail ||= "</automaticsummary>"
|
|
119
119
|
content << "\n\n"
|
|
120
120
|
if @pages_in_summary.empty?
|
|
@@ -160,13 +160,14 @@ class AutomaticRecentChanges
|
|
|
160
160
|
|
|
161
161
|
def initialize( wiki, changes = 200, pagename = "Recent Changes to This Site", author = "AutomaticRecentChanges" )
|
|
162
162
|
AutomaticSummary.new( wiki, { :pagename => pagename,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
163
|
+
:max_pages_to_show => changes,
|
|
164
|
+
:author => author,
|
|
165
|
+
:only_new_pages => false,
|
|
166
|
+
:sort_pages_by => :revised_on,
|
|
167
|
+
:include_metadata => true,
|
|
168
|
+
:summarise_revisions => true,
|
|
169
|
+
:reverse_sort => true,
|
|
170
|
+
:remove_deleted_pages => false,
|
|
170
171
|
} )
|
|
171
172
|
end
|
|
172
173
|
end
|
|
@@ -227,7 +228,7 @@ class AutomaticCalendar
|
|
|
227
228
|
end
|
|
228
229
|
|
|
229
230
|
def calendar_for( month )
|
|
230
|
-
content = "<div class='calendar'>\n"
|
|
231
|
+
content = "<div class='calendar'>\n\n"
|
|
231
232
|
content << "|_. Su |_. Mo |_. Tu |_. We |_. Th |_. Fr |_. Sa |\n"
|
|
232
233
|
1.upto( time_for( month, 1 ).wday ) { content << "| . " }
|
|
233
234
|
day = nil
|
|
@@ -240,7 +241,7 @@ class AutomaticCalendar
|
|
|
240
241
|
day.wday.upto( 5 ) { content << "| . " }
|
|
241
242
|
content << "|\n"
|
|
242
243
|
content << "\n\n< #{month_pagename( month-1 )} #{month_pagename( month+1 )} >\n"
|
|
243
|
-
content << "</div>"
|
|
244
|
+
content << "\n</div>"
|
|
244
245
|
end
|
|
245
246
|
|
|
246
247
|
def time_for( month, day = 1 )
|
|
@@ -282,14 +283,14 @@ class AutomaticUpcomingEvents
|
|
|
282
283
|
end
|
|
283
284
|
|
|
284
285
|
def render_upcoming_events
|
|
285
|
-
content = "<div class='upcomingevents'>\n"
|
|
286
|
+
content = "<div class='upcomingevents'>\n\n"
|
|
286
287
|
Time.now.day.upto( Time.now.day+7 ) do |day|
|
|
287
288
|
time = @calendar.time_for( Time.now.month, day )
|
|
288
289
|
content << "| [[ #{relative_day( time ) } => #{@calendar.day_pagename( time )} ]] |"
|
|
289
290
|
content << (@wiki.exists?( @calendar.day_pagename(time) ) ? render_event( @calendar.day_pagename( time ) ) : " |\n")
|
|
290
291
|
end
|
|
291
292
|
content << "\n\np(more). [[(more) => #{@calendar.month_pagename}]]\n\n"
|
|
292
|
-
content << "</div>\n"
|
|
293
|
+
content << "\n</div>\n"
|
|
293
294
|
@wiki.revise( "Upcoming Events", content , "AutomaticCalendar" )
|
|
294
295
|
end
|
|
295
296
|
|
|
@@ -9,6 +9,7 @@ class Message
|
|
|
9
9
|
envelope = @imap.fetch( @message_id, 'ENVELOPE' ).first.attr['ENVELOPE']
|
|
10
10
|
@subject = envelope['subject']
|
|
11
11
|
@sender_name = envelope['from'].first['name']
|
|
12
|
+
@date = envelope['date']
|
|
12
13
|
@sender_email = envelope['from'].first['mailbox'] + '@' + envelope['from'].first['host']
|
|
13
14
|
@text = plain_text_content_from_message( message_id )
|
|
14
15
|
end
|
|
@@ -18,9 +19,14 @@ class Message
|
|
|
18
19
|
text.gsub!(/\r\n/,"\n")
|
|
19
20
|
text.gsub!(/\r/,"\n")
|
|
20
21
|
text.gsub!(/=\n/,'')
|
|
21
|
-
text.gsub!(/((?:=[0-9a-fA-F]{2})+)/n) { [$1.delete('=')].pack('H*') }
|
|
22
|
+
#text.gsub!(/((?:=[0-9a-fA-F]{2})+)/n) { [$1.delete('=')].pack('H*') }
|
|
23
|
+
|
|
22
24
|
text
|
|
23
25
|
end
|
|
26
|
+
|
|
27
|
+
def textile
|
|
28
|
+
text.gsub(/[\*-]{2,}/,'').gsub(/([^\n])\n([^\n])/,'\1\2').gsub(/^[ \t]+/,'')
|
|
29
|
+
end
|
|
24
30
|
|
|
25
31
|
end
|
|
26
32
|
|
|
@@ -29,9 +35,9 @@ class Mail2WikiHelper
|
|
|
29
35
|
DEFAULT_SETTINGS = {
|
|
30
36
|
:server => 'imap.hermes.cam.ac.uk',
|
|
31
37
|
:username => 'tamc2',
|
|
32
|
-
:password => '',
|
|
38
|
+
:password => 'missing_a_password',
|
|
33
39
|
:mailbox => 'mcr notices',
|
|
34
|
-
:
|
|
40
|
+
:check_period => 600, # Seconds
|
|
35
41
|
:subject_regexp => /.*/,
|
|
36
42
|
}
|
|
37
43
|
|
|
@@ -41,7 +47,7 @@ class Mail2WikiHelper
|
|
|
41
47
|
check_mailbox
|
|
42
48
|
Thread.new do
|
|
43
49
|
loop do
|
|
44
|
-
sleep @settings[:
|
|
50
|
+
sleep @settings[:check_period ]
|
|
45
51
|
check_mailbox
|
|
46
52
|
end
|
|
47
53
|
end
|
|
@@ -52,7 +58,6 @@ class Mail2WikiHelper
|
|
|
52
58
|
def check_mailbox
|
|
53
59
|
login
|
|
54
60
|
select_mailbox
|
|
55
|
-
p "Checking for emails in #{@settings[:server]}"
|
|
56
61
|
new_messages_for_wiki do |message_id|
|
|
57
62
|
this_message = Message.new( @imap, message_id )
|
|
58
63
|
if this_message.subject =~ @settings[:subject_regexp]
|
|
@@ -70,9 +75,9 @@ class Mail2WikiHelper
|
|
|
70
75
|
else
|
|
71
76
|
text = current_page.textile
|
|
72
77
|
end
|
|
73
|
-
text << "\n\n
|
|
78
|
+
text << "\n\n"
|
|
74
79
|
text << "#{message.date} from #{message.sender_name} #{message.sender_email}\n"
|
|
75
|
-
text << message.text
|
|
80
|
+
text << message.text
|
|
76
81
|
@wiki.revise(message.subject, text, message.sender_name )
|
|
77
82
|
end
|
|
78
83
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'mail2wiki-helper'
|
|
2
|
+
|
|
3
|
+
@imap = Net::IMAP.new('imap.hermes.cam.ac.uk')
|
|
4
|
+
@imap.login( 'tamc2', 'iama8yes' )
|
|
5
|
+
|
|
6
|
+
@imap.select 'mcr notices'
|
|
7
|
+
|
|
8
|
+
message = Message.new( @imap, 1 )
|
|
9
|
+
|
|
10
|
+
p message.date
|
|
11
|
+
p message.subject
|
|
12
|
+
p message.textile
|
|
13
|
+
|
|
14
|
+
@imap.logout
|
|
15
|
+
@imap.disconnect
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
class Wiki2Html
|
|
2
|
+
|
|
3
|
+
DEFAULT_SETTINGS = {
|
|
4
|
+
:views_to_copy => ['view','meta','rss'],
|
|
5
|
+
:extension => '.html',
|
|
6
|
+
:destination_dir => '/Users/tamc2/Sites',
|
|
7
|
+
:destination_url => 'http://localhost/~tamc2'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
def initialize( wiki, view, settings = {} )
|
|
11
|
+
@settings = DEFAULT_SETTINGS.merge( settings )
|
|
12
|
+
@wiki, @view = wiki, view
|
|
13
|
+
@wiki.watch_for( :page_created, :page_deleted ) { |event, page| new_page( page ) }
|
|
14
|
+
@wiki.watch_for( :page_revised ) { |event, page| page_revised( page ) }
|
|
15
|
+
update_all_pages
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def new_page( page )
|
|
19
|
+
copy_all_views( page.name )
|
|
20
|
+
titleregex = Regexp.new( page.name, Regexp::IGNORECASE )
|
|
21
|
+
@wiki.each { |name, linkedpage |
|
|
22
|
+
page_revised( linkedpage ) if linkedpage.textile =~ titleregex
|
|
23
|
+
}
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def page_revised( page )
|
|
27
|
+
copy_all_views( page.name )
|
|
28
|
+
page.inserted_into.each { |including_page| copy_all_views( including_page.name ) }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def update_all_pages
|
|
32
|
+
@wiki.each { |pagename, page| copy_all_views( pagename) }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def copy_all_views( pagename )
|
|
36
|
+
@settings[:views_to_copy].each { |view| copy_view( pagename, view ) }
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def copy_view( pagename, view )
|
|
40
|
+
$stderr.puts "Copying #{pagename} #{view}"
|
|
41
|
+
html = @view.view( pagename, view )
|
|
42
|
+
update_links html
|
|
43
|
+
destination = "#{@settings[:destination_dir]}/#{view}/#{pagename}#{@settings[:extension]}".downcase
|
|
44
|
+
File.mkpath(File.dirname(destination)) unless File.exists?(File.dirname(destination))
|
|
45
|
+
File.open( destination,'w') {|file| file.puts html}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def update_links( html )
|
|
49
|
+
old_link = /['"]#{$SETTINGS[:url]}\/(.*?)\/(.*?)(\.\w*)?['"]/
|
|
50
|
+
html.gsub!(old_link) do |match|
|
|
51
|
+
if ($1.downcase == 'attachment' || @settings[:views_to_copy].include?( $1.downcase ))
|
|
52
|
+
"'#{@settings[:destination_url]}\/#{$1.downcase}\/#{$2.downcase}#{$3 || @settings[:extension]}'"
|
|
53
|
+
else
|
|
54
|
+
match
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
html
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
data/lib/soks-drb.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/local/bin/ruby
|
|
2
|
+
require 'drb'
|
|
3
|
+
|
|
4
|
+
def start_wiki( settings = {}, &automatic_agents )
|
|
5
|
+
|
|
6
|
+
$SETTINGS.merge! settings
|
|
7
|
+
$MESSAGES = YAML.load( IO.readlines("#{$SETTINGS[:root_directory]}/views/messages.yaml").join )
|
|
8
|
+
|
|
9
|
+
wiki = Wiki.new( "#{$SETTINGS[:root_directory]}/content" )
|
|
10
|
+
view = View.new( wiki, $SETTINGS[:name] )
|
|
11
|
+
|
|
12
|
+
Thread.new( automatic_agents, wiki, view ) do |block, wiki, view|
|
|
13
|
+
block.call( wiki, view )
|
|
14
|
+
end.priority = -2
|
|
15
|
+
|
|
16
|
+
DRb.start_service( 'druby://localhost:9001', view)
|
|
17
|
+
DRb.thread.join
|
|
18
|
+
|
|
19
|
+
$stderr.puts "Wiki started as DRb on druby://localhost:9001"
|
|
20
|
+
end
|
data/lib/soks-fcgi.rb
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/local/bin/ruby
|
|
2
|
+
require 'cgi'
|
|
3
|
+
require 'drb'
|
|
4
|
+
# Require authenticators
|
|
5
|
+
|
|
6
|
+
class CGI
|
|
7
|
+
def redirect( where )
|
|
8
|
+
print this.header( { 'Status' => '302 Moved', 'location' =>
|
|
9
|
+
'#{where}' } )
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Default settings moved to soks.rb
|
|
14
|
+
|
|
15
|
+
class WikiCgi
|
|
16
|
+
|
|
17
|
+
def initialize( cgi, wiki, settings )
|
|
18
|
+
@cgi, @wiki, @name, @wikiurl, @authenticators = server, wiki, settings[:name] , settings[:url] , settings[:authenticators]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def service( cgi )
|
|
22
|
+
case cgi.path_translated
|
|
23
|
+
# Redirect some cgis to static file servlet
|
|
24
|
+
when '/robots.txt', '/favicon.ico' ;
|
|
25
|
+
cgi.redirect( "#{@wikiurl}/attachment#{cgi.path_translated}")
|
|
26
|
+
# If cgi of the form /verb/pagename then execute the approriate method
|
|
27
|
+
when /\/(\w+?)\/(.+)/
|
|
28
|
+
verb, pagename = $1, $2
|
|
29
|
+
# authenticate cgi, response
|
|
30
|
+
if self.respond_to?( "do#{verb.capitalize}" )
|
|
31
|
+
self.send( "do#{verb.capitalize}", cgi, pagename, cgi.remote_user )
|
|
32
|
+
else
|
|
33
|
+
cgi.out { @wiki.view( pagename, verb, cgi.remote_user ) }
|
|
34
|
+
end
|
|
35
|
+
when /\/(.+)/ ; redirect( cgi, $1, 'view' ) # No verb given
|
|
36
|
+
when "/" ; redirect( cgi, "Home Page", 'view' ) # No page or verb given
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
#response['Content-Type'] ||= "text/html"
|
|
40
|
+
#response['Cache-control'] ||= 'no-cache'
|
|
41
|
+
#response['Pragma'] ||= 'no-cache'
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def authenticate( cgi )
|
|
45
|
+
@authenticators.each do |path_regex,authenticator|
|
|
46
|
+
if cgi.path_translated.downcase =~ path_regex
|
|
47
|
+
authenticator.authenticate( cgi )
|
|
48
|
+
break
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def redirect( cgi, pagename, verb = 'view' )
|
|
54
|
+
pagename = pagename.url_encode # Reformat into url encoding
|
|
55
|
+
cgi.redirect( verb ? "#{@wikiurl}/#{verb}/#{pagename}" : "#{@wikiurl}/#{pagename}")
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def doWiki( cgi, pagename, person )
|
|
59
|
+
redirect( pagename.gsub(/([a-z])([A-Z])/,'\1 \2') )
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def doFind( cgi, pagename, person )
|
|
63
|
+
cgi.out { @wiki.find( cgi.query['regex'].strip ) }
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def doSave( cgi, pagename, person )
|
|
67
|
+
content = cgi.query["content"].to_s
|
|
68
|
+
newpagename = cgi.query["titleprefix"].to_s + cgi.query["newtitle"].to_s
|
|
69
|
+
@wiki.revise( pagename, content.gsub(/\r\n/,"\n"), person, newpagename) if content
|
|
70
|
+
redirect( newpagename )
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def doRollback( cgi, pagename, person )
|
|
74
|
+
revision = cgi.query['revision'] ? cgi.query['revision'].to_i : nil
|
|
75
|
+
@wiki.rollback( pagename, revision, person ) if revision
|
|
76
|
+
redirect( pagename )
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def doDelete( cgi, pagename, person )
|
|
80
|
+
@wiki.delete( pagename, person )
|
|
81
|
+
redirect( pagename )
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def doUpload( cgi, pagename, person )
|
|
85
|
+
newpagename = cgi.query["titleprefix"].to_s + cgi.query["newtitle"].to_s
|
|
86
|
+
unless cgi.query['file'] == ""
|
|
87
|
+
@wiki.revise( pagename, upload( cgi.query['file'].filename[/[0-9A-Za-z.]*$/], cgi.query['file'] ) , person, newpagename )
|
|
88
|
+
else
|
|
89
|
+
@wiki.move( pagename, person, newpagename )
|
|
90
|
+
end
|
|
91
|
+
redirect( newpagename )
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def doRss( cgi, pagename, person )
|
|
95
|
+
cgi.out { @wiki.view( pagename, 'rss', person ) }
|
|
96
|
+
# response["Content-Type"] = "text/xml"
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
private
|
|
100
|
+
|
|
101
|
+
def upload( filename, filedata )
|
|
102
|
+
path = "#{$SETTINGS[:root_directory]}/attachment/"
|
|
103
|
+
filename = unique_filename( path ,filename )
|
|
104
|
+
File.open( File.join( path, filename ), 'wb' ) { |file| filedata.list.each { |data| file << data } }
|
|
105
|
+
"/attachment/#{filename}"
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def unique_filename( path, filename )
|
|
109
|
+
bits = filename.split(/\./)
|
|
110
|
+
while File.exist? File.join( path, filename )
|
|
111
|
+
if bits.length >= 1
|
|
112
|
+
bits[-2].succ!
|
|
113
|
+
else
|
|
114
|
+
bits[0].succ!
|
|
115
|
+
end
|
|
116
|
+
filename = bits.join('.')
|
|
117
|
+
end
|
|
118
|
+
filename
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
wiki = DRbObject.new( nil, 'druby://localhost:9001')
|
|
123
|
+
settings = wiki.settings
|
|
124
|
+
cgi = CGI.new
|
|
125
|
+
|
|
126
|
+
cgi = WikiCgi.new( cgi, wiki, settings )
|
|
127
|
+
cgi.service
|
data/lib/soks-model.rb
CHANGED
|
@@ -130,8 +130,8 @@ class UploadPage < Page
|
|
|
130
130
|
end
|
|
131
131
|
|
|
132
132
|
class ImagePage < UploadPage
|
|
133
|
-
def textile( content = @content )
|
|
134
|
-
deleted? ? content : "!#{
|
|
133
|
+
def textile( content = @content )
|
|
134
|
+
deleted? ? content : "!#{$SETTINGS[:url]}#{content.strip}!:#{$SETTINGS[:url]}/view/#{@name.url_encode}"
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
def name_for_index; @name[10..-1].strip.downcase end
|
|
@@ -139,7 +139,7 @@ end
|
|
|
139
139
|
|
|
140
140
|
class AttachmentPage < UploadPage
|
|
141
141
|
def textile( content = @content )
|
|
142
|
-
deleted? ? content : %Q{
|
|
142
|
+
deleted? ? content : %Q{[[ #{name} => #{$SETTINGS[:url]}#{content} ]]\n}
|
|
143
143
|
end
|
|
144
144
|
def name_for_index; @name[ 9..-1].strip.downcase end
|
|
145
145
|
end
|
|
@@ -159,10 +159,16 @@ class Wiki
|
|
|
159
159
|
def initialize( folder )
|
|
160
160
|
@folder = folder
|
|
161
161
|
@pages = {}
|
|
162
|
+
@shutting_down = false
|
|
162
163
|
load_all_pages
|
|
163
164
|
start_watching_files
|
|
164
165
|
end
|
|
165
166
|
|
|
167
|
+
def shutdown
|
|
168
|
+
sleep(1) until event_queue.empty?
|
|
169
|
+
@shutting_down = true # Stop further modifications
|
|
170
|
+
end
|
|
171
|
+
|
|
166
172
|
def page( name )
|
|
167
173
|
page_named( name )|| new_page( name, :empty )
|
|
168
174
|
end
|
|
@@ -176,11 +182,13 @@ class Wiki
|
|
|
176
182
|
end
|
|
177
183
|
|
|
178
184
|
def revise( pagename, content, author )
|
|
185
|
+
raise "Sorry! Shutting down..." if @shutting_down
|
|
179
186
|
check_disk_for_updated_page pagename
|
|
180
187
|
mutate( pagename ) { |page| page.revise( content, author ) }
|
|
181
188
|
end
|
|
182
189
|
|
|
183
190
|
def rollback( pagename, number, author )
|
|
191
|
+
raise "Sorry! Shutting down..." if @shutting_down
|
|
184
192
|
check_disk_for_updated_page pagename
|
|
185
193
|
mutate( pagename ) { |page| page.rollback( number, author ) }
|
|
186
194
|
end
|
data/lib/soks-servlet.rb
CHANGED
|
@@ -6,31 +6,30 @@ require 'yaml'
|
|
|
6
6
|
|
|
7
7
|
class WikiServlet < WEBrick::HTTPServlet::AbstractServlet
|
|
8
8
|
|
|
9
|
-
def initialize( server,
|
|
10
|
-
@server, @
|
|
9
|
+
def initialize( server, view, settings )
|
|
10
|
+
@server, @view, @wikiurl, @authenticators = server, view, settings[:url] , settings[:authenticators]
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def service( request, response )
|
|
14
14
|
case request.path
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
when /\/(\w+?)\/(.+)/
|
|
20
|
-
verb, pagename = $1, $2
|
|
15
|
+
when '/robots.txt', '/favicon.ico' # Catch some requests to static files
|
|
16
|
+
doAttachment( request, response, request.path[1..-1] )
|
|
17
|
+
when /\/(\w+?)\/(.+)/ # If request of the form /verb/pagename then doVerb on this class
|
|
18
|
+
verb, pagename = $1, make_pagename_valid( $2 )
|
|
21
19
|
authenticate request, response
|
|
22
20
|
if self.respond_to?( "do#{verb.capitalize}" )
|
|
23
21
|
self.send( "do#{verb.capitalize}", request, response, pagename, request.user )
|
|
24
22
|
else
|
|
25
|
-
|
|
23
|
+
unknownView( request, response, pagename, verb, request.user )
|
|
26
24
|
end
|
|
27
25
|
when /\/(.+)/ ; redirect( response, $1, 'view' ) # No verb given
|
|
28
|
-
when "/"
|
|
26
|
+
when "/" ; redirect( response, $SETTINGS[:home_page], 'view' ) # No page or verb given
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
if $SETTINGS[:force_no_cache]
|
|
30
|
+
response['Cache-control'] ||= 'no-cache'
|
|
31
|
+
response['Pragma'] ||= 'no-cache'
|
|
29
32
|
end
|
|
30
|
-
|
|
31
|
-
response['Content-Type'] ||= "text/html"
|
|
32
|
-
response['Cache-control'] ||= 'no-cache'
|
|
33
|
-
response['Pragma'] ||= 'no-cache'
|
|
34
33
|
end
|
|
35
34
|
|
|
36
35
|
def authenticate( request, response )
|
|
@@ -47,67 +46,84 @@ class WikiServlet < WEBrick::HTTPServlet::AbstractServlet
|
|
|
47
46
|
response.set_redirect(WEBrick::HTTPStatus::Found, verb ? "#{@wikiurl}/#{verb}/#{pagename}" : "#{@wikiurl}/#{pagename}")
|
|
48
47
|
end
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
# These methods deal with the various views
|
|
50
|
+
|
|
51
|
+
def doAttachment( request, response, pagename, person = nil )
|
|
52
|
+
request.script_name = 'attachment'
|
|
53
|
+
request.path_info = "/#{pagename}"
|
|
54
|
+
WEBrick::HTTPServlet::FileHandler.get_instance(@server, "#{$SETTINGS[:root_directory] }/attachment",true).service(request, response)
|
|
52
55
|
end
|
|
53
56
|
|
|
54
57
|
def doFind( request, response, pagename, person )
|
|
55
|
-
response.body = @
|
|
58
|
+
response.body = @view.find( request.query['regex'].strip )
|
|
59
|
+
response['Content-Type'] ||= "text/html"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def doRss( request, response, pagename, person )
|
|
63
|
+
response.body = @view.view( pagename, 'rss', person )
|
|
64
|
+
response["Content-Type"] = "application/xml"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# This captures all unkown view types
|
|
68
|
+
def unknownView( request, response, pagename, view, person )
|
|
69
|
+
response.body = @view.view( pagename, view, person )
|
|
70
|
+
response['Content-Type'] ||= "text/html"
|
|
56
71
|
end
|
|
57
72
|
|
|
73
|
+
# All the following methods change the wiki, then redirect
|
|
74
|
+
|
|
75
|
+
def doWiki( request, response, pagename, person )
|
|
76
|
+
redirect( response, pagename.gsub(/([a-z])([A-Z])/,'\1 \2') )
|
|
77
|
+
end
|
|
78
|
+
|
|
58
79
|
def doSave( request, response, pagename, person )
|
|
59
80
|
content = request.query["content"].to_s
|
|
60
|
-
newpagename = request.query["titleprefix"].to_s + request.query["newtitle"].to_s
|
|
61
|
-
@
|
|
81
|
+
newpagename = make_pagename_valid( request.query["titleprefix"].to_s + request.query["newtitle"].to_s)
|
|
82
|
+
@view.revise( pagename, content.gsub(/\r\n/,"\n"), person, newpagename) if content
|
|
62
83
|
redirect( response, newpagename )
|
|
63
84
|
end
|
|
64
85
|
|
|
65
86
|
def doRollback( request, response, pagename, person )
|
|
66
87
|
revision = request.query['revision'] ? request.query['revision'].to_i : nil
|
|
67
|
-
@
|
|
88
|
+
@view.rollback( pagename, revision, person ) if revision
|
|
68
89
|
redirect( response, pagename )
|
|
69
90
|
end
|
|
70
91
|
|
|
71
92
|
def doDelete( request, response, pagename, person )
|
|
72
|
-
@
|
|
93
|
+
@view.delete( pagename, person )
|
|
73
94
|
redirect( response, pagename )
|
|
74
95
|
end
|
|
75
96
|
|
|
76
97
|
def doUpload( request, response, pagename, person )
|
|
77
|
-
newpagename = request.query["titleprefix"].to_s + request.query["newtitle"].to_s
|
|
98
|
+
newpagename = make_pagename_valid( request.query["titleprefix"].to_s + request.query["newtitle"].to_s)
|
|
78
99
|
unless request.query['file'] == ""
|
|
79
|
-
@
|
|
100
|
+
@view.revise( pagename, upload_file_data( request.query['file'] ), person, newpagename )
|
|
80
101
|
else
|
|
81
|
-
@
|
|
102
|
+
@view.move( pagename, person, newpagename )
|
|
82
103
|
end
|
|
83
104
|
redirect( response, newpagename )
|
|
84
105
|
end
|
|
85
|
-
|
|
86
|
-
def doRss( request, response, pagename, person )
|
|
87
|
-
response.body = @wiki.view( pagename, 'rss', person )
|
|
88
|
-
response["Content-Type"] = "text/xml"
|
|
89
|
-
end
|
|
90
106
|
|
|
91
107
|
private
|
|
92
108
|
|
|
93
|
-
def
|
|
109
|
+
def upload_file_data( upload_data )
|
|
94
110
|
path = "#{$SETTINGS[:root_directory]}/attachment/"
|
|
95
|
-
filename = unique_filename( path ,filename )
|
|
96
|
-
File.open( File.join( path, filename ), 'wb' ) { |file|
|
|
111
|
+
filename = unique_filename( path , upload_data.filename )
|
|
112
|
+
File.open( File.join( path, filename ), 'wb' ) { |file| upload_data.list.each { |data| file << data } }
|
|
97
113
|
"/attachment/#{filename}"
|
|
98
114
|
end
|
|
99
115
|
|
|
100
116
|
def unique_filename( path, filename )
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
117
|
+
filename.gsub!(' ','') # Unfortunately no spaces permitted in redcloth links
|
|
118
|
+
return filename unless File.exist? File.join( path, filename ) # Leave as is, if doesn't exist
|
|
119
|
+
name, counter, extension = File.basename( filename, '.*'), 1, File.extname( filename )
|
|
120
|
+
counter += 1 while File.exist? File.join( path, "#{name}#{counter}#{extension}" )
|
|
121
|
+
return "#{name}#{counter}#{extension}"
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Certain characters cause problems in titles, so delete
|
|
125
|
+
def make_pagename_valid( pagename )
|
|
126
|
+
pagename.tr('\[]?{}&^`<>','')
|
|
111
127
|
end
|
|
112
128
|
end
|
|
113
129
|
|
|
@@ -123,11 +139,18 @@ def start_wiki( settings = {}, &automatic_agents )
|
|
|
123
139
|
block.call( wiki, view )
|
|
124
140
|
end.priority = -2
|
|
125
141
|
|
|
126
|
-
server = WEBrick::HTTPServer.new( { :Port => $SETTINGS[:port]
|
|
127
|
-
|
|
142
|
+
server = WEBrick::HTTPServer.new( { :Port => $SETTINGS[:port],
|
|
143
|
+
:ServerType=> $SETTINGS[:server_type]
|
|
144
|
+
} )
|
|
145
|
+
|
|
128
146
|
server.mount("/", WikiServlet, view, $SETTINGS )
|
|
129
147
|
|
|
130
|
-
trap("INT") {
|
|
148
|
+
trap("INT") {
|
|
149
|
+
$stderr.puts "Trying to shutdown gracefully"
|
|
150
|
+
server.shutdown
|
|
151
|
+
wiki.shutdown
|
|
152
|
+
$stderr.puts "Shutdown."
|
|
153
|
+
}
|
|
131
154
|
|
|
132
155
|
server.start
|
|
133
156
|
end
|