提交 f4f59e4b 编写于 作者: D devil

上传主题、插件+细节优化

上级 b1c8c916
......@@ -9,7 +9,7 @@
<!-- form start -->
<form class="am-form form-validation view-save am-margin-top-sm" action="{{:MyUrl('admin/pluginsadmin/upload')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/pluginsadmin/index')}}" enctype="multipart/form-data">
<div class="am-padding-xs am-form-file">
<div class="am-form-group am-form-group-refreshing am-margin-bottom-0 am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm am-radius">
<i class="am-icon-cloud-upload"></i> 选择文件</button>
<input type="file" name="file" class="file-event" data-tips-tag="#form-file-tips" data-validation-message="请选择需要上传的文件" accept=".zip" multiple required />
......@@ -17,7 +17,7 @@
<div id="form-file-tips" class="am-margin-top-xs"></div>
</div>
<div class="am-form-group am-form-group-refreshing">
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm" data-am-loading="{loadingText:'上传中...'}">上传</button>
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm" data-am-loading="{loadingText:'上传中...'}">确认上传</button>
</div>
</form>
<!-- form end -->
......
......@@ -12,12 +12,12 @@
<ul data-am-widget="gallery" class="am-gallery am-avg-sm-2 am-avg-md-3 am-avg-lg-4 am-gallery-bordered data-list" data-am-gallery="{}" data-select-url="{{:MyUrl('admin/theme/save')}}">
{{foreach $data_list as $v}}
<li id="data-list-{{$v.theme}}">
<div class="am-gallery-item am-radius {{if $v['theme'] eq $theme}}theme-active{{/if}}">
<a href="javascript:;" class="select-theme" data-theme="{{$v.theme}}">
<div class="am-gallery-item am-radius am-padding-0 {{if $v['theme'] eq $theme}}theme-active{{/if}}">
<a href="javascript:;" class="select-theme am-block" data-theme="{{$v.theme}}">
<img src="{{$v.preview}}" alt="{{$v.name}}" />
</a>
<div class="am-gallery-item-bottom">
<h3 class="am-gallery-title">
<h3 class="am-gallery-title am-margin-top-0">
{{$v.name}}
<div class="am-fr am-text-right">
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
......
......@@ -9,15 +9,15 @@
<!-- form start -->
<form class="am-form form-validation view-save am-margin-top-sm" action="{{:MyUrl('admin/theme/upload')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/theme/index')}}" enctype="multipart/form-data">
<div class="am-form-group am-form-file">
<div class="am-form-group am-form-group-refreshing am-margin-bottom-0 am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm am-radius">
<i class="am-icon-cloud-upload"></i> 选择文件</button>
<input type="file" name="theme" class="file-event" data-tips-tag="#form-theme-tips" data-validation-message="请选择需要上传的文件" accept=".zip" multiple required />
<span class="tips am-text-xs">上传一个zip压缩格式的主题安装包</span>
<div id="form-theme-tips" class="am-margin-top-xs"></div>
</div>
<div class="am-form-group">
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm" data-am-loading="{loadingText:'上传中...'}">上传</button>
<div class="am-form-group am-form-group-refreshing">
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm" data-am-loading="{loadingText:'上传中...'}">确认上传</button>
</div>
</form>
<!-- form end -->
......
......@@ -26,6 +26,9 @@ class PluginsAdminService
// 排除不能使用的名称
public static $plugins_exclude_verification = ['view', 'shopxo', 'www'];
// 排除的文件后缀
private static $exclude_ext = ['.php'];
/**
* 列表
* @author Devil
......@@ -1059,6 +1062,21 @@ php;
{
if(strpos($file, $dir_key) !== false)
{
// 仅控制器模块支持php文件
if($dir_key != '_controller_')
{
// 排除后缀文件
$pos = strripos($file, '.');
if($pos !== false)
{
if(in_array(substr($file, $pos), self::$exclude_ext))
{
continue;
}
}
}
// 匹配成功文件路径处理、跳出循环
$file = str_replace($plugins_name.'/'.$dir_key.'/', '', $dir_value.$file);
$is_has_find = true;
break;
......
......@@ -25,6 +25,9 @@ class ThemeService
private static $html_path = 'application'.DS.'index'.DS.'view'.DS;
private static $static_path = 'public'.DS.'static'.DS.'index'.DS;
// 排除的文件后缀
private static $exclude_ext = ['.php'];
/**
* 获取模板列表
* @author Devil
......@@ -109,11 +112,11 @@ class ThemeService
// 目录是否有权限
if(!is_writable(ROOT.self::$html_path))
{
return DataReturn('视图目录没权限', -10);
return DataReturn('视图目录没权限['.ROOT.self::$html_path.']', -10);
}
if(!is_writable(ROOT.self::$static_path))
{
return DataReturn('资源目录没权限', -10);
return DataReturn('资源目录没权限['.self::$static_path.']', -10);
}
// 资源目录
......@@ -140,6 +143,7 @@ class ThemeService
{
if(strpos($file, $dir_key) !== false)
{
// 匹配成功文件路径处理、跳出循环
$file = str_replace($dir_key.'/', '', $dir_value.$file);
$is_has_find = true;
break;
......@@ -152,6 +156,16 @@ class ThemeService
continue;
}
// 排除后缀文件
$pos = strripos($file, '.');
if($pos !== false)
{
if(in_array(substr($file, $pos), self::$exclude_ext))
{
continue;
}
}
// 截取文件路径
$file_path = substr($file, 0, strrpos($file, '/'));
......
.am-gallery-item-bottom { background: #f7f7f7; padding: 0px 8px 5px 8px; }
.am-gallery-item-bottom { background: #e6e6e6; padding: 5px 8px; }
.am-gallery-desc * { font-size: 12px; }
.am-gallery-item:hover { border: 1px solid #f60; }
.theme-active { border: 3px solid #5eb95e !important; }
......
......@@ -528,6 +528,7 @@ button.colorpicker-submit img {
line-height: 20px;
min-width: 160px;
max-width: 160px;
word-break: break-all;
}
.am-table-scrollable-horizontal .am-table .am-nowrap-initial {
white-space: initial;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册