<?php if(!defined('IN_SDCMS')) exit;?><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<title>编辑模板</title>
<link rel="stylesheet" href="{WEB_ROOT}public/css/ui.css">
<link rel="stylesheet" href="{WEB_ROOT}public/admin/css/layout.css">
<script src="{WEB_ROOT}public/js/jquery.js"></script>
<script src="{WEB_ROOT}public/js/ui.js"></script>
</head>

<body>
    <div class="position">当前位置：模板插件 > <a href="{U('index')}">模板管理</a>{$position} > <a href="{THIS_LOCAL}">编辑模板</a></div>
    <div class="border">
        <!---->
        <div class="form-subject">编辑模板</div>
        <form class="ui-form" method="post">
            <div class="form-group row">
                <label class="col-2 col-form-label">文件名：</label>
                <div class="col-4">
                    <input type="text" name="file" class="form-ip" value="{$file}" readonly>
                    <input type="hidden" name="t0" class="form-ip" value="{$file_code}">
                </div>
            </div>
            <div class="form-group row">
                <label class="col-2 col-form-label">注释：</label>
                <div class="col-4">
                    <input type="text" name="t1" class="form-ip" value="{$remark}">
                </div>
            </div>
            <div class="form-group row">
                <label class="col-2 col-form-label">内容：</label>
                <div class="col-10">
                    <textarea name="t2" rows="20" class="form-ip">{theme_html($data)}</textarea> 
                    <span class="input-tips">友情提示：<span class="text-red">如无法在线保存，请通过FTP修改模板文件</span></span>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-2 col-form-label"></label>
                <div class="col-4">
                    <button type="submit" class="btn btn-info mr-sm">保存</button>
                    <button type="button" class="btn ui-back">返回</button>
                </div>
            </div>
        </form>
        <!---->
    </div>

<script>
$(function()
{
	$(".ui-form").form(
	{
		type:2,
		result:function(form)
		{
			$.ajax(
			{
                type:'post',
                cache:false,
                dataType:'json',
                url:'{THIS_LOCAL}',
                data:$(form).serialize(),
                error:function(e){alert(e.responseText);},
                success:function(d)
                {
                    if(d.state=='success')
                    {
                        sdcms.success(d.msg);
                        setTimeout(function(){location.href='{U("lists","root=".$old."")}';},1500);
                    }
                    else
                    {
                        sdcms.error(d.msg);
                    }
                }
            });
		}
	});
})
</script>
</body>
</html>