Example #1
0
/**
 * 
 *
 */
function initialize_gui(&$dbHandler, &$argsObj)
{
    $req_spec_mgr = new requirement_spec_mgr($dbHandler);
    $tproject_mgr = new testproject($dbHandler);
    $commandMgr = new reqSpecCommands($dbHandler);
    $gui = $commandMgr->initGuiBean();
    $gui->req_spec_cfg = config_get('req_spec_cfg');
    $gui->req_cfg = config_get('req_cfg');
    // 20100810 - asimon - BUGID 3317: disabled total count of requirements by default
    $gui->external_req_management = $gui->req_cfg->external_req_management == ENABLED ? 1 : 0;
    $gui->grants = new stdClass();
    $gui->grants->req_mgmt = has_rights($db, "mgt_modify_req");
    $gui->req_spec = $req_spec_mgr->get_by_id($argsObj->req_spec_id);
    $gui->req_spec_id = $argsObj->req_spec_id;
    $gui->tproject_name = $argsObj->tproject_name;
    $gui->name = $gui->req_spec['title'];
    $gui->main_descr = lang_get('req_spec_short') . config_get('gui_title_separator_1') . "[{$gui->req_spec['doc_id']}] :: " . $gui->req_spec['title'];
    $gui->refresh_tree = 'no';
    $gui->cfields = $req_spec_mgr->html_table_of_custom_field_values($argsObj->req_spec_id, $argsObj->tproject_id);
    $gui->attachments = getAttachmentInfosFrom($req_spec_mgr, $argsObj->req_spec_id);
    $gui->requirements_count = $req_spec_mgr->get_requirements_count($argsObj->req_spec_id);
    $gui->reqSpecTypeDomain = init_labels($gui->req_spec_cfg->type_labels);
    /* contribution BUGID 2999, show direct link */
    $prefix = $tproject_mgr->getTestCasePrefix($argsObj->tproject_id);
    $gui->direct_link = $_SESSION['basehref'] . 'linkto.php?tprojectPrefix=' . urlencode($prefix) . '&item=reqspec&id=' . urlencode($gui->req_spec['doc_id']);
    return $gui;
}
Example #2
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 
        }
    }
