##// END OF EJS Templates
- Almacenados los datos del archivo ABS despues de ser importado.
jsalyrosas -
r155:156
parent child
Show More
@@ -0,0 +1,56
1 {% extends "abscontrol/index.html" %}
No newline at end of file
2 {% block title %}ABS CONTROL:::::IMPORT PROFILE{% endblock %}
No newline at end of file
3 {% block scripting %}
No newline at end of file
4 <script src="/static/static/js/profiles.js"></script>
No newline at end of file
5 {% endblock %}
No newline at end of file
6 {% block mnu_profile %}
No newline at end of file
7 <nav class="MnuVertical" id="mnuProfiles">
No newline at end of file
8 <ul>
No newline at end of file
9 <li><a href="/abscontrol/new">New</a></li>
No newline at end of file
10 <li><a href="#" id="lnkSaveImport">Save</a></li>
No newline at end of file
11 <li><a href="/abscontrol/import">Import</a></li>
No newline at end of file
12 <li><a href="#">Export</a></li>
No newline at end of file
13 <li><a href="#">Apply</a></li>
No newline at end of file
14 </ul>
No newline at end of file
15 </nav>
No newline at end of file
16 {% endblock %}
No newline at end of file
17 {% block maincolumn %}
No newline at end of file
18 <div id="maincolumn">
No newline at end of file
19 <div id="divPattern">
No newline at end of file
20 <div class="divUes">
No newline at end of file
21 <label for="lblFile">File: {{ txtFilename }}</label>
No newline at end of file
22 </div>
No newline at end of file
23 <form action="/abscontrol/saveImport/" id="frmImportProfile" method="post">
No newline at end of file
24 <div class="divUes">
No newline at end of file
25 <label for="lblExperiment">Experiment: </label>
No newline at end of file
26 <input type="text" name="txtProfile" value="{{ expName }}">
No newline at end of file
27 <br />
No newline at end of file
28 <label for="lblNumber">Number of patterns: {{ num_patterns }}</label>
No newline at end of file
29 <input type="hidden" name="txtNumPatterns" value="{{ num_patterns }}" />
No newline at end of file
30 </div>
No newline at end of file
31 {% if patterns %}
No newline at end of file
32 <div class="divListofPatterns">
No newline at end of file
33 {% for element in patterns %}
No newline at end of file
34 <div class="divPattern">
No newline at end of file
35 <div>
No newline at end of file
36 <label for="lblNumber">Pattern: {{ element.number }}</label>
No newline at end of file
37 <input type="hidden" name="txtNumberPattern{{ element.number }}" value="{{ element.number }}" />
No newline at end of file
38 </div>
No newline at end of file
39 <div class="divAntenna">
No newline at end of file
40 <label for="lblAntennaUp">Antenna Up:</label>
No newline at end of file
41 <textarea name="txtAntennaUp{{ element.number }}" class="txtAntenna" cols="38" rows="8">{{ element.up }}</textarea>
No newline at end of file
42 </div>
No newline at end of file
43 <div class="divAntenna">
No newline at end of file
44 <label for="lblAntennaDown">Antenna Down:</label>
No newline at end of file
45 <textarea name="txtAntennaDown{{ element.number }}" class="txtAntenna" cols="38" rows="8">{{ element.down }}</textarea>
No newline at end of file
46 </div>
No newline at end of file
47 <div class="cleardivs"></div>
No newline at end of file
48 </div>
No newline at end of file
49 <div class="cleardivs"></div>
No newline at end of file
50 {% endfor %}
No newline at end of file
51 </div>
No newline at end of file
52 {% endif %}
No newline at end of file
53 </form>
No newline at end of file
54 </div>
No newline at end of file
55 </div>
No newline at end of file
56 {% endblock %} No newline at end of file
@@ -0,0 +1,45
1 {% extends "abscontrol/index.html" %}
No newline at end of file
2 {% block title %}ABS CONTROL:::::IMPORT PROFILE{% endblock %}
No newline at end of file
3
No newline at end of file
4 {% block mnu_profile %}
No newline at end of file
5 <nav class="MnuVertical" id="mnuProfiles">
No newline at end of file
6 <ul>
No newline at end of file
7 <li><a href="/abscontrol/new">New</a></li>
No newline at end of file
8 <li><a href="#">Save</a></li>
No newline at end of file
9 <li><a href="/abscontrol/import">Import</a></li>
No newline at end of file
10 <li><a href="#">Export</a></li>
No newline at end of file
11 <li><a href="#">Apply</a></li>
No newline at end of file
12 </ul>
No newline at end of file
13 </nav>
No newline at end of file
14 {% endblock %}
No newline at end of file
15 {% block maincolumn %}
No newline at end of file
16 <div id="maincolumn">
No newline at end of file
17 <div id="divPattern">
No newline at end of file
18 <div class="divUes">
No newline at end of file
19 <label for="lblExperiment">Experiment: {{ expName }}</label><br />
No newline at end of file
20 <label for="lblNumber">Number of patterns: {{ num_patterns }}</label>
No newline at end of file
21 </div>
No newline at end of file
22 {% if patterns %}
No newline at end of file
23 <div class="divListofPatterns">
No newline at end of file
24 {% for element in patterns %}
No newline at end of file
25 <div class="divPattern">
No newline at end of file
26 <div>
No newline at end of file
27 <label for="lblNumber">Pattern: {{ element.number }}</label>
No newline at end of file
28 </div>
No newline at end of file
29 <div class="divAntenna">
No newline at end of file
30 <label for="lblAntennaUp">Antenna Up:</label>
No newline at end of file
31 <p>{{ element.up }}</p>
No newline at end of file
32 </div>
No newline at end of file
33 <div class="divAntenna">
No newline at end of file
34 <label for="lblAntennaDown">Antenna Down:</label>
No newline at end of file
35 <p>{{ element.down }}</p>
No newline at end of file
36 </div>
No newline at end of file
37 <div class="cleardivs"></div>
No newline at end of file
38 </div>
No newline at end of file
39 <div class="cleardivs"></div>
No newline at end of file
40 {% endfor %}
No newline at end of file
41 </div>
No newline at end of file
42 {% endif %}
No newline at end of file
43 </div>
No newline at end of file
44 </div>
No newline at end of file
45 {% endblock %} No newline at end of file
@@ -1,20 +1,21
1 1 from django.conf.urls import patterns, url No newline at end of file
2 2 No newline at end of file
3 3 urlpatterns = patterns('abscontrol.views', No newline at end of file
4 4 url(r'^$', 'index'), No newline at end of file
5 5 url(r'^new/$', 'new'), No newline at end of file
6 6 url(r'^save/$', 'save'), No newline at end of file
7 7 url(r'^view/(?P<profile_id>\d+)/$', 'view'), No newline at end of file
8 8 url(r'^edit/(?P<profile_id>\d+)/$', 'edit'), No newline at end of file
9 9 #url(r'^(?P<profile_id>\d+)/$', 'detail'), No newline at end of file
10 10 url(r'^(?P<profile_id>\d+)/add/$', 'addPattern'), No newline at end of file
11 11 url(r'^(?P<profile_id>\d+)/save/$', 'savePattern'), No newline at end of file
12 12 url(r'^(?P<profile_id>\d+)/edit/(?P<pattern_id>\d+)/$', 'editPattern'), No newline at end of file
13 13 url(r'^(?P<profile_id>\d+)/view/(?P<pattern_id>\d+)/$', 'viewPattern'), No newline at end of file
14 14 url(r'^(?P<profile_id>\d+)/delete/(?P<pattern_id>\d+)/$', 'deletePattern'), No newline at end of file
15 15 #url(r'^(?P<poll_id>\d+)/results/$', 'results'), No newline at end of file
16 16 #url(r'^(?P<poll_id>\d+)/vote/$', 'vote'), No newline at end of file
17 17 url(r'^import/$', 'importProfile'), No newline at end of file
18 url(r'^showImport/$', 'showImport'), No newline at end of file
18 19 url(r'^saveImport/$', 'saveImport'), No newline at end of file
19 20 url(r'^(?P<profile_id>\d+)/(?P<pattern_id>\d+)/overjro/(?P<antenna_id>\d+)/$', 'overJRO'), No newline at end of file
20 21 ) No newline at end of file
@@ -1,281 +1,307
1 1 from django.shortcuts import render_to_response, redirect No newline at end of file
2 2 from abscontrol.models import Profile, Pattern, AntennaDown, AntennaUp No newline at end of file
3 3 from util.readABSFile import readABSFile No newline at end of file
4 4 No newline at end of file
5 5 txtAntenna = "[[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ No newline at end of file
6 6 "[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \ No newline at end of file
7 7 "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ No newline at end of file
8 8 "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ No newline at end of file
9 9 "[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \ No newline at end of file
10 10 "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ No newline at end of file
11 11 "[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \ No newline at end of file
12 12 "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]]" No newline at end of file
13 13 No newline at end of file
14 14 txtTxUp = "[[1,1,1,1,1,1,1,1]," \ No newline at end of file
15 15 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
16 16 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
17 17 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
18 18 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
19 19 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
20 20 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
21 21 "[1,1,1,1,1,1,1,1]]" No newline at end of file
22 22 No newline at end of file
23 23 txtTxDown = "[[1,1,1,1,0,0,0,0]," \ No newline at end of file
24 24 "[1,1,1,1,0,0,0,0]," \ No newline at end of file
25 25 "[1,1,1,1,0,0,0,0]," \ No newline at end of file
26 26 "[1,1,1,1,0,0,0,0]," \ No newline at end of file
27 27 "[0,0,0,0,1,1,1,1]," \ No newline at end of file
28 28 "[0,0,0,0,1,1,1,1]," \ No newline at end of file
29 29 "[0,0,0,0,1,1,1,1]," \ No newline at end of file
30 30 "[0,0,0,0,1,1,1,1]]" No newline at end of file
31 31 No newline at end of file
32 32 txtRxUp = "[[0,0,0,0,1,1,1,1]," \ No newline at end of file
33 33 "[0,0,0,0,1,1,1,1]," \ No newline at end of file
34 34 "[0,0,0,0,1,1,1,1]," \ No newline at end of file
35 35 "[0,0,0,0,1,1,1,1]," \ No newline at end of file
36 36 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
37 37 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
38 38 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
39 39 "[1,1,1,1,1,1,1,1]]" No newline at end of file
40 40 No newline at end of file
41 41 txtRxDown = "[[1,1,1,1,1,1,1,1]," \ No newline at end of file
42 42 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
43 43 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
44 44 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
45 45 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
46 46 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
47 47 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
48 48 "[1,1,1,1,1,1,1,1]]" No newline at end of file
49 49 No newline at end of file
50 50 txtUes = "[0.533333,0.00000,1.06667,0.00000]" No newline at end of file
51 51 No newline at end of file
52 52 def index(request): No newline at end of file
53 53 #latest_poll_list = profileAntenna.objects.all().order_by('-pub_date')[:5] No newline at end of file
54 54 profile_list = Profile.objects.all() No newline at end of file
55 55 return render_to_response('abscontrol/index.html', {'profile_list': profile_list}) No newline at end of file
56 56 No newline at end of file
57 57 def new(request): No newline at end of file
58 58 profile_list = Profile.objects.all() No newline at end of file
59 59 No newline at end of file
60 60 return render_to_response('abscontrol/new.html', {'profile_list': profile_list, No newline at end of file
61 61 'txtAntenna' : txtAntenna, No newline at end of file
62 62 'txtUes' : txtUes, 'txtTxUp' : txtTxUp, No newline at end of file
63 63 'txtTxDown' : txtTxDown, 'txtRxUp' : txtRxUp, No newline at end of file
64 64 'txtRxDown' : txtRxDown, No newline at end of file
65 65 }) No newline at end of file
66 66 No newline at end of file
67 67 def save(request): No newline at end of file
68 68 No newline at end of file
69 69 txtProfile = request.POST["txtProfile"] No newline at end of file
70 70 No newline at end of file
71 71 txtAntennaUp = request.POST["txtAntennaUp"] No newline at end of file
72 72 txtTxUp = request.POST["txtTxUp"] No newline at end of file
73 73 txtRxUp = request.POST["txtRxUp"] No newline at end of file
74 74 txtUesUp = request.POST["txtUesUp"] No newline at end of file
75 75 No newline at end of file
76 76 txtAntennaDown = request.POST["txtAntennaDown"] No newline at end of file
77 77 txtTxDown = request.POST["txtTxDown"] No newline at end of file
78 78 txtRxDown = request.POST["txtRxDown"] No newline at end of file
79 79 txtUesDown = request.POST["txtUesDown"] No newline at end of file
80 80 No newline at end of file
81 81 newprofile = Profile(name=txtProfile) No newline at end of file
82 82 newprofile.save() No newline at end of file
83 83 No newline at end of file
84 84 newpattern = newprofile.pattern_set.create(value=1) No newline at end of file
85 85 newpattern.antennaup_set.create(value=txtAntennaUp,tx=txtTxUp,rx=txtRxUp,ues=txtUesUp) No newline at end of file
86 86 newpattern.antennadown_set.create(value=txtAntennaDown,tx=txtTxDown,rx=txtRxDown,ues=txtUesDown) No newline at end of file
87 87 No newline at end of file
88 88 newurl = '/abscontrol/view/%d' % newprofile.id No newline at end of file
89 89 No newline at end of file
90 90 return redirect(newurl) No newline at end of file
91 91 No newline at end of file
92 92 def view(request, profile_id): No newline at end of file
93 93 nextPattern = 0 No newline at end of file
94 94 No newline at end of file
95 95 if request.method == 'GET' and 'pattern' in request.GET: No newline at end of file
96 96 pattern_value = request.GET["pattern"] No newline at end of file
97 97 else: No newline at end of file
98 98 pattern_value = 1 No newline at end of file
99 99 No newline at end of file
100 100 profile_list = Profile.objects.all() No newline at end of file
101 101 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
102 102 No newline at end of file
103 103 lsPatterns = objProfile.pattern_set.all() No newline at end of file
104 104 patternChoosen = objProfile.pattern_set.get(value=pattern_value) No newline at end of file
105 105 objAntennaUp = patternChoosen.antennaup_set.get() No newline at end of file
106 106 objAntennaDown = patternChoosen.antennadown_set.get() No newline at end of file
107 107 No newline at end of file
108 108 if len(lsPatterns) > 1: No newline at end of file
109 109 if pattern_value == 1: No newline at end of file
110 110 nextValuePattern = pattern_value + 1 No newline at end of file
111 111 nextPattern = objProfile.pattern_set.get(value=nextValuePattern) No newline at end of file
112 112 No newline at end of file
113 113 No newline at end of file
114 114 return render_to_response('abscontrol/view.html', {'objProfile': objProfile, 'profile_list': profile_list, No newline at end of file
115 115 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, No newline at end of file
116 116 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, No newline at end of file
117 117 'nextPattern' : nextPattern, No newline at end of file
118 118 }) No newline at end of file
119 119 No newline at end of file
120 120 def edit(request, profile_id): No newline at end of file
121 121 if request.method == 'GET' and 'pattern' in request.GET: No newline at end of file
122 122 pattern_value = request.GET["pattern"] No newline at end of file
123 123 else: No newline at end of file
124 124 pattern_value = 1 No newline at end of file
125 125 No newline at end of file
126 126 profile_list = Profile.objects.all() No newline at end of file
127 127 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
128 128 No newline at end of file
129 129 lsPatterns = objProfile.pattern_set.all() No newline at end of file
130 130 patternChoosen = objProfile.pattern_set.get(value=pattern_value) No newline at end of file
131 131 objAntennaUp = patternChoosen.antennaup_set.get() No newline at end of file
132 132 objAntennaDown = patternChoosen.antennadown_set.get() No newline at end of file
133 133 No newline at end of file
134 134 return render_to_response('abscontrol/edit.html', {'objProfile': objProfile, 'profile_list': profile_list, No newline at end of file
135 135 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, No newline at end of file
136 136 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, No newline at end of file
137 137 }) No newline at end of file
138 138 No newline at end of file
139 139 def addPattern(request, profile_id): No newline at end of file
140 140 profile_list = Profile.objects.all() No newline at end of file
141 141 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
142 142 No newline at end of file
143 143 return render_to_response('abscontrol/addPattern.html', {'objProfile': objProfile, 'profile_list': profile_list, No newline at end of file
144 144 'txtAntenna' : txtAntenna, 'txtUes' : txtUes, No newline at end of file
145 145 'txtTxUp' : txtTxUp, 'txtTxDown' : txtTxDown, No newline at end of file
146 146 'txtRxUp' : txtRxUp, 'txtRxDown' : txtRxDown, No newline at end of file
147 147 }) No newline at end of file
148 148 No newline at end of file
149 149 def editPattern(request, profile_id, pattern_id): No newline at end of file
150 150 profile_list = Profile.objects.all() No newline at end of file
151 151 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
152 152 lsPatterns = objProfile.pattern_set.all() No newline at end of file
153 153 patternChoosen = Pattern.objects.get(pk=pattern_id) No newline at end of file
154 154 objAntennaUp = patternChoosen.antennaup_set.get() No newline at end of file
155 155 objAntennaDown = patternChoosen.antennadown_set.get() No newline at end of file
156 156 No newline at end of file
157 157 return render_to_response('abscontrol/editPattern.html', {'objProfile': objProfile, 'profile_list': profile_list, No newline at end of file
158 158 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, No newline at end of file
159 159 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, No newline at end of file
160 160 }) No newline at end of file
161 161 No newline at end of file
162 162 def savePattern(request, profile_id): No newline at end of file
163 163 pattern_id = 0 No newline at end of file
164 164 method = "save" No newline at end of file
165 165 No newline at end of file
166 166 if 'pattern_id' in request.POST: No newline at end of file
167 167 pattern_id = request.POST["pattern_id"] No newline at end of file
168 168 method = "update" No newline at end of file
169 169 No newline at end of file
170 170 maxValuePattern = 0 No newline at end of file
171 171 txtAntennaUp = request.POST["txtAntennaUp"] No newline at end of file
172 172 txtTxUp = request.POST["txtTxUp"] No newline at end of file
173 173 txtRxUp = request.POST["txtRxUp"] No newline at end of file
174 174 txtUesUp = request.POST["txtUesUp"] No newline at end of file
175 175 No newline at end of file
176 176 txtAntennaDown = request.POST["txtAntennaDown"] No newline at end of file
177 177 txtTxDown = request.POST["txtTxDown"] No newline at end of file
178 178 txtRxDown = request.POST["txtRxDown"] No newline at end of file
179 179 txtUesDown = request.POST["txtUesDown"] No newline at end of file
180 180 No newline at end of file
181 181 if method == "save": No newline at end of file
182 182 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
183 183 lsPatterns = objProfile.pattern_set.all() No newline at end of file
184 184 for element in lsPatterns: No newline at end of file
185 185 if element.value > maxValuePattern: No newline at end of file
186 186 maxPattern = element.value No newline at end of file
187 187 No newline at end of file
188 188 if maxPattern < 10 : No newline at end of file
189 189 newValuePattern = maxPattern + 1 No newline at end of file
190 190 newpattern = objProfile.pattern_set.create(value=newValuePattern) No newline at end of file
191 191 newpattern.antennaup_set.create(value=txtAntennaUp,tx=txtTxUp,rx=txtRxUp,ues=txtUesUp) No newline at end of file
192 192 newpattern.antennadown_set.create(value=txtAntennaDown,tx=txtTxDown,rx=txtRxDown,ues=txtUesDown) No newline at end of file
193 193 No newline at end of file
194 194 newurl = '/abscontrol/%d/view/%d' % (int(profile_id), newpattern.id) No newline at end of file
195 195 else: No newline at end of file
196 196 newurl = '/abscontrol/edit/%d' % (int(profile_id)) No newline at end of file
197 197 else: No newline at end of file
198 198 txtAntennaUpId = request.POST["txtAntennaUpId"] No newline at end of file
199 199 objAntennaUp = AntennaUp.objects.get(pk=txtAntennaUpId) No newline at end of file
200 200 objAntennaUp.value = txtAntennaUp No newline at end of file
201 201 objAntennaUp.tx = txtTxUp No newline at end of file
202 202 objAntennaUp.rx = txtRxUp No newline at end of file
203 203 objAntennaUp.ues = txtUesUp No newline at end of file
204 204 objAntennaUp.save() No newline at end of file
205 205 No newline at end of file
206 206 txtAntennaDownId = request.POST["txtAntennaDownId"] No newline at end of file
207 207 objAntennaDown = AntennaDown.objects.get(pk=txtAntennaDownId) No newline at end of file
208 208 objAntennaDown.value = txtAntennaDown No newline at end of file
209 209 objAntennaDown.tx = txtTxDown No newline at end of file
210 210 objAntennaDown.rx = txtRxDown No newline at end of file
211 211 objAntennaDown.ues = txtUesDown No newline at end of file
212 212 objAntennaDown.save() No newline at end of file
213 213 No newline at end of file
214 214 newurl = '/abscontrol/%d/view/%d' % (int(profile_id), int(pattern_id)) No newline at end of file
215 215 No newline at end of file
216 216 return redirect(newurl) No newline at end of file
217 217 No newline at end of file
218 218 def viewPattern(request, profile_id, pattern_id): No newline at end of file
219 219 No newline at end of file
220 220 profile_list = Profile.objects.all() No newline at end of file
221 221 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
222 222 No newline at end of file
223 223 patternChoosen = Pattern.objects.get(pk=pattern_id) No newline at end of file
224 224 No newline at end of file
225 225 objAntennaUp = patternChoosen.antennaup_set.get() No newline at end of file
226 226 objAntennaDown = patternChoosen.antennadown_set.get() No newline at end of file
227 227 No newline at end of file
228 228 lsPatterns = objProfile.pattern_set.all() No newline at end of file
229 229 No newline at end of file
230 230 return render_to_response('abscontrol/viewPattern.html', {'objProfile': objProfile, 'profile_list': profile_list, No newline at end of file
231 231 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, No newline at end of file
232 232 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, No newline at end of file
233 233 }) No newline at end of file
234 234 No newline at end of file
235 235 def deletePattern(request, profile_id, pattern_id): No newline at end of file
236 236 newurl = '/abscontrol/edit/%d' % int(profile_id) No newline at end of file
237 237 No newline at end of file
238 238 return redirect(newurl) No newline at end of file
239 239 No newline at end of file
240 240 def importProfile(request):
241 No newline at end of file
241
No newline at end of file
242 No newline at end of file
242 return render_to_response('abscontrol/import.html', { })
No newline at end of file
243 No newline at end of file
243
No newline at end of file
244 No newline at end of file
244 def saveImport(request): No newline at end of file
245 245 if request.method == 'POST': No newline at end of file
246 246 txtFilename = request.FILES['txtFile'] No newline at end of file
247 247 if txtFilename: No newline at end of file
248 248 destination = open('/tmp/'+txtFilename.name, 'wb+') No newline at end of file
249 249 for chunk in txtFilename.chunks(): No newline at end of file
250 250 destination.write(chunk) No newline at end of file
251 251 destination.close() No newline at end of file
252 252 filename = '/tmp/'+txtFilename.name No newline at end of file
253 253 readFile = readABSFile(filename) No newline at end of file
254 254 expName, num_patterns, patterns = readFile.getMetadata() No newline at end of file
255 255 else: No newline at end of file
256 256 txtFilename = "Error" No newline at end of file
257 257 #content = "Error" No newline at end of file
258 258 expName = "" No newline at end of file
259 259 num_patterns = 0 No newline at end of file
260 260
261 No newline at end of file
261 return render_to_response('abscontrol/upload.html', {'txtFilename': txtFilename, 'patterns' : patterns, No newline at end of file
262 262 'expName' : expName, 'num_patterns' : num_patterns, No newline at end of file
263 263 }) No newline at end of file
264
No newline at end of file
265 def saveImport(request):
No newline at end of file
266 patterns = []
No newline at end of file
267
No newline at end of file
268 expName = request.POST["txtProfile"]
No newline at end of file
269 num_patterns = int(request.POST["txtNumPatterns"])
No newline at end of file
270
No newline at end of file
271 newprofile = Profile(name=expName)
No newline at end of file
272 newprofile.save()
No newline at end of file
273
No newline at end of file
274 for i in range(0,num_patterns):
No newline at end of file
275 number = request.POST["txtNumberPattern"+str(i+1)]
No newline at end of file
276 txtAntennaUp = request.POST["txtAntennaUp"+str(i+1)]
No newline at end of file
277 txtAntennaDown = request.POST["txtAntennaDown"+str(i+1)]
No newline at end of file
278 dicPattern = {"number" : number, "up" : txtAntennaUp, "down" : txtAntennaDown}
No newline at end of file
279 patterns.append(dicPattern)
No newline at end of file
280 newpattern = newprofile.pattern_set.create(value=number)
No newline at end of file
281 newpattern.antennaup_set.create(value=txtAntennaUp)
No newline at end of file
282 newpattern.antennadown_set.create(value=txtAntennaDown)
No newline at end of file
283
No newline at end of file
284 newurl = '/abscontrol/view/%d' % newprofile.id
No newline at end of file
285
No newline at end of file
286 return redirect(newurl)
No newline at end of file
287 '''
No newline at end of file
288 return render_to_response('abscontrol/upload-view.html', {'expName' : expName, 'patterns' : patterns,
No newline at end of file
289 'num_patterns' : num_patterns,
No newline at end of file
290 })
No newline at end of file
291 ''' No newline at end of file
264 292 No newline at end of file
265 293 def overJRO(request, profile_id, pattern_id, antenna_id): No newline at end of file
266 294 if request.GET["beam"] == "Up": No newline at end of file
267 295 objAntenna = AntennaUp.objects.get(pk=antenna_id) No newline at end of file
268 296 else: No newline at end of file
269 297 objAntenna = AntennaDown.objects.get(pk=antenna_id) No newline at end of file
270 298 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
271 299 exp_name = objProfile.name No newline at end of file
272 300 No newline at end of file
273 301 phase_tx = objAntenna.value No newline at end of file
274 302 gain_tx = objAntenna.tx No newline at end of file
275 303 gain_rx = objAntenna.rx No newline at end of file
276 304 ues_tx = objAntenna.ues No newline at end of file
277 305 only_rx = objAntenna.only_rx No newline at end of file
278 306 No newline at end of file
279 307 return exp_name, phase_tx, gain_tx, gain_rx, ues_tx, only_rx No newline at end of file
280 308 No newline at end of file
281 309 No newline at end of file
@@ -1,20 +1,23
1 1 /** No newline at end of file
2 2 * @author Jose Antonio Sal y Rosas Celi No newline at end of file
3 3 * @contact: jose.salyrosas@jro.igp.gob.pe, arturo.jasyrc@gmail.com No newline at end of file
4 4 */ No newline at end of file
5 5 No newline at end of file
6 6 $(document).on('ready',function(){ No newline at end of file
7 7 $('#listProfiles').change(function() { No newline at end of file
8 8 if($(this).val() != -1){ No newline at end of file
9 9 location.href="/abscontrol/view/" + $(this).val(); No newline at end of file
10 10 } No newline at end of file
11 11 }); No newline at end of file
12 12 $('.activeOverJRO').click(function() { No newline at end of file
13 13 profile_id = $('input[name=txtProfileId]').val(); No newline at end of file
14 14 pattern_id = $('input[name=txtPatternId]').val(); No newline at end of file
15 15 field_Id = $(this).attr("id"); No newline at end of file
16 16 field_value = $('input[name=txtAntenna'+field_Id+'Id]').val(); No newline at end of file
17 17 url = "/abscontrol/"+profile_id+"/"+pattern_id+"/overjro/"+field_value+"/?beam="+field_Id; No newline at end of file
18 18 alert(url); No newline at end of file
19 19 }); No newline at end of file
20 $('#lnkSaveImport').click(function(){
No newline at end of file
21 $('#frmImportProfile').submit(); No newline at end of file
20 22 }); No newline at end of file
23 }); No newline at end of file
@@ -1,16 +1,16
1 1 {% extends "abscontrol/index.html" %} No newline at end of file
2 2 {% block title %}ABS CONTROL:::::IMPORT PROFILE{% endblock %} No newline at end of file
3 3
4 No newline at end of file
4 {% block content %}
No newline at end of file
5 No newline at end of file
5 <div id="content">
No newline at end of file
6 No newline at end of file
6 <form action="/abscontrol/saveImport/" method="post" enctype="multipart/form-data"> No newline at end of file
7 7 <div id="divPattern"> No newline at end of file
8 8 <div class="divUes"> No newline at end of file
9 9 <label for="lblFile">Choose File:</label> No newline at end of file
10 10 <input type="file" name="txtFile" /> No newline at end of file
11 11 <input type="submit" name="btnSend" value="Upload" /> No newline at end of file
12 12 </div> No newline at end of file
13 13 </div> No newline at end of file
14 14 </form> No newline at end of file
15 15 </div> No newline at end of file
16 16 {% endblock %} No newline at end of file
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now