Debian Codegraph @

docs/devel/toolsHowTo.htm

raw symbols SCIP
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html lang="en"><head>
3
4 <meta content="text/html; charset=ISO-8859-15" http-equiv="content-type">
5 <title>Tools HowTo</title>
6
7
8
9 <link rel="stylesheet" type="text/css" href="style/layout.css">
10
11
12 <link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
13
14 </head><body>
15 <h1 style="text-align: center;">Tools HowTo<br>
16 </h1>
17
18 <div style="text-align: center;"><br>
19 </div>
20
21 <div style="text-align: center;"><br>
22 <div style="text-align: left;">You can add your own tools easily.
23 Please follow the following steps to create a custom tool. Tools are
24 displayed in the tools menu in the upper right corner of LAM.<br>
25 <br>
26 <h2>Create tool definition class</h2>
27 All tools contain a definition class and a separate PHP page that displays the content itself.<br>
28 First, you need to create a new tool definition class in <span style="font-weight: bold;">lib/tools</span>. The file name does not need to follow any patterns but there must be a class included that implements the <span style="font-weight: bold;">LAMTool</span> interface.<br>
29 <br>
30 Example:<br>
31 <br>
32 <pre>/**</pre>
33 <pre>&nbsp;* Server information</pre>
34 <pre>&nbsp;* </pre>
35 <pre>&nbsp;* @package tools</pre>
36 <pre>&nbsp;*/ </pre>
37 <pre>class toolServerInformation implements LAMTool {</pre>
38 <pre>&nbsp;&nbsp;&nbsp; </pre>
39 <pre>&nbsp;&nbsp;&nbsp; /**</pre>
40 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* Returns the name of the tool.</pre>
41 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* </pre>
42 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* @return string name</pre>
43 <pre>&nbsp;&nbsp;&nbsp; &nbsp;*/</pre>
44 <pre>&nbsp;&nbsp;&nbsp; &nbsp;function getName() {</pre>
45 <pre>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; return _("Server information");</pre>
46 <pre>&nbsp;&nbsp;&nbsp; &nbsp;}</pre>
47 <pre>&nbsp;&nbsp;&nbsp; </pre>
48 <pre>&nbsp;&nbsp;&nbsp; /**</pre>
49 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* returns a description text for the tool.</pre>
50 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* </pre>
51 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* @return string description</pre>
52 <pre>&nbsp;&nbsp;&nbsp; &nbsp;*/</pre>
53 <pre>&nbsp;&nbsp;&nbsp; function getDescription() {</pre>
54 <pre>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return _("Information about the LDAP server.");</pre>
55 <pre>&nbsp;&nbsp;&nbsp; }</pre>
56 <pre>&nbsp;&nbsp;&nbsp; </pre>
57 <pre>&nbsp;&nbsp;&nbsp; /**</pre>
58 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* Returns a link to the tool page (relative to templates/).</pre>
59 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* </pre>
60 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* @return string link</pre>
61 <pre>&nbsp;&nbsp;&nbsp; &nbsp;*/</pre>
62 <pre>&nbsp;&nbsp;&nbsp; function getLink() {</pre>
63 <pre>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return "serverInfo.php";</pre>
64 <pre>&nbsp;&nbsp;&nbsp; }</pre>
65 <pre>&nbsp;&nbsp;&nbsp; </pre>
66 <pre>&nbsp;&nbsp;&nbsp; /** </pre>
67 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* Returns if the tool requires write access to LDAP.</pre>
68 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* </pre>
69 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* @return boolean true if write access is needed</pre>
70 <pre>&nbsp;&nbsp;&nbsp; &nbsp;*/</pre>
71 <pre>&nbsp;&nbsp;&nbsp; function getRequiresWriteAccess() {</pre>
72 <pre>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return false;</pre>
73 <pre>&nbsp;&nbsp;&nbsp; }</pre>
74 <pre>&nbsp;&nbsp;&nbsp; </pre>
75 <pre>&nbsp;&nbsp;&nbsp; /**</pre>
76 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* Returns if the tool requires password change rights.</pre>
77 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* </pre>
78 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* @return boolean true if password change rights are needed</pre>
79 <pre>&nbsp;&nbsp;&nbsp; &nbsp;*/</pre>
80 <pre>&nbsp;&nbsp;&nbsp; function getRequiresPasswordChangeRights() {</pre>
81 <pre>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return true;</pre>
82 <pre>&nbsp;&nbsp;&nbsp; }</pre>
83 <pre>&nbsp;&nbsp;&nbsp; </pre>
84 <pre>&nbsp;&nbsp;&nbsp; /**</pre>
85 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* Returns the link to the tool image (relative to graphics/)</pre>
86 <pre>&nbsp;&nbsp;&nbsp; &nbsp;*</pre>
87 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* @return string image URL</pre>
88 <pre>&nbsp;&nbsp;&nbsp; &nbsp;*/</pre>
89 <pre>&nbsp;&nbsp;&nbsp; function getImageLink() {</pre>
90 <pre>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return 'tree_info.png';</pre>
91 <pre>&nbsp;&nbsp;&nbsp; }</pre>
92 <pre>&nbsp;&nbsp;&nbsp; </pre>
93 <pre>&nbsp;&nbsp;&nbsp; /**</pre>
94 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* Returns the preferred position of this tool on the tools page.</pre>
95 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* The position may be between 0 and 1000. 0 is the top position.</pre>
96 <pre>&nbsp;&nbsp;&nbsp; &nbsp;*</pre>
97 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* @return int preferred position</pre>
98 <pre>&nbsp;&nbsp;&nbsp; &nbsp;*/</pre>
99 <pre>&nbsp;&nbsp;&nbsp; function getPosition() {</pre>
100 <pre>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return 600;</pre>
101 <pre>&nbsp;&nbsp;&nbsp; }</pre>
102 <pre>&nbsp;&nbsp;&nbsp; </pre>
103 <pre>&nbsp;&nbsp;&nbsp; /**</pre>
104 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* Returns a list of sub tools or an empty array.</pre>
105 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* </pre>
106 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* @return array list of subtools (LAMTool)</pre>
107 <pre>&nbsp;&nbsp;&nbsp; &nbsp;*/</pre>
108 <pre>&nbsp;&nbsp;&nbsp; function getSubTools() {</pre>
109 <pre>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return array();</pre>
110 <pre>&nbsp;&nbsp;&nbsp; }</pre>
111 <pre>&nbsp;&nbsp;&nbsp; </pre>
112 <pre>&nbsp;&nbsp;&nbsp; /**</pre>
113 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* Returns if the tool is visible in the menu.</pre>
114 <pre>&nbsp;&nbsp;&nbsp; &nbsp;*</pre>
115 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* @return boolean visible</pre>
116 <pre>&nbsp;&nbsp;&nbsp; &nbsp;*/</pre>
117 <pre>&nbsp;&nbsp;&nbsp; function isVisible() {</pre>
118 <pre>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return true;</pre>
119 <pre>&nbsp;&nbsp;&nbsp; }</pre>
120 <pre>&nbsp;&nbsp;&nbsp; </pre>
121 <pre>&nbsp;&nbsp;&nbsp; /**</pre>
122 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* Returns if a tool may be hidden by configuration in the LAM server profile.</pre>
123 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* </pre>
124 <pre>&nbsp;&nbsp;&nbsp; &nbsp;* @return boolean hideable</pre>
125 <pre>&nbsp;&nbsp;&nbsp; &nbsp;*/</pre>
126 <pre>&nbsp;&nbsp;&nbsp; function isHideable() {</pre>
127 <pre>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return true;</pre>
128 <pre>&nbsp;&nbsp;&nbsp; }</pre>
129 <pre>&nbsp;&nbsp;&nbsp; </pre>
130 <pre>}</pre>
131 The functions are quite self-descriptive.<br>
132 LAM Pro provides multiple access levels. The functions <span style="font-weight: bold;">getRequiresWriteAccess()/getRequiresPasswordChangeRights()</span> can restrict the visibility of the tool.<br>
133 <br>
134 You will also need a logo for your tool. This can be any image in the folder <span style="font-weight: bold;">graphics</span>.<br>
135 <br>
136 Sometimes you may want to create a submenu to group multiple tools. This is possible by using the function <span style="font-weight: bold;">getSubTools()</span>. It returns a list of LAMSubTool objects.<br>
137 <br>
138 <h2>Create the tool page</h2>
139 Each tool definition provides the path to its tool page with the function <span style="font-weight: bold;">getLink()</span>. The tool page can be any PHP page inside the directory <span style="font-weight: bold;">templates</span>.<br>
140 <br>
141 This is all that you need to create your own tool for LAM. :)<br>
142 </div>
143 </div>
144
145 </body></html>