1 | <%inherit file="/base.mako"/> |
---|
2 | <%namespace file="/message.mako" import="render_msg" /> |
---|
3 | |
---|
4 | %if message: |
---|
5 | ${render_msg( message, status )} |
---|
6 | %endif |
---|
7 | |
---|
8 | <%def name="render_grid( grid_index, grid_name, fields_dict )"> |
---|
9 | %if grid_name: |
---|
10 | <div class="form-row"> |
---|
11 | <h4>${grid_name}</h4> |
---|
12 | </div> |
---|
13 | %endif |
---|
14 | <div style="clear: both"></div> |
---|
15 | <table class="grid"> |
---|
16 | <thead> |
---|
17 | <tr> |
---|
18 | %for index, field in fields_dict.items(): |
---|
19 | <th> |
---|
20 | ${field['label']} |
---|
21 | <div class="toolParamHelp" style="clear: both;"> |
---|
22 | <i>${field['helptext']}</i> |
---|
23 | </div> |
---|
24 | </th> |
---|
25 | %endfor |
---|
26 | <th></th> |
---|
27 | </tr> |
---|
28 | <thead> |
---|
29 | <tbody> |
---|
30 | <tr> |
---|
31 | %for index, field in fields_dict.items(): |
---|
32 | <td> |
---|
33 | <div>${field['required']}</div> |
---|
34 | ## <div>${field['type']}</div> |
---|
35 | </td> |
---|
36 | %endfor |
---|
37 | <th></th> |
---|
38 | </tr> |
---|
39 | %for index, field in fields_dict.items(): |
---|
40 | <td> |
---|
41 | ## <div>${field['required']}</div> |
---|
42 | <div><i>Type:</i></div> |
---|
43 | <div>${field['type']}</div> |
---|
44 | </td> |
---|
45 | %endfor |
---|
46 | <th></th> |
---|
47 | </tr> |
---|
48 | <tr> |
---|
49 | %for index, field in fields_dict.items(): |
---|
50 | <td> |
---|
51 | %if field['type'] == 'SelectField': |
---|
52 | <div><i>Options:</i></div> |
---|
53 | %for option in field['selectlist']: |
---|
54 | <div>${option}</div> |
---|
55 | %endfor |
---|
56 | %endif |
---|
57 | </td> |
---|
58 | %endfor |
---|
59 | <th></th> |
---|
60 | </tr> |
---|
61 | <tbody> |
---|
62 | </table> |
---|
63 | </%def> |
---|
64 | |
---|
65 | <div class="toolForm"> |
---|
66 | %if form_definition.desc: |
---|
67 | <div class="toolFormTitle">${form_definition.name} - <i> ${form_definition.desc}</i> (${form_definition.type}) |
---|
68 | <a id="form_definition-${form_definition.id}-popup" class="popup-arrow" style="display: none;">▼</a> |
---|
69 | <div popupmenu="form_definition-${form_definition.id}-popup"> |
---|
70 | <a class="action-button" href="${h.url_for( controller='forms', action='manage', operation='Edit', id=trans.security.encode_id(form_definition.current.id) )}">Edit</a> |
---|
71 | </div> |
---|
72 | </div> |
---|
73 | %else: |
---|
74 | <div class="toolFormTitle">${form_definition.name} (${form_definition.type}) |
---|
75 | <a id="form_definition-${form_definition.id}-popup" class="popup-arrow" style="display: none;">▼</a> |
---|
76 | <div popupmenu="form_definition-${form_definition.id}-popup"> |
---|
77 | <a class="action-button" href="${h.url_for( controller='forms', action='manage', operation='Edit', id=trans.security.encode_id(form_definition.current.id) )}">Edit</a> |
---|
78 | </div> |
---|
79 | </div> |
---|
80 | %endif |
---|
81 | <form name="library" action="${h.url_for( controller='forms', action='manage' )}" method="post" > |
---|
82 | %if form_definition.type == trans.app.model.FormDefinition.types.SAMPLE: |
---|
83 | %if not len(form_definition.layout): |
---|
84 | ${render_grid( 0, '', form_definition.fields_of_grid( None ) )} |
---|
85 | %else: |
---|
86 | %for grid_index, grid_name in enumerate(form_definition.layout): |
---|
87 | ${render_grid( grid_index, grid_name, form_definition.fields_of_grid( grid_index ) )} |
---|
88 | %endfor |
---|
89 | %endif |
---|
90 | %else: |
---|
91 | %for index, field in enumerate(form_definition.fields): |
---|
92 | <div class="form-row"> |
---|
93 | <label>${field['label']}</label> |
---|
94 | %if field['helptext']: |
---|
95 | <div class="toolParamHelp" style="clear: both;"> |
---|
96 | <i>${field['helptext']}</i> |
---|
97 | </div> |
---|
98 | %endif |
---|
99 | <div>${field['required']}</div> |
---|
100 | <i>Type: </i> ${field['type']} |
---|
101 | %if field['type'] == 'SelectField': |
---|
102 | <div> |
---|
103 | <div><i>Options:</i></div> |
---|
104 | %for option in field['selectlist']: |
---|
105 | <div>${option}</div> |
---|
106 | %endfor |
---|
107 | </div> |
---|
108 | %endif |
---|
109 | </div> |
---|
110 | <div style="clear: both"></div> |
---|
111 | %endfor |
---|
112 | %endif |
---|
113 | </form> |
---|
114 | </div> |
---|
115 | </div> |
---|