qa-ifish7/web/Application/Admin/View/Template/publicEditor.html

107 lines
4.8 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<include file="Inc:header"/>
<style>
.div-li{ width: 25%; float: left; height: 40px; line-height 40px;}
</style>
<div class="container-fluid">
<div class="main_head">
</div>
<div style="text-align:right; float:right"></div>
<div class="row-fluid">
<div class="span12">
<div class="widget-box">
<div class="widget-title"> <span class="icon"> <i class=" icon-align-justify"></i> </span>
<ul class="sub-nav">
<li>{$pagetitle}</li>
</ul>
</div>
<div class="widget-content nopadding">
<form action="{:U('editor')}" method="post" class="form-horizontal" onsubmit="return this_submit(this);" >
<input type="hidden" name="type" value="public">
<input type="hidden" name="template_id" value="{$r.template_id}">
<!--基本信息开始-->
<div class="sub-nav-tab" style="display:block">
<div class="control-group">
<label class="control-label">变量标识</label>
<div class="controls">
<input type="text" name="name" value="{$r.name}"/> (如:公共头部)
</div>
</div>
<div class="control-group">
<label class="control-label">变量名</label>
<div class="controls">
[!--public.<input type="text" name="myvar" class="span1" value="{$r.myvar}"/> --] (如header变量就是[!--public.header--])
</div>
</div>
<?php
if(C('LANG_SWITCH_ON')){
?>
<div class="control-group">
<label class="control-label">语言</label>
<div class="controls">
<select name="lang">
<option value="">请选择语言</option>
<foreach name="LANG_OPT" item="v">
<option value="{$key}" {$key==$r[lang]?"selected":""}>{$v}</option>
</foreach>
</select>
</div>
</div>
<?php
}
?>
<div class="control-group">
<label class="control-label">模板内容</label>
<div class="controls">
<textarea name="content" id="template_editor" class="span11" style="height:500px;">{$r.content}</textarea>
</div>
</div>
</div>
<!--基本信息结束-->
<div class="form-actions">
<button type="submit" class="btn btn-success form_submit">提交</button>
<button type="button" class="btn btn-danger" onclick="cancel()">返回</button>
<a href="{:U('TemplateHistory/index',array('template_id'=>$r[template_id]))}" class="btn btn-primary iframe">查看历吏记录</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<include file="Inc/footer"/>
<include file="Inc/info_js"/>
<!--代码编辑器插件-->
<link rel="stylesheet" type="text/css" href="/Public/Admin/codemirror/lib/codemirror.css">
<script src="/Public/Admin/codemirror/lib/codemirror.js"></script>
<link rel="stylesheet" href="/Public/Admin/codemirror/theme/abcdef.css">
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("template_editor"), {
lineNumbers: true,
styleActiveLine: true,
matchBrackets: true,
theme:"abcdef",
});
function this_submit(obj){
$("#template_editor").val(editor.getValue());
//这里为什么要延时的原因因为editor.getValue()这个方法获取到代码需要时间计算的,如果不延时的话提交的是一个空值
setTimeout(function(){
save_form(obj);
},200);
return false;
}
function updateCode(){
editor.setValue($("#template_editor").val());
}
</script>