"Fossies" - the Fresh Open Source Software Archive

Member "roundup-2.0.0/share/roundup/templates/jinja2/html/query.edit.html" (29 Feb 2020, 6246 Bytes) of package /linux/www/roundup-2.0.0.tar.gz:


The requested HTML page contains a <FORM> tag that is unusable on "Fossies" in "automatic" (rendered) mode so that page is shown as HTML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 {% extends "layout/page.html" -%}
    2 
    3 {% block head_title %}
    4   {% trans %}"Your Queries" Editing{% endtrans %} - {{ config.TRACKER_NAME }}
    5 {% endblock -%}
    6 
    7 {% block page_header %}
    8   {% if not context.is_edit_ok() %}
    9     {% trans %}You are not allowed to edit queries.{% endtrans %}
   10   {% else %}
   11     {% trans %}"Your Queries" Editing{% endtrans %}
   12   {% endif %}
   13 {% endblock -%}
   14 
   15 {% block extrajs %}
   16 <script nonce="{{ request.client.client_nonce }}"
   17     language="javascript">
   18 // This allows us to make the delete button an immediate action.
   19 // The post_to_url function comes from:
   20 //    http://stackoverflow.com/questions/133925/javascript-post-request-like-a-form-submit
   21 function retire(qid, csrf) {
   22     post_to_url('query'+qid, {'@action': 'retire', '@template':'edit',
   23                 '@csrf': csrf});
   24 }
   25 
   26 function restore(qid, csrf) {
   27     post_to_url('query'+qid, {'@action': 'restore', '@template': 'edit',
   28                 '@csrf': csrf});
   29 }
   30 function post_to_url(path, params, method) {
   31     method = method || "post"; // Set method to post by default if not specified.
   32 
   33     var form = document.createElement("form");
   34     form.setAttribute("method", method);
   35     form.setAttribute("action", path);
   36 
   37     for(var key in params) {
   38         if(params.hasOwnProperty(key)) {
   39             var hiddenField = document.createElement("input");
   40             hiddenField.setAttribute("type", "hidden");
   41             hiddenField.setAttribute("name", key);
   42             hiddenField.setAttribute("value", params[key]);
   43 
   44             form.appendChild(hiddenField);
   45          }
   46     }
   47 
   48     document.body.appendChild(form);
   49     form.submit();
   50 }
   51 </script>
   52 {% endblock -%}
   53 
   54 {% macro include_query(query) %}
   55 <td>
   56   {% if query.id not in request.user.queries %}
   57   <select name="user{{ request.user.id }}@add@queries">
   58     <option value="">{% trans %}leave out{% endtrans %}</option>
   59     <option value="{{ query.id }}">{% trans %}include{% endtrans %}</option>
   60   </select>
   61   {% else %}
   62   <select name="user{{ request.user.id }}@remove@queries">
   63     <option value="">{% trans %}leave in{% endtrans %}</option>
   64     <option value="{{ query.id }}">{% trans %}remove{% endtrans %}</option>
   65   </select>
   66   {% endif %}
   67 </td>
   68 {% endmacro %}
   69 
   70 {% block content %}
   71   {% include 'layout/permission.html' %}
   72 
   73   {% if context.is_edit_ok() %}
   74 <form method="POST" onSubmit="return submit_once()" action="query"
   75       enctype="multipart/form-data">
   76 
   77 <table class="list" width="100%">
   78 {% set uid = request.user.id -%}
   79 {% set mine = request.user.queries -%}
   80 
   81 <tr>
   82   <th>{% trans %}Query{% endtrans %}</th>
   83   <th>{% trans %}Include in "Your Queries"{% endtrans %}</th>
   84   <th>{% trans %}Edit{% endtrans %}</th>
   85   <th>{% trans %}Private to you?{% endtrans %}</th>
   86   <th>{% trans %}delete/restore<br> (javascript<br>required){% endtrans %}</th>
   87 </tr>
   88 <tr>
   89   <td colspan="5"><b>{% trans %}Queries I created{% endtrans %}</b></td>
   90 </tr>
   91 
   92 {% set queries = db.query.filter(filterspec={'creator': uid}) %}
   93 {% for query in queries %}
   94 <tr>
   95   <td>
   96     <a href="{{ query.klass.plain()|u }}?{{ query.url.plain()|u }}">{{ query.name.plain() }}</a>
   97   </td>
   98 
   99   {{ include_query(query) }}
  100 
  101   <td>
  102     <a href="query{{ query.id }}">{% trans %}edit{% endtrans %}</a>
  103   </td>
  104 
  105   <td>
  106     <select name="query{{ query.id }}@private_for">
  107       <option {% if query.private_for == uid %}selected{% endif %}
  108               value="{{ uid }}">{% trans %}yes{% endtrans %}</option>
  109       <option {% if not query.private_for %}selected{% endif %}
  110               value="-1">{% trans %}no{% endtrans %}</option>
  111     </select>
  112   </td>
  113 
  114   <td>
  115     <input class="btn btn-sm btn-danger" type="button"
  116            value="{% trans %}Delete{% endtrans %}"
  117            onClick="retire('{{ query.id }}','{{ utils.anti_csrf_nonce() }}')">
  118   </td>
  119 </tr>
  120 {% endfor %}
  121 <tr>
  122  <td colspan="4"><b>{% trans %}Queries others created{% endtrans %}</b></td>
  123  <td colspan="4"><b>{% trans %}Owner{% endtrans %}</b></td>
  124 </tr>
  125 
  126 {% set queries = db.query.filter(filterspec={'private_for': None}) %}
  127 {% for query in queries %}
  128 <tr>
  129   {% if query.creator != uid %}
  130   <td>
  131     <a href="{{ query.klass.plain()|u }}?{{ query.url.plain()|u }}">{{ query.name.plain() }}</a>
  132   </td>
  133 
  134   {{ include_query(query) }}
  135 
  136   {% if not query.is_edit_ok() %}
  137   <td colspan="2">{% trans %}[not yours to edit]{% endtrans %}</td>
  138   {% else %}
  139   <td colspan="2"><a href="query{{ query.id }}">{% trans %}edit{% endtrans %}</a></td>
  140   {% endif %}
  141   <td colspan="2">{{ query.creator.plain()|u }}</td>
  142   {% endif %}
  143 </tr>
  144 {% endfor %}
  145 
  146 <tr>
  147  <td colspan="5"><b>{% trans %}Active retired/private queries{% endtrans %}</b></td>
  148 </tr>
  149 {% for query in request.user.queries %}
  150 <tr>
  151   {% if query.is_retired() %}
  152   <td>
  153     <a href="{{ query.klass.plain()|u }}?{{ query.url.plain()|u }}">{{ query.name.plain() }}</a>
  154   </td>
  155 
  156   {% if query.creator != uid %}
  157   {{ include_query(query) }}
  158   {% endif %}
  159 
  160   <td colspan="{% if query.creator == uid %}3{% else %}2{% endif %}">{% trans %}[query is retired]{% endtrans %}</td>
  161   {% if query.creator == uid %}
  162   <td>
  163     <input class="btn btn-sm btn-success" type="button"
  164            value="{% trans %}Restore{% endtrans %}"
  165            onClick="restore('{{ query.id }}','{{ utils.anti_csrf_nonce() }}')" />
  166   </td>
  167   {% else %}
  168   <td>{{ query.creator.plain()|u }}</td>
  169   {% endif %}
  170   {% endif %}
  171 </tr>
  172 <tr>
  173   {% if query.private_for and query.creator != uid %}
  174   <td>
  175     <a href="{{ query.klass.plain()|u }}?{{ query.url.plain()|u }}">{{ query.name.plain() }}</a>
  176   </td>
  177 
  178   {{ include_query(query) }}
  179 
  180   <td colspan="2">{% trans %}[query is private]{% endtrans %}</td>
  181   {% if query.creator == uid %}
  182   <td>
  183     <input type="button" value="{% trans %}Restore{% endtrans %}"
  184            onClick="restore('{{ query.id }}','{{ utils.anti_csrf_nonce() }}')" />
  185   </td>
  186   {% endif %}
  187   <td>{{ query.creator.plain()|u }}</td>
  188   {% endif %}
  189 </tr>
  190 {% endfor %}
  191 <tr>
  192   <td colspan="5">
  193     <input type="hidden" name="@action" value="edit" />
  194     <input type="hidden" name="@template" value="edit" />
  195     <input name="@csrf" type="hidden" value="{{ utils.anti_csrf_nonce() }}" />
  196     <input class="btn btn-primary" type="submit"
  197            value="{% trans %}Save Selection{% endtrans %}" />
  198   </td>
  199 </tr>
  200 
  201 </table>
  202 
  203 </form>
  204 </td>
  205 {% endif %}
  206 {% endblock %}