/**
 * 
 *
 */
function buildExtTable($gui, $charset)
{
    $table = null;
    $lbl = array('edit' => 'requirement', 'rev' => 'revision_short', 'ver' => 'version_short', 'req_spec' => 'req_spec', 'requirement' => 'requirement', 'version_revision_tag' => 'version_revision_tag');
    $labels = init_labels($lbl);
    $edit_icon = TL_THEME_IMG_DIR . "edit_icon.png";
    // $gui->resultSet -
    // key: reqspec_id
    // value: array of matches
    // array
    // {
    // [4][0]=>{"name" => "QAZ MNNN","id" => "4","req_doc_id" => "QAZ",
    //       	"version_id" => 5, "version" => 1,
    //			"revision_id" => -1, "revision" => 2}   -> revisio_id < 0 => lives on REQ VERSIONS TABLE
    //
    //    [1]=>{"name" => "QAZ MNNN","id" => "4","req_doc_id" => "QAZ",
    //       	"version_id" => 5, "version" => 1,
    //			"revision_id" => 6, "revision" => 1}
    // ...
    // }
    //
    //
    if (count($gui->resultSet) > 0) {
        $columns = array();
        $columns[] = array('title_key' => 'req_spec');
        $columns[] = array('title_key' => 'requirement', 'type' => 'text');
        // Extract the relevant data and build a matrix
        $matrixData = array();
        $key2loop = array_keys($gui->resultSet);
        $img = "<img title=\"{$labels['edit']}\" src=\"{$edit_icon}\" />";
        // req_id, req_version_id
        $reqVerHref = '<a href="javascript:openLinkedReqVersionWindow(%s,%s)">' . $labels['version_revision_tag'] . ' </a>';
        // req_revision_id
        $reqRevHref = '<a href="javascript:openReqRevisionWindow(%s)">' . $labels['version_revision_tag'] . ' </a>';
        foreach ($key2loop as $req_id) {
            $rowData = array();
            $itemSet = $gui->resultSet[$req_id];
            $rfx =& $itemSet[0];
            // We Group by Requirement path
            $rowData[] = htmlentities($gui->path_info[$rfx['id']], ENT_QUOTES, $charset);
            $edit_link = "<a href=\"javascript:openLinkedReqWindow(" . $rfx['id'] . ")\">" . "{$img}</a> ";
            $title = htmlentities($rfx['req_doc_id'], ENT_QUOTES, $charset) . ":" . htmlentities($rfx['name'], ENT_QUOTES, $charset);
            $matches = '';
            foreach ($itemSet as $rx) {
                if ($rx['revision_id'] > 0) {
                    $dummy = sprintf($reqRevHref, $rx['revision_id'], $rx['version'], $rx['revision']);
                } else {
                    $dummy = sprintf($reqVerHref, $req_id, $rx['version_id'], $rx['version'], $rx['revision']);
                }
                $matches .= $dummy;
            }
            $rowData[] = $edit_link . $title . ' ' . $matches;
            $matrixData[] = $rowData;
        }
        $table = new tlExtTable($columns, $matrixData, 'tl_table_req_search');
        $table->setGroupByColumnName($labels['req_spec']);
        $table->setSortByColumnName($labels['requirement']);
        $table->sortDirection = 'DESC';
        $table->showToolbar = true;
        $table->allowMultiSort = false;
        $table->toolbarRefreshButton = false;
        $table->toolbarShowAllColumnsButton = false;
        $table->storeTableState = false;
        $table->addCustomBehaviour('text', array('render' => 'columnWrap'));
    }
    return $table;
}
function buildExtTable($gui, $charset)
{
    $lbl = array('edit' => 'requirement_spec', 'rev' => 'revision_short', 'req_spec' => 'req_spec', 'revision_tag' => 'revision_tag', 'open_on_new_window' => 'open_on_new_window');
    $labels = init_labels($lbl);
    $edit_icon = TL_THEME_IMG_DIR . "edit_icon.png";
    $table = null;
    // $gui->resultSet -
    // key: reqspec_id
    // value: array of matches
    // array
    // {
    // [232][0]=>{"name" => "QA","id" => "232","doc_id" => "QA",
    //           "revision_id" => "251", "revision" => "4"}
    //      [1]=>{"name" => "QA","id" => "232","doc_id" => "QA",
    //           "revision_id" => "251", "revision" => "3"}
    // ...
    // }
    //
    //
    if (count($gui->resultSet) > 0) {
        $matrixData = array();
        $columns = array();
        $columns[] = array('title_key' => 'req_spec', 'type' => 'text', 'groupable' => 'false', 'hideable' => 'false');
        $key2loop = array_keys($gui->resultSet);
        foreach ($key2loop as $rspec_id) {
            $rowData = array();
            $itemSet = $gui->resultSet[$rspec_id];
            $rfx =& $itemSet[0];
            $path = $gui->path_info[$rfx['id']] ? $gui->path_info[$rfx['id']] . " / " : "";
            $edit_link = "<a href=\"javascript:openLinkedReqSpecWindow(" . $rfx['id'] . ")\">" . "<img title=\"{$labels['edit']}\" src=\"{$edit_icon}\" /></a> ";
            $title = htmlentities($rfx['doc_id'], ENT_QUOTES, $charset) . ":" . htmlentities($rfx['name'], ENT_QUOTES, $charset);
            $cm = '<a href="javascript:openReqSpecRevisionWindow(%s)" title="' . $labels['open_on_new_window'] . '" >' . $labels['revision_tag'] . ' </a>';
            // $link = $edit_link;
            $matches = '';
            foreach ($itemSet as $rx) {
                $matches .= sprintf($cm, $rx['revision_id'], $rx['revision']);
            }
            $rowData[] = $edit_link . $title . ' ' . $matches;
            $matrixData[] = $rowData;
        }
        $table = new tlExtTable($columns, $matrixData, 'tl_table_req_spec_search');
        $table->setSortByColumnName($labels['req_spec']);
        $table->sortDirection = 'ASC';
        $table->showToolbar = false;
        $table->addCustomBehaviour('text', array('render' => 'columnWrap'));
        $table->storeTableState = false;
    }
    return $table;
}
Exemplo n.º 3
0
/**
 * 
 *
 */
function buildExtTable($gui, $charset, $edit_icon, $history_icon)
{
    $table = null;
    if (count($gui->resultSet) > 0) {
        $labels = array('test_suite' => lang_get('test_suite'), 'test_case' => lang_get('test_case'));
        $columns = array();
        $columns[] = array('title_key' => 'test_suite');
        $columns[] = array('title_key' => 'test_case', 'type' => 'text');
        $columns[] = array('title_key' => 'summary');
        // Extract the relevant data and build a matrix
        $matrixData = array();
        $titleSeperator = config_get('gui_title_separator_1');
        foreach ($gui->resultSet as $result) {
            $rowData = array();
            $rowData[] = htmlentities($gui->path_info[$result['testcase_id']], ENT_QUOTES, $charset);
            // build test case link
            $history_link = "<a href=\"javascript:openExecHistoryWindow({$result['testcase_id']});\">" . "<img title=\"" . lang_get('execution_history') . "\" src=\"{$history_icon}\" /></a> ";
            $edit_link = "<a href=\"javascript:openTCEditWindow({$result['testcase_id']});\">" . "<img title=\"" . lang_get('design') . "\" src=\"{$edit_icon}\" /></a> ";
            $tcaseName = htmlentities($gui->tcasePrefix, ENT_QUOTES, $charset) . $result['tc_external_id'] . " [v" . $result['version'] . "]" . $titleSeperator . htmlentities($result['name'], ENT_QUOTES, $charset);
            $rowData[] = $history_link . $edit_link . $tcaseName;
            $rowData[] = $result['summary'];
            $matrixData[] = $rowData;
        }
        $table = new tlExtTable($columns, $matrixData, 'tl_table_test_case_search');
        $table->setGroupByColumnName($labels['test_suite']);
        $table->setSortByColumnName($labels['test_case']);
        $table->sortDirection = 'DESC';
        $table->showToolbar = true;
        $table->allowMultiSort = false;
        $table->toolbarRefreshButton = false;
        $table->toolbarShowAllColumnsButton = false;
        $table->addCustomBehaviour('text', array('render' => 'columnWrap'));
        $table->storeTableState = false;
    }
    return $table;
}
Exemplo n.º 4
0
                    $exec_history_link = "<a href=\"javascript:openExecHistoryWindow({$tc_id});\">" . "<img title=\"{$labels['execution_history']}\" " . " src=\"{$images['history_small']}\" /></a> ";
                    $edit_link = "<a href=\"javascript:openTCEditWindow({$tc_id});\">" . "<img title=\"{$labels['design']}\" src=\"{$images['edit_icon']}\" /></a> ";
                    $exec_link = "";
                    if (isset($testcases[$tc_id]['exec_status']) && $testcases[$tc_id]['exec_status'] != $status_code_map['not_run']) {
                        $exec_link = "<a href=\"javascript:openExecutionWindow(" . "{$tc_id}, {$testcases[$tc_id]['tcversion_id']}, {$testcases[$tc_id]['exec_on_build']} , " . "{$testcases[$tc_id]['exec_on_tplan']}, {$testcases[$tc_id]['platform_id']});\">" . "<img title=\"{$labels['execution']}\" src=\"{$images['exec_icon']}\" /></a> ";
                    }
                    $linked_tcs_with_status .= "{$exec_history_link} {$edit_link} {$exec_link} {$colored_status} {$tc_name}<br>";
                }
            } else {
                $linked_tcs_with_status = $labels['no_linked_tcs'];
            }
            $single_row[] = $linked_tcs_with_status;
            $rows[] = $single_row;
        }
    }
    $matrix = new tlExtTable($columns, $rows, 'tl_table_results_reqs');
    $matrix->title = $gui->pageTitle;
    // group by Req Spec and hide that column
    $matrix->setGroupByColumnName($labels['req_spec_short']);
    $matrix->setSortByColumnName($labels['progress']);
    $matrix->sortDirection = 'DESC';
    // show long text content in multiple lines
    $matrix->addCustomBehaviour('text', array('render' => 'columnWrap'));
    // define toolbar
    $matrix->toolbarShowAllColumnsButton = true;
    $matrix->showGroupItemsCount = false;
    $gui->tableSet = array($matrix);
}
$gui->summary = $eval_status_map;
$smarty->assign('gui', $gui);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
function initializeGuiForResult(&$dbHandler, $argsObj, &$guiObj)
{
    $rcfg = config_get('results');
    $map_status_code = $rcfg['status_code'];
    $map_code_status = $rcfg['code_status'];
    $map_status_label = $rcfg['status_label'];
    $map_statuscode_css = array();
    foreach ($map_code_status as $code => $status) {
        if (isset($map_status_label[$status])) {
            $label = $map_status_label[$status];
            $map_statuscode_css[$code] = array();
            $map_statuscode_css[$code]['translation'] = lang_get($label);
            $map_statuscode_css[$code]['css_class'] = $map_code_status[$code] . '_text';
        }
    }
    $options = array();
    // convert starttime to iso format for database usage
    $dateFormat = config_get('date_format');
    $k2l = array('selected_start_date' => 'startTime', 'selected_end_date' => 'endTime');
    foreach ($k2l as $in => $opt) {
        if (isset($argsObj->{$in}) && sizeof($argsObj->{$in}) > 0) {
            $dd = split_localized_date(current($argsObj->{$in}), $dateFormat);
            if ($dd != null) {
                $options[$opt] = $dd['year'] . "-" . $dd['month'] . "-" . $dd['day'];
            }
        }
    }
    $options['startTime'] .= " " . (isset($argsObj->start_Hour) ? $argsObj->start_Hour : "00") . ":00:00";
    $options['endTime'] .= " " . (isset($argsObj->end_Hour) ? $argsObj->end_Hour : "00") . ":59:59";
    $mgr = new testproject($dbHandler);
    $guiObj->resultSet = $mgr->getTestCasesCreatedByUser($argsObj->tproject_id, $argsObj->user_id, $options);
    if (!is_null($guiObj->resultSet)) {
        // test case can exist multiple times, due to versions
        $rows = array();
        foreach ($guiObj->resultSet as $idx => $itemInfo) {
            list($columns, $sortByColumn) = getColumnsDefinition();
            foreach ($itemInfo as $tcase) {
                $current_row = array();
                $tcase_id = $tcase['tcase_id'];
                $tcversion_id = $tcase['tcversion_id'];
                $current_row[] = htmlspecialchars($tcase['login']);
                $current_row[] = htmlspecialchars($tcase['path']);
                // Create linked icons
                $edit_link = "<a href=\"javascript:openTCEditWindow({$tcase_id},{$tcversion_id});\">" . "<img title=\"{$guiObj->l18n['design']}\" src=\"{$guiObj->images['edit']}\" /></a> ";
                $current_row[] = "<!-- " . sprintf("%010d", $tcase['external_id']) . " -->" . $edit_link . htmlspecialchars($tcase['external_id']) . " : " . htmlspecialchars($tcase['tcase_name']) . sprintf($guiObj->l18n['tcversion_indicator'], $tcase['version']);
                $current_row[] = $tcase['importance'];
                $current_row[] = $tcase['creation_ts'];
                $current_row[] = $tcase['modification_ts'];
                $rows[] = $current_row;
            }
        }
        // Different table ID for different reports:
        $table_id = "tl_table_tc_created_per_user_";
        // Add test plan ID to table ID
        $table_id .= $guiObj->tproject_id;
        $matrix = new tlExtTable($columns, $rows, $table_id);
        $matrix->title = $guiObj->l18n['testproject'] . ": " . htmlspecialchars($guiObj->tproject_name);
        //
        // @TODO how this work ?
        // $matrix->addCustomBehaviour(arg1, arg2)
        // arg1: type that can be user defined, here we use 'importance'.
        // arg2: array with methods
        //       'render' => javascript render method (has to be present on inc_ext_table.tpl).
        //       'filter' => piece of name used on several files
        //                   1. on exttable.class.php is used on buildColumns() to call build{piece}FilterOptions()
        //                   2. on ext_extensions a method named Ext.ux.grid.filter.{piece}Filter
        //                      has to exists or rendering will fail
        //
        $matrix->addCustomBehaviour('importance', array('render' => 'importanceRenderer', 'filter' => 'Importance'));
        // Default grouping by first column, which is user for overview, build otherwise
        $matrix->setGroupByColumnName(lang_get($columns[0]['title_key']));
        // Define toolbar
        $matrix->showToolbar = true;
        $matrix->toolbarExpandCollapseGroupsButton = true;
        $matrix->toolbarShowAllColumnsButton = true;
        // TICKET 5562: Test Cases created per User - toolbar refresh button breaks filter behaivour
        $matrix->toolbarDefaultStateButton = false;
        $matrix->toolbarRefreshButton = false;
        $matrix->setSortByColumnName($sortByColumn);
        $matrix->sortDirection = 'DESC';
        $guiObj->tableSet[$guiObj->tproject_id] = $matrix;
    }
}
/**
 * Builds ext-js rich table to display matrix results
 *
 *
 * return tlExtTable
 *
 */
function buildMatrix(&$guiObj, &$argsObj)
{
    // th_first_name,th_last_name,th_email
    // IMPORTANT DEVELOPER NOTICE
    // Column order is same that present on query on getAllUsersForGrid()
    //
    // Where col_id is not specified, col_id will be generated this way: 'id_' . $v['title_key'].
    // Example: id_th_first_name.
    //
    // 'tlType' => TestLinkType: will be analized and mapped accordingly on tlExtTable::buildColumns()
    //
    $columns = array(array('title_key' => 'th_login', 'col_id' => 'handle', 'width' => 100), array('title_key' => 'th_first_name', 'width' => 150), array('title_key' => 'th_last_name', 'width' => 150), array('title_key' => 'th_email', 'width' => 150), array('title_key' => 'th_role', 'width' => 150), array('title_key' => 'th_locale', 'width' => 150), array('title_key' => 'th_active', 'type' => 'oneZeroImage', 'width' => 50), array('title' => 'disableUser', 'tlType' => 'disableUser', 'width' => 150), array('hidden' => true, 'title' => 'hidden_role_id', 'col_id' => 'role_id'), array('hidden' => true, 'title' => 'hidden_user_id', 'col_id' => 'user_id'), array('hidden' => true, 'title' => 'hidden_login', 'col_id' => 'login'), array('hidden' => true, 'title' => 'hidden_is_special', 'col_id' => 'is_special'));
    $lbl = init_labels(array('th_login' => null, 'th_first_name' => null, 'th_last_name' => null, 'th_email' => null));
    $loop2do = count($guiObj->matrix);
    for ($zdx = 0; $zdx < $loop2do; $zdx++) {
        $guiObj->matrix[$zdx]['handle'] = '<a href="' . $argsObj->basehref . 'lib/usermanagement/usersEdit.php?doAction=edit&user_id=' . $guiObj->matrix[$zdx]['user_id'] . '">' . $guiObj->matrix[$zdx]['login'] . "</a>";
    }
    $matrix = new tlExtTable($columns, $guiObj->matrix, 'tl_users_list');
    // => addCustomBehaviour(columnType, );
    $matrix->addCustomBehaviour('oneZeroImage', array('render' => 'oneZeroImageRenderer'));
    $matrix->moreViewConfig = " ,getRowClass: function(record, index) {" . " var x = record.get('role_id');" . " return('roleCode'+x); " . " } ";
    $matrix->setImages($guiObj->images);
    $matrix->allowMultiSort = false;
    $matrix->sortDirection = 'DESC';
    $matrix->showToolbar = true;
    $matrix->toolbarShowAllColumnsButton = true;
    unset($columns);
    return $matrix;
}
Exemplo n.º 7
0
            $rowData = array();
            $rowData[] = strip_tags($tsuites[$tcases['id']]);
            //build test case link
            $edit_link = "<a href=\"javascript:openTCEditWindow({$gui->tproject_id},{$tcases['id']});\">" . "<img title=\"{$edit_label}\" src=\"{$edit_img}\" /></a> ";
            $tcaseName = $tcasePrefix . $tcases['tc_external_id'] . $titleSeperator . strip_tags($tcases['name']);
            $tcLink = "<!-- " . sprintf("%010d", $tcases['tc_external_id']) . " -->" . $edit_link . $tcaseName;
            $rowData[] = $tcLink;
            // only add importance column if
            if ($priorityMgmtEnabled) {
                if (isset($impCodeVerbose[$tcases['importance']])) {
                    $rowData[] = "<!-- " . $tcases['importance'] . " -->" . $impCodeLabel[$tcases['importance']];
                }
            }
            $matrixData[] = $rowData;
        }
        $table = new tlExtTable($columns, $matrixData, 'tl_table_test_cases_not_assigned_to_any_test_plan');
        $table->setGroupByColumnName(lang_get('test_suite'));
        $sort_by_column = $priorityMgmtEnabled ? 'importance' : 'test_case';
        $table->setSortByColumnName(lang_get($sort_by_column));
        $table->sortDirection = 'DESC';
        $gui->tableSet = array($table);
    }
}
$gui->tproject_name = $args->tproject_name;
$gui->pageTitle = lang_get('report_free_testcases_on_testproject');
$gui->warning_msg = lang_get($msg_key);
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
/**
 * get Columns definition for table to display
        $current_row[] = $name;
        // total count of testcases assigned to this user on this build
        $current_row[] = $statistics['total'];
        // add count and percentage for each possible status
        foreach ($statusCfg as $status => $code) {
            $current_row[] = $statistics[$status]['count'];
            $current_row[] = $statistics[$status]['percentage'];
        }
        $current_row[] = $statistics['progress'];
        $current_row[] = minutes2HHMMSS($statistics['total_time']);
        // add this row to the others
        $rows[] = $current_row;
    }
}
$columns = getTableHeader($statusCfg);
$smartTable = new tlExtTable($columns, $rows, 'tl_table_results_by_tester_per_build');
$smartTable->title = lang_get('results_by_tester_per_build');
$smartTable->setGroupByColumnName(lang_get('build'));
// enable default sorting by progress column
$smartTable->setSortByColumnName(lang_get('progress'));
//define toolbar
$smartTable->showToolbar = true;
$smartTable->toolbarExpandCollapseGroupsButton = true;
$smartTable->toolbarShowAllColumnsButton = true;
$gui->tableSet = array($smartTable);
// show warning message instead of table if table is empty
$gui->warning_message = count($rows) > 0 ? '' : lang_get('no_testers_per_build');
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
/**
Exemplo n.º 9
0
            $current_row[] = $statistics[$status]['count'];
            $current_row[] = $statistics[$status]['percentage'];
        }
        // add general progress for this user
        // add html comment with which js can sort the column
        $percentage = is_numeric($statistics['progress']) ? $statistics['progress'] : 0;
        $padded_percentage = sprintf("%010d", $percentage);
        //bring all percentages to same length
        $commented_progress = "<!-- {$padded_percentage} --> {$statistics['progress']}";
        $current_row[] = $commented_progress;
        // add this row to the others
        $rows[] = $current_row;
    }
}
// create the table object
$matrix = new tlExtTable($columns, $rows, $table_id);
$matrix->title = lang_get('results_by_tester_per_build');
//group by build
$matrix->setGroupByColumnName(lang_get('build'));
// 20100816 - asimon - enable default sorting by progress column
$matrix->setSortByColumnName(lang_get('progress'));
//define toolbar
$matrix->showToolbar = true;
$matrix->toolbarExpandCollapseGroupsButton = true;
$matrix->toolbarShowAllColumnsButton = true;
$gui->tableSet = array($matrix);
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
/**
 * initialize user input
Exemplo n.º 10
0
/**
 * Builds ext-js rich table to display matrix results
 *
 * @param map buildSet: info about all Builds analized
 * @param map dataSet: data to be displayed on matrix
 *
 * return tlExtTable
 *
 */
function buildMatrix($buildSet, $dataSet, $format, $show_platforms, &$args)
{
    $columns = array(array('title' => lang_get('title_test_suite_name'), 'width' => 100), array('title' => lang_get('title_test_case_title'), 'width' => 150));
    if ($show_platforms) {
        $columns[] = array('title' => lang_get('platform'), 'width' => 60);
    }
    // BUGID 3418: check if test priority is enabled
    if ($_SESSION['testprojectOptions']->testPriorityEnabled) {
        $columns[] = array('title' => lang_get('priority'), 'type' => 'priority', 'width' => 40);
    }
    foreach ($buildSet as $build) {
        $columns[] = array('title' => $build['name'], 'type' => 'status', 'width' => 100);
    }
    if ($format == FORMAT_HTML) {
        //create unique table id for each project and each test plan (build columns differ)
        $table_id = 'tl_' . $args->tproject_id . '_' . $args->tplan_id . '_table_results_tc';
        $matrix = new tlExtTable($columns, $dataSet, $table_id);
        //if platforms feature is enabled group by platform otherwise group by test suite
        $group_name = $show_platforms ? lang_get('platform') : lang_get('title_test_suite_name');
        $matrix->setGroupByColumnName($group_name);
        $matrix->sortDirection = 'DESC';
        // BUGID 3418: check if test priority is enabled
        if ($_SESSION['testprojectOptions']->testPriorityEnabled) {
            $matrix->addCustomBehaviour('priority', array('render' => 'priorityRenderer'));
            //sort by priority
            $matrix->setSortByColumnName(lang_get('priority'));
        } else {
            //sort by test case
            $matrix->setSortByColumnName(lang_get('title_test_case_title'));
        }
        //define table toolbar
        $matrix->showToolbar = true;
        $matrix->toolbarExpandCollapseGroupsButton = true;
        $matrix->toolbarShowAllColumnsButton = true;
    } else {
        $matrix = new tlHTMLTable($columns, $dataSet, 'tl_table_results_tc');
    }
    return $matrix;
}
             foreach ($statusSetForDisplay as $status_verbose => $status_label) {
                 if (isset($platform_metric[$status_verbose])) {
                     $rowData[] = $platform_metric[$status_verbose];
                     $rowData[] = getPercentage($platform_metric[$status_verbose], $platform_metric['active'], $round_precision);
                 } else {
                     $rowData[] = 0;
                     $rowData[] = 0;
                 }
             }
             $rowData[] = getPercentage($platform_metric['executed'], $platform_metric['active'], $round_precision);
             $matrixData[] = $rowData;
         }
     }
 }
 //new dBug($matrixData);
 $table = new tlExtTable($columns, $matrixData, 'tl_table_metrics_dashboard');
 // if platforms are to be shown -> group by test plan
 // if no platforms are to be shown -> no grouping
 if ($gui->show_platforms) {
     $table->setGroupByColumnName($labels['test_plan']);
 }
 $table->setSortByColumnName($labels['progress']);
 $table->sortDirection = 'DESC';
 $table->showToolbar = true;
 $table->toolbarExpandCollapseGroupsButton = true;
 $table->toolbarShowAllColumnsButton = true;
 $table->toolbarResetFiltersButton = true;
 $table->title = $labels['href_metrics_dashboard'];
 $table->showGroupItemsCount = true;
 $gui->tableSet = array($table);
 // get overall progress, collect test project metrics
Exemplo n.º 12
0
/**
 * Builds ext-js rich table to display matrix results
 *
 *
 * return tlExtTable
 *
 */
function buildMatrix(&$guiObj, &$argsObj, $buildIDSet, $latestBuild)
{
    $columns = array(array('title_key' => 'title_test_suite_name', 'width' => 100), array('title_key' => 'title_test_case_title', 'width' => 150));
    $lbl = init_labels(array('title_test_suite_name' => null, 'platform' => null, 'priority' => null, 'result_on_last_build' => null, 'title_test_case_title' => null));
    $group_name = $lbl['title_test_suite_name'];
    if (!is_null($guiObj->platforms)) {
        $columns[] = array('title_key' => 'platform', 'width' => 60, 'filter' => 'list', 'filterOptions' => $guiObj->platforms);
        $group_name = $lbl['platform'];
    }
    if ($guiObj->options->testPriorityEnabled) {
        $columns[] = array('title_key' => 'priority', 'type' => 'priority', 'width' => 40);
    }
    // --------------------------------------------------------------------
    $guiObj->filterFeedback = null;
    foreach ($buildIDSet as $iix) {
        $buildSet[] = $guiObj->buildInfoSet[$iix];
        if ($guiObj->filterApplied) {
            $guiObj->filterFeedback[] = $guiObj->buildInfoSet[$iix]['name'];
        }
    }
    if ($guiObj->matrixCfg->buildColumns['showStatusLastExecuted']) {
        $buildSet[] = array('name' => $lbl['result_on_last_build'] . ' ' . $latestBuild->name);
    }
    foreach ($buildSet as $build) {
        $columns[] = array('title' => $build['name'], 'type' => 'status', 'width' => 100);
    }
    // --------------------------------------------------------------------
    $columns[] = array('title_key' => 'last_execution', 'type' => 'status', 'width' => 100);
    if ($argsObj->format == FORMAT_HTML) {
        $matrix = new tlExtTable($columns, $guiObj->matrix, 'tl_table_results_tc');
        //if platforms feature is enabled group by platform otherwise group by test suite
        $matrix->setGroupByColumnName($group_name);
        $matrix->sortDirection = 'DESC';
        if ($guiObj->options->testPriorityEnabled) {
            // Developer Note:
            // To understand 'filter' => 'Priority' => see exttable.class.php => buildColumns()
            $matrix->addCustomBehaviour('priority', array('render' => 'priorityRenderer', 'filter' => 'Priority'));
            $matrix->setSortByColumnName($lbl['priority']);
        } else {
            $matrix->setSortByColumnName($lbl['title_test_case_title']);
        }
        // define table toolbar
        $matrix->showToolbar = true;
        $matrix->toolbarExpandCollapseGroupsButton = true;
        $matrix->toolbarShowAllColumnsButton = true;
    } else {
        $matrix = new tlHTMLTable($columns, $guiObj->matrix, 'tl_table_results_tc');
    }
    unset($columns);
    return $matrix;
}
/**
 * Builds ext-js rich table to display matrix results
 *
 * @param map dataSet: data to be displayed on matrix
 *
 * return tlExtTable
 *
 */
function buildMatrix($dataSet, &$args, $options = array(), $platforms, $customFieldColumns = null)
{
    $default_options = array('bugInterfaceOn' => false, 'show_platforms' => false, 'status_not_run' => false, 'format' => FORMAT_HTML);
    $options = array_merge($default_options, $options);
    $l18n = init_labels(array('assigned_to' => null, 'platform' => null, 'th_date' => null, 'th_build' => null));
    $columns = array();
    $columns[] = array('title_key' => 'title_test_suite_name', 'width' => 80, 'type' => 'text');
    $columns[] = array('title_key' => 'title_test_case_title', 'width' => 80, 'type' => 'text');
    $columns[] = array('title_key' => 'version', 'width' => 30);
    if ($options['show_platforms']) {
        $columns[] = array('title_key' => 'platform', 'width' => 60, 'filter' => 'list', 'filterOptions' => $platforms);
    }
    if ($options['status_not_run']) {
        $columns[] = array('title_key' => 'th_build', 'width' => 35);
        $columns[] = array('title_key' => 'assigned_to', 'width' => 60);
        $columns[] = array('title_key' => 'summary', 'width' => 150, 'type' => 'text');
    } else {
        $columns[] = array('title_key' => 'th_build', 'width' => 35);
        $columns[] = array('title_key' => 'th_run_by', 'width' => 60);
        $columns[] = array('title_key' => 'th_date', 'width' => 60);
        $columns[] = array('title_key' => 'title_execution_notes', 'width' => 150, 'type' => 'text');
        // 20130325
        if (!is_null($customFieldColumns)) {
            foreach ($customFieldColumns as $id => $def) {
                $columns[] = array('title' => $def['label'], 'width' => 60);
            }
        }
        if ($options['bugInterfaceOn']) {
            $columns[] = array('title_key' => 'th_bugs_id_summary', 'type' => 'text');
        }
    }
    if ($options['format'] == FORMAT_HTML) {
        // IMPORTANT DEVELOPMENT NOTICE
        // columns and dataSet are deeply related this means that inside
        // dataSet order has to be identical that on columns or table will be a disaster
        //
        $matrix = new tlExtTable($columns, $dataSet, 'tl_table_results_by_status');
        //if not run report: sort by test suite
        //blocked, failed report: sort by platform (if enabled) else sort by date
        $sort_name = 0;
        if ($options['status_not_run']) {
            $sort_name = $l18n['assigned_to'];
        } else {
            $sort_name = $options['show_platforms'] ? $l18n['platform'] : $l18n['th_date'];
        }
        $matrix->setSortByColumnName($sort_name);
        $matrix->setGroupByColumnName($l18n['th_build']);
        $matrix->addCustomBehaviour('text', array('render' => 'columnWrap'));
        //define table toolbar
        $matrix->showToolbar = true;
        $matrix->toolbarExpandCollapseGroupsButton = true;
        $matrix->toolbarShowAllColumnsButton = true;
    } else {
        $matrix = new tlHTMLTable($columns, $dataSet, 'tl_table_results_by_status');
    }
    return $matrix;
}
Exemplo n.º 14
0
function buildExtTable($gui, $charset, $edit_icon, $edit_label)
{
    $table = null;
    if (count($gui->resultSet) > 0) {
        $labels = array('req_spec' => lang_get('req_spec'));
        $columns = array();
        $columns[] = array('title_key' => 'req_spec', 'type' => 'text', 'groupable' => 'false', 'hideable' => 'false');
        // Extract the relevant data and build a matrix
        $matrixData = array();
        foreach ($gui->resultSet as $result) {
            $rowData = array();
            $path = $gui->path_info[$result['id']] ? $gui->path_info[$result['id']] . " / " : "";
            // use html comment to properly sort by full path
            // build req spec link
            //			$rowData[] = "<!-- " . htmlentities($path, ENT_QUOTES, $charset) . htmlentities($result['name'], ENT_QUOTES, $charset) ." -->" .
            //			             htmlentities($path, ENT_QUOTES, $charset) .
            //			             "<a href=\"lib/requirements/reqSpecView.php?item=req_spec&req_spec_id={$result['id']}\">" .
            //			             htmlentities($result['doc_id'], ENT_QUOTES, $charset) . ":" .
            //			             htmlentities($result['name'], ENT_QUOTES, $charset);
            $edit_link = "<a href=\"javascript:openLinkedReqSpecWindow({$gui->tproject_id}," . $result['id'] . ")\">" . "<img title=\"{$edit_label}\" src=\"{$edit_icon}\" /></a> ";
            $title = htmlentities($result['doc_id'], ENT_QUOTES, $charset) . ":" . htmlentities($result['name'], ENT_QUOTES, $charset);
            $link = $edit_link . $title;
            $rowData[] = $link;
            $matrixData[] = $rowData;
        }
        $table = new tlExtTable($columns, $matrixData, 'tl_table_req_spec_search');
        $table->setSortByColumnName($labels['req_spec']);
        $table->sortDirection = 'ASC';
        $table->showToolbar = false;
        $table->addCustomBehaviour('text', array('render' => 'columnWrap'));
        // dont save settings for this table
        $table->storeTableState = false;
    }
    return $table;
}
Exemplo n.º 15
0
/**
 * 
 *
 */
