1
0

luci.dispatcher.html 14 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151
  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.protocol.html">luci.http.protocol</a>
  31. </li>
  32. <li>
  33. <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a>
  34. </li>
  35. <li>
  36. <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a>
  37. </li>
  38. <li>
  39. <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a>
  40. </li>
  41. <li>
  42. <a href="../modules/luci.i18n.html">luci.i18n</a>
  43. </li>
  44. <li>
  45. <a href="../modules/luci.ip.html">luci.ip</a>
  46. </li>
  47. <li>
  48. <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
  49. </li>
  50. <li>
  51. <a href="../modules/luci.json.html">luci.json</a>
  52. </li>
  53. <li>
  54. <a href="../modules/luci.jsonc.html">luci.jsonc</a>
  55. </li>
  56. <li>
  57. <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
  58. </li>
  59. <li>
  60. <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
  61. </li>
  62. <li>
  63. <a href="../modules/luci.model.uci.html">luci.model.uci</a>
  64. </li>
  65. <li>
  66. <a href="../modules/luci.rpcc.html">luci.rpcc</a>
  67. </li>
  68. <li>
  69. <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
  70. </li>
  71. <li>
  72. <a href="../modules/luci.sys.html">luci.sys</a>
  73. </li>
  74. <li>
  75. <a href="../modules/luci.sys.init.html">luci.sys.init</a>
  76. </li>
  77. <li>
  78. <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
  79. </li>
  80. <li>
  81. <a href="../modules/luci.sys.net.html">luci.sys.net</a>
  82. </li>
  83. <li>
  84. <a href="../modules/luci.sys.process.html">luci.sys.process</a>
  85. </li>
  86. <li>
  87. <a href="../modules/luci.sys.user.html">luci.sys.user</a>
  88. </li>
  89. <li>
  90. <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
  91. </li>
  92. <li>
  93. <a href="../modules/luci.util.html">luci.util</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="#modifier">modifier</a>&nbsp;(func, order)</td>
  231. <td class="summary">
  232. Register a tree modifier.</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 childs 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="modifier"></a><strong>modifier</strong>&nbsp;(func, order)</dt>
  458. <dd>
  459. Register a tree modifier.
  460. <h3>Parameters</h3>
  461. <ul>
  462. <li>
  463. func: Modifier function
  464. </li>
  465. <li>
  466. order: Modifier order value (optional)
  467. </li>
  468. </ul>
  469. </dd>
  470. <dt><a name="node"></a><strong>node</strong>&nbsp;(...)</dt>
  471. <dd>
  472. Fetch or create a new dispatching node.
  473. <h3>Parameters</h3>
  474. <ul>
  475. <li>
  476. ...: Virtual path
  477. </li>
  478. </ul>
  479. <h3>Return value:</h3>
  480. Dispatching tree node
  481. </dd>
  482. <dt><a name="node_childs"></a><strong>node_childs</strong>&nbsp;(node)</dt>
  483. <dd>
  484. Return a sorted table of visible childs within a given node
  485. <h3>Parameters</h3>
  486. <ul>
  487. <li>
  488. node: Dispatch node
  489. </li>
  490. </ul>
  491. <h3>Return value:</h3>
  492. Ordered table of child node names
  493. </dd>
  494. <dt><a name="node_visible"></a><strong>node_visible</strong>&nbsp;(node)</dt>
  495. <dd>
  496. Check whether a dispatch node shall be visible
  497. <h3>Parameters</h3>
  498. <ul>
  499. <li>
  500. node: Dispatch node
  501. </li>
  502. </ul>
  503. <h3>Return value:</h3>
  504. Boolean indicating whether the node should be visible
  505. </dd>
  506. <dt><a name="rewrite"></a><strong>rewrite</strong>&nbsp;(n, ...)</dt>
  507. <dd>
  508. Rewrite the first x path values of the request.
  509. <h3>Parameters</h3>
  510. <ul>
  511. <li>
  512. n: Number of path values to replace
  513. </li>
  514. <li>
  515. ...: Virtual path to replace removed path values with
  516. </li>
  517. </ul>
  518. </dd>
  519. <dt><a name="template"></a><strong>template</strong>&nbsp;(name)</dt>
  520. <dd>
  521. Create a template render dispatching target.
  522. <h3>Parameters</h3>
  523. <ul>
  524. <li>
  525. name: Template to be rendered
  526. </li>
  527. </ul>
  528. </dd>
  529. <dt><a name="translate"></a><strong>translate</strong>&nbsp;(text)</dt>
  530. <dd>
  531. Access the luci.i18n translate() api.
  532. <h3>Parameters</h3>
  533. <ul>
  534. <li>
  535. text: Text to translate
  536. </li>
  537. </ul>
  538. </dd>
  539. </dl>
  540. </div> <!-- id="content" -->
  541. </div> <!-- id="main" -->
  542. <div id="about">
  543. <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>
  544. </div> <!-- id="about" -->
  545. </div> <!-- id="container" -->
  546. </body>
  547. </html>