{template header}
<div id="notice"></div>
<div class="subtitle">空想梦境</div>
<center>
<form method="post" name="vn_postitem" onsubmit="return false;">
	<input type="hidden" name="vnmode" id="vnmode" value="none">
    <span class="grey"><div id="vmixtips">$vnmix_top_tips</div></span>
    <span class="yellow"><div id="vmixc2">所持切糕数：$udata['credits2']</div></span>
	<table>
        <tr>
            <td class="b1" height=20px><span>{lang stf0}</span></td>
            <td class="b1"><span>{lang stf1}</span></td>
            <td class="b1"><span>{lang stf2}</span></td>
            <td class="b1"><span>{lang stf3}</span></td>
            <td class="b1"><span>{lang stf4}</span></td>
        </tr>
        <tr>
            <td class="b3">
                <input type="text" name="vsname0" list="vsnamelist" value="<!--{if !empty($carr['stf0'])}-->$carr['stf0']<!--{/if}-->" maxlength="30" onkeydown="if(event.keyCode==13){event.preventDefault();}">
            </td>
            <td class="b3">
                <input type="text" name="vsname1" list="vsnamelist" value="<!--{if !empty($carr['stf1'])}-->$carr['stf1']<!--{/if}-->" maxlength="30" onkeydown="if(event.keyCode==13){event.preventDefault();}">
            </td>
            <td class="b3">
                <input type="text" name="vsname2" list="vsnamelist" value="<!--{if !empty($carr['stf2'])}-->$carr['stf2']<!--{/if}-->" maxlength="30" onkeydown="if(event.keyCode==13){event.preventDefault();}">
            </td>
            <td class="b3">
                <input type="text" name="vsname3" list="vsnamelist" value="<!--{if !empty($carr['stf3'])}-->$carr['stf3']<!--{/if}-->" maxlength="30" onkeydown="if(event.keyCode==13){event.preventDefault();}">
            </td>
            <td class="b3">
                <input type="text" name="vsname4" list="vsnamelist" value="<!--{if !empty($carr['stf4'])}-->$carr['stf4']<!--{/if}-->" maxlength="30" onkeydown="if(event.keyCode==13){event.preventDefault();}">
            </td>
        </tr>
    </table>
    <br>
    <table>
        <tr>
            <td class="b1" width=20px></td>
            <td class="b1"><span>{lang viclass}</span></td>
            <td class="b1"><span>{lang vitm}</span></td>
            <td class="b1"><span>{lang vitmk}</span></td>
            <td class="b1"><span>{lang vitme}</span></td>
            <td class="b1"><span>{lang vitms}</span></td>
            <td class="b1"><span>{lang vitmsk}</span></td>
            <td class="b1"><span>{lang veitmsk}</span></td>
        </tr>
        <tr>
            <td class="b3" width=20px>↪</td>
            <td class="b3">
                <select name="vrck">
                    <!--{eval $tmpck = !empty($carr['class']) ? $carr['class'] : 'item';}-->
					<!--{loop $vrclassinfo $ck $vcarr}-->
					<option value="$ck" <!--{if $ck===$carr['class']}-->selected<!--{/if}-->>$vcarr[0]
                    <!--{/loop}-->
                </select>
            </td>
            <td class="b3">
                <input type="text" name="vrname" list="vsnamelist" value="<!--{if !empty($carr['itm'])}-->$carr['itm']<!--{else}-->在此填写道具名<!--{/if}-->" maxlength="30" onkeydown="if(event.keyCode==13){event.preventDefault();}">
            </td>
            <td class="b3">
                <select name="vrk">
                    <!--{eval $tmpk = !empty($carr['itmk']) ? $carr['itmk'] : 'Y';}-->
					<!--{loop $temp_vn_iteminfo $k $info}-->
					<option value="$k" <!--{if $k===$carr['itmk']}-->selected<!--{/if}-->>$info
                    <!--{/loop}-->
                </select>
            </td>
            <td class="b3">	
                <input type="number" name="vre" style="width:45px" value="$carr['itme']" min="1" max="16777214" oninput="if(value>16777214)value=16777214;if(value<1)value=1" onkeydown="if(event.keyCode==13){event.preventDefault();}">
            </td>
            <td class="b3">
                <span tooltip2="输入值为0时耐久度为“∞”">
                <input type="number" name="vrs" style="width:45px" value="$carr['itms']" min="0" max="65535" oninput="if(value>65535)value=65535;if(value<0)value=0" onkeydown="if(event.keyCode==13){event.preventDefault();}">
                </span>
            </td>
            <td class="b3" style="min-width: 200px;">
                <div id="tmpsk"><!--{if !empty($carr['itmsk_desc'])}-->{$carr['itmsk_desc']}<!--{/if}--></div>
                <input type="hidden" id="vrsk" name="vrsk" value="{$carr['itmsk']}">
            </td>
            <td class="b3">
                <span tooltip2="删除最后一个添加的属性"><input type="button" value="-" onclick="changeVrskResult(-1);"></span> 
                <select id="evrsk" name="evrsk">
                    <!--{eval $tmpk = !empty($carr['itmk']) ? $carr['itmk'] : 'Y';}-->
					<!--{loop $temp_vn_itemspkinfo $sk $info}-->
					<option value="$sk">$info</option>
                    <!--{/loop}-->
                </select>
                <span tooltip2="添加当前选择的属性"><input type="button" value="+" onclick="changeVrskResult();"></span>
            </td>
        </tr>
	</table>
    <!--{if $vnmix_name_assoc}-->
    <datalist id="vsnamelist">
        <!--{loop $temp_item_namelist $in}-->
            <option value="$in">
        <!--{/loop}-->
    </datalist>
    <!--{/if}-->
    <br>
    <div id="vmixlog">$vmixlog</div>
    <div id="vmixprint"></div>
    <!--{if isset($self_edit_flag)}-->
        <!--{eval $ep='ep+'.$editid;$dp='dp+'.$editid;$c1='cs+'.$editid.'+1';$c2='cs+'.$editid.'+2';}-->
            <!--{if ($udata['groupid']>=$vnmix_editor_group||$udata['username']==$gamefounder)}-->
                <input type="radio" id="c1" name="exmode" value="$c1" style="margin-left: 10px;"><a onclick="$('c1').click();" href="javascript:void(0);">审核通过</a>
                <input type="radio" id="c2" name="exmode"value="$c2" style="margin-left: 10px;"><a onclick="$('c2').click();" href="javascript:void(0);">审核不通过</a>
            <!--{/if}-->
            <input type="radio" id="ep" name="exmode" value="$ep" style="margin-left: 10px;" checked><a onclick="$('ep').click();" href="javascript:void(0);">编辑</a>
            <input type="radio" id="dp" name="exmode" value="$dp" style="margin-left: 10px;"><a onclick="$('dp').click();" href="javascript:void(0);"><span class="red">删除（该操作不可撤销！）</span></a>
        <br>
    <!--{/if}-->
    <br>
    <input type="button" value="提交" onClick="$('vnmode').value='postmode';postCmd('vn_postitem','vn_postitem.php');disabled=true;setTimeout(function(){disabled=false;},1000);">
    <a href="vnworld.php"><input type="button" value="返回"></a>
    <br>
</form> 
<script>
function changeVrskResult(mode=0)
{
    var sk = $('vrsk').value;
    var tsk = sk ? $('tmpsk').innerHTML : '';
    var key = $('evrsk').selectedIndex;
    var arr = $('evrsk').options;
    if(!mode && sk.length>=7)
    {
        window.alert("不能添加超过7个属性");
        return;
    }
    if(key || mode<0)
    {
        var skarr = sk.length>0 ? sk.split('') : [];
        var tarr = tsk.length>0 ? tsk.split('+') : [];
        if(!mode)
        {
            skarr.push(arr[key].value);
            tarr.push(arr[key].text);
        }
        else
        {
            skarr.pop(); tarr.pop();
        }
        $('vrsk').value = skarr.join('');
        $('tmpsk').innerHTML = tarr.join('+');
    }
}
</script>
</center>
{template footer}