[vhffs-dev] [svn] commit: r72 - trunk/vhffs-api/src/Vhffs/Misc trunk/vhffs-api/src/Vhffs/Panel trunk/vhffs-backend/src/pgsql trunk/vhffs-panel/admin trunk/vhffs-panel/templates/admin/main trunk/vhffs-panel/templates/admin/misc trunk/vhffs-robots/src

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Author: soda
Date: Thu Jul 28 01:47:49 2005
New Revision: 72

Log:
Improve Mailings to hosted
Add svn_public robot to handle public or private repositories


Added:
    trunk/vhffs-panel/admin/broadcast_delete.pl   (with props)
    trunk/vhffs-panel/admin/broadcast_list.pl   (with props)
    trunk/vhffs-panel/admin/broadcast_submit.pl   (with props)
    trunk/vhffs-panel/admin/broadcast_view.pl   (with props)
    trunk/vhffs-panel/templates/admin/misc/broadcast_list.tmpl
    trunk/vhffs-panel/templates/admin/misc/broadcast_part.tmpl
    trunk/vhffs-panel/templates/admin/misc/broadcast_view.tmpl
    trunk/vhffs-robots/src/svn_public.pl   (with props)
Modified:
    trunk/vhffs-api/src/Vhffs/Misc/Mailings.pm
    trunk/vhffs-api/src/Vhffs/Panel/Admin.pm
    trunk/vhffs-backend/src/pgsql/create_mailings.sql
    trunk/vhffs-panel/admin/broadcast.pl
    trunk/vhffs-panel/admin/moderation.pl
    trunk/vhffs-panel/admin/moderation_submit.pl
    trunk/vhffs-panel/templates/admin/main/general.tmpl
    trunk/vhffs-robots/src/mailing.pl

Modified: trunk/vhffs-api/src/Vhffs/Misc/Mailings.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Misc/Mailings.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Misc/Mailings.pm Thu Jul 28 01:47:49 2005
@@ -23,17 +23,60 @@
 	my $db = $vhffs->get_db_object;
 
 	my $id = 0;
-	my $query = "SELECT MAX( id_mailing ) FROM vhffs_mailings";
-	my $request = $db->{'DB_READ'}->selectall_arrayref( $query ) or return -1;
-	$id = $request->[0][0] if( defined $request->[0][0] );
-	$id++;
 
-	$query = "INSERT INTO vhffs_mailings VALUES( '".$id."' , '".$subject."' , '".$message."' , NOW() , '".Vhffs::Constants::WAITING_FOR_CREATION."')";
+	$query = "INSERT INTO vhffs_mailings (subject,message,date,state) 						  VALUES( '".$subject."' , '".$message."' , NOW() , '".Vhffs::Constants::WAITING_FOR_CREATION."')";
 	$request = $db->{'DB_WRITE'}->prepare( $query );
 	$request->execute or return -2;
 
-	return $id;
+	return 1;
+}
+
+
+sub getall
+{
+	my $vhffs = shift;
+	my $state = shift;
+
+    my $query;
+	my $request;
+
+    $query = "SELECT * FROM vhffs_mailings ";
+    $query.= " WHERE state='".$state."'" if( defined $state );
+
+    $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query );
+    $request->execute or return undef ;
+    
+	return $request->fetchall_hashref('id_mailing');
+}
+
+
+
+sub del_mailing
+{
+	my $vhffs = shift;	
+	my $id = shift;
+	my $db = $vhffs->get_db_object;
+	$query = "DELETE FROM vhffs_mailings WHERE id_mailing='".$id."'";
+	$request = $db->{'DB_WRITE'}->prepare( $query );
+	$request->execute or return -2;
+
+	return 1;
+}
+
+
+sub get_mailing
+{
+	my $vhffs = shift;	
+	my $id = shift;
+	my $db = $vhffs->get_db_object;
+
+	return undef if( ! defined $id );
 	
+	$query = "SELECT * FROM vhffs_mailings WHERE id_mailing='".$id."'";
+	$request = $db->{'DB_READ'}->prepare( $query );
+	$request->execute or return -2;
+
+	return $request->fetchrow_hashref() ;
 }
 
 1;

