Project

General

Profile

« Previous | Next » 

Revision 4357

Added by walbridge over 16 years ago

Further improvements to the registry to properly support the new properties. Removed all variables previously passed around between forms which should always be available canonically from the skin.properties file and replaced with refences to properties value for the skin being used. Removed some cruft from both files, fixed mior issues mentioned in bug #3487.

View differences:

lib/style/common/templates/entryForm.tmpl
71 71
  <input type="hidden" name="cfg" value="[% cfg %]">
72 72
  <input type="hidden" name="docid" value="[% docid %]">
73 73
  <input type="hidden" name="stage" value="insert">
74
  <input type="hidden" name="showSiteList" value="[% showSiteList %]">
75
  <input type="hidden" name="showWgList" value="[% showWgList %]">
76
  <input type="hidden" name="showOrganization" value="[% showOrganization %]">
77 74
  <input type="hidden" name="lsite" value="[% config.site %]">
78
  <input type="hidden" name="hasKeyword" value="[% hasKeyword %]">
79
  <input type="hidden" name="hasTemporal" value="[% hasTemporal %]">
80
  <input type="hidden" name="hasSpatial" value="[% hasSpatial %]">
81
  <input type="hidden" name="hasTaxonomic" value="[% hasTaxonomic %]">
82
  <input type="hidden" name="hasMethod" value="[% hasMethod %]">
83
  <input type="hidden" name="hasUpload" value="[% hasUpload %]">
84
  <input type="hidden" name="temporalRequired" value="[% temporalRequired %]">
85
  <input type="hidden" name="spatialRequired" value="[% spatialRequired %]">
86
  <input type="hidden" name="contactEmailAddressRequired" value="[% contactEmailAddressRequired %]">
87 75
  
88 76
        <table class="tables" cellpadding="5" cellspacing="0">
89 77
        <tr class="sectheader"><td colspan="5" align="left"><span class="label">NAME OF SUBMITTER&nbsp;
......
113 101
	<tr class="sectbody" id="title"><td class="rightCol"><span class="label">*Data Set Title</span></td><td colspan="5"><input type="TEXT" name="title" value="[%title%]" class="longwidth">
114 102
        </td></tr>
115 103
		
116
	[% IF showSiteList == 'true' %]
104
	[% IF show.siteList == 'true' %]
117 105
        <tr class="sectbody" id="sitelist"><td class="rightCol"><span class="label">*[% config.site | ucfirst %] Name</span></td>
118 106
	  <td colspan="5"><select name="site" class="longwidth">
119 107
	    [% IF form == 're_entry' %]
......
127 115
          </select></td></tr>
128 116
[% END %]
129 117
        
130
	[% IF showWgList == 'true' %]
118
	[% IF show.wgList == 'true' %]
131 119
        <tr class="sectbody"><td class="rightCol"><span class="label">*NCEAS Project(s):</span></td>
132 120
            <td colspan="5"><select name="wg" multiple="multiple" size="5" class="longwidth">
133 121
            [% FOREACH project = projects %]
......
147 135
            [% END %]
148 136
          </select></td></tr>
149 137
[% END %]
150
[% IF showOrganization == 'true' %]
138
[% IF show.organization == 'true' %]
151 139
        <tr class="sectbody"><td class="rightCol"><span class="label">*Organization Name</span></td>
152 140
            <td colspan="5"><input type="TEXT" name="site" class="longwidth" value="[%site%]"></td></tr>
153 141
[% END %]
......
344 332
    <tr class="sectbody"><td class="rightCol" valign="top"><span class="label">*Data Set Abstract</span><br><span class="regtext">(max. 350 words)</span></td>
345 333
        <td colspan="5"><textarea rows="6" cols="60" name="abstract">[%abstract%]</textarea></td></tr>
346 334
    </table>
347
   
348
  [% IF hasKeyword == 'true' %]
335
  [% IF modules.keyword == 'true' %]
349 336
    <table class="tables" cellpadding="5" cellspacing="0">
350 337
  <tr class="sectheader"><td colspan="5" align="left"><span class="label">KEYWORD INFORMATION <span class="label">&nbsp;</span><a href="[% cgiPrefix %]/register-dataset.cgi?cfg=[%cfg%]&amp;stage=guide#KeywordInformation"
