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