Jump to content

Page numbering help


monsieur_jj

Recommended Posts

Hi all,

 

Can anyone help me how to put page numbers for my table of contents? Lets say my queries have no exact length, how can I be able to compute for that?

Below is my full code for producing the rtf. What this produces is a documentation so naturally some characters will have to be bigger than others and there are different headings and a picture is included in the production. Can anyone give me a slight idea where/what I can modify to make the table of contents with pages.

 

for example

TestCases.....1

TestCasesII...2

TestCasesIII..3

TestCasesIV..12

TestCasesV...19

 

<?php

 

function printHeader($title, $base_href, $cssTemplate = TL_DOC_BASIC_CSS)

{

   $output = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n";

   $output .= "<html>\n<head>\n";

   $output .= '<meta http-equiv="Content-Type" content="text/html; charset='.TL_TPL_CHARSET.'" />';

   $output .= '<title>' . htmlspecialchars($title). "</title>\n";

   $output .= '<link type="text/css" rel="stylesheet" href="' . $base_href . $cssTemplate . '" />';

   $output .= '<style type="text/css" media="print">.notprintable { display:none;}</style>';

   $output .= "\n</head>\n<body>\n";

 

   return $output;

}

function printFirstPage(&$db,$title, $prodName, $prodNotes, $userID, $tplan_name="")

{

   

   tLog("printFirstPage called (TPlan=".$tplan_name.")");

   $g_date_format = config_get('date_format');

   $prodName = htmlspecialchars($prodName);

   

   $author = htmlspecialchars(getUserName($db,$userID));

       

   $title = htmlspecialchars($title);

   

   $output = '<div>';

   $output .= '<div class="groupBtn" style="text-align:right"><input class="notprintable" type="button" name="print" value="'.lang_get('btn_print').'" onclick="javascript: print();" style="margin-left:2px;" /></div>';

 

   $output .= '<div class="pageheader">'. $prodName ."</div>\n";

   

   if (TL_DOC_COMPANY != '' ||  TL_DOC_COMPANY_LOGO != '' )

   {

      $output .= '<br /><center><table class="company">';

 

        if (TL_DOC_COMPANY != '' )

        {

         $output .= '<tr><td id="company_name">'. htmlspecialchars(TL_DOC_COMPANY) ."</td></tr>";

      }

      $output .= '<tr><td/></tr>';

       

        if (TL_DOC_COMPANY_LOGO != '' )

      {

         $output .= '<tr><td id="company_logo">'.

                str_replace('%BASE_HREF%',$_SESSION['basehref'],TL_DOC_COMPANY_LOGO) ."</td></tr>";

      }

      $output .= "</table></center>\n";

   }

   

   $output .= "</div>\n";

 

   if ($tplan_name != "")

   {

      $output .= '<p style="margin-top:100px; font-size:16; text-align: center; font-weight: bold;">'. $title."</h1>\n";

      $output .= '<p style="margin-bottom:300px; font-size:16; text-align: center; font-weight: bold;">'. lang_get('test_plan').": " .$tplan_name."</h1>\n";

   } else {

      $output .= '<h1 id="doctitle" style="margin-bottom:1000px;">'.$title."</h1>\n";

   }

   $output .= '<div id="summary">' .

               '<p id="prodname">'. lang_get('product').": " . $prodName . "</p>\n";

 

   if (strlen($prodNotes))

      $output .= '<p id="prodnotes">'. $prodNotes . "</p>\n";

             

   $output .= '<p id="author">' . lang_get('author').": " . $author . "</p>\n" .

               '<p id="printedby">' . lang_get('printed_by_TestLink_on')." ".

               strftime($g_date_format, time()) . "</p></div>\n";

 

   if (TL_DOC_COPYRIGHT != '')

      $output .= '<div class="pagefooter" id="copyright">'.htmlspecialchars(TL_DOC_COPYRIGHT)."</div>\n";

   if (TL_DOC_CONFIDENT != '')

      $output .= '<div class="pagefooter" id="confidential" style="margin-bottom:600px;">'.htmlspecialchars(TL_DOC_CONFIDENT)."</div>\n";

 

   return $output;

}

 

function renderTestSpecTreeForPrinting(&$db,&$printingOptions,&$node,$tocPrefix,$tcCnt,$level,$tplan_id=0,$tplan_name="")

{

 

  tLog("renderTestSpecTreeForPrinting called (TPlan=".$tplan_name.")");

  $tree_mgr = new tree($db);

  $map_id_descr = array_flip($tree_mgr->get_available_node_types());

 

   $code = null;

   $bCloseTOC = 0;   

   if (isset($node['node_type_id']))

   {

        $verbose_node_type = $map_id_descr[$node['node_type_id']];

      switch($verbose_node_type)

      {

         case 'testproject':

            $code .= renderProjectNodeForPrinting($db,$printingOptions,$printingOptions['title'],$node,$tplan_name);

            break;

               

         case 'testsuite':

            if (!is_null($tocPrefix))

               $tocPrefix .= ".";

            $tocPrefix .= $tcCnt;

            $code .= renderTestSuiteNodeForPrinting($db,$printingOptions,$node,$tocPrefix,$level);

            break;

         

         case 'testcase':

            $code .= renderTestCaseForPrinting($db,$printingOptions,$node,$level,$tplan_id);

            break;

      }

   }

   if (isset($node['childNodes']) && $node['childNodes'])

   {

      $childNodes = $node['childNodes'];

      $tsCnt = 0;

    $children_qty=sizeof($childNodes);

      for($i = 0;$i <$children_qty ;$i++)

      {

         $current = $childNodes[$i];

         if(is_null($current))

            continue;

         

         if (isset($current['node_type_id']) && $map_id_descr[$current['node_type_id']] == 'testsuite')

            $tsCnt++;

         $code .= renderTestSpecTreeForPrinting($db,$printingOptions,$current,$tocPrefix,$tsCnt,$level+1,$tplan_name);

      }

   }

   if (isset($node['node_type_id']) && $map_id_descr[$node['node_type_id']] == 'testproject')

   {

      if ($printingOptions['toc'])

      {

         $printingOptions['tocCode'] .= '</div><hr />';   

         $code = str_replace("{{INSERT_TOC}}",$printingOptions['tocCode'],$code);

      }

      $code .= "</body></html>";

   }

       

   return $code;

}

 

