0001-workflows-add-possibility-of-a-backoffice-descriptio.patch
wcs/admin/workflows.py | ||
---|---|---|
316 | 316 |
class WorkflowStatusPage(Directory): |
317 | 317 |
_q_exports = ['', 'delete', 'newitem', ('items', 'items_dir'), |
318 | 318 |
'update_order', 'edit', 'reassign', 'visibility', |
319 |
'endpoint', 'colour'] |
|
319 |
'endpoint', 'colour', |
|
320 |
('backoffice-description', 'backoffice_description'),] |
|
320 | 321 | |
321 | 322 |
def __init__(self, workflow, status_id, html_top): |
322 | 323 |
self.html_top = html_top |
... | ... | |
332 | 333 |
def _q_index(self): |
333 | 334 |
self.html_top('%s - %s' % (_('Workflow'), self.workflow.name)) |
334 | 335 |
r = TemplateIO(html=True) |
335 |
get_response().add_javascript(['jquery.js', 'jquery-ui.js', 'biglist.js', 'svg-pan-zoom.js']) |
|
336 |
get_response().add_javascript(['jquery.js', 'jquery-ui.js', 'biglist.js', 'svg-pan-zoom.js', |
|
337 |
'ckeditor/ckeditor.js', 'qommon.wysiwyg.js', 'ckeditor/adapters/jquery.js']) |
|
336 | 338 |
get_response().add_javascript_code('$(function () { svgPanZoom("svg", {controlIconsEnabled: true}); });'); |
337 | 339 | |
338 | 340 |
r += htmltext('<h2>%s - ') % _('Workflow') |
... | ... | |
425 | 427 |
r += htmltext('<li><a href="visibility" rel="popup">%s</a></li>') % _('Change Status Visibility') |
426 | 428 |
r += htmltext('<li><a href="endpoint" rel="popup">%s</a></li>') % _('Change Terminal Status') |
427 | 429 |
r += htmltext('<li><a href="colour" rel="popup">%s</a></li>') % _('Change Status Colour') |
430 |
r += htmltext('<li><a href="backoffice-description" rel="popup">%s</a></li>' |
|
431 |
) % _('Change Backoffice Description') |
|
428 | 432 |
r += htmltext('<li><a href="delete" rel="popup">%s</a></li>') % _('Delete') |
429 | 433 |
r += htmltext('</ul>') |
430 | 434 |
r += htmltext('<div id="new-field">') |
... | ... | |
677 | 681 |
get_response().breadcrumb.append( ('colour', _('Status Colour')) ) |
678 | 682 |
return form.render() |
679 | 683 | |
684 |
def backoffice_description(self): |
|
685 |
form = Form(enctype = 'multipart/form-data') |
|
686 |
form.add(WysiwygTextWidget, 'backoffice_description', |
|
687 |
title=_('Description for backoffice'), |
|
688 |
value=self.status.backoffice_description) |
|
689 |
form.add_submit('submit', _('Submit')) |
|
690 |
form.add_submit('cancel', _('Cancel')) |
|
691 |
if form.get_widget('cancel').parse(): |
|
692 |
return redirect('..') |
|
693 | ||
694 |
if form.is_submitted() and not form.has_errors(): |
|
695 |
self.status.backoffice_description = form.get_widget('backoffice_description').parse() |
|
696 |
self.workflow.store() |
|
697 |
return redirect('.') |
|
698 | ||
699 |
self.html_top(title = _('Edit Backoffice Description')) |
|
700 |
get_response().breadcrumb.append( ('backoffice_description', |
|
701 |
_('Description for backoffice')) ) |
|
702 |
return form.render() |
|
703 | ||
680 | 704 | |
681 | 705 |
class WorkflowStatusDirectory(Directory): |
682 | 706 |
_q_exports = [''] |
wcs/forms/common.py | ||
---|---|---|
464 | 464 |
if form: |
465 | 465 |
r += form.render() |
466 | 466 | |
467 |
if self.filled.get_status().backoffice_description: |
|
468 |
r += htmltext('<div class="backoffice-description bo-block">') |
|
469 |
r += htmltext(self.filled.get_status().backoffice_description) |
|
470 |
r += htmltext('</div>') |
|
471 | ||
467 | 472 |
r += htmltext('<a href="..">%s</a>') % _('Back to Listing') |
468 | 473 |
return r.getvalue() |
469 | 474 |
wcs/qommon/static/css/dc2/admin.css | ||
---|---|---|
1002 | 1002 |
cursor: pointer; |
1003 | 1003 |
} |
1004 | 1004 | |
1005 |
.bo-block.backoffice-description:before { |
|
1006 |
font-family: FontAwesome; |
|
1007 |
content: "\f05a"; /* info-circle */ |
|
1008 |
position: absolute; |
|
1009 |
left: 10px; |
|
1010 |
font-size: 2em; |
|
1011 |
} |
|
1012 | ||
1013 |
.bo-block.backoffice-description { |
|
1014 |
position: relative; |
|
1015 |
padding-left: 40px; |
|
1016 |
} |
|
1017 | ||
1005 | 1018 |
@media print { |
1006 | 1019 |
div#sidebar { |
1007 | 1020 |
display: none; |
wcs/workflows.py | ||
---|---|---|
549 | 549 |
visibility = None |
550 | 550 |
forced_endpoint = False |
551 | 551 |
colour = 'FFFFFF' |
552 |
backoffice_description = None |
|
552 | 553 | |
553 | 554 |
def __init__(self, name = None): |
554 | 555 |
self.name = name |
... | ... | |
722 | 723 |
if self.forced_endpoint: |
723 | 724 |
ET.SubElement(status, 'forced_endpoint').text = 'true' |
724 | 725 | |
726 |
if self.backoffice_description: |
|
727 |
ET.SubElement(status, 'backoffice_description').text = unicode( |
|
728 |
self.backoffice_description, charset) |
|
729 | ||
725 | 730 |
visibility_node = ET.SubElement(status, 'visibility') |
726 | 731 |
for role in self.visibility or []: |
727 | 732 |
ET.SubElement(visibility_node, 'role').text = str(role) |
... | ... | |
739 | 744 |
self.colour = elem.find('colour').text.encode(charset) |
740 | 745 |
if elem.find('forced_endpoint') is not None: |
741 | 746 |
self.forced_endpoint = (elem.find('forced_endpoint').text == 'true') |
747 |
if elem.find('backoffice_description') is not None: |
|
748 |
self.backoffice_description = elem.find('backoffice_description').text.encode(charset) |
|
742 | 749 | |
743 | 750 |
self.visibility = [] |
744 | 751 |
for visibility_role in elem.findall('visibility/role'): |
745 |
- |