function print_status_option_list_plugin($p_select_label, $p_current_value = 0, $p_allow_close = false, $p_project_id = ALL_PROJECTS)
{
    $t_current_auth = access_get_project_level($p_project_id);
    #Changement de la fonction de récupération des statuts
    $t_enum_list = get_status_option_list_plugin($t_current_auth, $p_current_value, true, $p_allow_close, $p_project_id);
    if (count($t_enum_list) > 1) {
        # resort the list into ascending order
        ksort($t_enum_list);
        reset($t_enum_list);
        echo '<select ', helper_get_tab_index(), ' name="' . $p_select_label . '">';
        foreach ($t_enum_list as $key => $val) {
            #On ne veut pas afficher la valeur @0@
            if ($val == '@0@') {
                continue;
            }
            echo '<option value="' . $key . '"';
            check_selected($key, $p_current_value, false);
            #fix 1.3.0
            echo '>' . $val . '</option>';
        }
        echo '</select>';
    } else {
        if (count($t_enum_list) == 1) {
            echo array_pop($t_enum_list);
        } else {
            echo MantisEnum::getLabel(lang_get('status_enum_string'), $p_current_value);
        }
    }
}
function getDataAndScale(&$dbHandler)
{
    $obj = new stdClass();
    $totals = null;
    $resultsCfg = config_get('results');
    $dataSet = $_SESSION['statistics']['getTopLevelSuites'];
    $mapOfAggregate = $_SESSION['statistics']['getAggregateMap'];
    $obj->canDraw = !is_null($dataSet);
    if ($obj->canDraw) {
        // Process to enable alphabetical order
        foreach ($dataSet as $tsuite) {
            $item_descr[$tsuite['name']] = $tsuite['id'];
        }
        ksort($item_descr);
        foreach ($item_descr as $name => $tsuite_id) {
            $items[] = htmlspecialchars($name);
            $rmap = $mapOfAggregate[$tsuite_id];
            unset($rmap['total']);
            foreach ($rmap as $key => $value) {
                $totals[$key][] = $value;
            }
        }
    }
    $obj->xAxis = new stdClass();
    $obj->xAxis->values = $items;
    $obj->xAxis->serieName = 'Serie8';
    $obj->series_color = null;
    foreach ($totals as $status => $values) {
        $obj->chart_data[] = $values;
        $obj->series_label[] = lang_get($resultsCfg['status_label'][$status]);
        $obj->series_color[] = $resultsCfg['charts']['status_colour'][$status];
    }
    return $obj;
}
Example #5
0
function addIssue($dbHandler, $argsObj, $itsObj)
{
    $opOK = false;
    $msg = '';
    $resultsCfg = config_get('results');
    $tcaseMgr = new testcase($dbHandler);
    $dummy = $tcaseMgr->tree_manager->get_node_hierarchy_info($argsObj->tcversion_id);
    $auditSign = $tcaseMgr->getAuditSignature((object) array('id' => $dummy['parent_id']));
    $exec = current($tcaseMgr->getExecution($argsObj->exec_id, $argsObj->tcversion_id));
    $dummy = $exec['status'];
    if (isset($resultsCfg['code_status'][$exec['status']])) {
        $dummy = $resultsCfg['code_status'][$exec['status']];
    }
    $exec['statusVerbose'] = sprintf(lang_get('issue_exec_result'), $dummy);
    unset($tcaseMgr);
    $signature = sprintf(lang_get('issue_generated_description'), $argsObj->exec_id, $exec['tester_login'], $exec['testplan_name']);
    if ($exec['platform_id'] > 0) {
        $signature .= sprintf(lang_get('issue_platform'), $exec['platform_name']);
    }
    $signature .= sprintf(lang_get('issue_build') . lang_get('execution_ts_iso'), $exec['build_name'], $exec['execution_ts']) . "\n" . $exec['statusVerbose'] . "\n\n" . $exec['execution_notes'];
    $rs = $itsObj->addIssue($auditSign . ' - ' . sprintf(lang_get('execution_ts_iso'), $exec['execution_ts']), $signature);
    if ($rs['status_ok']) {
        $msg = $rs['msg'];
        $opOK = true;
        if (write_execution_bug($dbHandler, $argsObj->exec_id, $rs['id'])) {
            logAuditEvent(TLS("audit_executionbug_added", $rs['id']), "CREATE", $argsObj->exec_id, "executions");
        }
    } else {
        $msg = $rs['msg'];
    }
    return array($opOK, $msg);
}
Example #6
0
function access_denied()
{
    if (!auth_is_user_authenticated()) {
        if (basename($_SERVER['SCRIPT_NAME']) != 'login_page.php') {
            $t_return_page = $_SERVER['PHP_SELF'];
            if (isset($_SERVER['QUERY_STRING'])) {
                $t_return_page .= '?' . $_SERVER['QUERY_STRING'];
            }
            $t_return_page = string_url(string_sanitize_url($t_return_page));
            print_header_redirect('login_page.php?return=' . $t_return_page);
        }
    } else {
        if (auth_get_current_user_id() == user_get_id_by_name(config_get_global('anonymous_account'))) {
            if (basename($_SERVER['SCRIPT_NAME']) != 'login_page.php') {
                $t_return_page = $_SERVER['PHP_SELF'];
                if (isset($_SERVER['QUERY_STRING'])) {
                    $t_return_page .= '?' . $_SERVER['QUERY_STRING'];
                }
                $t_return_page = string_url(string_sanitize_url($t_return_page));
                echo '<center>';
                echo '<p>' . error_string(ERROR_ACCESS_DENIED) . '</p>';
                print_bracket_link('login_page.php?return=' . $t_return_page, lang_get('click_to_login'));
                echo '<p></p>';
                print_bracket_link('main_page.php', lang_get('proceed'));
                echo '</center>';
            }
        } else {
            echo '<center>';
            echo '<p>' . error_string(ERROR_ACCESS_DENIED) . '</p>';
            print_bracket_link('main_page.php', lang_get('proceed'));
            echo '</center>';
        }
    }
    exit;
}
/**
 * Posts a twitter update when a bug is resolved.
 *
 * @param $p_bug_id The bug id that was resolved.
 * @access public
 */
function twitter_issue_resolved($p_bug_id)
{
    if (!twitter_enabled()) {
        return true;
    }
    $t_bug = bug_get($p_bug_id, false);
    # Do not twitter except fixed issues
    if ($t_bug->resolution < config_get('bug_resolution_fixed_threshold') || $t_bug->resolution >= config_get('bug_resolution_not_fixed_threshold')) {
        return true;
    }
    # Do not twitter private bugs.
    if ($t_bug->view_state != VS_PUBLIC) {
        return true;
    }
    # Do not twitter bugs belonging to private projects.
    if (VS_PRIVATE == project_get_field($t_bug->project_id, 'view_state')) {
        return true;
    }
    $c_bug_id = db_prepare_int($p_bug_id);
    if (is_blank($t_bug->fixed_in_version)) {
        $t_message = sprintf(lang_get('twitter_resolved_no_version'), $c_bug_id, category_full_name($t_bug->category_id, false), $t_bug->summary, user_get_name($t_bug->handler_id));
    } else {
        $t_message = sprintf(lang_get('twitter_resolved'), $c_bug_id, category_full_name($t_bug->category_id, false), $t_bug->summary, user_get_name($t_bug->handler_id), $t_bug->fixed_in_version);
    }
    return twitter_update($t_message);
}
Example #8
0
/**
 * 
 *
 */
