Skip to content

Commit 1dda2eb

Browse files
author
Nicholas K. Dionysopoulos
committed
Merge branch 'development' into feature/13-cookie-policy-management
# Conflicts: # plugins/system/datacompliancecookie/datacompliancecookie.php # plugins/system/datacompliancecookie/datacompliancecookie.xml # plugins/system/datacompliancecookie/helper/helper.php # plugins/system/datacompliancecookie/media/css/datacompliancecookies.css # plugins/system/datacompliancecookie/media/js/datacompliancecookies.js # plugins/system/datacompliancecookie/tmpl/controls.php # translation/plugins/system/datacompliancecookie/en-GB/en-GB.plg_system_datacompliancecookie.ini
2 parents 79fed4b + 2a0d0d6 commit 1dda2eb

20 files changed

Lines changed: 868 additions & 63 deletions

File tree

CHANGELOG

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
Akeeba Data Compliance 0.1.0
1+
Akeeba Data Compliance 1.1.0
22
================================================================================
3+
+ Cookie consent plugin
4+
~ Joomla! 3.9 backend Components menu item compatibility
35

4-
* First release
6+
Akeeba Data Compliance 0.1.0
7+
================================================================================
8+
* First release

build/templates/datacompliance.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<!-- Administrator back-end section -->
3636
<administration>
3737
<!-- Administration menu -->
38-
<menu view="cpanel">COM_DATACOMPLIANCE</menu>
38+
<menu>COM_DATACOMPLIANCE</menu>
3939

