Debian Codegraph @

docs/devel/type_list.htm

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html lang="en">
3 <head>
4 <title>Type HowTo - Custom list view</title>
5 <link rel="stylesheet" type="text/css" href="style/layout.css">
6 <link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
7 </head>
8 <body>
9 <div style="text-align: center;">
10 <h1>Type HowTo - Custom list view<br>
11 </h1>
12 <br>
13 <br>
14 <div style="text-align: left;"><br>
15 <h2>1. Default list attributes<br>
16 </h2>
17 Here you can specify what attributes are shown as default in the list
18 view.<br>
19 <br>
20 The <span style="font-style: italic;">default attributes</span> are
21 specified
22 with <span style="font-weight: bold;">getDefaultListAttributes()</span><span
23 style="font-weight: bold;"></span>.<br>
24 <br>
25 <span style="font-weight: bold; text-decoration: underline;">Example:</span><br
26 style="font-weight: bold; text-decoration: underline;">
27 <br>
28 Our <span style="font-style: italic;">smbDomain</span> type will show
29 the attributes "#sambaDomainName;#sambaSID" by default.<br>
30 <br>
31 <div class="mod-code">
32 &nbsp;&nbsp;&nbsp; * Returns the default attribute list for this
33 account type.<br>
34 &nbsp;&nbsp;&nbsp; *<br>
35 &nbsp;&nbsp;&nbsp; * @return string attribute list<br>
36 &nbsp;&nbsp;&nbsp; */<br>
37 &nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span
38 style="color: rgb(255, 0, 0);">getDefaultListAttributes()</span> {<br>
39 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return
40 "#sambaDomainName;#sambaSID";<br>
41 &nbsp;&nbsp;&nbsp; }<br>
42 </div>
43 <br>
44 <br>
45 <h2>2. Pretranslated attribute descriptions<br>
46 </h2>
47 You can provide translated descriptions for common attributes. This way
48 the user only specifies the attributes and LAM will show a description
49 for each language.<br>
50 <br>
51 The descriptions are specified with <span style="font-weight: bold;">getListAttributeDescriptions()</span><span
52 style="font-weight: bold;"></span>.<br>
53 <br>
54 <span style="font-weight: bold; text-decoration: underline;">Example:</span><br
55 style="font-weight: bold; text-decoration: underline;">
56 <br>
57 Our <span style="font-style: italic;">smbDomain</span> type has
58 descriptions for sambaSID and sambaDomainName.<br>
59 <br>
60 <div class="mod-code">
61 &nbsp;&nbsp;&nbsp; * Returns a list of attributes which have a
62 translated description.<br>
63 &nbsp;&nbsp;&nbsp; * This is used for the head row in the list view.<br>
64 &nbsp;&nbsp;&nbsp; *<br>
65 &nbsp;&nbsp;&nbsp; * @return array list of descriptions<br>
66 &nbsp;&nbsp;&nbsp; */<br>
67 &nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span
68 style="color: rgb(255, 0, 0);">getListAttributeDescriptions()</span> {<br>
69 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return array(<br>
70 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; "sambaSID"
71 =&gt; _("Domain SID"),<br>
72 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
73 "sambaDomainName" =&gt; _("Domain name")<br>
74 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; );<br>
75 &nbsp;&nbsp;&nbsp; }<br>
76 </div>
77 <br>
78 <br>
79 <br>
80 <h2>3. Specifying a custom list view</h2>
81 The default list view has only very generic labels for the buttons and
82 navigation bar. So you should at least provide some new labels which
83 fit to your type.<br>
84 <br>
85 The class name of your list view is specified with <span
86 style="font-weight: bold;">getListClassName()</span><span
87 style="font-weight: bold;"></span>.<br>
88 <br>
89 <span style="font-weight: bold; text-decoration: underline;">Example:</span><br
90 style="font-weight: bold; text-decoration: underline;">
91 <br>
92 Our <span style="font-style: italic;">smbDomain</span> type sets the
93 list view class to <span style="font-style: italic;">lamSmbDomainList</span>.
94 The list class is defined in the same file as your type class
95 (smbDomain.inc in this case).<br>
96 The labels are set in the constructor. Do not forget to call the parent
97 constructor first.<br>
98 <br>
99 If you want to change more than just the labels, take a look at <span
100 style="font-weight: bold;">lib/lists.inc</span> and <span
101 style="font-weight: bold;">lib/types/user.inc</span>. When a list is
102 displayed then the <span style="font-weight: bold;">showPage()</span>
103 function is called. You can overwrite this function to display a
104 completely new list or just one of the other functions.<br>
105 <br>
106 <div class="mod-code">
107 * Returns the class name for the list object.<br>
108 *<br>
109 * @return string class name<br>
110 */<br>
111 function <span style="color: rgb(255, 0, 0);">getListClassName()</span>
112 {<br>
113 &nbsp;&nbsp;&nbsp; return "lamSmbDomainList";<br>
114 }<br>
115 <br>
116 <br>
117 /**<br>
118 &nbsp;* Generates the list view.<br>
119 &nbsp;*<br>
120 &nbsp;* @package lists<br>
121 &nbsp;* @author Roland Gruber<br>
122 &nbsp;* <br>
123 &nbsp;*/<br>
124 class <span style="color: rgb(255, 0, 0);">lamSmbDomainList</span>
125 extends <span style="font-weight: bold;">lamList</span> {<br>
126 <br>
127 &nbsp;&nbsp;&nbsp; /**<br>
128 &nbsp;&nbsp;&nbsp; &nbsp;* Constructor<br>
129 &nbsp;&nbsp;&nbsp; &nbsp;*<br>
130 &nbsp;&nbsp;&nbsp; &nbsp;* @param string $type account type<br>
131 &nbsp;&nbsp;&nbsp; &nbsp;* @return lamList list object<br>
132 &nbsp;&nbsp;&nbsp; &nbsp;*/<br>
133 &nbsp;&nbsp;&nbsp; function lamSmbDomainList($type) {<br>
134 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; parent::lamList($type);<br>
135 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $this-&gt;labels = array(<br>
136 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'nav' =&gt;
137 _("%s domain(s) found"),<br>
138 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
139 'error_noneFound' =&gt; _("No domains found!"),<br>
140 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'newEntry'
141 =&gt; _("New domain"),<br>
142 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'deleteEntry'
143 =&gt; _("Delete domain"),<br>
144 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'createPDF'
145 =&gt; _("Create PDF for selected domain(s)"),<br>
146 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'createPDFAll'
147 =&gt; _("Create PDF for all domains"));<br>
148 &nbsp;&nbsp;&nbsp; }<br>
149 <br>
150 }<br>
151 </div>
152 <br>
153 <br>
154 <br>
155 <br>
156 </div>
157 </div>
158 </body>
159 </html>