联系官方销售客服

1835022288

028-61286886

迅睿框架 版主:迅睿框架研发组
这个浏览有分页吗没找到如果图片多的话怎么看到以前的图片
类型:迅睿CMS 更新时间:2020-05-14 14:13:53 分页

image

这个浏览有分页吗,没找到,如果图片多的话怎么看到以前的图片

回帖
  • #1楼    迅睿框架创始人
    2020-05-05 11:27:25
    Google Pixel 手机 0
    不支持的,只显示最多30个,可以按ID来搜索
  • 张益达
    #2楼    张益达
    2020-05-05 11:30:45
    Chrome 0
    回复迅睿框架创始人问题是ID是啥都不知道名字有可能是乱七八糟的字母这就很尴尬不会是让在附件管理看下ID好,然后搜吧
  • 开黑吗我玩辅助
    #3楼    开黑吗我玩辅助
    2020-05-05 12:41:41
    Chrome 0
    我记得应用市场有一个组件可以
  • 张益达
    #4楼    张益达
    2020-05-05 13:10:25
    Chrome 0
    开黑吗我玩辅助找了一下貌似没找到
  • 张益达
    #5楼    张益达
    2020-05-05 15:49:03
    Chrome 0
    回复迅睿框架创始人
    image
    这样的控制器能进行重写吗?
  • 易学习
    #6楼    易学习
    2020-05-05 16:05:41
    Chrome 0
    不能,记住core,fcms都不能修改,会影响升级,其他地方可以随便改张益达
  • 张益达
    #7楼    张益达
    2020-05-05 16:08:36
    Chrome 0
    易学习我知道核心的东西不能修改,我的意思是能不能通过和重写 My/Model 一样重写这个
  • 眼镜
    #8楼    眼镜
    2020-05-05 16:17:58
    Chrome 0
    在模板里面写标签实现分页啊,不难的
  • 张益达
    #9楼    张益达
    2020-05-05 16:24:05
    Chrome 0
    眼镜我看这个貌似不行啊
    image
    通过标签能实现吗?
  • 张益达
    #10楼    张益达
    2020-05-05 17:06:28
    Chrome 0
        public function input_file_list() {
    
            $p = $this->_get_upload_params();
    
            $c = (int)\Phpcmf\Service::L('input')->get('ct'); // 当已有数量
            $ct = max(1, (int)$p['count']); // 可上传数量
    		
    		
            if (IS_AJAX_POST) {
                $p = (int)\Phpcmf\Service::L('input')->post('is_page');
    			
                $ids = \Phpcmf\Service::L('input')->get_post_ids($p ? 'ids1' : 'ids0');
                if (!$ids) {
                    $this->_json(0, dr_lang('至少要选择一个文件'));
                } elseif (dr_count($ids) > $ct - $c) {
                    $this->_json(0, dr_lang('只能选择%s个文件,你已经选择%s个', $ct - $c, dr_count($ids)));
                }
                $list = [];
                $temp = \Phpcmf\Service::M()->table($p ? 'attachment_data' : 'attachment_unused')->where('uid', $this->uid)->where_in('id', $ids)->limit_page();
                foreach ($temp as $t) {
                    $list[] = [
                        'id' => $t['id'],
                        'name' => $t['filename'],
                        'file' => $t['attachment'],
                        'url' => dr_get_file($t['id']),
                        'preview' => dr_file_preview_html(dr_get_file_url($t)),
                        'upload' => '<input type="file" name="file_data"></button>',
                    ];
                }
    
                $data = [
                    'count' => dr_count($ids),
                    'result' => $list,
                ];
                $this->_json(1, dr_lang('已选择%s个文件', $data['count']), $data);
            }
    
            $num = 14;
            $exts = dr_safe_replace($p['exts']);
    
            $list = [
                'used' => [],
                'unused' => $exts ? \Phpcmf\Service::M()->table('attachment_unused')->where('uid', $this->uid)->where_in('fileext', explode(',', $exts))->order_by('id desc')->getAll($num) : \Phpcmf\Service::M()->table('attachment_unused')->order_by('id desc')->getAll($num),
            ];
    
            $sfield = [
                'id' => dr_lang('附件ID'),
                'filename' => dr_lang('附件名称'),
            ];
    
            // 搜索附件		
    		$search_url = '/index.php?is_ajax=1&s=api&c=file&m=input_file_list&p='.\Phpcmf\Service::L('input')->get('p')
    			.'&fid='.\Phpcmf\Service::L('input')->get('fid').'&ct='.\Phpcmf\Service::L('input')->get('ct').'&page={page}';
    		$config = require CMSPATH.'Config/Apage.php';
    		$total = \Phpcmf\Service::M()->table('attachment_data')->where('uid', $this->uid)->where_in('fileext', explode(',', $exts))->order_by('id desc')->limit_page($num)[1];
    		
            $name = \Phpcmf\Service::L('input')->get('name');
            $value = dr_safe_replace(\Phpcmf\Service::L('input')->get('value'));
            if ($name && isset($sfield[$name]) && $value) {
                $db = \Phpcmf\Service::M()->table('attachment_data');
                $exts && $db->where_in('fileext', explode(',', $exts));
                $where = !$this->member['is_admin'] ? 'uid = '.$this->uid : '1';
                if ($name == 'id') {
                    $where.= ' AND id='.intval($value);
                } else {
                    $where.= ' AND '.$name.' LIKE "%'.$value.'%"';
                }
                $list['used'] = $db->where($where)->order_by('id desc')->limit_page($num);
            } else {
                $list['used'] = $exts ? \Phpcmf\Service::M()->table('attachment_data')->where('uid', $this->uid)->where_in('fileext', explode(',', $exts))->order_by('id desc')->limit_page($num)[0] : \Phpcmf\Service::M()->table('attachment_data')->order_by('id desc')->limit_page($num)[0];
            }
    		
            \Phpcmf\Service::V()->admin();
            \Phpcmf\Service::V()->assign([
                'form' => dr_form_hidden(),
                'list' => $list,
                'sfield' => $sfield,
                'mypages' => \Phpcmf\Service::L('input')->table_page($search_url, $total, $config, $num),
                'param' => [
                    'name' => $name,
                    'value' => $value,
                ],
                'page' => intval($_GET['page']),
                'search_url' => $search_url,
            ]);
            \Phpcmf\Service::V()->display('api_upload_list.html');exit;
        }
    我这样改改不知道合适不合适,反正是附件可以分页了,改了框架的内容,找不到更好的方法了
  • 张益达
    #11楼    张益达
    2020-05-05 17:07:07
    Chrome 0
    反正是这样目前正常,弊端未知
  • 易学习
    #12楼    易学习
    2020-05-05 17:44:12
    Chrome 0
    弊端就升级后会被覆盖我的方法是 复制dayrui/Core/Views/api_upload_list.html到 dayrui/My/View/api_upload_list.html查询:
    <div class="files">
        {loop $list.used $i $t}
        {php $url = dr_get_file_url($t, 50, 50);}
        <div class="template-download yl_files_row files_row">
            <label class="mt-table mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                <input type="checkbox" class="checkboxes" name="ids1[]" value="{$t.id}" />
                <span></span>
            </label>
            <label class="files_row_preview preview">{dr_file_preview_html($url, 1)}</label>
            <label class="label label-sm label-success" style="margin-right: 10px;"> {dr_format_file_size($t.filesize)} </label>
            <label class="label label-sm label-default" title="{$t.filename}">{dr_strcut($t.filename, 10)}</label>
        </div>
        {/loop}
    </div>
    改成
    <?php
    
    $rule = '/index.php?is_ajax=1&s=api&c=file&m=input_file_list&p='.\Phpcmf\Service::L('input')->get('p')
    .'&fid='.\Phpcmf\Service::L('input')->get('fid').'&ct='.\Phpcmf\Service::L('input')->get('ct').'&page=1&pp=[page]';
    $_GET['page'] = $_GET['pp'];
    $sfield = [
    'id' => dr_lang('附件ID'),
    'filename' => dr_lang('附件名称'),
    ];
    
    $name = \Phpcmf\Service::L('input')->get('name');
    $value = dr_safe_replace(\Phpcmf\Service::L('input')->get('value'));
    $where = [];
    $exts && $where[] = "fileext in (".$exts.")";
    if ($name && isset($sfield[$name]) && $value) {
        $this->member['is_admin'] && $where[] = 'uid = '.$this->uid;
        if ($name == 'id') {
            $where[] = 'id='.intval($value);
        } else {
            $where[]= $name.' LIKE "%'.$value.'%"';
        }
    }
    $where = urlencode(implode(' AND ', $where));
    ?>
    {table table=attachment_data where=$where page=1 pagesize=10 urlrule=$rule}
    {php $url = dr_get_file_url($t, 50, 50);}
    <div class="template-download yl_files_row files_row">
        <label class="mt-table mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
            <input type="checkbox" class="checkboxes" name="ids1[]" value="{$t.id}" />
            <span></span>
        </label>
        <label class="files_row_preview preview">{dr_file_preview_html($url, 1)}</label>
        <label class="label label-sm label-success" style="margin-right: 10px;"> {dr_format_file_size($t.filesize)} </label>
        <label class="label label-sm label-default" title="{$t.filename}">{dr_strcut($t.filename, 10)}</label>
    </div>
    {/loop}
    
    分页 {$pages}

    image
  • 新手上路
    #13楼    新手上路
    2020-05-05 17:57:43
    Chrome 0
    学习哥很牛
  • 张益达
    #14楼    张益达
    2020-05-05 20:29:29
    Chrome 0
    易学习老哥牛皮,改成你的了
  • 海水正蓝
    #15楼    海水正蓝
    2020-05-05 20:46:26
    Chrome 0
    学习哥真大神,出神入化了
  • 张益达
    #16楼    张益达
    2020-05-05 20:49:14
    Chrome 0
    海水正蓝谁是学习哥
  • 风之传奇
    #17楼    风之传奇
    2020-05-06 09:24:19
    Chrome 0
    啊,长知识了。
  • 张益达
    #18楼    张益达
    2020-05-06 09:27:05
    Chrome 0
    风之传奇学习哥牛P
  • 张益达
    #19楼    张益达
    2020-05-14 14:13:53
    Chrome 0
    易学习老哥,你那个修改方法分页没问题了,如果开启了附件归档,未使用的附件选择确定时会提示 至少要选择一个文件 ,这个怎么搞?