优化上传组件
This commit is contained in:
@@ -115,7 +115,20 @@ class Upload extends Base {
|
||||
}
|
||||
|
||||
public function filemanage(){
|
||||
return [];
|
||||
$pageConfig = [
|
||||
'list_rows' => $this->request->param('list_rows', 20),
|
||||
'page' => $this->request->param('page', 1),
|
||||
'query' => $this->request->param()
|
||||
];
|
||||
$map[] = ['type', '=', 'image'];
|
||||
$data = Db::where($map)->name('Attach')->paginate($pageConfig)->each(function($item, $key){
|
||||
$item['thumbURL'] = $item['url'];
|
||||
$item['oriURL'] = $item['url'];
|
||||
return $item;
|
||||
})->toArray();
|
||||
|
||||
$data['code'] = "000";
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function ueditor(){
|
||||
|
||||
@@ -36,6 +36,7 @@ require.config({
|
||||
'board': ['plugins/board/board.min'],
|
||||
'droppable': ['plugins/droppable/droppable'],
|
||||
'tagsinput': ['plugins/tagsinput/bootstrap-tagsinput'],
|
||||
'icheck': ['plugins/iCheck/icheck.min'],
|
||||
'select2': ['plugins/select2/select2.full'],
|
||||
'iconpicker': ['plugins/bootstrap-iconpicker/dist/js/bootstrap-iconpicker.bundle.min'],
|
||||
|
||||
@@ -88,6 +89,7 @@ require.config({
|
||||
'board': {deps:['jquery', 'droppable', 'css!'+baseRoot+'plugins/board/board.min.css'], exports: '$.fn.board'},
|
||||
'droppable': {deps:['jquery'], exports: '$.fn.droppable'},
|
||||
'tagsinput':{deps: ['jquery', 'bootstrap', 'css!'+baseRoot+'plugins/tagsinput/bootstrap-tagsinput.css'], exports: '$.fn.tagsinput'},
|
||||
'icheck': {deps: ['jquery', 'css!'+baseRoot+'plugins/iCheck/all.css']},
|
||||
'iconpicker':{deps: ['jquery', 'bootstrap', 'css!'+baseRoot+'plugins/bootstrap-iconpicker/dist/css/bootstrap-iconpicker.min.css'], exports: '$.fn.iconpicker'},
|
||||
|
||||
'validator-lang': ['validator-core'],
|
||||
@@ -119,9 +121,10 @@ require(['jquery', 'bootstrap', 'message', 'adminlte'], function ($) {
|
||||
$(function(){
|
||||
require(['sent'], function(sent){
|
||||
require(['admin/js/backend'], function(backend){
|
||||
var controller = (Config.jsname && Config.jsname !== 'upload') ? 'admin/js/module/'+Config.jsname : Config.jsname;
|
||||
//加载相应模块
|
||||
if (Config.jsname) {
|
||||
require(['admin/js/module/'+Config.jsname], function (Controller) {
|
||||
require([controller], function (Controller) {
|
||||
if (Controller.hasOwnProperty(Config.actionname)) {
|
||||
Controller[Config.actionname]();
|
||||
} else {
|
||||
|
||||
@@ -107,8 +107,8 @@ define(['jquery', 'bootstrap', 'validator'], function ($, undefined, Validator)
|
||||
require(['NKeditor'], function(){
|
||||
KindEditor.create('.form-editor', {
|
||||
items: Form.config.editor[items],
|
||||
uploadJson: "/admin/upload/editor'",
|
||||
fileManagerJson: "/admin/upload/filemanage"
|
||||
uploadJson: "/"+Config.module+"/upload/editor'",
|
||||
fileManagerJson: "/"+Config.module+"/upload/filemanage"
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -318,49 +318,6 @@ define(['jquery', 'bootstrap', 'validator'], function ($, undefined, Validator)
|
||||
})
|
||||
}
|
||||
},
|
||||
faselect: function (form) {
|
||||
//绑定fachoose选择附件事件
|
||||
if ($(".fachoose", form).size() > 0) {
|
||||
$(".fachoose", form).on('click', function () {
|
||||
var that = this;
|
||||
var multiple = $(this).data("multiple") ? $(this).data("multiple") : false;
|
||||
var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : '';
|
||||
var admin_id = $(this).data("admin-id") ? $(this).data("admin-id") : '';
|
||||
var user_id = $(this).data("user-id") ? $(this).data("user-id") : '';
|
||||
sent.api.open("general/attachment/select?element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype=" + mimetype + "&admin_id=" + admin_id + "&user_id=" + user_id, __('Choose'), {
|
||||
callback: function (data) {
|
||||
var button = $("#" + $(that).attr("id"));
|
||||
var maxcount = $(button).data("maxcount");
|
||||
var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
|
||||
maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
|
||||
if (input_id && data.multiple) {
|
||||
var urlArr = [];
|
||||
var inputObj = $("#" + input_id);
|
||||
var value = $.trim(inputObj.val());
|
||||
if (value !== "") {
|
||||
urlArr.push(inputObj.val());
|
||||
}
|
||||
urlArr.push(data.url)
|
||||
var result = urlArr.join(",");
|
||||
if (maxcount > 0) {
|
||||
var nums = value === '' ? 0 : value.split(/\,/).length;
|
||||
var files = data.url !== "" ? data.url.split(/\,/) : [];
|
||||
var remains = maxcount - nums;
|
||||
if (files.length > remains) {
|
||||
Toastr.error(__('You can choose up to %d file%s', remains));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
inputObj.val(result).trigger("change").trigger("validate");
|
||||
} else {
|
||||
$("#" + input_id).val(data.url).trigger("change").trigger("validate");
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
},
|
||||
fieldlist: function (form) {
|
||||
//绑定fieldlist
|
||||
if ($(".fieldlist", form).size() > 0) {
|
||||
@@ -580,7 +537,6 @@ define(['jquery', 'bootstrap', 'validator'], function ($, undefined, Validator)
|
||||
events.citypicker(form);
|
||||
events.datetimepicker(form);
|
||||
events.plupload(form);
|
||||
events.faselect(form);
|
||||
events.fieldlist(form);
|
||||
events.slider(form);
|
||||
events.switcher(form);
|
||||
|
||||
@@ -22,9 +22,8 @@
|
||||
<td class="col-lg-10 text-left">
|
||||
{if isset($list[$group['key']])}
|
||||
{volist name="list[$group['key']]" id="item"}
|
||||
<div class="radio radio-nice radio-inline">
|
||||
<input type="radio" name="{$item['module']}" value="{$item['id']}" id="{$item['module']}-{$item['id']}" {if condition="in_array($item['id'],$auth_list)"}checked{/if} />
|
||||
<label for="{$item['module']}-{$item['id']}">{$item['title']}</label>
|
||||
<div class="radio radio-inline">
|
||||
<label for="{$item['module']}-{$item['id']}"><input type="radio" name="{$item['module']}" value="{$item['id']}" id="{$item['module']}-{$item['id']}" {if condition="in_array($item['id'],$auth_list)"}checked{/if} /> {$item['title']}</label>
|
||||
</div>
|
||||
{/volist}
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user