Ticket #1483863: logout_purge.patch

File logout_purge.patch, 6.2 kB (added by alec, 8 months ago)
  • config/main.inc.php.dist

    diff -ru /home/alec/trunk/roundcubemail/config/main.inc.php.dist rc-beta/config/main.inc.php.dist
    old new  
    241241$rcmail_config['dont_override'] = array(); 
    242242 
    243243// list of configuration option names that need to be available in Javascript. 
    244 $rcmail_config['javascript_config'] = array('read_when_deleted', 'flag_for_deletion'); 
     244$rcmail_config['javascript_config'] = array('read_when_deleted', 'flag_for_deletion', 'logout_purge'); 
    245245 
    246246// try to load host-specific configuration 
    247247$rcmail_config['include_host_config'] = false; 
     
    283283// default setting if preview pane is enabled 
    284284$rcmail_config['preview_pane'] = FALSE; 
    285285 
     286// Empty trash folder on logout 
     287$rcmail_config['logout_purge'] = FALSE; 
     288 
    286289// don't let users set pagesize to more than this value if set 
    287290$rcmail_config['max_pagesize'] = 200; 
    288291 
  • program/js/app.js

    diff -ru /home/alec/trunk/roundcubemail/program/js/app.js rc-beta/program/js/app.js
    old new  
    488488        break; 
    489489 
    490490      case 'logout': 
    491         this.goto_url('logout', '', true); 
    492         break;       
     491        this.logout(); 
     492        break; 
    493493 
    494494      // commands to switch task 
    495495      case 'mail': 
     
    11901190  }; 
    11911191 
    11921192 
     1193  this.logout = function() 
     1194    { 
     1195      var ref = this; 
     1196      var func = function() { ref.goto_url('logout', '', true); }; 
     1197 
     1198      if (this.env.logout_purge) 
     1199        { 
     1200          var url = '_mbox=' + urlencode(this.env.trash_mailbox) + '&_reload=1'; 
     1201          this.set_busy(true, 'loading'); 
     1202          this.http_post('purge', url, true, func); 
     1203        } 
     1204      else 
     1205        func(); 
     1206    } 
     1207 
     1208 
    11931209  /*********************************************************/ 
    11941210  /*********     (message) list functionality      *********/ 
    11951211  /*********************************************************/ 
     
    33793395   
    33803396 
    33813397  // send a http request to the server 
    3382   this.http_request = function(action, querystring, lock) 
     3398  this.http_request = function(action, querystring, lock, oncomplete) 
    33833399    { 
    33843400    var request_obj = this.get_request_obj(); 
    33853401    querystring += (querystring ? '&' : '') + '_remote=1'; 
     
    33993415      var rcm = this; 
    34003416      request_obj.__lock = lock ? true : false; 
    34013417      request_obj.__action = action; 
    3402       request_obj.onerror = function(o){ ref.http_error(o); }; 
    3403       request_obj.oncomplete = function(o){ ref.http_response(o); }; 
     3418      request_obj.onerror = function(o){ rcm.http_error(o); }; 
     3419      if (oncomplete && typeof(oncomplete) == 'function') 
     3420        request_obj.oncomplete = function(o){ rcm.http_response(o); oncomplete(); }; 
     3421      else 
     3422        request_obj.oncomplete = function(o){ rcm.http_response(o); }; 
    34043423      request_obj.GET(this.env.comm_path+'&_action='+action+'&'+querystring); 
    34053424      } 
    34063425    }; 
    34073426 
    34083427    // send a http POST request to the server 
    3409     this.http_post = function(action, postdata, lock) 
     3428    this.http_post = function(action, postdata, lock, oncomplete) 
    34103429      { 
    34113430      var request_obj; 
    34123431      if (postdata && typeof(postdata) == 'object') 
     
    34263445        request_obj.__lock = lock ? true : false; 
    34273446        request_obj.__action = action; 
    34283447        request_obj.onerror = function(o){ rcm.http_error(o); }; 
    3429         request_obj.oncomplete = function(o){ rcm.http_response(o); }; 
    3430         request_obj.POST(this.env.comm_path+'&_action='+action, postdata); 
     3448        if (oncomplete && typeof(oncomplete) == 'function') 
     3449          request_obj.oncomplete = function(o){ rcm.http_response(o); oncomplete(); }; 
     3450        else 
     3451          request_obj.oncomplete = function(o){ rcm.http_response(o); }; 
     3452        request_obj.POST(this.env.comm_path+'&_action='+action, postdata); 
     3453 
     3454        return request_obj; 
    34313455        } 
    34323456      }; 
    34333457 
  • program/localization/en_US/labels.inc

    diff -ru /home/alec/trunk/roundcubemail/program/localization/en_US/labels.inc rc-beta/program/localization/en_US/labels.inc
    old new  
    250250$labels['htmleditor'] = 'Compose HTML messages'; 
    251251$labels['htmlsignature'] = 'HTML signature'; 
    252252$labels['previewpane'] = 'Show preview pane'; 
     253$labels['logoutpurge'] = 'Empty trash folder on logout'; 
    253254 
    254255$labels['autosavedraft']  = 'Automatically save draft'; 
    255256$labels['everynminutes']  = 'every $n minutes'; 
  • program/steps/settings/func.inc

    diff -ru /home/alec/trunk/roundcubemail/program/steps/settings/func.inc rc-beta/program/steps/settings/func.inc
    old new  
    195195                    $select_autosave->show($CONFIG['draft_autosave'])); 
    196196    } 
    197197 
     198  // trash purge on logout 
     199  if (!isset($no_override['logout_purge'])) 
     200    { 
     201    $field_id = 'rcmfd_logout_purge'; 
     202    $input_purge = new checkbox(array('name' => '_logout_purge', 'id' => $field_id, 'value' => 1)); 
     203    $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 
     204                    $field_id, 
     205                    Q(rcube_label('logoutpurge')), 
     206                    $input_purge->show($CONFIG['logout_purge']?1:0)); 
     207    } 
     208 
    198209  $out .= "\n</table>$form_end"; 
    199210 
    200211  return $out;   
  • program/steps/settings/save_prefs.inc

    diff -ru /home/alec/trunk/roundcubemail/program/steps/settings/save_prefs.inc rc-beta/program/steps/settings/save_prefs.inc
    old new  
    2727  'prefer_html'  => isset($_POST['_prefer_html']) ? TRUE : FALSE, 
    2828  'htmleditor'   => isset($_POST['_htmleditor']) ? TRUE : FALSE, 
    2929  'preview_pane' => isset($_POST['_preview_pane']) ? TRUE : FALSE, 
    30   'draft_autosave' => isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0 
     30  'logout_purge' => isset($_POST['_logout_purge']) ? TRUE : FALSE, 
     31  'draft_autosave' => isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0, 
    3132  ); 
    3233 
    3334// don't override these parameters