| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <title>Module HowTo - Advanced upload options</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>Module HowTo - Advanced upload options<br> |
| 11 | </h1> |
| 12 | <div style="text-align: left;"><br> |
| 13 | The <span style="font-style: italic;">ieee802Device</span> module only |
| 14 | needs the basic upload functions for its functionality.<br> |
| 15 | However there are more possibilities for the modules to control the |
| 16 | file upload.<br> |
| 17 | </div> |
| 18 | <div style="text-align: left;"><br> |
| 19 | <h2>1. Module order<br> |
| 20 | </h2> |
| 21 | Your module might depend on the input values of another module. In this |
| 22 | case you probably want that your module is called as the second one.<br> |
| 23 | <br> |
| 24 | You can define dependencies to other modules with the function <span |
| 25 | style="font-weight: bold;">get_uploadPreDepends()</span> or <span |
| 26 | style="font-weight: bold;">meta['upload_preDepends']</span>.<br> |
| 27 | <br> |
| 28 | <span style="font-weight: bold; text-decoration: underline;">Example:</span><br |
| 29 | style="font-weight: bold; text-decoration: underline;"> |
| 30 | <br> |
| 31 | The <span style="font-style: italic;">sambaGroupMapping</span> module |
| 32 | needs the group name to set the default <span |
| 33 | style="font-style: italic;">displayName</span>. Therefore it depends |
| 34 | on the <span style="font-style: italic;">posixGroup</span> module<br> |
| 35 | <br> |
| 36 | <div class="mod-code"> |
| 37 | * Returns meta data that is interpreted by parent |
| 38 | class<br> |
| 39 | *<br> |
| 40 | * @return array array with meta data<br> |
| 41 | */<br> |
| 42 | <span style="font-weight: bold;"> function</span> |
| 43 | get_metaData() {<br> |
| 44 | $return = array();<br> |
| 45 | // upload dependencies<br> |
| 46 | $return[<span |
| 47 | style="color: rgb(255, 0, 0);">'upload_preDepends'</span>] = |
| 48 | array('posixGroup');<br> |
| 49 | [...]<br> |
| 50 | </div> |
| 51 | <br> |
| 52 | <br> |
| 53 | <h2>2. Upload post actions<br> |
| 54 | </h2> |
| 55 | If your module does not only create an account but relates the account |
| 56 | with other existing LDAP entries you can do these modifications after |
| 57 | the account was created.<br> |
| 58 | This is useful for adding users to groups or setting quotas.<br> |
| 59 | <br> |
| 60 | You have to implement the function <span style="font-weight: bold;">doUploadPostActions()</span> |
| 61 | in your module. Since post actions are very special there is no <span |
| 62 | style="font-style: italic;">meta data</span> for this.<br> |
| 63 | <br> |
| 64 | <span style="font-weight: bold; text-decoration: underline;">Example:</span><br |
| 65 | style="font-weight: bold; text-decoration: underline;"> |
| 66 | <br> |
| 67 | The <span style="font-style: italic;">posixAccount</span> module |
| 68 | offers to put the user account in additional groups. This is done in |
| 69 | the post actions.<br> |
| 70 | <br> |
| 71 | <div class="mod-code"> |
| 72 | * This function executes one post upload action.<br> |
| 73 | *<br> |
| 74 | * @param array $data array containing one account in |
| 75 | each element<br> |
| 76 | * @param array $ids array(<column_name> => |
| 77 | <column number>)<br> |
| 78 | * @param array $failed list of accounts which were |
| 79 | not created successfully<br> |
| 80 | * @param array $temp variable to store temporary |
| 81 | data between two post actions<br> |
| 82 | * @return array current status<br> |
| 83 | * <br> array (<br> |
| 84 | * <br> 'status' => 'finished' | |
| 85 | 'inProgress'<br> |
| 86 | * <br> 'progress' => 0..100<br> |
| 87 | * <br> 'errors' => array (<array |
| 88 | of parameters for StatusMessage>)<br> |
| 89 | * <br> )<br> |
| 90 | */<br> |
| 91 | <span style="font-weight: bold;">function</span> <span |
| 92 | style="color: rgb(255, 0, 0);">doUploadPostActions</span>($data, $ids, |
| 93 | $failed, &$temp) {<br> |
| 94 | [...]<br> |
| 95 | }<br> |
| 96 | </div> |
| 97 | <br> |
| 98 | Please make sure that the actions in one call of <span |
| 99 | style="font-weight: bold;">doUploadPostActions()</span> are not very |
| 100 | time consuming (only one LDAP operation). Your function will be called |
| 101 | repeatedly until you give back the status "finished".<br> |
| 102 | This allows LAM to avoid running longer than the maximum execution time |
| 103 | by sending meta refreshes to the browser.<br> |
| 104 | </div> |
| 105 | </div> |
| 106 | </body> |
| 107 | </html> |