Piki is a minimal wiki
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

help.py 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. from django.utils.translation import gettext as _
  2. import mycreole
  3. import pages
  4. from themes import color_icon_url
  5. HELP_UID = 'help'
  6. MAIN = mycreole.render_simple(_(
  7. """
  8. = Piki
  9. **piki** is a minimal wiki implemented with python and django.
  10. == Get it
  11. For download and installation instructions, visit [[https://git.mount-mockery.de/application/piki]].
  12. == Help
  13. * [[creole|Creole Markup Language]]
  14. * [[access|Access Control for the site content]]
  15. * [[search|Help on Search]]
  16. """))
  17. CREOLE = mycreole.mycreole_help_pagecontent()
  18. CREOLE += mycreole.render_simple("""
  19. = Piki Markup
  20. | {{{[[rel_path_to_page|Name]]}}} | will result in a Link to the given wiki page. |
  21. | {{{<<subpages>>}}} | will result in a list of all subpages below the current page. |
  22. | {{{<<subpages=N,startswith>>}}} | will result in a list of subpages below the current page.\
  23. N will reduce the depth of the subpages to N. \
  24. startswith will reduce the hits to all pages starting with the given string. \
  25. You can give one or both Parameters. |
  26. | {{{<<allpages>>}}} | will result in a last of all pages. You can use [N,startswith] as with subpages. |
  27. """)
  28. ACCESS = mycreole.render_simple(_("""
  29. = Access
  30. == Administrator
  31. If the user has //Superuser status//, the user is able to create, read and write all pages.
  32. == Create new pages
  33. Only users with //Superuser status// or //Staff status// are able to create new pages.
  34. == Page rigths
  35. All following subsections are able to grant read or write access to the user
  36. === Owner permissions
  37. Every page has an owner, if the user is the owner, the defined read or write permissions will be granted.
  38. === Group permissions
  39. Every page has a group, if the user is in that group, the defined read or write permissions will be granted.
  40. === Other permissions
  41. If no other mechanism granted the permissions, the defined read or write permissions for all other users will be granted.
  42. = Default permissions
  43. | =Mechanism | =Read | Write |
  44. | Owner | X | X |
  45. | Group | X | X |
  46. | Other | X | - |
  47. """))
  48. SEARCH = mycreole.render_simple(_(
  49. """
  50. = Search
  51. The search looks up full words in //title (page basename)//, //page_src (the creole source)// and //tag (page tags)// \
  52. without giving special search commands in the search string.
  53. === Search fields
  54. * title (TEXT)
  55. * page_src (TEXT)
  56. * tag (TEXT)
  57. * creation_time (DATETIME)
  58. * modified_time (DATETIME)
  59. * modified_user (TEXT)
  60. == Search syntax (Whoosh)
  61. === Logic operators
  62. * AND
  63. ** **Example:** "foo AND bar" - Search will find all items with foo and bar.
  64. * OR
  65. ** **Example:** "foo OR bar" - Search will find all items with foo, bar or with foo and bar.
  66. * NOT
  67. ** **Example:** "foo NOT bar" - Search will find all items with foo and no bar.
  68. === Search in specific fields
  69. A search pattern like //foo:bar// does look for //bar// in the field named //foo//.
  70. This search pattern can also be combined with other search text via logical operators.
  71. === Search for specific content
  72. * **Wildcards:**
  73. * **Range:**
  74. ** From To:
  75. ** Above:
  76. ** Below:
  77. * **Named constants:**
  78. ** //now//: Current date
  79. ** //-[num]y//: Current date minus [num] years
  80. ** //+[num]mo//: Current date plus [num] months
  81. ** //-[num]d//: Current date minus [num] days
  82. ** ...
  83. == Examples
  84. * [[/search/?q=modified_user:system-page|modified_user:system-page]] results in a list of all system pages.
  85. * [[/search/?q=modified_time%3A%5B-5d+to+now%5D| modified_time:[-5d to now] ]] results in a list of all pages which have been modified within the last 5 days.
  86. * [[/search/?q=tag%3Afoo| tag:foo ]] results in a list of all pages which are tagged with //foo//.
  87. """))
  88. BACKUP = mycreole.render_simple(_(
  89. """
  90. = Backup
  91. With the following command, you create a backup of your piki. It contains out of two files. {{{pages.json}}} \
  92. includes userdata, bottombar configurations and so on. The pages are included in {{{pages.tgz}}}.
  93. {{{
  94. $ cd <PROJECT_DIRECTORY>
  95. $ source venv/bin/activate
  96. $ python manage.py dumpdata --natural-foreign --natural-primary -e contenttypes -e sessions -e auth.Permission -e sessions -e pages --indent 2 > pages.json
  97. $ tar -czf pages.tgz data/pages data/media
  98. }}}
  99. = Recovery
  100. Be carefull with these commands. They delete all the data, before recovering from the backup files!
  101. {{{
  102. $ cd <PROJECT_DIRECTORY>
  103. $ source venv/bin/activate
  104. $ rm db.sqlite3
  105. $ rm -rf data/pages data/media
  106. $ python manage.py migrate
  107. $ python manage.py loaddata pages.json
  108. $ tar -xvzf pages.tgz
  109. }}}
  110. """))
  111. help_pages = {
  112. 'main': MAIN,
  113. 'creole': CREOLE,
  114. 'access': ACCESS,
  115. 'search': SEARCH,
  116. 'backup': BACKUP
  117. }
  118. def actionbar(context, request, current_help_page=None, **kwargs):
  119. actionbar_entries = (
  120. ('1', 'Main'),
  121. ('2', 'Creole'),
  122. ('3', 'Access'),
  123. ('4', 'Search'),
  124. ('5', 'Backup'),
  125. )
  126. for num, name in actionbar_entries:
  127. context[context.ACTIONBAR].append_entry(
  128. HELP_UID + '-%s' % name.lower(), # uid
  129. _(name), # name
  130. color_icon_url(request, num + '.png'), # icon
  131. pages.url_helpview(name.lower()), # url
  132. True, # left
  133. name.lower() == current_help_page, # active
  134. )