Project

General

Profile

« Previous | Next » 

Revision 9633

merge changes to accommodate multiple alternative identifiers into trunk from 2.6 branch.

View differences:

lib/style/common/templates/confirmData.tmpl
408 408
<p><span class="sectionnames">DISTRIBUTION INFORMATION</span> 
409 409

  
410 410
<a name=Site-specificCode></a>
411
<p><span class="label">Data Set Identifier:</span> [%identifier%]
411
<p><span class="label">Data Set Identifier:</span> [%identifierValue1%]
412 412
</p>
413 413

  
414 414
<p><span class="label">Data Medium:</span>       [%dataMedium%]&nbsp;&nbsp;&nbsp;&nbsp;<span class="label">Other Data Medium</span>: [%dataMediumOther%]
......
437 437
          <input type="hidden" name="wg" value="[%group%]">
438 438
      [% END %]
439 439
  [% END %]
440
  <input type="hidden" name="identifier" value="[%identifier%]">
440
  <input type="hidden" name="identifier" value="[%identifierValue1%]">
441
  <input type="hidden" name="identifierValue1" value="[%identifierValue1%]">
441 442
  <input type="hidden" name="title" value="[%title%]">
442 443
  <input type="hidden" name="origNamefirst0" value="[%origNamefirst0%]">
443 444
  <input type="hidden" name="origNamelast0" value="[%origNamelast0%]">
lib/style/common/templates/entryForm.tmpl
981 981

  
982 982
   <table class="tables" cellpadding="5" cellspacing="0" id="distTable">  
983 983
  <tr class="sectbody"><td class="rightCol"><span class="label">Data Set Identifier</span></td>
984
  <td colspan="5"><input type="TEXT" name="identifier" value="[%identifier%]" class="longwidth"></td></tr>
984
  <td colspan="5"><input type="TEXT" name="identifier" value="[%identifierValue1%]" class="longwidth"></td></tr>
985 985
  <tr class="sectbody"><td valign="top" align="right"><span class="label">Note:</span></td>
986 986
     <td colspan="4" align="left"><span class="regtext">
987 987
     If available, please enter a name or number that uniquely identifies and<br>
lib/style/common/templates/genericResponse.tmpl
72 72
                                <input type="hidden" name="wg" value="[%group%]">
73 73
                            [% END %]
74 74
                        [% END %]
75
                        <input type="hidden" name="identifier" value="[%identifier%]">
75
                        <input type="hidden" name="identifier" value="[%identifierValue1%]">
76
  						<input type="hidden" name="identifierValue1" value="[%identifierValue1%]">
76 77
                        <input type="hidden" name="title" value="[%title%]">
77 78
                        <input type="hidden" name="origNamefirst0" value="[%origNamefirst0%]">
78 79
                        <input type="hidden" name="origNamelast0" value="[%origNamelast0%]">
lib/style/common/templates/metacatui/confirmData.tmpl
399 399
<h4>Distribution Information</h4> 
400 400

  
401 401
<a name="Site-specificCode"></a>
402
<p><span class="text-info">Data Set Identifier:</span> [%identifier%]
402
<p><span class="text-info">Data Set Identifiers:</span> 
403

  
404
[% numIdentifier = 0 %]
405
[% IF identifierCount > 0 %]
406
    [% numIdentifier = identifierCount %]
407
[% END %]
408
[% cnt = 1 %]
409
[% WHILE cnt <= numIdentifier %]
410
    [% SET id = "identifierValue${cnt}" %]
411
    <p><span class="text-info">Identifier:</span> [% $id %]</p>
412
    [% cnt = cnt + 1 %]
413
 [% END %]
414

  
403 415
</p>
404 416

  
405 417
<p><span class="text-info">Data Medium:</span>       [%dataMedium%]    <span class="text-info">Other Data Medium</span>: [%dataMediumOther%]
......
458 470
          <input type="hidden" name="wg" value="[%group%]" />
459 471
      [% END %]
460 472
  [% END %]
461
  <input type="hidden" name="identifier" value="[%identifier%]" /> 
473

  
474
  [% cnt = 1 %]
475
  [% WHILE cnt <= numIdentifier %]
476
      [% SET id = "identifierValue${cnt}" %]
