Пример #1
0
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
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;
}
Пример #4
0
                             $checkbox_action_rs[] = array('action' => 'item_borrow.php', 'op' => 'reminder', link => get_opendb_lang_var('send_reminder(s)'));
                         }
                         if (get_opendb_config_var('borrow', 'duration_support') !== FALSE) {
                             $checkbox_action_rs[] = array('action' => 'item_borrow.php', 'op' => 'extension', link => get_opendb_lang_var('borrow_duration_extension(s)'));
                         }
                     } else {
                         if ($HTTP_VARS['op'] == 'owner_reserved') {
                             $checkbox_action_rs[] = array('action' => 'item_borrow.php', 'op' => 'check_out', link => get_opendb_lang_var('check_out_item(s)'));
                             $checkbox_action_rs[] = array('action' => 'item_borrow.php', 'op' => 'cancel_reserve', link => get_opendb_lang_var('cancel_reservation(s)'));
                         }
                     }
                 }
             }
             echo format_checkbox_action_links('sequence_number', get_opendb_lang_var('no_items_checked'), $checkbox_action_rs);
         }
         echo format_help_block($listingObject->getHelpEntries());
         echo "<ul class=\"listingControls\">";
         if (get_opendb_config_var('listings', 'allow_override_show_item_image') !== FALSE) {
             echo "<li>" . getToggleControl($PHP_SELF, $HTTP_VARS, get_opendb_lang_var('show_item_image'), 'show_item_image', ifempty($HTTP_VARS['show_item_image'], get_opendb_config_var('listings', 'show_item_image') == TRUE ? 'Y' : 'N')) . "</li>";
         }
         echo "<li>" . getItemsPerPageControl($PHP_SELF, $HTTP_VARS) . "</li>";
         echo "</ul>";
         echo "<p class=\"listingDate\">" . get_opendb_lang_var('listing_generated', 'datetime', get_localised_timestamp(get_opendb_config_var('listings', 'print_listing_datetime_mask'))) . "</p>";
         echo format_footer_links($footer_links_r);
         echo _theme_footer();
     }
     //end if($show_listings)
 } else {
     //no guests allowed!
     opendb_not_authorised_page(PERM_USER_BORROWER, $HTTP_VARS);
 }
Пример #5
0
    echo "\n</table>";
    echo 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) {
        echo "\n<input type=\"button\" class=\"button\" value=\"{$save_button}\" onclick=\"if(!checkForm(this.form)){return false;}else{this.form.submit();}\">";
    } else {
        echo "\n<input type=\"button\" class=\"button\" value=\"{$save_button}\" onclick=\"this.form.submit();\">";
    }
    echo "\n</form>";
} else {
    if ($HTTP_VARS['op'] == 'edit-lookups') {
        // ################################################################
        // Do for both 'update' and 'edit'
        // ################################################################
        echo "<p>[<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&active_tab=" . $HTTP_VARS['active_tab'] . "\">Back to Main</a>]</p>";
        echo "<script language=\"JavaScript1.2\">\n\t\tfunction toggleChecked(element, name)\n\t\t{\n\t\t\tvar form = element.form;\n\n\t\t\t// then we have to uncheck everything else.\n\t\t\tfor (var i=0; i < form.length; i++)\n\t\t\t{\n\t\t        if (form.elements[i].type.toLowerCase() == 'checkbox' && form.elements[i].name.substring(0, name.length+1) == name+'[')\n\t\t\t\t{\n\t\t\t\t\tif(element.checked && form.elements[i].name != element.name)\n\t\t                form.elements[i].checked = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}</script>";
        echo "\n<h3>Edit " . $HTTP_VARS['s_attribute_type'] . " Attribute Type Lookups</h3>";
        if (is_not_empty_array($errors)) {
            echo format_error_block($errors);
        }
        display_lookup_attribute_type_form($HTTP_VARS);
        echo format_help_block('Image(s) must be in a <i>theme search path</i> directory.');
    } else {
        if ($HTTP_VARS['op'] == '') {
            if (is_not_empty_array($errors)) {
                echo format_error_block($errors);
            }
            echo "<p>[<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=new\">New Attribute Type</a>]</p>";
            display_attribute_type_form($HTTP_VARS);
        }
    }
}
Пример #6
0
                             reset($file_list_r);
                             while (list(, $file) = each($file_list_r)) {
                                 $color = $toggle ? "oddRow" : "evenRow";
                                 $toggle = !$toggle;
                                 echo "\n<form name=\"import_file\" action=\"{$PHP_SELF}\" method=\"GET\">" . "\n<input type=\"hidden\" name=\"type\" value=\"" . $ADMIN_TYPE . "\">" . "\n<input type=\"hidden\" name=\"site_type\" value=\"" . $HTTP_VARS['site_type'] . "\">" . "\n<input type=\"hidden\" name=\"op\" value=\"" . $HTTP_VARS['op'] . "\">" . "\n<input type=\"hidden\" name=\"import_file\" value=\"" . $file . "\">";
                                 echo "\n<tr>";
                                 echo "\n<td class=\"{$color}\">" . $file . "</td>";
                                 echo "<td class=\"{$color}\"><input type=\"submit\" class=\"submit\" value=\"Import\"></td></tr>";
                                 echo "\n</form>";
                                 echo "</table>";
                             }
                         } else {
                             echo "</table>";
                             echo "<div class=\"error\">No files found</div>";
                         }
                         echo format_help_block(array('text' => 'Upload CSV files directly (using FTP or equivalent) to the <code>./admin/s_site_plugin/upload/</code> directory.'));
                     }
                 } else {
                     //if(is_not_empty_array($site_plugin_r))
                     $errors[] = array('error' => 'Site Plugin not found');
                     $HTTP_VARS['op'] = 'list_site_plugins';
                 }
             } else {
                 if ($HTTP_VARS['op'] == 'installsql') {
                     execute_sql_install($ADMIN_TYPE, $HTTP_VARS['sqlfile'], $errors);
                     $HTTP_VARS['op'] = 'list_site_plugins';
                 }
             }
         }
     }
 }
