Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

{{!
    This file is part of Moodle - http://moodle.org/
    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template mod_data/template_editor

    Template editor in the database activity.

    Example context (json):
    {
        "title": "Defines browsing interface for multiple entries",
        "sesskey": "XXXXX",
        "disableeditor": true,
        "url": {},
        "usehtmleditor": true,
        "toolbar": {
            "toolshelp": "Available tags help",
            "hastools": true,
            "tools": [
                {
                    "name": "Fields",
                    "tags": [
                    {
                        "tag": "[[Checkme]]",
                        "tagname": "Checkme - [[Checkme]]"
                    },
                    {
                        "tag": "[[Description]]",
                        "tagname": "Description - [[Description]]"
                    },
                    {
                        "tag": "[[Name]]",
                        "tagname": "Name - [[Name]]"
                    }
                    ]
                }
            ]
        },
        "editors": [
            {
            "name": "Header",
            "fieldname": "listtemplateheader",
            "value": ""
            },
            {
            "name": "Repeated entry",
            "fieldname": "listtemplate",
            "value": "Template content"
            },
            {
            "name": "Footer",
            "fieldname": "listtemplatefooter",
            "value": ""
            }
        ]
    }
}}
<div class="mb-4">{{title}}</div>
<form id="edittemplateform" action="{{{url}}}" method="post">
    <input name="sesskey" value="{{sesskey}}" type="hidden" />
    <input name="defaultform" type="hidden" value=""/>
    <input name="resetall" type="hidden" value=""/>
    <div class="d-flex flex-row align-items-start">
        {{#toolbar}}
            {{> mod_data/template_editor_tools }}
        {{/toolbar}}
        <div class="d-flex flex-column w-100">
            {{#editors}}
            <div class="mb-4">
                <div class="template_heading m-0">
                    <label for="{{fieldname}}">{{name}}</label>
                </div>
                <div>
                    <textarea
                        id="{{fieldname}}"
                        name="{{fieldname}}"
                        class="form-control"
                        rows="15"
                        cols="80"
                        {{#usehtmleditor}}data-fieldtype="editor"{{/usehtmleditor}}
                    >{{value}}</textarea>
                </div>
            </div>
            {{/editors}}

            {{#disableeditor}}
            <div class="container-fluid px-0 mx-0">
                <div class="row mx-0 px-0">
                    <div class="ml-auto">
                        <input
                            type="checkbox"
                            name="useeditor"
                            id="useeditor"
                            value="1"
                            {{#usehtmleditor}}checked{{/usehtmleditor}}
                        />
                        <label for="useeditor">{{#str}} editorenable, data {{/str}}</label>
                    </div>
                </div>
            </div>
            {{/disableeditor}}
        </div>
    </div>

    {{< core/sticky_footer }}
        {{$ stickycontent }}
        <div>
            <input
                class="btn btn-primary mx-1"
                type="submit"
                value="{{#str}} save {{/str}}"
            />
        </div>
        {{/ stickycontent }}
    {{/ core/sticky_footer }}
</form>