Project

General

Profile

« Previous | Next » 

Revision 2027

Added by sgarg about 19 years ago

Bug 1301 - changes made for a repeatable add keyword button.

View differences:

entryForm.tmpl
46 46

  
47 47
        return newField;
48 48
    }
49

  
50
    function addKeyword() {
51
        var keyCountField = document.getElementById("keyCount");
52
        var keyCount = keyCountField.getAttribute("value");
53
        keyCount++;
54
        keyCountField.setAttribute("value", keyCount);
55
        var keyRow = createKeywordRow(keyCount);
56
        var keyRowMarker = document.getElementById("addkeyrow");
57
        var parent = keyRowMarker.parentNode;
58
        parent.insertBefore(keyRow, keyRowMarker);
59
    }
60

  
61
    function createKeywordRow(keyCount) {
62
        var nameField=createTextField("keyword" + keyCount, "40");
63
        var nameCell = document.createElement("td");
64
        nameCell.appendChild(nameField);
65

  
66
        var keyTypeField=createKeyTypeSelect("kwType" + keyCount);
67
        var keyTypeCell = document.createElement("td");
68
        keyTypeCell.appendChild(keyTypeField);
69

  
70
        var keyThField=createKeyThSelect("kwTh" + keyCount);
71
        var keyThCell = document.createElement("td");
72
        keyThCell.appendChild(keyThField); 
73

  
74
        var keyRow = document.createElement("tr");
75
        keyRow.appendChild(nameCell);
76
        keyRow.appendChild(keyTypeCell);
77
        keyRow.appendChild(keyThCell);
78

  
79
        return keyRow;
80
    }
81

  
82
    function createKeyTypeSelect(name) {
83
        var newField=document.createElement("select");
84
        newField.setAttribute("name", name);
85
	var option1=document.createElement("option");
86
	var text1=document.createTextNode("none");
87
	option1.appendChild(text1);
88
	newField.appendChild(option1);
89
	var option2=document.createElement("option");
90
	var text2=document.createTextNode("theme");
91
	option1.appendChild(text2);
92
	newField.appendChild(option2);
93
	var option3=document.createElement("option");
94
	var text3=document.createTextNode("place");
95
	option1.appendChild(text3);
96
	newField.appendChild(option3)
97
	var option4=document.createElement("option");
98
	var text4=document.createTextNode("stratum");
99
	option1.appendChild(text4);
100
	newField.appendChild(option4);
101
	var option5=document.createElement("option");
102
	var text5=document.createTextNode("temporal");
103
	option1.appendChild(text5);
104
	newField.appendChild(option5);
105
	var option6=document.createElement("option");
106
	var text6=document.createTextNode("taxonomic");
107
	option1.appendChild(text6);
108
	newField.appendChild(option6);
109

  
110
	return newField;
111
    }
112

  
113
    function createKeyThSelect(name) {
114
        var newField=document.createElement("select");
115
        newField.setAttribute("name", name);
116
	var option1=document.createElement("option");
117
	var text1=document.createTextNode("none");
118
	option1.appendChild(text1);
119
	newField.appendChild(option1);
120
	var option2=document.createElement("option");
121
	var text2=document.createTextNode("GCMD");
122
	option2.appendChild(text2);
123
	newField.appendChild(option2);
124

  
125
	return newField;
126
    }
127

  
128

  
49 129
  </script>
50 130

  
51 131
[% IF cfg == 'nrs' %]
......
580 660
    </b>(for example keywords, have a look at the keyword thesaurus for the <a href=
581 661
"http://gcmd.nasa.gov/Resources/valids/gcmd_parameters.html" target="nasa"><font color=
582 662
"008000">NASA Global Change Master Directory (GCMD))</font></a></font></p>
663
 [% numKey = 1 %]
664
 [% IF keyCount > 0 %]
665
   [% numKey = keyCount %]
666
 [% END %]
667
 <input type="hidden" name="keyCount" value="[%numKey%]" 
668
            id="keyCount">
583 669
  <table cellspacing="0" border="0" cellpadding="9" width="760"
670
bgcolor="#c6d6e7"> 
671
 <table cellspacing="0" border="0" cellpadding="9" width="760"
584 672
bgcolor="#c6d6e7">
585 673
    <tr> 
