<?php /*a:4:{s:84:"E:\phpstudy_pro\WWW\data\hkcms\template\admin\adminlte\routine\attachment\index.html";i:1715617489;s:74:"E:\phpstudy_pro\WWW\data\hkcms\template\admin\adminlte\common\default.html";i:1715617489;s:71:"E:\phpstudy_pro\WWW\data\hkcms\template\admin\adminlte\common\meta.html";i:1715617489;s:73:"E:\phpstudy_pro\WWW\data\hkcms\template\admin\adminlte\common\script.html";i:1715617489;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta name="csrf-token" content="<?php echo token(); ?>">

    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="referrer" content="never">
<meta name="renderer" content="webkit">
<title><?php echo $site['title']; ?> - <?php echo lang("Backstage panel"); ?></title>

<link rel="Shortcut Icon" href="<?php echo $site['favicon']; ?>?v=<?php echo env('APP_DEBUG')?time():$site['version']; ?>" type="image/x-icon" />

<!-- Font Awesome 5.13.0 字体图标库 -->
<link rel="stylesheet" href="/static/libs/fontawesome-free/css/all.min.css">
<!-- AdminLTE v3.2.0 | Bootstrap v4.6.0 CSS框架 -->
<link rel="stylesheet" href="/static/module/admin/adminlte/css/adminlte.css?v=<?php echo env('APP_DEBUG')?time():$site['version']; ?>">
<link rel="stylesheet" href="/static/module/admin/adminlte/css/common.css?v=<?php echo env('APP_DEBUG')?time():$site['version']; ?>">

<script type="text/javascript">
    window.Config = <?php echo json_encode($site); ?>;
    window.Lang = <?php echo json_encode($tempLang); ?>;
    window.Tpl = <?php echo json_encode($Tpl); ?>;
</script>

    <style>
        html,body,.wrapper {
            height: 100% !important;
        }
        .content {
            min-height: 100%;
            height: auto;
            padding-bottom: 20px;
            background-color: #f2f3f5;
        }
        .operatePage .card-footer {
            width: 100%;
            position: fixed;
            bottom: 0;
            z-index: 99;
        }
    </style>

    {__STYLE__}

</head>
<body class="sidebar-mini layout-top-nav overlayScrollbars" >

    <?php if(empty($popup)): ?>
    <!-- 子页 -->
    <div class="wrapper">
        <div class="content">
            <div class="container-fluid" style="padding-top: 16px">
                <div class="card card-primary">
    <div class="card-body">
        <!--筛选-->
        <div class="filter-panel d-none">
            <form action="" method="get" class="frm-filter">
                <div class="row">
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <label class="row-form-label"><?php echo lang("Title"); ?></label>
                            <input type="text" class="form-control" name="title" placeholder="<?php echo lang("Title"); ?>" data-op="like %...%">
                        </div>
                    </div>
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <label class="row-form-label"><?php echo lang('Suffix'); ?></label>
                            <select name="ext" class="form-control">
                                <option value=""><?php echo lang('All'); ?></option>
                                <?php if(is_array($ext) || $ext instanceof \think\Collection || $ext instanceof \think\Paginator): $i = 0; $__LIST__ = $ext;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                <option value="<?php echo $vo; ?>"><?php echo $vo; ?></option>
                                <?php endforeach; endif; else: echo "" ;endif; ?>
                            </select>
                        </div>
                    </div>
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <label class="row-form-label"><?php echo lang('Size'); ?></label>
                            <input type="hidden" name="size" data-op="BETWEEN">

                            <div class="row">
                                <div class="col-6">
                                    <input type="number" class="form-control" id="size_start" placeholder="<?php echo lang('Unit byte'); ?>">
                                </div>
                                <div class="col-6">
                                    <input type="number" class="form-control" id="size_end" placeholder="<?php echo lang('Unit byte'); ?>">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <input type="submit" class="btn btn-primary" value="<?php echo lang('Search'); ?>">
                            <input type="reset" class="btn btn-default ml-2" value="<?php echo lang('Reset'); ?>">
                        </div>
                    </div>
                </div>
            </form>
            <hr>
        </div>

        <div id="toolbar" class="toolbar">
            <?php if(has_rule('common/upload')): ?>
            <div class="file-upload-group">
                <button type="button" class="btn btn-primary btn-uploads"
                        data-multiple="true"
                        data-mimetype="*">
                    <i class="fas fa-arrow-alt-circle-up"></i> <?php echo lang('Upload'); ?>
                </button>
            </div>

            <button type="button" class="btn btn-default btn-remote" data-toggle="tooltip"><i class="fas fa-download"></i> <?php echo __('Remote download'); ?></button>
            <?php endif; if(has_rule('routine/attachment/water')): ?>
            <button type="button" class="btn btn-default btn-water" data-toggle="tooltip"><i class="fas fa-tint"></i> <?php echo __('Watermark'); ?></button>
            <?php endif; if(has_rule('routine/attachment/thumb')): ?>
            <button type="button" class="btn btn-default btn-thumb" data-toggle="tooltip"><i class="far fa-image"></i> <?php echo __('Thumbnail'); ?></button>
            <?php endif; ?>

            <button type="button" class="btn btn-disabled btn-danger disabled btn-del " data-url="<?php echo url('/routine.attachment/del'); ?>"><i class="fas fa-trash-alt"></i>
                <?php echo lang('Delete'); ?></button>
        </div>
        <table id="table"
               data-del="<?php if(has_rule('del')): ?><?php echo url('/routine.attachment/del'); ?><?php endif; ?>"
               data-edit="<?php if(has_rule('edit')): ?><?php echo url('/routine.attachment/edit'); ?><?php endif; ?>"
        ></table>
    </div>
</div>

{block:script}
<script>
    require(['admin','table'], function (admin, Table) {
        $(function () {
            var table = Table.init({
                url: "<?php echo url('/routine.attachment/index'); ?>",
                showToggle: false,
                search: false,
                pagination: true,
                customFilter: true,
                pageSize: 10,
                escape: false,
                sortName: 'update_time',
                sortOrder: 'desc',
                columns: [{
                    field: 'state',
                    checkbox: true,
                },{
                    field: 'user_id',
                    title: '<?php echo lang("User ID"); ?>',
                    visible: false
                },{
                    field: 'user_name',
                    title: '<?php echo lang("Username"); ?>',
                },{
                    field: 'title',
                    title: '<?php echo lang("Title"); ?>',
                    formatter: function (value, row, index, field) {
                        if (value.length>27) {
                            return '<span title="'+value+'">'+(value.substring(0,27)+'...')+'</span>'
                        }
                        return value;
                    }
                },{
                    field: 'cdn_url',
                    title: '<?php echo lang("Preview"); ?>',
                    formatter: Table.formatter.image,
                    events: Table.events.image
                },{
                    field: 'path',
                    title: '<?php echo lang("Path"); ?>',
                    visible: false
                },{
                    field: 'size_text',
                    title: '<?php echo lang("Size (kb)"); ?>',
                },{
                    field: 'storage',
                    title: '<?php echo lang("Storage"); ?>',
                },{
                    field: 'ext',
                    title: '<?php echo lang("Suffix"); ?>',
                },{
                    field: 'md5',
                    title: 'md5',
                    visible: false
                },{
                    field: 'mime_type',
                    title: '<?php echo lang("Mime type"); ?>',
                    visible: false
                },{
                    field: 'remark',
                    title: '<?php echo lang("Remark"); ?>',
                    visible: false
                },{
                    field: 'create_time',
                    title: '<?php echo lang("Create time"); ?>',
                },{
                    field: 'update_time',
                    title: '<?php echo lang("Update time"); ?>',
                    visible: false
                },{
                    field: 'operate',
                    title: '<?php echo lang("Operate"); ?>',
                    formatter: Table.formatter.operate,
                    events: Table.events.operate
                }]});

            // 远程下载
            $('.btn-remote').click(function (e) {
                layer.prompt({title: '<?php echo __("Please enter the remote attachment address"); ?>', formType: 2}, function(url, index){
                    var ind = layer.load(1);
                    $.post('<?php echo url("/routine.attachment/download"); ?>',{ url:url },function (e) {
                        layer.close(ind);
                        if (e.code==200) {
                            layer.msg(e.msg,{time:1000},function () {
                                table.bootstrapTable('refresh');
                                layer.close(index);
                            })
                        } else {
                            layer.alert(e.msg);
                        }
                    });
                });
            });

            // 水印
            $('.btn-water').click(function (e) {
                hkcms.api.open('<?php echo url("/routine.attachment/water"); ?>?popup=1',"<?php echo __('Watermark'); ?>");
            });

            // 缩略图
            $('.btn-thumb').click(function (e) {
                hkcms.api.open('<?php echo url("/routine.attachment/thumb"); ?>?popup=1',"<?php echo __('Thumbnail'); ?>");
            });
        })
    })
</script>
{/block:script}
            </div>
        </div>
    </div>

    <?php else: ?>
    <div class="operatePage">
        <div class="card card-primary">
    <div class="card-body">
        <!--筛选-->
        <div class="filter-panel d-none">
            <form action="" method="get" class="frm-filter">
                <div class="row">
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <label class="row-form-label"><?php echo lang("Title"); ?></label>
                            <input type="text" class="form-control" name="title" placeholder="<?php echo lang("Title"); ?>" data-op="like %...%">
                        </div>
                    </div>
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <label class="row-form-label"><?php echo lang('Suffix'); ?></label>
                            <select name="ext" class="form-control">
                                <option value=""><?php echo lang('All'); ?></option>
                                <?php if(is_array($ext) || $ext instanceof \think\Collection || $ext instanceof \think\Paginator): $i = 0; $__LIST__ = $ext;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                <option value="<?php echo $vo; ?>"><?php echo $vo; ?></option>
                                <?php endforeach; endif; else: echo "" ;endif; ?>
                            </select>
                        </div>
                    </div>
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <label class="row-form-label"><?php echo lang('Size'); ?></label>
                            <input type="hidden" name="size" data-op="BETWEEN">

                            <div class="row">
                                <div class="col-6">
                                    <input type="number" class="form-control" id="size_start" placeholder="<?php echo lang('Unit byte'); ?>">
                                </div>
                                <div class="col-6">
                                    <input type="number" class="form-control" id="size_end" placeholder="<?php echo lang('Unit byte'); ?>">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <input type="submit" class="btn btn-primary" value="<?php echo lang('Search'); ?>">
                            <input type="reset" class="btn btn-default ml-2" value="<?php echo lang('Reset'); ?>">
                        </div>
                    </div>
                </div>
            </form>
            <hr>
        </div>

        <div id="toolbar" class="toolbar">
            <?php if(has_rule('common/upload')): ?>
            <div class="file-upload-group">
                <button type="button" class="btn btn-primary btn-uploads"
                        data-multiple="true"
                        data-mimetype="*">
                    <i class="fas fa-arrow-alt-circle-up"></i> <?php echo lang('Upload'); ?>
                </button>
            </div>

            <button type="button" class="btn btn-default btn-remote" data-toggle="tooltip"><i class="fas fa-download"></i> <?php echo __('Remote download'); ?></button>
            <?php endif; if(has_rule('routine/attachment/water')): ?>
            <button type="button" class="btn btn-default btn-water" data-toggle="tooltip"><i class="fas fa-tint"></i> <?php echo __('Watermark'); ?></button>
            <?php endif; if(has_rule('routine/attachment/thumb')): ?>
            <button type="button" class="btn btn-default btn-thumb" data-toggle="tooltip"><i class="far fa-image"></i> <?php echo __('Thumbnail'); ?></button>
            <?php endif; ?>

            <button type="button" class="btn btn-disabled btn-danger disabled btn-del " data-url="<?php echo url('/routine.attachment/del'); ?>"><i class="fas fa-trash-alt"></i>
                <?php echo lang('Delete'); ?></button>
        </div>
        <table id="table"
               data-del="<?php if(has_rule('del')): ?><?php echo url('/routine.attachment/del'); ?><?php endif; ?>"
               data-edit="<?php if(has_rule('edit')): ?><?php echo url('/routine.attachment/edit'); ?><?php endif; ?>"
        ></table>
    </div>
</div>

{block:script}
<script>
    require(['admin','table'], function (admin, Table) {
        $(function () {
            var table = Table.init({
                url: "<?php echo url('/routine.attachment/index'); ?>",
                showToggle: false,
                search: false,
                pagination: true,
                customFilter: true,
                pageSize: 10,
                escape: false,
                sortName: 'update_time',
                sortOrder: 'desc',
                columns: [{
                    field: 'state',
                    checkbox: true,
                },{
                    field: 'user_id',
                    title: '<?php echo lang("User ID"); ?>',
                    visible: false
                },{
                    field: 'user_name',
                    title: '<?php echo lang("Username"); ?>',
                },{
                    field: 'title',
                    title: '<?php echo lang("Title"); ?>',
                    formatter: function (value, row, index, field) {
                        if (value.length>27) {
                            return '<span title="'+value+'">'+(value.substring(0,27)+'...')+'</span>'
                        }
                        return value;
                    }
                },{
                    field: 'cdn_url',
                    title: '<?php echo lang("Preview"); ?>',
                    formatter: Table.formatter.image,
                    events: Table.events.image
                },{
                    field: 'path',
                    title: '<?php echo lang("Path"); ?>',
                    visible: false
                },{
                    field: 'size_text',
                    title: '<?php echo lang("Size (kb)"); ?>',
                },{
                    field: 'storage',
                    title: '<?php echo lang("Storage"); ?>',
                },{
                    field: 'ext',
                    title: '<?php echo lang("Suffix"); ?>',
                },{
                    field: 'md5',
                    title: 'md5',
                    visible: false
                },{
                    field: 'mime_type',
                    title: '<?php echo lang("Mime type"); ?>',
                    visible: false
                },{
                    field: 'remark',
                    title: '<?php echo lang("Remark"); ?>',
                    visible: false
                },{
                    field: 'create_time',
                    title: '<?php echo lang("Create time"); ?>',
                },{
                    field: 'update_time',
                    title: '<?php echo lang("Update time"); ?>',
                    visible: false
                },{
                    field: 'operate',
                    title: '<?php echo lang("Operate"); ?>',
                    formatter: Table.formatter.operate,
                    events: Table.events.operate
                }]});

            // 远程下载
            $('.btn-remote').click(function (e) {
                layer.prompt({title: '<?php echo __("Please enter the remote attachment address"); ?>', formType: 2}, function(url, index){
                    var ind = layer.load(1);
                    $.post('<?php echo url("/routine.attachment/download"); ?>',{ url:url },function (e) {
                        layer.close(ind);
                        if (e.code==200) {
                            layer.msg(e.msg,{time:1000},function () {
                                table.bootstrapTable('refresh');
                                layer.close(index);
                            })
                        } else {
                            layer.alert(e.msg);
                        }
                    });
                });
            });

            // 水印
            $('.btn-water').click(function (e) {
                hkcms.api.open('<?php echo url("/routine.attachment/water"); ?>?popup=1',"<?php echo __('Watermark'); ?>");
            });

            // 缩略图
            $('.btn-thumb').click(function (e) {
                hkcms.api.open('<?php echo url("/routine.attachment/thumb"); ?>?popup=1',"<?php echo __('Thumbnail'); ?>");
            });
        })
    })
</script>
{/block:script}
    </div>
    <?php endif; ?>

    <script src="/static/libs/require/require.js"></script>
<script src="/static/module/admin/adminlte/js/main.js?v=<?php echo env('APP_DEBUG')?time():$site['version']; ?>"></script>

<!-- // 加载插件JS-->
<?php echo load_js(); ?>



    {__SCRIPT__}
    
</body>
</html>