Project

General

Profile

Revision 2138

Added by sgarg over 16 years ago

Made changes to control whether a skin wants to use keywords or not. Keywords probably will be used by all skins alsways. But similar changes can be made for Geographic Coverage or Temporal COverage to control whether a particular section of the insert data template needs to be shown or not. This can be controlled from .cfg file. For example, in nceas.cfg is you define hasKeyword = false, none of the templates will show the keyword part. (Unless, you are using NCEAS skin and you try to modify a document which already has keywords.)

View differences:

register-dataset.cgi
72 72
$config->define("accesssysid");
73 73
$config->define("datasetpubid");
74 74
$config->define("datasetsysid");
75
$config->define("hasKeyword", { DEFAULT => 'true'} );
75 76
$config->define("mailhost");
76 77
$config->define("sender");
77 78
$config->define("recipient");
......
107 108
my $orgabbrev = $config->orgabbrev();
108 109
my $orgurl = $config->orgurl();
109 110
my $orgfilter = $organization;
110
   $orgfilter =~ s/ /%20/g;
111
      $orgfilter =~ s/ /%20/g;
111 112
my $responseTemplate = $config->responseTemplate();
112 113
my $entryFormTemplate = $config->entryFormTemplate();
113 114
my $deleteDataTemplate = $config->deleteDataTemplate();
......
117 118
my $accesssysid = $config->accesssysid();
118 119
my $datasetpubid = $config->datasetpubid();
119 120
my $datasetsysid = $config->datasetsysid();
121
my $hasKeyword = $config->hasKeyword();
120 122
my $mailhost = $config->mailhost();
121 123
my $sender = $config->sender();
122 124
my $recipient = $config->recipient();
......
233 235
        $$templateVars{'wg'} = \@FORM::wg;
234 236
    }
235 237

  
238
    $$templateVars{'hasKeyword'} = $hasKeyword;
239

  
236 240
    $$templateVars{'siteList'} = \@sortedSites;
237 241
    $$templateVars{'section'} = "Entry Form";
238 242
    $$templateVars{'docid'} = "";
......
320 324
	    $xmldocWithDocID = $xmldoc;
321 325
            $xmldocWithDocID =~ s/docid/$docid/;
322 326

  
327
	    # Code for testing the xml file being inserted####
323 328
            #my $testFile = "/tmp/test.xml";
324 329
            #open (TFILE,">$testFile") || die ("Cant open xml file...\n");
325 330
            #print TFILE $xmldoc;
326 331
            #close(TFILE);
332
	    ####
327 333
    
328 334
            $notunique = insertMetadata($xmldocWithDocID, $docid);
329 335
            #  if (!$notunique) {
......
1384 1390
    my $aoCount = 1;
1385 1391
    my $foundDSO;
1386 1392

  
1393
    # set variable values
1394
    $$templateVars{'hasKeyword'} = $hasKeyword;
1395
    
1387 1396
    # find out the tag <alternateIdentifier>. 
1388 1397
    $results = $doc->findnodes('//dataset/alternateIdentifier');
1389 1398
    if ($results->size() > 1) {
......
1623 1632
	$$templateVars{"kwTh$count"} = findValue($node, "keywordThesaurus");
1624 1633
    }
1625 1634
    $$templateVars{'keyCount'} = $count;
1635
    if($count > 0 ){
1636
       $$templateVars{'hasKeyword'} = "true";
1637
    }
1626 1638

  
1627 1639
    $results = $doc->findnodes('//dataset/additionalInfo');
1628 1640
    if ($results->size() > 1) {
......
2308 2320
    $$templateVars{'methodPara'} = \@tempMethodPara;
2309 2321
    $$templateVars{'studyExtentDescription'} = normalizeCD($FORM::studyExtentDescription);
2310 2322
    $$templateVars{'samplingDescription'} = normalizeCD($FORM::samplingDescription);
2323
    $$templateVars{'origStateContact'} = $FORM::origState;
2324

  
2325
    $$templateVars{'hasKeyword'} = $FORM::hasKeyword;
2311 2326
    $$templateVars{'docid'} = $FORM::docid;
2312 2327

  
2313 2328
    if (! $error) {
......
2500 2515
    $$templateVars{'methodPara'} = \@FORM::methodPara;
2501 2516
    $$templateVars{'studyExtentDescription'} = $FORM::studyExtentDescription;
2502 2517
    $$templateVars{'samplingDescription'} = $FORM::samplingDescription;
2518
    
2519
     $$templateVars{'hasKeyword'} = $FORM::hasKeyword;
2503 2520
}
2504 2521

  
2505 2522
################################################################################

Also available in: Unified diff