Changeset 5662 in subversion


Ignore:
Timestamp:
Dec 29, 2011 4:35:01 AM (17 months ago)
Author:
alec
Message:
  • Add separate pagesize setting for mail messages and contacts (#1488269)
Location:
trunk/roundcubemail
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r5659 r5662  
    22=========================== 
    33 
     4- Add separate pagesize setting for mail messages and contacts (#1488269) 
    45- Fix handling of INBOX's subfolders in special folders config (#1488279) 
    56- Add ifModule statement for setting Options -Indexes in .htaccess file (#1488274) 
  • trunk/roundcubemail/config/main.inc.php.dist

    r5562 r5662  
    655655$rcmail_config['skin'] = 'default'; 
    656656 
    657 // show up to X items in list view 
    658 $rcmail_config['pagesize'] = 40; 
     657// show up to X items in messages list view 
     658$rcmail_config['mail_pagesize'] = 50; 
     659 
     660// show up to X items in contacts list view 
     661$rcmail_config['addressbook_pagesize'] = 50; 
    659662 
    660663// use this timezone to display date/time 
  • trunk/roundcubemail/installer/config.php

    r4822 r5662  
    525525</dd> 
    526526 
    527 <dt class="propname">pagesize <span class="userconf">*</span></dt> 
    528 <dd> 
    529 <?php 
    530  
    531 $input_pagesize = new html_inputfield(array('name' => '_pagesize', 'size' => 6, 'id' => "cfgpagesize")); 
    532 echo $input_pagesize->show($RCI->getprop('pagesize')); 
    533  
    534 ?> 
    535 <div>Show up to X items in list view.</div> 
     527<dt class="propname">mail_pagesize <span class="userconf">*</span></dt> 
     528<dd> 
     529<?php 
     530 
     531$pagesize = $RCI->getprop('mail_pagesize'); 
     532if (!$pagesize) { 
     533    $pagesize = $RCI->getprop('pagesize'); 
     534} 
     535$input_pagesize = new html_inputfield(array('name' => '_mail_pagesize', 'size' => 6, 'id' => "cfgmailpagesize")); 
     536echo $input_pagesize->show($pagesize); 
     537 
     538?> 
     539<div>Show up to X items in the mail messages list view.</div> 
     540</dd> 
     541 
     542<dt class="propname">addressbook_pagesize <span class="userconf">*</span></dt> 
     543<dd> 
     544<?php 
     545 
     546$pagesize = $RCI->getprop('addressbook_pagesize'); 
     547if (!$pagesize) { 
     548    $pagesize = $RCI->getprop('pagesize'); 
     549} 
     550$input_pagesize = new html_inputfield(array('name' => '_addressbook_pagesize', 'size' => 6, 'id' => "cfgabookpagesize")); 
     551echo $input_pagesize->show($pagesize); 
     552 
     553?> 
     554<div>Show up to X items in the contacts list view.</div> 
    536555</dd> 
    537556 
  • trunk/roundcubemail/installer/rcube_install.php

    r5614 r5662  
    4141    'addrbook_show_images' => 'show_images', 
    4242    'imap_root' => 'imap_ns_personal', 
     43    'pagesize' => 'mail_pagesize', 
    4344  ); 
    44    
     45 
    4546  // these config options are required for a working system 
    4647  var $required_config = array( 
     
    4849    'des_key', 'session_lifetime', 
    4950  ); 
    50    
     51 
    5152  /** 
    5253   * Constructor 
     
    170171          $value = $value[0]; 
    171172      } 
    172       else if ($prop == 'pagesize') { 
     173      else if ($prop == 'mail_pagesize' || $prop == 'addressbook_pagesize') { 
    173174        $value = max(2, intval($value)); 
    174175      } 
  • trunk/roundcubemail/program/include/rcmail.php

    r5564 r5662  
    599599 
    600600    // enable caching of imap data 
    601     $imap_cache = $this->config->get('imap_cache'); 
     601    $imap_cache     = $this->config->get('imap_cache'); 
    602602    $messages_cache = $this->config->get('messages_cache'); 
    603603    // for backward compatybility 
     
    606606        $messages_cache = true; 
    607607    } 
     608 
    608609    if ($imap_cache) 
    609610        $this->imap->set_caching($imap_cache); 
     
    612613 
    613614    // set pagesize from config 
    614     $this->imap->set_pagesize($this->config->get('pagesize', 50)); 
    615  
    616     // Setting root and delimiter before establishing the connection 
    617     // can save time detecting them using NAMESPACE and LIST 
     615    $pagesize = $this->config->get('mail_pagesize'); 
     616    if (!$pagesize) { 
     617        $pagesize = $this->config->get('pagesize', 50); 
     618    } 
     619    $this->imap->set_pagesize($pagesize); 
     620 
     621    // set connection options 
    618622    $options = array( 
    619623      'auth_type'   => $this->config->get('imap_auth_type', 'check'), 
  • trunk/roundcubemail/program/js/app.js

    r5654 r5662  
    56595659  }; 
    56605660 
    5661   this.toggle_prefer_html = function(checkbox) 
    5662   { 
    5663     $('#rcmfd_show_images').prop('disabled', !checkbox.checked).val(0); 
    5664   }; 
    5665  
    5666   this.toggle_preview_pane = function(checkbox) 
    5667   { 
    5668     $('#rcmfd_preview_pane_mark_read').prop('disabled', !checkbox.checked); 
    5669   }; 
    5670  
    56715661  // display fetched raw headers 
    56725662  this.set_headers = function(content) 
  • trunk/roundcubemail/program/localization/en_US/labels.inc

    r5562 r5662  
    413413$labels['maintenance'] = 'Maintenance'; 
    414414$labels['newmessage'] = 'New Message'; 
    415 $labels['listoptions'] = 'List Options'; 
    416415$labels['signatureoptions'] = 'Signature Options'; 
    417416$labels['whenreplying'] = 'When replying'; 
  • trunk/roundcubemail/program/steps/addressbook/delete.inc

    r4951 r5662  
    104104    // create resultset object 
    105105    $count  = count($records); 
    106     $first  = ($page-1) * $CONFIG['pagesize']; 
     106    $first  = ($page-1) * $PAGE_SIZE; 
    107107    $result = new rcube_result_set($count, $first); 
    108108 
    109109    // get records from the next page to add to the list 
    110     $pages = ceil((count($records) + $delcnt) / $CONFIG['pagesize']); 
     110    $pages = ceil((count($records) + $delcnt) / $PAGE_SIZE); 
    111111    if ($_GET['_from'] != 'show' && $pages > 1 && $page < $pages) { 
    112112        // sort the records 
    113113        ksort($records, SORT_LOCALE_STRING); 
    114114 
    115         $first += $CONFIG['pagesize']; 
     115        $first += $PAGE_SIZE; 
    116116        // create resultset object 
    117117        $res = new rcube_result_set($count, $first - $delcnt); 
    118118 
    119         if ($CONFIG['pagesize'] < $count) { 
     119        if ($PAGE_SIZE < $count) { 
    120120            $records = array_slice($records, $first - $delcnt, $delcnt); 
    121121        } 
     
    133133 
    134134    // get records from the next page to add to the list 
    135     $pages = ceil(($result->count + $delcnt) / $CONFIG['pagesize']); 
     135    $pages = ceil(($result->count + $delcnt) / $PAGE_SIZE); 
    136136    if ($_GET['_from'] != 'show' && $pages > 1 && $page < $pages) { 
    137137        $CONTACTS->set_page($page); 
     
    141141 
    142142// update message count display 
    143 $OUTPUT->set_env('pagecount', ceil($result->count / $CONFIG['pagesize'])); 
     143$OUTPUT->set_env('pagecount', ceil($result->count / $PAGE_SIZE)); 
    144144$OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($result)); 
    145145 
  • trunk/roundcubemail/program/steps/addressbook/func.inc

    r5645 r5662  
    5757); 
    5858 
     59$PAGE_SIZE = $RCMAIL->config->get('addressbook_pagesize'); 
     60if (!$PAGE_SIZE) { 
     61    $PAGE_SIZE = $RCMAIL->config->get('pagesize', 50); 
     62} 
    5963 
    6064// Addressbook UI 
     
    109113function rcmail_contact_source($source=null, $init_env=false, $writable=false) 
    110114{ 
    111     global $RCMAIL, $OUTPUT, $CONFIG, $CONTACT_COLTYPES; 
     115    global $RCMAIL, $OUTPUT, $CONTACT_COLTYPES, $PAGE_SIZE; 
    112116 
    113117    if (!strlen($source)) { 
     
    117121    // Get object 
    118122    $CONTACTS = $RCMAIL->get_address_book($source, $writable); 
    119     $CONTACTS->set_pagesize($CONFIG['pagesize']); 
     123    $CONTACTS->set_pagesize($PAGE_SIZE); 
    120124 
    121125    // set list properties and session vars 
     
    392396function rcmail_get_rowcount_text($result=null) 
    393397{ 
    394     global $CONTACTS, $CONFIG; 
     398    global $CONTACTS, $PAGE_SIZE; 
    395399 
    396400    // read nr of contacts 
     
    406410            'vars'  => array( 
    407411            'from'  => $result->first + 1, 
    408             'to'    => min($result->count, $result->first + $CONFIG['pagesize']), 
     412            'to'    => min($result->count, $result->first + $PAGE_SIZE), 
    409413            'count' => $result->count) 
    410414        )); 
  • trunk/roundcubemail/program/steps/addressbook/list.inc

    r5315 r5662  
    5757 
    5858    // create resultset object 
    59     $count  = count($records); 
    60     $first  = ($page-1) * $CONFIG['pagesize']; 
     59    $count    = count($records); 
     60    $first  = ($page-1) * $PAGE_SIZE; 
    6161    $result = new rcube_result_set($count, $first); 
    6262 
    6363    // we need only records for current page 
    64     if ($CONFIG['pagesize'] < $count) { 
    65         $records = array_slice($records, $first, $CONFIG['pagesize']); 
     64    if ($PAGE_SIZE < $count) { 
     65        $records = array_slice($records, $first, $PAGE_SIZE); 
    6666    } 
    6767 
     
    7474    // get contacts for this user 
    7575    $result = $CONTACTS->list_records(array('name')); 
    76      
     76 
    7777    if (!$result->count && $result->searchonly) { 
    7878        $OUTPUT->show_message('contactsearchonly', 'notice'); 
     
    8282 
    8383// update message count display 
    84 $OUTPUT->set_env('pagecount', ceil($result->count / $CONFIG['pagesize'])); 
     84$OUTPUT->set_env('pagecount', ceil($result->count / $PAGE_SIZE)); 
    8585$OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($result)); 
    8686 
  • trunk/roundcubemail/program/steps/addressbook/search.inc

    r5406 r5662  
    8989function rcmail_contact_search() 
    9090{ 
    91     global $RCMAIL, $OUTPUT, $CONFIG, $SEARCH_MODS_DEFAULT; 
     91    global $RCMAIL, $OUTPUT, $SEARCH_MODS_DEFAULT, $PAGE_SIZE; 
    9292 
    9393    $adv = isset($_POST['_adv']); 
     
    199199 
    200200    // cut first-page records 
    201     if ($CONFIG['pagesize'] < $count) { 
    202         $records = array_slice($records, 0, $CONFIG['pagesize']); 
     201    if ($PAGE_SIZE < $count) { 
     202        $records = array_slice($records, 0, $PAGE_SIZE); 
    203203    } 
    204204 
     
    229229    // update message count display 
    230230    $OUTPUT->command('set_env', 'search_request', $search_request); 
    231     $OUTPUT->command('set_env', 'pagecount', ceil($result->count / $CONFIG['pagesize'])); 
     231    $OUTPUT->command('set_env', 'pagecount', ceil($result->count / $PAGE_SIZE)); 
    232232    $OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($result)); 
    233233    // Re-set current source 
  • trunk/roundcubemail/program/steps/settings/func.inc

    r5661 r5662  
    158158    $blocks = array( 
    159159      'main' => array('name' => Q(rcube_label('mainoptions'))), 
    160       'list' => array('name' => Q(rcube_label('listoptions'))), 
    161160    ); 
    162161 
     
    176175    } 
    177176 
    178     // show page size selection 
     177    // timezone selection 
    179178    if (!isset($no_override['timezone'])) { 
    180179      $field_id = 'rcmfd_timezone'; 
     
    277276    } 
    278277 
    279     // show page size selection 
    280     if (!isset($no_override['pagesize'])) { 
    281       $field_id = 'rcmfd_pgsize'; 
    282       $input_pagesize = new html_inputfield(array('name' => '_pagesize', 'id' => $field_id, 'size' => 5)); 
    283  
    284       $blocks['list']['options']['pagesize'] = array( 
    285         'title' => html::label($field_id, Q(rcube_label('pagesize'))), 
    286         'content' => $input_pagesize->show($config['pagesize']), 
    287       ); 
    288     } 
    289  
    290278    // show drop-down for available skins 
    291279    if (!isset($no_override['skin'])) { 
     
    379367    } 
    380368 
     369    // show page size selection 
     370    if (!isset($no_override['pagesize'])) { 
     371      $field_id = 'rcmfd_pagesize'; 
     372      $input_pagesize = new html_inputfield(array('name' => '_pagesize', 'id' => $field_id, 'size' => 5)); 
     373 
     374      $blocks['main']['options']['pagesize'] = array( 
     375        'title' => html::label($field_id, Q(rcube_label('pagesize'))), 
     376        'content' => $input_pagesize->show($config['pagesize']), 
     377      ); 
     378    } 
     379 
    381380    if (!isset($no_override['keep_alive'])) { 
    382381      $field_id = 'rcmfd_keep_alive'; 
     
    688687        'title' => html::label($field_id, Q(rcube_label('autocompletesingle'))), 
    689688        'content' => $checkbox->show($config['autocomplete_single']?1:0), 
     689      ); 
     690    } 
     691 
     692    // show addressbook page size selection 
     693    if (!isset($no_override['addressbook_pagesize'])) { 
     694      $field_id = 'rcmfd_addressbook_pagesize'; 
     695      $input_pagesize = new html_inputfield(array('name' => '_addressbook_pagesize', 'id' => $field_id, 'size' => 5)); 
     696 
     697      $size = $config['addressbook_pagesize'] ? $config['addressbook_pagesize'] : $config['pagesize']; 
     698 
     699      $blocks['main']['options']['pagesize'] = array( 
     700        'title' => html::label($field_id, Q(rcube_label('pagesize'))), 
     701        'content' => $input_pagesize->show((int)$size), 
    690702      ); 
    691703    } 
  • trunk/roundcubemail/program/steps/settings/save_prefs.inc

    r5564 r5662  
    3232      'timezone'     => isset($_POST['_timezone']) ? (is_numeric($_POST['_timezone']) ? floatval($_POST['_timezone']) : get_input_value('_timezone', RCUBE_INPUT_POST)) : $CONFIG['timezone'], 
    3333      'dst_active'   => isset($_POST['_dst_active']) ? TRUE : FALSE, 
    34       'pagesize'     => is_numeric($_POST['_pagesize']) ? max(2, intval($_POST['_pagesize'])) : $CONFIG['pagesize'], 
    3534      'date_format'  => isset($_POST['_date_format']) ? get_input_value('_date_format', RCUBE_INPUT_POST) : $CONFIG['date_format'], 
    3635      'time_format'  => isset($_POST['_time_format']) ? get_input_value('_time_format', RCUBE_INPUT_POST) : ($CONFIG['time_format'] ? $CONFIG['time_format'] : 'H:i'), 
     
    3837      'skin'         => isset($_POST['_skin']) ? get_input_value('_skin', RCUBE_INPUT_POST) : $CONFIG['skin'], 
    3938    ); 
    40      
     39 
    4140    // compose derived date/time format strings 
    4241    if ((isset($_POST['_date_format']) || isset($_POST['_time_format'])) && $a_user_prefs['date_format'] && $a_user_prefs['time_format']) { 
     
    5554      'keep_alive'           => isset($_POST['_keep_alive']) ? intval($_POST['_keep_alive'])*60 : $CONFIG['keep_alive'], 
    5655      'check_all_folders'    => isset($_POST['_check_all_folders']) ? TRUE : FALSE, 
     56      'mail_pagesize'        => is_numeric($_POST['_mail_pagesize']) ? max(2, intval($_POST['_mail_pagesize'])) : $CONFIG['mail_pagesize'], 
    5757    ); 
    5858 
     
    9494  case 'addressbook': 
    9595    $a_user_prefs = array( 
    96       'default_addressbook' => get_input_value('_default_addressbook', RCUBE_INPUT_POST, true), 
    97       'autocomplete_single' => isset($_POST['_autocomplete_single']) ? TRUE : FALSE, 
     96      'default_addressbook'  => get_input_value('_default_addressbook', RCUBE_INPUT_POST, true), 
     97      'autocomplete_single'  => isset($_POST['_autocomplete_single']) ? TRUE : FALSE, 
     98      'addressbook_pagesize' => is_numeric($_POST['_addressbook_pagesize']) ? max(2, intval($_POST['_addressbook_pagesize'])) : $CONFIG['addressbook_pagesize'], 
    9899    ); 
    99100 
     
    151152 
    152153    // force min size 
    153     if ($a_user_prefs['pagesize'] < 1) 
    154       $a_user_prefs['pagesize'] = 10; 
    155  
    156     if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['pagesize'] > $CONFIG['max_pagesize'])) 
    157       $a_user_prefs['pagesize'] = (int) $CONFIG['max_pagesize']; 
     154    if ($a_user_prefs['mail_pagesize'] < 1) 
     155      $a_user_prefs['mail_pagesize'] = 10; 
     156    if ($a_user_prefs['addressbook_pagesize'] < 1) 
     157      $a_user_prefs['addressbook_pagesize'] = 10; 
     158 
     159    if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['mail_pagesize'] > $CONFIG['max_pagesize'])) 
     160      $a_user_prefs['mail_pagesize'] = (int) $CONFIG['max_pagesize']; 
     161    if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['addressbook_pagesize'] > $CONFIG['max_pagesize'])) 
     162      $a_user_prefs['addressbook_pagesize'] = (int) $CONFIG['max_pagesize']; 
    158163 
    159164    $a_user_prefs['timezone'] = (string) $a_user_prefs['timezone']; 
Note: See TracChangeset for help on using the changeset viewer.