Rename 'hide' property to 'hidden' for consistency.

pull/7/head
Ferry Boender 10 years ago
parent a4f8e05832
commit 9c0a5a4978
  1. 20
      doc/MANUAL.md
  2. 2
      examples/megacorp_acc/megacorp_acc.json
  3. 10
      src/scriptform.py

@ -142,6 +142,13 @@ Structurally, they are made up of the following elements:
the [Output](#output) section. The default value is '`escaped`'. the [Output](#output) section. The default value is '`escaped`'.
**Optional**, **String**. **Optional**, **String**.
- **`allowed_users`**: A list of users that are allowed to view and submit
this form. **Optional**, **List of strings**.
- **`hidden`**: If 'true', don't show the form in the list. You can still
view it, if you know its name. This is useful for other forms to
redirect to this forms and such.
- **`fields`**: List of fields in the form. Each field is a dictionary. - **`fields`**: List of fields in the form. Each field is a dictionary.
**Required**, **List of dictionaries**. **Required**, **List of dictionaries**.
@ -158,19 +165,12 @@ Structurally, they are made up of the following elements:
- **`required`**: Whether the field is required. **Optional**, - **`required`**: Whether the field is required. **Optional**,
**Boolean**. **Boolean**.
- **`hide`**: If 'true', don't show the form in the list. You can still
view it, if you know its name. This is useful for other forms to
redirect to this forms and such.
- **`...`**: Other options, which depend on the type of field. For - **`...`**: Other options, which depend on the type of field. For
more information, see [Field types](#field_types). **Optional**. more information, see [Field types](#field_types). **Optional**.
- **`allowed_users`**: A list of users that are allowed to view and submit - **`hidden`**: If 'true', the input field is hidden. This is useful for
this form. **Optional**, **List of strings**. pre-filled forms which takes it values from the GET request.
**Optional**, **boolean**.
- **`hidden`**: If 'true', the input field is hidden. This is useful for
pre-filled forms which takes it values from the GET request.
**Optional**, **boolean**.
- **`users`**: A dictionary of users where the key is the username and the - **`users`**: A dictionary of users where the key is the username and the
value is the plaintext password. This field is not required. **Dictionary**. value is the plaintext password. This field is not required. **Dictionary**.

@ -31,7 +31,7 @@
}, },
{ {
"name": "signup_step_2", "name": "signup_step_2",
"hide": true, "hidden": true,
"title": "Sign up: Your subscriptions", "title": "Sign up: Your subscriptions",
"description": "Please check which topics you are interested in", "description": "Please check which topics you are interested in",
"script": "job_signup_step2.sh", "script": "job_signup_step2.sh",

@ -203,7 +203,7 @@ class ScriptForm:
form['fields'], form['fields'],
script, script,
output=form.get('output', 'escaped'), output=form.get('output', 'escaped'),
hide=form.get('hide', False), hidden=form.get('hidden', False),
submit_title=form.get('submit_title', 'Submit'), submit_title=form.get('submit_title', 'Submit'),
allowed_users=form.get('allowed_users', None)) allowed_users=form.get('allowed_users', None))
) )
@ -269,14 +269,14 @@ class FormConfig:
def get_visible_forms(self, username=None): def get_visible_forms(self, username=None):
""" """
Return a list of all visible forms. Excluded forms are those that have Return a list of all visible forms. Excluded forms are those that have
the 'hide' property set, and where the user has no access to. the 'hidden' property set, and where the user has no access to.
""" """
form_list = [] form_list = []
for form_def in self.forms: for form_def in self.forms:
if form_def.allowed_users is not None and \ if form_def.allowed_users is not None and \
username not in form_def.allowed_users: username not in form_def.allowed_users:
continue # User is not allowed to run this form continue # User is not allowed to run this form
if form_def.hide: if form_def.hidden:
continue # Don't show hidden forms in the list. continue # Don't show hidden forms in the list.
else: else:
form_list.append(form_def) form_list.append(form_def)
@ -331,7 +331,7 @@ class FormDefinition:
for validation of the form values. for validation of the form values.
""" """
def __init__(self, name, title, description, fields, script, def __init__(self, name, title, description, fields, script,
output='escaped', hide=False, submit_title="Submit", output='escaped', hidden=False, submit_title="Submit",
allowed_users=None): allowed_users=None):
self.name = name self.name = name
self.title = title self.title = title
@ -339,7 +339,7 @@ class FormDefinition:
self.fields = fields self.fields = fields
self.script = script self.script = script
self.output = output self.output = output
self.hide = hide self.hidden = hidden
self.submit_title = submit_title self.submit_title = submit_title
self.allowed_users = allowed_users self.allowed_users = allowed_users

Loading…
Cancel
Save