4040
<!-- Back-end files -->
4141
<files folder="backend">
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
/**
3+
* @package Akeeba Data Compliance
4+
* @copyright Copyright (c)2018 Nicholas K. Dionysopoulos / Akeeba Ltd
5+
* @license GNU General Public License version 3, or later
6+
*/
7+
8+
namespace Akeeba\DataCompliance\Admin\Controller;
9+
10+
defined('_JEXEC') or die;
11+
12+
class Cookietrail extends Cookietrails
13+
{
14+
15+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
/**
3+
* @package Akeeba Data Compliance
4+
* @copyright Copyright (c)2018 Nicholas K. Dionysopoulos / Akeeba Ltd
5+
* @license GNU General Public License version 3, or later
6+
*/
7+
8+
namespace Akeeba\DataCompliance\Admin\Controller;
9+
10+
defined('_JEXEC') or die;
11+
12+
class Cookietrails extends AbstractBrowseOnly
13+
{
14+
}

component/backend/Dispatcher/Dispatcher.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,16 @@ class Dispatcher extends \FOF30\Dispatcher\Dispatcher
2020
/** @var string The name of the default view, in case none is specified */
2121
public $defaultView = 'ControlPanel';
2222

23-
public function onBeforeDispatch()
23+
public function __construct(Container $container, array $config)
24+
{
25+
parent::__construct($container, $config);
26+
27+
$this->viewNameAliases = [
28+
'cpanel' => 'ControlPanel',
29+
];
30+
}
31+
32+
public function onBeforeDispatch()
2433
{
2534
$this->onBeforeDispatchViewAliases();
2635

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
/**
3+
* @package Akeeba Data Compliance
4+
* @copyright Copyright (c)2018 Nicholas K. Dionysopoulos / Akeeba Ltd
5+
* @license GNU General Public License version 3, or later
6+
*/
7+
8+
9+
namespace Akeeba\DataCompliance\Admin\Model;
10+
11+
defined('_JEXEC') or die;
12+
13+
use Akeeba\DataCompliance\Admin\Model\Mixin\FilterByUser;
14+
use FOF30\Container\Container;
15+
use FOF30\Model\DataModel;
16+
use FOF30\Utils\Ip;
17+
use RuntimeException;
18+
19+
/**
20+
* Cookie consent preferences audit trails
21+
*
22+
* @property int datacompliance_cookietrail_id Primary key.
23+
* @property string created_on When the changes were made.
24+
* @property int created_by Logged in user ID (0 = guest)
25+
* @property string requester_ip The IP of the person who performed the change.
26+
* @property int preference The recorded / applied cookie preference
27+
* @property int dnt The value of the DNT header. -1 = missing, -2 = was not taken into account
28+
* @property int reset 1 if the preference was applied as a result of the user asking to reset their options
29+
*
30+
* @since 1.1.0
31+
*/
32+
class Cookietrails extends DataModel
33+
{
34+
use FilterByUser;
35+
36+
public function __construct(Container $container, array $config = array())
37+
{
38+
parent::__construct($container, $config);
39+
40+
$this->filterByUserSearchField = 'created_by';
41+
}
42+
43+
/**
44+
* Checks the validity of the record. Also auto-fills the created* and requester_ip fields.
45+
*
46+
* @return static
47+
*/
48+
public function check()
49+
{
50+
if (empty($this->requester_ip))
51+
{
52+
if ($this->container->platform->isCli())
53+
{
54+
$this->requester_ip = '(CLI)';
55+
}
56+
else
57+
{
58+
$this->requester_ip = Ip::getIp();
59+
}
60+
}
61+
62+
if (is_null($this->preference))
63+
{
64+
throw new RuntimeException('The recorded preference cannot be null');
65+
}
66+
67+
if (is_null($this->dnt))
68+
{
69+
$this->dnt = -2;
70+
}
71+
72+
if (is_null($this->reset))
73+
{
74+
$this->reset = 0;
75+
}
76+
77+
/** @var self $static This docblock is to keep phpStorm's static analysis from complaining */
78+
$static = parent::check();
79+
80+
return $static;
81+
}
82+
83+
protected function onBeforeBuildQuery(\JDatabaseQuery &$query)
84+
{
85+
// Apply filtering by user. This is a relation filter, it needs to go before the main query builder fires.
86+
$this->filterByUser($query);
87+
}
88+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* @package Akeeba Data Compliance
4+
* @copyright Copyright (c)2018 Nicholas K. Dionysopoulos / Akeeba Ltd
5+
* @license GNU General Public License version 3, or later
6+
*/
7+
8+
9+
namespace Akeeba\DataCompliance\Admin\View\Cookietrail;
10+
11+
12+
use FOF30\View\DataView\Html as BaseView;
13+
14+
class Html extends BaseView
15+
{
16+
17+
}

component/backend/ViewTemplates/ControlPanel/icons.blade.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
@lang('COM_DATACOMPLIANCE_CONSENTTRAILS')
2525
</a>
2626

27+
<a class="akeeba-action--teal"
28+
href="index.php?option=com_datacompliance&view=Cookietrails" >
29+
<span class="akion-android-checkbox"></span>
30+
@lang('COM_DATACOMPLIANCE_COOKIETRAILS')
31+
</a>
32+
33+
2734
<a class="akeeba-action--teal"
2835
href="index.php?option=com_datacompliance&view=Usertrails" >
2936
<span class="akion-person"></span>
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
<?php
2+
/**
3+
* @package Akeeba Data Compliance
4+
* @copyright Copyright (c)2018 Nicholas K. Dionysopoulos / Akeeba Ltd
5+
* @license GNU General Public License version 3, or later
6+
*/
7+
8+
use Akeeba\DataCompliance\Admin\Model\Cookietrails;
9+
use FOF30\Utils\FEFHelper\BrowseView;
10+
use FOF30\Utils\SelectOptions;
11+
12+
defined('_JEXEC') or die();
13+
14+
/**
15+
* @var \Akeeba\DataCompliance\Admin\View\Cookietrail\Html $this
16+
* @var Cookietrails $row
17+
* @var Cookietrails $model
18+
*/
19+
20+
$model = $this->getModel();
21+
?>
22+
23+
@extends('admin:com_datacompliance/Common/browse')
24+
25+
@section('browse-filters')
26+
{{-- Created by --}}
27+
<div class="akeeba-filter-element akeeba-form-group">
28+
@searchfilter('created_by', 'created_by', 'COM_DATACOMPLIANCE_USERTRAIL_FIELD_USER_ID')
29+
</div>
30+
31+
@stop
32+
33+
@section('browse-table-header')
34+
{{-- ### HEADER ROW ### --}}
35+
<tr>
36+
{{-- Row select --}}
37+
<th width="20">
38+
@jhtml('FEFHelper.browse.checkall')
39+
</th>
40+
{{-- Created by --}}
41+
<th>
42+
@sortgrid('created_by')
43+
</th>
44+
{{-- Created on --}}
45+
<th width="20%">
46+
@sortgrid('created_on')
47+
</th>
48+
{{-- Requester IP --}}
49+
<th width="20%">
50+
@sortgrid('requester_ip')
51+
</th>
52+
{{-- Preference --}}
53+
<th width="10%">
54+
@sortgrid('preference')
55+
</th>
56+
{{-- DNT --}}
57+
<th width="10%">
58+
@sortgrid('dnt')
59+
</th>
60+
{{-- Reset --}}
61+
<th width="60">
62+
@sortgrid('reset')
63+
</th>
64+
</tr>
65+
@stop
66+
67+
@section('browse-table-body-withrecords')
68+
{{-- Table body shown when records are present. --}}
69+
<?php $i = 0; ?>
70+
@foreach($this->items as $row)
71+
<tr>
72+
{{-- Row select --}}
73+
<td>
74+
@jhtml('FEFHelper.browse.id', ++$i, $row->getId())
75+
</td>
76+
{{-- Created by --}}
77+
<td>
78+
@include('admin:com_datacompliance/Common/ShowUser', ['item' => $row, 'field' => 'created_by'])
79+
</td>
80+
{{-- Created on --}}
81+
<td>
82+
{{ \Akeeba\DataCompliance\Admin\Helper\Format::date($row->created_on) }}
83+
</td>
84+
{{-- Requester IP --}}
85+
<td>
86+
{{{ $row->requester_ip }}}
87+
</td>
88+
89+
{{-- Preference --}}
90+
<td>
91+
@if($row->preference == 1)
92+
<a class="akeeba-btn--green--mini disabled akeebagrid hasTooltip" title="@lang('COM_DATACOMPLIANCE_COOKIETRAIL_FIELD_PREFERENCE_YES')">
93+
<span class="akion-checkmark-round"></span>&nbsp;
94+
</a>
95+
@elseif($row->preference == 0)
96+
<a class="akeeba-btn--red--mini disabled akeebagrid hasTooltip" title="@lang('COM_DATACOMPLIANCE_COOKIETRAIL_FIELD_PREFERENCE_NO')">
97+
<span class="akion-close-round"></span>&nbsp;
98+
</a>
99+
@endif
100+
</td>
101+
102+
{{-- DNT --}}
103+
<td>
104+
@if($row->dnt == -2)
105+
<a class="akeeba-btn--orange--mini disabled akeebagrid hasTooltip" title="@lang('COM_DATACOMPLIANCE_COOKIETRAIL_FIELD_DNT_NA')">
106+
<span class="akion-minus-round"></span>&nbsp;
107+
</a>
108+
@elseif($row->dnt == -1)
109+
<a class="akeeba-btn--grey--mini disabled akeebagrid hasTooltip" title="@lang('COM_DATACOMPLIANCE_COOKIETRAIL_FIELD_DNT_UNSET')">
110+
<span class="akion-help"></span>&nbsp;
111+
</a>
112+
@elseif($row->dnt == 0)
113+
<a class="akeeba-btn--red--mini disabled akeebagrid hasTooltip" title="@lang('COM_DATACOMPLIANCE_COOKIETRAIL_FIELD_DNT_TRACK')">
114+
<span class="akion-eye"></span>&nbsp;
115+
</a>
116+
@elseif($row->dnt == 1)
117+
<a class="akeeba-btn--green--mini disabled akeebagrid hasTooltip" title="@lang('COM_DATACOMPLIANCE_COOKIETRAIL_FIELD_DNT_NOTTRACK')">
118+
<span class="akion-eye-disabled"></span>&nbsp;
119+
</a>
120+
@endif
121+
</td>
122+
123+
{{-- Reset --}}
124+
<td>
125+
@if($row->reset == 1)
126+
<a class="akeeba-btn--green--mini disabled akeebagrid hasTooltip" title="@lang('COM_DATACOMPLIANCE_COOKIETRAIL_FIELD_RESET_YES')">
127+
<span class="akion-checkmark-round"></span>&nbsp;
128+
</a>
129+
@elseif($row->reset == 0)
130+
<a class="akeeba-btn--grey--mini disabled akeebagrid hasTooltip" title="@lang('COM_DATACOMPLIANCE_COOKIETRAIL_FIELD_RESET_NO')">
131+
<span class="akion-close-round"></span>&nbsp;
132+
</a>
133+
@endif
134+
135+
</td>
136+
</tr>
137+
@endforeach
138+
@stop

component/backend/sql/xml/mysql.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,23 @@ PRIMARY KEY (`datacompliance_usertrail_id`)
7575
]]></query>
7676
</action>
7777

78+
<!-- User profile changes audit trail -->
79+
<action table="#__datacompliance_cookietrails" canfail="0">
80+
<condition type="missing" value="" />
81+
<query><![CDATA[
82+
CREATE TABLE `#__datacompliance_cookietrails` (
83+
`datacompliance_cookietrail_id` BIGINT(20) NOT NULL AUTO_INCREMENT,
84+
`created_on` datetime NOT NULL,
85+
`created_by` bigint(20) NOT NULL,
86+
`requester_ip` varchar(255) NOT NULL,
87+
`preference` int NOT NULL DEFAULT 0,
88+
`dnt` tinyint(1) NOT NULL DEFAULT -1,
89+
`reset` tinyint(1) NOT NULL DEFAULT 0,
90+
PRIMARY KEY (`datacompliance_cookietrail_id`)
91+
) DEFAULT COLLATE utf8_general_ci;
92+
]]></query>
93+
</action>
94+
7895
<action table="#__datacompliance_emailtemplates" canfail="0">
7996
<condition type="missing" value="" />
8097
<query><![CDATA[

0 commit comments

Comments
 (0)