-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebstrings.py
70 lines (62 loc) · 2.51 KB
/
webstrings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
trfieldall = '''<tr><td class="fieldlabel" {wshelp}>{wlabel}</td><td>{wfield}</td><td class="fieldhelp">{whelp}</td></tr>\n'''
spanfieldall = '''<span {wshelp}>{wlabel}</span><span>{wfield}</span>'''
fieldlabel = '{wl.label}:'
fieldshelp = 'title="{wl.shelp}"'
fieldfhelp = '<a class="fieldlink" href="{wl.doclink}" rel="noopener noreferrer">details</a>'
fielduinput = '<input type="text" value="{wl.webvalue}" style="width: 8em" {tattrs}/>' # for input fields that use input with type="text"
fieldnouser = '<span {tattrs}>{wl.webvalue}</span>'
fielddummy = '<span class="sectheadtext" {tattrs}>{wl.value}</span>'
fieldudropdn= '''<select {tattrs} >{wl.webvalue}</select>''' # for input fields that use a drop down selection
fieldcyclicbtn = '<div class="btnlike" {tattrs}>{wl.webvalue}</div>'
tablefieldinputhtml = {
'all' : trfieldall,
'label' : fieldlabel,
'shelp' : fieldshelp,
'fhelp' : fieldfhelp,
'fieldu': fielduinput,
'fieldf': fieldnouser,
}
tablefielddropdnhtml = {
'all' : trfieldall,
'label' : fieldlabel,
'shelp' : fieldshelp,
'fhelp' : fieldfhelp,
'fieldu': fieldudropdn,
'fieldf': fieldnouser,
}
tablefieldcyclicbtndnhtml = {
'all' : trfieldall,
'label' : fieldlabel,
'shelp' : fieldshelp,
'fhelp' : fieldfhelp,
'fieldu': fieldcyclicbtn,
'fieldf': fieldnouser,
}
tablefieldstatic = {
'label': fieldlabel,
'shelp' : fieldshelp,
'fhelp' : fieldfhelp,
'fieldf': fielddummy,
}
# wraps a set of fields as part of an existing table. 1 row with a header which has a button to open and close the group of fields that follow
# expects parameters:
# style : class used for all parts - typically used just to set background color
# title : title used in the header line of the section
# flipid : id used for the open close button and the main body of fields that are shown / hidden
# fields : bunch of html rows that form the main part of the section
tablesectwrapper = """
<tr class="{style}">
<td colspan="3" class="sectheadtext" >{title}</td>
<td><span class="sectheadoc" onclick="flipme('{flipid}', '{flipid}x')"><img class="cbtn" id="{flipid}x" src="static/opendnarrow.svg" /></span></td>
</tr>\n
<tbody id="{flipid}" class="{style}" style="display: none;">
{fields}
</tbody>\n"""
spanfieldinputhtml = {
'all' : spanfieldall,
'label' : fieldlabel,
'shelp' : fieldshelp,
'fhelp' : fieldfhelp,
'fieldu': fielduinput,
'fieldf': fieldnouser,
}