All pastes #803255 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-12-01 01:01 UTC
rendered paste body
<?php
        # Mantis - a php based bugtracking system
        # Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
        # Copyright (C) 2002 - 2004  Mantis Team   - mantisbt-dev@lists.sourceforge.net
        # This program is distributed under the terms and conditions of the GPL
        # See the README and LICENSE files for details

        # --------------------------------------------------------
        # $Id: bug_report_page_css.php,v 1.00 2006/05/20 12:43:30 chillax Exp $
        # --------------------------------------------------------

        # This file POSTs data to bug_report.php

        $g_allow_browser_cache = 1;
        require_once( 'core.php' );

        $t_core_path = config_get( 'core_path' );

        require_once( $t_core_path.'file_api.php' );
        require_once( $t_core_path.'custom_field_api.php' );

        $f_master_bug_id = gpc_get_int( 'm_id', 0 );

        # this page is invalid for the 'All Project' selection except if this is a clone
        if ( ( ALL_PROJECTS == helper_get_current_project() ) && ( 0 == $f_master_bug_id ) ) {
                print_header_redirect( 'login_select_proj_page.php?ref=bug_report_page_css.php' );
        }

        if ( SIMPLE_ONLY == config_get( 'show_report' ) ) {
                $show_advanced = FALSE;
        } elseif ( ADVANCED_ONLY == config_get( 'show_report' ) ) {
                $show_advanced = TRUE;
        } else {
                if ( ( null !== auth_get_current_user_id() ) &&
                         ( ON == user_pref_get_pref( auth_get_current_user_id(), 'advanced_report' ) ) ) {
                        $show_advanced = TRUE;
                } else {
                        $show_advanced = FALSE;
                }
        }

        if ($show_advanced === TRUE)
        {
                $onload_function = 'load_advanced_report_type';
        } else {
                $onload_function = 'load_simple_report_type';
        }


        if( $f_master_bug_id > 0 ) {
                # master bug exists...
                bug_ensure_exists( $f_master_bug_id );

                # master bug is not read-only...
                if ( bug_is_readonly( $f_master_bug_id ) ) {
                        error_parameters( $f_master_bug_id );
                        trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR );
                }

                $t_bug = bug_prepare_edit( bug_get( $f_master_bug_id, true ) );

                # the user can at least update the master bug (needed to add the relationship)...
                access_ensure_bug_level( config_get( 'update_bug_threshold', null, $t_bug->project_id ), $f_master_bug_id );

                #@@@ (thraxisp) Note that the master bug is cloned into the same project as the master, independent of
                #       what the current project is set to.
                if( $t_bug->project_id != helper_get_current_project() ) {
            # in case the current project is not the same project of the bug we are viewing...
            # ... override the current project. This to avoid problems with categories and handlers lists etc.
            $g_project_override = $t_bug->project_id;
            $t_changed_project = true;
        } else {
            $t_changed_project = false;
        }

            access_ensure_project_level( config_get( 'report_bug_threshold' ) );

                $f_build                                = $t_bug->build;
                $f_platform                             = $t_bug->platform;
                $f_os                                   = $t_bug->os;
                $f_os_build                             = $t_bug->os_build;
                $f_product_version              = $t_bug->version;
                $f_profile_id                   = 0;
                $f_handler_id                   = $t_bug->handler_id;

                $f_category                             = $t_bug->category;
                $f_reproducibility              = $t_bug->reproducibility;
                $f_severity                             = $t_bug->severity;
                $f_priority                             = $t_bug->priority;
                $f_summary                              = $t_bug->summary;
                $f_description                  = $t_bug->description;
                $f_steps_to_reproduce   = $t_bug->steps_to_reproduce;
                $f_additional_info              = $t_bug->additional_information;
                $f_view_state                   = $t_bug->view_state;

                $t_project_id                   = $t_bug->project_id;
        } else {
            access_ensure_project_level( config_get( 'report_bug_threshold' ) );

                $f_build                                = gpc_get_string( 'build', '' );
                $f_platform                             = gpc_get_string( 'platform', '' );
                $f_os                                   = gpc_get_string( 'os', '' );
                $f_os_build                             = gpc_get_string( 'os_build', '' );
                $f_product_version              = gpc_get_string( 'product_version', '' );
                $f_profile_id                   = gpc_get_int( 'profile_id', 0 );
                $f_handler_id                   = gpc_get_int( 'handler_id', 0 );

                $f_category                             = gpc_get_string( 'category', config_get( 'default_bug_category' ) );
                $f_reproducibility              = gpc_get_int( 'reproducibility', '' );
                $f_severity                             = gpc_get_int( 'severity', config_get( 'default_bug_severity' ) );
                $f_priority                             = gpc_get_int( 'priority', config_get( 'default_bug_priority' ) );
                $f_summary                              = gpc_get_string( 'summary', '' );
                $f_description                  = gpc_get_string( 'description', '' );
                $f_steps_to_reproduce   = gpc_get_string( 'steps_to_reproduce', config_get( 'default_bug_steps_to_reproduce' ) );
                $f_additional_info              = gpc_get_string( 'additional_info', config_get ( 'default_bug_additional_info' ) );
                $f_view_state                   = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) );

                $t_project_id                   = helper_get_current_project();

                $t_changed_project              = false;
        }

        $f_report_stay                  = gpc_get_bool( 'report_stay', false );

        html_page_top1( lang_get( 'report_bug_link' ) );
        html_page_top2();
