[vhffs-dev] [895] Moved Vhffs::Misc::Mailings to Vhffs::Mailings , bye bye Vhffs::Misc: :*

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


Revision: 895
Author:   gradator
Date:     2007-09-10 03:31:23 +0000 (Mon, 10 Sep 2007)

Log Message:
-----------
Moved Vhffs::Misc::Mailings to Vhffs::Mailings , bye bye Vhffs::Misc::*

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Makefile.am
    trunk/vhffs-panel/admin/broadcast_delete.pl
    trunk/vhffs-panel/admin/broadcast_list.pl
    trunk/vhffs-panel/admin/broadcast_submit.pl
    trunk/vhffs-panel/admin/broadcast_view.pl

Added Paths:
-----------
    trunk/vhffs-api/src/Vhffs/Mailings.pm

Removed Paths:
-------------
    trunk/vhffs-api/src/Vhffs/Misc/


Copied: trunk/vhffs-api/src/Vhffs/Mailings.pm (from rev 894, trunk/vhffs-api/src/Vhffs/Misc/Mailings.pm)
===================================================================
--- trunk/vhffs-api/src/Vhffs/Mailings.pm	                        (rev 0)
+++ trunk/vhffs-api/src/Vhffs/Mailings.pm	2007-09-10 03:31:23 UTC (rev 895)
@@ -0,0 +1,106 @@
+#!%PERL% -w
+# Copyright (c) vhffs project and its contributors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without 
+# modification, are permitted provided that the following conditions 
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright 
+#   notice, this list of conditions and the following disclaimer.
+#2. Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in 
+#   the documentation and/or other materials provided with the 
+#   distribution.
+#3. Neither the name of vhffs nor the names of its contributors 
+#   may be used to endorse or promote products derived from this 
+#   software without specific prior written permission.
+#
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
+#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
+#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+# POSSIBILITY OF SUCH DAMAGE.
+
+
+# This file is a part of the VHFFS plateform
+# Please respect the entire licence of VHFFS
+# 
+# Author : Julien Delange < dieu at gunnm dot org >
+
+package Vhffs::Mailings;
+
+use Vhffs::Functions;
+use Vhffs::Constants;
+
+sub add_mailing
+{
+	my $vhffs = shift;	
+	my $subject = shift;
+	my $message = shift;
+	
+	return -1 if ( ! defined $vhffs );
+
+	$query = 'INSERT INTO vhffs_mailings (subject,message,date,state) VALUES( ? , ? , NOW() , ? )';
+	$request = $vhffs->{'db'}->prepare( $query );
+	$request->execute($subject, $message, Vhffs::Constants::WAITING_FOR_CREATION) or return -2;
+
+	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'}->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->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->prepare( $query );
+	$request->execute or return -2;
+
+	return $request->fetchrow_hashref() ;
+}
+
+1;

Modified: trunk/vhffs-api/src/Vhffs/Makefile.am
===================================================================
--- trunk/vhffs-api/src/Vhffs/Makefile.am	2007-09-10 03:19:45 UTC (rev 894)
+++ trunk/vhffs-api/src/Vhffs/Makefile.am	2007-09-10 03:31:23 UTC (rev 895)
@@ -12,6 +12,7 @@
 	Functions.pm \
 	Group.pm \
 	Intl.pm \
+	Mailings.pm \
 	Main.pm \
 	ObjectFactory.pm \
 	Object.pm \
@@ -22,7 +23,6 @@
 	Listengine/Intl.pm \
 	Listengine/Listengine.pm \
 	Listengine/Mail.pm \
-	Misc/Mailings.pm \
 	Panel/Admin.pm \
 	Panel/Avatar.pm \
 	Panel/Commons.pm \

Modified: trunk/vhffs-panel/admin/broadcast_delete.pl
===================================================================
--- trunk/vhffs-panel/admin/broadcast_delete.pl	2007-09-10 03:19:45 UTC (rev 894)
+++ trunk/vhffs-panel/admin/broadcast_delete.pl	2007-09-10 03:31:23 UTC (rev 895)
@@ -85,8 +85,8 @@
 }
 else
 {
-	use Vhffs::Misc::Mailings;
-	if( Vhffs::Misc::Mailings::del_mailing( $vhffs , $mid ) == 1 )
+	use Vhffs::Mailings;
+	if( Vhffs::Mailings::del_mailing( $vhffs , $mid ) == 1 )
 	{
 		$template->param( MESSAGE  => gettext("Mailing successfully deleted") );
 	}

Modified: trunk/vhffs-panel/admin/broadcast_list.pl
===================================================================
--- trunk/vhffs-panel/admin/broadcast_list.pl	2007-09-10 03:19:45 UTC (rev 894)
+++ trunk/vhffs-panel/admin/broadcast_list.pl	2007-09-10 03:31:23 UTC (rev 895)
@@ -45,7 +45,7 @@
 use Vhffs::Panel::Main;
 use Vhffs::Panel::Menu;
 use Vhffs::Constants;
-use Vhffs::Misc::Mailings;
+use Vhffs::Mailings;
 
 my $panel = new Vhffs::Panel::Main();
 exit 0 unless $panel;
@@ -74,7 +74,7 @@
 {
 	$template = new HTML::Template( filename => $templatesdir."/panel/admin/misc/broadcast_list.tmpl" );
 	$template->param( TITLE => gettext("All mailings sent to hosted"));
-	my $mailings = Vhffs::Misc::Mailings::getall( $vhffs );
+	my $mailings = Vhffs::Mailings::getall( $vhffs );
 	my $result;
 	my $body;
 	$result = "";

Modified: trunk/vhffs-panel/admin/broadcast_submit.pl
===================================================================
--- trunk/vhffs-panel/admin/broadcast_submit.pl	2007-09-10 03:19:45 UTC (rev 894)
+++ trunk/vhffs-panel/admin/broadcast_submit.pl	2007-09-10 03:31:23 UTC (rev 895)
@@ -85,8 +85,8 @@
 }
 else
 {
-	use Vhffs::Misc::Mailings;
-	if( Vhffs::Misc::Mailings::add_mailing( $vhffs , $subject , $body ) == 1 )
+	use Vhffs::Mailings;
+	if( Vhffs::Mailings::add_mailing( $vhffs , $subject , $body ) == 1 )
 	{
 		$template->param( MESSAGE  => gettext("Mailing successfully added") );
 	}

Modified: trunk/vhffs-panel/admin/broadcast_view.pl
===================================================================
--- trunk/vhffs-panel/admin/broadcast_view.pl	2007-09-10 03:19:45 UTC (rev 894)
+++ trunk/vhffs-panel/admin/broadcast_view.pl	2007-09-10 03:31:23 UTC (rev 895)
@@ -45,7 +45,7 @@
 use Vhffs::Panel::Main;
 use Vhffs::Panel::Menu;
 use Vhffs::Constants;
-use Vhffs::Misc::Mailings;
+use Vhffs::Mailings;
 
 my $panel = new Vhffs::Panel::Main();
 exit 0 unless $panel;
@@ -64,7 +64,7 @@
 my $templatesdir = $vhffs->get_config->get_templatedir;
 my $message;
 
-my $mailing = Vhffs::Misc::Mailings::get_mailing( $vhffs , $mid );
+my $mailing = Vhffs::Mailings::get_mailing( $vhffs , $mid );
 
 if( $user->is_admin != 1 )
 {


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