documentation: delete obsoleted file that has a troublesome name
[project/luci.git] / documentation / api / modules / luci.dispatcher.html
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
10 <body>
11 <div id="container">
12
13 <div id="product">
14         <div id="product_logo"></div>
15         <div id="product_name"><big><b></b></big></div>
16         <div id="product_description"></div>
17 </div> <!-- id="product" -->
18
19 <div id="main">
20
21 <div id="navigation">
22
23
24 <h1>LuaDoc</h1>
25 <ul>
26         
27         <li><a href="../index.html">Index</a></li>
28         
29 </ul>
30
31
32 <!-- Module list -->
33
34 <h1>Modules</h1>
35 <ul>
36
37         <li><strong>luci.dispatcher</strong></li>
38         
39         <li>
40                 <a href="../modules/luci.http.html">luci.http</a>
41         </li>
42
43         <li>
44                 <a href="../modules/luci.http.protocol.html">luci.http.protocol</a>
45         </li>
46
47         <li>
48                 <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a>
49         </li>
50
51         <li>
52                 <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a>
53         </li>
54
55         <li>
56                 <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a>
57         </li>
58
59         <li>
60                 <a href="../modules/luci.i18n.html">luci.i18n</a>
61         </li>
62
63         <li>
64                 <a href="../modules/luci.ip.html">luci.ip</a>
65         </li>
66
67         <li>
68                 <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
69         </li>
70
71         <li>
72                 <a href="../modules/luci.json.html">luci.json</a>
73         </li>
74
75         <li>
76                 <a href="../modules/luci.jsonc.html">luci.jsonc</a>
77         </li>
78
79         <li>
80                 <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
81         </li>
82
83         <li>
84                 <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
85         </li>
86
87         <li>
88                 <a href="../modules/luci.model.uci.html">luci.model.uci</a>
89         </li>
90
91         <li>
92                 <a href="../modules/luci.rpcc.html">luci.rpcc</a>
93         </li>
94
95         <li>
96                 <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
97         </li>
98
99         <li>
100                 <a href="../modules/luci.sys.html">luci.sys</a>
101         </li>
102
103         <li>
104                 <a href="../modules/luci.sys.init.html">luci.sys.init</a>
105         </li>
106
107         <li>
108                 <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
109         </li>
110
111         <li>
112                 <a href="../modules/luci.sys.net.html">luci.sys.net</a>
113         </li>
114
115         <li>
116                 <a href="../modules/luci.sys.process.html">luci.sys.process</a>
117         </li>
118
119         <li>
120                 <a href="../modules/luci.sys.user.html">luci.sys.user</a>
121         </li>
122
123         <li>
124                 <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
125         </li>
126
127         <li>
128                 <a href="../modules/luci.util.html">luci.util</a>
129         </li>
130
131         <li>
132                 <a href="../modules/nixio.html">nixio</a>
133         </li>
134
135         <li>
136                 <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
137         </li>
138
139         <li>
140                 <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
141         </li>
142
143         <li>
144                 <a href="../modules/nixio.File.html">nixio.File</a>
145         </li>
146
147         <li>
148                 <a href="../modules/nixio.README.html">nixio.README</a>
149         </li>
150
151         <li>
152                 <a href="../modules/nixio.Socket.html">nixio.Socket</a>
153         </li>
154
155         <li>
156                 <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
157         </li>
158
159         <li>
160                 <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
161         </li>
162
163         <li>
164                 <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
165         </li>
166
167         <li>
168                 <a href="../modules/nixio.bin.html">nixio.bin</a>
169         </li>
170
171         <li>
172                 <a href="../modules/nixio.bit.html">nixio.bit</a>
173         </li>
174
175         <li>
176                 <a href="../modules/nixio.crypto.html">nixio.crypto</a>
177         </li>
178
179         <li>
180                 <a href="../modules/nixio.fs.html">nixio.fs</a>
181         </li>
182
183 </ul>
184
185
186
187 <!-- File list -->
188
189
190
191
192
193
194
195 </div><!-- id="navigation" -->
196
197 <div id="content">
198
199 <h1>Class <code>luci.dispatcher</code></h1>
200
201 <p></p>
202
203
204
205
206
207
208
209 <h2>Functions</h2>
210 <table class="function_list">
211
212         <tr>
213         <td class="name" nowrap><a href="#_">_</a>&nbsp;()</td>
214         <td class="summary">
215  
216 No-op function used to mark translation entries for menu labels.</td>
217         </tr>
218
219         <tr>
220         <td class="name" nowrap><a href="#alias">alias</a>&nbsp;(...)</td>
221         <td class="summary">
222  
223 Create a redirect to another dispatching node.</td>
224         </tr>
225
226         <tr>
227         <td class="name" nowrap><a href="#arcombine">arcombine</a>&nbsp;(trg1, trg2)</td>
228         <td class="summary">
229  
230 Create a combined dispatching target for non argv and argv requests.</td>
231         </tr>
232
233         <tr>
234         <td class="name" nowrap><a href="#assign">assign</a>&nbsp;(path, clone, title, order)</td>
235         <td class="summary">
236  
237 Clone a node of the dispatching tree to another position.</td>
238         </tr>
239
240         <tr>
241         <td class="name" nowrap><a href="#build_url">build_url</a>&nbsp;(...)</td>
242         <td class="summary">
243  
244 Build the URL relative to the server webroot from given virtual path.</td>
245         </tr>
246
247         <tr>
248         <td class="name" nowrap><a href="#call">call</a>&nbsp;(name, ...)</td>
249         <td class="summary">
250  
251 Create a function-call dispatching target.</td>
252         </tr>
253
254         <tr>
255         <td class="name" nowrap><a href="#cbi">cbi</a>&nbsp;(model)</td>
256         <td class="summary">
257  
258 Create a CBI model dispatching target.</td>
259         </tr>
260
261         <tr>
262         <td class="name" nowrap><a href="#createindex">createindex</a>&nbsp;()</td>
263         <td class="summary">
264  
265 Generate the dispatching index using the native file-cache based strategy.</td>
266         </tr>
267
268         <tr>
269         <td class="name" nowrap><a href="#createtree">createtree</a>&nbsp;()</td>
270         <td class="summary">
271  
272 Create the dispatching tree from the index.</td>
273         </tr>
274
275         <tr>
276         <td class="name" nowrap><a href="#dispatch">dispatch</a>&nbsp;(request)</td>
277         <td class="summary">
278  
279 Dispatches a LuCI virtual path.</td>
280         </tr>
281
282         <tr>
283         <td class="name" nowrap><a href="#entry">entry</a>&nbsp;(path, target, title, order)</td>
284         <td class="summary">
285  
286 Create a new dispatching node and define common parameters.</td>
287         </tr>
288
289         <tr>
290         <td class="name" nowrap><a href="#error404">error404</a>&nbsp;(message)</td>
291         <td class="summary">
292  
293 Send a 404 error code and render the "error404" template if available.</td>
294         </tr>
295
296         <tr>
297         <td class="name" nowrap><a href="#error500">error500</a>&nbsp;(message)</td>
298         <td class="summary">
299  
300 Send a 500 error code and render the "error500" template if available.</td>
301         </tr>
302
303         <tr>
304         <td class="name" nowrap><a href="#firstchild">firstchild</a>&nbsp;()</td>
305         <td class="summary">
306  
307 Alias the first (lowest order) page automatically 
308  
309  </td>
310         </tr>
311
312         <tr>
313         <td class="name" nowrap><a href="#form">form</a>&nbsp;(model)</td>
314         <td class="summary">
315  
316 Create a CBI form model dispatching target.</td>
317         </tr>
318
319         <tr>
320         <td class="name" nowrap><a href="#get">get</a>&nbsp;(...)</td>
321         <td class="summary">
322  
323 Fetch or create a dispatching node without setting the target module or 
324  
325 enabling the node.</td>
326         </tr>
327
328         <tr>
329         <td class="name" nowrap><a href="#httpdispatch">httpdispatch</a>&nbsp;(request)</td>
330         <td class="summary">
331  
332 Dispatch an HTTP request.</td>
333         </tr>
334
335         <tr>
336         <td class="name" nowrap><a href="#modifier">modifier</a>&nbsp;(func, order)</td>
337         <td class="summary">
338  
339 Register a tree modifier.</td>
340         </tr>
341
342         <tr>
343         <td class="name" nowrap><a href="#node">node</a>&nbsp;(...)</td>
344         <td class="summary">
345  
346 Fetch or create a new dispatching node.</td>
347         </tr>
348
349         <tr>
350         <td class="name" nowrap><a href="#node_childs">node_childs</a>&nbsp;(node)</td>
351         <td class="summary">
352  
353 Return a sorted table of visible childs within a given node 
354  </td>
355         </tr>
356
357         <tr>
358         <td class="name" nowrap><a href="#node_visible">node_visible</a>&nbsp;(node)</td>
359         <td class="summary">
360  
361 Check whether a dispatch node shall be visible 
362  </td>
363         </tr>
364
365         <tr>
366         <td class="name" nowrap><a href="#rewrite">rewrite</a>&nbsp;(n, ...)</td>
367         <td class="summary">
368  
369 Rewrite the first x path values of the request.</td>
370         </tr>
371
372         <tr>
373         <td class="name" nowrap><a href="#template">template</a>&nbsp;(name)</td>
374         <td class="summary">
375  
376 Create a template render dispatching target.</td>
377         </tr>
378
379         <tr>
380         <td class="name" nowrap><a href="#translate">translate</a>&nbsp;(text)</td>
381         <td class="summary">
382  
383 Access the luci.i18n translate() api.</td>
384         </tr>
385
386 </table>
387
388
389
390
391
392
393 <br/>
394 <br/>
395
396
397 <h2><a name="functions"></a>Functions</h2>
398 <dl class="function">
399
400
401
402 <dt><a name="_"></a><strong>_</strong>&nbsp;()</dt>
403 <dd>
404
405  
406 No-op function used to mark translation entries for menu labels. 
407  
408 This function does not actually translate the given argument but 
409 is used by build/i18n-scan.pl to find translatable entries. 
410
411
412
413
414
415
416
417
418
419
420 </dd>
421
422
423
424
425 <dt><a name="alias"></a><strong>alias</strong>&nbsp;(...)</dt>
426 <dd>
427
428  
429 Create a redirect to another dispatching node. 
430
431
432
433 <h3>Parameters</h3>
434 <ul>
435         
436         <li>
437           ...: Virtual path destination
438         </li>
439         
440 </ul>
441
442
443
444
445
446
447
448
449 </dd>
450
451
452
453
454 <dt><a name="arcombine"></a><strong>arcombine</strong>&nbsp;(trg1, trg2)</dt>
455 <dd>
456
457  
458 Create a combined dispatching target for non argv and argv requests. 
459
460
461
462 <h3>Parameters</h3>
463 <ul>
464         
465         <li>
466           trg1: Overview Target
467         </li>
468         
469         <li>
470           trg2: Detail Target
471         </li>
472         
473 </ul>
474
475
476
477
478
479
480
481
482 </dd>
483
484
485
486
487 <dt><a name="assign"></a><strong>assign</strong>&nbsp;(path, clone, title, order)</dt>
488 <dd>
489
490  
491 Clone a node of the dispatching tree to another position. 
492
493
494
495 <h3>Parameters</h3>
496 <ul>
497         
498         <li>
499           path: Virtual path destination
500         </li>
501         
502         <li>
503           clone: Virtual path source
504         </li>
505         
506         <li>
507           title: Destination node title (optional)
508         </li>
509         
510         <li>
511           order: Destination node order value (optional)
512         </li>
513         
514 </ul>
515
516
517
518
519
520
521 <h3>Return value:</h3>
522 Dispatching tree node
523
524
525
526 </dd>
527
528
529
530
531 <dt><a name="build_url"></a><strong>build_url</strong>&nbsp;(...)</dt>
532 <dd>
533
534  
535 Build the URL relative to the server webroot from given virtual path. 
536
537
538
539 <h3>Parameters</h3>
540 <ul>
541         
542         <li>
543           ...: Virtual path
544         </li>
545         
546 </ul>
547
548
549
550
551
552
553 <h3>Return value:</h3>
554 Relative URL
555
556
557
558 </dd>
559
560
561
562
563 <dt><a name="call"></a><strong>call</strong>&nbsp;(name, ...)</dt>
564 <dd>
565
566  
567 Create a function-call dispatching target. 
568
569
570
571 <h3>Parameters</h3>
572 <ul>
573         
574         <li>
575           name: Target function of local controller
576         </li>
577         
578         <li>
579           ...: Additional parameters passed to the function
580         </li>
581         
582 </ul>
583
584
585
586
587
588
589
590
591 </dd>
592
593
594
595
596 <dt><a name="cbi"></a><strong>cbi</strong>&nbsp;(model)</dt>
597 <dd>
598
599  
600 Create a CBI model dispatching target. 
601
602
603
604 <h3>Parameters</h3>
605 <ul>
606         
607         <li>
608           model: CBI model to be rendered
609         </li>
610         
611 </ul>
612
613
614
615
616
617
618
619
620 </dd>
621
622
623
624
625 <dt><a name="createindex"></a><strong>createindex</strong>&nbsp;()</dt>
626 <dd>
627
628  
629 Generate the dispatching index using the native file-cache based strategy. 
630  
631
632
633
634
635
636
637
638
639
640
641 </dd>
642
643
644
645
646 <dt><a name="createtree"></a><strong>createtree</strong>&nbsp;()</dt>
647 <dd>
648
649  
650 Create the dispatching tree from the index. 
651  
652 Build the index before if it does not exist yet. 
653
654
655
656
657
658
659
660
661
662
663 </dd>
664
665
666
667
668 <dt><a name="dispatch"></a><strong>dispatch</strong>&nbsp;(request)</dt>
669 <dd>
670
671  
672 Dispatches a LuCI virtual path. 
673
674
675
676 <h3>Parameters</h3>
677 <ul>
678         
679         <li>
680           request: Virtual path
681         </li>
682         
683 </ul>
684
685
686
687
688
689
690
691
692 </dd>
693
694
695
696
697 <dt><a name="entry"></a><strong>entry</strong>&nbsp;(path, target, title, order)</dt>
698 <dd>
699
700  
701 Create a new dispatching node and define common parameters. 
702
703
704
705 <h3>Parameters</h3>
706 <ul>
707         
708         <li>
709           path: Virtual path
710         </li>
711         
712         <li>
713           target: Target function to call when dispatched.
714         </li>
715         
716         <li>
717           title: Destination node title
718         </li>
719         
720         <li>
721           order: Destination node order value (optional)
722         </li>
723         
724 </ul>
725
726
727
728
729
730
731 <h3>Return value:</h3>
732 Dispatching tree node
733
734
735
736 </dd>
737
738
739
740
741 <dt><a name="error404"></a><strong>error404</strong>&nbsp;(message)</dt>
742 <dd>
743
744  
745 Send a 404 error code and render the "error404" template if available. 
746
747
748
749 <h3>Parameters</h3>
750 <ul>
751         
752         <li>
753           message: Custom error message (optional)
754         </li>
755         
756 </ul>
757
758
759
760
761
762
763 <h3>Return value:</h3>
764 false
765
766
767
768 </dd>
769
770
771
772
773 <dt><a name="error500"></a><strong>error500</strong>&nbsp;(message)</dt>
774 <dd>
775
776  
777 Send a 500 error code and render the "error500" template if available. 
778
779
780
781 <h3>Parameters</h3>
782 <ul>
783         
784         <li>
785           message: Custom error message (optional)#
786         </li>
787         
788 </ul>
789
790
791
792
793
794
795 <h3>Return value:</h3>
796 false
797
798
799
800 </dd>
801
802
803
804
805 <dt><a name="firstchild"></a><strong>firstchild</strong>&nbsp;()</dt>
806 <dd>
807
808  
809 Alias the first (lowest order) page automatically 
810  
811
812
813
814
815
816
817
818
819
820
821 </dd>
822
823
824
825
826 <dt><a name="form"></a><strong>form</strong>&nbsp;(model)</dt>
827 <dd>
828
829  
830 Create a CBI form model dispatching target. 
831
832
833
834 <h3>Parameters</h3>
835 <ul>
836         
837         <li>
838           model: CBI form model tpo be rendered
839         </li>
840         
841 </ul>
842
843
844
845
846
847
848
849
850 </dd>
851
852
853
854
855 <dt><a name="get"></a><strong>get</strong>&nbsp;(...)</dt>
856 <dd>
857
858  
859 Fetch or create a dispatching node without setting the target module or 
860  
861 enabling the node.
862
863
864 <h3>Parameters</h3>
865 <ul>
866         
867         <li>
868           ...: Virtual path
869         </li>
870         
871 </ul>
872
873
874
875
876
877
878 <h3>Return value:</h3>
879 Dispatching tree node
880
881
882
883 </dd>
884
885
886
887
888 <dt><a name="httpdispatch"></a><strong>httpdispatch</strong>&nbsp;(request)</dt>
889 <dd>
890
891  
892 Dispatch an HTTP request. 
893
894
895
896 <h3>Parameters</h3>
897 <ul>
898         
899         <li>
900           request: LuCI HTTP Request object
901         </li>
902         
903 </ul>
904
905
906
907
908
909
910
911
912 </dd>
913
914
915
916
917 <dt><a name="modifier"></a><strong>modifier</strong>&nbsp;(func, order)</dt>
918 <dd>
919
920  
921 Register a tree modifier. 
922
923
924
925 <h3>Parameters</h3>
926 <ul>
927         
928         <li>
929           func: Modifier function
930         </li>
931         
932         <li>
933           order: Modifier order value (optional)
934         </li>
935         
936 </ul>
937
938
939
940
941
942
943
944
945 </dd>
946
947
948
949
950 <dt><a name="node"></a><strong>node</strong>&nbsp;(...)</dt>
951 <dd>
952
953  
954 Fetch or create a new dispatching node. 
955
956
957
958 <h3>Parameters</h3>
959 <ul>
960         
961         <li>
962           ...: Virtual path
963         </li>
964         
965 </ul>
966
967
968
969
970
971
972 <h3>Return value:</h3>
973 Dispatching tree node
974
975
976
977 </dd>
978
979
980
981
982 <dt><a name="node_childs"></a><strong>node_childs</strong>&nbsp;(node)</dt>
983 <dd>
984
985  
986 Return a sorted table of visible childs within a given node 
987
988
989
990 <h3>Parameters</h3>
991 <ul>
992         
993         <li>
994           node: Dispatch node
995         </li>
996         
997 </ul>
998
999
1000
1001
1002
1003
1004 <h3>Return value:</h3>
1005 Ordered table of child node names
1006
1007
1008
1009 </dd>
1010
1011
1012
1013
1014 <dt><a name="node_visible"></a><strong>node_visible</strong>&nbsp;(node)</dt>
1015 <dd>
1016
1017  
1018 Check whether a dispatch node shall be visible 
1019
1020
1021
1022 <h3>Parameters</h3>
1023 <ul>
1024         
1025         <li>
1026           node: Dispatch node
1027         </li>
1028         
1029 </ul>
1030
1031
1032
1033
1034
1035
1036 <h3>Return value:</h3>
1037 Boolean indicating whether the node should be visible
1038
1039
1040
1041 </dd>
1042
1043
1044
1045
1046 <dt><a name="rewrite"></a><strong>rewrite</strong>&nbsp;(n, ...)</dt>
1047 <dd>
1048
1049  
1050 Rewrite the first x path values of the request. 
1051
1052
1053
1054 <h3>Parameters</h3>
1055 <ul>
1056         
1057         <li>
1058           n: Number of path values to replace
1059         </li>
1060         
1061         <li>
1062           ...: Virtual path to replace removed path values with
1063         </li>
1064         
1065 </ul>
1066
1067
1068
1069
1070
1071
1072
1073
1074 </dd>
1075
1076
1077
1078
1079 <dt><a name="template"></a><strong>template</strong>&nbsp;(name)</dt>
1080 <dd>
1081
1082  
1083 Create a template render dispatching target. 
1084
1085
1086
1087 <h3>Parameters</h3>
1088 <ul>
1089         
1090         <li>
1091           name: Template to be rendered
1092         </li>
1093         
1094 </ul>
1095
1096
1097
1098
1099
1100
1101
1102
1103 </dd>
1104
1105
1106
1107
1108 <dt><a name="translate"></a><strong>translate</strong>&nbsp;(text)</dt>
1109 <dd>
1110
1111  
1112 Access the luci.i18n translate() api. 
1113
1114
1115
1116 <h3>Parameters</h3>
1117 <ul>
1118         
1119         <li>
1120           text: Text to translate
1121         </li>
1122         
1123 </ul>
1124
1125
1126
1127
1128
1129
1130
1131
1132 </dd>
1133
1134
1135 </dl>
1136
1137
1138
1139
1140
1141 </div> <!-- id="content" -->
1142
1143 </div> <!-- id="main" -->
1144
1145 <div id="about">
1146         <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>
1147 </div> <!-- id="about" -->
1148
1149 </div> <!-- id="container" -->
1150 </body>
1151 </html>