/**
 * Validates the action on the specified bug id.
 *
 * @param $p_bug_id Bug ID
 * @return string|null On failure: the reason why the action could not be validated. On success: null.
 */
function action_update_product_build_validate($p_bug_id)
{
    $t_bug_id = (int) $p_bug_id;
    if (bug_is_readonly($t_bug_id)) {
        return lang_get('actiongroup_error_issue_is_readonly');
    }
    if (!access_has_bug_level(config_get('update_bug_threshold'), $t_bug_id)) {
        return lang_get('access_denied');
    }
    return null;
}
/**
 * Validates the action on the specified bug id.
 *
 * @return string|null On failure: the reason why the action could not be validated. On success: null.
 */
function action_update_severity_validate($p_bug_id)
{
    $f_severity = gpc_get_string('severity');
    $t_update_severity_threshold = config_get('update_bug_threshold');
    $t_bug_id = $p_bug_id;
    if (bug_is_readonly($t_bug_id)) {
        return lang_get('actiongroup_error_issue_is_readonly');
    }
    if (!access_has_bug_level($t_update_severity_threshold, $t_bug_id)) {
        return lang_get('access_denied');
    }
    return null;
}
/**
 * Validates the action on the specified bug id.
 *
 * @param $p_bug_id Bug ID
 * @return true|array  Action can be applied., bug_id => reason for failure
 */
function action_update_product_build_validate($p_bug_id)
{
    $t_bug_id = (int) $p_bug_id;
    if (bug_is_readonly($t_bug_id)) {
        $t_failed_validation_ids = array();
        $t_failed_validation_ids[$t_bug_id] = lang_get('actiongroup_error_issue_is_readonly');
        return $t_failed_validation_ids;
    }
    if (!access_has_bug_level(config_get('update_bug_threshold'), $t_bug_id)) {
        $t_failed_validation_ids = array();
        $t_failed_validation_ids[$t_bug_id] = lang_get('access_denied');
        return $t_failed_validation_ids;
    }
    return true;
}
/**
 * Validates the action on the specified bug id.
 *
 * @returns true    Action can be applied.
 * @returns array( bug_id => reason for failure )
 */
function action_update_severity_validate($p_bug_id)
{
    $f_severity = gpc_get_string('severity');
    $t_failed_validation_ids = array();
    $t_update_severity_threshold = config_get('update_bug_threshold');
    $t_bug_id = $p_bug_id;
    if (bug_is_readonly($t_bug_id)) {
        $t_failed_validation_ids[$t_bug_id] = lang_get('actiongroup_error_issue_is_readonly');
        return $t_failed_validation_ids;
    }
    if (!access_has_bug_level($t_update_severity_threshold, $t_bug_id)) {
        $t_failed_validation_ids[$t_bug_id] = lang_get('access_denied');
        return $t_failed_validation_ids;
    }
    return true;
}
/**
 * Validates the action on the specified bug id.
 *
 * @returns true|array Action can be applied., ( bug_id => reason for failure )
 */
function action_add_note_validate($p_bug_id)
{
    $f_bugnote_text = gpc_get_string('bugnote_text');
    if (is_blank($f_bugnote_text)) {
        error_parameters(lang_get('bugnote'));
        trigger_error(ERROR_EMPTY_FIELD, ERROR);
    }
    $t_failed_validation_ids = array();
    $t_add_bugnote_threshold = config_get('add_bugnote_threshold');
    $t_bug_id = $p_bug_id;
    if (bug_is_readonly($t_bug_id)) {
        $t_failed_validation_ids[$t_bug_id] = lang_get('actiongroup_error_issue_is_readonly');
        return $t_failed_validation_ids;
    }
    if (!access_has_bug_level($t_add_bugnote_threshold, $t_bug_id)) {
        $t_failed_validation_ids[$t_bug_id] = lang_get('access_denied');
        return $t_failed_validation_ids;
    }
    return true;
}
 style="width:50px;">
				<input type="hidden" name="businessValueOld[<?php 
        echo $row['id'];
        ?>
]" value="<?php 
        echo $row['businessValue'];
        ?>
"/>
			</td>
			<td><?php 
        echo $row['storyPoints'];
        ?>
</td>
			<td width="20">
				<?php 
        if (!bug_is_readonly($row['id'])) {
            ?>
<a href="bug_update_page.php?bug_id=<?php 
            echo $row['id'];
            ?>
" height="16" width="16"><img src="images/update.png" alt="Detailinformation zur User Story bearbeiten" height="16" width="16"></a><?php 
        }
        ?>
			</td>
			<td><a href="view.php?id=<?php 
        echo $row['id'];
        ?>
"><?php 
        echo $row['id'];
        ?>
</a></td>
Esempio n. 7
0
require_api('helper_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('profile_api.php');
require_api('project_api.php');
require_api('relationship_api.php');
require_api('string_api.php');
require_api('utility_api.php');
require_api('version_api.php');
$f_master_bug_id = gpc_get_int('m_id', 0);
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_get($f_master_bug_id, true);
    #@@@ (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'));
Esempio n. 8
0
function print_column_edit($p_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE)
{
    if ($p_columns_target != COLUMNS_TARGET_CSV_PAGE) {
        global $t_icon_path, $t_update_bug_threshold;
        echo '<td>';
        if (!bug_is_readonly($p_row['id']) && access_has_bug_level($t_update_bug_threshold, $p_row['id'])) {
            echo '<a href="' . string_get_bug_update_url($p_row['id']) . '">';
            echo '<img border="0" width="16" height="16" src="' . $t_icon_path . 'update.png';
            echo '" alt="' . lang_get('update_bug_button') . '"';
            echo ' title="' . lang_get('update_bug_button') . '" /></a>';
        } else {
            echo '&nbsp;';
        }
        echo '</td>';
    }
}
Esempio n. 9
0
require_api('error_api.php');
require_api('event_api.php');
require_api('form_api.php');
require_api('gpc_api.php');
require_api('print_api.php');
require_api('string_api.php');
form_security_validate('bugnote_update');
$f_bugnote_id = gpc_get_int('bugnote_id');
$f_bugnote_text = gpc_get_string('bugnote_text', '');
$f_time_tracking = gpc_get_string('time_tracking', '0:00');
# Check if the current user is allowed to edit the bugnote
$t_user_id = auth_get_current_user_id();
$t_reporter_id = bugnote_get_field($f_bugnote_id, 'reporter_id');
if ($t_user_id == $t_reporter_id) {
    access_ensure_bugnote_level(config_get('bugnote_user_edit_threshold'), $f_bugnote_id);
} else {
    access_ensure_bugnote_level(config_get('update_bugnote_threshold'), $f_bugnote_id);
}
# Check if the bug is readonly
$t_bug_id = bugnote_get_field($f_bugnote_id, 'bug_id');
if (bug_is_readonly($t_bug_id)) {
    error_parameters($t_bug_id);
    trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR);
}
$f_bugnote_text = trim($f_bugnote_text) . "\n\n";
bugnote_set_text($f_bugnote_id, $f_bugnote_text);
bugnote_set_time_tracking($f_bugnote_id, $f_time_tracking);
# Plugin integration
event_signal('EVENT_BUGNOTE_EDIT', array($t_bug_id, $f_bugnote_id));
form_security_purge('bugnote_update');
print_successful_redirect(string_get_bug_view_url($t_bug_id) . '#bugnotes');
Esempio n. 10
0
 public function post($request)
 {
     /**
      * 	Creates a new bugnote.
      *
      * 	Sets the location header and returns the main URL of the created resource,
      * 	as RFC2616 says we SHOULD.
      *
      * 	@param $request - The Request we're responding to
      */
     $this->bug_id = BugnoteList::get_bug_id_from_url($request->url);
     if (!access_has_bug_level(config_get('add_bugnote_threshold'), $this->bug_id)) {
         throw new HTTPException(403, "Access denied to add bugnote");
     }
     if (bug_is_readonly($this->bug_id)) {
         throw new HTTPException(500, "Cannot add a bugnote to a read-only bug");
     }
     $new_note = new Bugnote();
     $new_note->populate_from_repr($request->body);
     $bugnote_added = bugnote_add($this->bug_id, $new_note->mantis_data['note'], '0:00', $new_note->mantis_data['view_state'] == VS_PRIVATE);
     if ($bugnote_added) {
         $bugnote_added_url = Bugnote::get_url_from_mantis_id($bugnote_added);
         $this->rsrc_data = $bugnote_added_url;
         $resp = new Response();
         $resp->headers[] = "location: {$bugnote_added_url}";
         $resp->status = 201;
         $resp->body = json_encode($bugnote_added_url);
         return $resp;
     } else {
         throw new HTTPException(500, "Couldn't create bugnote");
     }
 }