477
      <input type="hidden" name="[% id %]" value="[% $id %]" />
478
      <input type="hidden" name="identifier" value="[% $id %]" />
479
      [% cnt = cnt + 1 %]
480
  [% END %]  
481
  <input type="hidden" name="identifierCount" value="[% identifierCount %]" />
482

  
462 483
  <input type="hidden" name="title" value="[%title%]" />
463 484
  <input type="hidden" name="origNamefirst0" value="[%origNamefirst0%]" />
464 485
  <input type="hidden" name="origNamelast0" value="[%origNamelast0%]" />
lib/style/common/templates/metacatui/entryForm.js
655 655
    }
656 656
}
657 657

  
658

  
659
//BEGIN BRL ALTERNATE IDENTIFIER
660
function addIdentifier() {   
661
    var identifier   = document.getElementById("identifier");
662

  
663
    if (identifier.value !="") {
664
        var identifierCount = incrementCount("identifierCount");
665
        var row = createIdentifierRow(identifierCount, identifier.value);
666
        var identifierRowMarker = document.getElementById("addidentifierrow");
667
        var parent = identifierRowMarker.parentNode;
668
        
669
        var identifierHR = document.getElementById("identifierHRRow");
670
        if (identifierHR == null) {
671
            var identifierHRRow = createHRRow();
672
            identifierHRRow.setAttribute("id", "identifierHRRow");
673
            parent.insertBefore(identifierHRRow, identifierRowMarker);
674
        }
675
        
676
        parent.insertBefore(row, identifierRowMarker);
677

  
678
        identifier.value = "";
679
    } else {
680
        alert("Enter complete alternate identifier information");
681
    }
682
}
683

  
684
function createIdentifierRow(identifierCount, identifier){    
685
    var TR = document.createElement("tr");
686
    TR.className='sectbody';
687

  
688
    var labelTD = createTD("5","left", "pointer");
689
    if (navigator.userAgent.toLowerCase().indexOf('msie')!= -1 && document.all) {
690
        labelTD.attachEvent("onclick",new Function("identifierEditRow(event, 0, \"" + identifier  + "\")"));
691
    } else {
692
        labelTD.setAttribute("onClick","identifierEditRow(event, 0, \"" + identifier  + "\")");
693
    }
694

  
695
    var text = "Identifier: " + identifier;
696
    var label = document.createTextNode(text);
697

  
698
    labelTD.appendChild(label);
699
    labelTD.appendChild(createHiddenInput("identifier", identifier));
700
    
701
    var imgTD = createTD("","right");
702
    imgTD.className = 'rightCol';
703

  
704
    imgTD.appendChild(createIconLink("icon-arrow-up",
705
                                      "Move Up", "moveUpRow(event)",
706
                                      "pointer"));
707
    imgTD.appendChild(document.createTextNode(" "));
708
    imgTD.appendChild(createIconLink("icon-arrow-down",
709
                                      "Move Down", "moveDownRow(event, 'addidentifierrow')",
710
                                      "pointer"));
711
    imgTD.appendChild(document.createTextNode(" "));
712
    imgTD.appendChild(createIconLink("icon-remove-sign",
713
                                      "Delete", "delRow(event)",
714
                                      "pointer"));
715

  
716
    TR.appendChild(imgTD);
717
    TR.appendChild(labelTD);
718
    
719
    return TR;
720
}
721

  
722
function identifierEditRow(evt, num, identifier) {
723
    evt = (evt) ? evt : ((window.event) ? window.event : null);
724
    if (evt) {
725
        // equalize W3C/IE models to get event target reference
726
        var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
727
        if (elem && elem.nodeName == "TD") {
728
            try {
729
                var table = elem.parentNode;
730
                if (num == 0) {
731
                    table.removeChild(elem);
732
                    var TD = createTD("5","left", "pointer");
733
                    if (navigator.userAgent.toLowerCase().indexOf('msie')!= -1 && document.all) {
734
                        TD.attachEvent("onclick",new Function("identifierEditRow(event, 1, \"" + identifier  + "\")"));
735
                    } else {
736
                        TD.setAttribute("onClick","taxonEditRow(event, 1, \"" + identifier  + "\")");
737
                    }
738
          
739
                    
740
                    TD.appendChild(document.createTextNode(" Identifier: "));
741
                    TD.appendChild(createTextField("identifier", 15, identifier));
742
                    table.appendChild(TD);
743
                } else {
744
                    var child = elem.childNodes;
745
                    taxonName = child.item(1).value;
746
                    table.removeChild(elem);
747

  
748
                    var TD = createTD("5","left", "pointer");
749
                    if (navigator.userAgent.toLowerCase().indexOf('msie')!= -1 && document.all) {
750
                        TD.attachEvent("onclick",new Function("identifierEditRow(event, 0, \"" + identifier  + "\")"));
751
                    } else {
752
                        TD.setAttribute("onClick","identifierEditRow(event, 0, \"" + identifier  + "\")");
753
                    }                        
754
                    var text = "Identifier: " + identifier;
755
                    var label = document.createTextNode(text);
756
                    TD.appendChild(label);
757
                    TD.appendChild(createHiddenInput("identifier", identifier));
758
                    table.appendChild(TD);
759
                }
760
            } catch(e) {
761
                var msg = (typeof e == "string") ? e : ((e.message) ? e.message : "Unknown Error");
762
                alert("Error:\n" + msg);
763
                return;
764
            }
765
        }
766
    }
767
}
768
//END BRL ALTERNATE IDENTIFIER
769

  
658 770
function addKeyword() {
659 771
    var keyword   = document.getElementById("keyword");
660 772
    var keywordType   = document.getElementById("keywordType");
lib/style/common/templates/metacatui/entryForm.tmpl
1226 1226
						<div id="collapseDistribution" class="accordion-body collapse in">
1227 1227
							<div class="accordion-inner">
1228 1228
								<!--  the INPUT -->
1229
								<!--
1229 1230
								<div class="control-group">
1230 1231
									<label class="control-label" for="identifier">Data Set Identifier</label>
1231 1232
									<div class="controls">
......
1237 1238
									     data management system.</span>
1238 1239
									</div>
1239 1240
								</div>
1241
								-->
1242
								
1243
								<!-- BEGIN BRL MULTIPLE ALTERNATE IDENTIFIERS -->							
1240 1244
								<div class="control-group">
1245
									<label class="control-label" for="identifier">Alternate Identifier</label>
1246
									<div class="controls">
1247
										<input name="identifier" id="identifier">
1248
										<span class="help-block">
1249
									     If available, please enter a name or number that uniquely identifies and
1250
									     describes concisely the data set. Alternatively, provide other pertinent
1251
									     information that can identify and locate the data set within your site's
1252
									     data management system.</span>
1253
									</div>
1254
								</div>
1255
								<div class="control-group">
1256
									<label class="control-label" for="addIdentifierButton"></label>
1257
									<div class="controls">
1258
										<input type="button" class="btn" value="Add Identifier" onClick="addIdentifier()">
1259
									</div>
1260
								</div>
1261
								
1262
								<div class="control-group">
1263
									<label class="control-label" for="identifierTable"></label>
1264
									<div class="controls">
1265
										<table>
1266
											<tr id="addIdentifier">
1267
												<td colspan="6">
1268
											</tr>	
1269
											[% numIdentifier = 0 %]
1270
									        [% IF identifierCount %]
1271
									            [% numIdentifier = identifierCount %]
1272
									            <tr class="sectbody" id="identifierHRRow">
1273
									                <td colSpan="6">
1274
									                    <hr width = "85%"/>
1275
									                </td>
1276
									            </tr>
1277
									        [% END %]
1278
									        <input type="hidden" name="identifierCount" value="[%numIdentifier%]" id="identifierCount">
1279
									    
1280
									        [% cnt = 1 %]
1281
									        [% WHILE cnt <= numIdentifier%]        
1282
									            <tr class="sectbody">
1283
									                <td class="rightCol">
1284
									                    <a style="cursor:pointer">
1285
									                        <i onClick="cleanTextNodes('identifierHRRow', 'addidentifierrow');moveUpRow(event)"
1286
									                        class="icon-arrow-up"
1287
									                        alt="Move Up"></i>
1288
									                    </a>
1289
									                    <a style="cursor:pointer">
1290
									                        <i onClick="cleanTextNodes('identifierHRRow', 'addidentifierrow');moveDownRow(event, 'addidentifierrow')"
1291
									                        class="icon-arrow-down"
1292
									                        alt="Move Down"></i>
1293
									                    </a>
1294
									                    <a style="cursor:pointer">
1295
									                        <i class="icon-remove-sign"
1296
									                        onClick="delRow(event)" alt="Delete"></i>
1297
									                    </a>
1298
									                </td>
1299
									                [% SET id = "identifierValue${cnt}" %]
1300
									                <td colspan="5" align ="left" style="cursor:pointer"
1301
									                    onClick="identifierEditRow(event, 0, '[%$id%]')">
1302
									                    Identifier: [%$id%]
1303
									                    <input name="identifier" type="hidden" value="[%$id%]"/>
1304
									            </tr>
1305
									            [% cnt = cnt + 1 %]
1306
									        [% END %]
1307
									
1308
									     <tr class="sectbody" id="addidentifierrow"> 
1309
									        <td class="bordertop" valign="top" align="right"></td>
1310
									        <td class="bordertop" align="left" colspan="5"></td>
1311
									     </tr>
1312
									     
1313
									   </table>
1314
									</div>
1315
								</div>
1316
								
1317
								<!-- END BRL ALTERNATE IDENTIFIERS --->
1318
								
1319
								
1320
								<div class="control-group">
1241 1321
									<label class="control-label" for="dataMedium">*Data Medium</label>
1242 1322
									<div class="controls">
1243 1323
										[% IF form == 're_entry' && (dataMedium == "digital " || dataMedium == "digital")  %]  
lib/style/common/templates/metacatui/genericResponse.tmpl
66 66
                            [% END %]
67 67
                        [% END %]
68 68
                        <input type="hidden" name="funding" value="[%funding%]">
69
                        <input type="hidden" name="identifier" value="[%identifier%]">
69
                        
70
                        [% cnt = 1 %]
71
						[% WHILE cnt <= numIdentifier %]
72
							[% SET id = "identifierValue${cnt}" %]
73
							<input type="hidden" name="[% id %]" value="[% $id %]" />
74
							<input type="hidden" name="identifier" value="[% $id %]" />
75
							[% cnt = cnt + 1 %]
76
						[% END %]  
77
						<input type="hidden" name="identifierCount" value="[% identifierCount %]" />
78
                        
70 79
                        <input type="hidden" name="title" value="[%title%]">
71 80
                        <input type="hidden" name="origNamefirst0" value="[%origNamefirst0%]">
72 81
                        <input type="hidden" name="origNamelast0" value="[%origNamelast0%]">
src/perl/register-dataset.cgi
1841 1841
sub datasetStart() {
1842 1842
	my $dataset = "<dataset>\n";
1843 1843

  
1844
	if ( hasContent($FORM::identifier) ) {
1845
		$dataset .= "<alternateIdentifier system=\"$FORM::site\">";
1846
		$dataset .= normalize($FORM::identifier) . "</alternateIdentifier>\n";
1844
	## handle multiple alternate identifiers
1845
	my $identifierArray = \@FORM::identifier;
1846
	debug(  "datasetStart identifier array size = " . $#$identifierArray );
1847
	for ( my $i = 0 ; $i <= $#$identifierArray ; $i++ ) {
1848
		if (   hasContent( $identifierArray->[$i] ) )
1849
		{
1850
			debug(  "Processing identifier: id = "
1851
				  . $identifierArray->[$i] );
1852
			#$dataset .= "<alternateIdentifier system=\"$FORM::site\">";
1853
			$dataset .= "<alternateIdentifier>";
1854
			$dataset .= normalize($identifierArray->[$i]) . "</alternateIdentifier>\n";
1855
		}
1847 1856
	}
1857
	
1858
	
1848 1859
	return $dataset;
1849 1860
}
1850 1861

  
......
2715 2726

  
2716 2727
	# find out the tag <alternateIdentifier>.
2717 2728
	$results = $doc->findnodes('//dataset/alternateIdentifier');
2718
	if ( $results->size() > 1 ) {
2719
		errMoreThanOne("alternateIdentifier");
2720
	}
2721
	else {
2729
	if ( $results->size() > 0 ) {		
2730
		# handle multiple alternate identifiers
2731
		$results = $doc->findnodes('//dataset/alternateIdentifier');
2732
		my $identifierIndex = 0;
2722 2733
		foreach $node ( $results->get_nodelist ) {
2723
			$$templateVars{'identifier'} =
2724
			  findValue( $node, '../alternateIdentifier' );
2734
			$identifierIndex++;
2735
			$$templateVars{ "identifierValue" . $identifierIndex } =
2736
			  findValue( $node, '../alternateIdentifier[' . $identifierIndex . ']' );
2725 2737
		}
2738
		$$templateVars{'identifierCount'} = $identifierIndex;
2739
		
2726 2740
	}
2741
	
2727 2742

  
2728 2743
	# find out the tag <title>.
2729 2744
	$results = $doc->findnodes('//dataset/title');
......
4871 4886
	}
4872 4887

  
4873 4888
	$$templateVars{'funding'}        = normalizeCD($FORM::funding);
4874
	$$templateVars{'identifier'}     = normalizeCD($FORM::identifier);
4889
	
4890
	# handle multiple identifiers
4891
	#$$templateVars{'identifier'}     = normalizeCD($FORM::identifier);
4892
	my $identifierArray = \@FORM::identifier;
4893
	debug(  "Processing identifier array size = " . $#$identifierArray );
4894
	my $identifierCount     = 1;
4895
	for ( my $i = 0 ; $i <= $#$identifierArray ; $i++ ) {
4896
		if (   hasContent( $identifierArray->[$i] ) )
4897
		{
4898
			debug(  "Processing confirm identifier: id = "
4899
				  . $identifierArray->[$i] );
4900
			$$templateVars{ "identifierValue" . $identifierCount } =
4901
			  normalizeCD( $identifierArray->[$i] );
4902
			$identifierCount++;
4903
		}
4904
	}
4905
	$$templateVars{'identifierCount'} = $identifierCount - 1;
4906
	
4875 4907
	$$templateVars{'title'}          = normalizeCD($FORM::title);
4876 4908
	$$templateVars{'origNamefirst0'} = normalizeCD($FORM::origNamefirst0);
4877 4909
	$$templateVars{'origNamelast0'}  = normalizeCD($FORM::origNamelast0);
......
5178 5210
		$$templateVars{'wg'}       = \@FORM::wg;
5179 5211
	}
5180 5212
	$$templateVars{'funding'}        = $FORM::funding;
5181
	$$templateVars{'identifier'}     = $FORM::identifier;
5213
	
5214
	# handle multiple identifier values
5215
	#$$templateVars{'identifier'}     = $FORM::identifier;
5216
	$$templateVars{'identifierCount'}    = $FORM::identifierCount;
5217
	debug(  "Identifier template count: " . $FORM::identifierCount );
5218

  
5219
	foreach my $id ( param() ) {
5220
		if ( $id =~ /identifier/ ) {
5221
			debug(  "Processing identifier param: $id = " . param($id) );
5222
			
5223
			my $identifierIndex = $id;
5224
			$identifierIndex =~ s/identifierValue//;    # get the index of the parameter 0, ..., 10
5225
			my $idParamName = "identifierValue" . $identifierIndex;
5226
			debug(  "identifierIndex:" . $identifierIndex );
5227
			debug(  "idParamName: " . $idParamName );
5228
			debug(  "id: " . $id );
5229
			if ( $identifierIndex =~ /[0-9]+/ ) {
5230
				if ( hasContent( param($idParamName) ) ) {
5231
					debug(  "Processing template identifier: $id = "
5232
						  . param($idParamName) );
5233
					$$templateVars{$idParamName} = param($idParamName);
5234
				}
5235
			}
5236
		}
5237
	}
5238
	
5239
	
5182 5240
	$$templateVars{'title'}          = $FORM::title;
5183 5241
	$$templateVars{'origNamefirst0'} = $FORM::origNamefirst0;
5184 5242
	$$templateVars{'origNamelast0'}  = $FORM::origNamelast0;

Also available in: Unified diff