function renderTestCaseForPrinting(&$db,&$printingOptions,&$node,$level,$tplan_id=0)

{

 

    $id = $node['id'];

   $name = htmlspecialchars($node['name']);

   

   $code = null;

  $tc_mgr = null;

  $tcInfo = null;

 

  $versionID = isset($node['tcversion_id']) ? $node['tcversion_id'] : TC_LATEST_VERSION;

       

   if( $printingOptions['body'] || $printingOptions['summary'] ||

       $printingOptions['author'] )

   {

      $tc_mgr = new testcase($db);

    $tcInfo = $tc_mgr->get_by_id($id,$versionID);

 

     if ($tcInfo)

      {

       $tcInfo=$tcInfo[0];

     }

   

   }   

 

   

   if ($printingOptions['toc'])

   {

 

     $printingOptions['tocCode']  .= '<p style="margin-left: '.(15*$level).'px;"><a href="#tc' . $id . '">' .

                          $name . '</a></p>';

      $code .= "<a name='tc" . $id . "'></a>";

   }

   

 

 

  $code .= "<div class=\"tc\"><h3>".lang_get('test_case')." " . $id . ": " . $name . "</h3><table class=\"tc\" width=\"90%\">";

 

             

   

 

  if ($printingOptions['body'] || $printingOptions['summary'])

   {

      if ($tcInfo)

      {

         if ($printingOptions['summary'])

            $code .= "<tr><td colspan=\"2\"><u>".lang_get('summary')."</u>: " .  $tcInfo['summary'] . "</td></tr>";

         if ($printingOptions['body'])

         {

               $code .= "<tr><td colspan=\"2\"><u>".lang_get('steps')."</u>:<br />" .  $tcInfo['steps'] . "</td></tr>";

               $code .= "<tr><td colspan=\"2\"><u>".lang_get('expected_results')."</u>:<br />" .  $tcInfo['expected_results'] . "</td></tr>";

         }

         if ($printingOptions['passfail'])

         {

 

 

$testplan_id2 = $_SESSION['testPlanId'];

$id2 = $id+=1;

 

         $query = mysql_query("SELECT status, execution_ts, notes FROM executions

where tcversion_id = $id2

and testplan_id = $testplan_id2

and execution_ts = (select MAX(execution_ts) from executions

where tcversion_id = $id2

and testplan_id = $testplan_id2

group by tcversion_id, testplan_id)");

 

 

         $result = mysql_fetch_assoc($query);

 

    if (!$result) {

      $tcstatus2 = 'not run';

      $tcnotes2 = '';

    }else{

      $tcstatus2 = $result['status'];

      $tcnotes2 = $result['notes'];

   }

 

if ($tcstatus2 == 'p'){$tcstatus2 = '<FONT COLOR=\"#000000\"><b>passed</b></FONT>';}

if ($tcstatus2 == 'b'){$tcstatus2 = '<FONT COLOR=\"#000000\">blocked</FONT>';}

if ($tcstatus2 == 'f'){$tcstatus2 = '<FONT COLOR=\"#000000\">failed</FONT>';}

 

 

            $code .= "<tr><td width=\"20%\" valign=\"top\"><u>".lang_get('passfail')."</u>:<br /><br />".$tcstatus2."</td><td><u>".

            lang_get('testnotes')."</u>:<br /><br />".$tcnotes2."<br /></td></tr>";

         }

      }

   }

 

  if ($printingOptions['author'])

  {   

     $authorName = getUserName($db, $tcInfo['author_id']);

     $code .= '<tr><td colspan="2"><b>' . lang_get("author") . " </b>" . $authorName . "</td></tr>";

  }

 

   $code .= "</table></div><br />";

 

  if( !is_null($tc_mgr) )

   {

     unset($tc_mgr);

   }

   

   

   return $code;

}

 

function renderProjectNodeForPrinting(&$db,&$printingOptions,$title,&$node, $tplan_name)

{

   $stitle = lang_get('title_test_spec');

   if (strlen($title))

      $stitle .= " - " . $title;

   

   $my_userID = isset($_SESSION['userID']) ? intval($_SESSION['userID']) : null;

 

   $tproject = new testproject($db);

   $projectData = $tproject->get_by_id($node['id']);

   unset($tproject);

   $code = printHeader($stitle,$_SESSION['basehref']);

   $code .= printFirstPage($db,$stitle, $projectData['name'], $projectData['notes'], $my_userID, $tplan_name);

 

   $printingOptions['toc_numbers'][1] = 0;

   if ($printingOptions['toc'])

   {

      $printingOptions['tocCode'] = '<div class="toc"><center><h2>'.lang_get('title_toc').'</h2></center>';

      $code .= "{{INSERT_TOC}}";

   }

   

   return $code;

}

 

function renderTestSuiteNodeForPrinting(&$db,&$printingOptions,&$node,$tocPrefix,$level)

{

   $code = null;

   $name = isset($node['name']) ? htmlspecialchars($node['name']) : '';

   if ($printingOptions['toc'])

   {

 

       $printingOptions['tocCode'] .= '<p style="margin-left: '.(10*$level).'px;"><a href="#cat' . $node['id'] . '">' .

                        $name . '</a></p>';

      $code .= "<a name='cat{$node['id']}'></a>";

   }

    $code .= "<center><h2> ".lang_get('test_suite') ." {$name}</h2></center>"; //removed tocPrefix

                   

   if ($printingOptions['header'])

     {

      $tsuite = new testsuite($db);

      $tInfo = $tsuite->get_by_id($node['id']);

      unset($tsuite);

       $code .= "<h2> ".lang_get('details'). //removed tocPrefix

             "</h2><div>{$tInfo['details']}</div><br />";

    }

   

   return $code;

}

?>

Link to comment
Share on other sites

With an RTF file, yes, I believe so. Assuming PHP could access the following:

- The margins

- The page size

 

I don't see how PHP could determine where the page breaks are created in the document - and thus the number of pages and what content is on which page. The page breaks are "dynamic" in that they are determined by the document reading the file. They are not embedded in the file where they can be read by PHP.

Link to comment
Share on other sites

With an RTF file, yes, I believe so. Assuming PHP could access the following:

- The margins

- The page size

 

I don't see how PHP could determine where the page breaks are created in the document - and thus the number of pages and what content is on which page. The page breaks are "dynamic" in that they are determined by the document reading the file. They are not embedded in the file where they can be read by PHP.

 

Thank you Sir for the reply.

 

What should be changed in the document in order to find out how many pages are there?

Link to comment
Share on other sites

Offhand, I can't think of any good solutions because of the same reasons listed above. In addition, the table of contents traditionally goes at the beginning of the document. There are two problems associated with that: 1) How to get the table of contents at the beginning of the content after it is created (since you need to create the content first to determine the pages - if possible, and 2) without knowing beforehand how long the table of contents is you could not determine what page the content starts on. And with most content types I can think of the pagination is determined by the rendering application. E.g. if you and I have different margins for Notepad we would have different page breaks for the same content.

 

One "possible" solution would be to create the content in PDF form. I have not used PHPs PDF creation functions, but I used to work for a company that created dynamically generated PDFs through a web interface. However, in that environment we used PostScript programming to generate the PDFs and with PostScript the code can determine the exact position on the page as each line of text is "written" and the code is responsible for creating the page breaks - not the rendering application. If the PHP PDF functions have that capability it would be possible, but it would be more complex than it is now as you need to control the position of every piece of text - including line-breaks, pagination, etc.

 

Even then, I'm not sure if it would be possible to append the table of contents to the beginning of the document after the content pages are generated. You might have to settle with putting the TOC at the end of the document.

Link to comment
Share on other sites

Offhand, I can't think of any good solutions because of the same reasons listed above. In addition, the table of contents traditionally goes at the beginning of the document. There are two problems associated with that: 1) How to get the table of contents at the beginning of the content after it is created (since you need to create the content first to determine the pages - if possible, and 2) without knowing beforehand how long the table of contents is you could not determine what page the content starts on. And with most content types I can think of the pagination is determined by the rendering application. E.g. if you and I have different margins for Notepad we would have different page breaks for the same content.

 

One "possible" solution would be to create the content in PDF form. I have not used PHPs PDF creation functions, but I used to work for a company that created dynamically generated PDFs through a web interface. However, in that environment we used PostScript programming to generate the PDFs and with PostScript the code can determine the exact position on the page as each line of text is "written" and the code is responsible for creating the page breaks - not the rendering application. If the PHP PDF functions have that capability it would be possible, but it would be more complex than it is now as you need to control the position of every piece of text - including line-breaks, pagination, etc.

 

Even then, I'm not sure if it would be possible to append the table of contents to the beginning of the document after the content pages are generated. You might have to settle with putting the TOC at the end of the document.

 

I am thinking that ill make a table of contents even with the wrong pages

as long is it is aligned then ill just update the table via word the only problem is i dont know if word will detect the table of contents as their own

Link to comment
Share on other sites

Do you know about this: http://www.phprtf.com/, Do you think its possible for me to create a separate table of contents rtf file with pagenumbers that I can just insert after?

I've never used that class/pprogram. It could be that it has the capability - maybe. Check the documentation.

 

I am thinking that ill make a table of contents even with the wrong pages

as long is it is aligned then ill just update the table via word the only problem is i dont know if word will detect the table of contents as their own

 

No, MS Word will not "detect" the table of contents. All the elements in Word have embedded coding that makes it all work. Word will be able to detect any raw text as anything othr than raw text. However, that does give me an idea. If you create a proper HTML file and use header tags (H1, H2, etc) then you can open that HTML file in word and those headers will be interpreted correctly. You could then put a page break at the very top and then use Word to insert a TOC on that first page. You might also want to go into the page numbering properties to start the page numbers after the TOC page.

 

By the way, I see from yur first example that you are creating test case docs. What type of software do you work with?

Link to comment
Share on other sites

Hi,

 

Thanks for the reply I am working for a company that uses Testlink and they assigned me to modify the report being generated into a more professional looking documentation.

Do I really need to make a separate file? Or can I just include the TOC in the documenation with the proper headings. Also what i think is to design the TOC as this:

 

Heading1..............1

  Heading2...........1

    Heading3.........1

 

Just like how it works at MsWord hoping for it to be detected.

 

Jj

Link to comment
Share on other sites

Do you know about this: http://www.phprtf.com/, Do you think its possible for me to create a separate table of contents rtf file with pagenumbers that I can just insert after?

I've never used that class/pprogram. It could be that it has the capability - maybe. Check the documentation.

 

I am thinking that ill make a table of contents even with the wrong pages

as long is it is aligned then ill just update the table via word the only problem is i dont know if word will detect the table of contents as their own

 

No, MS Word will not "detect" the table of contents. All the elements in Word have embedded coding that makes it all work. Word will be able to detect any raw text as anything othr than raw text. However, that does give me an idea. If you create a proper HTML file and use header tags (H1, H2, etc) then you can open that HTML file in word and those headers will be interpreted correctly. You could then put a page break at the very top and then use Word to insert a TOC on that first page. You might also want to go into the page numbering properties to start the page numbers after the TOC page.

 

By the way, I see from yur first example that you are creating test case docs. What type of software do you work with?

 

Hmm from what I understand you recommend on just using the TOC generator of word?

Link to comment
Share on other sites

I made some changes with my code I am able to generate at TOC that is being recognized by word however word cant update the TOC, Can anyone help me find out what i lack? Thanks!

 

<?php 
/** 
* TestLink Open Source Project - http://testlink.sourceforge.net/ 
*  
* @filesource $RCSfile: print.inc.php,v $ 
* @version $Revision: 1.29.2.1 $ 
* @modified $Date: 2007/11/18 02:12:10 $ by $Author: havlat $ 
* 
* @author   Martin Havlat <havlat@users.sourceforge.net> 
* 
* Functions for support printing of documents. 
* 
* 20070509 - franciscom 
* changes in renderTestSpecTreeForPrinting() interface 
* 
* 20070106 - franciscom 
* 1. remove of some magic numbers 
* 
*/ 

/** 
* print HTML header 
* Standard: HTML 4.01 trans (because is more flexible to bugs in user data) 
*/ 




function printHeader($title, $base_href, $cssTemplate = TL_DOC_BASIC_CSS) 
{ 
   //$output = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n"; 
   $output .= "<html xmlns:v='urn:schemas-microsoft-com:vml'
xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word'
xmlns:m='http://schemas.microsoft.com/office/2004/12/omml'
xmlns='http://www.w3.org/TR/REC-html40'>\n<head>\n"; 
   
   //$output .= '<meta http-equiv="Content-Type" content="text/html; charset='.TL_TPL_CHARSET.'" />'; 
   $output .= '<meta http-equiv="Content-Type" content="text/html; charset=unicode" />';
   $output .= '<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 12">
<meta name=Originator content="Microsoft Word 12">';
   $output .= '<title>' . htmlspecialchars($title). "</title>\n"; 
   $output .= '<link type="text/css" rel="stylesheet" href="' . $base_href . $cssTemplate . '" />'; 
   //$output .= '<style type="text/css" media="print">.notprintable { display:none;}</style>'; 
   $output .= '<style>
<!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;
mso-font-charset:2;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:0 268435456 0 0 -2147483648 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
{font-family:Cambria;
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-1610611985 1073741899 0 0 159 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:1627400839 -2147483648 8 0 66047 0;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-format:other;
mso-font-pitch:auto;
mso-font-signature:0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
h1
{mso-style-priority:9;
mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-link:"Heading 1 Char";
margin-top:112.5pt;
margin-right:15.0pt;
margin-bottom:7.5pt;
margin-left:15.0pt;
text-align:center;
mso-pagination:widow-orphan;
mso-outline-level:1;
font-size:14.5pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
font-weight:bold;}
h2
{mso-style-priority:9;
mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-link:"Heading 2 Char";
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
text-indent:3.75pt;
mso-pagination:widow-orphan;
mso-outline-level:2;
font-size:14.5pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
font-weight:bold;}
h3
{mso-style-priority:9;
mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-link:"Heading 3 Char";
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
text-indent:7.5pt;
mso-pagination:widow-orphan;
mso-outline-level:3;
font-size:13.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
font-weight:bold;}
h4
{mso-style-priority:9;
mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-link:"Heading 4 Char";
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
text-indent:11.25pt;
mso-pagination:widow-orphan;
mso-outline-level:4;
font-size:12.5pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
font-weight:bold;}
p.MsoToc1, li.MsoToc1, div.MsoToc1
{mso-style-update:auto;
mso-style-priority:39;
mso-style-next:Normal;
margin-top:0in;
margin-right:0in;
margin-bottom:5.0pt;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
p.MsoToc2, li.MsoToc2, div.MsoToc2
{mso-style-update:auto;
mso-style-priority:39;
mso-style-next:Normal;
margin-top:0in;
margin-right:0in;
margin-bottom:5.0pt;
margin-left:12.0pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
p.MsoToc3, li.MsoToc3, div.MsoToc3
{mso-style-update:auto;
mso-style-priority:39;
mso-style-next:Normal;
margin-top:0in;
margin-right:0in;
margin-bottom:5.0pt;
margin-left:24.0pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:black;
mso-text-animation:none;
text-decoration:none;
text-underline:none;
text-decoration:none;
text-line-through:none;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
pre
{mso-style-noshow:yes;
mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
font-size:10.0pt;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-noshow:yes;
mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
p.MsoTocHeading, li.MsoTocHeading, div.MsoTocHeading
{mso-style-noshow:yes;
mso-style-priority:39;
mso-style-qformat:yes;
mso-style-parent:"Heading 1";
mso-style-next:Normal;
margin-top:24.0pt;
margin-right:0in;
margin-bottom:0in;
margin-left:0in;
margin-bottom:.0001pt;
line-height:115%;
mso-pagination:widow-orphan lines-together;
page-break-after:avoid;
font-size:14.0pt;
font-family:"Cambria","serif";
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:major-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:major-fareast;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:major-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:major-bidi;
color:#365F91;
mso-themecolor:accent1;
mso-themeshade:191;
font-weight:bold;}
span.Heading1Char
{mso-style-name:"Heading 1 Char";
mso-style-priority:9;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"Heading 1";
mso-ansi-font-size:14.0pt;
mso-bidi-font-size:14.0pt;
font-family:"Cambria","serif";
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:major-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:major-fareast;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:major-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:major-bidi;
color:#365F91;
mso-themecolor:accent1;
mso-themeshade:191;
font-weight:bold;}
span.Heading2Char
{mso-style-name:"Heading 2 Char";
mso-style-noshow:yes;
mso-style-priority:9;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"Heading 2";
mso-ansi-font-size:13.0pt;
mso-bidi-font-size:13.0pt;
font-family:"Cambria","serif";
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:major-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:major-fareast;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:major-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:major-bidi;
color:#4F81BD;
mso-themecolor:accent1;
font-weight:bold;}
span.Heading3Char
{mso-style-name:"Heading 3 Char";
mso-style-noshow:yes;
mso-style-priority:9;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"Heading 3";
mso-ansi-font-size:12.0pt;
mso-bidi-font-size:12.0pt;
font-family:"Cambria","serif";
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:major-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:major-fareast;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:major-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:major-bidi;
color:#4F81BD;
mso-themecolor:accent1;
font-weight:bold;}
span.Heading4Char
{mso-style-name:"Heading 4 Char";
mso-style-noshow:yes;
mso-style-priority:9;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"Heading 4";
mso-ansi-font-size:12.0pt;
mso-bidi-font-size:12.0pt;
font-family:"Cambria","serif";
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:major-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:major-fareast;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:major-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:major-bidi;
color:#4F81BD;
mso-themecolor:accent1;
font-weight:bold;
font-style:italic;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"HTML Preformatted";
font-family:"Consolas","serif";
mso-ascii-font-family:Consolas;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Consolas;}
p.important, li.important, div.important
{mso-style-name:important;
mso-style-unhide:no;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:13.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
font-weight:bold;}
p.notprintable, li.notprintable, div.notprintable
{mso-style-name:notprintable;
mso-style-unhide:no;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
display:none;
mso-hide:all;}
p.note, li.note, div.note
{mso-style-name:note;
mso-style-unhide:no;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
p.numberedlist, li.numberedlist, div.numberedlist
{mso-style-name:numberedlist;
mso-style-unhide:no;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
p.listcontinued, li.listcontinued, div.listcontinued
{mso-style-name:listcontinued;
mso-style-unhide:no;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
p.bodytext, li.bodytext, div.bodytext
{mso-style-name:bodytext;
mso-style-unhide:no;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"Balloon Text";
mso-ansi-font-size:8.0pt;
mso-bidi-font-size:8.0pt;
font-family:"Tahoma","sans-serif";
mso-ascii-font-family:Tahoma;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Tahoma;
mso-bidi-font-family:Tahoma;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-size:10.0pt;
mso-ansi-font-size:10.0pt;
mso-bidi-font-size:10.0pt;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
/* List Definitions */
@list l0
{mso-list-id:1444862;
mso-list-template-ids:1816839108;}
@list l1
{mso-list-id:14769254;
mso-list-template-ids:-246410296;}
@list l1:level1
{mso-level-start-at:5;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l2
{mso-list-id:243153172;
mso-list-template-ids:98996550;}
@list l2:level1
{mso-level-start-at:6;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l3
{mso-list-id:352801658;
mso-list-template-ids:1196052432;}
@list l3:level1
{mso-level-start-at:4;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l4
{mso-list-id:370501404;
mso-list-template-ids:-915389982;}
@list l4:level1
{mso-level-start-at:8;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l5
{mso-list-id:882138145;
mso-list-template-ids:1386922386;}
@list l5:level1
{mso-level-number-format:bullet;
mso-level-text:·;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l6
{mso-list-id:924462046;
mso-list-template-ids:669696314;}
@list l6:level1
{mso-level-start-at:5;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l7
{mso-list-id:1013067749;
mso-list-template-ids:565770946;}
@list l7:level1
{mso-level-number-format:bullet;
mso-level-text:·;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l8
{mso-list-id:1062173593;
mso-list-template-ids:-881307198;}
@list l8:level1
{mso-level-start-at:3;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l9
{mso-list-id:1138648925;
mso-list-template-ids:963010878;}
@list l10
{mso-list-id:1200898252;
mso-list-template-ids:935727302;}
@list l10:level1
{mso-level-number-format:bullet;
mso-level-text:·;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l11
{mso-list-id:1284649394;
mso-list-template-ids:1324010672;}
@list l11:level1
{mso-level-start-at:7;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l12
{mso-list-id:1324509618;
mso-list-template-ids:1270754774;}
@list l12:level1
{mso-level-number-format:bullet;
mso-level-text:·;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l13
{mso-list-id:1369376408;
mso-list-template-ids:1670691600;}
@list l13:level1
{mso-level-start-at:11;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l14
{mso-list-id:1537083581;
mso-list-template-ids:-1206079252;}
@list l14:level1
{mso-level-number-format:bullet;
mso-level-text:·;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l15
{mso-list-id:1600914171;
mso-list-template-ids:-178098694;}
@list l15:level1
{mso-level-number-format:bullet;
mso-level-text:·;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l16
{mso-list-id:1618247161;
mso-list-template-ids:438962092;}
@list l16:level1
{mso-level-start-at:4;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l17
{mso-list-id:1665620274;
mso-list-template-ids:1336576566;}
@list l17:level1
{mso-level-start-at:10;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l18
{mso-list-id:1688600977;
mso-list-template-ids:-1673389332;}
@list l18:level1
{mso-level-start-at:3;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l19
{mso-list-id:1742748162;
mso-list-template-ids:1288324854;}
@list l19:level1
{mso-level-start-at:5;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l20
{mso-list-id:1794782219;
mso-list-template-ids:-1923154860;}
@list l20:level1
{mso-level-number-format:bullet;
mso-level-text:·;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l21
{mso-list-id:1797749274;
mso-list-template-ids:-231996904;}
@list l22
{mso-list-id:1914195859;
mso-list-template-ids:128452592;}
@list l22:level1
{mso-level-start-at:4;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l23
{mso-list-id:1955332389;
mso-list-template-ids:1362951258;}
@list l24
{mso-list-id:2038775735;
mso-list-template-ids:165213790;}
@list l25
{mso-list-id:2144108210;
mso-list-template-ids:-2112730450;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->
</style>
   ';
   $output .= "\n</head>\n<body>\n"; 

   return $output; 
} 

/** 
  print HTML - initial page of document 
*/ 
function printFirstPage(&$db,$title, $prodName, $prodNotes, $userID, $tplan_name="") 
{ 
    
   tLog("printFirstPage called (TPlan=".$tplan_name.")"); 
   $g_date_format = config_get('date_format'); 
   $prodName = htmlspecialchars($prodName); 
    
   $author = htmlspecialchars(getUserName($db,$userID)); 
       
   $title = htmlspecialchars($title); 
    
   $output = '<div>'; 
   $output .= '<div class="groupBtn" style="text-align:right"><input class="notprintable" type="button" name="print" value="'.lang_get('btn_print').'" onclick="javascript: print();" style="margin-left:2px;" /></div>'; 

   $output .= '<div class="pageheader">'. $prodName ."</div>\n"; 
    
   if (TL_DOC_COMPANY != '' ||  TL_DOC_COMPANY_LOGO != '' ) 
   { 
      $output .= '<br /><center><table class="company">'; 

        if (TL_DOC_COMPANY != '' ) 
        { 
         $output .= '<tr><td id="company_name">'. htmlspecialchars(TL_DOC_COMPANY) ."</td></tr>"; 
      } 
      $output .= '<tr><td/></tr>'; 
        
        if (TL_DOC_COMPANY_LOGO != '' ) 
      { 
         $output .= '<tr><td id="company_logo">'. 
                str_replace('%BASE_HREF%',$_SESSION['basehref'],TL_DOC_COMPANY_LOGO) ."</td></tr>"; 
      } 
      $output .= "</table></center>\n"; 
   } 
    
   $output .= "</div>\n"; 

   if ($tplan_name != "") 
   { 
      $output .= '<p style="margin-top:100px; font-size:16; text-align: center; font-weight: bold;">'. $title."</h1>\n"; 
      $output .= '<p style="margin-bottom:300px; font-size:16; text-align: center; font-weight: bold;">'. lang_get('test_plan').": " .$tplan_name."</h1>\n"; 
   } else { 
      $output .= '<h1 id="doctitle" style="margin-bottom:1000px;">'.$title."</h1>\n"; 
   } 
   $output .= '<div id="summary">' . 
               '<p id="prodname">'. lang_get('product').": " . $prodName . "</p>\n"; 

   if (strlen($prodNotes)) 
      $output .= '<p id="prodnotes">'. $prodNotes . "</p>\n"; 
              
   $output .= '<p id="author">' . lang_get('author').": " . $author . "</p>\n" . 
               '<p id="printedby">' . lang_get('printed_by_TestLink_on')." ". 
               strftime($g_date_format, time()) . "</p></div>\n"; 

   if (TL_DOC_COPYRIGHT != '') 
      $output .= '<div class="pagefooter" id="copyright">'.htmlspecialchars(TL_DOC_COPYRIGHT)."</div>\n"; 
   if (TL_DOC_CONFIDENT != '') 
      $output .= '<div class="pagefooter" id="confidential" style="margin-bottom:600px;">'.htmlspecialchars(TL_DOC_CONFIDENT)."</div>\n"; 

   return $output; 
} 


/* 
  function: renderTestSpecTreeForPrinting 

  args : 
  
        [$tplan_id] 
        
  returns: 
  
  rev : 
       20070509 - franciscom - added $tplan_id in order to refactor and 
                               add contribution BUGID 

*/ 
function renderTestSpecTreeForPrinting(&$db,&$printingOptions,&$node,$tocPrefix,$tcCnt,$level,$tplan_id=0,$tplan_name="") 
{ 

  tLog("renderTestSpecTreeForPrinting called (TPlan=".$tplan_name.")"); 
  $tree_mgr = new tree($db); 
  $map_id_descr = array_flip($tree_mgr->get_available_node_types()); 
  
   $code = null; 
   $bCloseTOC = 0;    
   if (isset($node['node_type_id'])) 
   { 
        $verbose_node_type = $map_id_descr[$node['node_type_id']]; 
      switch($verbose_node_type) 
      { 
         case 'testproject': 
            $code .= renderProjectNodeForPrinting($db,$printingOptions,$printingOptions['title'],$node,$tplan_name); 
            break; 
                
         case 'testsuite': 
            if (!is_null($tocPrefix)) 
               $tocPrefix .= "."; 
            $tocPrefix .= $tcCnt; 
            $code .= renderTestSuiteNodeForPrinting($db,$printingOptions,$node,$tocPrefix,$level); 
            break; 
          
         case 'testcase': 
            $code .= renderTestCaseForPrinting($db,$printingOptions,$node,$level,$tplan_id); 
            break; 
      } 
   } 
   if (isset($node['childNodes']) && $node['childNodes']) 
   { 
      $childNodes = $node['childNodes']; 
      $tsCnt = 0; 
    $children_qty=sizeof($childNodes); 
      for($i = 0;$i <$children_qty ;$i++) 
      { 
         $current = $childNodes[$i]; 
         if(is_null($current)) 
            continue; 
          
         if (isset($current['node_type_id']) && $map_id_descr[$current['node_type_id']] == 'testsuite') 
            $tsCnt++; 
         $code .= renderTestSpecTreeForPrinting($db,$printingOptions,$current,$tocPrefix,$tsCnt,$level+1,$tplan_name); 
      } 
   } 
   if (isset($node['node_type_id']) && $map_id_descr[$node['node_type_id']] == 'testproject') 
   { 
      if ($printingOptions['toc']) 
      { 
         //$printingOptions['tocCode'] .= '</div><hr />';    
         $printingOptions['tocCode'] .= ' <p class="MsoNormal"><!--[if supportFields]><span style="mso-element:field-end"></span><![endif]--><o:p> </o:p></p></w:Sdt>';
         $code = str_replace("{{INSERT_TOC}}",$printingOptions['tocCode'],$code); 
      } 
      $code .= "</body></html>"; 
   } 
       
   return $code; 
} 

/* 
  function: 

  args : 
  
  returns: 

  rev : 
       20070509 - franciscom - added Contribution 
        
*/ 
function renderTestCaseForPrinting(&$db,&$printingOptions,&$node,$level,$tplan_id=0) 
{ 

    $id = $node['id']; 
   $name = htmlspecialchars($node['name']); 
    
   $code = null; 
  $tc_mgr = null; 
  $tcInfo = null; 
  
  $versionID = isset($node['tcversion_id']) ? $node['tcversion_id'] : TC_LATEST_VERSION; 
       
   if( $printingOptions['body'] || $printingOptions['summary'] || 
       $printingOptions['author'] ) 
   { 
      $tc_mgr = new testcase($db); 
    $tcInfo = $tc_mgr->get_by_id($id,$versionID); 

     if ($tcInfo) 
      { 
       $tcInfo=$tcInfo[0]; 
     } 
    
   }    

    
   if ($printingOptions['toc']) 
   { 
// SDM - changed padding-left -> margin-left 
     /*$printingOptions['tocCode']  .= '<p style="margin-left:45px;"><a href="#tc' . $id . '">Test Case ' . $id . ': ' . 
                          $name . '</a></p>'; */
      $printingOptions['tocCode']  .= '<p class="MsoToc3"" style="tab-stops:right dotted 467.5pt">
			<span class="MsoHyperlink">
			<span style="mso-no-proof:yes"><a href="#_Toc' . $id . '"><span style=font-family:"Arial","sans-serif";mso-fareast-font-family:"Times New Roman">Test Case ' . $id . ': ' . 
                          $name . '</span>
<span style="color:windowtext;display:none;mso-hide:screen">
<span style="mso-tab-count:1 dotted">. </span>
</span>
<!--[if supportFields]>
<span style="color:windowtext;display:none;mso-hide:screen">
<span style="mso-element: field-begin"></span>
</span><span style="color:windowtext;display:none; mso-hide:screen"> PAGEREF _Toc' . $node['id'] . ' \h
</span>
<span style="color:windowtext; display:none;mso-hide:screen">
<span style="mso-element:field-separator">
</span>
</span><![endif]-->
<span style="color:windowtext;display:none;mso-hide:screen">
5
</span>
<!--[if supportFields]>
<span style="color:windowtext; display:none;mso-hide:screen">
<span style="mso-element:field-end"></span>
</span>
<![endif]-->
</a>
</span></span>
<span style=font-size:11.0pt;font-family:"Calibri","sans-serif";mso-ascii-theme-font: minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;mso-no-proof:yes>
<o:p></o:p></span></p>';
                          
      $code .= "<a name='_Toc" . $id . "'></a>"; 
   } 
   
  	$code .= "<div class=\"tc\"><h3>".lang_get('test_case')." " . $id . ": " . $name . "</h3><table class=\"tc\" width=\"90%\">"; 
    

  if ($printingOptions['body'] || $printingOptions['summary']) 
   { 
      if ($tcInfo) 
      { 
         if ($printingOptions['summary']) 
            $code .= "<tr><td colspan=\"2\"><u>".lang_get('summary')."</u>: " .  $tcInfo['summary'] . "</td></tr>"; 
         if ($printingOptions['body']) 
         { 
               $code .= "<tr><td colspan=\"2\"><u>".lang_get('steps')."</u>:<br />" .  $tcInfo['steps'] . "</td></tr>"; 
               $code .= "<tr><td colspan=\"2\"><u>".lang_get('expected_results')."</u>:<br />" .  $tcInfo['expected_results'] . "</td></tr>"; 
         } 
         if ($printingOptions['passfail']) 
         { 

// SDM - BEGIN changes for printing testresult and notes in 'Print Test Plan' 
$testplan_id2 = $_SESSION['testPlanId']; 
$id2 = $id+=1; 

         $query = mysql_query("SELECT status, execution_ts, notes FROM executions 
where tcversion_id = $id2 
and testplan_id = $testplan_id2 
and execution_ts = (select MAX(execution_ts) from executions 
where tcversion_id = $id2 
and testplan_id = $testplan_id2 
group by tcversion_id, testplan_id)"); 


         $result = mysql_fetch_assoc($query); 

    if (!$result) { 
      $tcstatus2 = 'not run'; 
      $tcnotes2 = ''; 
    }else{ 
      $tcstatus2 = $result['status']; 
      $tcnotes2 = $result['notes']; 
   } 

if ($tcstatus2 == 'p'){$tcstatus2 = '<FONT COLOR=\"#000000\"><b>passed</b></FONT>';} 
if ($tcstatus2 == 'b'){$tcstatus2 = '<FONT COLOR=\"#000000\">blocked</FONT>';} 
if ($tcstatus2 == 'f'){$tcstatus2 = '<FONT COLOR=\"#000000\">failed</FONT>';} 
// SDM - END changes for printing testresult and notes in 'Print Test Plan' 
       
// SDM = added $tcstatus2 and $tcnotes2 

            $code .= "<tr><td width=\"20%\" valign=\"top\"><u>".lang_get('passfail')."</u>:<br /><br />".$tcstatus2."</td><td><u>". 
            lang_get('testnotes')."</u>:<br /><br />".$tcnotes2."<br /></td></tr>"; 
         } 
      } 
   } 

  if ($printingOptions['author']) 
  {    
     $authorName = getUserName($db, $tcInfo['author_id']); 
     $code .= '<tr><td colspan="2"><b>' . lang_get("author") . " </b>" . $authorName . "</td></tr>"; 
  } 
//SDM - added <br /> to add a line between to printed testcases 
   $code .= "</table></div><br />"; 

  if( !is_null($tc_mgr) ) 
   { 
     unset($tc_mgr); 
   } 
    
    
   return $code; 
} 

function renderProjectNodeForPrinting(&$db,&$printingOptions,$title,&$node, $tplan_name) 
{ 
   $stitle = lang_get('title_test_spec'); 
   if (strlen($title)) 
      $stitle .= " - " . $title; 
    
   $my_userID = isset($_SESSION['userID']) ? intval($_SESSION['userID']) : null; 

   $tproject = new testproject($db); 
   $projectData = $tproject->get_by_id($node['id']); 
   unset($tproject); 
   $code = printHeader($stitle,$_SESSION['basehref']); 
   $code .= printFirstPage($db,$stitle, $projectData['name'], $projectData['notes'], $my_userID, $tplan_name); 

   $printingOptions['toc_numbers'][1] = 0; 
   if ($printingOptions['toc']) 
   { 
      //$printingOptions['tocCode'] = '<div class="toc"><center><h2>'.lang_get('title_toc').'</h2></center>';
      $printingOptions['tocCode'] = '<w:Sdt SdtDocPart="t" DocPartType="Table of Contents" DocPartUnique="t" ID="4628251">
      <p class="MsoTocHeading" align=center style="text-align:center">Table of Contents<w:sdtPr></w:sdtPr></p>';
  
      $code .= "{{INSERT_TOC}}"; 
   } 
    
   return $code; 
} 


function renderTestSuiteNodeForPrinting(&$db,&$printingOptions,&$node,$tocPrefix,$level) 
{ 
   $code = null; 
   $name = isset($node['name']) ? htmlspecialchars($node['name']) : ''; 
   if ($printingOptions['toc']) 
   { 
// SDM - changed padding-left -> margin-left 
       /*$printingOptions['tocCode'] .= '<li class="toc"><p style="margin-left:10px;"><a href="#cat' . $node['id'] . '">Test Suite ' . 
                        $name . '</a></p>1</li>*/
                        
                       $printingOptions['tocCode'] .= '<p class="MsoToc1"" style="tab-stops:right dotted 467.5pt">
<span class="MsoHyperlink">
<span style="mso-no-proof:yes"><a href="#_Toc' . $node['id'] . '"><span style=font-family:"Arial","sans-serif";mso-fareast-font-family:"Times New Roman">Test Suite ' . 
                        $name . '</span>
<span style="color:windowtext;display:none; mso-hide:screen">
<span style="mso-tab-count:1 dotted">. </span>
</span><!--[if supportFields]>
<span style="color:windowtext;display:none;mso-hide:screen">
<span style="mso-element: field-begin"></span>
</span>
<span style="color:windowtext;display:none; mso-hide:screen"> PAGEREF _Toc' . $node['id'] . ' \h 
</span>
<span style="color:windowtext; display:none;mso-hide:screen">
<span style="mso-element:field-separator"></span>
</span>
<![endif]-->
<span style="color:windowtext;display:none;mso-hide:screen">
5
</span>
<!--[if supportFields]>
<span style="color:windowtext; display:none;mso-hide:screen">
<span style="mso-element:field-end"></span>
</span>
<![endif]-->
</a>
</span>
</span>
<span style=font-size:11.0pt;font-family:"Calibri","sans-serif";mso-ascii-theme-font: minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;mso-no-proof:yes>
<o:p></o:p>
</span></p>

<p class="MsoToc2"" style="tab-stops:right dotted 467.5pt">
<span class="MsoHyperlink">
<span style="mso-no-proof:yes"><a href="#_Toc' . $node['id'] . '">
<span style=font-family:"Arial","sans-serif";mso-fareast-font-family:"Times New Roman">
Overview
</span>
<span style="color:windowtext;display:none;mso-hide:screen">
<span style="mso-tab-count:1 dotted">.. </span>
</span>
<!--[if supportFields]><span style="color:windowtext; display:none;mso-hide:screen">
<span style="mso-element:field-begin"></span>
</span>
<span style="color:windowtext;display:none;mso-hide:screen"> PAGEREF _Toc' . $node['id'] . ' \h</span>
<span style="color:windowtext;display:none;mso-hide:screen">
<span style="mso-element:field-separator"></span>
</span>
<![endif]--><span style="color:windowtext;display:none;mso-hide:screen">
5
</span>
<!--[if supportFields]>
<span style="color:windowtext; display:none;mso-hide:screen">
<span style="mso-element:field-end"></span>
</span>
<![endif]-->
</a>
</span>
</span>
<span style=font-size:11.0pt;font-family:"Calibri","sans-serif";mso-ascii-theme-font: minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;mso-no-proof:yes>
<o:p>
</o:p>
</span>
</p>';      
                       //<p style="margin-left:20px;"><a href="#cat' . $node['id'] . '">Overview</a></p>'; 
      $code .= "<a name='_Toc{$node['id']}'></a>"; 
   } 
    $code .= "<center><h1> ".lang_get('test_suite') ." {$name}</h1></center>"; //removed tocPrefix
                   
   if ($printingOptions['header']) 
     { 
      $tsuite = new testsuite($db); 
      $tInfo = $tsuite->get_by_id($node['id']); 
      unset($tsuite); 
      	
       $code .= "<h2> ".lang_get('details'). //removed tocPrefix
             "</h2><div>{$tInfo['details']}</div><br />"; 
    } 
    
   return $code; 
} 
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.