@@ -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 | 1 | # Django settings for abs_webapp_dev project. |
|
2 | 2 | |
|
3 | import os | |
|
3 | import os, sys | |
|
4 | 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 | 8 | DEBUG = True |
|
7 | 9 | TEMPLATE_DEBUG = DEBUG |
@@ -19,4 +19,5 | |||
|
19 | 19 | url(r'^saveImport/$', 'saveImport'), |
|
20 | 20 | url(r'^(?P<profile_id>\d+)/(?P<pattern_id>\d+)/overjro/(?P<antenna_id>\d+)/$', 'overJRO'), |
|
21 | 21 | url(r'^export/(?P<profile_id>\d+)/$', 'export'), |
|
22 | url(r'^send/(?P<profile_id>\d+)/$', 'send'), | |
|
22 | 23 | ) No newline at end of file |
@@ -7,7 +7,7 | |||
|
7 | 7 | from abscontrol.models import Profile, Pattern, AntennaDown, AntennaUp |
|
8 | 8 | from util.readABSFile import readABSFile |
|
9 | 9 | from util.saveABSFile import saveABSFile |
|
10 | ||
|
10 | from scripts.sendFile import sendFile | |
|
11 | 11 | |
|
12 | 12 | txtAntenna = "[[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ |
|
13 | 13 | "[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \ |
@@ -342,3 +342,33 | |||
|
342 | 342 | response['X-Sendfile'] = '%s' % smart_str(filename) |
|
343 | 343 | |
|
344 | 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 | 9 | location.href="/abscontrol/view/" + $(this).val(); |
|
10 | 10 | } |
|
11 | 11 | }); |
|
12 | ||
|
13 | 12 | $('#lnkSave').click(function() { |
|
14 | 13 | $('#frmPattern').submit(); |
|
15 | 14 | }); |
|
16 | ||
|
17 | 15 | $('#lnkCancel').click(function() { |
|
18 | 16 | if ($("#pattern_id").val() == 0){ |
|
19 | 17 | location.href="/abscontrol/edit/" + $("#profile_id").val(); |
|
20 | 18 | }else{ |
|
21 | 19 | location.href="/abscontrol/" + $("#profile_id").val() + "/view/" + $("#pattern_id").val() |
|
22 | 20 | } |
|
23 | ||
|
24 | 21 | }); |
|
25 | ||
|
26 | 22 | $('#lnkExport').click(function(){ |
|
27 | 23 | profile_id = $(this).attr("alt"); |
|
28 | 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 | 30 | }); No newline at end of file |
@@ -24,4 +24,8 | |||
|
24 | 24 | profile_id = $(this).attr("alt"); |
|
25 | 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 | 31 | }); No newline at end of file |
@@ -45,7 +45,7 | |||
|
45 | 45 | <li><a href="/abscontrol/import">Import</a></li> |
|
46 | 46 | {% if objProfile %} |
|
47 | 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 | 49 | {% endif %} |
|
50 | 50 | </ul> |
|
51 | 51 | </nav> |
General Comments 0
You need to be logged in to leave comments.
Login now