[vhffs-dev] [729] backport of revision 727->728 to vhffs 4.0 |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 729
Author: gradator
Date: 2007-07-17 07:06:21 +0000 (Tue, 17 Jul 2007)
Log Message:
-----------
backport of revision 727->728 to vhffs 4.0
Modified Paths:
--------------
branches/vhffs-4.0/vhffs-panel/mailinglist/add_sub.pl
branches/vhffs-4.0/vhffs-panel/mailinglist/prefs.pl
branches/vhffs-4.0/vhffs-panel/templates/mailinglist/prefs.tmpl
Modified: branches/vhffs-4.0/vhffs-panel/mailinglist/add_sub.pl
===================================================================
--- branches/vhffs-4.0/vhffs-panel/mailinglist/add_sub.pl 2007-07-17 06:58:29 UTC (rev 728)
+++ branches/vhffs-4.0/vhffs-panel/mailinglist/add_sub.pl 2007-07-17 07:06:21 UTC (rev 729)
@@ -47,10 +47,9 @@
use Vhffs::Services::Mailing;
use Vhffs::Acl;
use Vhffs::Constants;
+
my $panel = new Vhffs::Panel::Main();
-if(!$panel) {
- exit 0;
-}
+exit 0 unless $panel;
my $vhffs = $panel->{'vhffs'};
my $session = $panel->{'session'};
@@ -61,11 +60,11 @@
my $cgi = $panel->{'cgi'};
my $domain = $cgi->param("DOMAIN");
my $lpart = $cgi->param("LOCALPART");
-my $member = $cgi->param("MEMBER");
+my $memberlist = $cgi->param("MEMBERS");
my $template;
my $subtemplate;
-my $message;
+my $message = "";
my $templatedir = $vhffs->get_config->get_templatedir;
@@ -73,7 +72,8 @@
$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-if( ( ! defined $lpart ) ||( ! defined $domain ) )
+
+if( ( ! defined $lpart ) || ( ! defined $domain ) || ( ! defined $memberlist ) )
{
$message = gettext( "CGI Error!");
}
@@ -93,24 +93,27 @@
{
$message = gettext("You're not allowed to do this (ACL rights)");
}
-elsif( Vhffs::Functions::valid_mail( $member ) < 0 )
-{
- $message = gettext("Not valid mail");
-}
-else
-{
- if( $list->add_sub( $member , Vhffs::Constants::ML_RIGHT_SUB ) < 0 )
- {
- $message = gettext( "This member already exists on this list !" );
+
+my @members = split (/^/, $memberlist);
+chomp (@members);
+map(s/^\s*(\S*)\s*$/$1/, @members);
+@members = grep (!/^$/, @members);
+
+my $member;
+foreach $member ( @members ) {
+
+ if( Vhffs::Functions::valid_mail( $member ) < 0 ) {
+ $message .= sprintf( gettext("%s is not a valid mail"), $member );
}
- else
- {
- $message = gettext( "Successfully added" );
+ elsif( $list->add_sub( $member , Vhffs::Constants::ML_RIGHT_SUB ) < 0 ) {
+ $message .= sprintf( gettext( "%s is already subscribed" ), $member );
}
-# $message = $list->add_sub( $member , 0 );
-
+ else {
+ $message .= sprintf( gettext( "%s has been successfully added" ), $member );
+ }
}
+
$template->param( MESSAGE => $message );
set_refresh_url Vhffs::Panel::Main($panel, "/mailinglist/prefs.pl?local=$lpart&domain=$domain", 0);
display Vhffs::Panel::Main($panel, $template->output);
Modified: branches/vhffs-4.0/vhffs-panel/mailinglist/prefs.pl
===================================================================
--- branches/vhffs-4.0/vhffs-panel/mailinglist/prefs.pl 2007-07-17 06:58:29 UTC (rev 728)
+++ branches/vhffs-4.0/vhffs-panel/mailinglist/prefs.pl 2007-07-17 07:06:21 UTC (rev 729)
@@ -121,11 +121,10 @@
$template->param( TITLE_MEMBERS => gettext("Manage members") );
$template->param( TITLE_LIST_MEMBERS => gettext("List all members") );
- $template->param( TITLE_ADD_MEMBER => gettext("Add a member") );
- $template->param( TEXT_ADD_MEMBER => gettext("Email adress") );
- $template->param( BUTTON_ADD_MEMBER => gettext("Add !") );
+ $template->param( TITLE_ADD_MEMBERS => gettext("Add members") );
+ $template->param( TEXT_ADD_MEMBERS => gettext("Addresses (one per line)") );
+ $template->param( BUTTON_ADD_MEMBERS => gettext("Add them !") );
-
if( $list->get_open_archive == 1 )
{
$template->param( CHECK_OPENARCHIVE => "checked" );
Modified: branches/vhffs-4.0/vhffs-panel/templates/mailinglist/prefs.tmpl
===================================================================
--- branches/vhffs-4.0/vhffs-panel/templates/mailinglist/prefs.tmpl 2007-07-17 06:58:29 UTC (rev 728)
+++ branches/vhffs-4.0/vhffs-panel/templates/mailinglist/prefs.tmpl 2007-07-17 07:06:21 UTC (rev 729)
@@ -59,20 +59,20 @@
<tmpl_var name="LIST_MEMBERS">
</table>
-<h3><tmpl_var name="TITLE_ADD_MEMBER"></h3>
+<h3><tmpl_var name="TITLE_ADD_MEMBERS"></h3>
<form method="post" action="add_sub.pl">
<p>
<label for="USERNAME">
- <tmpl_var name="TEXT_ADD_MEMBER">
+ <tmpl_var name="TEXT_ADD_MEMBERS">
</label>
- <input type="text" name="MEMBER" id="USERNAME" />
+ <textarea name="MEMBERS" rows="7" cols="50"></textarea>
</p>
<p class="button">
<input type="hidden" name="DOMAIN" value="<tmpl_var name="VALUE_DOMAIN">" />
<input type="hidden" name="LOCALPART" value="<tmpl_var name="VALUE_LOCALPART">" />
- <input type="submit" value="<tmpl_var name="BUTTON_ADD_MEMBER">" />
+ <input type="submit" value="<tmpl_var name="BUTTON_ADD_MEMBERS">" />
</p>
</form>