[vhffs-dev] [545] Added a fine subscribe control and posting control in listengine, now you can manage all possible cases. |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
- To: vhffs-dev@xxxxxxxxx
- Subject: [vhffs-dev] [545] Added a fine subscribe control and posting control in listengine, now you can manage all possible cases.
- From: subversion@xxxxxxxxx
- Date: Sun, 08 Apr 2007 01:57:49 +0200
Revision: 545
Author: gradator
Date: 2007-04-07 23:57:48 +0000 (Sat, 07 Apr 2007)
Log Message:
-----------
Added a fine subscribe control and posting control in listengine, now you can manage all possible cases.
Modified Paths:
--------------
branches/vhffs_4.1/vhffs-api/src/Vhffs/Constants.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm
branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mailing.pm
branches/vhffs_4.1/vhffs-listengine/src/listengine.pl
branches/vhffs_4.1/vhffs-panel/mailinglist/prefs.pl
branches/vhffs_4.1/vhffs-panel/mailinglist/save_options.pl
branches/vhffs_4.1/vhffs-panel/templates/mailinglist/prefs.tmpl
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Constants.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Constants.pm 2007-04-07 20:49:35 UTC (rev 544)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Constants.pm 2007-04-07 23:57:48 UTC (rev 545)
@@ -7,7 +7,7 @@
use constant
{
- VHFFS_VERSION => '4.1-alpha (Revision: 537)',
+ VHFFS_VERSION => '4.1-alpha (Revision: 544)',
VHFFS_RELEASE_NAME => "hippocampus",
WAITING_FOR_VALIDATION => 1,
@@ -50,6 +50,16 @@
ML_RIGHT_ADMIN => 10,
ML_RIGHT_SUB_WAITING_FOR_DEL => 12,
+ ML_SUBSCRIBE_NO_APPROVAL_REQUIRED => 0,
+ ML_SUBSCRIBE_APPROVAL_REQUIRED => 1,
+ ML_SUBSCRIBE_CLOSED => 2,
+ ML_POSTING_OPEN_ALL => 0,
+ ML_POSTING_MODERATED_ALL => 1,
+ ML_POSTING_OPEN_MEMBERS_MODERATED_OTHERS => 2,
+ ML_POSTING_MEMBERS_ONLY => 3,
+ ML_POSTING_MEMBERS_ONLY_MODERATED => 4,
+ ML_POSTING_ADMINS_ONLY => 5,
+
MAILS_DIR => "/usr/share/vhffs/mails/",
# Objects' types
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm 2007-04-07 20:49:35 UTC (rev 544)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm 2007-04-07 23:57:48 UTC (rev 545)
@@ -514,7 +514,7 @@
return undef unless(@params = $dbh->selectrow_array($sql, undef, $domain));
# We now need the boxes and forwards
- $sql = 'SELECT domain, local_part, domain_hash, password_hash, mbox_name, password_hash AS password, nospam::integer, novirus::integer FROM vhffs_boxes WHERE domain = ?';
+ $sql = 'SELECT domain, local_part, domain_hash, password_hash, mbox_name, password_hash AS password, nospam, novirus FROM vhffs_boxes WHERE domain = ?';
my $sth = $dbh->prepare($sql);
$sth->execute($domain);
my $boxes = $sth->fetchall_hashref('local_part');
Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mailing.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mailing.pm 2007-04-07 20:49:35 UTC (rev 544)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mailing.pm 2007-04-07 23:57:48 UTC (rev 545)
@@ -87,9 +87,10 @@
my $parent = Vhffs::Object::create($main, $user->get_uid, $description, undef, Vhffs::Constants::TYPE_ML);
die('Unable to create parent object') unless(defined $parent);
- $sql = 'INSERT INTO vhffs_ml(local_part, domain, prefix, owner_uid, owner_gid, object_id, admin, open_post, open_archive, open_sub, reply_to, moderated) VALUES(?, ?, ?, ?, ?, ?, ?, FALSE, FALSE, TRUE, TRUE, FALSE)';
+ # open sub, post members only
+ $sql = 'INSERT INTO vhffs_ml(local_part, domain, prefix, owner_uid, owner_gid, object_id, admin, open_archive, reply_to, sub_ctrl, post_ctrl) VALUES(?, ?, ?, ?, ?, ?, ?, FALSE, TRUE, ?, ? )';
my $sth = $dbh->prepare($sql);
- $sth->execute($local, $domain, $local, $user->get_uid, $group->get_gid, $parent->get_oid, $admin);
+ $sth->execute($local, $domain, $local, $user->get_uid, $group->get_gid, $parent->get_oid, $admin, Vhffs::Constants::ML_SUBSCRIBE_NO_APPROVAL_REQUIRED, Vhffs::Constants::ML_POSTING_MEMBERS_ONLY);
$dbh->commit;
$ml = get_by_mladdress($main, $local, $domain);
};
@@ -118,7 +119,7 @@
my ($main, $local, $domain) = @_;
my $dbh = $main->get_db_object();
- my $sql = 'SELECT ml.ml_id, ml.local_part, ml.domain, ml.prefix, ml.owner_gid, ml.admin, ml.open_post, ml.open_archive, ml.open_sub, ml.reply_to, ml.moderated, ml.signature, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_ml ml INNER JOIN vhffs_object o ON o.object_id = ml.object_id WHERE domain = ? and local_part = ?';
+ my $sql = 'SELECT ml.ml_id, ml.local_part, ml.domain, ml.prefix, ml.owner_gid, ml.admin, ml.open_archive, ml.reply_to, ml.sub_ctrl, ml.post_ctrl, ml.signature, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_ml ml INNER JOIN vhffs_object o ON o.object_id = ml.object_id WHERE domain = ? and local_part = ?';
my $sth = $dbh->prepare($sql);
return undef unless ($sth->execute($domain, $local) > 0);
my @params = $sth->fetchrow_array;
@@ -132,7 +133,7 @@
}
sub _new {
- my ($class, $main, $ml_id, $local_part, $domain, $prefix, $owner_gid, $admin, $open_post, $open_archive, $open_sub, $reply_to, $moderated, $signature, $oid, $owner_uid, $date_creation, $state, $description, $subs) = @_;
+ my ($class, $main, $ml_id, $local_part, $domain, $prefix, $owner_gid, $admin, $open_archive, $reply_to, $sub_ctrl, $post_ctrl, $signature, $oid, $owner_uid, $date_creation, $state, $description, $subs) = @_;
my $self = $class->SUPER::_new($main, $oid, $owner_uid, $date_creation, $description, $state, Vhffs::Constants::TYPE_ML);
return undef unless defined($self);
@@ -143,11 +144,10 @@
$self->{prefix} = $prefix;
$self->{owner_gid} = $owner_gid;
$self->{admin} = $admin;
- $self->{open_post} = $open_post;
$self->{open_archive} = $open_archive;
- $self->{open_sub} = $open_sub;
$self->{reply_to} = $reply_to;
- $self->{moderated} = $moderated;
+ $self->{sub_ctrl} = $sub_ctrl;
+ $self->{post_ctrl} = $post_ctrl;
$self->{signature} = $signature;
$self->{subs} = $subs;
@@ -159,9 +159,9 @@
{
my $self = shift;
- my $sql = 'UPDATE vhffs_ml SET prefix = ?, admin = ?, open_post = ?, open_archive = ?, reply_to = ?, moderated = ?, open_sub = ?, signature = ? WHERE ml_id = ?';
+ my $sql = 'UPDATE vhffs_ml SET prefix = ?, admin = ?, open_archive = ?, reply_to = ?, sub_ctrl = ?, post_ctrl = ?, signature = ? WHERE ml_id = ?';
my $dbh = $self->get_main->get_db_object();
- $dbh->do($sql, undef, $self->{prefix}, $self->{admin}, $self->{open_post}, $self->{open_archive}, $self->{reply_to}, $self->{moderated}, $self->{open_sub}, $self->{signature}, $self->{ml_id});
+ $dbh->do($sql, undef, $self->{prefix}, $self->{admin}, $self->{open_archive}, $self->{reply_to}, $self->{sub_ctrl}, $self->{post_ctrl}, $self->{signature}, $self->{ml_id});
return -3 if( $self->SUPER::commit < 0 );
@@ -173,7 +173,7 @@
my ($self, $subscriber, $right) = @_;
my $sql = 'UPDATE vhffs_ml_subscribers SET perm = ? WHERE ml_id = ? AND member = ?';
- my $dbh = $self->get_db_object();
+ my $dbh = $self->get_main->get_db_object();
# FIXME compatibility hack, we should return a boolean
return -1 unless($dbh->do($sql, undef, $right, $self->{ml_id}, $subscriber) > 0);
$self->{subs}->{$subscriber}->{perm} = $right;
@@ -304,7 +304,6 @@
#{
#}
-
sub get_language_for_sub
{
my ($main, $sub) = @_;
@@ -314,7 +313,6 @@
return $lang;
}
-
sub set_language_for_sub
{
my ($main, $sub, $language) = @_;
@@ -349,47 +347,36 @@
return $self->{'open_archive'};
}
-sub get_open_post
+sub get_sub_ctrl
{
my $self = shift;
- return $self->{'open_post'};
+ return $self->{'sub_ctrl'};
}
-sub get_open_sub
+sub get_post_ctrl
{
my $self = shift;
- return $self->{'open_sub'};
+ return $self->{'post_ctrl'};
}
-
-
sub get_replyto
{
my $self = shift;
return $self->{'reply_to'};
}
-
-sub get_moderated
-{
- my $self = shift;
- return $self->{'moderated'};
-}
-
sub get_admin
{
my $self = shift;
return $self->{'admin'};
}
-
sub get_domain
{
my $self = shift;
return $self->{'domain'};
}
-
sub get_prefix
{
my $self = shift;
@@ -402,7 +389,6 @@
return $self->{subs};
}
-
sub set_replytolist
{
my $self;
@@ -418,32 +404,30 @@
return 1;
}
-
-sub set_moderated
+sub set_open_archive
{
my( $self , $value ) = @_;
- $self->{'moderated'} = $value;
+ $self->{'open_archive'} = $value;
}
-sub set_open_post
+sub set_sub_ctrl
{
- my( $self , $value ) = @_;
- $self->{'open_post'} = $value;
+ my( $self , $value ) = @_;
+ return -1 unless ( $value =~ /\d+/ );
+ return -1 if( $value < Vhffs::Constants::ML_SUBSCRIBE_NO_APPROVAL_REQUIRED || $value > Vhffs::Constants::ML_SUBSCRIBE_CLOSED );
+ $self->{'sub_ctrl'} = $value;
+ return 0;
}
-
-sub set_open_archive
+sub set_post_ctrl
{
- my( $self , $value ) = @_;
- $self->{'open_archive'} = $value;
+ my( $self , $value ) = @_;
+ return -1 unless ( $value =~ /\d+/ );
+ return -1 if ( $value < Vhffs::Constants::ML_POSTING_OPEN_ALL || $value > Vhffs::Constants::ML_POSTING_ADMINS_ONLY );
+ $self->{'post_ctrl'} = $value;
+ return 0;
}
-sub set_open_sub
-{
- my( $self , $value ) = @_;
- $self->{'open_sub'} = $value;
-}
-
sub set_admin
{
my $self = shift;
@@ -559,6 +543,6 @@
=head1 AUTHORS
-soda < god at gunnm dot org >
-
+Julien Delange < god at gunnm dot org >
Sebastien Le Ray < beuss at tuxfamily dot org >
+Sylvain Rochet < gradator at gradator dot net >
Modified: branches/vhffs_4.1/vhffs-listengine/src/listengine.pl
===================================================================
--- branches/vhffs_4.1/vhffs-listengine/src/listengine.pl 2007-04-07 20:49:35 UTC (rev 544)
+++ branches/vhffs_4.1/vhffs-listengine/src/listengine.pl 2007-04-07 23:57:48 UTC (rev 545)
@@ -120,22 +120,23 @@
sub archive_it
{
- use Date::Simple ('date', 'today');
my $mail = shift;
my $list = shift;
- my $date = today();
- my ( $message_id )= ($mail->get( 'Message-Id' ) =~ /<(.+)>/);
+ my (undef,undef,undef,$day,$month,$year) = localtime(time);
+ $year += 1900;
+ $month += 1;
+ $month = '0'.$month if( $month < 9 );
+ $day = '0'.$day if( $day < 9 );
+ my $message_id = ( $mail->get( 'Message-Id' ) =~ /<(.+)>/ );
+
#Don't archive if message-id is not found
return if( ( ! defined $message_id ) || ( $message_id eq "" ) );
-
- my $directory = $DIRECTORY."/archives/".$list->get_domain."/".$list->get_localpart."/".$date->year."/".$date->month."/".$date->day."";
-
+ my $directory = $DIRECTORY.'/archives/'.$list->get_domain.'/'.$list->get_localpart.'/'.$year.'/'.$month.'/'.$day;
Vhffs::Functions::create_dir( $directory ) if( ! -d $directory );
-
my $file = "$directory/".$message_id;
open( FILE , ">$file");
print FILE $mail->as_string;
@@ -199,7 +200,9 @@
my $message;
my @body;
- if( $list->get_open_sub != 1 )
+ my $sub_ctrl = $list->get_sub_ctrl;
+
+ if( $sub_ctrl == Vhffs::Constants::ML_SUBSCRIBE_NO_APPROVAL_REQUIRED )
{
$message ="Subscribtion are not allowed for this list";
push @body , $message ;
@@ -216,6 +219,8 @@
Body => Vhffs::Listengine::Intl::sub_deny( $list , $from )
);
}
+
+ #FIXME: TODO: do subscription with approval (moderation)
else
{
@@ -434,13 +439,11 @@
$mail->replace( 'Subject' , "[".$prefix."]"." ".$subject ) if( length( $prefix ) > 0 );
}
- # Add list's signature at the bottom of mail
- if(defined(my $signature = $list->get_signature)) {
- my $body = $mail->body;
- push @$body, '---';
- my @sig = split(/\n/, $signature);
- push @$body, @sig;
- }
+ # Add list's signature at the bottom of mail
+ if(defined(my $signature = $list->get_signature)) {
+ my $body = $mail->body;
+ push @$body, "---\n".$signature;
+ }
foreach ( keys %{$subs} )
{
@@ -455,49 +458,37 @@
sub bounce_mail
{
+ my $mail = shift;
+ my $list = shift;
- my $mail = shift;
- my $list = shift;
-
- exit -1 if( ! defined $list );
+ exit -1 if( ! defined $list );
- my ( $from ) = ( $mail->get('From') =~ /(([\+\.a-zA-Z_\-0-9^\s]+)@([a\.-zA-Z_\-0-9^\s]+)\.(\w+))/);
- my $subject = $mail->get('Subject');
- my $subs = $list->get_members;
+ my ( $from ) = ( $mail->get('From') =~ /(([\+\.a-zA-Z_\-0-9^\s]+)@([a\.-zA-Z_\-0-9^\s]+)\.(\w+))/);
+ my $subject = $mail->get('Subject');
+ my $subs = $list->get_members;
- my $authorized = 0;
- my $in_moderation = 0;
-
+ # we need to know if the sender is a member, an admin, or other
+ my $user_class = "other"; #assume other
+ $user_class = "member" if( defined $subs->{$from} && $subs->{$from}{perm} == Vhffs::Constants::ML_RIGHT_SUB );
+ $user_class = "admin" if( defined $subs->{$from} && $subs->{$from}{perm} == Vhffs::Constants::ML_RIGHT_ADMIN );
- if( $list->get_moderated == 1 )
- {
-
- $in_moderation = 1;
+ my $post_ctrl = $list->get_post_ctrl;
- # If the list is moderated, we refuse the mail
- # But if the mail is from an admin, we allow it
- if(defined $subs->{$from} && $subs->{$from}{perm} == Vhffs::Constants::ML_RIGHT_ADMIN) {
- $authorized = 1;
- $in_moderation = 0;
- }
- }
- elsif( $list->get_open_post == 1 )
- {
- # If the list is not moderated, and open_post,
- # we authorize the mail
- $authorized = 1;
- }
- else
- {
- # In this case, The list is not in open_post
- # We must check if the poster is a subscriber
- $authorized = 1 if(defined $subs->{$from} && ($subs->{$from}{perm} == Vhffs::Constants::ML_RIGHT_SUB
- || $subs->{$from}{perm} == Vhffs::Constants::ML_RIGHT_ADMIN));
- }
-
-
- sendmail_to_list( $mail , $list ) if( $authorized == 1 );
- put_in_moderation( $mail , $list ) if( $in_moderation == 1 );
+ if( $user_class eq "admin" || $post_ctrl == Vhffs::Constants::ML_POSTING_OPEN_ALL ) {
+ sendmail_to_list( $mail , $list );
+ }
+ elsif ( $user_class eq "member" ) {
+ if( $post_ctrl == Vhffs::Constants::ML_POSTING_MEMBERS_ONLY || $post_ctrl == Vhffs::Constants::ML_POSTING_OPEN_MEMBERS_MODERATED_OTHERS ) {
+ sendmail_to_list( $mail , $list )
+ } elsif ( $post_ctrl == Vhffs::Constants::ML_POSTING_MODERATED_ALL || $post_ctrl == Vhffs::Constants::ML_POSTING_MEMBERS_ONLY_MODERATED ) {
+ put_in_moderation( $mail , $list );
+ }
+ }
+ elsif ( $user_class eq "other" ) {
+ if( $post_ctrl == Vhffs::Constants::ML_POSTING_MODERATED_ALL || $post_ctrl == Vhffs::Constants::ML_POSTING_OPEN_MEMBERS_MODERATED_OTHERS ) {
+ put_in_moderation( $mail , $list );
+ }
+ }
}
Modified: branches/vhffs_4.1/vhffs-panel/mailinglist/prefs.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/mailinglist/prefs.pl 2007-04-07 20:49:35 UTC (rev 544)
+++ branches/vhffs_4.1/vhffs-panel/mailinglist/prefs.pl 2007-04-07 23:57:48 UTC (rev 545)
@@ -48,9 +48,7 @@
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'};
@@ -110,19 +108,46 @@
$template->param( VALUE_LOCALPART => $list->get_localpart );
$template->param( SUBTITLE_OPTIONS => gettext("Options") );
- $template->param( TEXT_MODERATED => gettext("Moderated") );
- $template->param( TEXT_OPENPOST => gettext("Open post") );
- $template->param( TEXT_OPENSUB => gettext("Open subscribing") );
- $template->param( TEXT_OPENARCHIVE => gettext("Open archives") );
+ $template->param( TEXT_SUBSCRIBE_CONTROL => gettext("Subscribe control:") );
+ $template->param( TEXT_SUBSCRIBE_NO_APPROVAL_REQUIRED => gettext("Open, no approval required") );
+ $template->param( TEXT_SUBSCRIBE_APPROVAL_REQUIRED => gettext("Open, approval required") );
+ $template->param( TEXT_SUBSCRIBE_CLOSED => gettext("Closed") );
+ $template->param( TEXT_POSTING_CONTROL => gettext("Posting control:") );
+ $template->param( TEXT_POSTING_OPEN_ALL => gettext("Open for everyone") );
+ $template->param( TEXT_POSTING_MODERATED_ALL => gettext("Moderated for everyone") );
+ $template->param( TEXT_POSTING_OPEN_MEMBERS_MODERATED_OTHERS => gettext("Open for members, moderated for non-members") );
+ $template->param( TEXT_POSTING_MEMBERS_ONLY => gettext("Members only") );
+ $template->param( TEXT_POSTING_MEMBERS_ONLY_MODERATED => gettext("Members only and moderated") );
+ $template->param( TEXT_POSTING_ADMINS_ONLY => gettext("Admins only") );
+ $template->param( VALUE_SUBSCRIBE_NO_APPROVAL_REQUIRED => Vhffs::Constants::ML_SUBSCRIBE_NO_APPROVAL_REQUIRED );
+ $template->param( VALUE_SUBSCRIBE_APPROVAL_REQUIRED => Vhffs::Constants::ML_SUBSCRIBE_APPROVAL_REQUIRED );
+ $template->param( VALUE_SUBSCRIBE_CLOSED => Vhffs::Constants::ML_SUBSCRIBE_CLOSED );
+ $template->param( VALUE_POSTING_OPEN_ALL => Vhffs::Constants::ML_POSTING_OPEN_ALL );
+ $template->param( VALUE_POSTING_MODERATED_ALL => Vhffs::Constants::ML_POSTING_MODERATED_ALL );
+ $template->param( VALUE_POSTING_OPEN_MEMBERS_MODERATED_OTHERS => Vhffs::Constants::ML_POSTING_OPEN_MEMBERS_MODERATED_OTHERS );
+ $template->param( VALUE_POSTING_MEMBERS_ONLY => Vhffs::Constants::ML_POSTING_MEMBERS_ONLY );
+ $template->param( VALUE_POSTING_MEMBERS_ONLY_MODERATED => Vhffs::Constants::ML_POSTING_MEMBERS_ONLY_MODERATED );
+ $template->param( VALUE_POSTING_ADMINS_ONLY => Vhffs::Constants::ML_POSTING_ADMINS_ONLY );
+ $template->param( SELECTED_SUBSCRIBE_NO_APPROVAL_REQUIRED => "selected" ) if( $list->{sub_ctrl} == Vhffs::Constants::ML_SUBSCRIBE_NO_APPROVAL_REQUIRED );
+ $template->param( SELECTED_SUBSCRIBE_APPROVAL_REQUIRED => "selected" ) if( $list->{sub_ctrl} == Vhffs::Constants::ML_SUBSCRIBE_APPROVAL_REQUIRED );
+ $template->param( SELECTED_SUBSCRIBE_CLOSED => "selected" ) if( $list->{sub_ctrl} == Vhffs::Constants::ML_SUBSCRIBE_CLOSED );
+ $template->param( SELECTED_POSTING_OPEN_ALL => "selected" ) if( $list->{post_ctrl} == Vhffs::Constants::ML_POSTING_OPEN_ALL );
+ $template->param( SELECTED_POSTING_MODERATED_ALL => "selected" ) if( $list->{post_ctrl} == Vhffs::Constants::ML_POSTING_MODERATED_ALL );
+ $template->param( SELECTED_POSTING_OPEN_MEMBERS_MODERATED_OTHERS => "selected" ) if( $list->{post_ctrl} == Vhffs::Constants::ML_POSTING_OPEN_MEMBERS_MODERATED_OTHERS );
+ $template->param( SELECTED_POSTING_MEMBERS_ONLY => "selected" ) if( $list->{post_ctrl} == Vhffs::Constants::ML_POSTING_MEMBERS_ONLY );
+ $template->param( SELECTED_POSTING_MEMBERS_ONLY_MODERATED => "selected" ) if( $list->{post_ctrl} == Vhffs::Constants::ML_POSTING_MEMBERS_ONLY_MODERATED );
+ $template->param( SELECTED_POSTING_ADMINS_ONLY => "selected" ) if( $list->{post_ctrl} == Vhffs::Constants::ML_POSTING_ADMINS_ONLY );
+
+ $template->param( TEXT_OPENARCHIVE => gettext("Public archives") );
$template->param( TEXT_REPLYTO => gettext("Reply to: on list") );
$template->param( TEXT_PREFIX => gettext("Prefix on subject") );
$template->param( VALUE_PREFIX => $list->get_prefix );
$template->param( TEXT_SUBMIT_PREFS => gettext("Save options") );
- $template->param( TITLE_SIGNATURE => gettext("Signature") );
- $template->param( VALUE_SIGNATURE => $list->get_signature );
- $template->param( TEXT_SUBMIT_SIGNATURE => gettext("Update signature") );
+ $template->param( TITLE_SIGNATURE => gettext("Signature") );
+ $template->param( VALUE_SIGNATURE => $list->get_signature );
+ $template->param( TEXT_SUBMIT_SIGNATURE => gettext("Update signature") );
$template->param( TITLE_MEMBERS => gettext("Manage members") );
$template->param( TITLE_LIST_MEMBERS => gettext("List all members") );
@@ -135,26 +160,26 @@
{
$template->param( CHECK_OPENARCHIVE => "checked" );
}
- if( $list->get_open_sub == 1 )
- {
- $template->param( CHECK_OPENSUB => "checked" );
- }
+# if( $list->get_open_sub == 1 )
+# {
+# $template->param( CHECK_OPENSUB => "checked" );
+# }
+#
+# if( $list->get_open_post == 1 )
+# {
+# $template->param( CHECK_OPENPOST => "checked" );
+# }
- if( $list->get_open_post == 1 )
- {
- $template->param( CHECK_OPENPOST => "checked" );
- }
-
if( $list->get_replyto == 1 )
{
$template->param( CHECK_REPLYTO => "checked" );
}
- if( $list->get_moderated == 1 )
- {
- $template->param( CHECK_MODERATED => "checked" );
- }
+# if( $list->get_moderated == 1 )
+# {
+# $template->param( CHECK_MODERATED => "checked" );
+# }
my $subs = $list->get_members;
my $output = "";
Modified: branches/vhffs_4.1/vhffs-panel/mailinglist/save_options.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/mailinglist/save_options.pl 2007-04-07 20:49:35 UTC (rev 544)
+++ branches/vhffs_4.1/vhffs-panel/mailinglist/save_options.pl 2007-04-07 23:57:48 UTC (rev 545)
@@ -48,9 +48,7 @@
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'};
@@ -63,11 +61,10 @@
my $lpart = $cgi->param("LOCALPART");
my $openarchive = $cgi->param("OPENARCHIVE");
-my $openpost = $cgi->param("OPENPOST");
-my $moderated = $cgi->param("MODERATED");
my $replyto = $cgi->param("REPLYTO");
-my $opensub = $cgi->param("OPENSUB");
my $prefix = $cgi->param("PREFIX");
+my $sub_ctrl = $cgi->param("SUBSCRIBE_CONTROL");
+my $post_ctrl = $cgi->param("POSTING_CONTROL");
my $template;
my $subtemplate;
@@ -99,34 +96,11 @@
{
$list->set_prefix( $prefix ) if( defined $prefix );
- if( ! defined $moderated )
- {
- $list->set_moderated( 0 );
- }
- else
- {
- $list->set_moderated( 1 );
- }
- if( ! defined $opensub )
- {
- $list->set_open_sub( 0 );
- }
- else
- {
- $list->set_open_sub( 1 );
- }
+ $list->set_sub_ctrl( $sub_ctrl ) if( defined $sub_ctrl );
+ $list->set_post_ctrl( $post_ctrl ) if( defined $post_ctrl );
- if( ! defined $openpost )
- {
- $list->set_open_post( 0 );
- }
- else
- {
- $list->set_open_post( 1 );
- }
-
if( ! defined $openarchive )
{
$list->set_open_archive( 0 );
Modified: branches/vhffs_4.1/vhffs-panel/templates/mailinglist/prefs.tmpl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/templates/mailinglist/prefs.tmpl 2007-04-07 20:49:35 UTC (rev 544)
+++ branches/vhffs_4.1/vhffs-panel/templates/mailinglist/prefs.tmpl 2007-04-07 23:57:48 UTC (rev 545)
@@ -10,27 +10,45 @@
<p>
<tmpl_var name="TEXT_PREFIX">
<input type="TEXT" size=20 name="PREFIX" value="<tmpl_var name="VALUE_PREFIX">"/>
-
</p>
<p>
- <input type="checkbox" name="MODERATED" id="MODERATED" value="1" <tmpl_var name="CHECK_MODERATED"> />
- <label for="MODERATED">
- <tmpl_var name="TEXT_MODERATED">
- </label>
+ <tmpl_var name="TEXT_SUBSCRIBE_CONTROL">
+ <select name="SUBSCRIBE_CONTROL" id="SUBSCRIBE_CONTROL">
+ <option value="<tmpl_var name="VALUE_SUBSCRIBE_NO_APPROVAL_REQUIRED">" <tmpl_var name="SELECTED_SUBSCRIBE_NO_APPROVAL_REQUIRED">>
+ <tmpl_var name="TEXT_SUBSCRIBE_NO_APPROVAL_REQUIRED">
+ </option>
+ <option value="<tmpl_var name="VALUE_SUBSCRIBE_APPROVAL_REQUIRED">" <tmpl_var name="SELECTED_SUBSCRIBE_APPROVAL_REQUIRED">>
+ <tmpl_var name="TEXT_SUBSCRIBE_APPROVAL_REQUIRED">
+ </option>
+ <option value="<tmpl_var name="VALUE_SUBSCRIBE_CLOSED">" <tmpl_var name="SELECTED_SUBSCRIBE_CLOSED">>
+ <tmpl_var name="TEXT_SUBSCRIBE_CLOSED">
+ </option>
+ </select>
</p>
<p>
- <input type="checkbox" name="OPENSUB" value="1" <tmpl_var name="CHECK_OPENSUB"> />
- <label for="OPENSUB">
- <tmpl_var name="TEXT_OPENSUB">
- </label>
+ <tmpl_var name="TEXT_POSTING_CONTROL">
+ <select name="POSTING_CONTROL" id="POSTING_CONTROL">
+ <option value="<tmpl_var name="VALUE_POSTING_OPEN_ALL">" <tmpl_var name="SELECTED_POSTING_OPEN_ALL">>
+ <tmpl_var name="TEXT_POSTING_OPEN_ALL">
+ </option>
+ <option value="<tmpl_var name="VALUE_POSTING_MODERATED_ALL">" <tmpl_var name="SELECTED_POSTING_MODERATED_ALL">>
+ <tmpl_var name="TEXT_POSTING_MODERATED_ALL">
+ </option>
+ <option value="<tmpl_var name="VALUE_POSTING_OPEN_MEMBERS_MODERATED_OTHERS">" <tmpl_var name="SELECTED_POSTING_OPEN_MEMBERS_MODERATED_OTHERS">>
+ <tmpl_var name="TEXT_POSTING_OPEN_MEMBERS_MODERATED_OTHERS">
+ </option>
+ <option value="<tmpl_var name="VALUE_POSTING_MEMBERS_ONLY">" <tmpl_var name="SELECTED_POSTING_MEMBERS_ONLY">>
+ <tmpl_var name="TEXT_POSTING_MEMBERS_ONLY">
+ </option>
+ <option value="<tmpl_var name="VALUE_POSTING_MEMBERS_ONLY_MODERATED">" <tmpl_var name="SELECTED_POSTING_MEMBERS_ONLY_MODERATED">>
+ <tmpl_var name="TEXT_POSTING_MEMBERS_ONLY_MODERATED">
+ </option>
+ <option value="<tmpl_var name="VALUE_POSTING_ADMINS_ONLY">" <tmpl_var name="SELECTED_POSTING_ADMINS_ONLY">>
+ <tmpl_var name="TEXT_POSTING_ADMINS_ONLY">
+ </option>
+ </select>
</p>
<p>
- <input type="checkbox" name="OPENPOST" id="OPENPOST" value="1" <tmpl_var name="CHECK_OPENPOST"> />
- <label for="OPENPOST">
- <tmpl_var name="TEXT_OPENPOST">
- </label>
- </p>
- <p>
<input type="checkbox" name="OPENARCHIVE" id="OPENARCHIVE" value="1" <tmpl_var name="CHECK_OPENARCHIVE"> />
<label for="OPENARCHIVE">
<tmpl_var name="TEXT_OPENARCHIVE">