function initialize_gui(&$dbHandler, &$argsObj)
{
    $req_spec_mgr = new requirement_spec_mgr($dbHandler);
    $tproject_mgr = new testproject($dbHandler);
    $commandMgr = new reqSpecCommands($dbHandler);
    $gui = $commandMgr->initGuiBean();
    $gui->refreshTree = $argsObj->refreshTree;
    $gui->req_spec_cfg = config_get('req_spec_cfg');
    $gui->req_cfg = config_get('req_cfg');
    $gui->external_req_management = $gui->req_cfg->external_req_management == ENABLED ? 1 : 0;
    $gui->grants = new stdClass();
    $gui->grants->req_mgmt = $argsObj->user->hasRight($dbHandler, "mgt_modify_req", $argsObj->tproject_id);
    $gui->req_spec = $req_spec_mgr->get_by_id($argsObj->req_spec_id);
    $gui->revCount = $req_spec_mgr->getRevisionsCount($argsObj->req_spec_id);
    $gui->req_spec_id = $argsObj->req_spec_id;
    $gui->parentID = $argsObj->req_spec_id;
    $gui->req_spec_revision_id = $gui->req_spec['revision_id'];
    $gui->name = $gui->req_spec['title'];
    $gui->tproject_id = $argsObj->tproject_id;
    $gui->tproject_name = $argsObj->tproject_name;
    $gui->main_descr = lang_get('req_spec_short') . config_get('gui_title_separator_1') . "[{$gui->req_spec['doc_id']}] :: " . $gui->req_spec['title'];
    $gui->refresh_tree = 'no';
    $gui->cfields = $req_spec_mgr->html_table_of_custom_field_values($argsObj->req_spec_id, $gui->req_spec_revision_id, $argsObj->tproject_id);
    $gui->attachments = $req_spec_mgr->getAttachmentInfos($argsObj->req_spec_id);
    $gui->requirements_count = $req_spec_mgr->get_requirements_count($argsObj->req_spec_id);
    $gui->reqSpecTypeDomain = init_labels($gui->req_spec_cfg->type_labels);
    $prefix = $tproject_mgr->getTestCasePrefix($argsObj->tproject_id);
    $gui->direct_link = $_SESSION['basehref'] . 'linkto.php?tprojectPrefix=' . urlencode($prefix) . '&item=reqspec&id=' . urlencode($gui->req_spec['doc_id']);
    $gui->actions = initializeActions($gui);
    return $gui;
}
/**
 * 
 *
 */
function buildTable($data, $tproject_id, $show_platforms, $priorityMgmtEnabled)
{
    $key2search = array('testsuite', 'testcase', 'platform', 'priority', 'summary');
    foreach ($key2search as $key) {
        $labels[$key] = lang_get($key);
    }
    $columns[] = array('title_key' => 'testsuite', 'width' => 20);
    $columns[] = array('title_key' => 'testcase', 'width' => 25);
    if ($show_platforms) {
        $columns[] = array('title_key' => 'platform', 'width' => 10);
    }
    if ($priorityMgmtEnabled) {
        $columns[] = array('title_key' => 'priority', 'type' => 'priority', 'width' => 5);
    }
    $columns[] = array('title_key' => 'summary', 'type' => 'text', 'width' => 40);
    $matrix = new tlExtTable($columns, $data, 'tl_table_tc_without_tester');
    $matrix->setGroupByColumnName($labels['testsuite']);
    $matrix->setSortByColumnName($labels['testcase']);
    $matrix->addCustomBehaviour('text', array('render' => 'columnWrap'));
    if ($priorityMgmtEnabled) {
        $matrix->addCustomBehaviour('priority', array('render' => 'priorityRenderer', 'filter' => 'Priority'));
        $matrix->setSortByColumnName($labels['priority']);
    }
    return $matrix;
}
Example #10
0
/**
 * Print Change Status to: AJAXified button
 * This code is similar to button_bug_change_status except that the 
 * button is AJAXified.
 * Uses projax.php
 *
 * @param int $p_bug_id
 * @param int $t_project_id
 * @param int $t_user_id
 * @return null
 */
function kanban_ajax_button_bug_change_status($p_bug_id, $t_project_id, $t_user_id)
{
    global $g_projax;
    $t_bug_project_id = bug_get_field($p_bug_id, 'project_id');
    $t_bug_current_state = bug_get_field($p_bug_id, 'status');
    $t_current_access = access_get_project_level($t_bug_project_id);
    $t_enum_list = get_status_option_list($t_current_access, $t_bug_current_state, false, bug_get_field($p_bug_id, 'reporter_id') == auth_get_current_user_id() && ON == config_get('allow_reporter_close'), $t_bug_project_id);
    if (count($t_enum_list) > 0) {
        # resort the list into ascending order after noting the key from the first element (the default)
        $t_default_arr = each($t_enum_list);
        $t_default = $t_default_arr['key'];
        ksort($t_enum_list);
        reset($t_enum_list);
        echo "<div id=\"ajax_statuschange\"><form method=\"post\" id=\"ajax_status_form\" action=\"xmlhttprequest.php\">";
        # CSRF protection not required here - form does not result in modifications
        echo "<input type=\"hidden\" name=\"project_id\" id=\"project_id\" value=\"{$t_project_id}\" />";
        echo "<input type=\"hidden\" name=\"user_id\" id=\"user_id\" value=\"{$t_user_id}\" />";
        echo "<input type=\"hidden\" name=\"entrypoint\" id=\"entrypoint\" value=\"bug_update_status\" />";
        $t_button_text = lang_get('bug_status_to_button');
        // AJAX button options
        $options = array('url' => plugin_page('kanban_ajax_request'), 'with' => true, 'confirm' => lang_get('confirm_change_status'), 'success' => 'location.reload()', 'failure' => 'alert("Error: " ' + request . status + ')');
        echo $g_projax->submit_to_remote('ajax_status', $t_button_text, $options);
        echo " <select name=\"new_status\">";
        # space at beginning of line is important
        foreach ($t_enum_list as $key => $val) {
            echo "<option value=\"{$key}\" ";
            check_selected($key, $t_default);
            echo ">{$val}</option>";
        }
        echo '</select>';
        $t_bug_id = string_attribute($p_bug_id);
        echo "<input type=\"hidden\" name=\"id\" value=\"{$t_bug_id}\" />\n";
        echo "</form></div>\n";
    }
}
function act()
{
    if (isset($_GET['filter_target'])) {
        if (!headers_sent()) {
            header('Content-Type: text/html; charset=' . lang_get('charset'));
        }
        $filter = $_GET['filter_target'];
        $t_functionName = 'print_filter_' . substr($filter, 0, -7);
        echo "<!-- {$filter} -->";
        if (function_exists($t_functionName)) {
            call_user_func($t_functionName);
        } elseif ('custom_field' == substr($filter, 0, 12)) {
            # custom function
            $t_custom_id = substr($filter, 13, -7);
            print_filter_custom_field($t_custom_id);
        } else {
            # error - no function to populate the target (e.g., print_filter_foo)
            ?>
				<span style="color:red;weight:bold;">
					unknown filter (<?php 
            echo $filter;
            ?>
)
				</span>
				<?php 
        }
    } else {
        # error - no filter given
        ?>
			<span style="color:red;weight:bold;">
				no filter selected
			</span>
			<?php 
    }
}
/**
 * 
 *
 */
