thomascube
2008-07-31 d224551cfbf5903505f41bc9e51ad9840119942f
Fix read_when_deleted behavior + javascript codestyle

4 files modified
21 ■■■■ changed files
config/main.inc.php.dist 2 ●●● patch | view | raw | blame | history
program/include/rcmail.php 2 ●●● patch | view | raw | blame | history
program/js/app.js 10 ●●●●● patch | view | raw | blame | history
program/steps/mail/move_del.inc 7 ●●●● patch | view | raw | blame | history
config/main.inc.php.dist
@@ -175,7 +175,7 @@
// When a Trash folder is not present and a message is deleted, flag 
// the message for deletion rather than deleting it immediately.  Setting this to 
// false causes deleted messages to be permanantly removed if there is no Trash folder
$rcmail_config['flag_for_deletion'] = TRUE;
$rcmail_config['flag_for_deletion'] = FALSE;
// Behavior if a received message requests a message delivery notification (read receipt)
// 0 = ask the user, 1 = send automatically, 2 = ignore (never send or ask)
program/include/rcmail.php
@@ -243,7 +243,7 @@
    if (!($this->output instanceof rcube_template))
      $this->output = new rcube_template($this->task, $framed);
    foreach (array('flag_for_deletion') as $js_config_var) {
    foreach (array('flag_for_deletion','read_when_deleted') as $js_config_var) {
      $this->output->set_env($js_config_var, $this->config->get($js_config_var));
    }
program/js/app.js
@@ -1532,6 +1532,11 @@
            rows[id].classname += ' deleted';
            this.set_classname(rows[id].obj, 'deleted', true);
            }
          if (this.env.read_when_deleted)
          {
            rows[id].classname = rows[id].classname.replace(/\s*unread/, '');
            this.set_classname(rows[id].obj, 'unread', false);
          }
        
      if (rows[id].icon && this.env.deletedicon)
            rows[id].icon.src = this.env.deletedicon;
@@ -1783,6 +1788,11 @@
          rows[uid].classname += ' deleted';
          this.set_classname(rows[uid].obj, 'deleted', true);
          }
        if (this.env.read_when_deleted)
        {
          rows[uid].classname = rows[uid].classname.replace(/\s*unread/, '');
          this.set_classname(rows[uid].obj, 'unread', false);
        }
        
    if (rows[uid].icon && this.env.deletedicon)
          rows[uid].icon.src = this.env.deletedicon;
program/steps/mail/move_del.inc
@@ -29,7 +29,12 @@
    $target = get_input_value('_target_mbox', RCUBE_INPUT_POST);
    $moved = $IMAP->move_message($uids, $target, get_input_value('_mbox', RCUBE_INPUT_POST));
  
    if (!$moved) {
    if ($moved) {
        // flag old messages as read because rcube_imap will not send expunge command after moving
        if ($CONFIG['read_when_deleted'])
            $IMAP->set_flag($uids, 'SEEN');
    }
    else {
        // send error message
        $OUTPUT->command('list_mailbox');
        $OUTPUT->show_message('errormoving', 'error');