function buildExtTable($gui, $tcase_mgr, $tplan_mgr, $tplan_id, $gluechar, $charset, $labels, $edit_icon)
{
    $table = null;
    if (count($gui->resultSet) > 0) {
        $columns = array();
        $columns[] = array('title_key' => 'test_suite');
        $columns[] = array('title_key' => 'test_case', 'width' => 80, 'type' => 'text');
        foreach ($gui->cfields as $cfield) {
            $dummy = array('title' => $cfield['label'], 'col_id' => 'id_cf_' . $cfield['name'], 'type' => 'text');
            $columns[] = $dummy;
        }
        // Extract the relevant data and build a matrix
        $matrixData = array();
        foreach ($gui->resultSet as $item) {
            $rowData = array();
            // Get test suite path
            $dummy = $tcase_mgr->getPathLayered(array($item['tcase_id']));
            $dummy = end($dummy);
            $rowData[] = $dummy['value'];
            $name = buildExternalIdString($gui->tcasePrefix, $item['tc_external_id']) . $gluechar . $item['tcase_name'];
            // create linked icons
            $edit_link = "<a href=\"javascript:openTCEditWindow({$gui->tproject_id},{$item['tcase_id']});\">" . "<img title=\"{$labels['design']}\" src=\"{$edit_icon}\" /></a> ";
            $link = "<!-- " . sprintf("%010d", $item['tc_external_id']) . " -->" . $edit_link . $name;
            $rowData[] = $link;
            //			$rowData[] = '<a href="lib/testcases/archiveData.php?edit=testcase&id=' . $item['tcase_id'] . '">' .
            //						 buildExternalIdString($gui->tcasePrefix, $item['tc_external_id']) .
            //						 $gluechar . $item['tcase_name'] . '</a>';
            $hasValue = false;
            foreach ($item['cfields'] as $cf_value) {
                $rowData[] = preg_replace('!\\s+!', ' ', htmlentities($cf_value, ENT_QUOTES, $charset));
                if ($cf_value) {
                    $hasValue = true;
                }
            }
            if ($hasValue) {
                $matrixData[] = $rowData;
            }
        }
        $table = new tlExtTable($columns, $matrixData, 'tl_table_tplan_with_cf');
        $table->addCustomBehaviour('text', array('render' => 'columnWrap'));
        $table->setGroupByColumnName(lang_get('test_suite'));
        $table->setSortByColumnName(lang_get('test_case'));
        $table->sortDirection = 'ASC';
    }
    return $table;
}
/**
* initialize Gui
*/
function initializeGui(&$db, &$args, $dateFormat)
{
    $gui = new stdClass();
    $gui->glueChar = config_get('testcase_cfg')->glue_character;
    $gui->tproject_id = $args->tproject_id;
    $gui->tproject_name = $args->tproject_name;
    $gui->warning_msg = '';
    $gui->tableSet = null;
    $history_img = TL_THEME_IMG_DIR . "history_small.png";
    $exec_img = TL_THEME_IMG_DIR . "exec_icon.png";
    $edit_img = TL_THEME_IMG_DIR . "edit_icon.png";
    $l18n = init_labels(array('tcversion_indicator' => null, 'goto_testspec' => null, 'version' => null, 'testplan' => null, 'assigned_tc_overview' => null, 'testcases_created_per_user' => null, 'design' => null, 'execution' => null, 'execution_history' => null, 'low_priority' => null, 'medium_priority' => null, 'high_priority' => null));
    $gui->pageTitle = sprintf($l18n['testcases_created_per_user'], $gui->tproject_name);
    $results_config = config_get('results');
    $map_status_code = $results_config['status_code'];
    $map_code_status = $results_config['code_status'];
    $map_status_label = $results_config['status_label'];
    $map_statuscode_css = array();
    foreach ($map_code_status as $code => $status) {
        if (isset($map_status_label[$status])) {
            $label = $map_status_label[$status];
            $map_statuscode_css[$code] = array();
            $map_statuscode_css[$code]['translation'] = lang_get($label);
            $map_statuscode_css[$code]['css_class'] = $map_code_status[$code] . '_text';
        }
    }
    $options = new stdClass();
    // convert starttime to iso format for database usage
    if (isset($args->selected_start_date) && sizeof($args->selected_start_date) > 0) {
        $date_array = split_localized_date($args->selected_start_date[0], $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $options->startTime = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    // convert starttime to iso format for database usage
    if (isset($args->selected_end_date) && sizeof($args->selected_end_date) > 0) {
        $date_array = split_localized_date($args->selected_end_date[0], $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $options->endTime = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    $start_hour = isset($args->start_Hour) ? $args->start_Hour : "00";
    $options->startTime = $options->startTime . " " . $start_hour . ":00:00";
    $end_hour = isset($args->end_Hour) ? $args->end_Hour : "00";
    $options->endTime = $options->endTime . " " . $end_hour . ":59:59";
    $options->mode = 'full_path';
    // TBD: remove it
    $options->tplan_id = $args->tplan_id;
    // used to retrieve test cases from
    $tcase_mgr = new testcase($db);
    $gui->resultSet = $tcase_mgr->get_created_per_user($args->user_id, $args->tproject_id, $options);
    if (!is_null($gui->resultSet)) {
        $tables = tlObjectWithDB::getDBTables(array('nodes_hierarchy'));
        $tplanSet = array_keys($gui->resultSet);
        $sql = "SELECT name,id FROM {$tables['nodes_hierarchy']} " . "WHERE id IN (" . implode(',', $tplanSet) . ")";
        $gui->tplanNames = $db->fetchRowsIntoMap($sql, 'id');
        $optColumns = array('priority' => $args->priority_enabled);
        // For each test case set under a test plan ID, create the rows and columns
        foreach ($gui->resultSet as $tplan_id => $tcase_set) {
            list($columns, $sortByColumn) = getColumnsDefinition($optColumns);
            $rows = array();
            foreach ($tcase_set as $tcase_platform) {
                foreach ($tcase_platform as $tcase) {
                    $current_row = array();
                    $tcase_id = $tcase['testcase_id'];
                    $tcversion_id = $tcase['tcversion_id'];
                    $current_row[] = htmlspecialchars($tcase['login']);
                    $current_row[] = htmlspecialchars($tcase['tcase_full_path']);
                    // Create linked icons
                    $exec_history_link = "<a href=\"javascript:openExecHistoryWindow({$tcase_id});\">" . "<img title=\"{$l18n['execution_history']}\" src=\"{$history_img}\" /></a> ";
                    $edit_link = "<a href=\"javascript:openTCEditWindow({$tcase_id});\">" . "<img title=\"{$l18n['design']}\" src=\"{$edit_img}\" /></a> ";
                    $current_row[] = "<!-- " . sprintf("%010d", $tcase['tc_external_id']) . " -->" . $exec_history_link . $edit_link . htmlspecialchars($tcase['prefix']) . $gui->glueChar . $tcase['tc_external_id'] . " : " . htmlspecialchars($tcase['name']) . sprintf($l18n['tcversion_indicator'], $tcase['version']);
                    $last_execution = $tcase_mgr->get_last_execution($tcase_id, $tcversion_id, $tplan_id, $tcase['build_id'], $tcase['platform_id']);
                    $status = $last_execution[$tcversion_id]['status'];
                    if (!$status) {
                        $status = $map_status_code['not_run'];
                    }
                    $current_row[] = array("value" => $status, "text" => $map_statuscode_css[$status]['translation'], "cssClass" => $map_statuscode_css[$status]['css_class']);
                    $current_row[] = $tcase['creation_ts'];
                    $current_row[] = $tcase['modification_ts'];
                    // add this row to the others
                    $rows[] = $current_row;
                }
            }
            // Different table ID for different reports:
            $table_id = "tl_table_tc_created_per_user_";
            // Add test plan ID to table ID
            $table_id .= $tplan_id;
            $matrix = new tlExtTable($columns, $rows, $table_id);
            $matrix->title = $l18n['testplan'] . ": " . htmlspecialchars($gui->tplanNames[$tplan_id]['name']);
            // Default grouping by first column, which is user for overview, build otherwise
            $matrix->setGroupByColumnName(lang_get($columns[0]['title_key']));
            // Make table collapsible if more than 1 table is shown and surround by frame
            if (count($tplanSet) > 1) {
                $matrix->collapsible = true;
                $matrix->frame = true;
            }
            // Define toolbar
            $matrix->showToolbar = true;
            $matrix->toolbarExpandCollapseGroupsButton = true;
            $matrix->toolbarShowAllColumnsButton = true;
            $matrix->setSortByColumnName($sortByColumn);
            $matrix->sortDirection = 'DESC';
            $gui->tableSet[$tplan_id] = $matrix;
        }
    }
    return $gui;
}
Exemplo n.º 17
0
/**
 * 
 *
 */
function buildExtTable($gui, $show_icon, $charset)
{
    $table = null;
    if (count($gui->events) > 0) {
        $columns = array();
        $columns[] = array('title' => lang_get('th_timestamp'), 'width' => 15);
        $columns[] = array('title' => lang_get('th_loglevel'), 'width' => 15);
        $columns[] = array('title' => lang_get('th_user'), 'width' => 15);
        $columns[] = array('title' => lang_get('th_event_description'), 'type' => 'text');
        $columns[] = array('title' => lang_get('th_transaction'), 'width' => 15, 'hidden' => 'true');
        // Extract the relevant data and build a matrix
        $matrixData = array();
        foreach ($gui->events as $event_key => $event) {
            $transactionID = $event->transactionID;
            $rowData = array();
            // necessary as localize_dateOrTimeStamp expects 2nd parameter to pass by reference
            $dummy = null;
            // use html comment to sort properly by timestamp
            $rowData[] = "<!--{$event->timestamp}-->" . localize_dateOrTimeStamp(null, $dummy, 'timestamp_format', $event->timestamp);
            $rowData[] = $event->getlogLevel();
            if (isset($event->userID)) {
                $rowData[] = $gui->users[$event->userID];
            } else {
                $rowData[] = "";
            }
            $rowData[] = "<a onClick=\"showEventDetails({$event->dbID});\" style=\"cursor: hand; cursor: pointer;\">" . "<img title=\"" . lang_get("show_eventdetails") . "\" src=\"{$show_icon}\" /> </a>" . htmlentities($event->description, ENT_QUOTES, $charset);
            $rowData[] = $event->transactionID;
            $matrixData[] = $rowData;
        }
        $table = new tlExtTable($columns, $matrixData, 'tl_table_eventviewer');
        $table->addCustomBehaviour('text', array('render' => 'columnWrap'));
        $table->setGroupByColumnName(lang_get('th_loglevel'));
        $table->setSortByColumnName(lang_get('th_timestamp'));
        $table->sortDirection = 'DESC';
        $table->showToolbar = true;
        $table->toolbarExpandCollapseGroupsButton = true;
        $table->toolbarShowAllColumnsButton = true;
    }
    return $table;
}
Exemplo n.º 18
0
            //			             $tcasePrefix . $tcases['tc_external_id'] . $titleSeperator .
            //			             strip_tags($tcases['name']);
            switch ($tcases['importance']) {
                case $importance_levels[LOW]:
                    $rowData[] = "<!-- 1 -->" . lang_get('low_importance');
                    break;
                case $importance_levels[MEDIUM]:
                    $rowData[] = "<!-- 2 -->" . lang_get('medium_importance');
                    break;
                case $importance_levels[HIGH]:
                    $rowData[] = "<!-- 3 -->" . lang_get('high_importance');
                    break;
            }
            $matrixData[] = $rowData;
        }
        $table = new tlExtTable($columns, $matrixData, 'tl_table_test_cases_not_assigned_to_any_test_plan');
        $table->setGroupByColumnName(lang_get('test_suite'));
        $table->setSortByColumnName(lang_get('importance'));
        $table->sortDirection = 'DESC';
        $table->showToolbar = true;
        $table->toolbarExpandCollapseGroupsButton = true;
        $table->toolbarShowAllColumnsButton = true;
        $gui->tableSet = array($table);
    }
}
$gui->tproject_name = $args->tproject_name;
$gui->pageTitle = lang_get('report_free_testcases_on_testproject');
$gui->warning_msg = lang_get($msg_key);
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
Exemplo n.º 19
0
/**
 * Builds ext-js rich table to display matrix results
 *
 * @param map dataSet: data to be displayed on matrix
 *
 * return tlExtTable
 *
 */
function buildMatrix($dataSet, &$args, $options = array())
{
    $default_options = array('bugInterfaceOn' => false, 'show_platforms' => false, 'status_not_run' => false, 'format' => FORMAT_HTML);
    $options = array_merge($default_options, $options);
    $columns = array();
    $columns[] = array('title_key' => 'title_test_suite_name', 'width' => 80, 'type' => 'text');
    $columns[] = array('title_key' => 'title_test_case_title', 'width' => 80, 'type' => 'text');
    $columns[] = array('title_key' => 'version', 'width' => 30);
    if ($options['show_platforms']) {
        $columns[] = array('title_key' => 'platform', 'width' => 60);
    }
    if ($options['status_not_run']) {
        $columns[] = array('title_key' => 'th_build', 'width' => 35);
        $columns[] = array('title_key' => 'assigned_to', 'width' => 60);
        $columns[] = array('title_key' => 'summary', 'width' => 150, 'type' => 'text');
    } else {
        $columns[] = array('title_key' => 'th_build', 'width' => 35);
        $columns[] = array('title_key' => 'th_run_by', 'width' => 60);
        $columns[] = array('title_key' => 'th_date', 'width' => 60);
        $columns[] = array('title_key' => 'title_execution_notes', 'width' => 150, 'type' => 'text');
        if ($options['bugInterfaceOn']) {
            $columns[] = array('title_key' => 'th_bugs', 'type' => 'text');
        }
    }
    if ($options['format'] == FORMAT_HTML) {
        $matrix = new tlExtTable($columns, $dataSet, 'tl_table_results_by_status');
        //if not run report: sort by test suite
        //blocked, failed report: sort by platform (if enabled) else sort by date
        $sort_name = 0;
        if ($options['status_not_run']) {
            $sort_name = lang_get('assigned_to');
        } else {
            if ($options['show_platforms']) {
                $sort_name = lang_get('platform');
            } else {
                $sort_name = lang_get('th_date');
            }
        }
        $matrix->setSortByColumnName($sort_name);
        $matrix->setGroupByColumnName(lang_get('th_build'));
        $matrix->addCustomBehaviour('text', array('render' => 'columnWrap'));
        //define table toolbar
        $matrix->showToolbar = true;
        $matrix->toolbarExpandCollapseGroupsButton = true;
        $matrix->toolbarShowAllColumnsButton = true;
    } else {
        $matrix = new tlHTMLTable($columns, $dataSet, 'tl_table_results_by_status');
    }
    return $matrix;
}
Exemplo n.º 20
0
/**
 * Builds ext-js rich table or static HTML table to display matrix results
 *
 * @param $dataSet
 * @param $format
 * @return tlExtTable|tlHTMLTable
 *
 *
 */
function buildMatrix($dataSet, $format)
{
    $columns = array(array('title_key' => 'title_test_suite_name', 'width' => 100), array('title_key' => 'title_test_case_title', 'width' => 150));
    if ($_SESSION['testprojectOptions']->testPriorityEnabled) {
        $columns[] = array('title_key' => 'priority', 'type' => 'priority', 'width' => 40);
    }
    if ($format == FORMAT_HTML) {
        $matrix = new tlExtTable($columns, $dataSet, 'tl_table_results_tc');
        $matrix->setGroupByColumnName(lang_get('title_test_suite_name'));
        $matrix->sortDirection = 'DESC';
        if ($_SESSION['testprojectOptions']->testPriorityEnabled) {
            $matrix->addCustomBehaviour('priority', array('render' => 'priorityRenderer', 'filter' => 'Priority'));
            //sort by priority
            $matrix->setSortByColumnName(lang_get('priority'));
        } else {
            //sort by test case
            $matrix->setSortByColumnName(lang_get('title_test_case_title'));
        }
    } else {
        $matrix = new tlHTMLTable($columns, $dataSet, 'tl_table_results_tc');
    }
    return $matrix;
}
/**
 * 
 *
 */
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;
}
Exemplo n.º 22
0
/**
 * Builds ext-js rich table to display matrix results
 *
 * @param map buildSet: info about all Builds analized
 * @param map dataSet: data to be displayed on matrix
 *
 * return tlExtTable
 *
 */