function initialize_gui(&$dbHandler, $argsObj)
{
    $tproject_mgr = new testproject($dbHandler);
    $itemMgr = new requirement_spec_mgr($dbHandler);
    $commandMgr = new reqSpecCommands($dbHandler);
    $gui = $commandMgr->initGuiBean();
    $gui->itemCfg = config_get('req_spec_cfg');
    $gui->tproject_name = $argsObj->tproject_name;
    $gui->grants = new stdClass();
    $gui->grants->req_mgmt = $argsObj->hasRight($dbHandler, "mgt_modify_req", $argsObj->tproject_id);
    $gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($argsObj->tproject_id);
    $gui->glueChar = config_get('testcase_cfg')->glue_character;
    $gui->pieceSep = config_get('gui_title_separator_1');
    $gui->item_id = $argsObj->item_id;
    $info = $itemMgr->getRevisionByID($gui->item_id, array('decode_user' => true));
    $gui->item = $info;
    $gui->cfields = $itemMgr->html_table_of_custom_field_values(null, $gui->item_id, $argsObj->tproject_id);
    $gui->show_title = false;
    $gui->main_descr = lang_get('req_spec') . $gui->pieceSep . $gui->item['name'];
    $gui->showContextInfo = $argsObj->showContextInfo;
    if ($gui->showContextInfo) {
        $gui->parent_descr = lang_get('req_spec_short') . $gui->pieceSep . $gui->item['name'];
    }
    $gui->itemSpecStatus = null;
    $gui->itemTypeDomain = init_labels($gui->itemCfg->type_labels);
    return $gui;
}
/**
 * initializeGui
 *
 */
function initializeGui(&$argsObj, &$req_spec_mgr)
{
    $gui = new stdClass();
    $gui->exportTypes = $req_spec_mgr->get_export_file_types();
    $gui->exportType = $argsObj->exportType;
    $gui->scope = $argsObj->scope;
    $gui->tproject_id = $argsObj->tproject_id;
    switch ($argsObj->scope) {
        case 'tree':
            $gui->req_spec['title'] = lang_get('all_reqspecs_in_tproject');
            $gui->req_spec_id = 0;
            $exportFileName = 'all-req.xml';
            break;
        case 'branch':
            $gui->req_spec = $req_spec_mgr->get_by_id($argsObj->req_spec_id);
            $gui->req_spec_id = $argsObj->req_spec_id;
            $exportFileName = $gui->req_spec['title'] . '-req-spec.xml';
            break;
        case 'items':
            $gui->req_spec = $req_spec_mgr->get_by_id($argsObj->req_spec_id);
            $gui->req_spec_id = $argsObj->req_spec_id;
            $exportFileName = $gui->req_spec['title'] . '-child_req.xml';
            break;
    }
    $gui->export_filename = trim($argsObj->export_filename);
    if ($gui->export_filename == "") {
        $gui->export_filename = $exportFileName;
    }
    return $gui;
}
 /**
  * Returns html string to display
  * @return string
  */
 public function html()
 {
     $t_html = $this->html_start();
     $t_html .= '<div class="action">' . sprintf(lang_get('timeline_issue_created'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id)) . '</div>';
     $t_html .= $this->html_end();
     return $t_html;
 }
