<{if $preview.title}>
<table class="outer">
  <tbody>
  <tr><td class="head"><{$preview.title}></td></tr>
  <tr><td><{$preview.hometext}></td></tr>
  </tbody>
</table>
<br />
<{/if}>

<form name="storyform" id="storyform" action="?page=submit" method="post" onsubmit="return xoopsFormValidate_storyform();">
  <{$gticket}>
  <{if $storyid}><input type="hidden" name="storyid" value="<{$storyid}>"/><{/if}>
  <{if $return}><input type="hidden" name="return" value="<{$return}>"/><{/if}>
  <table class="outer" cellspacing="1" width="100%">
    <tr><th colspan="2"><{$smarty.const._MD_SUBMITNEWS}></th></tr>
    <tr align="left" valign="top">
      <td class="head"><{$smarty.const._MD_POSTEDBY}></td>
      <td class="even"><{$poster}></td>
    </tr>
    <tr align="left" valign="top">
      <td class="head"><{$smarty.const._MD_TITLE}></td>
      <td class="even"><input type="text" name="title" value="<{$title}>" size="50" maxlength="80" /></td>
    </tr>
    <tr align="left" valign="top">
      <td class="head"><{$smarty.const._MD_TOPIC}></td>
      <td class="even"><{$topic_selbox}></td>
    </tr>
    <tr align="left" valign="top">
      <td class="head"><{$smarty.const._MD_TOPIC_IMAGE}></td>
      <td class="even">
        <select name="topicimg">
          <option value="1"<{if $topicimg==1}> selected="selected"<{/if}>><{$smarty.const._MD_TOPIC_RIGHT}></option>
          <option value="2"<{if $topicimg==2}> selected="selected"<{/if}>><{$smarty.const._MD_TOPIC_LEFT}></option>
          <option value="0"<{if $topicimg==0}> selected="selected"<{/if}>><{$smarty.const._MD_TOPIC_DISABLE}></option>
        </select>
      </td>
    </tr>
    <tr align="left" valign="top">
      <td class="head"><{$smarty.const._MD_THESCOOP}>
<{php}>
$this->assign( 'common_fck_installed' , file_exists( XOOPS_ROOT_PATH.'/common/fckeditor/fckeditor.js' ) ) ;
<{/php}>
<{if ! $common_fck_installed and $use_fckeditor}>
	<{if $smarty.const._MYCKEDITOR_MODULE_LOADED == 1}>
		<{php}>
			$_makescript = & xoops_getmodulehandler('makescript','myckeditor');
			$params = array('id'=>'text','editor'=>'bbcode','myckeditor'=>'display');
			$_makescript->makeheader($params);
		<{/php}>
	<br />
	<input type="button" class="formButton" value="CKEeditorOn" name="myckeditorOn" onclick="text_myckeditor_exec();document.getElementById('switch_bbcode').checked=false;document.getElementById('text_bbcode_buttons_pre').style.display='none';document.getElementById('text_bbcode_buttons_post').style.display='none';"/>
	<br />
	<input type="button" class="formButton" value="CKEeditorOff" name="myckeditorOff" onclick="text_myckeditor_remove();"/>
	<{/if}>
