[vhffs-dev] [380] Suppressed a bunch of new Vhffs::Object + fetch

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


Revision: 380
Author:   beuss
Date:     2006-12-19 22:35:48 +0000 (Tue, 19 Dec 2006)

Log Message:
-----------
Suppressed a bunch of new Vhffs::Object + fetch
Vhffs::Object::get_by_id becomes Vhffs::Object::get_by_oid (coherence)

Modified Paths:
--------------
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Object.pm
    branches/vhffs_4.1/vhffs-irc/modobot.pl
    branches/vhffs_4.1/vhffs-panel/acl/add_acl_group.pl
    branches/vhffs_4.1/vhffs-panel/acl/add_acl_user.pl
    branches/vhffs_4.1/vhffs-panel/acl/submit.pl
    branches/vhffs_4.1/vhffs-panel/admin/moderation_submit.pl
    branches/vhffs_4.1/vhffs-panel/admin/object/delete_avatar.pl
    branches/vhffs_4.1/vhffs-panel/admin/object/edit.pl
    branches/vhffs_4.1/vhffs-panel/admin/object/edit_submit.pl
    branches/vhffs_4.1/vhffs-panel/getavatar.pl
    branches/vhffs_4.1/vhffs-panel/history.pl
    branches/vhffs_4.1/vhffs-panel/object/upavatar.pl
    branches/vhffs_4.1/vhffs-panel/subscribe.pl
    branches/vhffs_4.1/vhffs-tests/src/Object.pl
    branches/vhffs_4.1/vhffs-tools/src/vhffs-moderate


Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Object.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Object.pm	2006-12-18 06:45:18 UTC (rev 379)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Object.pm	2006-12-19 22:35:48 UTC (rev 380)
@@ -179,7 +179,7 @@
     $sth->execute($owner_uid, $state, $description) or return undef;
     my $oid = $vhffs->get_db_object->last_insert_id(undef, undef, 'vhffs_object', undef);
 
-    my $res = get_by_id($vhffs, $oid);
+    my $res = get_by_oid($vhffs, $oid);
 
     $res->add_history('Object created');
     return $res;
@@ -501,7 +501,7 @@
     return undef;
 }
 