351 338
        target="guide"><span class="smalltext">(What's this?)</span></a></td>
......
384 371
             <option>GCMD</option>
385 372
            </select>
386 373
	    
387
	  <!--  <input type="radio"  name="kwTh[%cnt%]" value="none"><span class="regtext">None&nbsp;&nbsp;</span>
388
	  <input type="radio"  name="kwTh[%cnt%]" value="GCMD"><span class="regtext">GCMD&nbsp;&nbsp;</span> --> 
389
	   
390
	    
391 374
	    </td></tr>
392 375
            
393 376
	  <tr id="addKeyword" class="sectbody">
......
446 429
       </table>
447 430
  [% END %]
448 431
  
449
  [% IF hasTemporal == 'true' %]
432
  [% IF modules.temporal == 'true' %]
450 433
   
451 434
  <table class="tables" cellpadding="5" cellspacing="0">   
452 435
  <tr class="sectheader"><td colspan="5" align="left"><span class="label">
......
467 450
     
468 451
      <tr class="sectbody"> 
469 452
        <td class="rightCol"> 
470
          [% IF temporalRequired == 'true' %]
453
          [% IF required.temporal == 'true' %]
471 454
          	<span class="label">*Year (yyyy)</span>
472 455
          [% ELSE %]
473 456
		<span class="label">Year (yyyy)</span>
......
481 464
	  
482 465
	<tr class="sectbody">
483 466
	  <td class="rightCol">
484
          <!-- from eml-2.0.1, it is not required to make month and day required -->
485
	  <!-- [% IF temporalRequired == 'true' %]
486
	        <span class="label">*Month</span>
487
          [% ELSE %]
488
		<span class="label">Month</span>
489
	  [% END %]-->
490 467
	  <span class="label">Month</span>
491 468
          </td>
492 469
	  <td align="left"><select name="beginningMonth">
......
512 489
	 	  
513 490
   <tr class="sectbody">
514 491
	  <td class="rightCol"> 
515
          <!--[% IF temporalRequired == 'true' %]
516
        	  <span class="label">*Day</span>
517
          [% ELSE %]
518 492
	          <span class="label">Day</span>
519
	  [% END %]-->
520
	          <span class="label">Day</span>
521 493
	  </td>
522 494
	  
523 495
	  <td align="left"><select name="beginningDay">
......
556 528
     </table>
557 529
  [% END %]  
558 530
  
559
[% IF hasSpatial == 'true' %]
531
[% IF modules.spatial == 'true' %]
560 532

  
561 533
  <table class="tables" cellpadding="5" cellspacing="0">  
562 534

  
......
570 542
   <table class="tables" cellpadding="5" cellspacing="0" id="spatialTable">  
571 543
   
572 544
    <tr class="sectbody">
573
       [% IF spatialRequired == 'true' %]
545
       [% IF required.spatial == 'true' %]
574 546
      	  <td align="right" valign="top"><span class="label">*Geographic Description</span></td>
575 547
    [% ELSE %]
576 548
          <td align="right" valign="top"><span class="label">Geographic Description</span></td>
......
582 554
    <tr class="sectbody"><td class="topbottom" align="center" colspan="6"><span class="label">COORDINATES</span></td></tr>
583 555
        
584 556
     
585
  [% IF showSiteList == 'true' %]
557
  [% IF show.siteList == 'true' %]
586 558
    <tr class="sectbody"><td align="left" valign="top" colspan="6">
587 559
        <input class="label" type="CHECKBOX" name="useSiteCoord" [%useSiteCoord%]>
588 560
        <span class="regtext">Use [% config.site %] coordinates. (This indicates that the data were
......
601 573
      
602 574
   <tr class="sectbody">
603 575
     <td class="rightCol">
604
      [% IF spatialRequired == 'true' %]
576
      [% IF required.spatial == 'true' %]
605 577
        <span class="label">*Latitude</span>
606 578
      [% ELSE %]
607 579
        <span class="label">Latitude</span>
......
627 599

  
628 600
    <tr class="sectbody">
629 601
      <td class="rightCol"> 
630
      [% IF spatialRequired == 'true' %]
602
      [% IF required.spatial == 'true' %]
631 603
        <span class="label">*Longitude</span>
632 604
      [% ELSE %]
633 605
        <span class="label">Longitude</span>
......
702 674
  </table>    
703 675
   [% END %]
704 676

  
705
   [% IF hasTaxonomic == 'true' %]
677
   [% IF modules.taxonomic == 'true' %]
706 678
   
707 679
   <table class="tables" cellpadding="5" cellspacing="0">  
708 680

  
......
793 765
   </table>
794 766
    [% END %]	
795 767

  
796
  [% IF hasMethod == 'true' %]
768
  [% IF modules.method == 'true' %]
797 769
   <table class="tables" cellpadding="5" cellspacing="0">  
798 770
  <tr class="sectheader"><td colspan="5" align="left">
799 771
  <span class="label">DATA COLLECTION METHODS&nbsp;</span>
......
875 847
      <td class="rightCol"><span class="label">Organization Name</span>
876 848
      <td colspan="5"><input type="TEXT" name="origNameOrgContact" id="contactNameOrg" value="[%origNameOrgContact%]" class="longwidth"></td></tr>
877 849
    <tr class="sectbody">      
878
      [% IF contactEmailAddressRequired == 'true' %]
850
      [% IF required.contactEmailAddress == 'true' %]
879 851
      	<td class="rightCol"><span class="label">*E-Mail</span>
880 852
      [% ELSE %]
881 853
      	<td class="rightCol"><span class="label">E-Mail</span>
......
991 963
  
992 964
        <td colspan="5" align="left">
993 965
        [% IF form == 're_entry' && (dataMedium == "digital " || dataMedium == "digital")  %]	
994
            <input type="radio"  name="dataMedium" onClick="handleOther(0, 'otherDM')" value="digital" CHECKED><span class="regtext">Digital&nbsp;&nbsp;</span></input>
966
            <input type="radio"  name="dataMedium" onClick="handleOther(0, 'otherDM')" value="digital" CHECKED>
967
						<span class="regtext">Digital&nbsp;&nbsp;</span></input>
995 968
        [%ELSE%]
996
            <input type="radio"  name="dataMedium" onClick="handleOther(0, 'otherDM')" value="digital"><span class="regtext">Digital&nbsp;&nbsp;</span></input>
969
            <input type="radio"  name="dataMedium" onClick="handleOther(0, 'otherDM')" value="digital">
970
						<span class="regtext">Digital&nbsp;&nbsp;</span></input>
997 971
        [% END %]
998 972
        [% IF form == 're_entry' && (dataMedium == "hardcopy " || dataMedium == "hardcopy") %]	
999
           <input type="radio"  name="dataMedium" onClick="handleOther(0, 'otherDM')" value="hardcopy" CHECKED><span class="regtext">Hardcopy&nbsp;&nbsp;</span></input>
973
           <input type="radio"  name="dataMedium" onClick="handleOther(0, 'otherDM')" value="hardcopy" CHECKED>
974
					 <span class="regtext">Hardcopy&nbsp;&nbsp;</span></input>
1000 975
        [%ELSE%]
1001
           <input type="radio"  name="dataMedium" onClick="handleOther(0, 'otherDM')" value="hardcopy"><span class="regtext">Hardcopy&nbsp;&nbsp;</span></input>
976
           <input type="radio"  name="dataMedium" onClick="handleOther(0, 'otherDM')" value="hardcopy">
977
					 <span class="regtext">Hardcopy&nbsp;&nbsp;</span></input>
1002 978
        [% END %]
1003 979
        [% IF form == 're_entry' && dataMedium == "other" %]
1004
           <input type="radio" name="dataMedium" value="other" onClick="handleOther(1, 'otherDM')" CHECKED><span class="regtext">Other&nbsp;</span></input>
980
           <input type="radio" name="dataMedium" value="other" onClick="handleOther(1, 'otherDM')" CHECKED>
981
					 <span class="regtext">Other&nbsp;</span></input>
1005 982
        [%ELSE%]
1006
           <input type="radio"  name="dataMedium" onClick="handleOther(1, 'otherDM')" value="other"><span class="regtext">Other&nbsp;</span></input>
983
           <input type="radio"  name="dataMedium" onClick="handleOther(1, 'otherDM')" value="other">
984
					 <span class="regtext">Other&nbsp;</span></input>
1007 985
        [% END %]
1008 986

  
1009 987
	<input type="TEXT" name="dataMediumOther" value="[%dataMediumOther%]" id="otherDM" class="shortwidth"></input>
......
1014 992
      <td colspan="5" align="left">
1015 993
      
1016 994
          [% IF form == 're_entry' && useConstraints == "no restrictions" %]		  
1017
	    <input type="radio"  name="useConstraints" onClick="handleOther(0, 'otherUC')" value="no restrictions" CHECKED><span class="regtext">No restrictions&nbsp;&nbsp;</span>
995
	    <input type="radio"  name="useConstraints" onClick="handleOther(0, 'otherUC')" value="no restrictions" CHECKED>
996
			<span class="regtext">No restrictions&nbsp;&nbsp;</span>
1018 997
          [%ELSE%]
1019
            <input type="radio"  name="useConstraints" onClick="handleOther(0, 'otherUC')" value="no restrictions"><span class="regtext">No restrictions&nbsp;&nbsp;</span>
998
            <input type="radio"  name="useConstraints" onClick="handleOther(0, 'otherUC')" value="no restrictions">
999
						<span class="regtext">No restrictions&nbsp;&nbsp;</span>
1020 1000
          [%END%]
1021 1001
          [% IF form == 're_entry' && useConstraints == "Obtain permission from data set owner(s)" %]		  
1022
  	    <input type="radio"  name="useConstraints" onClick="handleOther(0, 'otherUC')" value="Obtain permission from data set owner(s)" CHECKED><span class="regtext">Obtain permission from data set owner(s)&nbsp;&nbsp;</span>
1002
  	    <input type="radio"  name="useConstraints" onClick="handleOther(0, 'otherUC')" value="Obtain permission from data set owner(s)" CHECKED>
1003
				<span class="regtext">Obtain permission from data set owner(s)&nbsp;&nbsp;</span>
1023 1004
          [%ELSE%]
1024
            <input type="radio"  name="useConstraints" onClick="handleOther(0, 'otherUC')" value="Obtain permission from data set owner(s)"><span class="regtext">Obtain permission from data set owner(s)&nbsp;&nbsp;</span>
1005
            <input type="radio"  name="useConstraints" onClick="handleOther(0, 'otherUC')" value="Obtain permission from data set owner(s)">
1006
						<span class="regtext">Obtain permission from data set owner(s)&nbsp;&nbsp;</span>
1025 1007
          [%END%]
1026 1008
          </td></tr>
1027 1009
	  
......
1030 1012
   <tr class="sectbody"><td></td><td colspan="5" align="left">
1031 1013
 
1032 1014
    [% IF form == 're_entry' && useConstraints == "other" %]		  
1033
      <input type="radio"  name="useConstraints" onClick="handleOther(1, 'otherUC')" value="other" CHECKED><span class="regtext">Other&nbsp;</span>
1015
      <input type="radio"  name="useConstraints" onClick="handleOther(1, 'otherUC')" value="other" CHECKED>
1016
			<span class="regtext">Other&nbsp;</span>
1034 1017
    [%ELSE%]
1035
      <input type="radio"  name="useConstraints" onClick="handleOther(1, 'otherUC')" value="other"><span class="regtext">Other&nbsp;</span>
1018
      <input type="radio"  name="useConstraints" onClick="handleOther(1, 'otherUC')" value="other">
1019
			<span class="regtext">Other&nbsp;</span>
1036 1020
    [%END%]
1037 1021
   <input type="TEXT" name="useConstraintsOther" id="otherUC" value="[%useConstraintsOther%]" size="49"></td</tr>
1038 1022
   
......
1045 1029
   
1046 1030
   </table>
1047 1031
   
1048
  [% IF hasUpload == 'true' %]
1032
  [% IF modules.upload == 'true' %]
1049 1033

  
1050 1034
  <!-- Associated Data -->
1051 1035
  <table class="tables" cellpadding="5" cellspacing="0">
......
1123 1107
   <tr class="sectheader"><td colspan="6" align="left"></td></tr>
1124 1108
   <tr class="sectheader"><td colspan="6" align="center" class="borderbottom"><input type="SUBMIT" onClick="sortInputTags()" value="Submit Data Set Description" name="SUBMIT">
1125 1109
              
1126
   
1127
   <!-- <span>&nbsp;&nbsp;</span><input type="RESET" value="Reset Form" name="RESET"></td></tr>-->
1128 1110
    </table>
1129 1111
    <p></p>
1130 1112
   
lib/style/common/templates/confirmData.tmpl
144 144
<a name="DataSetAbstract"></a>
145 145
<p><span class="sectionnames">DATA SET ABSTRACT</span><br>  [%abstract%]
146 146
</p>
147
 [% IF hasKeyword == 'true' %]
147
 [% IF module.keyword == 'true' %]
148 148
<hr>
149 149
<a name="KeywordInformation"></a>
150 150
<p><span class="sectionnames">KEYWORD INFORMATION</span> 
......
187 187
</table>
188 188
[% END %]
189 189
  
190
[% IF hasTemporal == 'true' %]
190
[% IF module.temporal == 'true' %]
191 191
<hr>
192 192
<a name="TemporalCoverageOfData"></a>
193 193
<p><span class="sectionnames">TEMPORAL COVERAGE OF DATA</span> 
......
199 199
</p>
200 200
[% END %]
201 201

  
202
[% IF hasSpatial == 'true' %]
202
[% IF module.spatial == 'true' %]
203 203
<hr>
204 204
<a name="SpatialCoverageOfData"></a>
205 205
<p><span class="sectionnames">SPATIAL COVERAGE OF DATA</span> 
......
304 304
  </table>
305 305
[% END %]
306 306

  
307
[% IF hasTaxonomic == 'true' %]
307
[% IF modules.taxonomic == 'true' %]
308 308
    [% numTaxa = 0 %]
309 309
    [% IF taxaCount > 0 %]
310 310
        [% numTaxa = taxaCount %]
......
322 322
     <p><span class="label">Taxonomic Reference:</span>  [% taxaAuth %]</p>
323 323
[% END %]
324 324

  
325
[% IF hasMethod == 'true' %]
325
[% IF modules.method == 'true' %]
326 326
    <hr>
327 327
    <a name="Methods"></a>
328 328
    <p><span class="sectionnames">DATA COLLECTION METHODS</span></p>
......
334 334
    <p><span class="label">Sampling Description:</span> [%samplingDescription%]</p>
335 335
[% END %]
336 336

  
337
[% IF hasUpload == 'true' && upCount %]
337
[% IF modules.upload == 'true' && upCount %]
338 338
   <hr>
339 339
	 <a name="Upload Data"></a>
340 340
	  <p><span class="sectionnames">UPLOAD DATA</span></p>
......
416 416
  <input type="hidden" name="cfg" value="[% cfg %]">
417 417
  <input type="hidden" name="docid" value="[% docid %]">
418 418
  <input type="hidden" name="stage" value="confirmed">
419
  <input type="hidden" name="showSiteList" value="[% showSiteList %]">
420
  <input type="hidden" name="showWgList" value="[% showWgList %]">
421
  <input type="hidden" name="showOrganization" value="[% showOrganization %]">
422
  <input type="hidden" name="lsite" value="[% config.site %]">
423
  <input type="hidden" name="hasKeyword" value="[% hasKeyword %]">
424
  <input type="hidden" name="hasSpatial" value="[% hasSpatial %]">
425
  <input type="hidden" name="hasTemporal" value="[% hasTemporal %]">
426
  <input type="hidden" name="hasTaxonomic" value="[% hasTaxonomic %]">
427
  <input type="hidden" name="hasMethod" value="[% hasMethod %]">
428
  <input type="hidden" name="hasUpload" value="[% hasUpload %]">
429
  <input type="hidden" name="temporalRequired" value="[% temporalRequired %]">
430
  <input type="hidden" name="spatialRequired" value="[% spatialRequired %]">
431
  <input type="hidden" name="contactEmailAddressRequired" value="[% contactEmailAddressRequired %]">
432 419
  <input type="hidden" name="providerGivenName" value="[%providerGivenName%]">
433 420
  <input type="hidden" name="providerSurName" value="[%providerSurName%]">
434 421
  <input type="hidden" name="site" value="[%site%]">
lib/style/common/templates/genericResponse.tmpl
9 9
            <tr><td align="left"><span class="regtext">Your data set description has been [% function  %].  Thank you.</span></td></tr>
10 10
        [%ELSE%]
11 11
	    <tr><td align="left"><span class="regtext">Your data set description has been [% function  %].  Thank you.</span></td></tr>
12
            <tr><td align="left"><span class="regtext">You can see the data set description by clicking 
13
	    <a href="[% metacatUrl %]?action=read&qformat=[% cfg %]&docid=[% docid %]">here</a>.</span></td></tr> 	   
12
            <tr><td align="left"><span class="regtext">View the <a href="[% metacatUrl %]?action=read&qformat=[% cfg %]&docid=[% docid %]">data set description</a>.</span></td></tr> 	   
14 13
        [%END%]
15 14
      </table>
16 15
    [% ELSE %]
......
48 47
            <tr><td align="left"><span class="regtext">Click <a href = "javascript:history.back()">here</a> to return
49 48
            to the previous page, and enter the correct username, organization, and password.</td></tr> 
50 49
            [%ELSE%]
51
                <tr><td align="left"><span class="regtext">To register a new data set, click <a href="[% cgiPrefix %]/register-dataset.cgi?cfg=[%cfg%]" target="_top">here</a>.
50
                <tr><td align="left"><span class="regtext">Or, <a href="[% cgiPrefix %]/register-dataset.cgi?cfg=[%cfg%]" target="_top">register a new data set</a>.
52 51
		Otherwise, use the toolbar links above to navigate.</span></td></tr>
53 52
            [%END%]
54 53
            </table>
55 54
        [% ELSE %]
56 55
            [% IF status == 'success' %]
57 56
                <table class="intro" cellpadding="8" cellspacing="0">
58
                    <tr><td align="left"><span class="regtext">To register a new data set, click <a href="[% cgiPrefix %]/register-dataset.cgi?cfg=[%cfg%]" target="_top">here</a>.
57
                    <tr><td align="left"><span class="regtext">Or, <a href="[% cgiPrefix %]/register-dataset.cgi?cfg=[%cfg%]" target="_top">register a new data set</a>.
59 58
                    Otherwise, use the toolbar links above to navigate.</span></td></tr>
60 59
                </table>
61 60
            [% ELSE %]
......
65 64
                        <input type="hidden" name="docid" value="[% docid %]">
66 65
                        <input type="hidden" name="stage" value="confirmed">
67 66
                        <input type="hidden" name="dataWrong" value="No, go back to editing">
68
                        <input type="hidden" name="showSiteList" value="[% showSiteList %]">
69
                        <input type="hidden" name="showWgList" value="[% showWgList %]">
70
                        <input type="hidden" name="showOrganization" value="[% showOrganization %]">
71
                        <input type="hidden" name="lsite" value="[% lsite %]">
72
                        <input type="hidden" name="usite" value="[% usite %]">
73
                        <input type="hidden" name="hasKeyword" value="[% hasKeyword %]">
74
                        <input type="hidden" name="hasTemporal" value="[% hasTemporal %]">
75
                        <input type="hidden" name="hasSpatial" value="[% hasSpatial %]">
76
                        <input type="hidden" name="hasTaxonomic" value="[% hasTaxonomic %]">
77
                        <input type="hidden" name="hasMethod" value="[% hasMethod %]">
78
                        <input type="hidden" name="hasUpload" value="[% hasUpload %]">
79
                        <input type="hidden" name="temporalRequired" value="[% temporalRequired %]">
80
                        <input type="hidden" name="spatialRequired" value="[% spatialRequired %]">
81
                        <input type="hidden" name="contactEmailAddressRequired" value="[% contactEmailAddressRequired %]">
82 67
                        <input type="hidden" name="providerGivenName" value="[%providerGivenName%]">
83 68
                        <input type="hidden" name="providerSurName" value="[%providerSurName%]">
84 69
                        <input type="hidden" name="site" value="[%site%]">
src/perl/register-dataset.cgi
43 43
use File::Basename;
44 44
use strict;
45 45

  
46
debug("at top...");
46 47
# Global configuration paramters
47 48
my $cgiUrl = $ENV{'SCRIPT_FILENAME'};
48 49
my $workingDirectory = ".";
......
75 76
my $styleSkinsPath = $contextUrl . "/style/skins";
76 77
my $styleCommonPath = $contextUrl . "/style/common";
77 78

  
79
# XXX remove me
80
#print "Content-type: text/html\n\n";
81
#print "skins: $skinsDir, templates: $templatesDir, tempDir: $tempDir, url: $contextUrl";
82
#exit;
78 83
my $now = time;
79 84

  
80 85
# Import all of the HTML form fields as variables
......
123 128

  
124 129
# replacements for appconfig values using properties
125 130
my $moderators = $properties->getProperty('ldap.moderators'); # scw TODO: check if this changes to per-skin
126
my $config = $properties->splitToTree(qr/\./, 'registry.config');
127
my $templates = $properties->splitToTree(qr/\./, 'registry.templates');
128
my $modules = $properties->splitToTree(qr/\./, 'registry.modules');
129
my $required = $properties->splitToTree(qr/\./, 'registry.required');
130
my $spatial = $properties->splitToTree(qr/\./, 'registry.spatial');
131
my $config = $skinProperties->splitToTree(qr/\./, 'registry.config');
132
my $templates = $skinProperties->splitToTree(qr/\./, 'registry.templates');
133
my $modules = $skinProperties->splitToTree(qr/\./, 'registry.modules');
134
my $required = $skinProperties->splitToTree(qr/\./, 'registry.required');
135
my $spatial = $skinProperties->splitToTree(qr/\./, 'registry.spatial');
136
my $show = $skinProperties->splitToTree(qr/\./, 'registry.show');
131 137

  
132 138
# set stderr printing if configured
133 139
my $debug_enabled = $config->{'debug'};
......
138 144
my $username = $config->{'username'};
139 145
my $password = $config->{'password'};
140 146

  
141
# TODO SCW replace these with the proper array versions once the templates work correctly
142
my $showWgList = $required->{'wgList'};
143
my $showOrganization = $required->{'organization'};
144
my $hasKeyword = $required->{'keyword'};
145
my $hasTemporal = $required->{'temporal'};
146
my $hasSpatial = $required->{'spatial'};
147
my $hasTaxonomic = $required->{'taxonomic'};
148
my $hasMethod = $required->{'method'};
149
my $hasUpload = $required->{'upload'};
150

  
151 147
# contains sender, recipient, admin, mailhost
152 148
my $email = $skinProperties->splitToTree(qr/\./, 'email');
153 149

  
154
# set stderr printing if configured
155
my $debug_enabled = $config->{'debug'};
156
if ($FORM::debug) {
157
    $debug_enabled = $FORM::debug;
158
}
159

  
160 150
#Convert the lat and lon configs into usable data structures
161 151
my @sitelist;
162 152
my %siteLatDMS;
......
169 159
    $siteLatDMS{$name} = [ $latd, $latm, $lats, $latdir ];
170 160
    $siteLongDMS{$name} = [ $lond, $lonm, $lons, $londir ];
171 161
}
172
debug("template: $templatesDir\n");
162

  
173 163
# set some configuration options for the template object
174 164
my $ttConfig = {
175 165
             INCLUDE_PATH => $templatesDir,
176 166
             INTERPOLATE  => 0,                    
177 167
             POST_CHOMP   => 1,
178
             #DEBUG        => 'all',
168
             DEBUG        => 1,
179 169
             };
180 170

  
181 171
# create an instance of the template processor
182 172
my $template = Template->new($ttConfig) || die $Template::ERROR, "\n";
183

  
173
#print "Content-type: text/html\n\n";
174
#print "Is debug enabled? `$debug_enabled`";
175
#use Data::Dumper;
176
#print Dumper($config);
177
#exit;
184 178
# Set up the template information that is common to all forms
185 179

  
186 180
# GENERATE ME:
......
325 319
        	$$templateVars{'projects'} = $projects;
326 320
        	$$templateVars{'wg'} = \@FORM::wg;
327 321
    	}