Example #15
0
function login_dialog()
{
    echo '
    <div class="modal fade" id="login-dialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <form id="login-dialog-form" method="post" class="form-signin" action="/actions/login">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                        <h4 class="modal-title" id="myModalLabel">', lang_get('log_in'), '</h4>
                    </div>
                    <div class="modal-body">
                            <input name="', md5(CONFIG_SITE_NAME . 'USR'), '" type="email" class="form-control" placeholder="', lang_get('email_address'), '" id="login-email-input" required autofocus />
                            <input name="', md5(CONFIG_SITE_NAME . 'PWD'), '" type="password" class="form-control" placeholder="', lang_get('password'), '" id="login-password-input" required />
                            <input type="hidden" name="action" value="login" />
                            <input type="hidden" name="redirect" value="', htmlspecialchars($_SERVER['REQUEST_URI']), '" />
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" name="remember_me" value="1" checked> ', lang_get('remember_me'), '
                                </label>
                            </div>
                            <a href="reset_password">', lang_get('forgotten_password'), '</a>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">', lang_get('close'), '</button>
                        <button type="submit" class="btn btn-primary" id="login-button">', lang_get('log_in'), '</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    ';
}
Example #16
0
/**
 * Add to email queue
 * @param EmailData $p_email_data
 * @return int
 */
function email_queue_add($p_email_data)
{
    $t_email_data = email_queue_prepare_db($p_email_data);
    # email cannot be blank
    if (is_blank($t_email_data->email)) {
        error_parameters(lang_get('email'));
        trigger_error(ERROR_EMPTY_FIELD, ERROR);
    }
    # subject cannot be blank
    if (is_blank($t_email_data->subject)) {
        error_parameters(lang_get('subject'));
        trigger_error(ERROR_EMPTY_FIELD, ERROR);
    }
    # body cannot be blank
    if (is_blank($t_email_data->body)) {
        error_parameters(lang_get('body'));
        trigger_error(ERROR_EMPTY_FIELD, ERROR);
    }
    $t_email_table = db_get_table('email');
    $c_email = $t_email_data->email;
    $c_subject = $t_email_data->subject;
    $c_body = $t_email_data->body;
    $c_metadata = serialize($t_email_data->metadata);
    $query = "INSERT INTO {$t_email_table}\n\t\t\t\t    ( email,\n\t\t\t\t      subject,\n\t\t\t\t\t  body,\n\t\t\t\t\t  submitted,\n\t\t\t\t\t  metadata)\n\t\t\t\t  VALUES\n\t\t\t\t    ( " . db_param() . ",\n\t\t\t\t      " . db_param() . ",\n\t\t\t\t      " . db_param() . ",\n\t\t\t\t\t  " . db_param() . ",\n\t\t\t\t\t  " . db_param() . "\n\t\t\t\t\t)";
    db_query_bound($query, array($c_email, $c_subject, $c_body, db_now(), $c_metadata));
    return db_insert_id($t_email_table, 'email_id');
}
/**
 * 
 *
 */
function initializeGui(&$control)
{
    $gui = new stdClass();
    // This logic is managed from execSetResults.php
    $gui->loadExecDashboard = true;
    if (isset($_SESSION['loadExecDashboard'][$control->form_token]) || $control->args->loadExecDashboard == 0) {
        $gui->loadExecDashboard = false;
        unset($_SESSION['loadExecDashboard'][$control->form_token]);
    }
    $gui->menuUrl = 'lib/execute/execSetResults.php';
    $gui->args = $control->get_argument_string();
    if ($control->args->loadExecDashboard == false) {
        $gui->src_workframe = '';
    } else {
        $gui->src_workframe = $control->args->basehref . $gui->menuUrl . "?edit=testproject&id={$control->args->testproject_id}" . $gui->args;
    }
    $control->draw_export_testplan_button = true;
    $control->draw_import_xml_results_button = true;
    $dummy = config_get('results');
    $gui->not_run = $dummy['status_code']['not_run'];
    $dummy = config_get('execution_filter_methods');
    $gui->lastest_exec_method = $dummy['status_code']['latest_execution'];
    $gui->pageTitle = lang_get('href_execute_test');
    return $gui;
}
Example #18
0
function email_queue_add($p_email_data)
{
    $t_email_data = email_queue_prepare_db($p_email_data);
    # email cannot be blank
    if (is_blank($t_email_data->email)) {
        error_parameters(lang_get('email'));
        trigger_error(ERROR_EMPTY_FIELD, ERROR);
    }
    # subject cannot be blank
    if (is_blank($t_email_data->subject)) {
        error_parameters(lang_get('subject'));
        trigger_error(ERROR_EMPTY_FIELD, ERROR);
    }
    # body cannot be blank
    if (is_blank($t_email_data->body)) {
        error_parameters(lang_get('body'));
        trigger_error(ERROR_EMPTY_FIELD, ERROR);
    }
    $t_email_table = config_get('mantis_email_table');
    $c_email = $t_email_data->email;
    $c_subject = $t_email_data->subject;
    $c_body = $t_email_data->body;
    $c_metadata = serialize($t_email_data->metadata);
    $query = "INSERT INTO {$t_email_table}\r\n\t\t\t\t    ( email,\r\n\t\t\t\t      subject,\r\n\t\t\t\t\t  body,\r\n\t\t\t\t\t  submitted,\r\n\t\t\t\t\t  metadata)\r\n\t\t\t\t  VALUES\r\n\t\t\t\t    ( '{$c_email}',\r\n\t\t\t\t      '{$c_subject}',\r\n\t\t\t\t      '{$c_body}',\r\n\t\t\t\t\t  " . db_now() . ",\r\n\t\t\t\t\t  '{$c_metadata}'\r\n\t\t\t\t\t)";
    db_query($query);
    return db_insert_id($t_email_table);
}
 /** 
  * Function returns array with input for reports navigator
  * 
  * @param object $context
  * @param boolean $bug_interface_enabled
  * @param boolean $req_mgmt_enabled
  * @param integer $format format identifier
  * 
  * @return array of array - described for array $g_reports_list in const.inc.php
  **/
 public function get_list_reports($context, $bug_interface_enabled, $req_mgmt_enabled, $format)
 {
     $reportList = config_get('reports_list');
     $items = array();
     $toggleMsg = lang_get('show_hide_direct_link');
     $canNotCreateDirectLink = lang_get('can_not_create_direct_link');
     $apiKeyLen = strlen(trim($context->apikey));
     $apiKeyIsValid = $apiKeyLen == 32 || $apiKeyLen == 64;
     // I'm sorry for MAGIC
     $xdx = 0;
     foreach ($reportList as &$reportItem) {
         // check validity of report
         if ($reportItem['enabled'] == 'all' || $reportItem['enabled'] == 'req' && $req_mgmt_enabled || $reportItem['enabled'] == 'bts' && $bug_interface_enabled) {
             if (strpos("," . $reportItem['format'], $format) > 0) {
                 $reportUrl = $reportItem['url'] . (stristr($reportItem['url'], "?") ? '&' : '?');
                 $items[$xdx] = array('name' => lang_get($reportItem['title']), 'href' => $reportUrl, 'directLink' => '');
                 if (isset($reportItem['directLink']) && trim($reportItem['directLink']) != '') {
                     if ($apiKeyIsValid) {
                         $items[$xdx]['directLink'] = sprintf($reportItem['directLink'], $_SESSION['basehref'], $context->apikey, $context->tproject_id, $context->tplan_id);
                     } else {
                         $items[$xdx]['directLink'] = $canNotCreateDirectLink;
                     }
                 }
                 $dl = $items[$xdx]['directLink'];
                 $mask = '<img class="clickable" title="%s" alt="%s" ' . ' onclick="showHideByClass(' . "'div','%s');event.stopPropagation();" . '" ' . ' src="' . $context->imgSet['link_to_report'] . '" align="center" />';
                 $divClass = 'direct_link_' . $xdx;
                 $items[$xdx]['toggle'] = sprintf($mask, $toggleMsg, $toggleMsg, $divClass);
                 $items[$xdx]['directLinkDiv'] = '<div class="' . $divClass . '" ' . "style='display:none;border:1px solid;background-color:white;'>" . '<a href="' . $dl . '" target="_blank">' . $dl . '</a><br></div>';
                 $xdx++;
             }
         }
     }
     return $items;
 }
/**
 * 
 */
function initializeGui(&$dbHandler, $args)
{
    $locale = isset($_SESSION['locale']) ? $_SESSION['locale'] : 'en_GB';
    $localesDateFormat = config_get('locales_date_format');
    $date_format = $localesDateFormat[$locale];
    $gui = new stdClass();
    $tplan_mgr = new testplan($dbHandler);
    $tproject_mgr = new testproject($dbHandler);
    $gui_open = config_get('gui_separator_open');
    $gui_close = config_get('gui_separator_close');
    $gui->str_option_any = $gui_open . lang_get('any') . $gui_close;
    $gui->str_option_none = $gui_open . lang_get('nobody') . $gui_close;
    $gui->tplan_id = $args->tplan_id;
    $gui->tproject_id = $args->tproject_id;
    $tplan_info = $tplan_mgr->get_by_id($gui->tplan_id);
    unset($tplan_mgr);
    $gui->tplan_name = $tplan_info['name'];
    $tproject_info = $tproject_mgr->get_by_id($gui->tproject_id);
    unset($tproject_mgr);
    $gui->tproject_name = $tproject_info['name'];
    $gui->users = new stdClass();
    $gui->users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, array(TL_USER_ANYBODY => $gui->str_option_any));
    $gui->users->qty = count($gui->users->items);
    $reports_cfg = config_get('reportsCfg');
    $startDate = strftime($date_format, time() - $reports_cfg->start_date_offset);
    $gui->selected_start_date = $startDate;
    $gui->selected_start_time = $reports_cfg->start_time;
    $gui->selected_end_date = strftime($date_format, time());
    $gui->selected_end_time = null;
    return $gui;
}
/**
 * Print the list of selected issues and the legend for the status colors.
 *
 * @param $p_bug_ids_array   An array of issue ids.
 */
function bug_group_action_print_bug_list($p_bug_ids_array)
{
    $t_legend_position = config_get('status_legend_position');
    if (STATUS_LEGEND_POSITION_TOP == $t_legend_position) {
        html_status_legend();
        echo '<br />';
    }
    echo '<div align="center">';
    echo '<table class="width75" cellspacing="1">';
    echo '<tr class="row-1">';
    echo '<td class="category" colspan="2">';
    echo lang_get('actiongroup_bugs');
    echo '</td>';
    echo '</tr>';
    $t_i = 1;
    foreach ($p_bug_ids_array as $t_bug_id) {
        $t_class = sprintf("row-%d", $t_i++ % 2 + 1);
        echo sprintf("<tr bgcolor=\"%s\"> <td>%s</td> <td>%s</td> </tr>\n", get_status_color(bug_get_field($t_bug_id, 'status')), string_get_bug_view_link($t_bug_id), string_attribute(bug_get_field($t_bug_id, 'summary')));
    }
    echo '</table>';
    echo '</form>';
    echo '</div>';
    if (STATUS_LEGEND_POSITION_BOTTOM == $t_legend_position) {
        echo '<br />';
        html_status_legend();
    }
}
Example #22
0
/**
 * @param unknown_type $dbHandler
 * @param unknown_type $control
 * @return stdClass
 * 
 * @internal revisions:
 *   20100721 - asimon - BUGID 3406, added assignmentMgr
 */
function initializeGui(&$dbHandler, &$control, &$assignmentMgr)
{
    $gui = new stdClass();
    $gui->feature = $control->args->feature;
    $gui->tPlanID = $control->args->testplan_id;
    $gui->title = lang_get('title_test_plan_navigator');
    $gui->src_workframe = '';
    $gui->additional_string = '';
    // configure target URLs and clickable buttons
    switch ($control->args->feature) {
        case 'planUpdateTC':
            $gui->menuUrl = "lib/plan/planUpdateTC.php";
            $control->draw_bulk_update_button = true;
            break;
        case 'test_urgency':
            $gui->menuUrl = "lib/plan/planUrgency.php";
            break;
        case 'tc_exec_assignment':
            $gui->menuUrl = "lib/plan/tc_exec_assignment.php";
            // BUGID 3406 - check for assignments before displaying the unassign button
            $build_id = $control->settings['setting_build']['selected'];
            if ($assignmentMgr->get_count_of_assignments_for_build_id($build_id)) {
                $control->draw_tc_unassign_button = true;
            }
            break;
    }
    return $gui;
}
Example #23
0
/**
 * Parse a workflow into a graph-like array of workflow transitions.
 * @param array The workflow enumeration to parse.
 * @return array The parsed workflow graph.
 */
function workflow_parse($p_enum_workflow)
{
    $t_status_arr = MantisEnum::getAssocArrayIndexedByValues(config_get('status_enum_string'));
    if (count($p_enum_workflow) == 0) {
        # workflow is not set, default it to all transitions
        foreach ($t_status_arr as $t_status => $t_label) {
            $t_temp_workflow = array();
            foreach ($t_status_arr as $t_next => $t_next_label) {
                if ($t_status != $t_next) {
                    $t_temp_workflow[] = $t_next . ':' . $t_next_label;
                }
            }
            $p_enum_workflow[$t_status] = implode(',', $t_temp_workflow);
        }
    }
    $t_entry = array();
    $t_exit = array();
    # prepopulate new bug state (bugs go from nothing to here)
    $t_submit_status_array = config_get('bug_submit_status');
    $t_new_label = MantisEnum::getLabel(lang_get('status_enum_string'), config_get('bug_submit_status'));
    if (is_array($t_submit_status_array)) {
        # @@@ (thraxisp) this is not implemented in bug_api.php
        foreach ($t_submit_status_array as $t_access => $t_status) {
            $t_entry[$t_status][0] = $t_new_label;
            $t_exit[0][$t_status] = $t_new_label;
        }
    } else {
        $t_status = $t_submit_status_array;
        $t_entry[$t_status][0] = $t_new_label;
        $t_exit[0][$t_status] = $t_new_label;
    }
    # add user defined arcs and implicit reopen arcs
    $t_reopen = config_get('bug_reopen_status');
    $t_reopen_label = MantisEnum::getLabel(lang_get('resolution_enum_string'), config_get('bug_reopen_resolution'));
    $t_resolved_status = config_get('bug_resolved_status_threshold');
    $t_default = array();
    foreach ($t_status_arr as $t_status => $t_status_label) {
        if (isset($p_enum_workflow[$t_status])) {
            $t_next_arr = MantisEnum::getAssocArrayIndexedByValues($p_enum_workflow[$t_status]);
            foreach ($t_next_arr as $t_next => $t_next_label) {
                if (!isset($t_default[$t_status])) {
                    $t_default[$t_status] = $t_next;
                }
                $t_exit[$t_status][$t_next] = '';
                $t_entry[$t_next][$t_status] = '';
            }
        } else {
            $t_exit[$t_status] = array();
        }
        if ($t_status >= $t_resolved_status) {
            $t_exit[$t_status][$t_reopen] = $t_reopen_label;
            $t_entry[$t_reopen][$t_status] = $t_reopen_label;
        }
        if (!isset($t_entry[$t_status])) {
            $t_entry[$t_status] = array();
        }
    }
    return array('entry' => $t_entry, 'exit' => $t_exit, 'default' => $t_default);
}
Example #24
0
function initializeGui()
{
    $gui = new stdClass();
    $gui->external_password_mgmt = tlUser::isPasswordMgtExternal();
    $gui->page_title = lang_get('page_title_lost_passwd');
    $gui->note = lang_get('your_info_for_passwd');
    return $gui;
}
 function options()
 {
     plugin_push_current('CustomerManagement');
     if (access_has_global_level(plugin_config_get('view_customer_fields_threshold'))) {
         $options = array(1 => lang_get('yes'), 2 => lang_get('no'));
     }
     plugin_pop_current();
     return $options;
 }