-sub get_by_id
+sub get_by_oid
 {
     my ($vhffs, $oid) = @_;
     my $query = 'SELECT owner_uid, date_creation, state, description FROM vhffs_object WHERE object_id =?';

Modified: branches/vhffs_4.1/vhffs-irc/modobot.pl
===================================================================
--- branches/vhffs_4.1/vhffs-irc/modobot.pl	2006-12-18 06:45:18 UTC (rev 379)
+++ branches/vhffs_4.1/vhffs-irc/modobot.pl	2006-12-19 22:35:48 UTC (rev 380)
@@ -368,7 +368,7 @@
     $oid    =       shift;
     $status =       shift;
 
-    $object = Vhffs::Object::get_by_id( $vhffs , $oid );
+    $object = Vhffs::Object::get_by_oid( $vhffs , $oid );
 
     if( ! defined $object )
     {

Modified: branches/vhffs_4.1/vhffs-panel/acl/add_acl_group.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/acl/add_acl_group.pl	2006-12-18 06:45:18 UTC (rev 379)
+++ branches/vhffs_4.1/vhffs-panel/acl/add_acl_group.pl	2006-12-19 22:35:48 UTC (rev 380)
@@ -75,7 +75,7 @@
 $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
 
 my $obj_src = Vhffs::Group::get_by_groupname( $vhffs , $groupname );
-my $obj_dst = Vhffs::Object::get_by_id( $vhffs , $oid_dst );
+my $obj_dst = Vhffs::Object::get_by_oid( $vhffs , $oid_dst );
 
 
 my $message;

Modified: branches/vhffs_4.1/vhffs-panel/acl/add_acl_user.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/acl/add_acl_user.pl	2006-12-18 06:45:18 UTC (rev 379)
+++ branches/vhffs_4.1/vhffs-panel/acl/add_acl_user.pl	2006-12-19 22:35:48 UTC (rev 380)
@@ -75,7 +75,7 @@
 $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
 
 my $obj_src = Vhffs::User::get_by_username( $vhffs , $username );
-my $obj_dst = Vhffs::Object::get_by_id( $vhffs , $oid_dst );
+my $obj_dst = Vhffs::Object::get_by_oid( $vhffs , $oid_dst );
 
 
 my $message;

Modified: branches/vhffs_4.1/vhffs-panel/acl/submit.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/acl/submit.pl	2006-12-18 06:45:18 UTC (rev 379)
+++ branches/vhffs_4.1/vhffs-panel/acl/submit.pl	2006-12-19 22:35:48 UTC (rev 380)
@@ -73,8 +73,8 @@
 
 $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
 
-my $obj_src = new Vhffs::Object( $vhffs , $oid_src , '401' );
-my $obj_dst = new Vhffs::Object( $vhffs , $oid_dst , '401' );
+my $obj_src = Vhffs::Object::get_by_oid( $vhffs , $oid_src );
+my $obj_dst = Vhffs::Object::get_by_oid( $vhffs , $oid_dst );
 
 
 my $message;
@@ -87,10 +87,6 @@
 {
 	$message = gettext( "Object Error" );
 }
-elsif( ( $obj_src->fetch < 0 ) || ( $obj_dst->fetch  < 0) )
-{
-	$message = gettext( "Object Error" );
-}
 else
 {
 	if( (  Vhffs::Acl::what_perm_for_user( $user , $obj_dst , $vhffs ) < Vhffs::Constants::ACL_MANAGEACL ) && ( $user->is_admin != 1 ) )

Modified: branches/vhffs_4.1/vhffs-panel/admin/moderation_submit.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/admin/moderation_submit.pl	2006-12-18 06:45:18 UTC (rev 379)
+++ branches/vhffs_4.1/vhffs-panel/admin/moderation_submit.pl	2006-12-19 22:35:48 UTC (rev 380)
@@ -82,7 +82,7 @@
 	use Vhffs::Object;
 	my $oid = $cgi->param("OID");
 	my $oidasker = $cgi->param("OID_ASKER");
-	my $object = Vhffs::Object::get_by_id( $vhffs , $oid );
+	my $object = Vhffs::Object::get_by_oid( $vhffs , $oid );
 
 	if( ( ! defined $oid ) || ( ! defined $object ) || ( ! defined $accept ) )
 	{
@@ -115,7 +115,7 @@
 		}
 		else
 		{
-			my $askerobject = Vhffs::Object::get_by_id( $vhffs , $oidasker );
+			my $askerobject = Vhffs::Object::get_by_oid( $vhffs , $oidasker );
 		    $object->set_description( $reason );
 		    $object->set_status( Vhffs::Constants::VALIDATION_REFUSED );
 	        if( $vhffs->get_config->use_notation == 1 )

Modified: branches/vhffs_4.1/vhffs-panel/admin/object/delete_avatar.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/admin/object/delete_avatar.pl	2006-12-18 06:45:18 UTC (rev 379)
+++ branches/vhffs_4.1/vhffs-panel/admin/object/delete_avatar.pl	2006-12-19 22:35:48 UTC (rev 380)
@@ -79,7 +79,7 @@
 {
 	$message =  gettext( "CGI ERROR !");
 }
-elsif( ( ! defined ( $object = new Vhffs::Object( $vhffs , $oid , '401'  ) ) ) || ( $object->fetch < 0 ) )
+elsif( ! defined ( $object = Vhffs::Object::get_by_oid( $vhffs , $oid ) ) )
 {
 	$message = gettext( "Cannot fetch object");
 }

Modified: branches/vhffs_4.1/vhffs-panel/admin/object/edit.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/admin/object/edit.pl	2006-12-18 06:45:18 UTC (rev 379)
+++ branches/vhffs_4.1/vhffs-panel/admin/object/edit.pl	2006-12-19 22:35:48 UTC (rev 380)
@@ -77,7 +77,7 @@
 	$template = new HTML::Template( filename => "$templatesdir/misc/simplemsg.tmpl" );
 	$template->param( MESSAGE => gettext( "CGI ERROR !") );
 }
-elsif( ( ! defined ( $object = new Vhffs::Object( $vhffs , $oid , '401'  ) ) ) || ( $object->fetch < 0 ) )
+elsif( ! defined ( $object = Vhffs::Object::get_by_oid( $vhffs , $oid ) ) )
 {
 	$template = new HTML::Template( filename => "$templatesdir/misc/simplemsg.tmpl" );
 	$template->param( MESSAGE => gettext( "Cannot fetch object") );

Modified: branches/vhffs_4.1/vhffs-panel/admin/object/edit_submit.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/admin/object/edit_submit.pl	2006-12-18 06:45:18 UTC (rev 379)
+++ branches/vhffs_4.1/vhffs-panel/admin/object/edit_submit.pl	2006-12-19 22:35:48 UTC (rev 380)
@@ -75,7 +75,7 @@
 {
 	$template->param( MESSAGE => gettext( "CGI ERROR !") );
 }
-elsif( ( ! defined ( $object = new Vhffs::Object( $vhffs , $oid , '401'  ) ) ) || ( $object->fetch < 0 ) )
+elsif( ! defined ( $object = Vhffs::Object::get_by_oid( $vhffs , $oid ) ) )
 {
 	$template->param( MESSAGE => gettext( "Cannot fetch object") );
 }

Modified: branches/vhffs_4.1/vhffs-panel/getavatar.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/getavatar.pl	2006-12-18 06:45:18 UTC (rev 379)
+++ branches/vhffs_4.1/vhffs-panel/getavatar.pl	2006-12-19 22:35:48 UTC (rev 380)
@@ -55,7 +55,7 @@
 $vhffs		= init Vhffs::Main;	
 $oid 		= $cgi->param( "oid" );
 
-$object = new Vhffs::Object( $vhffs , $oid , '401' );
+$object = Vhffs::Object::get_by_oid( $vhffs , $oid );
 
 $path = Vhffs::Panel::Avatar::exists_avatar( $vhffs , $object );
 

Modified: branches/vhffs_4.1/vhffs-panel/history.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/history.pl	2006-12-18 06:45:18 UTC (rev 379)
+++ branches/vhffs_4.1/vhffs-panel/history.pl	2006-12-19 22:35:48 UTC (rev 380)
@@ -71,19 +71,19 @@
 
 my $message;
 
-$object = new Vhffs::Object( $vhffs , $oid , '401' );
+$object = Vhffs::Object::get_by_oid( $vhffs , $oid );
 
 
 my $templatesdir = $vhffs->get_config->get_templatedir;
 
 
-if( ( ! defined $oid ) || ( ! defined $object ) )
+if( ! defined $oid )
 {
 	$template = new HTML::Template( filename => "$templatesdir/misc/simplemsg.tmpl" );
 	$message = gettext( "CGI Error !");
 	$template->param( MESSAGE => $message );
 }
-elsif( $object->fetch < 0 )
+elsif( !defined $object )
 {
 
 	$template = new HTML::Template( filename => "$templatesdir/misc/simplemsg.tmpl" );

Modified: branches/vhffs_4.1/vhffs-panel/object/upavatar.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/object/upavatar.pl	2006-12-18 06:45:18 UTC (rev 379)
+++ branches/vhffs_4.1/vhffs-panel/object/upavatar.pl	2006-12-19 22:35:48 UTC (rev 380)
@@ -71,7 +71,7 @@
 
 $cgioid = $cgi->param( 'OID' );
 $filename = $cgi->param( 'avatar' );
-$object = new Vhffs::Object( $vhffs , $cgioid , '401' );
+$object = Vhffs::Object::get_by_oid( $vhffs , $cgioid );
 
 $message = "";
 
@@ -95,7 +95,7 @@
 {
 	$message = gettext( "Object-ID error" );
 }
-elsif( ( ! defined( $object ) ) || ( $object->fetch < 0 ) )
+elsif( ! defined( $object ) )
 {
 	$message = gettext( "Cannot find object" );
 }

Modified: branches/vhffs_4.1/vhffs-panel/subscribe.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/subscribe.pl	2006-12-18 06:45:18 UTC (rev 379)
+++ branches/vhffs_4.1/vhffs-panel/subscribe.pl	2006-12-19 22:35:48 UTC (rev 380)
@@ -199,8 +199,6 @@
 			$template->param( GOOD_NEWS2 => $good_news2 );
 		    }
 		}
-		
-	    }
 	}
 	if ( ( scalar @errors ) > 0 ) {
 	    $template = new HTML::Template( filename => $templatedir."/user/create.tmpl" );

Modified: branches/vhffs_4.1/vhffs-tests/src/Object.pl
===================================================================
--- branches/vhffs_4.1/vhffs-tests/src/Object.pl	2006-12-18 06:45:18 UTC (rev 379)
+++ branches/vhffs_4.1/vhffs-tests/src/Object.pl	2006-12-19 22:35:48 UTC (rev 380)
@@ -29,7 +29,7 @@
 cmp_ok($obj2->fetch, '>', 0, 'Object fetched');
 
 is_deeply($obj1, $obj2, 'Fetched object matches created object');
-my $obj2b = Vhffs::Object::get_by_id($main, $oid1);
+my $obj2b = Vhffs::Object::get_by_oid($main, $oid1);
 is_deeply($obj2b, $obj2);
 
 my $history = $obj1->get_history;

Modified: branches/vhffs_4.1/vhffs-tools/src/vhffs-moderate
===================================================================
--- branches/vhffs_4.1/vhffs-tools/src/vhffs-moderate	2006-12-18 06:45:18 UTC (rev 379)
+++ branches/vhffs_4.1/vhffs-tools/src/vhffs-moderate	2006-12-19 22:35:48 UTC (rev 380)
@@ -380,15 +380,10 @@
 	$status	=	shift;
 	$vhffs	= init Vhffs::Main;
 
-	$object	= new Vhffs::Object( $vhffs , $oid , '51' );
+	$object	= Vhffs::Object::get_by_oid( $vhffs , $oid );
 
 	if( ! defined $object )
 	{
-		print "Object is null, error\n";
-		return( -1 );
-	}
-	elsif( $object->fetch < 0 )
-	{
 		print "Cannot fetch object\n";
 		return( -1 );
 	}


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