328

  
329
        #$$templateVars{'required'} = $required; 
322
        
323
        $$templateVars{'modules'} = $modules;
324
        $$templateVars{'required'} = $required;
330 325
        $$templateVars{'templates'} = $templates;
331
        $$templateVars{'showSiteList'} = $required->{'siteList'};
326
        $$templateVars{'show'} = $show;
332 327
        $$templateVars{'site'} = $config->{'site'};
333
        $$templateVars{'showWgList'} = $showWgList;
334
        $$templateVars{'showOrganization'} = $showOrganization;
335
        $$templateVars{'hasKeyword'} = $hasKeyword;
336
        $$templateVars{'hasTemporal'} = $hasTemporal;
337
        $$templateVars{'hasSpatial'} = $hasSpatial;
338
        $$templateVars{'hasTaxonomic'} = $hasTaxonomic;
339
        $$templateVars{'hasMethod'} = $hasMethod;
340
        $$templateVars{'hasUpload'} = $hasUpload;
341
        $$templateVars{'temporalRequired'} = $required->{'temporalRequired'};
342
        $$templateVars{'spatialRequired'} = $required->{'spatialRequired'};
343
        $$templateVars{'contactEmailAddressRequired'} = $required->{'contactEmail'};
344 328

  
345 329
        $$templateVars{'siteList'} = \@sortedSites;
