Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#111 vacation with choice of reply

closed-fixed
nobody
Vacation (23)
5
2013-12-26
2012-03-18
J.Kruis
No

This patch provides users and administrators the ability to choose between three types of reply.

one reply
autoreply
reply with delay

Discussion

  • J.Kruis
    J.Kruis
    2012-03-19

     
    Attachments
  • GingerDog
    GingerDog
    2012-04-19

    Thank you for the patch; I've not tested it yet.

     
  • GingerDog
    GingerDog
    2012-04-19

    • status: open --> closed-accepted
     
  • GingerDog
    GingerDog
    2012-04-19

    • summary: vacation with choose of reply --> vacation with choice of reply
     
    • status: closed-accepted --> open
     
  • I know I'm late ;-) but unfortunately your patch contains several issues :-(
    (and you are lucky that David already commited it - I would have rejected it in the current state ;-)

    The patch introduces two unrelated (and unused?) config options: $CONF['usercontol'] and $CONF['users_domain_controle'] which aren't used.

    $CONF['vacation_replytype_control'] and $CONF['vacation_allow_user_reply'] aren't used/checked (the fields are always displayed)

    the texts for $CONF['choice_of_reply'] are hardcoded in several places - does it really make sense to make them configurable? (Besides that, I'd prefer to have them translateable.)

    if I get the comment in vacation.pl right, only the reply interval is checked ( 0 = onereply, 1 = autoreply, >1 = Delay reply ) - what's the reason for storing the "reply_type" as text in the database? It looks superfluous to me.

    (BTW: Does it really make sense to let the user enter the interval? IMHO providing the dropdown with some options would be enough, but I don't know your usecase.)

    upgrade_1345_mysql should use the _db_add_field() function of upgrade.php

    the upgrade for postgresql users is missing (hint: _db_add_field() can cover both)

    in vacation.pl, the interval stored in the database silently overrides the config option $interval - this might make sense, but it should at least be documented (and/or the config option removed)

    Can you please provide an additional patch to solve those issues?

     
  • J.Kruis
    J.Kruis
    2012-08-04

    Hi Christian,

    You are right
    $ CONF ['usercontol'] and $ CONFIG ['users_domain_controle'] which are not used yet also
    $ CONF ['vacation_replytype_control'] and $ CONFIG ['vacation_allow_user_reply'] are not used yet
    These items should not have been included in this patch but I was already working on Patch 352593 [UserControl]

    I have
    With concern to $ CONF ['choice_of_reply'] i also agree with you.
    I would like to change in the form of an array and applying with the language files,
    but my knowledge of programming in PHP is somewhat limited so help is welcome

    I am thinking of adding this into config.inc.php
    [Code]
    // Get the user or Admin a choice of reply
    // If you want to add a extra type of reply you MUST add this choice to the interval_time arry below
    // as well to add a entry pReplychoice_xxxxxx to the the [postfixhomedir]/languages/en.lang and your onw contry file
    $CONF['choice_of_reply'] = array (
    'One Reply' => 'pReplychoice_ones', // Only Reply ones on a email
    'Auto Reply' => 'pReplychoice_auto_reply', // Send no email if last email was send within 10 sec. see interval_time [Auto Reply]
    'One Hour' => 'PReplychoice_one_hour', // Send only a reply to a email if the last 1 hour ago. see interval_time [One Hour]
    'One Day' => 'pReplychoice_one_day', // Send only a reply to a email if the last 1 day ago. see interval_time [One Day]
    'One Week' => 'pReplychoice_one_week' // Send only a reply to a email if the last 1 week ago. see interval_time [One Week]
    );

    // Get the time according to choice of reply (see above entry)
    // If your have add a extra choice add that choice also below in this array
    $CONF['interval_time'] = array (
    'One Reply' => '0', // 0 means only one reply this value MUST be Zero en may not be change
    'Auto Reply' => '10', // This is your autoreplydelay time adjust this value to your needs
    'One Hour' => '3600', // one hour = 60 * 60 seconds
    'One Day' => '86400', // One day = 60 * 60 * 24 seconds
    'One Week' => '604800' // One week = 60 * 60 * 24 * 7 seconds
    );
    [/CODE]

    or is it better to place this array I vacation.php

    Question 1
    Can i work with a array of 3 items like

    $CONF['choice_of_reply'] = array (
    //type of reply interval time translation string
    'one reply', '0', 'pReplychoice_ones',
    'auto reply', '10', 'pReplychoice_autoreply',

    );

    Questing 2
    how can display a list using the above array
    type of reply and interval should by stored in the database and the translation string referred by pReplychoice… should be displayed as a list.
    I have make change to upgrade.php and now used _db_add_field()

    Regards
    Jan Kruis

     
  • (sorry for the delay - I'd need days with at least 30 hours ;-)

    > // as well to add a entry pReplychoice_xxxxxx to the the
    > [postfixhomedir]/languages/en.lang and your onw contry file

    using $CONF['language_hook'] might be the better solution for custom texts/translations.

    > Question 1
    > Can i work with a array of 3 items like
    > $CONF['choice_of_reply'] = array (
    > 'one reply', '0', 'pReplychoice_ones',

    No, but you can do it in a much easier way - just drop the first "column" ;-) AFAIK texts like "one reply" aren't used anywhere, which means they are superfluous ;-)

    If you really need an array with 3 "columns", you can use nested arrays - but this shouldn't be needed here.

    $CONF['choice_of_reply'] = array(
    // seconds => text
    0 => 'pReplychoice_ones',
    1 => 'pReplychoice_autoreply',
    60*60 => 'pReplychoice_hourly',
    24*60*60 => 'pReplychoice_daily',
    );

    > Questing 2
    > how can display a list using the above array

    foreach ( $CONF['choice_of_reply'] as $interval => $text ) {
    echo "$interval - $text";
    }

    > type of reply and interval should by stored in the database and the
    > translation string referred by pReplychoice… should be displayed as a
    > list.

    As I said above - storing the integer value (0 for "reply once", 1 for "autoreply", > 1 for seconds between autoreplies) is enough ;-)

     
  • Jan, any news on this?

     
    • status: open --> closed-fixed
    • Group: --> SVN (please specify revision!)
     
  • I did this myself in the meantime - see svn trunk r1610