123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238 |
- {template 'common/header-gw'}
- <script type="text/javascript">
- require(['filestyle', 'util'], function($, u){
- $(".form-group").find(':file').filestyle({buttonText: '上传图片'});
- $('.form-control').blur(function(){
- var identifie = $('input[name="template[identifie]"]').val();
- $(".identifie").html(identifie);
- });
- /*表单数据检测*/
- $("#form1").submit(function(){
- var msg = '';
- var m = $.trim($(':text[name="template[name]"]').val());
- if(m == '') {
- msg += '必须输入模板名称. <br />';
- }
- if((/\*\/|\/\*|eval|\$\_/i).test(m)) {
- msg += '必须输入有效的模板名称. <br />';
- }
- var identifie = $.trim($(':text[name="template[identifie]"]').val());
- if(identifie == '' || !(/^[a-z][a-z\d_]+$/i).test(identifie)) {
- msg += '必须输入模板标识(只能包括字母和数字, 且只能以字母开头). <br />';
- }
- var author = $.trim($(':text[name="template[author]"]').val());
- if(author == '' || (/\*\/|\/\*|eval|\$\_/i).test(author)) {
- msg += '必须输入有效的作者. <br />';
- }
- var url = $.trim($(':text[name="template[url]"]').val());
- if(url == '' || (/\*\/|\/\*|eval|\$\_/i).test(url)) {
- msg += '必须输入有效的模板发布页. <br />';
- }
- if($(':checkbox[name="versions[]"]:checked').length == 0) {
- msg += '必须选择模板支持的微擎版本. <br />';
- }
- if(msg != '') {
- u.message(msg, '', 'error');
- return false;
- }
- if($(':hidden[name=do]').val() == '') {
- return false;
- }
- return true;
- });
- });
-
- /*添加配置项节点*/
- function addOption(point, title) {
- var html = '<div class="form-group">' +
- '<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">' + title +'</label>' +
- '<div class="col-sm-10">' +
- '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">' +
- '<div class="input-group" style="margin-left:-15px;margin-bottom:10px">' +
- '<span class="input-group-addon">变量名</span>' +
- '<input class="form-control" name="settings[variables][]" type="text" placeholder="请输入配置变量"> ' +
- '</div>' +
- '</div>' +
- '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">' +
- '<div class="input-group" style="margin-left:-15px;margin-bottom:10px">' +
- '<span class="input-group-addon">变量描述</span>' +
- '<input class="form-control" name="settings[description][]" type="text" placeholder="请输入变量描述"> ' +
- '</div>' +
- '</div>' +
- '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">' +
- '<div class="input-group" style="margin-left:-15px;margin-bottom:10px">' +
- '<span class="input-group-addon">值</span>' +
- '<input class="form-control" name="settings[values][]" type="text" placeholder="请输入配置值"> ' +
- '</div>' +
- '</div>' +
- '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">' +
- '<label class="checkbox-inline"> ' +
- '<a href="javascript:;" onclick="deleteOption(this)" class="fa fa-times-circle" title="删除此操作"></a> ' +
- '</label> ' +
- '</div>' +
- '</div>' +
- '</div>';
- $('#settings').append(html);
- }
-
- /*删除配置项节点*/
- function deleteOption(o) {
- $(o).parent().parent().parent().parent().remove();
- }
- </script>
-
- {template 'extension/theme-tabs'}
-
- <div class="clearfix">
- <form class="form-horizontal form" id="form1" action="" method="post" enctype="multipart/form-data">
- <input type="hidden" name="id" value="{$rule['rule'][id]}">
- <h5 class="page-header">模板基本信息 <small>这里来定义你自己模板的基本信息</small></h5>
- <div class="form-group">
- <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模板名称</label>
- <div class="col-sm-10 col-xs-12">
- <input type="text" class="form-control" placeholder="" name="template[name]"/>
- <span class="help-block">模板的名称, 由于显示在用户的模板列表中. 不要超过10个字符 </span>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模板标识</label>
- <div class="col-sm-10 col-xs-12">
- <input type="text" class="form-control" placeholder="" name="template[identifie]" />
- <span class="help-block">模板标识符, 应对应模板文件夹的名称, 微擎系统按照此标识符查找模板定义, 只能由字母数字下划线组成 </span>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模板类型</label>
- <div class="col-sm-10 col-xs-12">
- <select name="template[type]" class="form-control">
- {loop $temtypes $type}
- <option value="{$type['name']}">{$type['title']}</option>
- {/loop}
- </select>
- <span class="help-block">模板的类型, 用于分类展示和查找你的模板</span>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模板介绍</label>
- <div class="col-sm-10 col-xs-12">
- <textarea class="form-control" name="template[description]" rows="4"></textarea>
- <span class="help-block">模板详细描述, 详细介绍模板的功能和使用方法 </span>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">作者</label>
- <div class="col-sm-10 col-xs-12">
- <input type="text" class="form-control" placeholder="" name="template[author]"/>
- <span class="help-block">模板的作者, 留下你的大名吧</span>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">发布页</label>
- <div class="col-sm-10 col-xs-12">
- <input type="text" class="form-control" placeholder="" name="template[url]" value="http://bbs.we7.cc/" />
- <span class="help-block">模板的发布页, 用于发布模板更新信息的页面, 推荐使用微擎模板版块</span>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模板支持位置数</label>
- <div class="col-sm-10 col-xs-12">
- <select name="template[sections]" class="form-control">
- <option value="0">不设置位置</option>
- <?php for ($i=1; $i<=10; $i++) {?>
- <option {if $item['section'] == $i} selected{/if} value="{$i}">位置{$i}</option>
- <?php }?>
- </select>
- <span class="help-block">此设置为指定模板支持导航链接显示在模板中的位置选项,管理员可添加导航链接到相应的位置中。不设置位置则表示不支持导航位置显示。</span>
- </div>
- </div>
-
- <h5 class="page-header">模板发布 <small>这里来定义模板发布时需要的配置项<span class="text-danger">(说明:变量名用于设置不同的变量,只能是字母数字组成.变量描述可方便用户识别对应变量的作用,不能为空)</span></small></h5>
- <div id="settings">
- <div class="form-group">
- <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">配置项</label>
- <div class="col-sm-10 col-xs-12">
- <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">
- <div class="input-group" style="margin-left:-15px;margin-bottom:10px">
- <span class="input-group-addon">变量名</span>
- <input class="form-control" name="settings[variables][]" type="text" placeholder="请输入配置变量">
- </div>
- </div>
- <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">
- <div class="input-group" style="margin-left:-15px;margin-bottom:10px">
- <span class="input-group-addon">变量描述</span>
- <input class="form-control" name="settings[description][]" type="text" placeholder="请输入变量描述">
- </div>
- </div>
- <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">
- <div class="input-group" style="margin-left:-15px;margin-bottom:10px">
- <span class="input-group-addon">值</span>
- <input class="form-control" name="settings[values][]" type="text" placeholder="请输入配置值">
- </div>
- </div>
- <div class="col-xs-12 col-sm-12 col-md-4 col-lg-1">
- <label class="checkbox-inline">
- <a href="javascript:;" onclick="deleteOption(this)" class="fa fa-times-circle" title="删除此操作"></a>
- </label>
- </div>
- </div>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
- <div class="col-sm-10 col-xs-12">
- <div class="well well-sm">
- <a href="javascript:;" onclick="addOption('{$point}', '{$row['title']}');">添加操作 <i class="fa fa-plus-circle" title="添加菜单"></i></a>
- </div>
- <span class="help-block">{$row['desc']}</span>
- </div>
- </div>
-
- <div class="form-group">
- <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">兼容的微擎版本</label>
- <div class="col-sm-10 col-xs-12">
- {loop $versions $v}
- <label class="checkbox-inline">
- <input type="checkbox" name="versions[]" value="{$v}" />WeEngine {$v}
- </label>
- {/loop}
- <span class="help-block">当前模板兼容的微擎系统版本, 安装时会判断版本信息, 不兼容的版本将无法安装</span>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模板背景</label>
- <div class="col-sm-10 col-xs-12">
- <input type="file" name="preview" value="{$m['preview']}">
- <span class="help-block">模板封面, 大小为 145*225, 更好的设计将会获得官方推荐位置</span>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
- <div class="col-sm-10 col-xs-12">
- <input name="method" type="hidden" value="download"/>
- <input name="token" type="hidden" value="{$_W['token']}" />
- {if $available['create']}
- <input type="submit" class="btn btn-primary" name="submit" onclick="$(':hidden[name=method]').val('create');" value="直接生成模板文件" />
- {else}
- <input type="submit" class="btn btn-primary disabled" disabled="disabled" name="submit" value="直接生成模板文件" />
- <div class="alert-warning alert" style="width:auto;margin-top:5px;">需要 addons 目录具有可写权限</div>
- {/if}
- <span class="help-block">点此直接在源码目录 <span class="identifie">app/themes/</span> 处生成模板开发的模板文件, 方便快速开发</span>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
- <div class="col-sm-10 col-xs-12">
- {if $available['download']}
- <input type="submit" class="btn btn-primary span3" name="submit" onclick="$(':hidden[name=method]').val('download');" value="下载模板文件" />
- {else}
- <input type="submit" class="btn btn-primary span3 disabled" disabled="disabled" name="submit" value="下载模板文件" />
- <div class="alert-warning alert">需要启用 Zip 模板</div>
- {/if}
- <span class="help-block">如果您的服务器不能直接读写文件, 请下载后上传至服务器目录 <span class="identifie">app/themes/</span> 下来编辑开发 </span>
- </div>
- </div>
-
- </form>
- </div>
- {template 'common/footer-gw'}
|