<{/if}>
      </td>
      <td class="even">
      <{if ! $common_fck_installed}>
        <div id="area_dhtmltarea">
          <label><input id="switch_bbcode" type="checkbox" onclick="var pre=xoopsGetElementById('text_bbcode_buttons_pre');var post=xoopsGetElementById('text_bbcode_buttons_post');if(this.checked){pre.style.display='block';post.style.display='block';text_myckeditor_remove();}else{pre.style.display='none';post.style.display='none'};" /><{$smarty.const._MD_INPUTHELPER}></label>
          <br />
          <{xoopsdhtmltarea name="text" cols=$bulletin_post_tray_col rows=$bulletin_post_tray_row value=$text pre_style="display:none;" post_style="display:none;"}>
        </div>
      <{else}>
        <{if $use_fckeditor}>
          <label><input type="checkbox" name="using_fck" checked="checked" onclick="var td=xoopsGetElementById('area_dhtmltarea');var tf=xoopsGetElementById('area_fckxoops');if(this.checked){tf.style.display='block';td.style.display='none';}else{td.style.display='block';tf.style.display='none';};" /><{$smarty.const._MD_FCKXOOPS_ONOFF}></label>
        <{/if}>
        <div id="area_dhtmltarea">
          <label><input type="checkbox" onclick="var pre=xoopsGetElementById('text_bbcode_buttons_pre');var post=xoopsGetElementById('text_bbcode_buttons_post');if(this.checked){pre.style.display='block';post.style.display='block'}else{pre.style.display='none';post.style.display='none'};" /><{$smarty.const._MD_INPUTHELPER}></label>
          <br />
          <{xoopsdhtmltarea name="text" cols=$bulletin_post_tray_col rows=$bulletin_post_tray_row value=$text pre_style="display:none;" post_style="display:none;"}>
        </div>
        <{if $use_fckeditor}>
          <div id="area_fckxoops">
            <script type="text/javascript" src="<{$xoops_url}>/common/fckeditor/fckeditor.js"></script>
            <script type="text/javascript">
              function fckeditor_exec() {
                var oFCKeditor = new FCKeditor( "text_fck" , "100%" , "500" , "Default" );
                oFCKeditor.BasePath = "<{$xoops_url}>/common/fckeditor/";
                oFCKeditor.ReplaceTextarea();
              }
            </script>
            <textarea id="text_fck" name="text_fck"><{$text}></textarea>
            <script>
              fckeditor_exec();
              xoopsGetElementById('area_dhtmltarea').style.display='none';
            </script>
          </div>
        <{/if}>
      <{/if}>
        <div><{$smarty.const._MULTIPAGE}></div>
      </td>
    </tr>
    <{if $can_use_date}>
      <tr align="left" valign="top">
        <td class="head"><{$smarty.const._MD_PUBLISHED}></td>
        <td class="even">
          <label><input type="checkbox" value="1" name="autodate" <{if $autodate}>checked="checked"<{/if}> /><{$smarty.const._MD_SETDATETIME}></label>&nbsp;
          <span style="font-size:0.8em;"><{$smarty.const._MD_SETDATETIME_DESC}></span><br />
          <{$post_date_selector}>
        </td>
      </tr>
      <tr align="left" valign="top">
        <td class="head"><{$smarty.const._MD_EXPIRED}></td>
        <td class="even">
          <label><input type="checkbox" value="1" name="autoexpdate" <{if $autoexpdate}>checked="checked"<{/if}> /><{$smarty.const._MD_SETEXPDATETIME}></label>&nbsp;
          <span style="font-size:0.8em;"><{$smarty.const._MD_SETEXPDATETIME_DESC}></span><br />
          <{$expire_date_selector}>
        </td>
      </tr>
    <{/if}>
    <{if $use_relation}>
      <tr align="left" valign="top">
        <td class="head"><{$smarty.const._MD_RELATION}></td>
        <td class="even">
          <div id="relation">
          <{foreach item=i from=$relations}>
            <input type="checkbox" name="storyidR[]" value="<{$i.linkedid}>" />
            <input type="hidden" name="titleR[]" value="<{$i.title}>" />
            <input type="hidden" name="dirnameR[]" value="<{$i.dirname}>" />
            <input type="hidden" name="storyidRH[]" value="<{$i.linkedid}>" />
            <{$i.title}><br />
          <{/foreach}>
          </div>
          <input type="button" value="<{$smarty.const._MD_ADD_RELATION}>" name="opensub" onclick="window.open('index.php?page=search','sub','width=400,height=500');">
          <input type="button" value="<{$smarty.const._DELETE}>" name="updatevar" onclick="updateRelations('storyform', false)">
        </td>
      </tr>
    <{/if}>
    <tr align="left" valign="top">
      <td class="head"><{$smarty.const._OPTIONS}></td>
      <td class="even">
        <{if $use_notify}>
          <label><input type="checkbox" value="1" name="notifypub" <{if $notifypub}>checked="checked"<{/if}> /><{$smarty.const._MD_NOTIFYPUBLISH}></label><br />
        <{/if}>
        <{if $use_html}>
          <label><input type="checkbox" value="1" name="html" <{if $html}>checked="checked"<{/if}> /><{$smarty.const._MD_USE_HTML}></label><br />
        <{/if}>
        <label><input type="checkbox" value="1" name="br" <{if $br}>checked="checked"<{/if}> /><{$smarty.const._MD_USE_BR}></label><br />
        <label><input type="checkbox" value="1" name="smiley" <{if $smiley}>checked="checked"<{/if}> /><{$smarty.const._MD_USE_SMILEY}></label><br />
        <label><input type="checkbox" value="1" name="xcode" <{if $xcode}>checked="checked"<{/if}> /><{$smarty.const._MD_USE_XCODE}></label><br />
        <label><input type="checkbox" value="1" name="block" <{if $block}>checked="checked"<{/if}> /><{$smarty.const._MD_DISP_BLOCK}></label><br />
        <label><input type="checkbox" value="1" name="ihome" <{if $ihome}>checked="checked"<{/if}> /><{$smarty.const._MD_PUBINHOME}></label><br />
        <{if $use_approve}>
          <label><input type="checkbox" value="1" name="approve" <{if $approve}>checked="checked"<{/if}> /><{$smarty.const._MD_APPROVE}></label><br />
        <{/if}>
      </td>
    </tr>
    <tr align="left" valign="top">
      <td class="head">&nbsp;</td>
      <td class="even">
        <input class="formButton" name="preview" id="preview" value="<{$smarty.const._PREVIEW}>" type="submit" />&nbsp;
        <input class="formButton" name="post" id="post" value="<{$smarty.const._MD_POST}>" type="submit" />
      </td>
    </tr>
  </table>
</form>

<!-- Start Form Vaidation JavaScript //-->
<script type="text/javascript">
  function xoopsFormValidate_storyform() {
    myform = window.document.storyform;
    if ( myform.title.value == "" ) { window.alert("<{'{0}'|str_replace:$smarty.const._MD_TITLE:$smarty.const._MD_ERROR_REQUIRED}>"); myform.title.focus(); return false; }
    return true;
  }
</script>
<!-- End Form Vaidation JavaScript //-->

