/** * * */ 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; }
} } 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); /** * Builds a descriptive string which will be added to the grouping column of the ExtJS table * for each req spec to see information about the requirements in this spec and their status. * * @author Andreas Simon * @param array $evalcode_status_map * @param array $spec_info
/** * 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; }
/** * 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; }
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; }
/** * * */ 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; }
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); $smarty->display($templateCfg->template_dir . $templateCfg->default_template);
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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
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; } }
/** * * */ 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; }
/** * * */ 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; }
/** * * */ 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; }
/** * * */ 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; }
/** * * */ 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; }