Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/module-enhancements'
Browse files Browse the repository at this point in the history
  • Loading branch information
reinhardfuehricht committed Jun 27, 2016
2 parents b6af24a + 52fce55 commit e66ad02
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 81 deletions.
5 changes: 5 additions & 0 deletions Classes/Controller/ModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,15 @@ public function indexAction(\Typoheads\Formhandler\Domain\Model\Demand $demand =
$demand->setPid($this->id);
}
}

$logDataRows = $this->logDataRepository->findDemanded($demand);
$this->view->assign('demand', $demand);
$this->view->assign('logDataRows', $logDataRows);
$this->view->assign('settings', $this->settings);
if(!$this->gp['show']) {
$this->gp['show'] = 10;
}
$this->view->assign('showItems', $this->gp['show']);
$permissions = [];
if ($GLOBALS['BE_USER']->user['admin'] || intval($this->settings['enableClearLogs']) === 1) {
$permissions['delete'] = TRUE;
Expand Down
6 changes: 4 additions & 2 deletions Classes/ViewHelpers/Widget/UriViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ protected function getWidgetUri()
}

$queryParameters = [$argumentPrefix => $arguments];

//@TODO: HOW TO DO THIS BETTER?
$additionalParams = [
'tx_formhandler_web_formhandlertxformhandler' => [
'demand' => $_POST['tx_formhandler_web_formhandlertxformhandler']['demand']
'tx_formhandler_web_formhandlerlog' => [
'demand' => $_POST['tx_formhandler_web_formhandlerlog']['demand'],
'show' => $_POST['tx_formhandler_web_formhandlerlog']['show']
]
];
$queryParameters = array_merge($queryParameters, $additionalParams);
Expand Down
1 change: 1 addition & 0 deletions Resources/Private/Language/locallang.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<label index="label.ip">IP</label>
<label index="label.detailView">View</label>
<label index="label.export">Export as</label>
<label index="label.show">Items per page</label>
<label index="label.submit">Filter</label>
<label index="label.select-all">Select all pages</label>
<label index="label.select-page-from-tree">Please select the page using the page tree.</label>
Expand Down
27 changes: 27 additions & 0 deletions Resources/Private/Partials/Module/SelectFieldsGroup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<div class="table-fit">
<table class="table table-striped table-hover select-fields fields-{groupName}">
<thead>
<tr>
<th>{groupLabel}</th>
<th>
<a class="btn btn-default select-all" rel="" href="#" title="{f:translate(key: 'label.select-all-rows')}">
<span class="t3-icon fa fa-check-square-o"> </span>
</a>
</th>
</tr>
</thead>
<tbody>
<f:for each="{fields}" as="field">
<tr>
<td><label for="tx_formhandler_logdata_{field}">{field}</label></td>
<td>
<label class="btn btn-default btn-checkbox">
<f:form.checkbox id="tx_formhandler_logdata_{field}" name="fields[]" value="{field}" />
<span class="t3-icon fa"></span>
</label>
</td>
</tr>
</f:for>
</tbody>
</table>
</div>
105 changes: 53 additions & 52 deletions Resources/Private/Templates/Module/Index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,65 +7,66 @@ <h1><f:translate key="headline.index" /></h1>
</f:section>

<f:section name="content">
<div class="row">
<div class="col-xs-3 last">
<f:form method="post" action="index" name="demand" object="{demand}" class="filterForm form-horizontal">
<div class="form-group">
<label for="tx_formhandler_logdata_pid"><f:translate key="label.pid" /></label>
<f:form.textfield id="tx_formhandler_logdata_pid" property="pid" readonly="readonly" title="{f:translate(key: 'label.select-page-from-tree')}" class="form-control input-sm"/>
</div>
<div class="form-group">
<label for="tx_formhandler_logdata_ip"><f:translate key="label.ip" /></label>
<f:form.textfield id="tx_formhandler_logdata_ip" property="ip" class="form-control input-sm"/>
</div>
<div class="form-group">
<label for="tx_formhandler_logdata_start"><f:translate key="label.start" /></label>
<div class="input-group input-group-sm">
<f:form.textfield
name="start"
value="{f:if(condition: demand.startTimestamp, then: \"{f:format.date(format:'{settings.timeFormat} {settings.dateFormat}', date: '@{demand.startTimestamp}')}\")}"
id="tx_formhandler_logdata_start"
class="form-control input-sm t3js-datetimepicker t3js-clearable"
data="{date-type: 'datetime', date-offset: 0}"
/>
<f:form.hidden property="startTimestamp" value="{demand.startTimestamp}" />
<span class="input-group-btn">
<label class="btn btn-default" for="tx_formhandler_logdata_start">
<span class="fa fa-calendar"></span>
</label>
</span>
</div>
<div class="col-xs-4 last">
<f:form method="post" action="index" name="demand" object="{demand}" class="filterForm form-horizontal">
<div class="form-group">
<label for="tx_formhandler_logdata_pid"><f:translate key="label.pid" /></label>
<f:form.textfield id="tx_formhandler_logdata_pid" property="pid" readonly="readonly" title="{f:translate(key: 'label.select-page-from-tree')}" class="form-control input-sm"/>
</div>
<div class="form-group">
<label for="tx_formhandler_logdata_ip"><f:translate key="label.ip" /></label>
<f:form.textfield id="tx_formhandler_logdata_ip" property="ip" class="form-control input-sm"/>
</div>
<div class="form-group">
<label for="tx_formhandler_logdata_start"><f:translate key="label.start" /></label>
<div class="input-group input-group-sm">
<f:form.textfield
name="start"
value="{f:if(condition: demand.startTimestamp, then: \"{f:format.date(format:'{settings.timeFormat} {settings.dateFormat}', date: '@{demand.startTimestamp}')}\")}"
id="tx_formhandler_logdata_start"
class="form-control input-sm t3js-datetimepicker t3js-clearable"
data="{date-type: 'datetime', date-offset: 0}"
/>
<f:form.hidden property="startTimestamp" value="{demand.startTimestamp}" />
<span class="input-group-btn">
<label class="btn btn-default" for="tx_formhandler_logdata_start">
<span class="fa fa-calendar"></span>
</label>
</span>
</div>
<div class="form-group">
<label for="tx_formhandler_logdata_end"><f:translate key="label.end" /></label>
<div class="input-group input-group-sm">
<f:form.textfield
name="start"
value="{f:if(condition: demand.endTimestamp, then: \"{f:format.date(format:'{settings.timeFormat} {settings.dateFormat}', date: '@{demand.endTimestamp}')}\")}"
id="tx_formhandler_logdata_end"
class="form-control input-sm t3js-datetimepicker t3js-clearable"
data="{date-type: 'datetime', date-offset: 0}"
/>
<f:form.hidden property="endTimestamp" value="{demand.endTimestamp}" />
<span class="input-group-btn">
<label class="btn btn-default" for="tx_formhandler_logdata_end">
<span class="fa fa-calendar"></span>
</label>
</span>
</div>
</div>
<div class="form-group">
<label for="tx_formhandler_logdata_end"><f:translate key="label.end" /></label>
<div class="input-group input-group-sm">
<f:form.textfield
name="start"
value="{f:if(condition: demand.endTimestamp, then: \"{f:format.date(format:'{settings.timeFormat} {settings.dateFormat}', date: '@{demand.endTimestamp}')}\")}"
id="tx_formhandler_logdata_end"
class="form-control input-sm t3js-datetimepicker t3js-clearable"
data="{date-type: 'datetime', date-offset: 0}"
/>
<f:form.hidden property="endTimestamp" value="{demand.endTimestamp}" />
<span class="input-group-btn">
<label class="btn btn-default" for="tx_formhandler_logdata_end">
<span class="fa fa-calendar"></span>
</label>
</span>
</div>

<div class="form-group">
<f:form.submit value="{f:translate(key: 'label.submit')}" class="btn btn-default btn-sm" />
</div>
</f:form>
</div>
</div>
<div class="form-group">
<label for="tx_formhandler_logdata_show"><f:translate key="label.show" /></label>
<f:form.select id="tx_formhandler_logdata_show" class="form-control" name="show" value="{showItems}" options="{10:10, 50:50, 100:100, 1000:1000, 999999:'All'}"/>
</div>
<div class="form-group">
<f:form.submit value="{f:translate(key: 'label.submit')}" class="btn btn-default btn-sm" />
</div>
</f:form>
</div>
<div class="row">
<div class="col-xs-12">
<f:if condition="{logDataRows -> f:count()} > 0">
<f:then>
<f:be.widget.paginate objects="{logDataRows}" as="paginatedLogDataRows" configuration="{itemsPerPage: 5, insertBelow: 1}">
<f:be.widget.paginate objects="{logDataRows}" as="paginatedLogDataRows" configuration="{itemsPerPage: showItems, insertBelow: 1}">
<div class="table-fit">
<table class="table table-striped table-hover">
<thead>
Expand Down
30 changes: 3 additions & 27 deletions Resources/Private/Templates/Module/SelectFields.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,15 @@ <h1><f:translate key="headline.selectFields" /></h1>
<f:form.hidden name="logDataUids" value="{logDataUids}" />

<f:if condition="{fields.global -> f:count()} > 0">
<h3>Global</h3>
<f:for each="{fields.global}" as="field">
<div class="form-group fields-global">
<label for="tx_formhandler_logdata_{field}">
<f:form.checkbox id="tx_formhandler_logdata_{field}" name="fields[]" value="{field}" />
{field}
</label>
</div>
</f:for>
<f:render partial="Module/SelectFieldsGroup" arguments="{fields: fields.global, groupLabel: 'Global Fields', groupName: 'global'}" />
</f:if>

<f:if condition="{fields.custom -> f:count()} > 0">
<h3>Custom</h3>
<f:for each="{fields.custom}" as="field">
<div class="form-group fields-custom">
<label for="tx_formhandler_logdata_{field}">
<f:form.checkbox id="tx_formhandler_logdata_{field}" name="fields[]" value="{field}" />
{field}
</label>
</div>
</f:for>
<f:render partial="Module/SelectFieldsGroup" arguments="{fields: fields.custom, groupLabel: 'Custom Fields', groupName: 'custom'}" />
</f:if>

<f:if condition="{fields.system -> f:count()} > 0">
<h3>System</h3>
<f:for each="{fields.system}" as="field">
<div class="form-group fields-system">
<label for="tx_formhandler_logdata_{field}">
<f:form.checkbox id="tx_formhandler_logdata_{field}" name="fields[]" value="{field}" />
{field}
</label>
</div>
</f:for>
<f:render partial="Module/SelectFieldsGroup" arguments="{fields: fields.system, groupLabel: 'System Fields', groupName: 'system'}" />
</f:if>
<div class="form-group">
<f:form.submit value="{f:translate(key: 'button.export')}" class="btn btn-default btn-sm" />
Expand Down
12 changes: 12 additions & 0 deletions Resources/Public/JavaScript/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,16 @@ TYPO3.jQuery(function() {
});
}
});

TYPO3.jQuery(".table.select-fields A.select-all").on("click", function(e) {
e.preventDefault();
var table = TYPO3.jQuery(this).closest("TABLE");
var allCheckboxes = table.find('INPUT[type="checkbox"]');
var activeCheckboxes = table.find('INPUT[type="checkbox"]:checked');
if(allCheckboxes.length === activeCheckboxes.length) {
allCheckboxes.prop("checked", false);
} else {
allCheckboxes.prop("checked", true);
}
});
});

0 comments on commit e66ad02

Please sign in to comment.