Example #26
0
function initializeGui($argsObj)
{
    $gui = new stdClass();
    $gui->tree_title = lang_get('title_navigator') . ' - ' . lang_get('title_req_spec');
    $gui->req_spec_manager_url = "lib/requirements/reqSpecView.php";
    $gui->req_manager_url = "lib/requirements/reqView.php";
    $gui->basehref = $argsObj->basehref;
    return $gui;
}
Example #27
0
function lang_get_failsave_custom_field($p_custom_field_name)
{
    if (lang_exists($p_custom_field_name, lang_get_current())) {
        $t_str = lang_get($p_custom_field_name);
    } else {
        $t_str = plugin_lang_get($p_custom_field_name);
    }
    return $t_str;
}
 /**
  * Returns html string to display
  * @return string
  */
 public function html()
 {
     $t_string = $this->tag ? lang_get('timeline_issue_tagged') : lang_get('timeline_issue_untagged');
     $t_tag_row = tag_get_by_name($this->tag_name);
     $t_html = $this->html_start();
     $t_html .= '<div class="action">' . sprintf($t_string, user_get_name($this->user_id), string_get_bug_view_link($this->issue_id), $t_tag_row ? tag_get_link($t_tag_row) : $this->tag_name) . '</div>';
     $t_html .= $this->html_end();
     return $t_html;
 }
Example #29
0
/**
* Initiate the execution of a testcase through XML Server RPCs.
* All the object instantiations are done here.
* XML-RPC Server Settings need to be configured using the custom fields feature.
* Three fields each for testcase level and testsuite level are required.
* The fields are: server_host, server_port and server_path.
* Precede 'tc_' for custom fields assigned to testcase level.
*
* @param $tcaseInfo: 
* @param $serverCfg:
* @param $context
*
* @return map:
*         keys: 'result','notes','message'
*         values: 'result' -> (Pass, Fail or Blocked)
*                 'notes' -> Notes text
*                 'message' -> Message from server
*/
function executeTestCase($tcaseInfo, $serverCfg, $context)
{
    // system: to give info about conection to remote execution server
    // execution:
    // 	scheduled: domain 'now', 'future'
    //			   caller will use this attribute to write exec result (only if now)
    //	timestampISO: can be used by server to say the scheduled time.
    //				  To be used only if scheduled = 'future'
    //
    //   Complete date plus hours, minutes and seconds:
    //      YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
    //
    // where:
    //
    //     YYYY = four-digit year
    //     MM   = two-digit month (01=January, etc.)
    //     DD   = two-digit day of month (01 through 31)
    //     hh   = two digits of hour (00 through 23) (am/pm NOT allowed)
    //     mm   = two digits of minute (00 through 59)
    //     ss   = two digits of second (00 through 59)
    //     TZD  = time zone designator (Z or +hh:mm or -hh:mm)
    $ret = array('system' => array('status' => 'ok', 'msg' => 'ok'), 'execution' => array('scheduled' => '', 'result' => '', 'notes' => '', 'timestampISO' => ''));
    $do_it = !is_null($serverCfg) && !is_null($serverCfg["url"]);
    if (!$do_it) {
        $ret['system']['status'] = 'configProblems';
        $ret['system']['msg'] = lang_get('remoteExecServerConfigProblems');
    }
    if ($do_it) {
        $xmlrpcClient = new IXR_Client($serverCfg["url"]);
        if (is_null($xmlrpcClient)) {
            $do_it = false;
            $ret['system']['status'] = 'connectionFailure';
            $ret['system']['msg'] = lang_get('remoteExecServerConnectionFailure');
        }
    }
    if ($do_it) {
        $args4call = array();
        // Execution Target
        $args4call['testCaseName'] = $tcaseInfo['name'];
        $args4call['testCaseID'] = $tcaseInfo['id'];
        $args4call['testCaseVersionID'] = $tcaseInfo['version_id'];
        // Context
        $args4call['testProjectID'] = $context['tproject_id'];
        $args4call['testPlanID'] = $context['tplan_id'];
        $args4call['platformID'] = $context['platform_id'];
        $args4call['buildID'] = $context['build_id'];
        $args4call['executionMode'] = 'now';
        // domain: deferred,now
        $xmlrpcClient->query('executeTestCase', $args4call);
        $response = $xmlrpcClient->getResponse();
        if (!is_null($response)) {
            $ret['execution'] = $response;
        }
    }
    return $ret;
}
Example #30
0
/**
 * Initialize object with information for graphical user interface.
 * 
 * @param tlTestCaseFilterControl $control
 * @return stdClass $gui
 */
function initializeGui(&$dbHandler, &$control)
{
    $gui = new stdClass();
    $gui->feature = $control->args->feature;
    $gui->treeHeader = lang_get('title_navigator') . ' - ' . lang_get('title_test_spec');
    $feature_path = array('edit_tc' => "lib/testcases/archiveData.php", 'keywordsAssign' => "lib/keywords/keywordsAssign.php", 'assignReqs' => "lib/requirements/reqTcAssign.php");
    $gui->tree_drag_and_drop_enabled = array('edit_tc' => has_rights($dbHandler, "mgt_modify_tc") == 'yes', 'keywordsAssign' => false, 'assignReqs' => false);
    $gui->menuUrl = $feature_path[$gui->feature];
    return $gui;
}