Commit f14f02a6 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'S13657_Twig_formEditor_autocron' into 'develop'

S13657 Added two new twig report files to system: FormEditorTwig and...

See merge request !416
parents e1034f6a 0580b9a1
Pipeline #6972 passed with stage
in 1 minute and 43 seconds
......@@ -320,6 +320,10 @@ Setup a *report* to manage all *forms*:
file=_formEditor
* Twig version of FormEditor is available too ::
file=_formEditorTwig
.. _install-checklist:
Installation: Check List
......
......@@ -125,6 +125,10 @@ to edit `AutoCron` jobs::
}
Or you can use the following code in a separate QFQ record for the twig version of autoCron::
file=_autoCronTwig
Usage
^^^^^
......
dbIndex={{indexQfq:Y}}
form={{form:S}}
1.sql = SELECT id, status,comment, lastRun, lastStatus, nextRun, frequency, inProgress
FROM Cron WHERE '{{form:SE}}' = '' ORDER BY id
1.twig = {% if store.sip.form == '' %}
<table class='table table-hover qfq-table-50'>
<thead class="qfq-sticky"><tr>
<tr>
<th data-sorter="false" class="filter-false">
{{ ('p:'~store.typo3.pageAlias~'|s|N|U:form=cron') | qfqlink }}
</th>
<th>ID</th>
<th>Next run</th>
<th>Frequency</th>
<th>Comment</th>
<th>Last run</th>
<th>In Progress</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
{% for row in result %}
{% set tr_class = "" %}
{% set tr_title = "" %}
{% if row.status != "enable" %}
{% set tr_class = "text-muted" %}
{% elseif row.lastStatus[:5] == "Error" %}
{% set tr_class = "danger" %}
{% set tr_title = "Status: Error" %}
{% elseif row.inProgress != 0 and (row.inProgress|date('U') < "-10 minutes"|date('U')) %}
{% set tr_class = "warning" %}
{% set tr_title = "in Progress > 10mins" %}
{% endif %}
<tr class="{{tr_class}}" title="{{tr_title}}">
<td>{{ ('p:'~store.typo3.pageAlias~'|s|E|U:form=cron&r='~row.id) | qfqlink }}</td>
<td>{{ row.id }}</td>
<td>{{ row.nextRun != 0 ? row.nextRun|date("Y-m-d H:i:s") : "-" }}</td>
<td>{{ row.frequency }} </td>
<td>{{ row.comment }} </td>
<td>{{ row.lastRun != 0 ? row.lastRun|date("Y-m-d H:i:s") : "-" }}</td>
<td>{{ row.inProgress != 0 ? (("now"|date("U")-row.inProgress|date("U"))//60~" minutes") : "-" }}</td>
<td>{{ row.lastStatus[:40] }} </td>
<td>
{{ ('u:/typo3conf/ext/qfq/Classes/Api/delete.php'~
'|s|D|q:Delete Cronjob '~row.id~'?'~
'|U:_modeAnswer=html&_targetUrl=/index.php?id='~store.typo3.pageAlias~
'&form=cron&r='~row.id) | qfqlink }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
#
# Form
#
# a) List of forms: {{form:S}}='', {{formIdHistory:S}}=''
# b) Edit Form: {{form:S}} - Open form {{form:S}} with record {{r:S}} - typically the FormEditor
# c) Use history of a given form: {{formIdHistory:S}}
#
# {{form:S}}
# {{formIdHistory:S0}} - usage history of form '{{formIdHistory:S}}'
form={{form:SE}}
dbIndex={{indexQfq:Y}}
10.sql = SELECT f.id
, f.name
, f.title
, f.tableName
, COUNT(fsl.id) AS submit_count
, MIN(fsl.created) AS submit_first
, MAX(fsl.created) AS submit_last
, GROUP_CONCAT(DISTINCT fsl.pageId ORDER BY fsl.pageId) AS submit_pages
FROM Form AS f
LEFT JOIN FormSubmitLog AS fsl ON fsl.formId=f.id
WHERE '{{form:SE}}'='' AND {{formIdHistory:S0}}=0
GROUP BY f.id ORDER BY f.name
10.twig = {% if result|length > 0 %}
<table class="table table-hover qfq-table-50 tablesorter tablesorter-filter" id="{{store.typo3.pageAlias}}-form">
<thead class="qfq-sticky"><tr>
<th data-sorter="false" class="filter-false">
<div class="btn-group" role="group">
{{ ('p:'~store.typo3.pageAlias~'|s|N|U:form=form') | qfqlink }}
{{ ('p:'~store.typo3.pageAlias~'|s|G:glyphicon-th-list|o:Edit as JSON|U:form=formJson') | qfqlink }}
</div>
</th>
<th>Name</th>
<th>Title</th>
<th>Table</th>
<th>#</th>
<th><em>Frist</em></th>
<th><em>Last</em></th>
<th><em>PageId</em></th>
</tr></thead>
<tbody>
{% for row in result %}
<tr>
<td>
{{ ('p:'~store.typo3.pageAlias~'|s|E|U:form=form&r='~row.id) | qfqlink }}
{{ ('p:'~store.typo3.pageAlias~'|s|G:glyphicon-th-list|o:Edit as JSON|U:form=formJson&r='~row.id) | qfqlink }}
</td>
<td>{{ row.name }} <span class="text-muted">({{ row.id }})</span></td>
<td>
{{ row.title[:50] }}{%- if row.title|length > 50 -%}
<span class="qfq-more-text">{{ row.title[50:] }}</span>
{% endif %}
</td>
<td>{{ row.tableName }}</td>
<td>
{% if row.submit_count == 0 %}
{% set mode = "|r:3" %}
{% else %}
{% set mode = "" %}
{% endif %}
{{ ('p:'~store.typo3.pageAlias~mode~'|U:formIdHistory='~row.id~'|s|b|t:<span class="badge">'~row.submit_count~'</span>') | qfqlink }}
</td>
<td><em>{{ row.submit_first ? row.submit_first|date('Y-m-d') : "-" }}</em></td>
<td><em>{{ row.submit_last ? (date(row.submit_last).diff(date()).days~" days ago") : "-" }}</em></td>
<td><em>{{ row.submit_pages }}</em></td>
</tr>
{% endfor %}
</tbody></table>
{% endif %}
20.sql = SELECT f.name
, fsl.feUser
, fsl.recordId
, fsl.pageId
, fsl.created
FROM FormSubmitLog AS fsl
LEFT JOIN Form AS f
ON fsl.formId=f.id
WHERE fsl.formId={{formIdHistory:S0}}
ORDER BY fsl.created DESC
20.twig = {% if result|length > 0 %}
<h3>Submit History for {{ result.0.name }}</h3>
<a href="javascript:history.back()">Back</a>
<table class="table table-hover qfq-table-50 tablesorter tablesorter-filter" id="{{store.typo3.pageAlias}}-formHistory">
<thead class="qfq-sticky"><tr><th>Form</th><th>feUser</th><th>recordId</th><th>pageId</th><th>Submit</th></tr></thead>
<tbody>
{% for row in result %}
<tr>
{% for col in row %}
<td>{{ col }}</td>
{% endfor %}
</tr>
{% else %}
{# this should never happen, as we do not provide a link if there is no history #}
<tr><td></td><td></td><td></td><td>no history found</td><td></td><td></td><td></td><td></td><td></td></tr>
{% endfor %}
</tbody></table>
<a href="javascript:history.back()">Back</a>
{% endif %}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment