{include file="header.tpl.html"}
{include file="navigation.tpl.html"}

<br />
{if $duplicate_result != ""}
<table width="500" bgcolor="{$cell_color}" border="0" cellspacing="0" cellpadding="1" align="center">
  <tr>
    <td>
      <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2" border="0">
        <tr>
          <td class="default">
            {if $duplicate_result == -1}
            <b>{t}Sorry, an error happened while trying to run your query.{/t}</b>
            {elseif $duplicate_result == 1}
            <b>{t}Thank you, the issue was marked as a duplicate successfully. Please choose 
            from one of the options below:{/t}</b>
            <ul>
              <li><a href="view.php?id={$smarty.post.issue_id}" class="link">{t}Open the Issue Details Page{/t}</a></li>
              <li><a href="list.php" class="link">{t}Open the Issue Listing Page{/t}</a></li>
              {if $app_setup.support_email == 'enabled' and $current_role > $roles.viewer}
              <li><a href="emails.php" class="link">{t}Open the Emails Listing Page{/t}</a></li>
              {/if}
            </ul>
            <b>{t}Otherwise, you will be automatically redirected to the Issue Details Page in 5 seconds.{/t}</b>
            {literal}
            <script language="JavaScript">
            <!--
            setTimeout('openDetailPage()', 5000);
            function openDetailPage()
            {
            {/literal}
                window.location.href = 'view.php?id={$smarty.post.issue_id}';
            {literal}
            }
            //-->
            </script>
            {/literal}
            {/if}
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
{else}
{literal}
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<script language="JavaScript" src="js/overlib_mini.js"></script>
<script language="JavaScript">
<!--
function validateDuplicate(f)
{
    if (hasSelected(f.duplicated_issue, -1)) {
        alert('{/literal}{t escape=js}Please choose the duplicated issue.{/t}{literal}');
        selectField(f, 'duplicated_issue');
        return false;
    }
    return true;
}
//-->
</script>
{/literal}
<table width="80%" bgcolor="{$cell_color}" border="0" cellspacing="0" cellpadding="1" align="center">
<form name="duplicate_form" onSubmit="javascript:return validateDuplicate(this);" method="post" action="duplicate.php">
<input type="hidden" name="cat" value="mark">
<input type="hidden" name="issue_id" value="{$smarty.get.id}">
  <tr>
    <td>
      <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2" border="0">
        <tr>
          <td colspan="2" class="default" nowrap>
            <b>{t}Mark Issue as Duplicate{/t}</b> ({t}Issue ID:{/t} <a href="{$rel_url}view.php?id={$smarty.get.id}" class="link">{$smarty.get.id}</a>)
          </td>
        </tr>
        <tr>
          <td width="150" bgcolor="{$cell_color}" class="default_white">
            <b>{t}Duplicated Issue:{/t} *</b>
          </td>
          <td bgcolor="{$light_color}">
            <select name="duplicated_issue" class="default">
              <option value="-1">{t}Please select an issue{/t}</option>
              {html_options values=$issues output=$issues}
            </select>
            {if not ($os.mac and $browser.ie)}<a title="lookup issues by their summaries" href="javascript:void(null);" onClick="return overlib(getOverlibContents('{include file="lookup_layer.tpl.html" list=$assoc_issues}', 'duplicate_form', 'duplicated_issue', true), STICKY, HEIGHT, 50, WIDTH, 160, BELOW, RIGHT, CLOSECOLOR, '#FFFFFF', FGCOLOR, '#FFFFFF', BGCOLOR, '#000000', CAPTION, 'Lookup Details', CLOSECLICK);" onMouseOut="javascript:nd();"><img src="{$rel_url}images/lookup.gif" border="0"></a>{/if}
            {include file="error_icon.tpl.html" field="duplicated_issue"}
          </td>
        </tr>
        <tr>
          <td width="150" bgcolor="{$cell_color}" class="default_white">
            <b>{t}Comments:{/t}</b><br />
          </td>
          <td bgcolor="{$light_color}" class="default">
            <textarea name="comments" rows="8" style="width: 97%"></textarea>
          </td>
        </tr>
        <tr bgcolor="{$cell_color}">
          <td colspan="2">
            <table cellpadding="0" cellspacing="0" border="0" width="100%">
              <tr>
                <td><input class="button" type="button" value="&lt;&lt; {t}Back{/t}" onClick="javascript:history.go(-1);"></td>
                <td width="100%" align="center"><input class="button" type="submit" value="{t}Mark Issue as Duplicate{/t}"></td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td colspan="2" class="default">
            <b>* {t}Required fields{/t}</b>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</form>
</table>
{/if}
<br />

{include file="app_info.tpl.html"}
{include file="footer.tpl.html"}