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