dispatcher.luadoc 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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. Clone a node of the dispatching tree to another position.
  65. @class function
  66. @name assign
  67. @param path Virtual path destination
  68. @param clone Virtual path source
  69. @param title Destination node title (optional)
  70. @param order Destination node order value (optional)
  71. @return Dispatching tree node
  72. ]]
  73. ---[[
  74. Create a new dispatching node and define common parameters.
  75. @class function
  76. @name entry
  77. @param path Virtual path
  78. @param target Target function to call when dispatched.
  79. @param title Destination node title
  80. @param order Destination node order value (optional)
  81. @return Dispatching tree node
  82. ]]
  83. ---[[
  84. Fetch or create a dispatching node without setting the target module or
  85. enabling the node.
  86. @class function
  87. @name get
  88. @param ... Virtual path
  89. @return Dispatching tree node
  90. ]]
  91. ---[[
  92. Fetch or create a new dispatching node.
  93. @class function
  94. @name node
  95. @param ... Virtual path
  96. @return Dispatching tree node
  97. ]]
  98. ---[[
  99. Lookup node in dispatching tree.
  100. @class function
  101. @name lookup
  102. @param ... Virtual path
  103. @return Node object, canonical url or nil if the path was not found.
  104. ]]
  105. ---[[
  106. Alias the first (lowest order) page automatically
  107. @class function
  108. @name firstchild
  109. ]]
  110. ---[[
  111. Create a redirect to another dispatching node.
  112. @class function
  113. @name alias
  114. @param ... Virtual path destination
  115. ]]
  116. ---[[
  117. Rewrite the first x path values of the request.
  118. @class function
  119. @name rewrite
  120. @param n Number of path values to replace
  121. @param ... Virtual path to replace removed path values with
  122. ]]
  123. ---[[
  124. Create a function-call dispatching target.
  125. @class function
  126. @name call
  127. @param name Target function of local controller
  128. @param ... Additional parameters passed to the function
  129. ]]
  130. ---[[
  131. Create a template render dispatching target.
  132. @class function
  133. @name template
  134. @param name Template to be rendered
  135. ]]
  136. ---[[
  137. Create a CBI model dispatching target.
  138. @class function
  139. @name cbi
  140. @param model CBI model to be rendered
  141. ]]
  142. ---[[
  143. Create a combined dispatching target for non argv and argv requests.
  144. @class function
  145. @name arcombine
  146. @param trg1 Overview Target
  147. @param trg2 Detail Target
  148. ]]
  149. ---[[
  150. Create a CBI form model dispatching target.
  151. @class function
  152. @name form
  153. @param model CBI form model tpo be rendered
  154. ]]
  155. ---[[
  156. Access the luci.i18n translate() api.
  157. @class function
  158. @name translate
  159. @param text Text to translate
  160. ]]
  161. ---[[
  162. No-op function used to mark translation entries for menu labels.
  163. This function does not actually translate the given argument but
  164. is used by build/i18n-scan.pl to find translatable entries.
  165. @class function
  166. @name _
  167. ]]