完善table
This commit is contained in:
parent
2a46ffa475
commit
ea7c9e7131
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,2 @@
|
|||
/*! toolbar.js 2015-05-17 */
|
||||
"function"!=typeof Object.create&&(Object.create=function(a){function b(){}return b.prototype=a,new b}),function(a,b,c,d){var e={init:function(b,c){var d=this;d.elem=c,d.$elem=a(c),d.options=a.extend({},a.fn.toolbar.options,b),d.metadata=d.$elem.data(),d.overrideOptions(),d.toolbar=a('<div class="tool-container" />').addClass("tool-"+d.options.position).addClass("toolbar-"+d.options.style).append('<div class="tool-items" />').append('<div class="arrow" />').appendTo("body").css("opacity",0).hide(),d.toolbar_arrow=d.toolbar.find(".arrow"),d.initializeToolbar()},overrideOptions:function(){var b=this;a.each(b.options,function(a){"undefined"!=typeof b.$elem.data("toolbar-"+a)&&(b.options[a]=b.$elem.data("toolbar-"+a))})},initializeToolbar:function(){var a=this;a.populateContent(),a.setTrigger(),a.toolbarWidth=a.toolbar.width()},setTrigger:function(){function c(){d.$elem.hasClass("pressed")?e=setTimeout(function(){d.hide()},150):clearTimeout(e)}var d=this;if("click"!=d.options.event){var e;d.$elem.on({mouseenter:function(a){d.$elem.hasClass("pressed")?clearTimeout(e):d.show()}}),d.$elem.parent().on({mouseleave:function(a){c()}}),a(".tool-container").on({mouseenter:function(a){clearTimeout(e)},mouseleave:function(a){c()}})}"click"==d.options.event&&(d.$elem.on("click",function(a){a.preventDefault(),d.$elem.hasClass("pressed")?d.hide():d.show()}),d.options.hideOnClick&&a("html").on("click.toolbar",function(a){a.target!=d.elem&&0===d.$elem.has(a.target).length&&0===d.toolbar.has(a.target).length&&d.toolbar.is(":visible")&&d.hide()})),a(b).resize(function(a){a.stopPropagation(),d.toolbar.is(":visible")&&(d.toolbarCss=d.getCoordinates(d.options.position,20),d.collisionDetection(),d.toolbar.css(d.toolbarCss),d.toolbar_arrow.css(d.arrowCss))})},populateContent:function(){var b=this,c=b.toolbar.find(".tool-items"),d=a(b.options.content).clone(!0).find("a").addClass("tool-item");c.html(d),c.find(".tool-item").on("click",function(a){a.preventDefault(),b.$elem.trigger("toolbarItemClick",this)})},calculatePosition:function(){var a=this;a.arrowCss={},a.toolbarCss=a.getCoordinates(a.options.position,a.options.adjustment),a.toolbarCss.position="absolute",a.toolbarCss.zIndex=a.options.zIndex,a.collisionDetection(),a.toolbar.css(a.toolbarCss),a.toolbar_arrow.css(a.arrowCss)},getCoordinates:function(a,b){var c=this;switch(c.coordinates=c.$elem.offset(),c.options.adjustment&&c.options.adjustment[c.options.position]&&(b=c.options.adjustment[c.options.position]+b),c.options.position){case"top":return{left:c.coordinates.left-c.toolbar.width()/2+c.$elem.outerWidth()/2,top:c.coordinates.top-c.$elem.outerHeight()-b,right:"auto"};case"left":return{left:c.coordinates.left-c.toolbar.width()/2-c.$elem.outerWidth()/2-b,top:c.coordinates.top-c.toolbar.height()/2+c.$elem.outerHeight()/2,right:"auto"};case"right":return{left:c.coordinates.left+c.toolbar.width()/2+c.$elem.outerWidth()/2+b,top:c.coordinates.top-c.toolbar.height()/2+c.$elem.outerHeight()/2,right:"auto"};case"bottom":return{left:c.coordinates.left-c.toolbar.width()/2+c.$elem.outerWidth()/2,top:c.coordinates.top+c.$elem.outerHeight()+b,right:"auto"}}},collisionDetection:function(){var c=this,d=20;("top"==c.options.position||"bottom"==c.options.position)&&(c.arrowCss={left:"50%",right:"50%"},c.toolbarCss.left<d?(c.toolbarCss.left=d,c.arrowCss.left=c.$elem.offset().left+c.$elem.width()/2-d):a(b).width()-(c.toolbarCss.left+c.toolbarWidth)<d&&(c.toolbarCss.right=d,c.toolbarCss.left="auto",c.arrowCss.left="auto",c.arrowCss.right=a(b).width()-c.$elem.offset().left-c.$elem.width()/2-d-5))},show:function(){var a=this;a.$elem.addClass("pressed"),a.calculatePosition(),a.toolbar.show().css({opacity:1}).addClass("animate-"+a.options.animation),a.$elem.trigger("toolbarShown")},hide:function(){var a=this,b={opacity:0};switch(a.$elem.removeClass("pressed"),a.options.position){case"top":b.top="+=20";break;case"left":b.left="+=20";break;case"right":b.left="-=20";break;case"bottom":b.top="-=20"}a.toolbar.animate(b,200,function(){a.toolbar.hide()}),a.$elem.trigger("toolbarHidden")},getToolbarElement:function(){return this.toolbar.find(".tool-items")}};a.fn.toolbar=function(b){if(a.isPlainObject(b))return this.each(function(){var c=Object.create(e);c.init(b,this),a(this).data("toolbarObj",c)});if("string"==typeof b&&0!==b.indexOf("_")){var c=a(this).data("toolbarObj"),d=c[b];return d.apply(c,a.makeArray(arguments).slice(1))}},a.fn.toolbar.options={content:"#myContent",position:"top",hideOnClick:!1,zIndex:120,hover:!1,style:"default",animation:"standard",adjustment:10}}(jQuery,window,document);
|
|
@ -84,8 +84,8 @@ $(function () {
|
|||
|
||||
var $file_list = $('#file_list_' + $input_file_name);
|
||||
var ratio = window.devicePixelRatio || 1;
|
||||
var thumbnailWidth = 165 * ratio;
|
||||
var thumbnailHeight = 110 * ratio;
|
||||
var thumbnailWidth = (jsOptions.thumbnailWidth || 165) * ratio;
|
||||
var thumbnailHeight = (jsOptions.thumbnailHeight || 110) * ratio;
|
||||
|
||||
$file_list.find('li.pic-item').each(function (ii, ee) {
|
||||
var $li = $(ee);
|
||||
|
@ -111,165 +111,168 @@ $(function () {
|
|||
}
|
||||
});
|
||||
|
||||
var uploader = WebUploader.create({
|
||||
auto: true,
|
||||
chunked: true,
|
||||
prepareNextFile: true,
|
||||
duplicate: jsOptions.duplicate ? true : false,
|
||||
resize: jsOptions.resize ? true : false,
|
||||
swf: jsOptions.swf_url,
|
||||
server: jsOptions.upload_url,
|
||||
pick: {
|
||||
id: '#picker_' + $input_file_name,
|
||||
multiple: $multiple
|
||||
},
|
||||
fileSingleSizeLimit: $size,
|
||||
fileNumLimit: jsOptions.fileNumLimit,
|
||||
fileSizeLimit: jsOptions.fileSizeLimit,
|
||||
accept: {
|
||||
title: '文件',
|
||||
extensions: $ext,
|
||||
mimeTypes: jsOptions.mimeTypes || '*/*'
|
||||
},
|
||||
thumb: {
|
||||
// 图片质量,只有type为`image/jpeg`的时候才有效。
|
||||
quality: 70,
|
||||
// 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false.
|
||||
allowMagnify: false,
|
||||
// 是否允许裁剪。
|
||||
crop: true,
|
||||
// 为空的话则保留原有图片格式。
|
||||
// 否则强制转换成指定的类型。
|
||||
type: 'image/jpeg'
|
||||
}
|
||||
});
|
||||
|
||||
uploader.on('beforeFileQueued', function (file) {
|
||||
if ($multiple && $file_list.find('li.pic-item').size() >= jsOptions.fileNumLimit) {
|
||||
lightyear.notify('最多允许上传' + jsOptions.fileNumLimit + '个文件', 'danger');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
uploader.on('fileQueued', function (file) {
|
||||
var $li = $('<li class="col-xs-6 col-sm-3 col-md-2 pic-item" id="' + file.id + '">' +
|
||||
' <figure>' +
|
||||
'<div style="width:' + thumbnailWidth + 'px;height:' + thumbnailHeight + 'px">' +
|
||||
' <img>' +
|
||||
'</div>' +
|
||||
' <figcaption>' +
|
||||
' <a class="btn btn-round btn-square btn-primary btn-link-pic" href="javascript:;"><i class="mdi mdi-eye"></i></a>' +
|
||||
' <a class="btn btn-round btn-square btn-danger btn-remove-pic" href="javascript:;"><i class="mdi mdi-delete"></i></a>' +
|
||||
' </figcaption>' +
|
||||
' </figure>' +
|
||||
'</li>'),
|
||||
$img = $li.find('img');
|
||||
|
||||
if ($multiple) {
|
||||
$file_list.append($li);
|
||||
} else {
|
||||
$file_list.html($li);
|
||||
$input_file.val('');
|
||||
}
|
||||
uploader.makeThumb(file, function (error, src) {
|
||||
if (error) {
|
||||
$img.replaceWith('<div class="cantpreview" style="position:relative;width:' + thumbnailWidth + 'px;height:' +
|
||||
thumbnailHeight + 'px"><div class="filename" style="width:100%;font-size:12px;text-align:center;position:absolute;top:' + (thumbnailHeight / 2 - 10) + 'px;">不能预览</div></div>');
|
||||
return;
|
||||
if (jsOptions.canUpload) {
|
||||
var uploader = WebUploader.create({
|
||||
auto: true,
|
||||
chunked: true,
|
||||
prepareNextFile: true,
|
||||
duplicate: jsOptions.duplicate ? true : false,
|
||||
resize: jsOptions.resize ? true : false,
|
||||
swf: jsOptions.swf_url,
|
||||
server: jsOptions.upload_url,
|
||||
pick: {
|
||||
id: '#picker_' + $input_file_name,
|
||||
multiple: $multiple
|
||||
},
|
||||
fileSingleSizeLimit: $size,
|
||||
fileNumLimit: jsOptions.fileNumLimit,
|
||||
fileSizeLimit: jsOptions.fileSizeLimit,
|
||||
accept: {
|
||||
title: '文件',
|
||||
extensions: $ext,
|
||||
mimeTypes: jsOptions.mimeTypes || '*/*'
|
||||
},
|
||||
thumb: {
|
||||
// 图片质量,只有type为`image/jpeg`的时候才有效。
|
||||
quality: 70,
|
||||
// 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false.
|
||||
allowMagnify: false,
|
||||
// 是否允许裁剪。
|
||||
crop: true,
|
||||
// 为空的话则保留原有图片格式。
|
||||
// 否则强制转换成指定的类型。
|
||||
type: 'image/jpeg'
|
||||
}
|
||||
$img.attr('src', src);
|
||||
$img.css({
|
||||
'display': 'block',
|
||||
'min-height': 'auto',
|
||||
'max-width': thumbnailWidth + 'px',
|
||||
'margin': '0 auto'
|
||||
});
|
||||
}, thumbnailWidth, thumbnailHeight);
|
||||
$('<div class="progress progress-sm"><div class="progress-bar progress-bar-primary progress-bar-striped" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%"></div></div>').appendTo($li);
|
||||
});
|
||||
uploader.on('uploadProgress', function (file, percentage) {
|
||||
var $percent = $('#' + file.id).find('.progress-bar');
|
||||
$percent.css('width', percentage * 100 + '%');
|
||||
});
|
||||
uploader.on('uploadSuccess', function (file, response) {
|
||||
var $li = $('#' + file.id);
|
||||
if (response.status == 200) { // 返回200成功
|
||||
});
|
||||
|
||||
uploader.on('beforeFileQueued', function (file) {
|
||||
if ($multiple && $file_list.find('li.pic-item').size() >= jsOptions.fileNumLimit) {
|
||||
lightyear.notify('最多允许上传' + jsOptions.fileNumLimit + '个文件', 'danger');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
uploader.on('fileQueued', function (file) {
|
||||
var $li = $('<li class="pic-item" id="' + file.id + '">' +
|
||||
' <figure>' +
|
||||
'<div style="width:' + thumbnailWidth + 'px;height:' + thumbnailHeight + 'px">' +
|
||||
' <img>' +
|
||||
'</div>' +
|
||||
' <figcaption>' +
|
||||
' <a class="btn btn-round btn-square btn-primary btn-link-pic" href="javascript:;"><i class="mdi mdi-eye"></i></a>' +
|
||||
' <a class="btn btn-round btn-square btn-danger btn-remove-pic" href="javascript:;"><i class="mdi mdi-delete"></i></a>' +
|
||||
' </figcaption>' +
|
||||
' </figure>' +
|
||||
'</li>'),
|
||||
$img = $li.find('img');
|
||||
|
||||
if ($multiple) {
|
||||
if ($input_file.val()) {
|
||||
$input_file.val($input_file.val() + ',' + response.id);
|
||||
$file_list.append($li);
|
||||
} else {
|
||||
$file_list.html($li);
|
||||
$input_file.val('');
|
||||
}
|
||||
uploader.makeThumb(file, function (error, src) {
|
||||
if (error) {
|
||||
$img.replaceWith('<div class="cantpreview" style="position:relative;width:' + thumbnailWidth + 'px;height:' +
|
||||
thumbnailHeight + 'px"><div class="filename" style="width:100%;font-size:12px;text-align:center;position:absolute;top:' + (thumbnailHeight / 2 - 10) + 'px;">不能预览</div></div>');
|
||||
return;
|
||||
}
|
||||
$img.attr('src', src);
|
||||
$img.css({
|
||||
'display': 'block',
|
||||
'min-height': 'auto',
|
||||
'max-width': thumbnailWidth + 'px',
|
||||
'margin': '0 auto'
|
||||
});
|
||||
}, thumbnailWidth, thumbnailHeight);
|
||||
$('<div class="progress progress-sm"><div class="progress-bar progress-bar-primary progress-bar-striped" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%"></div></div>').appendTo($li);
|
||||
});
|
||||
uploader.on('uploadProgress', function (file, percentage) {
|
||||
var $percent = $('#' + file.id).find('.progress-bar');
|
||||
$percent.css('width', percentage * 100 + '%');
|
||||
});
|
||||
uploader.on('uploadSuccess', function (file, response) {
|
||||
var $li = $('#' + file.id);
|
||||
if (response.status == 200) { // 返回200成功
|
||||
if ($multiple) {
|
||||
if ($input_file.val()) {
|
||||
$input_file.val($input_file.val() + ',' + response.id);
|
||||
} else {
|
||||
$input_file.val(response.id);
|
||||
}
|
||||
$li.find('.btn-remove-pic').attr('data-id', response.id);
|
||||
} else {
|
||||
$input_file.val(response.id);
|
||||
}
|
||||
$li.find('.btn-remove-pic').attr('data-id', response.id);
|
||||
} else {
|
||||
$input_file.val(response.id);
|
||||
}
|
||||
}
|
||||
$('<div class="' + response.class + '"></div>').text(response.info + '(' + $file_list.find('li.pic-item').size() + '/' + jsOptions.fileNumLimit + ')').appendTo($li);
|
||||
if ($li.find('.cantpreview').size() > 0) {
|
||||
$li.find('a.btn-link-pic').attr('href', response.picurl).removeClass('btn-link-pic').attr('target', '_blank');
|
||||
$li.find('.filename').text(response.picurl);
|
||||
} else {
|
||||
$li.find('a.btn-link-pic').attr('href', response.picurl);
|
||||
}
|
||||
});
|
||||
uploader.on('uploadError', function (file) {
|
||||
var $li = $('#' + file.id);
|
||||
$('<div class="error">上传失败</div>').appendTo($li);
|
||||
});
|
||||
uploader.on('error', function (type) {
|
||||
switch (type) {
|
||||
case 'Q_TYPE_DENIED':
|
||||
lightyear.notify('文件类型不正确,只允许上传后缀名为:' + $ext + ',请重新上传!', 'danger');
|
||||
break;
|
||||
case 'F_EXCEED_SIZE':
|
||||
lightyear.notify('文件不得超过' + ($size / 1024) + 'kb,请重新上传!', 'danger');
|
||||
break;
|
||||
}
|
||||
});
|
||||
uploader.on('uploadComplete', function (file) {
|
||||
setTimeout(function () {
|
||||
$('#' + file.id).find('.progress').remove();
|
||||
}, 500);
|
||||
});
|
||||
// 删除操作
|
||||
$file_list.delegate('.btn-remove-pic', 'click', function () {
|
||||
var id = $(this).data('id');
|
||||
var that = $(this);
|
||||
$.alert({
|
||||
title: '提示',
|
||||
content: '确认要删除此文件吗?',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '确认',
|
||||
btnClass: 'btn-primary',
|
||||
action: function () {
|
||||
if ($multiple) {
|
||||
var ids = $input_file.val().split(',');
|
||||
if (id) {
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
if (ids[i] == id) {
|
||||
ids.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$input_file.val(ids.join(','));
|
||||
}
|
||||
} else {
|
||||
$input_file.val('');
|
||||
}
|
||||
|
||||
that.closest('.pic-item').remove();
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: '取消',
|
||||
action: function () {
|
||||
|
||||
}
|
||||
}
|
||||
$('<div class="' + response.class + '"></div>').text(response.info + '(' + $file_list.find('li.pic-item').size() + '/' + jsOptions.fileNumLimit + ')').appendTo($li.find('figure'));
|
||||
if ($li.find('.cantpreview').size() > 0) {
|
||||
$li.find('a.btn-link-pic').attr('href', response.picurl).removeClass('btn-link-pic').attr('target', '_blank');
|
||||
$li.find('.filename').text(response.picurl);
|
||||
} else {
|
||||
$li.find('a.btn-link-pic').attr('href', response.picurl);
|
||||
}
|
||||
});
|
||||
});
|
||||
uploader.on('uploadError', function (file) {
|
||||
var $li = $('#' + file.id);
|
||||
$('<div class="error">上传失败</div>').appendTo($li).find('figure');
|
||||
});
|
||||
uploader.on('error', function (type) {
|
||||
switch (type) {
|
||||
case 'Q_TYPE_DENIED':
|
||||
lightyear.notify('文件类型不正确,只允许上传后缀名为:' + $ext + ',请重新上传!', 'danger');
|
||||
break;
|
||||
case 'F_EXCEED_SIZE':
|
||||
lightyear.notify('文件不得超过' + ($size / 1024) + 'kb,请重新上传!', 'danger');
|
||||
break;
|
||||
}
|
||||
});
|
||||
uploader.on('uploadComplete', function (file) {
|
||||
setTimeout(function () {
|
||||
$('#' + file.id).find('.progress').remove();
|
||||
}, 500);
|
||||
});
|
||||
// 删除操作
|
||||
$file_list.delegate('.btn-remove-pic', 'click', function () {
|
||||
var id = $(this).data('id');
|
||||
var that = $(this);
|
||||
$.alert({
|
||||
title: '提示',
|
||||
content: '确认要删除此文件吗?',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '确认',
|
||||
btnClass: 'btn-primary',
|
||||
action: function () {
|
||||
if ($multiple) {
|
||||
var ids = $input_file.val().split(',');
|
||||
if (id) {
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
if (ids[i] == id) {
|
||||
ids.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$input_file.val(ids.join(','));
|
||||
}
|
||||
} else {
|
||||
$input_file.val('');
|
||||
}
|
||||
|
||||
that.closest('.pic-item').remove();
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: '取消',
|
||||
action: function () {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 接入图片查看插件
|
||||
$(this).magnificPopup({
|
||||
delegate: 'a.btn-link-pic',
|
||||
|
@ -280,4 +283,144 @@ $(function () {
|
|||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
window.autoPost = function (id, url) {
|
||||
var obj = $('#' + id);
|
||||
if (!obj.size()) {
|
||||
return;
|
||||
}
|
||||
if (obj.is('div')) {
|
||||
$('body').on('change', '#' + id + ' :radio,#' + id + ' :checkbox', function () {
|
||||
var name = $(this).attr('name');
|
||||
var val = '';
|
||||
if ($(this).is(':radio')) {
|
||||
val = $("input[name='" + name + "']:checked").val();
|
||||
} else {
|
||||
var values = [];
|
||||
$("input[name='" + name + "']:checked").each(function (i, e) {
|
||||
values.push($(e).val());
|
||||
});
|
||||
val = values.join(',');
|
||||
}
|
||||
|
||||
window.autoSendData(name, val, url);
|
||||
});
|
||||
} else {
|
||||
if (/^(input|textarea|select)$/i.test(obj.get(0).tagName)) {
|
||||
$('body').on('change', '#' + id, function () {
|
||||
|
||||
$('#' + id).toolbar({
|
||||
content: '#edit-options',
|
||||
position: 'left',
|
||||
style: 'success',
|
||||
});
|
||||
|
||||
var name = $(this).attr('name');
|
||||
var val = '';
|
||||
if (/^(input|textarea|select)$/i.test(this.tagName)) {
|
||||
val = $(this).val();
|
||||
}
|
||||
|
||||
window.autoSendData(name, val, url);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.postChecked = function (id, url, confirm) {
|
||||
var obj = $('#' + id);
|
||||
if (!obj.size()) {
|
||||
return;
|
||||
}
|
||||
$('body').on('click', '#' + id, function () {
|
||||
var name = 'rows';
|
||||
var val = '';
|
||||
|
||||
var values = [];
|
||||
|
||||
$("input.table-row:checked").each(function (i, e) {
|
||||
values.push($(e).val());
|
||||
});
|
||||
|
||||
if (values.length == 0) {
|
||||
|
||||
lightyear.notify('未选中任何数据', 'warning');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
val = values.join(',');
|
||||
|
||||
if (confirm) {
|
||||
var text = $('#' + id).text();
|
||||
$.alert({
|
||||
title: '操作提示',
|
||||
content: '确定要执行批量<strong>' + text + '</strong>操作吗?',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '确认',
|
||||
btnClass: 'btn-primary',
|
||||
action: function () {
|
||||
window.autoSendData(name, val, url);
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: '取消',
|
||||
action: function () {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
window.autoSendData(name, val, url);
|
||||
}
|
||||
});
|
||||
|
||||
if ($("input.table-row:checked").size() == 0) {
|
||||
$('#' + id).addClass('disabled');
|
||||
} else {
|
||||
$('#' + id).removeClass('disabled');
|
||||
}
|
||||
|
||||
$('body').on('change', 'input.table-row', function () {
|
||||
if ($("input.table-row:checked").size() == 0) {
|
||||
$('#' + id).addClass('disabled');
|
||||
} else {
|
||||
$('#' + id).removeClass('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('change', 'input.table-row-checkall', function () {
|
||||
if ($("input.table-row:checked").is(':checked')) {
|
||||
$('#' + id).removeClass('disabled');
|
||||
} else {
|
||||
$('#' + id).addClass('disabled');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.autoSendData = function (name, value, url) {
|
||||
name = name.split('-')[0];
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: {
|
||||
name: name,
|
||||
value: value,
|
||||
__token__: window.__token__,
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.status) {
|
||||
lightyear.notify('操作成功!', 'success');
|
||||
} else {
|
||||
lightyear.notify('操作失败', 'warning');
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
lightyear.notify('网络错误', 'danger');
|
||||
}
|
||||
});
|
||||
};
|
|
@ -11,11 +11,13 @@ class Upload extends Controller
|
|||
public function upfiles($type = '', $token = '')
|
||||
{
|
||||
if (empty($token)) {
|
||||
exit('no token');
|
||||
echo json_encode(['info' => 'no token', 'picurl' => '']);
|
||||
return;
|
||||
}
|
||||
|
||||
if (session('uploadtoken') != $token) {
|
||||
exit('token error');
|
||||
echo json_encode(['info' => 'token error', 'picurl' => '']);
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
|
|
|
@ -55,8 +55,9 @@ class Builder implements Renderable
|
|||
{
|
||||
if (static::$instance == null) {
|
||||
static::$instance = new static($title, $desc);
|
||||
static::$instance->csrf_token = csrf_token();
|
||||
View::share(['__token__' => static::$instance->csrf_token]);
|
||||
$token = csrf_token();
|
||||
static::$instance->csrf_token = $token;
|
||||
View::share(['__token__' => $token]);
|
||||
}
|
||||
|
||||
return static::$instance;
|
||||
|
@ -170,6 +171,17 @@ class Builder implements Renderable
|
|||
return $this->column($size)->table();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一个工具栏
|
||||
*
|
||||
* @param integer col大小
|
||||
* @return Toolbar
|
||||
*/
|
||||
public function toolbar($size = 12)
|
||||
{
|
||||
return $this->column($size)->toolbar();
|
||||
}
|
||||
|
||||
public function beforRender()
|
||||
{
|
||||
foreach ($this->rows as $row) {
|
||||
|
|
|
@ -41,6 +41,18 @@ class Column
|
|||
return $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一个表格
|
||||
*
|
||||
* @return Toolbar
|
||||
*/
|
||||
public function toolbar()
|
||||
{
|
||||
$table = new Toolbar();
|
||||
$this->elms[] = $table;
|
||||
return $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
|
|
|
@ -16,6 +16,8 @@ class Form extends Wapper implements Renderable
|
|||
|
||||
protected $class = '';
|
||||
|
||||
protected $attr = '';
|
||||
|
||||
protected $method = 'post';
|
||||
|
||||
protected $rows = [];
|
||||
|
@ -33,6 +35,7 @@ class Form extends Wapper implements Renderable
|
|||
'action' => $this->action,
|
||||
'method' => $this->method,
|
||||
'class' => $this->class,
|
||||
'attr' => $this->attr,
|
||||
];
|
||||
|
||||
return $viewshow->assign($vars)->getContent();
|
||||
|
@ -68,18 +71,54 @@ class Form extends Wapper implements Renderable
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function class($val)
|
||||
function class ($val)
|
||||
{
|
||||
$this->class = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function attr($val)
|
||||
{
|
||||
$this->attr = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function addClass($val)
|
||||
{
|
||||
$this->class .= ' ' . $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function addAttr($val)
|
||||
{
|
||||
$this->attr .= ' ' . $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
|
@ -166,7 +205,7 @@ class Form extends Wapper implements Renderable
|
|||
|
||||
$this->rows[] = $row;
|
||||
|
||||
return $row->$name($arguments[0], $count > 1 ? $arguments[1] : '');
|
||||
return $row->$name($arguments[0], $row->getLabel());
|
||||
}
|
||||
|
||||
throw new \UnexpectedValueException('未知调用');
|
||||
|
|
|
@ -41,6 +41,16 @@ class Row
|
|||
return $this->column($size)->table();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一个工具栏
|
||||
*
|
||||
* @return Toolbar
|
||||
*/
|
||||
public function toolbar($size = 12)
|
||||
{
|
||||
return $this->column($size)->table();
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace tpext\builder\common;
|
||||
|
||||
use think\response\View as ViewShow;
|
||||
use tpext\builder\displayer\Field;
|
||||
use tpext\builder\form\Wapper;
|
||||
use tpext\builder\table\Column;
|
||||
|
||||
|
@ -11,9 +10,21 @@ class Table extends Wapper implements Renderable
|
|||
{
|
||||
protected $view = '';
|
||||
|
||||
protected $js = [
|
||||
'/assets/tpextbuilder/js/jquery-toolbar/jquery.toolbar.min.js',
|
||||
];
|
||||
|
||||
protected $css = [
|
||||
'/assets/tpextbuilder/js/jquery-toolbar/jquery-toolbar.min.css',
|
||||
];
|
||||
|
||||
protected $headTextAlign = 'left';
|
||||
|
||||
protected $textAlign = 'left';
|
||||
|
||||
protected $verticalAlign = 'middle';
|
||||
|
||||
protected $class = 'table-striped table-hover';
|
||||
protected $class = 'table-striped table-hover table-bordered';
|
||||
|
||||
protected $attr = '';
|
||||
|
||||
|
@ -23,13 +34,58 @@ class Table extends Wapper implements Renderable
|
|||
|
||||
protected $data = [];
|
||||
|
||||
protected $lit = [];
|
||||
|
||||
protected $pk = 'id';
|
||||
|
||||
protected $ids = [];
|
||||
|
||||
protected $rowCheckbox = true;
|
||||
|
||||
protected $emptyText = "暂未数据~";
|
||||
|
||||
public function beforRender()
|
||||
{
|
||||
foreach ($this->cols as $col) {
|
||||
Builder::getInstance()->addJs($this->js);
|
||||
Builder::getInstance()->addCss($this->css);
|
||||
|
||||
$col->beforRender();
|
||||
$this->list = [];
|
||||
|
||||
$pk = strtolower($this->pk);
|
||||
|
||||
foreach ($this->data as $row => $cols) {
|
||||
|
||||
foreach ($cols as $col => $value) {
|
||||
|
||||
if (strtolower($col) == $pk) {
|
||||
|
||||
$this->ids[$row] = $value;
|
||||
}
|
||||
|
||||
if (!isset($this->cols[$col])) {
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$displayer = $this->cols[$col]->getDisplayer();
|
||||
|
||||
$displayer
|
||||
->showLabel(false)
|
||||
->size([0, 12])
|
||||
->value($value)
|
||||
->tableRowKey('-' . $row);
|
||||
|
||||
$displayer->beforRender();
|
||||
|
||||
$this->cols[$col]->addStyle('vertical-align:' . $this->verticalAlign . ';' . 'text-align:' . $this->textAlign . ';');
|
||||
|
||||
$this->list[$row][$col] = [
|
||||
'displayer' => $displayer,
|
||||
'value' => $displayer->render(),
|
||||
'attr' => $displayer->getAttr(),
|
||||
'wapper' => $this->cols[$col],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,38 +95,46 @@ class Table extends Wapper implements Renderable
|
|||
|
||||
$viewshow = new ViewShow($template);
|
||||
|
||||
$list = [];
|
||||
|
||||
foreach ($this->data as $row => $cols) {
|
||||
|
||||
foreach ($cols as $col => $value) {
|
||||
|
||||
$displayer = isset($this->cols[$col]) ? $this->cols[$col]->getDisplayer() : new Field($col, ucfirst($col));
|
||||
|
||||
$displayer->showLabel(false)
|
||||
->size(12, 12)
|
||||
->addAttr('style="vertical-align:' . $this->verticalAlign . ';"');
|
||||
|
||||
$list[$row][$col] = [
|
||||
'displayer' => $displayer,
|
||||
'value' => $value,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$vars = [
|
||||
'class' => $this->class,
|
||||
'attr' => $this->attr,
|
||||
'headers' => $this->headers,
|
||||
'cols' => $this->cols,
|
||||
'list' => $list,
|
||||
'list' => $this->list,
|
||||
'data' => $this->data,
|
||||
'emptyText' => $this->emptyText,
|
||||
'headStyle' => 'style="text-align:' . $this->headTextAlign . ';"',
|
||||
'ids' => $this->ids,
|
||||
'rowCheckbox' => $this->rowCheckbox && !empty($this->ids),
|
||||
'name' => time() . mt_rand(1000, 9999),
|
||||
];
|
||||
|
||||
return $viewshow->assign($vars)->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
* 主键, 默认 为 'id'
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function pk($val)
|
||||
{
|
||||
$this->pk = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
* @param boolean $val
|
||||
* @return $this
|
||||
*/
|
||||
public function rowCheckbox($val)
|
||||
{
|
||||
$this->rowCheckbox = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
|
@ -119,6 +183,26 @@ class Table extends Wapper implements Renderable
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getJs()
|
||||
{
|
||||
return $this->js;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCss()
|
||||
{
|
||||
return $this->css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
|
@ -161,6 +245,29 @@ class Table extends Wapper implements Renderable
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function textAlign($val)
|
||||
{
|
||||
return $this->textAlign = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function headTextAlign($val)
|
||||
{
|
||||
return $this->headTextAlign = $val;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
|
@ -189,22 +296,13 @@ class Table extends Wapper implements Renderable
|
|||
|
||||
if ($count > 0 && static::isDisplayer($name)) {
|
||||
|
||||
//$row = new Row($arguments[0], $count > 1 ? $arguments[1] : '', $count > 2 ? $arguments[2] : 12, $count > 3 ? $arguments[3] : '', $count > 4 ? $arguments[4] : '');
|
||||
$col = new Column($arguments[0], $count > 1 ? $arguments[1] : '', $count > 2 ? $arguments[2] : 0, $count > 3 ? $arguments[3] : '', $count > 4 ? $arguments[4] : '');
|
||||
|
||||
//$this->rows[] = $row;
|
||||
|
||||
//return $row->$name($arguments[0], $count > 1 ? $arguments[1] : '');
|
||||
|
||||
$label = $count > 1 ? $arguments[1] : '';
|
||||
|
||||
if (empty($label)) {
|
||||
$label = ucfirst($name);
|
||||
}
|
||||
|
||||
$col = new Column($name, $label, $count > 2 ? $arguments[2] : 12, $count > 3 ? $arguments[3] : '', $count > 4 ? $arguments[4] : '');
|
||||
$this->cols[$arguments[0]] = $col;
|
||||
$this->headers[] = $label;
|
||||
return $col->$name($arguments[0], $label)->extKey(1);
|
||||
|
||||
$this->headers[] = $col->getLabel();
|
||||
|
||||
return $col->$name($arguments[0], $col->getLabel());
|
||||
}
|
||||
|
||||
throw new \UnexpectedValueException('未知调用');
|
||||
|
|
|
@ -0,0 +1,163 @@
|
|||
<?php
|
||||
|
||||
namespace tpext\builder\common;
|
||||
|
||||
use think\response\View as ViewShow;
|
||||
use tpext\builder\common\Plugin;
|
||||
use tpext\builder\toolbar\Wapper;
|
||||
|
||||
class Toolbar extends Wapper implements Renderable
|
||||
{
|
||||
protected $view = '';
|
||||
|
||||
protected $class = '';
|
||||
|
||||
protected $attr = '';
|
||||
|
||||
protected $elms = [];
|
||||
|
||||
public function render()
|
||||
{
|
||||
$template = Plugin::getInstance()->getRoot() . implode(DIRECTORY_SEPARATOR, ['src', 'view', 'toolbar.html']);
|
||||
|
||||
$viewshow = new ViewShow($template);
|
||||
|
||||
$vars = [
|
||||
'elms' => $this->elms,
|
||||
'class' => $this->class,
|
||||
'attr' => $this->attr,
|
||||
];
|
||||
|
||||
return $viewshow->assign($vars)->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
function class ($val)
|
||||
{
|
||||
$this->class = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function attr($val)
|
||||
{
|
||||
$this->attr = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function addClass($val)
|
||||
{
|
||||
$this->class .= ' ' . $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function addAttr($val)
|
||||
{
|
||||
$this->attr .= ' ' . $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getJs()
|
||||
{
|
||||
return $this->js;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCss()
|
||||
{
|
||||
return $this->css;
|
||||
}
|
||||
|
||||
public function beforRender()
|
||||
{
|
||||
foreach ($this->elms as $elm) {
|
||||
|
||||
$elm->beforRender();
|
||||
}
|
||||
}
|
||||
|
||||
public function buttons()
|
||||
{
|
||||
$this->btnAdd();
|
||||
$this->btnEnable();
|
||||
$this->btnDisable();
|
||||
$this->btnDelete();
|
||||
$this->btnRefresh();
|
||||
}
|
||||
|
||||
public function btnAdd($label = '添加', $class = 'btn-primary')
|
||||
{
|
||||
$this->linkBtn('add', $label)->icon('mdi-plus')->class($class);
|
||||
}
|
||||
|
||||
public function btnDelete($label = '删除', $class = 'btn-danger')
|
||||
{
|
||||
$this->linkBtn('delete', $label)->icon('mdi-delete')->class($class)->postChecked(url('delete'));
|
||||
}
|
||||
|
||||
public function btnDisable($label = '禁用', $class = 'btn-warning')
|
||||
{
|
||||
$this->linkBtn('disable', $label)->icon('mdi-block-helper')->class($class)->postChecked(url('disable'));
|
||||
}
|
||||
|
||||
public function btnEnable($label = '启用', $class = 'btn-success')
|
||||
{
|
||||
$this->linkBtn('enable', $label)->icon('mdi-check')->class($class)->postChecked(url('enable'));
|
||||
}
|
||||
|
||||
public function btnRefresh($label = '', $class = 'btn-default')
|
||||
{
|
||||
$this->linkBtn('refresh', $label)->icon('mdi-refresh')->class($class)->attr('title="刷新"');
|
||||
}
|
||||
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
$count = count($arguments);
|
||||
|
||||
if ($count > 0 && static::isDisplayer($name)) {
|
||||
|
||||
$class = static::$displayerMap[$name];
|
||||
|
||||
$elm = new $class($arguments[0], $count > 1 ? $arguments[1] : '');
|
||||
|
||||
$elm->created();
|
||||
|
||||
$this->elms[] = $elm;
|
||||
|
||||
return $elm;
|
||||
}
|
||||
|
||||
throw new \UnexpectedValueException('未知调用');
|
||||
}
|
||||
}
|
|
@ -38,7 +38,7 @@ class CKEditor extends Field
|
|||
// 失败返回格式{"uploaded":0,"error":{"message":"失败原因"}}
|
||||
|
||||
if (!isset($this->jsOptions['filebrowserImageUploadUrl']) || empty($this->jsOptions['filebrowserImageUploadUrl'])) {
|
||||
$token = md5('uploadtoken' . time() . uniqid());
|
||||
$token = session('uploadtoken') ? session('uploadtoken') : md5('uploadtoken' . time() . uniqid());
|
||||
|
||||
session('uploadtoken', $token);
|
||||
|
||||
|
|
|
@ -5,13 +5,14 @@ namespace tpext\builder\displayer;
|
|||
use think\response\View as ViewShow;
|
||||
use tpext\builder\common\Builder;
|
||||
use tpext\builder\common\Plugin;
|
||||
use tpext\builder\common\Renderable;
|
||||
use tpext\builder\form\Wapper;
|
||||
|
||||
class Field
|
||||
class Field implements Renderable
|
||||
{
|
||||
protected $id = '';
|
||||
|
||||
protected $extKey = '';
|
||||
protected $tableRowKey = '';
|
||||
|
||||
protected $name = '';
|
||||
|
||||
|
@ -25,7 +26,7 @@ class Field
|
|||
|
||||
protected $script = [];
|
||||
|
||||
protected $style = [];
|
||||
protected $style = '';
|
||||
|
||||
protected $view = 'field';
|
||||
|
||||
|
@ -39,6 +40,8 @@ class Field
|
|||
|
||||
protected $editable = true;
|
||||
|
||||
protected $autoPost = '';
|
||||
|
||||
protected $showLabel = true;
|
||||
|
||||
protected $class = '';
|
||||
|
@ -99,17 +102,17 @@ class Field
|
|||
*/
|
||||
public function getId()
|
||||
{
|
||||
return 'form-' . $this->name . $this->extKey;
|
||||
return 'form-' . $this->name . $this->tableRowKey;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name . $this->extKey;
|
||||
return $this->name . $this->tableRowKey;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,9 +121,21 @@ class Field
|
|||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function extKey($val)
|
||||
public function tableRowKey($val)
|
||||
{
|
||||
$this->extKey = $val;
|
||||
$this->tableRowKey = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $url
|
||||
* @return $this
|
||||
*/
|
||||
public function autoPost($url)
|
||||
{
|
||||
$this->autoPost = $url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -183,6 +198,18 @@ class Field
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function style($val)
|
||||
{
|
||||
$this->style = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
|
@ -243,6 +270,18 @@ class Field
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function addStyle($val)
|
||||
{
|
||||
$this->attr .= $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
|
@ -500,6 +539,21 @@ class Field
|
|||
return $viewshow;
|
||||
}
|
||||
|
||||
protected function autoPostScript()
|
||||
{
|
||||
$script = '';
|
||||
$inputId = $this->getId();
|
||||
|
||||
$script = <<<EOT
|
||||
|
||||
window.autoPost('{$inputId}', '{$this->autoPost}');
|
||||
|
||||
EOT;
|
||||
$this->script[] = $script;
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
public function beforRender()
|
||||
{
|
||||
if (!empty($this->js)) {
|
||||
|
@ -510,12 +564,12 @@ class Field
|
|||
Builder::getInstance()->addCss($this->css);
|
||||
}
|
||||
|
||||
if (!empty($this->script)) {
|
||||
Builder::getInstance()->addScript($this->script);
|
||||
if ($this->autoPost) {
|
||||
$this->autoPostScript();
|
||||
}
|
||||
|
||||
if (!empty($this->style)) {
|
||||
Builder::getInstance()->addStyle($this->style);
|
||||
if (!empty($this->script)) {
|
||||
Builder::getInstance()->addScript($this->script);
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -544,17 +598,16 @@ class Field
|
|||
'id' => $this->getId(),
|
||||
'label' => $this->label,
|
||||
'name' => $this->getName(),
|
||||
'extKey' => $this->extKey,
|
||||
'tableRowKey' => $this->tableRowKey,
|
||||
'value' => $this->value ? $this->value : $this->default,
|
||||
'class' => ' ' . $this->class,
|
||||
'attr' => $this->attr . ($this->disabled ? ' disabled' : '') . ($this->readonly ? ' readonly onclick="return false;"' : ''),
|
||||
'attr' => $this->attr . ($this->disabled ? ' disabled' : '') . ($this->readonly ? ' readonly onclick="return false;"' : '') . (empty($this->style) ? '' : ' style="' . $this->style . '"'),
|
||||
'error' => $this->error,
|
||||
'size' => $this->size,
|
||||
'labelClass' => $this->size[0] < 12 ? $this->labelClass . ' control-label text-right' : $this->labelClass,
|
||||
'labelAttr' => empty($this->labelAttr) ? '' : ' ' . $this->labelAttr,
|
||||
'options' => $this->options,
|
||||
'help' => $this->help,
|
||||
'error' => $this->error,
|
||||
'showLabel' => $this->showLabel,
|
||||
'helptempl' => static::$helptempl,
|
||||
'labeltempl' => static::$labeltempl,
|
||||
|
|
|
@ -61,7 +61,7 @@ class MDEditor extends Field
|
|||
* }
|
||||
*/
|
||||
if (!isset($this->jsOptions['imageUploadURL']) || empty($this->jsOptions['imageUploadURL'])) {
|
||||
$token = md5('uploadtoken' . time() . uniqid());
|
||||
$token = session('uploadtoken') ? session('uploadtoken') : md5('uploadtoken' . time() . uniqid());
|
||||
|
||||
session('uploadtoken', $token);
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@ class MultipleFile extends Field
|
|||
'/assets/tpextbuilder/css/uploadfiles.css',
|
||||
];
|
||||
|
||||
protected $canUpload = true;
|
||||
|
||||
protected $files = [];
|
||||
|
||||
protected $jsOptions = [
|
||||
|
@ -49,6 +51,8 @@ class MultipleFile extends Field
|
|||
'fileSingleSizeLimit' => 5 * 1024 * 1024,
|
||||
'fileNumLimit' => 5,
|
||||
'fileSizeLimit' => 0,
|
||||
'thumbnailWidth' => 165,
|
||||
'thumbnailHeight' => 110,
|
||||
];
|
||||
|
||||
protected $extTypes = [
|
||||
|
@ -70,6 +74,18 @@ class MultipleFile extends Field
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param boolean $val
|
||||
* @return $this
|
||||
*/
|
||||
public function canUpload($val)
|
||||
{
|
||||
$this->canUpload = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
* fileNumLimit
|
||||
|
@ -97,7 +113,7 @@ class MultipleFile extends Field
|
|||
public function render()
|
||||
{
|
||||
if (!isset($this->jsOptions['upload_url']) || empty($this->jsOptions['upload_url'])) {
|
||||
$token = md5('uploadtoken' . time() . uniqid());
|
||||
$token = session('uploadtoken') ? session('uploadtoken') : md5('uploadtoken' . time() . uniqid());
|
||||
|
||||
session('uploadtoken', $token);
|
||||
|
||||
|
@ -112,8 +128,11 @@ class MultipleFile extends Field
|
|||
$this->files = is_array($this->default) ? $this->default : explode(',', $this->default);
|
||||
}
|
||||
|
||||
$this->jsOptions['canUpload'] = $this->canUpload && empty($this->tableRowKey);
|
||||
|
||||
$vars = array_merge($vars, [
|
||||
'jsOptions' => $this->jsOptions,
|
||||
'canUpload' => $this->canUpload && empty($this->tableRowKey),
|
||||
'files' => $this->files,
|
||||
]);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class Tinymce extends Field
|
|||
$inputId = $this->getId();
|
||||
|
||||
if (!isset($this->jsOptions['images_upload_url']) || empty($this->jsOptions['images_upload_url'])) {
|
||||
$token = md5('uploadtoken' . time() . uniqid());
|
||||
$token = session('uploadtoken') ? session('uploadtoken') : md5('uploadtoken' . time() . uniqid());
|
||||
|
||||
session('uploadtoken', $token);
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ EOT;
|
|||
public function render()
|
||||
{
|
||||
if (empty($this->uploadUrl)) {
|
||||
|
||||
$token = md5('uploadtoken' . time() . uniqid());
|
||||
|
||||
$token = session('uploadtoken') ? session('uploadtoken') : md5('uploadtoken' . time() . uniqid());$token = md5('uploadtoken' . time() . uniqid());
|
||||
|
||||
session('uploadtoken', $token);
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ class WangEditor extends Field
|
|||
$inputId = $this->getId();
|
||||
|
||||
if (!isset($this->jsOptions['uploadImgServer']) || empty($this->jsOptions['uploadImgServer'])) {
|
||||
$token = md5('uploadtoken' . time() . uniqid());
|
||||
|
||||
$token = session('uploadtoken') ? session('uploadtoken') : md5('uploadtoken' . time() . uniqid());
|
||||
|
||||
session('uploadtoken', $token);
|
||||
|
||||
$this->jsOptions['uploadImgServer'] = url('/tpextbuilder/admin/upload/upfiles', ['type' => 'wangeditor', 'token' => $token]);
|
||||
|
|
181
src/form/Row.php
181
src/form/Row.php
|
@ -18,6 +18,8 @@ class Row extends Wapper implements Renderable
|
|||
|
||||
protected $attr = '';
|
||||
|
||||
protected $style = '';
|
||||
|
||||
protected $errorClass = '';
|
||||
|
||||
/**
|
||||
|
@ -44,61 +46,167 @@ class Row extends Wapper implements Renderable
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function createDisplayer($class, $arguments)
|
||||
{
|
||||
$displayer = new $class($arguments[0], $arguments[1]);
|
||||
$displayer->setWapper($this);
|
||||
$displayer->created();
|
||||
|
||||
$this->displayer = $displayer;
|
||||
|
||||
return $displayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param int $val
|
||||
* @return $this
|
||||
*/
|
||||
public function size($val)
|
||||
{
|
||||
$this->size = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function style($val)
|
||||
{
|
||||
$this->style = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
function class ($val)
|
||||
{
|
||||
$this->class = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function attr($val)
|
||||
{
|
||||
$this->attr = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function errorClass($val)
|
||||
{
|
||||
$this->errorClass = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSize()
|
||||
{
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
public function getClass()
|
||||
{
|
||||
return empty($this->class) ? '' : ' ' . $this->class;
|
||||
}
|
||||
|
||||
public function getErrorClass()
|
||||
{
|
||||
return empty($this->errorClass) ? '' : ' ' . $this->errorClass;
|
||||
}
|
||||
|
||||
public function getAttr()
|
||||
{
|
||||
return empty($this->attr) ? '' : ' ' . $this->attr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function addClass($val)
|
||||
{
|
||||
$this->class .= ' ' . $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function addAttr($val)
|
||||
{
|
||||
$this->attr .= ' ' . $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function addStyle($val)
|
||||
{
|
||||
$this->style .= $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSize()
|
||||
{
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getClass()
|
||||
{
|
||||
return empty($this->class) ? '' : ' ' . $this->class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorClass()
|
||||
{
|
||||
return empty($this->errorClass) ? '' : ' ' . $this->errorClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAttr()
|
||||
{
|
||||
return (empty($this->attr) ? '' : ' ' . $this->attr) . (empty($this->style) ? '' : ' style="' . $this->style . '"');
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStyle()
|
||||
{
|
||||
return $this->style;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return \tpext\builder\displayer\Field
|
||||
*/
|
||||
public function getDisplayer()
|
||||
{
|
||||
return $this->displayer;
|
||||
|
@ -114,6 +222,17 @@ class Row extends Wapper implements Renderable
|
|||
return $this->displayer->beforRender();
|
||||
}
|
||||
|
||||
public function createDisplayer($class, $arguments)
|
||||
{
|
||||
$displayer = new $class($arguments[0], $arguments[1]);
|
||||
$displayer->setWapper($this);
|
||||
$displayer->created();
|
||||
|
||||
$this->displayer = $displayer;
|
||||
|
||||
return $displayer;
|
||||
}
|
||||
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
if (static::isDisplayer($name)) {
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
namespace tpext\builder\table;
|
||||
|
||||
|
||||
use tpext\builder\form\Row;
|
||||
|
||||
class Column extends Row
|
||||
class Column extends Row
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,210 @@
|
|||
<?php
|
||||
|
||||
namespace tpext\builder\toolbar;
|
||||
|
||||
use think\response\View as ViewShow;
|
||||
use tpext\builder\common\Builder;
|
||||
use tpext\builder\common\Plugin;
|
||||
use tpext\builder\common\Renderable;
|
||||
|
||||
class Bar implements Renderable
|
||||
{
|
||||
protected $view = '';
|
||||
|
||||
protected $class = 'btn-default';
|
||||
|
||||
protected $name = '';
|
||||
|
||||
protected $label = '';
|
||||
|
||||
protected $attr = '';
|
||||
|
||||
protected $style = '';
|
||||
|
||||
protected $js = [];
|
||||
|
||||
protected $css = [];
|
||||
|
||||
protected $script = [];
|
||||
|
||||
public function __construct($name, $label = '')
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->label = $label;
|
||||
}
|
||||
|
||||
public function created()
|
||||
{
|
||||
$fieldType = preg_replace('/.+?\\\(\w+)$/', '$1', get_called_class());
|
||||
|
||||
$fieldType = lcfirst($fieldType);
|
||||
|
||||
$defaultClass = Wapper::hasDefaultFieldClass($fieldType);
|
||||
|
||||
if (!empty($defaultClass)) {
|
||||
$this->class = $defaultClass;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return 'tool-' . $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function label($val)
|
||||
{
|
||||
$this->label = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function style($val)
|
||||
{
|
||||
$this->style = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
function class ($val)
|
||||
{
|
||||
$this->class = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function attr($val)
|
||||
{
|
||||
$this->attr = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function addClass($val)
|
||||
{
|
||||
$this->class .= ' ' . $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function addAttr($val)
|
||||
{
|
||||
$this->attr .= ' ' . $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function addStyle($val)
|
||||
{
|
||||
$this->attr .= $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function beforRender()
|
||||
{
|
||||
if (!empty($this->js)) {
|
||||
Builder::getInstance()->addJs($this->js);
|
||||
}
|
||||
|
||||
if (!empty($this->css)) {
|
||||
Builder::getInstance()->addCss($this->css);
|
||||
}
|
||||
|
||||
if (!empty($this->script)) {
|
||||
Builder::getInstance()->addScript($this->script);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$vars = $this->commonVars();
|
||||
|
||||
$viewshow = $this->getViewInstance();
|
||||
|
||||
return $viewshow->assign($vars)->getContent();
|
||||
}
|
||||
|
||||
protected function getViewInstance()
|
||||
{
|
||||
$template = Plugin::getInstance()->getRoot() . implode(DIRECTORY_SEPARATOR, ['src', 'view', 'toolbar', $this->view . '.html']);
|
||||
|
||||
$viewshow = new ViewShow($template);
|
||||
|
||||
return $viewshow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function commonVars()
|
||||
{
|
||||
$vars = [
|
||||
'id' => $this->getId(),
|
||||
'label' => $this->label,
|
||||
'name' => $this->getName(),
|
||||
'class' => ' ' . $this->class,
|
||||
'attr' => $this->attr . (empty($this->style) ? '' : ' style="' . $this->style . '"'),
|
||||
];
|
||||
|
||||
return $vars;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace tpext\builder\toolbar;
|
||||
|
||||
class Html extends Bar
|
||||
{
|
||||
protected $view = 'html';
|
||||
|
||||
public function __construct($html)
|
||||
{
|
||||
$this->label = $html;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
|
||||
namespace tpext\builder\toolbar;
|
||||
|
||||
class LinkBtn extends Bar
|
||||
{
|
||||
protected $view = 'linkbtn';
|
||||
|
||||
protected $class = 'btn-default';
|
||||
|
||||
protected $icon = '';
|
||||
|
||||
protected $href = 'javascript:;';
|
||||
|
||||
protected $postChecked = '';
|
||||
|
||||
protected $confirm = true;
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function icon($val)
|
||||
{
|
||||
$this->icon = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $val
|
||||
* @return $this
|
||||
*/
|
||||
public function href($val)
|
||||
{
|
||||
$this->icon = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function postChecked($url, $confirm = true)
|
||||
{
|
||||
$this->postChecked = $url;
|
||||
$this->confirm = $confirm;
|
||||
}
|
||||
|
||||
protected function postCheckedScript()
|
||||
{
|
||||
$script = '';
|
||||
$inputId = $this->getId();
|
||||
|
||||
$script = <<<EOT
|
||||
|
||||
window.postChecked('{$inputId}', '{$this->postChecked}', {$this->confirm});
|
||||
|
||||
EOT;
|
||||
$this->script[] = $script;
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
public function beforRender()
|
||||
{
|
||||
if ($this->postChecked) {
|
||||
$this->postCheckedScript();
|
||||
}
|
||||
|
||||
return parent::beforRender();
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$vars = $this->commonVars();
|
||||
|
||||
$vars = array_merge($vars, [
|
||||
'icon' => $this->icon,
|
||||
'href' => $this->href,
|
||||
]);
|
||||
|
||||
$viewshow = $this->getViewInstance();
|
||||
|
||||
return $viewshow->assign($vars)->getContent();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace tpext\builder\toolbar;
|
||||
|
||||
/**
|
||||
* Class Wapper.
|
||||
*
|
||||
* @method \tpext\builder\toolbar\LinkBtn linkBtn($name, $label)
|
||||
* @method \tpext\builder\toolbar\Html html($html)
|
||||
*/
|
||||
|
||||
class Wapper
|
||||
{
|
||||
protected static $displayers = [];
|
||||
|
||||
protected static $displayerMap = [
|
||||
'linkBtn' => \tpext\builder\toolbar\LinkBtn::class,
|
||||
'html' => \tpext\builder\toolbar\Html::class,
|
||||
];
|
||||
|
||||
protected static $defaultFieldClass = [
|
||||
'linkBtn' => 'btn-sm',
|
||||
];
|
||||
|
||||
public static function isDisplayer($name)
|
||||
{
|
||||
if (empty(static::$displayers)) {
|
||||
static::$displayers = array_keys(static::$displayerMap);
|
||||
}
|
||||
|
||||
return in_array($name, static::$displayers);
|
||||
}
|
||||
|
||||
public static function hasDefaultFieldClass($type)
|
||||
{
|
||||
if (isset(static::$defaultFieldClass[$type])) {
|
||||
return static::$defaultFieldClass[$type];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function extend($pair)
|
||||
{
|
||||
static::$displayerMap = array_merge(static::$displayerMap, $pair);
|
||||
}
|
||||
|
||||
public static function setdefaultFieldClass($pair)
|
||||
{
|
||||
static::$defaultFieldClass = array_merge(static::$defaultFieldClass, $pair);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{include file="$labeltempl" /}
|
||||
<div class="col-md-{$size[1]}">
|
||||
<div class="col-md-{$size[1]} checkbox-div" id="{$id}">
|
||||
{if condition="$checkallBtn"}
|
||||
<label class="lyear-checkbox m-t-10 m-b-10 {$class}">
|
||||
<input type="checkbox" class="checkall" id="checkall-{$name}"
|
||||
|
@ -9,8 +9,8 @@
|
|||
{volist name="options" id="option"}
|
||||
<label class="lyear-checkbox {$inline} {$class}">
|
||||
<input type="checkbox" value="{$key}" class="check-{$name}" {in
|
||||
name="$key" value="$checked"}checked{/in}
|
||||
id="fomm-{$name}-{$key}" name="{$name}" {$attr|raw}><span>{$option}</span>
|
||||
name="$key" value="$checked" }checked{/in}
|
||||
id="{$id}-{$key}" name="{$name}" {$attr|raw}><span>{$option}</span>
|
||||
</label>
|
||||
{/volist}
|
||||
{include file="$helptempl" /}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{if condition="$showLabel"}
|
||||
<label class="col-md-{$size[0]} {$labelClass}"{$labelAttr|raw} for="{$id}">{$label}</label>
|
||||
<label class="col-md-{$size[0]} {$labelClass}"{$labelAttr|raw} for="{$id}">{$label|raw}</label>
|
||||
{/if}
|
|
@ -3,24 +3,29 @@
|
|||
<div class="js-upload-files">
|
||||
<input type="hidden" name="{$name}" class="form-control {$class}"
|
||||
value="{$value}" id="{$id}" {$attr|raw}>
|
||||
{if condition="$canUpload"}
|
||||
<div id="picker_{$name}"><i class="mdi mdi-cloud-upload"></i> 上传{if
|
||||
condition="$jsOptions.multiple"}多{else/}单{/if}个文件</div>
|
||||
{/if}
|
||||
|
||||
<ul id="file_list_{$name}" class="list-inline clearfix
|
||||
lyear-uploads-pic">
|
||||
{volist name="files" id="file"}
|
||||
<li class="col-xs-6 col-sm-3 col-md-2 pic-item" id="flie{$key}">
|
||||
<li class="pic-item" id="flie{$key}">
|
||||
<figure>
|
||||
<div>
|
||||
<img style="display: none;" class="preview-img"
|
||||
src="{$file}" />
|
||||
src="{$file}" />
|
||||
</div>
|
||||
<figcaption>
|
||||
<a class="btn btn-round btn-square btn-primary
|
||||
btn-link-pic" data-id="file{$key}"
|
||||
href="{$file}"><i class="mdi mdi-eye"></i></a>
|
||||
{if condition="$canUpload"}
|
||||
<a class="btn btn-round btn-square btn-danger
|
||||
btn-remove-pic" href="javascript:;"><i class="mdi
|
||||
mdi-delete"></i></a>
|
||||
{/if}
|
||||
</figcaption>
|
||||
</figure>
|
||||
</li>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{include file="$labeltempl" /}
|
||||
<div class="col-md-{$size[1]}">
|
||||
<div class="col-md-{$size[1]} radio-div" id="{$id}">
|
||||
{volist name="options" id="option"}
|
||||
<label class="lyear-radio {$inline} {$class}">
|
||||
<input type="radio" value="{$key}" class="check-{$name}" {if
|
||||
condition="$key eq $checked"}checked{/if} id="fomm-{$name}-{$key}"
|
||||
condition="$key eq $checked" }checked{/if} id="{$id}-{$key}"
|
||||
name="{$name}" {$attr|raw}><span>{$option}</span>
|
||||
</label>
|
||||
{/volist}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<form action="{$action}" method="{$method|default='post'}" enctype="multipart/form-data" class="{$class}"
|
||||
<form action="{$action}" method="{$method|default='post'}" enctype="multipart/form-data" class="{$class} {$attr|raw}"
|
||||
id="thefrom">
|
||||
<div class="row">
|
||||
{volist name="rows" id="row"}
|
||||
|
|
|
@ -2,18 +2,36 @@
|
|||
{notempty name="$headers"}
|
||||
<thead>
|
||||
<tr>
|
||||
{if condition="$rowCheckbox"}
|
||||
<th style="width: 40px;">
|
||||
<label class="checkbox-primary">
|
||||
<input type="checkbox" id="checkall-{$name}"
|
||||
data-check="check-{$name}" class="checkall table-row-checkall"><span></span>
|
||||
</label>
|
||||
</th>
|
||||
{/if}
|
||||
{volist name="headers" id="header"}
|
||||
<th>{$header}</th>
|
||||
<th {$headStyle|raw}>{$header}</th>
|
||||
{/volist}
|
||||
</tr>
|
||||
</thead>
|
||||
{/notempty}
|
||||
<tbody>
|
||||
{volist name="list" id="row" key="rowKey"}
|
||||
{volist name="list" id="row"}
|
||||
<tr>
|
||||
{if condition="$rowCheckbox"}
|
||||
<td style="width: 40px;">
|
||||
<label class="checkbox-primary">
|
||||
<input type="checkbox" id="{$name}-{$key}"
|
||||
value="{$ids[$key]}"
|
||||
class="check-{$name} table-row"><span></span>
|
||||
</label>
|
||||
</td>
|
||||
{/if}
|
||||
{volist name="row" id="col"}
|
||||
<td {:$col.displayer->getAttr()}>
|
||||
{:$col.displayer->value($col.value)->extKey('-'.$rowKey)->render()}
|
||||
<td class="col-md-{$col.wapper->getSize()}{$col.wapper->getClass()}"
|
||||
{$col.wapper->getAttr()|raw}>
|
||||
{$col.value|raw}
|
||||
</td>
|
||||
{/volist}
|
||||
</tr>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{notempty name="$elms"}
|
||||
<div class="toolbar-btn-action m-b-10 {$class}" {$attr|raw}>
|
||||
{volist name="elms" id="elm"}
|
||||
{:$elm->render()}
|
||||
{/volist}
|
||||
</div>
|
||||
{/notempty}
|
|
@ -0,0 +1 @@
|
|||
{$label|raw}
|
|
@ -0,0 +1,2 @@
|
|||
<a class="btn btn-sm m-r-5 {$class}" id="{$id}" {$attr|raw} href="{$href}">{if condition="$icon"}<i
|
||||
class="mdi {$icon}"></i>{/if}{$label|raw}</a>
|
Loading…
Reference in New Issue