示例#1
0
文件: index.php 项目: horrabin/opendb
function get_edit_announcement_input_form($announcement_r, $HTTP_VARS = NULL)
{
    global $PHP_SELF;
    $buffer .= "<form action=\"{$PHP_SELF}\" method=\"POST\">";
    $buffer .= "\n<input type=\"hidden\" name=\"type\" value=\"announcements\">";
    if (is_array($announcement_r)) {
        $buffer .= "\n<input type=\"hidden\" name=\"op\" value=\"update\">" . "\n<input type=\"hidden\" name=\"announcement_id\" value=\"" . $announcement_r['announcement_id'] . "\">";
    } else {
        $buffer .= "\n<input type=\"hidden\" name=\"op\" value=\"insert\">";
    }
    $buffer .= "<table>";
    $buffer .= get_input_field("title", NULL, 'Title', "text(50,500)", "Y", ifempty($announcement_r['title'], $HTTP_VARS['title']), TRUE);
    $buffer .= get_input_field("content", NULL, 'Announcement', "htmlarea(60,15)", "Y", ifempty($announcement_r['content'], $HTTP_VARS['content']), TRUE);
    $buffer .= get_input_field("display_days", NULL, 'Display Days', "number(10,10)", "Y", ifempty($announcement_r['display_days'], $HTTP_VARS['display_days']), TRUE);
    if (is_array($announcement_r)) {
        $buffer .= get_input_field("closed_ind", NULL, 'Closed', "checkbox(Y,N)", "N", ifempty($announcement_r['closed_ind'], $HTTP_VARS['closed_ind']), TRUE);
    }
    $buffer .= "</table>";
    $help_r[] = array('img' => 'compulsory.gif', 'text' => get_opendb_lang_var('compulsory_field'), id => 'compulsory');
    $help_r[] = array('text' => 'A zero in Display Days indicates the announcment will never expire.');
    $help_r[] = array('text' => 'No validation is performed on HTML entered in the Announcement text field.');
    $buffer .= format_help_block($help_r);
    if (get_opendb_config_var('widgets', 'enable_javascript_validation') !== FALSE) {
        $onclick_event = "if(!checkForm(this.form)){return false;}else{this.form.submit();}";
    } else {
        $onclick_event = "this.form.submit();";
    }
    $buffer .= "<input type=\"button\" class=\"button\" onclick=\"{$onclick_event}\" value=\"Save\">";
    $buffer .= "\n</form>";
    return $buffer;
}
示例#2
0
function get_edit_form($op, $review_r, $HTTP_VARS)
{
    global $PHP_SELF;
    $formContents = "";
    $formContents .= "<form action=\"{$PHP_SELF}\" method=\"POST\">";
    $formContents .= "<table>";
    $compulsory_ind = 'N';
    if (get_opendb_config_var('item_review', 'comment_compulsory') === TRUE) {
        $compulsory_ind = 'Y';
    }
    $formContents .= get_input_field("comment", NULL, get_opendb_lang_var('review'), "htmlarea(55,10)", $compulsory_ind, $review_r['comment'], TRUE);
    // We are now able to configure this in the database.
    $attribute_type_r = fetch_attribute_type_r('S_RATING');
    $attribute_type_r['compulsory_ind'] = 'N';
    if (get_opendb_config_var('item_review', 'rating_compulsory') == TRUE) {
        $attribute_type_r['compulsory_ind'] = 'Y';
    }
    $formContents .= get_item_input_field("rating", $attribute_type_r, NULL, $review_r['rating']);
    $formContents .= "</table>";
    if (get_opendb_config_var('widgets', 'enable_javascript_validation') !== FALSE) {
        $onclick_event = "if(!checkForm(this.form)){return false;}else{this.form.submit();}";
    } else {
        $onclick_event = "this.form.submit();";
    }
    $formContents .= format_help_block(array('img' => 'compulsory.gif', 'text' => get_opendb_lang_var('compulsory_field'), id => 'compulsory'));
    $formContents .= "<input type=\"button\" class=\"button\" onclick=\"{$onclick_event}\" value=\"" . get_opendb_lang_var('save_review') . "\">\n\t\t<input type=\"hidden\" name=\"op\" value=\"{$op}\">\n\t\t<input type=\"hidden\" name=\"sequence_number\" value=\"" . $review_r['sequence_number'] . "\">\n\t\t<input type=\"hidden\" name=\"item_id\" value=\"" . $HTTP_VARS['item_id'] . "\">\n\t\t<input type=\"hidden\" name=\"instance_no\" value=\"" . $HTTP_VARS['instance_no'] . "\">\n\t\t</form>";
    return $formContents;
}
示例#3
0
文件: index.php 项目: horrabin/opendb
function display_s_item_type_group_row($item_type_group_r, $row)
{
    global $PHP_SELF;
    global $ADMIN_TYPE;
    echo "\n<tr>";
    if (is_not_empty_array($item_type_group_r)) {
        echo "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"Y\">";
        echo "<td class=\"data\">";
        echo get_input_field("s_item_type_group[{$row}]", NULL, "Item Type Group", "readonly", "Y", $item_type_group_r['s_item_type_group'], FALSE);
        if (fetch_item_type_item_type_group_cnt($item_type_group_r['s_item_type_group']) === 0) {
            echo "*";
        }
        echo "</td>";
    } else {
        echo "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"N\">";
        echo "\n<td class=\"data\">" . get_input_field("s_item_type_group[{$row}]", NULL, "Item Type Group", "text(10,10)", "Y", NULL, FALSE) . "</td>";
    }
    echo "<td class=\"data\">" . get_input_field("description[{$row}]", NULL, "Description", "text(30,255)", 'Y', $item_type_group_r['description'], FALSE) . "</td>";
    echo "\n<td class=\"data\">";
    if (is_not_empty_array($item_type_group_r)) {
        echo "<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=edit_item_type_group_rltshps&s_item_type_group=" . $item_type_group_r['s_item_type_group'] . "\">Edit</a>" . " / <a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=delete_item_type_group&s_item_type_group=" . $item_type_group_r['s_item_type_group'] . "\">Delete</a>";
    }
    echo "\n</td>";
    echo "</tr>";
}
示例#4
0
文件: index.php 项目: horrabin/opendb
function display_s_file_type_row($file_type_r, $row)
{
    global $PHP_SELF;
    global $ADMIN_TYPE;
    echo "\n<tr>";
    if (is_not_empty_array($file_type_r)) {
        echo "\n<td class=\"data\">" . get_input_field("content_type[{$row}]", NULL, NULL, "readonly", "N", $file_type_r['content_type'], FALSE) . "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"Y\">" . "</td>";
    } else {
        echo "\n<td class=\"data\">" . get_input_field("content_type[{$row}]", NULL, NULL, "text(20,100)", "Y", $file_type_r['content_type'], FALSE) . "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"N\">" . "</td>";
    }
    $groups = array();
    $results = fetch_s_file_type_content_group_rs();
    if ($results) {
        while ($content_group_r = db_fetch_assoc($results)) {
            $groups[] = $content_group_r['content_group'];
        }
    }
    echo "<td class=\"data\">" . custom_select("content_group[{$row}]", $groups, "%value%", 1, $file_type_r['content_group'], "value") . "</td>";
    //description
    echo "\n<td class=\"data\">" . get_input_field("description[{$row}]", NULL, NULL, "text(20,255)", "N", $file_type_r['description'], FALSE) . "</td>";
    echo "\n<td class=\"data\">" . get_input_field("extension[{$row}]", NULL, "Extension", "text(10,10)", "Y", $file_type_r['extension'], FALSE) . "</td>";
    $alt_extensions = '';
    if (is_not_empty_array($file_type_r)) {
        $alt_extensions_r = fetch_s_file_type_alt_extension_r($file_type_r['content_type']);
        if (is_array($alt_extensions_r)) {
            $alt_extensions = implode(', ', $alt_extensions_r);
        }
    }
    // convert array of extensiosn to a string
    echo "\n<td class=\"data\">" . get_input_field("alt_extensions[{$row}]", NULL, "Alternate Extensions", "text(20,255)", "N", $alt_extensions, FALSE) . "</td>";
    echo "<td class=\"data\">";
    // Get the theme specific source of the image.
    if (strlen($file_type_r['image']) > 0) {
        $src = theme_image_src($file_type_r['image']);
    }
    if ($src !== FALSE && strlen($src) > 0) {
        echo "<img src=\"{$src}\">";
    } else {
        echo "&nbsp;";
    }
    echo "</td>";
    echo "\n<td class=\"data\">" . get_input_field("image[{$row}]", NULL, NULL, "url(15,*,\"gif,jpg,png\",N)", "N", $file_type_r['image'], FALSE) . "</td>";
    echo "\n<td class=\"data\">" . get_input_field("thumbnail_support_ind[{$row}]", NULL, NULL, "simple_checkbox(" . (strtoupper($file_type_r['thumbnail_support_ind']) == "Y" ? "CHECKED" : "") . ")", "N", "Y", FALSE) . "</td>";
    echo "\n<td class=\"data\">";
    if (is_not_empty_array($file_type_r)) {
        echo "<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=delete&content_type=" . $file_type_r['content_type'] . "\">Delete</a>";
    } else {
        echo "&nbsp;";
    }
    echo "\n</td>";
    echo "</tr>";
}
示例#5
0
function display_borrower_form($HTTP_VARS)
{
    echo "\n<form action=\"{$PHP_SELF}\" method=\"GET\">";
    echo "\n<input type=\"hidden\" name=\"op\" value=\"checkout\">";
    echo "\n<table class=\"borrowerForm\">";
    if (get_opendb_config_var('borrow', 'admin_quick_checkout_borrower_lov') !== TRUE) {
        echo get_input_field('borrower_id', NULL, get_opendb_lang_var('borrower'), "filtered(20,20,a-zA-Z0-9_.)", "Y", NULL, TRUE);
    } else {
        $results = fetch_user_rs(PERM_USER_BORROWER, INCLUDE_ROLE_PERMISSIONS, EXCLUDE_CURRENT_USER, EXCLUDE_DEACTIVATED_USER, 'fullname', 'ASC');
        if ($results) {
            echo format_field(get_opendb_lang_var('borrower'), custom_select('borrower_id', $results, '%fullname% (%user_id%)', 1, NULL, 'user_id'));
        } else {
            echo format_field(get_opendb_lang_var('borrower'), get_opendb_lang_var('no_records_found'));
        }
    }
    echo "</table>";
    echo "<input type=\"submit\" class=\"submit\" value=\"" . get_opendb_lang_var('submit') . "\">";
    echo "</form>";
}
示例#6
0
文件: index.php 项目: horrabin/opendb
/**
   @param $edit_op - indicates the operation that spawned this table, will be used
   by the refresh operation.
*/
function display_edit_table($edit_op, $update_op, $headers, $display_functioname, $context_http_vars, $results)
{
    global $PHP_SELF;
    global $ADMIN_TYPE;
    global $HTTP_VARS;
    echo "\n<form name=\"editform\" action=\"{$PHP_SELF}\" method=\"POST\">";
    echo "\n<input type=\"hidden\" name=\"type\" value=\"" . $ADMIN_TYPE . "\">";
    echo "\n<input type=\"hidden\" name=\"op\" value=\"{$edit_op}\">";
    echo get_url_fields($context_http_vars, NULL, array('op', 'type'));
    echo "<table>";
    echo "\n<tr class=\"navbar\">";
    for ($i = 0; $i < count($headers); $i++) {
        echo "\n<th>" . $headers[$i] . "</th>";
    }
    echo "\n</tr>";
    $row = 0;
    if ($results) {
        while ($result_r = db_fetch_assoc($results)) {
            echo "\n<tr>";
            $display_functioname($result_r, $row);
            echo "\n</tr>";
            $row++;
        }
        db_free_result($results);
    }
    if (is_numeric($HTTP_VARS['blank_rows'])) {
        $blank_rows = (int) $HTTP_VARS['blank_rows'];
    } else {
        $blank_rows = 5;
    }
    for ($i = $row; $i < $row + $blank_rows; $i++) {
        echo "\n<tr>";
        $display_functioname(array(), $i);
        echo "\n</tr>";
    }
    echo "</table>";
    echo get_input_field("blank_rows", NULL, NULL, "value_select(\"1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20\",1)", "N", ifempty($HTTP_VARS['blank_rows'], "5"), FALSE, NULL, "this.form.submit();");
    echo "<input type=\"button\" class=\"button\" value=\"Refresh\" onclick=\"this.form['op'].value='{$edit_op}'; this.form.submit();\">";
    echo "<input type=\"button\" class=\"button\" value=\"Update\" onclick=\"this.form['op'].value='{$update_op}'; this.form.submit();\">";
    echo "</form>";
}
示例#7
0
文件: index.php 项目: horrabin/opendb
function get_column_details($record_r, $row)
{
    if (is_not_empty_array($record_r)) {
        $new_record = FALSE;
    } else {
        $new_record = TRUE;
    }
    $columns_r = NULL;
    $columns_r[] = array('column' => 'button', 'field' => '<a style="{cursor: pointer;}" onClick="moveRowUp(document.forms[\'s_item_listing_conf\'], document.forms[\'s_item_listing_conf\'][\'column_no[' . $row . ']\']); return false;"><img src="./images/admin/up.gif" border=0></a><br />' . '<a style="{cursor: pointer;}" onClick="moveRowDown(document.forms[\'s_item_listing_conf\'], document.forms[\'s_item_listing_conf\'][\'column_no[' . $row . ']\']); return false;"><img src="./images/admin/down.gif" border=0></a>');
    $column_types_r = array(array('value' => '', 'display' => ''), array('value' => 's_field_type', 'display' => 'Field Type'), array('value' => 's_attribute_type', 'display' => 'Attribute Type'), array('value' => 'action_links', 'display' => 'Action Links'), array('value' => 'borrow_status', 'display' => 'Borrow Status'));
    $columns_r[] = array('column' => 'column_type', 'field' => custom_select("column_type[{$row}]", $column_types_r, '%display%', 1, $record_r['column_type'], 'value', NULL, '', 'doOnChange(this.form, this)', FALSE));
    // disabled
    $field_type_r = array();
    if ($new_record || $record_r['column_type'] != 's_field_type') {
        $field_type_r = array(array('value' => '', 'display' => ''));
    }
    //ITEM_ID, TITLE, STATUSTYPE, STATUSCMNT, CATEGORY, RATING, ITEMTYPE, OWNER, INTEREST
    $field_type_r = array_merge($field_type_r, array(array('value' => 'ITEM_ID', 'display' => 'Item ID'), array('value' => 'ITEMTYPE', 'display' => 'Item Type'), array('value' => 'TITLE', 'display' => 'Title'), array('value' => 'CATEGORY', 'display' => 'Category'), array('value' => 'STATUSTYPE', 'display' => 'Status Type'), array('value' => 'STATUSCMNT', 'display' => 'Status Comment'), array('value' => 'OWNER', 'display' => 'Owner'), array('value' => 'INTEREST', 'display' => 'Interest'), array('value' => 'RATING', 'display' => 'Rating')));
    $columns_r[] = array('column' => 's_field_type', 'field' => custom_select("s_field_type[{$row}]", $field_type_r, '%display%', 1, $record_r['s_field_type'], 'value', NULL, '', 'doOnChange(this.form, this)', $new_record || is_field_disabled('s_field_type', $record_r)));
    $attribute_type_rs = array();
    if ($new_record || $record_r['column_type'] != 's_attribute_type') {
        $attribute_type_rs = array(array('value' => '', 'display' => ''));
    }
    $attribute_type_rs = get_attribute_type_rs($attribute_type_rs);
    // this is to avoid confusion if system data is defined for non-existent s_attribute_types
    if (!$new_record && !in_array($record_r['s_attribute_type'], $attribute_type_rs)) {
        $attribute_type_rs[] = array('value' => $record_r['s_attribute_type'], 'display' => $record_r['s_attribute_type']);
    }
    $columns_r[] = array('column' => 's_attribute_type', 'field' => custom_select("s_attribute_type[{$row}]", $attribute_type_rs, '%value%', 1, $record_r['s_attribute_type'], 'value', NULL, '', 'doOnChange(this.form, this)', $new_record || is_field_disabled('s_attribute_type', $record_r)));
    $columns_r[] = array('column' => 'override_prompt', 'field' => get_input_field("override_prompt[{$row}]", NULL, 'Override Prompt', 'text(20,30)', 'N', $record_r['override_prompt'], FALSE, '', '', $new_record || is_field_disabled('override_prompt', $record_r)));
    $disabled = $new_record || is_field_disabled('printable_support_ind', $record_r);
    if ($disabled) {
        $record_r['printable_support_ind'] = 'N';
    }
    $columns_r[] = array('column' => 'printable_support_ind', 'field' => get_input_field("printable_support_ind[{$row}]", NULL, 'Printable Support', "simple_checkbox(" . ($record_r['printable_support_ind'] == 'Y' ? 'CHECKED' : '') . ")", 'N', 'Y', FALSE, '', '', $disabled));
    $disabled = $new_record || is_field_disabled('orderby_support_ind', $record_r);
    if ($disabled) {
        $record_r['orderby_support_ind'] = 'N';
    }
    $columns_r[] = array('column' => 'orderby_support_ind', 'field' => get_input_field('orderby_support_ind[' . $row . ']', NULL, 'Order By Support', "simple_checkbox(" . ($record_r['orderby_support_ind'] == 'Y' ? 'CHECKED' : '') . ")", 'N', 'Y', FALSE, NULL, 'doOnChange(this.form, this);', $new_record || is_field_disabled('orderby_support_ind', $record_r)));
    $orderby_datatypes_r = array();
    if (is_field_disabled('orderby_datatype', $record_r)) {
        $orderby_datatypes_r = array(array('value' => '', 'display' => ''));
    }
    $orderby_datatypes_r = array_merge($orderby_datatypes_r, array(array('value' => 'alpha'), array('value' => 'numeric')));
    $columns_r[] = array('column' => 'orderby_datatype', 'field' => custom_select("orderby_datatype[{$row}]", $orderby_datatypes_r, '%value%', 1, $record_r['orderby_datatype'], 'value', NULL, '', '', $new_record || is_field_disabled('orderby_datatype', $record_r)));
    $disabled = $new_record || is_field_disabled('orderby_default_ind', $record_r);
    if ($disabled) {
        $record_r['orderby_default_ind'] = 'N';
    }
    $columns_r[] = array('column' => 'orderby_default_ind', 'field' => get_input_field("orderby_default_ind[{$row}]", NULL, 'Default Orderby', "simple_checkbox(" . ($record_r['orderby_default_ind'] == 'Y' ? 'CHECKED' : '') . ")", 'N', 'Y', FALSE, '', 'doOnChange(this.form, this);', $disabled));
    $sortorder_r = array();
    if (is_field_disabled('orderby_sort_order', $record_r)) {
        $sortorder_r = array(array('value' => '', 'display' => ''));
    }
    $sortorder_r = array_merge($sortorder_r, array(array('value' => 'asc'), array('value' => 'desc')));
    $columns_r[] = array('column' => 'orderby_sort_order', 'field' => custom_select("orderby_sort_order[{$row}]", $sortorder_r, '%value%', 1, $record_r['orderby_sort_order'], 'value', NULL, '', '', $new_record || is_field_disabled('orderby_sort_order', $record_r)));
    $buffer = "<tr>";
    $buffer .= '<input type="hidden" name="is_new_row[' . $row . ']" value="' . ($new_record ? 'true' : 'false') . '">';
    $class = 'data';
    if (strlen($columns_r['error']) > 0) {
        $class = 'error';
    }
    // column_no hidden must be null for us to determine if a row has been populated
    $buffer .= get_input_field("column_no[{$row}]", NULL, 'Column No', 'hidden', 'N', $record_r['column_no'], FALSE);
    while (list(, $column_r) = each($columns_r)) {
        $buffer .= '<td class="' . $class . '" id="' . $column_r['column'] . '[' . $row . ']" nowrap>' . $column_r['field'] . '</td>';
    }
    $buffer .= '</tr>';
    return $buffer;
}
示例#8
0
文件: email.php 项目: horrabin/opendb
function show_email_form($to_userid, $to_fullname, $from_userid, $from_fullname, $subject, $message, $HTTP_VARS, $errors)
{
    global $PHP_SELF;
    if (strlen($to_userid) > 0 && strlen($to_fullname) > 0) {
        $to = get_opendb_lang_var('user_name', array('fullname' => $to_fullname, 'user_id' => $to_userid));
    } else {
        if (strlen($to_fullname) > 0) {
            $to = $to_fullname;
        } else {
            if (strlen($to_userid) > 0) {
                $to = $to_userid;
            }
        }
    }
    $isFromReadonly = FALSE;
    if (strlen($from_userid) > 0 && strlen($from_fullname) > 0) {
        $from = get_opendb_lang_var('current_user', array('fullname' => $from_fullname, 'user_id' => $from_userid));
        $isFromReadonly = TRUE;
    } else {
        if (strlen($from_fullname) > 0) {
            $from = $from_fullname;
            // this is an email address
        } else {
            if (strlen($from_userid) > 0) {
                $from = $from_userid;
                // this is an email address
            }
        }
    }
    if (is_array($errors)) {
        echo format_error_block($errors);
    }
    echo "\n<form action=\"{$PHP_SELF}\" method=\"POST\">";
    echo get_url_fields($HTTP_VARS, array('op2' => 'send'), array('subject', 'message'));
    echo "\n<table class=\"emailForm\">";
    echo format_field(get_opendb_lang_var('to'), $to);
    echo get_input_field("from", NULL, get_opendb_lang_var('from'), $isFromReadonly ? "readonly" : "email(50,100)", "Y", $from, TRUE);
    echo get_input_field("subject", NULL, get_opendb_lang_var('subject'), "text(50,100)", "Y", $subject, TRUE);
    echo get_input_field("message", NULL, get_opendb_lang_var('message'), "textarea(50,10)", "N", $message, TRUE);
    echo "</table>";
    $help_block_r[] = array('img' => 'compulsory.gif', 'text' => get_opendb_lang_var('compulsory_field'), id => 'compulsory');
    echo format_help_block($help_block_r);
    echo "<input type=\"submit\" class=\"submit\" value=\"" . get_opendb_lang_var('submit') . "\">";
    echo "\n</form>";
}
示例#9
0
文件: index.php 项目: horrabin/opendb
function display_edit_form($status_type_r, $HTTP_VARS = NULL)
{
    global $_COLUMN_DESC;
    if (is_array($status_type_r)) {
        echo get_input_field("s_status_type", NULL, $_COLUMN_DESC['s_status_type'], "readonly", "Y", $status_type_r['s_status_type'], TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('s_status_type') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>");
    } else {
        echo get_input_field("s_status_type", NULL, $_COLUMN_DESC['s_status_type'], "text(1,1)", "Y", $HTTP_VARS['s_status_type'], TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('s_status_type') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>");
    }
    echo get_input_field("description", NULL, $_COLUMN_DESC['description'], "text(30,60)", "Y", ifempty($status_type_r['description'], $HTTP_VARS['description']), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('description') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>");
    $field = get_input_field("img", NULL, $_COLUMN_DESC['img'], "url(15,*,\"gif,jpg,png\",N)", "N", ifempty($status_type_r['img'], $HTTP_VARS['img']), FALSE);
    $image_src = theme_image_src(ifempty($status_type_r['img'], $HTTP_VARS['img']));
    if ($image_src !== FALSE && strlen($image_src) > 0) {
        $field .= " <img src=\"{$image_src}\">";
    }
    echo format_field($_COLUMN_DESC['img'], $field, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('img') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>");
    echo get_input_field("delete_ind", NULL, $_COLUMN_DESC['delete_ind'], "value_radio_grid('Y,N')", "N", ifempty($status_type_r['delete_ind'], $HTTP_VARS['delete_ind']), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('delete_ind') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>");
    echo get_input_field("change_owner_ind", NULL, $_COLUMN_DESC['change_owner_ind'], "value_radio_grid('Y,N')", "N", ifempty($status_type_r['change_owner_ind'], ifempty($HTTP_VARS['change_owner_ind'], "N")), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('change_owner_ind') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>");
    echo get_input_field("borrow_ind", NULL, $_COLUMN_DESC['borrow_ind'], "value_radio_grid('Y,N')", "N", ifempty($status_type_r['borrow_ind'], $HTTP_VARS['borrow_ind']), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('borrow_ind') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>");
    echo get_input_field("status_comment_ind", NULL, $_COLUMN_DESC['status_comment_ind'], "value_radio_grid('Y,N')", "N", ifempty($status_type_r['status_comment_ind'], $HTTP_VARS['status_comment_ind']), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('status_comment_ind') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>");
    echo get_input_field("hidden_ind", NULL, $_COLUMN_DESC['hidden_ind'], "value_radio_grid('Y,N')", "N", ifempty($status_type_r['hidden_ind'], $HTTP_VARS['hidden_ind']), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('hidden_ind') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>");
    echo get_input_field("default_ind", NULL, $_COLUMN_DESC['default_ind'], "checkbox(Y,N)", "N", ifempty($status_type_r['default_ind'], $HTTP_VARS['default_ind']), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('default_ind') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>");
    if (is_array($status_type_r)) {
        echo get_input_field("closed_ind", NULL, $_COLUMN_DESC['closed_ind'], "checkbox(Y,N)", "N", ifempty($status_type_r['closed_ind'], $HTTP_VARS['closed_ind']), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('closed_ind') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>");
    }
}
示例#10
0
/**
 */
function get_row_column_mappings_table($s_item_type, $owner_id, $header_row, $field_column_r, $field_default_r, $field_initcap_r)
{
    $buffer = "\n<table>";
    $buffer .= "\n<tr class=\"navbar\"><th></th>" . "<th>" . get_opendb_lang_var('field') . "</th>" . "<th>" . get_opendb_lang_var('default') . "</th>" . "<th> " . get_opendb_lang_var('initcap') . "</th></tr>";
    // If the prompt for this field, matches any of the $tokens, then select that token.
    if (!is_numeric($field_column_r['s_item_type'])) {
        for ($i = 0; $i < count($header_row); $i++) {
            if ($header_row[$i] == 's_item_type' || $header_row[$i] == get_opendb_lang_var('s_item_type')) {
                $field_column_r['s_item_type'] = $i;
                break;
            }
        }
    }
    // If your data includes the item_type, then specify the column, so we
    // can ignore records that are not of the chosen item_type.
    $buffer .= "\n<tr>" . "<th class=\"prompt\" scope=\"row\">" . get_opendb_lang_var('s_item_type') . "</th>" . "<td class=\"data fieldColumn\">" . get_column_select_block("field_column[s_item_type]", $header_row, $field_column_r['s_item_type']) . "</td>" . "<td class=\"data defaultColumn\">&nbsp;</td>" . "<td class=\"data initcapColumn\">&nbsp;</td>" . "</tr>";
    // --------- Now the main input fields start....
    $results = fetch_item_attribute_type_rs($s_item_type);
    if ($results) {
        while ($item_attribute_type_r = db_fetch_assoc($results)) {
            // purely readonly
            if ($item_attribute_type_r['s_field_type'] !== 'ITEM_ID') {
                $fieldname = get_field_name($item_attribute_type_r['s_attribute_type'], $item_attribute_type_r['order_no']);
                if ($item_attribute_type_r['s_field_type'] == 'STATUSTYPE') {
                    $lookup_results = fetch_newitem_status_type_rs();
                    $default_field = build_select("field_default[{$fieldname}]", $lookup_results, $field_default_r[$fieldname], FALSE);
                    // do not include 'None' option
                    $initcap_field = NULL;
                    // No initcap for these types of fields.
                } else {
                    if ($item_attribute_type_r['input_type'] !== "textarea" && $item_attribute_type_r['input_type'] !== "url") {
                        // Check if any lookup values for this field.
                        $lookup_results = fetch_attribute_type_lookup_rs($item_attribute_type_r['s_attribute_type'], 'order_no, value ASC');
                        if ($lookup_results) {
                            $default_field = build_select("field_default[{$fieldname}]", $lookup_results, $field_default_r[$fieldname]);
                            $initcap_field = NULL;
                            // No initcap for these types of fields.
                        } else {
                            //use normal input field.
                            if ($item_attribute_type_r['multi_attribute_ind'] == 'Y') {
                                $item_attribute_type_r['multi_attribute_ind'] = 'N';
                            }
                            $default_field = get_item_input_field("field_default[{$fieldname}]", $item_attribute_type_r, NULL, $field_default_r[$fieldname], FALSE);
                            if ($item_attribute_type_r['input_type'] === 'text') {
                                $initcap_field = get_input_field("field_initcap[{$fieldname}]", NULL, NULL, "checkbox(true,false,)", "N", ifempty($field_initcap_r[$fieldname], get_opendb_config_var('import', 'row_import_default_initcap_checked') ? "true" : "false"), FALSE);
                            } else {
                                //Only for text fields.
                                $initcap_field = NULL;
                            }
                        }
                    } else {
                        $field = NULL;
                        $default_field = NULL;
                        $initcap_field = NULL;
                    }
                }
                // If the prompt for this field, matches any of the $tokens, then select that token.
                if (!is_numeric($field_column_r[$fieldname])) {
                    for ($i = 0; $i < count($header_row); $i++) {
                        // A direct export from CSV Export, so lets match the columns for you.
                        if ($header_row[$i] == $fieldname || $header_row[$i] == $item_attribute_type_r['prompt'] || $item_attribute_type_r['s_field_type'] == 'CATEGORY' && $header_row[$i] == 'Genre') {
                            $field_column_r[$fieldname] = $i;
                            break;
                        }
                    }
                }
                $buffer .= "\n<tr>" . "<th class=\"prompt\" scope=\"row\">" . $item_attribute_type_r['prompt'] . "</th>" . "<td class=\"data fieldColumn\">" . get_column_select_block("field_column[{$fieldname}]", $header_row, $field_column_r[$fieldname]) . "</td>" . "<td class=\"data defaultColumn\">" . $default_field . "</td>" . "<td class=\"data initcapColumn\">" . $initcap_field . "</td>" . "</tr>";
            }
            //if($item_attribute_type_r['s_field_type'] !== 'ITEM_ID')
        }
        //while
        db_free_result($results);
    }
    //if($results)
    $buffer .= "\n</table>";
    return $buffer;
}
示例#11
0
文件: index.php 项目: horrabin/opendb
function display_s_addr_attribute_type_rltshp_row($s_address_type, $s_addr_attribute_type_rltshp_r, $row, $exists_error_ind = FALSE, $s_attribute_type_list_rs)
{
    echo "<tr>";
    // Indicates this record is in error, and we need to make this clear.
    if ($exists_error_ind) {
        $class = "error";
    } else {
        $class = "data";
    }
    // Delete ind
    echo "<td class=\"{$class}\">";
    if (!$exists_error_ind && is_not_empty_array($s_addr_attribute_type_rltshp_r) && is_s_addr_attribute_type_rltshp_deletable($s_address_type, $s_addr_attribute_type_rltshp_r['s_attribute_type'], $s_addr_attribute_type_rltshp_r['order_no'])) {
        echo get_input_field("delete_ind[{$row}]", NULL, NULL, "simple_checkbox()", "N", "Y", FALSE);
    } else {
        echo "&nbsp;";
    }
    echo "</td>";
    // s_attribute_type
    if (is_not_empty_array($s_addr_attribute_type_rltshp_r) && $exists_error_ind == FALSE) {
        // order_no
        echo "<td class=\"{$class}\">" . get_input_field("order_no[{$row}]", NULL, NULL, "number(3)", "Y", $s_addr_attribute_type_rltshp_r['order_no'], FALSE) . "<input type=\"hidden\" name=\"old_order_no[{$row}]\" value=\"" . $s_addr_attribute_type_rltshp_r['order_no'] . "\">" . "</td>";
        echo "\n<td class=\"{$class}\">" . get_input_field("s_attribute_type[{$row}]", NULL, NULL, "readonly", "Y", $s_addr_attribute_type_rltshp_r['s_attribute_type'], FALSE) . "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"Y\">" . "</td>";
        echo "<td class=\"{$class}\"><a href=\"#\" onmouseover=\"return show_sat_tooltip('" . $s_addr_attribute_type_rltshp_r['s_attribute_type'] . "', arrayOfSystemAttributeTypeTooptips);\" onmouseout=\"return hide_tooltip();\">(?)</a></td>";
    } else {
        // order_no
        echo "<td class=\"{$class}\">" . ($exists_error_ind ? theme_image("rs.gif", "Duplicate Attribute Type & Order No") : "") . get_input_field("order_no[{$row}]", NULL, NULL, "number(3)", "N", $s_addr_attribute_type_rltshp_r['order_no'], FALSE) . "</td>";
        echo "<td class=\"{$class}\">" . "<select name=\"s_attribute_type[{$row}]\">" . "\n<option value=\"\">";
        reset($s_attribute_type_list_rs);
        while (list(, $attribute_type_r) = each($s_attribute_type_list_rs)) {
            if (is_not_empty_array($s_addr_attribute_type_rltshp_r) && $s_addr_attribute_type_rltshp_r['s_attribute_type'] == $attribute_type_r['s_attribute_type']) {
                echo "\n<option value=\"" . $attribute_type_r['s_attribute_type'] . "\" SELECTED>" . $attribute_type_r['s_attribute_type'];
            } else {
                echo "\n<option value=\"" . $attribute_type_r['s_attribute_type'] . "\">" . $attribute_type_r['s_attribute_type'];
            }
        }
        echo "\n</select></td>";
        echo "<td class=\"{$class}\"><a href=\"#\" onmouseover=\"return show_sat_select_tooltip(document.forms['s_addr_attribute_type_rltshp']['s_attribute_type[{$row}]'], arrayOfSystemAttributeTypeTooptips);\" onmouseout=\"return hide_tooltip();\">(?)</a></td>";
    }
    echo "<td class=\"{$class}\">" . get_input_field("prompt[{$row}]", NULL, NULL, "text(15,30)", "N", $s_addr_attribute_type_rltshp_r['prompt'], FALSE) . "</td>";
    if (is_array($s_addr_attribute_type_rltshp_r)) {
        echo "\n<td class=\"{$class}\">" . get_input_field("closed_ind[{$row}]", NULL, NULL, "simple_checkbox(" . ($s_addr_attribute_type_rltshp_r['closed_ind'] == 'Y' ? 'CHECKED' : '') . ")", "N", "Y", FALSE) . "</td>";
    }
    echo "</td>";
    echo "</tr>";
}
示例#12
0
function install_opendb_user_and_database_form($HTTP_VARS, $errors)
{
    global $PHP_SELF;
    $buffer = "<h3>OpenDb Database Configuration</h3>\n";
    if (is_array($errors)) {
        echo format_error_block($errors);
    }
    $buffer .= "\n<form action=\"{$PHP_SELF}\" method=\"GET\">" . "<input type=\"hidden\" name=\"step\" value=\"pre-install\">";
    $dbserver_conf_r = get_opendb_config_var('db_server');
    $buffer .= "<p>What database do you want to use for your OpenDb installation?</p>";
    $buffer .= "<table>";
    $buffer .= get_input_field("host", NULL, "MySQL Database Host", "text(50,255)", "Y", strlen($HTTP_VARS['host']) > 0 ? $HTTP_VARS['host'] : ifempty($dbserver_conf_r['host'], 'localhost'), TRUE);
    $buffer .= get_input_field("dbname", NULL, "MySQL Database Name", "text(50,255)", "Y", strlen($HTTP_VARS['dbname']) > 0 ? $HTTP_VARS['dbname'] : ifempty($dbserver_conf_r['dbname'], 'opendb'), TRUE);
    $buffer .= get_input_field("username", NULL, "MySQL User Name", "text(50,255)", "Y", strlen($HTTP_VARS['username']) > 0 ? $HTTP_VARS['username'] : ifempty($dbserver_conf_r['username'], 'lender'), TRUE);
    $buffer .= get_input_field("passwd", NULL, "MySQL User Password", "text(50,255)", "Y", strlen($HTTP_VARS['passwd']) > 0 ? $HTTP_VARS['passwd'] : ifempty($dbserver_conf_r['passwd'], 'test'), TRUE);
    $buffer .= get_input_field("table_prefix", NULL, "Table Prefix", "text(50,255)", "N", strlen($HTTP_VARS['table_prefix']) > 0 ? $HTTP_VARS['table_prefix'] : $dbserver_conf_r['table_prefix'], TRUE);
    $buffer .= "</table>";
    $buffer .= "<h3>MySQL Root User</h3>";
    $buffer .= "<p>If the specified database and/or user do not already exist, the installer can create them, but only if MySQL 'Root' User credentials are provided that have\n\t \tpermission to CREATE DATABASE and GRANT ALL PRIVILEGES.</p>";
    $buffer .= "<table>";
    $buffer .= get_input_field("db_username", NULL, "MySQL Root User Name", "text(50,255)", "N", $HTTP_VARS['db_username'], TRUE);
    $buffer .= get_input_field("db_passwd", NULL, "MySQL Root User Password", "password(50,255)", "N", $HTTP_VARS['db_passwd'], TRUE);
    $buffer .= "</table>";
    $buffer .= format_help_block(array('img' => 'compulsory.gif', 'text' => 'Compulsory Field', id => 'compulsory'));
    $buffer .= "<input type=\"button\" class=\"button\" value=\"Next\" onclick=\"this.value='Working...'; this.disabled=true; this.form.submit(); return true;\">\n";
    $buffer .= "</form>\n";
    return $buffer;
}
示例#13
0
            }
            $itemTypeBlock .= "</select>";
            echo format_field(get_opendb_lang_var('s_attribute_type'), $attrTypeSelect);
            echo format_field(get_opendb_lang_var('s_attribute_type_lookup'), "\n<select name=\"lookup_attribute_val\" id=\"search-lookupattributeval\" onChange=\"if(this.options[this.options.selectedIndex].value.length>0){this.form['attribute_val'].disabled=true;}else{this.form['attribute_val'].disabled=false;}\">" . "\n<option value=\"\">" . get_opendb_lang_var('use_the_value_field') . " ---->" . "\n</select>");
            echo format_field(get_opendb_lang_var('attribute_val'), "<input type=\"text\" class=\"text\" name=\"attribute_val\" id=\"search-attributeval\" size=\"50\" value=\"\">" . "\n<ul class=\"searchInputOptions\">" . "\n<li><input type=\"radio\" class=\"radio\" name=\"attr_match\" value=\"word\">" . get_opendb_lang_var('word_match') . "</li>" . "\n<li><input type=\"radio\" class=\"radio\" name=\"attr_match\" value=\"partial\" CHECKED>" . get_opendb_lang_var('partial_match') . "</li>" . "\n<li><input type=\"radio\" class=\"radio\" name=\"attr_match\" value=\"exact\">" . get_opendb_lang_var('exact_match') . "</li>" . "\n<li><input type=\"checkbox\" class=\"checkbox\" name=\"attr_case\" value=\"case_sensitive\">" . get_opendb_lang_var('case_sensitive') . "</li>" . "\n</ul>");
            if (strlen($HTTP_VARS['not_owner_id']) > 0) {
                echo "\n<input type=\"hidden\" name=\"not_owner_id\" value=\"" . $HTTP_VARS['not_owner_id'] . "\">";
            }
            echo format_field(get_opendb_lang_var('owner'), "\n<select name=\"owner_id\" id=\"search-owner\">" . "\n<option value=\"\">-------------- " . get_opendb_lang_var('all') . " --------------" . custom_select('owner_id', fetch_user_rs(PERM_ITEM_OWNER), '%fullname% (%user_id%)', 'NA', NULL, 'user_id') . "\n</select>");
            $lookup_results = fetch_status_type_rs(TRUE);
            if ($lookup_results && db_num_rows($lookup_results) > 1) {
                echo format_field(get_opendb_lang_var('s_status_type'), checkbox_grid('s_status_type', $lookup_results, '%img%', 'VERTICAL', array()));
                // value
            }
            echo format_field(get_opendb_lang_var('status_comment'), "\n<input type=\"text\" class=\"text\" name=\"status_comment\" id=\"search-statuscomment\" size=\"50\">" . "\n<ul class=\"searchInputOptions\">" . "\n<li><input type=\"radio\" class=\"radio\" name=\"status_comment_match\" value=\"word\">" . get_opendb_lang_var('word_match') . "</li>" . "\n<li><input type=\"radio\" class=\"radio\" name=\"status_comment_match\" value=\"partial\" CHECKED>" . get_opendb_lang_var('partial_match') . "</li>" . "\n<li><input type=\"radio\" class=\"radio\" name=\"status_comment_match\" value=\"exact\">" . get_opendb_lang_var('exact_match') . "</li>" . "\n<li><input type=\"checkbox\" class=\"checkbox\" name=\"status_comment_case\" value=\"case_sensitive\">" . get_opendb_lang_var('case_sensitive') . "</li>" . "\n</ul>");
            echo format_field(get_opendb_lang_var('updated'), "\n<select name=\"update_on_days\" id=\"search-updateondays\" onChange=\"if(this.options[this.options.selectedIndex].value.length>0){this.form['update_on'].disabled=true;}else{this.form['update_on'].disabled=false;}\">" . "\n<option value=\"\">" . get_opendb_lang_var('specify_datetime') . " ---->" . "\n<option value=\"1\">" . get_opendb_lang_var('one_day_ago') . "\n<option value=\"7\">" . get_opendb_lang_var('one_week_ago') . "\n<option value=\"28\">" . get_opendb_lang_var('one_month_ago') . "\n<option value=\"365\">" . get_opendb_lang_var('one_year_ago') . "\n</select>" . get_input_field("update_on", NULL, NULL, "datetime(" . get_opendb_config_var('search', 'datetime_mask') . ")", "N", NULL, FALSE));
            echo format_field(get_opendb_lang_var('order_by'), "\n<select name=\"order_by\"  id=\"search-orderby\">" . "\n<option value=\"title\" SELECTED>" . get_opendb_lang_var('title') . "\n<option value=\"owner_id\">" . get_opendb_lang_var('owner') . "\n<option value=\"category\">" . get_opendb_lang_var('category') . "\n<option value=\"s_item_type\">" . get_opendb_lang_var('item_type') . "\n<option value=\"s_status_type\">" . get_opendb_lang_var('s_status_type') . "\n<option value=\"update_on\">" . get_opendb_lang_var('update_date') . "\n</select>" . "\n<input type=\"radio\" class=\"radio\" name=\"sortorder\" value=\"ASC\" CHECKED>" . get_opendb_lang_var('asc') . "\n<input type=\"radio\" class=\"radio\" name=\"sortorder\" value=\"DESC\">" . get_opendb_lang_var('desc'));
            echo "</table>";
            echo "\n<input type=\"submit\" class=\"submit\" value=\"" . get_opendb_lang_var('search') . "\">";
            echo "</form>";
            echo _theme_footer();
        } else {
            opendb_not_authorised_page(PERM_VIEW_ADVANCED_SEARCH, $HTTP_VARS);
        }
    } else {
        // invalid login, so login instead.
        redirect_login($PHP_SELF, $HTTP_VARS);
    }
} else {
    //if(is_site_enabled())
    opendb_site_disabled();
示例#14
0
文件: index.php 项目: horrabin/opendb
function display_s_item_attribute_type_row($s_item_type, $s_item_attribute_type_r, $row, $exists_error_ind = FALSE, $s_attribute_type_list_rs)
{
    global $PHP_SELF;
    global $ADMIN_TYPE;
    echo "<tr>";
    // Indicates this record is in error, and we need to make this clear.
    if ($exists_error_ind) {
        $class = "error";
    } else {
        $class = "data";
    }
    // s_attribute_type
    if (is_not_empty_array($s_item_attribute_type_r) && $exists_error_ind == FALSE) {
        // order_no
        echo "<td class=\"{$class}\">";
        if (!is_s_item_attribute_type_deletable($s_item_type, $s_item_attribute_type_r['s_attribute_type'], $s_item_attribute_type_r['order_no'])) {
            echo get_input_field("order_no[{$row}]", NULL, "Order No.", "readonly", "N", $s_item_attribute_type_r['order_no'], FALSE);
        } else {
            echo get_input_field("order_no[{$row}]", NULL, "Order No.", "number(3)", "N", $s_item_attribute_type_r['order_no'], FALSE);
        }
        echo "<input type=\"hidden\" name=\"old_order_no[{$row}]\" value=\"" . $s_item_attribute_type_r['order_no'] . "\"></td>";
        // See if a s_field_type defined for this attribute type
        $attribute_type_r = fetch_s_attribute_type_r($s_item_attribute_type_r['s_attribute_type']);
        if (strlen($attribute_type_r['s_field_type']) > 0) {
            $value = $s_item_attribute_type_r['s_attribute_type'] . " [" . $attribute_type_r['s_field_type'] . "]";
        } else {
            $value = $s_item_attribute_type_r['s_attribute_type'];
        }
        echo "<input type=\"hidden\" name=\"s_attribute_type[{$row}]\" value=\"" . $s_item_attribute_type_r['s_attribute_type'] . "\">" . "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"Y\">";
        echo "<td class=\"{$class}\">" . $value . "</td>";
        echo "<td class=\"{$class}\"><a href=\"#\" onmouseover=\"return show_sat_tooltip('" . $s_item_attribute_type_r['s_attribute_type'] . "', arrayOfSystemAttributeTypeTooptips);\" onmouseout=\"return hide_tooltip();\">(?)</a></td>";
    } else {
        // order_no
        echo "<td class=\"{$class}\">" . ($exists_error_ind ? theme_image("rs.gif", "Duplicate Attribute Type & Order No") : "") . get_input_field("order_no[{$row}]", NULL, NULL, "number(3)", "N", $s_item_attribute_type_r['order_no'], FALSE) . "</td>";
        echo "<td class=\"{$class}\">" . "<select name=\"s_attribute_type[{$row}]\">" . "\n<option value=\"\">";
        reset($s_attribute_type_list_rs);
        while (list(, $attribute_type_r) = each($s_attribute_type_list_rs)) {
            if (is_not_empty_array($s_item_attribute_type_r) && $s_item_attribute_type_r['s_attribute_type'] == $attribute_type_r['s_attribute_type']) {
                echo "\n<option value=\"" . $attribute_type_r['s_attribute_type'] . "\" SELECTED>" . $attribute_type_r['s_attribute_type'];
            } else {
                echo "\n<option value=\"" . $attribute_type_r['s_attribute_type'] . "\">" . $attribute_type_r['s_attribute_type'];
            }
            if (strlen($attribute_type_r['s_field_type']) > 0) {
                echo " [" . $attribute_type_r['s_field_type'] . "]";
            }
        }
        echo "\n</select></td>";
        echo "<td class=\"{$class}\"><a href=\"#\" onmouseover=\"return show_sat_select_tooltip(document.forms['s_item_attribute_type']['s_attribute_type[{$row}]'], arrayOfSystemAttributeTypeTooptips);\" onmouseout=\"return hide_tooltip();\">(?)</a></td>";
    }
    echo "<td class=\"{$class}\">" . get_input_field("prompt[{$row}]", NULL, NULL, "text(15,30)", "N", $s_item_attribute_type_r['prompt'], FALSE) . "</td>";
    if (!is_array($s_item_attribute_type_r) || $attribute_type_r['s_field_type'] != 'STATUSTYPE' && $attribute_type_r['s_field_type'] != 'STATUSCMNT' && $attribute_type_r['s_field_type'] != 'DURATION' && $attribute_type_r['s_field_type'] != 'TITLE' && $attribute_type_r['s_field_type'] != 'ITEM_ID' && $attribute_type_r['s_field_type'] != 'UPDATE_ON') {
        echo "<td class=\"{$class}\">";
        echo get_input_field("instance_attribute_ind[{$row}]", NULL, NULL, "simple_checkbox(" . (strtoupper($s_item_attribute_type_r['instance_attribute_ind']) == "Y" ? "CHECKED" : "") . ")", "N", "Y", FALSE);
        echo "</td>";
        echo "<td class=\"{$class}\">";
        echo get_input_field("compulsory_ind[{$row}]", NULL, NULL, "simple_checkbox(" . (strtoupper($s_item_attribute_type_r['compulsory_ind']) == "Y" ? "CHECKED" : "") . ")", "N", "Y", FALSE);
        echo "</td>";
    } else {
        // title is not supported at instance level
        if ($attribute_type_r['s_field_type'] == 'TITLE') {
            echo "<td class=\"{$class}\">N</td>";
        } else {
            echo "<td class=\"{$class}\">Y</td>";
        }
        echo "<td class=\"{$class}\">Y</td>";
    }
    echo "\n<td class=\"{$class}\">";
    echo get_input_field("rss_ind[{$row}]", NULL, NULL, "simple_checkbox(" . (strtoupper($s_item_attribute_type_r['rss_ind']) == "Y" ? "CHECKED" : "") . ")", "N", "Y", FALSE) . "&nbsp;Rss Feed<br />";
    echo get_input_field("printable_ind[{$row}]", NULL, NULL, "simple_checkbox(" . (strtoupper($s_item_attribute_type_r['printable_ind']) == "Y" ? "CHECKED" : "") . ")", "N", "Y", FALSE) . "&nbsp;Printable";
    echo "</td>";
    echo "\n<td class=\"{$class}\">";
    if (is_not_empty_array($s_item_attribute_type_r)) {
        echo "<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=delete&s_item_type=" . $s_item_type . "&s_attribute_type=" . $s_item_attribute_type_r['s_attribute_type'] . "&order_no=" . $s_item_attribute_type_r['order_no'] . "\">Delete</a>";
    }
    echo "</td>";
    echo "</tr>";
}
示例#15
0
文件: index.php 项目: horrabin/opendb
function display_edit_form($attribute_type_r, $HTTP_VARS = NULL)
{
    global $display_type_functions;
    global $_FIELD_TYPES;
    // s_attribute_type
    if (is_array($attribute_type_r)) {
        echo get_input_field("s_attribute_type", NULL, "Attribute Type", "readonly", "Y", $attribute_type_r['s_attribute_type']);
    } else {
        echo get_input_field("s_attribute_type", NULL, "Attribute Type", "text(30,30)", "Y", $HTTP_VARS['s_attribute_type'], TRUE, NULL, 'this.value=trim(this.value.toUpperCase()); if(this.value.substring(0,2) == \'S_\'){alert(\'Attributes with a \\\'S_\\\' prefix are reserved for internal use.\'); this.value=\'\'; this.focus(); return false; }');
    }
    //description
    echo get_input_field("description", NULL, "Description", "text(30,60)", "Y", ifempty($attribute_type_r['description'], $HTTP_VARS['description']));
    //prompt
    echo get_input_field("prompt", NULL, "Prompt", "text(20,30)", "Y", ifempty($attribute_type_r['prompt'], $HTTP_VARS['prompt']));
    $is_reserved_attribute_type = is_reserved_s_attribute_type($attribute_type_r['s_attribute_type']);
    if (!$is_reserved_attribute_type) {
        edit_attribute_ind_type_js();
        $attribute_ind_type = get_attribute_ind_type($attribute_type_r, $HTTP_VARS);
        echo format_field('Attribute Type Indicator', build_attribute_ind_type_widget($attribute_ind_type, $HTTP_VARS));
    }
    if ($is_reserved_attribute_type) {
        echo format_field("Input Type", $attribute_type_r['input_type']);
        if (strlen($attribute_type_r['input_type_arg1']) > 0) {
            echo format_field("Input Type Arg 1", $attribute_type_r['input_type_arg1']);
        }
        if (strlen($attribute_type_r['input_type_arg2']) > 0) {
            echo format_field("Input Type Arg 2", $attribute_type_r['input_type_arg2']);
        }
        if (strlen($attribute_type_r['input_type_arg3']) > 0) {
            echo format_field("Input Type Arg 3", $attribute_type_r['input_type_arg3']);
        }
        if (strlen($attribute_type_r['input_type_arg4']) > 0) {
            echo format_field("Input Type Arg 4", $attribute_type_r['input_type_arg4']);
        }
        if (strlen($attribute_type_r['input_type_arg5']) > 0) {
            echo format_field("Input Type Arg 5", $attribute_type_r['input_type_arg5']);
        }
    } else {
        $input_function_list = get_attribute_ind_type_function_list($attribute_ind_type);
        echo format_field("Input Type", build_function_list("input_type", $input_function_list, ifempty($attribute_type_r['input_type'], $HTTP_VARS['input_type'])) . get_function_help_link('input'));
        echo get_input_field("input_type_arg1", NULL, "Input Type Arg 1", "text(25)", 'N', ifempty($attribute_type_r['input_type_arg1'], $HTTP_VARS['input_type_arg1']));
        echo get_input_field("input_type_arg2", NULL, "Input Type Arg 2", "text(25)", 'N', ifempty($attribute_type_r['input_type_arg2'], $HTTP_VARS['input_type_arg2']));
        echo get_input_field("input_type_arg3", NULL, "Input Type Arg 3", "text(25)", 'N', ifempty($attribute_type_r['input_type_arg3'], $HTTP_VARS['input_type_arg3']));
        echo get_input_field("input_type_arg4", NULL, "Input Type Arg 4", "text(25)", 'N', ifempty($attribute_type_r['input_type_arg4'], $HTTP_VARS['input_type_arg4']));
        echo get_input_field("input_type_arg5", NULL, "Input Type Arg 5", "text(25)", 'N', ifempty($attribute_type_r['input_type_arg5'], $HTTP_VARS['input_type_arg5']));
    }
    if ($attribute_type_r['s_field_type'] == 'ITEM_ID' || !$is_reserved_attribute_type) {
        if ($attribute_type_r['s_field_type'] == 'ITEM_ID') {
            $function_list = build_function_list("display_type", array('hidden' => array(), 'display' => array()), ifempty($attribute_type_r['display_type'], $HTTP_VARS['display_type']));
        } else {
            $function_list = build_function_list("display_type", $display_type_functions, ifempty($attribute_type_r['display_type'], $HTTP_VARS['display_type']));
        }
        echo format_field("Display Type", $function_list . get_function_help_link('display'));
    } else {
        echo format_field("Display Type", $attribute_type_r['display_type']);
    }
    if (!$is_reserved_attribute_type) {
        echo get_input_field("display_type_arg1", NULL, "Display Type Arg 1", "text(25)", 'N', ifempty($attribute_type_r['display_type_arg1'], $HTTP_VARS['display_type_arg1']));
        echo get_input_field("display_type_arg2", NULL, "Display Type Arg 2", "text(25)", 'N', ifempty($attribute_type_r['display_type_arg2'], $HTTP_VARS['display_type_arg2']));
        echo get_input_field("display_type_arg3", NULL, "Display Type Arg 3", "text(25)", 'N', ifempty($attribute_type_r['display_type_arg3'], $HTTP_VARS['display_type_arg3']));
        echo get_input_field("display_type_arg4", NULL, "Display Type Arg 4", "text(25)", 'N', ifempty($attribute_type_r['display_type_arg4'], $HTTP_VARS['display_type_arg4']));
        echo get_input_field("display_type_arg5", NULL, "Display Type Arg 5", "text(25)", 'N', ifempty($attribute_type_r['display_type_arg5'], $HTTP_VARS['display_type_arg5']));
    } else {
        if (strlen($attribute_type_r['display_type_arg1']) > 0) {
            echo format_field("Display Type Arg 1", $attribute_type_r['display_type_arg1']);
        }
        if (strlen($attribute_type_r['display_type_arg2']) > 0) {
            echo format_field("Input Type Arg 2", $attribute_type_r['display_type_arg2']);
        }
        if (strlen($attribute_type_r['display_type_arg3']) > 0) {
            echo format_field("Display Type Arg 3", $attribute_type_r['display_type_arg3']);
        }
        if (strlen($attribute_type_r['display_type_arg4']) > 0) {
            echo format_field("Display Type Arg 4", $attribute_type_r['display_type_arg4']);
        }
        if (strlen($attribute_type_r['display_type_arg5']) > 0) {
            echo format_field("Display Type Arg 5", $attribute_type_r['display_type_arg5']);
        }
    }
    echo get_input_field("listing_link_ind", NULL, "Listing Link Indicator", "checkbox(Y,N)", "N", ifempty($attribute_type_r['listing_link_ind'], $HTTP_VARS['listing_link_ind']));
    if (!$is_reserved_attribute_type && $attribute_type_r['s_field_type'] != 'ADDRESS' && $attribute_type_r['s_field_type'] != 'RATING') {
        echo format_field("Field type", custom_select("s_field_type", $_FIELD_TYPES, "%key% - %value%", 1, ifempty($attribute_type_r['s_field_type'], $HTTP_VARS['s_field_type']), "key"));
        $sites = get_site_plugin_list_r();
        if (!is_array($sites)) {
            $sites[] = '';
        } else {
            if (!in_array('', $sites)) {
                $sites = array_merge(array(''), $sites);
            }
        }
        if (strlen($attribute_type_r['site_type']) > 0 && !in_array($attribute_type_r['site_type'], $sites)) {
            $sites[] = $attribute_type_r['site_type'];
        }
        echo format_field("Site type", custom_select("site_type", $sites, "%value%", 1, ifempty($attribute_type_r['site_type'], $HTTP_VARS['site_type'])));
    } else {
        echo format_field("Field type", $attribute_type_r['s_field_type']);
    }
    echo build_roles_select($attribute_type_r);
}
示例#16
0
function get_user_password_change_form($user_r, $HTTP_VARS)
{
    global $PHP_SELF;
    $buffer .= "<form action=\"{$PHP_SELF}\" method=\"POST\">";
    $buffer .= "<table class=\"changePasswordForm\">";
    $buffer .= get_input_field("user_id", NULL, get_opendb_lang_var('userid'), "readonly", "", $user_r['user_id'], TRUE);
    $buffer .= get_input_field("pwd", NULL, get_opendb_lang_var('new_passwd'), "password(30,40)", 'Y', "", TRUE);
    $buffer .= get_input_field("confirmpwd", NULL, get_opendb_lang_var('confirm_passwd'), "password(30,40)", 'Y', "", TRUE, NULL, get_opendb_config_var('widgets', 'enable_javascript_validation') !== FALSE ? "if( (this.form.pwd.value.length!=0 || this.form.confirmpwd.value.length!=0) && this.form.pwd.value!=this.form.confirmpwd.value){alert('" . get_opendb_lang_var('passwds_do_not_match') . "'); this.focus(); return false;}" : "");
    $buffer .= "</table>";
    $buffer .= format_help_block(array('img' => 'compulsory.gif', 'text' => get_opendb_lang_var('compulsory_field'), id => 'compulsory'));
    if (get_opendb_config_var('widgets', 'enable_javascript_validation') !== FALSE) {
        $onclick_event = "if(!checkForm(this.form)){return false;}else{this.form.submit();}";
    } else {
        $onclick_event = "this.form.submit();";
    }
    $buffer .= "\n<input type=\"hidden\" name=\"op\" value=\"update_password\">" . "\n<input type=\"button\" class=\"button\" onclick=\"{$onclick_event}\" value=\"" . get_opendb_lang_var('change_password') . "\">";
    $buffer .= "\n</form>";
    return $buffer;
}
示例#17
0
/**
 * @param $borrowed_item_rs Items that this action will be performed against.  It may actually
 * 						be an array of 'sequence_number' values, in which case the borrow
 * 						record for the sequence_number will be fetched.
 * @param $HTTP_VARS
 * */
function more_information_form($op, $borrowed_item_rs, $HTTP_VARS, $email_notification = TRUE)
{
    global $PHP_SELF;
    $duration_attr_type = NULL;
    $default_borrow_duration = NULL;
    echo "\n<form action=\"{$PHP_SELF}\" method=\"POST\">";
    // In case no detail is required.
    echo "\n<input type=\"hidden\" name=\"more_info_requested\" value=\"true\">";
    // Pass all http variables onto next instance...
    // Includes empty fields...
    echo get_url_fields($HTTP_VARS, NULL, NULL);
    // Display the items to be operated on.
    if (is_not_empty_array($borrowed_item_rs)) {
        echo "<div id=\"moreInfoListing\">";
        // no pagination.
        $HTTP_VARS['items_per_page'] = '';
        $listingObject = new HTML_Listing($PHP_SELF, $HTTP_VARS);
        $listingObject->setIncludeHrefLinks(TRUE);
        $listingObject->setIncludeFooter(FALSE);
        $listingObject->startListing();
        $listingObject->addHeaderColumn(get_opendb_lang_var('type'));
        $listingObject->addHeaderColumn(get_opendb_lang_var('title'));
        if ($op == 'reserve' || $op == 'cancel_reserve' || $op == 'quick_check_out') {
            $listingObject->addHeaderColumn(get_opendb_lang_var('owner'));
        } else {
            if ($op == 'check_in') {
                $listingObject->addHeaderColumn(get_opendb_lang_var('borrower'));
            }
        }
        if (get_opendb_config_var('borrow', 'duration_support')) {
            if ($op == 'check_out' || $op == 'quick_check_out') {
                $listingObject->addHeaderColumn(get_opendb_lang_var('borrow_duration'));
            }
        }
        //initialise
        $max_overdue_duration = NULL;
        $default_borrow_duration = NULL;
        reset($borrowed_item_rs);
        while (list(, $borrowed_item_r) = each($borrowed_item_rs)) {
            $listingObject->startRow();
            // If only a sequence_number, we need to fetch the borrow record.
            if (!is_array($borrowed_item_r) && is_numeric($borrowed_item_r)) {
                $borrowed_item_r = fetch_borrowed_item_r($borrowed_item_r);
            }
            // TODO - add borrowed item history this to be displayed as readonly.
            //$results = fetch_borrowed_item_hist_rs($borrowed_item_r['sequence_number']);
            $item_r = fetch_item_instance_r($borrowed_item_r['item_id'], $borrowed_item_r['instance_no']);
            $listingObject->addItemTypeImageColumn($item_r['s_item_type']);
            $listingObject->addTitleColumn($item_r);
            if ($op == 'reserve' || $op == 'cancel_reserve' || $op == 'quick_check_out') {
                $listingObject->addUserNameColumn($item_r['owner_id'], array('bi_sequence_number' => $borrowed_item_r['sequence_number']));
            } else {
                if ($op == 'check_in') {
                    $listingObject->addUserNameColumn($borrowed_item_r['borrower_id'], array('bi_sequence_number' => $borrowed_item_r['sequence_number']));
                }
            }
            if (get_opendb_config_var('borrow', 'duration_support')) {
                if ($op == 'check_out' || $op == 'quick_check_out') {
                    if (is_numeric($item_r['borrow_duration'])) {
                        // todo - change
                        $duration_attr_type_r = fetch_sfieldtype_item_attribute_type_r($item_r['s_item_type'], 'DURATION');
                        $listingObject->addDisplayColumn($duration_attr_type_r['s_attribute_type'], NULL, $duration_attr_type_r['display_type'], $item_r['borrow_duration']);
                    } else {
                        $listingObject->addColumn(get_opendb_lang_var('undefined'));
                    }
                }
            }
            // While we are here, we are going to calculate the default duration value.
            // We want to choose the least duration value.  If any of the items use a
            // different s_attribute_type for duration, then we should not try to get
            // a default value.  This is indicated by the $duration_attr_type===FALSE
            // if we have encountered a difference.
            if (get_opendb_config_var('borrow', 'duration_support') && $duration_attr_type !== FALSE) {
                $new_duration_attr_type = fetch_sfieldtype_item_attribute_type($item_r['s_item_type'], 'DURATION');
                if ($duration_attr_type == NULL) {
                    $duration_attr_type = $new_duration_attr_type;
                } else {
                    if ($duration_attr_type !== $new_duration_attr_type) {
                        // Different s_attribute_type's for DURATION, so cannot display Duration chooser.
                        $duration_attr_type = FALSE;
                    }
                }
                if ($duration_attr_type !== FALSE) {
                    if ($op == 'check_out' || $op == 'quick_check_out') {
                        // The default borrow duration should be the least amount of days or undefined
                        // if no records have a borrow duration.
                        if ($default_borrow_duration === NULL) {
                            $default_borrow_duration = $item_r['borrow_duration'];
                        } else {
                            if ($default_borrow_duration !== '') {
                                // Undefined empty value.
                                if (is_numeric($default_borrow_duration) && is_numeric($item_r['borrow_duration']) && $item_r['borrow_duration'] < $default_borrow_duration) {
                                    $default_borrow_duration = $item_r['borrow_duration'];
                                }
                            }
                        }
                    } else {
                        if ($op == 'extension') {
                            if ($borrowed_item_r['total_duration'] > $borrowed_item_r['borrow_duration']) {
                                $tmp_overdue_duration = $borrowed_item_r['total_duration'] - $borrowed_item_r['borrow_duration'];
                            }
                            // We want to get the max overdue duration, so we can give the User granting the extension a
                            // default, that will bring all selected items back into non-overdue status.
                            if (!is_numeric($max_overdue_duration) || $max_overdue_duration < $tmp_overdue_duration) {
                                $max_overdue_duration = $tmp_overdue_duration;
                            }
                        }
                    }
                }
            }
            //if(get_opendb_config_var('borrow', 'duration_support') && $duration_attr_type!==FALSE)
            $listingObject->endRow();
        }
        //while(list(,$borrowed_item_r) = each($borrowed_item_rs))
        $listingObject->endListing();
        echo "</div>";
    }
    echo "<table class=\"moreInfo\">";
    // Do not display this more information section unless email is enabled.
    if (is_valid_opendb_mailer() && $email_notification !== FALSE) {
        echo get_input_field("more_information", NULL, get_opendb_lang_var('more_information'), "textarea(50,10)", "N", NULL, TRUE);
    }
    // Include a Borrower ID select, minus the current user.
    if ($op == 'quick_check_out') {
        if (strlen($HTTP_VARS['borrower_id']) == 0 || !is_user_granted_permission(PERM_USER_BORROWER, $HTTP_VARS['borrower_id'])) {
            $current_user_mode = EXCLUDE_CURRENT_USER;
            if (get_opendb_config_var('borrow', 'owner_self_checkout') !== FALSE) {
                $current_user_mode = INCLUDE_CURRENT_USER;
            }
            $results = fetch_user_rs(PERM_USER_BORROWER, INCLUDE_ROLE_PERMISSIONS, $current_user_mode, EXCLUDE_DEACTIVATED_USER, 'fullname', 'ASC');
            if ($results) {
                echo format_field(get_opendb_lang_var('borrower'), custom_select('borrower_id', $results, '%fullname% (%user_id%)', 1, NULL, 'user_id'));
            } else {
                echo format_field(get_opendb_lang_var('borrower'), get_opendb_lang_var('no_records_found'));
            }
        }
    }
    //Only for check_out/quick_check_out operations - makes no sense otherwise!
    if (get_opendb_config_var('borrow', 'duration_support') !== FALSE && ($op == 'check_out' || $op == 'quick_check_out' || $op == 'extension')) {
        // Display default borrow duration.
        if (strlen($duration_attr_type) > 0) {
            $duration_attr_type_r = fetch_attribute_type_r($duration_attr_type);
            // We have to find the matching DURATION lookup value, which is at least
            // as many days as the max_overdue value, or the highest possible
            // duration value, if none found as large as the $max_overdue_duration
            if ($op == 'extension') {
                $default_borrow_duration = NULL;
                $result = fetch_attribute_type_lookup_rs($duration_attr_type_r['s_attribute_type'], 'order_no, value ASC');
                if ($result) {
                    while ($lookup_r = db_fetch_assoc($result)) {
                        if (is_numeric($lookup_r['value']) && (!is_numeric($max_overdue_duration) || is_numeric($max_overdue_duration) && $max_overdue_duration <= $lookup_r['value'])) {
                            $default_borrow_duration = $lookup_r['value'];
                            break;
                        }
                        // backup, in case we need to use outside while loop
                        $lookup_r2 = $lookup_r;
                    }
                    db_free_result($result);
                    // If still null, then set to the largest option
                    if ($default_borrow_duration == NULL) {
                        $default_borrow_duration = $lookup_r2['value'];
                    }
                }
            }
            if ($op != 'extension' && strlen(get_opendb_lang_var('default_borrow_duration')) > 0 && is_array($borrowed_item_rs)) {
                $duration_attr_type_r['prompt'] = get_opendb_lang_var('default_borrow_duration');
            }
            $duration_attr_type_r['compulsory_ind'] = 'N';
            echo get_item_input_field("default_borrow_duration", $duration_attr_type_r, NULL, $op != 'quick_check_out' ? $default_borrow_duration : NULL);
            // Not appropriate for extension operation
            if ($op == 'check_out' || $op == 'quick_check_out') {
                echo get_input_field("override_item_duration", NULL, get_opendb_lang_var('override_item_duration'), "simple_checkbox(" . ($default_borrow_duration === NULL ? "CHECKED" : "") . ")", "N", "Y", TRUE);
            }
        } else {
            //otherwise tell checkout to use item_instance borrow duration instead.
            if ($op == 'check_out' || $op == 'quick_check_out') {
                echo "\n<input type=\"hidden\" name=\"override_item_duration\" value=\"N\">";
            }
        }
    }
    echo "</table>";
    echo "<input type=\"submit\" class=\"submit\" value=\"" . get_opendb_lang_var('submit') . "\">";
    echo "</form>";
    echo format_help_block(get_opendb_lang_var('more_information_help'));
}