Esempio n. 11
0
/**
 * Delete the relationship with the specified target id.
 *
 * @param string  $p_username        The name of the user trying to add a note to an issue.
 * @param string  $p_password        The password of the user.
 * @param integer $p_issue_id        The id of the source issue for the relationship.
 * @param integer $p_relationship_id The id of relationship to delete.
 * @return boolean true: success, false: failure
 */
function mc_issue_relationship_delete($p_username, $p_password, $p_issue_id, $p_relationship_id)
{
    global $g_project_override;
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_login_failed();
    }
    $t_project_id = bug_get_field($p_issue_id, 'project_id');
    $g_project_override = $t_project_id;
    if (!mci_has_readwrite_access($t_user_id, $t_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    # user has access to update the bug...
    if (!access_has_bug_level(config_get('update_bug_threshold'), $p_issue_id, $t_user_id)) {
        return mci_soap_fault_access_denied($t_user_id, 'Active user does not have access level required to remove a relationship from this issue.');
    }
    # bug is not read-only...
    if (bug_is_readonly($p_issue_id)) {
        return mci_soap_fault_access_denied($t_user_id, 'Issue \'' . $p_issue_id . '\' is readonly.');
    }
    # retrieve the destination bug of the relationship
    $t_dest_issue_id = relationship_get_linked_bug_id($p_relationship_id, $p_issue_id);
    # user can access to the related bug at least as viewer, if it's exist...
    if (bug_exists($t_dest_issue_id)) {
        if (!access_has_bug_level(config_get('view_bug_threshold', null, null, $t_project_id), $t_dest_issue_id, $t_user_id)) {
            return mci_soap_fault_access_denied($t_user_id, 'The issue \'' . $t_dest_issue_id . '\' requires higher access level.');
        }
    }
    $t_bug_relationship_data = relationship_get($p_relationship_id);
    $t_rel_type = $t_bug_relationship_data->type;
    # delete relationship from the DB
    log_event(LOG_WEBSERVICE, 'deleting relationship id \'' . $p_relationship_id . '\'');
    relationship_delete($p_relationship_id);
    # update bug last updated
    bug_update_date($p_issue_id);
    bug_update_date($t_dest_issue_id);
    # set the rel_type for both bug and dest_bug based on $t_rel_type and on who is the dest bug
    if ($p_issue_id == $t_bug_relationship_data->src_bug_id) {
        $t_bug_rel_type = $t_rel_type;
        $t_dest_bug_rel_type = relationship_get_complementary_type($t_rel_type);
    } else {
        $t_bug_rel_type = relationship_get_complementary_type($t_rel_type);
        $t_dest_bug_rel_type = $t_rel_type;
    }
    # send email and update the history for the src issue
    history_log_event_special($p_issue_id, BUG_DEL_RELATIONSHIP, $t_bug_rel_type, $t_dest_issue_id);
    email_relationship_deleted($p_issue_id, $t_dest_issue_id, $t_bug_rel_type);
    if (bug_exists($t_dest_issue_id)) {
        # send email and update the history for the dest issue
        history_log_event_special($t_dest_issue_id, BUG_DEL_RELATIONSHIP, $t_dest_bug_rel_type, $p_issue_id);
        email_relationship_deleted($t_dest_issue_id, $p_issue_id, $t_dest_bug_rel_type);
    }
    return true;
}
 function bfebugnote($t_event, $t_bug_id, $t_bugnote_id, $t_bugnote_is_private)
 {
     if ($t_bugnote_is_private) {
         # WK: zwei neue CSS-Klassen für unsere zusätzlichen Links
         $t_bugnote_bfe_css = 'bugnote-bfe-private';
         $t_spacer_bfe_css = 'spacer-bfe-private';
     } else {
         # WK: zwei weitere CSS-Klassen für unsere zusätzlichen Links
         $t_bugnote_bfe_css = 'bugnote-bfe-public';
         $t_spacer_bfe_css = 'spacer-bfe-public';
     }
     # Mod WK/BFE: Diese Links sind die neue BFE-Funktion Notiz klonen. Nur ab Recht 'Projekte bearbeiten' oder ab Rolle 'Entwickler vor Ort'
     if (!bug_is_readonly($t_bug_id)) {
         if (access_has_bug_level(config_get('manage_project_threshold'), $t_bug_id) || access_has_project_level(50)) {
             $t_src = relationship_get_all_src($t_bug_id);
             $t_src_count = count($t_src);
             $t_dest = relationship_get_all_dest($t_bug_id);
             $t_dest_count = count($t_dest);
             if ($t_src_count || $t_dest_count) {
                 echo '<tr class="row-1">';
                 echo '	<td class="' . $t_bugnote_bfe_css . '" colspan="2">';
                 # Zunächst die Destination Bug IDs
                 for ($z = 0; $z < $t_src_count; $z++) {
                     $t_thisbugid = $t_src[$z]->dest_bug_id;
                     $t_thisbugsumm = bug_get_field($t_thisbugid, 'summary');
                     $t_thisprojectid = bug_get_field($t_thisbugid, 'project_id');
                     echo '<a href="view.php?id=' . $t_thisbugid . '&bugnote_id=' . $t_bugnote_id . '#bugnotes">';
                     echo "Notiz klonen in Issue ";
                     echo bug_format_id($t_thisbugid) . ': ' . $t_thisbugsumm . ' [' . project_get_field($t_thisprojectid, 'name') . ']</a><br />';
                 }
                 # und jetzt die Source Bug IDs
                 for ($z = 0; $z < $t_dest_count; $z++) {
                     $t_thisbugid = $t_dest[$z]->src_bug_id;
                     $t_thisbugsumm = bug_get_field($t_thisbugid, 'summary');
                     $t_thisprojectid = bug_get_field($t_thisbugid, 'project_id');
                     echo '<a href="view.php?id=' . $t_thisbugid . '&bugnote_id=' . $t_bugnote_id . '#bugnotes">';
                     echo "Notiz klonen in Issue ";
                     echo bug_format_id($t_thisbugid) . ': ' . $t_thisbugsumm . ' [' . project_get_field($t_thisprojectid, 'name') . ']</a><br />';
                 }
                 echo '	</td>';
                 echo '</tr>';
             }
         }
     }
     echo '<tr class="' . $t_spacer_bfe_css . '" />';
 }
Esempio n. 13
0
	return;
}

