コード例 #1
0
    function reportBugFormTop($p_event, $p_project_id)
    {
        # allow to change reporter_id (if access level is higher than defined)
        $t_user_id = auth_get_current_user_id();
        $t_access_level = user_get_access_level($t_user_id, $p_project_id);
        if ($t_access_level >= plugin_config_get('select_threshold')) {
            ?>
		    
			<tr <?php 
            echo helper_alternate_class();
            ?>
>
				<td class="category" width="30%">
					<?php 
            echo lang_get('reporter');
            ?>
				</td>
				<td width="70%">
					<select <?php 
            echo helper_get_tab_index();
            ?>
 name="reporter_id">
						<?php 
            print_reporter_option_list($t_user_id, $p_project_id);
            ?>
					</select>
				</td>
			</tr>
<?php 
        }
    }
コード例 #2
0
function print_info_row($p_description, $p_value)
{
    echo '<tr ' . helper_alternate_class() . '>';
    echo '<td class="category">' . $p_description . '</td>';
    echo '<td>' . $p_value . '</td>';
    echo '</tr>';
}
コード例 #3
0
 /**
  *
  */
 public function printTableRowHead()
 {
     if ($this->getMantisVersion() == '1.2.') {
         echo '<tr ' . helper_alternate_class() . '>';
     } else {
         echo '<tr>';
     }
 }
コード例 #4
0
 /**
  * When updating user preferences, allowing the user or admin to specify
  * a version control username to be associated with the account.
  * @param string Event name
  * @param int User ID
  */
 function account_update_form($p_event, $p_user_id)
 {
     if (!access_has_global_level(config_get('plugin_Source_username_threshold'))) {
         return;
     }
     $t_user = SourceUser::load($p_user_id);
     echo '<tr ', helper_alternate_class(), '><td class="category">', plugin_lang_get('vcs_username', 'Source'), '<input type="hidden" name="Source_vcs" value="1"/></td><td>', '<input name="Source_vcs_username" value="', $t_user->username, '"/></td></tr>';
 }
コード例 #5
0
    /**
     * @author Lennard Bredenkamp, BFE
     * import the data which came from TestLink via POST
     * and show data on bug report page
     */
    function data_input_from_tl()
    {
        // global $this->tts_new_ttslink_bug;
        global $tts_new_ttslink_bug;
        $tts_new_ttslink_bug = false;
        // if(!$tts_new_ttslink_bug) echo "false";
        $args = $_POST;
        if (isset($args['exec_id'], $args['tproject_id'])) {
            $tts_exec_id = gpc_get_string('exec_id');
            $tts_tproject_id = gpc_get_string('tproject_id');
            $tts_new_ttslink_bug = true;
            // echo "blubb2: ".$tts_new_ttslink_bug;
            ?>
		  
		  
		<tr <?php 
            echo helper_alternate_class();
            ?>
>
		<td class="category">
			TestTracker-Beziehung
		</td>
		<td>
			<table>
				<tr>
					<td style="padding-right: 30px">
						<b>Ausf&uuml;hrungs-ID:</b> <?php 
            echo $tts_exec_id;
            ?>
					</td>
					<td >
						<b>Testprojekt-ID:</b> <?php 
            echo $tts_tproject_id;
            ?>
					</td>
				</tr>
			</table>
			<input type="hidden" name="tts_exec_id" id="tts_exec_id" value="<?php 
            echo $tts_exec_id;
            ?>
">
			<input type="hidden" name="tts_tproject_id" id="tts_tproject_id" value="<?php 
            echo $tts_tproject_id;
            ?>
">
		</td>
		</tr>
		<?php 
        }
    }
コード例 #6
0
function get_capability_row($p_caption, $p_access_level)
{
    $t_access_levels = MantisEnum::getValues(config_get('access_levels_enum_string'));
    $t_output = '<tr ' . helper_alternate_class() . '><td>' . string_display($p_caption) . '</td>';
    foreach ($t_access_levels as $t_access_level) {
        if ($t_access_level >= (int) $p_access_level) {
            $t_value = '<img src="images/ok.gif" width="20" height="15" alt="X" title="X" />';
        } else {
            $t_value = '&#160;';
        }
        $t_output .= '<td class="center">' . $t_value . '</td>';
    }
    $t_output .= '</tr>' . "\n";
    return $t_output;
}
コード例 #7
0
function get_capability_row($p_caption, $p_access_level)
{
    $t_access_levels = explode_enum_string(config_get('access_levels_enum_string'));
    $t_output = '<tr ' . helper_alternate_class() . '><td>' . string_display($p_caption) . '</td>';
    foreach ($t_access_levels as $t_access_level) {
        $t_entry_array = explode_enum_arr($t_access_level);
        if ((int) $t_entry_array[0] >= (int) $p_access_level) {
            $t_value = '<img src="images/ok.gif" width="20" height="15" alt="X" title="X" />';
        } else {
            $t_value = '&nbsp;';
        }
        $t_output .= '<td class="center">' . $t_value . '</td>';
    }
    $t_output .= '</tr>' . "\n";
    return $t_output;
}
コード例 #8
0
    /**
     * @author Lennard Bredenkamp, BFE
     * import the data which came from TestLink via POST
     * and show data on bug report page
     */
    function data_input_from_tl()
    {
        $args = $_POST;
        if (isset($args['exec_id'], $args['tproject_id'])) {
            $tts_exec_id = filter_var(gpc_get_string('exec_id'), FILTER_SANITIZE_NUMBER_INT);
            //only allow int to prevent code injections
            $tts_tproject_id = filter_var(gpc_get_string('tproject_id'), FILTER_SANITIZE_NUMBER_INT);
            //only allow int to prevent code injections
            ?>
		  
		  
		<tr <?php 
            echo helper_alternate_class();
            ?>
>
		<td class="category">
			TestTracker-Beziehung
		</td>
		<td>
			<table>
				<tr>
					<td style="padding-right: 30px">
						<b>Ausf&uuml;hrungs-ID:</b> <?php 
            echo $tts_exec_id;
            ?>
					</td>
					<td >
						<b>Testprojekt-ID:</b> <?php 
            echo $tts_tproject_id;
            ?>
					</td>
				</tr>
			</table>
			<input type="hidden" name="tts_exec_id" id="tts_exec_id" value="<?php 
            echo $tts_exec_id;
            ?>
">
			<input type="hidden" name="tts_tproject_id" id="tts_tproject_id" value="<?php 
            echo $tts_tproject_id;
            ?>
">
		</td>
		</tr>
		<?php 
        }
    }