?>

<br />
<div align="center">
<form name="report_bug_form" method="post" <?php if ( file_allow_bug_upload() ) { echo 'enctype="multipart/form-data"'; } ?> action="bug_report.php">

<div class="report_details_container">
        <!-- Title -->
        <div class="report_title_container">
                <span class="report_title_left">
                        <input type="hidden" name="m_id" value="<?php echo $f_master_bug_id ?>" />
                        <input type="hidden" name="project_id" value="<?php echo $t_project_id ?>" />
                        <?php echo lang_get( 'enter_report_details_title' ) ?>
                </span>
                <span class="report_title_right" id="report_type">
                        <?php
                                if ( BOTH == config_get( 'show_report' ) ) {
                                        if ($show_advanced === TRUE)
                                        {
                                                PRINT '[ <a href="#" onclick="javascript:toggle_report_type(\'simple\')">' . lang_get( 'simple_report_link' ) . '</a> ]';
                                        } else {
                                                PRINT '[ <a href="#" onclick="javascript:toggle_report_type(\'advanced\')">' . lang_get( 'advanced_report_link' ) . '</a> ]';
                                        }
                                }
                        ?>
                </span>
        </div>

        <!-- Category -->
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>">
                <span class="report_row_left">
                        <?php echo lang_get( 'category' ) ?> <?php print_documentation_link( 'category' ) ?>
                </span>
                <span class="report_row_right">
                        <?php if ( $t_changed_project ) {
                                echo "[" . project_get_field( $t_bug->project_id, 'name' ) . "] ";
                        } ?>
                        <select <?php echo helper_get_tab_index() ?> name="category">
                                <?php print_category_option_list( $f_category ) ?>
                        </select>
                </span>
        </div>

        <!-- Reproducibility -->
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>">
                <span class="report_row_left">
                        <?php echo lang_get( 'reproducibility' ) ?> <?php print_documentation_link( 'reproducibility' ) ?>
                </span>
                <span class="report_row_right">
                        <select <?php echo helper_get_tab_index() ?> name="reproducibility">
                                <?php print_enum_string_option_list( 'reproducibility', $f_reproducibility ) ?>
                        </select>
                </span>
        </div>

        <!-- Severity -->
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>">
                <span class="report_row_left">
                        <?php echo lang_get( 'severity' ) ?> <?php print_documentation_link( 'severity' ) ?>
                </span>
                <span class="report_row_right">
                        <select <?php echo helper_get_tab_index() ?> name="severity">
                                <?php print_enum_string_option_list( 'severity', $f_severity ) ?>
                        </select>
                </span>
        </div>

        <!-- Priority (if permissions allow) -->
        <?php if ( access_has_project_level( config_get( 'handle_bug_threshold' ) ) ) { ?>
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>">
                <span class="report_row_left">
                        <?php echo lang_get( 'priority' ) ?> <?php print_documentation_link( 'priority' ) ?>
                </span>
                <span class="report_row_right">
                        <select <?php echo helper_get_tab_index() ?> name="priority"><?php print_enum_string_option_list( 'priority', $f_priority ) ?></select>
                </span>
        </div>
        <?php } ?>

        <!-- spacer -->
        <div class="spacer">&nbsp;</div>

        <!-- Profile -->
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>" id="profile">
                <span class="report_row_left">
                        <?php echo lang_get( 'select_profile' ) ?>
                </span>
                <span class="report_row_right">
                        <select <?php echo helper_get_tab_index() ?> name="profile_id">
                                <?php print_profile_option_list( auth_get_current_user_id(), $f_profile_id ) ?>
                        </select>
                </span>
        </div>

        <!-- instructions -->
        <div style="text-align:left;" id="instructions">
                <?php echo lang_get( 'or_fill_in' ) ?>
        </div>

        <!-- Platform -->
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>" id="platform">
                <span class="report_row_left">
                        <?php echo lang_get( 'platform' ) ?>
                </span>
                <span class="report_row_right">
                        <input <?php echo helper_get_tab_index() ?> type="text" name="platform" size="32" maxlength="32" value="<?php echo $f_platform ?>" />
                </span>
        </div>


        <!-- Operating System -->
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>" id="os">
                <span class="report_row_left">
                        <?php echo lang_get( 'os' ) ?>
                </span>
                <span class="report_row_right">
                        <input <?php echo helper_get_tab_index() ?> type="text" name="os" size="32" maxlength="32" value="<?php echo $f_os ?>" />
                </span>
        </div>

        <!-- OS Version -->
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>" id="os_version">
                <span class="report_row_left">
                        <?php echo lang_get( 'os_version' ) ?>
                </span>
                <span class="report_row_right">
                        <input <?php echo helper_get_tab_index() ?> type="text" name="os_build" size="16" maxlength="16" value="<?php echo $f_os_build ?>" />
                </span>
        </div>

        <!-- spacer -->
        <div class="spacer">&nbsp;</div>

        <?php
        $t_show_version = ( ON == config_get( 'show_product_version' ) )
                        || ( ( AUTO == config_get( 'show_product_version' ) )
                                                && ( count( version_get_all_rows( $t_project_id ) ) > 0 ) );
        if ( $t_show_version ) {
        ?>

        <!-- Product Version -->
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>">
                <span class="report_row_left">
                        <?php echo lang_get( 'product_version' ) ?>
                </span>
                <span class="report_row_right">
                        <select <?php echo helper_get_tab_index() ?> name="product_version">
                                <?php print_version_option_list( $f_product_version, $t_project_id, VERSION_RELEASED ) ?>
                        </select>
                </span>
        </div>
        <?php } ?>

        <!-- Product Build -->
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>" id="product_build">
                <span class="report_row_left">
                        <?php echo lang_get( 'product_build' ) ?>
                </span>
                <span class="report_row_right">
                        <input <?php echo helper_get_tab_index() ?> type="text" name="build" size="32" maxlength="32" value="<?php echo $f_build ?>" />
                </span>
        </div>

        <!-- Handler (if permissions allow) -->
        <?php if ( access_has_project_level( config_get( 'update_bug_assign_threshold' ) ) ) { ?>

        <!-- spacer -->
        <div class="spacer">&nbsp;</div>

        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>" id="handler">
                <span class="report_row_left">
                        <?php echo lang_get( 'assign_to' ) ?>
                </span>
                <span class="report_row_right">
                        <select <?php echo helper_get_tab_index() ?> name="handler_id">
                                <option value="0" selected="selected"></option>
                                <?php print_assign_to_option_list( $f_handler_id ) ?>
                        </select>
                </span>
        </div>
        <?php } ?>

        <!-- spacer -->
        <div class="spacer">&nbsp;</div>

        <!-- Summary -->
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>">
                <span class="report_row_left">
                        <span class="required">*</span><?php echo lang_get( 'summary' ) ?> <?php print_documentation_link( 'summary' ) ?>
                </span>
                <span class="report_row_right">
                        <input <?php echo helper_get_tab_index() ?> type="text" name="summary" size="90" maxlength="128" value="<?php echo $f_summary ?>" />
                </span>
        </div>

        <!-- Description -->
        <div class="report_row_container_large <?php echo substr(helper_alternate_class(),7,-1) ?>">
                <span class="report_row_left_large">
                        <span class="required">*</span><?php echo lang_get( 'description' ) ?> <?php print_documentation_link( 'description' ) ?>
                </span>
                <span class="report_row_right_large">
                        <textarea <?php echo helper_get_tab_index() ?> name="description" cols="60" rows="5"><?php echo $f_description ?></textarea>
                </span>
        </div>

        <!-- Steps to Reproduce -->
        <div class="report_row_container_large <?php echo substr(helper_alternate_class(),7,-1) ?>" id="reproduce">
                <span class="report_row_left_large">
                        <?php echo lang_get( 'steps_to_reproduce' ) ?> <?php print_documentation_link( 'steps_to_reproduce' ) ?>
                </span>
                <span class="report_row_right_large">
                        <textarea <?php echo helper_get_tab_index() ?> name="steps_to_reproduce" cols="60" rows="5"><?php echo $f_steps_to_reproduce ?></textarea>
                </span>
        </div>

        <!-- Additional Information -->
        <div class="report_row_container_large <?php echo substr(helper_alternate_class(),7,-1) ?>" id="additional_info">
                <span class="report_row_left_large">
                        <?php echo lang_get( 'additional_information' ) ?> <?php print_documentation_link( 'additional_information' ) ?>
                </span>
                <span class="report_row_right_large">
                        <textarea <?php echo helper_get_tab_index() ?> name="additional_info" cols="60" rows="5"><?php echo $f_additional_info ?></textarea>
                </span>
        </div>

        <!-- spacer -->
        <div class="spacer">&nbsp;</div>

        <!-- Custom Fields -->
        <?php
        $t_custom_fields_found = false;
        $t_related_custom_field_ids = custom_field_get_linked_ids( $t_project_id );

        foreach( $t_related_custom_field_ids as $t_id ) {
                $t_def = custom_field_get_definition( $t_id );
                if( ( $t_def['display_report'] || $t_def['require_report']) && custom_field_has_write_access_to_project( $t_id, $t_project_id ) ) {
                        $t_custom_fields_found = true;
        ?>
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>">
                <span class="report_row_left">
                        <?php if($t_def['require_report']) {?><span class="required">*</span><?php } ?><?php echo lang_get_defaulted( $t_def['name'] ) ?>
                </span>
                <span class="report_row_right">
                        <?php print_custom_field_input( $t_def, ( $f_master_bug_id === 0 ) ? null : $f_master_bug_id ) ?>
                </span>
        </div>
        <?php
                }
        } # foreach( $t_related_custom_field_ids as $t_id )
        ?>

        <?php if ( $t_custom_fields_found ) { ?>
        <!-- spacer -->
        <div class="spacer">&nbsp;</div>
        <?php } # custom fields found ?>

        <!-- File Upload (if enabled) -->
        <?php if ( file_allow_bug_upload() ) {
        $t_max_file_size = (int)min( ini_get_number( 'upload_max_filesize' ), ini_get_number( 'post_max_size' ), config_get( 'max_file_size' ) );
        ?>
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>">
                <span class="report_row_left">
                        <?php echo lang_get( 'upload_file' ) ?><br/>
                        <?php echo '<span class="small">(' . lang_get( 'max_file_size' ) . ': ' . number_format( $t_max_file_size/1000 ) . 'k)</span>'?>
                </span>
                <span class="report_row_right">
                        <input type="hidden" name="max_file_size" value="<?php echo $t_max_file_size ?>" />
                        <input <?php echo helper_get_tab_index() ?> name="file" type="file" size="60" />
                </span>
        </div>
        <?php } ?>

        <!-- View Status -->
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>" id="view_status">
                <span class="report_row_left">
                        <?php echo lang_get( 'view_status' ) ?>
                </span>
                <span class="report_row_right">
                        <?php if ( access_has_project_level( config_get( 'set_view_status_threshold' ) ) ) { ?>
                        <input <?php echo helper_get_tab_index() ?> type="radio" name="view_state" value="<?php echo VS_PUBLIC ?>" <?php check_checked( $f_view_state, VS_PUBLIC ) ?> id="public" /> <label for="public"><?php echo lang_get( 'public' ) ?></label>
                        <input <?php echo helper_get_tab_index() ?> type="radio" name="view_state" value="<?php echo VS_PRIVATE ?>" <?php check_checked( $f_view_state, VS_PRIVATE ) ?> id="private" /> <label for="private"><?php echo lang_get( 'private' ) ?></label>
                        <?php } else {
                                echo get_enum_element( 'project_view_state', $f_view_state );
                        }
                        ?>
                </span>
        </div>

        <!-- Relationship (in case of cloned bug creation...) -->
        <?php if( $f_master_bug_id > 0 ) { ?>
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>">
                <span class="report_row_left">
                        <?php echo lang_get( 'relationship_with_parent' ) ?>
                </span>
                <span class="report_row_right">
                        <?php relationship_list_box( BUG_BLOCKS ) ?>
                        <?php PRINT '<b>' . lang_get( 'bug' ) . ' ' . bug_format_id( $f_master_bug_id ) . '</b>' ?>
                </span>
        </div>
        <?php } ?>

        <!-- Report Stay (report more bugs) -->
        <div class="report_row_container <?php echo substr(helper_alternate_class(),7,-1) ?>" id="report_stay">
                <span class="report_row_left">
                        <?php echo lang_get( 'report_stay' ) ?> <?php print_documentation_link( 'report_stay' ) ?>
                </span>
                <span class="report_row_right">
                        <input <?php echo helper_get_tab_index() ?> type="checkbox" name="report_stay" <?php check_checked( $f_report_stay ) ?> id="report_stay" /> <label for="report_stay">(<?php echo lang_get( 'check_report_more_bugs' ) ?>)</label>
                </span>
        </div>

        <!-- Submit Button -->
        <div class="report_submit_container">
                <span class="report_submit_left">
                        <span class="required"> * <?php echo lang_get( 'required' ) ?></span>
                </span>
                <span class="report_submit_right">
                        <input <?php echo helper_get_tab_index() ?> type="submit" class="button" value="<?php echo lang_get( 'submit_report_button' ) ?>" />
                </span>
        </div>

        <div style="clear:left;line-height:0.1;height:0;">&nbsp;</div>