586 674
      <td width="34%" valign="TOP"> 
......
593 681
        <p><font size="-1"><b>Keyword Thesaurus</b></font></p>
594 682
      </td>
595 683
    </tr>
596
    <tr> 
597
      <td width="34%" valign="TOP"> 
598
        <p><font size="-1"> 
599
          <input type="TEXT" name="keyword0" value="[%keyword0%]" size="40">
600
          </font></p>
601
      </td>
602
      <td width="18%" valign="TOP"> 
603
        <p> <font size="-1">
604
          <select name="kwType0">
684
        [% cnt = 1 %]
685
        [% WHILE cnt <= numKey %]
686
            <tr> 
687
            <td>
688
            [% SET key = "keyword${cnt}" %]
689
            <input name="keyword[%cnt%]" value="[%$key%]" size="40">
690
            </td>
691

  
692
            <td>
693
            [% SET keyT = "kwType${cnt}" %]
694
            <select name="kwType[%cnt%]">
605 695
	    [% IF form == 're_entry' %]
606
	     	<option selected>[%kwType0%]</option>
696
	     	<option selected>[%$keyT%]</option>
607 697
	    [% END %]
608 698
	    <option>none</option>
609 699
            <option>theme</option>
......
611 701
            <option>stratum</option>
612 702
            <option>temporal</option>
613 703
            <option>taxonomic</option>
614
          </select>
615
          </font></p>
616
      </td>
617
      <td width="48%" valign="TOP"> 
618
        <p> <font size="-1">
619
          <select name="kwTh0">
704
            </select>
705
            </td>
706

  
707
            <td>
708
            [% SET keyTh = "kwTh${cnt}" %]
709
            <select name="kwTh[%cnt%]">
620 710
	    [% IF form == 're_entry' %]
621
	     	<option selected>[%kwTh0%]</option>
711
	     	<option selected>[%$keyTh%]</option>
622 712
	    [% END %]
623 713
	    <option>none</option>
624 714
            <option>GCMD</option>
625
          </select>
626
          </font></p>
627
      </td>
628
    </tr>
629
    <tr> 
630
      <td width="34%" valign="TOP"> 
631
        <p><font size="-1"> 
632
          <input type="TEXT" name="keyword1" value="[%keyword1%]" size="40">
633
          </font></p>
634
      </td>
635
      <td width="18%" valign="TOP"> 
636
        <p> <font size="-1">
637
          <select name="kwType1">
638
	    [% IF form == 're_entry' %]
639
	     	<option selected>[%kwType1%]</option>
640
	    [% END %]
641
	    <option>none</option>
642
            <option>theme</option>
643
            <option>place</option>
644
            <option>stratum</option>
645
            <option>temporal</option>
646
            <option>taxonomic</option>
647
          </select>
648
          </font></p>
649
      </td>
650
      <td width="48%" valign="TOP"> 
651
        <p> <font size="-1">
652
          <select name="kwTh1">
653
	    [% IF form == 're_entry' %]
654
	     	<option selected>[%kwTh1%]</option>
655
	    [% END %]
656
	    <option>none</option>
657
            <option>GCMD</option>
658
          </select>
659
          </font></p>
660
      </td>
661
    </tr>
662
    <tr> 
663
      <td width="34%" valign="TOP"> 
664
        <p><font size="-1"> 
665
          <input type="TEXT" name="keyword2" value="[%keyword2%]" size="40">
666
          </font></p>
667
      </td>
668
      <td width="18%" valign="TOP"> 
669
        <p> <font size="-1">
670
          <select name="kwType2">
671
	    [% IF form == 're_entry' %]
672
	     	<option selected>[%kwType2%]</option>
673
	    [% END %]
674
	    <option>none</option>
675
            <option>theme</option>
676
            <option>place</option>
677
            <option>stratum</option>
678
            <option>temporal</option>
679
            <option>taxonomic</option>
680
          </select>
681
          </font></p>
682
      </td>
683
      <td width="48%" valign="TOP"> 
684
        <p> <font size="-1">
685
          <select name="kwTh2">
686
	    [% IF form == 're_entry' %]
687
	     	<option selected>[%kwTh2%]</option>
688
	    [% END %]
689
	    <option>none</option>
690
            <option>GCMD</option>
