dispatcher.luadoc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. ---[[
  2. LuCI web dispatcher.
  3. ]]
  4. module "luci.dispatcher"
  5. ---[[
  6. Build the URL relative to the server webroot from given virtual path.
  7. @class function
  8. @name build_url
  9. @param ... Virtual path
  10. @return Relative URL
  11. ]]
  12. ---[[
  13. Check whether a dispatch node shall be visible
  14. @class function
  15. @name node_visible
  16. @param node Dispatch node
  17. @return Boolean indicating whether the node should be visible
  18. ]]
  19. ---[[
  20. Return a sorted table of visible children within a given node
  21. @class function
  22. @name node_childs
  23. @param node Dispatch node
  24. @return Ordered table of child node names
  25. ]]
  26. ---[[
  27. Send a 404 error code and render the "error404" template if available.
  28. @class function
  29. @name error404
  30. @param message Custom error message (optional)
  31. @return false
  32. ]]
  33. ---[[
  34. Send a 500 error code and render the "error500" template if available.
  35. @class function
  36. @name error500
  37. @param message Custom error message (optional)#
  38. @return false
  39. ]]
  40. ---[[
  41. Dispatch an HTTP request.
  42. @class function
  43. @name httpdispatch
  44. @param request LuCI HTTP Request object
  45. ]]
  46. ---[[
  47. Dispatches a LuCI virtual path.
  48. @class function
  49. @name dispatch
  50. @param request Virtual path
  51. ]]
  52. ---[[
  53. Generate the dispatching index using the native file-cache based strategy.
  54. @class function
  55. @name createindex
  56. ]]
  57. ---[[
  58. Create the dispatching tree from the index.
  59. Build the index before if it does not exist yet.
  60. @class function
  61. @name createtree
  62. ]]
  63. ---[[
  64. Register a tree modifier.
  65. @class function
  66. @name modifier
  67. @param func Modifier function
  68. @param order Modifier order value (optional)
  69. ]]
  70. ---[[
  71. Clone a node of the dispatching tree to another position.
  72. @class function
  73. @name assign
  74. @param path Virtual path destination
  75. @param clone Virtual path source
  76. @param title Destination node title (optional)
  77. @param order Destination node order value (optional)
  78. @return Dispatching tree node
  79. ]]
  80. ---[[
  81. Create a new dispatching node and define common parameters.
  82. @class function
  83. @name entry
  84. @param path Virtual path
  85. @param target Target function to call when dispatched.
  86. @param title Destination node title
  87. @param order Destination node order value (optional)
  88. @return Dispatching tree node
  89. ]]
  90. ---[[
  91. Fetch or create a dispatching node without setting the target module or
  92. enabling the node.
  93. @class function
  94. @name get
  95. @param ... Virtual path
  96. @return Dispatching tree node
  97. ]]
  98. ---[[
  99. Fetch or create a new dispatching node.
  100. @class function
  101. @name node
  102. @param ... Virtual path
  103. @return Dispatching tree node
  104. ]]
  105. ---[[
  106. Lookup node in dispatching tree.
  107. @class function
  108. @name lookup
  109. @param ... Virtual path
  110. @return Node object, canonical url or nil if the path was not found.
  111. ]]
  112. ---[[
  113. Alias the first (lowest order) page automatically
  114. @class function
  115. @name firstchild
  116. ]]
  117. ---[[
  118. Create a redirect to another dispatching node.
  119. @class function
  120. @name alias
  121. @param ... Virtual path destination
  122. ]]
  123. ---[[
  124. Rewrite the first x path values of the request.
  125. @class function
  126. @name rewrite
  127. @param n Number of path values to replace
  128. @param ... Virtual path to replace removed path values with
  129. ]]
  130. ---[[
  131. Create a function-call dispatching target.
  132. @class function
  133. @name call
  134. @param name Target function of local controller
  135. @param ... Additional parameters passed to the function
  136. ]]
  137. ---[[
  138. Create a template render dispatching target.
  139. @class function
  140. @name template
  141. @param name Template to be rendered
  142. ]]
  143. ---[[
  144. Create a CBI model dispatching target.
  145. @class function
  146. @name cbi
  147. @param model CBI model to be rendered
  148. ]]
  149. ---[[
  150. Create a combined dispatching target for non argv and argv requests.
  151. @class function
  152. @name arcombine
  153. @param trg1 Overview Target
  154. @param trg2 Detail Target
  155. ]]
  156. ---[[
  157. Create a CBI form model dispatching target.
  158. @class function
  159. @name form
  160. @param model CBI form model tpo be rendered
  161. ]]
  162. ---[[
  163. Access the luci.i18n translate() api.
  164. @class function
  165. @name translate
  166. @param text Text to translate
  167. ]]
  168. ---[[
  169. No-op function used to mark translation entries for menu labels.
  170. This function does not actually translate the given argument but
  171. is used by build/i18n-scan.pl to find translatable entries.
  172. @class function
  173. @name _
  174. ]]