</div>

</form>
</div>

<!-- Autofocus JS -->
<script type="text/javascript" language="JavaScript">
<!--
        window.document.report_bug_form.category.focus();

        if (window.addEventListener)
        {
                window.addEventListener('load',<?php echo $onload_function; ?>,false);
        } else if (window.attachEvent) {
                window.attachEvent('onload',<?php echo $onload_function; ?>);
        }

        function load_simple_report_type()
        {
                toggle_report_type('simple');
        }

        function load_advanced_report_type()
        {
                toggle_report_type('advanced');
        }

        function toggle_report_type(change_to)
        {
                if (change_to == 'advanced')
                {
                        document.getElementById('report_type').innerHTML = '[ <a href="#" style="cursor:pointer;" onclick="javascript:toggle_report_type(\'simple\')"><?php echo lang_get( 'simple_report_link' ) ?></a> ]';

                        document.getElementById('instructions').style.display = 'block';
                        document.getElementById('platform').style.display = 'block';
                        document.getElementById('os').style.display = 'block';
                        document.getElementById('os_version').style.display = 'block';

                        document.getElementById('product_build').style.display = 'block';

                        document.getElementById('handler').style.display = 'block';
                        document.getElementById('additional_info').style.display = 'block';
                        document.getElementById('reproduce').style.display = 'block';

                        document.getElementById('view_status').style.display = 'block';
                        document.getElementById('report_stay').style.display = 'block';

                } else if (change_to == 'simple') {

                        document.getElementById('report_type').innerHTML = '[ <a href="#" style="cursor:pointer;" onclick="javascript:toggle_report_type(\'advanced\')"><?php echo lang_get( 'advanced_report_link' ) ?></a> ]';

                        document.getElementById('instructions').style.display = 'none';
                        document.getElementById('platform').style.display = 'none';
                        document.getElementById('os').style.display = 'none';
                        document.getElementById('os_version').style.display = 'none';

                        document.getElementById('product_build').style.display = 'none';

                        document.getElementById('handler').style.display = 'none';
                        document.getElementById('additional_info').style.display = 'none';
                        document.getElementById('reproduce').style.display = 'none';

                        document.getElementById('view_status').style.display = 'none';
                        document.getElementById('report_stay').style.display = 'none';
                }
        }
-->
</script>

<?php html_page_bottom1( __FILE__ ) ?>