roundcube / roundcubemail

The Roundcube Webmail suite
https://roundcube.net
GNU General Public License v3.0
5.81k stars 1.63k forks source link

ReplyAll to a message - changes done #571

Closed rcubetrac closed 18 years ago

rcubetrac commented 18 years ago

Reported by tvkbhaskar on 18 Feb 2006 04:31 UTC as Trac ticket #1433998

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[= $value;

$input_cc = new textfield($field_attrib);
$out = $input_cc->show($_POST['_cc']($attr]));
// End of addition

Change 3:

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

if ($header=='cc') {
if ($header=='cc' && $REPLY_MESSAGE['headers']('headers']->from);
)->to) {
      $fvalue =
$IMAP->decode_header($REPLY_MESSAGE[   }
if ($header=='cc' && $REPLY_MESSAGE['headers']('headers']->to);
)->cc) {
      $fvalue .= ',' .
$IMAP->decode_header($REPLY_MESSAGE[                                                     

// 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']('headers']->cc);
}
}
);
    $chk_addr_part_in = $_SESSION[. '@' .
$CONFIG['default_host']('username']);
    if (stristr($chk_addr_part, $chk_addr_part_in) ===
FALSE ) {
      $fvalue .= (strlen($fvalue) ? ',
':'').$addr_part[   }
    }

// 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']('string'];
)   = 'Reply to the message';
// added the below line
$labels[  = 'ReplyAll to the message';
// end of addition
$labels['forwardmessage']('replyalltomessage'])   = 'Forward the message';

I hope this will help the roundcube community.

Let me know if you have any doubts

regards
Bhaskar

Migrated-From: http://trac.roundcube.net/ticket/1433998

rcubetrac commented 18 years ago

Comment by tvkbhaskar on 18 Feb 2006 06:01 UTC

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[= props;

          // get selected contacts
          else
            {
            for (var n=0; n<this.selection.length; n++)
              a_cids[a_cids.length](a_cids.length]) = this.selection[           }

          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](n];
) = props;

          // get selected contacts
          else
            {
            for (var n=0; n<this.selection.length; n++)
              a_cids[= this.selection[n](a_cids.length]);
            }

          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
rcubetrac commented 18 years ago

Comment by @thomascube on 21 Feb 2006 15:51 UTC

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
rcubetrac commented 18 years ago

Status changed by @thomascube on 21 Feb 2006 15:51 UTC

assigned => closed