0001-Mix-enabled-and-disabled-forms-1674.patch
extra/modules/forms_ui.ptl | ||
---|---|---|
82 | 82 |
if is_admin or formdef.receiver_id in (user.roles or []): |
83 | 83 |
l.append(formdef) |
84 | 84 |
elif is_admin: |
85 |
l2.append(formdef)
|
|
85 |
l.append(formdef) |
|
86 | 86 | |
87 | 87 |
cats = Category.select(order_by = 'name') |
88 | 88 |
lists = [] |
... | ... | |
94 | 94 |
if t: |
95 | 95 |
lists.append((None, t)) |
96 | 96 | |
97 |
lists_disabled = [] |
|
98 |
for c in cats: |
|
99 |
t = [x for x in l2 if x.category_id == c.id] |
|
100 |
if t: |
|
101 |
lists_disabled.append((c.name, t)) |
|
102 |
t = [x for x in l2 if x.category_id is None] |
|
103 |
if t: |
|
104 |
lists_disabled.append((None, t)) |
|
105 | ||
106 | 97 |
mid_term = ((len(lists) * 2) + sum([len(x[-1]) for x in lists])) / 2 |
107 | 98 |
count = 0 |
108 | 99 |
in_second_column = False |
... | ... | |
130 | 121 |
if formdef.disabled: |
131 | 122 |
'</span>' |
132 | 123 |
if is_admin: |
133 |
' (<a href="%s/options" rel="popup">%s</a>)' % (formdef.id, _('options')) |
|
124 |
if formdef.disabled: |
|
125 |
' (<a href="%s/enable">%s</a>)' % (formdef.id, _('enable')) |
|
126 |
else: |
|
127 |
' (<a href="%s/disable">%s</a>)' % (formdef.id, _('disable')) |
|
134 | 128 |
'</li>' |
135 | 129 |
'</ul>' |
136 | 130 |
'</div>' |
137 | 131 |
'</div>' |
138 | 132 | |
139 |
if is_admin and lists_disabled: |
|
140 |
get_response().filter['sidebar'] = self.get_sidebar(lists_disabled) |
|
141 | 133 |
get_logger().info('forms backoffice - home') |
142 | 134 | |
143 |
def get_sidebar [html] (self, lists_disabled): |
|
144 |
'<h3>%s</h3>' % _('Available Forms') |
|
145 |
'<p>' |
|
146 |
_('Click on forms to enable them.') |
|
147 |
'</p>' |
|
148 |
for cat_name, formdefs in lists_disabled: |
|
149 |
if cat_name: |
|
150 |
'<h4>%s</h4>' % cat_name |
|
151 |
else: |
|
152 |
'<h4>%s</h4>' % _('Misc') |
|
153 |
'<ul>' |
|
154 |
for formdef in formdefs: |
|
155 |
'<li>' |
|
156 |
'<a href="%s/enable">%s</a>' % (formdef.id, formdef.name) |
|
157 |
'</li>' |
|
158 |
'</ul>' |
|
159 | ||
160 | ||
161 | 135 |
def _q_lookup(self, component): |
162 | 136 |
try: |
163 | 137 |
formdef = FormDef.get(component) |
164 |
- |