@@ -1,173 +1,173 | |||
|
1 | 1 | # Django settings for abs_webapp_dev project. |
|
2 | 2 | |
|
3 | 3 | import os, sys |
|
4 | 4 | PROJECT_DIR = os.path.split(os.path.dirname(__file__))[0] |
|
5 | 5 | API_DIR = "/home/dev/workspace/absclient" |
|
6 | 6 | OVERJRO_DIR = "/home/dev/workspace/weboverjro" |
|
7 | 7 | sys.path.append(API_DIR) |
|
8 | 8 | sys.path.append(OVERJRO_DIR) |
|
9 | 9 | |
|
10 | 10 | DEBUG = True |
|
11 | 11 | TEMPLATE_DEBUG = DEBUG |
|
12 | 12 | |
|
13 | 13 | ADMINS = ( |
|
14 | 14 | # ('Your Name', 'your_email@example.com'), |
|
15 | 15 | ) |
|
16 | 16 | |
|
17 | 17 | MANAGERS = ADMINS |
|
18 | 18 | |
|
19 | 19 | DATABASES = { |
|
20 | 20 | 'default': { |
|
21 | 21 | 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. |
|
22 | 22 | 'NAME': 'db_jrowebapp_dev', # Or path to database file if using sqlite3. |
|
23 | 23 | 'USER': 'abscontrol', # Not used with sqlite3. |
|
24 | 24 | 'PASSWORD': 'abscontrol', # Not used with sqlite3. |
|
25 | 25 | 'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3. |
|
26 | 26 | 'PORT': '3306', # Set to empty string for default. Not used with sqlite3. |
|
27 | 27 | } |
|
28 | 28 | } |
|
29 | 29 | |
|
30 | 30 | # Local time zone for this installation. Choices can be found here: |
|
31 | 31 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name |
|
32 | 32 | # although not all choices may be available on all operating systems. |
|
33 | 33 | # In a Windows environment this must be set to your system time zone. |
|
34 | 34 | TIME_ZONE = 'America/Lima' |
|
35 | 35 | |
|
36 | 36 | # Language code for this installation. All choices can be found here: |
|
37 | 37 | # http://www.i18nguy.com/unicode/language-identifiers.html |
|
38 | 38 | LANGUAGE_CODE = 'en-us' |
|
39 | 39 | |
|
40 | 40 | SITE_ID = 1 |
|
41 | 41 | |
|
42 | 42 | # If you set this to False, Django will make some optimizations so as not |
|
43 | 43 | # to load the internationalization machinery. |
|
44 | 44 | USE_I18N = True |
|
45 | 45 | |
|
46 | 46 | # If you set this to False, Django will not format dates, numbers and |
|
47 | 47 | # calendars according to the current locale. |
|
48 | 48 | USE_L10N = True |
|
49 | 49 | |
|
50 | 50 | # If you set this to False, Django will not use timezone-aware datetimes. |
|
51 | 51 | USE_TZ = True |
|
52 | 52 | |
|
53 | 53 | # Absolute filesystem path to the directory that will hold user-uploaded files. |
|
54 | 54 | # Example: "/home/media/media.lawrence.com/media/" |
|
55 | 55 | MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media').replace('\\', '/') |
|
56 | 56 | |
|
57 | 57 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a |
|
58 | 58 | # trailing slash. |
|
59 | 59 | # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" |
|
60 | 60 | MEDIA_URL = '/media/' |
|
61 | 61 | |
|
62 | 62 | # Absolute path to the directory static files should be collected to. |
|
63 | 63 | # Don't put anything in this directory yourself; store your static files |
|
64 | 64 | # in apps' "static/" subdirectories and in STATICFILES_DIRS. |
|
65 | 65 | # Example: "/home/media/media.lawrence.com/static/" |
|
66 | 66 | STATIC_ROOT = os.path.join(PROJECT_DIR, 'static').replace('\\', '/') |
|
67 | 67 | #STATIC_ROOT = '' |
|
68 | 68 | |
|
69 | 69 | # URL prefix for static files. |
|
70 | 70 | # Example: "http://media.lawrence.com/static/" |
|
71 | 71 | STATIC_URL = '/static/' |
|
72 | 72 | |
|
73 | 73 | # Additional locations of static files |
|
74 | 74 | STATICFILES_DIRS = ( |
|
75 | 75 | # Put strings here, like "/home/html/static" or "C:/www/django/static". |
|
76 | 76 | # Always use forward slashes, even on Windows. |
|
77 | 77 | # Don't forget to use absolute paths, not relative paths. |
|
78 | 78 | #os.path.join(PROJECT_DIR, "static").replace('\\', '/'), |
|
79 | 79 | #("static", os.path.join(PROJECT_DIR, "static").replace('\\', '/')), |
|
80 | 80 | ) |
|
81 | 81 | |
|
82 | 82 | # List of finder classes that know how to find static files in |
|
83 | 83 | # various locations. |
|
84 | 84 | STATICFILES_FINDERS = ( |
|
85 | 85 | 'django.contrib.staticfiles.finders.FileSystemFinder', |
|
86 | 86 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', |
|
87 | 87 | 'django.contrib.staticfiles.finders.DefaultStorageFinder', |
|
88 | 88 | ) |
|
89 | 89 | |
|
90 | 90 | # Make this unique, and don't share it with anybody. |
|
91 | 91 | SECRET_KEY = '=^abu)gd=)7hf#rme_vw=tv!bdh7+tts*^&)h(n=7@7(9#__@e' |
|
92 | 92 | |
|
93 | 93 | # List of callables that know how to import templates from various sources. |
|
94 | 94 | TEMPLATE_LOADERS = ( |
|
95 | 95 | 'django.template.loaders.filesystem.Loader', |
|
96 | 96 | 'django.template.loaders.app_directories.Loader', |
|
97 | 97 | # 'django.template.loaders.eggs.Loader', |
|
98 | 98 | ) |
|
99 | 99 | |
|
100 | 100 | MIDDLEWARE_CLASSES = ( |
|
101 | 101 | 'django.middleware.common.CommonMiddleware', |
|
102 | 102 | 'django.contrib.sessions.middleware.SessionMiddleware', |
|
103 | 103 | 'django.middleware.csrf.CsrfViewMiddleware', |
|
104 | 104 | 'django.contrib.auth.middleware.AuthenticationMiddleware', |
|
105 | 105 | 'django.contrib.messages.middleware.MessageMiddleware', |
|
106 | 106 | # Uncomment the next line for simple clickjacking protection: |
|
107 | 107 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
|
108 | 108 | ) |
|
109 | 109 | |
|
110 | 110 | ROOT_URLCONF = 'abs_webapp_dev.urls' |
|
111 | 111 | |
|
112 | 112 | # Python dotted path to the WSGI application used by Django's runserver. |
|
113 | 113 | WSGI_APPLICATION = 'abs_webapp_dev.wsgi.application' |
|
114 | 114 | |
|
115 | 115 | TEMPLATE_DIRS = ( |
|
116 | 116 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". |
|
117 | 117 | # Always use forward slashes, even on Windows. |
|
118 | 118 | # Don't forget to use absolute paths, not relative paths. |
|
119 | 119 | os.path.join(PROJECT_DIR, "templates").replace('\\', '/'), |
|
120 | 120 | os.path.join(PROJECT_DIR, "abscontrol", "templates").replace('\\', '/'), |
|
121 | 121 | ) |
|
122 | 122 | |
|
123 | 123 | TEMPLATE_CONTEXT_PROCESSORS = ( |
|
124 | 'django.core.context_processors.debug', | |
|
124 | #'django.core.context_processors.debug', | |
|
125 | 125 | 'django.core.context_processors.media', |
|
126 | 126 | 'django.core.context_processors.static', |
|
127 | 127 | 'django.contrib.auth.context_processors.auth', |
|
128 | 128 | ) |
|
129 | 129 | |
|
130 | 130 | INSTALLED_APPS = ( |
|
131 | 131 | 'django.contrib.auth', |
|
132 | 132 | 'django.contrib.contenttypes', |
|
133 | 133 | 'django.contrib.sessions', |
|
134 | 134 | 'django.contrib.sites', |
|
135 | 135 | 'django.contrib.messages', |
|
136 | 136 | 'django.contrib.staticfiles', |
|
137 | 137 | # Uncomment the next line to enable the admin: |
|
138 | 138 | 'django.contrib.admin', |
|
139 | 139 | # Uncomment the next line to enable admin documentation: |
|
140 | 140 | # 'django.contrib.admindocs', |
|
141 | 141 | 'abscontrol', |
|
142 | 142 | 'audit', |
|
143 | 143 | 'south', |
|
144 | 144 | ) |
|
145 | 145 | |
|
146 | 146 | # A sample logging configuration. The only tangible logging |
|
147 | 147 | # performed by this configuration is to send an email to |
|
148 | 148 | # the site admins on every HTTP 500 error when DEBUG=False. |
|
149 | 149 | # See http://docs.djangoproject.com/en/dev/topics/logging for |
|
150 | 150 | # more details on how to customize your logging configuration. |
|
151 | 151 | LOGGING = { |
|
152 | 152 | 'version': 1, |
|
153 | 153 | 'disable_existing_loggers': False, |
|
154 | 154 | 'filters': { |
|
155 | 155 | 'require_debug_false': { |
|
156 | 156 | '()': 'django.utils.log.RequireDebugFalse' |
|
157 | 157 | } |
|
158 | 158 | }, |
|
159 | 159 | 'handlers': { |
|
160 | 160 | 'mail_admins': { |
|
161 | 161 | 'level': 'ERROR', |
|
162 | 162 | 'filters': ['require_debug_false'], |
|
163 | 163 | 'class': 'django.utils.log.AdminEmailHandler' |
|
164 | 164 | } |
|
165 | 165 | }, |
|
166 | 166 | 'loggers': { |
|
167 | 167 | 'django.request': { |
|
168 | 168 | 'handlers': ['mail_admins'], |
|
169 | 169 | 'level': 'ERROR', |
|
170 | 170 | 'propagate': True, |
|
171 | 171 | }, |
|
172 | 172 | } |
|
173 | 173 | } |
@@ -1,264 +1,264 | |||
|
1 | 1 | {% extends "config/index.html" %} |
|
2 | 2 | {% load url from future %} |
|
3 | 3 | {% block title %}ABS CONTROL:::::NEW PROFILE{% endblock %} |
|
4 | 4 | {% block scripting %} |
|
5 | 5 | <script src="{{ STATIC_URL }}js/patterns.js"></script> |
|
6 | 6 | {% endblock %} |
|
7 | 7 | {% block maincolumn%} |
|
8 | 8 | <div id="maincolumn"> |
|
9 | <form action="{% url abscontrol.views.upgrade profile_id %}" method="post" id="frmPattern"> | |
|
9 | <form action="{% url 'abscontrol.views.upgrade' profile_id %}" method="post" id="frmPattern"> | |
|
10 | 10 | {% csrf_token %} |
|
11 | 11 | <div id="divProfile"> |
|
12 | 12 | <label for="lblName">Profile:</label> |
|
13 | 13 | <label for="lblName" class="lblProfile">{{ profile_name }}</label> |
|
14 | 14 | </div> |
|
15 | 15 | {% block mnuPattern %} |
|
16 | 16 | <div class="divMenu" id="divMnuPattern"> |
|
17 | 17 | <nav class="MnuHorizontal"> |
|
18 | 18 | <ul class="mnu" id="mnuPattern"> |
|
19 | 19 | <li><a href="#" id="lnkSavePattern">Save</a></li> |
|
20 | 20 | </ul> |
|
21 | 21 | </nav> |
|
22 | 22 | </div> |
|
23 | 23 | <div class="cleardivs"></div> |
|
24 | 24 | {% endblock %} |
|
25 | 25 | <div id="divPattern"> |
|
26 | 26 | <div id="antennaUp" class="NewAntenna"> |
|
27 | 27 | <fieldset class="NewFlsAntenna"> |
|
28 | 28 | <legend class="legendAntenna">UP</legend> |
|
29 | 29 | <div class="NewDivAntenna"> |
|
30 | 30 | <label for="lblAntenna" class="titleField">Antenna</label> |
|
31 | 31 | <div class="boxAntenna" id="divtxtAntenna"> |
|
32 | 32 | {% for i in range %} |
|
33 | 33 | <div class="fullLine"> |
|
34 | 34 | {% if i == 0 %} |
|
35 | 35 | <label for="lblSignLeft" class="lblSignLeft">[</label> |
|
36 | 36 | {% else %} |
|
37 | 37 | <label for="lblSignLeft" class="lblSignLeft"> </label> |
|
38 | 38 | {% endif %} |
|
39 | 39 | <div class="lineInputs"> |
|
40 | 40 | <label for="lblSign" class="lblSign">[</label> |
|
41 | 41 | <div class="divValuesAntenna"> |
|
42 | 42 | {% for j in range %} |
|
43 | 43 | <input type="text" name="txtUnitAntennaUp" class="txtUnitAntenna" id="txtUnitAntennaUp_{{ i }}_{{ j }}" value="0.5" maxlength="3" /> |
|
44 | 44 | {% if j != 7 %},{% endif %} |
|
45 | 45 | {% endfor %} |
|
46 | 46 | </div> |
|
47 | 47 | <label for="lblSign" class="lblSign">]</label> |
|
48 | 48 | </div> |
|
49 | 49 | {% if i == 7 %} |
|
50 | 50 | <label for="lblSignRight" class="lblSignRight">]</label> |
|
51 | 51 | {% else %} |
|
52 | 52 | <label for="lblSignRight" class="lblSignRight">,</label> |
|
53 | 53 | {% endif %} |
|
54 | 54 | </div> |
|
55 | 55 | <div class="cleardivs"></div> |
|
56 | 56 | {% endfor %} |
|
57 | 57 | </div> |
|
58 | 58 | </div> |
|
59 | 59 | <div class="NewDivTx"> |
|
60 | 60 | <label for="lblTx" class="titleField">Tx</label> |
|
61 | 61 | <div class="boxTR" id="divtxtTR"> |
|
62 | 62 | {% for i in range %} |
|
63 | 63 | <div class="fullLine"> |
|
64 | 64 | {% if i == 0 %} |
|
65 | 65 | <label for="lblNewSignLeft" class="lblNewSignLeft">[</label> |
|
66 | 66 | {% else %} |
|
67 | 67 | <label for="lblNewSignLeft" class="lblNewSignLeft"> </label> |
|
68 | 68 | {% endif %} |
|
69 | 69 | <div class="lineInputsTx"> |
|
70 | 70 | <label for="lblSign" class="lblSignTx">[</label> |
|
71 | 71 | <div class="divValuesTx"> |
|
72 | 72 | {% for j in range %} |
|
73 | 73 | <input type="text" name="txtUnitTxUp" class="txtUnitTx" id="txtUnitTxUp_{{ i }}_{{ j }}" value="1" maxlength="1" /> |
|
74 | 74 | {% if j != 7 %},{% endif %} |
|
75 | 75 | {% endfor %} |
|
76 | 76 | </div> |
|
77 | 77 | <label for="lblSign" class="lblSignTx">]</label> |
|
78 | 78 | </div> |
|
79 | 79 | {% if i == 7 %} |
|
80 | 80 | <label for="lblNewSignRight" class="lblNewSignRight">]</label> |
|
81 | 81 | {% else %} |
|
82 | 82 | <label for="lblNewSignRight" class="lblNewSignRight">,</label> |
|
83 | 83 | {% endif %} |
|
84 | 84 | </div> |
|
85 | 85 | <div class="cleardivs"></div> |
|
86 | 86 | {% endfor %} |
|
87 | 87 | </div> |
|
88 | 88 | <div class="cleardivs"></div> |
|
89 | 89 | </div> |
|
90 | 90 | <div class="NewDivTx"> |
|
91 | 91 | <label for="lblRx" class="titleField">Rx</label> |
|
92 | 92 | <div class="boxTR" id="divtxtTR"> |
|
93 | 93 | {% for i in range %} |
|
94 | 94 | <div class="fullLine"> |
|
95 | 95 | {% if i == 0 %} |
|
96 | 96 | <label for="lblNewSignLeft" class="lblNewSignLeft">[</label> |
|
97 | 97 | {% else %} |
|
98 | 98 | <label for="lblNewSignLeft" class="lblNewSignLeft"> </label> |
|
99 | 99 | {% endif %} |
|
100 | 100 | <div class="lineInputsTx"> |
|
101 | 101 | <label for="lblSign" class="lblSignTx">[</label> |
|
102 | 102 | <div class="divValuesTx"> |
|
103 | 103 | {% for j in range %} |
|
104 | 104 | <input type="text" name="txtUnitRxUp" class="txtUnitRx" id="txtUnitRxUp_{{ i }}_{{ j }}" value="0" maxlength="1" /> |
|
105 | 105 | {% if j != 7 %},{% endif %} |
|
106 | 106 | {% endfor %} |
|
107 | 107 | </div> |
|
108 | 108 | <label for="lblSign" class="lblSignTx">]</label> |
|
109 | 109 | </div> |
|
110 | 110 | {% if i == 7 %} |
|
111 | 111 | <label for="lblNewSignRight" class="lblNewSignRight">]</label> |
|
112 | 112 | {% else %} |
|
113 | 113 | <label for="lblNewSignRight" class="lblNewSignRight">,</label> |
|
114 | 114 | {% endif %} |
|
115 | 115 | </div> |
|
116 | 116 | <div class="cleardivs"></div> |
|
117 | 117 | {% endfor %} |
|
118 | 118 | </div> |
|
119 | 119 | <div class="cleardivs"></div> |
|
120 | 120 | </div> |
|
121 | 121 | <div class="cleardivs"></div> |
|
122 | 122 | <div class="divNewUes"> |
|
123 | 123 | <label for="lblUes" class="titleUes">Ues:</label> |
|
124 | 124 | <div class="valueUes"> |
|
125 | 125 | <label for="lblUes">[</label> |
|
126 | 126 | {% for element in arrayUes %} |
|
127 | 127 | <input type="text" name="unitUesUp_{{ forloop.counter }}" value="{{ element }}" maxlength="8" class="txtUnitUes" /> |
|
128 | 128 | {% if not forloop.last %},{% endif %} |
|
129 | 129 | {% endfor %} |
|
130 | 130 | <label for="lblUes">]</label> |
|
131 | 131 | </div> |
|
132 | 132 | </div> |
|
133 | 133 | <div class="checkOnly"> |
|
134 | 134 | <input type="checkbox" name="chkOnlyRxUp" value="" /> |
|
135 | 135 | <label for="lblOnlyRx">Only Rx</label> |
|
136 | 136 | </div> |
|
137 | 137 | </fieldset> |
|
138 | 138 | <input type="hidden" name="txtAntennaUp" value="" /> |
|
139 | 139 | <input type="hidden" name="txtTxUp" value="" /> |
|
140 | 140 | <input type="hidden" name="txtRxUp" value="" /> |
|
141 | 141 | <input type="hidden" name="txtUesUp" value="" /> |
|
142 | 142 | </div> |
|
143 | 143 | <div id="antennaDown" class="NewAntenna"> |
|
144 | 144 | <fieldset class="NewFlsAntenna"> |
|
145 | 145 | <legend class="legendAntenna">DOWN</legend> |
|
146 | 146 | <div class="NewDivAntenna"> |
|
147 | 147 | <label for="lblAntenna" class="titleField">Antenna</label> |
|
148 | 148 | <div class="boxAntenna" id="divtxtAntenna"> |
|
149 | 149 | {% for i in range %} |
|
150 | 150 | <div class="fullLine"> |
|
151 | 151 | {% if i == 0 %} |
|
152 | 152 | <label for="lblSignLeft" class="lblSignLeft">[</label> |
|
153 | 153 | {% else %} |
|
154 | 154 | <label for="lblSignLeft" class="lblSignLeft"> </label> |
|
155 | 155 | {% endif %} |
|
156 | 156 | <div class="lineInputs"> |
|
157 | 157 | <label for="lblSign" class="lblSign">[</label> |
|
158 | 158 | <div class="divValuesAntenna"> |
|
159 | 159 | {% for j in range %} |
|
160 | 160 | <input type="text" name="txtUnitAntennaDown" class="txtUnitAntenna" id="txtUnitAntennaDown_{{ i }}_{{ j }}" value="0.5" maxlength="3" /> |
|
161 | 161 | {% if j != 7 %},{% endif %} |
|
162 | 162 | {% endfor %} |
|
163 | 163 | </div> |
|
164 | 164 | <label for="lblSign" class="lblSign">]</label> |
|
165 | 165 | </div> |
|
166 | 166 | {% if i == 7 %} |
|
167 | 167 | <label for="lblSignRight" class="lblSignRight">]</label> |
|
168 | 168 | {% else %} |
|
169 | 169 | <label for="lblSignRight" class="lblSignRight">,</label> |
|
170 | 170 | {% endif %} |
|
171 | 171 | </div> |
|
172 | 172 | <div class="cleardivs"></div> |
|
173 | 173 | {% endfor %} |
|
174 | 174 | </div> |
|
175 | 175 | </div> |
|
176 | 176 | <div class="NewDivTx"> |
|
177 | 177 | <label for="lblTx" class="titleField">Tx</label> |
|
178 | 178 | <div class="boxTR" id="divtxtTR"> |
|
179 | 179 | {% for i in range %} |
|
180 | 180 | <div class="fullLine"> |
|
181 | 181 | {% if i == 0 %} |
|
182 | 182 | <label for="lblNewSignLeft" class="lblNewSignLeft">[</label> |
|
183 | 183 | {% else %} |
|
184 | 184 | <label for="lblNewSignLeft" class="lblNewSignLeft"> </label> |
|
185 | 185 | {% endif %} |
|
186 | 186 | <div class="lineInputsTx"> |
|
187 | 187 | <label for="lblSign" class="lblSignTx">[</label> |
|
188 | 188 | <div class="divValuesTx"> |
|
189 | 189 | {% for j in range %} |
|
190 | 190 | <input type="text" name="txtUnitTxDown" class="txtUnitTx" id="txtUnitTxDown_{{ i }}_{{ j }}" value="1" maxlength="1" /> |
|
191 | 191 | {% if j != 7 %},{% endif %} |
|
192 | 192 | {% endfor %} |
|
193 | 193 | </div> |
|
194 | 194 | <label for="lblSign" class="lblSignTx">]</label> |
|
195 | 195 | </div> |
|
196 | 196 | {% if i == 7 %} |
|
197 | 197 | <label for="lblNewSignRight" class="lblNewSignRight">]</label> |
|
198 | 198 | {% else %} |
|
199 | 199 | <label for="lblNewSignRight" class="lblNewSignRight">,</label> |
|
200 | 200 | {% endif %} |
|
201 | 201 | </div> |
|
202 | 202 | <div class="cleardivs"></div> |
|
203 | 203 | {% endfor %} |
|
204 | 204 | </div> |
|
205 | 205 | <div class="cleardivs"></div> |
|
206 | 206 | </div> |
|
207 | 207 | <div class="NewDivTx"> |
|
208 | 208 | <label for="lblRx" class="titleField">Rx</label> |
|
209 | 209 | <div class="boxTR" id="divtxtTR"> |
|
210 | 210 | {% for i in range %} |
|
211 | 211 | <div class="fullLine"> |
|
212 | 212 | {% if i == 0 %} |
|
213 | 213 | <label for="lblNewSignLeft" class="lblNewSignLeft">[</label> |
|
214 | 214 | {% else %} |
|
215 | 215 | <label for="lblNewSignLeft" class="lblNewSignLeft"> </label> |
|
216 | 216 | {% endif %} |
|
217 | 217 | <div class="lineInputsTx"> |
|
218 | 218 | <label for="lblSign" class="lblSignTx">[</label> |
|
219 | 219 | <div class="divValuesTx"> |
|
220 | 220 | {% for j in range %} |
|
221 | 221 | <input type="text" name="txtUnitRxDown" class="txtUnitRx" id="txtUnitRxDown_{{ i }}_{{ j }}" value="0" /> |
|
222 | 222 | {% if j != 7 %},{% endif %} |
|
223 | 223 | {% endfor %} |
|
224 | 224 | </div> |
|
225 | 225 | <label for="lblSign" class="lblSignTx">]</label> |
|
226 | 226 | </div> |
|
227 | 227 | {% if i == 7 %} |
|
228 | 228 | <label for="lblNewSignRight" class="lblNewSignRight">]</label> |
|
229 | 229 | {% else %} |
|
230 | 230 | <label for="lblNewSignRight" class="lblNewSignRight">,</label> |
|
231 | 231 | {% endif %} |
|
232 | 232 | </div> |
|
233 | 233 | <div class="cleardivs"></div> |
|
234 | 234 | {% endfor %} |
|
235 | 235 | </div> |
|
236 | 236 | <div class="cleardivs"></div> |
|
237 | 237 | </div> |
|
238 | 238 | <div class="cleardivs"></div> |
|
239 | 239 | <div class="divNewUes"> |
|
240 | 240 | <label for="lblUes" class="titleUes">Ues:</label> |
|
241 | 241 | <div class="valueUes"> |
|
242 | 242 | <label for="lblUes">[</label> |
|
243 | 243 | {% for element in arrayUes %} |
|
244 | 244 | <input type="text" name="unitUesDown_{{ forloop.counter }}" value="{{ element }}" maxlength="8" class="txtUnitUes" /> |
|
245 | 245 | {% if not forloop.last %},{% endif %} |
|
246 | 246 | {% endfor %} |
|
247 | 247 | <label for="lblUes">]</label> |
|
248 | 248 | </div> |
|
249 | 249 | </div> |
|
250 | 250 | <div class="checkOnly"> |
|
251 | 251 | <input type="checkbox" name="chkOnlyRxDown" value="" /> |
|
252 | 252 | <label for="lblOnlyRx">Only Rx</label> |
|
253 | 253 | </div> |
|
254 | 254 | </fieldset> |
|
255 | 255 | <input type="hidden" name="txtAntennaDown" value="" /> |
|
256 | 256 | <input type="hidden" name="txtTxDown" value="" /> |
|
257 | 257 | <input type="hidden" name="txtRxDown" value="" /> |
|
258 | 258 | <input type="hidden" name="txtUesDown" value="" /> |
|
259 | 259 | </div> |
|
260 | 260 | </div> |
|
261 | 261 | <input type="hidden" name="mode" value="e"> |
|
262 | 262 | </form> |
|
263 | 263 | </div> |
|
264 | 264 | {% endblock %} |
@@ -1,28 +1,28 | |||
|
1 | 1 | from django.conf.urls import patterns, url |
|
2 | 2 | |
|
3 | 3 | urlpatterns = patterns('abscontrol.views', |
|
4 | 4 | url(r'^$', 'index'), |
|
5 | url(r'^new/$', 'new'), | |
|
6 | url(r'^save/$', 'save'), | |
|
7 | url(r'^view/(?P<profile_id>\d+)/$', 'view'), | |
|
8 | url(r'^edit/(?P<profile_id>\d+)/$', 'edit'), | |
|
9 | url(r'^update/(?P<profile_id>\d+)/$', 'update'), | |
|
10 | url(r'^upgrade/(?P<profile_id>\d+)/$', 'upgrade'), | |
|
5 | url(r'^new/$', 'new', name="new"), | |
|
6 | url(r'^save/$', 'save', name="save"), | |
|
7 | url(r'^view/(?P<profile_id>\d+)/$', 'view', name="view"), | |
|
8 | url(r'^edit/(?P<profile_id>\d+)/$', 'edit', name="edit"), | |
|
9 | url(r'^update/(?P<profile_id>\d+)/$', 'update', name="update"), | |
|
10 | url(r'^upgrade/(?P<profile_id>\d+)/$', 'upgrade', name="upgrade"), | |
|
11 | 11 | url(r'^changeName/(?P<profile_id>\d+)/$', 'changeName'), |
|
12 | 12 | #url(r'^(?P<profile_id>\d+)/$', 'detail'), |
|
13 | 13 | url(r'^(?P<profile_id>\d+)/add/$', 'addPattern'), |
|
14 | 14 | url(r'^(?P<profile_id>\d+)/save/$', 'savePattern'), |
|
15 | 15 | url(r'^(?P<profile_id>\d+)/edit/(?P<pattern_id>\d+)/$', 'editPattern'), |
|
16 | 16 | url(r'^(?P<profile_id>\d+)/view/(?P<pattern_id>\d+)/$', 'viewPattern'), |
|
17 | 17 | url(r'^(?P<profile_id>\d+)/delete/(?P<pattern_id>\d+)/$', 'deletePattern'), |
|
18 | 18 | #url(r'^(?P<poll_id>\d+)/results/$', 'results'), |
|
19 | 19 | #url(r'^(?P<poll_id>\d+)/vote/$', 'vote'), |
|
20 | 20 | url(r'^import/$', 'importProfile'), |
|
21 | 21 | url(r'^upload/$', 'upload'), |
|
22 | 22 | #url(r'^saveImport/$', 'saveImport'), |
|
23 | 23 | url(r'^(?P<profile_id>\d+)/(?P<pattern_id>\d+)/overjroUp/(?P<antenna_id>\d+)/$', 'overJROUp'), |
|
24 | 24 | url(r'^(?P<profile_id>\d+)/(?P<pattern_id>\d+)/overjroDown/(?P<antenna_id>\d+)/$', 'overJRODown'), |
|
25 | 25 | url(r'^export/(?P<profile_id>\d+)/$', 'export'), |
|
26 | 26 | url(r'^send/(?P<profile_id>\d+)/$', 'send'), |
|
27 | 27 | url(r'^change/(?P<profile_id>\d+)/(?P<pattern_id>\d+)/$', 'changePattern'), |
|
28 | 28 | ) No newline at end of file |
@@ -1,564 +1,564 | |||
|
1 | 1 | from django.shortcuts import render_to_response, redirect |
|
2 | 2 | from django.http import HttpResponse |
|
3 | 3 | from django.conf import settings |
|
4 | 4 | from django.utils.encoding import smart_str |
|
5 | 5 | from django.core.servers.basehttp import FileWrapper |
|
6 | 6 | import mimetypes |
|
7 | 7 | from django.contrib.auth.decorators import login_required |
|
8 | 8 | from django.template import RequestContext |
|
9 | 9 | |
|
10 | 10 | from datetime import datetime |
|
11 | 11 | import os |
|
12 | 12 | from abscontrol.models import Profile, Pattern, AntennaDown, AntennaUp |
|
13 | 13 | |
|
14 | 14 | from util.readABSFile import readABSFile |
|
15 | 15 | from util.saveABSFile import saveABSFile |
|
16 | 16 | from util.ABSData import ABSData |
|
17 | 17 | from util.OverJRO import OverJRO |
|
18 | 18 | from scripts.sendFile import sendFile |
|
19 | 19 | from scripts.changeBeam import changeBeam |
|
20 | 20 | from overJroShow import overJroShow |
|
21 | 21 | |
|
22 | 22 | arrayTx = [["0","0","0","0","0","0","0","0"],\ |
|
23 | 23 | ["0","0","0","0","0","0","0","0"],\ |
|
24 | 24 | ["0","0","0","0","0","0","0","0"],\ |
|
25 | 25 | ["0","0","0","0","0","0","0","0"],\ |
|
26 | 26 | ["0","0","0","0","0","0","0","0"],\ |
|
27 | 27 | ["0","0","0","0","0","0","0","0"],\ |
|
28 | 28 | ["0","0","0","0","0","0","0","0"],\ |
|
29 | 29 | ["0","0","0","0","0","0","0","0"]] |
|
30 | 30 | |
|
31 | 31 | arrayUes = ["0.533333","0.00000","1.06667","0.00000"] |
|
32 | 32 | |
|
33 | 33 | @login_required(login_url='/accounts/login/') |
|
34 | 34 | def index(request): |
|
35 | 35 | #latest_poll_list = profileAntenna.objects.all().order_by('-pub_date')[:5] |
|
36 | 36 | profile_list = Profile.objects.filter(state=1) |
|
37 | 37 | return render_to_response('config/index.html', {'profile_list': profile_list}, context_instance=RequestContext(request)) |
|
38 | 38 | |
|
39 | 39 | def new(request): |
|
40 | 40 | profile_list = Profile.objects.filter(state=1) |
|
41 | 41 | txtProfile = datetime.now().strftime("%Y%m%d%H%M%S%f") |
|
42 |
new |
|
|
43 |
new |
|
|
42 | newProfile = Profile(name=txtProfile) | |
|
43 | newProfile.save() | |
|
44 | 44 | |
|
45 | 45 | lsPatterns = None |
|
46 | 46 | |
|
47 | 47 | return render_to_response('config/new.html', {'profile_list': profile_list, |
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
|
48 | 'profile_name' : newProfile.name, | |
|
49 | 'profile_id' : newProfile.id, | |
|
50 | 'lsPatterns' : lsPatterns, | |
|
51 | 'range' : range(8), 'arrayUes' : arrayUes, | |
|
52 | }, context_instance=RequestContext(request)) | |
|
53 | 53 | |
|
54 | 54 | def save(request): |
|
55 | 55 | |
|
56 | 56 | txtProfile = request.POST["txtProfile"] |
|
57 | 57 | |
|
58 | 58 | txtAntennaUp = request.POST["txtAntennaUp"] |
|
59 | 59 | txtTxUp = request.POST["txtTxUp"] |
|
60 | 60 | txtRxUp = request.POST["txtRxUp"] |
|
61 | 61 | txtUesUp = request.POST["txtUesUp"] |
|
62 | 62 | |
|
63 | 63 | txtAntennaDown = request.POST["txtAntennaDown"] |
|
64 | 64 | txtTxDown = request.POST["txtTxDown"] |
|
65 | 65 | txtRxDown = request.POST["txtRxDown"] |
|
66 | 66 | txtUesDown = request.POST["txtUesDown"] |
|
67 | 67 | |
|
68 | 68 | newprofile = Profile(name=txtProfile) |
|
69 | 69 | newprofile.save() |
|
70 | 70 | |
|
71 | 71 | newpattern = newprofile.pattern_set.create(value=1) |
|
72 | 72 | newpattern.antennaup_set.create(value=txtAntennaUp,tx=txtTxUp,rx=txtRxUp,ues=txtUesUp) |
|
73 | 73 | newpattern.antennadown_set.create(value=txtAntennaDown,tx=txtTxDown,rx=txtRxDown,ues=txtUesDown) |
|
74 | 74 | |
|
75 | 75 | newurl = '/abscontrol/view/%d' % newprofile.id |
|
76 | 76 | |
|
77 | 77 | return redirect(newurl) |
|
78 | 78 | |
|
79 | 79 | # Update temporal experiment |
|
80 | 80 | def upgrade(request, profile_id): |
|
81 | 81 | txtAntennaUp = request.POST["txtAntennaUp"] |
|
82 | 82 | txtTxUp = request.POST["txtTxUp"] |
|
83 | 83 | txtRxUp = request.POST["txtRxUp"] |
|
84 | 84 | txtUesUp = request.POST["txtUesUp"] |
|
85 | 85 | |
|
86 | 86 | txtAntennaDown = request.POST["txtAntennaDown"] |
|
87 | 87 | txtTxDown = request.POST["txtTxDown"] |
|
88 | 88 | txtRxDown = request.POST["txtRxDown"] |
|
89 | 89 | txtUesDown = request.POST["txtUesDown"] |
|
90 | 90 | |
|
91 | 91 | objProfile = Profile.objects.get(pk=profile_id) |
|
92 | 92 | newpattern = objProfile.pattern_set.create(value=1) |
|
93 | 93 | newpattern.antennaup_set.create(value=txtAntennaUp,tx=txtTxUp,rx=txtRxUp,ues=txtUesUp) |
|
94 | 94 | newpattern.antennadown_set.create(value=txtAntennaDown,tx=txtTxDown,rx=txtRxDown,ues=txtUesDown) |
|
95 | 95 | |
|
96 | 96 | newurl = '/abscontrol/%d/edit/%d' % (int(profile_id), newpattern.id) |
|
97 | 97 | return redirect(newurl) |
|
98 | 98 | |
|
99 | 99 | def update(request, profile_id): |
|
100 | 100 | txtProfile = request.POST["txtProfile"] |
|
101 | 101 | |
|
102 | 102 | objProfile = Profile.objects.get(pk=profile_id) |
|
103 | 103 | objProfile.name = txtProfile |
|
104 | 104 | objProfile.state = 1 |
|
105 | 105 | objProfile.save() |
|
106 | 106 | |
|
107 | 107 | newurl = '/abscontrol/view/%d' % objProfile.id |
|
108 | 108 | return redirect(newurl) |
|
109 | 109 | |
|
110 | 110 | def changeName(request, profile_id): |
|
111 | 111 | profile_list = Profile.objects.filter(state=1) |
|
112 | 112 | objProfile = Profile.objects.get(pk=profile_id) |
|
113 | 113 | lsPatterns = objProfile.pattern_set.all() |
|
114 | 114 | |
|
115 | 115 | return render_to_response('config/changeName.html', {'profile_list': profile_list, |
|
116 | 116 | 'objProfile': objProfile, |
|
117 | 117 | 'lsPatterns' : lsPatterns, |
|
118 | 118 | }, context_instance=RequestContext(request)) |
|
119 | 119 | |
|
120 | 120 | def view(request, profile_id): |
|
121 | 121 | objProfileActive = None |
|
122 | 122 | objPatternActive = None |
|
123 | 123 | |
|
124 | 124 | if request.method == 'GET' and 'pattern' in request.GET: |
|
125 | 125 | pattern_value = request.GET["pattern"] |
|
126 | 126 | else: |
|
127 | 127 | pattern_value = 1 |
|
128 | 128 | |
|
129 | 129 | profile_list = Profile.objects.filter(state=1) |
|
130 | 130 | objProfile = Profile.objects.get(pk=profile_id) |
|
131 | 131 | |
|
132 | 132 | lsPatterns = objProfile.pattern_set.all() |
|
133 | 133 | patternChoosen = objProfile.pattern_set.get(value=pattern_value) |
|
134 | 134 | objAntennaUp = patternChoosen.antennaup_set.get() |
|
135 | 135 | objAntennaDown = patternChoosen.antennadown_set.get() |
|
136 | 136 | |
|
137 | 137 | lsProfilesActive = Profile.objects.filter(is_active=1) |
|
138 | 138 | if len(lsProfilesActive) > 0: |
|
139 | 139 | objProfileActive = Profile.objects.get(is_active=1) |
|
140 | 140 | |
|
141 | 141 | lsPatternsActive = Pattern.objects.filter(is_active=1) |
|
142 | 142 | if len(lsPatternsActive) > 0: |
|
143 | 143 | objPatternActive = Pattern.objects.get(is_active=1) |
|
144 | 144 | |
|
145 | 145 | return render_to_response('config/view.html', {'objProfile': objProfile, 'profile_list': profile_list, |
|
146 | 146 | 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, |
|
147 | 147 | 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, |
|
148 | 148 | 'profileActive' : objProfileActive, 'patternActive' : objPatternActive, |
|
149 | 149 | }, context_instance=RequestContext(request)) |
|
150 | 150 | |
|
151 | 151 | def edit(request, profile_id): |
|
152 | 152 | if request.method == 'GET' and 'pattern' in request.GET: |
|
153 | 153 | pattern_value = request.GET["pattern"] |
|
154 | 154 | else: |
|
155 | 155 | pattern_value = 1 |
|
156 | 156 | |
|
157 | 157 | absData = ABSData() |
|
158 | 158 | profile_list = Profile.objects.filter(state=1) |
|
159 | 159 | objProfile = Profile.objects.get(pk=profile_id) |
|
160 | 160 | |
|
161 | 161 | lsPatterns = objProfile.pattern_set.all() |
|
162 | 162 | patternChoosen = objProfile.pattern_set.get(value=pattern_value) |
|
163 | 163 | objAntennaUp = patternChoosen.antennaup_set.get() |
|
164 | 164 | objAntennaDown = patternChoosen.antennadown_set.get() |
|
165 | 165 | |
|
166 | 166 | arrayAntennaUp = absData.convertStringtoList2(objAntennaUp.value) |
|
167 | 167 | if objAntennaUp.tx != None: |
|
168 | 168 | arrayTxUp = absData.convertStringtoList2(objAntennaUp.tx) |
|
169 | 169 | else: |
|
170 | 170 | arrayTxUp = arrayTx |
|
171 | 171 | if objAntennaUp.rx != None: |
|
172 | 172 | arrayRxUp = absData.convertStringtoList2(objAntennaUp.rx) |
|
173 | 173 | else: |
|
174 | 174 | arrayRxUp = arrayTx |
|
175 | 175 | if objAntennaUp.ues != None: |
|
176 | 176 | arrayUesUp = absData.convertStringtoList1(objAntennaUp.ues) |
|
177 | 177 | else: |
|
178 | 178 | arrayUesUp = arrayUes |
|
179 | 179 | |
|
180 | 180 | arrayAntennaDown = absData.convertStringtoList2(objAntennaDown.value) |
|
181 | 181 | if objAntennaDown.tx != None: |
|
182 | 182 | arrayTxDown = absData.convertStringtoList2(objAntennaDown.tx) |
|
183 | 183 | else: |
|
184 | 184 | arrayTxDown = arrayTx |
|
185 | 185 | if objAntennaDown.rx != None: |
|
186 | 186 | arrayRxDown = absData.convertStringtoList2(objAntennaDown.rx) |
|
187 | 187 | else: |
|
188 | 188 | arrayRxDown = arrayTx |
|
189 | 189 | if objAntennaDown.ues != None: |
|
190 | 190 | arrayUesDown = absData.convertStringtoList1(objAntennaDown.ues) |
|
191 | 191 | else: |
|
192 | 192 | arrayUesDown = arrayUes |
|
193 | 193 | |
|
194 | 194 | return render_to_response('config/edit.html', {'objProfile': objProfile, 'profile_list': profile_list, |
|
195 | 195 | 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, |
|
196 | 196 | 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, |
|
197 | 197 | 'arrayAntennaUp' : arrayAntennaUp, 'arrayTxUp' : arrayTxUp, |
|
198 | 198 | 'arrayRxUp' : arrayRxUp, 'arrayRxDown' : arrayRxDown, |
|
199 | 199 | 'arrayAntennaDown' : arrayAntennaDown, 'arrayTxDown' : arrayTxDown, |
|
200 | 200 | 'arrayUesUp' : arrayUesUp, 'arrayUesDown' : arrayUesDown, |
|
201 | 201 | }, context_instance=RequestContext(request)) |
|
202 | 202 | |
|
203 | 203 | def addPattern(request, profile_id): |
|
204 | 204 | profile_list = Profile.objects.filter(state=1) |
|
205 | 205 | objProfile = Profile.objects.get(pk=profile_id) |
|
206 | 206 | |
|
207 | 207 | return render_to_response('config/addPattern.html', {'objProfile': objProfile, 'profile_list': profile_list, |
|
208 | 208 | 'range' : range(8), 'arrayUes' : arrayUes, |
|
209 | 209 | }, context_instance=RequestContext(request)) |
|
210 | 210 | |
|
211 | 211 | def editPattern(request, profile_id, pattern_id): |
|
212 | 212 | absData = ABSData() |
|
213 | 213 | profile_list = Profile.objects.filter(state=1) |
|
214 | 214 | objProfile = Profile.objects.get(pk=profile_id) |
|
215 | 215 | lsPatterns = objProfile.pattern_set.all() |
|
216 | 216 | patternChoosen = Pattern.objects.get(pk=pattern_id) |
|
217 | 217 | objAntennaUp = patternChoosen.antennaup_set.get() |
|
218 | 218 | objAntennaDown = patternChoosen.antennadown_set.get() |
|
219 | 219 | |
|
220 | 220 | arrayAntennaUp = absData.convertStringtoList2(objAntennaUp.value) |
|
221 | 221 | if objAntennaUp.tx != None: |
|
222 | 222 | arrayTxUp = absData.convertStringtoList2(objAntennaUp.tx) |
|
223 | 223 | else: |
|
224 | 224 | arrayTxUp = arrayTx |
|
225 | 225 | if objAntennaUp.rx != None: |
|
226 | 226 | arrayRxUp = absData.convertStringtoList2(objAntennaUp.rx) |
|
227 | 227 | else: |
|
228 | 228 | arrayRxUp = arrayTx |
|
229 | 229 | if objAntennaUp.ues != None: |
|
230 | 230 | arrayUesUp = absData.convertStringtoList1(objAntennaUp.ues) |
|
231 | 231 | else: |
|
232 | 232 | arrayUesUp = arrayUes |
|
233 | 233 | |
|
234 | 234 | arrayAntennaDown = absData.convertStringtoList2(objAntennaDown.value) |
|
235 | 235 | if objAntennaDown.tx != None: |
|
236 | 236 | arrayTxDown = absData.convertStringtoList2(objAntennaDown.tx) |
|
237 | 237 | else: |
|
238 | 238 | arrayTxDown = arrayTx |
|
239 | 239 | if objAntennaDown.rx != None: |
|
240 | 240 | arrayRxDown = absData.convertStringtoList2(objAntennaDown.rx) |
|
241 | 241 | else: |
|
242 | 242 | arrayRxDown = arrayTx |
|
243 | 243 | if objAntennaDown.ues != None: |
|
244 | 244 | arrayUesDown = absData.convertStringtoList1(objAntennaDown.ues) |
|
245 | 245 | else: |
|
246 | 246 | arrayUesDown = arrayUes |
|
247 | 247 | |
|
248 | 248 | return render_to_response('config/editPattern.html', {'objProfile': objProfile, 'profile_list': profile_list, |
|
249 | 249 | 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, |
|
250 | 250 | 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, |
|
251 | 251 | 'arrayAntennaUp' : arrayAntennaUp, 'arrayTxUp' : arrayTxUp, |
|
252 | 252 | 'arrayRxUp' : arrayRxUp, 'arrayRxDown' : arrayRxDown, |
|
253 | 253 | 'arrayAntennaDown' : arrayAntennaDown, 'arrayTxDown' : arrayTxDown, |
|
254 | 254 | 'arrayUesUp' : arrayUesUp, 'arrayUesDown' : arrayUesDown, |
|
255 | 255 | }, context_instance=RequestContext(request)) |
|
256 | 256 | |
|
257 | 257 | def savePattern(request, profile_id): |
|
258 | 258 | pattern_id = 0 |
|
259 | 259 | method = "save" |
|
260 | 260 | |
|
261 | 261 | if 'pattern_id' in request.POST: |
|
262 | 262 | pattern_id = request.POST["pattern_id"] |
|
263 | 263 | method = "update" |
|
264 | 264 | |
|
265 | 265 | maxValuePattern = 0 |
|
266 | 266 | txtAntennaUp = request.POST["txtAntennaUp"] |
|
267 | 267 | txtTxUp = request.POST["txtTxUp"] |
|
268 | 268 | txtRxUp = request.POST["txtRxUp"] |
|
269 | 269 | txtUesUp = request.POST["txtUesUp"] |
|
270 | 270 | if "chkOnlyRxUp" in request.POST: |
|
271 | 271 | chkOnlyRxUp = request.POST["chkOnlyRxUp"] |
|
272 | 272 | else: |
|
273 | 273 | chkOnlyRxUp = 0 |
|
274 | 274 | |
|
275 | 275 | txtAntennaDown = request.POST["txtAntennaDown"] |
|
276 | 276 | txtTxDown = request.POST["txtTxDown"] |
|
277 | 277 | txtRxDown = request.POST["txtRxDown"] |
|
278 | 278 | txtUesDown = request.POST["txtUesDown"] |
|
279 | 279 | if "chkOnlyRxDown" in request.POST: |
|
280 | 280 | chkOnlyRxDown = request.POST["chkOnlyRxDown"] |
|
281 | 281 | else: |
|
282 | 282 | chkOnlyRxDown = 0 |
|
283 | 283 | |
|
284 | 284 | mode = request.POST["mode"] |
|
285 | 285 | |
|
286 | 286 | if method == "save": |
|
287 | 287 | objProfile = Profile.objects.get(pk=profile_id) |
|
288 | 288 | lsPatterns = objProfile.pattern_set.all() |
|
289 | 289 | if len(lsPatterns) > 0: |
|
290 | 290 | for element in lsPatterns: |
|
291 | 291 | if element.value > maxValuePattern: |
|
292 | 292 | maxPattern = element.value |
|
293 | 293 | else: |
|
294 | 294 | maxPattern = 0 |
|
295 | 295 | |
|
296 | 296 | if maxPattern < 10 : |
|
297 | 297 | newValuePattern = maxPattern + 1 |
|
298 | 298 | newpattern = objProfile.pattern_set.create(value=newValuePattern) |
|
299 | 299 | newpattern.antennaup_set.create(value=txtAntennaUp,tx=txtTxUp,rx=txtRxUp,ues=txtUesUp,only_rx=chkOnlyRxUp) |
|
300 | 300 | newpattern.antennadown_set.create(value=txtAntennaDown,tx=txtTxDown,rx=txtRxDown,ues=txtUesDown,only_rx=chkOnlyRxDown) |
|
301 | 301 | error = 0 |
|
302 | 302 | else: |
|
303 | 303 | error = 1 # Can not add more patterns |
|
304 | 304 | |
|
305 | 305 | if mode == "e": |
|
306 | 306 | newurl = '/abscontrol/%d/edit/%d' % (int(profile_id), newpattern.id) |
|
307 | 307 | else: |
|
308 | 308 | newurl = '/abscontrol/%d/view/%d' % (int(profile_id), newpattern.id) |
|
309 | 309 | else: |
|
310 | 310 | txtAntennaUpId = request.POST["txtAntennaUpId"] |
|
311 | 311 | objAntennaUp = AntennaUp.objects.get(pk=txtAntennaUpId) |
|
312 | 312 | objAntennaUp.value = txtAntennaUp |
|
313 | 313 | objAntennaUp.tx = txtTxUp |
|
314 | 314 | objAntennaUp.rx = txtRxUp |
|
315 | 315 | objAntennaUp.ues = txtUesUp |
|
316 | 316 | objAntennaUp.only_rx = chkOnlyRxUp |
|
317 | 317 | objAntennaUp.save() |
|
318 | 318 | |
|
319 | 319 | txtAntennaDownId = request.POST["txtAntennaDownId"] |
|
320 | 320 | objAntennaDown = AntennaDown.objects.get(pk=txtAntennaDownId) |
|
321 | 321 | objAntennaDown.value = txtAntennaDown |
|
322 | 322 | objAntennaDown.tx = txtTxDown |
|
323 | 323 | objAntennaDown.rx = txtRxDown |
|
324 | 324 | objAntennaDown.ues = txtUesDown |
|
325 | 325 | objAntennaDown.only_rx = chkOnlyRxDown |
|
326 | 326 | objAntennaDown.save() |
|
327 | 327 | |
|
328 | 328 | if mode == "e": |
|
329 | 329 | newurl = '/abscontrol/%d/edit/%d' % (int(profile_id), int(pattern_id)) |
|
330 | 330 | else: |
|
331 | 331 | newurl = '/abscontrol/%d/view/%d' % (int(profile_id), int(pattern_id)) |
|
332 | 332 | |
|
333 | 333 | return redirect(newurl) |
|
334 | 334 | |
|
335 | 335 | def viewPattern(request, profile_id, pattern_id): |
|
336 | 336 | objProfileActive = None |
|
337 | 337 | objPatternActive = None |
|
338 | 338 | |
|
339 | 339 | profile_list = Profile.objects.filter(state=1) |
|
340 | 340 | objProfile = Profile.objects.get(pk=profile_id) |
|
341 | 341 | |
|
342 | 342 | patternChoosen = Pattern.objects.get(pk=pattern_id) |
|
343 | 343 | |
|
344 | 344 | objAntennaUp = patternChoosen.antennaup_set.get() |
|
345 | 345 | objAntennaDown = patternChoosen.antennadown_set.get() |
|
346 | 346 | |
|
347 | 347 | lsPatterns = objProfile.pattern_set.all() |
|
348 | 348 | |
|
349 | 349 | lsProfilesActive = Profile.objects.filter(is_active=1) |
|
350 | 350 | if len(lsProfilesActive) > 0: |
|
351 | 351 | objProfileActive = Profile.objects.get(is_active=1) |
|
352 | 352 | |
|
353 | 353 | lsPatternsActive = Pattern.objects.filter(is_active=1) |
|
354 | 354 | if len(lsPatternsActive) > 0: |
|
355 | 355 | objPatternActive = Pattern.objects.get(is_active=1) |
|
356 | 356 | |
|
357 | 357 | return render_to_response('config/viewPattern.html', {'objProfile': objProfile, 'profile_list': profile_list, |
|
358 | 358 | 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, |
|
359 | 359 | 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, |
|
360 | 360 | 'profileActive' : objProfileActive, 'patternActive' : objPatternActive, |
|
361 | 361 | }, context_instance=RequestContext(request)) |
|
362 | 362 | |
|
363 | 363 | def deletePattern(request, profile_id, pattern_id): |
|
364 | 364 | newurl = '/abscontrol/edit/%d' % int(profile_id) |
|
365 | 365 | |
|
366 | 366 | return redirect(newurl) |
|
367 | 367 | |
|
368 | 368 | def importProfile(request): |
|
369 | 369 | profile_list = Profile.objects.filter(state=1) |
|
370 | 370 | return render_to_response('config/import.html', {'profile_list': profile_list,}, context_instance=RequestContext(request)) |
|
371 | 371 | |
|
372 | 372 | def upload(request): |
|
373 | 373 | profile_list = Profile.objects.filter(state=1) |
|
374 | 374 | if request.method == 'POST': |
|
375 | 375 | txtFilename = request.FILES['txtFile'] |
|
376 | 376 | if txtFilename: |
|
377 | 377 | destination = open('/tmp/'+txtFilename.name, 'wb+') |
|
378 | 378 | for chunk in txtFilename.chunks(): |
|
379 | 379 | destination.write(chunk) |
|
380 | 380 | destination.close() |
|
381 | 381 | filename = '/tmp/'+txtFilename.name |
|
382 | 382 | readFile = readABSFile(filename) |
|
383 | 383 | expName, num_patterns, patterns = readFile.getMetadata() |
|
384 | 384 | |
|
385 | 385 | if expName != "" and num_patterns > 0: |
|
386 | 386 | if len(Profile.objects.filter(name__iexact=expName)) > 0: |
|
387 | 387 | txtError = "Experiment's name found." |
|
388 | 388 | return render_to_response('config/error.html', {'profile_list': profile_list, |
|
389 | 389 | 'txtError' : txtError, }, |
|
390 | 390 | context_instance=RequestContext(request)) |
|
391 | 391 | else: |
|
392 | 392 | newprofile = Profile(name=expName) |
|
393 | 393 | newprofile.save() |
|
394 | 394 | newprofile.state = 1 |
|
395 | 395 | |
|
396 | 396 | for element in patterns: |
|
397 | 397 | newpattern = newprofile.pattern_set.create(value=element["number"]) |
|
398 | 398 | newpattern.antennaup_set.create(value=element["up"]) |
|
399 | 399 | newpattern.antennadown_set.create(value=element["down"]) |
|
400 | 400 | |
|
401 | 401 | newprofile.save() |
|
402 | 402 | |
|
403 | 403 | newurl = '/abscontrol/edit/%d' % int(newprofile.id) |
|
404 | 404 | return redirect(newurl) |
|
405 | 405 | else: |
|
406 | 406 | txtError = "Experiment's name not found or the number of patterns is 0." |
|
407 | 407 | return render_to_response('config/error.html', {'profile_list': profile_list, |
|
408 | 408 | 'txtError' : txtError, }, |
|
409 | 409 | context_instance=RequestContext(request)) |
|
410 | 410 | else: |
|
411 | 411 | txtError = "No file." |
|
412 | 412 | |
|
413 | 413 | return render_to_response('config/error.html', {'profile_list': profile_list, 'txtError' : txtError, }, |
|
414 | 414 | context_instance=RequestContext(request)) |
|
415 | 415 | |
|
416 | 416 | def getImgfromOverJRO(profile_id, objAntenna): |
|
417 | 417 | objProfile = Profile.objects.get(pk=profile_id) |
|
418 | 418 | exp_name = objProfile.name |
|
419 | 419 | phase_tx = objAntenna.value |
|
420 | 420 | gain_tx = objAntenna.tx |
|
421 | 421 | gain_rx = objAntenna.rx |
|
422 | 422 | ues_tx = objAntenna.ues |
|
423 | 423 | just_rx = objAntenna.only_rx |
|
424 | 424 | |
|
425 | 425 | overjro = OverJRO() |
|
426 | 426 | overjro.setParameters(settings.MEDIA_ROOT, exp_name, phase_tx, gain_tx, gain_rx, ues_tx, just_rx) |
|
427 | 427 | contentFile = overjro.setTextContent() |
|
428 | 428 | finalpath = overjro.saveFile(contentFile) |
|
429 | 429 | |
|
430 | 430 | currentdate = datetime.today() |
|
431 | 431 | newOverJro = overJroShow() |
|
432 | 432 | newOverJro.setInputParameters(settings.MEDIA_ROOT, currentdate, finalpath) |
|
433 | 433 | newOverJro.setupParameters() |
|
434 | 434 | newOverJro.execute() |
|
435 | 435 | path = newOverJro.getPlot() |
|
436 | 436 | |
|
437 | 437 | return path |
|
438 | 438 | |
|
439 | 439 | def overJROUp(request, profile_id, pattern_id, antenna_id): |
|
440 | 440 | objAntenna = AntennaUp.objects.get(pk=antenna_id) |
|
441 | 441 | img_path = getImgfromOverJRO(profile_id, objAntenna) |
|
442 | 442 | filename = os.path.split(img_path)[1] |
|
443 | 443 | return render_to_response('config/overjro_up.html', {'img_up': filename,'antennaUp': objAntenna,}, |
|
444 | 444 | context_instance=RequestContext(request)) |
|
445 | 445 | |
|
446 | 446 | def overJRODown(request, profile_id, pattern_id, antenna_id): |
|
447 | 447 | objAntenna = AntennaDown.objects.get(pk=antenna_id) |
|
448 | 448 | img_path = getImgfromOverJRO(profile_id, objAntenna) |
|
449 | 449 | filename = os.path.split(img_path)[1] |
|
450 | 450 | return render_to_response('config/overjro_down.html', {'img_down': filename, 'antennaDown': objAntenna,}, |
|
451 | 451 | context_instance=RequestContext(request)) |
|
452 | 452 | |
|
453 | 453 | def export(request, profile_id): |
|
454 | 454 | listPatterns = [] |
|
455 | 455 | objProfile = Profile.objects.get(pk=profile_id) |
|
456 | 456 | exp_name = objProfile.name |
|
457 | 457 | lsPatterns = objProfile.pattern_set.all() |
|
458 | 458 | for element in lsPatterns: |
|
459 | 459 | objAntennaUp = element.antennaup_set.get() |
|
460 | 460 | objAntennaDown = element.antennadown_set.get() |
|
461 | 461 | dicPatterns = {"number" : element.value, "up" : objAntennaUp.value, "down" : objAntennaDown.value} |
|
462 | 462 | listPatterns.append(dicPatterns) |
|
463 | 463 | |
|
464 | 464 | absFile = saveABSFile() |
|
465 | 465 | absFile.setParameters(settings.MEDIA_ROOT, exp_name, listPatterns) |
|
466 | 466 | filename, filesize = absFile.save() |
|
467 | 467 | |
|
468 | 468 | wrapper = FileWrapper( open( filename, "r" ) ) |
|
469 | 469 | content_type = mimetypes.guess_type( filename )[0] |
|
470 | 470 | |
|
471 | 471 | response = HttpResponse(wrapper, content_type = content_type) |
|
472 | 472 | response['Content-Description'] = 'File Transfer' |
|
473 | 473 | response['Content-Disposition'] = 'attachment; filename=%s' % smart_str(filename) |
|
474 | 474 | response['Content-Transfer-Encoding'] = 'binary' |
|
475 | 475 | response['Expires'] = '0' |
|
476 | 476 | response['Cache-Control'] = 'must-revalidate' |
|
477 | 477 | response['Pragma'] = 'public' |
|
478 | 478 | response['Content-Length'] = '%s' % str(filesize) |
|
479 | 479 | response['X-Sendfile'] = '%s' % smart_str(filename) |
|
480 | 480 | |
|
481 | 481 | return response |
|
482 | 482 | |
|
483 | 483 | def send(request, profile_id): |
|
484 | 484 | listPatterns = [] |
|
485 | 485 | objProfile = Profile.objects.get(pk=profile_id) |
|
486 | 486 | exp_name = objProfile.name |
|
487 | 487 | |
|
488 | 488 | lsPatterns = objProfile.pattern_set.all() |
|
489 | 489 | for element in lsPatterns: |
|
490 | 490 | objAntennaUp = element.antennaup_set.get() |
|
491 | 491 | objAntennaDown = element.antennadown_set.get() |
|
492 | 492 | dicPatterns = {"number" : element.value, "up" : objAntennaUp.value, "down" : objAntennaDown.value} |
|
493 | 493 | listPatterns.append(dicPatterns) |
|
494 | 494 | |
|
495 | 495 | absFile = saveABSFile() |
|
496 | 496 | absFile.setParameters(settings.MEDIA_ROOT, exp_name, listPatterns) |
|
497 | 497 | filename, filesize = absFile.save() |
|
498 | 498 | |
|
499 | 499 | apiclient = sendFile() |
|
500 | 500 | apiclient.execute(filename) |
|
501 | 501 | output = apiclient.getOutput() |
|
502 | 502 | |
|
503 | 503 | if output == "OK": |
|
504 | 504 | message = "File sent successfully." |
|
505 | 505 | lsProfilesActive = Profile.objects.filter(is_active=1) |
|
506 | 506 | if len(lsProfilesActive) > 0: |
|
507 | 507 | objProfileActive = Profile.objects.get(is_active=1) |
|
508 | 508 | objProfileActive.is_active = 0 |
|
509 | 509 | objProfileActive.save() |
|
510 | 510 | |
|
511 | 511 | lsPatternsActive = Pattern.objects.filter(is_active=1) |
|
512 | 512 | if len(lsPatternsActive) > 0: |
|
513 | 513 | objPatternActive = Pattern.objects.get(is_active=1) |
|
514 | 514 | objPatternActive.is_active = 0 |
|
515 | 515 | objPatternActive.save() |
|
516 | 516 | |
|
517 | 517 | objProfile.hits += 1 |
|
518 | 518 | objProfile.is_active = 1 |
|
519 | 519 | objProfile.save() |
|
520 | 520 | |
|
521 | 521 | pattern_value = 1 |
|
522 | 522 | patternChoosen = objProfile.pattern_set.get(value=pattern_value) |
|
523 | 523 | patternChoosen.is_active = 1 |
|
524 | 524 | patternChoosen.save() |
|
525 | 525 | |
|
526 | 526 | newurl = '/abscontrol/view/%d' % int(profile_id) |
|
527 | 527 | |
|
528 | 528 | return redirect(newurl) |
|
529 | 529 | else: |
|
530 | 530 | message = "Error sending file." |
|
531 | 531 | |
|
532 | 532 | profile_list = Profile.objects.all() |
|
533 | 533 | |
|
534 | 534 | return render_to_response('config/sendFile.html', {'message': message, "profile_list" : profile_list, |
|
535 | 535 | 'objProfile': objProfile, |
|
536 | 536 | }, context_instance=RequestContext(request)) |
|
537 | 537 | |
|
538 | 538 | def changePattern(request, profile_id, pattern_id): |
|
539 | 539 | patternChoosen = Pattern.objects.get(id=pattern_id) |
|
540 | 540 | beam = int(patternChoosen.value)-1 |
|
541 | 541 | |
|
542 | 542 | apiclient = changeBeam() |
|
543 | 543 | apiclient.execute(str(beam)) |
|
544 | 544 | output = apiclient.getOutput() |
|
545 | 545 | |
|
546 | 546 | if output == "OK": |
|
547 | 547 | lsPatternsActive = Pattern.objects.filter(is_active=1) |
|
548 | 548 | if len(lsPatternsActive) > 0: |
|
549 | 549 | objPatternActive = Pattern.objects.get(is_active=1) |
|
550 | 550 | objPatternActive.is_active = 0 |
|
551 | 551 | objPatternActive.save() |
|
552 | 552 | |
|
553 | 553 | patternChoosen.hits += 1 |
|
554 | 554 | patternChoosen.is_active = 1 |
|
555 | 555 | patternChoosen.save() |
|
556 | 556 | |
|
557 | 557 | newurl = '/abscontrol/%d/view/%d/' % (int(profile_id), int(pattern_id)) |
|
558 | 558 | return redirect(newurl) |
|
559 | 559 | else: |
|
560 | 560 | message = "Error sending file." |
|
561 | 561 | profile_list = Profile.objects.all() |
|
562 | 562 | return render_to_response('config/sendFile.html', {'message': message, "profile_list" : profile_list, |
|
563 | 563 | }, context_instance=RequestContext(request)) |
|
564 | 564 | No newline at end of file |
@@ -1,44 +1,43 | |||
|
1 | 1 | <!DOCTYPE html> |
|
2 | 2 | <html lang="en"> |
|
3 | 3 | <head> |
|
4 | 4 | <meta charset="utf-8" /> |
|
5 | 5 | {% comment %} |
|
6 | 6 | <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame |
|
7 | 7 | Remove this if you use the .htaccess --> |
|
8 | 8 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> |
|
9 | 9 | {% endcomment %} |
|
10 | 10 | <link href='http://fonts.googleapis.com/css?family=Droid+Sans|Ubuntu:400,500,300italic|Open+Sans:400,300,600|Open+Sans+Condensed:300,700|Roboto+Condensed:400,300' rel='stylesheet' type='text/css'> |
|
11 | 11 | <link rel="stylesheet" href="{{ STATIC_URL }}css/style.css" type="text/css" /> |
|
12 | 12 | <script src="{{ STATIC_URL }}js/jquery-1.9.1.min.js"></script> |
|
13 | 13 | {% block scripting %}{% endblock %} |
|
14 | 14 | <title>{% block title %}JRO WEB APPS::::{% endblock %}</title> |
|
15 | 15 | <meta name="description" content="JRO WEB APPLICATIONS" /> |
|
16 | 16 | <meta name="author" content="Jose Antonio Sal y Rosas Celi" /> |
|
17 | ||
|
18 | {# <meta name="viewport" content="width=device-width; initial-scale=1.0" /> #} | |
|
17 | <meta name="viewport" content="width=device-width; initial-scale=1.0" /> | |
|
19 | 18 | {% comment %} |
|
20 | 19 | <!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references --> |
|
21 | 20 | <link rel="shortcut icon" href="/favicon.ico" /> |
|
22 | 21 | <link rel="apple-touch-icon" href="/apple-touch-icon.png" /> |
|
23 | 22 | {% endcomment %} |
|
24 | 23 | </head> |
|
25 | 24 | <body> |
|
26 | 25 | <div id="schema"> |
|
27 | 26 | <header> |
|
28 | 27 | {% block header %} |
|
29 | 28 | <div id="Main_Head"> |
|
30 | 29 | <label class="Main_Title">Jicamarca Radio Observatory</label> |
|
31 | 30 | </div> |
|
32 | 31 | {% endblock %} |
|
33 | 32 | </header> |
|
34 | 33 | {% block content %} |
|
35 | 34 | <div id="content"></div> |
|
36 | 35 | {% endblock %} |
|
37 | 36 | <footer> |
|
38 | 37 | {% block footer %} |
|
39 | 38 | <p>© Copyright 2013 by Jicamarca Radio Observatory</p> |
|
40 | 39 | {% endblock %} |
|
41 | 40 | </footer> |
|
42 | 41 | </div> |
|
43 | 42 | </body> |
|
44 | 43 | </html> |
General Comments 0
You need to be logged in to leave comments.
Login now