require_api( 'access_api.php' );
require_api( 'bug_api.php' );
require_api( 'collapse_api.php' );
require_api( 'config_api.php' );
require_api( 'constant_inc.php' );
require_api( 'event_api.php' );
require_api( 'form_api.php' );
require_api( 'helper_api.php' );
require_api( 'html_api.php' );
require_api( 'lang_api.php' );

?>
<?php if ( ( !bug_is_readonly( $f_bug_id ) ) &&
		( access_has_bug_level( config_get( 'add_bugnote_threshold' ), $f_bug_id ) ) ) { ?>
<?php # Bugnote Add Form BEGIN ?>
<a id="addbugnote"></a> <br />

<?php
	collapse_open( 'bugnote_add' );
?>
<form name="bugnoteadd" method="post" action="bugnote_add.php">
<?php echo form_security_field( 'bugnote_add' ) ?>
<input type="hidden" name="bug_id" value="<?php echo $f_bug_id ?>" />
<table class="width100" cellspacing="1">
<tr>
	<td class="form-title" colspan="2">
<?php
	collapse_icon( 'bugnote_add' );
Esempio n. 14
0
 public function put($request)
 {
     /**
      * 	Updates the note.
      *
      * 	Only the text and view state of the note can be altered.
      *
      *      @param $request - The request we're responding to
      */
     $this->note_id = Bugnote::get_mantis_id_from_url($request->url);
     if (!bugnote_exists($this->note_id)) {
         throw new HTTPException(404, "No such bug note: {$this->note_id}");
     }
     # Check if the current user is allowed to edit the bugnote
     # (This comes from Mantis's bugnote_update.php)
     $user_id = auth_get_current_user_id();
     $reporter_id = bugnote_get_field($this->note_id, 'reporter_id');
     $bug_id = bugnote_get_field($this->note_id, 'bug_id');
     if ($user_id != $reporter_id || OFF == config_get('bugnote_allow_user_edit_delete')) {
         if (!access_has_bugnote_level(config_get('update_bugnote_threshold'), $this->note_id)) {
             throw new HTTPException(403, "Access denied");
         }
     }
     if (bug_is_readonly($bug_id)) {
         throw new HTTPException(500, "Can't edit a note on a read-only bug");
     }
     $this->populate_from_repr($request->body);
     bugnote_set_view_state($this->note_id, !!$this->_get_rsrc_attr('private'));
     bugnote_set_text($this->note_id, $this->_get_mantis_attr('note'));
     $resp = new Response();
     $resp->status = 204;
     return $resp;
 }
Esempio n. 15
0
/**
 * Delete the relationship with the specified target id.
 *
 * @param string $p_username  The name of the user trying to add a note to an issue.
 * @param string $p_password  The password of the user.
 * @param integer $p_issue_id  The id of the source issue for the relationship
 * @param integer $p_relationship_id  The id of relationship to delete.
 * @return true: success, false: failure
 */
function mc_issue_relationship_delete($p_username, $p_password, $p_issue_id, $p_relationship_id)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return new soap_fault('Client', '', 'Access Denied');
    }
    $t_project_id = bug_get_field($p_issue_id, 'project_id');
    if (!mci_has_readwrite_access($t_user_id, $t_project_id)) {
        return new soap_fault('Client', '', 'Access Denied');
    }
    # user has access to update the bug...
    if (!access_has_bug_level(config_get('update_bug_threshold'), $p_issue_id, $t_user_id)) {
        return new soap_fault('Client', '', "Active user does not have access level required to remove a relationship from this issue.");
    }
    # bug is not read-only...
    if (bug_is_readonly($p_issue_id)) {
        return new soap_fault('Client', '', "Issue '{$p_issue_id}' is readonly.");
    }
    # retrieve the destination bug of the relationship
    $t_dest_issue_id = relationship_get_linked_bug_id($p_relationship_id, $p_issue_id);
    # user can access to the related bug at least as viewer, if it's exist...
    if (bug_exists($t_dest_issue_id)) {
        if (!access_has_bug_level(VIEWER, $t_dest_issue_id, $t_user_id)) {
            return new soap_fault('Client', '', "The issue '{$t_dest_issue_id}' requires higher access level.");
        }
    }
    $t_bug_relationship_data = relationship_get($p_relationship_id);
    $t_rel_type = $t_bug_relationship_data->type;
    # delete relationship from the DB
    relationship_delete($p_relationship_id);
    # update bug last updated (just for the src bug)
    bug_update_date($p_issue_id);
    # set the rel_type for both bug and dest_bug based on $t_rel_type and on who is the dest bug
    if ($p_issue_id == $t_bug_relationship_data->src_bug_id) {
        $t_bug_rel_type = $t_rel_type;
        $t_dest_bug_rel_type = relationship_get_complementary_type($t_rel_type);
    } else {
        $t_bug_rel_type = relationship_get_complementary_type($t_rel_type);
        $t_dest_bug_rel_type = $t_rel_type;
    }
    # send email and update the history for the src issue
    history_log_event_special($p_issue_id, BUG_DEL_RELATIONSHIP, $t_bug_rel_type, $t_dest_issue_id);
    email_relationship_deleted($p_issue_id, $t_dest_issue_id, $t_bug_rel_type);
    if (bug_exists($t_dest_issue_id)) {
        # send email and update the history for the dest issue
        history_log_event_special($t_dest_issue_id, BUG_DEL_RELATIONSHIP, $t_dest_bug_rel_type, $p_issue_id);
        email_relationship_deleted($t_dest_issue_id, $p_issue_id, $t_dest_bug_rel_type);
    }
    return true;
}
Esempio n. 16
0
function file_can_delete_bug_attachments($p_bug_id)
{
    if (bug_is_readonly($p_bug_id)) {
        return false;
    }
    $t_reported_by_me = bug_is_user_reporter($p_bug_id, auth_get_current_user_id());
    $t_can_download = access_has_bug_level(config_get('delete_attachments_threshold'), $p_bug_id);
    # @@@ Fix this to be readable
    $t_can_download = $t_can_download || $t_reported_by_me && config_get('allow_delete_own_attachments');
    return $t_can_download;
}
Esempio n. 17
0
    $project_name = project_get_field($v_project_id, 'name');
    ?>

