##// END OF EJS Templates
- Agregada la funcion que permite enviar un archivo a la API cliente de ABS CONTROL.
jsalyrosas -
r167:168
parent child
Show More
@@ -0,0 +1,10
1 {% extends "abscontrol/index.html" %}
No newline at end of file
2 {% block title %}ABS CONTROL:::::SENDING FILE{% endblock %}
No newline at end of file
3
No newline at end of file
4 {% block maincolumn %}
No newline at end of file
5 <div id="maincolumn">
No newline at end of file
6 <div class="divMessage">
No newline at end of file
7 <label>{{ message }}</label>
No newline at end of file
8 </div>
No newline at end of file
9 </div>
No newline at end of file
10 {% endblock %} No newline at end of file
@@ -1,159 +1,161
1 1 # Django settings for abs_webapp_dev project. No newline at end of file
2 2
3 No newline at end of file
3 import os No newline at end of file
4 4 PROJECT_DIR = os.path.split(os.path.dirname(__file__))[0] No newline at end of file
5 API_DIR = "/home/dev/workspace/absclient"
No newline at end of file
6 sys.path.append(API_DIR) No newline at end of file
5 7 No newline at end of file
6 8 DEBUG = True No newline at end of file
7 9 TEMPLATE_DEBUG = DEBUG No newline at end of file
8 10 No newline at end of file
9 11 ADMINS = ( No newline at end of file
10 12 # ('Your Name', 'your_email@example.com'), No newline at end of file
11 13 ) No newline at end of file
12 14 No newline at end of file
13 15 MANAGERS = ADMINS No newline at end of file
14 16 No newline at end of file
15 17 DATABASES = { No newline at end of file
16 18 'default': { No newline at end of file
17 19 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. No newline at end of file
18 20 'NAME': 'db_jrowebapp_dev', # Or path to database file if using sqlite3. No newline at end of file
19 21 'USER': 'abscontrol', # Not used with sqlite3. No newline at end of file
20 22 'PASSWORD': 'abscontrol', # Not used with sqlite3. No newline at end of file
21 23 'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3. No newline at end of file
22 24 'PORT': '3306', # Set to empty string for default. Not used with sqlite3. No newline at end of file
23 25 } No newline at end of file
24 26 } No newline at end of file
25 27 No newline at end of file
26 28 # Local time zone for this installation. Choices can be found here: No newline at end of file
27 29 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name No newline at end of file
28 30 # although not all choices may be available on all operating systems. No newline at end of file
29 31 # In a Windows environment this must be set to your system time zone. No newline at end of file
30 32 TIME_ZONE = 'America/Lima' No newline at end of file
31 33 No newline at end of file
32 34 # Language code for this installation. All choices can be found here: No newline at end of file
33 35 # http://www.i18nguy.com/unicode/language-identifiers.html No newline at end of file
34 36 LANGUAGE_CODE = 'en-us' No newline at end of file
35 37 No newline at end of file
36 38 SITE_ID = 1 No newline at end of file
37 39 No newline at end of file
38 40 # If you set this to False, Django will make some optimizations so as not No newline at end of file
39 41 # to load the internationalization machinery. No newline at end of file
40 42 USE_I18N = True No newline at end of file
41 43 No newline at end of file
42 44 # If you set this to False, Django will not format dates, numbers and No newline at end of file
43 45 # calendars according to the current locale. No newline at end of file
44 46 USE_L10N = True No newline at end of file
45 47 No newline at end of file
46 48 # If you set this to False, Django will not use timezone-aware datetimes. No newline at end of file
47 49 USE_TZ = True No newline at end of file
48 50 No newline at end of file
49 51 # Absolute filesystem path to the directory that will hold user-uploaded files. No newline at end of file
50 52 # Example: "/home/media/media.lawrence.com/media/" No newline at end of file
51 53 MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media').replace('\\', '/') No newline at end of file
52 54 No newline at end of file
53 55 # URL that handles the media served from MEDIA_ROOT. Make sure to use a No newline at end of file
54 56 # trailing slash. No newline at end of file
55 57 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" No newline at end of file
56 58 MEDIA_URL = '/media/' No newline at end of file
57 59 No newline at end of file
58 60 # Absolute path to the directory static files should be collected to. No newline at end of file
59 61 # Don't put anything in this directory yourself; store your static files No newline at end of file
60 62 # in apps' "static/" subdirectories and in STATICFILES_DIRS. No newline at end of file
61 63 # Example: "/home/media/media.lawrence.com/static/" No newline at end of file
62 64 #STATIC_ROOT = os.path.join(PROJECT_DIR, 'static-serve').replace('\\', '/'), No newline at end of file
63 65 STATIC_ROOT = '' No newline at end of file
64 66 No newline at end of file
65 67 # URL prefix for static files. No newline at end of file
66 68 # Example: "http://media.lawrence.com/static/" No newline at end of file
67 69 STATIC_URL = '/static/' No newline at end of file
68 70 No newline at end of file
69 71 # Additional locations of static files No newline at end of file
70 72 STATICFILES_DIRS = ( No newline at end of file
71 73 # Put strings here, like "/home/html/static" or "C:/www/django/static". No newline at end of file
72 74 # Always use forward slashes, even on Windows. No newline at end of file
73 75 # Don't forget to use absolute paths, not relative paths. No newline at end of file
74 76 #os.path.join(PROJECT_DIR, "static").replace('\\', '/'), No newline at end of file
75 77 ("static", os.path.join(PROJECT_DIR, "static").replace('\\', '/')), No newline at end of file
76 78 ) No newline at end of file
77 79 No newline at end of file
78 80 # List of finder classes that know how to find static files in No newline at end of file
79 81 # various locations. No newline at end of file
80 82 STATICFILES_FINDERS = ( No newline at end of file
81 83 'django.contrib.staticfiles.finders.FileSystemFinder', No newline at end of file
82 84 'django.contrib.staticfiles.finders.AppDirectoriesFinder', No newline at end of file
83 85 # 'django.contrib.staticfiles.finders.DefaultStorageFinder', No newline at end of file
84 86 ) No newline at end of file
85 87 No newline at end of file
86 88 # Make this unique, and don't share it with anybody. No newline at end of file
87 89 SECRET_KEY = '=^abu)gd=)7hf#rme_vw=tv!bdh7+tts*^&amp;)h(n=7@7(9#__@e' No newline at end of file
88 90 No newline at end of file
89 91 # List of callables that know how to import templates from various sources. No newline at end of file
90 92 TEMPLATE_LOADERS = ( No newline at end of file
91 93 'django.template.loaders.filesystem.Loader', No newline at end of file
92 94 'django.template.loaders.app_directories.Loader', No newline at end of file
93 95 # 'django.template.loaders.eggs.Loader', No newline at end of file
94 96 ) No newline at end of file
95 97 No newline at end of file
96 98 MIDDLEWARE_CLASSES = ( No newline at end of file
97 99 'django.middleware.common.CommonMiddleware', No newline at end of file
98 100 'django.contrib.sessions.middleware.SessionMiddleware', No newline at end of file
99 101 #'django.middleware.csrf.CsrfViewMiddleware', No newline at end of file
100 102 'django.contrib.auth.middleware.AuthenticationMiddleware', No newline at end of file
101 103 'django.contrib.messages.middleware.MessageMiddleware', No newline at end of file
102 104 # Uncomment the next line for simple clickjacking protection: No newline at end of file
103 105 # 'django.middleware.clickjacking.XFrameOptionsMiddleware', No newline at end of file
104 106 ) No newline at end of file
105 107 No newline at end of file
106 108 ROOT_URLCONF = 'abs_webapp_dev.urls' No newline at end of file
107 109 No newline at end of file
108 110 # Python dotted path to the WSGI application used by Django's runserver. No newline at end of file
109 111 WSGI_APPLICATION = 'abs_webapp_dev.wsgi.application' No newline at end of file
110 112 No newline at end of file
111 113 TEMPLATE_DIRS = ( No newline at end of file
112 114 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". No newline at end of file
113 115 # Always use forward slashes, even on Windows. No newline at end of file
114 116 # Don't forget to use absolute paths, not relative paths. No newline at end of file
115 117 os.path.join(PROJECT_DIR, "templates").replace('\\', '/'), No newline at end of file
116 118 ) No newline at end of file
117 119 No newline at end of file
118 120 INSTALLED_APPS = ( No newline at end of file
119 121 'django.contrib.auth', No newline at end of file
120 122 'django.contrib.contenttypes', No newline at end of file
121 123 'django.contrib.sessions', No newline at end of file
122 124 'django.contrib.sites', No newline at end of file
123 125 'django.contrib.messages', No newline at end of file
124 126 'django.contrib.staticfiles', No newline at end of file
125 127 # Uncomment the next line to enable the admin: No newline at end of file
126 128 'django.contrib.admin', No newline at end of file
127 129 # Uncomment the next line to enable admin documentation: No newline at end of file
128 130 # 'django.contrib.admindocs', No newline at end of file
129 131 'abscontrol', No newline at end of file
130 132 ) No newline at end of file
131 133 No newline at end of file
132 134 # A sample logging configuration. The only tangible logging No newline at end of file
133 135 # performed by this configuration is to send an email to No newline at end of file
134 136 # the site admins on every HTTP 500 error when DEBUG=False. No newline at end of file
135 137 # See http://docs.djangoproject.com/en/dev/topics/logging for No newline at end of file
136 138 # more details on how to customize your logging configuration. No newline at end of file
137 139 LOGGING = { No newline at end of file
138 140 'version': 1, No newline at end of file
139 141 'disable_existing_loggers': False, No newline at end of file
140 142 'filters': { No newline at end of file
141 143 'require_debug_false': { No newline at end of file
142 144 '()': 'django.utils.log.RequireDebugFalse' No newline at end of file
143 145 } No newline at end of file
144 146 }, No newline at end of file
145 147 'handlers': { No newline at end of file
146 148 'mail_admins': { No newline at end of file
147 149 'level': 'ERROR', No newline at end of file
148 150 'filters': ['require_debug_false'], No newline at end of file
149 151 'class': 'django.utils.log.AdminEmailHandler' No newline at end of file
150 152 } No newline at end of file
151 153 }, No newline at end of file
152 154 'loggers': { No newline at end of file
153 155 'django.request': { No newline at end of file
154 156 'handlers': ['mail_admins'], No newline at end of file
155 157 'level': 'ERROR', No newline at end of file
156 158 'propagate': True, No newline at end of file
157 159 }, No newline at end of file
158 160 } No newline at end of file
159 161 } No newline at end of file
@@ -1,22 +1,23
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 18 url(r'^showImport/$', 'showImport'), No newline at end of file
19 19 url(r'^saveImport/$', 'saveImport'), No newline at end of file
20 20 url(r'^(?P<profile_id>\d+)/(?P<pattern_id>\d+)/overjro/(?P<antenna_id>\d+)/$', 'overJRO'), No newline at end of file
21 21 url(r'^export/(?P<profile_id>\d+)/$', 'export'), No newline at end of file
22 url(r'^send/(?P<profile_id>\d+)/$', 'send'), No newline at end of file
22 23 ) No newline at end of file
@@ -1,344 +1,374
1 1 from django.shortcuts import render_to_response, redirect No newline at end of file
2 2 from django.http import HttpResponse No newline at end of file
3 3 from django.conf import settings No newline at end of file
4 4 from django.utils.encoding import smart_str No newline at end of file
5 5 from django.core.servers.basehttp import FileWrapper No newline at end of file
6 6 import mimetypes No newline at end of file
7 7 from abscontrol.models import Profile, Pattern, AntennaDown, AntennaUp No newline at end of file
8 8 from util.readABSFile import readABSFile No newline at end of file
9 9 from util.saveABSFile import saveABSFile
10 No newline at end of file
10 No newline at end of file
11 11 No newline at end of file
12 12 txtAntenna = "[[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ No newline at end of file
13 13 "[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \ No newline at end of file
14 14 "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ No newline at end of file
15 15 "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ No newline at end of file
16 16 "[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \ No newline at end of file
17 17 "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ No newline at end of file
18 18 "[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \ No newline at end of file
19 19 "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]]" No newline at end of file
20 20 No newline at end of file
21 21 txtTxUp = "[[1,1,1,1,1,1,1,1]," \ No newline at end of file
22 22 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
23 23 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
24 24 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
25 25 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
26 26 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
27 27 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
28 28 "[1,1,1,1,1,1,1,1]]" No newline at end of file
29 29 No newline at end of file
30 30 txtTxDown = "[[1,1,1,1,0,0,0,0]," \ No newline at end of file
31 31 "[1,1,1,1,0,0,0,0]," \ No newline at end of file
32 32 "[1,1,1,1,0,0,0,0]," \ No newline at end of file
33 33 "[1,1,1,1,0,0,0,0]," \ 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 "[0,0,0,0,1,1,1,1]," \ No newline at end of file
37 37 "[0,0,0,0,1,1,1,1]]" No newline at end of file
38 38 No newline at end of file
39 39 txtRxUp = "[[0,0,0,0,1,1,1,1]," \ No newline at end of file
40 40 "[0,0,0,0,1,1,1,1]," \ No newline at end of file
41 41 "[0,0,0,0,1,1,1,1]," \ No newline at end of file
42 42 "[0,0,0,0,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 No newline at end of file
48 48 txtRxDown = "[[1,1,1,1,1,1,1,1]," \ No newline at end of file
49 49 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
50 50 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
51 51 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
52 52 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
53 53 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
54 54 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
55 55 "[1,1,1,1,1,1,1,1]]" No newline at end of file
56 56 No newline at end of file
57 57 txtUes = "[0.533333,0.00000,1.06667,0.00000]" No newline at end of file
58 58 No newline at end of file
59 59 def index(request): No newline at end of file
60 60 #latest_poll_list = profileAntenna.objects.all().order_by('-pub_date')[:5] No newline at end of file
61 61 profile_list = Profile.objects.all() No newline at end of file
62 62 return render_to_response('abscontrol/index.html', {'profile_list': profile_list}) No newline at end of file
63 63 No newline at end of file
64 64 def new(request): No newline at end of file
65 65 profile_list = Profile.objects.all() No newline at end of file
66 66 No newline at end of file
67 67 return render_to_response('abscontrol/new.html', {'profile_list': profile_list, No newline at end of file
68 68 'txtAntenna' : txtAntenna, No newline at end of file
69 69 'txtUes' : txtUes, 'txtTxUp' : txtTxUp, No newline at end of file
70 70 'txtTxDown' : txtTxDown, 'txtRxUp' : txtRxUp, No newline at end of file
71 71 'txtRxDown' : txtRxDown, No newline at end of file
72 72 }) No newline at end of file
73 73 No newline at end of file
74 74 def save(request): No newline at end of file
75 75 No newline at end of file
76 76 txtProfile = request.POST["txtProfile"] No newline at end of file
77 77 No newline at end of file
78 78 txtAntennaUp = request.POST["txtAntennaUp"] No newline at end of file
79 79 txtTxUp = request.POST["txtTxUp"] No newline at end of file
80 80 txtRxUp = request.POST["txtRxUp"] No newline at end of file
81 81 txtUesUp = request.POST["txtUesUp"] No newline at end of file
82 82 No newline at end of file
83 83 txtAntennaDown = request.POST["txtAntennaDown"] No newline at end of file
84 84 txtTxDown = request.POST["txtTxDown"] No newline at end of file
85 85 txtRxDown = request.POST["txtRxDown"] No newline at end of file
86 86 txtUesDown = request.POST["txtUesDown"] No newline at end of file
87 87 No newline at end of file
88 88 newprofile = Profile(name=txtProfile) No newline at end of file
89 89 newprofile.save() No newline at end of file
90 90 No newline at end of file
91 91 newpattern = newprofile.pattern_set.create(value=1) No newline at end of file
92 92 newpattern.antennaup_set.create(value=txtAntennaUp,tx=txtTxUp,rx=txtRxUp,ues=txtUesUp) No newline at end of file
93 93 newpattern.antennadown_set.create(value=txtAntennaDown,tx=txtTxDown,rx=txtRxDown,ues=txtUesDown) No newline at end of file
94 94 No newline at end of file
95 95 newurl = '/abscontrol/view/%d' % newprofile.id No newline at end of file
96 96 No newline at end of file
97 97 return redirect(newurl) No newline at end of file
98 98 No newline at end of file
99 99 def view(request, profile_id): No newline at end of file
100 100 nextPattern = 0 No newline at end of file
101 101 No newline at end of file
102 102 if request.method == 'GET' and 'pattern' in request.GET: No newline at end of file
103 103 pattern_value = request.GET["pattern"] No newline at end of file
104 104 else: No newline at end of file
105 105 pattern_value = 1 No newline at end of file
106 106 No newline at end of file
107 107 profile_list = Profile.objects.all() No newline at end of file
108 108 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
109 109 No newline at end of file
110 110 lsPatterns = objProfile.pattern_set.all() No newline at end of file
111 111 patternChoosen = objProfile.pattern_set.get(value=pattern_value) No newline at end of file
112 112 objAntennaUp = patternChoosen.antennaup_set.get() No newline at end of file
113 113 objAntennaDown = patternChoosen.antennadown_set.get() No newline at end of file
114 114 No newline at end of file
115 115 if len(lsPatterns) > 1: No newline at end of file
116 116 if pattern_value == 1: No newline at end of file
117 117 nextValuePattern = pattern_value + 1 No newline at end of file
118 118 nextPattern = objProfile.pattern_set.get(value=nextValuePattern) No newline at end of file
119 119 No newline at end of file
120 120 No newline at end of file
121 121 return render_to_response('abscontrol/view.html', {'objProfile': objProfile, 'profile_list': profile_list, No newline at end of file
122 122 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, No newline at end of file
123 123 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, No newline at end of file
124 124 'nextPattern' : nextPattern, No newline at end of file
125 125 }) No newline at end of file
126 126 No newline at end of file
127 127 def edit(request, profile_id): No newline at end of file
128 128 if request.method == 'GET' and 'pattern' in request.GET: No newline at end of file
129 129 pattern_value = request.GET["pattern"] No newline at end of file
130 130 else: No newline at end of file
131 131 pattern_value = 1 No newline at end of file
132 132 No newline at end of file
133 133 profile_list = Profile.objects.all() No newline at end of file
134 134 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
135 135 No newline at end of file
136 136 lsPatterns = objProfile.pattern_set.all() No newline at end of file
137 137 patternChoosen = objProfile.pattern_set.get(value=pattern_value) No newline at end of file
138 138 objAntennaUp = patternChoosen.antennaup_set.get() No newline at end of file
139 139 objAntennaDown = patternChoosen.antennadown_set.get() No newline at end of file
140 140 No newline at end of file
141 141 return render_to_response('abscontrol/edit.html', {'objProfile': objProfile, 'profile_list': profile_list, No newline at end of file
142 142 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, No newline at end of file
143 143 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, No newline at end of file
144 144 }) No newline at end of file
145 145 No newline at end of file
146 146 def addPattern(request, profile_id): No newline at end of file
147 147 profile_list = Profile.objects.all() No newline at end of file
148 148 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
149 149 No newline at end of file
150 150 return render_to_response('abscontrol/addPattern.html', {'objProfile': objProfile, 'profile_list': profile_list, No newline at end of file
151 151 'txtAntenna' : txtAntenna, 'txtUes' : txtUes, No newline at end of file
152 152 'txtTxUp' : txtTxUp, 'txtTxDown' : txtTxDown, No newline at end of file
153 153 'txtRxUp' : txtRxUp, 'txtRxDown' : txtRxDown, No newline at end of file
154 154 }) No newline at end of file
155 155 No newline at end of file
156 156 def editPattern(request, profile_id, pattern_id): No newline at end of file
157 157 profile_list = Profile.objects.all() No newline at end of file
158 158 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
159 159 lsPatterns = objProfile.pattern_set.all() No newline at end of file
160 160 patternChoosen = Pattern.objects.get(pk=pattern_id) No newline at end of file
161 161 objAntennaUp = patternChoosen.antennaup_set.get() No newline at end of file
162 162 objAntennaDown = patternChoosen.antennadown_set.get() No newline at end of file
163 163 No newline at end of file
164 164 return render_to_response('abscontrol/editPattern.html', {'objProfile': objProfile, 'profile_list': profile_list, No newline at end of file
165 165 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, No newline at end of file
166 166 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, No newline at end of file
167 167 }) No newline at end of file
168 168 No newline at end of file
169 169 def savePattern(request, profile_id): No newline at end of file
170 170 pattern_id = 0 No newline at end of file
171 171 method = "save" No newline at end of file
172 172 No newline at end of file
173 173 if 'pattern_id' in request.POST: No newline at end of file
174 174 pattern_id = request.POST["pattern_id"] No newline at end of file
175 175 method = "update" No newline at end of file
176 176 No newline at end of file
177 177 maxValuePattern = 0 No newline at end of file
178 178 txtAntennaUp = request.POST["txtAntennaUp"] No newline at end of file
179 179 txtTxUp = request.POST["txtTxUp"] No newline at end of file
180 180 txtRxUp = request.POST["txtRxUp"] No newline at end of file
181 181 txtUesUp = request.POST["txtUesUp"] No newline at end of file
182 182 No newline at end of file
183 183 txtAntennaDown = request.POST["txtAntennaDown"] No newline at end of file
184 184 txtTxDown = request.POST["txtTxDown"] No newline at end of file
185 185 txtRxDown = request.POST["txtRxDown"] No newline at end of file
186 186 txtUesDown = request.POST["txtUesDown"] No newline at end of file
187 187 No newline at end of file
188 188 if method == "save": No newline at end of file
189 189 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
190 190 lsPatterns = objProfile.pattern_set.all() No newline at end of file
191 191 for element in lsPatterns: No newline at end of file
192 192 if element.value > maxValuePattern: No newline at end of file
193 193 maxPattern = element.value No newline at end of file
194 194 No newline at end of file
195 195 if maxPattern < 10 : No newline at end of file
196 196 newValuePattern = maxPattern + 1 No newline at end of file
197 197 newpattern = objProfile.pattern_set.create(value=newValuePattern) No newline at end of file
198 198 newpattern.antennaup_set.create(value=txtAntennaUp,tx=txtTxUp,rx=txtRxUp,ues=txtUesUp) No newline at end of file
199 199 newpattern.antennadown_set.create(value=txtAntennaDown,tx=txtTxDown,rx=txtRxDown,ues=txtUesDown) No newline at end of file
200 200 No newline at end of file
201 201 newurl = '/abscontrol/%d/view/%d' % (int(profile_id), newpattern.id) No newline at end of file
202 202 else: No newline at end of file
203 203 newurl = '/abscontrol/edit/%d' % (int(profile_id)) No newline at end of file
204 204 else: No newline at end of file
205 205 txtAntennaUpId = request.POST["txtAntennaUpId"] No newline at end of file
206 206 objAntennaUp = AntennaUp.objects.get(pk=txtAntennaUpId) No newline at end of file
207 207 objAntennaUp.value = txtAntennaUp No newline at end of file
208 208 objAntennaUp.tx = txtTxUp No newline at end of file
209 209 objAntennaUp.rx = txtRxUp No newline at end of file
210 210 objAntennaUp.ues = txtUesUp No newline at end of file
211 211 objAntennaUp.save() No newline at end of file
212 212 No newline at end of file
213 213 txtAntennaDownId = request.POST["txtAntennaDownId"] No newline at end of file
214 214 objAntennaDown = AntennaDown.objects.get(pk=txtAntennaDownId) No newline at end of file
215 215 objAntennaDown.value = txtAntennaDown No newline at end of file
216 216 objAntennaDown.tx = txtTxDown No newline at end of file
217 217 objAntennaDown.rx = txtRxDown No newline at end of file
218 218 objAntennaDown.ues = txtUesDown No newline at end of file
219 219 objAntennaDown.save() No newline at end of file
220 220 No newline at end of file
221 221 newurl = '/abscontrol/%d/view/%d' % (int(profile_id), int(pattern_id)) No newline at end of file
222 222 No newline at end of file
223 223 return redirect(newurl) No newline at end of file
224 224 No newline at end of file
225 225 def viewPattern(request, profile_id, pattern_id): No newline at end of file
226 226 No newline at end of file
227 227 profile_list = Profile.objects.all() No newline at end of file
228 228 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
229 229 No newline at end of file
230 230 patternChoosen = Pattern.objects.get(pk=pattern_id) No newline at end of file
231 231 No newline at end of file
232 232 objAntennaUp = patternChoosen.antennaup_set.get() No newline at end of file
233 233 objAntennaDown = patternChoosen.antennadown_set.get() No newline at end of file
234 234 No newline at end of file
235 235 lsPatterns = objProfile.pattern_set.all() No newline at end of file
236 236 No newline at end of file
237 237 return render_to_response('abscontrol/viewPattern.html', {'objProfile': objProfile, 'profile_list': profile_list, No newline at end of file
238 238 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, No newline at end of file
239 239 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, No newline at end of file
240 240 }) No newline at end of file
241 241 No newline at end of file
242 242 def deletePattern(request, profile_id, pattern_id): No newline at end of file
243 243 newurl = '/abscontrol/edit/%d' % int(profile_id) No newline at end of file
244 244 No newline at end of file
245 245 return redirect(newurl) No newline at end of file
246 246 No newline at end of file
247 247 def importProfile(request): No newline at end of file
248 248 profile_list = Profile.objects.all() No newline at end of file
249 249 return render_to_response('abscontrol/import.html', {'profile_list': profile_list,}) No newline at end of file
250 250 No newline at end of file
251 251 def showImport(request): No newline at end of file
252 252 if request.method == 'POST': No newline at end of file
253 253 txtFilename = request.FILES['txtFile'] No newline at end of file
254 254 if txtFilename: No newline at end of file
255 255 destination = open('/tmp/'+txtFilename.name, 'wb+') No newline at end of file
256 256 for chunk in txtFilename.chunks(): No newline at end of file
257 257 destination.write(chunk) No newline at end of file
258 258 destination.close() No newline at end of file
259 259 filename = '/tmp/'+txtFilename.name No newline at end of file
260 260 readFile = readABSFile(filename) No newline at end of file
261 261 expName, num_patterns, patterns = readFile.getMetadata() No newline at end of file
262 262 else: No newline at end of file
263 263 txtFilename = "Error" No newline at end of file
264 264 #content = "Error" No newline at end of file
265 265 expName = "" No newline at end of file
266 266 num_patterns = 0 No newline at end of file
267 267 No newline at end of file
268 268 return render_to_response('abscontrol/upload-edit.html', {'txtFilename': txtFilename, 'patterns' : patterns, No newline at end of file
269 269 'expName' : expName, 'num_patterns' : num_patterns, No newline at end of file
270 270 }) No newline at end of file
271 271 No newline at end of file
272 272 def saveImport(request): No newline at end of file
273 273 patterns = [] No newline at end of file
274 274 No newline at end of file
275 275 expName = request.POST["txtProfile"] No newline at end of file
276 276 num_patterns = int(request.POST["txtNumPatterns"]) No newline at end of file
277 277 No newline at end of file
278 278 newprofile = Profile(name=expName) No newline at end of file
279 279 newprofile.save() No newline at end of file
280 280 No newline at end of file
281 281 for i in range(0,num_patterns): No newline at end of file
282 282 number = request.POST["txtNumberPattern"+str(i+1)] No newline at end of file
283 283 txtAntennaUp = request.POST["txtAntennaUp"+str(i+1)] No newline at end of file
284 284 txtAntennaDown = request.POST["txtAntennaDown"+str(i+1)] No newline at end of file
285 285 dicPattern = {"number" : number, "up" : txtAntennaUp, "down" : txtAntennaDown} No newline at end of file
286 286 patterns.append(dicPattern) No newline at end of file
287 287 newpattern = newprofile.pattern_set.create(value=number) No newline at end of file
288 288 newpattern.antennaup_set.create(value=txtAntennaUp) No newline at end of file
289 289 newpattern.antennadown_set.create(value=txtAntennaDown) No newline at end of file
290 290 No newline at end of file
291 291 newurl = '/abscontrol/view/%d' % newprofile.id No newline at end of file
292 292 No newline at end of file
293 293 return redirect(newurl) No newline at end of file
294 294 ''' No newline at end of file
295 295 return render_to_response('abscontrol/upload-view.html', {'expName' : expName, 'patterns' : patterns, No newline at end of file
296 296 'num_patterns' : num_patterns, No newline at end of file
297 297 }) No newline at end of file
298 298 ''' No newline at end of file
299 299 No newline at end of file
300 300 def overJRO(request, profile_id, pattern_id, antenna_id): No newline at end of file
301 301 if request.GET["beam"] == "Up": No newline at end of file
302 302 objAntenna = AntennaUp.objects.get(pk=antenna_id) No newline at end of file
303 303 else: No newline at end of file
304 304 objAntenna = AntennaDown.objects.get(pk=antenna_id) No newline at end of file
305 305 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
306 306 exp_name = objProfile.name No newline at end of file
307 307 No newline at end of file
308 308 phase_tx = objAntenna.value No newline at end of file
309 309 gain_tx = objAntenna.tx No newline at end of file
310 310 gain_rx = objAntenna.rx No newline at end of file
311 311 ues_tx = objAntenna.ues No newline at end of file
312 312 only_rx = objAntenna.only_rx No newline at end of file
313 313 No newline at end of file
314 314 return exp_name, phase_tx, gain_tx, gain_rx, ues_tx, only_rx No newline at end of file
315 315 No newline at end of file
316 316 def export(request, profile_id): No newline at end of file
317 317 listPatterns = [] No newline at end of file
318 318 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
319 319 exp_name = objProfile.name No newline at end of file
320 320 lsPatterns = objProfile.pattern_set.all() No newline at end of file
321 321 for element in lsPatterns: No newline at end of file
322 322 objAntennaUp = element.antennaup_set.get() No newline at end of file
323 323 objAntennaDown = element.antennadown_set.get() No newline at end of file
324 324 dicPatterns = {"number" : element.value, "up" : objAntennaUp.value, "down" : objAntennaDown.value} No newline at end of file
325 325 listPatterns.append(dicPatterns) No newline at end of file
326 326 No newline at end of file
327 327 absFile = saveABSFile() No newline at end of file
328 328 absFile.setParameters(settings.MEDIA_ROOT, exp_name, listPatterns) No newline at end of file
329 329 filename, filesize = absFile.save() No newline at end of file
330 330 No newline at end of file
331 331 wrapper = FileWrapper( open( filename, "r" ) ) No newline at end of file
332 332 content_type = mimetypes.guess_type( filename )[0] No newline at end of file
333 333 No newline at end of file
334 334 response = HttpResponse(wrapper, content_type = content_type) No newline at end of file
335 335 response['Content-Description'] = 'File Transfer' No newline at end of file
336 336 response['Content-Disposition'] = 'attachment; filename=%s' % smart_str(filename) No newline at end of file
337 337 response['Content-Transfer-Encoding'] = 'binary' No newline at end of file
338 338 response['Expires'] = '0' No newline at end of file
339 339 response['Cache-Control'] = 'must-revalidate' No newline at end of file
340 340 response['Pragma'] = 'public' No newline at end of file
341 341 response['Content-Length'] = '%s' % str(filesize) No newline at end of file
342 342 response['X-Sendfile'] = '%s' % smart_str(filename) No newline at end of file
343 343 No newline at end of file
344 344 return response No newline at end of file
345
No newline at end of file
346 def send(request, profile_id):
No newline at end of file
347 listPatterns = []
No newline at end of file
348 objProfile = Profile.objects.get(pk=profile_id)
No newline at end of file
349 exp_name = objProfile.name
No newline at end of file
350
No newline at end of file
351 lsPatterns = objProfile.pattern_set.all()
No newline at end of file
352 for element in lsPatterns:
No newline at end of file
353 objAntennaUp = element.antennaup_set.get()
No newline at end of file
354 objAntennaDown = element.antennadown_set.get()
No newline at end of file
355 dicPatterns = {"number" : element.value, "up" : objAntennaUp.value, "down" : objAntennaDown.value}
No newline at end of file
356 listPatterns.append(dicPatterns)
No newline at end of file
357
No newline at end of file
358 absFile = saveABSFile()
No newline at end of file
359 absFile.setParameters(settings.MEDIA_ROOT, exp_name, listPatterns)
No newline at end of file
360 filename, filesize = absFile.save()
No newline at end of file
361
No newline at end of file
362 apiclient = sendFile()
No newline at end of file
363 apiclient.execute(filename)
No newline at end of file
364
No newline at end of file
365 objProfile.hits += 1
No newline at end of file
366 objProfile.save()
No newline at end of file
367
No newline at end of file
368 message = "File sent successfully."
No newline at end of file
369
No newline at end of file
370 profile_list = Profile.objects.all()
No newline at end of file
371
No newline at end of file
372 return render_to_response('abscontrol/sendFile.html', {'message': message, "profile_list" : profile_list,
No newline at end of file
373 'objProfile': objProfile,
No newline at end of file
374 }) No newline at end of file
@@ -1,30 +1,30
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 No newline at end of file
13 13 $('#lnkSave').click(function() { No newline at end of file
14 14 $('#frmPattern').submit(); No newline at end of file
15 15 }); No newline at end of file
16 16 No newline at end of file
17 17 $('#lnkCancel').click(function() { No newline at end of file
18 18 if ($("#pattern_id").val() == 0){ No newline at end of file
19 19 location.href="/abscontrol/edit/" + $("#profile_id").val(); No newline at end of file
20 20 }else{ No newline at end of file
21 21 location.href="/abscontrol/" + $("#profile_id").val() + "/view/" + $("#pattern_id").val() No newline at end of file
22 22 } No newline at end of file
23 23 No newline at end of file
24 24 }); No newline at end of file
25 25 No newline at end of file
26 26 $('#lnkExport').click(function(){ No newline at end of file
27 27 profile_id = $(this).attr("alt"); No newline at end of file
28 28 location.href="/abscontrol/export/" + profile_id + "/"; No newline at end of file
29 29 }); No newline at end of file
30 });
No newline at end of file
31 L31: rhodecode diff rendering error
No newline at end of file
32 L32: rhodecode diff rendering error No newline at end of file
30 33 }); No newline at end of file
@@ -1,27 +1,31
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 20 $('#lnkSaveImport').click(function(){ No newline at end of file
21 21 $('#frmImportProfile').submit(); No newline at end of file
22 22 }); No newline at end of file
23 23 $('#lnkExport').click(function(){ No newline at end of file
24 24 profile_id = $(this).attr("alt"); No newline at end of file
25 25 location.href="/abscontrol/export/" + profile_id + "/"; No newline at end of file
26 26 }); No newline at end of file
27 $('#lnkSendFile').click(function(){
No newline at end of file
28 profile_id = $(this).attr("alt");
No newline at end of file
29 location.href="/abscontrol/send/" + profile_id + "/"; No newline at end of file
27 30 }); No newline at end of file
31 }); No newline at end of file
@@ -1,62 +1,62
1 1 {% extends "base.html" %} No newline at end of file
2 2 No newline at end of file
3 3 {% block title %}ABS CONTROL:::::{% endblock %} No newline at end of file
4 4 {% block scripting %} No newline at end of file
5 5 {% if profile_list %} No newline at end of file
6 6 <script src="/static/static/js/profiles.js"></script> No newline at end of file
7 7 {% endif %} No newline at end of file
8 8 {% endblock %} No newline at end of file
9 9 {% block content %} No newline at end of file
10 10 <div id="content"> No newline at end of file
11 11 {% block leftcolumn %} No newline at end of file
12 12 <div id="leftcolumn"> No newline at end of file
13 13 <div id="lsProfiles"> No newline at end of file
14 14 <div id="infoProfiles"> No newline at end of file
15 15 <label for="lblProfile" class="lblInfo">Profiles:</label><br /> No newline at end of file
16 16 {% if profile_list %} No newline at end of file
17 17 <select name="lsProfiles" id="listProfiles"> No newline at end of file
18 18 <option value="-1">Choose ...</option> No newline at end of file
19 19 {% for entry in profile_list %} No newline at end of file
20 20 {% if objProfile %} No newline at end of file
21 21 {% if objProfile.id == entry.id %} No newline at end of file
22 22 <option value="{{ entry.id }}" selected>{{ entry.name }}</option> No newline at end of file
23 23 {% else %} No newline at end of file
24 24 <option value="{{ entry.id }}">{{ entry.name }}</option> No newline at end of file
25 25 {% endif %} No newline at end of file
26 26 {% else %} No newline at end of file
27 27 <option value="{{ entry.id }}">{{ entry.name }}</option> No newline at end of file
28 28 {% endif %} No newline at end of file
29 29 {% endfor %} No newline at end of file
30 30 </select> No newline at end of file
31 31 {% else %} No newline at end of file
32 32 <label for="lblMessage" class="lblInfo">No profiles.</label> No newline at end of file
33 33 {% endif %} No newline at end of file
34 34 </div> No newline at end of file
35 35 </div> No newline at end of file
36 36 {% block mnu_profile %} No newline at end of file
37 37 <nav class="MnuVertical" id="mnuProfiles"> No newline at end of file
38 38 <ul> No newline at end of file
39 39 <li><a href="/abscontrol/new">New</a></li> No newline at end of file
40 40 {% if objProfile %} No newline at end of file
41 41 <li><a href="/abscontrol/edit/{{ objProfile.id }}">Edit</a></li> No newline at end of file
42 42 <li><a href="#">Save</a></li> No newline at end of file
43 43 {% endif %} No newline at end of file
44 44 <li><a href="#">Save as</a></li> No newline at end of file
45 45 <li><a href="/abscontrol/import">Import</a></li> No newline at end of file
46 46 {% if objProfile %} No newline at end of file
47 47 <li><a href="#" id="lnkExport" alt="{{ objProfile.id }}">Export</a></li>
48 No newline at end of file
48 <li><a href="#">Apply</a></li> No newline at end of file
49 49 {% endif %} No newline at end of file
50 50 </ul> No newline at end of file
51 51 </nav> No newline at end of file
52 52 {% endblock %} No newline at end of file
53 53 </div> No newline at end of file
54 54 {% endblock %} No newline at end of file
55 55 {% block maincolumn %} No newline at end of file
56 56 <div id="maincolumn"> No newline at end of file
57 57 No newline at end of file
58 58 </div> No newline at end of file
59 59 {% endblock %} No newline at end of file
60 60 <div class="cleardivs"></div> No newline at end of file
61 61 </div> No newline at end of file
62 62 {% endblock %} No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now