| 1 | {# |
|---|
| 2 | # Copyright (C) 2020 Cinc |
|---|
| 3 | # |
|---|
| 4 | # All rights reserved. |
|---|
| 5 | # |
|---|
| 6 | # This software is licensed as described in the file COPYING, which |
|---|
| 7 | # you should have received as part of this distribution. |
|---|
| 8 | #} |
|---|
| 9 | |
|---|
| 10 | # extends 'admin.html' |
|---|
| 11 | <!DOCTYPE html> |
|---|
| 12 | <html> |
|---|
| 13 | <head> |
|---|
| 14 | <title> |
|---|
| 15 | # block admintitle |
|---|
| 16 | ${_("Workflow Admin")} |
|---|
| 17 | # endblock admintitle |
|---|
| 18 | </title> |
|---|
| 19 | # block head |
|---|
| 20 | ${ super() } |
|---|
| 21 | # if view == 'detail': |
|---|
| 22 | <script type="text/javascript"> |
|---|
| 23 | jQuery(document).ready(function ($) { |
|---|
| 24 | $("#workflow-actions").autoPreviewWorkflow("${href()}/multipleworkflow/workflow_render", "", |
|---|
| 25 | function (textarea, text, rendered) { |
|---|
| 26 | if (rendered) { |
|---|
| 27 | $('#workflow-graph').html(rendered['html']); |
|---|
| 28 | var graphdiv = $('.multiple-workflow-graph'); |
|---|
| 29 | var data = rendered['graph_data']; |
|---|
| 30 | window.drawWorkflows(data, graphdiv); |
|---|
| 31 | } |
|---|
| 32 | }); |
|---|
| 33 | $('#name').bind('input', function () { |
|---|
| 34 | /* trac_types holds all the known ticket types */ |
|---|
| 35 | if ($.inArray($(this).val(), trac_types) == -1) { |
|---|
| 36 | $('#trac-type-hint').show(); |
|---|
| 37 | } |
|---|
| 38 | else { |
|---|
| 39 | $('#trac-type-hint').hide(); |
|---|
| 40 | } |
|---|
| 41 | ; |
|---|
| 42 | }); |
|---|
| 43 | }); |
|---|
| 44 | </script> |
|---|
| 45 | # endif |
|---|
| 46 | # endblock head |
|---|
| 47 | </head> |
|---|
| 48 | <body> |
|---|
| 49 | # block adminpanel |
|---|
| 50 | <h2>${_("Manage Workflows")} |
|---|
| 51 | # if view == 'list': |
|---|
| 52 | <span class="trac-count">(${len(types) + 1})</span> |
|---|
| 53 | # endif |
|---|
| 54 | </h2> |
|---|
| 55 | <div> |
|---|
| 56 | |
|---|
| 57 | # if view == 'detail': |
|---|
| 58 | <form class="mod" id="modworkflow" method="post" action=""> |
|---|
| 59 | ${jmacros.form_token_input()} |
|---|
| 60 | <fieldset> |
|---|
| 61 | <legend>${_("Modify Workflow:")}</legend> |
|---|
| 62 | <div class="field"> |
|---|
| 63 | <label>${_("Name:")}<br/> |
|---|
| 64 | <input name="name" value="${name}" |
|---|
| 65 | type="text" id="name"${{'disabled': name == 'default'}|htmlattr}/> |
|---|
| 66 | </label> |
|---|
| 67 | </div> |
|---|
| 68 | <div class="field"> |
|---|
| 69 | <textarea id="workflow-actions" |
|---|
| 70 | name="workflow-actions" |
|---|
| 71 | class="wikitext trac-resizable" rows="15" |
|---|
| 72 | cols="78">${''.join(workflow)}</textarea> |
|---|
| 73 | </div> |
|---|
| 74 | <p class="help" id="trac-type-hint"${{'style': |
|---|
| 75 | {'display': 'none' if name in trac_types or name == "default"}}|htmlattr}> |
|---|
| 76 | ${_("There is currently no ticket type matching this workflow.")} |
|---|
| 77 | </p> |
|---|
| 78 | <div class="buttons"> |
|---|
| 79 | <input type="submit" name="cancel" value="${_('Cancel')}"/> |
|---|
| 80 | <input type="submit" name="save" value="${_('Save')}"/> |
|---|
| 81 | </div> |
|---|
| 82 | |
|---|
| 83 | <h3>${_("Workflow Graph")}</h3> |
|---|
| 84 | <div id="workflow-graph"> |
|---|
| 85 | ${workflowgraph} |
|---|
| 86 | </div> |
|---|
| 87 | </fieldset> |
|---|
| 88 | </form> |
|---|
| 89 | |
|---|
| 90 | # endif |
|---|
| 91 | |
|---|
| 92 | # if view == 'list': |
|---|
| 93 | # if not wf_controller_installed: |
|---|
| 94 | |
|---|
| 95 | # set controller |
|---|
| 96 | <strong>MultipleWorkflowPlugin</strong> |
|---|
| 97 | # endset |
|---|
| 98 | <div class="system-message warning"> |
|---|
| 99 | ${tag_("Workflow controller %(controller)s is not set in trac.ini.", controller=controller)} |
|---|
| 100 | </div> |
|---|
| 101 | <div> |
|---|
| 102 | <p class="help">${_("It must be added as a workflow controller |
|---|
| 103 | in section [ticket]. Only the default ticket workflow will currently be used.")} |
|---|
| 104 | </p> |
|---|
| 105 | </div> |
|---|
| 106 | <form class="addnew" id="install-controller" method="post" action=""> |
|---|
| 107 | ${jmacros.form_token_input()} |
|---|
| 108 | <fieldset> |
|---|
| 109 | <legend>${_("Install Workflow Controller:")}</legend> |
|---|
| 110 | <p>${_("You may install the workflow controller by clicking the following button.")}</p> |
|---|
| 111 | <div class="buttons"> |
|---|
| 112 | <input type="submit" name="install" value="${_('Install')}"/> |
|---|
| 113 | </div> |
|---|
| 114 | </fieldset> |
|---|
| 115 | </form> |
|---|
| 116 | <hr/> |
|---|
| 117 | #endif |
|---|
| 118 | <form class="addnew" id="addworkflow" method="post" action=""> |
|---|
| 119 | ${jmacros.form_token_input()} |
|---|
| 120 | <fieldset> |
|---|
| 121 | <legend>${_("Add Workflow:")}</legend> |
|---|
| 122 | <div class="field"> |
|---|
| 123 | <label>${_("Name:")}<br/><input type="text" name="name"/></label> |
|---|
| 124 | </div> |
|---|
| 125 | <label>${_("Copy from:")}<br/> |
|---|
| 126 | <select name="type" id="tkt-types" style="margin-left: 1em;"> |
|---|
| 127 | <option value="default">${_("Default workflow")}</option> |
|---|
| 128 | # for tkt_type in types: |
|---|
| 129 | <option${{'selected': tkt_type == selected, 'value': tkt_type |
|---|
| 130 | }|htmlattr}> ${tkt_type} |
|---|
| 131 | </option> |
|---|
| 132 | # endfor |
|---|
| 133 | </select> |
|---|
| 134 | </label> |
|---|
| 135 | |
|---|
| 136 | <div class="buttons"> |
|---|
| 137 | <input type="submit" name="add" value="${_('Add')}"/> |
|---|
| 138 | </div> |
|---|
| 139 | </fieldset> |
|---|
| 140 | </form> |
|---|
| 141 | |
|---|
| 142 | <form id="workflow_table" method="post" action=""> |
|---|
| 143 | ${jmacros.form_token_input()} |
|---|
| 144 | <table class="listing" id="workflowlist"> |
|---|
| 145 | <thead> |
|---|
| 146 | <tr> |
|---|
| 147 | <th class="sel"> </th> |
|---|
| 148 | <th>${_("Ticket Workflow")}</th> |
|---|
| 149 | <th>${_("Description")}</th> |
|---|
| 150 | </tr> |
|---|
| 151 | </thead> |
|---|
| 152 | <tbody> |
|---|
| 153 | <tr> |
|---|
| 154 | <td class="sel"></td> |
|---|
| 155 | <td class="name"> |
|---|
| 156 | <a href="${panel_href('default')}">${_("default")}</a> |
|---|
| 157 | </td> |
|---|
| 158 | <td> |
|---|
| 159 | ${_("Trac default workflow. It is used for ticket types without any specific workflow.")} |
|---|
| 160 | </td> |
|---|
| 161 | </tr> |
|---|
| 162 | # for tkt_type in types: |
|---|
| 163 | <tr> |
|---|
| 164 | <td class="sel"><input type="checkbox" name="sel" value="${tkt_type}"/></td> |
|---|
| 165 | <td class="name"> |
|---|
| 166 | <a href="${panel_href(tkt_type)}">${tkt_type}</a> |
|---|
| 167 | </td> |
|---|
| 168 | <td> |
|---|
| 169 | Workflow for tickets of type <strong>${tkt_type}</strong>. |
|---|
| 170 | # if tkt_type not in trac_types: |
|---|
| 171 | <p class="help"> |
|---|
| 172 | ${_("There is currently no ticket type matching this workflow.")} |
|---|
| 173 | </p> |
|---|
| 174 | # endif |
|---|
| 175 | </td> |
|---|
| 176 | </tr> |
|---|
| 177 | # endfor |
|---|
| 178 | </tbody> |
|---|
| 179 | </table> |
|---|
| 180 | <div class="buttons"> |
|---|
| 181 | <input type="submit" name="remove" value="${_('Remove selected items')}"/> |
|---|
| 182 | </div> |
|---|
| 183 | <p class="help"> |
|---|
| 184 | ${_("You can't remove the default workflow.")} |
|---|
| 185 | </p> |
|---|
| 186 | </form> |
|---|
| 187 | # endif |
|---|
| 188 | |
|---|
| 189 | </div> |
|---|
| 190 | # endblock adminpanel |
|---|
| 191 | </body> |
|---|
| 192 | </html> |
|---|