691
          </select>
692
          </font></p>
693
      </td>
694
    </tr>
695
    <tr> 
696
      <td width="34%" valign="TOP"> 
697
        <p><font size="-1"> 
698
          <input type="TEXT" name="keyword3" value="[%keyword3%]" size="40">
699
          </font></p>
700
      </td>
701
      <td width="18%" valign="TOP"> 
702
        <p> <font size="-1">
703
          <select name="kwType3">
704
	    [% IF form == 're_entry' %]
705
	     	<option selected>[%kwType3%]</option>
706
	    [% END %]
707
	    <option>none</option>
708
            <option>theme</option>
709
            <option>place</option>
710
            <option>stratum</option>
711
            <option>temporal</option>
712
            <option>taxonomic</option>
713
          </select>
714
          </font></p>
715
      </td>
716
      <td width="48%" valign="TOP"> 
717
        <p> <font size="-1">
718
          <select name="kwTh3">
719
	    [% IF form == 're_entry' %]
720
	     	<option selected>[%kwTh3%]</option>
721
	    [% END %]
722
	    <option>none</option>
723
            <option>GCMD</option>
724
          </select>
725
          </font></p>
726
      </td>
727
    </tr>
728
    <tr> 
729
      <td width="34%" valign="TOP"> 
730
        <p><font size="-1"> 
731
          <input type="TEXT" name="keyword4" value="[%keyword4%]" size="40">
732
          </font></p>
733
      </td>
734
      <td width="18%" valign="TOP"> 
735
        <p> <font size="-1">
736
          <select name="kwType4">
737
	    [% IF form == 're_entry' %]
738
	     	<option selected>[%kwType4%]</option>
739
	    [% END %]
740
	    <option>none</option>
741
            <option>theme</option>
742
            <option>place</option>
743
            <option>stratum</option>
744
            <option>temporal</option>
745
            <option>taxonomic</option>
746
          </select>
747
          </font></p>
748
      </td>
749
      <td width="48%" valign="TOP"> 
750
        <p> <font size="-1">
751
          <select name="kwTh4">
752
	    [% IF form == 're_entry' %]
753
	     	<option selected>[%kwTh4%]</option>
754
	    [% END %]
755
	    <option>none</option>
756
            <option>GCMD</option>
757
          </select>
758
          </font></p>
759
      </td>
760
    </tr>
761
    <tr> 
762
      <td width="34%" valign="TOP"> 
763
        <p><font size="-1"> 
764
          <input type="TEXT" name="keyword5" value="[%keyword5%]" size="40">
765
          </font></p>
766
      </td>
767
      <td width="18%" valign="TOP"> 
768
        <p> <font size="-1">
769
          <select name="kwType5">
770
	    [% IF form == 're_entry' %]
771
	     	<option selected>[%kwType5%]</option>
772
	    [% END %]
773
	    <option>none</option>
774
            <option>theme</option>
775
            <option>place</option>
776
            <option>stratum</option>
777
            <option>temporal</option>
778
            <option>taxonomic</option>
779
          </select>
780
          </font></p>
781
      </td>
782
      <td width="48%" valign="TOP"> 
783
        <p> <font size="-1">
784
          <select name="kwTh5">
785
	    [% IF form == 're_entry' %]
786
	     	<option selected>[%kwTh5%]</option>
787
	    [% END %]
788
 	    <option>none</option>
789
            <option>GCMD</option>
790
          </select>
791
          </font></p>
792
      </td>
793
    </tr>
794
    <tr> 
795
      <td width="34%" valign="TOP"> 
796
        <p><font size="-1"> 
797
          <input type="TEXT" name="keyword6" value="[%keyword6%]" size="40">
798
          </font></p>
799
      </td>
800
      <td width="18%" valign="TOP"> 
801
        <p> <font size="-1">
802
          <select name="kwType6">
803
	    [% IF form == 're_entry' %]
804
	     	<option selected>[%kwType6%]</option>
805
	    [% END %]
806
	    <option>none</option>
807
            <option>theme</option>
808
            <option>place</option>
809
            <option>stratum</option>
810
            <option>temporal</option>
811
            <option>taxonomic</option>
812
          </select>
813
          </font></p>
814
      </td>
815
      <td width="48%" valign="TOP"> 