コード例 #9
0
    public function update_repo_form($p_repo)
    {
        $t_sf_project = isset($p_repo->info['sf_project']) ? $p_repo->info['sf_project'] : '';
        ?>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
<td class="category"><?php 
        echo lang_get('plugin_SourceSFSVN_sf_project');
        ?>
</td>
<td><input name="sf_project" maxlength="250" size="40" value="<?php 
        echo string_attribute($t_sf_project);
        ?>
"/></td>
</tr>
<?php 
        return parent::update_repo_form($p_repo);
    }
コード例 #10
0
 function display_commit_message($event, $bugid)
 {
     if (!$bugid) {
         return;
     }
     $t_fields = config_get('bug_view_page_fields');
     $t_fields = columns_filter_disabled($t_fields);
     $tpl_show_id = in_array('id', $t_fields);
     $tpl_show_description = in_array('description', $t_fields);
     $tpl_show_status = in_array('status', $t_fields);
     if ($tpl_show_id && $tpl_show_description && $tpl_show_status) {
         bug_ensure_exists($bugid);
         $bug = bug_get($bugid, true);
         access_ensure_bug_level(VIEWER, $bugid);
         $tpl_description = string_display_links($bug->summary);
         $tpl_status = get_enum_element('status', $bug->status);
         $tpl_link = config_get('path') . string_get_bug_view_url($bugid, null);
         $message = sprintf('%s - #JJ%d: %s<br/>%s', strtoupper($tpl_status), $bugid, $tpl_description, $tpl_link);
         echo '<tr ', helper_alternate_class(), '>';
         echo '<td class="category">', plugin_lang_get('commit_message'), '</td>';
         echo '<td colspan="5">' . $message . '</td>';
         echo '</tr>';
     }
 }
コード例 #11
0
                    if (-1 == $t_dependency) {
                        $t_ready = false;
                        $t_depends[] = '<span class="small dependency_dated">' . string_display_line($t_plugins[$t_plugin]->name . ' ' . $t_version) . '</span>';
                    } else {
                        $t_ready = false;
                        $t_depends[] = '<span class="small dependency_unmet">' . string_display_line($t_plugin . ' ' . $t_version) . '</span>';
                    }
                }
            }
        }
        if (0 < count($t_depends)) {
            $t_depends = implode($t_depends, '<br />');
        } else {
            $t_depends = '<span class="small dependency_met">' . lang_get('plugin_no_depends') . '</span>';
        }
        echo '<tr ', helper_alternate_class(), '>';
        echo '<td class="small center">', $t_name, '</td>';
        echo '<td class="small">', $t_description, $t_author, $t_url, '</td>';
        echo '<td class="center">', $t_depends, '</td>';
        echo '<td class="center">';
        if ($t_ready) {
            print_bracket_link('manage_plugin_install.php?name=' . $t_basename . form_security_param('manage_plugin_install'), lang_get('plugin_install'));
        }
        echo '</td></tr>';
    }
    ?>

</table>
<?php 
}
?>
コード例 #12
0
<?php
html_robots_noindex();

html_page_top( lang_get( 'report_bug_link' ) );

print_recently_visited();

?>
<br /><br />
<table align="center" class="width50" cellspacing="1">

<tr>
	<td class="form-title" >
		SVN : Log Message
	</td>
</tr>

<tr <?php echo helper_alternate_class( )?>>
	<td>
		<textarea style="width:100%;" rows="20"><?php	echo $t_generated_log;?></textarea>
	</td>
</tr>


</table>

