Project

General

Profile

Revision 1982

Added by Matt Jones over 17 years ago

Modifications to add "Methods" collection to the data registry, and to
make the forms HTML 4.0.1 valid (in an attempt to figure out some of
the rendering and layout oddities I'm seeing).

View differences:

register-dataset.cgi
308 308
        push(@errorMessages, "Failed during login.\n");
309 309
    }
310 310

  
311
debug( "Registry: A");
311
    debug( "Registry: A");
312 312
    if ($FORM::docid eq "") {
313 313
        debug( "Registry: B1");
314 314
        # document is being inserted 
......
318 318
            
319 319
            $xmldoc =~ s/docid/$docid/;
320 320
    
321
            #my $testFile = "/usr/local/apache2/htdocs/xml/test.xml";
321
            #my $testFile = "/tmp/test.xml";
322 322
            #open (TFILE,">$testFile") || die ("Cant open xml file...\n");
323 323
            #print TFILE $xmldoc;
324 324
            #close(TFILE);
......
1158 1158

  
1159 1159
    $doc .= $cont;
1160 1160
    $doc .= $publ;
1161
    
1162
    if ((hasContent($FORM::methodTitle)) || scalar(@FORM::methodsPara) > 0) {
1163
        my $methods = "<methods><methodStep><description><section>\n";
1164
        if (hasContent($FORM::methodTitle)) {
1165
            $methods .= "<title>$FORM::methodTitle</title>\n";
1166
        }
1167
        for (my $i = 0; $i < scalar(@FORM::methodPara); $i++) {
1168
            $methods .= "<para>$FORM::methodPara[$i]</para>\n";
1169
        }
1170
        $methods .= "</section></description></methodStep></methods>\n";
1171
        $doc .= $methods;
1172
    }
1161 1173

  
1162 1174
    $doc .= "<access authSystem=\"knb\" order=\"denyFirst\">\n";
1163 1175
    $doc .= "<allow>\n";
......
1856 1868
        }
1857 1869
    }
1858 1870
    
1871
    $results = $doc->findnodes('//dataset/methods/methodStep/description/section');
1872
    debug("Registry: Number methods: ".$results->size());
1873
    if ($results->size() > 1) {
1874
        errMoreThanN("methods/methodStep/description/section");    
1875
    } else {
1876
        dontOccur($doc, "//methodStep/citation", "methodStep/citation");
1877
        dontOccur($doc, "//methodStep/protocol", "methodStep/protocol");
1878
        dontOccur($doc, "//methodStep/instrumentation", "methodStep/instrumentation");
1879
        dontOccur($doc, "//methodStep/software", "methodStep/software");
1880
        dontOccur($doc, "//methodStep/subStep", "methodStep/subStep");
1881
        dontOccur($doc, "//methodStep/dataSource", "methodStep/dataSource");
1882
        dontOccur($doc, "//methods/sampling", "methods/sampling");
1883
        dontOccur($doc, "//methods/qualityControl", "methods/qualityControl");
1884

  
1885
        my @methodPara;
1886
        foreach $node ($results->get_nodelist) {
1887
            my @children = $node->childNodes;
1888
            for (my $i = 0; $i < scalar(@children); $i++) {
1889
                debug("Registry: Method child loop ($i)");
1890
                my $child = $children[$i];
1891
                if ($child->nodeName eq 'title') {
1892
                    my $title = $child->textContent();
1893
                    debug("Registry: Method title ($title)");
1894
                    $$templateVars{'methodTitle'} = $title;
1895
                } elsif ($child->nodeName eq 'para') {
1896
                    my $para = $child->textContent();
1897
                    debug("Registry: Method para ($para)");
1898
                    $methodPara[scalar(@methodPara)] = $para;
1899
                }
1900
            }
1901
        }
1902
        if (scalar(@methodPara) > 0) {
1903
            $$templateVars{'methodPara'} = \@methodPara;
1904
        }
1905
    }
1906

  
1859 1907
    dontOccur($doc, "./pubPlace", "pubPlace");
1860
    dontOccur($doc, "./methods", "methods");
1861 1908
    dontOccur($doc, "./project", "project");
1862 1909
    
1863 1910
    dontOccur($doc, "./dataTable", "dataTable");
......
2219 2266
    $$templateVars{'longMin2'} = $FORM::longMin2;
2220 2267
    $$templateVars{'longSec2'} = $FORM::longSec2;
2221 2268
    $$templateVars{'hemisphLong2'} = $FORM::hemisphLong2;
2269
    $$templateVars{'methodTitle'} = $FORM::methodTitle;
2270
    $$templateVars{'methodPara'} = \@FORM::methodPara;
2222 2271
    $$templateVars{'docid'} = $FORM::docid;
2223 2272

  
2224 2273
    $$templateVars{'section'} = "Confirm Data";
......
2256 2305
    $$templateVars{'providerGivenName'} = $FORM::providerGivenName;
2257 2306
    $$templateVars{'providerSurName'} = $FORM::providerSurName;
2258 2307
    $$templateVars{'site'} = $FORM::site;
2259
    if($FORM::cfg eq "nceas"){
2308
    if ($FORM::cfg eq "nceas") {
2260 2309
        my $projects = getProjectList();
2261 2310
        $$templateVars{'projects'} = $projects;
2262 2311
        $$templateVars{'wg'} = \@FORM::wg;
......
2387 2436
    $$templateVars{'longMin2'} = $FORM::longMin2;
2388 2437
    $$templateVars{'longSec2'} = $FORM::longSec2;
2389 2438
    $$templateVars{'hemisphLong2'} = $FORM::hemisphLong2;
2439
    if ($FORM::cfg eq "nceas") {
2440
        $$templateVars{'methodsTitle'} = $FORM::methodsTitle;
2441
        $$templateVars{'methodsPara'} = \@FORM::methodsPara;
2442
    }
2390 2443
    $$templateVars{'docid'} = $FORM::docid;
2391 2444

  
2392 2445
    $$templateVars{'form'} = 're_entry';

Also available in: Unified diff