function buildMatrix($buildSet, $dataSet, $format, $show_platforms, &$args, $platforms)
{
    $columns = array(array('title_key' => 'title_test_suite_name', 'width' => 100), array('title_key' => 'title_test_case_title', 'width' => 150));
    if ($show_platforms) {
        $columns[] = array('title_key' => 'platform', 'width' => 60, 'filter' => 'list', 'filterOptions' => $platforms);
    }
    // BUGID 3418: check if test priority is enabled
    if ($_SESSION['testprojectOptions']->testPriorityEnabled) {
        $columns[] = array('title_key' => 'priority', 'type' => 'priority', 'width' => 40);
    }
    foreach ($buildSet as $build) {
        $columns[] = array('title' => $build['name'], 'type' => 'status', 'width' => 100);
    }
    // BUGID 4341 - add new column for last result
    $columns[] = array('title_key' => 'last_execution', 'type' => 'status', 'width' => 100);
    if ($format == FORMAT_HTML) {
        $matrix = new tlExtTable($columns, $dataSet, 'tl_table_results_tc');
        //if platforms feature is enabled group by platform otherwise group by test suite
        $group_name = $show_platforms ? lang_get('platform') : lang_get('title_test_suite_name');
        $matrix->setGroupByColumnName($group_name);
        $matrix->sortDirection = 'DESC';
        // BUGID 3418: check if test priority is enabled
        if ($_SESSION['testprojectOptions']->testPriorityEnabled) {
            $matrix->addCustomBehaviour('priority', array('render' => 'priorityRenderer', 'filter' => 'Priority'));
            //sort by priority
            $matrix->setSortByColumnName(lang_get('priority'));
        } else {
            //sort by test case
            $matrix->setSortByColumnName(lang_get('title_test_case_title'));
        }
    } else {
        $matrix = new tlHTMLTable($columns, $dataSet, 'tl_table_results_tc');
    }
    return $matrix;
}
Exemplo n.º 23
0
    $row[2] = implode("<br/>", $row[2]);
}
$arrData = array_values($testcase_bugs);
if (count($arrData) > 0) {
    // Create column headers
    $columns = getColumnsDefinition();
    // Extract the relevant data and build a matrix
    $matrixData = array();
    foreach ($arrData as $bugs) {
        $rowData = array();
        $rowData[] = $bugs[0];
        $rowData[] = $bugs[1];
        $rowData[] = $bugs[2];
        $matrixData[] = $rowData;
    }
    $table = new tlExtTable($columns, $matrixData, 'tl_table_bugs_per_test_case');
    $table->setGroupByColumnName(lang_get('title_test_suite_name'));
    $table->setSortByColumnName(lang_get('title_test_case_title'));
    $table->sortDirection = 'ASC';
    $table->showToolbar = true;
    $table->toolbarExpandCollapseGroupsButton = true;
    $table->toolbarShowAllColumnsButton = true;
    $gui->tableSet = array($table);
} else {
    $gui->warning_msg = $l18n['no_linked_bugs'];
}
$totalOpenBugs = count($openBugs);
$totalResolvedBugs = count($resolvedBugs);
$totalBugs = $totalOpenBugs + $totalResolvedBugs;
$totalCasesWithBugs = count($arrData);
$gui->user = $args->user;
Exemplo n.º 24
0
                        $progress_percentage += $percentage;
                    }
                } else {
                    $value = $labels['na'];
                }
                $single_row[] = $value;
            }
            // complete progress
            $single_row[] = $total_count ? comment_percentage($progress_percentage) : $labels['na'];
            $rows[] = $single_row;
        }
    }
    // create unique table id for each project
    $table_id = 'tl_' . $args->tproject_id . '_table_results_reqs';
    // create table object
    $matrix = new tlExtTable($columns, $rows, $table_id);
    $matrix->title = $gui->pageTitle;
    // group by Req Spec and hide that column
    $matrix->setGroupByColumnName(lang_get('req_spec_short'));
    // sort descending by progress percentage
    $matrix->setSortByColumnName(lang_get('progress'));
    $matrix->sortDirection = 'DESC';
    //show long text content in multiple lines
    $matrix->addCustomBehaviour('text', array('render' => 'columnWrap'));
    //define toolbar
    $matrix->toolbarShowAllColumnsButton = true;
    $matrix->showGroupItemsCount = false;
    $gui->tableSet = array($matrix);
}
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
Exemplo n.º 25
0
/**
 * 
 *
 */
