Django Library PaTT
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 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. from django.utils.translation import gettext as _
  2. import mycreole
  3. import patt
  4. from themes import color_icon_url
  5. # TODO: Search: Describe search fields
  6. # TODO: Search: Describe logic operator order and brackets if possible
  7. # TODO: Search: Extend Examples with useful features.
  8. # TODO: Search for specific content: Describe search possibilities (also in pygal)
  9. HELP_UID = 'help'
  10. MAIN = mycreole.render_simple(_("""
  11. = PaTT
  12. **PaTT** is a **P**roject **a**nd **T**eamorganisation **T**ool.
  13. It is designed to store Tasks in relation to Projects and Users.
  14. == Help
  15. * [[creole|Creole Markup Language]]
  16. * [[access|Access Control for the site content]]
  17. * [[search|Help on Search]]
  18. == Items
  19. === Task properties:
  20. * State
  21. * Targetdate
  22. * Priority
  23. * Progress
  24. * Name
  25. * Description
  26. === Project properties:
  27. * Project Leaders
  28. * Project Members
  29. * State
  30. * Name
  31. * Description
  32. """))
  33. CREOLE = mycreole.mycreole_help_pagecontent()
  34. CREOLE += mycreole.render_simple("""
  35. = PaTT Markup
  36. {{{[[task:number]]}}} will result in a Link to the given tasknumber.
  37. {{{[[tasklist:number]]}}} will result in a Link to the tasklist of the given projectnumber.
  38. """)
  39. ACCESS = mycreole.render_simple(_("""
  40. = Superuser(s)
  41. * Are able to view, create and edit everything!
  42. * Only a Superuser is able to create a project.
  43. = Non-Staff-Users
  44. * Are able to read their own tasks, which are in the state "Open" or "Finished" and the related project(s) to these tasks.
  45. * They don't get project role permissions (Projectleader, -member, ...), even if they have a role.
  46. * They don't get permission to change any content.
  47. = Projectleader(s)
  48. * Are able to view and edit everything related to the project.
  49. * They are able to create tasks for the project for any user with a projectrole.
  50. = Projectmember(s)
  51. * Are able to view everything related to the project.
  52. * They are have limited modify permission to their own task related to that project.
  53. * They are able to leave taskcomments at every task related to the project.
  54. * They are able to create tasks related to the project for themselves.
  55. = Projectvisitor(s)
  56. * Are able to view everything related to the project.
  57. * They are have limited modify permission to their own task related to that project.
  58. """))
  59. SEARCH = mycreole.render_simple(_("""
  60. = Search
  61. The search looks up full words in //Tasknames (name)// and //Taskdescriptions (description)// without giving \
  62. special search commands in the search string. The search will result in a tasklist.
  63. === Task search fields
  64. * task_id (NUMERIC):
  65. * assigned_user (TEXT):
  66. * assigned_user_missing (BOOLEAN):
  67. * name (TEXT):
  68. * description (TEXT):
  69. * state (TEXT):
  70. ** The state of a Task. It is one of the following states: Open, Finished, Closed, Cancelled
  71. * targetdate (DATETIME):
  72. === Project related fields
  73. * project_id (NUMERIC):
  74. * project_name (TEXT):
  75. * project_description (TEXT):
  76. === Comment related field
  77. * comment (TEXT):
  78. == Search syntax (Whoosh)
  79. === Logic operators
  80. * AND
  81. ** **Example:** "foo AND bar" - Search will find all items with foo and bar.
  82. * OR
  83. ** **Example:** "foo OR bar" - Search will find all items with foo, bar or with foo and bar.
  84. * NOT
  85. ** **Example:** "foo NOT bar" - Search will find all items with foo and no bar.
  86. === Search in specific fields
  87. A search pattern like //foo:bar// does look for //bar// in the field named //foo//.
  88. This search pattern can also be combined with other search text via logical operators.
  89. === Search for specific content
  90. * **Wildcards:**
  91. * **Range:**
  92. ** From To:
  93. ** Above:
  94. ** Below:
  95. * **Named constants:**
  96. ** //now//: Current date
  97. ** //-[num]y//: Current date minus [num] years
  98. ** //+[num]mo//: Current date plus [num] months
  99. ** //-[num]d//: Current date minus [num] days
  100. ** ...
  101. == Examples
  102. * [[/patt/tasklist/search?q=project_id:1|project_id:1]] gives results with all tasks of project number #1.
  103. * [[/patt/tasklist/search?q=project_id:1 AND assigned_user:dirk|project_id:1 AND assigned_user:dirk]] gives results with all tasks of project number #1 which are assigned to 'dirk'.
  104. * [[/patt/tasklist/search?q=assigned_user:dirk+AND+targetdate:[2000+to+%2b5d]|assigned_user:dirk AND targetdate:[2000 to +5d] ]] gives results with tasks having a targetdate within the next 5 days and assigned to 'dirk'.
  105. """))
  106. help_pages = {
  107. 'main': MAIN,
  108. 'creole': CREOLE,
  109. 'access': ACCESS,
  110. 'search': SEARCH,
  111. }
  112. def actionbar(context, request, current_help_page=None, **kwargs):
  113. actionbar_entries = (
  114. ('1', 'Main'),
  115. ('2', 'Creole'),
  116. ('3', 'Access'),
  117. ('4', 'Search'),
  118. )
  119. for num, name in actionbar_entries:
  120. context[context.ACTIONBAR].append_entry(
  121. HELP_UID + '-%s' % name.lower(), # uid
  122. _(name), # name
  123. color_icon_url(request, num + '.png'), # icon
  124. patt.url_helpview(request, name.lower()), # url
  125. True, # left
  126. name.lower() == current_help_page, # active
  127. )