@@ -0,0 +1,124 | |||||
|
1 | $(document).ready(function() { | |||
|
2 | var type = $("#id_exp_type").val(); | |||
|
3 | spectral_number = $("#id_spectral_number") | |||
|
4 | spectral = $("#id_spectral") | |||
|
5 | fftpoints = $("#id_fftpoints") | |||
|
6 | save_ch_dc = $("#id_save_ch_dc") | |||
|
7 | add_spec_button = $("#add_spectral_button") | |||
|
8 | del_spec_button = $("#delete_spectral_button") | |||
|
9 | sel_spec_button = $("#self_spectral_button") | |||
|
10 | cro_spec_button = $("#cross_spectral_button") | |||
|
11 | all_spec_button = $("#all_spectral_button") | |||
|
12 | ||||
|
13 | if (type == 0) { | |||
|
14 | $(spectral_number).attr('readonly', true); | |||
|
15 | $(spectral).attr('readonly', true); | |||
|
16 | $(fftpoints).attr('readonly', true); | |||
|
17 | $(save_ch_dc).attr('disabled', true); | |||
|
18 | $(save_ch_dc).attr('readonly', true); | |||
|
19 | $(add_spec_button).attr('disabled', true); | |||
|
20 | $(del_spec_button).attr('disabled', true); | |||
|
21 | $(sel_spec_button).attr('disabled', true); | |||
|
22 | $(cro_spec_button).attr('disabled', true); | |||
|
23 | $(all_spec_button).attr('disabled', true); | |||
|
24 | } | |||
|
25 | else { | |||
|
26 | $(spectral_number).attr('readonly', false); | |||
|
27 | $(spectral).attr('readonly', false); | |||
|
28 | $(fftpoints).attr('readonly', false); | |||
|
29 | $(save_ch_dc).attr('disabled', false); | |||
|
30 | $(save_ch_dc).attr('readonly', false); | |||
|
31 | $(add_spec_button).attr('disabled', false); | |||
|
32 | $(del_spec_button).attr('disabled', false); | |||
|
33 | $(sel_spec_button).attr('disabled', false); | |||
|
34 | $(cro_spec_button).attr('disabled', false); | |||
|
35 | $(all_spec_button).attr('disabled', false); | |||
|
36 | } | |||
|
37 | }); | |||
|
38 | ||||
|
39 | $("#id_exp_type").change(function() { | |||
|
40 | var type = $("#id_exp_type").val(); | |||
|
41 | spectral_number = $("#id_spectral_number") | |||
|
42 | spectral = $("#id_spectral") | |||
|
43 | fftpoints = $("#id_fftpoints") | |||
|
44 | save_ch_dc = $("#id_save_ch_dc") | |||
|
45 | add_spec_button = $("#add_spectral_button") | |||
|
46 | del_spec_button = $("#delete_spectral_button") | |||
|
47 | sel_spec_button = $("#self_spectral_button") | |||
|
48 | cro_spec_button = $("#cross_spectral_button") | |||
|
49 | all_spec_button = $("#all_spectral_button") | |||
|
50 | ||||
|
51 | if (type == 0) { | |||
|
52 | $(spectral_number).attr('readonly', true); | |||
|
53 | $(spectral).attr('readonly', true); | |||
|
54 | $(fftpoints).attr('readonly', true); | |||
|
55 | $(save_ch_dc).attr('disabled', true); | |||
|
56 | $(save_ch_dc).attr('readonly', true); | |||
|
57 | $(add_spec_button).attr('disabled', true); | |||
|
58 | $(del_spec_button).attr('disabled', true); | |||
|
59 | $(sel_spec_button).attr('disabled', true); | |||
|
60 | $(cro_spec_button).attr('disabled', true); | |||
|
61 | $(all_spec_button).attr('disabled', true); | |||
|
62 | } | |||
|
63 | else { | |||
|
64 | $(spectral_number).attr('readonly', false); | |||
|
65 | $(spectral).attr('readonly', false); | |||
|
66 | $(fftpoints).attr('readonly', false); | |||
|
67 | $(save_ch_dc).attr('disabled', false); | |||
|
68 | $(save_ch_dc).attr('readonly', false); | |||
|
69 | $(add_spec_button).attr('disabled', false); | |||
|
70 | $(del_spec_button).attr('disabled', false); | |||
|
71 | $(sel_spec_button).attr('disabled', false); | |||
|
72 | $(cro_spec_button).attr('disabled', false); | |||
|
73 | $(all_spec_button).attr('disabled', false); | |||
|
74 | } | |||
|
75 | }); | |||
|
76 | ||||
|
77 | ||||
|
78 | $("#id_cards_number").on('change', function() { | |||
|
79 | var cards_number = $("#id_cards_number").val(); | |||
|
80 | channels_number = $("#id_channels_number") | |||
|
81 | $(channels_number).val(cards_number*2) | |||
|
82 | updateChannelsNumber(); | |||
|
83 | }); | |||
|
84 | ||||
|
85 | ||||
|
86 | $("#id_channels_number").on('change', function() { | |||
|
87 | updateChannelsNumber(); | |||
|
88 | }); | |||
|
89 | ||||
|
90 | ||||
|
91 | $("#id_spectral").on('change', function() { | |||
|
92 | updateSpectralNumber(); | |||
|
93 | }); | |||
|
94 | ||||
|
95 | ||||
|
96 | function updateSpectralNumber(){ | |||
|
97 | var spectral_comb = $("#id_spectral").val(); | |||
|
98 | var num = spectral_comb.length; | |||
|
99 | var cont = 0 | |||
|
100 | for (i = 0; i < num; i++) { | |||
|
101 | if (spectral_comb[i] == "]"){ | |||
|
102 | cont = cont + 1 | |||
|
103 | } | |||
|
104 | } | |||
|
105 | $("#id_spectral_number").val(cont) | |||
|
106 | } | |||
|
107 | ||||
|
108 | ||||
|
109 | function updateChannelsNumber() { | |||
|
110 | ||||
|
111 | var channels_number = $("#id_channels_number").val(); | |||
|
112 | channels = $("#id_channels") | |||
|
113 | sequence = "" | |||
|
114 | ||||
|
115 | for (i = 1; i <= channels_number; i++) { | |||
|
116 | if (i==1){ | |||
|
117 | sequence = i.toString() | |||
|
118 | } | |||
|
119 | else{ | |||
|
120 | sequence = sequence + "," + i.toString() | |||
|
121 | } | |||
|
122 | } | |||
|
123 | $(channels).val(sequence) | |||
|
124 | } No newline at end of file |
@@ -16,8 +16,8 class JARSConfigurationForm(forms.ModelForm): | |||||
16 | self.fields['experiment'].widget.choices = [(experiment.id, experiment) for experiment in experiments] |
|
16 | self.fields['experiment'].widget.choices = [(experiment.id, experiment) for experiment in experiments] | |
17 |
|
17 | |||
18 | self.fields['device'].widget.choices = [(device.id, device) for device in devices] |
|
18 | self.fields['device'].widget.choices = [(device.id, device) for device in devices] | |
19 | self.fields['spectral'].widget = SpectralWidget() |
|
19 | #self.fields['spectral'].widget = SpectralWidget() | |
20 |
|
20 | self.fields['spectral'].widget = SpectralWidget() | ||
21 | #-------------JARS Configuration needs an Experiment----------------- |
|
21 | #-------------JARS Configuration needs an Experiment----------------- | |
22 | def clean(self): |
|
22 | def clean(self): | |
23 | cleaned_data = super(JARSConfigurationForm, self).clean() |
|
23 | cleaned_data = super(JARSConfigurationForm, self).clean() |
@@ -4,131 +4,5 | |||||
4 | {% load main_tags %} |
|
4 | {% load main_tags %} | |
5 |
|
5 | |||
6 | {% block extra-js%} |
|
6 | {% block extra-js%} | |
7 | <script type="text/javascript"> |
|
7 | <script src="{% static 'js/jars.js' %}"></script> | |
8 |
|
||||
9 | $(document).ready(function() { |
|
|||
10 | var type = $("#id_exp_type").val(); |
|
|||
11 | spectral_number = $("#id_spectral_number") |
|
|||
12 | spectral = $("#id_spectral") |
|
|||
13 | fftpoints = $("#id_fftpoints") |
|
|||
14 | save_ch_dc = $("#id_save_ch_dc") |
|
|||
15 | add_spec_button = $("#add_spectral_button") |
|
|||
16 | del_spec_button = $("#delete_spectral_button") |
|
|||
17 | sel_spec_button = $("#self_spectral_button") |
|
|||
18 | cro_spec_button = $("#cross_spectral_button") |
|
|||
19 | all_spec_button = $("#all_spectral_button") |
|
|||
20 |
|
||||
21 | if (type == 0) { |
|
|||
22 | $(spectral_number).attr('readonly', true); |
|
|||
23 | $(spectral).attr('readonly', true); |
|
|||
24 | $(fftpoints).attr('readonly', true); |
|
|||
25 | $(save_ch_dc).attr('disabled', true); |
|
|||
26 | $(save_ch_dc).attr('readonly', true); |
|
|||
27 | $(add_spec_button).attr('disabled', true); |
|
|||
28 | $(del_spec_button).attr('disabled', true); |
|
|||
29 | $(sel_spec_button).attr('disabled', true); |
|
|||
30 | $(cro_spec_button).attr('disabled', true); |
|
|||
31 | $(all_spec_button).attr('disabled', true); |
|
|||
32 | } |
|
|||
33 | else { |
|
|||
34 | $(spectral_number).attr('readonly', false); |
|
|||
35 | $(spectral).attr('readonly', false); |
|
|||
36 | $(fftpoints).attr('readonly', false); |
|
|||
37 | $(save_ch_dc).attr('disabled', false); |
|
|||
38 | $(save_ch_dc).attr('readonly', false); |
|
|||
39 | $(add_spec_button).attr('disabled', false); |
|
|||
40 | $(del_spec_button).attr('disabled', false); |
|
|||
41 | $(sel_spec_button).attr('disabled', false); |
|
|||
42 | $(cro_spec_button).attr('disabled', false); |
|
|||
43 | $(all_spec_button).attr('disabled', false); |
|
|||
44 | } |
|
|||
45 | }); |
|
|||
46 |
|
||||
47 | $("#id_exp_type").change(function() { |
|
|||
48 | var type = $("#id_exp_type").val(); |
|
|||
49 | spectral_number = $("#id_spectral_number") |
|
|||
50 | spectral = $("#id_spectral") |
|
|||
51 | fftpoints = $("#id_fftpoints") |
|
|||
52 | save_ch_dc = $("#id_save_ch_dc") |
|
|||
53 | add_spec_button = $("#add_spectral_button") |
|
|||
54 | del_spec_button = $("#delete_spectral_button") |
|
|||
55 | sel_spec_button = $("#self_spectral_button") |
|
|||
56 | cro_spec_button = $("#cross_spectral_button") |
|
|||
57 | all_spec_button = $("#all_spectral_button") |
|
|||
58 |
|
||||
59 | if (type == 0) { |
|
|||
60 | $(spectral_number).attr('readonly', true); |
|
|||
61 | $(spectral).attr('readonly', true); |
|
|||
62 | $(fftpoints).attr('readonly', true); |
|
|||
63 | $(save_ch_dc).attr('disabled', true); |
|
|||
64 | $(save_ch_dc).attr('readonly', true); |
|
|||
65 | $(add_spec_button).attr('disabled', true); |
|
|||
66 | $(del_spec_button).attr('disabled', true); |
|
|||
67 | $(sel_spec_button).attr('disabled', true); |
|
|||
68 | $(cro_spec_button).attr('disabled', true); |
|
|||
69 | $(all_spec_button).attr('disabled', true); |
|
|||
70 | } |
|
|||
71 | else { |
|
|||
72 | $(spectral_number).attr('readonly', false); |
|
|||
73 | $(spectral).attr('readonly', false); |
|
|||
74 | $(fftpoints).attr('readonly', false); |
|
|||
75 | $(save_ch_dc).attr('disabled', false); |
|
|||
76 | $(save_ch_dc).attr('readonly', false); |
|
|||
77 | $(add_spec_button).attr('disabled', false); |
|
|||
78 | $(del_spec_button).attr('disabled', false); |
|
|||
79 | $(sel_spec_button).attr('disabled', false); |
|
|||
80 | $(cro_spec_button).attr('disabled', false); |
|
|||
81 | $(all_spec_button).attr('disabled', false); |
|
|||
82 | } |
|
|||
83 | }); |
|
|||
84 |
|
||||
85 |
|
||||
86 | $("#id_cards_number").on('change', function() { |
|
|||
87 | var cards_number = $("#id_cards_number").val(); |
|
|||
88 | channels_number = $("#id_channels_number") |
|
|||
89 | $(channels_number).val(cards_number*2) |
|
|||
90 | updateChannelsNumber(); |
|
|||
91 | }); |
|
|||
92 |
|
||||
93 |
|
||||
94 | $("#id_channels_number").on('change', function() { |
|
|||
95 | updateChannelsNumber(); |
|
|||
96 | }); |
|
|||
97 |
|
||||
98 |
|
||||
99 | $("#id_spectral").on('change', function() { |
|
|||
100 | updateSpectralNumber(); |
|
|||
101 | }); |
|
|||
102 |
|
||||
103 |
|
||||
104 | function updateSpectralNumber(){ |
|
|||
105 | var spectral_comb = $("#id_spectral").val(); |
|
|||
106 | var num = spectral_comb.length; |
|
|||
107 | var cont = 0 |
|
|||
108 | for (i = 0; i < num; i++) { |
|
|||
109 | if (spectral_comb[i] == "]"){ |
|
|||
110 | cont = cont + 1 |
|
|||
111 | } |
|
|||
112 | } |
|
|||
113 | $("#id_spectral_number").val(cont) |
|
|||
114 | } |
|
|||
115 |
|
||||
116 |
|
||||
117 | function updateChannelsNumber() { |
|
|||
118 |
|
||||
119 | var channels_number = $("#id_channels_number").val(); |
|
|||
120 | channels = $("#id_channels") |
|
|||
121 | sequence = "" |
|
|||
122 |
|
||||
123 | for (i = 1; i <= channels_number; i++) { |
|
|||
124 | if (i==1){ |
|
|||
125 | sequence = i.toString() |
|
|||
126 | } |
|
|||
127 | else{ |
|
|||
128 | sequence = sequence + "," + i.toString() |
|
|||
129 | } |
|
|||
130 | } |
|
|||
131 | $(channels).val(sequence) |
|
|||
132 | } |
|
|||
133 | </script> |
|
|||
134 | {% endblock %} No newline at end of file |
|
8 | {% endblock %} |
@@ -110,4 +110,8 | |||||
110 | <script src="{% static 'js/cr.js' %}"></script> |
|
110 | <script src="{% static 'js/cr.js' %}"></script> | |
111 | {% endif %} |
|
111 | {% endif %} | |
112 |
|
112 | |||
|
113 | {% if device == 'jars' %} | |||
|
114 | <script src="{% static 'js/jars.js' %}"></script> | |||
|
115 | {% endif %} | |||
|
116 | ||||
113 | {% endblock %} No newline at end of file |
|
117 | {% endblock %} |
General Comments 0
You need to be logged in to leave comments.
Login now