Modified: trunk/vhffs-api/src/Vhffs/Panel/Admin.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Admin.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Panel/Admin.pm Thu Jul 28 01:47:49 2005
@@ -58,6 +58,7 @@
 
 	if( $user->is_admin == 1 )   {
 		$subtemplate->param( TEXT_MAILING => gettext( "Mailing to hosted" ) );
+		$subtemplate->param( TEXT_AMAILING => gettext( "Manage mailings" ) );
 		$subtemplate->param( TEXT_OBJECT_LIST => gettext( "List all objects" ) );
 		$subtemplate->param( TEXT_OBJECT_SEARCH => gettext( "Search object" ) );			           
 

Modified: trunk/vhffs-backend/src/pgsql/create_mailings.sql
==============================================================================
--- trunk/vhffs-backend/src/pgsql/create_mailings.sql (original)
+++ trunk/vhffs-backend/src/pgsql/create_mailings.sql Thu Jul 28 01:47:49 2005
@@ -7,9 +7,9 @@
 
 CREATE TABLE vhffs_mailings
 (
-	id_mailing int4,
+	id_mailing serial,
 	subject VARCHAR NOT NULL,
-	message varchar NOT NULL,
+	message TEXT NOT NULL,
 	date timestamp,
 	state int4 NOT NULL,
 	CONSTRAINT vhffs_mailings_pkey PRIMARY KEY (id_mailing)

Modified: trunk/vhffs-panel/admin/broadcast.pl
==============================================================================
--- trunk/vhffs-panel/admin/broadcast.pl (original)
+++ trunk/vhffs-panel/admin/broadcast.pl Thu Jul 28 01:47:49 2005
@@ -7,7 +7,6 @@
 use CGI;
 use CGI::Session;
 use strict;
-use Data::Dumper;
 
 use Vhffs::User;
 use Vhffs::Group;

Modified: trunk/vhffs-panel/admin/moderation.pl
==============================================================================
--- trunk/vhffs-panel/admin/moderation.pl (original)
+++ trunk/vhffs-panel/admin/moderation.pl Thu Jul 28 01:47:49 2005
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w -I/vhffs/vhffs-api/src/ -I/vhffs/vhffs-panel/
+#!/usr/bin/perl -w
 
 use POSIX qw(locale_h);
 use HTML::Template;

Modified: trunk/vhffs-panel/admin/moderation_submit.pl
==============================================================================
--- trunk/vhffs-panel/admin/moderation_submit.pl (original)
+++ trunk/vhffs-panel/admin/moderation_submit.pl Thu Jul 28 01:47:49 2005
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w -I/vhffs/vhffs-api/src/ -I/vhffs/vhffs-panel/
+#!/usr/bin/perl -w 
 
 use POSIX qw(locale_h);
 use HTML::Template;

Modified: trunk/vhffs-panel/templates/admin/main/general.tmpl
==============================================================================
--- trunk/vhffs-panel/templates/admin/main/general.tmpl (original)
+++ trunk/vhffs-panel/templates/admin/main/general.tmpl Thu Jul 28 01:47:49 2005
@@ -26,5 +26,10 @@
                 				        <tmpl_var name="TEXT_MAILING">
 						</a>
 					</li>
+					<li id="adminHomeMailing">
+				                <a href="/admin/broadcast_list.pl">
+                				        <tmpl_var name="TEXT_AMAILING">
+						</a>
+					</li>
 				</ul>
 			</li>

Modified: trunk/vhffs-robots/src/mailing.pl
==============================================================================
--- trunk/vhffs-robots/src/mailing.pl (original)
+++ trunk/vhffs-robots/src/mailing.pl Thu Jul 28 01:47:49 2005
@@ -58,9 +58,7 @@
 			$user = new Vhffs::User( $vhffs , $_ , '401' );
 			next if( $user->fetch < 0 );
 	
-			print "envoi du mailing a " . $user->get_mail . " id : " . $idm;
-			
-			#Vhffs::Functions::send_mail( $from , $user->get_mail , $mailings->{$idm}{subject} , $mailings->{$idm}{message} , $vhffs );
+			Vhffs::Functions::send_mail( $from , $user->get_mail , Vhffs::Functions::stripslashes( $mailings->{$idm}{subject} ) , Vhffs::Functions::stripslashes( $mailings->{$idm}{message} ), $vhffs );
 		}
 	}
 }




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/