{extends "base.tpl.html"}
{block "title"}#{$issue_id} - Custom Fields{/block}

{block "javascripts" append}
  <script type="text/javascript" src="{$core.rel_url}ajax/dynamic_custom_field.js.php?iss_id={$smarty.get.issue_id}"></script>
  <script type="text/javascript" src="{$core.rel_url}js/dynamic_custom_field.js?c=12c2"></script>
{/block}

{block "content"}
{if $update_result|default:'' != ''}
  <br />
  <center>
  <span>
  {if $update_result == -1}
    <b>{t}An error occurred while trying to run your query{/t}</b>
  {elseif $update_result == 1}
    <b>{t}Thank you, the custom field values were updated successfully.{/t}</b>
  {/if}
  </span>
  </center>
  <script type="text/javascript">
  <!--
  {if $core.current_user_prefs.close_popup_windows == '1'}
  setTimeout('Eventum.close_and_refresh()', 2000);
  {/if}
  //-->
  </script>
  <br />
  {if not $core.current_user_prefs.close_popup_windows}
  <center>
    <span><a href="javascript:void(null);" onClick="Eventum.close_and_refresh();">{t}Continue{/t}</a></span>
  </center>
  {/if}
{else}

<script type="text/javascript">
<!--
function validateForm(f)
{
    Validation.checkCustomFields(f);
}
//-->
</script>

<form name="custom_field_form" class="validate" method="post" data-validation-function='validateForm'>
<input type="hidden" name="cat" value="update_values">
<input type="hidden" name="issue_id" value="{$smarty.get.issue_id}">
  <table class="bordered">
    <tr class="title">
      <th colspan="2">
        {t}Update Issue Details{/t}
      </th>
    </tr>
    {include file="edit_custom_fields.tpl.html" form_type='edit'}
    <tr>
      <td class="buttons" colspan="2">
        <input type="submit" value="{t}Update Values{/t}">&nbsp;&nbsp;
        <input type="button" value="{t}Close{/t}" onClick="window.close();">
      </td>
    </tr>
  </table>
</form>
{/if}
{/block}
