Example #1
0
function renderTestSuiteNodeForPrinting(&$db, &$node, &$options, $tocPrefix, $level, $tplan_id, $tproject_id)
{
    static $tsuite_mgr;
    $labels = array('test_suite' => lang_get('test_suite'), 'details' => lang_get('details'));
    $code = null;
    $name = isset($node['name']) ? htmlspecialchars($node['name']) : '';
    $title_separator = config_get('gui_title_separator_1');
    $cfields = array('design' => '');
    $cfieldFormatting = array('table_css_style' => 'class="cf"');
    $docHeadingNumbering = '';
    if ($options['headerNumbering']) {
        $docHeadingNumbering = "{$tocPrefix}. ";
    }
    if ($options['toc']) {
        $spacing = $level == 2 && $tocPrefix != 1 ? "<br>" : "";
        $options['tocCode'] .= $spacing . '<b><p style="padding-left: ' . 10 * $level . 'px;">' . '<a href="#' . prefixToHTMLID($tocPrefix) . '">' . $docHeadingNumbering . $name . "</a></p></b>\n";
        $code .= "<a name='" . prefixToHTMLID($tocPrefix) . "'></a>\n";
    }
    $docHeadingLevel = $level - 1;
    //we would like to have html top heading H1 - H6
    $docHeadingLevel = $docHeadingLevel > 6 ? 6 : $docHeadingLevel;
    $code .= "<h{$docHeadingLevel} class='doclevel'>" . $docHeadingNumbering . $labels['test_suite'] . $title_separator . $name . "</h{$docHeadingLevel}>\n";
    // ----- get Test Suite text -----------------
    if ($options['header']) {
        if (!$tsuite_mgr) {
            $tsuite_mgr = new testsuite($db);
        }
        $tInfo = $tsuite_mgr->get_by_id($node['id']);
        if ($tInfo['details'] != '') {
            $code .= '<div>' . $tInfo['details'] . '</div>';
        }
        // get Custom fields
        // Attention: for test suites custom fields can not be edited during execution,
        //            then we need to get just custom fields with scope  'design'
        foreach ($cfields as $key => $value) {
            $cfields[$key] = $tsuite_mgr->html_table_of_custom_field_values($node['id'], $key, null, $tproject_id, $cfieldFormatting);
            if ($cfields[$key] != "") {
                $add_br = true;
                $code .= '<p>' . $cfields[$key] . '</p>';
            }
        }
    }
    return $code;
}
Example #2
0
function smarty_assign_tsuite_info(&$smarty, &$request_hash, &$db, &$tree_mgr, $tcase_id, $tproject_id)
{
    $fpath = $tree_mgr->get_full_path_verbose($tcase_id, array('output_format' => 'id_name'));
    $tsuite_info = get_ts_name_details($db, $tcase_id);
    foreach ($fpath as $key => $value) {
        unset($value['name'][0]);
        // Remove test plan name
        unset($value['node_id'][0]);
        // Remove test plan name
        $str = '';
        foreach ($value['name'] as $jdx => $elem) {
            $str .= "<a href=\"javascript:openTestSuiteWindow(" . $value['node_id'][$jdx] . ")\"> ";
            $str .= htmlentities($elem) . '</a>/';
        }
        $tsuite_info[$key]['tsuite_name'] = $str;
    }
    $smarty->assign('tsuite_info', $tsuite_info);
    // --------------------------------------------------------------------------------
    if (!is_null($tsuite_info)) {
        $cookieKey = 'TL_execSetResults_tsdetails_view_status';
        $exec_cfg = config_get('exec_cfg');
        $a_tsvw = array();
        $a_ts = array();
        $a_tsval = array();
        $tsuite_mgr = new testsuite($db);
        foreach ($tsuite_info as $key => $elem) {
            $main_k = 'tsdetails_view_status_' . $key;
            $a_tsvw[] = $main_k;
            $a_ts[] = 'tsdetails_' . $key;
            $expand_collapse = 0;
            if (!isset($request_hash[$main_k])) {
                // First time we are entered here => we can need to understand how to proceed
                switch ($exec_cfg->expand_collapse->testsuite_details) {
                    case LAST_USER_CHOICE:
                        if (isset($_COOKIE[$cookieKey])) {
                            $expand_collapse = $_COOKIE[$cookieKey];
                        }
                        break;
                    default:
                        $expand_collapse = $exec_cfg->expand_collapse->testsuite_details;
                        break;
                }
            }
            $a_tsval[] = isset($request_hash[$main_k]) ? $request_hash[$main_k] : $expand_collapse;
            $tsuite_id = $elem['tsuite_id'];
            $tc_id = $elem['tc_id'];
            if (!isset($cached_cf[$tsuite_id])) {
                $cached_cf[$tsuite_id] = $tsuite_mgr->html_table_of_custom_field_values($tsuite_id, 'design', null, $tproject_id);
            }
            $ts_cf_smarty[$tc_id] = $cached_cf[$tsuite_id];
        }
        if (count($a_tsval) > 0) {
            setcookie($cookieKey, $a_tsval[0], TL_COOKIE_KEEPTIME, '/');
        }
        $smarty->assign('tsd_div_id_list', implode(",", $a_ts));
        $smarty->assign('tsd_hidden_id_list', implode(",", $a_tsvw));
        $smarty->assign('tsd_val_for_hidden_list', implode(",", $a_tsval));
        $smarty->assign('ts_cf_smarty', $ts_cf_smarty);
    }
}
Example #3
0
function renderTestSuiteNodeForPrinting(&$db, &$node, $env, &$options, $context)
{
    static $tsuite_mgr;
    static $labels;
    static $title_separator;
    static $cfieldFormatting;
    if (!is_null($labels)) {
        $labels = array('test_suite' => lang_get('test_suite'), 'details' => lang_get('details'));
        $title_separator = config_get('gui_title_separator_1');
        $cfieldFormatting = array('table_css_style' => 'class="cf"');
    }
    $code = null;
    $name = isset($node['name']) ? htmlspecialchars($node['name']) : '';
    $cfields = array('design' => '');
    $docHeadingNumbering = $options['headerNumbering'] ? $env->tocPrefix . "." : '';
    if ($options['toc']) {
        $spacing = $context['level'] == 2 && $env->tocPrefix != 1 ? "<br>" : "";
        $options['tocCode'] .= $spacing . '<b><p style="padding-left: ' . 10 * $context['level'] . 'px;">' . '<a href="#' . prefixToHTMLID($env->tocPrefix) . '">' . $docHeadingNumbering . $name . "</a></p></b>\n";
        $code .= "<a name='" . prefixToHTMLID($context['prefix']) . "'></a>\n";
    }
    $docHeadingLevel = $context['level'] - 1;
    //we would like to have html top heading H1 - H6
    $docHeadingLevel = $docHeadingLevel > 6 ? 6 : $docHeadingLevel;
    $code .= "<h{$docHeadingLevel} class='doclevel'>" . $docHeadingNumbering . $labels['test_suite'] . $title_separator . $name . "</h{$docHeadingLevel}>\n";
    // ----- get Test Suite text -----------------
    if ($options['header']) {
        if (!$tsuite_mgr) {
            $tsuite_mgr = new testsuite($db);
        }
        $tInfo = $tsuite_mgr->get_by_id($node['id']);
        if ($tInfo['details'] != '') {
            $code .= '<div>' . $tInfo['details'] . '</div>';
        }
        $attachSet = (array) $tsuite_mgr->getAttachmentInfos($node['id']);
        if (count($attachSet) > 0) {
            $code .= "<table>";
            $code .= "<tr><td><span class=\"label\">" . $labels['attached_files'] . "</span></td><td><ul>";
            foreach ($attachSet as $item) {
                $fname = "";
                if ($item['title']) {
                    $fname .= htmlspecialchars($item['title']) . " : ";
                }
                $fname .= htmlspecialchars($item['file_name']);
                $code .= "<li>{$fname}</li>";
                if ($item['is_image']) {
                    $code .= '<li>' . '<img src="' . $env->base_href . 'lib/attachments/attachmentdownload.php?skipCheck=1&id=' . $item['id'] . '"> </li>';
                }
            }
            $code .= "</ul></td></tr>";
            $code .= "</table>";
        }
        // get Custom fields
        // Attention: for test suites custom fields can not be edited during execution,
        //            then we need to get just custom fields with scope  'design'
        foreach ($cfields as $key => $value) {
            $cfields[$key] = $tsuite_mgr->html_table_of_custom_field_values($node['id'], $key, null, $context['tproject_id'], $cfieldFormatting);
            if ($cfields[$key] != "") {
                $add_br = true;
                $code .= '<p>' . $cfields[$key] . '</p>';
            }
        }
    }
    return $code;
}
function renderTestSuiteNodeForPrinting(&$db, &$node, $env, &$options, $context, $tocPrefix, $indentLevel)
{
    static $tsuite_mgr;
    static $l10n;
    static $title_separator;
    static $cfieldFormatting;
    static $getOpt;
    if (is_null($l10n)) {
        $tsuite_mgr = new testsuite($db);
        $l10n = array('test_suite' => 'test_suite', 'details' => 'details', 'attached_files' => 'attached_files');
        $l10n = init_labels($l10n);
        $title_separator = config_get('gui_title_separator_1');
        $cfieldFormatting = array('table_css_style' => 'class="cf"');
        $getOpt['getByID'] = array('fields' => ' TS.id,TS.details ', 'renderImageInline' => true);
    }
    $code = null;
    $name = isset($node['name']) ? htmlspecialchars($node['name']) : '';
    $cfields = array('design' => '');
    $docHeadingNumbering = $options['headerNumbering'] ? $tocPrefix . "." : '';
    if ($options['toc']) {
        $spacing = $indentLevel == 2 && $tocPrefix != 1 ? "<br>" : "";
        $options['tocCode'] .= $spacing . '<b><p style="padding-left: ' . 10 * $indentLevel . 'px;">' . '<a href="#' . prefixToHTMLID($tocPrefix) . '">' . $docHeadingNumbering . $name . "</a></p></b>\n";
        $code .= "<a name='" . prefixToHTMLID($context['prefix']) . "'></a>\n";
    }
    // we would like to have html top heading H1 - H6
    $docHeadingLevel = $indentLevel - 1;
    // Remember that only H1 to H6 exists
    $docHeadingLevel = $docHeadingLevel > 6 ? 6 : $docHeadingLevel;
    $docHeadingLevel = $docHeadingLevel < 1 ? 1 : $docHeadingLevel;
    $code .= "<h{$docHeadingLevel} class='doclevel'>" . $docHeadingNumbering . $l10n['test_suite'] . $title_separator . $name . "</h{$docHeadingLevel}>\n";
    // ----- get Test Suite text -----------------
    if ($options['header']) {
        $tInfo = $tsuite_mgr->get_by_id($node['id'], $getOpt['getByID']);
        if ($tInfo['details'] != '') {
            $code .= '<div>' . $tInfo['details'] . '</div>';
        }
        $tInfo = null;
        $attachSet = (array) $tsuite_mgr->getAttachmentInfos($node['id']);
        if (count($attachSet) > 0) {
            $code .= '<table><caption style="text-align:left;">' . $l10n['attached_files'] . '</caption>';
            $code .= '<tr><td>&nbsp</td>';
            $code .= '<td><ul>';
            foreach ($attachSet as $item) {
                $fname = "";
                if ($item['title']) {
                    $fname .= htmlspecialchars($item['title']) . " : ";
                }
                $fname .= htmlspecialchars($item['file_name']);
                $code .= "<li>{$fname}</li>";
                if ($item['is_image']) {
                    $code .= '<li>' . '<img src="' . $env->base_href . 'lib/attachments/attachmentdownload.php?skipCheck=1&id=' . $item['id'] . '"> </li>';
                } else {
                    $code .= '<li>' . '<a href="' . $env->base_href . 'lib/attachments/attachmentdownload.php?skipCheck=1&id=' . $item['id'] . '" ' . ' target="#blank" > ' . htmlspecialchars($item['file_name']) . '</a></li>';
                }
            }
            $code .= "</ul></td></tr>";
            $code .= "</table>";
        }
        $attachSet = null;
        // get Custom fields
        // Attention: for test suites custom fields can not be edited during execution,
        //            then we need to get just custom fields with scope  'design'
        foreach ($cfields as $key => $value) {
            $cfields[$key] = $tsuite_mgr->html_table_of_custom_field_values($node['id'], $key, null, $context['tproject_id'], $cfieldFormatting);
            if ($cfields[$key] != "") {
                $add_br = true;
                $code .= '<p>' . $cfields[$key] . '</p>';
            }
        }
        $cfields = null;
    }
    return $code;
}
$version_exec_assignment=$tsuite_mgr->get_version_exec_assignment($tcversion_id,$tplan_id);
new dBug($version_exec_assignment);
*/
echo "<pre> testsuite - get_linked_cfields_at_design(\$id,\$parent_id=null,\$show_on_execution=null)";
echo "</pre>";
echo "<pre>            get_linked_cfields_at_design({$tsuite_id})";
echo "</pre>";
$linked_cfields_at_design = $tsuite_mgr->get_linked_cfields_at_design($tsuite_id);
new dBug($linked_cfields_at_design);
echo "<pre> testsuite - get_linked_cfields_at_execution(\$id,\$parent_id=null,<br>\r\n                                                       \$show_on_execution=null,<br>\r\n                                                       \$execution_id=null,\$testplan_id=null)";
echo "</pre>";
echo "<pre>            get_linked_cfields_at_execution({$tsuite_id})";
echo "</pre>";
$linked_cfields_at_execution = $tsuite_mgr->get_linked_cfields_at_execution($tsuite_id);
new dBug($linked_cfields_at_execution);
echo "<pre> testsuite - html_table_of_custom_field_inputs(\$id,\$parent_id=null,\$scope='design',\$name_suffix='')";
echo "</pre>";
echo "<pre>            html_table_of_custom_field_inputs({$tsuite_id})";
echo "</pre>";
$table_of_custom_field_inputs = $tsuite_mgr->html_table_of_custom_field_inputs($tsuite_id);
echo "<pre>";
echo $table_of_custom_field_inputs;
echo "</pre>";
echo "<pre> testsuite - html_table_of_custom_field_values(\$id,\$scope='design',<br>\r\n                                                         \$show_on_execution=null,<br>\r\n                                                         \$execution_id=null,\$testplan_id=null) ";
echo "</pre>";
echo "<pre> testsuite - html_table_of_custom_field_values({$tsuite_id})";
echo "</pre>";
$table_of_custom_field_values = $tsuite_mgr->html_table_of_custom_field_values($tsuite_id);
echo "<pre><xmp>";
echo $table_of_custom_field_values;
echo "</xmp></pre>";