Пример #7
0
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>";
}
Пример #8
0
        $save_button = 'Update';
    } else {
        echo "\n<h3>New Status Type</h3>";
        $save_op = 'insert';
        $save_button = 'Insert';
    }
    if (is_not_empty_array($errors)) {
        echo format_error_block($errors);
    }
    echo "\n<form name=\"s_status_type\" action=\"{$PHP_SELF}\" method=\"POST\">";
    echo "\n<input type=\"hidden\" name=\"op\" value=\"{$save_op}\">";
    echo "\n<input type=\"hidden\" name=\"type\" value=\"" . $HTTP_VARS['type'] . "\">";
    echo "\n<table>";
    display_edit_form($status_type_r, $HTTP_VARS);
    echo "\n</table>";
    echo 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) {
        echo "\n<input type=\"button\" class=\"button\" value=\"{$save_button}\" onclick=\"if(!checkForm(this.form)){return false;}else{this.form.submit();}\">";
    } else {
        echo "\n<input type=\"button\" class=\"button\" value=\"{$save_button}\" onclick=\"this.form.submit();\">";
    }
    echo "\n</form>";
} else {
    if (strlen($HTTP_VARS['op']) == 0) {
        echo "<p>[<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=new\">New Status Type</a>]</p>";
        if (is_not_empty_array($errors)) {
            echo format_error_block($errors);
        }
        $results = fetch_status_type_rs();
        if ($results) {
            echo "\n<form name=\"s_status_type\" action=\"{$PHP_SELF}\" method=\"POST\">";
Пример #9
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;
}
Пример #10
0
function perform_cloneitem_process(&$item_r, &$status_type_r, &$HTTP_VARS, &$footer_links_r)
{
    global $PHP_SELF;
    if (!is_exists_item_type($HTTP_VARS['s_item_type'])) {
        do_op_title($item_r, $status_type_r, 'clone_item');
        echo '<form action="' . $PHP_SELF . '">';
        echo '<input type="hidden" name="op" value="clone_item">';
        echo '<input type="hidden" name="item_id" value="' . $item_r['item_id'] . '">';
        echo '<input type="hidden" name="instance_no" value="' . $item_r['instance_no'] . '">';
        echo '<table class="cloneItemForm">';
        echo '<tr><th class="prompt">' . get_opendb_lang_var('item_type') . '</th>' . '<td class="data">' . custom_select('s_item_type', fetch_item_type_rs(), '%s_item_type% - %description%', '1', $item_r['s_item_type'], 's_item_type', NULL, NULL, NULL, FALSE, 'clone-s_item_type') . '</td></tr>';
        echo '</table>';
        echo '<input type="submit" class="submit" value="' . get_opendb_lang_var('submit') . '">';
        echo '</form>';
        echo format_help_block(get_opendb_lang_var('clone_item_help'));
        $footer_links_r[] = array(url => "item_display.php?item_id=" . $item_r['item_id'] . "&instance_no=" . $item_r['instance_no'], text => get_opendb_lang_var('back_to_item'));
    } else {
        // at this point we need to populate $HTTP_VARS with all data corresponding to a mapping between the old and possible new item type
        $HTTP_VARS = array_merge($HTTP_VARS, copy_item_to_http_vars($item_r, $HTTP_VARS['s_item_type']));
        // insert item for item type as specified in previous dialog
        $item_r['s_item_type'] = $HTTP_VARS['s_item_type'];
        do_op_title($item_r, $status_type_r, 'clone_item');
        $item_r['title'] = NULL;
        // fix for clone reverting to source item on insert.
        $item_r['item_id'] = NULL;
        $item_r['instance_no'] = NULL;
        $errors = NULL;
        $formContents = handle_new_or_site($HTTP_VARS['op'], $item_r, $status_type_r, $HTTP_VARS, $errors);
        if ($formContents !== FALSE) {
            echo $formContents;
        } else {
            echo format_error_block($errors);
        }
    }
}
Пример #11
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'));
}