function buildExtTable($gui, $charset, $edit_icon, $edit_label)
{
    $table = null;
    if (count($gui->resultSet) > 0) {
        $labels = array('test_suite' => lang_get('test_suite'), 'test_case' => lang_get('test_case'));
        $columns = array();
        $columns[] = array('title' => $labels['test_suite']);
        $columns[] = array('title' => $labels['test_case'], 'type' => 'text');
        // Extract the relevant data and build a matrix
        $matrixData = array();
        $titleSeperator = config_get('gui_title_separator_1');
        foreach ($gui->resultSet as $result) {
            $rowData = array();
            $rowData[] = htmlentities($gui->path_info[$result['testcase_id']], ENT_QUOTES, $charset);
            // build test case link
            //			$rowData[] = "<a href=\"lib/testcases/archiveData.php?edit=testcase&id={$result['testcase_id']}\">" .
            //			             htmlentities($gui->tcasePrefix, ENT_QUOTES, $charset) . $result['tc_external_id'] . $titleSeperator .
            //			             htmlentities($result['name'], ENT_QUOTES, $charset);
            $edit_link = "<a href=\"javascript:openTCEditWindow({$result['testcase_id']});\">" . "<img title=\"{$edit_label}\" src=\"{$edit_icon}\" /></a> ";
            $tcaseName = htmlentities($gui->tcasePrefix, ENT_QUOTES, $charset) . $result['tc_external_id'] . $titleSeperator . htmlentities($result['name'], ENT_QUOTES, $charset);
            $tcLink = $edit_link . $tcaseName;
            $rowData[] = $tcLink;
            $matrixData[] = $rowData;
        }
        $table = new tlExtTable($columns, $matrixData, 'tl_table_test_case_search');
        $table->setGroupByColumnName($labels['test_suite']);
        $table->setSortByColumnName($labels['test_case']);
        $table->sortDirection = 'DESC';
        $table->showToolbar = true;
        $table->allowMultiSort = false;
        $table->toolbarRefreshButton = false;
        $table->toolbarShowAllColumnsButton = false;
        $table->addCustomBehaviour('text', array('render' => 'columnWrap'));
        // dont save settings for this table
        $table->storeTableState = false;
    }
    return $table;
}
Exemplo n.º 26
0
        $rowData[] = strip_tags($item['exec_notes']);
        if ($item['exec_notes']) {
            $hasValue = true;
        }
        foreach ($item['cfields'] as $cf_value) {
            $rowData[] = preg_replace('!\\s+!', ' ', htmlspecialchars($cf_value, ENT_QUOTES, $charset));
            if ($cf_value) {
                $hasValue = true;
            }
        }
        if ($hasValue) {
            $matrixData[] = $rowData;
        }
    }
    if (count($matrixData) > 0) {
        $table = new tlExtTable($columns, $matrixData, 'tl_table_tc_with_cf');
        $table->addCustomBehaviour('status', array('render' => 'statusRenderer'));
        $table->addCustomBehaviour('text', array('render' => 'columnWrap'));
        $table->setGroupByColumnName(lang_get('build'));
        $table->setSortByColumnName(lang_get('date'));
        $table->sortDirection = 'DESC';
        $table->showToolbar = true;
        $table->toolbarExpandCollapseGroupsButton = true;
        $table->toolbarShowAllColumnsButton = true;
        $gui->tableSet = array($table);
    } else {
        $gui->warning_msg = $labels['no_linked_tc_cf'];
    }
}
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
Exemplo n.º 27
0
            $executed_vs_active_string = "<!-- 0 -->0";
            if ($platform_metric['executed_vs_active'] > 0) {
                $percentage_comment = sprintf("%010d", $platform_metric['executed_vs_active']);
                $executed_vs_active_string = "<!-- {$percentage_comment} -->" . $platform_metric['executed_vs_active'];
            }
            $rowData[] = $executed_vs_active_string;
            $executed_vs_total_string = "<!-- 0 -->0";
            if ($platform_metric['executed_vs_total'] > 0) {
                $percentage_comment = sprintf("%010d", $platform_metric['executed_vs_total']);
                $executed_vs_total_string = "<!-- {$percentage_comment} -->" . $platform_metric['executed_vs_total'];
            }
            $rowData[] = $executed_vs_total_string;
            $matrixData[] = $rowData;
        }
    }
    $table = new tlExtTable($columns, $matrixData, 'tl_table_metrics_dashboard');
    //if platforms are to be shown -> group by test plan
    // if no platforms are to be shown -> no grouping
    if ($gui->show_platforms) {
        $table->setGroupByColumnName(lang_get('test_plan'));
    }
    $table->setSortByColumnName(lang_get('th_executed_vs_active'));
    $table->sortDirection = 'DESC';
    $table->showToolbar = true;
    $table->toolbarExpandCollapseGroupsButton = true;
    $table->toolbarShowAllColumnsButton = true;
    $table->title = lang_get("href_metrics_dashboard");
    $gui->tableSet = array($table);
} else {
    $gui->warning_msg = lang_get('no_testplans_available');
}
Exemplo n.º 28
0
/**
 * 
 *
 */
