function showForm (&$options, $formatdescr, $targeturl, $columns) { global $M2MDir, $M2MUrl; $categories = $options->getCategories(); ?> <script language='JavaScript'> function expand (id, val) { var catElem = document.getElementById('cat'+id); var bodyElem = document.getElementById('catbody'+id); if (catElem && bodyElem) { if (val == 'open') { catElem.className = 'open'; bodyElem.style.display = ''; } else if (val == 'close') { catElem.className = 'close'; bodyElem.style.display = 'none'; } else { catElem.className = (catElem.className == 'open' ? 'close' : 'open'); bodyElem.style.display = (bodyElem.style.display == 'none' ? '' : 'none'); } } } function expandAll (open) { var i; for (i=0; i < <?php echo count($categories); ?> ; i++) expand(i, open ? 'open' : 'close'); } </script> <table class='bgtable' cellpadding="10" width="95%" align="center"><tr><td> <form action='<?php echo $targeturl; ?> ' method='post' enctype='multipart/form-data'> <table class='cattable' cellpadding="5" width="100%"> <tr bgcolor='#555555'> <td colspan='<?php echo $columns; ?> '> <div class='title'>Optionen für Zielformat <?php echo $formatdescr; ?> </div> <div class='openclose'> <img src='<?php echo $M2MUrl; ?> /images/plus.gif' onClick="expandAll(true)"> <img src='<?php echo $M2MUrl; ?> /images/minus.gif' onClick="expandAll(false)"> </div> </td></tr> <? $catcount = 0; foreach ($categories as $c) { $col = 0; $optclass = 'opt1'; if ($c['title'] == 'hidden') foreach ($c['options'] as $o) echo "<input type='hidden' name='$o[name]' value='$o[value]'>\n"; else { echo "<tr class='catrow'><td colspan='$columns'>"; echo "<a id='cat$catcount' class='open' onClick='expand($catcount)'>$c[title]</a></td></tr>\n"; echo "<tbody id='catbody$catcount'>\n"; foreach ($c['options'] as $o) { if ($col == 0) echo "<tr class='$optclass'>"; echo "<td>"; if (is_array($o['value'])) { echo htmlentities($o['description']).":<br>"; foreach ($o['value'] as $k=>$v) echo OptionPage::getHtmlInputElement("$o[name][$k]", $v['type'], "$o[indexdescr] $k", $v['value']) . "<br>\n"; } else echo OptionPage::getHtmlInputElement($o['name'], $o['type'], $o['description'], $o['value']) . "</td>\n"; if ($col++ >= $columns-1) { $col = 0; $optclass = ($optclass == 'opt1' ? 'opt2' : 'opt1'); echo "</tr>"; } } for ($col %= $columns; $col > 0; $col = ($col+1) % $columns) echo "<td class='$optclass'></td>"; $catcount++; echo "</tbody>\n"; } } ?> </table></td></tr><tr><td> <input type="submit" name="submit" value="OK" class="button"> <input type="reset" name="submit" value="Zurücksetzen" class="button"> <input type="button" value="Abbrechen" class="button" onClick="window.close()"> </td></tr> </form></table> <? }