luci.dispatcher.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html>
  4. <head>
  5. <title>Reference</title>
  6. <link rel="stylesheet" href="../luadoc.css" type="text/css" />
  7. <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
  8. </head>
  9. <body>
  10. <div id="container">
  11. <div id="product">
  12. <div id="product_logo"></div>
  13. <div id="product_name"><big><b></b></big></div>
  14. <div id="product_description"></div>
  15. </div> <!-- id="product" -->
  16. <div id="main">
  17. <div id="navigation">
  18. <h1>LuaDoc</h1>
  19. <ul>
  20. <li><a href="../index.html">Index</a></li>
  21. </ul>
  22. <!-- Module list -->
  23. <h1>Modules</h1>
  24. <ul>
  25. <li><strong>luci.dispatcher</strong></li>
  26. <li>
  27. <a href="../modules/luci.http.html">luci.http</a>
  28. </li>
  29. <li>
  30. <a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
  31. </li>
  32. <li>
  33. <a href="../modules/luci.http.date.html">luci.http.date</a>
  34. </li>
  35. <li>
  36. <a href="../modules/luci.http.mime.html">luci.http.mime</a>
  37. </li>
  38. <li>
  39. <a href="../modules/luci.i18n.html">luci.i18n</a>
  40. </li>
  41. <li>
  42. <a href="../modules/luci.ip.html">luci.ip</a>
  43. </li>
  44. <li>
  45. <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
  46. </li>
  47. <li>
  48. <a href="../modules/luci.json.html">luci.json</a>
  49. </li>
  50. <li>
  51. <a href="../modules/luci.jsonc.html">luci.jsonc</a>
  52. </li>
  53. <li>
  54. <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
  55. </li>
  56. <li>
  57. <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
  58. </li>
  59. <li>
  60. <a href="../modules/luci.model.uci.html">luci.model.uci</a>
  61. </li>
  62. <li>
  63. <a href="../modules/luci.rpcc.html">luci.rpcc</a>
  64. </li>
  65. <li>
  66. <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
  67. </li>
  68. <li>
  69. <a href="../modules/luci.sys.html">luci.sys</a>
  70. </li>
  71. <li>
  72. <a href="../modules/luci.sys.init.html">luci.sys.init</a>
  73. </li>
  74. <li>
  75. <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
  76. </li>
  77. <li>
  78. <a href="../modules/luci.sys.net.html">luci.sys.net</a>
  79. </li>
  80. <li>
  81. <a href="../modules/luci.sys.process.html">luci.sys.process</a>
  82. </li>
  83. <li>
  84. <a href="../modules/luci.sys.user.html">luci.sys.user</a>
  85. </li>
  86. <li>
  87. <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
  88. </li>
  89. <li>
  90. <a href="../modules/luci.util.html">luci.util</a>
  91. </li>
  92. <li>
  93. <a href="../modules/luci.xml.html">luci.xml</a>
  94. </li>
  95. <li>
  96. <a href="../modules/nixio.html">nixio</a>
  97. </li>
  98. <li>
  99. <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
  100. </li>
  101. <li>
  102. <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
  103. </li>
  104. <li>
  105. <a href="../modules/nixio.File.html">nixio.File</a>
  106. </li>
  107. <li>
  108. <a href="../modules/nixio.README.html">nixio.README</a>
  109. </li>
  110. <li>
  111. <a href="../modules/nixio.Socket.html">nixio.Socket</a>
  112. </li>
  113. <li>
  114. <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
  115. </li>
  116. <li>
  117. <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
  118. </li>
  119. <li>
  120. <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
  121. </li>
  122. <li>
  123. <a href="../modules/nixio.bin.html">nixio.bin</a>
  124. </li>
  125. <li>
  126. <a href="../modules/nixio.bit.html">nixio.bit</a>
  127. </li>
  128. <li>
  129. <a href="../modules/nixio.crypto.html">nixio.crypto</a>
  130. </li>
  131. <li>
  132. <a href="../modules/nixio.fs.html">nixio.fs</a>
  133. </li>
  134. </ul>
  135. <!-- File list -->
  136. </div><!-- id="navigation" -->
  137. <div id="content">
  138. <h1>Class <code>luci.dispatcher</code></h1>
  139. <p></p>
  140. <h2>Functions</h2>
  141. <table class="function_list">
  142. <tr>
  143. <td class="name" nowrap><a href="#_">_</a>&nbsp;()</td>
  144. <td class="summary">
  145. No-op function used to mark translation entries for menu labels.</td>
  146. </tr>
  147. <tr>
  148. <td class="name" nowrap><a href="#alias">alias</a>&nbsp;(...)</td>
  149. <td class="summary">
  150. Create a redirect to another dispatching node.</td>
  151. </tr>
  152. <tr>
  153. <td class="name" nowrap><a href="#arcombine">arcombine</a>&nbsp;(trg1, trg2)</td>
  154. <td class="summary">
  155. Create a combined dispatching target for non argv and argv requests.</td>
  156. </tr>
  157. <tr>
  158. <td class="name" nowrap><a href="#assign">assign</a>&nbsp;(path, clone, title, order)</td>
  159. <td class="summary">
  160. Clone a node of the dispatching tree to another position.</td>
  161. </tr>
  162. <tr>
  163. <td class="name" nowrap><a href="#build_url">build_url</a>&nbsp;(...)</td>
  164. <td class="summary">
  165. Build the URL relative to the server webroot from given virtual path.</td>
  166. </tr>
  167. <tr>
  168. <td class="name" nowrap><a href="#call">call</a>&nbsp;(name, ...)</td>
  169. <td class="summary">
  170. Create a function-call dispatching target.</td>
  171. </tr>
  172. <tr>
  173. <td class="name" nowrap><a href="#cbi">cbi</a>&nbsp;(model)</td>
  174. <td class="summary">
  175. Create a CBI model dispatching target.</td>
  176. </tr>
  177. <tr>
  178. <td class="name" nowrap><a href="#createindex">createindex</a>&nbsp;()</td>
  179. <td class="summary">
  180. Generate the dispatching index using the native file-cache based strategy.</td>
  181. </tr>
  182. <tr>
  183. <td class="name" nowrap><a href="#createtree">createtree</a>&nbsp;()</td>
  184. <td class="summary">
  185. Create the dispatching tree from the index.</td>
  186. </tr>
  187. <tr>
  188. <td class="name" nowrap><a href="#dispatch">dispatch</a>&nbsp;(request)</td>
  189. <td class="summary">
  190. Dispatches a LuCI virtual path.</td>
  191. </tr>
  192. <tr>
  193. <td class="name" nowrap><a href="#entry">entry</a>&nbsp;(path, target, title, order)</td>
  194. <td class="summary">
  195. Create a new dispatching node and define common parameters.</td>
  196. </tr>
  197. <tr>
  198. <td class="name" nowrap><a href="#error404">error404</a>&nbsp;(message)</td>
  199. <td class="summary">
  200. Send a 404 error code and render the "error404" template if available.</td>
  201. </tr>
  202. <tr>
  203. <td class="name" nowrap><a href="#error500">error500</a>&nbsp;(message)</td>
  204. <td class="summary">
  205. Send a 500 error code and render the "error500" template if available.</td>
  206. </tr>
  207. <tr>
  208. <td class="name" nowrap><a href="#firstchild">firstchild</a>&nbsp;()</td>
  209. <td class="summary">
  210. Alias the first (lowest order) page automatically
  211. </td>
  212. </tr>
  213. <tr>
  214. <td class="name" nowrap><a href="#form">form</a>&nbsp;(model)</td>
  215. <td class="summary">
  216. Create a CBI form model dispatching target.</td>
  217. </tr>
  218. <tr>
  219. <td class="name" nowrap><a href="#get">get</a>&nbsp;(...)</td>
  220. <td class="summary">
  221. Fetch or create a dispatching node without setting the target module or
  222. enabling the node.</td>
  223. </tr>
  224. <tr>
  225. <td class="name" nowrap><a href="#httpdispatch">httpdispatch</a>&nbsp;(request)</td>
  226. <td class="summary">
  227. Dispatch an HTTP request.</td>
  228. </tr>
  229. <tr>
  230. <td class="name" nowrap><a href="#lookup">lookup</a>&nbsp;(...)</td>
  231. <td class="summary">
  232. Lookup node in dispatching tree.</td>
  233. </tr>
  234. <tr>
  235. <td class="name" nowrap><a href="#node">node</a>&nbsp;(...)</td>
  236. <td class="summary">
  237. Fetch or create a new dispatching node.</td>
  238. </tr>
  239. <tr>
  240. <td class="name" nowrap><a href="#node_childs">node_childs</a>&nbsp;(node)</td>
  241. <td class="summary">
  242. Return a sorted table of visible children within a given node
  243. </td>
  244. </tr>
  245. <tr>
  246. <td class="name" nowrap><a href="#node_visible">node_visible</a>&nbsp;(node)</td>
  247. <td class="summary">
  248. Check whether a dispatch node shall be visible
  249. </td>
  250. </tr>
  251. <tr>
  252. <td class="name" nowrap><a href="#rewrite">rewrite</a>&nbsp;(n, ...)</td>
  253. <td class="summary">
  254. Rewrite the first x path values of the request.</td>
  255. </tr>
  256. <tr>
  257. <td class="name" nowrap><a href="#template">template</a>&nbsp;(name)</td>
  258. <td class="summary">
  259. Create a template render dispatching target.</td>
  260. </tr>
  261. <tr>
  262. <td class="name" nowrap><a href="#translate">translate</a>&nbsp;(text)</td>
  263. <td class="summary">
  264. Access the luci.i18n translate() api.</td>
  265. </tr>
  266. </table>
  267. <br/>
  268. <br/>
  269. <h2><a name="functions"></a>Functions</h2>
  270. <dl class="function">
  271. <dt><a name="_"></a><strong>_</strong>&nbsp;()</dt>
  272. <dd>
  273. No-op function used to mark translation entries for menu labels.
  274. This function does not actually translate the given argument but
  275. is used by build/i18n-scan.pl to find translatable entries.
  276. </dd>
  277. <dt><a name="alias"></a><strong>alias</strong>&nbsp;(...)</dt>
  278. <dd>
  279. Create a redirect to another dispatching node.
  280. <h3>Parameters</h3>
  281. <ul>
  282. <li>
  283. ...: Virtual path destination
  284. </li>
  285. </ul>
  286. </dd>
  287. <dt><a name="arcombine"></a><strong>arcombine</strong>&nbsp;(trg1, trg2)</dt>
  288. <dd>
  289. Create a combined dispatching target for non argv and argv requests.
  290. <h3>Parameters</h3>
  291. <ul>
  292. <li>
  293. trg1: Overview Target
  294. </li>
  295. <li>
  296. trg2: Detail Target
  297. </li>
  298. </ul>
  299. </dd>
  300. <dt><a name="assign"></a><strong>assign</strong>&nbsp;(path, clone, title, order)</dt>
  301. <dd>
  302. Clone a node of the dispatching tree to another position.
  303. <h3>Parameters</h3>
  304. <ul>
  305. <li>
  306. path: Virtual path destination
  307. </li>
  308. <li>
  309. clone: Virtual path source
  310. </li>
  311. <li>
  312. title: Destination node title (optional)
  313. </li>
  314. <li>
  315. order: Destination node order value (optional)
  316. </li>
  317. </ul>
  318. <h3>Return value:</h3>
  319. Dispatching tree node
  320. </dd>
  321. <dt><a name="build_url"></a><strong>build_url</strong>&nbsp;(...)</dt>
  322. <dd>
  323. Build the URL relative to the server webroot from given virtual path.
  324. <h3>Parameters</h3>
  325. <ul>
  326. <li>
  327. ...: Virtual path
  328. </li>
  329. </ul>
  330. <h3>Return value:</h3>
  331. Relative URL
  332. </dd>
  333. <dt><a name="call"></a><strong>call</strong>&nbsp;(name, ...)</dt>
  334. <dd>
  335. Create a function-call dispatching target.
  336. <h3>Parameters</h3>
  337. <ul>
  338. <li>
  339. name: Target function of local controller
  340. </li>
  341. <li>
  342. ...: Additional parameters passed to the function
  343. </li>
  344. </ul>
  345. </dd>
  346. <dt><a name="cbi"></a><strong>cbi</strong>&nbsp;(model)</dt>
  347. <dd>
  348. Create a CBI model dispatching target.
  349. <h3>Parameters</h3>
  350. <ul>
  351. <li>
  352. model: CBI model to be rendered
  353. </li>
  354. </ul>
  355. </dd>
  356. <dt><a name="createindex"></a><strong>createindex</strong>&nbsp;()</dt>
  357. <dd>
  358. Generate the dispatching index using the native file-cache based strategy.
  359. </dd>
  360. <dt><a name="createtree"></a><strong>createtree</strong>&nbsp;()</dt>
  361. <dd>
  362. Create the dispatching tree from the index.
  363. Build the index before if it does not exist yet.
  364. </dd>
  365. <dt><a name="dispatch"></a><strong>dispatch</strong>&nbsp;(request)</dt>
  366. <dd>
  367. Dispatches a LuCI virtual path.
  368. <h3>Parameters</h3>
  369. <ul>
  370. <li>
  371. request: Virtual path
  372. </li>
  373. </ul>
  374. </dd>
  375. <dt><a name="entry"></a><strong>entry</strong>&nbsp;(path, target, title, order)</dt>
  376. <dd>
  377. Create a new dispatching node and define common parameters.
  378. <h3>Parameters</h3>
  379. <ul>
  380. <li>
  381. path: Virtual path
  382. </li>
  383. <li>
  384. target: Target function to call when dispatched.
  385. </li>
  386. <li>
  387. title: Destination node title
  388. </li>
  389. <li>
  390. order: Destination node order value (optional)
  391. </li>
  392. </ul>
  393. <h3>Return value:</h3>
  394. Dispatching tree node
  395. </dd>
  396. <dt><a name="error404"></a><strong>error404</strong>&nbsp;(message)</dt>
  397. <dd>
  398. Send a 404 error code and render the "error404" template if available.
  399. <h3>Parameters</h3>
  400. <ul>
  401. <li>
  402. message: Custom error message (optional)
  403. </li>
  404. </ul>
  405. <h3>Return value:</h3>
  406. false
  407. </dd>
  408. <dt><a name="error500"></a><strong>error500</strong>&nbsp;(message)</dt>
  409. <dd>
  410. Send a 500 error code and render the "error500" template if available.
  411. <h3>Parameters</h3>
  412. <ul>
  413. <li>
  414. message: Custom error message (optional)#
  415. </li>
  416. </ul>
  417. <h3>Return value:</h3>
  418. false
  419. </dd>
  420. <dt><a name="firstchild"></a><strong>firstchild</strong>&nbsp;()</dt>
  421. <dd>
  422. Alias the first (lowest order) page automatically
  423. </dd>
  424. <dt><a name="form"></a><strong>form</strong>&nbsp;(model)</dt>
  425. <dd>
  426. Create a CBI form model dispatching target.
  427. <h3>Parameters</h3>
  428. <ul>
  429. <li>
  430. model: CBI form model tpo be rendered
  431. </li>
  432. </ul>
  433. </dd>
  434. <dt><a name="get"></a><strong>get</strong>&nbsp;(...)</dt>
  435. <dd>
  436. Fetch or create a dispatching node without setting the target module or
  437. enabling the node.
  438. <h3>Parameters</h3>
  439. <ul>
  440. <li>
  441. ...: Virtual path
  442. </li>
  443. </ul>
  444. <h3>Return value:</h3>
  445. Dispatching tree node
  446. </dd>
  447. <dt><a name="httpdispatch"></a><strong>httpdispatch</strong>&nbsp;(request)</dt>
  448. <dd>
  449. Dispatch an HTTP request.
  450. <h3>Parameters</h3>
  451. <ul>
  452. <li>
  453. request: LuCI HTTP Request object
  454. </li>
  455. </ul>
  456. </dd>
  457. <dt><a name="lookup"></a><strong>lookup</strong>&nbsp;(...)</dt>
  458. <dd>
  459. Lookup node in dispatching tree.
  460. <h3>Parameters</h3>
  461. <ul>
  462. <li>
  463. ...: Virtual path
  464. </li>
  465. </ul>
  466. <h3>Return value:</h3>
  467. Node object, canonical url or nil if the path was not found.
  468. </dd>
  469. <dt><a name="node"></a><strong>node</strong>&nbsp;(...)</dt>
  470. <dd>
  471. Fetch or create a new dispatching node.
  472. <h3>Parameters</h3>
  473. <ul>
  474. <li>
  475. ...: Virtual path
  476. </li>
  477. </ul>
  478. <h3>Return value:</h3>
  479. Dispatching tree node
  480. </dd>
  481. <dt><a name="node_childs"></a><strong>node_childs</strong>&nbsp;(node)</dt>
  482. <dd>
  483. Return a sorted table of visible children within a given node
  484. <h3>Parameters</h3>
  485. <ul>
  486. <li>
  487. node: Dispatch node
  488. </li>
  489. </ul>
  490. <h3>Return value:</h3>
  491. Ordered table of child node names
  492. </dd>
  493. <dt><a name="node_visible"></a><strong>node_visible</strong>&nbsp;(node)</dt>
  494. <dd>
  495. Check whether a dispatch node shall be visible
  496. <h3>Parameters</h3>
  497. <ul>
  498. <li>
  499. node: Dispatch node
  500. </li>
  501. </ul>
  502. <h3>Return value:</h3>
  503. Boolean indicating whether the node should be visible
  504. </dd>
  505. <dt><a name="rewrite"></a><strong>rewrite</strong>&nbsp;(n, ...)</dt>
  506. <dd>
  507. Rewrite the first x path values of the request.
  508. <h3>Parameters</h3>
  509. <ul>
  510. <li>
  511. n: Number of path values to replace
  512. </li>
  513. <li>
  514. ...: Virtual path to replace removed path values with
  515. </li>
  516. </ul>
  517. </dd>
  518. <dt><a name="template"></a><strong>template</strong>&nbsp;(name)</dt>
  519. <dd>
  520. Create a template render dispatching target.
  521. <h3>Parameters</h3>
  522. <ul>
  523. <li>
  524. name: Template to be rendered
  525. </li>
  526. </ul>
  527. </dd>
  528. <dt><a name="translate"></a><strong>translate</strong>&nbsp;(text)</dt>
  529. <dd>
  530. Access the luci.i18n translate() api.
  531. <h3>Parameters</h3>
  532. <ul>
  533. <li>
  534. text: Text to translate
  535. </li>
  536. </ul>
  537. </dd>
  538. </dl>
  539. </div> <!-- id="content" -->
  540. </div> <!-- id="main" -->
  541. <div id="about">
  542. <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
  543. </div> <!-- id="about" -->
  544. </div> <!-- id="container" -->
  545. </body>
  546. </html>