Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
hexbee
Cloudreve
提交
7a530f5d
C
Cloudreve
项目概览
hexbee
/
Cloudreve
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Cloudreve
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7a530f5d
编写于
3月 17, 2019
作者:
H
HFO4
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Feat: Color option in dashboard
上级
88fac85c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
180 addition
and
9 deletion
+180
-9
application/index/controller/Admin.php
application/index/controller/Admin.php
+18
-5
application/index/controller/Callback.php
application/index/controller/Callback.php
+0
-1
application/index/model/AdminHandler.php
application/index/model/AdminHandler.php
+31
-0
application/index/view/admin/color.html
application/index/view/admin/color.html
+98
-0
application/index/view/error.html
application/index/view/error.html
+0
-1
application/index/view/header_admin.html
application/index/view/header_admin.html
+10
-2
static/js/admin/color.js
static/js/admin/color.js
+23
-0
未找到文件。
application/index/controller/Admin.php
浏览文件 @
7a530f5d
...
...
@@ -102,6 +102,15 @@ class Admin extends Controller{
]);
}
public
function
Color
(){
$options
=
Option
::
getValues
([
"basic"
]);
return
view
(
'color'
,
[
'options'
=>
$this
->
siteOptions
,
'optionsForSet'
=>
$options
,
'colors'
=>
\
json_decode
(
$options
[
"themes"
],
true
)
]);
}
public
function
Theme
(){
$fileName
=
input
(
"?param.name"
)
?
input
(
"param.name"
)
:
"error"
;
$dir
=
ROOT_PATH
.
"application/index/view/"
;
...
...
@@ -141,6 +150,10 @@ class Admin extends Controller{
return
$this
->
adminObj
->
saveThemeFile
(
input
(
'post.'
));
}
public
function
SaveColorSetting
(){
return
$this
->
adminObj
->
saveColorSetting
(
input
(
'post.'
));
}
public
function
SettingMail
(){
return
view
(
'mail_setting'
,
[
'options'
=>
$this
->
siteOptions
,
...
...
@@ -344,7 +357,7 @@ class Admin extends Controller{
}
public
function
DeleteShareMultiple
(){
return
$this
->
adminObj
->
deleteShare
(
json_decode
(
input
(
'post.id'
),
true
));
return
$this
->
adminObj
->
deleteShare
(
\
json_decode
(
input
(
'post.id'
),
true
));
}
public
function
DeleteMultiple
(){
...
...
@@ -380,7 +393,7 @@ class Admin extends Controller{
}
public
function
DeleteUsers
(){
$uidGroup
=
json_decode
(
input
(
'post.id'
),
true
);
$uidGroup
=
\
json_decode
(
input
(
'post.id'
),
true
);
foreach
(
$uidGroup
as
$key
=>
$value
)
{
$this
->
adminObj
->
deleteUser
(
$value
,
$this
->
userObj
->
uid
);
}
...
...
@@ -468,7 +481,7 @@ class Admin extends Controller{
}
public
function
About
(){
$verison
=
json_decode
(
file_get_contents
(
ROOT_PATH
.
"application/version.json"
),
true
);
$verison
=
\
json_decode
(
file_get_contents
(
ROOT_PATH
.
"application/version.json"
),
true
);
return
view
(
'about'
,
[
'options'
=>
$this
->
siteOptions
,
'programVersion'
=>
$verison
,
...
...
@@ -477,7 +490,7 @@ class Admin extends Controller{
}
public
function
Purchase
(){
$packData
=
json_decode
(
Option
::
getValue
(
"pack_data"
),
true
);
$packData
=
\
json_decode
(
Option
::
getValue
(
"pack_data"
),
true
);
return
view
(
'purchase'
,
[
'options'
=>
$this
->
siteOptions
,
'pack'
=>
$packData
,
...
...
@@ -494,7 +507,7 @@ class Admin extends Controller{
}
public
function
PurchaseGroup
(){
$groupData
=
json_decode
(
Option
::
getValue
(
"group_sell_data"
),
true
);
$groupData
=
\
json_decode
(
Option
::
getValue
(
"group_sell_data"
),
true
);
foreach
(
$groupData
as
$key
=>
$value
)
{
$groupData
[
$key
][
"group"
]
=
Db
::
name
(
"groups"
)
->
where
(
"id"
,
$value
[
"goup_id"
])
->
find
();
}
...
...
application/index/controller/Callback.php
浏览文件 @
7a530f5d
...
...
@@ -25,7 +25,6 @@ class Callback extends Controller{
public
function
Oss
(){
ob_end_clean
();
error_log
(
"sadasdasdsadsasadasasdasdasd"
);
header
(
'Content-Type: application/json'
);
$handllerObj
=
new
CallbackHandler
(
file_get_contents
(
"php://input"
));
$handllerObj
->
ossHandler
(
Request
::
instance
()
->
header
(
'Authorization'
),
Request
::
instance
()
->
header
(
'x-oss-pub-key-url'
));
...
...
application/index/model/AdminHandler.php
浏览文件 @
7a530f5d
...
...
@@ -102,6 +102,37 @@ class AdminHandler extends Model{
return
$this
->
saveOptions
(
$options
);
}
public
function
saveColorSetting
(
$options
){
$colorOptions
=
[];
foreach
(
$options
[
"color"
]
as
$key
=>
$value
)
{
$color
=
\
json_decode
(
$value
,
true
);
$validate
=
(
$color
!==
null
)
&&
array_key_exists
(
"palette"
,
$color
)
&&
array_key_exists
(
"common"
,
$color
[
"palette"
])
&&
array_key_exists
(
"black"
,
$color
[
"palette"
][
"common"
])
&&
array_key_exists
(
"white"
,
$color
[
"palette"
][
"common"
])
&&
array_key_exists
(
"background"
,
$color
[
"palette"
])
&&
array_key_exists
(
"primary"
,
$color
[
"palette"
])
&&
array_key_exists
(
"secondary"
,
$color
[
"palette"
])
&&
array_key_exists
(
"error"
,
$color
[
"palette"
])
&&
array_key_exists
(
"text"
,
$color
[
"palette"
])
&&
array_key_exists
(
"explorer"
,
$color
[
"palette"
])
&&
array_key_exists
(
"main"
,
$color
[
"palette"
][
"primary"
])
&&
array_key_exists
(
"main"
,
$color
[
"palette"
][
"secondary"
]);
if
(
!
$validate
){
return
[
"error"
=>
1
,
"msg"
=>
"第 "
.
(
$key
+
1
)
.
" 行配色方案格式有误"
];
}
$colorOptions
[
$color
[
"palette"
][
"primary"
][
"main"
]]
=
$color
;
}
if
(
!
array_key_exists
(
$options
[
"header"
],
$colorOptions
)){
return
[
"error"
=>
1
,
"msg"
=>
"第 "
.
(
$key
+
1
)
.
" 默认配色不存在"
];
}
$optionsForSet
=
[
"defaultTheme"
=>
$options
[
"header"
],
"themes"
=>
json_encode
(
$colorOptions
),
];
return
$this
->
saveOptions
(
$optionsForSet
);
}
public
function
saveRegSetting
(
$options
){
foreach
([
"email_active"
,
"login_captcha"
,
"reg_captcha"
,
"forget_captcha"
]
as
$key
){
$options
[
$key
]
=
array_key_exists
(
$key
,
$options
)
?
$options
[
$key
]
:
0
;
...
...
application/index/view/admin/color.html
0 → 100644
浏览文件 @
7a530f5d
{extend name="header_admin" /}
{block name="title"}基础设置- {$options.siteName}{/block}
{block name="content"}
<div
class=
"content-wrapper"
>
<div
class=
"container-fluid"
>
<!-- Breadcrumbs-->
<ol
class=
"breadcrumb"
>
<li
class=
"breadcrumb-item"
>
<a
href=
"/Admin"
>
管理面板
</a>
</li>
<li
class=
"breadcrumb-item active"
>
配色方案
</li>
</ol>
<!-- Area Chart Example-->
<div
class=
"row"
>
<div
class=
"col-12"
>
<h2>
配色方案
</h2>
<div
class=
"alert alert-primary"
role=
"alert"
>
<ul>
<li>
你可以使用
<a
href=
"https://theme.cloudreve.org"
>
Cloudreve配色工具
</a>
创建配色,并将生成的配置信息填写在下方;
</li>
<li>
主色调为不同配色的区分标识,请不要创建主色调相同的配色方案。
</li>
</ul>
</div>
<div
class=
"row"
>
<div
class=
"col-md-9"
>
<form
id=
"colorForm"
>
<div
class=
"row form-setting"
>
<div
class=
"col-md-1 form-label "
>
<label
for=
"colFormLabelSm"
class=
"col-form-label col-form-label-sm"
>
默认配色方案
</label>
</div>
<div
class=
"col-md-4"
><select
class=
"form-control"
name=
"header"
>
{volist name="colors" id="theme"}
<option
value=
"{$key}"
{
eq
name=
"optionsForSet.defaultTheme"
value=
"$key"
}
selected
{/
eq
}
>
{$key}
</option>
{/volist}
</select></div>
</div>
<div
class=
"row form-setting"
>
<div
class=
"col-md-1 form-label "
>
<label
for=
"colFormLabelSm"
class=
"col-form-label col-form-label-sm"
>
可选配色方案
</label>
</div>
<div
class=
"col-md-8"
>
<table
class=
"table"
id=
"colorTable"
>
<thead>
<tr>
<th
scope=
"col"
>
主色调
</th>
<th
scope=
"col"
>
颜色配置
</th>
</tr>
</thead>
<tbody>
{volist name="colors" id="theme"}
<tr>
<th
scope=
"row"
style=
"color:{$key}"
>
{$key}
<br><button
id=
"removeRow"
type=
"button"
data-action=
"removeRow"
class=
"btn btn-default"
>
删除
</button>
</th>
<td><textarea
class=
"form-control"
rows=
"4"
name=
"color[]"
>
{:json_encode($theme)}
</textarea></td>
</tr>
{/volist}
</tbody>
</table>
<div
style=
"text-align:right;"
><button
id=
"addRow"
type=
"button"
class=
"btn btn-default"
>
增加一行
</button></div>
</div>
</div>
<div
class=
"row form-setting"
>
<div
class=
"col-md-1 form-label "
>
</div>
<div
class=
"col-md-4"
>
<button
type=
"button"
class=
"btn btn-primary"
id=
"saveColor"
>
保存设置
</button></div>
<div
class=
"col-md-4 option-des"
>
</div>
<br>
<br>
</div>
</form>
<br><br>
</div>
<div
class=
"col-md-3"
>
<div
class=
"file_side"
>
<div
class=
"nav flex-column nav-pills"
id=
"v-pills-tab"
role=
"tablist"
aria-orientation=
"vertical"
>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Example DataTables Card-->
</div>
<!-- /.container-fluid-->
</div>
{/block}
{block name="js"}
<script
src=
"/static/js/admin/color.js"
></script>
<script
type=
"text/javascript"
>
</script>
{/block}
\ No newline at end of file
application/index/view/error.html
浏览文件 @
7a530f5d
<link
rel=
"stylesheet"
href=
"/static/css/error.css"
/>
</head>
<body
data-ma-header=
"teal"
>
...
...
application/index/view/header_admin.html
浏览文件 @
7a530f5d
...
...
@@ -58,11 +58,19 @@
</li>
</ul>
</li>
<li
class=
"nav-item"
data-toggle=
"tooltip"
data-placement=
"right"
title=
"模板"
>
<a
class=
"nav-link
"
href=
"/Admin/T
heme"
>
<li
class=
"nav-item"
data-toggle=
"tooltip"
data-placement=
"right"
title=
"模板"
>
<a
class=
"nav-link
nav-link-collapse collapsed"
data-toggle=
"collapse"
href=
"#t
heme"
>
<i
class=
"fa fa-fw fa-paint-brush"
></i>
<span
class=
"nav-link-text"
>
模板
</span>
</a>
<ul
class=
"sidenav-second-level collapse"
id=
"theme"
>
<li>
<a
href=
"/Admin/Theme"
>
模板
</a>
</li>
<li>
<a
href=
"/Admin/Color"
>
配色方案
</a>
</li>
</ul>
</li>
<li
class=
"nav-item"
data-toggle=
"tooltip"
data-placement=
"right"
title=
"文件"
>
<a
class=
"nav-link"
href=
"/Admin/Files"
>
...
...
static/js/admin/color.js
0 → 100644
浏览文件 @
7a530f5d
$
(
"
#addRow
"
).
click
(
function
(){
$
(
"
#colorTable tbody
"
).
append
(
'
<tr><td></td><td><textarea class="form-control" rows="4" name="color[]"></textarea></td></tr>
'
);
})
$
(
"
[data-action='removeRow']
"
).
on
(
"
click
"
,
function
(
e
){
$
(
this
).
parent
().
parent
().
remove
();
});
$
(
"
#saveColor
"
).
click
(
function
()
{
$
(
"
#saveColor
"
).
attr
(
"
disabled
"
,
"
true
"
);
$
.
post
(
"
/Admin/SaveColorSetting
"
,
$
(
"
#colorForm
"
).
serialize
()
,
function
(
data
)
{
if
(
data
.
error
==
"
1
"
)
{
toastr
[
"
warning
"
](
data
.
msg
);
$
(
"
#saveColor
"
).
removeAttr
(
"
disabled
"
);
}
else
if
(
data
.
error
==
"
200
"
)
{
toastr
[
"
success
"
](
"
设置已保存
"
);
$
(
"
#saveColor
"
).
removeAttr
(
"
disabled
"
);
}
else
{
toastr
[
"
warning
"
](
"
未知错误
"
);
$
(
"
#saveColor
"
).
removeAttr
(
"
disabled
"
);
}
});
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录