summaryrefslogtreecommitdiffstats
path: root/ogcp
diff options
context:
space:
mode:
Diffstat (limited to 'ogcp')
-rw-r--r--ogcp/forms/action_forms.py1
-rw-r--r--ogcp/views.py11
2 files changed, 10 insertions, 2 deletions
diff --git a/ogcp/forms/action_forms.py b/ogcp/forms/action_forms.py
index c803b02..ed9825a 100644
--- a/ogcp/forms/action_forms.py
+++ b/ogcp/forms/action_forms.py
@@ -193,6 +193,7 @@ class RoomForm(FlaskForm):
validators=[InputRequired()])
gateway = StringField(label=_l('Gateway'),
validators=[InputRequired()])
+ folder_id = HiddenField()
submit = SubmitField(label=_l('Submit'))
class DeleteRoomForm(FlaskForm):
diff --git a/ogcp/views.py b/ogcp/views.py
index 2ca2681..a09e33e 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -1596,7 +1596,8 @@ def action_room_add():
payload = {"center": int(form.center.data),
"name": form.name.data,
"netmask": form.netmask.data,
- "gateway": form.gateway.data}
+ "gateway": form.gateway.data,
+ "folder_id": int(form.folder_id.data)}
r = server.post('/room/add', payload)
if r.status_code != requests.codes.ok:
flash(_('Server replied with error code when adding the room'), category='error')
@@ -1606,7 +1607,7 @@ def action_room_add():
else:
params = request.args.to_dict()
if not params.get('scope-center'):
- flash(_('Please, select one center'), category='error')
+ flash(_('Please, select a center or a folder'), category='error')
return redirect(url_for('scopes'))
server = get_server_from_ip_port(params['scope-server'])
r = server.get('/scopes')
@@ -1617,6 +1618,12 @@ def action_room_add():
form.center.choices = selected_center
form.center.render_kw = {'readonly': True}
form.server.data = params['scope-server']
+
+ if params.get('folder'):
+ form.folder_id.data = params['folder']
+ else:
+ form.folder_id.data = 0
+
scopes, clients = get_scopes()
return render_template('actions/add_room.html', form=form,
scopes=scopes)