def edit_form_actions(request, domain, app_id, form_unique_id): app = get_app(domain, app_id) form = app.get_form(form_unique_id) module = form.get_module() old_load_from_form = form.actions.load_from_form form.actions = FormActions.wrap(json.loads(request.POST['actions'])) add_properties_to_data_dictionary( domain, module.case_type, list(form.actions.update_case.update.keys())) if old_load_from_form: form.actions.load_from_form = old_load_from_form for condition in (form.actions.open_case.condition, form.actions.close_case.condition): if isinstance(condition.answer, six.string_types): soft_assert_type_text(condition.answer) condition.answer = condition.answer.strip('"\'') form.requires = request.POST.get('requires', form.requires) if actions_use_usercase(form.actions): if not is_usercase_in_use(domain): enable_usercase(domain) add_properties_to_data_dictionary( domain, USERCASE_TYPE, list(form.actions.usercase_update.update.keys())) response_json = {} app.save(response_json) response_json['propertiesMap'] = get_all_case_properties(app) response_json['usercasePropertiesMap'] = get_usercase_properties(app) return json_response(response_json)
def edit_form_actions(request, domain, app_id, form_unique_id): app = get_app(domain, app_id) form = app.get_form(form_unique_id) module = form.get_module() old_load_from_form = form.actions.load_from_form form.actions = FormActions.wrap(json.loads(request.POST['actions'])) add_properties_to_data_dictionary(domain, module.case_type, list(form.actions.update_case.update.keys())) if old_load_from_form: form.actions.load_from_form = old_load_from_form for condition in (form.actions.open_case.condition, form.actions.close_case.condition): if isinstance(condition.answer, six.string_types): soft_assert_type_text(condition.answer) condition.answer = condition.answer.strip('"\'') form.requires = request.POST.get('requires', form.requires) if actions_use_usercase(form.actions): if not is_usercase_in_use(domain): enable_usercase(domain) add_properties_to_data_dictionary(domain, USERCASE_TYPE, list(form.actions.usercase_update.update.keys())) response_json = {} app.save(response_json) response_json['propertiesMap'] = get_all_case_properties(app) response_json['usercasePropertiesMap'] = get_usercase_properties(app) return json_response(response_json)
def get_extra_case_id_datums(form): datums = [] actions = form.active_actions() if form.form_type == 'module_form' and actions_use_usercase(actions): case = UserCaseXPath().case() datums.append(FormDatumMeta( datum=SessionDatum(id=USERCASE_ID, function=('%s/@case_id' % case)), case_type=USERCASE_TYPE, requires_selection=False, action=None # Unused (and could be actions['usercase_update'] or actions['usercase_preload']) ))
def get_extra_case_id_datums(form): datums = [] actions = form.active_actions() if form.form_type == 'module_form' and actions_use_usercase(actions): case = UserCaseXPath().case() datums.append(FormDatumMeta( datum=SessionDatum(id=USERCASE_ID, function=('%s/@case_id' % case)), case_type=USERCASE_TYPE, requires_selection=False, action=None # Unused (and could be actions['usercase_update'] or actions['usercase_preload']) )) return datums
def edit_form_actions(request, domain, app_id, module_id, form_id): app = get_app(domain, app_id) form = app.get_module(module_id).get_form(form_id) form.actions = FormActions.wrap(json.loads(request.POST['actions'])) for condition in (form.actions.open_case.condition, form.actions.close_case.condition): if isinstance(condition.answer, basestring): condition.answer = condition.answer.strip('"\'') form.requires = request.POST.get('requires', form.requires) if actions_use_usercase(form.actions) and not is_usercase_in_use(domain): enable_usercase(domain) response_json = {} app.save(response_json) response_json['propertiesMap'] = get_all_case_properties(app) response_json['usercasePropertiesMap'] = get_usercase_properties(app) return json_response(response_json)
def edit_form_actions(request, domain, app_id, module_id, form_id): app = get_app(domain, app_id) form = app.get_module(module_id).get_form(form_id) old_load_from_form = form.actions.load_from_form form.actions = FormActions.wrap(json.loads(request.POST['actions'])) if old_load_from_form: form.actions.load_from_form = old_load_from_form for condition in (form.actions.open_case.condition, form.actions.close_case.condition): if isinstance(condition.answer, basestring): condition.answer = condition.answer.strip('"\'') form.requires = request.POST.get('requires', form.requires) if actions_use_usercase(form.actions) and not is_usercase_in_use(domain): enable_usercase(domain) response_json = {} app.save(response_json) response_json['propertiesMap'] = get_all_case_properties(app) response_json['usercasePropertiesMap'] = get_usercase_properties(app) return json_response(response_json)