Records per page

Discussion in 'General' started by Christophe GUHRING, Mar 2, 2023.

  1. Christophe GUHRING

    Christophe GUHRING New Member

    Hi,
    I've searched a while without finding anything about that....
    I would like to change the default "15" records par page to "100" for all lists in ISPConfig 3.2.9

    In my preceding installation, I remember that I have been able to change/save this in an easy way, but now It's not saved...

    Thanks in advance.
     
  2. Christophe GUHRING

    Christophe GUHRING New Member

    Up

    Is there any way to modify that behavior, including modifying php files ? (and If I must mofify after each upgrade it's not a problem, but I dont know which php file is responsible of fixing this "15" value per default in select-box)
     
  3. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    i believe it's set by
    Code:
            public function onShow()
            {
                    global $app;
    
                    //* Set global Language File
                    $lng_file = ISPC_LIB_PATH.'/lang/'.$app->functions->check_language($_SESSION['s']['language']).'.lng';
                    if(!file_exists($lng_file))
                            $lng_file = ISPC_LIB_PATH.'/lang/en.lng';
                    include $lng_file;
                    $app->tpl->setVar($wb);
    
                    //* Limit each page
                    $limits = array('5'=>'5', '15'=>'15', '25'=>'25', '50'=>'50', '100'=>'100', '999999999' => 'all');
    
                    //* create options and set selected, if default -> 15 is selected
    
                    $options = '';
                    foreach($limits as $key => $val){
                            $options .= '<option value="'.$key.'" '.(isset($_SESSION['search']['limit']) &&  $_SESSION['search']['limit'] == $key ? 'selected="selected"':'' ).(!isset($_SESSION['search']['limit']) && $key == '15' ? 'selected="selected"':'').'>'.$val.'</option>';
                    }
                    $app->tpl->setVar('search_limit', '<select name="search_limit" class="search_limit" style="width: 60px;">'.$options.'</select>');
    
                    $app->tpl->setVar('toolsarea_head_txt', $app->lng('toolsarea_head_txt'));
                    $app->tpl->setVar($app->listform->wordbook);
                    $app->tpl->setVar('form_action', $app->listform->listDef['file']);
    
                    if(isset($_SESSION['show_info_msg'])) {
                            $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
                            unset($_SESSION['show_info_msg']);
                    }
                    if(isset($_SESSION['show_error_msg'])) {
                            $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
                            unset($_SESSION['show_error_msg']);
                    }
    
                    //* Parse the templates and send output to the browser
                    $this->onShowEnd();
            }
    
    
    
    in /usr/local/ispconfig/interface/lib/classes/listform_actions_inc.php
    with the default value set by $key == '15'

    although if you edit this, i have no idea if that can be put into conf-custom though to make it update safe.
     
    ahrasis likes this.
  4. Christophe GUHRING

    Christophe GUHRING New Member

    Thank you, I've made some testing, and after grepping with "$_SESSION['search']['limit']" I've found this line in "/usr/local/ispconfig/interface/lib/classes/listform.inc.php"
    Code:
    line 306 : if(intval($_SESSION['search']['limit']) < 1) $_SESSION['search']['limit'] = 15;
    So I've replaced by
    Code:
    line 306 : if(intval($_SESSION['search']['limit']) < 1) $_SESSION['search']['limit'] = (isset($conf['search_limit_default']) ? intval($conf['search_limit_default']) : 15);
    And added in "/usr/local/ispconfig/interface/lib/config.inc.php"
    Code:
    $conf['search_limit_default'] = 100;
    Maybe, this could be great if that little tweak can be added in a future update.
     
    kobuki and ahrasis like this.

Share This Page