<?php 
html_page_bottom();
コード例 #13
0
function edit_printing_prefs($p_user_id = null, $p_error_if_protected = true, $p_redirect_url = '')
{
    if (null === $p_user_id) {
        $p_user_id = auth_get_current_user_id();
    }
    $c_user_id = db_prepare_int($p_user_id);
    # protected account check
    if ($p_error_if_protected) {
        user_ensure_unprotected($p_user_id);
    }
    $t_user_print_pref_table = db_get_table('mantis_user_print_pref_table');
    if (is_blank($p_redirect_url)) {
        $p_redirect_url = 'print_all_bug_page.php';
    }
    # get the fields list
    $t_field_name_arr = get_field_names();
    $field_name_count = count($t_field_name_arr);
    # Grab the data
    $query = "SELECT print_pref\n\t\t\tFROM {$t_user_print_pref_table}\n\t\t\tWHERE user_id=" . db_param();
    $result = db_query_bound($query, array($c_user_id));
    ## OOPS, No entry in the database yet.  Lets make one
    if (0 == db_num_rows($result)) {
        # create a default array, same size than $t_field_name
        for ($i = 0; $i < $field_name_count; $i++) {
            $t_default_arr[$i] = 1;
        }
        $t_default = implode('', $t_default_arr);
        # all fields are added by default
        $query = "INSERT\n\t\t\t\tINTO {$t_user_print_pref_table}\n\t\t\t\t(user_id, print_pref)\n\t\t\t\tVALUES\n\t\t\t\t(" . db_param() . "," . db_param() . ")";
        $result = db_query_bound($query, array($c_user_id, $t_default));
        # Rerun select query
        $query = "SELECT print_pref\n\t\t\t\tFROM {$t_user_print_pref_table}\n\t\t\t\tWHERE user_id=" . db_param();
        $result = db_query_bound($query, array($c_user_id));
    }
    # putting the query result into an array with the same size as $t_fields_arr
    $row = db_fetch_array($result);
    $t_prefs = $row['print_pref'];
    # Account Preferences Form BEGIN
    $t_index_count = 0;
    ?>
<br />
<div align="center">
<form method="post" action="print_all_bug_options_update.php">
<?php 
    echo form_security_field('print_all_bug_options_update');
    ?>
<input type="hidden" name="user_id" value="<?php 
    echo $p_user_id;
    ?>
" />
<input type="hidden" name="redirect_url" value="<?php 
    echo string_attribute($p_redirect_url);
    ?>
" />
<table class="width75" cellspacing="1">
<tr>
	<td class="form-title">
		<?php 
    echo lang_get('printing_preferences_title');
    ?>
	</td>
	<td class="right">
	</td>
</tr>


<?php 
    # display the checkboxes
    for ($i = 0; $i < $field_name_count; $i++) {
        printf('<tr %s>', helper_alternate_class($i));
        ?>

	<td class="category">
		<?php 
        echo lang_get($t_field_name_arr[$i]);
        ?>
	</td>
	<td>
		<input type="checkbox" name="<?php 
        echo 'print_' . $t_field_name_arr[$i];
        ?>
"
		<?php 
        if (isset($t_prefs[$i]) && $t_prefs[$i] == 1) {
            echo 'checked="checked"';
        }
        ?>
 />
	</td>
</tr>

<?php 
    }
    ?>
<tr>
	<td>&#160;</td>
	<td>
		<input type="submit" class="button" value="<?php 
    echo lang_get('update_prefs_button');
    ?>
" />
	</td>
</tr>
</table>
</form>
</div>

<br />

<div class="border center">
	<form method="post" action="print_all_bug_options_reset.php">
	<?php 
    echo form_security_field('print_all_bug_options_reset');
    ?>
	<input type="submit" class="button" value="<?php 
    echo lang_get('reset_prefs_button');
    ?>
" />
	</form>
</div>

<?php 
}
コード例 #14
0
} else {
    $count = db_num_rows($result);
    echo '<p>Found ' . $count . ' fields to be updated.</p>';
    $t_failures = 0;
    if ($count > 0) {
        echo '<table width="80%" bgcolor="#222222" border="0" cellpadding="10" cellspacing="1">';
        # Headings
        echo '<tr bgcolor="#ffffff"><th width="10%">Bug Id</th><th width="20%">Field Value</th><th width="70%">Status</th></tr>';
    }
    for ($i = 0; $i < $count; $i++) {
        $row = db_fetch_array($result);
        extract($row, EXTR_PREFIX_ALL, 'v');
        # trace bug id back to project
        $t_project_id = bug_get_field($v_bug_id, 'project_id');
        $t_cust_value = $v_value;
        printf("\n<tr %s><td><a href=\"../view.php?id=%d\">%07d</a></td><td>%s</td><td>", helper_alternate_class(), $v_bug_id, $v_bug_id, $v_value);
        # validate field contents
        switch ($f_dest_field) {
            case 'fixed_in_version':
                $t_valid = version_get_id($t_cust_value, $t_project_id) == FALSE ? FALSE : TRUE;
                break;
            default:
                $t_valid = FALSE;
        }
        if ($t_valid) {
            # value was valid, update value
            if (!bug_set_field($v_bug_id, $f_dest_field, $t_cust_value)) {
                echo 'database update failed';
                $t_failures++;
            } else {
                echo 'applied';
コード例 #15
0
    public function update_repo_form($p_repo)
    {
        $t_gitweb_root = null;
        $t_gitweb_project = null;
        if (isset($p_repo->info['gitweb_root'])) {
            $t_gitweb_root = $p_repo->info['gitweb_root'];
        }
        if (isset($p_repo->info['gitweb_project'])) {
            $t_gitweb_project = $p_repo->info['gitweb_project'];
        }
        if (isset($p_repo->info['master_branch'])) {
            $t_master_branch = $p_repo->info['master_branch'];
        } else {
            $t_master_branch = 'master';
        }
        ?>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
<td class="category"><?php 
        echo plugin_lang_get('gitweb_root');
        ?>
</td>
<td><input name="gitweb_root" maxlength="250" size="40" value="<?php 
        echo string_attribute($t_gitweb_root);
        ?>
"/></td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
<td class="category"><?php 
        echo plugin_lang_get('gitweb_project');
        ?>
</td>
<td><input name="gitweb_project" maxlength="250" size="40" value="<?php 
        echo string_attribute($t_gitweb_project);
        ?>
"/></td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
<td class="category"><?php 
        echo plugin_lang_get('master_branch');
        ?>
</td>
<td><input name="master_branch" maxlength="250" size="40" value="<?php 
        echo string_attribute($t_master_branch);
        ?>
"/></td>
</tr>
<?php 
    }
コード例 #16
0
ファイル: error_api.php プロジェクト: amjadtbssm/website
function error_print_stack_trace()
{
    if (extension_loaded('xdebug')) {
        #check for xdebug presence
        $t_stack = xdebug_get_function_stack();
        # reverse the array in a separate line of code so the
        #  array_reverse() call doesn't appear in the stack
        $t_stack = array_reverse($t_stack);
        array_shift($t_stack);
        #remove the call to this function from the stack trace
        print '<center><table class="width75">';
        foreach ($t_stack as $t_frame) {
            print '<tr ' . helper_alternate_class() . '>';
            print '<td>' . string_html_entities($t_frame['file']) . '</td><td>' . $t_frame['line'] . '</td><td>' . (isset($t_frame['function']) ? $t_frame['function'] : '???') . '</td>';
            $t_args = array();
            if (isset($t_frame['params'])) {
                foreach ($t_frame['params'] as $t_value) {
                    $t_args[] = error_build_parameter_string($t_value);
                }
            }
            print '<td>( ' . string_html_entities(implode($t_args, ', ')) . ' )</td></tr>';
        }
        print '</table></center>';
    } else {
        $t_stack = debug_backtrace();
        array_shift($t_stack);
        #remove the call to this function from the stack trace
        array_shift($t_stack);
        #remove the call to the error handler from the stack trace
        print '<center><table class="width75">';
        print '<tr><th>Filename</th><th>Line</th><th>Function</th><th>Args</th></tr>';
        foreach ($t_stack as $t_frame) {
            print '<tr ' . helper_alternate_class() . '>';
            print '<td>' . string_html_entities($t_frame['file']) . '</td><td>' . (isset($t_frame['line']) ? $t_frame['line'] : '-') . '</td><td>' . $t_frame['function'] . '</td>';
            $t_args = array();
            if (isset($t_frame['args'])) {
                foreach ($t_frame['args'] as $t_value) {
                    $t_args[] = error_build_parameter_string($t_value);
                }
            }
            print '<td>( ' . string_html_entities(implode($t_args, ', ')) . ' )</td></tr>';
        }
        print '</table></center>';
    }
}
コード例 #17
0
function show_revision($t_revision)
{
    static $s_can_drop = null;
    static $s_drop_token = null;
    static $s_user_access = null;
    if (is_null($s_can_drop)) {
        $s_can_drop = access_has_bug_level(config_get('bug_revision_drop_threshold'), $t_revision['bug_id']);
        $s_drop_token = form_security_param('bug_revision_drop');
    }
    switch ($t_revision['type']) {
        case REV_DESCRIPTION:
            $t_label = lang_get('description');
            break;
        case REV_STEPS_TO_REPRODUCE:
            $t_label = lang_get('steps_to_reproduce');
            break;
        case REV_ADDITIONAL_INFO:
            $t_label = lang_get('additional_information');
            break;
        case REV_BUGNOTE:
            if (is_null($s_user_access)) {
                $s_user_access = access_has_bug_level(config_get('private_bugnote_threshold'), $t_revision['bug_id']);
            }
            if (!$s_user_access) {
                return null;
            }
            $t_label = lang_get('bugnote');
            break;
        default:
            $t_label = '';
    }
    $t_by_string = sprintf(lang_get('revision_by'), string_display_line(date(config_get('normal_date_format'), $t_revision['timestamp'])), string_display_line(user_get_name($t_revision['user_id'])));
    ?>
<tr class="spacer"><td><a id="revision-<?php 
    echo $t_revision['id'];
    ?>
"></a></td></tr>

<tr <?php 
    echo helper_alternate_class();
    ?>
>
<th class="category"><?php 
    echo lang_get('revision');
    ?>
</th>
<td colspan="2"><?php 
    echo $t_by_string;
    ?>
</td>
<td class="center" width="5%">
<?php 
    if ($s_can_drop) {
        print_bracket_link('bug_revision_drop.php?id=' . $t_revision['id'] . $s_drop_token, lang_get('revision_drop'));
    }
    ?>
</tr>

<tr <?php 
    echo helper_alternate_class();
    ?>
>
<th class="category"><?php 
    echo $t_label;
    ?>
</th>
<td colspan="3"><?php 
    echo string_display_links($t_revision['value']);
    ?>
</td>
</tr>

	<?php 
}
コード例 #18
0
    public function update_repo_form($p_repo)
    {
        $t_bit_basic_login = null;
        $t_bit_basic_pwd = null;
        $t_bit_username = null;
        $t_bit_reponame = null;
        if (isset($p_repo->info['bit_basic_login'])) {
            $t_bit_basic_login = $p_repo->info['bit_basic_login'];
        }
        if (isset($p_repo->info['bit_basic_pwd'])) {
            $t_bit_basic_pwd = $p_repo->info['bit_basic_pwd'];
        }
        if (isset($p_repo->info['bit_username'])) {
            $t_bit_username = $p_repo->info['bit_username'];
        }
        if (isset($p_repo->info['bit_reponame'])) {
            $t_bit_reponame = $p_repo->info['bit_reponame'];
        }
        if (isset($p_repo->info['master_branch'])) {
            $t_master_branch = $p_repo->info['master_branch'];
        } else {
            $t_master_branch = 'master';
        }
        ?>
		<tr <?php 
        echo helper_alternate_class();
        ?>
>
			<td class="category"><?php 
        echo plugin_lang_get('bit_basic_login');
        ?>
</td>
			<td><input name="bit_basic_login" maxlength="250" size="40"
					   value="<?php 
        echo string_attribute($t_bit_basic_login);
        ?>
"/></td>
		</tr>
		<tr <?php 
        echo helper_alternate_class();
        ?>
>
			<td class="category"><?php 
        echo plugin_lang_get('bit_basic_pwd');
        ?>
</td>
			<td><input type="password" name="bit_basic_pwd" maxlength="250" size="40"
					   value="<?php 
        echo string_attribute($t_bit_basic_pwd);
        ?>
"/></td>
		</tr>
		<tr <?php 
        echo helper_alternate_class();
        ?>
>
			<td class="category"><?php 
        echo plugin_lang_get('bit_username');
        ?>
</td>
			<td><input name="bit_username" maxlength="250" size="40"
					   value="<?php 
        echo string_attribute($t_bit_username);
        ?>
"/></td>
		</tr>
		<tr <?php 
        echo helper_alternate_class();
        ?>
>
			<td class="category"><?php 
        echo plugin_lang_get('bit_reponame');
        ?>
</td>
			<td><input name="bit_reponame" maxlength="250" size="40"
					   value="<?php 
        echo string_attribute($t_bit_reponame);
        ?>
"/></td>
		</tr>
		<tr>
			<td class="spacer"></td>
		</tr>
		<tr <?php 
        echo helper_alternate_class();
        ?>
>
			<td class="category"><?php 
        echo plugin_lang_get('master_branch');
        ?>
</td>
			<td><input name="master_branch" maxlength="250" size="40"
					   value="<?php 
        echo string_attribute($t_master_branch);
        ?>
"/></td>
		</tr>
	<?php 
    }
コード例 #19
0
ファイル: bug_view_inc.php プロジェクト: nextgens/mantisbt
    $t_custom_fields_found = true;
    $t_def = custom_field_get_definition($t_id);
    echo '<tr ', helper_alternate_class(), '>';
    echo '<th class="bug-custom-field category">', string_display(lang_get_defaulted($t_def['name'])), '</th>';
    echo '<td class="bug-custom-field" colspan="5">';
    print_custom_field_value($t_def, $t_id, $f_bug_id);
    echo '</td></tr>';
}
if ($t_custom_fields_found) {
    # spacer
    echo '<tr class="spacer"><td colspan="6"></td></tr>';
}
# custom fields found
# Attachments
if ($tpl_show_attachments) {
    echo '<tr id="attachments" ', helper_alternate_class(), '>';
    echo '<th class="bug-attachments category">', lang_get('attached_files'), '</th>';
    echo '<td class="bug-attachments" colspan="5">';
    print_bug_attachments_list($tpl_bug_id);
    echo '</td></tr>';
}
echo '</tbody></table>';
# User list sponsoring the bug
if ($tpl_show_sponsorships_box) {
    define('BUG_SPONSORSHIP_LIST_VIEW_INC_ALLOW', true);
    include $tpl_mantis_dir . 'bug_sponsorship_list_view_inc.php';
}
# Bug Relationships
if ($tpl_show_relationships_box) {
    relationship_view_box($tpl_bug->id);
}
コード例 #20
0
ファイル: summary_api.php プロジェクト: fur81/zofaxiopeu
function summary_print_reporter_effectiveness($p_severity_enum_string, $p_resolution_enum_string)
{
    $t_mantis_bug_table = db_get_table('mantis_bug_table');
    $t_mantis_user_table = db_get_table('mantis_user_table');
    $t_reporter_summary_limit = config_get('reporter_summary_limit');
    $t_project_id = helper_get_current_project();
    $t_user_id = auth_get_current_user_id();
    $t_severity_multipliers = config_get('severity_multipliers');
    $t_resolution_multipliers = config_get('resolution_multipliers');
    # Get the severity values to use
    $c_sev_s = MantisEnum::getValues($p_severity_enum_string);
    $enum_sev_count = count($c_sev_s);
    # Get the resolution values to use
    $c_res_s = MantisEnum::getValues($p_resolution_enum_string);
    $enum_res_count = count($c_res_s);
    # Checking if it's a per project statistic or all projects
    $specific_where = helper_project_specific_where($t_project_id);
    if (' 1<>1' == $specific_where) {
        return;
    }
    # Get all of the bugs and split them up into an array
    $query = "SELECT COUNT(id) as bugcount, reporter_id, resolution, severity\n\t\t\t\tFROM {$t_mantis_bug_table}\n\t\t\t\tWHERE {$specific_where}\n\t\t\t\tGROUP BY reporter_id, resolution, severity";
    $result = db_query_bound($query);
    $t_reporter_ressev_arr = array();
    $t_reporter_bugcount_arr = array();
    $t_arr = db_fetch_array($result);
    while ($t_arr) {
        if (!isset($t_reporter_ressev_arr[$t_arr['reporter_id']])) {
            $t_reporter_ressev_arr[$t_arr['reporter_id']] = array();
            $t_reporter_bugcount_arr[$t_arr['reporter_id']] = 0;
        }
        if (!isset($t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']])) {
            $t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']] = array();
            $t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']]['total'] = 0;
        }
        if (!isset($t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']][$t_arr['resolution']])) {
            $t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']][$t_arr['resolution']] = 0;
        }
        $t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']][$t_arr['resolution']] += $t_arr['bugcount'];
        $t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']]['total'] += $t_arr['bugcount'];
        $t_reporter_bugcount_arr[$t_arr['reporter_id']] += $t_arr['bugcount'];
        $t_arr = db_fetch_array($result);
    }
    # Sort our total bug count array so that the reporters with the highest number of bugs are listed first,
    arsort($t_reporter_bugcount_arr);
    $t_row_count = 0;
    # We now have a multi dimensional array of users, resolutions and severities, with the
    # value of each resolution and severity for each user
    foreach ($t_reporter_bugcount_arr as $t_reporter_id => $t_total_user_bugs) {
        # Limit the number of reporters listed
        if ($t_row_count > $t_reporter_summary_limit) {
            break;
        }
        # Only print reporters who have reported at least one bug. This helps
        # prevent divide by zeroes, showing reporters not on this project, and showing
        # users that aren't actually reporters...
        if ($t_total_user_bugs > 0) {
            $t_arr2 = $t_reporter_ressev_arr[$t_reporter_id];
            echo '<tr ' . helper_alternate_class($t_row_count) . '>';
            $t_row_count++;
            echo '<td>';
            echo string_display_line(user_get_name($t_reporter_id));
            echo '</td>';
            $t_total_severity = 0;
            $t_total_errors = 0;
            for ($j = 0; $j < $enum_sev_count; $j++) {
                if (!isset($t_arr2[$c_sev_s[$j]])) {
                    continue;
                }
                $sev_bug_count = $t_arr2[$c_sev_s[$j]]['total'];
                $t_sev_mult = 1;
                if ($t_severity_multipliers[$c_sev_s[$j]]) {
                    $t_sev_mult = $t_severity_multipliers[$c_sev_s[$j]];
                }
                if ($sev_bug_count > 0) {
                    $t_total_severity += $sev_bug_count * $t_sev_mult;
                }
                foreach ($t_resolution_multipliers as $t_res => $t_res_mult) {
                    if (isset($t_arr2[$c_sev_s[$j]][$t_res])) {
                        $t_total_errors += $t_sev_mult * $t_res_mult;
                    }
                }
            }
            echo '<td>';
            echo $t_total_severity;
            echo '</td>';
            echo '<td>';
            echo $t_total_errors;
            echo '</td>';
            echo '<td>';
            print $t_total_severity - $t_total_errors;
            echo '</td>';
            echo '</tr>';
        }
    }
}
コード例 #21
0
 public static function printTableRow()
 {
     if (substr(MANTIS_VERSION, 0, 4) == '1.2.') {
         echo '<tr ' . helper_alternate_class() . '>';
     } else {
         echo '<tr>';
     }
 }
コード例 #22
0
    public function update_repo_form($p_repo)
    {
        $t_url = $this->get_viewvc_url($p_repo);
        $t_name = $this->get_viewvc_name($p_repo);
        $t_use_checkout = $this->get_viewvc_use_checkout($p_repo);
        $t_root_as_url = $this->get_viewvc_root_as_url($p_repo);
        ?>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
<td class="category"><?php 
        echo lang_get('plugin_SourceViewVC_viewvc_url');
        ?>
</td>
<td><input name="viewvc_url" maxlength="250" size="40" value="<?php 
        echo string_attribute($t_url);
        ?>
"/></td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
<td class="category"><?php 
        echo lang_get('plugin_SourceViewVC_viewvc_name');
        ?>
</td>
<td><input name="viewvc_name" maxlength="250" size="40" value="<?php 
        echo string_attribute($t_name);
        ?>
"/></td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
<td class="category"><?php 
        echo lang_get('plugin_SourceViewVC_viewvc_root_as_url');
        ?>
</td>
<td><input name="viewvc_root_as_url" type="checkbox" <?php 
        echo $t_root_as_url ? 'checked="checked"' : '';
        ?>
/></td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
<td class="category"><?php 
        echo lang_get('plugin_SourceViewVC_viewvc_use_checkout');
        ?>
</td>
<td><input name="viewvc_use_checkout" type="checkbox" <?php 
        echo $t_use_checkout ? 'checked="checked"' : '';
        ?>
/></td>
</tr>
<?php 
        return parent::update_repo_form($p_repo);
    }
コード例 #23
0
ファイル: move_db2disk.php プロジェクト: rombert/mantisbt
function upgrade_move_att2disk( $p_source ) {

	# $p_source is the string "attachment" or "project"
	if( $p_source == 'attachment' ) {
		$t_file_table = db_get_table( 'bug_file' );
		$t_bug_label = "Bug";
	}
	if( $p_source == 'project' ) {
		$t_file_table = db_get_table( 'project_file' );
		$t_bug_label = "Project";
	}

	# check that the source was valid
	if( !isset( $t_file_table ) ) {
		echo 'Failure: Internal Error: File source not set';
		return;
	}

	# check that the destination is set up properly
	$t_upload_method = config_get_global( 'file_upload_method' );
	if( $t_upload_method <> DISK ) {
		echo 'Failure: Upload Method is not DISK';
		return;
	}

	$query = 'SELECT * FROM ' . $t_file_table . ' WHERE content <> \'\'';

	$result = @db_query_bound( $query );

	if( false == $result ) {
		echo '<p>No attachments need to be moved.</p>';
		return;
	}

	$count = db_num_rows( $result );
	echo '<p>Found ' . $count . ' attachments to be moved.</p>';
	$t_failures = 0;

	if( $count > 0 ) {
		echo '<table width="80%" bgcolor="#222222" cellpadding="10" cellspacing="1">';

		# Headings
		echo '<tr bgcolor="#ffffff"><th width="10%">' . $t_bug_label . '</th><th width="20%">Attachment</th><th width="70%">Status</th></tr>';
	}

	for( $i = 0;$i < $count;$i++ ) {
		$t_row = db_fetch_array( $result );

		// trace bug id back to project to determine the proper file path
		if( $p_source == 'attachment' ) {
			$t_project_id = bug_get_field( $t_row['bug_id'], 'project_id' );
			$t_bug_id = $t_row['bug_id'];
		} else {
			$t_project_id = (int) $t_row['project_id'];
			$t_bug_id = $t_project_id;
		}

		$t_file_path = project_get_field( $t_project_id, 'file_path' );
		$prefix = get_prefix( $t_file_path );
		$t_real_file_path = $prefix . $t_file_path;
		$c_filename = file_clean_name( $t_row['filename'] );

		printf( "\n<tr %s><td>%8d</td><td>%s</td><td>", helper_alternate_class(), $t_bug_id, $t_row['filename'] );

		if( is_blank( $t_real_file_path ) || !file_exists( $t_real_file_path ) || !is_dir( $t_real_file_path ) || !is_writable( $t_real_file_path ) ) {
			echo 'Destination ' . $t_real_file_path . ' not writable';
			$t_failures++;
		} else {
			$t_file_name = $t_real_file_path . $c_filename;

			// write file to disk store after adjusting the path
			if( file_put_contents( $t_file_name, $t_row['content'] ) ) {
				// successful, update database
				/** @todo do we want to check the size of data transfer matches here? */
				$c_new_file_name = $t_file_path . $c_filename;
				$query2 = "UPDATE $t_file_table SET diskfile = " . db_param() . ",
						folder = " . db_param() . ", content = '' WHERE id = " . db_param();
				$update = @db_query_bound( $query2, Array( $c_new_file_name, $t_file_path, $t_row['id'] ) );
				if( !$update ) {
					echo 'database update failed';
					$t_failures++;
				} else {
					echo 'moved to ' . $t_file_name;
				}
			} else {
				echo 'copy to ' . $t_file_name . ' failed';
				$t_failures++;
			}
		}

		echo '</td></tr>';
	}

	echo '</table><br />' . $count . ' attachments processed, ' . $t_failures . ' failures';
}
コード例 #24
0
function get_capability_row_for_email($p_caption, $p_message_type)
{
    $t_access_levels = MantisEnum::getValues(config_get('access_levels_enum_string'));
    echo '<tr ' . helper_alternate_class() . '><td>' . string_display($p_caption) . '</td>';
    echo '<td class="center"' . colour_notify_flag($p_message_type, 'reporter') . '>' . show_notify_flag($p_message_type, 'reporter') . '</td>';
    echo '<td class="center"' . colour_notify_flag($p_message_type, 'handler') . '>' . show_notify_flag($p_message_type, 'handler') . '</td>';
    echo '<td class="center"' . colour_notify_flag($p_message_type, 'monitor') . '>' . show_notify_flag($p_message_type, 'monitor') . '</td>';
    echo '<td class="center"' . colour_notify_flag($p_message_type, 'bugnotes') . '>' . show_notify_flag($p_message_type, 'bugnotes') . '</td>';
    foreach ($t_access_levels as $t_access_level) {
        echo '<td class="center"' . colour_threshold_flag($t_access_level, $p_message_type) . '>' . show_notify_threshold($t_access_level, $p_message_type) . '</td>';
    }
    echo '</tr>' . "\n";
}
コード例 #25
0
/**
 * Prints the table and form for the Attach Tags group action page.
 */
function action_attach_tags_print_fields()
{
    echo '<tr ', helper_alternate_class(), '><td class="category">', lang_get('tag_attach_long'), '</td><td>';
    print_tag_input();
    echo '<input type="submit" class="button" value="' . lang_get('tag_attach') . ' " /></td></tr>';
}
コード例 #26
0
    public function update_repo_form($p_repo)
    {
        $t_url = isset($p_repo->info['websvn_url']) ? $p_repo->info['websvn_url'] : '';
        $t_name = isset($p_repo->info['websvn_name']) ? $p_repo->info['websvn_name'] : '';
        $t_path = isset($p_repo->info['websvn_path']) ? $p_repo->info['websvn_path'] : '';
        ?>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
<td class="category"><?php 
        echo lang_get('plugin_SourceWebSVN_websvn_url');
        ?>
</td>
<td><input name="websvn_url" maxlength="250" size="40" value="<?php 
        echo string_attribute($t_url);
        ?>
"/></td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
<td class="category"><?php 
        echo lang_get('plugin_SourceWebSVN_websvn_name');
        ?>
</td>
<td><input name="websvn_name" maxlength="250" size="40" value="<?php 
        echo string_attribute($t_name);
        ?>
"/></td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
<td class="category"><?php 
        echo lang_get('plugin_SourceWebSVN_websvn_path');
        ?>
</td>
<td><input name="websvn_path" maxlength="250" size="40" value="<?php 
        echo string_attribute($t_path);
        ?>
"/></td>
</tr>
<?php 
        return parent::update_repo_form($p_repo);
    }
コード例 #27
0
function get_capability_enum($p_caption, $p_threshold, $p_enum, $p_all_projects_only = false)
{
    global $t_user, $t_project_id, $t_show_submit, $t_access_levels, $t_colour_project, $t_colour_global;
    $t_file = config_get_global($p_threshold);
    $t_global = config_get($p_threshold, null, null, ALL_PROJECTS);
    $t_project = config_get($p_threshold);
    $t_can_change = access_has_project_level(config_get_access($p_threshold), $t_project_id, $t_user) && (ALL_PROJECTS == $t_project_id || !$p_all_projects_only);
    $t_colour = '';
    if ($t_global != $t_file) {
        $t_colour = ' bgcolor="' . $t_colour_global . '" ';
        # all projects override
        if ($t_can_change) {
            set_overrides($p_threshold);
        }
    }
    if ($t_project != $t_global) {
        $t_colour = ' bgcolor="' . $t_colour_project . '" ';
        # project overrides
        if ($t_can_change) {
            set_overrides($p_threshold);
        }
    }
    echo '<tr ' . helper_alternate_class() . '><td>' . string_display($p_caption) . '</td>';
    if ($t_can_change) {
        echo '<td class="left" colspan="3"' . $t_colour . '><select name="flag_' . $p_threshold . '">';
        print_enum_string_option_list($p_enum, config_get($p_threshold));
        echo '</select></td><td colspan="' . (count($t_access_levels) - 3) . '"></td>';
        $t_show_submit = true;
    } else {
        $t_value = MantisEnum::getLabel(lang_get($p_enum . '_enum_string'), config_get($p_threshold)) . '&nbsp;';
        echo '<td class="left" colspan="3"' . $t_colour . '>' . $t_value . '</td><td colspan="' . (count($t_access_levels) - 3) . '"></td>';
    }
    if ($t_can_change) {
        echo '<td><select name="access_' . $p_threshold . '">';
        print_enum_string_option_list('access_levels', config_get_access($p_threshold));
        echo '</select> </td>';
    } else {
        echo '<td>' . MantisEnum::getLabel(lang_get('access_levels_enum_string'), config_get_access($p_threshold)) . '&nbsp;</td>';
    }
    echo '</tr>' . "\n";
}
コード例 #28
0
function access_row()
{
    global $t_access, $t_can_change_flags, $t_colour_project, $t_colour_global;
    $t_enum_status = get_enum_to_array(config_get('status_enum_string'));
    $t_file_new = config_get_global('report_bug_threshold');
    $t_global_new = config_get('report_bug_threshold', null, null, ALL_PROJECTS);
    $t_project_new = config_get('report_bug_threshold');
    $t_file_set = config_get_global('set_status_threshold');
    foreach ($t_enum_status as $t_status => $t_status_label) {
        if (!isset($t_file_set[$t_status])) {
            $t_file_set[$t_status] = config_get_global('update_bug_status_threshold');
        }
    }
    $t_global_set = config_get('set_status_threshold', null, null, ALL_PROJECTS);
    foreach ($t_enum_status as $t_status => $t_status_label) {
        if (!isset($t_file_set[$t_status])) {
            $t_file_set[$t_status] = config_get('update_bug_status_threshold', null, null, ALL_PROJECTS);
        }
    }
    $t_project_set = config_get('set_status_threshold');
    foreach ($t_enum_status as $t_status => $t_status_label) {
        if (!isset($t_file_set[$t_status])) {
            $t_file_set[$t_status] = config_get('update_bug_status_threshold');
        }
    }
    foreach ($t_enum_status as $t_status => $t_status_label) {
        echo '<tr ' . helper_alternate_class() . '><td width="30%">' . string_no_break(get_enum_to_string(lang_get('status_enum_string'), $t_status)) . '</td>';
        if (NEW_ == $t_status) {
            $t_level = $t_project_new;
            $t_can_change = $t_access >= config_get_access('report_bug_threshold');
            $t_colour = '';
            if ($t_global_new != $t_file_new) {
                $t_colour = ' bgcolor="' . $t_colour_global . '" ';
                # all projects override
                if ($t_can_change) {
                    set_overrides('report_bug_threshold');
                }
            }
            if ($t_project_new != $t_global_new) {
                $t_colour = ' bgcolor="' . $t_colour_project . '" ';
                # project overrides
                if ($t_can_change) {
                    set_overrides('report_bug_threshold');
                }
            }
        } else {
            $t_level = isset($t_project_set[$t_status]) ? $t_project_set[$t_status] : false;
            $t_level_global = isset($t_global_set[$t_status]) ? $t_global_set[$t_status] : false;
            $t_level_file = isset($t_file_set[$t_status]) ? $t_file_set[$t_status] : false;
            $t_can_change = $t_access >= config_get_access('set_status_threshold');
            $t_colour = '';
            if ($t_level_global != $t_level_file) {
                $t_colour = ' bgcolor="' . $t_colour_global . '" ';
                # all projects override
                if ($t_can_change) {
                    set_overrides('set_status_threshold');
                }
            }
            if ($t_level != $t_level_global) {
                $t_colour = ' bgcolor="' . $t_colour_project . '" ';
                # project overrides
                if ($t_can_change) {
                    set_overrides('set_status_threshold');
                }
            }
        }
        if ($t_can_change) {
            echo '<td' . $t_colour . '><select name="access_change_' . $t_status . '">';
            print_enum_string_option_list('access_levels', $t_level);
            echo '</select> </td>';
            $t_can_change_flags = true;
        } else {
            echo '<td class="center"' . $t_colour . '>' . get_enum_to_string(config_get('access_levels_enum_string'), $t_level) . '</td>';
        }
        echo '</tr>' . "\n";
    }
}
コード例 #29
0
				<?php 
        echo lang_get('actions');
        ?>
			</td>
<?php 
    }
    ?>
		</tr>
<?php 
}
foreach ($t_categories as $t_category) {
    $t_id = $t_category['id'];
    ?>
<!-- Repeated Info Row -->
		<tr <?php 
    echo helper_alternate_class();
    ?>
>
			<td>
				<?php 
    echo string_display(category_full_name($t_id, false));
    ?>
			</td>
			<td>
				<?php 
    echo prepare_user_name($t_category['user_id']);
    ?>
			</td>
<?php 
    if ($t_can_update_global_cat) {
        ?>
コード例 #30
0
/**
 * Prints a table row in the plugin config area
 */
function print_config_table_row()
{
    if (userprojectapi::is_mantis_rel()) {
        echo '<tr ' . helper_alternate_class() . '>';
    } else {
        echo '<tr>';
    }
}