<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Module HowTo - Advanced upload options</title>
<link rel="stylesheet" type="text/css" href="style/layout.css">
</head>
<body>
<div style="text-align: center;">
<h1>Module HowTo - Advanced upload options<br>
</h1>
<div style="text-align: left;"><br>
The <span style="font-style: italic;">ieee802Device</span> module only
needs the basic upload functions for its functionality.<br>
However there are more possibilities for the modules to control the
file upload.<br>
</div>
<div style="text-align: left;"><br>
<h2>1. Module order<br>
</h2>
Your module might depend on the input values of another module. In this
case you probably want that your module is called as the second one.<br>
<br>
You can define dependencies to other modules with the function <span
style="font-weight: bold;">get_uploadPreDepends()</span> or <span
style="font-weight: bold;">meta['upload_preDepends']</span>.<br>
<br>
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
style="font-weight: bold; text-decoration: underline;">
<br>
The <span style="font-style: italic;">sambaGroupMapping</span> module
needs the group name to set the default <span
style="font-style: italic;">displayName</span>. Therefore it depends
on the <span style="font-style: italic;">posixGroup</span> module<br>
<br>
<table style="width: 100%; text-align: left;" class="mod-code"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;"> /**<br>
* Returns meta data that is interpreted by parent
class<br>
*<br>
* @return array array with meta data<br>
*/<br>
<span style="font-weight: bold;"> function</span>
get_metaData() {<br>
$return = array();<br>
// upload dependencies<br>
$return[<span
style="color: rgb(255, 0, 0);">'upload_preDepends'</span>] =
array('posixGroup');<br>
[...]<br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
<h2>2. Upload post actions<br>
</h2>
If your module does not only create an account but relates the account
with other existing LDAP entries you can do these modifications after
the account was created.<br>
This is useful for adding users to groups or setting quotas.<br>
<br>
You have to implement the function <span style="font-weight: bold;">doUploadPostActions()</span>
in your module. Since post actions are very special there is no <span
style="font-style: italic;">meta data</span> for this.<br>
<br>
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
style="font-weight: bold; text-decoration: underline;">
<br>
The <span style="font-style: italic;">posixAccount</span> module
offers to put the user account in additional groups. This is done in
the post actions.<br>
<br>
<table style="width: 100%; text-align: left;" class="mod-code"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;"> /**<br>
* This function executes one post upload action.<br>
*<br>
* @param array $data array containing one account in
each element<br>
* @param array $ids array(<column_name> =>
<column number>)<br>
* @param array $failed list of accounts which were
not created successfully<br>
* @param array $temp variable to store temporary
data between two post actions<br>
* @return array current status<br>
* <br> array (<br>
* <br> 'status' => 'finished' |
'inProgress'<br>
* <br> 'progress' => 0..100<br>
* <br> 'errors' => array (<array
of parameters for StatusMessage>)<br>
* <br> )<br>
*/<br>
<span style="font-weight: bold;">function</span> <span
style="color: rgb(255, 0, 0);">doUploadPostActions</span>($data, $ids,
$failed, &$temp) {<br>
[...]<br>
}<br>
</td>
</tr>
</tbody>
</table>
<br>
Please make sure that the actions in one call of <span
style="font-weight: bold;">doUploadPostActions()</span> are not very
time consuming (only one LDAP operation). Your function will be called
repeatedly until you give back the status "finished".<br>
This allows LAM to avoid running longer than the maximum execution time
by sending meta refreshes to the browser.<br>
<span style="font-weight: bold;"></span>
<h2><span style="font-weight: bold;"></span></h2>
</div>
</div>
</body>
</html>
syntax highlighted by Code2HTML, v. 0.9.1