<tr bgcolor="<?php 
    echo $status_color;
    ?>
">
	<?php 
    # -- Bug ID and details link + Pencil shortcut --
    ?>
	<td class="center" valign="top" width ="0" nowrap>
		<span class="small">
		<?php 
    print_bug_link($v_id);
    echo '<br />';
    if (!bug_is_readonly($v_id) && access_has_bug_level($t_update_bug_threshold, $v_id)) {
        echo '<a href="' . string_get_bug_update_url($v_id) . '"><img border="0" src="' . $t_icon_path . 'update.png' . '" alt="' . lang_get('update_bug_button') . '" /></a>';
    }
    if (ON == config_get('show_priority_text')) {
        print_formatted_priority_string($v_status, $v_priority);
    } else {
        print_status_icon($v_priority);
    }
    if (0 < $t_attachment_count) {
        echo '<a href="' . string_get_bug_view_url($v_id) . '#attachments">';
        echo '<img border="0" src="' . $t_icon_path . 'attachment.png' . '"';
        echo ' alt="' . lang_get('attachment_alt') . '"';
        echo ' title="' . $t_attachment_count . ' ' . lang_get('attachments') . '"';
        echo ' />';
        echo '</a>';
    }
Esempio n. 18
0
			<?php 
            print_custom_field_value($t_def, $t_id, $f_bug_id);
            ?>
		</td>
	</tr>
<?php 
        }
    }
    # custom_field_has_read_access( $t_id, $f_bug_id ) )
}
# foreach( $t_related_custom_field_ids as $t_id )
?>

