[Bio] / Babel / get_aclh.cgi Repository:
ViewVC logotype

View of /Babel/get_aclh.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (annotate)
Tue Dec 1 15:22:43 2009 UTC (10 years, 6 months ago) by wilke
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, mgrast_dev_03052011, mgrast_dev_05262011, mgrast_dev_04082011, mgrast_dev_12152011, mgrast_dev_06072011, mgrast_dev_10262011, mgrast_dev_02212011, mgrast_release_3_0, mgrast_dev_03252011, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, mgrast_dev_04012011, mgrast_dev_04052011, mgrast_dev_02222011
initial babel checkin

use strict;
use warnings;

use CGI;
use DBMaster;
use AnnoClearinghouse;
use FIG;

my 	$dbmaster = DBMaster->new(-database => 'WebAppBackend' ,
				  -backend  => 'MySQL',
				  -host     => 'bio-app-authdb.mcs.anl.gov' ,
				  -user     => 'mgrast',
				  );

my $fig = new FIG;

my $cgi = new CGI;                        # create new CGI object
print $cgi->header;                    # create the HTTP header
#     $cgi->start_html('hello world'), # start the HTML
#     $cgi->h1('hello world'),         # level 1 header
#     $cgi->end_html;                  # end the HTML


my $mode   = $cgi->param('mode')   | '';
my $login  = $cgi->param('login')  | '';
my $passwd = $cgi->param('passwd') | '';
my $expert = $cgi->param('expert') | '';


my $aclh = AnnoClearinghouse->new( $FIG_Config::clearinghouse_data , $FIG_Config::clearinghouse_contrib , 0 , $fig->db_handle);


# print "Params:\n" , join (" " , $cgi->param) , "\n";
# foreach my $key ( $cgi->param ){
#     print "$key\t".$cgi->param( $key )."\n";
# }



if ( $mode eq "get_assertions" ) {
    
    my $user_annotations = $aclh->get_all_user_annotations($expert);
    
    foreach my $var ( @$user_annotations ) {
	print join "\t" , @$var , "\n";
    }

}
elsif( $mode eq "load_assertions" ){

#	print "Load assertions\n";

    unless( $login and $passwd ) {
	print "Can not import file, invalid parameters\n";
#	exit;
    }

    my $file = "/tmp/upload.tmp";
    open(FILE , ">$file") or die "Can't open file!\n";

    if ( $cgi->param('file') ){
	my $filename = $cgi->param('file');
#	while (<$filename>) {
#	    print FILE;
#	}

	my $bad_list = [];
	print "Importing list for $login \n";
	my $result = $aclh->import_user_annotations($login, $filename, $bad_list);
	print "$result\n";
	# my @user_annotations = $aclh->get_all_user_annotations($login);
	# print "Done" , scalar @user_annotations,"\n";
    }
    else{
	print "No file\n";
    }

   close(FILE);
}
else{

    print "Nothing to do\n";

}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3