Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#1433998 closed Feature Requests (None)

ReplyAll to a message - changes done

Reported by: tvkbhaskar Owned by: roundcube
Priority: 5 Milestone:
Component: User Interface Version: None
Severity: critical Keywords:
Cc:

Description

Hi all,
Please find the changes done to implement 'REPLYALL'
functionality in roundcube interface.

documentroot/index.php

  if ($_action=='compose')
    include('program/steps/mail/compose.inc');
// Below two lines are added 
  if ($_action=='composeall')
    include('program/steps/mail/composeall.inc');
// End of addition
  if ($_action=='addcontact')
    include('program/steps/mail/addcontact.inc');
     

document root/program/js/app.js

if (this.env.action=='show')
{
// Below line changed to include replyall
   this.enable_command('show', 'reply', 'replyall',
'forward', 'moveto', 'delete', 'viewsource', 'print',
'load-attachment', true);
// End of change
   if (this.env.next_uid)
      this.enable_command('nextmessage', true);
  if (this.env.prev_uid)
     this.enable_command('previousmessage', true);
}

document root/program/js/app.js

var input_replyto = rcube_find_object('_replyto');
// Below line added
var input_replyall = rcube_find_object('_replyall');
// End of addition
var input_subject = rcube_find_object('_subject');

document root/program/js/app.js

case 'reply':
var uid;
if (uid = this.get_single_uid())
{
this.set_busy(true);
location.href =
this.env.comm_path+'&_action=compose&_reply_uid='+uid+'&_mbox='+escape(this.env.mailbox);
}
break;
                                                      
                                                      
               
// Below case statements are added to handle replyall
case 'replyall':
var uid;
if (uid = this.get_single_uid())
{
this.set_busy(true);
location.href =
this.env.comm_path+'&_action=composeall&_reply_uid='+uid+'&_mbox='+escape(this.env.mailbox);
}
break;
// End of addition

case 'forward':
var uid;
if (uid = this.get_single_uid())
{
this.set_busy(true);
location.href =
this.env.comm_path+'&_action=compose&_forward_uid='+uid+'&_mbox='+escape(this.env.mailbox);
}
break;

document root/program/steps/mail/compose.inc
copy this file as program/steps/mail/composeall.inc and
do the following changes

change 1:

