<?php include "../../include.php"; if (url_id('module_id')) { $result = db_table('SELECT p.id, p.title, p.url, p.is_hidden FROM pages p WHERE module_id = ' . $_GET['module_id'] . ' ORDER BY p.precedence'); } elseif (url_id('modulette_id')) { $result = db_table('SELECT p.id, p.title, p.url, p.is_hidden FROM pages p WHERE modulette_id = ' . $_GET['modulette_id'] . ' ORDER BY p.precedence'); } else { url_change('./'); } echo drawTop(); //pages list $t = new table('pages', drawHeader()); $t->set_column('is_hidden', 'd', ' '); $t->set_column('draggy', 'd', ' '); $t->set_column('title', 'l', getString('title')); $t->set_column('url'); $t->set_draggable('draggy'); foreach ($result as &$r) { $r['is_hidden'] = draw_form_checkbox('foo', !$r['is_hidden'], false, 'ajax_set(\'pages\', \'is_hidden\', ' . $r['id'] . ', ' . abs($r['is_hidden'] - 1) . ');'); $r['draggy'] = draw_img('/images/icons/move.png'); $r['title'] = draw_link('page.php?id=' . $r['id'], $r['title']); if (empty($r['url'])) { $r['url'] = 'index.php'; } } echo $t->draw($result, 'No pages'); echo drawBottom();
function drawThreadCommentForm($showAdmin = false) { global $page, $_josh, $_SESSION; $name = $_josh['request']['folder'] == 'bb' ? 'description' : 'message'; $return = '<a name="bottom"></a><form '; if ($_josh['db']['language'] == 'mysql') { $return .= 'accept-charset="utf-8" '; } $return .= 'method="post" action="' . $_josh['request']['path_query'] . '" onsubmit="javascript:return validate(this);"><tr valign="top"> <td class="left">' . drawName($_SESSION['user_id'], $_SESSION['full_name'], false, true, false) . '</td> <td>' . draw_form_textarea($name . langExt(), '', 'mceEditor thread'); if ($showAdmin && $page['is_admin']) { $return .= ' <table class="nospacing"> <tr> <td width="16">' . draw_form_checkbox('is_admin') . '</td> <td>' . drawCheckboxText('is_admin', 'This followup is admin-only (invisible to most users)') . '</td> </tr> </table>'; } $return .= ' </td> </tr> <tr> <td class="bottom" colspan="2">' . draw_form_submit(getString('add_followup')) . '</td> </tr> </form>'; return $return; }
</tr> <tr> <td class="left">Accessories</td> <td> <table class="nospacing"> <?php if (isset($_GET["id"])) { $accessories = db_query("SELECT \r\n\t\t\t\t\ta.id, \r\n\t\t\t\t\ta.name,\r\n\t\t\t\t\t(SELECT COUNT(*) FROM it_laptops_2_accessories i2t WHERE i2t.accessoryID = a.id AND i2t.laptopID = {$_GET["id"]}) checked\r\n\t\t\t\t\tFROM it_laptops_accessories a ORDER BY a.name"); } else { $accessories = db_query("SELECT \r\n\t\t\t\t\ta.id, \r\n\t\t\t\t\ta.name\r\n\t\t\t\t\tFROM it_laptops_accessories a ORDER BY a.name"); } while ($a = db_fetch($accessories)) { ?> <tr> <td><?php echo draw_form_checkbox("chkacc_" . $a["id"], @$a["checked"]); ?> </td> <td><?php echo $a["name"]; ?> </td> </tr> <?php } ?> </table> </td> </tr> <tr> <td class="left">Notes</td>
if ($posting) { langTranslatePost('title'); $id = db_save('modules'); url_drop('id'); } echo drawTop(); if (url_id()) { //form $f = new form('modules', @$_GET['id']); $f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title'))); langUnsetFields($f, 'title'); langTranslateCheckbox($f); echo $f->draw(); } else { //modules list $t = new table('modules', drawHeader()); $t->set_column('is_selected', 'd', ' '); $t->set_column('draggy', 'd', ' '); $t->set_column('title', 'l', getString('title')); $t->set_column('pages', 'r'); $result = db_table('SELECT m.id, m.title' . langExt() . ' title, m.is_active, (SELECT COUNT(*) FROM pages p WHERE p.module_id = m.id AND p.modulette_id IS NULL) pages FROM modules m ORDER BY m.precedence'); $t->set_draggable('draggy'); foreach ($result as &$r) { $r['is_selected'] = draw_form_checkbox('foo', $r['is_active'], false, 'ajax_set(\'modules\', \'is_active\', ' . $r['id'] . ', ' . abs($r['is_active'] - 1) . ');'); $r['draggy'] = draw_img('/images/icons/move.png'); $r['title'] = draw_link('./?id=' . $r['id'], $r['title']); $r['pages'] = draw_link('pages.php?module_id=' . $r['id'], format_quantitize($r['pages'], 'page')); } echo $t->draw($result, 'No modules'); } echo drawBottom();
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"]; } }
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; }
></td> <td width="99%">External Deadline</td> </tr> </table> </div> <div id="report" <?php if (!$r["isActionItem"] || $r["isInternalDeadline"]) { ?> style="visibility:hidden;"<?php } ?> > <table width="100%" cellpadding="0" cellspacing="0" border="0" class="small"> <tr> <td width="16"><?php echo draw_form_checkbox("chkReport", $r["isReport"]); ?> </td> <td width="99%">Is this a Report?</td> </tr> </table> </div> </td> </tr> <tr class="helptext" bgcolor="#FFFFFF"> <td bgcolor="#F6F6F6"><nobr>Status:</nobr></td> <td colspan="2" width="99%"> <select class="field" name="isComplete"> <option value="0" <?php if (!$r["isComplete"]) { ?>
<td><?php echo draw_form_select("cboProgram", "SELECT programID, programDesc FROM funders_programs ORDER BY programDesc", @$r["awardProgramID"]); ?> </td> </tr> <tr> <td class="left">Cross List</td> <td> <table cellpadding="0" cellspacing="0" border="0" class="small"> <tr> <td><?php echo draw_form_select("cboProgram2", "SELECT programID, programDesc FROM funders_programs ORDER BY programDesc", @$r["awardProgramID2"]); ?> </td> <td> <?php echo draw_form_checkbox("noCrossList", @(!@$r["awardProgramID2"])); ?> </td> <td> (no cross-listing)</td> </tr> </table> </td> </tr> <tr> <td class="left">Amount <div style="float:right">$</span></td> <td><input type="text" size="11" class="field" name="txtAmount" value="<?php echo @$r["awardAmount"]; ?> "></td> </tr> <tr>
<?php include '../../include.php'; if (url_action('delete')) { db_delete('soc_members', $_GET['delete_id']); url_drop('action,delete_id'); } echo drawTop(); $t = new table('soc_members', drawHeader(array('edit.php' => 'Add New'))); $t->set_column('is_selected', 'd', ' '); $t->set_column('name'); $t->set_column('updated', 'r'); $t->set_column('delete', 'd', ' '); $result = db_table('SELECT m.id, m.name, m.is_selected, c.en "group", ' . db_updated('m') . ' FROM soc_members m JOIN jr_countries c ON m.country_id = c.id WHERE m.is_active = 1 ORDER BY c.en, m.name'); foreach ($result as &$r) { $r['is_selected'] = draw_form_checkbox('foo', $r['is_selected'], false, 'ajax_set(\'soc_members\', \'is_selected\', ' . $r['id'] . ', ' . abs($r['is_selected'] - 1) . ');'); $r['name'] = draw_link('edit.php?id=' . $r['id'], format_string($r['name'], 70)); $r['updated'] = format_date($r['updated']); $r['delete'] = drawColumnDelete($r['id']); } echo $t->draw($result); echo drawBottom();
</table></div> </td> </tr> <tr> <td width="50%" height="50"> STAFF RESPONSIBLE<br> <?php echo drawSelectUser("cboStaff", $_SESSION["user_id"]); ?> </td> <td width="50%"> <div id="report" style="visibility:hidden;"> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="small"> <tr> <td width="16"><?php echo draw_form_checkbox("chkReport", 0); ?> </td> <td width="99%">Is this a Report?</td> </tr> </table></div> </td> </tr> <tr> <td colspan="2"> NOTES<br> <?php echo draw_form_textarea("tarDescription", ""); ?> </td> </tr>
function draw_form_checkboxes($name, $linking_table = false, $object_col = false, $option_col = false, $id = false) { if (stristr($name, "_")) { error_handle("draw_form_checkboxes()", "an error occurred with the calling of this function; you can't have an underscore in the field name", true); } if ($linking_table) { $result = db_query("SELECT o.id, o.value, (SELECT COUNT(*) FROM " . $linking_table . " l WHERE l." . $option_col . " = o.id AND " . $object_col . " = " . $id . ") checked FROM option_" . $name . " o ORDER BY value"); } else { $result = db_query("SELECT id, value, 0 checked FROM option_" . $name . " ORDER BY value"); } $return = '<table cellspacing="0" class="checkboxes">'; while ($r = db_fetch($result)) { $return .= '<tr><td>' . draw_form_checkbox("chk_" . $name . "_" . $r["id"], $r["checked"]) . '</td>'; $return .= '<td> ' . $r["value"] . '</td></tr>'; } $return .= '</table>'; return $return; }
?> <?php echo $r["last"]; ?> </b></td> </tr> <tr> <td class="left">Permissions</td> <td><table class="nospacing"> <?php $result = db_query("SELECT \n\t\t\t\t\t\t\t\tm.id,\n\t\t\t\t\t\t\t\tm.name,\n\t\t\t\t\t\t\t\t(SELECT COUNT(*) FROM administrators a WHERE a.moduleID = m.id AND a.userID = {$_GET["id"]}) isAdmin\n\t\t\t\t\t\t\tFROM modules m\n\t\t\t\t\t\t\tWHERE m.isActive = 1\n\t\t\t\t\t\t\tORDER BY m.name"); while ($r = db_fetch($result)) { ?> <tr> <td><?php echo draw_form_checkbox("chk_" . $r["id"], $r["isAdmin"]); ?> </td> <td><?php echo $r["name"]; ?> </td> </tr> <?php } ?> </table> </td> </tr> <tr> <td class="bottom" colspan="2"><?php
?> "><?php } ?> <b><?php echo $t["name"]; ?> </b></a></td> </tr> <?php $values = db_query("SELECT\r\n\t\t\t\t\t\t\tt.id, \r\n\t\t\t\t\t\t\tt.tag, \r\n\t\t\t\t\t\t\t(SELECT count(*) FROM contacts o \r\n\t\t\t\t\t\t\t\tINNER JOIN contacts_instances i ON o.instanceCurrentID = i.id\r\n\t\t\t\t\t\t\t\tINNER JOIN contacts_instances_to_tags i2t ON i.id = i2t.instanceID\r\n\t\t\t\t\t\t\t\tWHERE o.type_id = 22 AND i2t.tagID = t.id AND o.is_active = 1) contactcount\r\n\t\t\t\t\t\tFROM contacts_tags t \r\n\t\t\t\t\t\tWHERE t.type_id = {$t["id"]} AND t.is_active = 1\r\n\t\t\t\t\t\tORDER BY t.precedence"); while ($v = db_fetch($values)) { ?> <tr valign="middle"> <td><?php echo draw_form_checkbox("tag_" . $v["id"]); ?> </td> <td><a href="value.php?id=<?php echo $v["id"]; ?> "><?php echo $v["tag"]; ?> </a></td> <td align="right"><?php echo number_format($v["contactcount"]); ?> </td> </tr> <?php
</td> </tr> <tr valign="top"> <td class="left">Languages (other than english):</td> <td> <table class="nospacing"> <?php $languages = db_query("SELECT l.id, l.name, \n\t\t\t\t\t\t(SELECT count(*) FROM web_organizations_2_languages o2l WHERE o2l.organizationID = {$_GET["id"]} AND o2l.languageID = l.id) as checked\n\t\t\t\t\t\tFROM web_languages l ORDER BY l.name"); while ($l = db_fetch($languages)) { if ($l["name"] == "English") { continue; } ?> <tr> <td width="25"><?php echo draw_form_checkbox("chkl_" . $_GET["id"] . "_" . $l["id"], $l["checked"]); ?> </td> <td><?php echo $l["name"]; ?> </td> </tr> <?php } ?> </table> </td> </tr> <tr> <td colspan="2" align="center" class="left">
<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"); ?> </td> </tr> <tr>