function addRow($field) { global $_josh; extract($field); $return = ""; if ($type == "hidden") { $return .= draw_form_hidden($name, $value); } else { if ($label) { $return .= '<dt class="' . $type . '">' . $label; if ($additional && $type == "checkboxes") { $return .= $additional; } $return .= '</dt>' . $_josh["newline"]; } $return .= '<dd class="' . $type . '">'; if ($type == "checkbox") { $return .= '<div class="checkbox_option">' . draw_form_checkbox($name, $value) . '<span class="option_name" onclick="javascript:form_checkbox_toggle(\'' . $name . '\');">' . $additional . '</span></div>'; } elseif ($type == "checkboxes") { if ($value) { $options = db_query("SELECT o.id, o.name, (SELECT COUNT(*) FROM {$linking_table} l WHERE l.option_id = o.id AND l.object_id = {$value}) checked FROM {$options_table} o ORDER BY o.name"); } else { $options = db_query("SELECT id, name, 0 checked FROM {$options_table} ORDER BY name"); } while ($o = db_fetch($options)) { $name = "chk_" . str_replace("_", "-", $options_table) . "_" . $o["id"]; $return .= '<div class="checkbox_option">' . draw_form_checkbox($name, $o["checked"]) . '<span class="option_name" onclick="javascript:form_checkbox_toggle(\'' . $name . '\');">' . $o["name"] . '</span></div>'; } } elseif ($type == "date") { $return .= draw_form_date($name, $value, false) . $additional; } elseif ($type == "datetime") { $return .= draw_form_date($name, $value, true) . $additional; } elseif ($type == "note") { $return .= "<div class='note'>" . $additional . "</div>"; } elseif ($type == "password") { $return .= draw_form_password($name, $value, $class, 255, false) . $additional; } elseif ($type == "radio") { if (!$options) { if (!$sql) { $sql = "SELECT id, name FROM options_" . str_replace("_id", "", $name); } $options = db_array($sql); } if ($append) { while (list($addkey, $addval) = each($append)) { $options[$addkey] = $addval; } } foreach ($options as $id => $description) { $return .= '<div class="radio_option">' . draw_form_radio($name, $id, $value == $id, $class) . $description . '</div>'; } } elseif ($type == "select") { if (!$options) { if (!$sql) { $sql = "SELECT id, name FROM options_" . str_replace("_id", "", $name); } $options = db_array($sql); } if ($append) { while (list($addkey, $addval) = each($append)) { $options[$addkey] = $addval; } } $return .= draw_form_select($name, $options, $value, $required, $class, $action); } elseif ($type == "submit") { $return .= draw_form_submit($value, $class) . $additional; } elseif ($type == "text") { $return .= draw_form_text($name, $value, $class, $maxlength, false, false) . $additional; } elseif ($type == "textarea") { $return .= draw_form_textarea($name, $value, $class) . $additional; } $return .= '</dd>' . $_josh["newline"]; } return $return; }
function addRow($type, $title, $name = "", $value = "", $default = "", $required = false, $maxlength = 50, $onchange = false) { global $rows, $js, $months, $month, $today, $year, $_josh; $textlength = $maxlength > 50 ? 50 : $maxlength; $value = trim($value); if ($type == "raw") { $rows .= $title; } else { $rows .= '<tr>'; if ($type != "button" && $type != "submit" && $type != "hidden" && $type != "raw") { $rows .= '<td class="left">' . $title . '</td>'; } if ($type == "text") { //output text, no form element $rows .= '<td>' . $value . '</td>'; } elseif ($type == "date") { $rows .= '<td>' . draw_form_date($name, $value, false, false, $required) . '</td>'; } elseif ($type == "datetime") { $rows .= '<td>' . draw_form_date($name, $value, true) . '</td>'; } elseif ($type == "checkbox") { $rows .= '<td>' . draw_form_checkbox($name, $value) . '</td>'; } elseif ($type == "itext") { $rows .= '<td>' . draw_form_text($name, $value, false, $maxlength) . '</td>'; if ($required) { $js .= "if (!form." . $name . ".value.length) errors[errors.length] = 'the \\'" . $title . "\\' field is empty';" . $_josh["newline"]; } } elseif ($type == "phone") { $rows .= '<td>' . draw_form_text($name, $value, 14, $maxlength) . '</td>'; if ($required) { $js .= "if (!form." . $name . ".value.length) errors[errors.length] = 'the \\'" . $title . "\\' field is empty';" . $_josh["newline"]; } } elseif ($type == "extension") { $rows .= '<td>' . draw_form_text($name, $value, 4, $maxlength) . '</td>'; if ($required) { $js .= "if (!form." . $name . ".value.length) errors[errors.length] = 'the \\'" . $title . "\\' field is empty';" . $_josh["newline"]; } } elseif ($type == "password") { $rows .= '<td>' . draw_form_password($name, $value, $textlength, $maxlength) . '</td>'; if ($required) { $js .= "if (!form." . $name . ".value.length) errors[errors.length] = 'the \\'" . $title . "\\' field is empty';" . $_josh["newline"]; } } elseif ($type == "select") { $rows .= '<td>'; $rows .= draw_form_select($name, $value, $default, $required, false, $onchange); $rows .= '</td>'; } elseif ($type == "user") { $result = db_query("SELECT \n\t\t\t\t\t\t\t\t\t\t\tuserID, \n\t\t\t\t\t\t\t\t\t\t\tISNULL(nickname, firstname) first,\n\t\t\t\t\t\t\t\t\t\t\tlastname last \n\t\t\t\t\t\t\t\t\t\tFROM intranet_users\n\t\t\t\t\t\t\t\t\t\tWHERE isActive = 1\n\t\t\t\t\t\t\t\t\t\tORDER by lastname"); while ($r = db_fetch($result)) { $options[$r["userID"]] = $r["first"] . ", " . $r["last"]; } $rows .= '<td>'; $rows .= draw_form_select($name, $options, $default, $required, false, $onchange); $rows .= '</td>'; } elseif ($type == "department") { $rows .= '<td><select name="' . $name . '">'; $result = db_query("SELECT \n\t\t\t\t\t\t\t\t\t\t\tdepartmentID,\n\t\t\t\t\t\t\t\t\t\t\tdepartmentName,\n\t\t\t\t\t\t\t\t\t\t\tquoteLevel\n\t\t\t\t\t\t\t\t\t\tFROM intranet_departments\n\t\t\t\t\t\t\t\t\t\tWHERE isActive = 1\n\t\t\t\t\t\t\t\t\t\tORDER by precedence"); while ($r = db_fetch($result)) { $rows .= '<option value="' . $r["departmentID"] . '"'; if ($r["departmentID"] == $default) { $rows .= ' selected'; } $rows .= '>'; if ($r["quoteLevel"] == 2) { $rows .= " · "; } elseif ($r["quoteLevel"] == 3) { $rows .= " - "; } $rows .= $r["departmentName"] . '</option>'; } $rows .= '</select></td>'; } elseif ($type == "userpic") { $rows .= '<td>' . drawName($name, $value, $default, true, " ") . '</td>'; } elseif ($type == "textarea") { $rows .= '<td>' . draw_form_textarea($name, $value) . '</td>'; $js .= " tinyMCE.triggerSave();" . $_josh["newline"]; if ($required) { $js .= "if (!form." . $name . ".value.length || (form." . $name . ".value == '<p> </p>')) errors[errors.length] = 'the \\'" . $title . "\\' field is empty';" . $_josh["newline"]; } } elseif ($type == "textarea-plain") { $rows .= '<td>' . draw_form_textarea($name, $value, "noMceEditor") . '</td>'; if ($required) { $js .= "if (!form." . $name . ".value.length) errors[errors.length] = 'the \\'" . $title . "\\' field is empty';" . $_josh["newline"]; } } elseif ($type == "hidden") { $rows .= draw_form_hidden($name, $value); } elseif ($type == "submit") { $rows .= '<td colspan="2" align="center" class="bottom">' . draw_form_submit($title, "button") . '</td>'; } elseif ($type == "button") { $rows .= '<td colspan="2" align="center" class="bottom">' . draw_form_button($title, $value, "button") . '</td>'; } elseif ($type == "file") { $rows .= '<td>' . draw_form_file($name) . '</td>'; } $rows .= '</tr>' . $_josh["newline"]; } }
?> </td> <td width="50%"> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="small"> <tr> <td width="16"><input type="checkbox" name="chkActionItem" onclick="javascript:checkInternal(this);"></td> <td width="99%">Is this an Action Item?</td> </tr> </table> </td> </tr> <tr> <td width="50%" height="50"> DATE<br> <?php echo draw_form_date("cboDate"); ?> </td> <td width="50%" valign="middle"> <div id="internal" style="visibility:hidden;"> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="small"> <tr> <td width="16"><input type="radio" name="isInternal" value="true" checked onclick="javascript:checkReport();"></td> <td width="99%">Internal Deadline</td> </tr> <tr> <td width="16"><input type="radio" name="isInternal" value="false" onclick="javascript:checkReport();"></td> <td width="99%">External Deadline</td> </tr> </table></div> </td>
"><?php echo $r["name"]; ?> </a></b>)</td> </tr> <tr class="helptext" bgcolor="#FFFFFF"> <td bgcolor="#F6F6F6"><nobr>Activity Title:</nobr></td> <td colspan="2" width="99%"><?php echo draw_form_text("activityTitle", $r["activityTitle"]); ?> </b></td> </tr> <tr class="helptext" bgcolor="#FFFFFF"> <td bgcolor="#F6F6F6"><nobr>Activity Date:</nobr></td> <td colspan="2" width="99%"><?php echo draw_form_date("activityDate", $r["activityDate"]); ?> </td> </tr> <tr class="helptext" bgcolor="#FFFFFF"> <td bgcolor="#F6F6F6"><nobr>Staff Responsible:</nobr></td> <td colspan="2" width="99%"> <?php echo drawSelectUser("activityAssignedTo", $r["activityAssignedTo"]); ?> </td> </tr> <tr class="helptext" bgcolor="#FFFFFF"> <td bgcolor="#F6F6F6" valign="top"><nobr>Type:</nobr></td> <td colspan="2" width="99%"> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="small">
</td> </tr> <tr> <td class="left">Start</td> <td><?php echo draw_form_date("checkoutStart"); ?> </td> </tr> <tr> <td class="left">End</td> <td> <table class="nospacing"> <tr> <td><?php echo draw_form_date("checkoutEnd"); ?> </td> <td> <?php echo draw_form_checkbox("noEndDate"); ?> </td> <td>(no end date)</td> </tr> </table> </td> </tr> <tr valign="top"> <td class="left">Notes</td> <td><?php echo draw_form_textarea("checkoutNotes");