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:

lib/style/common/templates/entryForm.tmpl
3 3
[% IF cfg == 'nrs' %]
4 4
  [% lsite = 'reserve' %]
5 5
  [% usite = 'Reserve' %]
6
  [% showSiteList = 'true' %]
7
[% ELSIF cfg == 'obfs' %]
8
  [% lsite = 'station' %]
9
  [% usite = 'Station' %]
10
  [% showSiteList = 'true' %]
11
[% ELSIF cfg == 'nceas' %]
12
  [% lsite = 'station' %]
13
  [% usite = 'Station' %]
14
  [% showSiteList = 'false' %]
6 15
[% ELSE %]
7 16
  [% lsite = 'station' %]
8 17
  [% usite = 'Station' %]
18
  [% showSiteList = 'false' %]
9 19
[% END %]
10 20

  
11 21
      [% IF form != 're_entry' %]	
......
76 86
        <p><font size="-1"><b> 
77 87
          <input type="TEXT" name="providerSurName" size="40" value="[%providerSurName%]">
78 88
          <font color="#ff0000">*</font>Last Name</b></font></p>
89
[% IF showSiteList == 'true' %]
79 90
        <p align="left"> <font size="-1">
80 91
          <select name="site" value="[%site%]">
81 92
	    [% IF form == 're_entry' %]
......
88 99
            [% END %]
89 100
          </select>
90 101
          <b><font color="#ff0000">*</font>[% usite %] Name</b></font></p>
102
[% END %]
103
[% IF cfg == 'nceas' %]
104
        <p align="left"> <font size="-1">
105
          <input type="TEXT" name="site" size="40" value="[%site%]">
106
          <b><font color="#ff0000">*</font>Working Group Name</b></font></p>
107
[% END %]
91 108
        <p align="left"><font size="-1"> 
92 109
          <input type="TEXT" name="title" value="[%title%]" size="53">
93 110
          <b><font color="#ff0000">*</font>Data Set Title</b></font></p>
......
1029 1046
          bounding box.</b></font></p>
1030 1047
      </td>
1031 1048
    </tr>
1049
[% IF showSiteList == 'true' %]
1032 1050
    <tr> 
1033 1051
      <td valign="TOP" colspan="4" class="tablepanel"><font size="-1" color="#ff0000"> 
1034 1052
        <input
......
1037 1055
        at the [% lsite %]. If you check this box, you don't need to fill in the lat./long. 
1038 1056
        fields below).</font> </td>
1039 1057
    </tr>
1058
[% END %]
1040 1059
    <tr> 
1041 1060
      <td width="18%" valign="TOP"> 
1042 1061
        <p><font size="-1"><b><font color="#ff0000">*</font>Latitude</b></font></p>
src/perl/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