@@ -0,0 +1,10 | |||||
|
1 | {% extends "abscontrol/index.html" %} | |||
|
2 | {% block title %}ABS CONTROL:::::SENDING FILE{% endblock %} | |||
|
3 | ||||
|
4 | {% block maincolumn %} | |||
|
5 | <div id="maincolumn"> | |||
|
6 | <div class="divMessage"> | |||
|
7 | <label>{{ message }}</label> | |||
|
8 | </div> | |||
|
9 | </div> | |||
|
10 | {% endblock %} No newline at end of file |
@@ -1,7 +1,9 | |||||
1 | # Django settings for abs_webapp_dev project. |
|
1 | # Django settings for abs_webapp_dev project. | |
2 |
|
2 | |||
3 | import os |
|
3 | import os, sys | |
4 | PROJECT_DIR = os.path.split(os.path.dirname(__file__))[0] |
|
4 | PROJECT_DIR = os.path.split(os.path.dirname(__file__))[0] | |
|
5 | API_DIR = "/home/dev/workspace/absclient" | |||
|
6 | sys.path.append(API_DIR) | |||
5 |
|
7 | |||
6 | DEBUG = True |
|
8 | DEBUG = True | |
7 | TEMPLATE_DEBUG = DEBUG |
|
9 | TEMPLATE_DEBUG = DEBUG |
@@ -19,4 +19,5 | |||||
19 | url(r'^saveImport/$', 'saveImport'), |
|
19 | url(r'^saveImport/$', 'saveImport'), | |
20 | url(r'^(?P<profile_id>\d+)/(?P<pattern_id>\d+)/overjro/(?P<antenna_id>\d+)/$', 'overJRO'), |
|
20 | url(r'^(?P<profile_id>\d+)/(?P<pattern_id>\d+)/overjro/(?P<antenna_id>\d+)/$', 'overJRO'), | |
21 | url(r'^export/(?P<profile_id>\d+)/$', 'export'), |
|
21 | url(r'^export/(?P<profile_id>\d+)/$', 'export'), | |
|
22 | url(r'^send/(?P<profile_id>\d+)/$', 'send'), | |||
22 | ) No newline at end of file |
|
23 | ) |
@@ -7,7 +7,7 | |||||
7 | from abscontrol.models import Profile, Pattern, AntennaDown, AntennaUp |
|
7 | from abscontrol.models import Profile, Pattern, AntennaDown, AntennaUp | |
8 | from util.readABSFile import readABSFile |
|
8 | from util.readABSFile import readABSFile | |
9 | from util.saveABSFile import saveABSFile |
|
9 | from util.saveABSFile import saveABSFile | |
10 |
|
10 | from scripts.sendFile import sendFile | ||
11 |
|
11 | |||
12 | txtAntenna = "[[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ |
|
12 | txtAntenna = "[[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ | |
13 | "[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \ |
|
13 | "[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \ | |
@@ -342,3 +342,33 | |||||
342 | response['X-Sendfile'] = '%s' % smart_str(filename) |
|
342 | response['X-Sendfile'] = '%s' % smart_str(filename) | |
343 |
|
343 | |||
344 | return response |
|
344 | return response | |
|
345 | ||||
|
346 | def send(request, profile_id): | |||
|
347 | listPatterns = [] | |||
|
348 | objProfile = Profile.objects.get(pk=profile_id) | |||
|
349 | exp_name = objProfile.name | |||
|
350 | ||||
|
351 | lsPatterns = objProfile.pattern_set.all() | |||
|
352 | for element in lsPatterns: | |||
|
353 | objAntennaUp = element.antennaup_set.get() | |||
|
354 | objAntennaDown = element.antennadown_set.get() | |||
|
355 | dicPatterns = {"number" : element.value, "up" : objAntennaUp.value, "down" : objAntennaDown.value} | |||
|
356 | listPatterns.append(dicPatterns) | |||
|
357 | ||||
|
358 | absFile = saveABSFile() | |||
|
359 | absFile.setParameters(settings.MEDIA_ROOT, exp_name, listPatterns) | |||
|
360 | filename, filesize = absFile.save() | |||
|
361 | ||||
|
362 | apiclient = sendFile() | |||
|
363 | apiclient.execute(filename) | |||
|
364 | ||||
|
365 | objProfile.hits += 1 | |||
|
366 | objProfile.save() | |||
|
367 | ||||
|
368 | message = "File sent successfully." | |||
|
369 | ||||
|
370 | profile_list = Profile.objects.all() | |||
|
371 | ||||
|
372 | return render_to_response('abscontrol/sendFile.html', {'message': message, "profile_list" : profile_list, | |||
|
373 | 'objProfile': objProfile, | |||
|
374 | }) |
@@ -9,22 +9,22 | |||||
9 | location.href="/abscontrol/view/" + $(this).val(); |
|
9 | location.href="/abscontrol/view/" + $(this).val(); | |
10 | } |
|
10 | } | |
11 | }); |
|
11 | }); | |
12 |
|
||||
13 | $('#lnkSave').click(function() { |
|
12 | $('#lnkSave').click(function() { | |
14 | $('#frmPattern').submit(); |
|
13 | $('#frmPattern').submit(); | |
15 | }); |
|
14 | }); | |
16 |
|
||||
17 | $('#lnkCancel').click(function() { |
|
15 | $('#lnkCancel').click(function() { | |
18 | if ($("#pattern_id").val() == 0){ |
|
16 | if ($("#pattern_id").val() == 0){ | |
19 | location.href="/abscontrol/edit/" + $("#profile_id").val(); |
|
17 | location.href="/abscontrol/edit/" + $("#profile_id").val(); | |
20 | }else{ |
|
18 | }else{ | |
21 | location.href="/abscontrol/" + $("#profile_id").val() + "/view/" + $("#pattern_id").val() |
|
19 | location.href="/abscontrol/" + $("#profile_id").val() + "/view/" + $("#pattern_id").val() | |
22 | } |
|
20 | } | |
23 |
|
||||
24 | }); |
|
21 | }); | |
25 |
|
||||
26 | $('#lnkExport').click(function(){ |
|
22 | $('#lnkExport').click(function(){ | |
27 | profile_id = $(this).attr("alt"); |
|
23 | profile_id = $(this).attr("alt"); | |
28 | location.href="/abscontrol/export/" + profile_id + "/"; |
|
24 | location.href="/abscontrol/export/" + profile_id + "/"; | |
29 | }); |
|
25 | }); | |
|
26 | $('#lnkSendFile').click(function(){ | |||
|
27 | profile_id = $(this).attr("alt"); | |||
|
28 | location.href="/abscontrol/send/" + profile_id + "/"; | |||
|
29 | }); | |||
30 | }); No newline at end of file |
|
30 | }); |
@@ -24,4 +24,8 | |||||
24 | profile_id = $(this).attr("alt"); |
|
24 | profile_id = $(this).attr("alt"); | |
25 | location.href="/abscontrol/export/" + profile_id + "/"; |
|
25 | location.href="/abscontrol/export/" + profile_id + "/"; | |
26 | }); |
|
26 | }); | |
|
27 | $('#lnkSendFile').click(function(){ | |||
|
28 | profile_id = $(this).attr("alt"); | |||
|
29 | location.href="/abscontrol/send/" + profile_id + "/"; | |||
|
30 | }); | |||
27 | }); No newline at end of file |
|
31 | }); |
@@ -45,7 +45,7 | |||||
45 | <li><a href="/abscontrol/import">Import</a></li> |
|
45 | <li><a href="/abscontrol/import">Import</a></li> | |
46 | {% if objProfile %} |
|
46 | {% if objProfile %} | |
47 | <li><a href="#" id="lnkExport" alt="{{ objProfile.id }}">Export</a></li> |
|
47 | <li><a href="#" id="lnkExport" alt="{{ objProfile.id }}">Export</a></li> | |
48 |
<li><a href="#"> |
|
48 | <li><a href="#" id="lnkSendFile" alt="{{ objProfile.id }}">Send</a></li> | |
49 | {% endif %} |
|
49 | {% endif %} | |
50 | </ul> |
|
50 | </ul> | |
51 | </nav> |
|
51 | </nav> |
General Comments 0
You need to be logged in to leave comments.
Login now