初始化项目
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
Options +FollowSymlinks
|
||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
|
||||||
|
</IfModule>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
namespace addons\devteam;
|
||||||
|
use app\common\controller\Addons;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开发团队信息插件
|
||||||
|
* @author thinkphp
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Devteam extends Addons{
|
||||||
|
|
||||||
|
public $info = array(
|
||||||
|
'name'=>'Devteam',
|
||||||
|
'title'=>'开发团队信息',
|
||||||
|
'description'=>'开发团队成员信息',
|
||||||
|
'status'=>1,
|
||||||
|
'author'=>'molong',
|
||||||
|
'version'=>'0.1'
|
||||||
|
);
|
||||||
|
|
||||||
|
public function install(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function uninstall(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//实现的AdminIndex钩子方法
|
||||||
|
public function AdminIndex($param){
|
||||||
|
$config = $this->getConfig();
|
||||||
|
$this->assign('addons_config', $config);
|
||||||
|
if($config['display']){
|
||||||
|
$this->template('widget');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'title'=>array(//配置在表单中的键名 ,这个会是config[title]
|
||||||
|
'title'=>'显示标题:',//表单的文字
|
||||||
|
'type'=>'text', //表单的类型:text、textarea、checkbox、radio、select等
|
||||||
|
'value'=>'SentCMS开发团队', //表单的默认值
|
||||||
|
),
|
||||||
|
'width'=>array(
|
||||||
|
'title'=>'显示宽度:',
|
||||||
|
'type'=>'select',
|
||||||
|
'options'=>array(
|
||||||
|
'1'=>'1格',
|
||||||
|
'2'=>'2格',
|
||||||
|
'4'=>'4格',
|
||||||
|
'6'=>'6格'
|
||||||
|
),
|
||||||
|
'value'=>'6'
|
||||||
|
),
|
||||||
|
'display'=>array(
|
||||||
|
'title'=>'是否显示:',
|
||||||
|
'type'=>'radio',
|
||||||
|
'options'=>array(
|
||||||
|
'1'=>'显示',
|
||||||
|
'0'=>'不显示'
|
||||||
|
),
|
||||||
|
'value'=>'1'
|
||||||
|
)
|
||||||
|
);
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<div class="col-lg-{$addons_config.width}">
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<h2>{$addons_config.title}</h2>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<th>总策划</th>
|
||||||
|
<td>郭平平</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>产品设计及研发团队</th>
|
||||||
|
<td>郭平平</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>界面及用户体验团队</th>
|
||||||
|
<td>BootStrap 团队</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>官方网址</th>
|
||||||
|
<td><a href="http://www.tensent.cn" target="_blank">www.tensent.cn</a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>官方QQ群</th>
|
||||||
|
<td><a target="_blank" href="http://jq.qq.com/?_wv=1027&k=WVW2se"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="SentCMS技术交流" title="SentCMS技术交流"></a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>BUG反馈</th>
|
||||||
|
<td><a href="http://bbs.sentcms.com/" target="_blank">SentCMS讨论区</a></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: yangweijie <yangweijiester@gmail.com> <code-tech.diandian.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
namespace addons\sitestat;
|
||||||
|
use app\common\controller\Addons;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统环境信息插件
|
||||||
|
* @author thinkphp
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Sitestat extends Addons{
|
||||||
|
|
||||||
|
public $info = array(
|
||||||
|
'name'=>'Sitestat',
|
||||||
|
'title'=>'站点统计信息',
|
||||||
|
'description'=>'统计站点的基础信息',
|
||||||
|
'status'=>1,
|
||||||
|
'author'=>'thinkphp',
|
||||||
|
'version'=>'0.2'
|
||||||
|
);
|
||||||
|
|
||||||
|
public function install(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function uninstall(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//实现的AdminIndex钩子方法
|
||||||
|
public function AdminIndex($param){
|
||||||
|
$config = $this->getConfig();
|
||||||
|
$this->assign('addons_config', $config);
|
||||||
|
$map['status'] = array('egt',0);
|
||||||
|
$maps['is_read'] = array('eq',0);
|
||||||
|
if($config['display']){
|
||||||
|
$info['users'] = db('Member')->where($map)->count();
|
||||||
|
$info['userall'] = db('Member')->count();
|
||||||
|
$info['action'] = db('ActionLog')->where(array('create_time'=>array('gt',strtotime(date('Y-m-d')))))->count();
|
||||||
|
$info['category'] = db('Category')->count();
|
||||||
|
$info['model'] = db('Model')->count();
|
||||||
|
$this->assign('info',$info);
|
||||||
|
$this->template('index/info');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: yangweijie <yangweijiester@gmail.com> <code-tech.diandian.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'title'=>array(//配置在表单中的键名 ,这个会是config[title]
|
||||||
|
'title'=>'显示标题:',//表单的文字
|
||||||
|
'type'=>'text', //表单的类型:text、textarea、checkbox、radio、select等
|
||||||
|
'value'=>'系统信息', //表单的默认值
|
||||||
|
),
|
||||||
|
'width'=>array(
|
||||||
|
'title'=>'显示宽度:',
|
||||||
|
'type'=>'select',
|
||||||
|
'options'=>array(
|
||||||
|
'4'=>'4格',
|
||||||
|
'6'=>'6格',
|
||||||
|
'12'=>'12格',
|
||||||
|
),
|
||||||
|
'value'=>'2'
|
||||||
|
),
|
||||||
|
'display'=>array(
|
||||||
|
'title'=>'是否显示:',
|
||||||
|
'type'=>'radio',
|
||||||
|
'options'=>array(
|
||||||
|
'1'=>'显示',
|
||||||
|
'0'=>'不显示'
|
||||||
|
),
|
||||||
|
'value'=>'1'
|
||||||
|
)
|
||||||
|
);
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-3 col-sm-6 col-xs-12">
|
||||||
|
<div class="main-box infographic-box colored emerald-bg"> <i class="fa fa-envelope"></i>
|
||||||
|
<span class="headline">今日行为</span>
|
||||||
|
<span class="value">{$info['action']}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3 col-sm-6 col-xs-12">
|
||||||
|
<div class="main-box infographic-box colored green-bg"> <i class="fa fa-money"></i>
|
||||||
|
<span class="headline">栏目总数</span>
|
||||||
|
<span class="value">{$info['category']}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3 col-sm-6 col-xs-12">
|
||||||
|
<div class="main-box infographic-box colored red-bg"> <i class="fa fa-user"></i>
|
||||||
|
<span class="headline">用户总数</span>
|
||||||
|
<span class="value">{$info['users']}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3 col-sm-6 col-xs-12">
|
||||||
|
<div class="main-box infographic-box colored purple-bg">
|
||||||
|
<i class="fa fa-globe"></i>
|
||||||
|
<span class="headline">模型总数</span>
|
||||||
|
<span class="value">{$info['model']}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: yangweijie <yangweijiester@gmail.com> <code-tech.diandian.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
namespace addons\Syslogin;
|
||||||
|
use app\common\controller\Addons;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统环境信息插件
|
||||||
|
* @author thinkphp
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Syslogin extends Addons{
|
||||||
|
|
||||||
|
public $info = array(
|
||||||
|
'name'=>'Syslogin',
|
||||||
|
'title'=>'第三方登录',
|
||||||
|
'description'=>'第三方登录',
|
||||||
|
'status'=>0,
|
||||||
|
'author'=>'molong',
|
||||||
|
'version'=>'0.1'
|
||||||
|
);
|
||||||
|
|
||||||
|
public function loginBottom(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function install(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function uninstall(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace addons\syslogin\controller;
|
||||||
|
use app\common\controller\Addons;
|
||||||
|
|
||||||
|
class Admin extends Addons{
|
||||||
|
|
||||||
|
public function setting(){
|
||||||
|
$this->template('admin/login');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace addons\syslogin\controller;
|
||||||
|
use app\common\controller\Addons;
|
||||||
|
|
||||||
|
class Index extends Addons{
|
||||||
|
|
||||||
|
public function login(){
|
||||||
|
$this->template('index/login');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{extend name="admin@public:base"/}
|
||||||
|
{block name="body"}
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
登录
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: yangweijie <yangweijiester@gmail.com> <code-tech.diandian.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
namespace addons\systeminfo;
|
||||||
|
use app\common\controller\Addons;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统环境信息插件
|
||||||
|
* @author thinkphp
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Systeminfo extends Addons{
|
||||||
|
|
||||||
|
public $info = array(
|
||||||
|
'name'=>'Systeminfo',
|
||||||
|
'title'=>'系统环境信息',
|
||||||
|
'description'=>'用于显示一些服务器的信息',
|
||||||
|
'status'=>1,
|
||||||
|
'author'=>'molong',
|
||||||
|
'version'=>'0.1'
|
||||||
|
);
|
||||||
|
|
||||||
|
public function install(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function uninstall(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//实现的AdminIndex钩子方法
|
||||||
|
public function AdminIndex($param){
|
||||||
|
$config = $this->getConfig();
|
||||||
|
|
||||||
|
if(false){//extension_loaded('curl')
|
||||||
|
$url = 'http://www.tensent.cn/index.php?m=home&c=version&a=check_version';
|
||||||
|
$params = array(
|
||||||
|
'version' => ONETHINK_VERSION,
|
||||||
|
'domain' => $_SERVER['HTTP_HOST'],
|
||||||
|
'auth' => sha1(config('DATA_AUTH_KEY')),
|
||||||
|
);
|
||||||
|
|
||||||
|
$vars = http_build_query($params);
|
||||||
|
$opts = array(
|
||||||
|
CURLOPT_TIMEOUT => 5,
|
||||||
|
CURLOPT_RETURNTRANSFER => 1,
|
||||||
|
CURLOPT_URL => $url,
|
||||||
|
CURLOPT_POST => 1,
|
||||||
|
CURLOPT_POSTFIELDS => $vars,
|
||||||
|
CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT'],
|
||||||
|
);
|
||||||
|
|
||||||
|
/* 初始化并执行curl请求 */
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt_array($ch, $opts);
|
||||||
|
$data = curl_exec($ch);
|
||||||
|
$error = curl_error($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($data) && strlen($data)<400 ){
|
||||||
|
$config['new_version'] = $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assign('addons_config', $config);
|
||||||
|
if($config['display']){
|
||||||
|
$this->template('widget');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: yangweijie <yangweijiester@gmail.com> <code-tech.diandian.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'title'=>array(//配置在表单中的键名 ,这个会是config[title]
|
||||||
|
'title'=>'显示标题:',//表单的文字
|
||||||
|
'type'=>'text', //表单的类型:text、textarea、checkbox、radio、select等
|
||||||
|
'value'=>'系统信息', //表单的默认值
|
||||||
|
),
|
||||||
|
'width'=>array(
|
||||||
|
'title'=>'显示宽度:',
|
||||||
|
'type'=>'select',
|
||||||
|
'options'=>array(
|
||||||
|
'3'=>'3格',
|
||||||
|
'4'=>'4格',
|
||||||
|
'6'=>'6格'
|
||||||
|
),
|
||||||
|
'value'=>'6'
|
||||||
|
),
|
||||||
|
'display'=>array(
|
||||||
|
'title'=>'是否显示:',
|
||||||
|
'type'=>'radio',
|
||||||
|
'options'=>array(
|
||||||
|
'1'=>'显示',
|
||||||
|
'0'=>'不显示'
|
||||||
|
),
|
||||||
|
'value'=>'1'
|
||||||
|
)
|
||||||
|
);
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<div class="col-lg-{$addons_config.width}">
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<h2>{$addons_config.title}</h2>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<th>核心版本</th>
|
||||||
|
<td>SentCMS v{$Think.SENTCMS_VERSION}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>服务器操作系统</th>
|
||||||
|
<td>{$Think.const.PHP_OS}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>运行环境</th>
|
||||||
|
<td>{$_SERVER['SERVER_SOFTWARE']}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>MYSQL版本</th>
|
||||||
|
{php}$system_info_mysql = \think\Db::query("select version() as v;");{/php}
|
||||||
|
<td>{$system_info_mysql.0.v}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>上传限制</th>
|
||||||
|
<td>{:ini_get('upload_max_filesize')}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>系统版权所有</th>
|
||||||
|
<td>
|
||||||
|
<a href="http://www.tensent.cn/" target="_blank">南昌腾速科技有限公司</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* select返回的数组进行整数映射转换
|
||||||
|
*
|
||||||
|
* @param array $map 映射关系二维数组 array(
|
||||||
|
* '字段名1'=>array(映射关系数组),
|
||||||
|
* '字段名2'=>array(映射关系数组),
|
||||||
|
* ......
|
||||||
|
* )
|
||||||
|
* @author 朱亚杰 <zhuyajie@topthink.net>
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* array(
|
||||||
|
* array('id'=>1,'title'=>'标题','status'=>'1','status_text'=>'正常')
|
||||||
|
* ....
|
||||||
|
* )
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function int_to_string(&$data,$map=array('status'=>array(1=>'正常',-1=>'删除',0=>'禁用',2=>'未审核',3=>'草稿'))) {
|
||||||
|
if($data === false || $data === null ){
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
$data = (array)$data;
|
||||||
|
foreach ($data as $key => $row){
|
||||||
|
foreach ($map as $col=>$pair){
|
||||||
|
if(isset($row[$col]) && isset($pair[$row[$col]])){
|
||||||
|
$data[$key][$col.'_text'] = $pair[$row[$col]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取对应状态的文字信息
|
||||||
|
* @param int $status
|
||||||
|
* @return string 状态文字 ,false 未获取到
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
function get_status_title($status = null){
|
||||||
|
if(!isset($status)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
switch ($status){
|
||||||
|
case -1 : return '已删除'; break;
|
||||||
|
case 0 : return '禁用'; break;
|
||||||
|
case 1 : return '正常'; break;
|
||||||
|
case 2 : return '待审核'; break;
|
||||||
|
default : return false; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取数据的状态操作
|
||||||
|
function show_status_op($status) {
|
||||||
|
switch ($status){
|
||||||
|
case 0 : return '启用'; break;
|
||||||
|
case 1 : return '禁用'; break;
|
||||||
|
case 2 : return '审核'; break;
|
||||||
|
default : return false; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取行为类型
|
||||||
|
* @param intger $type 类型
|
||||||
|
* @param bool $all 是否返回全部类型
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
function get_action_type($type, $all = false){
|
||||||
|
$list = array(
|
||||||
|
1=>'系统',
|
||||||
|
2=>'用户',
|
||||||
|
);
|
||||||
|
if($all){
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
return $list[$type];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取行为数据
|
||||||
|
* @param string $id 行为id
|
||||||
|
* @param string $field 需要获取的字段
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
function get_action($id = null, $field = null){
|
||||||
|
if(empty($id) && !is_numeric($id)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$list = cache('action_list');
|
||||||
|
if(empty($list[$id])){
|
||||||
|
$map = array('status'=>array('gt', -1), 'id'=>$id);
|
||||||
|
$list[$id] = db('Action')->where($map)->field(true)->find();
|
||||||
|
}
|
||||||
|
return empty($field) ? $list[$id] : $list[$id][$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据条件字段获取数据
|
||||||
|
* @param mixed $value 条件,可用常量或者数组
|
||||||
|
* @param string $condition 条件字段
|
||||||
|
* @param string $field 需要返回的字段,不传则返回整个数据
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
function get_document_field($value = null, $condition = 'id', $field = null){
|
||||||
|
if(empty($value)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//拼接参数
|
||||||
|
$map[$condition] = $value;
|
||||||
|
$info = db('Model')->where($map);
|
||||||
|
if(empty($field)){
|
||||||
|
$info = $info->field(true)->find();
|
||||||
|
}else{
|
||||||
|
$info = $info->value($field);
|
||||||
|
}
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
return array(
|
||||||
|
|
||||||
|
'user_administrator' => 1,
|
||||||
|
|
||||||
|
'url_common_param'=>true,
|
||||||
|
|
||||||
|
'template' => array(
|
||||||
|
),
|
||||||
|
|
||||||
|
'view_replace_str' => array(
|
||||||
|
'__ADDONS__' => BASE_PATH . '/addons',
|
||||||
|
'__PUBLIC__' => BASE_PATH . '/public',
|
||||||
|
'__STATIC__' => BASE_PATH . '/application/admin/static',
|
||||||
|
'__IMG__' => BASE_PATH . '/application/admin/static/images',
|
||||||
|
'__CSS__' => BASE_PATH . '/application/admin/static/css',
|
||||||
|
'__JS__' => BASE_PATH . '/application/admin/static/js',
|
||||||
|
),
|
||||||
|
|
||||||
|
'session' => array(
|
||||||
|
'prefix' => 'admin',
|
||||||
|
'type' => '',
|
||||||
|
'auto_start' => true,
|
||||||
|
),
|
||||||
|
);
|
||||||
@@ -0,0 +1,229 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Action extends Admin {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户行为列表
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function index() {
|
||||||
|
$map = array('status' => array('gt', -1));
|
||||||
|
|
||||||
|
$order = "id desc";
|
||||||
|
//获取列表数据
|
||||||
|
$list = model('Action')->where($map)->order($order)->paginate(10);
|
||||||
|
|
||||||
|
// 记录当前列表页的cookie
|
||||||
|
Cookie('__forward__', $_SERVER['REQUEST_URI']);
|
||||||
|
$data = array(
|
||||||
|
'list' => $list,
|
||||||
|
'page' => $list->render()
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('用户行为');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建用户行为
|
||||||
|
* @author colin <colin@tensent.cn>
|
||||||
|
*/
|
||||||
|
public function add(){
|
||||||
|
$model = model('Action');
|
||||||
|
if(IS_POST){
|
||||||
|
$data = $model->create();
|
||||||
|
if(!$data){
|
||||||
|
return $this->error($model->getError());
|
||||||
|
}else{
|
||||||
|
$result = $model->add();
|
||||||
|
if ($result) {
|
||||||
|
action_log('add_action', 'Action', $result, session('user_auth.uid'));
|
||||||
|
return $this->success('添加成功!',url('index'));
|
||||||
|
}else{
|
||||||
|
return $this->error($model->getError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$data = array(
|
||||||
|
'keyList' => $model->fieldlist
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("添加行为");
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑用户行为
|
||||||
|
* @author colin <colin@tensent.cn>
|
||||||
|
*/
|
||||||
|
public function edit($id = null){
|
||||||
|
$model = model('Action');
|
||||||
|
if(IS_POST){
|
||||||
|
$model = D('Action');
|
||||||
|
$data = $model->create();
|
||||||
|
if(!$data){
|
||||||
|
return $this->error($model->getError());
|
||||||
|
}else{
|
||||||
|
$result = $model->save();
|
||||||
|
if ($result !== false) {
|
||||||
|
action_log('edit_action', 'Action', $id, session('user_auth.uid'));
|
||||||
|
return $this->success('编辑成功!',url('index'));
|
||||||
|
}else{
|
||||||
|
return $this->error($model->getError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$info = $model::where(array('id'=>$id))->find();
|
||||||
|
if (!$info) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
$data = array(
|
||||||
|
'info' => $info,
|
||||||
|
'keyList' => $model->fieldlist
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("编辑行为");
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户行为状态
|
||||||
|
* @author colin <colin@tensent.cn>
|
||||||
|
*/
|
||||||
|
public function del(){
|
||||||
|
if (IS_POST) {
|
||||||
|
$ids = input('ids/a',array());
|
||||||
|
$id = input('id','');
|
||||||
|
array_push($ids, $id);
|
||||||
|
if(empty($ids)){
|
||||||
|
return $this->error("非法操作!",'');
|
||||||
|
}
|
||||||
|
$map['id'] = array('IN',$ids);
|
||||||
|
$result = db('Action')->where($map)->delete();
|
||||||
|
if ($result) {
|
||||||
|
action_log('delete_action', 'Action', $id, session('user_auth.uid'));
|
||||||
|
return $this->success('删除成功!');
|
||||||
|
}else{
|
||||||
|
return $this->error('删除失败!');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户行为状态
|
||||||
|
* @author colin <colin@tensent.cn>
|
||||||
|
*/
|
||||||
|
public function setstatus(){
|
||||||
|
$ids = input('ids/a',array());
|
||||||
|
$id = input('id','');
|
||||||
|
array_push($ids, $id);
|
||||||
|
if(empty($ids)){
|
||||||
|
return $this->error("非法操作!",'');
|
||||||
|
}
|
||||||
|
$status = input('get.status','','trim,intval');
|
||||||
|
$message = !$status ? '禁用' : '启用';
|
||||||
|
$map['id'] = array('IN',$ids);
|
||||||
|
$result = db('Action')->where($map)->setField('status',$status);
|
||||||
|
if ($result !== false) {
|
||||||
|
action_log('setstatus_action', 'Action', $id, session('user_auth.uid'));
|
||||||
|
return $this->success('设置'.$message.'状态成功!','');
|
||||||
|
}else{
|
||||||
|
return $this->error('设置'.$message.'状态失败!','');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行为日志列表
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function log() {
|
||||||
|
|
||||||
|
//获取列表数据
|
||||||
|
$map['status'] = array('gt', -1);
|
||||||
|
|
||||||
|
$order = "id desc";
|
||||||
|
//获取列表数据
|
||||||
|
$list = model('ActionLog')->where($map)->order($order)->paginate(10);
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'list' => $list,
|
||||||
|
'page' => $list->render()
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('行为日志');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查看行为日志
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function detail($id = 0) {
|
||||||
|
$model = model('ActionLog');
|
||||||
|
if (empty($id)) {
|
||||||
|
return $this->error('参数错误!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$info = $model::get($id);
|
||||||
|
|
||||||
|
$info['title'] = get_action($info['action_id'],'title');
|
||||||
|
$info['user_id'] = get_username($info['user_id']);
|
||||||
|
$info['action_ip'] = long2ip($info['action_ip']);
|
||||||
|
$info['create_time'] = date('Y-m-d H:i:s',$info['create_time']);
|
||||||
|
$data = array(
|
||||||
|
'info' => $info,
|
||||||
|
'keyList' => $model->keyList
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('查看行为日志');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除日志
|
||||||
|
* @param mixed $ids
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function dellog() {
|
||||||
|
$ids = input('ids/a',array());
|
||||||
|
$id = input('id','');
|
||||||
|
array_push($ids, $id);
|
||||||
|
if(empty($ids)){
|
||||||
|
return $this->error("非法操作!",'');
|
||||||
|
}
|
||||||
|
$map['id'] = array('IN',$ids);
|
||||||
|
$res = db('ActionLog')->where($map)->delete();
|
||||||
|
if ($res !== false) {
|
||||||
|
action_log('delete_actionlog', 'ActionLog', $id, session('user_auth.uid'));
|
||||||
|
return $this->success('删除成功!');
|
||||||
|
} else {
|
||||||
|
return $this->error('删除失败!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 清空日志
|
||||||
|
*/
|
||||||
|
public function clear($id = '') {
|
||||||
|
$res = db('ActionLog')->where('1=1')->delete();
|
||||||
|
if ($res !== false) {
|
||||||
|
//记录行为
|
||||||
|
action_log('clear_actionlog', 'ActionLog', $id, session('user_auth.uid'));
|
||||||
|
return $this->success('日志清空成功!');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $this->error('日志清空失败!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,191 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Ad extends Admin {
|
||||||
|
|
||||||
|
protected $ad;
|
||||||
|
protected $adplace;
|
||||||
|
|
||||||
|
public function _initialize(){
|
||||||
|
parent::_initialize();
|
||||||
|
$this->ad = db('Ad');
|
||||||
|
$this->adplace = db('AdPlace');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 插件列表
|
||||||
|
*/
|
||||||
|
public function index(){
|
||||||
|
$map = array();
|
||||||
|
$order = "id desc";
|
||||||
|
|
||||||
|
$list = db('AdPlace')->where($map)->order($order)->paginate(10);
|
||||||
|
$data = array(
|
||||||
|
'list' => $list,
|
||||||
|
'page' => $list->render()
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("广告管理");
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 广告位添加
|
||||||
|
*/
|
||||||
|
public function add(){
|
||||||
|
$place = model('AdPlace');
|
||||||
|
if (IS_POST) {
|
||||||
|
$data = input('post.');
|
||||||
|
$result = $place->save($data);
|
||||||
|
if (false !== false) {
|
||||||
|
return $this->success("添加成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error($place->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$data = array(
|
||||||
|
'keyList' => $place->keyList
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("添加广告位");
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id = null){
|
||||||
|
$place = model('AdPlace');
|
||||||
|
if (IS_POST) {
|
||||||
|
$data = input('post.','');
|
||||||
|
if ($data) {
|
||||||
|
$result = $place->save($data,array('id'=>$data['id']));
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("修改成功!", url('admin/ad/index'));
|
||||||
|
}else{
|
||||||
|
return $this->error($this->adplace->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->error($this->adplace->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$info = db('AdPlace')->where(array('id'=>$id))->find();
|
||||||
|
if (!$info) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
$data = array(
|
||||||
|
'info' => $info,
|
||||||
|
'keyList' => $place->keyList
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("编辑广告位");
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function del(){
|
||||||
|
$id = input('id','');
|
||||||
|
|
||||||
|
if (!$id) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
$map['id'] = array('IN',$id);
|
||||||
|
$result = $this->adplace->where($map)->delete();
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("删除成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error("删除失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function lists($id = null){
|
||||||
|
$map['place_id'] = $id;
|
||||||
|
$order = "id desc";
|
||||||
|
|
||||||
|
$list = db('Ad')->where($map)->order($order)->paginate(10);
|
||||||
|
$data = array(
|
||||||
|
'id' => $id,
|
||||||
|
'list' => $list,
|
||||||
|
'page' => $list->render()
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("广告管理");
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addad($id){
|
||||||
|
$ad = model('ad');
|
||||||
|
if (IS_POST) {
|
||||||
|
$data = input('post.');
|
||||||
|
if ($data) {
|
||||||
|
$result = $ad->save($data);
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("添加成功!", url('admin/ad/lists',array('id'=>$data['place_id'])));
|
||||||
|
}else{
|
||||||
|
return $this->error($ad->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->error($ad->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$info['place_id'] = $id;
|
||||||
|
$data = array(
|
||||||
|
'info' => $info,
|
||||||
|
'keyList' => $ad->keyList
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("添加广告位");
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function editad($id = null){
|
||||||
|
$ad = model('ad');
|
||||||
|
if (IS_POST) {
|
||||||
|
$data = input('post.');
|
||||||
|
if ($data) {
|
||||||
|
$result = $ad->save($data,array('id'=>$data['id']));
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("修改成功!", url('admin/ad/lists',array('id'=>$data['place_id'])));
|
||||||
|
}else{
|
||||||
|
return $this->error($ad->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->error($ad->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$info = db('ad')->where(array('id'=>$id))->find();
|
||||||
|
if (!$info) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
$data = array(
|
||||||
|
'info' => $info,
|
||||||
|
'keyList' => $ad->keyList
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("编辑广告位");
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delad(){
|
||||||
|
$id = input('id','');
|
||||||
|
|
||||||
|
if (!$id) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
$map['id'] = array('IN',$id);
|
||||||
|
$result = db('ad')->where($map)->delete();
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("删除成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error("删除失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,336 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Addons extends Admin {
|
||||||
|
|
||||||
|
protected $addons;
|
||||||
|
|
||||||
|
public function _initialize(){
|
||||||
|
parent::_initialize();
|
||||||
|
//加入菜单
|
||||||
|
$this->getAddonsMenu();
|
||||||
|
$this->addons = model('Addons');
|
||||||
|
$this->hooks = db('Hooks');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 插件列表
|
||||||
|
*/
|
||||||
|
public function index(){
|
||||||
|
$row = $this->addons->getList();
|
||||||
|
foreach($row as $key => $value){
|
||||||
|
$value['status_text'] = '';
|
||||||
|
if($value['uninstall'] == 1){
|
||||||
|
$value['uninstall_text'] = '未安装';
|
||||||
|
}else{
|
||||||
|
$value['uninstall_text'] = '已安装';
|
||||||
|
if($value['status'] == 0){
|
||||||
|
$value['status_text'] = '禁用';
|
||||||
|
}else{
|
||||||
|
$value['status_text'] = '启用';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$list[] = $value;
|
||||||
|
}
|
||||||
|
// 记录当前列表页的cookie
|
||||||
|
Cookie('__forward__',$_SERVER['REQUEST_URI']);
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'list' => $list,
|
||||||
|
//'page' => $page->show()
|
||||||
|
);
|
||||||
|
$this->setMeta("插件管理");
|
||||||
|
$this->assign($data);
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
//创建向导首页
|
||||||
|
public function add(){
|
||||||
|
if (IS_POST) {
|
||||||
|
$data = $this->addons->create();
|
||||||
|
if ($data) {
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("创建成功!",url('admin/addons/index'));
|
||||||
|
}else{
|
||||||
|
return $this->error("创建失败!",'');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->error($this->addons->getError(),'');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$hooks = db('Hooks')->field('name,description')->select();
|
||||||
|
$this->assign('Hooks',$hooks);
|
||||||
|
$hook = db('Hooks')->field(true)->select();
|
||||||
|
foreach($hook as $key => $value){
|
||||||
|
$addons_opt[$value['name']] = $value['name'];
|
||||||
|
}
|
||||||
|
$addons_opt = array(array('type'=>'select','opt'=>$addons_opt));
|
||||||
|
if(!is_writable(SENT_ADDON_PATH)){
|
||||||
|
return $this->error('您没有创建目录写入权限,无法使用此功能');
|
||||||
|
}
|
||||||
|
$this->setMeta("添加插件");
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//预览
|
||||||
|
public function preview($output = true){
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安装插件
|
||||||
|
*/
|
||||||
|
public function install(){
|
||||||
|
$addon_name = input('addon_name','','trim,ucfirst');
|
||||||
|
$class = get_addon_class($addon_name);
|
||||||
|
if(class_exists($class)){
|
||||||
|
$addons = new $class;
|
||||||
|
$info = $addons->info;
|
||||||
|
if(!$info || !$addons->checkInfo()){
|
||||||
|
//检测信息的正确性
|
||||||
|
return $this->error('插件信息缺失');
|
||||||
|
}
|
||||||
|
session('addons_install_error',null);
|
||||||
|
$install_flag = $addons->install();
|
||||||
|
if(!$install_flag){
|
||||||
|
return $this->error('执行插件预安装操作失败'.session('addons_install_error'));
|
||||||
|
}
|
||||||
|
$result = $this->addons->install($info);
|
||||||
|
if($result){
|
||||||
|
cache('hooks', null);
|
||||||
|
return $this->success('安装成功');
|
||||||
|
}else{
|
||||||
|
return $this->error($this->addons->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->error('插件不存在','');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卸载插件
|
||||||
|
*/
|
||||||
|
public function uninstall($id){
|
||||||
|
$result = $this->addons->uninstall($id);
|
||||||
|
if($result === false){
|
||||||
|
return $this->error($this->addons->getError(),'');
|
||||||
|
}else{
|
||||||
|
return $this->success('卸载成功!','');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用插件
|
||||||
|
*/
|
||||||
|
public function enable(){
|
||||||
|
$id = input('id');
|
||||||
|
cache('hooks', null);
|
||||||
|
$model = model('Addons');
|
||||||
|
$result = $model::where(array('id'=>$id))->update(array('status'=>1));
|
||||||
|
if ($result) {
|
||||||
|
return $this->success('启用成功');
|
||||||
|
}else{
|
||||||
|
return $this->error("启用失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 禁用插件
|
||||||
|
*/
|
||||||
|
public function disable(){
|
||||||
|
$id = input('id');
|
||||||
|
cache('hooks', null);
|
||||||
|
$model = model('Addons');
|
||||||
|
$result = $model::where(array('id'=>$id))->update(array('status'=>0));
|
||||||
|
if ($result) {
|
||||||
|
return $this->success('禁用成功');
|
||||||
|
}else{
|
||||||
|
return $this->error("禁用失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置插件页面
|
||||||
|
*/
|
||||||
|
public function config(){
|
||||||
|
if (IS_POST) {
|
||||||
|
# code...
|
||||||
|
}else{
|
||||||
|
$id = input('id','','trim,intval');
|
||||||
|
if (!$id) {
|
||||||
|
return $this->error("非法操作!",'');
|
||||||
|
}
|
||||||
|
$info = $this->addons->find($id);
|
||||||
|
if (!empty($info)) {
|
||||||
|
$class = get_addon_class($info['name']);
|
||||||
|
|
||||||
|
$keyList = array();
|
||||||
|
$data = array(
|
||||||
|
'keyList' => $keyList
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta($info['title'] . " - 设置");
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}else{
|
||||||
|
return $this->error("未安装此插件!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取插件所需的钩子是否存在,没有则新增
|
||||||
|
* @param string $str 钩子名称
|
||||||
|
* @param string $addons 插件名称
|
||||||
|
* @param string $addons 插件简介
|
||||||
|
*/
|
||||||
|
public function existHook($str, $addons, $msg=''){
|
||||||
|
$hook_mod = db('Hooks');
|
||||||
|
$where['name'] = $str;
|
||||||
|
$gethook = $hook_mod->where($where)->find();
|
||||||
|
if(!$gethook || empty($gethook) || !is_array($gethook)){
|
||||||
|
$data['name'] = $str;
|
||||||
|
$data['description'] = $msg;
|
||||||
|
$data['type'] = 1;
|
||||||
|
$data['update_time'] = time();
|
||||||
|
$data['addons'] = $addons;
|
||||||
|
if( false !== $hook_mod->create($data) ){
|
||||||
|
$hook_mod->add();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除钩子
|
||||||
|
* @param string $hook 钩子名称
|
||||||
|
*/
|
||||||
|
public function deleteHook($hook){
|
||||||
|
$model = db('hooks');
|
||||||
|
$condition = array(
|
||||||
|
'name' => $hook,
|
||||||
|
);
|
||||||
|
$model->where($condition)->delete();
|
||||||
|
S('hooks', null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钩子列表
|
||||||
|
*/
|
||||||
|
public function hooks(){
|
||||||
|
|
||||||
|
$map = array();
|
||||||
|
$order = "id desc";
|
||||||
|
$list = model('Hooks')->where($map)->order($order)->paginate(10);
|
||||||
|
|
||||||
|
// 记录当前列表页的cookie
|
||||||
|
Cookie('__forward__',$_SERVER['REQUEST_URI']);
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'list' => $list,
|
||||||
|
'page' => $list->render()
|
||||||
|
);
|
||||||
|
$this->setMeta("钩子管理");
|
||||||
|
$this->assign($data);
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addhook(){
|
||||||
|
$hooks = model('Hooks');
|
||||||
|
if (IS_POST) {
|
||||||
|
$data = input();
|
||||||
|
if ($data) {
|
||||||
|
$result = $hooks->change($data);
|
||||||
|
if ($result !== false) {
|
||||||
|
return $this->success("修改成功");
|
||||||
|
}else{
|
||||||
|
return $this->error($hooks->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->error($hooks->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$keylist = $hooks->getaddons();
|
||||||
|
$data = array(
|
||||||
|
'keyList' => $keylist,
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('编辑钩子');
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//钩子出编辑挂载插件页面
|
||||||
|
public function edithook($id){
|
||||||
|
$hooks = model('Hooks');
|
||||||
|
if (IS_POST) {
|
||||||
|
$data = input('post.');
|
||||||
|
if ($data) {
|
||||||
|
$result = $hooks->change($data);
|
||||||
|
if ($result !== false) {
|
||||||
|
return $this->success("修改成功");
|
||||||
|
}else{
|
||||||
|
return $this->error($hooks->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->error($hooks->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$info = db('Hooks')->find($id);
|
||||||
|
$keylist = $hooks->getaddons($info['addons']);
|
||||||
|
$data = array(
|
||||||
|
'info' => $info,
|
||||||
|
'keyList' => $keylist,
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('编辑钩子');
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//超级管理员删除钩子
|
||||||
|
public function delhook(){
|
||||||
|
$id = input('id','','trim,intval');
|
||||||
|
$ids = input('post.ids/a',array());
|
||||||
|
array_push($ids, $id);
|
||||||
|
$map['id'] = array('IN',$ids);
|
||||||
|
$result = $this->hooks->where($map)->delete();
|
||||||
|
if($result !== false){
|
||||||
|
return $this->success('删除成功');
|
||||||
|
}else{
|
||||||
|
return $this->error('删除失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateHook(){
|
||||||
|
$hookModel = D('Hooks');
|
||||||
|
$data = $hookModel->create();
|
||||||
|
if($data){
|
||||||
|
if($data['id']){
|
||||||
|
$flag = $hookModel->save($data);
|
||||||
|
if($flag !== false){
|
||||||
|
S('hooks', null);
|
||||||
|
$this->success('更新成功', Cookie('__forward__'));
|
||||||
|
}else{
|
||||||
|
$this->error('更新失败');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$flag = $hookModel->add($data);
|
||||||
|
if($flag){
|
||||||
|
S('hooks', null);
|
||||||
|
$this->success('新增成功', Cookie('__forward__'));
|
||||||
|
}else{
|
||||||
|
$this->error('新增失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$this->error($hookModel->getError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Attribute extends Admin {
|
||||||
|
|
||||||
|
//保存的Model句柄
|
||||||
|
protected $model;
|
||||||
|
protected $attr;
|
||||||
|
|
||||||
|
//初始化
|
||||||
|
public function _initialize(){
|
||||||
|
parent::_initialize();
|
||||||
|
$this->getContentMenu();
|
||||||
|
$this->model = model('Attribute');
|
||||||
|
//遍历属性列表
|
||||||
|
foreach (get_attribute_type() as $key => $value) {
|
||||||
|
$this->attr[$key] = $value[0];
|
||||||
|
}
|
||||||
|
$this->validate_rule = array(
|
||||||
|
0=>'请选择',
|
||||||
|
'regex'=>'正则验证',
|
||||||
|
'function'=>'函数验证',
|
||||||
|
'unique'=>'唯一验证',
|
||||||
|
'length'=>'长度验证',
|
||||||
|
'in'=>'验证在范围内',
|
||||||
|
'notin'=>'验证不在范围内',
|
||||||
|
'between'=>'区间验证',
|
||||||
|
'notbetween'=>'不在区间验证'
|
||||||
|
);
|
||||||
|
$this->auto_type = array(0=>'请选择','function'=>'函数','field'=>'字段','string'=>'字符串');
|
||||||
|
$this->the_time = array(0=>'请选择','3'=>'始 终','1'=>'新 增','2'=>'编 辑');
|
||||||
|
$this->field = $this->getField();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* index方法
|
||||||
|
* @author colin <colin@tensent.cn>
|
||||||
|
*/
|
||||||
|
public function index($model = null){
|
||||||
|
$model_id = input('get.model_id','','trim,intval');
|
||||||
|
$map['model_id'] = $model_id;
|
||||||
|
if (!$model_id) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
|
||||||
|
$list = model('Attribute')->where($map)->order('id desc')->paginate(25);
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'list' => $list,
|
||||||
|
'model_id'=> $model_id,
|
||||||
|
'page' => $list->render()
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('字段管理');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建字段
|
||||||
|
* @author colin <colin@tensent.cn>
|
||||||
|
*/
|
||||||
|
public function add(){
|
||||||
|
$model_id = input('get.model_id','','trim,intval');
|
||||||
|
if(IS_POST){
|
||||||
|
$result = $this->model->change();
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("创建成功!",url('Attribute/index',array('model_id'=>$model_id)));
|
||||||
|
}else{
|
||||||
|
return $this->error($this->model->getError(),'');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (!$model_id) {
|
||||||
|
return $this->error('非法操作!');
|
||||||
|
}
|
||||||
|
$data = array(
|
||||||
|
'info' => array('model_id'=>$model_id),
|
||||||
|
'fieldGroup' => $this->field
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('添加字段');
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑字段方法
|
||||||
|
* @author colin <colin@tensent.cn>
|
||||||
|
*/
|
||||||
|
public function edit(){
|
||||||
|
if(IS_POST){
|
||||||
|
$result = $this->model->change();
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("修改成功!",url('Attribute/index',array('model_id'=>$_POST['model_id'])));
|
||||||
|
}else{
|
||||||
|
return $this->error($this->model->getError(),'');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$id = input('get.id','','trim,intval');
|
||||||
|
$info = db('Attribute')->find($id);
|
||||||
|
$data = array(
|
||||||
|
'info' => $info,
|
||||||
|
'fieldGroup' => $this->field
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('编辑字段');
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字段信息
|
||||||
|
* @var delattr 是否删除字段表里的字段
|
||||||
|
* @author colin <colin@tensent.cn>
|
||||||
|
*/
|
||||||
|
public function del(){
|
||||||
|
$id = input('id','','trim,intval');
|
||||||
|
if (!$id) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->model->del($id);
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("删除成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error($this->model->getError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//字段编辑所需字段
|
||||||
|
protected function getField(){
|
||||||
|
return array(
|
||||||
|
'基础' => array(
|
||||||
|
array('name'=>'id','title'=>'id','help'=>'','type'=>'hidden'),
|
||||||
|
array('name'=>'model_id','title'=>'model_id','help'=>'','type'=>'hidden'),
|
||||||
|
array('name'=>'name','title'=>'字段名','help'=>'英文字母开头,长度不超过30','type'=>'text'),
|
||||||
|
array('name'=>'title','title'=>'字段标题','help'=>'请输入字段标题,用于表单显示','type'=>'text'),
|
||||||
|
array('name'=>'type','title'=>'字段类型','help'=>'用于表单中的展示方式','type'=>'select','option'=>$this->attr,'help'=>''),
|
||||||
|
array('name'=>'length','title'=>'字段长度','help'=>'字段的长度值','type'=>'text'),
|
||||||
|
array('name'=>'extra','title'=>'参数','help'=>'布尔、枚举、多选字段类型的定义数据','type'=>'textarea'),
|
||||||
|
array('name'=>'value','title'=>'默认值','help'=>'字段的默认值','type'=>'text'),
|
||||||
|
array('name'=>'remark','title'=>'字段备注','help'=>'用于表单中的提示','type'=>'text'),
|
||||||
|
array('name'=>'is_show','title'=>'是否显示','help'=>'是否显示在表单中','type'=>'select','option'=>array('1'=>'始终显示','2'=>'新增显示','3'=>'编辑显示','0'=>'不显示'),'value'=>1),
|
||||||
|
array('name'=>'is_must','title'=>'是否必填','help'=>'用于自动验证','type'=>'select','option'=>array('0'=>'否','1'=>'是'))
|
||||||
|
),
|
||||||
|
'高级' => array(
|
||||||
|
array('name'=>'validate_type','title'=>'验证方式','type'=>'select','option'=>$this->validate_rule,'help'=>''),
|
||||||
|
array('name'=>'validate_rule','title'=>'验证规则','help'=>'根据验证方式定义相关验证规则','type'=>'text'),
|
||||||
|
array('name'=>'error_info','title'=>'出错提示','type'=>'text','help'=>''),
|
||||||
|
array('name'=>'validate_time','title'=>'验证时间','help'=>'英文字母开头,长度不超过30','type'=>'select','option'=>$this->the_time,'help'=>''),
|
||||||
|
array('name'=>'auto_type','title'=>'自动完成方式','help'=>'英文字母开头,长度不超过30','type'=>'select','option'=>$this->auto_type,'help'=>''),
|
||||||
|
array('name'=>'auto_rule','title'=>'自动完成规则','help'=>'根据完成方式订阅相关规则','type'=>'text'),
|
||||||
|
array('name'=>'auto_time','title'=>'自动完成时间','help'=>'英文字母开头,长度不超过30','type'=>'select','option'=>$this->the_time),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,248 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Category extends Admin{
|
||||||
|
|
||||||
|
public function _initialize(){
|
||||||
|
parent::_initialize();
|
||||||
|
$this->getContentMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(){
|
||||||
|
$map = array('status' => array('gt', -1));
|
||||||
|
$row = db('Category')->where($map)->order('sort asc,id asc')->select();
|
||||||
|
|
||||||
|
$list = array();
|
||||||
|
foreach ($row as $key => $value) {
|
||||||
|
$list[$value['id']] = $value;
|
||||||
|
}
|
||||||
|
if (!empty($list)) {
|
||||||
|
$tree = new \com\Tree();
|
||||||
|
$list = $tree->toFormatTree($list);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assign('tree',$list);
|
||||||
|
$this->setMeta('栏目列表');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 单字段编辑 */
|
||||||
|
public function editable($name = null, $value = null, $pk = null) {
|
||||||
|
if ($name && ($value != null || $value != '') && $pk) {
|
||||||
|
db('Category')->where(array('id' => $pk))->setField($name, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 编辑分类 */
|
||||||
|
public function edit($id = null, $pid = 0) {
|
||||||
|
if (IS_POST) {
|
||||||
|
$category = model('Category');
|
||||||
|
//提交表单
|
||||||
|
$result = $category->change();
|
||||||
|
if (false !== $result) {
|
||||||
|
//记录行为
|
||||||
|
action_log('update_category', 'category', $id, session('user_auth.uid'));
|
||||||
|
return $this->success('编辑成功!', url('index'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$error = $category->getError();
|
||||||
|
return $this->error(empty($error) ? '未知错误!' : $error);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$cate = '';
|
||||||
|
if ($pid) {
|
||||||
|
/* 获取上级分类信息 */
|
||||||
|
$cate = db('Category')->find($pid);
|
||||||
|
if (!($cate && 1 == $cate['status'])) {
|
||||||
|
return $this->error('指定的上级分类不存在或被禁用!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* 获取分类信息 */
|
||||||
|
$info = $id ? db('Category')->find($id) : '';
|
||||||
|
|
||||||
|
$this->assign('info', $info);
|
||||||
|
$this->assign('category', $cate);
|
||||||
|
$this->setMeta('编辑分类');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* 新增分类 */
|
||||||
|
public function add($pid = 0) {
|
||||||
|
$Category = model('Category');
|
||||||
|
|
||||||
|
if (IS_POST) {
|
||||||
|
//提交表单
|
||||||
|
$id = $Category->change();
|
||||||
|
if (false !== $id) {
|
||||||
|
action_log('update_category', 'category', $id, session('user_auth.uid'));
|
||||||
|
return $this->success('新增成功!', url('index'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$error = $Category->getError();
|
||||||
|
return $this->error(empty($error) ? '未知错误!' : $error);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$cate = array();
|
||||||
|
if ($pid) {
|
||||||
|
/* 获取上级分类信息 */
|
||||||
|
$cate = $Category->info($pid, 'id,name,title,status');
|
||||||
|
if (!($cate && 1 == $cate['status'])) {
|
||||||
|
return $this->error('指定的上级分类不存在或被禁用!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* 获取分类信息 */
|
||||||
|
$this->assign('info', null);
|
||||||
|
$this->assign('category', $cate);
|
||||||
|
$this->setMeta('新增分类');
|
||||||
|
return $this->fetch('edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除一个分类
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function remove($id) {
|
||||||
|
if (empty($id)) {
|
||||||
|
return $this->error('参数错误!');
|
||||||
|
}
|
||||||
|
//判断该分类下有没有子分类,有则不允许删除
|
||||||
|
$child = db('Category')->where(array('pid' => $id))->field('id')->select();
|
||||||
|
if (!empty($child)) {
|
||||||
|
return $this->error('请先删除该分类下的子分类');
|
||||||
|
}
|
||||||
|
//判断该分类下有没有内容
|
||||||
|
$document_list = db('Document')->where(array('category_id' => $id))->field('id')->select();
|
||||||
|
if (!empty($document_list)) {
|
||||||
|
return $this->error('请先删除该分类下的文章(包含回收站)');
|
||||||
|
}
|
||||||
|
//删除该分类信息
|
||||||
|
$res = db('Category')->where(array('id'=>$id))->delete();
|
||||||
|
if ($res !== false) {
|
||||||
|
//记录行为
|
||||||
|
action_log('update_category', 'category', $id, session('user_auth.uid'));
|
||||||
|
return $this->success('删除分类成功!');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $this->error('删除分类失败!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作分类初始化
|
||||||
|
* @param string $type
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function operate($type = 'move') {
|
||||||
|
//检查操作参数
|
||||||
|
if (strcmp($type, 'move') == 0) {
|
||||||
|
$operate = '移动';
|
||||||
|
}
|
||||||
|
elseif (strcmp($type, 'merge') == 0) {
|
||||||
|
$operate = '合并';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $this->error('参数错误!');
|
||||||
|
}
|
||||||
|
$from = intval(input('get.from'));
|
||||||
|
if (empty($from)) {
|
||||||
|
return $this->error('参数错误!');
|
||||||
|
}
|
||||||
|
//获取分类
|
||||||
|
$map = array('status' => 1, 'id' => array('neq', $from));
|
||||||
|
$list = db('Category')->where($map)->field('id,pid,title')->select();
|
||||||
|
//移动分类时增加移至根分类
|
||||||
|
if (strcmp($type, 'move') == 0) {
|
||||||
|
//不允许移动至其子孙分类
|
||||||
|
$list = tree_to_list(list_to_tree($list));
|
||||||
|
|
||||||
|
$pid = db('Category')->getFieldById($from, 'pid');
|
||||||
|
$pid && array_unshift($list, array('id' => 0, 'title' => '根分类'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assign('type', $type);
|
||||||
|
$this->assign('operate', $operate);
|
||||||
|
$this->assign('from', $from);
|
||||||
|
$this->assign('list', $list);
|
||||||
|
$this->setMeta($operate . '分类');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 移动分类
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function move() {
|
||||||
|
$to = input('post.to');
|
||||||
|
$from = input('post.from');
|
||||||
|
$res = db('Category')->where(array('id' => $from))->setField('pid', $to);
|
||||||
|
if ($res !== false) {
|
||||||
|
return $this->success('分类移动成功!', url('index'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $this->error('分类移动失败!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 合并分类
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function merge() {
|
||||||
|
$to = input('post.to');
|
||||||
|
$from = input('post.from');
|
||||||
|
$Model = model('Category');
|
||||||
|
//检查分类绑定的模型
|
||||||
|
$from_models = explode(',', $Model->getFieldById($from, 'model'));
|
||||||
|
$to_models = explode(',', $Model->getFieldById($to, 'model'));
|
||||||
|
foreach ($from_models as $value) {
|
||||||
|
if (!in_array($value, $to_models)) {
|
||||||
|
return $this->error('请给目标分类绑定' . get_document_model($value, 'title') . '模型');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//检查分类选择的文档类型
|
||||||
|
$from_types = explode(',', $Model->getFieldById($from, 'type'));
|
||||||
|
$to_types = explode(',', $Model->getFieldById($to, 'type'));
|
||||||
|
foreach ($from_types as $value) {
|
||||||
|
if (!in_array($value, $to_types)) {
|
||||||
|
$types = config('DOCUMENT_MODEL_TYPE');
|
||||||
|
return $this->error('请给目标分类绑定文档类型:' . $types[$value]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//合并文档
|
||||||
|
$res = db('Document')->where(array('category_id' => $from))->setField('category_id', $to);
|
||||||
|
|
||||||
|
if ($res !== false) {
|
||||||
|
//删除被合并的分类
|
||||||
|
$Model->delete($from);
|
||||||
|
return $this->success('合并分类成功!', url('index'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $this->error('合并分类失败!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function status(){
|
||||||
|
$id = input('id','','trim,intval');
|
||||||
|
$ids = input('post.ids/a',array(),'');
|
||||||
|
$status = input('status','0','trim,intval');
|
||||||
|
array_push($ids, $id);
|
||||||
|
if (!$id) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
|
||||||
|
$map['id'] = array('IN',$ids);
|
||||||
|
$result = db('Category')->where($map)->setField('status', $status);
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("设置成功!",'');
|
||||||
|
}else{
|
||||||
|
return $this->error("设置失败!",'');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,199 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Channel extends Admin{
|
||||||
|
|
||||||
|
public function _initialize(){
|
||||||
|
parent::_initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(){
|
||||||
|
$pid = input('get.pid', 0);
|
||||||
|
/* 获取频道列表 */
|
||||||
|
//$map = array('status' => array('gt', -1), 'pid'=>$pid);
|
||||||
|
$map = array('status' => array('gt', -1));
|
||||||
|
$list = db('Channel')->where($map)->order('sort asc,id asc')->select();
|
||||||
|
|
||||||
|
if (!empty($list)) {
|
||||||
|
$tree = new \com\Tree();
|
||||||
|
$list = $tree->toFormatTree($list);
|
||||||
|
}
|
||||||
|
|
||||||
|
config('_sys_get_channel_tree_', true);
|
||||||
|
|
||||||
|
$this->assign('tree', $list);
|
||||||
|
$this->assign('pid', $pid);
|
||||||
|
$this->setMeta('导航管理');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 单字段编辑 */
|
||||||
|
public function editable($name = null, $value = null, $pk = null) {
|
||||||
|
if ($name && ($value != null || $value != '') && $pk) {
|
||||||
|
model('Channel')->where(array('id' => $pk))->setField($name, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加频道
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
public function add() {
|
||||||
|
if (IS_POST) {
|
||||||
|
$Channel = model('Channel');
|
||||||
|
$data = input('post.');
|
||||||
|
if ($data) {
|
||||||
|
$id = $Channel->save($data);
|
||||||
|
if ($id) {
|
||||||
|
return $this->success('新增成功', url('index'));
|
||||||
|
//记录行为
|
||||||
|
action_log('update_channel', 'channel', $id, session('user_auth.uid'));
|
||||||
|
} else {
|
||||||
|
return $this->error('新增失败');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->error($Channel->getError());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$pid = input('get.pid', 0);
|
||||||
|
//获取父导航
|
||||||
|
if (!empty($pid)) {
|
||||||
|
$parent = db('Channel')->where(array('id' => $pid))->field('title')->find();
|
||||||
|
$this->assign('parent', $parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
$pnav = db('Channel')->where(array('pid' => '0'))->select();
|
||||||
|
$this->assign('pnav', $pnav);
|
||||||
|
$this->assign('pid', $pid);
|
||||||
|
$this->assign('info', null);
|
||||||
|
$this->setMeta('新增导航');
|
||||||
|
return $this->fetch('edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑频道
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
public function edit($id = 0) {
|
||||||
|
if (IS_POST) {
|
||||||
|
$Channel = model('Channel');
|
||||||
|
$data = input('post.');
|
||||||
|
if ($data) {
|
||||||
|
if (false !== $Channel->save($data,array('id'=>$data['id']))) {
|
||||||
|
//记录行为
|
||||||
|
action_log('update_channel', 'channel', $data['id'], session('user_auth.uid'));
|
||||||
|
return $this->success('编辑成功', url('index'));
|
||||||
|
} else {
|
||||||
|
return $this->error('编辑失败');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $this->error($Channel->getError());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$info = array();
|
||||||
|
/* 获取数据 */
|
||||||
|
$info = db('Channel')->find($id);
|
||||||
|
|
||||||
|
if (false === $info) {
|
||||||
|
return $this->error('获取配置信息错误');
|
||||||
|
}
|
||||||
|
|
||||||
|
$pid = input('get.pid', 0);
|
||||||
|
//获取父导航
|
||||||
|
if (!empty($pid)) {
|
||||||
|
$parent = db('Channel')->where(array('id' => $pid))->field('title')->find();
|
||||||
|
$this->assign('parent', $parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
$pnav = db('Channel')->where(array('pid' => '0'))->select();
|
||||||
|
$this->assign('pnav', $pnav);
|
||||||
|
$this->assign('pid', $pid);
|
||||||
|
$this->assign('info', $info);
|
||||||
|
$this->setMeta('编辑导航');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除频道
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
public function del() {
|
||||||
|
$id = array_unique((array)input('id', 0));
|
||||||
|
|
||||||
|
if (empty($id)) {
|
||||||
|
return $this->error('请选择要操作的数据!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$map = array('id' => array('in', $id));
|
||||||
|
if (db('Channel')->where($map)->delete()) {
|
||||||
|
//记录行为
|
||||||
|
action_log('update_channel', 'channel', $id, session('user_auth.uid'));
|
||||||
|
return $this->success('删除成功');
|
||||||
|
} else {
|
||||||
|
return $this->error('删除失败!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 导航排序
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function sort() {
|
||||||
|
if (IS_GET) {
|
||||||
|
$ids = input('get.ids');
|
||||||
|
$pid = input('get.pid');
|
||||||
|
//获取排序的数据
|
||||||
|
$map = array('status' => array('gt', -1));
|
||||||
|
if (!empty($ids)) {
|
||||||
|
$map['id'] = array('in', $ids);
|
||||||
|
} else {
|
||||||
|
if ($pid !== '') {
|
||||||
|
$map['pid'] = $pid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$list = db('Channel')->where($map)->field('id,title')->order('sort asc,id asc')->select();
|
||||||
|
|
||||||
|
$this->assign('list', $list);
|
||||||
|
$this->setMeta('导航排序');
|
||||||
|
return $this->fetch();
|
||||||
|
} elseif (IS_POST) {
|
||||||
|
$ids = input('post.ids');
|
||||||
|
$ids = explode(',', $ids);
|
||||||
|
foreach ($ids as $key => $value) {
|
||||||
|
$res = db('Channel')->where(array('id' => $value))->setField('sort', $key + 1);
|
||||||
|
}
|
||||||
|
if ($res !== false) {
|
||||||
|
return $this->success('排序成功!',url('admin/channel/index'));
|
||||||
|
} else {
|
||||||
|
return $this->error('排序失败!','');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $this->error('非法请求!','');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStatus(){
|
||||||
|
$id = array_unique((array)input('ids', 0));
|
||||||
|
$status = input('status','0','trim');
|
||||||
|
|
||||||
|
if (empty($id)) {
|
||||||
|
return $this->error('请选择要操作的数据!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$map = array('id' => array('in', $id));
|
||||||
|
$result = db('Channel')->where($map)->update(array('status'=>$status));
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("操作成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error("操作失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,215 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Config extends Admin{
|
||||||
|
|
||||||
|
public function _initialize(){
|
||||||
|
parent::_initialize();
|
||||||
|
$this->model = model('Config');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置管理
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
public function index() {
|
||||||
|
/* 查询条件初始化 */
|
||||||
|
$map = array();
|
||||||
|
$map = array('status' => 1);
|
||||||
|
if (isset($_GET['group'])) {
|
||||||
|
$map['group'] = input('group', 0);
|
||||||
|
}
|
||||||
|
if (isset($_GET['name'])) {
|
||||||
|
$map['name'] = array('like', '%' . (string)input('name') . '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
$list = $this->model->where($map)->order('id desc')->paginate(25);
|
||||||
|
// 记录当前列表页的cookie
|
||||||
|
Cookie('__forward__', $_SERVER['REQUEST_URI']);
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'group' => config('config_group_list'),
|
||||||
|
'config_type' => config('config_config_list'),
|
||||||
|
'page' => $list->render(),
|
||||||
|
'group_id' => input('get.group', 0),
|
||||||
|
'list' => $list
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('配置管理');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function group(){
|
||||||
|
if (IS_POST) {
|
||||||
|
$config = input('post.config/a','');
|
||||||
|
$model = model('Config');
|
||||||
|
foreach ($config as $key => $value) {
|
||||||
|
$model::where('name',$key)->update(array('value' => $value));
|
||||||
|
}
|
||||||
|
return $this->success("更新成功!");
|
||||||
|
}else{
|
||||||
|
$id = input('get.id', 1);
|
||||||
|
$type = config('config_group_list');
|
||||||
|
$list = db("Config")->where(array('status' => 1, 'group' => $id))->field('id,name,title,extra,value,remark,type')->order('sort')->select();
|
||||||
|
if ($list) {
|
||||||
|
$this->assign('list', $list);
|
||||||
|
}
|
||||||
|
$this->assign('id', $id);
|
||||||
|
$this->setMeta($type[$id] . '设置');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增配置
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
public function add() {
|
||||||
|
if (IS_POST) {
|
||||||
|
$Config = model('Config');
|
||||||
|
$data = input('post.');
|
||||||
|
if ($data) {
|
||||||
|
$id = $Config->validate(true)->save($data);
|
||||||
|
if ($id) {
|
||||||
|
cache('db_config_data', null);
|
||||||
|
//记录行为
|
||||||
|
action_log('update_config', 'config', $id, session('user_auth.uid'));
|
||||||
|
return $this->success('新增成功', url('index'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $this->error('新增失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $this->error($Config->getError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->setMeta('新增配置');
|
||||||
|
$this->assign('info', null);
|
||||||
|
return $this->fetch('edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑配置
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
public function edit($id = 0) {
|
||||||
|
if (IS_POST) {
|
||||||
|
$Config = model('Config');
|
||||||
|
$data = input('post.');
|
||||||
|
if ($data) {
|
||||||
|
$result = $Config->validate('Config.edit')->save($data,array('id'=>$data['id']));
|
||||||
|
if (false !== $result) {
|
||||||
|
cache('db_config_data', null);
|
||||||
|
//记录行为
|
||||||
|
action_log('update_config', 'config', $data['id'], session('user_auth.uid'));
|
||||||
|
return $this->success('更新成功', Cookie('__forward__'));
|
||||||
|
} else {
|
||||||
|
return $this->error($Config->getError(), '');
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
return $this->error($Config->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$info = array();
|
||||||
|
/* 获取数据 */
|
||||||
|
$info = db('Config')->field(true)->find($id);
|
||||||
|
|
||||||
|
if (false === $info) {
|
||||||
|
return $this->error('获取配置信息错误');
|
||||||
|
}
|
||||||
|
$this->assign('info', $info);
|
||||||
|
$this->setMeta('编辑配置');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 批量保存配置
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
public function save($config) {
|
||||||
|
if ($config && is_array($config)) {
|
||||||
|
$Config = db('Config');
|
||||||
|
foreach ($config as $name => $value) {
|
||||||
|
$map = array('name' => $name);
|
||||||
|
$Config->where($map)->setField('value', $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cache('db_config_data', null);
|
||||||
|
return $this->success('保存成功!');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除配置
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
public function del() {
|
||||||
|
$id = array_unique((array)input('id', 0));
|
||||||
|
|
||||||
|
if (empty($id)) {
|
||||||
|
return $this->error('请选择要操作的数据!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$map = array('id' => array('in', $id));
|
||||||
|
if (db('Config')->where($map)->delete()) {
|
||||||
|
cache('DB_CONFIG_DATA', null);
|
||||||
|
//记录行为
|
||||||
|
action_log('update_config', 'config', $id, session('user_auth.uid'));
|
||||||
|
return $this->success('删除成功');
|
||||||
|
} else {
|
||||||
|
return $this->error('删除失败!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置排序
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function sort() {
|
||||||
|
if (IS_GET) {
|
||||||
|
$ids = input('get.ids');
|
||||||
|
//获取排序的数据
|
||||||
|
$map = array('status' => array('gt', -1));
|
||||||
|
if (!empty($ids)) {
|
||||||
|
$map['id'] = array('in', $ids);
|
||||||
|
}
|
||||||
|
elseif (input('group')) {
|
||||||
|
$map['group'] = input('group');
|
||||||
|
}
|
||||||
|
$list = db('Config')->where($map)->field('id,title')->order('sort asc,id asc')->select();
|
||||||
|
|
||||||
|
$this->assign('list', $list);
|
||||||
|
$this->setMeta('配置排序');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
elseif (IS_POST) {
|
||||||
|
$ids = input('post.ids');
|
||||||
|
$ids = explode(',', $ids);
|
||||||
|
foreach ($ids as $key => $value) {
|
||||||
|
$res = db('Config')->where(array('id' => $value))->setField('sort', $key + 1);
|
||||||
|
}
|
||||||
|
if ($res !== false) {
|
||||||
|
return $this->success('排序成功!', '', Cookie('__forward__'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $this->error('排序失败!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $this->error('非法请求!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,242 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Content extends Admin{
|
||||||
|
|
||||||
|
public function _initialize(){
|
||||||
|
parent::_initialize();
|
||||||
|
$this->getContentMenu();
|
||||||
|
$this->model_id = $model_id = $this->request->param('model_id');
|
||||||
|
$row = db('Model')->select();
|
||||||
|
foreach ($row as $key => $value) {
|
||||||
|
$list[$value['id']] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($list[$model_id])) {
|
||||||
|
return $this->error("无此模型!");
|
||||||
|
}else {
|
||||||
|
$this->modelInfo = $list[$model_id];
|
||||||
|
if ($this->modelInfo['extend'] > 1) {
|
||||||
|
$this->model = model($this->modelInfo['name']);
|
||||||
|
}else{
|
||||||
|
$this->model = model('Document')->extend($this->modelInfo['name']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assign('model_id',$model_id);
|
||||||
|
$this->assign('model_list',$list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容列表
|
||||||
|
* @return [html] [页面内容]
|
||||||
|
* @author molong <ycgpp@126.com>
|
||||||
|
*/
|
||||||
|
public function index(){
|
||||||
|
if ($this->modelInfo['list_grid'] == '') {
|
||||||
|
return $this->error("列表定义不正确!", url('admin/model/edit',array('id'=>$this->modelInfo['id'])));
|
||||||
|
}
|
||||||
|
$grid_list = get_grid_list($this->modelInfo['list_grid']);
|
||||||
|
$order = "id desc";
|
||||||
|
$map = array();
|
||||||
|
if ($this->modelInfo['extend'] == 1) {
|
||||||
|
$map['model_id'] = $this->modelInfo['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$field = array_filter($grid_list['fields']);
|
||||||
|
$list = $this->model->where($map)->field($field)->order($order)->paginate(15);
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'grid' => $grid_list,
|
||||||
|
'list' => $list,
|
||||||
|
'page' => $list->render()
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta($this->modelInfo['title'] . "列表");
|
||||||
|
return $this->fetch('content/index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容添加
|
||||||
|
* @author molong <ycgpp@126.com>
|
||||||
|
*/
|
||||||
|
public function add(){
|
||||||
|
if (IS_POST) {
|
||||||
|
$result = $this->model->change();
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("添加成功!",url('admin/content/index',array('model_id'=>$this->modelInfo['id'])));
|
||||||
|
}else{
|
||||||
|
return $this->error($this->model->getError(),'');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$info = array(
|
||||||
|
'model_id' => $this->modelInfo['id']
|
||||||
|
);
|
||||||
|
$data = array(
|
||||||
|
'info' => $info,
|
||||||
|
'fieldGroup' => $this->getField($this->modelInfo)
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("添加".$this->modelInfo['title']);
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容修改
|
||||||
|
* @author molong <ycgpp@126.com>
|
||||||
|
*/
|
||||||
|
public function edit(){
|
||||||
|
if (IS_POST) {
|
||||||
|
$result = $this->model->change();
|
||||||
|
if ($result !== false) {
|
||||||
|
return $this->success("更新成功!",url('admin/content/index',array('model_id'=>$this->modelInfo['id'])));
|
||||||
|
}else{
|
||||||
|
return $this->error($this->model->getError(),'');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$id = input('get.id','','trim,intval');
|
||||||
|
if (!$id) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
$info = $this->model->detail($id);
|
||||||
|
if (!$info) {
|
||||||
|
return $this->error($this->model->getError());
|
||||||
|
}
|
||||||
|
$info['model_id'] = $this->modelInfo['id'];
|
||||||
|
$data = array(
|
||||||
|
'info' => $info,
|
||||||
|
'fieldGroup' => $this->getField($this->modelInfo)
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("编辑".$this->modelInfo['title']);
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容删除
|
||||||
|
* @author molong <ycgpp@126.com>
|
||||||
|
*/
|
||||||
|
public function del(){
|
||||||
|
$id = input('get.id','','trim');
|
||||||
|
$ids = input('post.ids/a',array());
|
||||||
|
array_push($ids, $id);
|
||||||
|
if (empty($ids)) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
|
||||||
|
$map['id'] = array('IN',$ids);
|
||||||
|
$result = $this->model->del($map);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("删除成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error("删除失败!", '', "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置状态
|
||||||
|
* @author molong <ycgpp@126.com>
|
||||||
|
*/
|
||||||
|
public function status(){
|
||||||
|
$model = $this->model;
|
||||||
|
$id = input('get.id','','trim,intval');
|
||||||
|
$status = input('get.status','','trim,intval');
|
||||||
|
|
||||||
|
$map['id'] = $id;
|
||||||
|
$result = $model::where($map)->setField('status',$status);
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("操作成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error("操作失败!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字段信息
|
||||||
|
* @return array 字段数组
|
||||||
|
* @author molong <ycgpp@126.com>
|
||||||
|
*/
|
||||||
|
protected function getField(){
|
||||||
|
$field_group = parse_config_attr($this->modelInfo['field_group']);
|
||||||
|
$field_sort = json_decode($this->modelInfo['field_sort'],true);
|
||||||
|
|
||||||
|
if ($this->modelInfo['extend'] > 1) {
|
||||||
|
$map['model_id'] = $this->modelInfo['id'];
|
||||||
|
}else{
|
||||||
|
$model_id[] = $this->modelInfo['id'];
|
||||||
|
$model_id[] = 1;
|
||||||
|
$map['model_id'] = array('IN',$model_id);
|
||||||
|
}
|
||||||
|
if ($this->request->action() == 'add') {
|
||||||
|
$map['is_show'] = array('in',array('1','2'));
|
||||||
|
}elseif($this->request->action() == 'edit'){
|
||||||
|
$map['is_show'] = array('in',array('1','3'));
|
||||||
|
}
|
||||||
|
|
||||||
|
//获得数组的第一条数组
|
||||||
|
$first_key = array_keys($field_group);
|
||||||
|
$fields = model('Attribute')->getFieldlist($map);
|
||||||
|
if (!empty($field_sort)) {
|
||||||
|
foreach ($field_sort as $key => $value) {
|
||||||
|
foreach ($value as $index) {
|
||||||
|
if (isset($fields[$index])) {
|
||||||
|
$groupfield[$key][] = $fields[$index];
|
||||||
|
unset($fields[$index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//未进行排序的放入第一组中
|
||||||
|
$fields[] = array('name'=>'model_id','type'=>'hidden'); //加入模型ID值
|
||||||
|
$fields[] = array('name'=>'id','type'=>'hidden'); //加入模型ID值
|
||||||
|
foreach ($fields as $key => $value) {
|
||||||
|
$groupfield[$first_key[0]][] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($field_group as $key => $value) {
|
||||||
|
if ($groupfield[$key]) {
|
||||||
|
$data[$value] = $groupfield[$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测需要动态判断的文档类目有关的权限
|
||||||
|
*
|
||||||
|
* @return boolean|null
|
||||||
|
* 返回true则表示当前访问有权限
|
||||||
|
* 返回false则表示当前访问无权限
|
||||||
|
* 返回null,则会进入checkRule根据节点授权判断权限
|
||||||
|
*
|
||||||
|
* @author 朱亚杰 <xcoolcc@gmail.com>
|
||||||
|
*/
|
||||||
|
protected function checkDynamic(){
|
||||||
|
$model_id = $this->request->param('model_id');
|
||||||
|
if(IS_ROOT){
|
||||||
|
return true;//管理员允许访问任何页面
|
||||||
|
}
|
||||||
|
$models = model('AuthGroup')->getAuthModels(session('user_auth.uid'));
|
||||||
|
if (!$model_id) {
|
||||||
|
return false;
|
||||||
|
}elseif (in_array($model_id, $models)) {
|
||||||
|
//返回null继续判断操作权限
|
||||||
|
return null;
|
||||||
|
}else{
|
||||||
|
return false;//无权限
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,276 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Database extends Admin {
|
||||||
|
/**
|
||||||
|
* 数据库备份/还原列表
|
||||||
|
* @param String $type import-还原,export-备份
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
public function index($type = null) {
|
||||||
|
switch ($type) {
|
||||||
|
/* 数据还原 */
|
||||||
|
case 'import':
|
||||||
|
//列出备份文件列表
|
||||||
|
$path = config('data_backup_path');
|
||||||
|
if (!is_dir($path)) {
|
||||||
|
mkdir($path, 0755, true);
|
||||||
|
}
|
||||||
|
$path = realpath($path);
|
||||||
|
$flag = \FilesystemIterator::KEY_AS_FILENAME;
|
||||||
|
$glob = new \FilesystemIterator($path, $flag);
|
||||||
|
|
||||||
|
$list = array();
|
||||||
|
foreach ($glob as $name => $file) {
|
||||||
|
if (preg_match('/^\d{8,8}-\d{6,6}-\d+\.sql(?:\.gz)?$/', $name)) {
|
||||||
|
$name = sscanf($name, '%4s%2s%2s-%2s%2s%2s-%d');
|
||||||
|
|
||||||
|
$date = "{$name[0]}-{$name[1]}-{$name[2]}";
|
||||||
|
$time = "{$name[3]}:{$name[4]}:{$name[5]}";
|
||||||
|
$part = $name[6];
|
||||||
|
|
||||||
|
if (isset($list["{$date} {$time}"])) {
|
||||||
|
$info = $list["{$date} {$time}"];
|
||||||
|
$info['part'] = max($info['part'], $part);
|
||||||
|
$info['size'] = $info['size'] + $file->getSize();
|
||||||
|
} else {
|
||||||
|
$info['part'] = $part;
|
||||||
|
$info['size'] = $file->getSize();
|
||||||
|
}
|
||||||
|
$extension = strtoupper(pathinfo($file->getFilename(), PATHINFO_EXTENSION));
|
||||||
|
$info['compress'] = ($extension === 'SQL') ? '-' : $extension;
|
||||||
|
$info['time'] = strtotime("{$date} {$time}");
|
||||||
|
|
||||||
|
$list["{$date} {$time}"] = $info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$title = '数据还原';
|
||||||
|
break;
|
||||||
|
/* 数据备份 */
|
||||||
|
case 'export':
|
||||||
|
$Db = \think\Db::connect();
|
||||||
|
$list = $Db->query('SHOW TABLE STATUS');
|
||||||
|
$list = array_map('array_change_key_case', $list);
|
||||||
|
$title = '数据备份';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return $this->error('参数错误!');
|
||||||
|
}
|
||||||
|
//渲染模板
|
||||||
|
$this->setMeta($title);
|
||||||
|
$this->assign('list', $list);
|
||||||
|
return $this->fetch($type);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 优化表
|
||||||
|
* @param String $tables 表名
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
public function optimize($tables = null) {
|
||||||
|
if ($tables) {
|
||||||
|
$Db = \think\Db::connect();
|
||||||
|
if (is_array($tables)) {
|
||||||
|
$tables = implode('`,`', $tables);
|
||||||
|
$list = $Db->query("OPTIMIZE TABLE `{$tables}`");
|
||||||
|
|
||||||
|
if ($list) {
|
||||||
|
return $this->success("数据表优化完成!");
|
||||||
|
} else {
|
||||||
|
return $this->error("数据表优化出错请重试!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$list = $Db->query("OPTIMIZE TABLE `{$tables}`");
|
||||||
|
if ($list) {
|
||||||
|
return $this->success("数据表'{$tables}'优化完成!");
|
||||||
|
} else {
|
||||||
|
return $this->error("数据表'{$tables}'优化出错请重试!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $this->error("请指定要优化的表!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修复表
|
||||||
|
* @param String $tables 表名
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
public function repair($tables = null) {
|
||||||
|
if ($tables) {
|
||||||
|
$Db = \think\Db::connect();
|
||||||
|
if (is_array($tables)) {
|
||||||
|
$tables = implode('`,`', $tables);
|
||||||
|
$list = $Db->query("REPAIR TABLE `{$tables}`");
|
||||||
|
|
||||||
|
if ($list) {
|
||||||
|
return $this->success("数据表修复完成!");
|
||||||
|
} else {
|
||||||
|
return $this->error("数据表修复出错请重试!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$list = $Db->query("REPAIR TABLE `{$tables}`");
|
||||||
|
if ($list) {
|
||||||
|
return $this->success("数据表'{$tables}'修复完成!");
|
||||||
|
} else {
|
||||||
|
return $this->error("数据表'{$tables}'修复出错请重试!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $this->error("请指定要修复的表!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除备份文件
|
||||||
|
* @param Integer $time 备份时间
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
public function del($time = 0) {
|
||||||
|
if ($time) {
|
||||||
|
$name = date('Ymd-His', $time) . '-*.sql*';
|
||||||
|
$path = realpath(config('DATA_BACKUP_PATH')) . DIRECTORY_SEPARATOR . $name;
|
||||||
|
array_map("unlink", glob($path));
|
||||||
|
if (count(glob($path))) {
|
||||||
|
return $this->error('备份文件删除失败,请检查权限!');
|
||||||
|
} else {
|
||||||
|
return $this->success('备份文件删除成功!');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $this->error('参数错误!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 备份数据库
|
||||||
|
* @param String $tables 表名
|
||||||
|
* @param Integer $id 表ID
|
||||||
|
* @param Integer $start 起始行数
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
public function export($tables = null, $id = null, $start = null) {
|
||||||
|
if (IS_POST && !empty($tables) && is_array($tables)) { //初始化
|
||||||
|
$path = config('data_backup_path');
|
||||||
|
if (!is_dir($path)) {
|
||||||
|
mkdir($path, 0755, true);
|
||||||
|
}
|
||||||
|
//读取备份配置
|
||||||
|
$config = array('path' => realpath($path) . DIRECTORY_SEPARATOR, 'part' => config('data_backup_part_size'), 'compress' => config('data_backup_compress'), 'level' => config('data_backup_compress_level'),);
|
||||||
|
//检查是否有正在执行的任务
|
||||||
|
$lock = "{$config['path']}backup.lock";
|
||||||
|
if (is_file($lock)) {
|
||||||
|
return $this->error('检测到有一个备份任务正在执行,请稍后再试!');
|
||||||
|
} else {
|
||||||
|
//创建锁文件
|
||||||
|
file_put_contents($lock, time());
|
||||||
|
}
|
||||||
|
//检查备份目录是否可写
|
||||||
|
if (!is_writeable($config['path'])) {
|
||||||
|
return $this->error('备份目录不存在或不可写,请检查后重试!');
|
||||||
|
}
|
||||||
|
session('backup_config', $config);
|
||||||
|
//生成备份文件信息
|
||||||
|
$file = array('name' => date('Ymd-His', time()), 'part' => 1,);
|
||||||
|
session('backup_file', $file);
|
||||||
|
//缓存要备份的表
|
||||||
|
session('backup_tables', $tables);
|
||||||
|
//创建备份文件
|
||||||
|
$Database = new \com\Database($file, $config);
|
||||||
|
if (false !== $Database->create()) {
|
||||||
|
$tab = array('id' => 0, 'start' => 0);
|
||||||
|
return $this->success('初始化成功!', '', array('tables' => $tables, 'tab' => $tab));
|
||||||
|
} else {
|
||||||
|
return $this->error('初始化失败,备份文件创建失败!');
|
||||||
|
}
|
||||||
|
} elseif (IS_GET && is_numeric($id) && is_numeric($start)) { //备份数据
|
||||||
|
$tables = session('backup_tables');
|
||||||
|
//备份指定表
|
||||||
|
$Database = new \com\Database(session('backup_file'), session('backup_config'));
|
||||||
|
$start = $Database->backup($tables[$id], $start);
|
||||||
|
if (false === $start) { //出错
|
||||||
|
return $this->error('备份出错!');
|
||||||
|
} elseif (0 === $start) { //下一表
|
||||||
|
if (isset($tables[++$id])) {
|
||||||
|
$tab = array('id' => $id, 'start' => 0);
|
||||||
|
return $this->success('备份完成!', '', array('tab' => $tab));
|
||||||
|
} else { //备份完成,清空缓存
|
||||||
|
unlink(session('backup_config.path') . 'backup.lock');
|
||||||
|
session('backup_tables', null);
|
||||||
|
session('backup_file', null);
|
||||||
|
session('backup_config', null);
|
||||||
|
return $this->success('备份完成!');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$tab = array('id' => $id, 'start' => $start[0]);
|
||||||
|
$rate = floor(100 * ($start[0] / $start[1]));
|
||||||
|
return $this->success("正在备份...({$rate}%)", '', array('tab' => $tab));
|
||||||
|
}
|
||||||
|
} else { //出错
|
||||||
|
return $this->error('参数错误!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 还原数据库
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
public function import($time = 0, $part = null, $start = null) {
|
||||||
|
if (is_numeric($time) && is_null($part) && is_null($start)) { //初始化
|
||||||
|
//获取备份文件信息
|
||||||
|
$name = date('Ymd-His', $time) . '-*.sql*';
|
||||||
|
$path = realpath(config('data_backup_path')) . DIRECTORY_SEPARATOR . $name;
|
||||||
|
$files = glob($path);
|
||||||
|
$list = array();
|
||||||
|
foreach ($files as $name) {
|
||||||
|
$basename = basename($name);
|
||||||
|
$match = sscanf($basename, '%4s%2s%2s-%2s%2s%2s-%d');
|
||||||
|
$gz = preg_match('/^\d{8,8}-\d{6,6}-\d+\.sql.gz$/', $basename);
|
||||||
|
$list[$match[6]] = array($match[6], $name, $gz);
|
||||||
|
}
|
||||||
|
ksort($list);
|
||||||
|
//检测文件正确性
|
||||||
|
$last = end($list);
|
||||||
|
if (count($list) === $last[0]) {
|
||||||
|
session('backup_list', $list); //缓存备份列表
|
||||||
|
return $this->success('初始化完成!', '', array('part' => 1, 'start' => 0));
|
||||||
|
} else {
|
||||||
|
return $this->error('备份文件可能已经损坏,请检查!');
|
||||||
|
}
|
||||||
|
} elseif (is_numeric($part) && is_numeric($start)) {
|
||||||
|
$list = session('backup_list');
|
||||||
|
|
||||||
|
$db = new \com\Database($list[$part], array('path' => realpath(config('data_backup_path')) . DIRECTORY_SEPARATOR, 'compress' => $list[$part][2]));
|
||||||
|
|
||||||
|
$start = $db->import($start);
|
||||||
|
|
||||||
|
if (false === $start) {
|
||||||
|
return $this->error('还原数据出错!');
|
||||||
|
} elseif (0 === $start) { //下一卷
|
||||||
|
if (isset($list[++$part])) {
|
||||||
|
$data = array('part' => $part, 'start' => 0);
|
||||||
|
return $this->success("正在还原...#{$part}", '', $data);
|
||||||
|
} else {
|
||||||
|
session('backup_list', null);
|
||||||
|
return $this->success('还原完成!');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$data = array('part' => $part, 'start' => $start[0]);
|
||||||
|
if ($start[1]) {
|
||||||
|
$rate = floor(100 * ($start[0] / $start[1]));
|
||||||
|
return $this->success("正在还原...#{$part} ({$rate}%)", '', $data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$data['gz'] = 1;
|
||||||
|
return $this->success("正在还原...#{$part}", '', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $this->error('参数错误!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Form extends Admin {
|
||||||
|
|
||||||
|
//自定义表单
|
||||||
|
public function index(){
|
||||||
|
$this->assign('meta_title','自定义表单');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,268 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Group extends Admin {
|
||||||
|
|
||||||
|
protected $model;
|
||||||
|
protected $rule;
|
||||||
|
|
||||||
|
public function _initialize(){
|
||||||
|
parent::_initialize();
|
||||||
|
$this->group = model('AuthGroup');
|
||||||
|
$this->rule = model('AuthRule');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//会员分组首页控制器
|
||||||
|
public function index(){
|
||||||
|
$type = input('get.type','admin','trim');
|
||||||
|
|
||||||
|
$map['module'] = $type;
|
||||||
|
|
||||||
|
$list = db('AuthGroup')->where($map)->order('id desc')->paginate(10);
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'list' => $list,
|
||||||
|
'page' => $list->render(),
|
||||||
|
'type' => $type
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('用户组管理');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
//会员分组添加控制器
|
||||||
|
public function add($type = 'admin'){
|
||||||
|
if (IS_POST) {
|
||||||
|
$result = $this->group->change();
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("添加成功!", url('admin/group/index'));
|
||||||
|
}else{
|
||||||
|
return $this->error("添加失败!");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$data = array(
|
||||||
|
'info' => array('module' => $type,'status' => 1),
|
||||||
|
'keyList' => $this->group->keyList
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('添加用户组');
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//会员分组编辑控制器
|
||||||
|
public function edit($id){
|
||||||
|
if (!$id) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
if (IS_POST) {
|
||||||
|
$result = $this->group->change();
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("编辑成功!", url('admin/group/index'));
|
||||||
|
}else{
|
||||||
|
return $this->error("编辑失败!");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$info = $this->group->where(array('id'=>$id))->find();
|
||||||
|
$data = array(
|
||||||
|
'info' => $info,
|
||||||
|
'keyList' => $this->group->keyList
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('编辑用户组');
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//会员分组编辑字段控制器
|
||||||
|
public function editable(){
|
||||||
|
$pk = input('pk','','trim,intval');
|
||||||
|
$name = input('name','','trim');
|
||||||
|
$value = input('value','','trim');
|
||||||
|
$result = $this->group->where(array('id'=>$pk))->setField($name,$value);
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("删除成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error("删除失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//会员分组删除控制器
|
||||||
|
public function del(){
|
||||||
|
$id = input('id','','trim,intval');
|
||||||
|
if (!$id) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
$result = $this->group->where(array('id'=>$id))->delete();
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("删除成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error("删除失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//权限节点控制器
|
||||||
|
public function access(){
|
||||||
|
$type = input('get.type','admin','trim');
|
||||||
|
|
||||||
|
$map['module'] = $type;
|
||||||
|
|
||||||
|
$list = db('AuthRule')->where($map)->order('id desc')->paginate(10);
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'list' => $list,
|
||||||
|
'page' => $list->render(),
|
||||||
|
'type' => $type
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('权限节点');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据菜单更新节点
|
||||||
|
public function upnode($type){
|
||||||
|
$rule = model('Menu')->getAuthNodes($type);
|
||||||
|
foreach ($rule as $value) {
|
||||||
|
$data = array(
|
||||||
|
'module' => $type,
|
||||||
|
'type' => 2,
|
||||||
|
'name' => $value['url'],
|
||||||
|
'title' => $value['title'],
|
||||||
|
'group' => $value['group'],
|
||||||
|
'status' => 1
|
||||||
|
);
|
||||||
|
$id = $this->rule->where(array('name'=>$data['name']))->value('id');
|
||||||
|
if ($id) {
|
||||||
|
$data['id'] = $id;
|
||||||
|
$this->rule->save($data, array('id'=>$id));
|
||||||
|
}else{
|
||||||
|
$this->rule->save($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->success("更新成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function auth($id){
|
||||||
|
if (!$id) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
if (IS_POST) {
|
||||||
|
$rule = input('rule',array());
|
||||||
|
$extend_rule = input('extend_rule',array());
|
||||||
|
$extend_result = $rule_result = false;
|
||||||
|
//扩展权限
|
||||||
|
$extend_data = array();
|
||||||
|
foreach ($extend_rule as $key => $value) {
|
||||||
|
foreach ($value as $item) {
|
||||||
|
$extend_data[] = array('group_id'=> $id, 'extend_id' => $item, 'type'=> $key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!empty($extend_data)) {
|
||||||
|
db('AuthExtend')->where(array('group_id'=>$id))->delete();
|
||||||
|
$extend_result = db('AuthExtend')->insertAll($extend_data);
|
||||||
|
}
|
||||||
|
if ($rule) {
|
||||||
|
$rules = implode(',', $rule);
|
||||||
|
$rule_result = $this->group->where(array('id'=>$id))->setField('rules',$rules);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rule_result !== false || $extend_result !== false) {
|
||||||
|
return $this->success("授权成功!", url('admin/group/index'));
|
||||||
|
}else{
|
||||||
|
return $this->error("授权失败!", '');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$group = $this->group->where(array('id'=>$id))->find();
|
||||||
|
|
||||||
|
$map['module'] = $group['module'];
|
||||||
|
$row = db('AuthRule')->where($map)->order('id desc')->select();
|
||||||
|
|
||||||
|
$list = array();
|
||||||
|
foreach ($row as $key => $value) {
|
||||||
|
$list[$value['group']][] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//模块
|
||||||
|
$model = db('model')->field('id,title,name')
|
||||||
|
->where(array('status' => array('gt',0), 'extend' => array('gt',0)))
|
||||||
|
->select();
|
||||||
|
//扩展权限
|
||||||
|
$extend_auth = db('AuthExtend')->where(array('group_id'=>$id,'type'=>2))->column('extend_id');
|
||||||
|
$data = array(
|
||||||
|
'list' => $list,
|
||||||
|
'model' => $model,
|
||||||
|
'extend_auth' => $extend_auth,
|
||||||
|
'auth_list' => explode(',', $group['rules']),
|
||||||
|
'id' => $id
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('授权');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addnode($type = 'admin'){
|
||||||
|
if (IS_POST) {
|
||||||
|
$result = $this->rule->change();
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("创建成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error($this->rule->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$data = array(
|
||||||
|
'info' => array('module' => $type,'status' => 1),
|
||||||
|
'keyList' => $this->rule->keyList
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('添加节点');
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function editnode($id){
|
||||||
|
if (IS_POST) {
|
||||||
|
$result = $this->rule->change();
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("更新成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error("更新失败!");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (!$id) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
$info = $this->rule->find($id);
|
||||||
|
$data = array(
|
||||||
|
'info' => $info,
|
||||||
|
'keyList' => $this->rule->keyList
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('编辑节点');
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delnode(){
|
||||||
|
$id = input('id','','trim,intval');
|
||||||
|
if (!$id) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
$result = $this->rule->where(array('id'=>$id))->delete();
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("删除成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error("删除失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Index extends Admin{
|
||||||
|
|
||||||
|
public function index(){
|
||||||
|
$this->setMeta('后台首页');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function login($username = '', $password = '', $verify = ''){
|
||||||
|
if (IS_POST) {
|
||||||
|
if (!$username || !$password) {
|
||||||
|
return $this->error('用户名或者密码不能为空!','');
|
||||||
|
}
|
||||||
|
|
||||||
|
//验证码验证
|
||||||
|
$this->checkVerify($verify);
|
||||||
|
|
||||||
|
$user = model('User');
|
||||||
|
$info = $user->login($username,$password);
|
||||||
|
if ($info) {
|
||||||
|
return $this->success('登录成功!',url('admin/index/index'));
|
||||||
|
}else{
|
||||||
|
switch($uid) {
|
||||||
|
case -1: $error = '用户不存在或被禁用!'; break; //系统级别禁用
|
||||||
|
case -2: $error = '密码错误!'; break;
|
||||||
|
default: $error = '未知错误!'; break; // 0-接口参数错误(调试阶段使用)
|
||||||
|
}
|
||||||
|
return $this->error($error,'');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function logout(){
|
||||||
|
$user = model('User');
|
||||||
|
$user->logout();
|
||||||
|
$this->redirect('index/login');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clear(){
|
||||||
|
if (IS_POST) {
|
||||||
|
$clear = input('post.clear/a',array());
|
||||||
|
foreach ($clear as $key => $value) {
|
||||||
|
if ($value == 'cache') {
|
||||||
|
\think\Cache::clear(); // 清空缓存数据
|
||||||
|
}elseif ($value == 'log') {
|
||||||
|
\think\Log::clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->success("更新成功!",url('admin/index/index'));
|
||||||
|
}else{
|
||||||
|
$keylist = array(
|
||||||
|
array('name'=>'clear','title'=>'更新缓存','type'=>'checkbox','help'=>'','option'=>array(
|
||||||
|
'cache' => '缓存数据',
|
||||||
|
'log' => '日志数据'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$data = array(
|
||||||
|
'keyList' => $keylist,
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("更新缓存");
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Link extends Admin{
|
||||||
|
|
||||||
|
public function index(){
|
||||||
|
$map = array();
|
||||||
|
|
||||||
|
$order = "id desc";
|
||||||
|
$list = db('Link')->where($map)->order($order)->paginate(10);
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'list' => $list,
|
||||||
|
'page' => $list->render()
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("友情链接");
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加
|
||||||
|
public function add(){
|
||||||
|
$link = model('Link');
|
||||||
|
if(IS_POST){
|
||||||
|
$data = input('post.');
|
||||||
|
if ($data) {
|
||||||
|
unset($data['id']);
|
||||||
|
$result = $link->save($data);
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("添加成功!",url('Link/index'));
|
||||||
|
}else{
|
||||||
|
return $this->error($link->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->error($link->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$data = array(
|
||||||
|
'keyList' => $link->keyList
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("添加友链");
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function edit(){
|
||||||
|
$link = model('Link');
|
||||||
|
$id = input('get.id','','trim,intval');
|
||||||
|
if(IS_POST){
|
||||||
|
$data = input('post.');
|
||||||
|
if ($data) {
|
||||||
|
$result = $link->save($data,array('id'=>$data['id']));
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("修改成功!",url('Link/index'));
|
||||||
|
}else{
|
||||||
|
return $this->error("修改失败!");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->error($link->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$map = array('id'=>$id);
|
||||||
|
$info = db('Link')->where($map)->find();
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'keyList' => $link->keyList,
|
||||||
|
'info' => $info
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("编辑友链");
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function delete($id){
|
||||||
|
$link = db('Link');
|
||||||
|
|
||||||
|
$map = array('id'=>array('IN',$id));
|
||||||
|
$result = $link->where($map)->delete();
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("删除成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error("删除失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,262 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Menu extends Admin{
|
||||||
|
|
||||||
|
public function _initialize(){
|
||||||
|
parent::_initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(){
|
||||||
|
$map = array();
|
||||||
|
$title = trim(input('get.title'));
|
||||||
|
$list = db("Menu")->where($map)->field(true)->order('sort asc,id asc')->select();
|
||||||
|
int_to_string($list,array('hide'=>array(1=>'是',0=>'否'),'is_dev'=>array(1=>'是',0=>'否')));
|
||||||
|
|
||||||
|
if (!empty($list)) {
|
||||||
|
$tree = new \com\Tree();
|
||||||
|
$list = $tree->toFormatTree($list);
|
||||||
|
}
|
||||||
|
// 记录当前列表页的cookie
|
||||||
|
Cookie('__forward__',$_SERVER['REQUEST_URI']);
|
||||||
|
|
||||||
|
$this->setMeta('菜单列表');
|
||||||
|
$this->assign('list',$list);
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 单字段编辑 */
|
||||||
|
public function editable($name=null,$value=null,$pk=null){
|
||||||
|
if ($name && ($value != null || $value != '') && $pk) {
|
||||||
|
db('Menu')->where(array('id'=>$pk))->setField($name,$value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增菜单
|
||||||
|
* @author yangweijie <yangweijiester@gmail.com>
|
||||||
|
*/
|
||||||
|
public function add(){
|
||||||
|
if(IS_POST){
|
||||||
|
$Menu = model('Menu');
|
||||||
|
$data = input('post.');
|
||||||
|
if($data){
|
||||||
|
$id = $Menu->save($data);
|
||||||
|
if($id){
|
||||||
|
session('admin_menu_list',null);
|
||||||
|
//记录行为
|
||||||
|
action_log('update_menu', 'Menu', $id, session('user_auth.uid'));
|
||||||
|
return $this->success('新增成功', Cookie('__forward__'));
|
||||||
|
} else {
|
||||||
|
return $this->error('新增失败');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $this->error($Menu->getError());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->assign('info',array('pid'=>input('pid')));
|
||||||
|
$menus = db('Menu')->select();
|
||||||
|
$tree = new \com\Tree();
|
||||||
|
$menus = $tree->toFormatTree($menus);
|
||||||
|
if (!empty($menus)) {
|
||||||
|
$menus = array_merge(array(0=>array('id'=>0,'title_show'=>'顶级菜单')), $menus);
|
||||||
|
}else{
|
||||||
|
$menus = array(0=>array('id'=>0,'title_show'=>'顶级菜单'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assign('Menus', $menus);
|
||||||
|
$this->setMeta('新增菜单');
|
||||||
|
return $this->fetch('edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑配置
|
||||||
|
* @author yangweijie <yangweijiester@gmail.com>
|
||||||
|
*/
|
||||||
|
public function edit($id = 0){
|
||||||
|
if(IS_POST){
|
||||||
|
$Menu = model('Menu');
|
||||||
|
$data = input('post.');
|
||||||
|
if($data){
|
||||||
|
if($Menu->save($data,array('id'=>$data['id']))!== false){
|
||||||
|
session('admin_menu_list',null);
|
||||||
|
//记录行为
|
||||||
|
action_log('update_menu', 'Menu', $data['id'], session('user_auth.uid'));
|
||||||
|
return $this->success('更新成功', Cookie('__forward__'));
|
||||||
|
} else {
|
||||||
|
return $this->error('更新失败');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $this->error($Menu->getError());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$info = array();
|
||||||
|
/* 获取数据 */
|
||||||
|
$info = db('Menu')->field(true)->find($id);
|
||||||
|
$menus = db('Menu')->field(true)->select();
|
||||||
|
$tree = new \com\Tree();
|
||||||
|
$menus = $tree->toFormatTree($menus);
|
||||||
|
|
||||||
|
$menus = array_merge(array(0=>array('id'=>0,'title_show'=>'顶级菜单')), $menus);
|
||||||
|
$this->assign('Menus', $menus);
|
||||||
|
if(false === $info){
|
||||||
|
return $this->error('获取后台菜单信息错误');
|
||||||
|
}
|
||||||
|
$this->assign('info', $info);
|
||||||
|
$this->setMeta('编辑后台菜单');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除后台菜单
|
||||||
|
* @author yangweijie <yangweijiester@gmail.com>
|
||||||
|
*/
|
||||||
|
public function del(){
|
||||||
|
$id = array_unique((array)input('id',0));
|
||||||
|
|
||||||
|
if ( empty($id) ) {
|
||||||
|
return $this->error('请选择要操作的数据!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$map = array('id' => array('in', $id) );
|
||||||
|
if(db('Menu')->where($map)->delete()){
|
||||||
|
session('admin_menu_list',null);
|
||||||
|
//记录行为
|
||||||
|
action_log('update_menu', 'Menu', $id, UID);
|
||||||
|
return $this->success('删除成功');
|
||||||
|
} else {
|
||||||
|
return $this->error('删除失败!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toogleHide($id,$value = 1){
|
||||||
|
session('admin_menu_list',null);
|
||||||
|
$result = db('Menu')->where(array('id'=>$id))->setField(array('hide'=>$value));
|
||||||
|
if($result !==false ) {
|
||||||
|
return $this->success('操作成功!');
|
||||||
|
}else{
|
||||||
|
return $this->error('操作失败!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toogleDev($id,$value = 1){
|
||||||
|
session('admin_menu_list',null);
|
||||||
|
$result = db('Menu')->where(array('id'=>$id))->setField(array('is_dev'=>$value));
|
||||||
|
if($result !==false ) {
|
||||||
|
return $this->success('操作成功!');
|
||||||
|
}else{
|
||||||
|
return $this->error('操作失败!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function importFile($tree = null, $pid=0){
|
||||||
|
if($tree == null){
|
||||||
|
$file = APP_PATH."Admin/Conf/Menu.php";
|
||||||
|
$tree = require_once($file);
|
||||||
|
}
|
||||||
|
$menuModel = D('Menu');
|
||||||
|
foreach ($tree as $value) {
|
||||||
|
$add_pid = $menuModel->add(
|
||||||
|
array(
|
||||||
|
'title'=>$value['title'],
|
||||||
|
'url'=>$value['url'],
|
||||||
|
'pid'=>$pid,
|
||||||
|
'hide'=>isset($value['hide'])? (int)$value['hide'] : 0,
|
||||||
|
'tip'=>isset($value['tip'])? $value['tip'] : '',
|
||||||
|
'group'=>$value['group'],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if($value['operator']){
|
||||||
|
$this->import($value['operator'], $add_pid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function import(){
|
||||||
|
if(IS_POST){
|
||||||
|
$tree = input('post.tree');
|
||||||
|
$lists = explode(PHP_EOL, $tree);
|
||||||
|
$menuModel = db('Menu');
|
||||||
|
if($lists == array()){
|
||||||
|
return $this->error('请按格式填写批量导入的菜单,至少一个菜单');
|
||||||
|
}else{
|
||||||
|
$pid = input('post.pid');
|
||||||
|
foreach ($lists as $key => $value) {
|
||||||
|
$record = explode('|', $value);
|
||||||
|
if(count($record) == 4){
|
||||||
|
$menuModel->add(array(
|
||||||
|
'title'=>$record[0],
|
||||||
|
'url'=>$record[1],
|
||||||
|
'pid'=>$record[2],
|
||||||
|
'sort'=>0,
|
||||||
|
'hide'=>0,
|
||||||
|
'tip'=>'',
|
||||||
|
'is_dev'=>0,
|
||||||
|
'group'=>$record[3],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
session('admin_menu_list',null);
|
||||||
|
return $this->success('导入成功',url('index?pid='.$pid));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$this->setMeta('批量导入后台菜单');
|
||||||
|
$pid = (int)input('get.pid');
|
||||||
|
$this->assign('pid', $pid);
|
||||||
|
$data = db('Menu')->where("id={$pid}")->field(true)->find();
|
||||||
|
$this->assign('data', $data);
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单排序
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function sort(){
|
||||||
|
if(IS_GET){
|
||||||
|
$ids = input('get.ids');
|
||||||
|
$pid = input('get.pid');
|
||||||
|
|
||||||
|
//获取排序的数据
|
||||||
|
$map = array('status'=>array('gt',-1));
|
||||||
|
if(!empty($ids)){
|
||||||
|
$map['id'] = array('in',$ids);
|
||||||
|
}else{
|
||||||
|
if($pid !== ''){
|
||||||
|
$map['pid'] = $pid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$list = db('Menu')->where($map)->field('id,title')->order('sort asc,id asc')->select();
|
||||||
|
|
||||||
|
$this->assign('list', $list);
|
||||||
|
$this->setMeta('菜单排序');
|
||||||
|
return $this->fetch();
|
||||||
|
}elseif (IS_POST){
|
||||||
|
$ids = input('post.ids');
|
||||||
|
$ids = explode(',', $ids);
|
||||||
|
foreach ($ids as $key=>$value){
|
||||||
|
$res = db('Menu')->where(array('id'=>$value))->setField('sort', $key+1);
|
||||||
|
}
|
||||||
|
if($res !== false){
|
||||||
|
session('admin_menu_list',null);
|
||||||
|
return $this->success('排序成功!');
|
||||||
|
}else{
|
||||||
|
return $this->error('排序失败!');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->error('非法请求!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,168 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Model extends Admin{
|
||||||
|
|
||||||
|
public function _initialize(){
|
||||||
|
parent::_initialize();
|
||||||
|
$this->getContentMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型管理首页
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function index() {
|
||||||
|
$map = array('status' => array('gt', -1));
|
||||||
|
|
||||||
|
$order = "id desc";
|
||||||
|
$list = model('Model')->where($map)->order($order)->paginate(10);
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'list' => $list,
|
||||||
|
'page' => $list->render(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// 记录当前列表页的cookie
|
||||||
|
Cookie('__forward__', $_SERVER['REQUEST_URI']);
|
||||||
|
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('模型管理');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增页面初始化
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function add() {
|
||||||
|
|
||||||
|
//获取所有的模型
|
||||||
|
$models = db('Model')->where(array('extend' => 0))->field('id,title')->select();
|
||||||
|
|
||||||
|
$this->assign('models', $models);
|
||||||
|
$this->setMeta('新增模型');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑页面初始化
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function edit() {
|
||||||
|
$id = input('get.id', '');
|
||||||
|
if (empty($id)) {
|
||||||
|
return $this->error('参数不能为空!');
|
||||||
|
}
|
||||||
|
|
||||||
|
/*获取一条记录的详细数据*/
|
||||||
|
$model = model('Model');
|
||||||
|
$data = $model::find($id);
|
||||||
|
if (!$data) {
|
||||||
|
return $this->error($Model->getError());
|
||||||
|
}
|
||||||
|
$data['attribute_list'] = empty($data['attribute_list']) ? '' : explode(",", $data['attribute_list']);
|
||||||
|
|
||||||
|
// 是否继承了其他模型
|
||||||
|
if ($data['extend'] == 1) {
|
||||||
|
$map['model_id'] = array('IN',array($data['id'],$data['extend']));
|
||||||
|
}else{
|
||||||
|
$map['model_id'] = $data['id'];
|
||||||
|
}
|
||||||
|
$map['is_show'] = 1;
|
||||||
|
$fields = db('Attribute')->where($map)->select();
|
||||||
|
|
||||||
|
// 梳理属性的可见性
|
||||||
|
foreach ($fields as $key => $field) {
|
||||||
|
if (!empty($data['attribute_list']) && !in_array($field['id'], $data['attribute_list'])) {
|
||||||
|
$field['is_show'] = 0;
|
||||||
|
}
|
||||||
|
$field['group'] = -1;
|
||||||
|
$field['sort'] = 0;
|
||||||
|
$fields_tem[$field['id']] = $field;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取模型排序字段
|
||||||
|
$field_sort = json_decode($data['field_sort'], true);
|
||||||
|
if (!empty($field_sort)) {
|
||||||
|
foreach ($field_sort as $group => $ids) {
|
||||||
|
foreach ($ids as $key => $value) {
|
||||||
|
if (!empty($fields_tem[$value])) {
|
||||||
|
$fields_tem[$value]['group'] = $group;
|
||||||
|
$fields_tem[$value]['sort'] = $key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($fields_tem) && $fields_tem) {
|
||||||
|
// 模型字段列表排序
|
||||||
|
$fields = list_sort_by($fields_tem, "sort");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assign('fields', $fields);
|
||||||
|
$this->assign('info', $data);
|
||||||
|
$this->setMeta('编辑模型');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除一条数据
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function del() {
|
||||||
|
$mdoel = model('Model');
|
||||||
|
$result = $mdoel->del();
|
||||||
|
if ($result) {
|
||||||
|
return $this->success('删除模型成功!');
|
||||||
|
} else {
|
||||||
|
return $this->error($mdoel->getError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新一条数据
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function update() {
|
||||||
|
$res = \think\Loader::model('Model')->change();
|
||||||
|
if($res['status']){
|
||||||
|
return $this->success($res['info'], url('index'));
|
||||||
|
}else{
|
||||||
|
return $this->error($res['info'], '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新数据
|
||||||
|
* @author colin <colin@tensent.cn>
|
||||||
|
*/
|
||||||
|
public function status(){
|
||||||
|
$map['id'] = input('post.ids/a') ? input('post.ids/a') : input('get.ids/a');
|
||||||
|
if(null == $map['id'])return $this->error('参数不正确!');
|
||||||
|
|
||||||
|
$data['status'] = input('get.status');
|
||||||
|
|
||||||
|
if(null == $data['status']){
|
||||||
|
//实现单条数据数据修改
|
||||||
|
$status = db('Model')->where($map)->field('status')->find();
|
||||||
|
$data['status'] = $status['status'] ? 0 : 1;
|
||||||
|
db('Model')->where($map)->update($data);
|
||||||
|
}else{
|
||||||
|
//实现多条数据同时修改
|
||||||
|
$map['id'] = array('IN',$map['id']);
|
||||||
|
db('Model')->where($map)->update($data);
|
||||||
|
}
|
||||||
|
return $this->success('状态设置成功!');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Seo extends Admin{
|
||||||
|
|
||||||
|
protected $model;
|
||||||
|
protected $keyList;
|
||||||
|
|
||||||
|
public function _initialize(){
|
||||||
|
parent::_initialize();
|
||||||
|
$app=array(''=>'-所有模块-','index'=>'前台模块','user'=>'用户中心');
|
||||||
|
$this->keyList = array(
|
||||||
|
array('name'=>'id','title'=>'标识','type'=>'hidden'),
|
||||||
|
array('name'=>'title','title'=>'规则名称','type'=>'text','option'=>'','help'=>'规则名称,方便记忆'),
|
||||||
|
array('name'=>'app','title'=>'模块名','type'=>'select','option'=>$app,'help'=>'不选表示所有模块'),
|
||||||
|
array('name'=>'controller','title'=>'控制器','type'=>'text','option'=>'','help'=>'不填表示所有控制器'),
|
||||||
|
array('name'=>'act','title'=>'方法','type'=>'text','option'=>'','help'=>'不填表示所有方法'),
|
||||||
|
array('name'=>'seo_title','title'=>'SEO标题','type'=>'text','option'=>'','help'=>'不填表示使用默认'),
|
||||||
|
array('name'=>'seo_keywords','title'=>'SEO关键字','type'=>'text','option'=>'','help'=>'不填表示使用默认'),
|
||||||
|
array('name'=>'seo_description','title'=>'SEO描述','type'=>'text','option'=>'','help'=>'不填表示使用默认'),
|
||||||
|
array('name'=>'status', 'title'=>'状态', 'type'=>'select','option'=>array('0'=>'禁用','1'=>'启用'),'help'=>''),
|
||||||
|
array('name'=>'sort','title'=>'排序','type'=>'text','option'=>'','help'=>'')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index($page = 1, $r = 20){
|
||||||
|
//读取规则列表
|
||||||
|
$map = array('status' => array('EGT', 0));
|
||||||
|
|
||||||
|
$list = model('SeoRule')->where($map)->order('sort asc')->paginate(10);
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'list' => $list,
|
||||||
|
'page' => $list->render(),
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("规则列表");
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add(){
|
||||||
|
if (IS_POST) {
|
||||||
|
$data = input('post.');
|
||||||
|
if ($data) {
|
||||||
|
$result = model('SeoRule')->save($data);
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("添加成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error("添加失败!","");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->error($this->model->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$data = array(
|
||||||
|
'keyList' => $this->keyList
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("添加规则");
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id = null){
|
||||||
|
if (IS_POST) {
|
||||||
|
$data = input('post.');
|
||||||
|
if ($data) {
|
||||||
|
$result = model('SeoRule')->save($data,array('id'=>$data['id']));
|
||||||
|
if (false !== $result) {
|
||||||
|
return $this->success("修改成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error("修改失败!","");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->error($this->model->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$id = input('id','','trim,intval');
|
||||||
|
$info = db('SeoRule')->where(array('id'=>$id))->find();
|
||||||
|
$data = array(
|
||||||
|
'info' => $info,
|
||||||
|
'keyList' => $this->keyList
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("编辑规则");
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function del(){
|
||||||
|
$id = input('id','','trim,intval');
|
||||||
|
if (!$id) {
|
||||||
|
return $this->error("非法操作!");
|
||||||
|
}
|
||||||
|
$result = db('SeoRule')->where(array('id'=>$id))->delete();
|
||||||
|
if ($result) {
|
||||||
|
return $this->success("删除成功!");
|
||||||
|
}else{
|
||||||
|
return $this->error("删除失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class Upload extends Admin {
|
||||||
|
|
||||||
|
public function _empty(){
|
||||||
|
$controller = controller('common/Upload');
|
||||||
|
$action = ACTION_NAME;
|
||||||
|
return $controller->$action();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,365 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\common\controller\Admin;
|
||||||
|
|
||||||
|
class User extends Admin{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户管理首页
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
public function index() {
|
||||||
|
$nickname = input('nickname');
|
||||||
|
$map['status'] = array('egt', 0);
|
||||||
|
if (is_numeric($nickname)) {
|
||||||
|
$map['uid|nickname'] = array(intval($nickname), array('like', '%' . $nickname . '%'), '_multi' => true);
|
||||||
|
} else {
|
||||||
|
$map['nickname'] = array('like', '%' . (string)$nickname . '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
$order = "uid desc";
|
||||||
|
$list = model('User')->where($map)->order($order)->paginate(15);
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'list' => $list,
|
||||||
|
'page' => $list->render(),
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta('用户信息');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create
|
||||||
|
* @author colin <colin@tensent.cn>
|
||||||
|
*/
|
||||||
|
public function add(){
|
||||||
|
$model = \think\Loader::model('User');
|
||||||
|
if(IS_POST){
|
||||||
|
$username = input('post.username', '', 'trim');
|
||||||
|
$email = input('post.email', '', 'trim');
|
||||||
|
$password = input('post.password', '', 'trim');
|
||||||
|
$repassword = input('post.repassword', '', 'trim');
|
||||||
|
//创建注册用户
|
||||||
|
$uid = $model->register($username, $password, $repassword, false);
|
||||||
|
|
||||||
|
if(0 < $uid){
|
||||||
|
$userinfo = array('nickname' => $username, 'email' => $email, 'status' => 1,'reg_time'=>time(),'last_login_time'=>time(),'last_login_ip'=>get_client_ip(1));
|
||||||
|
/*保存信息*/
|
||||||
|
if(!db('Member')->where(array('uid'=>$uid))->update($userinfo)){
|
||||||
|
return $this->error('用户添加失败!');
|
||||||
|
} else {
|
||||||
|
return $this->success('用户添加成功!',url('index'));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->error($this->showRegError($uid));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$data = array(
|
||||||
|
'keyList' => $model->addfield
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("添加用户");
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改昵称初始化
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function edit() {
|
||||||
|
$model = model('User');
|
||||||
|
if(IS_POST){
|
||||||
|
$data = $this->request->post();
|
||||||
|
if(!$data){
|
||||||
|
return $this->error($this->showRegError($model->getError()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//为空
|
||||||
|
if(empty($data['password'])){
|
||||||
|
unset($data['password']);
|
||||||
|
unset($data['salt']);
|
||||||
|
$model->save($data);
|
||||||
|
}else{
|
||||||
|
$data['salt'] = rand_string();
|
||||||
|
$data['password'] = md5($password.$data['salt']);
|
||||||
|
//不为空
|
||||||
|
$model->save($data,array('uid'=>$data['uid']));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($reuslt) {
|
||||||
|
return $this->success('修改成功!',url('index'));
|
||||||
|
}else{
|
||||||
|
return $this->error('修改失败!', '');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$info = $this->getUserinfo();
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'info' => $info,
|
||||||
|
'keyList' => $model->editfield
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("编辑用户");
|
||||||
|
return $this->fetch('public/edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* del
|
||||||
|
* @author colin <colin@tensent.cn>
|
||||||
|
*/
|
||||||
|
public function del(){
|
||||||
|
$ids = input('post.ids');
|
||||||
|
//多条删除和单条删除
|
||||||
|
empty($ids) ? $ids = input('get.id') : $ids = $ids;
|
||||||
|
$uid = array('IN',is_array($ids) ? implode(',',$ids) : $ids);
|
||||||
|
//获取用户信息
|
||||||
|
$find = $this->getUserinfo($uid);
|
||||||
|
model('User')->where(array('uid'=>$uid))->delete();
|
||||||
|
return $this->success('删除用户成功!');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function auth(){
|
||||||
|
$access = model('AuthGroupAccess');
|
||||||
|
$group = model('AuthGroup');
|
||||||
|
if (IS_POST) {
|
||||||
|
$uid = input('uid','','trim,intval');
|
||||||
|
$access->where(array('uid'=>$uid))->delete();
|
||||||
|
$group_type = config('user_group_type');
|
||||||
|
foreach ($group_type as $key => $value) {
|
||||||
|
$group_id = input($key,'','trim,intval');
|
||||||
|
if ($group_id) {
|
||||||
|
$add = array(
|
||||||
|
'uid' => $uid,
|
||||||
|
'group_id' => $group_id,
|
||||||
|
);
|
||||||
|
$access->save($add);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->success("设置成功!");
|
||||||
|
}else{
|
||||||
|
$uid = input('id','','trim,intval');
|
||||||
|
$row = $group::select();
|
||||||
|
$auth = $access::where(array('uid'=>$uid))->select();
|
||||||
|
|
||||||
|
$auth_list = array();
|
||||||
|
foreach ($auth as $key => $value) {
|
||||||
|
$auth_list[] = $value['group_id'];
|
||||||
|
}
|
||||||
|
foreach ($row as $key => $value) {
|
||||||
|
$list[$value['module']][] = $value;
|
||||||
|
}
|
||||||
|
$data = array(
|
||||||
|
'uid' => $uid,
|
||||||
|
'auth_list' => $auth_list,
|
||||||
|
'list' => $list
|
||||||
|
);
|
||||||
|
$this->assign($data);
|
||||||
|
$this->setMeta("用户分组");
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取某个用户的信息
|
||||||
|
* @var uid 针对状态和删除启用
|
||||||
|
* @var pass 是查询password
|
||||||
|
* @var errormasg 错误提示
|
||||||
|
* @author colin <colin@tensent.cn>
|
||||||
|
*/
|
||||||
|
private function getUserinfo($uid = null,$pass = null,$errormsg = null){
|
||||||
|
$user = model('User');
|
||||||
|
$uid = $uid ? $uid : input('get.id');
|
||||||
|
//如果无UID则修改当前用户
|
||||||
|
$uid = $uid ? $uid : session('user_auth.uid');
|
||||||
|
$map['uid'] = $uid;
|
||||||
|
if($pass != null ){
|
||||||
|
unset($map);
|
||||||
|
$map['password'] = $pass;
|
||||||
|
}
|
||||||
|
$list = $user::where($map)->field('uid,username,nickname,sex,email,qq,score,signature,status,salt')->find();
|
||||||
|
if(!$list){
|
||||||
|
return $this->error($errormsg ? $errormsg : '不存在此用户!');
|
||||||
|
}
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改昵称提交
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function submitNickname() {
|
||||||
|
|
||||||
|
//获取参数
|
||||||
|
$nickname = input('post.nickname');
|
||||||
|
$password = input('post.password');
|
||||||
|
if (empty($nickname)) {
|
||||||
|
return $this->error('请输入昵称');
|
||||||
|
}
|
||||||
|
if (empty($password)) {
|
||||||
|
return $this->error('请输入密码');
|
||||||
|
}
|
||||||
|
|
||||||
|
//密码验证
|
||||||
|
$User = new UserApi();
|
||||||
|
$uid = $User->login(UID, $password, 4);
|
||||||
|
if ($uid == -2) {
|
||||||
|
return $this->error('密码不正确');
|
||||||
|
}
|
||||||
|
|
||||||
|
$Member = model('User');
|
||||||
|
$data = $Member->create(array('nickname' => $nickname));
|
||||||
|
if (!$data) {
|
||||||
|
return $this->error($Member->getError());
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = $Member->where(array('uid' => $uid))->save($data);
|
||||||
|
|
||||||
|
if ($res) {
|
||||||
|
$user = session('user_auth');
|
||||||
|
$user['username'] = $data['nickname'];
|
||||||
|
session('user_auth', $user);
|
||||||
|
session('user_auth_sign', data_auth_sign($user));
|
||||||
|
return $this->success('修改昵称成功!');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $this->error('修改昵称失败!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改密码初始化
|
||||||
|
* @author huajie <banhuajie@163.com>
|
||||||
|
*/
|
||||||
|
public function editpwd() {
|
||||||
|
if (IS_POST) {
|
||||||
|
$user = \think\Loader::model('User');
|
||||||
|
//获取参数
|
||||||
|
$password = input('post.old');
|
||||||
|
if(empty($password)){
|
||||||
|
return $this->error('请输入原密码','');
|
||||||
|
}
|
||||||
|
$data['password'] = input('post.password');
|
||||||
|
if (empty($data['password'])) {
|
||||||
|
return $this->error('请输入新密码','');
|
||||||
|
}
|
||||||
|
$repassword = input('post.repassword');
|
||||||
|
if (empty($repassword)) {
|
||||||
|
return $this->error('请输入确认密码','');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($data['password'] !== $repassword) {
|
||||||
|
return $this->error('您输入的新密码与确认密码不一致','');
|
||||||
|
}
|
||||||
|
$res = $user->updateUserFields(UID, $password, $data);
|
||||||
|
if ($res) {
|
||||||
|
return $this->success('修改密码成功!');
|
||||||
|
}else {
|
||||||
|
return $this->error($user->getError());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$this->setMeta('修改密码');
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员状态修改
|
||||||
|
* @author 朱亚杰 <zhuyajie@topthink.net>
|
||||||
|
*/
|
||||||
|
public function changeStatus($method = null) {
|
||||||
|
$id = array_unique((array)input('id', 0));
|
||||||
|
if (in_array(config('user_administrator'), $id)) {
|
||||||
|
return $this->error("不允许对超级管理员执行该操作!");
|
||||||
|
}
|
||||||
|
$id = is_array($id) ? implode(',', $id) : $id;
|
||||||
|
if (empty($id)) {
|
||||||
|
return $this->error('请选择要操作的数据!');
|
||||||
|
}
|
||||||
|
$map['uid'] = array('in', $id);
|
||||||
|
switch (strtolower($method)) {
|
||||||
|
case 'forbiduser':
|
||||||
|
$this->forbid('Member', $map);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'resumeuser':
|
||||||
|
$this->resume('Member', $map);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'deleteuser':
|
||||||
|
$this->delete('Member', $map);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return $this->error('参数非法');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户注册错误信息
|
||||||
|
* @param integer $code 错误编码
|
||||||
|
* @return string 错误信息
|
||||||
|
*/
|
||||||
|
private function showRegError($code = 0) {
|
||||||
|
switch ($code) {
|
||||||
|
case -1:
|
||||||
|
$error = '用户名长度必须在16个字符以内!';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case -2:
|
||||||
|
$error = '用户名被禁止注册!';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case -3:
|
||||||
|
$error = '用户名被占用!';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case -4:
|
||||||
|
$error = '密码长度必须在6-30个字符之间!';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case -5:
|
||||||
|
$error = '邮箱格式不正确!';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case -6:
|
||||||
|
$error = '邮箱长度必须在1-32个字符之间!';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case -7:
|
||||||
|
$error = '邮箱被禁止注册!';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case -8:
|
||||||
|
$error = '邮箱被占用!';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case -9:
|
||||||
|
$error = '手机格式不正确!';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case -10:
|
||||||
|
$error = '手机被禁止注册!';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case -11:
|
||||||
|
$error = '手机号被占用!';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$error = '未知错误';
|
||||||
|
}
|
||||||
|
return $error;
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
@@ -0,0 +1,328 @@
|
|||||||
|
$(function($) {
|
||||||
|
var storage, fail, uid;
|
||||||
|
try {
|
||||||
|
uid = new Date; (storage = window.localStorage).setItem(uid, uid);
|
||||||
|
fail = storage.getItem(uid) != uid;
|
||||||
|
storage.removeItem(uid);
|
||||||
|
fail && (storage = false);
|
||||||
|
} catch(e) {}
|
||||||
|
if (storage) {
|
||||||
|
try {
|
||||||
|
var usedSkin = localStorage.getItem('config-skin');
|
||||||
|
if (usedSkin != '') {
|
||||||
|
$('#skin-colors .skin-changer').removeClass('active');
|
||||||
|
$('#skin-colors .skin-changer[data-skin="' + usedSkin + '"]').addClass('active');
|
||||||
|
}
|
||||||
|
var fixedHeader = localStorage.getItem('config-fixed-header');
|
||||||
|
if (fixedHeader == 'fixed-header') {
|
||||||
|
$('body').addClass(fixedHeader);
|
||||||
|
$('#config-fixed-header').prop('checked', true);
|
||||||
|
}
|
||||||
|
var fixedFooter = localStorage.getItem('config-fixed-footer');
|
||||||
|
if (fixedFooter == 'fixed-footer') {
|
||||||
|
$('body').addClass(fixedFooter);
|
||||||
|
$('#config-fixed-footer').prop('checked', true);
|
||||||
|
}
|
||||||
|
var boxedLayout = localStorage.getItem('config-boxed-layout');
|
||||||
|
if (boxedLayout == 'boxed-layout') {
|
||||||
|
$('body').addClass(boxedLayout);
|
||||||
|
$('#config-boxed-layout').prop('checked', true);
|
||||||
|
}
|
||||||
|
var fixedLeftmenu = localStorage.getItem('config-fixed-leftmenu');
|
||||||
|
if (fixedLeftmenu == 'fixed-leftmenu') {
|
||||||
|
$('body').addClass(fixedLeftmenu);
|
||||||
|
$('#config-fixed-sidebar').prop('checked', true);
|
||||||
|
if ($('#page-wrapper').hasClass('nav-small')) {
|
||||||
|
$('#page-wrapper').removeClass('nav-small');
|
||||||
|
}
|
||||||
|
$('.fixed-leftmenu #col-left').nanoScroller({
|
||||||
|
alwaysVisible: true,
|
||||||
|
iOSNativeScrolling: false,
|
||||||
|
preventPageScrolling: true,
|
||||||
|
contentClass: 'col-left-nano-content'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var sidebarSamll = localStorage.getItem('config-sidebar-samll');
|
||||||
|
if (sidebarSamll == 'sidebar-samll') {
|
||||||
|
$('#config-sidebar-samll').prop('checked', true);
|
||||||
|
$('#page-wrapper').addClass('nav-small');
|
||||||
|
} else {
|
||||||
|
$('#page-wrapper').removeClass('nav-small');
|
||||||
|
};
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$('#config-tool-cog').on('click',
|
||||||
|
function() {
|
||||||
|
$('#config-tool').toggleClass('closed');
|
||||||
|
});
|
||||||
|
$('#config-fixed-header').on('change',
|
||||||
|
function() {
|
||||||
|
var fixedHeader = '';
|
||||||
|
if ($(this).is(':checked')) {
|
||||||
|
$('body').addClass('fixed-header');
|
||||||
|
fixedHeader = 'fixed-header';
|
||||||
|
} else {
|
||||||
|
$('body').removeClass('fixed-header');
|
||||||
|
if ($('#config-fixed-sidebar').is(':checked')) {
|
||||||
|
$('#config-fixed-sidebar').prop('checked', false);
|
||||||
|
$('#config-fixed-sidebar').trigger('change');
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writeStorage(storage, 'config-fixed-header', fixedHeader);
|
||||||
|
});
|
||||||
|
$('#config-fixed-footer').on('change',
|
||||||
|
function() {
|
||||||
|
var fixedFooter = '';
|
||||||
|
if ($(this).is(':checked')) {
|
||||||
|
$('body').addClass('fixed-footer');
|
||||||
|
fixedFooter = 'fixed-footer';
|
||||||
|
} else {
|
||||||
|
$('body').removeClass('fixed-footer');
|
||||||
|
}
|
||||||
|
writeStorage(storage, 'config-fixed-footer', fixedFooter);
|
||||||
|
});
|
||||||
|
$('#config-boxed-layout').on('change',
|
||||||
|
function() {
|
||||||
|
var boxedLayout = '';
|
||||||
|
if ($(this).is(':checked')) {
|
||||||
|
$('body').addClass('boxed-layout');
|
||||||
|
boxedLayout = 'boxed-layout';
|
||||||
|
} else {
|
||||||
|
$('body').removeClass('boxed-layout');
|
||||||
|
}
|
||||||
|
writeStorage(storage, 'config-boxed-layout', boxedLayout);
|
||||||
|
});
|
||||||
|
$('#config-fixed-sidebar').on('change',
|
||||||
|
function() {
|
||||||
|
var fixedSidebar = '';
|
||||||
|
if ($(this).is(':checked')) {
|
||||||
|
if (!$('#config-fixed-header').is(':checked')) {
|
||||||
|
$('#config-fixed-header').prop('checked', true);
|
||||||
|
$('#config-fixed-header').trigger('change');
|
||||||
|
}
|
||||||
|
if ($('#page-wrapper').hasClass('nav-small')) {
|
||||||
|
$('#page-wrapper').removeClass('nav-small');
|
||||||
|
}
|
||||||
|
$('body').addClass('fixed-leftmenu');
|
||||||
|
fixedSidebar = 'fixed-leftmenu';
|
||||||
|
$('.fixed-leftmenu #col-left').nanoScroller({
|
||||||
|
alwaysVisible: true,
|
||||||
|
iOSNativeScrolling: false,
|
||||||
|
preventPageScrolling: true,
|
||||||
|
contentClass: 'col-left-nano-content'
|
||||||
|
});
|
||||||
|
writeStorage(storage, 'config-fixed-leftmenu', fixedSidebar);
|
||||||
|
} else {
|
||||||
|
$('body').removeClass('fixed-leftmenu');
|
||||||
|
writeStorage(storage, 'config-fixed-leftmenu', fixedSidebar);
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#config-sidebar-samll').on('change',function(){
|
||||||
|
var sidebarSamll = '';
|
||||||
|
if ($(this).is(':checked')) {
|
||||||
|
$('#page-wrapper').addClass('nav-small');
|
||||||
|
sidebarSamll = 'sidebar-samll';
|
||||||
|
writeStorage(storage, 'config-sidebar-samll', sidebarSamll);
|
||||||
|
} else {
|
||||||
|
$('#page-wrapper').removeClass('nav-small');
|
||||||
|
writeStorage(storage, 'config-sidebar-samll', sidebarSamll);
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (!storage) {
|
||||||
|
$('#config-fixed-header').prop('checked', false);
|
||||||
|
$('#config-fixed-footer').prop('checked', false);
|
||||||
|
$('#config-fixed-sidebar').prop('checked', false);
|
||||||
|
$('#config-boxed-layout').prop('checked', false);
|
||||||
|
$('#config-sidebar-samll').prop('checked', false);
|
||||||
|
}
|
||||||
|
$('#skin-colors .skin-changer').on('click',
|
||||||
|
function() {
|
||||||
|
$('body').removeClassPrefix('theme-');
|
||||||
|
$('body').addClass($(this).data('skin'));
|
||||||
|
$('#skin-colors .skin-changer').removeClass('active');
|
||||||
|
$(this).addClass('active');
|
||||||
|
writeStorage(storage, 'config-skin', $(this).data('skin'));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//合并自script.js
|
||||||
|
setTimeout(function() {
|
||||||
|
$('#content-wrapper > .row').css({
|
||||||
|
opacity: 1
|
||||||
|
});
|
||||||
|
},
|
||||||
|
200);
|
||||||
|
$('#sidebar-nav,#nav-col-submenu').on('click', '.dropdown-toggle',
|
||||||
|
function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var $item = $(this).parent();
|
||||||
|
if (!$item.hasClass('open')) {
|
||||||
|
$item.parent().find('.open .submenu').slideUp('fast');
|
||||||
|
$item.parent().find('.open').toggleClass('open');
|
||||||
|
}
|
||||||
|
$item.toggleClass('open');
|
||||||
|
if ($item.hasClass('open')) {
|
||||||
|
$item.children('.submenu').slideDown('fast');
|
||||||
|
} else {
|
||||||
|
$item.children('.submenu').slideUp('fast');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('body').on('mouseenter', '#page-wrapper.nav-small #sidebar-nav .dropdown-toggle',
|
||||||
|
function(e) {
|
||||||
|
if ($(document).width() >= 992) {
|
||||||
|
var $item = $(this).parent();
|
||||||
|
if ($('body').hasClass('fixed-leftmenu')) {
|
||||||
|
var topPosition = $item.position().top;
|
||||||
|
if ((topPosition + 4 * $(this).outerHeight()) >= $(window).height()) {
|
||||||
|
topPosition -= 6 * $(this).outerHeight();
|
||||||
|
}
|
||||||
|
$('#nav-col-submenu').html($item.children('.submenu').clone());
|
||||||
|
$('#nav-col-submenu > .submenu').css({
|
||||||
|
'top': topPosition
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$item.addClass('open');
|
||||||
|
$item.children('.submenu').slideDown('fast');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('body').on('mouseleave', '#page-wrapper.nav-small #sidebar-nav > .nav-pills > li',
|
||||||
|
function(e) {
|
||||||
|
if ($(document).width() >= 992) {
|
||||||
|
var $item = $(this);
|
||||||
|
if ($item.hasClass('open')) {
|
||||||
|
$item.find('.open .submenu').slideUp('fast');
|
||||||
|
$item.find('.open').removeClass('open');
|
||||||
|
$item.children('.submenu').slideUp('fast');
|
||||||
|
}
|
||||||
|
$item.removeClass('open');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('body').on('mouseenter', '#page-wrapper.nav-small #sidebar-nav a:not(.dropdown-toggle)',
|
||||||
|
function(e) {
|
||||||
|
if ($('body').hasClass('fixed-leftmenu')) {
|
||||||
|
$('#nav-col-submenu').html('');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('body').on('mouseleave', '#page-wrapper.nav-small #nav-col',
|
||||||
|
function(e) {
|
||||||
|
if ($('body').hasClass('fixed-leftmenu')) {
|
||||||
|
$('#nav-col-submenu').html('');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#make-small-nav').click(function(e) {
|
||||||
|
$('#page-wrapper').toggleClass('nav-small');
|
||||||
|
});
|
||||||
|
$(window).smartresize(function() {
|
||||||
|
if ($(document).width() <= 991) {
|
||||||
|
$('#page-wrapper').removeClass('nav-small');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('.mobile-search').click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$('.mobile-search').addClass('active');
|
||||||
|
$('.mobile-search form input.form-control').focus();
|
||||||
|
});
|
||||||
|
$(document).mouseup(function(e) {
|
||||||
|
var container = $('.mobile-search');
|
||||||
|
if (!container.is(e.target) && container.has(e.target).length === 0) {
|
||||||
|
container.removeClass('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('.fixed-leftmenu #col-left').nanoScroller({
|
||||||
|
alwaysVisible: true,
|
||||||
|
iOSNativeScrolling: false,
|
||||||
|
preventPageScrolling: true,
|
||||||
|
contentClass: 'col-left-nano-content'
|
||||||
|
});
|
||||||
|
$("[data-toggle='tooltip']").each(function(index, el) {
|
||||||
|
$(el).tooltip({
|
||||||
|
placement: $(this).data("placement") || 'top'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
function writeStorage(storage, key, value) {
|
||||||
|
if (storage) {
|
||||||
|
try {
|
||||||
|
localStorage.setItem(key, value);
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$.fn.removeClassPrefix = function(prefix) {
|
||||||
|
this.each(function(i, el) {
|
||||||
|
var classes = el.className.split(" ").filter(function(c) {
|
||||||
|
return c.lastIndexOf(prefix, 0) !== 0;
|
||||||
|
});
|
||||||
|
el.className = classes.join(" ");
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}; (function($, sr) {
|
||||||
|
var debounce = function(func, threshold, execAsap) {
|
||||||
|
var timeout;
|
||||||
|
return function debounced() {
|
||||||
|
var obj = this,
|
||||||
|
args = arguments;
|
||||||
|
function delayed() {
|
||||||
|
if (!execAsap) func.apply(obj, args);
|
||||||
|
timeout = null;
|
||||||
|
};
|
||||||
|
if (timeout) clearTimeout(timeout);
|
||||||
|
else if (execAsap) func.apply(obj, args);
|
||||||
|
timeout = setTimeout(delayed, threshold || 100);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
jQuery.fn[sr] = function(fn) {
|
||||||
|
return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr);
|
||||||
|
};
|
||||||
|
})(jQuery, 'smartresize');
|
||||||
|
|
||||||
|
function helpIntro(){
|
||||||
|
var placementRight = 'right';
|
||||||
|
var placementLeft = 'left';
|
||||||
|
|
||||||
|
if ($('body').hasClass('rtl')) {
|
||||||
|
placementRight = 'left';
|
||||||
|
placementLeft = 'right';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define the tour!
|
||||||
|
var tour = {
|
||||||
|
id: "Cube-intro",
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
target: 'make-small-nav',
|
||||||
|
title: "设置小菜单按钮",
|
||||||
|
content: "点击小菜单可以把左侧菜单变成小菜单,增大右侧操作区域!",
|
||||||
|
placement: "bottom",
|
||||||
|
zindex: 999,
|
||||||
|
xOffset: -8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
target: 'config-tool-options',
|
||||||
|
title: "后台配置工具",
|
||||||
|
content: "配置后台主题色彩,定制头部、左侧菜单以及底部信息",
|
||||||
|
placement: placementLeft,
|
||||||
|
zindex: 999,
|
||||||
|
fixedElement: true,
|
||||||
|
xOffset: -55
|
||||||
|
},
|
||||||
|
{
|
||||||
|
target: 'sidebar-nav',
|
||||||
|
title: "左侧导航区域",
|
||||||
|
content: "左侧功能导航区域。",
|
||||||
|
placement: placementRight
|
||||||
|
}
|
||||||
|
],
|
||||||
|
showPrevButton: true
|
||||||
|
};
|
||||||
|
|
||||||
|
// Start the tour!
|
||||||
|
hopscotch.startTour(tour);
|
||||||
|
}
|
||||||
@@ -0,0 +1,362 @@
|
|||||||
|
CodeMirror.defineMode("clike", function(config, parserConfig) {
|
||||||
|
var indentUnit = config.indentUnit,
|
||||||
|
statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
|
||||||
|
dontAlignCalls = parserConfig.dontAlignCalls,
|
||||||
|
keywords = parserConfig.keywords || {},
|
||||||
|
builtin = parserConfig.builtin || {},
|
||||||
|
blockKeywords = parserConfig.blockKeywords || {},
|
||||||
|
atoms = parserConfig.atoms || {},
|
||||||
|
hooks = parserConfig.hooks || {},
|
||||||
|
multiLineStrings = parserConfig.multiLineStrings;
|
||||||
|
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
|
||||||
|
|
||||||
|
var curPunc;
|
||||||
|
|
||||||
|
function tokenBase(stream, state) {
|
||||||
|
var ch = stream.next();
|
||||||
|
if (hooks[ch]) {
|
||||||
|
var result = hooks[ch](stream, state);
|
||||||
|
if (result !== false) return result;
|
||||||
|
}
|
||||||
|
if (ch == '"' || ch == "'") {
|
||||||
|
state.tokenize = tokenString(ch);
|
||||||
|
return state.tokenize(stream, state);
|
||||||
|
}
|
||||||
|
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
||||||
|
curPunc = ch;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (/\d/.test(ch)) {
|
||||||
|
stream.eatWhile(/[\w\.]/);
|
||||||
|
return "number";
|
||||||
|
}
|
||||||
|
if (ch == "/") {
|
||||||
|
if (stream.eat("*")) {
|
||||||
|
state.tokenize = tokenComment;
|
||||||
|
return tokenComment(stream, state);
|
||||||
|
}
|
||||||
|
if (stream.eat("/")) {
|
||||||
|
stream.skipToEnd();
|
||||||
|
return "comment";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isOperatorChar.test(ch)) {
|
||||||
|
stream.eatWhile(isOperatorChar);
|
||||||
|
return "operator";
|
||||||
|
}
|
||||||
|
stream.eatWhile(/[\w\$_]/);
|
||||||
|
var cur = stream.current();
|
||||||
|
if (keywords.propertyIsEnumerable(cur)) {
|
||||||
|
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
||||||
|
return "keyword";
|
||||||
|
}
|
||||||
|
if (builtin.propertyIsEnumerable(cur)) {
|
||||||
|
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
||||||
|
return "builtin";
|
||||||
|
}
|
||||||
|
if (atoms.propertyIsEnumerable(cur)) return "atom";
|
||||||
|
return "variable";
|
||||||
|
}
|
||||||
|
|
||||||
|
function tokenString(quote) {
|
||||||
|
return function(stream, state) {
|
||||||
|
var escaped = false, next, end = false;
|
||||||
|
while ((next = stream.next()) != null) {
|
||||||
|
if (next == quote && !escaped) {end = true; break;}
|
||||||
|
escaped = !escaped && next == "\\";
|
||||||
|
}
|
||||||
|
if (end || !(escaped || multiLineStrings))
|
||||||
|
state.tokenize = null;
|
||||||
|
return "string";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function tokenComment(stream, state) {
|
||||||
|
var maybeEnd = false, ch;
|
||||||
|
while (ch = stream.next()) {
|
||||||
|
if (ch == "/" && maybeEnd) {
|
||||||
|
state.tokenize = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
maybeEnd = (ch == "*");
|
||||||
|
}
|
||||||
|
return "comment";
|
||||||
|
}
|
||||||
|
|
||||||
|
function Context(indented, column, type, align, prev) {
|
||||||
|
this.indented = indented;
|
||||||
|
this.column = column;
|
||||||
|
this.type = type;
|
||||||
|
this.align = align;
|
||||||
|
this.prev = prev;
|
||||||
|
}
|
||||||
|
function pushContext(state, col, type) {
|
||||||
|
var indent = state.indented;
|
||||||
|
if (state.context && state.context.type == "statement")
|
||||||
|
indent = state.context.indented;
|
||||||
|
return state.context = new Context(indent, col, type, null, state.context);
|
||||||
|
}
|
||||||
|
function popContext(state) {
|
||||||
|
var t = state.context.type;
|
||||||
|
if (t == ")" || t == "]" || t == "}")
|
||||||
|
state.indented = state.context.indented;
|
||||||
|
return state.context = state.context.prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interface
|
||||||
|
|
||||||
|
return {
|
||||||
|
startState: function(basecolumn) {
|
||||||
|
return {
|
||||||
|
tokenize: null,
|
||||||
|
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
||||||
|
indented: 0,
|
||||||
|
startOfLine: true
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
token: function(stream, state) {
|
||||||
|
var ctx = state.context;
|
||||||
|
if (stream.sol()) {
|
||||||
|
if (ctx.align == null) ctx.align = false;
|
||||||
|
state.indented = stream.indentation();
|
||||||
|
state.startOfLine = true;
|
||||||
|
}
|
||||||
|
if (stream.eatSpace()) return null;
|
||||||
|
curPunc = null;
|
||||||
|
var style = (state.tokenize || tokenBase)(stream, state);
|
||||||
|
if (style == "comment" || style == "meta") return style;
|
||||||
|
if (ctx.align == null) ctx.align = true;
|
||||||
|
|
||||||
|
if ((curPunc == ";" || curPunc == ":" || curPunc == ",") && ctx.type == "statement") popContext(state);
|
||||||
|
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
||||||
|
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
||||||
|
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
||||||
|
else if (curPunc == "}") {
|
||||||
|
while (ctx.type == "statement") ctx = popContext(state);
|
||||||
|
if (ctx.type == "}") ctx = popContext(state);
|
||||||
|
while (ctx.type == "statement") ctx = popContext(state);
|
||||||
|
}
|
||||||
|
else if (curPunc == ctx.type) popContext(state);
|
||||||
|
else if (((ctx.type == "}" || ctx.type == "top") && curPunc != ';') || (ctx.type == "statement" && curPunc == "newstatement"))
|
||||||
|
pushContext(state, stream.column(), "statement");
|
||||||
|
state.startOfLine = false;
|
||||||
|
return style;
|
||||||
|
},
|
||||||
|
|
||||||
|
indent: function(state, textAfter) {
|
||||||
|
if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
|
||||||
|
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
|
||||||
|
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
|
||||||
|
var closing = firstChar == ctx.type;
|
||||||
|
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
|
||||||
|
else if (ctx.align && (!dontAlignCalls || ctx.type != ")")) return ctx.column + (closing ? 0 : 1);
|
||||||
|
else if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit;
|
||||||
|
else return ctx.indented + (closing ? 0 : indentUnit);
|
||||||
|
},
|
||||||
|
|
||||||
|
electricChars: "{}",
|
||||||
|
blockCommentStart: "/*",
|
||||||
|
blockCommentEnd: "*/",
|
||||||
|
lineComment: "//",
|
||||||
|
fold: "brace"
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
function words(str) {
|
||||||
|
var obj = {}, words = str.split(" ");
|
||||||
|
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
var cKeywords = "auto if break int case long char register continue return default short do sizeof " +
|
||||||
|
"double static else struct entry switch extern typedef float union for unsigned " +
|
||||||
|
"goto while enum void const signed volatile";
|
||||||
|
|
||||||
|
function cppHook(stream, state) {
|
||||||
|
if (!state.startOfLine) return false;
|
||||||
|
for (;;) {
|
||||||
|
if (stream.skipTo("\\")) {
|
||||||
|
stream.next();
|
||||||
|
if (stream.eol()) {
|
||||||
|
state.tokenize = cppHook;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stream.skipToEnd();
|
||||||
|
state.tokenize = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "meta";
|
||||||
|
}
|
||||||
|
|
||||||
|
// C#-style strings where "" escapes a quote.
|
||||||
|
function tokenAtString(stream, state) {
|
||||||
|
var next;
|
||||||
|
while ((next = stream.next()) != null) {
|
||||||
|
if (next == '"' && !stream.eat('"')) {
|
||||||
|
state.tokenize = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "string";
|
||||||
|
}
|
||||||
|
|
||||||
|
function mimes(ms, mode) {
|
||||||
|
for (var i = 0; i < ms.length; ++i) CodeMirror.defineMIME(ms[i], mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
mimes(["text/x-csrc", "text/x-c", "text/x-chdr"], {
|
||||||
|
name: "clike",
|
||||||
|
keywords: words(cKeywords),
|
||||||
|
blockKeywords: words("case do else for if switch while struct"),
|
||||||
|
atoms: words("null"),
|
||||||
|
hooks: {"#": cppHook}
|
||||||
|
});
|
||||||
|
mimes(["text/x-c++src", "text/x-c++hdr"], {
|
||||||
|
name: "clike",
|
||||||
|
keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " +
|
||||||
|
"static_cast typeid catch operator template typename class friend private " +
|
||||||
|
"this using const_cast inline public throw virtual delete mutable protected " +
|
||||||
|
"wchar_t"),
|
||||||
|
blockKeywords: words("catch class do else finally for if struct switch try while"),
|
||||||
|
atoms: words("true false null"),
|
||||||
|
hooks: {"#": cppHook}
|
||||||
|
});
|
||||||
|
CodeMirror.defineMIME("text/x-java", {
|
||||||
|
name: "clike",
|
||||||
|
keywords: words("abstract assert boolean break byte case catch char class const continue default " +
|
||||||
|
"do double else enum extends final finally float for goto if implements import " +
|
||||||
|
"instanceof int interface long native new package private protected public " +
|
||||||
|
"return short static strictfp super switch synchronized this throw throws transient " +
|
||||||
|
"try void volatile while"),
|
||||||
|
blockKeywords: words("catch class do else finally for if switch try while"),
|
||||||
|
atoms: words("true false null"),
|
||||||
|
hooks: {
|
||||||
|
"@": function(stream) {
|
||||||
|
stream.eatWhile(/[\w\$_]/);
|
||||||
|
return "meta";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
CodeMirror.defineMIME("text/x-csharp", {
|
||||||
|
name: "clike",
|
||||||
|
keywords: words("abstract as base break case catch checked class const continue" +
|
||||||
|
" default delegate do else enum event explicit extern finally fixed for" +
|
||||||
|
" foreach goto if implicit in interface internal is lock namespace new" +
|
||||||
|
" operator out override params private protected public readonly ref return sealed" +
|
||||||
|
" sizeof stackalloc static struct switch this throw try typeof unchecked" +
|
||||||
|
" unsafe using virtual void volatile while add alias ascending descending dynamic from get" +
|
||||||
|
" global group into join let orderby partial remove select set value var yield"),
|
||||||
|
blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
|
||||||
|
builtin: words("Boolean Byte Char DateTime DateTimeOffset Decimal Double" +
|
||||||
|
" Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32" +
|
||||||
|
" UInt64 bool byte char decimal double short int long object" +
|
||||||
|
" sbyte float string ushort uint ulong"),
|
||||||
|
atoms: words("true false null"),
|
||||||
|
hooks: {
|
||||||
|
"@": function(stream, state) {
|
||||||
|
if (stream.eat('"')) {
|
||||||
|
state.tokenize = tokenAtString;
|
||||||
|
return tokenAtString(stream, state);
|
||||||
|
}
|
||||||
|
stream.eatWhile(/[\w\$_]/);
|
||||||
|
return "meta";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
CodeMirror.defineMIME("text/x-scala", {
|
||||||
|
name: "clike",
|
||||||
|
keywords: words(
|
||||||
|
|
||||||
|
/* scala */
|
||||||
|
"abstract case catch class def do else extends false final finally for forSome if " +
|
||||||
|
"implicit import lazy match new null object override package private protected return " +
|
||||||
|
"sealed super this throw trait try trye type val var while with yield _ : = => <- <: " +
|
||||||
|
"<% >: # @ " +
|
||||||
|
|
||||||
|
/* package scala */
|
||||||
|
"assert assume require print println printf readLine readBoolean readByte readShort " +
|
||||||
|
"readChar readInt readLong readFloat readDouble " +
|
||||||
|
|
||||||
|
"AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
|
||||||
|
"Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable " +
|
||||||
|
"Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " +
|
||||||
|
"Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " +
|
||||||
|
"StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector :: #:: " +
|
||||||
|
|
||||||
|
/* package java.lang */
|
||||||
|
"Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
|
||||||
|
"Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
|
||||||
|
"Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
|
||||||
|
"StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
|
||||||
|
|
||||||
|
|
||||||
|
),
|
||||||
|
blockKeywords: words("catch class do else finally for forSome if match switch try while"),
|
||||||
|
atoms: words("true false null"),
|
||||||
|
hooks: {
|
||||||
|
"@": function(stream) {
|
||||||
|
stream.eatWhile(/[\w\$_]/);
|
||||||
|
return "meta";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mimes(["x-shader/x-vertex", "x-shader/x-fragment"], {
|
||||||
|
name: "clike",
|
||||||
|
keywords: words("float int bool void " +
|
||||||
|
"vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 " +
|
||||||
|
"mat2 mat3 mat4 " +
|
||||||
|
"sampler1D sampler2D sampler3D samplerCube " +
|
||||||
|
"sampler1DShadow sampler2DShadow" +
|
||||||
|
"const attribute uniform varying " +
|
||||||
|
"break continue discard return " +
|
||||||
|
"for while do if else struct " +
|
||||||
|
"in out inout"),
|
||||||
|
blockKeywords: words("for while do if else struct"),
|
||||||
|
builtin: words("radians degrees sin cos tan asin acos atan " +
|
||||||
|
"pow exp log exp2 sqrt inversesqrt " +
|
||||||
|
"abs sign floor ceil fract mod min max clamp mix step smootstep " +
|
||||||
|
"length distance dot cross normalize ftransform faceforward " +
|
||||||
|
"reflect refract matrixCompMult " +
|
||||||
|
"lessThan lessThanEqual greaterThan greaterThanEqual " +
|
||||||
|
"equal notEqual any all not " +
|
||||||
|
"texture1D texture1DProj texture1DLod texture1DProjLod " +
|
||||||
|
"texture2D texture2DProj texture2DLod texture2DProjLod " +
|
||||||
|
"texture3D texture3DProj texture3DLod texture3DProjLod " +
|
||||||
|
"textureCube textureCubeLod " +
|
||||||
|
"shadow1D shadow2D shadow1DProj shadow2DProj " +
|
||||||
|
"shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod " +
|
||||||
|
"dFdx dFdy fwidth " +
|
||||||
|
"noise1 noise2 noise3 noise4"),
|
||||||
|
atoms: words("true false " +
|
||||||
|
"gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex " +
|
||||||
|
"gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 " +
|
||||||
|
"gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 " +
|
||||||
|
"gl_FogCoord " +
|
||||||
|
"gl_Position gl_PointSize gl_ClipVertex " +
|
||||||
|
"gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor " +
|
||||||
|
"gl_TexCoord gl_FogFragCoord " +
|
||||||
|
"gl_FragCoord gl_FrontFacing " +
|
||||||
|
"gl_FragColor gl_FragData gl_FragDepth " +
|
||||||
|
"gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix " +
|
||||||
|
"gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse " +
|
||||||
|
"gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse " +
|
||||||
|
"gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose " +
|
||||||
|
"gl_ProjectionMatrixInverseTranspose " +
|
||||||
|
"gl_ModelViewProjectionMatrixInverseTranspose " +
|
||||||
|
"gl_TextureMatrixInverseTranspose " +
|
||||||
|
"gl_NormalScale gl_DepthRange gl_ClipPlane " +
|
||||||
|
"gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel " +
|
||||||
|
"gl_FrontLightModelProduct gl_BackLightModelProduct " +
|
||||||
|
"gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ " +
|
||||||
|
"gl_FogParameters " +
|
||||||
|
"gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords " +
|
||||||
|
"gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats " +
|
||||||
|
"gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits " +
|
||||||
|
"gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits " +
|
||||||
|
"gl_MaxDrawBuffers"),
|
||||||
|
hooks: {"#": cppHook}
|
||||||
|
});
|
||||||
|
}());
|
||||||
@@ -0,0 +1,259 @@
|
|||||||
|
/* BASICS */
|
||||||
|
|
||||||
|
.CodeMirror {
|
||||||
|
/* Set height, width, borders, and global font properties here */
|
||||||
|
font-family: monospace;
|
||||||
|
height: 300px;
|
||||||
|
}
|
||||||
|
.CodeMirror-scroll {
|
||||||
|
/* Set scrolling behaviour here */
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PADDING */
|
||||||
|
|
||||||
|
.CodeMirror-lines {
|
||||||
|
padding: 4px 0; /* Vertical padding around content */
|
||||||
|
}
|
||||||
|
.CodeMirror pre {
|
||||||
|
padding: 0 4px; /* Horizontal padding of content */
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||||
|
background-color: white; /* The little square between H and V scrollbars */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GUTTER */
|
||||||
|
|
||||||
|
.CodeMirror-gutters {
|
||||||
|
border-right: 1px solid #ddd;
|
||||||
|
background-color: #f7f7f7;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.CodeMirror-linenumbers {}
|
||||||
|
.CodeMirror-linenumber {
|
||||||
|
padding: 0 3px 0 5px;
|
||||||
|
min-width: 20px;
|
||||||
|
text-align: right;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CURSOR */
|
||||||
|
|
||||||
|
.CodeMirror div.CodeMirror-cursor {
|
||||||
|
border-left: 1px solid black;
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
|
/* Shown when moving in bi-directional text */
|
||||||
|
.CodeMirror div.CodeMirror-secondarycursor {
|
||||||
|
border-left: 1px solid silver;
|
||||||
|
}
|
||||||
|
.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
|
||||||
|
width: auto;
|
||||||
|
border: 0;
|
||||||
|
background: #7e7;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
/* Can style cursor different in overwrite (non-insert) mode */
|
||||||
|
.CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {}
|
||||||
|
|
||||||
|
.cm-tab { display: inline-block; }
|
||||||
|
|
||||||
|
/* DEFAULT THEME */
|
||||||
|
|
||||||
|
.cm-s-default .cm-keyword {color: #708;}
|
||||||
|
.cm-s-default .cm-atom {color: #219;}
|
||||||
|
.cm-s-default .cm-number {color: #164;}
|
||||||
|
.cm-s-default .cm-def {color: #00f;}
|
||||||
|
.cm-s-default .cm-variable {color: black;}
|
||||||
|
.cm-s-default .cm-variable-2 {color: #05a;}
|
||||||
|
.cm-s-default .cm-variable-3 {color: #085;}
|
||||||
|
.cm-s-default .cm-property {color: black;}
|
||||||
|
.cm-s-default .cm-operator {color: black;}
|
||||||
|
.cm-s-default .cm-comment {color: #a50;}
|
||||||
|
.cm-s-default .cm-string {color: #a11;}
|
||||||
|
.cm-s-default .cm-string-2 {color: #f50;}
|
||||||
|
.cm-s-default .cm-meta {color: #555;}
|
||||||
|
.cm-s-default .cm-error {color: #f00;}
|
||||||
|
.cm-s-default .cm-qualifier {color: #555;}
|
||||||
|
.cm-s-default .cm-builtin {color: #30a;}
|
||||||
|
.cm-s-default .cm-bracket {color: #997;}
|
||||||
|
.cm-s-default .cm-tag {color: #170;}
|
||||||
|
.cm-s-default .cm-attribute {color: #00c;}
|
||||||
|
.cm-s-default .cm-header {color: blue;}
|
||||||
|
.cm-s-default .cm-quote {color: #090;}
|
||||||
|
.cm-s-default .cm-hr {color: #999;}
|
||||||
|
.cm-s-default .cm-link {color: #00c;}
|
||||||
|
|
||||||
|
.cm-negative {color: #d44;}
|
||||||
|
.cm-positive {color: #292;}
|
||||||
|
.cm-header, .cm-strong {font-weight: bold;}
|
||||||
|
.cm-em {font-style: italic;}
|
||||||
|
.cm-link {text-decoration: underline;}
|
||||||
|
|
||||||
|
.cm-invalidchar {color: #f00;}
|
||||||
|
|
||||||
|
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
||||||
|
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
||||||
|
.CodeMirror-activeline-background {background: #e8f2ff;}
|
||||||
|
|
||||||
|
/* STOP */
|
||||||
|
|
||||||
|
/* The rest of this file contains styles related to the mechanics of
|
||||||
|
the editor. You probably shouldn't touch them. */
|
||||||
|
|
||||||
|
.CodeMirror {
|
||||||
|
line-height: 1;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
background: white;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-scroll {
|
||||||
|
/* 30px is the magic margin used to hide the element's real scrollbars */
|
||||||
|
/* See overflow: hidden in .CodeMirror */
|
||||||
|
margin-bottom: -30px; margin-right: -30px;
|
||||||
|
padding-bottom: 30px; padding-right: 30px;
|
||||||
|
height: 100%;
|
||||||
|
outline: none; /* Prevent dragging from highlighting the element */
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.CodeMirror-sizer {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
||||||
|
before actuall scrolling happens, thus preventing shaking and
|
||||||
|
flickering artifacts. */
|
||||||
|
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 6;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.CodeMirror-vscrollbar {
|
||||||
|
right: 0; top: 0;
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
.CodeMirror-hscrollbar {
|
||||||
|
bottom: 0; left: 0;
|
||||||
|
overflow-y: hidden;
|
||||||
|
overflow-x: scroll;
|
||||||
|
}
|
||||||
|
.CodeMirror-scrollbar-filler {
|
||||||
|
right: 0; bottom: 0;
|
||||||
|
}
|
||||||
|
.CodeMirror-gutter-filler {
|
||||||
|
left: 0; bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-gutters {
|
||||||
|
position: absolute; left: 0; top: 0;
|
||||||
|
padding-bottom: 30px;
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
|
.CodeMirror-gutter {
|
||||||
|
white-space: normal;
|
||||||
|
height: 100%;
|
||||||
|
padding-bottom: 30px;
|
||||||
|
margin-bottom: -32px;
|
||||||
|
display: inline-block;
|
||||||
|
/* Hack to make IE7 behave */
|
||||||
|
*zoom:1;
|
||||||
|
*display:inline;
|
||||||
|
}
|
||||||
|
.CodeMirror-gutter-elt {
|
||||||
|
position: absolute;
|
||||||
|
cursor: default;
|
||||||
|
z-index: 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-lines {
|
||||||
|
cursor: text;
|
||||||
|
}
|
||||||
|
.CodeMirror pre {
|
||||||
|
/* Reset some styles that the rest of the page might have set */
|
||||||
|
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
|
||||||
|
border-width: 0;
|
||||||
|
background: transparent;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
margin: 0;
|
||||||
|
white-space: pre;
|
||||||
|
word-wrap: normal;
|
||||||
|
line-height: inherit;
|
||||||
|
color: inherit;
|
||||||
|
z-index: 2;
|
||||||
|
position: relative;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
.CodeMirror-wrap pre {
|
||||||
|
word-wrap: break-word;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: normal;
|
||||||
|
}
|
||||||
|
.CodeMirror-code pre {
|
||||||
|
border-right: 30px solid transparent;
|
||||||
|
width: -webkit-fit-content;
|
||||||
|
width: -moz-fit-content;
|
||||||
|
width: fit-content;
|
||||||
|
}
|
||||||
|
.CodeMirror-wrap .CodeMirror-code pre {
|
||||||
|
border-right: none;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
.CodeMirror-linebackground {
|
||||||
|
position: absolute;
|
||||||
|
left: 0; right: 0; top: 0; bottom: 0;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-linewidget {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-widget {
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-wrap .CodeMirror-scroll {
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-measure {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%; height: 0px;
|
||||||
|
overflow: hidden;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
.CodeMirror-measure pre { position: static; }
|
||||||
|
|
||||||
|
.CodeMirror div.CodeMirror-cursor {
|
||||||
|
position: absolute;
|
||||||
|
visibility: hidden;
|
||||||
|
border-right: none;
|
||||||
|
width: 0;
|
||||||
|
}
|
||||||
|
.CodeMirror-focused div.CodeMirror-cursor {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-selected { background: #d9d9d9; }
|
||||||
|
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
|
||||||
|
|
||||||
|
.cm-searching {
|
||||||
|
background: #ffa;
|
||||||
|
background: rgba(255, 255, 0, .4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* IE7 hack to prevent it from returning funny offsetTops on the spans */
|
||||||
|
.CodeMirror span { *vertical-align: text-bottom; }
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
/* Hide the cursor when printing */
|
||||||
|
.CodeMirror div.CodeMirror-cursor {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,480 @@
|
|||||||
|
// TODO actually recognize syntax of TypeScript constructs
|
||||||
|
|
||||||
|
CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
|
var indentUnit = config.indentUnit;
|
||||||
|
var statementIndent = parserConfig.statementIndent;
|
||||||
|
var jsonMode = parserConfig.json;
|
||||||
|
var isTS = parserConfig.typescript;
|
||||||
|
|
||||||
|
// Tokenizer
|
||||||
|
|
||||||
|
var keywords = function(){
|
||||||
|
function kw(type) {return {type: type, style: "keyword"};}
|
||||||
|
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
|
||||||
|
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
||||||
|
|
||||||
|
var jsKeywords = {
|
||||||
|
"if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
||||||
|
"return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
|
||||||
|
"var": kw("var"), "const": kw("var"), "let": kw("var"),
|
||||||
|
"function": kw("function"), "catch": kw("catch"),
|
||||||
|
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
||||||
|
"in": operator, "typeof": operator, "instanceof": operator,
|
||||||
|
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
|
||||||
|
"this": kw("this")
|
||||||
|
};
|
||||||
|
|
||||||
|
// Extend the 'normal' keywords with the TypeScript language extensions
|
||||||
|
if (isTS) {
|
||||||
|
var type = {type: "variable", style: "variable-3"};
|
||||||
|
var tsKeywords = {
|
||||||
|
// object-like things
|
||||||
|
"interface": kw("interface"),
|
||||||
|
"class": kw("class"),
|
||||||
|
"extends": kw("extends"),
|
||||||
|
"constructor": kw("constructor"),
|
||||||
|
|
||||||
|
// scope modifiers
|
||||||
|
"public": kw("public"),
|
||||||
|
"private": kw("private"),
|
||||||
|
"protected": kw("protected"),
|
||||||
|
"static": kw("static"),
|
||||||
|
|
||||||
|
"super": kw("super"),
|
||||||
|
|
||||||
|
// types
|
||||||
|
"string": type, "number": type, "bool": type, "any": type
|
||||||
|
};
|
||||||
|
|
||||||
|
for (var attr in tsKeywords) {
|
||||||
|
jsKeywords[attr] = tsKeywords[attr];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return jsKeywords;
|
||||||
|
}();
|
||||||
|
|
||||||
|
var isOperatorChar = /[+\-*&%=<>!?|~^]/;
|
||||||
|
|
||||||
|
function chain(stream, state, f) {
|
||||||
|
state.tokenize = f;
|
||||||
|
return f(stream, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
function nextUntilUnescaped(stream, end) {
|
||||||
|
var escaped = false, next;
|
||||||
|
while ((next = stream.next()) != null) {
|
||||||
|
if (next == end && !escaped)
|
||||||
|
return false;
|
||||||
|
escaped = !escaped && next == "\\";
|
||||||
|
}
|
||||||
|
return escaped;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used as scratch variables to communicate multiple values without
|
||||||
|
// consing up tons of objects.
|
||||||
|
var type, content;
|
||||||
|
function ret(tp, style, cont) {
|
||||||
|
type = tp; content = cont;
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
function jsTokenBase(stream, state) {
|
||||||
|
var ch = stream.next();
|
||||||
|
if (ch == '"' || ch == "'")
|
||||||
|
return chain(stream, state, jsTokenString(ch));
|
||||||
|
else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/))
|
||||||
|
return ret("number", "number");
|
||||||
|
else if (/[\[\]{}\(\),;\:\.]/.test(ch))
|
||||||
|
return ret(ch);
|
||||||
|
else if (ch == "0" && stream.eat(/x/i)) {
|
||||||
|
stream.eatWhile(/[\da-f]/i);
|
||||||
|
return ret("number", "number");
|
||||||
|
}
|
||||||
|
else if (/\d/.test(ch)) {
|
||||||
|
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
||||||
|
return ret("number", "number");
|
||||||
|
}
|
||||||
|
else if (ch == "/") {
|
||||||
|
if (stream.eat("*")) {
|
||||||
|
return chain(stream, state, jsTokenComment);
|
||||||
|
}
|
||||||
|
else if (stream.eat("/")) {
|
||||||
|
stream.skipToEnd();
|
||||||
|
return ret("comment", "comment");
|
||||||
|
}
|
||||||
|
else if (state.lastType == "operator" || state.lastType == "keyword c" ||
|
||||||
|
/^[\[{}\(,;:]$/.test(state.lastType)) {
|
||||||
|
nextUntilUnescaped(stream, "/");
|
||||||
|
stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
|
||||||
|
return ret("regexp", "string-2");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stream.eatWhile(isOperatorChar);
|
||||||
|
return ret("operator", null, stream.current());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ch == "#") {
|
||||||
|
stream.skipToEnd();
|
||||||
|
return ret("error", "error");
|
||||||
|
}
|
||||||
|
else if (isOperatorChar.test(ch)) {
|
||||||
|
stream.eatWhile(isOperatorChar);
|
||||||
|
return ret("operator", null, stream.current());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stream.eatWhile(/[\w\$_]/);
|
||||||
|
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
|
||||||
|
return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
|
||||||
|
ret("variable", "variable", word);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function jsTokenString(quote) {
|
||||||
|
return function(stream, state) {
|
||||||
|
if (!nextUntilUnescaped(stream, quote))
|
||||||
|
state.tokenize = jsTokenBase;
|
||||||
|
return ret("string", "string");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function jsTokenComment(stream, state) {
|
||||||
|
var maybeEnd = false, ch;
|
||||||
|
while (ch = stream.next()) {
|
||||||
|
if (ch == "/" && maybeEnd) {
|
||||||
|
state.tokenize = jsTokenBase;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
maybeEnd = (ch == "*");
|
||||||
|
}
|
||||||
|
return ret("comment", "comment");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parser
|
||||||
|
|
||||||
|
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true};
|
||||||
|
|
||||||
|
function JSLexical(indented, column, type, align, prev, info) {
|
||||||
|
this.indented = indented;
|
||||||
|
this.column = column;
|
||||||
|
this.type = type;
|
||||||
|
this.prev = prev;
|
||||||
|
this.info = info;
|
||||||
|
if (align != null) this.align = align;
|
||||||
|
}
|
||||||
|
|
||||||
|
function inScope(state, varname) {
|
||||||
|
for (var v = state.localVars; v; v = v.next)
|
||||||
|
if (v.name == varname) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseJS(state, style, type, content, stream) {
|
||||||
|
var cc = state.cc;
|
||||||
|
// Communicate our context to the combinators.
|
||||||
|
// (Less wasteful than consing up a hundred closures on every call.)
|
||||||
|
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
|
||||||
|
|
||||||
|
if (!state.lexical.hasOwnProperty("align"))
|
||||||
|
state.lexical.align = true;
|
||||||
|
|
||||||
|
while(true) {
|
||||||
|
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
|
||||||
|
if (combinator(type, content)) {
|
||||||
|
while(cc.length && cc[cc.length - 1].lex)
|
||||||
|
cc.pop()();
|
||||||
|
if (cx.marked) return cx.marked;
|
||||||
|
if (type == "variable" && inScope(state, content)) return "variable-2";
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Combinator utils
|
||||||
|
|
||||||
|
var cx = {state: null, column: null, marked: null, cc: null};
|
||||||
|
function pass() {
|
||||||
|
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
||||||
|
}
|
||||||
|
function cont() {
|
||||||
|
pass.apply(null, arguments);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function register(varname) {
|
||||||
|
function inList(list) {
|
||||||
|
for (var v = list; v; v = v.next)
|
||||||
|
if (v.name == varname) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var state = cx.state;
|
||||||
|
if (state.context) {
|
||||||
|
cx.marked = "def";
|
||||||
|
if (inList(state.localVars)) return;
|
||||||
|
state.localVars = {name: varname, next: state.localVars};
|
||||||
|
} else {
|
||||||
|
if (inList(state.globalVars)) return;
|
||||||
|
state.globalVars = {name: varname, next: state.globalVars};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Combinators
|
||||||
|
|
||||||
|
var defaultVars = {name: "this", next: {name: "arguments"}};
|
||||||
|
function pushcontext() {
|
||||||
|
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
|
||||||
|
cx.state.localVars = defaultVars;
|
||||||
|
}
|
||||||
|
function popcontext() {
|
||||||
|
cx.state.localVars = cx.state.context.vars;
|
||||||
|
cx.state.context = cx.state.context.prev;
|
||||||
|
}
|
||||||
|
function pushlex(type, info) {
|
||||||
|
var result = function() {
|
||||||
|
var state = cx.state, indent = state.indented;
|
||||||
|
if (state.lexical.type == "stat") indent = state.lexical.indented;
|
||||||
|
state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
|
||||||
|
};
|
||||||
|
result.lex = true;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
function poplex() {
|
||||||
|
var state = cx.state;
|
||||||
|
if (state.lexical.prev) {
|
||||||
|
if (state.lexical.type == ")")
|
||||||
|
state.indented = state.lexical.indented;
|
||||||
|
state.lexical = state.lexical.prev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
poplex.lex = true;
|
||||||
|
|
||||||
|
function expect(wanted) {
|
||||||
|
return function(type) {
|
||||||
|
if (type == wanted) return cont();
|
||||||
|
else if (wanted == ";") return pass();
|
||||||
|
else return cont(arguments.callee);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function statement(type) {
|
||||||
|
if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
|
||||||
|
if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
|
||||||
|
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
|
||||||
|
if (type == "{") return cont(pushlex("}"), block, poplex);
|
||||||
|
if (type == ";") return cont();
|
||||||
|
if (type == "if") return cont(pushlex("form"), expression, statement, poplex, maybeelse);
|
||||||
|
if (type == "function") return cont(functiondef);
|
||||||
|
if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
|
||||||
|
poplex, statement, poplex);
|
||||||
|
if (type == "variable") return cont(pushlex("stat"), maybelabel);
|
||||||
|
if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
|
||||||
|
block, poplex, poplex);
|
||||||
|
if (type == "case") return cont(expression, expect(":"));
|
||||||
|
if (type == "default") return cont(expect(":"));
|
||||||
|
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
|
||||||
|
statement, poplex, popcontext);
|
||||||
|
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
||||||
|
}
|
||||||
|
function expression(type) {
|
||||||
|
return expressionInner(type, false);
|
||||||
|
}
|
||||||
|
function expressionNoComma(type) {
|
||||||
|
return expressionInner(type, true);
|
||||||
|
}
|
||||||
|
function expressionInner(type, noComma) {
|
||||||
|
var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
|
||||||
|
if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
|
||||||
|
if (type == "function") return cont(functiondef);
|
||||||
|
if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
|
||||||
|
if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop);
|
||||||
|
if (type == "operator") return cont(noComma ? expressionNoComma : expression);
|
||||||
|
if (type == "[") return cont(pushlex("]"), commasep(expressionNoComma, "]"), poplex, maybeop);
|
||||||
|
if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeop);
|
||||||
|
return cont();
|
||||||
|
}
|
||||||
|
function maybeexpression(type) {
|
||||||
|
if (type.match(/[;\}\)\],]/)) return pass();
|
||||||
|
return pass(expression);
|
||||||
|
}
|
||||||
|
function maybeexpressionNoComma(type) {
|
||||||
|
if (type.match(/[;\}\)\],]/)) return pass();
|
||||||
|
return pass(expressionNoComma);
|
||||||
|
}
|
||||||
|
|
||||||
|
function maybeoperatorComma(type, value) {
|
||||||
|
if (type == ",") return cont(expression);
|
||||||
|
return maybeoperatorNoComma(type, value, false);
|
||||||
|
}
|
||||||
|
function maybeoperatorNoComma(type, value, noComma) {
|
||||||
|
var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
|
||||||
|
var expr = noComma == false ? expression : expressionNoComma;
|
||||||
|
if (type == "operator") {
|
||||||
|
if (/\+\+|--/.test(value)) return cont(me);
|
||||||
|
if (value == "?") return cont(expression, expect(":"), expr);
|
||||||
|
return cont(expr);
|
||||||
|
}
|
||||||
|
if (type == ";") return;
|
||||||
|
if (type == "(") return cont(pushlex(")", "call"), commasep(expressionNoComma, ")"), poplex, me);
|
||||||
|
if (type == ".") return cont(property, me);
|
||||||
|
if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
|
||||||
|
}
|
||||||
|
function maybelabel(type) {
|
||||||
|
if (type == ":") return cont(poplex, statement);
|
||||||
|
return pass(maybeoperatorComma, expect(";"), poplex);
|
||||||
|
}
|
||||||
|
function property(type) {
|
||||||
|
if (type == "variable") {cx.marked = "property"; return cont();}
|
||||||
|
}
|
||||||
|
function objprop(type, value) {
|
||||||
|
if (type == "variable") {
|
||||||
|
cx.marked = "property";
|
||||||
|
if (value == "get" || value == "set") return cont(getterSetter);
|
||||||
|
} else if (type == "number" || type == "string") {
|
||||||
|
cx.marked = type + " property";
|
||||||
|
}
|
||||||
|
if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expressionNoComma);
|
||||||
|
}
|
||||||
|
function getterSetter(type) {
|
||||||
|
if (type == ":") return cont(expression);
|
||||||
|
if (type != "variable") return cont(expect(":"), expression);
|
||||||
|
cx.marked = "property";
|
||||||
|
return cont(functiondef);
|
||||||
|
}
|
||||||
|
function commasep(what, end) {
|
||||||
|
function proceed(type) {
|
||||||
|
if (type == ",") {
|
||||||
|
var lex = cx.state.lexical;
|
||||||
|
if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
|
||||||
|
return cont(what, proceed);
|
||||||
|
}
|
||||||
|
if (type == end) return cont();
|
||||||
|
return cont(expect(end));
|
||||||
|
}
|
||||||
|
return function(type) {
|
||||||
|
if (type == end) return cont();
|
||||||
|
else return pass(what, proceed);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function block(type) {
|
||||||
|
if (type == "}") return cont();
|
||||||
|
return pass(statement, block);
|
||||||
|
}
|
||||||
|
function maybetype(type) {
|
||||||
|
if (type == ":") return cont(typedef);
|
||||||
|
return pass();
|
||||||
|
}
|
||||||
|
function typedef(type) {
|
||||||
|
if (type == "variable"){cx.marked = "variable-3"; return cont();}
|
||||||
|
return pass();
|
||||||
|
}
|
||||||
|
function vardef1(type, value) {
|
||||||
|
if (type == "variable") {
|
||||||
|
register(value);
|
||||||
|
return isTS ? cont(maybetype, vardef2) : cont(vardef2);
|
||||||
|
}
|
||||||
|
return pass();
|
||||||
|
}
|
||||||
|
function vardef2(type, value) {
|
||||||
|
if (value == "=") return cont(expressionNoComma, vardef2);
|
||||||
|
if (type == ",") return cont(vardef1);
|
||||||
|
}
|
||||||
|
function maybeelse(type, value) {
|
||||||
|
if (type == "keyword b" && value == "else") return cont(pushlex("form"), statement, poplex);
|
||||||
|
}
|
||||||
|
function forspec1(type) {
|
||||||
|
if (type == "var") return cont(vardef1, expect(";"), forspec2);
|
||||||
|
if (type == ";") return cont(forspec2);
|
||||||
|
if (type == "variable") return cont(formaybein);
|
||||||
|
return pass(expression, expect(";"), forspec2);
|
||||||
|
}
|
||||||
|
function formaybein(_type, value) {
|
||||||
|
if (value == "in") return cont(expression);
|
||||||
|
return cont(maybeoperatorComma, forspec2);
|
||||||
|
}
|
||||||
|
function forspec2(type, value) {
|
||||||
|
if (type == ";") return cont(forspec3);
|
||||||
|
if (value == "in") return cont(expression);
|
||||||
|
return pass(expression, expect(";"), forspec3);
|
||||||
|
}
|
||||||
|
function forspec3(type) {
|
||||||
|
if (type != ")") cont(expression);
|
||||||
|
}
|
||||||
|
function functiondef(type, value) {
|
||||||
|
if (type == "variable") {register(value); return cont(functiondef);}
|
||||||
|
if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext);
|
||||||
|
}
|
||||||
|
function funarg(type, value) {
|
||||||
|
if (type == "variable") {register(value); return isTS ? cont(maybetype) : cont();}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interface
|
||||||
|
|
||||||
|
return {
|
||||||
|
startState: function(basecolumn) {
|
||||||
|
return {
|
||||||
|
tokenize: jsTokenBase,
|
||||||
|
lastType: null,
|
||||||
|
cc: [],
|
||||||
|
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
||||||
|
localVars: parserConfig.localVars,
|
||||||
|
globalVars: parserConfig.globalVars,
|
||||||
|
context: parserConfig.localVars && {vars: parserConfig.localVars},
|
||||||
|
indented: 0
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
token: function(stream, state) {
|
||||||
|
if (stream.sol()) {
|
||||||
|
if (!state.lexical.hasOwnProperty("align"))
|
||||||
|
state.lexical.align = false;
|
||||||
|
state.indented = stream.indentation();
|
||||||
|
}
|
||||||
|
if (state.tokenize != jsTokenComment && stream.eatSpace()) return null;
|
||||||
|
var style = state.tokenize(stream, state);
|
||||||
|
if (type == "comment") return style;
|
||||||
|
state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
|
||||||
|
return parseJS(state, style, type, content, stream);
|
||||||
|
},
|
||||||
|
|
||||||
|
indent: function(state, textAfter) {
|
||||||
|
if (state.tokenize == jsTokenComment) return CodeMirror.Pass;
|
||||||
|
if (state.tokenize != jsTokenBase) return 0;
|
||||||
|
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
|
||||||
|
// Kludge to prevent 'maybelse' from blocking lexical scope pops
|
||||||
|
for (var i = state.cc.length - 1; i >= 0; --i) {
|
||||||
|
var c = state.cc[i];
|
||||||
|
if (c == poplex) lexical = lexical.prev;
|
||||||
|
else if (c != maybeelse || /^else\b/.test(textAfter)) break;
|
||||||
|
}
|
||||||
|
if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
|
||||||
|
if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
|
||||||
|
lexical = lexical.prev;
|
||||||
|
var type = lexical.type, closing = firstChar == type;
|
||||||
|
|
||||||
|
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? 4 : 0);
|
||||||
|
else if (type == "form" && firstChar == "{") return lexical.indented;
|
||||||
|
else if (type == "form") return lexical.indented + indentUnit;
|
||||||
|
else if (type == "stat")
|
||||||
|
return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? statementIndent || indentUnit : 0);
|
||||||
|
else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
|
||||||
|
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
|
||||||
|
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
|
||||||
|
else return lexical.indented + (closing ? 0 : indentUnit);
|
||||||
|
},
|
||||||
|
|
||||||
|
electricChars: ":{}",
|
||||||
|
blockCommentStart: jsonMode ? null : "/*",
|
||||||
|
blockCommentEnd: jsonMode ? null : "*/",
|
||||||
|
lineComment: jsonMode ? null : "//",
|
||||||
|
fold: "brace",
|
||||||
|
|
||||||
|
helperType: jsonMode ? "json" : "javascript",
|
||||||
|
jsonMode: jsonMode
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
CodeMirror.defineMIME("text/javascript", "javascript");
|
||||||
|
CodeMirror.defineMIME("text/ecmascript", "javascript");
|
||||||
|
CodeMirror.defineMIME("application/javascript", "javascript");
|
||||||
|
CodeMirror.defineMIME("application/ecmascript", "javascript");
|
||||||
|
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|
||||||
|
CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
|
||||||
|
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
|
||||||
|
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Name: 3024 day
|
||||||
|
Author: Jan T. Sott (http://github.com/idleberg)
|
||||||
|
|
||||||
|
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
||||||
|
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
.cm-s-3024-day.CodeMirror {background: #f7f7f7; color: #3a3432;}
|
||||||
|
.cm-s-3024-day div.CodeMirror-selected {background: #d6d5d4 !important;}
|
||||||
|
.cm-s-3024-day .CodeMirror-gutters {background: #f7f7f7; border-right: 0px;}
|
||||||
|
.cm-s-3024-day .CodeMirror-linenumber {color: #807d7c;}
|
||||||
|
.cm-s-3024-day .CodeMirror-cursor {border-left: 1px solid #5c5855 !important;}
|
||||||
|
|
||||||
|
.cm-s-3024-day span.cm-comment {color: #cdab53;}
|
||||||
|
.cm-s-3024-day span.cm-atom {color: #a16a94;}
|
||||||
|
.cm-s-3024-day span.cm-number {color: #a16a94;}
|
||||||
|
|
||||||
|
.cm-s-3024-day span.cm-property, .cm-s-3024-day span.cm-attribute {color: #01a252;}
|
||||||
|
.cm-s-3024-day span.cm-keyword {color: #db2d20;}
|
||||||
|
.cm-s-3024-day span.cm-string {color: #fded02;}
|
||||||
|
|
||||||
|
.cm-s-3024-day span.cm-variable {color: #01a252;}
|
||||||
|
.cm-s-3024-day span.cm-variable-2 {color: #01a0e4;}
|
||||||
|
.cm-s-3024-day span.cm-def {color: #e8bbd0;}
|
||||||
|
.cm-s-3024-day span.cm-error {background: #db2d20; color: #5c5855;}
|
||||||
|
.cm-s-3024-day span.cm-bracket {color: #3a3432;}
|
||||||
|
.cm-s-3024-day span.cm-tag {color: #db2d20;}
|
||||||
|
.cm-s-3024-day span.cm-link {color: #a16a94;}
|
||||||
|
|
||||||
|
.cm-s-3024-day .CodeMirror-activeline-background {background: #e8f2ff !important;}
|
||||||
|
.cm-s-3024-day .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Name: 3024 night
|
||||||
|
Author: Jan T. Sott (http://github.com/idleberg)
|
||||||
|
|
||||||
|
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
||||||
|
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
.cm-s-3024-night.CodeMirror {background: #090300; color: #d6d5d4;}
|
||||||
|
.cm-s-3024-night div.CodeMirror-selected {background: #3a3432 !important;}
|
||||||
|
.cm-s-3024-night .CodeMirror-gutters {background: #090300; border-right: 0px;}
|
||||||
|
.cm-s-3024-night .CodeMirror-linenumber {color: #5c5855;}
|
||||||
|
.cm-s-3024-night .CodeMirror-cursor {border-left: 1px solid #807d7c !important;}
|
||||||
|
|
||||||
|
.cm-s-3024-night span.cm-comment {color: #cdab53;}
|
||||||
|
.cm-s-3024-night span.cm-atom {color: #a16a94;}
|
||||||
|
.cm-s-3024-night span.cm-number {color: #a16a94;}
|
||||||
|
|
||||||
|
.cm-s-3024-night span.cm-property, .cm-s-3024-night span.cm-attribute {color: #01a252;}
|
||||||
|
.cm-s-3024-night span.cm-keyword {color: #db2d20;}
|
||||||
|
.cm-s-3024-night span.cm-string {color: #fded02;}
|
||||||
|
|
||||||
|
.cm-s-3024-night span.cm-variable {color: #01a252;}
|
||||||
|
.cm-s-3024-night span.cm-variable-2 {color: #01a0e4;}
|
||||||
|
.cm-s-3024-night span.cm-def {color: #e8bbd0;}
|
||||||
|
.cm-s-3024-night span.cm-error {background: #db2d20; color: #807d7c;}
|
||||||
|
.cm-s-3024-night span.cm-bracket {color: #d6d5d4;}
|
||||||
|
.cm-s-3024-night span.cm-tag {color: #db2d20;}
|
||||||
|
.cm-s-3024-night span.cm-link {color: #a16a94;}
|
||||||
|
|
||||||
|
.cm-s-3024-night .CodeMirror-activeline-background {background: #2F2F2F !important;}
|
||||||
|
.cm-s-3024-night .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
.cm-s-ambiance.CodeMirror {
|
||||||
|
-webkit-box-shadow: none;
|
||||||
|
-moz-box-shadow: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Name: Base16 Default Dark
|
||||||
|
Author: Chris Kempson (http://chriskempson.com)
|
||||||
|
|
||||||
|
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-chrome-devtools)
|
||||||
|
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
.cm-s-base16-dark.CodeMirror {background: #151515; color: #e0e0e0;}
|
||||||
|
.cm-s-base16-dark div.CodeMirror-selected {background: #202020 !important;}
|
||||||
|
.cm-s-base16-dark .CodeMirror-gutters {background: #151515; border-right: 0px;}
|
||||||
|
.cm-s-base16-dark .CodeMirror-linenumber {color: #505050;}
|
||||||
|
.cm-s-base16-dark .CodeMirror-cursor {border-left: 1px solid #b0b0b0 !important;}
|
||||||
|
|
||||||
|
.cm-s-base16-dark span.cm-comment {color: #8f5536;}
|
||||||
|
.cm-s-base16-dark span.cm-atom {color: #aa759f;}
|
||||||
|
.cm-s-base16-dark span.cm-number {color: #aa759f;}
|
||||||
|
|
||||||
|
.cm-s-base16-dark span.cm-property, .cm-s-base16-dark span.cm-attribute {color: #90a959;}
|
||||||
|
.cm-s-base16-dark span.cm-keyword {color: #ac4142;}
|
||||||
|
.cm-s-base16-dark span.cm-string {color: #f4bf75;}
|
||||||
|
|
||||||
|
.cm-s-base16-dark span.cm-variable {color: #90a959;}
|
||||||
|
.cm-s-base16-dark span.cm-variable-2 {color: #6a9fb5;}
|
||||||
|
.cm-s-base16-dark span.cm-def {color: #d28445;}
|
||||||
|
.cm-s-base16-dark span.cm-error {background: #ac4142; color: #b0b0b0;}
|
||||||
|
.cm-s-base16-dark span.cm-bracket {color: #e0e0e0;}
|
||||||
|
.cm-s-base16-dark span.cm-tag {color: #ac4142;}
|
||||||
|
.cm-s-base16-dark span.cm-link {color: #aa759f;}
|
||||||
|
|
||||||
|
.cm-s-base16-dark .CodeMirror-activeline-background {background: #2F2F2F !important;}
|
||||||
|
.cm-s-base16-dark .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Name: Base16 Default Light
|
||||||
|
Author: Chris Kempson (http://chriskempson.com)
|
||||||
|
|
||||||
|
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-chrome-devtools)
|
||||||
|
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
.cm-s-base16-light.CodeMirror {background: #f5f5f5; color: #202020;}
|
||||||
|
.cm-s-base16-light div.CodeMirror-selected {background: #e0e0e0 !important;}
|
||||||
|
.cm-s-base16-light .CodeMirror-gutters {background: #f5f5f5; border-right: 0px;}
|
||||||
|
.cm-s-base16-light .CodeMirror-linenumber {color: #b0b0b0;}
|
||||||
|
.cm-s-base16-light .CodeMirror-cursor {border-left: 1px solid #505050 !important;}
|
||||||
|
|
||||||
|
.cm-s-base16-light span.cm-comment {color: #8f5536;}
|
||||||
|
.cm-s-base16-light span.cm-atom {color: #aa759f;}
|
||||||
|
.cm-s-base16-light span.cm-number {color: #aa759f;}
|
||||||
|
|
||||||
|
.cm-s-base16-light span.cm-property, .cm-s-base16-light span.cm-attribute {color: #90a959;}
|
||||||
|
.cm-s-base16-light span.cm-keyword {color: #ac4142;}
|
||||||
|
.cm-s-base16-light span.cm-string {color: #f4bf75;}
|
||||||
|
|
||||||
|
.cm-s-base16-light span.cm-variable {color: #90a959;}
|
||||||
|
.cm-s-base16-light span.cm-variable-2 {color: #6a9fb5;}
|
||||||
|
.cm-s-base16-light span.cm-def {color: #d28445;}
|
||||||
|
.cm-s-base16-light span.cm-error {background: #ac4142; color: #505050;}
|
||||||
|
.cm-s-base16-light span.cm-bracket {color: #202020;}
|
||||||
|
.cm-s-base16-light span.cm-tag {color: #ac4142;}
|
||||||
|
.cm-s-base16-light span.cm-link {color: #aa759f;}
|
||||||
|
|
||||||
|
.cm-s-base16-light .CodeMirror-activeline-background {background: #DDDCDC !important;}
|
||||||
|
.cm-s-base16-light .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/* Port of TextMate's Blackboard theme */
|
||||||
|
|
||||||
|
.cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; }
|
||||||
|
.cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; }
|
||||||
|
.cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; }
|
||||||
|
.cm-s-blackboard .CodeMirror-linenumber { color: #888; }
|
||||||
|
.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; }
|
||||||
|
|
||||||
|
.cm-s-blackboard .cm-keyword { color: #FBDE2D; }
|
||||||
|
.cm-s-blackboard .cm-atom { color: #D8FA3C; }
|
||||||
|
.cm-s-blackboard .cm-number { color: #D8FA3C; }
|
||||||
|
.cm-s-blackboard .cm-def { color: #8DA6CE; }
|
||||||
|
.cm-s-blackboard .cm-variable { color: #FF6400; }
|
||||||
|
.cm-s-blackboard .cm-operator { color: #FBDE2D;}
|
||||||
|
.cm-s-blackboard .cm-comment { color: #AEAEAE; }
|
||||||
|
.cm-s-blackboard .cm-string { color: #61CE3C; }
|
||||||
|
.cm-s-blackboard .cm-string-2 { color: #61CE3C; }
|
||||||
|
.cm-s-blackboard .cm-meta { color: #D8FA3C; }
|
||||||
|
.cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; }
|
||||||
|
.cm-s-blackboard .cm-builtin { color: #8DA6CE; }
|
||||||
|
.cm-s-blackboard .cm-tag { color: #8DA6CE; }
|
||||||
|
.cm-s-blackboard .cm-attribute { color: #8DA6CE; }
|
||||||
|
.cm-s-blackboard .cm-header { color: #FF6400; }
|
||||||
|
.cm-s-blackboard .cm-hr { color: #AEAEAE; }
|
||||||
|
.cm-s-blackboard .cm-link { color: #8DA6CE; }
|
||||||
|
|
||||||
|
.cm-s-blackboard .CodeMirror-activeline-background {background: #3C3636 !important;}
|
||||||
|
.cm-s-blackboard .CodeMirror-matchingbracket {outline:1px solid grey;color:white !important}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
.cm-s-cobalt.CodeMirror { background: #002240; color: white; }
|
||||||
|
.cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; }
|
||||||
|
.cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
|
||||||
|
.cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; }
|
||||||
|
.cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
|
.cm-s-cobalt span.cm-comment { color: #08f; }
|
||||||
|
.cm-s-cobalt span.cm-atom { color: #845dc4; }
|
||||||
|
.cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; }
|
||||||
|
.cm-s-cobalt span.cm-keyword { color: #ffee80; }
|
||||||
|
.cm-s-cobalt span.cm-string { color: #3ad900; }
|
||||||
|
.cm-s-cobalt span.cm-meta { color: #ff9d00; }
|
||||||
|
.cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; }
|
||||||
|
.cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; }
|
||||||
|
.cm-s-cobalt span.cm-error { color: #9d1e15; }
|
||||||
|
.cm-s-cobalt span.cm-bracket { color: #d8d8d8; }
|
||||||
|
.cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; }
|
||||||
|
.cm-s-cobalt span.cm-link { color: #845dc4; }
|
||||||
|
|
||||||
|
.cm-s-cobalt .CodeMirror-activeline-background {background: #002D57 !important;}
|
||||||
|
.cm-s-cobalt .CodeMirror-matchingbracket {outline:1px solid grey;color:white !important}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
.cm-s-eclipse span.cm-meta {color: #FF1717;}
|
||||||
|
.cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; }
|
||||||
|
.cm-s-eclipse span.cm-atom {color: #219;}
|
||||||
|
.cm-s-eclipse span.cm-number {color: #164;}
|
||||||
|
.cm-s-eclipse span.cm-def {color: #00f;}
|
||||||
|
.cm-s-eclipse span.cm-variable {color: black;}
|
||||||
|
.cm-s-eclipse span.cm-variable-2 {color: #0000C0;}
|
||||||
|
.cm-s-eclipse span.cm-variable-3 {color: #0000C0;}
|
||||||
|
.cm-s-eclipse span.cm-property {color: black;}
|
||||||
|
.cm-s-eclipse span.cm-operator {color: black;}
|
||||||
|
.cm-s-eclipse span.cm-comment {color: #3F7F5F;}
|
||||||
|
.cm-s-eclipse span.cm-string {color: #2A00FF;}
|
||||||
|
.cm-s-eclipse span.cm-string-2 {color: #f50;}
|
||||||
|
.cm-s-eclipse span.cm-error {color: #f00;}
|
||||||
|
.cm-s-eclipse span.cm-qualifier {color: #555;}
|
||||||
|
.cm-s-eclipse span.cm-builtin {color: #30a;}
|
||||||
|
.cm-s-eclipse span.cm-bracket {color: #cc7;}
|
||||||
|
.cm-s-eclipse span.cm-tag {color: #170;}
|
||||||
|
.cm-s-eclipse span.cm-attribute {color: #00c;}
|
||||||
|
.cm-s-eclipse span.cm-link {color: #219;}
|
||||||
|
|
||||||
|
.cm-s-eclipse .CodeMirror-activeline-background {background: #e8f2ff !important;}
|
||||||
|
.cm-s-eclipse .CodeMirror-matchingbracket {outline:1px solid grey; color:black !important;}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
.cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;}
|
||||||
|
.cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;}
|
||||||
|
.cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;}
|
||||||
|
.cm-s-elegant span.cm-variable {color: black;}
|
||||||
|
.cm-s-elegant span.cm-variable-2 {color: #b11;}
|
||||||
|
.cm-s-elegant span.cm-qualifier {color: #555;}
|
||||||
|
.cm-s-elegant span.cm-keyword {color: #730;}
|
||||||
|
.cm-s-elegant span.cm-builtin {color: #30a;}
|
||||||
|
.cm-s-elegant span.cm-error {background-color: #fdd;}
|
||||||
|
.cm-s-elegant span.cm-link {color: #762;}
|
||||||
|
|
||||||
|
.cm-s-elegant .CodeMirror-activeline-background {background: #e8f2ff !important;}
|
||||||
|
.cm-s-elegant .CodeMirror-matchingbracket {outline:1px solid grey; color:black !important;}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
.cm-s-erlang-dark.CodeMirror { background: #002240; color: white; }
|
||||||
|
.cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; }
|
||||||
|
.cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
|
||||||
|
.cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; }
|
||||||
|
.cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
|
.cm-s-erlang-dark span.cm-atom { color: #f133f1; }
|
||||||
|
.cm-s-erlang-dark span.cm-attribute { color: #ff80e1; }
|
||||||
|
.cm-s-erlang-dark span.cm-bracket { color: #ff9d00; }
|
||||||
|
.cm-s-erlang-dark span.cm-builtin { color: #eaa; }
|
||||||
|
.cm-s-erlang-dark span.cm-comment { color: #77f; }
|
||||||
|
.cm-s-erlang-dark span.cm-def { color: #e7a; }
|
||||||
|
.cm-s-erlang-dark span.cm-error { color: #9d1e15; }
|
||||||
|
.cm-s-erlang-dark span.cm-keyword { color: #ffee80; }
|
||||||
|
.cm-s-erlang-dark span.cm-meta { color: #50fefe; }
|
||||||
|
.cm-s-erlang-dark span.cm-number { color: #ffd0d0; }
|
||||||
|
.cm-s-erlang-dark span.cm-operator { color: #d55; }
|
||||||
|
.cm-s-erlang-dark span.cm-property { color: #ccc; }
|
||||||
|
.cm-s-erlang-dark span.cm-qualifier { color: #ccc; }
|
||||||
|
.cm-s-erlang-dark span.cm-quote { color: #ccc; }
|
||||||
|
.cm-s-erlang-dark span.cm-special { color: #ffbbbb; }
|
||||||
|
.cm-s-erlang-dark span.cm-string { color: #3ad900; }
|
||||||
|
.cm-s-erlang-dark span.cm-string-2 { color: #ccc; }
|
||||||
|
.cm-s-erlang-dark span.cm-tag { color: #9effff; }
|
||||||
|
.cm-s-erlang-dark span.cm-variable { color: #50fe50; }
|
||||||
|
.cm-s-erlang-dark span.cm-variable-2 { color: #e0e; }
|
||||||
|
.cm-s-erlang-dark span.cm-variable-3 { color: #ccc; }
|
||||||
|
|
||||||
|
.cm-s-erlang-dark .CodeMirror-activeline-background {background: #013461 !important;}
|
||||||
|
.cm-s-erlang-dark .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
http://lesscss.org/ dark theme
|
||||||
|
Ported to CodeMirror by Peter Kroon
|
||||||
|
*/
|
||||||
|
.cm-s-lesser-dark {
|
||||||
|
line-height: 1.3em;
|
||||||
|
}
|
||||||
|
.cm-s-lesser-dark {
|
||||||
|
font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; }
|
||||||
|
.cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/
|
||||||
|
.cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
.cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/
|
||||||
|
|
||||||
|
.cm-s-lesser-dark.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/
|
||||||
|
|
||||||
|
.cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; }
|
||||||
|
.cm-s-lesser-dark .CodeMirror-linenumber { color: #777; }
|
||||||
|
|
||||||
|
.cm-s-lesser-dark span.cm-keyword { color: #599eff; }
|
||||||
|
.cm-s-lesser-dark span.cm-atom { color: #C2B470; }
|
||||||
|
.cm-s-lesser-dark span.cm-number { color: #B35E4D; }
|
||||||
|
.cm-s-lesser-dark span.cm-def {color: white;}
|
||||||
|
.cm-s-lesser-dark span.cm-variable { color:#D9BF8C; }
|
||||||
|
.cm-s-lesser-dark span.cm-variable-2 { color: #669199; }
|
||||||
|
.cm-s-lesser-dark span.cm-variable-3 { color: white; }
|
||||||
|
.cm-s-lesser-dark span.cm-property {color: #92A75C;}
|
||||||
|
.cm-s-lesser-dark span.cm-operator {color: #92A75C;}
|
||||||
|
.cm-s-lesser-dark span.cm-comment { color: #666; }
|
||||||
|
.cm-s-lesser-dark span.cm-string { color: #BCD279; }
|
||||||
|
.cm-s-lesser-dark span.cm-string-2 {color: #f50;}
|
||||||
|
.cm-s-lesser-dark span.cm-meta { color: #738C73; }
|
||||||
|
.cm-s-lesser-dark span.cm-error { color: #9d1e15; }
|
||||||
|
.cm-s-lesser-dark span.cm-qualifier {color: #555;}
|
||||||
|
.cm-s-lesser-dark span.cm-builtin { color: #ff9e59; }
|
||||||
|
.cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; }
|
||||||
|
.cm-s-lesser-dark span.cm-tag { color: #669199; }
|
||||||
|
.cm-s-lesser-dark span.cm-attribute {color: #00c;}
|
||||||
|
.cm-s-lesser-dark span.cm-header {color: #a0a;}
|
||||||
|
.cm-s-lesser-dark span.cm-quote {color: #090;}
|
||||||
|
.cm-s-lesser-dark span.cm-hr {color: #999;}
|
||||||
|
.cm-s-lesser-dark span.cm-link {color: #00c;}
|
||||||
|
|
||||||
|
.cm-s-lesser-dark .CodeMirror-activeline-background {background: #3C3A3A !important;}
|
||||||
|
.cm-s-lesser-dark .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/* Based on the theme at http://bonsaiden.github.com/JavaScript-Garden */
|
||||||
|
|
||||||
|
/*<!--match-->*/
|
||||||
|
.cm-s-midnight span.CodeMirror-matchhighlight { background: #494949 }
|
||||||
|
.cm-s-midnight.CodeMirror-focused span.CodeMirror-matchhighlight { background: #314D67 !important; }
|
||||||
|
|
||||||
|
/*<!--activeline-->*/
|
||||||
|
.cm-s-midnight .CodeMirror-activeline-background {background: #253540 !important;}
|
||||||
|
|
||||||
|
.cm-s-midnight.CodeMirror {
|
||||||
|
background: #0F192A;
|
||||||
|
color: #D1EDFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-midnight.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
||||||
|
|
||||||
|
.cm-s-midnight div.CodeMirror-selected {background: #314D67 !important;}
|
||||||
|
.cm-s-midnight .CodeMirror-gutters {background: #0F192A; border-right: 1px solid;}
|
||||||
|
.cm-s-midnight .CodeMirror-linenumber {color: #D0D0D0;}
|
||||||
|
.cm-s-midnight .CodeMirror-cursor {
|
||||||
|
border-left: 1px solid #F8F8F0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-midnight span.cm-comment {color: #428BDD;}
|
||||||
|
.cm-s-midnight span.cm-atom {color: #AE81FF;}
|
||||||
|
.cm-s-midnight span.cm-number {color: #D1EDFF;}
|
||||||
|
|
||||||
|
.cm-s-midnight span.cm-property, .cm-s-midnight span.cm-attribute {color: #A6E22E;}
|
||||||
|
.cm-s-midnight span.cm-keyword {color: #E83737;}
|
||||||
|
.cm-s-midnight span.cm-string {color: #1DC116;}
|
||||||
|
|
||||||
|
.cm-s-midnight span.cm-variable {color: #FFAA3E;}
|
||||||
|
.cm-s-midnight span.cm-variable-2 {color: #FFAA3E;}
|
||||||
|
.cm-s-midnight span.cm-def {color: #4DD;}
|
||||||
|
.cm-s-midnight span.cm-error {background: #F92672; color: #F8F8F0;}
|
||||||
|
.cm-s-midnight span.cm-bracket {color: #D1EDFF;}
|
||||||
|
.cm-s-midnight span.cm-tag {color: #449;}
|
||||||
|
.cm-s-midnight span.cm-link {color: #AE81FF;}
|
||||||
|
|
||||||
|
.cm-s-midnight .CodeMirror-matchingbracket {
|
||||||
|
text-decoration: underline;
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* Based on Sublime Text's Monokai theme */
|
||||||
|
|
||||||
|
.cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;}
|
||||||
|
.cm-s-monokai div.CodeMirror-selected {background: #49483E !important;}
|
||||||
|
.cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;}
|
||||||
|
.cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;}
|
||||||
|
.cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;}
|
||||||
|
|
||||||
|
.cm-s-monokai span.cm-comment {color: #75715e;}
|
||||||
|
.cm-s-monokai span.cm-atom {color: #ae81ff;}
|
||||||
|
.cm-s-monokai span.cm-number {color: #ae81ff;}
|
||||||
|
|
||||||
|
.cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;}
|
||||||
|
.cm-s-monokai span.cm-keyword {color: #f92672;}
|
||||||
|
.cm-s-monokai span.cm-string {color: #e6db74;}
|
||||||
|
|
||||||
|
.cm-s-monokai span.cm-variable {color: #a6e22e;}
|
||||||
|
.cm-s-monokai span.cm-variable-2 {color: #9effff;}
|
||||||
|
.cm-s-monokai span.cm-def {color: #fd971f;}
|
||||||
|
.cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;}
|
||||||
|
.cm-s-monokai span.cm-bracket {color: #f8f8f2;}
|
||||||
|
.cm-s-monokai span.cm-tag {color: #f92672;}
|
||||||
|
.cm-s-monokai span.cm-link {color: #ae81ff;}
|
||||||
|
|
||||||
|
.cm-s-monokai .CodeMirror-activeline-background {background: #373831 !important;}
|
||||||
|
.cm-s-monokai .CodeMirror-matchingbracket {
|
||||||
|
text-decoration: underline;
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
.cm-s-neat span.cm-comment { color: #a86; }
|
||||||
|
.cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; }
|
||||||
|
.cm-s-neat span.cm-string { color: #a22; }
|
||||||
|
.cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; }
|
||||||
|
.cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; }
|
||||||
|
.cm-s-neat span.cm-variable { color: black; }
|
||||||
|
.cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; }
|
||||||
|
.cm-s-neat span.cm-meta {color: #555;}
|
||||||
|
.cm-s-neat span.cm-link { color: #3a3; }
|
||||||
|
|
||||||
|
.cm-s-neat .CodeMirror-activeline-background {background: #e8f2ff !important;}
|
||||||
|
.cm-s-neat .CodeMirror-matchingbracket {outline:1px solid grey; color:black !important;}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/* Loosely based on the Midnight Textmate theme */
|
||||||
|
|
||||||
|
.cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; }
|
||||||
|
.cm-s-night div.CodeMirror-selected { background: #447 !important; }
|
||||||
|
.cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
|
||||||
|
.cm-s-night .CodeMirror-linenumber { color: #f8f8f8; }
|
||||||
|
.cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
|
.cm-s-night span.cm-comment { color: #6900a1; }
|
||||||
|
.cm-s-night span.cm-atom { color: #845dc4; }
|
||||||
|
.cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; }
|
||||||
|
.cm-s-night span.cm-keyword { color: #599eff; }
|
||||||
|
.cm-s-night span.cm-string { color: #37f14a; }
|
||||||
|
.cm-s-night span.cm-meta { color: #7678e2; }
|
||||||
|
.cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; }
|
||||||
|
.cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; }
|
||||||
|
.cm-s-night span.cm-error { color: #9d1e15; }
|
||||||
|
.cm-s-night span.cm-bracket { color: #8da6ce; }
|
||||||
|
.cm-s-night span.cm-comment { color: #6900a1; }
|
||||||
|
.cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; }
|
||||||
|
.cm-s-night span.cm-link { color: #845dc4; }
|
||||||
|
|
||||||
|
.cm-s-night .CodeMirror-activeline-background {background: #1C005A !important;}
|
||||||
|
.cm-s-night .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Name: Paraíso (Dark)
|
||||||
|
Author: Jan T. Sott
|
||||||
|
|
||||||
|
Color scheme by Jan T. Sott (https://github.com/idleberg/Paraiso-CodeMirror)
|
||||||
|
Inspired by the art of Rubens LP (http://www.rubenslp.com.br)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
.cm-s-paraiso-dark.CodeMirror {background: #2f1e2e; color: #b9b6b0;}
|
||||||
|
.cm-s-paraiso-dark div.CodeMirror-selected {background: #41323f !important;}
|
||||||
|
.cm-s-paraiso-dark .CodeMirror-gutters {background: #2f1e2e; border-right: 0px;}
|
||||||
|
.cm-s-paraiso-dark .CodeMirror-linenumber {color: #776e71;}
|
||||||
|
.cm-s-paraiso-dark .CodeMirror-cursor {border-left: 1px solid #8d8687 !important;}
|
||||||
|
|
||||||
|
.cm-s-paraiso-dark span.cm-comment {color: #e96ba8;}
|
||||||
|
.cm-s-paraiso-dark span.cm-atom {color: #815ba4;}
|
||||||
|
.cm-s-paraiso-dark span.cm-number {color: #815ba4;}
|
||||||
|
|
||||||
|
.cm-s-paraiso-dark span.cm-property, .cm-s-paraiso-dark span.cm-attribute {color: #48b685;}
|
||||||
|
.cm-s-paraiso-dark span.cm-keyword {color: #ef6155;}
|
||||||
|
.cm-s-paraiso-dark span.cm-string {color: #fec418;}
|
||||||
|
|
||||||
|
.cm-s-paraiso-dark span.cm-variable {color: #48b685;}
|
||||||
|
.cm-s-paraiso-dark span.cm-variable-2 {color: #06b6ef;}
|
||||||
|
.cm-s-paraiso-dark span.cm-def {color: #f99b15;}
|
||||||
|
.cm-s-paraiso-dark span.cm-error {background: #ef6155; color: #8d8687;}
|
||||||
|
.cm-s-paraiso-dark span.cm-bracket {color: #b9b6b0;}
|
||||||
|
.cm-s-paraiso-dark span.cm-tag {color: #ef6155;}
|
||||||
|
.cm-s-paraiso-dark span.cm-link {color: #815ba4;}
|
||||||
|
|
||||||
|
.cm-s-paraiso-dark .CodeMirror-activeline-background {background: #4D344A !important;}
|
||||||
|
.cm-s-paraiso-dark .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Name: Paraíso (Light)
|
||||||
|
Author: Jan T. Sott
|
||||||
|
|
||||||
|
Color scheme by Jan T. Sott (https://github.com/idleberg/Paraiso-CodeMirror)
|
||||||
|
Inspired by the art of Rubens LP (http://www.rubenslp.com.br)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
.cm-s-paraiso-light.CodeMirror {background: #e7e9db; color: #41323f;}
|
||||||
|
.cm-s-paraiso-light div.CodeMirror-selected {background: #b9b6b0 !important;}
|
||||||
|
.cm-s-paraiso-light .CodeMirror-gutters {background: #e7e9db; border-right: 0px;}
|
||||||
|
.cm-s-paraiso-light .CodeMirror-linenumber {color: #8d8687;}
|
||||||
|
.cm-s-paraiso-light .CodeMirror-cursor {border-left: 1px solid #776e71 !important;}
|
||||||
|
|
||||||
|
.cm-s-paraiso-light span.cm-comment {color: #e96ba8;}
|
||||||
|
.cm-s-paraiso-light span.cm-atom {color: #815ba4;}
|
||||||
|
.cm-s-paraiso-light span.cm-number {color: #815ba4;}
|
||||||
|
|
||||||
|
.cm-s-paraiso-light span.cm-property, .cm-s-paraiso-light span.cm-attribute {color: #48b685;}
|
||||||
|
.cm-s-paraiso-light span.cm-keyword {color: #ef6155;}
|
||||||
|
.cm-s-paraiso-light span.cm-string {color: #fec418;}
|
||||||
|
|
||||||
|
.cm-s-paraiso-light span.cm-variable {color: #48b685;}
|
||||||
|
.cm-s-paraiso-light span.cm-variable-2 {color: #06b6ef;}
|
||||||
|
.cm-s-paraiso-light span.cm-def {color: #f99b15;}
|
||||||
|
.cm-s-paraiso-light span.cm-error {background: #ef6155; color: #776e71;}
|
||||||
|
.cm-s-paraiso-light span.cm-bracket {color: #41323f;}
|
||||||
|
.cm-s-paraiso-light span.cm-tag {color: #ef6155;}
|
||||||
|
.cm-s-paraiso-light span.cm-link {color: #815ba4;}
|
||||||
|
|
||||||
|
.cm-s-paraiso-light .CodeMirror-activeline-background {background: #CFD1C4 !important;}
|
||||||
|
.cm-s-paraiso-light .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
.cm-s-rubyblue { font-family: Trebuchet, Verdana, sans-serif; } /* - customized editor font - */
|
||||||
|
|
||||||
|
.cm-s-rubyblue.CodeMirror { background: #112435; color: white; }
|
||||||
|
.cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; }
|
||||||
|
.cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; }
|
||||||
|
.cm-s-rubyblue .CodeMirror-linenumber { color: white; }
|
||||||
|
.cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
|
.cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; }
|
||||||
|
.cm-s-rubyblue span.cm-atom { color: #F4C20B; }
|
||||||
|
.cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; }
|
||||||
|
.cm-s-rubyblue span.cm-keyword { color: #F0F; }
|
||||||
|
.cm-s-rubyblue span.cm-string { color: #F08047; }
|
||||||
|
.cm-s-rubyblue span.cm-meta { color: #F0F; }
|
||||||
|
.cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; }
|
||||||
|
.cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; }
|
||||||
|
.cm-s-rubyblue span.cm-error { color: #AF2018; }
|
||||||
|
.cm-s-rubyblue span.cm-bracket { color: #F0F; }
|
||||||
|
.cm-s-rubyblue span.cm-link { color: #F4C20B; }
|
||||||
|
.cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; }
|
||||||
|
.cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; }
|
||||||
|
|
||||||
|
.cm-s-rubyblue .CodeMirror-activeline-background {background: #173047 !important;}
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,26 @@
|
|||||||
|
.cm-s-the-matrix.CodeMirror { background: #000000; color: #00FF00; }
|
||||||
|
.cm-s-the-matrix span.CodeMirror-selected { background: #a8f !important; }
|
||||||
|
.cm-s-the-matrix .CodeMirror-gutters { background: #060; border-right: 2px solid #00FF00; }
|
||||||
|
.cm-s-the-matrix .CodeMirror-linenumber { color: #FFFFFF; }
|
||||||
|
.cm-s-the-matrix .CodeMirror-cursor { border-left: 1px solid #00FF00 !important; }
|
||||||
|
|
||||||
|
.cm-s-the-matrix span.cm-keyword {color: #008803; font-weight: bold;}
|
||||||
|
.cm-s-the-matrix span.cm-atom {color: #3FF;}
|
||||||
|
.cm-s-the-matrix span.cm-number {color: #FFB94F;}
|
||||||
|
.cm-s-the-matrix span.cm-def {color: #99C;}
|
||||||
|
.cm-s-the-matrix span.cm-variable {color: #F6C;}
|
||||||
|
.cm-s-the-matrix span.cm-variable-2 {color: #C6F;}
|
||||||
|
.cm-s-the-matrix span.cm-variable-3 {color: #96F;}
|
||||||
|
.cm-s-the-matrix span.cm-property {color: #62FFA0;}
|
||||||
|
.cm-s-the-matrix span.cm-operator {color: #999}
|
||||||
|
.cm-s-the-matrix span.cm-comment {color: #CCCCCC;}
|
||||||
|
.cm-s-the-matrix span.cm-string {color: #39C;}
|
||||||
|
.cm-s-the-matrix span.cm-meta {color: #C9F;}
|
||||||
|
.cm-s-the-matrix span.cm-error {color: #FF0000;}
|
||||||
|
.cm-s-the-matrix span.cm-qualifier {color: #FFF700;}
|
||||||
|
.cm-s-the-matrix span.cm-builtin {color: #30a;}
|
||||||
|
.cm-s-the-matrix span.cm-bracket {color: #cc7;}
|
||||||
|
.cm-s-the-matrix span.cm-tag {color: #FFBD40;}
|
||||||
|
.cm-s-the-matrix span.cm-attribute {color: #FFF700;}
|
||||||
|
|
||||||
|
.cm-s-the-matrix .CodeMirror-activeline-background {background: #040;}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Name: Tomorrow Night - Eighties
|
||||||
|
Author: Chris Kempson
|
||||||
|
|
||||||
|
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
||||||
|
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
.cm-s-tomorrow-night-eighties.CodeMirror {background: #000000; color: #CCCCCC;}
|
||||||
|
.cm-s-tomorrow-night-eighties div.CodeMirror-selected {background: #2D2D2D !important;}
|
||||||
|
.cm-s-tomorrow-night-eighties .CodeMirror-gutters {background: #000000; border-right: 0px;}
|
||||||
|
.cm-s-tomorrow-night-eighties .CodeMirror-linenumber {color: #515151;}
|
||||||
|
.cm-s-tomorrow-night-eighties .CodeMirror-cursor {border-left: 1px solid #6A6A6A !important;}
|
||||||
|
|
||||||
|
.cm-s-tomorrow-night-eighties span.cm-comment {color: #d27b53;}
|
||||||
|
.cm-s-tomorrow-night-eighties span.cm-atom {color: #a16a94;}
|
||||||
|
.cm-s-tomorrow-night-eighties span.cm-number {color: #a16a94;}
|
||||||
|
|
||||||
|
.cm-s-tomorrow-night-eighties span.cm-property, .cm-s-tomorrow-night-eighties span.cm-attribute {color: #99cc99;}
|
||||||
|
.cm-s-tomorrow-night-eighties span.cm-keyword {color: #f2777a;}
|
||||||
|
.cm-s-tomorrow-night-eighties span.cm-string {color: #ffcc66;}
|
||||||
|
|
||||||
|
.cm-s-tomorrow-night-eighties span.cm-variable {color: #99cc99;}
|
||||||
|
.cm-s-tomorrow-night-eighties span.cm-variable-2 {color: #6699cc;}
|
||||||
|
.cm-s-tomorrow-night-eighties span.cm-def {color: #f99157;}
|
||||||
|
.cm-s-tomorrow-night-eighties span.cm-error {background: #f2777a; color: #6A6A6A;}
|
||||||
|
.cm-s-tomorrow-night-eighties span.cm-bracket {color: #CCCCCC;}
|
||||||
|
.cm-s-tomorrow-night-eighties span.cm-tag {color: #f2777a;}
|
||||||
|
.cm-s-tomorrow-night-eighties span.cm-link {color: #a16a94;}
|
||||||
|
|
||||||
|
.cm-s-tomorrow-night-eighties .CodeMirror-activeline-background {background: #343600 !important;}
|
||||||
|
.cm-s-tomorrow-night-eighties .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
.cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/
|
||||||
|
.cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/
|
||||||
|
|
||||||
|
.cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; }
|
||||||
|
.cm-s-twilight .CodeMirror-linenumber { color: #aaa; }
|
||||||
|
.cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
|
.cm-s-twilight .cm-keyword { color: #f9ee98; } /**/
|
||||||
|
.cm-s-twilight .cm-atom { color: #FC0; }
|
||||||
|
.cm-s-twilight .cm-number { color: #ca7841; } /**/
|
||||||
|
.cm-s-twilight .cm-def { color: #8DA6CE; }
|
||||||
|
.cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/
|
||||||
|
.cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/
|
||||||
|
.cm-s-twilight .cm-operator { color: #cda869; } /**/
|
||||||
|
.cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/
|
||||||
|
.cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/
|
||||||
|
.cm-s-twilight .cm-string-2 { color:#bd6b18 } /*?*/
|
||||||
|
.cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/
|
||||||
|
.cm-s-twilight .cm-error { border-bottom: 1px solid red; }
|
||||||
|
.cm-s-twilight .cm-builtin { color: #cda869; } /*?*/
|
||||||
|
.cm-s-twilight .cm-tag { color: #997643; } /**/
|
||||||
|
.cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/
|
||||||
|
.cm-s-twilight .cm-header { color: #FF6400; }
|
||||||
|
.cm-s-twilight .cm-hr { color: #AEAEAE; }
|
||||||
|
.cm-s-twilight .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } /**/
|
||||||
|
|
||||||
|
.cm-s-twilight .CodeMirror-activeline-background {background: #27282E !important;}
|
||||||
|
.cm-s-twilight .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/* Taken from the popular Visual Studio Vibrant Ink Schema */
|
||||||
|
|
||||||
|
.cm-s-vibrant-ink.CodeMirror { background: black; color: white; }
|
||||||
|
.cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; }
|
||||||
|
|
||||||
|
.cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
|
||||||
|
.cm-s-vibrant-ink .CodeMirror-linenumber { color: #d0d0d0; }
|
||||||
|
.cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
|
.cm-s-vibrant-ink .cm-keyword { color: #CC7832; }
|
||||||
|
.cm-s-vibrant-ink .cm-atom { color: #FC0; }
|
||||||
|
.cm-s-vibrant-ink .cm-number { color: #FFEE98; }
|
||||||
|
.cm-s-vibrant-ink .cm-def { color: #8DA6CE; }
|
||||||
|
.cm-s-vibrant-ink span.cm-variable-2, .cm-s-vibrant span.cm-tag { color: #FFC66D }
|
||||||
|
.cm-s-vibrant-ink span.cm-variable-3, .cm-s-vibrant span.cm-def { color: #FFC66D }
|
||||||
|
.cm-s-vibrant-ink .cm-operator { color: #888; }
|
||||||
|
.cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; }
|
||||||
|
.cm-s-vibrant-ink .cm-string { color: #A5C25C }
|
||||||
|
.cm-s-vibrant-ink .cm-string-2 { color: red }
|
||||||
|
.cm-s-vibrant-ink .cm-meta { color: #D8FA3C; }
|
||||||
|
.cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; }
|
||||||
|
.cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; }
|
||||||
|
.cm-s-vibrant-ink .cm-tag { color: #8DA6CE; }
|
||||||
|
.cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; }
|
||||||
|
.cm-s-vibrant-ink .cm-header { color: #FF6400; }
|
||||||
|
.cm-s-vibrant-ink .cm-hr { color: #AEAEAE; }
|
||||||
|
.cm-s-vibrant-ink .cm-link { color: blue; }
|
||||||
|
|
||||||
|
.cm-s-vibrant-ink .CodeMirror-activeline-background {background: #27282E !important;}
|
||||||
|
.cm-s-vibrant-ink .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2011 by MarkLogic Corporation
|
||||||
|
Author: Mike Brevoort <mike@brevoort.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
.cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; }
|
||||||
|
.cm-s-xq-dark .CodeMirror-selected { background: #27007A !important; }
|
||||||
|
.cm-s-xq-dark .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
|
||||||
|
.cm-s-xq-dark .CodeMirror-linenumber { color: #f8f8f8; }
|
||||||
|
.cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
|
.cm-s-xq-dark span.cm-keyword {color: #FFBD40;}
|
||||||
|
.cm-s-xq-dark span.cm-atom {color: #6C8CD5;}
|
||||||
|
.cm-s-xq-dark span.cm-number {color: #164;}
|
||||||
|
.cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;}
|
||||||
|
.cm-s-xq-dark span.cm-variable {color: #FFF;}
|
||||||
|
.cm-s-xq-dark span.cm-variable-2 {color: #EEE;}
|
||||||
|
.cm-s-xq-dark span.cm-variable-3 {color: #DDD;}
|
||||||
|
.cm-s-xq-dark span.cm-property {}
|
||||||
|
.cm-s-xq-dark span.cm-operator {}
|
||||||
|
.cm-s-xq-dark span.cm-comment {color: gray;}
|
||||||
|
.cm-s-xq-dark span.cm-string {color: #9FEE00;}
|
||||||
|
.cm-s-xq-dark span.cm-meta {color: yellow;}
|
||||||
|
.cm-s-xq-dark span.cm-error {color: #f00;}
|
||||||
|
.cm-s-xq-dark span.cm-qualifier {color: #FFF700;}
|
||||||
|
.cm-s-xq-dark span.cm-builtin {color: #30a;}
|
||||||
|
.cm-s-xq-dark span.cm-bracket {color: #cc7;}
|
||||||
|
.cm-s-xq-dark span.cm-tag {color: #FFBD40;}
|
||||||
|
.cm-s-xq-dark span.cm-attribute {color: #FFF700;}
|
||||||
|
|
||||||
|
.cm-s-xq-dark .CodeMirror-activeline-background {background: #27282E !important;}
|
||||||
|
.cm-s-xq-dark .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2011 by MarkLogic Corporation
|
||||||
|
Author: Mike Brevoort <mike@brevoort.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
.cm-s-xq-light span.cm-keyword {line-height: 1em; font-weight: bold; color: #5A5CAD; }
|
||||||
|
.cm-s-xq-light span.cm-atom {color: #6C8CD5;}
|
||||||
|
.cm-s-xq-light span.cm-number {color: #164;}
|
||||||
|
.cm-s-xq-light span.cm-def {text-decoration:underline;}
|
||||||
|
.cm-s-xq-light span.cm-variable {color: black; }
|
||||||
|
.cm-s-xq-light span.cm-variable-2 {color:black;}
|
||||||
|
.cm-s-xq-light span.cm-variable-3 {color: black; }
|
||||||
|
.cm-s-xq-light span.cm-property {}
|
||||||
|
.cm-s-xq-light span.cm-operator {}
|
||||||
|
.cm-s-xq-light span.cm-comment {color: #0080FF; font-style: italic;}
|
||||||
|
.cm-s-xq-light span.cm-string {color: red;}
|
||||||
|
.cm-s-xq-light span.cm-meta {color: yellow;}
|
||||||
|
.cm-s-xq-light span.cm-error {color: #f00;}
|
||||||
|
.cm-s-xq-light span.cm-qualifier {color: grey}
|
||||||
|
.cm-s-xq-light span.cm-builtin {color: #7EA656;}
|
||||||
|
.cm-s-xq-light span.cm-bracket {color: #cc7;}
|
||||||
|
.cm-s-xq-light span.cm-tag {color: #3F7F7F;}
|
||||||
|
.cm-s-xq-light span.cm-attribute {color: #7F007F;}
|
||||||
|
|
||||||
|
.cm-s-xq-light .CodeMirror-activeline-background {background: #e8f2ff !important;}
|
||||||
|
.cm-s-xq-light .CodeMirror-matchingbracket {outline:1px solid grey;color:black !important;background:yellow;}
|
||||||
@@ -0,0 +1,341 @@
|
|||||||
|
CodeMirror.defineMode("xml", function(config, parserConfig) {
|
||||||
|
var indentUnit = config.indentUnit;
|
||||||
|
var multilineTagIndentFactor = parserConfig.multilineTagIndentFactor || 1;
|
||||||
|
var multilineTagIndentPastTag = parserConfig.multilineTagIndentPastTag || true;
|
||||||
|
|
||||||
|
var Kludges = parserConfig.htmlMode ? {
|
||||||
|
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
|
||||||
|
'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
|
||||||
|
'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
|
||||||
|
'track': true, 'wbr': true},
|
||||||
|
implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
|
||||||
|
'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
|
||||||
|
'th': true, 'tr': true},
|
||||||
|
contextGrabbers: {
|
||||||
|
'dd': {'dd': true, 'dt': true},
|
||||||
|
'dt': {'dd': true, 'dt': true},
|
||||||
|
'li': {'li': true},
|
||||||
|
'option': {'option': true, 'optgroup': true},
|
||||||
|
'optgroup': {'optgroup': true},
|
||||||
|
'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
|
||||||
|
'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
|
||||||
|
'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
|
||||||
|
'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
|
||||||
|
'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
|
||||||
|
'rp': {'rp': true, 'rt': true},
|
||||||
|
'rt': {'rp': true, 'rt': true},
|
||||||
|
'tbody': {'tbody': true, 'tfoot': true},
|
||||||
|
'td': {'td': true, 'th': true},
|
||||||
|
'tfoot': {'tbody': true},
|
||||||
|
'th': {'td': true, 'th': true},
|
||||||
|
'thead': {'tbody': true, 'tfoot': true},
|
||||||
|
'tr': {'tr': true}
|
||||||
|
},
|
||||||
|
doNotIndent: {"pre": true},
|
||||||
|
allowUnquoted: true,
|
||||||
|
allowMissing: true
|
||||||
|
} : {
|
||||||
|
autoSelfClosers: {},
|
||||||
|
implicitlyClosed: {},
|
||||||
|
contextGrabbers: {},
|
||||||
|
doNotIndent: {},
|
||||||
|
allowUnquoted: false,
|
||||||
|
allowMissing: false
|
||||||
|
};
|
||||||
|
var alignCDATA = parserConfig.alignCDATA;
|
||||||
|
|
||||||
|
// Return variables for tokenizers
|
||||||
|
var tagName, type;
|
||||||
|
|
||||||
|
function inText(stream, state) {
|
||||||
|
function chain(parser) {
|
||||||
|
state.tokenize = parser;
|
||||||
|
return parser(stream, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
var ch = stream.next();
|
||||||
|
if (ch == "<") {
|
||||||
|
if (stream.eat("!")) {
|
||||||
|
if (stream.eat("[")) {
|
||||||
|
if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
|
||||||
|
else return null;
|
||||||
|
} else if (stream.match("--")) {
|
||||||
|
return chain(inBlock("comment", "-->"));
|
||||||
|
} else if (stream.match("DOCTYPE", true, true)) {
|
||||||
|
stream.eatWhile(/[\w\._\-]/);
|
||||||
|
return chain(doctype(1));
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else if (stream.eat("?")) {
|
||||||
|
stream.eatWhile(/[\w\._\-]/);
|
||||||
|
state.tokenize = inBlock("meta", "?>");
|
||||||
|
return "meta";
|
||||||
|
} else {
|
||||||
|
var isClose = stream.eat("/");
|
||||||
|
tagName = "";
|
||||||
|
var c;
|
||||||
|
while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
|
||||||
|
if (!tagName) return "error";
|
||||||
|
type = isClose ? "closeTag" : "openTag";
|
||||||
|
state.tokenize = inTag;
|
||||||
|
return "tag";
|
||||||
|
}
|
||||||
|
} else if (ch == "&") {
|
||||||
|
var ok;
|
||||||
|
if (stream.eat("#")) {
|
||||||
|
if (stream.eat("x")) {
|
||||||
|
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
|
||||||
|
} else {
|
||||||
|
ok = stream.eatWhile(/[\d]/) && stream.eat(";");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
|
||||||
|
}
|
||||||
|
return ok ? "atom" : "error";
|
||||||
|
} else {
|
||||||
|
stream.eatWhile(/[^&<]/);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function inTag(stream, state) {
|
||||||
|
var ch = stream.next();
|
||||||
|
if (ch == ">" || (ch == "/" && stream.eat(">"))) {
|
||||||
|
state.tokenize = inText;
|
||||||
|
type = ch == ">" ? "endTag" : "selfcloseTag";
|
||||||
|
return "tag";
|
||||||
|
} else if (ch == "=") {
|
||||||
|
type = "equals";
|
||||||
|
return null;
|
||||||
|
} else if (ch == "<") {
|
||||||
|
return "error";
|
||||||
|
} else if (/[\'\"]/.test(ch)) {
|
||||||
|
state.tokenize = inAttribute(ch);
|
||||||
|
state.stringStartCol = stream.column();
|
||||||
|
return state.tokenize(stream, state);
|
||||||
|
} else {
|
||||||
|
stream.eatWhile(/[^\s\u00a0=<>\"\']/);
|
||||||
|
return "word";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function inAttribute(quote) {
|
||||||
|
var closure = function(stream, state) {
|
||||||
|
while (!stream.eol()) {
|
||||||
|
if (stream.next() == quote) {
|
||||||
|
state.tokenize = inTag;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "string";
|
||||||
|
};
|
||||||
|
closure.isInAttribute = true;
|
||||||
|
return closure;
|
||||||
|
}
|
||||||
|
|
||||||
|
function inBlock(style, terminator) {
|
||||||
|
return function(stream, state) {
|
||||||
|
while (!stream.eol()) {
|
||||||
|
if (stream.match(terminator)) {
|
||||||
|
state.tokenize = inText;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
stream.next();
|
||||||
|
}
|
||||||
|
return style;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function doctype(depth) {
|
||||||
|
return function(stream, state) {
|
||||||
|
var ch;
|
||||||
|
while ((ch = stream.next()) != null) {
|
||||||
|
if (ch == "<") {
|
||||||
|
state.tokenize = doctype(depth + 1);
|
||||||
|
return state.tokenize(stream, state);
|
||||||
|
} else if (ch == ">") {
|
||||||
|
if (depth == 1) {
|
||||||
|
state.tokenize = inText;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
state.tokenize = doctype(depth - 1);
|
||||||
|
return state.tokenize(stream, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "meta";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var curState, curStream, setStyle;
|
||||||
|
function pass() {
|
||||||
|
for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
|
||||||
|
}
|
||||||
|
function cont() {
|
||||||
|
pass.apply(null, arguments);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pushContext(tagName, startOfLine) {
|
||||||
|
var noIndent = Kludges.doNotIndent.hasOwnProperty(tagName) || (curState.context && curState.context.noIndent);
|
||||||
|
curState.context = {
|
||||||
|
prev: curState.context,
|
||||||
|
tagName: tagName,
|
||||||
|
indent: curState.indented,
|
||||||
|
startOfLine: startOfLine,
|
||||||
|
noIndent: noIndent
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function popContext() {
|
||||||
|
if (curState.context) curState.context = curState.context.prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
function element(type) {
|
||||||
|
if (type == "openTag") {
|
||||||
|
curState.tagName = tagName;
|
||||||
|
curState.tagStart = curStream.column();
|
||||||
|
return cont(attributes, endtag(curState.startOfLine));
|
||||||
|
} else if (type == "closeTag") {
|
||||||
|
var err = false;
|
||||||
|
if (curState.context) {
|
||||||
|
if (curState.context.tagName != tagName) {
|
||||||
|
if (Kludges.implicitlyClosed.hasOwnProperty(curState.context.tagName.toLowerCase())) {
|
||||||
|
popContext();
|
||||||
|
}
|
||||||
|
err = !curState.context || curState.context.tagName != tagName;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
err = true;
|
||||||
|
}
|
||||||
|
if (err) setStyle = "error";
|
||||||
|
return cont(endclosetag(err));
|
||||||
|
}
|
||||||
|
return cont();
|
||||||
|
}
|
||||||
|
function endtag(startOfLine) {
|
||||||
|
return function(type) {
|
||||||
|
var tagName = curState.tagName;
|
||||||
|
curState.tagName = curState.tagStart = null;
|
||||||
|
if (type == "selfcloseTag" ||
|
||||||
|
(type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(tagName.toLowerCase()))) {
|
||||||
|
maybePopContext(tagName.toLowerCase());
|
||||||
|
return cont();
|
||||||
|
}
|
||||||
|
if (type == "endTag") {
|
||||||
|
maybePopContext(tagName.toLowerCase());
|
||||||
|
pushContext(tagName, startOfLine);
|
||||||
|
return cont();
|
||||||
|
}
|
||||||
|
return cont();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function endclosetag(err) {
|
||||||
|
return function(type) {
|
||||||
|
if (err) setStyle = "error";
|
||||||
|
if (type == "endTag") { popContext(); return cont(); }
|
||||||
|
setStyle = "error";
|
||||||
|
return cont(arguments.callee);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function maybePopContext(nextTagName) {
|
||||||
|
var parentTagName;
|
||||||
|
while (true) {
|
||||||
|
if (!curState.context) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
parentTagName = curState.context.tagName.toLowerCase();
|
||||||
|
if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) ||
|
||||||
|
!Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
popContext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function attributes(type) {
|
||||||
|
if (type == "word") {setStyle = "attribute"; return cont(attribute, attributes);}
|
||||||
|
if (type == "endTag" || type == "selfcloseTag") return pass();
|
||||||
|
setStyle = "error";
|
||||||
|
return cont(attributes);
|
||||||
|
}
|
||||||
|
function attribute(type) {
|
||||||
|
if (type == "equals") return cont(attvalue, attributes);
|
||||||
|
if (!Kludges.allowMissing) setStyle = "error";
|
||||||
|
else if (type == "word") {setStyle = "attribute"; return cont(attribute, attributes);}
|
||||||
|
return (type == "endTag" || type == "selfcloseTag") ? pass() : cont();
|
||||||
|
}
|
||||||
|
function attvalue(type) {
|
||||||
|
if (type == "string") return cont(attvaluemaybe);
|
||||||
|
if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return cont();}
|
||||||
|
setStyle = "error";
|
||||||
|
return (type == "endTag" || type == "selfCloseTag") ? pass() : cont();
|
||||||
|
}
|
||||||
|
function attvaluemaybe(type) {
|
||||||
|
if (type == "string") return cont(attvaluemaybe);
|
||||||
|
else return pass();
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
startState: function() {
|
||||||
|
return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, tagStart: null, context: null};
|
||||||
|
},
|
||||||
|
|
||||||
|
token: function(stream, state) {
|
||||||
|
if (!state.tagName && stream.sol()) {
|
||||||
|
state.startOfLine = true;
|
||||||
|
state.indented = stream.indentation();
|
||||||
|
}
|
||||||
|
if (stream.eatSpace()) return null;
|
||||||
|
|
||||||
|
setStyle = type = tagName = null;
|
||||||
|
var style = state.tokenize(stream, state);
|
||||||
|
state.type = type;
|
||||||
|
if ((style || type) && style != "comment") {
|
||||||
|
curState = state; curStream = stream;
|
||||||
|
while (true) {
|
||||||
|
var comb = state.cc.pop() || element;
|
||||||
|
if (comb(type || style)) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
state.startOfLine = false;
|
||||||
|
return setStyle || style;
|
||||||
|
},
|
||||||
|
|
||||||
|
indent: function(state, textAfter, fullLine) {
|
||||||
|
var context = state.context;
|
||||||
|
// Indent multi-line strings (e.g. css).
|
||||||
|
if (state.tokenize.isInAttribute) {
|
||||||
|
return state.stringStartCol + 1;
|
||||||
|
}
|
||||||
|
if ((state.tokenize != inTag && state.tokenize != inText) ||
|
||||||
|
context && context.noIndent)
|
||||||
|
return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
|
||||||
|
// Indent the starts of attribute names.
|
||||||
|
if (state.tagName) {
|
||||||
|
if (multilineTagIndentPastTag)
|
||||||
|
return state.tagStart + state.tagName.length + 2;
|
||||||
|
else
|
||||||
|
return state.tagStart + indentUnit * multilineTagIndentFactor;
|
||||||
|
}
|
||||||
|
if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
|
||||||
|
if (context && /^<\//.test(textAfter))
|
||||||
|
context = context.prev;
|
||||||
|
while (context && !context.startOfLine)
|
||||||
|
context = context.prev;
|
||||||
|
if (context) return context.indent + indentUnit;
|
||||||
|
else return 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
electricChars: "/",
|
||||||
|
blockCommentStart: "<!--",
|
||||||
|
blockCommentEnd: "-->",
|
||||||
|
|
||||||
|
configuration: parserConfig.htmlMode ? "html" : "xml",
|
||||||
|
helperType: parserConfig.htmlMode ? "html" : "xml"
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
CodeMirror.defineMIME("text/xml", "xml");
|
||||||
|
CodeMirror.defineMIME("application/xml", "xml");
|
||||||
|
if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
|
||||||
|
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
var storage, fail, uid;
|
||||||
|
try {
|
||||||
|
uid = new Date; (storage = window.localStorage).setItem(uid, uid);
|
||||||
|
fail = storage.getItem(uid) != uid;
|
||||||
|
storage.removeItem(uid);
|
||||||
|
fail && (storage = false);
|
||||||
|
} catch(e) {}
|
||||||
|
if (storage) {
|
||||||
|
try {
|
||||||
|
var usedSkin = localStorage.getItem('config-skin');
|
||||||
|
if (usedSkin != '' && usedSkin != null) {
|
||||||
|
document.body.className = usedSkin;
|
||||||
|
} else {
|
||||||
|
document.body.className = 'theme-whbl';
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
document.body.className = 'theme-whbl';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
document.body.className = 'theme-whbl';
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box no-header clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<!-- 标题栏 -->
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th align="right">名称</th>
|
||||||
|
<th>信息</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="info" id="item"}
|
||||||
|
<tr>
|
||||||
|
<td align="right">{$key}:</td>
|
||||||
|
<td>{$item}</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box no-header clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<!-- 标题栏 -->
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a class="btn btn-primary" id="action_add" href="{:url('add')}">新 增</a>
|
||||||
|
<button class="btn btn-success ajax-post" target-form="ids" url="{:url('setstatus?status=1')}" >启 用</button>
|
||||||
|
<button class="btn btn-default ajax-post" target-form="ids" url="{:url('setstatus?status=0')}">禁 用</button>
|
||||||
|
<button class="btn btn-danger ajax-post confirm" target-form="ids" url="{:url('del')}">删 除</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<!-- 数据列表 -->
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="row-selected row-selected">
|
||||||
|
<input class="check-all" type="checkbox"/>
|
||||||
|
</th>
|
||||||
|
<th class="">编号</th>
|
||||||
|
<th class="">标识</th>
|
||||||
|
<th class="">名称</th>
|
||||||
|
<th class="">类型</th>
|
||||||
|
<th class="">规则</th>
|
||||||
|
<th class="">状态</th>
|
||||||
|
<th class="">操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="list" id="vo"}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input class="ids" type="checkbox" name="ids[]" value="{$vo.id}" />
|
||||||
|
</td>
|
||||||
|
<td>{$vo.id}</td>
|
||||||
|
<td>{$vo.name}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{:url('edit?id='.$vo['id'])}">{$vo.title}</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span>{:get_action_type($vo['type'])}</span>
|
||||||
|
</td>
|
||||||
|
<td>{$vo.remark}</td>
|
||||||
|
<td>{$vo.status_text}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{:url('edit?id='.$vo['id'])}">编辑</a>
|
||||||
|
{if $vo['status']}
|
||||||
|
<a href="{:url('setstatus',array('id'=> $vo['id'],'status'=>0))}" class="ajax-get">禁用</a>
|
||||||
|
{else/}
|
||||||
|
<a href="{:url('setstatus',array('id'=> $vo['id'],'status'=>1))}" class="ajax-get">启用</a>
|
||||||
|
{/if}
|
||||||
|
<a href="{:url('del' , array('id' => $vo['id']))}" class="confirm ajax-get">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
{$page}
|
||||||
|
<!-- /分页 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box no-header clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<!-- 标题栏 -->
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a class="btn btn-warning ajax-get confirm" href="{:url('clear')}">清 空</a>
|
||||||
|
<button class="btn btn-danger ajax-post confirm" target-form="ids" url="{:url('dellog')}">删 除</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<!-- 数据列表 -->
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
|
||||||
|
<th class="">编号</th>
|
||||||
|
<th class="">行为名称</th>
|
||||||
|
<th class="">执行者</th>
|
||||||
|
<th class="">执行时间</th>
|
||||||
|
<th class="">操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="list" id="vo"}
|
||||||
|
<tr>
|
||||||
|
<td><input class="ids" type="checkbox" name="ids[]" value="{$vo['id']}" /></td>
|
||||||
|
<td>{$vo['id']} </td>
|
||||||
|
<td>{:get_action($vo['action_id'],'title')}</td>
|
||||||
|
<td>{:get_nickname($vo['user_id'])}</td>
|
||||||
|
<td><span>{$vo.create_time|time_format}</span></td>
|
||||||
|
<td><a href="{:url('detail?id='.$vo['id'])}">详细</a>
|
||||||
|
<a class="confirm ajax-get" href="{:url('dellog?id='.$vo['id'])}">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
{$page}
|
||||||
|
<!-- /分页 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
|
||||||
|
{/block}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a class="btn btn-primary" href="{:url('add')}">新 增</a>
|
||||||
|
<button class="btn btn-danger ajax-post confirm" url="{:url('del')}" target-form="ids">删 除</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="30"><input class="checkbox check-all" type="checkbox"></th>
|
||||||
|
<th width="60">ID</th>
|
||||||
|
<th width="180">名称</th>
|
||||||
|
<th width="140">标识</th>
|
||||||
|
<th width="180">创建时间</th>
|
||||||
|
<th width="180">更新时间</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="list" id="item"}
|
||||||
|
<tr>
|
||||||
|
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$item['id']}"></td>
|
||||||
|
<td>{$item['id']}</td>
|
||||||
|
<td>{$item['title']}</td>
|
||||||
|
<td>{$item['name']}</td>
|
||||||
|
<td>{$item['create_time']|date='Y-m-d H:i',###}</td>
|
||||||
|
<td>{$item['update_time']|date='Y-m-d H:i',###}</td>
|
||||||
|
<td>
|
||||||
|
<a title="广告列表" href="{:url('lists?id='.$item['id'])}">广告列表</a>
|
||||||
|
<a title="移动" href="{:url('edit?id='.$item['id'])}">编辑</a>
|
||||||
|
<a title="删除" href="{:url('del?id='.$item['id'])}" class="confirm ajax-get">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{$page}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
{block name="script"}
|
||||||
|
<script type="text/javascript" src="__PUBLIC__/js/bootstrap-editable.min.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function() {
|
||||||
|
//点击排序
|
||||||
|
$('.item_sort').click(function(){
|
||||||
|
var url = $(this).attr('url');
|
||||||
|
var ids = $('.ids:checked');
|
||||||
|
var param = '';
|
||||||
|
if(ids.length > 0){
|
||||||
|
var str = new Array();
|
||||||
|
ids.each(function(){
|
||||||
|
str.push($(this).val());
|
||||||
|
});
|
||||||
|
param = str.join(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(url != undefined && url != ''){
|
||||||
|
window.location.href = url + '/ids/' + param;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$.fn.editable.defaults.mode = 'popup';
|
||||||
|
$.fn.editableform.buttons = '<button type="submit" class="btn btn-success editable-submit btn-mini"><i class="fa fa-check-square-o fa-white"></i></button>' +
|
||||||
|
'<button type="button" class="btn editable-cancel btn-mini"><i class="fa fa-times"></i></button>';
|
||||||
|
$('.editable').editable();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
|
||||||
|
{/block}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box no-header clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a class="btn btn-success" href="{:url('addad?id='.$id)}"><i class="fa fa-plus-circle fa-lg"></i> 新 增</a>
|
||||||
|
<a class="btn btn-primary" href="{:url('index')}"><i class="fa fa-list fa-lg"></i> 广告位</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<!-- 表格列表 -->
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="30"><input class="checkbox check-all" type="checkbox"></th>
|
||||||
|
<th width="60">ID</th>
|
||||||
|
<th width="280">标题</th>
|
||||||
|
<th width="280">创建时间</th>
|
||||||
|
<th width="280">更新时间</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="list" id="item"}
|
||||||
|
<tr>
|
||||||
|
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$item.id}"></td>
|
||||||
|
<td>{$item['id']}</td>
|
||||||
|
<td>{$item['title']}</td>
|
||||||
|
<td>{$item['create_time']|date='Y-m-d H:i',###}</td>
|
||||||
|
<td>{$item['update_time']|date='Y-m-d H:i',###}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{:url('editad?id='.$item['id'])}">编辑</a>
|
||||||
|
<a href="{:url('delad?id='.$item['id'])}" class="confirm ajax-get">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<!-- /表格列表 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
|
||||||
|
{/block}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<form method="post" class="form form-horizontal">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">插件名</label>
|
||||||
|
<div class="col-lg-8 col-sm-10">
|
||||||
|
{:widget('common/Form/show',array(array('name'=>'title','title'=>'插件名','type'=>'text'),''))}
|
||||||
|
<div class="help-block">请输入插件名</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">插件标识名</label>
|
||||||
|
<div class="col-lg-8 col-sm-10">
|
||||||
|
{:widget('common/Form/show',array(array('name'=>'name','title'=>'插件标识名','type'=>'text'),''))}
|
||||||
|
<div class="help-block">请输入插件标识</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">插件版本</label>
|
||||||
|
<div class="col-lg-8 col-sm-10">
|
||||||
|
{:widget('common/Form/show',array(array('name'=>'version','title'=>'插件版本','type'=>'text'),''))}
|
||||||
|
<div class="help-block">请输入插件版本</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">插件作者</label>
|
||||||
|
<div class="col-lg-8 col-sm-10">
|
||||||
|
{:widget('common/Form/show',array(array('name'=>'author','title'=>'插件作者','type'=>'text'),''))}
|
||||||
|
<div class="help-block">请输入插件作者</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">插件描述</label>
|
||||||
|
<div class="col-lg-8 col-sm-10">
|
||||||
|
{:widget('common/Form/show',array(array('name'=>'description','title'=>'插件描述','type'=>'textarea'),''))}
|
||||||
|
<div class="help-block">请输入插件描述</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">是否启用</label>
|
||||||
|
<div class="col-lg-8 col-sm-10">
|
||||||
|
{:widget('common/Form/show',array(array('name'=>'is_open','title'=>'是否启用','type'=>'radio','option'=>array('1'=>'启用','0'=>'禁用')),''))}
|
||||||
|
<div class="help-block">请输入插件描述</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">是否需要配置</label>
|
||||||
|
<div class="col-lg-8 col-sm-10">
|
||||||
|
{:widget('common/Form/show',array(array('name'=>'has_config','title'=>'是否需要配置','type'=>'radio','option'=>array('1'=>'启用','0'=>'禁用')),''))}
|
||||||
|
<div class="help-block">请输入插件描述</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-lg-offset-2 col-lg-10">
|
||||||
|
<input type="hidden" name="id" value="{$info['id']|default=''}">
|
||||||
|
<button class="btn btn-success submit-btn ajax-post" type="submit" target-form="form-horizontal">确 定</button>
|
||||||
|
<button class="btn btn-primary submit-btn" type="button">预 览</button>
|
||||||
|
<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
{block name="script"}
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace addons\[name];
|
||||||
|
use common\controller\Addon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [title]插件
|
||||||
|
* @author [author]
|
||||||
|
*/
|
||||||
|
class [name] extends Addon{
|
||||||
|
|
||||||
|
public $info = array(
|
||||||
|
'name'=>'[name]',
|
||||||
|
'title'=>'[title]',
|
||||||
|
'description'=>'[description]',
|
||||||
|
'status'=>[status],
|
||||||
|
'author'=>'[author]',
|
||||||
|
'version'=>'[version]'
|
||||||
|
);
|
||||||
|
|
||||||
|
//插件安装
|
||||||
|
public function install(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function uninstall(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
[hook]
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
|
||||||
|
{/block}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a class="btn btn-primary" href="{:url('addhook')}">新 增</a>
|
||||||
|
<button class="btn btn-danger ajax-post confirm" url="{:url('delhook')}" target-form="ids">删 除</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><input class="checkbox check-all" type="checkbox"></th>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>名称</th>
|
||||||
|
<th>描述</th>
|
||||||
|
<th>类型</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="list" id="item"}
|
||||||
|
<tr>
|
||||||
|
<td><input class="ids row-selected" type="checkbox" name="ids[]" value="{$item['id']}"></td>
|
||||||
|
<td>{$item['id']|default=0}</td>
|
||||||
|
<td>{$item['name']}</td>
|
||||||
|
<td>{$item['description']}</td>
|
||||||
|
<td>{$item['type_text']}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{:url('edithook?id='.$item['id'])}">编辑</a>
|
||||||
|
<a href="{:url('delhook?id='.$item['id'])}" class="confirm ajax-get">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{$page}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
{block name="script"}
|
||||||
|
<script type="text/javascript" src="__PUBLIC__/js/bootstrap-editable.min.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function() {
|
||||||
|
//点击排序
|
||||||
|
$('.item_sort').click(function(){
|
||||||
|
var url = $(this).attr('url');
|
||||||
|
var ids = $('.ids:checked');
|
||||||
|
var param = '';
|
||||||
|
if(ids.length > 0){
|
||||||
|
var str = new Array();
|
||||||
|
ids.each(function(){
|
||||||
|
str.push($(this).val());
|
||||||
|
});
|
||||||
|
param = str.join(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(url != undefined && url != ''){
|
||||||
|
window.location.href = url + '/ids/' + param;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$.fn.editable.defaults.mode = 'popup';
|
||||||
|
$.fn.editableform.buttons = '<button type="submit" class="btn btn-success editable-submit btn-mini"><i class="fa fa-check-square-o fa-white"></i></button>' +
|
||||||
|
'<button type="button" class="btn editable-cancel btn-mini"><i class="fa fa-times"></i></button>';
|
||||||
|
$('.editable').editable();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
|
||||||
|
{/block}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a class="btn btn-primary" href="{:url('add')}">新 增</a>
|
||||||
|
<button class="btn btn-danger ajax-post confirm" url="{:url('del')}" target-form="ids">删 除</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><input class="checkbox check-all" type="checkbox"></th>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>名称</th>
|
||||||
|
<th>标识</th>
|
||||||
|
<th>描述</th>
|
||||||
|
<th>状态</th>
|
||||||
|
<th>作者</th>
|
||||||
|
<th>版本</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="list" id="item"}
|
||||||
|
<tr>
|
||||||
|
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$item['id']}"></td>
|
||||||
|
<td>{$item['id']|default=0}</td>
|
||||||
|
<td>{$item['title']}</td>
|
||||||
|
<td>{$item['name']}</td>
|
||||||
|
<td>{$item['description']}</td>
|
||||||
|
<td>{$item['status_text']}</td>
|
||||||
|
<td>{$item['author']}</td>
|
||||||
|
<td>{$item['version']}</td>
|
||||||
|
<td>
|
||||||
|
{if $item['uninstall']}
|
||||||
|
<a href="{:url('install?addon_name='.$item['name'])}" class="ajax-get">安装</a>
|
||||||
|
{else/}
|
||||||
|
<a href="{:url('uninstall?id='.$item['id'])}" class="confirm ajax-get">卸载</a>
|
||||||
|
{if $item['status']}
|
||||||
|
<a href="{:url('disable?id='.$item['id'])}" class="confirm ajax-get">禁用</a>
|
||||||
|
{else/}
|
||||||
|
<a href="{:url('enable?id='.$item['id'])}" class="confirm ajax-get">启用</a>
|
||||||
|
{/if}
|
||||||
|
<a href="{:url('config?id='.$item['id'])}">设置</a>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
{block name="script"}
|
||||||
|
<script type="text/javascript" src="__PUBLIC__/js/bootstrap-editable.min.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function() {
|
||||||
|
//点击排序
|
||||||
|
$('.item_sort').click(function(){
|
||||||
|
var url = $(this).attr('url');
|
||||||
|
var ids = $('.ids:checked');
|
||||||
|
var param = '';
|
||||||
|
if(ids.length > 0){
|
||||||
|
var str = new Array();
|
||||||
|
ids.each(function(){
|
||||||
|
str.push($(this).val());
|
||||||
|
});
|
||||||
|
param = str.join(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(url != undefined && url != ''){
|
||||||
|
window.location.href = url + '/ids/' + param;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$.fn.editable.defaults.mode = 'popup';
|
||||||
|
$.fn.editableform.buttons = '<button type="submit" class="btn btn-success editable-submit btn-mini"><i class="fa fa-check-square-o fa-white"></i></button>' +
|
||||||
|
'<button type="button" class="btn editable-cancel btn-mini"><i class="fa fa-times"></i></button>';
|
||||||
|
$('.editable').editable();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a class="btn btn-info" href="{:url('Model/index')}">返回</a>
|
||||||
|
<a class="btn btn-primary" href="{:url('add',array('model_id'=>$model_id))}">新 增</a>
|
||||||
|
<button class="btn btn-danger ajax-post confirm" url="{:url('del')}" target-form="ids">删 除</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><input class="checkbox check-all" type="checkbox"></th>
|
||||||
|
<th>表单标题</th>
|
||||||
|
<th>字段名</th>
|
||||||
|
<th>字段类型</th>
|
||||||
|
<th>字段长度</th>
|
||||||
|
<th>默认值</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="list" id="item"}
|
||||||
|
<tr>
|
||||||
|
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$item['id']}"></td>
|
||||||
|
<td>{$item['title']}</td>
|
||||||
|
<td>{$item['name']}</td>
|
||||||
|
<td>{$item['type_text']}</td>
|
||||||
|
<td>{$item['length']}</td>
|
||||||
|
<td>{$item['value']}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{:url('edit',array('id'=>$item['id']))}">编辑</a>
|
||||||
|
<a href="{:url('del',array('id'=>$item['id']))}" class="confirm ajax-get">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{$page}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a class="btn btn-primary" href="{:url('add')}">新 增</a>
|
||||||
|
<button class="btn btn-danger ajax-post confirm" url="{:url('del')}" target-form="ids">删 除</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="30"><input class="checkbox check-all" type="checkbox"></th>
|
||||||
|
<th width="60">ID</th>
|
||||||
|
<th width="180">名称</th>
|
||||||
|
<th width="140">书号</th>
|
||||||
|
<th width="180">创建时间</th>
|
||||||
|
<th width="180">更新时间</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="list" id="item"}
|
||||||
|
<tr>
|
||||||
|
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$item['id']}"></td>
|
||||||
|
<td>{$item['id']}</td>
|
||||||
|
<td>{$item['book_name']}</td>
|
||||||
|
<td>{$item['book_list_no']}</td>
|
||||||
|
<td>{$item['create_time']|date='Y-m-d H:i',###}</td>
|
||||||
|
<td>{$item['date_last_modify']|date='Y-m-d H:i',###}</td>
|
||||||
|
<td>
|
||||||
|
<a title="移动" href="{:url('edit?id='.$item['id'])}">编辑</a>
|
||||||
|
<a title="删除" href="{:url('del?id='.$item['id'])}" class="confirm ajax-get">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{$page}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{:isset($info['id'])?'编辑':'新增'}分类</h2>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<form action="{:url()}" method="post" class="form form-horizontal">
|
||||||
|
<div class="tabs-wrapper">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<li class="active">
|
||||||
|
<a href="#tab-base" data-toggle="tab">基 础</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="#tab-better" data-toggle="tab">高 级</a></li>
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content">
|
||||||
|
<div class="tab-pane fade in active" id="tab-base">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">上级分类</label>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<input type="hidden" name="pid" value="{$category['id']|default=0}">
|
||||||
|
<input type="text" class="form-control" disabled="disabled" value="{$category['title']|default='无'}"/>
|
||||||
|
<span class="help-block"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">分类名称</label>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<input type="text" name="title" class="form-control" value="{$info.title|default=''}">
|
||||||
|
<span class="help-block">(名称不能为空)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">分类标识</label>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<input type="text" name="name" class="form-control" value="{$info.name|default=''}">
|
||||||
|
<span class="help-block">(英文字母)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">分组定义</label>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<textarea name="groups" class="form-control">{$info.groups|default=''}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">发布内容</label>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<label class="am-radio-inline"><input type="radio" name="allow_publish" value="0">不允许</label>
|
||||||
|
<label class="am-radio-inline"><input type="radio" name="allow_publish" value="1" checked>仅允许后台</label>
|
||||||
|
<label class="am-radio-inline"><input type="radio" name="allow_publish" value="2" >允许前后台</label>
|
||||||
|
<span class="help-block">(是否允许发布内容)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">
|
||||||
|
是否审核
|
||||||
|
</label>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<label class="am-radio-inline"><input type="radio" name="check" value="0" checked>不需要</label>
|
||||||
|
<label class="am-radio-inline"><input type="radio" name="check" value="1">需要</label>
|
||||||
|
<span class="help-block">(在该分类下发布的内容是否需要审核)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">分类图标</label>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
{:widget('common/Form/show',array(array('name'=>'icon','type'=>'image'),$info))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane fade" id="tab-better">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">可见性</label>
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<select name="display" class="form-control">
|
||||||
|
<option value="1">所有人可见</option>
|
||||||
|
<option value="0">不可见</option>
|
||||||
|
<option value="2">管理员可见</option>
|
||||||
|
</select>
|
||||||
|
<span class="help-block">(是否对用户可见,针对前台)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">排序</label>
|
||||||
|
<div class="col-lg-2">
|
||||||
|
<input type="text" name="sort" class="form-control" value="{$info.sort|default=0}">
|
||||||
|
<span class="help-block">(仅对当前层级分类有效)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">列表行数</label>
|
||||||
|
<div class="col-lg-5">
|
||||||
|
<input type="text" name="list_row" class="form-control" value="{$info.list_row|default=10}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">网页标题</label>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<input type="text" name="meta_title" class="form-control" value="{$info.meta_title|default=''}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">关键字</label>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<textarea class="form-control" name="keywords">{$info.keywords|default=''}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">描述</label>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<textarea class="form-control" name="description">{$info.description|default=''}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">频道模板</label>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<input type="text" name="template_index" class="form-control" value="{$info.template_index|default=''}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">列表模板</label>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<input type="text" name="template_lists" class="form-control" value="{$info.template_lists|default=''}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">详情模板</label>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<input type="text" name="template_detail" class="form-control" value="{$info.template_detail|default=''}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">编辑模板</label>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<input type="text" name="template_edit" class="form-control" value="{$info.template_edit|default=''}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-lg-offset-2 col-lg-10">
|
||||||
|
<input type="hidden" name="id" value="{$info['id']|default=''}">
|
||||||
|
<button type="submit" class="btn btn-success submit-btn ajax-post" target-form="form">确认提交</button>
|
||||||
|
<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="script"}
|
||||||
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugs/webuploader/webuploader.css">
|
||||||
|
<script type="text/javascript" src="__PUBLIC__/plugs/webuploader/webuploader.min.js"></script>
|
||||||
|
<script type="text/javascript" src="__PUBLIC__/plugs/webuploader/webuploader.custom.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
{present name="info['id']"}
|
||||||
|
Sent.setValue("allow_publish", {$info.allow_publish|default=1});
|
||||||
|
Sent.setValue("check", {$info.check|default=0});
|
||||||
|
Sent.setValue("model[]", {$info.model|json_encode} || [1]);
|
||||||
|
Sent.setValue("model_sub[]", {$info.model_sub|json_encode} || [1]);
|
||||||
|
Sent.setValue("type[]", {$info.type|json_encode} || [2]);
|
||||||
|
Sent.setValue("display", {$info.display|default=1});
|
||||||
|
Sent.setValue("reply", {$info.reply|default=0});
|
||||||
|
Sent.setValue("reply_model[]", {$info.reply_model|json_encode} || [1]);
|
||||||
|
{/present}
|
||||||
|
$(function(){
|
||||||
|
$("input[name=reply]").change(function(){
|
||||||
|
var $reply = $(".form-group.reply");
|
||||||
|
parseInt(this.value) ? $reply.show() : $reply.hide();
|
||||||
|
}).filter(":checked").change();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
|
||||||
|
{/block}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box no-header clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a class="btn btn-primary" href="{:url('add')}"><i class="fa fa-plus-circle fa-lg"></i> 新 增</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<!-- 表格列表 -->
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="30"><input class="checkbox check-all" type="checkbox"></th>
|
||||||
|
<th width="60">ID</th>
|
||||||
|
<th>名称</th>
|
||||||
|
<th width="120">排序</th>
|
||||||
|
<th width="120">发布</th>
|
||||||
|
<th width="120">状态</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="tree" id="list"}
|
||||||
|
<tr>
|
||||||
|
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$list.id}"></td>
|
||||||
|
<td>{$list['id']}</td>
|
||||||
|
<td>
|
||||||
|
{$list['level_show']}
|
||||||
|
<a href="#" class="editable editable-click" data-id="{$list['id']}" data-name="title" data-type="text" data-pk="{$list['id']}" data-url="{:url('editable')}">{$list['title']}</a>
|
||||||
|
<a class="add-sub-cate" title="添加子分类" href="{:url('add?pid='.$list['id'])}">
|
||||||
|
<i class="fa fa-plus-square"></i>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td><a href="#" class="editable editable-click" data-id="{$list['id']}" data-name="sort" data-type="text" data-pk="{$list['id']}" data-url="{:url('editable')}">{$list['sort']}</a></td>
|
||||||
|
<td>{$list['allow_publish']?'是':'否'}</td>
|
||||||
|
<td>
|
||||||
|
{if $list['status']}
|
||||||
|
<span class="label label-primary">启用</span>
|
||||||
|
{else/}
|
||||||
|
<span class="label label-danger">禁用</span>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a title="编辑" href="{:url('edit?id='.$list['id'].'&pid='.$list['pid'])}">编辑</a>
|
||||||
|
{if $list['status']}
|
||||||
|
<a href="{:url('status?id='.$list['id'].'&status=0')}" class="ajax-get">禁用</a>
|
||||||
|
{else/}
|
||||||
|
<a href="{:url('status?id='.$list['id'].'&status=1')}" class="ajax-get">启用</a>
|
||||||
|
{/if}
|
||||||
|
<a title="删除" href="{:url('remove?id='.$list['id'])}" class="confirm ajax-get">删除</a>
|
||||||
|
<a title="移动" href="{:url('operate?type=move&from='.$list['id'])}">移动</a>
|
||||||
|
<a title="合并" href="{:url('operate?type=merge&from='.$list['id'])}">合并</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<!-- /表格列表 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
{block name="script"}
|
||||||
|
<script type="text/javascript" src="__PUBLIC__/js/bootstrap-editable.min.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$.fn.editable.defaults.mode = 'popup';
|
||||||
|
$.fn.editableform.buttons = '<button type="submit" class="btn btn-success editable-submit btn-mini"><i class="fa fa-check-square-o fa-white"></i></button>' +
|
||||||
|
'<button type="button" class="btn editable-cancel btn-mini"><i class="fa fa-times"></i></button>';
|
||||||
|
$('.editable').editable();
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$operate}分类</h2>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<form action="{:url($type)}" method="post" class="form form-horizontal">
|
||||||
|
<div id="tab1" class="tab-pane in tab1">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">目标分类</label>
|
||||||
|
<div class="col-lg-5">
|
||||||
|
<select name="to" class="form-control">
|
||||||
|
{volist name="list" id="vo"}
|
||||||
|
<option value="{$vo.id}">{$vo.title}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
<span class="help-block">(将{$operate}至的分类)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-lg-offset-2 col-lg-10">
|
||||||
|
<input type="hidden" name="from" value="{$from}">
|
||||||
|
<button type="submit" class="btn btn-success submit-btn ajax-post" target-form="form">确认提交</button>
|
||||||
|
<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>
|
||||||
|
{$info['id']?'编辑':'新增'}导航
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<form method="post" class="form form-horizontal">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">导航标题</label>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<input type="text" class="form-control" name="title" value="{$info.title|default=''}">
|
||||||
|
<span class="help-block">(用于显示的文字)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">当前标识</label>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<input type="text" class="form-control" name="active" value="{$info.active|default=''}">
|
||||||
|
<span class="help-block">(当前标识)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">导航连接</label>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<input type="text" class="form-control" name="url" value="{$info.url|default=''}">
|
||||||
|
<span class="help-block">(用于调转的URL,支持带http://的URL或U函数参数格式)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">父导航</label>
|
||||||
|
<div class="col-lg-5">
|
||||||
|
<select name="pid" class="form-control" style="width:auto;">
|
||||||
|
<option value="0">--一级导航--</option>
|
||||||
|
{volist name=":parse_field_bind('Channel',$info['pid'],'')" id="item"}
|
||||||
|
{if condition="$item['id'] neq $info['id']"}
|
||||||
|
<option value="{$item['id']}" {if condition="$pid eq $item['id']"}selected{/if}>{$item['title_show']}</option>
|
||||||
|
{/if}
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">新窗口打开</label>
|
||||||
|
<div class="col-lg-2">
|
||||||
|
<select name="target" class="form-control" style="width:auto;">
|
||||||
|
<option value="0" >否</option>
|
||||||
|
<option value="1" {eq name="info.target" value="1"}selected{/eq}>是
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<span class="help-block">(是否新窗口打开链接)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">图标</label>
|
||||||
|
<div class="col-lg-2">
|
||||||
|
<input type="text" class="form-control" name="icon" value="{$info.icon|default=''}">
|
||||||
|
<span class="help-block">输入图标英文</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">优先级</label>
|
||||||
|
<div class="col-lg-2">
|
||||||
|
<input type="text" class="form-control" name="sort" value="{$info.sort|default='1'}">
|
||||||
|
<span class="help-block">(导航显示顺序)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">文字颜色</label>
|
||||||
|
<div class="col-lg-2">
|
||||||
|
<input type="text" class="form-control" name="color" value="{$info['color']|default=''}">
|
||||||
|
<span class="help-block">(右上角的标志点颜色,支持各类css表示方式)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">标志点颜色</label>
|
||||||
|
<div class="col-lg-2">
|
||||||
|
<input type="text" class="form-control" name="band_color" value="{$info['band_color']|default=''}">
|
||||||
|
<span class="help-block">(右上角的标志点颜色,支持各类css表示方式)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">标志点文字</label>
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<input type="text" class="form-control" name="band_text" value="{$info['band_text']|default=''}">
|
||||||
|
<span class="help-block">(右上角的标志点文字,不要太长,没有自动隐藏)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-lg-offset-2 col-lg-10">
|
||||||
|
<input type="hidden" name="id" value="{$info.id|default=''}">
|
||||||
|
<button class="btn btn-success submit-btn ajax-post" type="submit" target-form="form-horizontal">确 定</button>
|
||||||
|
<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
|
||||||
|
{/block}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a class="btn btn-primary" href="{:url('add','pid='.$pid)}">新 增</a>
|
||||||
|
<button class="btn btn-danger ajax-post confirm" url="{:url('del')}" target-form="ids">删 除</button>
|
||||||
|
<button class="btn btn-success list_sort" url="{:url('sort',array('pid'=>input('get.pid',0)),'')}">排序</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="30"><input class="checkbox check-all" type="checkbox"></th>
|
||||||
|
<th width="60">ID</th>
|
||||||
|
<th>名称</th>
|
||||||
|
<th>URL</th>
|
||||||
|
<th width="120">排序</th>
|
||||||
|
<th>状态</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="tree" id="list"}
|
||||||
|
<tr>
|
||||||
|
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$list.id}"></td>
|
||||||
|
<td>{$list['id']}</td>
|
||||||
|
<td>
|
||||||
|
{$list['level_show']}
|
||||||
|
<a href="#" class="editable editable-click" data-id="{$list['id']}" data-name="title" data-type="text" data-pk="{$list['id']}" data-url="{:url('editable')}">{$list['title']} </a>
|
||||||
|
<a class="add-sub-cate" title="添加子分类" href="{:url('add?pid='.$list['id'])}">
|
||||||
|
<i class="fa fa-plus-square"></i>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>{$list['url']}</td>
|
||||||
|
<td><a href="#" class="editable editable-click" data-id="{$list['id']}" data-name="sort" data-type="text" data-pk="{$list['id']}" data-url="{:url('editable')}">{$list['sort']}</a></td>
|
||||||
|
<td>
|
||||||
|
{if $list['status']}
|
||||||
|
<span class="label label-primary">{$list.status|get_status_title}</span>
|
||||||
|
{else/}
|
||||||
|
<span class="label label-danger">{$list.status|get_status_title}</span>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a title="编辑" href="{:url('edit?id='.$list['id'].'&pid='.$list['pid'])}">编辑</a>
|
||||||
|
<a title="{$list.status|show_status_op}" href="{:url('setStatus?ids='.$list['id'].'&status='.abs(1-$list['status']))}" class="ajax-get">{$list.status|show_status_op}</a>
|
||||||
|
<a title="删除" href="{:url('del?id='.$list['id'])}" class="confirm ajax-get">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="script"}
|
||||||
|
<script type="text/javascript" src="__PUBLIC__/js/bootstrap-editable.min.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function() {
|
||||||
|
//点击排序
|
||||||
|
$('.list_sort').click(function(){
|
||||||
|
var url = $(this).attr('url');
|
||||||
|
var ids = $('.ids:checked');
|
||||||
|
var param = '';
|
||||||
|
if(ids.length > 0){
|
||||||
|
var str = new Array();
|
||||||
|
ids.each(function(){
|
||||||
|
str.push($(this).val());
|
||||||
|
});
|
||||||
|
param = str.join(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(url != undefined && url != ''){
|
||||||
|
window.location.href = url + '/ids/' + param;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$.fn.editable.defaults.mode = 'popup';
|
||||||
|
$.fn.editableform.buttons = '<button type="submit" class="btn btn-success editable-submit btn-mini"><i class="fa fa-check-square-o fa-white"></i></button>' +
|
||||||
|
'<button type="button" class="btn editable-cancel btn-mini"><i class="fa fa-times"></i></button>';
|
||||||
|
$('.editable').editable();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>菜单排序 [ <a href="{:url('index',array('pid'=>input('pid')))}">返回列表</a> ]</h2>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<form action="{:url('sort')}" method="post" class="form form-horizontal">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-lg-2">
|
||||||
|
<select value="" size="8" class="form-control">
|
||||||
|
{volist name="list" id="vo"}
|
||||||
|
<option class="ids" title="{$vo.title}" value="{$vo.id}">{$vo.title}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-2">
|
||||||
|
<button class="top btn btn-primary btn-block" type="button"><i class="fa fa-arrow-up"></i> 第 一</button>
|
||||||
|
<button class="up btn btn-primary btn-block" type="button"><i class="fa fa-chevron-up"></i> 上 移</button>
|
||||||
|
<button class="down btn btn-primary btn-block" type="button"><i class="fa fa-chevron-down"></i> 下 移</button>
|
||||||
|
<button class="bottom btn btn-primary btn-block" type="button"><i class="fa fa-arrow-down"></i> 最 后</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sort_bottom form-group">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<input type="hidden" name="ids">
|
||||||
|
<button class="sort_confirm btn btn-primary submit-btn" type="button">确 定</button>
|
||||||
|
<button class="sort_cancel btn btn-dafault btn-return" type="button" url="{$Think.cookie.__forward__}">返 回</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="script"}
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
sort();
|
||||||
|
$(".top").click(function(){
|
||||||
|
rest();
|
||||||
|
$("option:selected").prependTo("select");
|
||||||
|
sort();
|
||||||
|
})
|
||||||
|
$(".bottom").click(function(){
|
||||||
|
rest();
|
||||||
|
$("option:selected").appendTo("select");
|
||||||
|
sort();
|
||||||
|
})
|
||||||
|
$(".up").click(function(){
|
||||||
|
rest();
|
||||||
|
$("option:selected").after($("option:selected").prev());
|
||||||
|
sort();
|
||||||
|
})
|
||||||
|
$(".down").click(function(){
|
||||||
|
rest();
|
||||||
|
$("option:selected").before($("option:selected").next());
|
||||||
|
sort();
|
||||||
|
})
|
||||||
|
$(".search").click(function(){
|
||||||
|
var v = $("input").val();
|
||||||
|
$("option:contains("+v+")").attr('selected','selected');
|
||||||
|
})
|
||||||
|
function sort(){
|
||||||
|
$('option').text(function(){return ($(this).index()+1)+'.'+$(this).text()});
|
||||||
|
}
|
||||||
|
|
||||||
|
//重置所有option文字。
|
||||||
|
function rest(){
|
||||||
|
$('option').text(function(){
|
||||||
|
return $(this).text().split('.')[1]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取排序并提交
|
||||||
|
$('.sort_confirm').click(function(){
|
||||||
|
var arr = new Array();
|
||||||
|
$('.ids').each(function(){
|
||||||
|
arr.push($(this).val());
|
||||||
|
});
|
||||||
|
$('input[name=ids]').val(arr.join(','));
|
||||||
|
$.post(
|
||||||
|
$('form').attr('action'),
|
||||||
|
{
|
||||||
|
'ids' : arr.join(',')
|
||||||
|
},
|
||||||
|
function(data){
|
||||||
|
if (data.code) {
|
||||||
|
updateAlert(data.msg + ' 页面即将自动跳转~','alert-success');
|
||||||
|
}else{
|
||||||
|
updateAlert(data.msg,'alert-success');
|
||||||
|
}
|
||||||
|
setTimeout(function(){
|
||||||
|
if (data.code) {
|
||||||
|
$('.sort_cancel').click();
|
||||||
|
}
|
||||||
|
},1500);
|
||||||
|
},
|
||||||
|
'json'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
//点击取消按钮
|
||||||
|
$('.sort_cancel').click(function(){
|
||||||
|
window.location.href = $(this).attr('url');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="body"}
|
||||||
|
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>配置管理</h2>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<form method="post" class="form form-horizontal">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">配置标识</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<input type="text" class="form-control" style="width: 400px" name="name" value="{$info.name|default=''}">
|
||||||
|
<span class="help-block">(用于config函数调用,只能使用英文且不能重复)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">配置标题</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<input type="text" class="form-control" style="width:400px;" name="title" value="{$info.title|default=''}">
|
||||||
|
<span class="help-block">(用于后台显示的配置标题)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">排序</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<input type="text" class="form-control" style="width: 400px" name="sort" value="{$info.sort|default=0}">
|
||||||
|
<span class="help-block">(用于分组显示的顺序)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">配置类型</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<select name="type" class="form-control" style="width:auto;">
|
||||||
|
{volist name=":config('config_type_list')" id="type"}
|
||||||
|
<option value="{$key}" {eq name="key" value="$info['type']"}selected{/eq}>{$type}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
<span class="help-block">(系统会根据不同类型解析配置值)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">配置分组</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<select name="group" class="form-control" style="width: auto">
|
||||||
|
<option value="0">不分组</option>
|
||||||
|
{volist name=":config('config_group_list')" id="group"}
|
||||||
|
<option value="{$key}" {eq name="key" value="$info['group']"}selected{/eq}>{$group}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
<span class="help-block">(配置分组 用于批量设置 不分组则不会显示在系统设置中)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">配置值</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<textarea name="value" class="form-control" style="width: 80%;height: 120px">{$info.value|default=''}</textarea>
|
||||||
|
<span class="help-block">(配置值)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">配置项</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<textarea name="extra" class="form-control" style="width: 80%;height: 120px">{$info.extra|default=''}</textarea>
|
||||||
|
<span class="help-block">(如果是枚举型 需要配置该项)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-lg-2 control-label">说明</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<textarea name="remark" class="form-control" style="width: 80%;height: 120px">{$info.remark|default=''}</textarea>
|
||||||
|
<span class="help-block">(配置详细说明)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-lg-offset-2 col-lg-10">
|
||||||
|
<input type="hidden" name="id" value="{$info.id|default=''}">
|
||||||
|
<button class="btn btn-success submit-btn ajax-post" type="submit" target-form="form-horizontal">确 定</button>
|
||||||
|
<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="body"}
|
||||||
|
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>配置管理</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a href="{:url('Config/index')}" class="btn btn-primary">
|
||||||
|
<i class="fa fa-list"></i>
|
||||||
|
配置列表
|
||||||
|
</a>
|
||||||
|
<a href="{:url('Config/add')}" class="btn btn-danger">
|
||||||
|
<i class="fa fa-list"></i>
|
||||||
|
添加配置
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<div class="tabs-wrapper">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
{volist name=":config('config_group_list')" id="item"}
|
||||||
|
<li {if condition="$key eq $id"}class="active"{/if}>
|
||||||
|
<a href="{:url('Config/group',array('id'=>$key))}">{$item}</a>
|
||||||
|
</li>
|
||||||
|
{/volist}
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content">
|
||||||
|
<div class="tab-pane fade in active" id="tab-home">
|
||||||
|
<form method="post" class="form form-horizontal" role="form">
|
||||||
|
{volist name="list" id="item"}
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="inputEmail1" class="col-lg-2 control-label">{$item['title']}</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
{switch name="item['type']"}
|
||||||
|
{case value="text"}
|
||||||
|
<input type="text" class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" value="{$item['value']}" placeholder="{$item['title']}" style="width:50%;">
|
||||||
|
{/case}
|
||||||
|
{case value="num"}
|
||||||
|
<input type="text" class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" value="{$item['value']}" placeholder="{$item['title']}" style="width:30%;">
|
||||||
|
{/case}
|
||||||
|
{case value="string"}
|
||||||
|
<input type="text" class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" value="{$item['value']}" placeholder="{$item['title']}" style="width:80%;">
|
||||||
|
{/case}
|
||||||
|
{case value="textarea"}
|
||||||
|
<textarea class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" style="width:80%; height:120px;">{$item['value']}</textarea>
|
||||||
|
{/case}
|
||||||
|
{case value="select"}
|
||||||
|
<select class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" style="width:auto;">
|
||||||
|
{volist name=":parse_config_attr($item['extra'])" id="vo"}
|
||||||
|
<option value="{$key}" {eq name="item['value']" value="$key"}selected{/eq}>{$vo}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
{/case}
|
||||||
|
{case value="bool"}
|
||||||
|
<select class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" style="width:auto;">
|
||||||
|
{volist name=":parse_config_attr($item['extra'])" id="vo"}
|
||||||
|
<option value="{$key}" {eq name="item['value']" value="$key"}selected{/eq}>{$vo}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
{/case}
|
||||||
|
{/switch}
|
||||||
|
{if condition="$item['remark']"}
|
||||||
|
<span class="help-block">({$item['remark']})</span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/volist}
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-lg-offset-2 col-lg-10">
|
||||||
|
<button type="submit" class="btn btn-success submit-btn ajax-post" target-form="form">确认提交</button>
|
||||||
|
<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>网站设置</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a href="{:url('Config/group')}" class="btn btn-danger">
|
||||||
|
<i class="fa fa-list"></i>
|
||||||
|
配置管理
|
||||||
|
</a>
|
||||||
|
<a href="{:url('Config/add')}" class="btn btn-danger">
|
||||||
|
<i class="fa fa-plus"></i>
|
||||||
|
添加配置
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<div class="tabs-wrapper">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<li {if condition="!isset($_GET['group'])"}class="active"{/if}><a href="{:url('index')}">全部</a></li>
|
||||||
|
{volist name="group" id="item"}
|
||||||
|
<li {if condition="$group_id eq $key"}class="active"{/if}>
|
||||||
|
<a href="{:url('index?group='.$key)}">{$item}</a>
|
||||||
|
</li>
|
||||||
|
{/volist}
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content">
|
||||||
|
<div class="tab-pane fade in active">
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="row-selected">
|
||||||
|
<input class="checkbox check-all" type="checkbox">
|
||||||
|
</th>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>名称</th>
|
||||||
|
<th>标题</th>
|
||||||
|
<th>分组</th>
|
||||||
|
<th>类型</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{notempty name="list"}
|
||||||
|
{volist name="list" id="config"}
|
||||||
|
<tr>
|
||||||
|
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$config.id}"></td>
|
||||||
|
<td>{$config.id}</td>
|
||||||
|
<td><a href="{:url('edit?id='.$config['id'])}">{$config.name}</a></td>
|
||||||
|
<td>{$config.title}</td>
|
||||||
|
<td>{$group[$config['group']]|default=''}</td>
|
||||||
|
<td>{$config['type_text']}</td>
|
||||||
|
<td>
|
||||||
|
<a title="编辑" href="{:url('edit?id='.$config['id'])}">编辑</a>
|
||||||
|
<a class="confirm ajax-get" title="删除" href="{:url('del?id='.$config['id'])}">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
{else/}
|
||||||
|
<td colspan="7" class="text-center"> aOh! 暂时还没有内容!</td>
|
||||||
|
{/notempty}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{$page}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/block}
|
||||||
|
{block name="script"}
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function () {
|
||||||
|
//搜索功能
|
||||||
|
$("#search").click(function () {
|
||||||
|
var url = $(this).attr('url');
|
||||||
|
var query = $('.search-form').find('input').serialize();
|
||||||
|
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
|
||||||
|
query = query.replace(/^&/g, '');
|
||||||
|
if (url.indexOf('?') > 0) {
|
||||||
|
url += '&' + query;
|
||||||
|
} else {
|
||||||
|
url += '?' + query;
|
||||||
|
}
|
||||||
|
window.location.href = url;
|
||||||
|
});
|
||||||
|
//回车搜索
|
||||||
|
$(".search-input").keyup(function (e) {
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
$("#search").click();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//点击排序
|
||||||
|
$('.list_sort').click(function () {
|
||||||
|
var url = $(this).attr('url');
|
||||||
|
var ids = $('.ids:checked');
|
||||||
|
var param = '';
|
||||||
|
if (ids.length > 0) {
|
||||||
|
var str = new Array();
|
||||||
|
ids.each(function () {
|
||||||
|
str.push($(this).val());
|
||||||
|
});
|
||||||
|
param = str.join(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (url != undefined && url != '') {
|
||||||
|
window.location.href = url + '/ids/' + param;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a class="btn btn-primary" href="{:url('admin/content/add?model_id='.$model_id)}">新 增</a>
|
||||||
|
<button class="btn btn-danger ajax-post confirm" url="{:url('admin/content/del?model_id='.$model_id)}" target-form="ids">删 除</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="30"><input class="checkbox check-all" type="checkbox"></th>
|
||||||
|
{volist name="grid['grids']" id="item"}
|
||||||
|
<th>{$item['title']}</th>
|
||||||
|
{/volist}
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{if condition="empty($list)"}
|
||||||
|
{php}
|
||||||
|
$cow = count($grid['grids'])+2;
|
||||||
|
{/php}
|
||||||
|
<tr>
|
||||||
|
<td colspan="{$cow}" align="center">暂无数据!</td>
|
||||||
|
</tr>
|
||||||
|
{else/}
|
||||||
|
{volist name="list" id="item"}
|
||||||
|
<tr>
|
||||||
|
<td><input class="ids row-selected" type="checkbox" name="ids[]" value="{$item['id']}"></td>
|
||||||
|
{volist name="grid['grids']" id="vo"}
|
||||||
|
{if isset($vo['format'])}
|
||||||
|
<td>{$item[$vo['field'][0]]|$vo['format']}</td>
|
||||||
|
{else/}
|
||||||
|
<td>{$item[$vo['field'][0]]}</td>
|
||||||
|
{/if}
|
||||||
|
{/volist}
|
||||||
|
<td>
|
||||||
|
{if isset($item['status'])}
|
||||||
|
{if $item['status']}
|
||||||
|
<a href="{:url('admin/content/status',array('id'=>$item['id'],'model_id'=>$model_id,'status'=>'0'))}" class="ajax-get">取消审核</a>
|
||||||
|
{else/}
|
||||||
|
<a href="{:url('admin/content/status',array('id'=>$item['id'],'model_id'=>$model_id,'status'=>'1'))}" class="ajax-get">审核</a>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
<a href="{:url('admin/content/edit',array('id'=>$item['id'],'model_id'=>$model_id))}" >编辑</a>
|
||||||
|
<a href="{:url('admin/content/del',array('id'=>$item['id'],'model_id'=>$model_id))}" class="ajax-get confirm">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
{/if}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{$page}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<!-- 标题栏 -->
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>数据备份</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a id="export" class="btn btn-primary" href="javascript:;" autocomplete="off">立即备份</a>
|
||||||
|
<a id="optimize" class="btn btn-success" href="{:url('optimize')}">优化表</a>
|
||||||
|
<a id="repair" class="btn btn-warning" href="{:url('repair')}">修复表</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<form id="export-form" method="post" action="{:url('export')}">
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="48">
|
||||||
|
<input class="check-all" checked="chedked" type="checkbox" value=""></th>
|
||||||
|
<th>表名</th>
|
||||||
|
<th width="120">数据量</th>
|
||||||
|
<th width="120">数据大小</th>
|
||||||
|
<th width="180">创建时间</th>
|
||||||
|
<th width="160">备份状态</th>
|
||||||
|
<th width="120">操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="list" id="table"}
|
||||||
|
<tr>
|
||||||
|
<td class="num">
|
||||||
|
<input class="ids" checked="chedked" type="checkbox" name="tables[]" value="{$table.name}"></td>
|
||||||
|
<td>{$table.name}</td>
|
||||||
|
<td>{$table.rows}</td>
|
||||||
|
<td>{$table.data_length|format_bytes}</td>
|
||||||
|
<td>{$table.create_time}</td>
|
||||||
|
<td class="info">未备份</td>
|
||||||
|
<td class="action">
|
||||||
|
<a class="ajax-get no-refresh" href="{:url('optimize?tables='.$table['name'])}">优化表</a>
|
||||||
|
|
||||||
|
<a class="ajax-get no-refresh" href="{:url('repair?tables='.$table['name'])}">修复表</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="script"}
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function($){
|
||||||
|
var $form = $("#export-form"), $export = $("#export"), tables
|
||||||
|
$optimize = $("#optimize"), $repair = $("#repair");
|
||||||
|
|
||||||
|
$optimize.add($repair).click(function(){
|
||||||
|
$.post(this.href, $form.serialize(), function(data){
|
||||||
|
if(data.code){
|
||||||
|
updateAlert(data.msg,'alert-success');
|
||||||
|
} else {
|
||||||
|
updateAlert(data.msg,'alert-error');
|
||||||
|
}
|
||||||
|
setTimeout(function(){
|
||||||
|
$('#top-alert').find('button').click();
|
||||||
|
$(that).removeClass('disabled').prop('disabled',false);
|
||||||
|
},1500);
|
||||||
|
}, "json");
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$export.click(function(){
|
||||||
|
$export.parent().children().addClass("disabled");
|
||||||
|
$export.html("正在发送备份请求...");
|
||||||
|
$.post(
|
||||||
|
$form.attr("action"),
|
||||||
|
$form.serialize(),
|
||||||
|
function(data){
|
||||||
|
if(data.code){
|
||||||
|
tables = data.data.tables;
|
||||||
|
$export.html(data.msg + "开始备份,请不要关闭本页面!");
|
||||||
|
backup(data.data.tab);
|
||||||
|
window.onbeforeunload = function(){ return "正在备份数据库,请不要关闭!" }
|
||||||
|
} else {
|
||||||
|
updateAlert(data.msg,'alert-error');
|
||||||
|
$export.parent().children().removeClass("disabled");
|
||||||
|
$export.html("立即备份");
|
||||||
|
setTimeout(function(){
|
||||||
|
$('#top-alert').find('button').click();
|
||||||
|
$(that).removeClass('disabled').prop('disabled',false);
|
||||||
|
},1500);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"json"
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
function backup(tab, status){
|
||||||
|
status && showmsg(tab.id, "开始备份...(0%)");
|
||||||
|
$.get($form.attr("action"), tab, function(data){
|
||||||
|
if(data.code){
|
||||||
|
var info = data.data;
|
||||||
|
showmsg(tab.id, data.msg);
|
||||||
|
|
||||||
|
if(!$.isPlainObject(info.tab)){
|
||||||
|
$export.parent().children().removeClass("disabled");
|
||||||
|
$export.html("备份完成,点击重新备份");
|
||||||
|
window.onbeforeunload = function(){ return null }
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
backup(info.tab, tab.id != info.tab.id);
|
||||||
|
} else {
|
||||||
|
updateAlert(data.msg,'alert-error');
|
||||||
|
$export.parent().children().removeClass("disabled");
|
||||||
|
$export.html("立即备份");
|
||||||
|
setTimeout(function(){
|
||||||
|
$('#top-alert').find('button').click();
|
||||||
|
$(that).removeClass('disabled').prop('disabled',false);
|
||||||
|
},1500);
|
||||||
|
}
|
||||||
|
}, "json");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function showmsg(id, msg){
|
||||||
|
$form.find("input[value=" + tables[id] + "]").closest("tr").find(".info").html(msg);
|
||||||
|
}
|
||||||
|
})(jQuery);
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<!-- 标题栏 -->
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>数据恢复</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
<!-- 应用列表 -->
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="200">备份名称</th>
|
||||||
|
<th width="80">卷数</th>
|
||||||
|
<th width="80">压缩</th>
|
||||||
|
<th width="80">数据大小</th>
|
||||||
|
<th width="200">备份时间</th>
|
||||||
|
<th>状态</th>
|
||||||
|
<th width="120">操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="list" id="data"}
|
||||||
|
<tr>
|
||||||
|
<td>{$data.time|date='Ymd-His',###}</td>
|
||||||
|
<td>{$data.part}</td>
|
||||||
|
<td>{$data.compress}</td>
|
||||||
|
<td>{$data.size|format_bytes}</td>
|
||||||
|
<td>{$key}</td>
|
||||||
|
<td>-</td>
|
||||||
|
<td class="action">
|
||||||
|
<a class="db-import" href="{:url('import?time='.$data['time'])}">还原</a>
|
||||||
|
|
||||||
|
<a class="ajax-get confirm" href="{:url('del?time='.$data['time'])}">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /应用列表 -->
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="script"}
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(".db-import").click(function(){
|
||||||
|
var self = this, status = ".";
|
||||||
|
$.get(self.href, success, "json");
|
||||||
|
window.onbeforeunload = function(){ return "正在还原数据库,请不要关闭!" }
|
||||||
|
return false;
|
||||||
|
|
||||||
|
function success(data){
|
||||||
|
if(data.code){
|
||||||
|
if(data.data.gz){
|
||||||
|
data.msg += status;
|
||||||
|
if(status.length === 5){
|
||||||
|
status = ".";
|
||||||
|
} else {
|
||||||
|
status += ".";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$(self).parent().prev().text(data.msg);
|
||||||
|
if(data.data.part){
|
||||||
|
$.get(self.href,
|
||||||
|
{"part" : data.data.part, "start" : data.data.start},
|
||||||
|
success,
|
||||||
|
"json"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
window.onbeforeunload = function(){ return null; }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
updateAlert(data.msg,'alert-error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
|
||||||
|
{/block}
|
||||||
|
{block name="body"}
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a href="{:url('Group/addnode',array('type'=>$type))}" class="btn btn-danger">
|
||||||
|
<i class="fa fa-plus"></i>
|
||||||
|
添加节点
|
||||||
|
</a>
|
||||||
|
<a href="{:url('Group/upnode',array('type'=>$type))}" class="btn btn-danger ajax-get">
|
||||||
|
<i class="fa fa-plus"></i>
|
||||||
|
更新节点
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<div class="tabs-wrapper">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
{volist name=":config('user_group_type')" id="item"}
|
||||||
|
<li {if condition="$key eq $type"}class="active"{/if}>
|
||||||
|
<a href="{:url('Group/access',array('type'=>$key))}">{$item}</a>
|
||||||
|
</li>
|
||||||
|
{/volist}
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content">
|
||||||
|
<div class="tab-pane fade in active" id="tab-home">
|
||||||
|
{if condition="empty($list)"}
|
||||||
|
<p>暂无数据!</p>
|
||||||
|
{else/}
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
<table class="table table-striped table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="60">ID</th>
|
||||||
|
<th>组名</th>
|
||||||
|
<th>标识</th>
|
||||||
|
<th>分组</th>
|
||||||
|
<th>状态</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="list" id="item"}
|
||||||
|
<tr>
|
||||||
|
<td>{$item['id']}</td>
|
||||||
|
<td>{$item['title']}</td>
|
||||||
|
<td>{$item['name']}</td>
|
||||||
|
<td>{$item['group']}</td>
|
||||||
|
<td>
|
||||||
|
{if condition="$item['status'] eq '0'"}
|
||||||
|
<span class="label label-danger">禁用</span>
|
||||||
|
{elseif condition="$item['status'] eq '1'"/}
|
||||||
|
<span class="label label-primary">启用</span>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{:url('Group/editnode',array('id'=>$item['id']))}">编辑</a>
|
||||||
|
<a href="{:url('Group/delnode',array('id'=>$item['id']))}" class="confirm ajax-get">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{$page}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a href="{:url('Group/index')}" class="btn btn-danger">
|
||||||
|
<i class="glyphicon glyphicon-menu-left"></i>
|
||||||
|
返回
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
<form action="" class="form" method="post">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="col-lg-2 text-right">分组</th>
|
||||||
|
<th>权限</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="list" id="node"}
|
||||||
|
<tr>
|
||||||
|
<td class="info col-lg-2 text-right">{$key}</td>
|
||||||
|
<td class="col-lg-10 text-left">
|
||||||
|
{volist name="node" id="item"}
|
||||||
|
<div class="checkbox-nice checkbox-inline">
|
||||||
|
<input type="checkbox" name="rule[]" value="{$item['id']}" id="{$item['name']}" {if in_array($item['id'],$auth_list)}checked{/if} />
|
||||||
|
<label for="{$item['name']}">{$item['title']}</label>
|
||||||
|
</div>
|
||||||
|
{/volist}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
<tr>
|
||||||
|
<td class="info col-lg-2 text-right">模块</td>
|
||||||
|
<td class="col-lg-10 text-left">
|
||||||
|
{volist name="model" id="item"}
|
||||||
|
<div class="checkbox-nice checkbox-inline">
|
||||||
|
<input type="checkbox" name="extend_rule[2][]" value="{$item['id']}" id="{$item['name']}" {if in_array($item['id'],$extend_auth)}checked{/if} />
|
||||||
|
<label for="{$item['name']}">{$item['title']}</label>
|
||||||
|
</div>
|
||||||
|
{/volist}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-lg-offset-2 col-lg-10">
|
||||||
|
<input type="hidden" name="id" value="{$id}">
|
||||||
|
<button type="submit" class="btn btn-success submit-btn ajax-post" target-form="form">确认提交</button>
|
||||||
|
<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
{extend name="public/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
|
||||||
|
{/block}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="main-box clearfix">
|
||||||
|
<header class="main-box-header clearfix">
|
||||||
|
<div class="pull-left">
|
||||||
|
<h2>{$meta_title}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<a href="{:url('Group/add',array('type'=>$type))}" class="btn btn-danger"><i class="fa fa-plus"></i> 添加用户组</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="main-box-body clearfix">
|
||||||
|
<div class="tabs-wrapper">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
{volist name=":config('USER_GROUP_TYPE')" id="item"}
|
||||||
|
<li {if condition="$key eq $type"}class="active"{/if}>
|
||||||
|
<a href="{:url('Group/index',array('type'=>$key))}">{$item}</a>
|
||||||
|
</li>
|
||||||
|
{/volist}
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content">
|
||||||
|
<div class="tab-pane fade in active" id="tab-home">
|
||||||
|
{if condition="empty($list)"}
|
||||||
|
<p>暂无数据!</p>
|
||||||
|
{else/}
|
||||||
|
<div class="table-responsive clearfix">
|
||||||
|
<table class="table table-striped table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="30"><input class="checkbox check-all" type="checkbox"></th>
|
||||||
|
<th width="60">ID</th>
|
||||||
|
<th>组名</th>
|
||||||
|
<th>描述</th>
|
||||||
|
<th>状态</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="list" id="item"}
|
||||||
|
<tr>
|
||||||
|
<td><input class="ids row-selected" type="checkbox" name="ids[]" value="{$item['id']}"></td>
|
||||||
|
<td>{$item['id']}</td>
|
||||||
|
<td><a href="#" class="editable editable-click" data-id="{$item['id']}" data-name="title" data-type="text" data-pk="{$item['id']}" data-url="{:url('editable')}">{$item['title']}</a></td>
|
||||||
|
<td>{$item['description']}</td>
|
||||||
|
<td>
|
||||||
|
{if condition="$item['status'] eq '0'"}
|
||||||
|
<span class="label label-danger">禁用</span>
|
||||||
|
{elseif condition="$item['status'] eq '1'"/}
|
||||||
|
<span class="label label-primary">启用</span>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{:url('Group/edit',array('id'=>$item['id']))}">编辑</a>
|
||||||
|
<a href="{:url('Group/auth',array('id'=>$item['id']))}">授权</a>
|
||||||
|
<a href="{:url('Group/del',array('id'=>$item['id']))}" class="confirm ajax-get">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{$page}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
{block name="script"}
|
||||||
|
<script type="text/javascript" src="__PUBLIC__/js/bootstrap-editable.min.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$.fn.editable.defaults.mode = 'popup';
|
||||||
|
$.fn.editableform.buttons = '<button type="submit" class="btn btn-success editable-submit btn-mini"><i class="fa fa-check-square-o fa-white"></i></button>' +
|
||||||
|
'<button type="button" class="btn editable-cancel btn-mini"><i class="fa fa-times"></i></button>';
|
||||||
|
$('.editable').editable();
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{extend name="public/base" /}
|
||||||
|
{block name="body"}
|
||||||
|
<div class="row">
|
||||||
|
{:hook('AdminIndex')}
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user