Project

General

Profile

« Previous | Next » 

Revision 1973

Preliminary changes to support the NCEAS data registry connection to the
AdminDB to retrieve project lists.

View differences:

register-dataset.cgi
77 77
$config->define("sender");
78 78
$config->define("recipient");
79 79
$config->define("adminname");
80
if ($FORM::cfg eq 'nceas') {
81
    $config->define("nceas_db");
82
    $config->define("nceas_db_user");
83
    $config->define("nceas_db_password");
84
}
80 85
$config->define("responseTemplate", { DEFAULT => 'crap.tmpl'} );
81 86
$config->define("entryFormTemplate", { DEFAULT => 'crap.tmpl'} );
82 87
$config->define("guideTemplate", { DEFAULT => 'crap.tmpl'} );
......
117 122
my $sender = $config->sender();
118 123
my $recipient = $config->recipient();
119 124
my $adminname = $config->adminname();
125
my $nceas_db;
126
my $nceas_db_user;
127
my $nceas_db_password;
128
if ($FORM::cfg eq 'nceas') {
129
    $nceas_db = $config->nceas_db();
130
    $nceas_db_user = $config->nceas_db_user();
131
    $nceas_db_password = $config->nceas_db_password();
132
}
120 133
my $debug = $config->debug();
121 134
my $lat = $config->get('lat');
122 135
my $lon = $config->get('lon');
......
213 226
    foreach my $site (sort @sitelist) {
214 227
        push(@sortedSites, $site);
215 228
    }
229
    
230
    if ($FORM::cfg eq 'nceas') {
231
        my $projects = getProjectList();
232
        for (my $i = 0; $i < scalar(@$projects); $i++) {
233
            print @$projects[$i]->[0]," ", @$projects[$i]->[3],"\n";
234
        }
235
    }
216 236
    $$templateVars{'siteList'} = \@sortedSites;
217 237
    $$templateVars{'section'} = "Entry Form";
218 238
    $$templateVars{'docid'} = "";
......
2481 2501
        print STDERR "$msg\n";
2482 2502
    }
2483 2503
}
2504

  
2505
################################################################################
2506
# 
2507
# get the list of projects
2508
#
2509
################################################################################
2510
sub getProjectList {
2511
    
2512
    #use NCEAS::AdminDB;
2513

  
2514
    #my $admindb = NCEAS::AdminDB->new();
2515
    #$admindb->connect($nceas_db, $nceas_db_user, $nceas_db_password);
2516
    #my $projects = $admindb->getProjects();
2517

  
2518
    # This block is for testing only!  Remove for production use
2519
    my @row1;
2520
    $row1[0] = 6000; $row1[1] = 'a1'; $row1[2] = 'a2'; $row1[3] = 'a3';
2521
    my @row2; 
2522
    $row2[0] = 7000; $row2[1] = 'b1'; $row2[2] = 'b2'; $row2[3] = 'b3';
2523
    my @projects;
2524
    $projects[0] = \@row1;
2525
    $projects[1] = \@row2;
2526
    return \@projects;
2527

  
2528
    #return $projects;
2529
}

Also available in: Unified diff