case "timezone_select": exec('/usr/bin/tar -tzf /usr/share/zoneinfo.tgz', $timezonelist); $timezonelist = array_filter($timezonelist, 'is_timezone'); sort($timezonelist); /* kill carriage returns */ for ($x = 0; $x < count($timezonelist); $x++) { $timezonelist[$x] = str_replace("\n", "", $timezonelist[$x]); } if ($field['displayname']) { echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; echo $field['displayname']; echo ":</td>\n"; } else { if (!$field['dontdisplayname']) { echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; echo fixup_string($field['name']); echo ":</td>"; } } if (!$field['dontcombinecells']) { echo "<td class=\"vtable\">"; } echo "<select class='formselect' name='{$name}'>\n"; foreach ($timezonelist as $tz) { if (strstr($tz, "GMT")) { continue; } $SELECTED = ""; if ($value == $tz) { $SELECTED = " SELECTED"; }
} } foreach ($schedules as $schedule) { if ($schedule == "none") { $schedlist[""] = $schedule; } else { $schedlist[$schedule] = $schedule; } } if ($grouping) { $group->add(new Form_Select($pkga['fieldname'], $pkga['fielddescr'], $value, $schedlist))->setHelp(fixup_string($pkga['description'])); } else { if (isset($pkga['advancedfield']) && isset($advfield_count)) { $advanced->addInput(new Form_Select($pkga['fieldname'], $pkga['fielddescr'], $value, $schedlist))->setHelp(fixup_string($pkga['description'])); } else { $section->addInput(new Form_Select($pkga['fieldname'], $pkga['fielddescr'], $value, $schedlist))->setHelp(fixup_string($pkga['description'])); } } break; case "rowhelper": $rowhelpername = "row"; $rowcounter = 0; $trc = 0; //Use assigned $a_pkg or create an empty array to enter loop if (isset($a_pkg[$id][$rowhelpername])) { $saved_rows = $a_pkg[$id][$rowhelpername]; } else { $saved_rows[] = array(); } $numrows = count($saved_rows) - 1; foreach ($saved_rows as $row) {
echo "rowname[{$fieldcounter}] = \"{$rowhelper['fieldname']}\";\n"; echo "rowtype[{$fieldcounter}] = \"{$rowhelper['type']}\";\n"; echo "rowsize[{$fieldcounter}] = \"{$rowhelper['size']}\";\n"; $fieldcounter++; } ?> //]]> </script> <table id="maintable" summary="main table"> <tr id='<?php echo "tr_{$pkga['fieldname']}"; ?> '> <?php foreach ($pkga['rowhelper']['rowhelperfield'] as $rowhelper) { echo "<td " . domTT_title($rowhelper['description']) . "><b>" . fixup_string($rowhelper['fielddescr']) . "</b></td>\n"; } $rowcounter = 0; $trc = 0; //Use assigned $a_pkg or create an empty array to enter loop if (isset($a_pkg[$id][$rowhelpername])) { $saved_rows = $a_pkg[$id][$rowhelpername]; } else { $saved_rows[] = array(); } foreach ($saved_rows as $row) { echo "</tr>\n<tr class=\"sortable\" id=\"id_{$rowcounter}\">\n"; foreach ($pkga['rowhelper']['rowhelperfield'] as $rowhelper) { unset($value); if ($rowhelper['value'] != "") { $value = $rowhelper['value'];
} else { if (!$field['dontdisplayname']) { $etitle = fixup_string($field['name']); } } if (!$field['dontcombinecells']) { //echo "<td class=\"vtable\">"; } $section->addInput(new Form_Select($name, $etitle, $value, array_combine($timezonelist, $timezonelist)))->setHelp($field['description']); break; case "checkbox": if ($field['displayname']) { $etitle = $field['displayname']; } else { if (!$field['dontdisplayname']) { $etitle = fixup_string($field['name']); } } if (isset($field['enablefields']) or isset($field['checkenablefields'])) { $onclick = "enablechange()"; } else { if (isset($field['disablefields']) or isset($field['checkdisablefields'])) { $onclick = "disablechange()"; } } $section->addInput(new Form_Checkbox($name, $etitle, $field['typehint'], $value != "", 'on'))->setHelp($field['description'])->setOnclick($onclick); break; } // e-o-switch } // e-o-foreach(package)
$source_name = $pkga['source_name'] ? $opt[$pkga['source_name']] : $opt[$pkga['name']]; $source_value = $pkga['source_value'] ? $opt[$pkga['source_value']] : $opt[$pkga['value']]; $selected = in_array($source_value, $items) ? 'selected="selected"' : ''; $input .= "\t<option value=\"{$source_value}\" {$selected}>{$source_name}</option>\n"; } $input .= "</select>\n<br />\n" . fixup_string($description) . "\n"; echo $input; break; case "checkbox": $checkboxchecked = $value == "on" ? " checked=\"checked\"" : ""; $onchange = isset($pkga['onchange']) ? "onchange=\"{$pkga['onchange']}\"" : ''; if (isset($pkga['enablefields']) || isset($pkga['checkenablefields'])) { $onclick = ' onclick="javascript:enablechange();"'; } $input = "<input id='{$pkga['fieldname']}' type='checkbox' name='{$pkga['fieldname']}' {$checkboxchecked} {$onclick} {$onchange} />\n"; $input .= "<br />" . fixup_string($description) . "\n"; echo $input; break; } #check typehint value if (isset($pkga['typehint'])) { echo " " . $pkga['typehint']; } #check combinefields options if (isset($pkga['combinefields'])) { $input = "</td>"; if ($pkga['combinefields'] == "end") { $input .= "</table></td></tr>"; } } else { $input = "</td></tr>";
<?php $rowcounter = 0; $fieldcounter = 0; foreach ($pkga['rowhelper']['rowhelperfield'] as $rowhelper) { echo "rowname[" . $fieldcounter . "] = \"" . $rowhelper['fieldname'] . "\";\n"; echo "rowtype[" . $fieldcounter . "] = \"" . $rowhelper['type'] . "\";\n"; $fieldcounter++; } ?> --> </script> <table name="maintable" id="maintable"> <tr> <?php foreach ($pkga['rowhelper']['rowhelperfield'] as $rowhelper) { echo "<td><b>" . fixup_string($rowhelper['fielddescr']) . "</td>\n"; } echo "</tr>"; echo "<tr>"; // XXX: traverse saved fields, add back needed rows. echo "</tr>"; echo "<tr>\n"; $rowcounter = 0; $trc = 0; if (isset($a_pkg[$id]['row'])) { foreach ($a_pkg[$id]['row'] as $row) { /* * loop through saved data for record if it exists, populating rowhelper */ foreach ($pkga['rowhelper']['rowhelperfield'] as $rowhelper) { unset($value);