villejuif/setting_form 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

villejuif/setting_form

最新稳定版本:0.1.3

Composer 安装命令:

composer require villejuif/setting_form

包简介

setting_form helps to create a JSON file of parameters writen in PHP.

README 文档

README

Presentation

This library offers forms leading to the production of a JSON file containing the data entered in these forms. This can be useful to give a user the possibility via a browser to set up an application.

The forms themselves are configured in a JSON file.

Example

See Screenshot.

Config file

json/config.json describes forms

category

{
    "CATEGORY_ID": {
        "label": "Category label displayed as tab title",
        "title": "Category title",
        "comment": "Category comment",
        "fields": {
...
  • CATEGORY_ID and label are required
  • CATEGORY_ID composed of upper letters
  • comment can contain html tags

Options:

  • multiple: authorize multiple records to create a list, with options:
    • "min": min count of record
    • "max": max count of record
    • "default": default count of record

field list

        ...
        "fields": {
            "FIELD_ID": {
                "label": "Field label",
                "type": "text",
                "default": "default value",
                "css": "css class name",
                "required": "true"
            },
        ...
  • FIELD_ID, label, type are required
  • FIELD_ID composed of upper letters
  • type can be :
    • text
    • password
    • url
    • date
    • email
    • number
    • range
    • select
    • list
    • checkbox
    • textarea
    • textarea html

Options for all types

* required: true
* css: css class name
* disable: true
* readonly: true
* default: default value, type depends on field type
  • option for text type

    • minlength
    • maxlength
    • placeholder
  • options for number and range type

    • min
    • max
    • step
  • option for select type

    • options: list of options :
      • "label": "value"

Example:

            ...
            "LIMITDISPLAY": {
                "label": "Représentation des limites",
                "comment": "Type de représentation des limites. En arc prend moins de surface. Dégradé est plus figuratif.",
                "type": "select",
                "default": "gradation",
                "required": "true",
                "options": {
                    "gradation": "dégradé",
                    "arc": "arc de couleur unie"
                }
            },
            ...
  • option for list type Same display as select type, but options refer to values of other multiple paramaters list
    • list:
      • base: category ID
      • label: label field name in category base
      • value: value field name in category base

Example with a hierarchical autoreference:

    ...
    "ACTIONS": {
        "label": "Actions",
        "multiple": {
        },
        "fields": {
            "LABEL": {
                "label": "Action label",
                "type": "text"
            },
            "ID": {
                "label": "Id",
                "type": "text",
                "minlength": 2,
                "maxlength": 8,
                "required": "true",
                "unique" : "unique"
            },
            "PARENT": {
                "label": "Parent",
                "type": "list",
                "list": {
                    "base": "ACTIONS",
                    "label": "LABEL",
                    "value": "ID"
                }
            },
    ...

Other example with reference to another category

            ...
            "ONECOLOGICALCEILING": {
                "label": "Effect on ecological ceiling",
                "title": "Effect on ecological ceiling",
                "multiple": {
                },
                "fields": {
                    "ECOLOGICALCEILING": {
                        "label": "Ceiling concerned",
                        "type": "list",
                        "list": {
                            "base": "ECOLOGICALCEILING",
                            "label": "LABEL",
                            "value": "ID",
                            "unique" : "unique"
                        },
                        "required": "true"
                    },
                    "FORCE": {
                        "label": "Action force on ecological ceiling",
                        "type": "range",
                        "min": -100,
                        "max": 100,
                        "step": 1
                    }
                }
            },
            ...

reference to

    ...
    "ECOLOGICALCEILING": {
        "label": "Ecological ceilings",
        "title": "Ecological ceilings",
        "multiple": {
            "min": 1,
            "max": 20,
            "default": 2
        },
        "fields": {
            "LABEL": {
                "label": "Intitulé de limite planétaire",
                "type": "text",
                "required": "true"
            },
            "ID": {
                "label": "Id",
                "type": "text",
                "minlength": 2,
                "maxlength": 8,
                "required": "true",
                "unique": "unique"
            },
            ...

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0-only
  • 更新时间: 2024-11-10