Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
{{!
2
    This file is part of Moodle - http://moodle.org/
3
    Moodle is free software: you can redistribute it and/or modify
4
    it under the terms of the GNU General Public License as published by
5
    the Free Software Foundation, either version 3 of the License, or
6
    (at your option) any later version.
7
    Moodle is distributed in the hope that it will be useful,
8
    but WITHOUT ANY WARRANTY; without even the implied warranty of
9
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
    GNU General Public License for more details.
11
    You should have received a copy of the GNU General Public License
12
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
13
}}
14
{{!
15
    @template mod_data/template_editor
16
 
17
    Template editor in the database activity.
18
 
19
    Example context (json):
20
    {
21
        "title": "Defines browsing interface for multiple entries",
22
        "sesskey": "XXXXX",
23
        "disableeditor": true,
24
        "url": {},
25
        "usehtmleditor": true,
26
        "toolbar": {
27
            "toolshelp": "Available tags help",
28
            "hastools": true,
29
            "tools": [
30
                {
31
                    "name": "Fields",
32
                    "tags": [
33
                    {
34
                        "tag": "[[Checkme]]",
35
                        "tagname": "Checkme - [[Checkme]]"
36
                    },
37
                    {
38
                        "tag": "[[Description]]",
39
                        "tagname": "Description - [[Description]]"
40
                    },
41
                    {
42
                        "tag": "[[Name]]",
43
                        "tagname": "Name - [[Name]]"
44
                    }
45
                    ]
46
                }
47
            ]
48
        },
49
        "editors": [
50
            {
51
            "name": "Header",
52
            "fieldname": "listtemplateheader",
53
            "value": ""
54
            },
55
            {
56
            "name": "Repeated entry",
57
            "fieldname": "listtemplate",
58
            "value": "Template content"
59
            },
60
            {
61
            "name": "Footer",
62
            "fieldname": "listtemplatefooter",
63
            "value": ""
64
            }
65
        ]
66
    }
67
}}
68
<div>{{title}}</div>
69
<form id="edittemplateform" action="{{{url}}}" method="post">
70
    <input name="sesskey" value="{{sesskey}}" type="hidden" />
71
    <input name="defaultform" type="hidden" value=""/>
72
    <input name="resetall" type="hidden" value=""/>
73
    <div class="d-flex flex-row align-items-center">
74
        {{#toolbar}}
75
            {{> mod_data/template_editor_tools }}
76
        {{/toolbar}}
77
        <div class="d-flex flex-column">
78
            {{#editors}}
79
            <div class="m-1">
80
                <div class="template_heading">
81
                    <label for="{{fieldname}}">{{name}}</label>
82
                </div>
83
                <div>
84
                    <textarea
85
                        id="{{fieldname}}"
86
                        name="{{fieldname}}"
87
                        class="form-control"
88
                        rows="15"
89
                        cols="80"
90
                        {{#usehtmleditor}}data-fieldtype="editor"{{/usehtmleditor}}
91
                    >{{value}}</textarea>
92
                </div>
93
            </div>
94
            {{/editors}}
95
        </div>
96
    </div>
97
    {{#disableeditor}}
98
    <div class="container-fluid mt-4">
99
        <div class="row">
100
            <div class="ml-auto">
101
                <input
102
                    type="checkbox"
103
                    name="useeditor"
104
                    id="useeditor"
105
                    value="1"
106
                    {{#usehtmleditor}}checked{{/usehtmleditor}}
107
                />
108
                <label for="useeditor">{{#str}} editorenable, data {{/str}}</label>
109
            </div>
110
        </div>
111
    </div>
112
    {{/disableeditor}}
113
    {{< core/sticky_footer }}
114
        {{$ stickycontent }}
115
        <div>
116
            <input
117
                class="btn btn-primary mx-1"
118
                type="submit"
119
                value="{{#str}} save {{/str}}"
120
            />
121
        </div>
122
        {{/ stickycontent }}
123
    {{/ core/sticky_footer }}
124
</form>