function buildExtTable($gui, $charset, $edit_icon, $edit_label)
{
    $table = null;
    if (count($gui->resultSet) > 0) {
        $labels = array('req_spec' => lang_get('req_spec'), 'requirement' => lang_get('requirement'));
        $columns = array();
        $columns[] = array('title' => $labels['req_spec']);
        $columns[] = array('title' => $labels['requirement'], 'type' => 'text');
        // Extract the relevant data and build a matrix
        $matrixData = array();
        foreach ($gui->resultSet as $result) {
            $rowData = array();
            $rowData[] = htmlentities($gui->path_info[$result['id']], ENT_QUOTES, $charset);
            // build requirement link
            $edit_link = "<a href=\"javascript:openLinkedReqWindow(" . $result['id'] . ")\">" . "<img title=\"{$edit_label}\" src=\"{$edit_icon}\" /></a> ";
            $title = htmlentities($result['req_doc_id'], ENT_QUOTES, $charset) . ":" . htmlentities($result['name'], ENT_QUOTES, $charset);
            $link = $edit_link . $title;
            $rowData[] = $link;
            //			$rowData[] = "<a href=\"lib/requirements/reqView.php?item=requirement&requirement_id={$result['id']}\">" .
            //			             htmlentities($result['req_doc_id'], ENT_QUOTES, $charset) . ":" .
            //			             htmlentities($result['name'], ENT_QUOTES, $charset);
            $matrixData[] = $rowData;
        }
        $table = new tlExtTable($columns, $matrixData, 'tl_table_req_search');
        $table->setGroupByColumnName($labels['req_spec']);
        $table->setSortByColumnName($labels['requirement']);
        $table->sortDirection = 'DESC';
        $table->showToolbar = true;
        $table->allowMultiSort = false;
        $table->toolbarRefreshButton = false;
        $table->toolbarShowAllColumnsButton = false;
        $table->addCustomBehaviour('text', array('render' => 'columnWrap'));
        // dont save settings for this table
        $table->storeTableState = false;
    }
    return $table;
}
Exemplo n.º 29
0
                $current_row[] = array("value" => $status, "text" => $map_statuscode_css[$status]['translation'], "cssClass" => $map_statuscode_css[$status]['css_class']);
                $current_row[] = $tcase['creation_ts'];
                $current_row[] = $tcase['modification_ts'];
                // add this row to the others
                $rows[] = $current_row;
            }
        }
        /* different table id for different reports:
         * - Assignment Overview if $args->show_all_users is set
         * - Test Cases assigned to user if $args->build_id > 0
         * - Test Cases assigned to me else
         */
        $table_id = "tl_table_tc_assigned_to_me_for_tplan_";
        // add test plan id to table id
        $table_id .= $tplan_id;
        $matrix = new tlExtTable($columns, $rows, $table_id);
        $matrix->title = $l18n['testplan'] . ": " . htmlspecialchars($gui->tplanNames[$tplan_id]['name']);
        // default grouping by first column, which is user for overview, build otherwise
        $matrix->setGroupByColumnName(lang_get($columns[0]['title_key']));
        // make table collapsible if more than 1 table is shown and surround by frame
        if (count($tplanSet) > 1) {
            $matrix->collapsible = true;
            $matrix->frame = true;
        }
        $matrix->setSortByColumnName($sortByColumn);
        $matrix->sortDirection = 'DESC';
        $gui->tableSet[$tplan_id] = $matrix;
    }
}
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
            $rowData = array();
            $rowData[] = strip_tags($tsuites[$tcases['id']]);
            $rowData[] = "<!-- " . sprintf("%010d", $tcases['tc_external_id']) . " -->" . "<a href=\"javascript:openTCEditWindow({$tcases['id']});\">" . "<img title=\"{$l18n['design']}\" src=\"{$edit_img}\" /></a> " . $tcasePrefix . $tcases['tc_external_id'] . ':' . strip_tags($tcases['name']);
            // only add importance column if
            if ($priorityMgmtEnabled) {
                $rowData[] = $impCols[$tcases['importance']];
            }
            $matrixData[] = $rowData;
        }
        // Time tracking
        //$chronos[] = microtime(true);$tnow = end($chronos);$tprev = prev($chronos);
        //$t_elapsed_abs = number_format( $tnow - $tstart, 4);
        //$t_elapsed = number_format( $tnow - $tprev, 4);
        //echo '<br>' . __FUNCTION__ . ' Elapsed relative (sec):' . $t_elapsed . ' Elapsed ABSOLUTE (sec):' . $t_elapsed_abs .'<br>';
        //reset($chronos);
        $table = new tlExtTable($columns, $matrixData, 'tl_table_test_cases_not_assigned_to_any_test_plan');
        $table->setGroupByColumnName($l18n['test_suite']);
        $table->setSortByColumnName(lang_get($priorityMgmtEnabled ? 'importance' : 'test_case'));
        $table->sortDirection = 'DESC';
        $table->showToolbar = true;
        $table->toolbarExpandCollapseGroupsButton = true;
        $table->toolbarShowAllColumnsButton = true;
        $gui->tableSet = array($table);
    }
}
$gui->tproject_name = $args->tproject_name;
$gui->pageTitle = lang_get('report_free_testcases_on_testproject');
$gui->warning_msg = lang_get($msg_key);
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);