{* 
TestLink Open Source Project - http://testlink.sourceforge.net/
$Id: tcView.tpl,v 1.26 2007/07/06 06:28:34 franciscom Exp $
Purpose: smarty template - view test case in test specification
*}

{include file="inc_head.tpl" openHead='yes'}
<script language="JavaScript" src="gui/javascript/expandAndCollapseFunctions.js" type="text/javascript"></script>
</head>

<body onLoad="viewElement(document.getElementById('other_versions'),false)">

<div class="workBack">
{include file="inc_update.tpl" result=$sqlResult action=$action item="test_case" 
         user_feedback=$user_feedback refresh=$refresh_tree}

{if $testcase_curr_version}
{section name=idx loop=$testcase_curr_version}
    {* Current active version *}
    {if $testcase_other_versions[idx] neq null}
        {assign var="my_delete_version" value="yes"}
    {/if}

    {* added args_cf *}
		{include file="tcView_viewer.tpl" 
		         args_testcase=$testcase_curr_version[idx][0]
		         args_keywords_map=$keywords_map[idx] 
		         args_reqs=$arrReqs[idx] 
		         args_status_quo=$status_quo[idx]

		         args_can_edit=$can_edit 
		         args_can_move_copy="yes" 
		         args_can_delete_testcase=$can_delete_testcase
		         args_can_delete_version=$my_delete_version
		         args_show_version="yes" 
		         args_show_title="yes"
		         
		         args_activate_deactivate_name='activate'
		         args_activate_deactivate='bnt_activate'
		         args_cf=$cf[idx] 
		         args_tcase_cfg=$tcase_cfg
		         args_users=$users
		         }
		
		{assign var="tcID" value=$testcase_curr_version[idx][0].testcase_id}
		{assign var="bDownloadOnly" value=false}
		{if $can_edit neq 'yes'}
			{assign var="bDownloadOnly" value=true}
		{/if}
		{include file="inc_attachments.tpl" id=$tcID  tableName="nodes_hierarchy"
		         attachmentInfos=$attachments[$tcID]  downloadOnly=$bDownloadOnly}

    {* Other Versions *}
    {if $testcase_other_versions[idx] neq null}
        {assign var="vid" value=$testcase_curr_version[idx][0].id}
         
        <span style="cursor: pointer" class="type1" 
              onclick="viewElement(document.getElementById('vers_{$vid}'),document.getElementById('vers_{$vid}').style.display=='none')"> Other Versions </span>
        <div id="vers_{$vid}" class="workBack">
        
  	    {foreach item=my_testcase from=$testcase_other_versions[idx]}
  	          <span style="cursor: pointer" class="type1" 
  	                onclick="viewElement(document.getElementById('v{$vid}_{$my_testcase.version}'),document.getElementById('v{$vid}_{$my_testcase.version}').style.display=='none')"> Version {$my_testcase.version} </span>
  	          <br />
  	          <div id="v{$vid}_{$my_testcase.version}" class="workBack">
				
				      {include file="tcView_viewer.tpl" 
                       args_testcase=$my_testcase 
                       args_keywords_map=$keywords_map[idx] 
                       args_reqs=$arrReqs[idx]
                       args_status_quo=$status_quo[idx]
                       			
                       args_can_edit=$can_edit 
                       args_can_move_copy="no" 
                       args_can_delete_testcase='no'
                       args_can_delete_version=$can_delete_version
                       args_show_version="no" 
                       args_show_title="no"
                       args_users=$users
                       args_cf=$cf[idx] 
                       }
  	         </div>
  	         <br />
  	         
		    {/foreach}
		    </div>
  
      	{* ---------------------------------------------------------------- *}
      	{* Force the div of every old version to show closed as first state *}
      	{literal}
      	<script type="text/javascript">
      	{/literal}
 	  	      viewElement(document.getElementById('vers_{$vid}'),false);

    	  		{foreach item=my_testcase from=$testcase_other_versions[idx]}
  	  	      viewElement(document.getElementById('{$my_testcase.version}'),false);
			      {/foreach}
      	{literal}
      	</script>
      	{/literal}
      	{* ---------------------------------------------------------------- *}
    {/if}
{/section}
{else}
	{lang_get s='no_records_found'}
{/if}

</div>
</body>
</html>