816
        <p> <font size="-1">
817
          <select name="kwTh6">
818
	    [% IF form == 're_entry' %]
819
	     	<option selected>[%kwTh6%]</option>
820
	    [% END %]
821
            <option>none</option>	
822
            <option>GCMD</option>
823
          </select>
824
          </font></p>
825
      </td>
826
    </tr>
827
    <tr> 
828
      <td width="34%" valign="TOP"> 
829
        <p><font size="-1"> 
830
          <input type="TEXT" name="keyword7" value="[%keyword7%]" size="40">
831
          </font></p>
832
      </td>
833
      <td width="18%" valign="TOP"> 
834
        <p> <font size="-1">
835
          <select name="kwType7">
836
	    [% IF form == 're_entry' %]
837
	     	<option selected>[%kwType7%]</option>
838
	    [% END %]
839
	    <option>none</option>
840
            <option>theme</option>
841
            <option>place</option>
842
            <option>stratum</option>
843
            <option>temporal</option>
844
            <option>taxonomic</option>
845
          </select>
846
          </font></p>
847
      </td>
848
      <td width="48%" valign="TOP"> 
849
        <p> <font size="-1">
850
          <select name="kwTh7">
851
	    [% IF form == 're_entry' %]
852
	     	<option selected>[%kwTh7%]</option>
853
	    [% END %]
854
            <option>none</option>
855
            <option>GCMD</option>
856
          </select>
857
          </font></p>
858
      </td>
859
    </tr>
860
    <tr> 
861
      <td width="34%" valign="TOP"> 
862
        <p><font size="-1"> 
863
          <input type="TEXT" name="keyword8" value="[%keyword8%]" size="40">
864
          </font></p>
865
      </td>
866
      <td width="18%" valign="TOP"> 
867
        <p> <font size="-1">
868
          <select name="kwType8">
869
	    [% IF form == 're_entry' %]
870
	     	<option selected>[%kwType8%]</option>
871
	    [% END %]
872
	    <option>none</option>
873
            <option>theme</option>
874
            <option>place</option>
875
            <option>stratum</option>
876
            <option>temporal</option>
877
            <option>taxonomic</option>
878
          </select>
879
          </font></p>
880
      </td>
881
      <td width="48%" valign="TOP"> 
882
        <p> <font size="-1">
883
          <select name="kwTh8">
884
	    [% IF form == 're_entry' %]
885
	     	<option selected>[%kwTh8%]</option>
886
	    [% END %]
887
            <option>none</option>
888
            <option>GCMD</option>
889
          </select>
890
          </font></p>
891
      </td>
892
    </tr>
893
    <tr> 
894
      <td width="34%" valign="TOP"> 
895
        <p><font size="-1"> 
896
          <input type="TEXT" name="keyword9" value="[%keyword9%]" size="40">
897
          </font></p>
898
      </td>
899
      <td width="18%" valign="TOP"> 
900
        <p> <font size="-1">
901
          <select name="kwType9">
902
	    [% IF form == 're_entry' %]
903
	     	<option selected>[%kwType9%]</option>
904
	    [% END %]
905
 	    <option>none</option>
906
            <option>theme</option>
907
            <option>place</option>
908
            <option>stratum</option>
909
            <option>temporal</option>
910
            <option>taxonomic</option>
911
          </select>
912
          </font></p>
913
      </td>
914
      <td width="48%" valign="TOP"> 
915
        <p> <font size="-1">
916
          <select name="kwTh9">
917
	    [% IF form == 're_entry' %]
918
	     	<option selected>[%kwTh9%]</option>
919
	    [% END %]    
920
            <option>none</option>
921
            <option>GCMD</option>
922
          </select>
923
          </font></p>
924
      </td>
925
    </tr>
715
            </select>
716
            </td>
717
            </tr>
718
            [% cnt = cnt + 1 %]
719
         [% END %]
720
        <tr id="addkeyrow"> 
721
            <td>
722
                <input type="button" value="Add Keyword" id="addkeybutton1"
723
                    onClick="addKeyword()">
724
            </td>
725
        </tr>
926 726
  </table>
927 727
  <br>
928 728
  <p align="left"><font size="4" color="0000ff"><b><font size="-1">

Also available in: Unified diff