primo commit
This commit is contained in:
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_privacy
|
||||
*
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Component\Privacy\Administrator\View\Capabilities;
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\View\GenericDataException;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Capabilities view class
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* The reported extension capabilities
|
||||
*
|
||||
* @var array
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $capabilities;
|
||||
|
||||
/**
|
||||
* The state information
|
||||
*
|
||||
* @var \Joomla\Registry\Registry
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* Execute and display a template script.
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @see BaseHtmlView::loadTemplate()
|
||||
* @since 3.9.0
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// Initialise variables
|
||||
$this->capabilities = $this->get('Capabilities');
|
||||
$this->state = $this->get('State');
|
||||
|
||||
// Check for errors.
|
||||
if (\count($errors = $this->get('Errors'))) {
|
||||
throw new Genericdataexception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
$this->addToolbar();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
$toolbar = $this->getDocument()->getToolbar();
|
||||
|
||||
ToolbarHelper::title(Text::_('COM_PRIVACY_VIEW_CAPABILITIES'), 'lock');
|
||||
|
||||
$toolbar->preferences('com_privacy');
|
||||
$toolbar->help('Privacy:_Extension_Capabilities');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,149 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_privacy
|
||||
*
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Component\Privacy\Administrator\View\Consents;
|
||||
|
||||
use Joomla\CMS\Form\Form;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\View\GenericDataException;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Pagination\Pagination;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
use Joomla\Component\Privacy\Administrator\Model\ConsentsModel;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Consents view class
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* The active search tools filters
|
||||
*
|
||||
* @var array
|
||||
* @since 3.9.0
|
||||
* @note Must be public to be accessed from the search tools layout
|
||||
*/
|
||||
public $activeFilters;
|
||||
|
||||
/**
|
||||
* Form instance containing the search tools filter form
|
||||
*
|
||||
* @var Form
|
||||
* @since 3.9.0
|
||||
* @note Must be public to be accessed from the search tools layout
|
||||
*/
|
||||
public $filterForm;
|
||||
|
||||
/**
|
||||
* The items to display
|
||||
*
|
||||
* @var array
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $items;
|
||||
|
||||
/**
|
||||
* The pagination object
|
||||
*
|
||||
* @var Pagination
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $pagination;
|
||||
|
||||
/**
|
||||
* The state information
|
||||
*
|
||||
* @var \Joomla\Registry\Registry
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* Is this view an Empty State
|
||||
*
|
||||
* @var boolean
|
||||
* @since 4.0.0
|
||||
*/
|
||||
private $isEmptyState = false;
|
||||
|
||||
/**
|
||||
* Execute and display a template script.
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @see BaseHtmlView::loadTemplate()
|
||||
* @since 3.9.0
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
/** @var ConsentsModel $model */
|
||||
$model = $this->getModel();
|
||||
$this->items = $model->getItems();
|
||||
$this->pagination = $model->getPagination();
|
||||
$this->state = $model->getState();
|
||||
$this->filterForm = $model->getFilterForm();
|
||||
$this->activeFilters = $model->getActiveFilters();
|
||||
|
||||
if (!\count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) {
|
||||
$this->setLayout('emptystate');
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (\count($errors = $this->get('Errors'))) {
|
||||
throw new Genericdataexception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
$this->addToolbar();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
ToolbarHelper::title(Text::_('COM_PRIVACY_VIEW_CONSENTS'), 'lock');
|
||||
|
||||
$toolbar = $this->getDocument()->getToolbar();
|
||||
|
||||
// Add a button to invalidate a consent
|
||||
if (!$this->isEmptyState) {
|
||||
$toolbar->confirmButton('trash', 'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE', 'consents.invalidate')
|
||||
->message('COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE')
|
||||
->icon('icon-trash')
|
||||
->listCheck(true);
|
||||
}
|
||||
|
||||
// If the filter is restricted to a specific subject, show the "Invalidate all" button
|
||||
if ($this->state->get('filter.subject') != '') {
|
||||
$toolbar->confirmButton('cancel', 'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE_ALL', 'consents.invalidateAll')
|
||||
->message('COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE_ALL_CONFIRM_MSG')
|
||||
->icon('icon-cancel')
|
||||
->listCheck(false);
|
||||
}
|
||||
|
||||
$toolbar->preferences('com_privacy');
|
||||
$toolbar->help('Privacy:_Consents');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_privacy
|
||||
*
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Component\Privacy\Administrator\View\Export;
|
||||
|
||||
use Joomla\CMS\MVC\View\AbstractView;
|
||||
use Joomla\CMS\MVC\View\GenericDataException;
|
||||
use Joomla\Component\Privacy\Administrator\Helper\PrivacyHelper;
|
||||
use Joomla\Component\Privacy\Administrator\Model\ExportModel;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Export view class
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @property-read \Joomla\CMS\Document\XmlDocument $document
|
||||
*/
|
||||
class XmlView extends AbstractView
|
||||
{
|
||||
/**
|
||||
* Execute and display a template script.
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.9.0
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
/** @var ExportModel $model */
|
||||
$model = $this->getModel();
|
||||
|
||||
$exportData = $model->collectDataForExportRequest();
|
||||
|
||||
// Check for errors.
|
||||
if (\count($errors = $this->get('Errors'))) {
|
||||
throw new GenericDataException(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
$requestId = $model->getState($model->getName() . '.request_id');
|
||||
|
||||
// This document should always be downloaded
|
||||
$this->getDocument()->setDownload(true);
|
||||
$this->getDocument()->setName('export-request-' . $requestId);
|
||||
|
||||
echo PrivacyHelper::renderDataAsXml($exportData);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,183 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_privacy
|
||||
*
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Component\Privacy\Administrator\View\Request;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Form;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\View\GenericDataException;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
use Joomla\Component\Privacy\Administrator\Model\RequestModel;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Request view class
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* The action logs for the item
|
||||
*
|
||||
* @var array
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $actionlogs;
|
||||
|
||||
/**
|
||||
* The form object
|
||||
*
|
||||
* @var Form
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $form;
|
||||
|
||||
/**
|
||||
* The item record
|
||||
*
|
||||
* @var \stdClass
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $item;
|
||||
|
||||
/**
|
||||
* The state information
|
||||
*
|
||||
* @var \Joomla\Registry\Registry
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* Execute and display a template script.
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @see BaseHtmlView::loadTemplate()
|
||||
* @since 3.9.0
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
/** @var RequestModel $model */
|
||||
$model = $this->getModel();
|
||||
$this->item = $model->getItem();
|
||||
$this->state = $model->getState();
|
||||
|
||||
// Variables only required for the default layout
|
||||
if ($this->getLayout() === 'default') {
|
||||
/** @var \Joomla\Component\Actionlogs\Administrator\Model\ActionlogsModel $logsModel */
|
||||
$logsModel = $this->getModel('actionlogs');
|
||||
|
||||
$this->actionlogs = $logsModel->getLogsForItem('com_privacy.request', $this->item->id);
|
||||
|
||||
// Load the com_actionlogs language strings for use in the layout
|
||||
$lang = $this->getLanguage();
|
||||
$lang->load('com_actionlogs', JPATH_ADMINISTRATOR)
|
||||
|| $lang->load('com_actionlogs', JPATH_ADMINISTRATOR . '/components/com_actionlogs');
|
||||
}
|
||||
|
||||
// Variables only required for the edit layout
|
||||
if ($this->getLayout() === 'edit') {
|
||||
$this->form = $this->get('Form');
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (\count($errors = $this->get('Errors'))) {
|
||||
throw new GenericDataException(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
$this->addToolbar();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
Factory::getApplication()->getInput()->set('hidemainmenu', true);
|
||||
|
||||
$toolbar = $this->getDocument()->getToolbar();
|
||||
|
||||
// Set the title and toolbar based on the layout
|
||||
if ($this->getLayout() === 'edit') {
|
||||
ToolbarHelper::title(Text::_('COM_PRIVACY_VIEW_REQUEST_ADD_REQUEST'), 'lock');
|
||||
|
||||
$toolbar->save('request.save');
|
||||
$toolbar->cancel('request.cancel');
|
||||
$toolbar->help('Privacy:_New_Information_Request');
|
||||
} else {
|
||||
ToolbarHelper::title(Text::_('COM_PRIVACY_VIEW_REQUEST_SHOW_REQUEST'), 'lock');
|
||||
|
||||
// Add transition and action buttons based on item status
|
||||
switch ($this->item->status) {
|
||||
case '0':
|
||||
$toolbar->standardButton('cancel', 'COM_PRIVACY_TOOLBAR_INVALIDATE', 'request.invalidate')
|
||||
->listCheck(false)
|
||||
->icon('icon-cancel-circle');
|
||||
|
||||
break;
|
||||
|
||||
case '1':
|
||||
$return = '&return=' . base64_encode('index.php?option=com_privacy&view=request&id=' . (int) $this->item->id);
|
||||
|
||||
$toolbar->standardButton('apply', 'COM_PRIVACY_TOOLBAR_COMPLETE', 'request.complete')
|
||||
->listCheck(false)
|
||||
->icon('icon-apply');
|
||||
|
||||
$toolbar->standardButton('invalidate', 'COM_PRIVACY_TOOLBAR_INVALIDATE', 'request.invalidate')
|
||||
->listCheck(false)
|
||||
->icon('icon-cancel-circle');
|
||||
|
||||
if ($this->item->request_type === 'export') {
|
||||
$toolbar->linkButton('download', 'COM_PRIVACY_ACTION_EXPORT_DATA')
|
||||
->url(Route::_('index.php?option=com_privacy&task=request.export&format=xml&id=' . (int) $this->item->id . $return));
|
||||
|
||||
if (Factory::getApplication()->get('mailonline', 1)) {
|
||||
$toolbar->linkButton('mail', 'COM_PRIVACY_ACTION_EMAIL_EXPORT_DATA')
|
||||
->url(Route::_('index.php?option=com_privacy&task=request.emailexport&id=' . (int) $this->item->id . $return
|
||||
. '&' . Session::getFormToken() . '=1'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->item->request_type === 'remove') {
|
||||
$toolbar->standardButton('delete', 'COM_PRIVACY_ACTION_DELETE_DATA', 'request.remove')
|
||||
->listCheck(false)
|
||||
->icon('icon-delete');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
// Item is in a "locked" state and cannot transition
|
||||
break;
|
||||
}
|
||||
|
||||
$toolbar->cancel('request.cancel');
|
||||
$toolbar->help('Privacy:_Review_Information_Request');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_privacy
|
||||
*
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Component\Privacy\Administrator\View\Requests;
|
||||
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Form;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\View\GenericDataException;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Pagination\Pagination;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
use Joomla\Component\Privacy\Administrator\Model\RequestsModel;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Requests view class
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* The active search tools filters
|
||||
*
|
||||
* @var array
|
||||
* @since 3.9.0
|
||||
* @note Must be public to be accessed from the search tools layout
|
||||
*/
|
||||
public $activeFilters;
|
||||
|
||||
/**
|
||||
* Form instance containing the search tools filter form
|
||||
*
|
||||
* @var Form
|
||||
* @since 3.9.0
|
||||
* @note Must be public to be accessed from the search tools layout
|
||||
*/
|
||||
public $filterForm;
|
||||
|
||||
/**
|
||||
* The items to display
|
||||
*
|
||||
* @var array
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $items;
|
||||
|
||||
/**
|
||||
* The pagination object
|
||||
*
|
||||
* @var Pagination
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $pagination;
|
||||
|
||||
/**
|
||||
* Flag indicating the site supports sending email
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $sendMailEnabled;
|
||||
|
||||
/**
|
||||
* The state information
|
||||
*
|
||||
* @var \Joomla\Registry\Registry
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* The age of urgent requests
|
||||
*
|
||||
* @var integer
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $urgentRequestAge;
|
||||
|
||||
/**
|
||||
* Execute and display a template script.
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @see BaseHtmlView::loadTemplate()
|
||||
* @since 3.9.0
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
/** @var RequestsModel $model */
|
||||
$model = $this->getModel();
|
||||
$this->items = $model->getItems();
|
||||
$this->pagination = $model->getPagination();
|
||||
$this->state = $model->getState();
|
||||
$this->filterForm = $model->getFilterForm();
|
||||
$this->activeFilters = $model->getActiveFilters();
|
||||
$this->urgentRequestAge = (int) ComponentHelper::getParams('com_privacy')->get('notify', 14);
|
||||
$this->sendMailEnabled = (bool) Factory::getApplication()->get('mailonline', 1);
|
||||
|
||||
if (!\count($this->items) && $this->get('IsEmptyState')) {
|
||||
$this->setLayout('emptystate');
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (\count($errors = $this->get('Errors'))) {
|
||||
throw new Genericdataexception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
$this->addToolbar();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
ToolbarHelper::title(Text::_('COM_PRIVACY_VIEW_REQUESTS'), 'lock');
|
||||
|
||||
$toolbar = $this->getDocument()->getToolbar();
|
||||
|
||||
// Requests can only be created if mail sending is enabled
|
||||
if (Factory::getApplication()->get('mailonline', 1)) {
|
||||
$toolbar->addNew('request.add');
|
||||
}
|
||||
|
||||
$toolbar->preferences('com_privacy');
|
||||
$toolbar->help('Privacy:_Information_Requests');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user