function rcmail_compose_headers($attrib)
  {
  global $IMAP, $REPLY_MESSAGE, $DB;
// Added $CONFIG 
  global $CONFIG;
                                                      
                                                      
               // End of addition
  list($form_start, $form_end) = get_form_tags($attrib);

Change 2:

    case 'cc':
      if (!$fname)
        {
        $fname = '_cc';
// Uncommented the below line
        $header = 'cc';
        }
// Added the following lines
// pass the following attributes to the form class
$field_attrib = array('name' => '_cc');
foreach ($attrib as $attr => $value)
if (in_array($attr, array('id', 'class', 'style', 'size')))
  $field_attrib[$attr] = $value;
                                                      
                                                      
               
$input_cc = new textfield($field_attrib);
$out = $input_cc->show($_POST['_cc']);
// End of addition

Change 3:

if ($fname && !empty($_POST[$fname]))
   $fvalue = $_POST[$fname];
else if ($header && is_object($REPLY_MESSAGE['headers']))
{
// get recipent address(es) out of the message headers
    if ($header=='to' &&
$REPLY_MESSAGE['headers']->replyto)
    $fvalue =
$IMAP->decode_header($REPLY_MESSAGE['headers']->replyto);
    else if ($header=='to' &&
$REPLY_MESSAGE['headers']->from)
      $fvalue =
$IMAP->decode_header($REPLY_MESSAGE['headers']->from);
                                                      
                                                      
               

if ($header=='cc') {
if ($header=='cc' && $REPLY_MESSAGE['headers']->to) {
      $fvalue =
$IMAP->decode_header($REPLY_MESSAGE['headers']->to);
    }
if ($header=='cc' && $REPLY_MESSAGE['headers']->cc) {
      $fvalue .= ',' .
$IMAP->decode_header($REPLY_MESSAGE['headers']->cc);
}
}
                                                      
                                                      
               
// split recipients and put them back together in a
unique way
$to_addresses = $IMAP->decode_address_list($fvalue);
    $fvalue = '';
    foreach ($to_addresses as $addr_part)
    {
// Following lines will prevent the senders email id to
come in the cc list
    $chk_addr_part = $addr_part['string'];
    $chk_addr_part_in = $_SESSION['username'] . '@' .
$CONFIG['default_host'];
    if (stristr($chk_addr_part, $chk_addr_part_in) ===
FALSE ) {
      $fvalue .= (strlen($fvalue) ? ',
':'').$addr_part['string'];
    }
    }

// end of changes in composeall.inc

document root/skins/default/templates/mail.html

<roundcube:button command="reply"
imageAct="/images/buttons/reply_act.png"
imagePas="/images/buttons/reply_pas.png" width="32"
height="32" title="replytomessage" />
// added the below line to indicate reply all
<roundcube:button command="replyall"
imageAct="/images/buttons/reply_act.png"
imagePas="/images/buttons/reply_pas.png" width="32"
height="32" title="replyalltomessage" />
// end of addition
<roundcube:button command="forward"
imageAct="/images/buttons/forward_act.png"
imagePas="/images/buttons/forward_pas.png" width="32"
height="32" title="forwardmessage" />


document root/skins/default/templates/message.html

<roundcube:button command="reply"
imageAct="/images/buttons/reply_act.png"
imagePas="/images/buttons/reply_pas.png" width="32"
height="32" title="replytomessage" />
// added the below line to indicate reply all
<roundcube:button command="replyall"
imageAct="/images/buttons/reply_act.png"
imagePas="/images/buttons/reply_pas.png" width="32"
height="32" title="replyalltomessage" />
// end of addition
<roundcube:button command="forward"
imageAct="/images/buttons/forward_act.png"
imagePas="/images/buttons/forward_pas.png" width="32"
height="32" title="forwardmessage" />

document root/program/localization/en/labels.inc

$labels['replytomessage']   = 'Reply to the message';
// added the below line
$labels['replyalltomessage']   = 'ReplyAll to the message';
// end of addition
$labels['forwardmessage']   = 'Forward the message';

I hope this will help the roundcube community.

Let me know if you have any doubts

regards
Bhaskar

Change History (2)

comment:1 Changed 7 years ago by tvkbhaskar

Logged In: YES 
user_id=723025

Pls find the changes done in document root/program/js/app.js
which got missed in the previous update

Change 1:

if (this.env.action=='compose')
this.enable_command('add-attachment', 'send-attachment',
'send', true);
                                                           
                                                           
     // Added the following lines
if (this.env.action=='composeall')
this.enable_command('add-attachment', 'send-attachment',
'send', true);
// end of addition
           
if (this.env.messagecount)
this.enable_command('select-all', 'select-none', true);

Change 2:
        if (this.env.action=='compose')
          this.init_messageform();
// Added the following line 
        if (this.env.action=='composeall')
          this.init_messageform();
// End of addition
        // show printing dialog
        if (this.env.action=='print')
          window.print();

Change 3:
      case 'compose':
        var url = this.env.comm_path+'&_action=compose';
                                                           
                                                           
     
        // modify url if we're in addressbook
        if (this.task=='addressbook')
          {
          url = this.get_task_url('mail', url);
          var a_cids = new Array();
                                                           
                                                           
     
          // use contact_id passed as command parameter
          if (props)
            a_cids[a_cids.length] = props;
                                                           
                                                           
     
          // get selected contacts
          else
            {
            for (var n=0; n<this.selection.length; n++)
              a_cids[a_cids.length] = this.selection[n];
            }
                                                           
                                                           
     
          if (a_cids.length)
            url += '&_to='+a_cids.join(',');
          else
            break;
          }
        else if (props)
           url += '&_to='+props;
                                                           
                                                           
     
        this.set_busy(true);
        location.href = url;
        break;
                                                           
                                                           
     // beginning of addition

      case 'composeall':
        var url = this.env.comm_path+'&_action=compose';
         
        // modify url if we're in addressbook
        if (this.task=='addressbook')
          {
          url = this.get_task_url('mail', url);
          var a_cids = new Array();
                                                           
                                                           
     
          // use contact_id passed as command parameter
          if (props)
            a_cids[a_cids.length] = props;
                                                           
                                                           
     
          // get selected contacts
          else
            {
            for (var n=0; n<this.selection.length; n++)
              a_cids[a_cids.length] = this.selection[n];
            }
                                                           
                                                           
     
          if (a_cids.length)
            url += '&_to='+a_cids.join(',');
          else
            break;
          }
        else if (props)
           url += '&_to='+props;
                                                           
                                                           
     
        this.set_busy(true);
        location.href = url;
        break;
                                                           
                                                           
     // end of addition

      case 'send':
        if (!this.gui_objects.messageform)
          break;


Please ignore the below change indicated in the first update
var input_replyto = rcube_find_object('_replyto');
// Below line added -  to be ignore
var input_replyall = rcube_find_object('_replyall');
// End of addition - to be ignore
var input_subject = rcube_find_object('_subject');

regards


comment:2 Changed 7 years ago by roundcube

  • Status changed from assigned to closed
Logged In: YES 
user_id=1262041

Thanks for your code but reply-all is already availabe in
the CVS version and recently released as 0.1-beta
Note: See TracTickets for help on using tickets.