<{include file="db:`$mydirname`_header.html"}>

<{include file="db:`$mydirname`_permission.html"}>



<form action="<{my_make_uri option=$uri_options mydirname=$mydirname controller=submit method=post}>" name="postlinkform" method="post" onsubmit='return submitCheck();' >

<table border="1" style="padding:6px;border-collapse:collapse;empty-cells:show; border-color:#999;margin-bottom:16px;">
  <tr>
    <th nowrap="nowrap" colspan="2">
      <{$smarty.const._MD_SUBMITLINK}>
    </th>
  </tr>
  <tr class="<{cycle values='odd,even'}>">
    <td class="head" nowrap="nowrap">
      <{$smarty.const._MD_SITETITLE}>
    </td>
    <td>
      <input type="text" name="title" size="50" maxlength="255" value="<{if $sitetitle}><{$sitetitle}><{/if}>" />
    </td>
  </tr>
  <tr class="<{cycle values='odd,even'}>">
    <td class="head" nowrap="nowrap">
      <{$smarty.const._MD_SITEURL}>
    </td>
    <td>
      <input type="text" name="url" size="50" maxlength="255" value="<{if $siteurl}><{$siteurl}><{else}>https://<{/if}>" />
      <a href="javascript:void(0);" onClick="check_URL(1);"><{$smarty.const._MD_CHECK_URL}></a>
    </td>
  </tr>
  <tr class="<{cycle values='odd,even'}>">
    <td class="head" nowrap="nowrap">
        <{if $category_selector==0 && $allcid != ''}>
          <div style="padding-left:12px;font-weight:normal;">
            <a href="javascript:void(0)" onclick="addHTML('categ','categadd');"><{$smarty.const._MD_ADDCATEGORY}></a>
          </div>
        <{/if}>
      </td>
    <td>
      <div id="categ"><{$category_selbox}></div>
      <div id="categadd"></div>
    </td>
  </tr>
  <tr class="<{cycle values='odd,even'}>">
    <td class="head" nowrap="nowrap">
      <{$smarty.const._MD_DESCRIPTIONC}>
      <div style="padding-left:12px;font-weight:normal;">
        <input type="checkbox" onClick="onoff('desc_bbcode_buttons_pre')" id="desc_bbcode_buttons_preONOFF"><{$smarty.const._MD_TOOLS}><br />
        <input type="checkbox" onClick="onoff('desc_bbcode_buttons_post')" id="desc_bbcode_buttons_postONOFF"><{$smarty.const._MD_SMILIES}>
      </div>
    </td>
    <td>
      <{xoopsdhtmltarea name="desc" cols="50" rows="7" value=$desc pre_style="display:none;" post_style="display:none;"}>
    </td>
  </tr>

<{if $isadmin}>
  <tr class="<{cycle values='odd,even'}>">
    <td class="head" valign="top">
      <{$smarty.const._MD_REGI_DATE}>
    </td>
    <td>
      <input type="checkbox" name="make_regidate" value="1"><{$smarty.const._MD_REGI_DATE_SET}></input>
      <{$date_selector}>
    </td>
  </tr>
<{/if}>

<{if $isadmin}>
  <tr class="<{cycle values='odd,even'}>">
    <td class="head" valign="top">
      <{$smarty.const._MD_NO_CHECK_URI}>
    </td>
    <td>
      <input type="checkbox" name="no_check_uri" value="1"></input>
    </td>
  </tr>
<{/if}>

  <tr class="<{cycle values='odd,even'}>">
    <td class="head" valign="top">
      <{$smarty.const._MD_SUBMITTER}>
    </td>
    <td>
      <{if $xoops_isuser}>
        <{$uname}>
      <{else}>
        <input type="text" name="guestname" size="50" maxlength="30" value="<{if $guestname}><{$guestname}><{else}><{$uname}><{/if}>" />
      <{/if}>
    </td>
  </tr>

  <tr class="foot">
    <td></td>
    <td>
      <{if $xoops_isuser}>
        <input type="submit" name="submit" class="button" value="<{$smarty.const._SUBMIT}>" />
      <{else}>
        <input type="hidden" name="CP" value="YES" />
        <input type="submit" name="submit" class="button" value="<{$smarty.const._SUBMIT}>" onclick="postlinkform.CP.value='';" />
      <{/if}>
      &nbsp;<input type="button" value="<{$smarty.const._CANCEL}>" onclick="javascript:history.go(-1)" />
    </td>
  </tr>
</table>

  <{$gticket}>
  <{* <!-- DATE a.ge --> *}>
  <input type="hidden" name="age" value="1" />
</form>

<{include file="db:`$mydirname`_footer.html"}>



<script type='text/javascript'>
<!--//
function submitCheck() {
  var myform = window.document.postlinkform;
  //TITLE check
  if( myform.title.value == "" ){
    alert("<{$smarty.const._MD_SITETITLE}><{$smarty.const._MD_SUBMIT_ALERT}>");
    myform.title.focus();
    return false;
  }
  //CATEGRY check
  <{if $category_selector==0}>
    if( myform.cid.selectedIndex==0 ){
      alert("<{$smarty.const._MD_CATEGORY}><{$smarty.const._MD_SUBMIT_ALERT}>");
      return false;
    }
  <{else}>
    var cidselect = document.getElementById('cid');
    var selectcount = 0 ;
    for(i=0;i<cidselect.length;i++) {
      if(cidselect.options[i].selected) {
        selectcount++;
      }
    }
    if( selectcount==0 ){
      alert("<{$smarty.const._MD_CATEGORY}><{$smarty.const._MD_SUBMIT_ALERT}>");
      return false;
    }
  <{/if}>
  //URL check
  var url = myform.url.value ;
  var murl = myform.murl.value ;
  if( (url=="" || url=="http://" || url.length<=7) && (murl=="" || murl=="http://" || murl.length<=7) ){
    alert("<{$smarty.const._MD_SITEURL}> or <{$smarty.const._MD_MOBILE_SITEURL}> <{$smarty.const._MD_SUBMIT_ALERT}>");
    myform.url.focus();
    return false;
  }
  return true;
}

function check_URL(status)
{
  var myform = window.document.postlinkform;
  if (status == 1) {
    url = myform.url.value;
  } else if (status == 2) {
    url = myform.murl.value;
  }
  if (!(url == '' || url =='http://' || url.length < 7)) {
    jQuery.post('<{$myurl}>/js/check_url.php', {'url':url, 'status':status}, after_check);
  } else {
    alert('<{$smarty.const._MD_INPUT_CHECK_URL}>');
  }
}

function after_check(num)
{
  if ( num == 1) {
    alert('<{$smarty.const._MD_CHECK_URL_NG}>');
  } else {
    alert('<{$smarty.const._MD_CHECK_URL_OK}>');
  }
}

//-->
</script>