<?php 
if ($f_new_status >= $t_resolved) {
    if (version_should_show_product_version($t_bug->project_id) && !bug_is_readonly($f_bug_id) && access_has_bug_level(config_get('update_bug_threshold'), $f_bug_id)) {
        ?>
<!-- Fixed in Version -->
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('fixed_in_version');
        ?>
	</td>
	<td>
		<select name="fixed_in_version">
			<?php 
        print_version_option_list($t_bug->fixed_in_version, $t_bug->project_id, VERSION_ALL);
Esempio n. 19
0
/**
 * Check if the current user can delete attachments from the specified bug.
 * @param integer $p_bug_id           A bug identifier.
 * @param integer $p_uploader_user_id An user identifier.
 * @return boolean
 */
function file_can_delete_bug_attachments($p_bug_id, $p_uploader_user_id = null)
{
    if (bug_is_readonly($p_bug_id)) {
        return false;
    }
    $t_uploaded_by_me = auth_get_current_user_id() === $p_uploader_user_id;
    $t_can_delete = access_has_bug_level(config_get('delete_attachments_threshold'), $p_bug_id);
    $t_can_delete = $t_can_delete || $t_uploaded_by_me && config_get('allow_delete_own_attachments');
    return $t_can_delete;
}
function GetRelationshipContent($p_bug_id, $p_html = false, $p_html_preview = false, $p_summary = false, $p_icons = false)
{
    $t_summary = '';
    $t_icons = '';
    $t_show_project = false;
    $t_summary_wrap_at = utf8_strlen(config_get('email_separator2')) - 10;
    $t_relationship_all = relationship_get_all($p_bug_id, $t_show_project);
    $t_relationship_all_count = count($t_relationship_all);
    if ($p_summary) {
        for ($i = 0; $i < $t_relationship_all_count; $i++) {
            $p_relationship = $t_relationship_all[$i];
            if ($p_bug_id == $p_relationship->src_bug_id) {
                # root bug is in the src side, related bug in the dest side
                $t_related_bug_id = $p_relationship->dest_bug_id;
                $t_relationship_descr = relationship_get_description_src_side($p_relationship->type);
            } else {
                # root bug is in the dest side, related bug in the src side
                $t_related_bug_id = $p_relationship->src_bug_id;
                $t_relationship_descr = relationship_get_description_dest_side($p_relationship->type);
            }
            # get the information from the related bug and prepare the link
            $t_bug = bug_get($t_related_bug_id, false);
            $t_text = trim(utf8_str_pad($t_relationship_descr, 20)) . ' ';
            if ($p_html_preview == true) {
                $t_text .= '<a href="' . string_get_bug_view_url($t_related_bug_id) . '"';
                $t_text .= ' class="rcv_tooltip"';
                //$t_text .= ' title="' . utf8_str_pad (bug_format_id ($t_related_bug_id), 8) . "\n" . string_attribute ($t_bug->summary) . '"';
                $t_text .= '>';
            }
            $t_text .= string_display_line(bug_format_id($t_related_bug_id));
            if ($p_html_preview == true) {
                $t_text .= '<span class="rcv_tooltip_box">';
                $t_text .= '<span class="rcv_tooltip_title">' . bug_format_id($t_related_bug_id) . '</span>';
                $t_text .= '<span class="rcv_tooltip_content">' . utf8_substr(string_email_links($t_bug->summary), 0, MAX_TOOLTIP_CONTENT_LENGTH);
                $t_text .= MAX_TOOLTIP_CONTENT_LENGTH < strlen($t_bug->summary) ? '...' : '';
                $t_text .= '</span>';
                $t_text .= '</span>';
                $t_text .= '</a>';
            }
            if (plugin_config_get('ShowRelationshipsControl') && !bug_is_readonly($p_bug_id) && !current_user_is_anonymous() && true == $p_html_preview) {
                // bug not read only
                if (access_has_bug_level(config_get('update_bug_threshold'), $p_bug_id)) {
                    // user has access level
                    // add a delete link
                    $t_text .= ' [';
                    $t_text .= '<a class="small" href="bug_relationship_delete.php?bug_id=' . $p_bug_id;
                    $t_text .= '&amp;rel_id=' . $p_relationship->id;
                    $t_text .= '&amp;redirect_url=view_all_bug_page.php';
                    $t_text .= htmlspecialchars(form_security_param('bug_relationship_delete'));
                    $t_text .= '">' . lang_get('delete_link') . '</a>';
                    $t_text .= ']';
                }
            }
            // $t_text = relationship_get_details ($p_bug_id, $t_relationship_all[$i], true, false, $t_show_project);
            if (false == $p_html) {
                // p_html == No
                if ($i != 0) {
                    if ($p_html_preview == true) {
                        $t_summary .= ",<br/>";
                    } else {
                        $t_summary .= ", ";
                    }
                }
                $t_summary .= $t_text;
            } else {
                // p_html == Yes
                if ($p_html_preview == true) {
                    $t_summary .= '<tr bgcolor="' . get_status_color($t_bug->status, auth_get_current_user_id(), $t_bug->project_id) . '">';
                    $t_summary .= '<td>' . $t_text . '</td>';
                    $t_summary .= '</tr>' . "\n";
                } else {
                    if ($i != 0) {
                        $t_summary .= ", ";
                    }
                    $t_summary .= $t_text;
                }
            }
        }
    }
    if (plugin_config_get('ShowRelationshipIcons') && !current_user_is_anonymous() && true == $p_html_preview) {
        $t_text = RelationshipsUtils::GetBugSmybols($p_bug_id, !is_blank($t_summary));
        if (!is_blank($t_text)) {
            if (false == $p_html) {
                // p_html == No
                $t_icons .= $t_text;
            } else {
                // p_html == Yes
                if ($p_html_preview == true) {
                    $t_icons .= '<tr><td>' . $t_text . '</td></tr>' . "\n";
                } else {
                    $t_icons .= $t_text;
                }
            }
        }
    }
    if ($p_html_preview == true) {
        $t_icons_table = '';
        $t_summary_table = '';
        if (!is_blank($t_icons)) {
            $t_icons_table = '<table border="0" width="100%" cellpadding="0" cellspacing="1">' . $t_icons . '</table>';
        }
        if (!is_blank($t_summary)) {
            $t_summary_table = '<table border="0" width="100%" cellpadding="0" cellspacing="1">' . $t_summary . '</table>';
        }
        if (!is_blank($t_icons_table) && !is_blank($t_summary_table)) {
            return '<table border="0" width="100%" cellpadding="0" cellspacing="0">' . '<tr><td valign="top" style="padding:0px;">' . $t_summary_table . '</td><td valign="top" style="padding:0px;">' . $t_icons_table . '</td></tr>' . '</table>';
        } else {
            return $t_summary_table . $t_icons_table;
        }
    } else {
        $t_result = $t_icons;
        if (!is_blank($t_icons) && !is_blank($t_summary)) {
            $t_result .= '<br/>';
        }
        $t_result .= $t_summary;
        return $t_result;
    }
}
Esempio n. 21
0
function html_buttons_view_bug_page($p_bug_id)
{
    $t_resolved = config_get('bug_resolved_status_threshold');
    $t_status = bug_get_field($p_bug_id, 'status');
    $t_readonly = bug_is_readonly($p_bug_id);
    print '<table><tr class="vcenter">';
    if (!$t_readonly) {
        # UPDATE button
        echo '<td class="center">';
        html_button_bug_update($p_bug_id);
        echo '</td>';
        # ASSIGN button
        echo '<td class="center">';
        html_button_bug_assign_to($p_bug_id);
        echo '</td>';
        # Change State button
        echo '<td class="center">';
        html_button_bug_change_status($p_bug_id);
        echo '</td>';
    }
    # MONITOR/UNMONITOR button
    echo '<td class="center">';
    if (!current_user_is_anonymous()) {
        if (user_is_monitoring_bug(auth_get_current_user_id(), $p_bug_id)) {
            html_button_bug_unmonitor($p_bug_id);
        } else {
            html_button_bug_monitor($p_bug_id);
        }
    }
    echo '</td>';
    if (!$t_readonly) {
        # CREATE CHILD button
        echo '<td class="center">';
        html_button_bug_create_child($p_bug_id);
        echo '</td>';
    }
    if ($t_resolved <= $t_status) {
        # resolved is not the same as readonly
        print '<td class="center">';
        # REOPEN button
        html_button_bug_reopen($p_bug_id);
        print '</td>';
    }
    if (!$t_readonly) {
        # MOVE button
        echo '<td class="center">';
        html_button_bug_move($p_bug_id);
        echo '</td>';
        # DELETE button
        echo '<td class="center">';
        html_button_bug_delete($p_bug_id);
        echo '</td>';
    }
    helper_call_custom_function('print_bug_view_page_custom_buttons', array($p_bug_id));
    echo '</tr></table>';
}
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
/**
 * @package MantisBT
 * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
 * @copyright Copyright (C) 2002 - 2012  MantisBT Team - mantisbt-dev@lists.sourceforge.net
 * @link http://www.mantisbt.org
 */
if (!bug_is_readonly($f_bug_id) && access_has_bug_level(config_get('add_bugnote_threshold'), $f_bug_id)) {
    # Bugnote Add Form BEGIN
    ?>
<a name="addbugnote"></a> <br />

<?php 
    collapse_open('bugnote_add');
    ?>
<form name="bugnoteadd" method="post" action="bugnote_add.php">
<?php 
    echo form_security_field('bugnote_add');
    ?>
<input type="hidden" name="bug_id" value="<?php 
    echo $f_bug_id;
    ?>
" />
require_api('config_api.php');
require_api('constant_inc.php');
require_api('current_user_api.php');
require_api('form_api.php');
require_api('helper_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('sponsorship_api.php');
require_api('utility_api.php');
#
# Determine whether the sponsorship section should be shown.
#
if (config_get('enable_sponsorship') == ON && access_has_bug_level(config_get('view_sponsorship_total_threshold'), $f_bug_id)) {
    $t_sponsorship_ids = sponsorship_get_all_ids($f_bug_id);
    $t_sponsorships_exist = count($t_sponsorship_ids) > 0;
    $t_can_sponsor = !bug_is_readonly($f_bug_id) && !current_user_is_anonymous();
    $t_show_sponsorships = $t_sponsorships_exist || $t_can_sponsor;
} else {
    $t_show_sponsorships = false;
}
#
# Sponsorship Box
#
if ($t_show_sponsorships) {
    ?>

<a id="sponsorships"></a> <br />

<?php 
    collapse_open('sponsorship');
    ?>
Esempio n. 24
0
 private function add_bug(&$p_email, $p_overwrite_project_id = FALSE)
 {
     $this->show_memory_usage('Start add bug');
     //Merge References and In-Reply-To headers into one array
     $t_references = $p_email['References'];
     $t_references[] = $p_email['In-Reply-To'];
     if ($this->_mail_add_bugnotes) {
         $t_bug_id = $this->mail_is_a_bugnote($p_email['Subject'], $t_references);
     } else {
         $t_bug_id = FALSE;
     }
     if ($t_bug_id !== FALSE && !bug_is_readonly($t_bug_id)) {
         // @TODO@ Disabled for now until we find a good solution on how to handle the reporters possible lack of access permissions
         //			access_ensure_bug_level( config_get( 'add_bugnote_threshold' ), $f_bug_id );
         $t_description = $p_email['X-Mantis-Body'];
         $t_description = $this->identify_replies($t_description);
         $t_description = $this->strip_signature($t_description);
         $t_description = $this->add_additional_info('note', $p_email, $t_description);
         $t_project_id = bug_get_field($t_bug_id, 'project_id');
         ERP_set_temporary_overwrite('project_override', $t_project_id);
         # Event integration
         # Core mantis event already exists within bugnote_add function
         $t_description = event_signal('EVENT_ERP_BUGNOTE_DATA', $t_description, $t_bug_id);
         if (bug_is_resolved($t_bug_id)) {
             # Reopen issue and add a bug note
             bug_reopen($t_bug_id, $t_description);
         } elseif (!is_blank($t_description)) {
             # Add a bug note
             bugnote_add($t_bug_id, $t_description);
         }
     } elseif ($this->_mail_add_bug_reports) {
         // @TODO@ Disabled for now until we find a good solution on how to handle the reporters possible lack of access permissions
         //			access_ensure_project_level( config_get('report_bug_threshold' ) );
         $f_master_bug_id = $t_bug_id !== FALSE && bug_is_readonly($t_bug_id) ? $t_bug_id : 0;
         $this->fix_empty_fields($p_email);
         $t_project_id = $p_overwrite_project_id === FALSE ? $this->_mailbox['project_id'] : $p_overwrite_project_id;
         ERP_set_temporary_overwrite('project_override', $t_project_id);
         $t_bug_data = new BugData();
         $t_bug_data->build = '';
         $t_bug_data->platform = '';
         $t_bug_data->os = '';
         $t_bug_data->os_build = '';
         $t_bug_data->version = '';
         $t_bug_data->profile_id = 0;
         $t_bug_data->handler_id = 0;
         $t_bug_data->view_state = (int) config_get('default_bug_view_status');
         $t_bug_data->category_id = (int) $this->_mailbox['global_category_id'];
         $t_bug_data->reproducibility = (int) config_get('default_bug_reproducibility');
         $t_bug_data->severity = (int) config_get('default_bug_severity');
         $t_bug_data->priority = (int) ($this->_mail_use_bug_priority ? $p_email['Priority'] : config_get('default_bug_priority'));
         $t_bug_data->projection = (int) config_get('default_bug_projection');
         $t_bug_data->eta = (int) config_get('default_bug_eta');
         $t_bug_data->resolution = config_get('default_bug_resolution');
         $t_bug_data->status = config_get('bug_submit_status');
         $t_bug_data->summary = $p_email['Subject'];
         $t_description = $p_email['X-Mantis-Body'];
         $t_description = $this->strip_signature($t_description);
         $t_description = $this->add_additional_info('issue', $p_email, $t_description);
         $t_bug_data->description = $t_description;
         $t_bug_data->steps_to_reproduce = config_get('default_bug_steps_to_reproduce');
         $t_bug_data->additional_information = config_get('default_bug_additional_info');
         $t_bug_data->due_date = date_get_null();
         $t_bug_data->project_id = $t_project_id;
         $t_bug_data->reporter_id = $p_email['Reporter_id'];
         // This function might do stuff that EmailReporting cannot handle. Disabled
         //helper_call_custom_function( 'issue_create_validate', array( $t_bug_data ) );
         // @TODO@ Disabled for now but possibly needed for other future features
         # Validate the custom fields before adding the bug.
         /*			$t_related_custom_field_ids = custom_field_get_linked_ids( $t_bug_data->project_id );
         			foreach( $t_related_custom_field_ids as $t_id )
         			{
         				$t_def = custom_field_get_definition( $t_id );
         
         				# Produce an error if the field is required but wasn't posted
         				if ( !gpc_isset_custom_field( $t_id, $t_def['type'] ) &&
         					( $t_def['require_report'] ||
         						$t_def['type'] == CUSTOM_FIELD_TYPE_ENUM ||
         						$t_def['type'] == CUSTOM_FIELD_TYPE_LIST ||
         						$t_def['type'] == CUSTOM_FIELD_TYPE_MULTILIST ||
         						$t_def['type'] == CUSTOM_FIELD_TYPE_RADIO ) ) {
         					error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) );
         					trigger_error( ERROR_EMPTY_FIELD, ERROR );
         				}
         				if ( !custom_field_validate( $t_id, gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], NULL ) ) )
         				{
         					error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) );
         					trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR );
         				}
         			}*/
         # Allow plugins to pre-process bug data
         $t_bug_data = event_signal('EVENT_REPORT_BUG_DATA', $t_bug_data);
         $t_bug_data = event_signal('EVENT_ERP_REPORT_BUG_DATA', $t_bug_data);
         # Create the bug
         $t_bug_id = $t_bug_data->create();
         // @TODO@ Disabled for now but possibly needed for other future features
         # Handle custom field submission
         /*			foreach( $t_related_custom_field_ids as $t_id )
         {
         				# Do not set custom field value if user has no write access.
         				if( !custom_field_has_write_access( $t_id, $t_bug_id ) )
         				{
         					continue;
         				}
         
         				$t_def = custom_field_get_definition( $t_id );
         				if( !custom_field_set_value( $t_id, $t_bug_id, gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], '' ), false ) ) {
         				{
         					error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) );
         					trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR );
         				}
         			}*/
         // Lets link a readonly already existing bug to the newly created one
         if ($f_master_bug_id > 0) {
             $f_rel_type = BUG_RELATED;
             # update master bug last updated
             bug_update_date($f_master_bug_id);
             # Add the relationship
             relationship_add($t_bug_id, $f_master_bug_id, $f_rel_type);
             # Add log line to the history (both issues)
             history_log_event_special($f_master_bug_id, BUG_ADD_RELATIONSHIP, relationship_get_complementary_type($f_rel_type), $t_bug_id);
             history_log_event_special($t_bug_id, BUG_ADD_RELATIONSHIP, $f_rel_type, $f_master_bug_id);
             # Send the email notification
             email_relationship_added($f_master_bug_id, $t_bug_id, relationship_get_complementary_type($f_rel_type));
         }
         helper_call_custom_function('issue_create_notify', array($t_bug_id));
         # Allow plugins to post-process bug data with the new bug ID
         event_signal('EVENT_REPORT_BUG', array($t_bug_data, $t_bug_id));
         email_new_bug($t_bug_id);
     } else {
         // Not allowed to add issues and not allowed / able to add notes. Need to stop processing
         $this->custom_error('Not allowed to create a new issue. Email ignored');
         return;
     }
     $this->custom_error('Reporter: ' . $p_email['Reporter_id'] . ' - ' . $p_email['From_parsed']['email'] . ' --> Issue ID: #' . $t_bug_id, FALSE);
     $this->show_memory_usage('Finished add bug');
     $this->show_memory_usage('Start processing attachments');
     # Add files
     if ($this->_allow_file_upload) {
         if (count($p_email['X-Mantis-Parts']) > 0) {
             $t_rejected_files = NULL;
             while ($t_part = array_shift($p_email['X-Mantis-Parts'])) {
                 $t_file_rejected = $this->add_file($t_bug_id, $t_part);
                 if ($t_file_rejected !== TRUE) {
                     $t_rejected_files .= $t_file_rejected;
                 }
             }
             if ($t_rejected_files !== NULL) {
                 $t_part = array('name' => 'Rejected files.txt', 'ctype' => 'text/plain', 'body' => 'List of rejected files' . "\n\n" . $t_rejected_files);
                 $t_reject_rejected_files = $this->add_file($t_bug_id, $t_part);
                 if ($t_reject_rejected_files !== TRUE) {
                     $t_part['body'] .= $t_reject_rejected_files;
                     $this->custom_error('Failed to add "' . $t_part['name'] . '" to the issue. See below for all errors.' . "\n" . $t_part['body']);
                 }
             }
         }
     }
     //Add the users in Cc and To list in mail header
     $this->add_monitors($t_bug_id, $p_email);
     //Add the message-id to the database
     $this->add_msg_id($t_bug_id, $p_email['Message-ID']);
     ERP_set_temporary_overwrite('project_override', NULL);
     $this->show_memory_usage('Finished processing attachments');
 }
/**
 * MantisBT Core API's
 */
require_once 'core.php';
require_once 'bug_api.php';
require_once 'bugnote_api.php';
form_security_validate('bugnote_add');
$f_bug_id = gpc_get_int('bug_id');
$f_private = gpc_get_bool('private');
$f_time_tracking = gpc_get_string('time_tracking', '0:00');
$f_bugnote_text = trim(gpc_get_string('bugnote_text', ''));
$t_bug = bug_get($f_bug_id, true);
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;
}
if (bug_is_readonly($f_bug_id)) {
    error_parameters($f_bug_id);
    trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR);
}
access_ensure_bug_level(config_get('add_bugnote_threshold'), $f_bug_id);
// We always set the note time to BUGNOTE, and the API will overwrite it with TIME_TRACKING
// if $f_time_tracking is not 0 and the time tracking feature is enabled.
$t_bugnote_id = bugnote_add($f_bug_id, $f_bugnote_text, $f_time_tracking, $f_private, BUGNOTE);
if (!$t_bugnote_id) {
    error_parameters(lang_get('bugnote'));
    trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
form_security_purge('bugnote_add');
print_successful_redirect_to_bug($f_bug_id);
Esempio n. 26
0
/**
 * Print all buttons for view bug pages
 * @param int $p_bug_id
 * @return null
 */
function html_buttons_view_bug_page($p_bug_id)
{
    $t_resolved = config_get('bug_resolved_status_threshold');
    $t_closed = config_get('bug_closed_status_threshold');
    $t_status = bug_get_field($p_bug_id, 'status');
    $t_readonly = bug_is_readonly($p_bug_id);
    $t_sticky = config_get('set_bug_sticky_threshold');
    $t_bug = bug_get($p_bug_id);
    echo '<table><tr class="vcenter">';
    if (!$t_readonly) {
        # UPDATE button
        echo '<td class="center">';
        html_button_bug_update($p_bug_id);
        echo '</td>';
        # ASSIGN button
        echo '<td class="center">';
        html_button_bug_assign_to($t_bug);
        echo '</td>';
    }
    # Change status button/dropdown
    if (!$t_readonly) {
        echo '<td class="center">';
        html_button_bug_change_status($t_bug);
        echo '</td>';
    }
    # MONITOR/UNMONITOR button
    if (!current_user_is_anonymous()) {
        echo '<td class="center">';
        if (user_is_monitoring_bug(auth_get_current_user_id(), $p_bug_id)) {
            html_button_bug_unmonitor($p_bug_id);
        } else {
            html_button_bug_monitor($p_bug_id);
        }
        echo '</td>';
    }
    # STICK/UNSTICK button
    if (access_has_bug_level($t_sticky, $p_bug_id)) {
        echo '<td class="center">';
        if (!bug_get_field($p_bug_id, 'sticky')) {
            html_button_bug_stick($p_bug_id);
        } else {
            html_button_bug_unstick($p_bug_id);
        }
        echo '</td>';
    }
    # CLONE button
    if (!$t_readonly) {
        echo '<td class="center">';
        html_button_bug_create_child($p_bug_id);
        echo '</td>';
    }
    # REOPEN button
    echo '<td class="center">';
    html_button_bug_reopen($t_bug);
    echo '</td>';
    # CLOSE button
    echo '<td class="center">';
    html_button_bug_close($t_bug);
    echo '</td>';
    # MOVE button
    echo '<td class="center">';
    html_button_bug_move($p_bug_id);
    echo '</td>';
    # DELETE button
    echo '<td class="center">';
    html_button_bug_delete($p_bug_id);
    echo '</td>';
    helper_call_custom_function('print_bug_view_page_custom_buttons', array($p_bug_id));
    echo '</tr></table>';
}
Esempio n. 27
0
/**
 * print HTML relationship form
 * @param integer $p_bug_id A bug identifier.
 * @return void
 */
function relationship_view_box($p_bug_id)
{
    ?>
<br/>

<?php 
    collapse_open('relationships');
    ?>
<table class="width100" cellspacing="1">
<tr class="row-2">
	<td width="15%" class="form-title" colspan="2">
		<?php 
    collapse_icon('relationships');
    echo lang_get('bug_relationships');
    if (ON == config_get('relationship_graph_enable')) {
        ?>
		<span class="small"><?php 
        print_bracket_link('bug_relationship_graph.php?bug_id=' . $p_bug_id . '&graph=relation', lang_get('relation_graph'));
        ?>
</span>
		<span class="small"><?php 
        print_bracket_link('bug_relationship_graph.php?bug_id=' . $p_bug_id . '&graph=dependency', lang_get('dependency_graph'));
        ?>
</span>
		<?php 
    }
    ?>
	</td>
</tr>
<?php 
    # bug not read-only and user authenticated
    if (!bug_is_readonly($p_bug_id)) {
        # user access level at least updater
        if (access_has_bug_level(config_get('update_bug_threshold'), $p_bug_id)) {
            ?>
<tr class="row-1">
	<th class="category"><?php 
            echo lang_get('add_new_relationship');
            ?>
</th>
	<td><?php 
            echo lang_get('this_bug');
            ?>
		<form method="post" action="bug_relationship_add.php">
		<?php 
            echo form_security_field('bug_relationship_add');
            ?>
		<input type="hidden" name="src_bug_id" value="<?php 
            echo $p_bug_id;
            ?>
" size="4" />
		<?php 
            relationship_list_box(config_get('default_bug_relationship'));
            ?>
		<input type="text" name="dest_bug_id" value="" />
		<input type="submit" name="add_relationship" class="button" value="<?php 
            echo lang_get('add_new_relationship_button');
            ?>
" />
		</form>
	</td></tr>
<?php 
        }
    }
    ?>
<tr>
	<td colspan="2"><?php 
    echo relationship_get_summary_html($p_bug_id);
    ?>
</td>
</tr>
</table>

<?php 
    collapse_closed('relationships');
    ?>
<table class="width100" cellspacing="1">
<tr>
	<td class="form-title">
		<?php 
    collapse_icon('relationships');
    echo lang_get('bug_relationships');
    ?>
	</td>
</tr>
</table>

<?php 
    collapse_end('relationships');
}
Esempio n. 28
0
$tpl_show_due_date = in_array('due_date', $t_fields) && access_has_bug_level(config_get('due_date_view_threshold'), $f_bug_id);
if ($tpl_show_due_date) {
    if (!date_is_null($tpl_bug->due_date)) {
        $tpl_bug_due_date = date(config_get('normal_date_format'), $tpl_bug->due_date);
    } else {
        $tpl_bug_due_date = '';
    }
}
$tpl_show_reporter = in_array('reporter', $t_fields);
$tpl_show_handler = in_array('handler', $t_fields) && access_has_bug_level(config_get('view_handler_threshold'), $f_bug_id);
$tpl_show_additional_information = !is_blank($tpl_bug->additional_information) && in_array('additional_info', $t_fields);
$tpl_show_steps_to_reproduce = !is_blank($tpl_bug->steps_to_reproduce) && in_array('steps_to_reproduce', $t_fields);
$tpl_show_monitor_box = !$tpl_force_readonly;
$tpl_show_relationships_box = !$tpl_force_readonly;
$tpl_show_sponsorships_box = config_get('enable_sponsorship') && access_has_bug_level(config_get('view_sponsorship_total_threshold'), $f_bug_id);
$tpl_show_upload_form = !$tpl_force_readonly && !bug_is_readonly($f_bug_id);
$tpl_show_history = $f_history;
$tpl_show_profiles = config_get('enable_profiles');
$tpl_show_platform = $tpl_show_profiles && in_array('platform', $t_fields);
$tpl_platform = $tpl_show_platform ? string_display_line($tpl_bug->platform) : '';
$tpl_show_os = $tpl_show_profiles && in_array('os', $t_fields);
$tpl_os = $tpl_show_os ? string_display_line($tpl_bug->os) : '';
$tpl_show_os_version = $tpl_show_profiles && in_array('os_version', $t_fields);
$tpl_os_version = $tpl_show_os_version ? string_display_line($tpl_bug->os_build) : '';
$tpl_show_projection = in_array('projection', $t_fields);
$tpl_projection = $tpl_show_projection ? string_display_line(get_enum_element('projection', $tpl_bug->projection)) : '';
$tpl_show_eta = in_array('eta', $t_fields);
$tpl_eta = $tpl_show_eta ? string_display_line(get_enum_element('eta', $tpl_bug->eta)) : '';
$tpl_show_attachments = in_array('attachments', $t_fields);
$tpl_can_attach_tag = $tpl_show_tags && !$tpl_force_readonly && access_has_bug_level(config_get('tag_attach_threshold'), $f_bug_id);
$tpl_show_category = in_array('category_id', $t_fields);
Esempio n. 29
0
/**
 * Print column content for column edit
 *
 * @param BugData $p_bug bug object
 * @param int $p_columns_target see COLUMNS_TARGET_* in constant_inc.php
 * @return null
 * @access public
 */
function print_column_edit($p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE)
{
    global $t_icon_path, $t_update_bug_threshold;
    echo '<td class="column-edit">';
    if (!bug_is_readonly($p_bug->id) && access_has_bug_level(config_get('update_bug_threshold'), $p_bug->id)) {
        echo '<a href="' . string_get_bug_update_url($p_bug->id) . '">';
        echo '<img width="16" height="16" src="' . $t_icon_path . 'update.png';
        echo '" alt="' . lang_get('update_bug_button') . '"';
        echo ' title="' . lang_get('update_bug_button') . '" /></a>';
    } else {
        echo '&#160;';
    }
    echo '</td>';
}
/**
 * Print all buttons for view bug pages
 * @param int $p_bug_id
 * @return null
 */
function html_buttons_view_bug_page($p_bug_id)
{
    $t_resolved = config_get('bug_resolved_status_threshold');
    $t_closed = config_get('bug_closed_status_threshold');
    $t_status = bug_get_field($p_bug_id, 'status');
    $t_readonly = bug_is_readonly($p_bug_id);
    // WK/BFE: Folgende Zeile ist eine Kopie der vorigen., LB/BFE 2015
    //	bug_is_readonly -> bug_is_readonly_BFE
    //	$t_readonly -> $t_readonly_BFE
    $t_readonly_BFE = bug_is_readonly_BFE($p_bug_id);
    $t_sticky = config_get('set_bug_sticky_threshold');
    $t_bug = bug_get($p_bug_id);
    echo '<table><tr class="vcenter">';
    // WK/BFE: Bedingund von $t_readonly auf $t_readonly_BFE geändert., LB/BFE 2015
    if (!$t_readonly_BFE) {
        # UPDATE button
        echo '<td class="center">';
        html_button_bug_update($p_bug_id);
        echo '</td>';
    }
    if (!$t_readonly) {
        # ASSIGN button
        echo '<td class="center">';
        html_button_bug_assign_to($t_bug);
        echo '</td>';
    }
    # Change status button/dropdown
    if (!$t_readonly) {
        echo '<td class="center">';
        html_button_bug_change_status($t_bug);
        echo '</td>';
    }
    # MONITOR/UNMONITOR button
    if (!current_user_is_anonymous()) {
        echo '<td class="center">';
        if (user_is_monitoring_bug(auth_get_current_user_id(), $p_bug_id)) {
            html_button_bug_unmonitor($p_bug_id);
        } else {
            html_button_bug_monitor($p_bug_id);
        }
        echo '</td>';
    }
    # STICK/UNSTICK button
    if (access_has_bug_level($t_sticky, $p_bug_id)) {
        echo '<td class="center">';
        if (!bug_get_field($p_bug_id, 'sticky')) {
            html_button_bug_stick($p_bug_id);
        } else {
            html_button_bug_unstick($p_bug_id);
        }
        echo '</td>';
    }
    # CLONE button
    if (!$t_readonly) {
        echo '<td class="center">';
        html_button_bug_create_child($p_bug_id);
        echo '</td>';
    }
    # REOPEN button
    echo '<td class="center">';
    html_button_bug_reopen($t_bug);
    echo '</td>';
    # CLOSE button
    # LB/BFE 2015 Schließen-Button entfernt: https://issuetracking.bfe.tv/view.php?id=18093
    /*
    echo '<td class="center">';
    html_button_bug_close( $t_bug );
    echo '</td>';
    */
    # MOVE button
    echo '<td class="center">';
    html_button_bug_move($p_bug_id);
    echo '</td>';
    # DELETE button
    echo '<td class="center">';
    html_button_bug_delete($p_bug_id);
    echo '</td>';
    helper_call_custom_function('print_bug_view_page_custom_buttons', array($p_bug_id));
    echo '</tr></table>';
}