346 330
        $$templateVars{'section'} = "Entry Form";
......
687 671
        unless hasContent($FORM::origNamelast0);
688 672
    push(@invalidParams, "Dataset abstract is missing.")
689 673
        unless hasContent($FORM::abstract);
690
    if($FORM::hasTemporal eq 'true'){
674
    if($modules->{'temporal'} eq 'true'){
691 675
	push(@invalidParams, "Year of start date is missing.")
692
	    unless (hasContent($FORM::beginningYear) || $FORM::temporalRequired ne 'true');
676
	    unless (hasContent($FORM::beginningYear) || $required->{'temporal'} ne 'true');
693 677
	push(@invalidParams, "Year of stop date has been specified but year of start date is missing.")
694 678
	    if ((!hasContent($FORM::beginningYear)) && hasContent($FORM::endingYear));
695 679
    }
696 680
    push(@invalidParams, "Geographic description is missing.")
697
        unless (hasContent($FORM::geogdesc) || $FORM::spatialRequired ne 'true');
681
        unless (hasContent($FORM::geogdesc) || $required->{'spatial'} ne 'true');
698 682

  
699 683
    if($FORM::beginningMonth eq "MM"){
700 684
	#if (hasContent($FORM::beginningYear)){
......
736 720
    # If the "use site" coord. box is checked and if the site is in 
737 721
    # the longitude hash ...  && ($siteLatDMS{$FORM::site})
738 722
    
739
    if($FORM::hasSpatial eq 'true'){
723
    if($modules->{'spatial'} eq 'true'){
740 724
	if (($FORM::useSiteCoord) && ($siteLatDMS{$FORM::site}) ) {
741 725
        
742 726
	    $latDeg1 = $siteLatDMS{$FORM::site}[0];
......
804 788
    # and long mentioned in the config file. 
805 789

  
806 790

  
807
    if($FORM::hasSpatial eq 'true' && $FORM::spatialRequired eq 'true'){
791
    if($modules->{'spatial'} eq 'true' && $required->{'spatial'} eq 'true'){
808 792
	if ($FORM::useSiteCoord ) {
809 793
	    push(@invalidParams, "The Data Registry doesn't have latitude and longitude information for the site that you chose. Please go back and enter the spatial information.")
810 794
		unless(hasContent($latDeg1) && hasContent($longDeg1));
811 795
	}else{
812 796
	    push(@invalidParams, "Latitude degrees are missing.")
813
		unless (hasContent($latDeg1) || $FORM::spatialRequired ne 'true');
797
		unless (hasContent($latDeg1) || $required->{'spatial'} ne 'true');
814 798
	    push(@invalidParams, "Longitude degrees are missing.")
815
		unless (hasContent($longDeg1) || $FORM::spatialRequired ne 'true');
799
		unless (hasContent($longDeg1) || $required->{'spatial'} ne 'true');
816 800
	}
817 801
	push(@invalidParams, 
818 802
	     "You must provide a geographic description if you provide latitude and longitude information.")
819 803
	    if ((hasContent($latDeg1) || (hasContent($longDeg1))) && (!hasContent($FORM::geogdesc)));
820 804
    }
821 805

  
822
    if($FORM::hasMethod eq 'true'){
806
    if($modules->{'method'} eq 'true'){
823 807
	push(@invalidParams, 
824 808
	     "You must provide a method description if you provide a method title.")
825 809
	    if (hasContent($FORM::methodTitle) && ( !(scalar(@FORM::methodPara) > 0) 
......
842 826
    push(@invalidParams, "Last name of data set contact is missing.")
843 827
    unless (hasContent($FORM::origNamelastContact) || 
844 828
        $FORM::useOrigAddress);
845
    if($FORM::contactEmailAddressRequired eq 'true'){
829
    if($required->{'contactEmailAddress'} eq 'true'){
846 830
        if($FORM::useOrigAddress){
847 831
    		push(@invalidParams, "Email address of data set owner is missing. This is required as it will be used as contact email address as specified by you.")
848 832
    			unless (hasContent($FORM::origEmail));
......
1563 1547
            $cont .= "<city>".normalize($FORM::origCityContact)."</city>\n";
1564 1548
        }
1565 1549
        if (hasContent($FORM::origStateContact) &&
1566
            ($FORM::origStateContact !=~ /select state/i)) {
1550
            ($FORM::origStateContact !~ /select state/i)) {
1567 1551
            $cont .= "<administrativeArea>".normalize($FORM::origStateContact);
1568 1552
            $cont .= "</administrativeArea>\n";
1569 1553
        } elsif (hasContent($FORM::origStateOtherContact)) {
......
1718 1702
            $hemisph = ($hemisphLong1 eq "W") ? -1 : 1;
1719 1703
            $cov .= "<westBoundingCoordinate>";
1720 1704
            my $var = $hemisph * ($longDeg1 + (60*$longMin1+$longSec1)/3600);
1721
            $cov .= sprintf("%.4f\n", $var);
1705
            $cov .= sprintf("%.4f", $var);
1722 1706
            $cov .= "</westBoundingCoordinate>\n";
1723 1707

  
1724 1708
            $hemisph = ($hemisphLong2 eq "W") ? -1 : 1;
1725 1709
            $cov .= "<eastBoundingCoordinate>";
1726 1710
            $var = $hemisph * ($longDeg2 + (60*$longMin2+$longSec2)/3600);
1727
            $cov .= sprintf("%.4f\n", $var);
1711
            $cov .= sprintf("%.4f", $var);
1728 1712
            $cov .= "</eastBoundingCoordinate>\n";
1729 1713

  
1730 1714
            $hemisph = ($hemisphLat1 eq "S") ? -1 : 1;
1731 1715
            $cov .= "<northBoundingCoordinate>";
1732 1716
            $var = $hemisph * ($latDeg1 + (60*$latMin1+$latSec1)/3600);
1733
            $cov .= sprintf("%.4f\n", $var);
1717
            $cov .= sprintf("%.4f", $var);
1734 1718
            $cov .= "</northBoundingCoordinate>\n";
1735 1719

  
1736 1720
            $hemisph = ($hemisphLat2 eq "S") ? -1 : 1;
1737 1721
            $cov .= "<southBoundingCoordinate>";
1738 1722
            $var = $hemisph * ($latDeg2 + (60*$latMin2+$latSec2)/3600);
1739
            $cov .= sprintf("%.4f\n", $var);
1723
            $cov .= sprintf("%.4f", $var);
1740 1724
            $cov .= "</southBoundingCoordinate>\n";
1741 1725

  
1742 1726
            $cov .= "</boundingCoordinates>\n";
......
2032 2016
    my $foundDSO;
2033 2017

  
2034 2018
    # set variable values
2019
    $$templateVars{'modules'} = $modules;
2035 2020
    $$templateVars{'required'} = $required;
2036
    $$templateVars{'showSiteList'} = $required->{'siteList'};
2021
    $$templateVars{'show'} = $show;
2037 2022
    $$templateVars{'site'} = $config->{'site'};
2038
    #$$templateVars{'showWgList'} = $showWgList;
2039
    $$templateVars{'showOrganization'} = $showOrganization;
2040
    $$templateVars{'hasKeyword'} = $hasKeyword;
2041
    $$templateVars{'hasTemporal'} = $hasTemporal;
2042
    $$templateVars{'hasSpatial'} = $hasSpatial;
2043
    $$templateVars{'hasTaxonomic'} = $hasTaxonomic;
2044
    $$templateVars{'hasMethod'} = $hasMethod;
2045
    $$templateVars{'spatialRequired'} = $required->{'spatialRequired'};
2046
    $$templateVars{'contactEmailAddressRequired'} = $required->{'contactEmail'};
2047
    $$templateVars{'temporalRequired'} = $required->{'temporal'};
2048 2023

  
2049 2024
    # find out the tag <alternateIdentifier>. 
2050 2025
    $results = $doc->findnodes('//dataset/alternateIdentifier');
......
3633 3608
################################################################################
3634 3609
sub toConfirmData{
3635 3610
    # Check if any invalid parameters
3636
 
3611

  
3637 3612
    my $invalidParams;
3638 3613
    if (! $error) {
3639
    	$invalidParams = validateParameters(0);
3640
    	if (scalar(@$invalidParams)) {
3641
        	$$templateVars{'status'} = 'failure';
3642
        	$$templateVars{'invalidParams'} = $invalidParams;
3643
        	$error = 1;
3644
    	}
3614
        $invalidParams = validateParameters(0);
3615
        if (scalar(@$invalidParams)) {
3616
            $$templateVars{'status'} = 'failure';
3617
            $$templateVars{'invalidParams'} = $invalidParams;
3618
            $error = 1;
3619
        }
3645 3620
    }
3646 3621

  
3647 3622
    $$templateVars{'providerGivenName'} = normalizeCD($FORM::providerGivenName);
......
3724 3699
            $$templateVars{"origNamelast".$aoCount} = normalizeCD($aoLNArray->[$i]);
3725 3700
            $$templateVars{"origRole".$aoCount} = normalizeCD($aoRoleArray->[$i]);
3726 3701
            $aoCount++;
3727
        }    
3702
        }
3728 3703
    }
3729 3704

  
3730 3705
    $$templateVars{'aoCount'} = $aoCount;
3731 3706
    $$templateVars{'abstract'} = normalizeCD($FORM::abstract);
3732
   
3733
   
3707

  
3708

  
3734 3709
    my $keywordArray = \@FORM::keyword;
3735 3710
    my $keywordTypeArray = \@FORM::keywordType;
3736 3711
    my $keywordThArray = \@FORM::keywordTh;
3737 3712
    my $keyCount = 1;
3738
   
3713

  
3739 3714
    for(my $i = 0; $i <= $#$keywordArray; $i++){
3740 3715
        if (hasContent($keywordArray->[$i])) {
3741 3716
            debug("Registry processing keyword: keyword = ".$keywordArray->[$i]."
......
3745 3720
            $$templateVars{"kwType".$keyCount} = normalizeCD($keywordTypeArray->[$i]);
3746 3721
            $$templateVars{"kwTh".$keyCount} = normalizeCD($keywordThArray->[$i]);
3747 3722
            $keyCount++;
3748
	}    
3749
    }    
3723
        }
3724
    }
3750 3725
    $$templateVars{'keyCount'} = $keyCount;
3751
    
3726

  
3752 3727
    $$templateVars{'addComments'} = normalizeCD($FORM::addComments);
3753 3728
    $$templateVars{'useConstraints'} = $FORM::useConstraints;
3754 3729
    if($FORM::useConstraints eq "other"){
......
3795 3770
            $$templateVars{"taxonRankName".$taxonCount} = normalizeCD($taxonRankArray->[$i]);
3796 3771
            $$templateVars{"taxonRankValue".$taxonCount} = normalizeCD($taxonNameArray->[$i]);
3797 3772
            $taxonCount++;
3798
	}    
3773
        }
3799 3774
    }
3800 3775

  
3801 3776
    $$templateVars{'taxaCount'} = $taxonCount-1;
......
3817 3792
            }
3818 3793
        }
3819 3794
    }
3820
    
3795

  
3821 3796
    my $uploadCount = 0;
3822 3797
    for (my $fileNum = 0; $fileNum <= $FORM::fileCount; $fileNum++) {
3823 3798
        my $fn = 'file_' . $fileNum;
......
3832 3807
            $$templateVars{"upload_$totalFileNum"} = $fileInfo->{'fileHash'};
3833 3808
            $$templateVars{"uploadname_$totalFileNum"} = $fileInfo->{'fileName'};
3834 3809
            $$templateVars{"uploadtype_$totalFileNum"} = $fileInfo->{'contentType'};
3810
            $$templateVars{"uploadperm_$totalFileNum"} = param("uploadperm_$fileNum");
3835 3811
            $uploadCount++;
3836 3812
        }
3837 3813
    }
3838 3814
    # total uploads are: new uploads - deleted files + original uploads
3839 3815
    $$templateVars{'upCount'} = $uploadCount - $deleteCount + $FORM::upCount;
3840 3816
    $$templateVars{'methodTitle'} = normalizeCD($FORM::methodTitle);
3841
 
3817

  
3842 3818
    my @tempMethodPara;
3843 3819
    for (my $i = 0; $i < scalar(@FORM::methodPara); $i++) {
3844 3820
        $tempMethodPara[$i] = normalizeCD($FORM::methodPara[$i]);
......
3848 3824
    $$templateVars{'samplingDescription'} = normalizeCD($FORM::samplingDescription);
3849 3825
    $$templateVars{'origStateContact'} = $FORM::origState;
3850 3826

  
3851
    $$templateVars{'showSiteList'} = $FORM::showSiteList;
3827
    $$templateVars{'modules'} = $modules;
3828
    $$templateVars{'required'} = $required;
3829
    $$templateVars{'show'} = $show;
3852 3830
    $$templateVars{'site'} = $FORM::site;
3853
    $$templateVars{'showWgList'} = $FORM::showWgList;
3854
    $$templateVars{'showOrganization'} = $FORM::showOrganization;
3855
    $$templateVars{'hasKeyword'} = $FORM::hasKeyword;
3856
    $$templateVars{'hasTemporal'} = $FORM::hasTemporal;
3857
    $$templateVars{'hasSpatial'} = $FORM::hasSpatial;
3858
    $$templateVars{'hasTaxonomic'} = $FORM::hasTaxonomic;
3859
    $$templateVars{'hasMethod'} = $FORM::hasMethod;
3860
    $$templateVars{'hasUpload'} = $FORM::hasUpload;
3861
    $$templateVars{'spatialRequired'} = $FORM::spatialRequired;
3862
    $$templateVars{'contactEmailAddressRequired'} = $FORM::contactEmailAddressRequired;
3863
    $$templateVars{'temporalRequired'} = $FORM::temporalRequired;
3864 3831

  
3865 3832
    $$templateVars{'docid'} = $FORM::docid;
3866 3833

  
3867 3834
    # Check if the session exists
3868 3835
    my $session = CGI::Session->load();
3869 3836
    if ( !($session->is_empty || $session->is_expired)) {
3870
    	$$templateVars{'userLoggedIn'} = 'true';
3837
        $$templateVars{'userLoggedIn'} = 'true';
3871 3838
    }
3872 3839

  
3873 3840
    if (! $error) {
3874
	# If no errors, then print out data in confirm Data template
3875
	$$templateVars{'section'} = "Confirm Data";
3876
	$template->process( $templates->{'confirmData'}, $templateVars);
3841
        # If no errors, then print out data in confirm Data template
3842
        $$templateVars{'section'} = "Confirm Data";
3843
        $template->process( $templates->{'confirmData'}, $templateVars);
3877 3844

  
3878 3845
    } else{    
3879 3846
    # Errors from validation function. print the errors out using the response template
......
4049 4016
    $$templateVars{'methodPara'} = \@FORM::methodPara;
4050 4017
    $$templateVars{'studyExtentDescription'} = $FORM::studyExtentDescription;
4051 4018
    $$templateVars{'samplingDescription'} = $FORM::samplingDescription;
4052
    
4053
    $$templateVars{'showSiteList'} = $FORM::showSiteList;
4019
 
4020
    $$templateVars{'modules'} = $modules; 
4021
    $$templateVars{'required'} = $required;
4022
    $$templateVars{'show'} = $show; 
4054 4023
    $$templateVars{'site'} = $FORM::site;
4055
    $$templateVars{'showWgList'} = $FORM::showWgList;
4056
    $$templateVars{'showOrganization'} = $FORM::showOrganization;
4057
    $$templateVars{'hasKeyword'} = $FORM::hasKeyword;
4058
    $$templateVars{'hasTemporal'} = $FORM::hasTemporal;
4059
    $$templateVars{'hasSpatial'} = $FORM::hasSpatial;
4060
    $$templateVars{'hasTaxonomic'} = $FORM::hasTaxonomic;
4061
    $$templateVars{'hasMethod'} = $FORM::hasMethod;
4062
    $$templateVars{'hasUpload'} = $FORM::hasUpload;
4063 4024
    $$templateVars{'fileCount'} = $FORM::fileCount;
4064

  
4025
  
4065 4026
    my $uploadCount = 0;
4066 4027
    foreach my $upload (param()) {
4067 4028
        if ($upload =~ /upload_/) {
......
4081 4042
    }
4082 4043

  
4083 4044
    $$templateVars{'upCount'} = $uploadCount;
4084
    $$templateVars{'spatialRequired'} = $FORM::spatialRequired;
4085
    $$templateVars{'contactEmailAddressRequired'} = $FORM::contactEmailAddressRequired;
4086
    $$templateVars{'temporalRequired'} = $FORM::temporalRequired;
4087 4045
}
4088 4046

  
4089 4047
################################################################################

Also available in: Unified diff