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

{if $post_result != ''}
<br />
<center>
  <span class="default">
{if $post_result == -1}
  <b>{t}An error occurred while trying to run your query{/t}</b>
{else}
  <b>{t}Thank you, the internal note was posted successfully.{/t}</b>
{/if}
  </span>
</center>
<script language="JavaScript">
<!--
{if $current_user_prefs.close_popup_windows}
setTimeout('closeAndRefresh()', 2000);
{/if}
//-->
</script>
<br />
  {if not $current_user_prefs.close_popup_windows}
  <center>
    <span class="default"><a class="link" href="javascript:void(null);" onClick="javascript:closeAndRefresh();">{t}Continue{/t}</a></span>
  </center>
  {/if}
{else}
{literal}
<script language="JavaScript">
<!--
function validate(f)
{
    if (isWhitespace(f.title.value)) {
        alert('{/literal}{t escape=js}Please enter the title of this note.{/t}{literal}');
        selectField(f, 'title');
        return false;
    }
    if (isWhitespace(f.note.value)) {
        alert('{/literal}{t escape=js}Please enter the message body of this note.{/t}{literal}');
        selectField(f, 'note');
        return false;
    }
    return true;
}
function clearExtraRecipients()
{
    var f = getForm('post_note_form');
    f.elements['note_cc[]'].selectedIndex = -1;
    showSelections('post_note_form', 'note_cc[]');
}
var old_message = '';
function setSignature(f)
{
{/literal}
    var signature = "{$current_user_prefs.email_signature|replace:'"':'\"'|replace:"\r":""|replace:"\n":'\n'}";
{literal}
    if (f.add_email_signature.checked) {
        old_message = f.note.value;
        f.note.value += "\n";
        f.note.value += signature;
    } else {
        f.note.value = old_message;
    }
} 
//-->
</script>
{/literal}
<form onSubmit="javascript:return validate(this);" name="post_note_form" method="post" action="{$smarty.server.PHP_SELF}">
<input type="hidden" name="cat" value="post_note">
<input type="hidden" name="parent_id" value="{$parent_note_id}">
<input type="hidden" name="issue_id" value="{$issue_id}">
<table align="center" width="100%" cellpadding="3">
  <tr>
    <td>
      <table width="100%" cellspacing="1" cellpadding="2" border="0">
        <tr>
          <td colspan="2" class="default">
            <b>{t}Post New Internal Note{/t}</b>
          </td>
        </tr>
        <tr>
          <td width="140" bgcolor="{$internal_color}" class="default_white">
            <b>{t}From:{/t}</b>
          </td>
          <td bgcolor="{$light_color}" class="default">
            <b>{$from|escape:"html"}</b>
          </td>
        </tr>
        <tr>
          <td width="140" bgcolor="{$internal_color}" class="default_white">
            <b>{t}Recipients:{/t}</b>
          </td>
          <td bgcolor="{$light_color}" class="default">
            Issue #{$issue_id} {t}Notification List{/t} (Members: {$subscribers.staff|replace:"<":"&lt;"|replace:">":"&gt;"})
          </td>
        </tr>
        <tr>
          <td width="140" bgcolor="{$internal_color}" class="default_white">
            <b>{t}Title:{/t} *</b>
          </td>
          <td bgcolor="{$light_color}">
            <input type="text" name="title" class="default" size="50" value="{$reply_subject|escape:"html"}">
            {include file="error_icon.tpl.html" field="title"}
          </td>
        </tr>
        <tr>
          <td bgcolor="{$light_color}" colspan="2">
            <textarea name="note" rows="16" style="width: 97%">{$note.not_body|escape:"html"}{if $current_user_prefs.auto_append_note_sig == 'yes'}


{$current_user_prefs.email_signature|escape:"html"}{/if}</textarea>
            {include file="error_icon.tpl.html" field="note"}
          </td>
        </tr>
        <tr>
          <td width="140" class="default_white" bgcolor="{$internal_color}">
            <b>{t}Extra Note Recipients:{/t}</b>
          </td>
          <td bgcolor="{$light_color}">
            <select class="default" size="4" multiple name="note_cc[]" onChange="javascript:showSelections('post_note_form', 'note_cc[]');">
              {html_options options=$users}
            </select><input class="button" type="button" value="{t}Clear Selections{/t}" onClick="javascript:clearExtraRecipients();"><br />
            {include file="lookup_field.tpl.html" lookup_field_name="search" lookup_field_target="note_cc[]" callbacks="new Array('showSelections(\'post_note_form\', \'note_cc[]\')')"}
            <div class="default" id="selection_note_cc[]"></div>
          </td>
        </tr>
        <tr>
          <td width="140" class="default_white" bgcolor="{$internal_color}">
            <b>{t}Add Extra Recipients To Notification List?{/t}</b>
          </td>
          <td bgcolor="{$light_color}" class="default">
            <input type="radio" name="add_extra_recipients" value="{t}yes{/t}"> <a id="link" class="link" href="javascript:void(null);" onClick="javascript:checkRadio('post_note_form', 'add_extra_recipients', 0);">{t}Yes{/t}</a>&nbsp;&nbsp;
            <input type="radio" name="add_extra_recipients" value="{t}no{/t}" checked> <a id="link" class="link" href="javascript:void(null);" onClick="javascript:checkRadio('post_note_form', 'add_extra_recipients', 1);">{t}No{/t}</a>
          </td>
        </tr>
        <tr>
          <td width="120" bgcolor="{$internal_color}" class="default_white">
            <b>{t}New Status for Issue{/t} #{$issue_id}:</b>
          </td>
          <td bgcolor="{$light_color}">
            <select name="new_status" class="default">
              {html_options options=$statuses selected=$current_issue_status}
            </select>
          </td>
        </tr>
        <tr>
          <td width="120" bgcolor="{$internal_color}" class="default_white">
            <b>{t}Time Spent:{/t}</b>
          </td>
          <td bgcolor="{$light_color}">
            <input type="text" size="5" name="time_spent" class="default">
            <select name="time_category" class="default">
              {html_options options=$time_categories selected=$note_category_id}
            </select>
            <span class="small_default"><i>(in minutes)</i></span>
            {include file="error_icon.tpl.html" field="time_spent"}
          </td>
        </tr>
        <tr>
          <td colspan="2" bgcolor="{$internal_color}">
            <table border="0" cellpadding="0" cellspacing="0" width="100%">
              <tr>
                <td align="center">
                  <input name="main_submit_button" class="button" type="submit" value="{t}Post Internal Note{/t}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  <input class="button" type="button" value="{t}Cancel{/t}" onClick="javascript:window.close();">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </td>
                {if $current_user_prefs.email_signature != "" and $current_user_prefs.auto_append_note_sig != 'yes'}
                <td align="right" class="default_white" width="10%">
                  <nobr>
                  <input type="checkbox" name="add_email_signature" value="{t}yes{/t}" onClick="javascript:setSignature(this.form);">
                  <a id="white_link" class="white_link" href="javascript:void(null);" onClick="javascript:toggleCheckbox('post_note_form', 'add_email_signature');setSignature(getForm('post_note_form'));">{t}Add Email Signature{/t}</a>
                  &nbsp;&nbsp;
                  </nobr>
                </td>
                {/if}
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td colspan="2" class="default">
            <b>* {t}Required fields{/t}</b>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</form>
{if $parent_note_id or $smarty.get.cat == 'reply'}
{literal}
<script language="JavaScript">
<!--
window.onload = focusMessageBox;
function focusMessageBox()
{
    var f = getForm('post_note_form');
    f.note.focus();
}
//-->
</script>
{/literal}
{/if}

{/if}

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