Compare commits
10 Commits
Author | SHA1 | Date |
---|---|---|
Robot | 8e3e7d6570 | |
Robot | 908fd6a45a | |
Llewellyn van der Merwe | 32498659b4 | |
Llewellyn van der Merwe | deec751e77 | |
Llewellyn van der Merwe | 85490b1a3d | |
Llewellyn van der Merwe | 4f7858e4b0 | |
Llewellyn van der Merwe | dbe9b096c8 | |
Luca Marzo | 71186d6b8d | |
Marco Dings | 7be39a27ad | |
Llewellyn van der Merwe | 2a0e88d337 |
46
README.md
46
README.md
|
@ -1,8 +1,6 @@
|
|||
# Track Release Checking (1.0.x)
|
||||
|
||||
![Track Release Checking image](https://raw.githubusercontent.com/joomla-projects/com_release_checking/master/admin/assets/images/vdm-component.jpg "The Track Release Checking")
|
||||
|
||||
Component to keep track of release checking
|
||||
A component to keep track of release checking.
|
||||
|
||||
# Build Details
|
||||
|
||||
|
@ -10,45 +8,13 @@ Component to keep track of release checking
|
|||
+ *Author*: [Joomla! Project](mailto:admin@joomla.org)
|
||||
+ *Name*: [Track Release Checking](http://www.joomla.org)
|
||||
+ *First Build*: 29th July, 2020
|
||||
+ *Last Build*: 2nd November, 2020
|
||||
+ *Last Build*: 10th August, 2023
|
||||
+ *Version*: 1.0.x
|
||||
+ *Copyright*: (C) 2020 Open Source Matters, Inc.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
|
||||
## Build Time
|
||||
## Some Fun Numbers
|
||||
|
||||
**57 Hours** or **7 Eight Hour Days** (actual time the author saved -
|
||||
due to [Automated Component Builder](http://joomlacomponentbuilder.com))
|
||||
|
||||
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
|
||||
> never making one mistake or taking any coffee break.)
|
||||
|
||||
+ *Line count*: **20353**
|
||||
+ *File count*: **190**
|
||||
+ *Folder count*: **56**
|
||||
|
||||
**37 Hours** or **5 Eight Hour Days** (the actual time the author spent)
|
||||
|
||||
> (with the following break down:
|
||||
> **debugging @14hours** = codingtime / 4;
|
||||
> **planning @8hours** = codingtime / 7;
|
||||
> **mapping @6hours** = codingtime / 10;
|
||||
> **office @9hours** = codingtime / 6;)
|
||||
|
||||
**94 Hours** or **12 Eight Hour Days**
|
||||
(a total of the realistic time frame for this project)
|
||||
|
||||
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
|
||||
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
|
||||
|
||||
Project duration: **2.4 weeks** or **0.5 months**
|
||||
|
||||
> This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
|
||||
## Donations
|
||||
|
||||
If you want to support this project, please consider donating:
|
||||
* PayPal: [paypal.me/donationgeek](https://www.paypal.me/donationgeek)
|
||||
* Bitcoin: 18vURxYpPFjvNk8BnUy1ovCAyQmY3MzkSf
|
||||
* Ethereum: 0x9548144662b47327c954f3e214edb96662d51218
|
||||
+ *Line count*: **23297**
|
||||
+ *File count*: **226**
|
||||
+ *Folder count*: **64**
|
|
@ -1,8 +1,6 @@
|
|||
# Track Release Checking (1.0.x)
|
||||
|
||||
![Track Release Checking image](https://raw.githubusercontent.com/joomla-projects/com_release_checking/master/admin/assets/images/vdm-component.jpg "The Track Release Checking")
|
||||
|
||||
Component to keep track of release checking
|
||||
A component to keep track of release checking.
|
||||
|
||||
# Build Details
|
||||
|
||||
|
@ -10,45 +8,13 @@ Component to keep track of release checking
|
|||
+ *Author*: [Joomla! Project](mailto:admin@joomla.org)
|
||||
+ *Name*: [Track Release Checking](http://www.joomla.org)
|
||||
+ *First Build*: 29th July, 2020
|
||||
+ *Last Build*: 2nd November, 2020
|
||||
+ *Last Build*: 10th August, 2023
|
||||
+ *Version*: 1.0.x
|
||||
+ *Copyright*: (C) 2020 Open Source Matters, Inc.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
|
||||
## Build Time
|
||||
## Some Fun Numbers
|
||||
|
||||
**57 Hours** or **7 Eight Hour Days** (actual time the author saved -
|
||||
due to [Automated Component Builder](http://joomlacomponentbuilder.com))
|
||||
|
||||
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
|
||||
> never making one mistake or taking any coffee break.)
|
||||
|
||||
+ *Line count*: **20353**
|
||||
+ *File count*: **190**
|
||||
+ *Folder count*: **56**
|
||||
|
||||
**37 Hours** or **5 Eight Hour Days** (the actual time the author spent)
|
||||
|
||||
> (with the following break down:
|
||||
> **debugging @14hours** = codingtime / 4;
|
||||
> **planning @8hours** = codingtime / 7;
|
||||
> **mapping @6hours** = codingtime / 10;
|
||||
> **office @9hours** = codingtime / 6;)
|
||||
|
||||
**94 Hours** or **12 Eight Hour Days**
|
||||
(a total of the realistic time frame for this project)
|
||||
|
||||
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
|
||||
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
|
||||
|
||||
Project duration: **2.4 weeks** or **0.5 months**
|
||||
|
||||
> This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
|
||||
## Donations
|
||||
|
||||
If you want to support this project, please consider donating:
|
||||
* PayPal: [paypal.me/donationgeek](https://www.paypal.me/donationgeek)
|
||||
* Bitcoin: 18vURxYpPFjvNk8BnUy1ovCAyQmY3MzkSf
|
||||
* Ethereum: 0x9548144662b47327c954f3e214edb96662d51218
|
||||
+ *Line count*: **23297**
|
||||
+ *File count*: **226**
|
||||
+ *Folder count*: **64**
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<access component="com_release_checking">
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<access component="com_release_checking">
|
||||
<section name="component">
|
||||
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
|
||||
<action name="core.options" title="JACTION_OPTIONS" description="JACTION_OPTIONS_COMPONENT_DESC" />
|
||||
|
@ -60,5 +60,5 @@
|
|||
</section>
|
||||
<section name="action">
|
||||
<action name="action.version" title="COM_RELEASE_CHECKING_ACTIONS_EDIT_VERSION" description="COM_RELEASE_CHECKING_ACTIONS_EDIT_VERSION_DESC" />
|
||||
</section>
|
||||
</section>
|
||||
</access>
|
|
@ -1,11 +1,12 @@
|
|||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
.no-click {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
.no-click {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
.control-wrapper-context .input-append {
|
||||
width: 85% !important;
|
||||
|
@ -20,4 +21,4 @@
|
|||
}
|
||||
.control-wrapper-action .input-append #jform_action_chzn {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
.outcome {
|
||||
padding: 10px;
|
||||
|
@ -26,4 +27,4 @@
|
|||
}
|
||||
.outcome-undecided {
|
||||
background-color: blue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* JS Document */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<config>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<config>
|
||||
<fieldset
|
||||
addrulepath="/administrator/components/com_release_checking/models/rules"
|
||||
addfieldpath="/administrator/components/com_release_checking/models/fields"
|
||||
|
@ -88,20 +88,20 @@
|
|||
<option value="0">
|
||||
COM_RELEASE_CHECKING_CONFIG_DEACTIVATE</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="permissions"
|
||||
label="JCONFIG_PERMISSIONS_LABEL"
|
||||
description="JCONFIG_PERMISSIONS_DESC">
|
||||
<field
|
||||
name="rules"
|
||||
type="rules"
|
||||
label="JCONFIG_PERMISSIONS_LABEL"
|
||||
class="inputbox"
|
||||
validate="rules"
|
||||
filter="rules"
|
||||
component="com_release_checking"
|
||||
section="component"
|
||||
/>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="permissions"
|
||||
label="JCONFIG_PERMISSIONS_LABEL"
|
||||
description="JCONFIG_PERMISSIONS_DESC">
|
||||
<field
|
||||
name="rules"
|
||||
type="rules"
|
||||
label="JCONFIG_PERMISSIONS_LABEL"
|
||||
class="inputbox"
|
||||
validate="rules"
|
||||
filter="rules"
|
||||
component="com_release_checking"
|
||||
section="component"
|
||||
/>
|
||||
</fieldset>
|
||||
</config>
|
|
@ -1,113 +1,115 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* General Controller of Release_checking component
|
||||
*/
|
||||
class Release_checkingController extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $config An optional associative array of configuration settings.
|
||||
* Recognized key values include 'name', 'default_task', 'model_path', and
|
||||
* 'view_path' (this list is not meant to be comprehensive).
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
// set the default view
|
||||
$config['default_view'] = 'release_checks';
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* display task
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
// set default view if not set
|
||||
$view = $this->input->getCmd('view', 'release_checks');
|
||||
$data = $this->getViewRelation($view);
|
||||
$layout = $this->input->get('layout', null, 'WORD');
|
||||
$id = $this->input->getInt('id');
|
||||
|
||||
// Check for edit form.
|
||||
if(Release_checkingHelper::checkArray($data))
|
||||
{
|
||||
if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_release_checking.edit.'.$data['view'], $id))
|
||||
{
|
||||
// Somehow the person just went to the form - we don't allow that.
|
||||
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
|
||||
$this->setMessage($this->getError(), 'error');
|
||||
// check if item was opend from other then its own list view
|
||||
$ref = $this->input->getCmd('ref', 0);
|
||||
$refid = $this->input->getInt('refid', 0);
|
||||
// set redirect
|
||||
if ($refid > 0 && Release_checkingHelper::checkString($ref))
|
||||
{
|
||||
// redirect to item of ref
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
|
||||
}
|
||||
elseif (Release_checkingHelper::checkString($ref))
|
||||
{
|
||||
|
||||
// redirect to ref
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view='.(string)$ref, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
// normal redirect back to the list view
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view='.$data['views'], false));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return parent::display($cachable, $urlparams);
|
||||
}
|
||||
|
||||
protected function getViewRelation($view)
|
||||
{
|
||||
// check the we have a value
|
||||
if (Release_checkingHelper::checkString($view))
|
||||
{
|
||||
// the view relationships
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* General Controller of Release_checking component
|
||||
*/
|
||||
class Release_checkingController extends BaseController
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $config An optional associative array of configuration settings.
|
||||
* Recognized key values include 'name', 'default_task', 'model_path', and
|
||||
* 'view_path' (this list is not meant to be comprehensive).
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
// set the default view
|
||||
$config['default_view'] = 'release_checks';
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* display task
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
// set default view if not set
|
||||
$view = $this->input->getCmd('view', 'release_checks');
|
||||
$data = $this->getViewRelation($view);
|
||||
$layout = $this->input->get('layout', null, 'WORD');
|
||||
$id = $this->input->getInt('id');
|
||||
|
||||
// Check for edit form.
|
||||
if(Release_checkingHelper::checkArray($data))
|
||||
{
|
||||
if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_release_checking.edit.'.$data['view'], $id))
|
||||
{
|
||||
// Somehow the person just went to the form - we don't allow that.
|
||||
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
|
||||
$this->setMessage($this->getError(), 'error');
|
||||
// check if item was opend from other then its own list view
|
||||
$ref = $this->input->getCmd('ref', 0);
|
||||
$refid = $this->input->getInt('refid', 0);
|
||||
// set redirect
|
||||
if ($refid > 0 && Release_checkingHelper::checkString($ref))
|
||||
{
|
||||
// redirect to item of ref
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
|
||||
}
|
||||
elseif (Release_checkingHelper::checkString($ref))
|
||||
{
|
||||
|
||||
// redirect to ref
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view='.(string)$ref, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
// normal redirect back to the list view
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view='.$data['views'], false));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return parent::display($cachable, $urlparams);
|
||||
}
|
||||
|
||||
protected function getViewRelation($view)
|
||||
{
|
||||
// check the we have a value
|
||||
if (Release_checkingHelper::checkString($view))
|
||||
{
|
||||
// the view relationships
|
||||
$views = array(
|
||||
'release_check' => 'release_checks',
|
||||
'joomla_version' => 'joomla_versions',
|
||||
'context' => 'contexts',
|
||||
'action' => 'actions'
|
||||
);
|
||||
// check if this is a list view
|
||||
if (in_array($view, $views))
|
||||
{
|
||||
// this is a list view
|
||||
return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view);
|
||||
}
|
||||
// check if it is an edit view
|
||||
elseif (array_key_exists($view, $views))
|
||||
{
|
||||
// this is a edit view
|
||||
return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
'action' => 'actions'
|
||||
);
|
||||
// check if this is a list view
|
||||
if (in_array($view, $views))
|
||||
{
|
||||
// this is a list view
|
||||
return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view);
|
||||
}
|
||||
// check if it is an edit view
|
||||
elseif (array_key_exists($view, $views))
|
||||
{
|
||||
// this is a edit view
|
||||
return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,54 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Action Controller
|
||||
*/
|
||||
class Release_checkingControllerAction extends JControllerForm
|
||||
{
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
*
|
||||
* @var string
|
||||
* @since 12.2
|
||||
* @note Replaces _task.
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array $config A named array of configuration variables.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->view_list = 'Actions'; // safeguard for setting the return view listing to the main view.
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Controller\FormController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Action Form Controller
|
||||
*/
|
||||
class Release_checkingControllerAction extends FormController
|
||||
{
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
*
|
||||
* @var string
|
||||
* @since 12.2
|
||||
* @note Replaces _task.
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array $config A named array of configuration variables.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->view_list = 'Actions'; // safeguard for setting the return view listing to the main view.
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
{
|
||||
// Get user object.
|
||||
$user = JFactory::getUser();
|
||||
|
@ -60,20 +62,20 @@ class Release_checkingControllerAction extends JControllerForm
|
|||
}
|
||||
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return parent::allowAdd($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
return parent::allowAdd($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
{
|
||||
// get user object.
|
||||
$user = JFactory::getUser();
|
||||
|
@ -116,199 +118,199 @@ class Release_checkingControllerAction extends JControllerForm
|
|||
}
|
||||
}
|
||||
// Since there is no permission, revert to the component permissions.
|
||||
return parent::allowEdit($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL arguments to append to an item redirect.
|
||||
*
|
||||
* @param integer $recordId The primary key id for the item.
|
||||
* @param string $urlVar The name of the URL variable for the id.
|
||||
*
|
||||
* @return string The arguments to append to the redirect URL.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||
{
|
||||
// get the referral options (old method use return instead see parent)
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// get redirect info.
|
||||
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
|
||||
|
||||
// set the referral options
|
||||
if ($refid && $ref)
|
||||
{
|
||||
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
$append = '&ref='. (string)$ref . $append;
|
||||
}
|
||||
|
||||
return $append;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run batch operations.
|
||||
*
|
||||
* @param object $model The model.
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public function batch($model = null)
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('Action', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=actions' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to cancel an edit.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
*
|
||||
* @return boolean True if access level checks pass, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
|
||||
$cancel = parent::cancel($key);
|
||||
|
||||
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if successful, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
|
||||
|
||||
if ($this->ref || $this->refid || $canReturn)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
// This is not needed since parent save already does this
|
||||
// Due to the ref and refid implementation we need to add this
|
||||
if ($canReturn)
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that allows child controller access to model data
|
||||
* after the data has been saved.
|
||||
*
|
||||
* @param JModel &$model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
protected function postSaveHook(JModelLegacy $model, $validData = array())
|
||||
return parent::allowEdit($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL arguments to append to an item redirect.
|
||||
*
|
||||
* @param integer $recordId The primary key id for the item.
|
||||
* @param string $urlVar The name of the URL variable for the id.
|
||||
*
|
||||
* @return string The arguments to append to the redirect URL.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
// get the referral options (old method use return instead see parent)
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// get redirect info.
|
||||
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
|
||||
|
||||
// set the referral options
|
||||
if ($refid && $ref)
|
||||
{
|
||||
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
$append = '&ref='. (string)$ref . $append;
|
||||
}
|
||||
|
||||
return $append;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run batch operations.
|
||||
*
|
||||
* @param object $model The model.
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public function batch($model = null)
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('Action', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=actions' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to cancel an edit.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
*
|
||||
* @return boolean True if access level checks pass, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
|
||||
$cancel = parent::cancel($key);
|
||||
|
||||
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if successful, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
|
||||
|
||||
if ($this->ref || $this->refid || $canReturn)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
// This is not needed since parent save already does this
|
||||
// Due to the ref and refid implementation we need to add this
|
||||
if ($canReturn)
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that allows child controller access to model data
|
||||
* after the data has been saved.
|
||||
*
|
||||
* @param JModel &$model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
protected function postSaveHook(JModelLegacy $model, $validData = array())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,44 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Actions Controller
|
||||
*/
|
||||
class Release_checkingControllerActions extends JControllerAdmin
|
||||
{
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING_ACTIONS';
|
||||
|
||||
/**
|
||||
* Method to get a model object, loading it if required.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JModelLegacy The model.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Action', $prefix = 'Release_checkingModel', $config = array('ignore_request' => true))
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Actions Admin Controller
|
||||
*/
|
||||
class Release_checkingControllerActions extends AdminController
|
||||
{
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING_ACTIONS';
|
||||
|
||||
/**
|
||||
* Method to get a model object, loading it if required.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JModelLegacy The model.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Action', $prefix = 'Release_checkingModel', $config = array('ignore_request' => true))
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
|
@ -53,7 +55,7 @@ class Release_checkingControllerActions extends JControllerAdmin
|
|||
$input = JFactory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
ArrayHelper::toInteger($pks);
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Actions');
|
||||
// get the data to export
|
||||
|
@ -102,5 +104,5 @@ class Release_checkingControllerActions extends JControllerAdmin
|
|||
$message = JText::_('COM_RELEASE_CHECKING_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=actions', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,50 +1,60 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checking Ajax Controller
|
||||
*/
|
||||
class Release_checkingControllerAjax extends JControllerLegacy
|
||||
{
|
||||
public function __construct($config)
|
||||
{
|
||||
parent::__construct($config);
|
||||
// make sure all json stuff are set
|
||||
JFactory::getDocument()->setMimeEncoding( 'application/json' );
|
||||
JResponse::setHeader('Content-Disposition','attachment;filename="getajax.json"');
|
||||
JResponse::setHeader("Access-Control-Allow-Origin", "*");
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checking Ajax Base Controller
|
||||
*/
|
||||
class Release_checkingControllerAjax extends BaseController
|
||||
{
|
||||
public function __construct($config)
|
||||
{
|
||||
parent::__construct($config);
|
||||
// make sure all json stuff are set
|
||||
JFactory::getDocument()->setMimeEncoding( 'application/json' );
|
||||
// get the application
|
||||
$app = JFactory::getApplication();
|
||||
$app->setHeader('Content-Disposition','attachment;filename="getajax.json"');
|
||||
$app->setHeader('Access-Control-Allow-Origin', '*');
|
||||
// load the tasks
|
||||
$this->registerTask('getAction', 'ajax');
|
||||
$this->registerTask('getActionDescription', 'ajax');
|
||||
}
|
||||
|
||||
public function ajax()
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
// Check Token!
|
||||
$token = JSession::getFormToken();
|
||||
$call_token = $jinput->get('token', 0, 'ALNUM');
|
||||
if($jinput->get($token, 0, 'ALNUM') || $token === $call_token)
|
||||
{
|
||||
$task = $this->getTask();
|
||||
switch($task)
|
||||
$this->registerTask('getActionDescription', 'ajax');
|
||||
}
|
||||
|
||||
public function ajax()
|
||||
{
|
||||
// get the user for later use
|
||||
$user = JFactory::getUser();
|
||||
// get the input values
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
// check if we should return raw
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
// return to a callback function
|
||||
$callback = $jinput->get('callback', null, 'CMD');
|
||||
// Check Token!
|
||||
$token = JSession::getFormToken();
|
||||
$call_token = $jinput->get('token', 0, 'ALNUM');
|
||||
if($jinput->get($token, 0, 'ALNUM') || $token === $call_token)
|
||||
{
|
||||
// get the task
|
||||
$task = $this->getTask();
|
||||
switch($task)
|
||||
{
|
||||
case 'getAction':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$contextValue = $jinput->get('context', NULL, 'INT');
|
||||
$joomla_versionValue = $jinput->get('joomla_version', NULL, 'INT');
|
||||
$current_idValue = $jinput->get('current_id', NULL, 'INT');
|
||||
|
@ -56,7 +66,7 @@ class Release_checkingControllerAjax extends JControllerLegacy
|
|||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
if($callback)
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
|
@ -71,10 +81,14 @@ class Release_checkingControllerAjax extends JControllerLegacy
|
|||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
if($callback)
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($e);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
|
@ -84,7 +98,6 @@ class Release_checkingControllerAjax extends JControllerLegacy
|
|||
case 'getActionDescription':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$actionValue = $jinput->get('action', NULL, 'INT');
|
||||
if($actionValue && $user->id != 0)
|
||||
{
|
||||
|
@ -94,7 +107,7 @@ class Release_checkingControllerAjax extends JControllerLegacy
|
|||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
if($callback)
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
|
@ -109,28 +122,37 @@ class Release_checkingControllerAjax extends JControllerLegacy
|
|||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
if($callback)
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($e);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback."(".json_encode(false).");";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode(false).");";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// return to a callback function
|
||||
if($callback)
|
||||
{
|
||||
echo $callback."(".json_encode(false).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode(false).");";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,54 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Context Controller
|
||||
*/
|
||||
class Release_checkingControllerContext extends JControllerForm
|
||||
{
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
*
|
||||
* @var string
|
||||
* @since 12.2
|
||||
* @note Replaces _task.
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array $config A named array of configuration variables.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->view_list = 'Contexts'; // safeguard for setting the return view listing to the main view.
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Controller\FormController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Context Form Controller
|
||||
*/
|
||||
class Release_checkingControllerContext extends FormController
|
||||
{
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
*
|
||||
* @var string
|
||||
* @since 12.2
|
||||
* @note Replaces _task.
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array $config A named array of configuration variables.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->view_list = 'Contexts'; // safeguard for setting the return view listing to the main view.
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
{
|
||||
// Get user object.
|
||||
$user = JFactory::getUser();
|
||||
|
@ -60,20 +62,20 @@ class Release_checkingControllerContext extends JControllerForm
|
|||
}
|
||||
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return parent::allowAdd($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
return parent::allowAdd($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
{
|
||||
// get user object.
|
||||
$user = JFactory::getUser();
|
||||
|
@ -116,199 +118,199 @@ class Release_checkingControllerContext extends JControllerForm
|
|||
}
|
||||
}
|
||||
// Since there is no permission, revert to the component permissions.
|
||||
return parent::allowEdit($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL arguments to append to an item redirect.
|
||||
*
|
||||
* @param integer $recordId The primary key id for the item.
|
||||
* @param string $urlVar The name of the URL variable for the id.
|
||||
*
|
||||
* @return string The arguments to append to the redirect URL.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||
{
|
||||
// get the referral options (old method use return instead see parent)
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// get redirect info.
|
||||
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
|
||||
|
||||
// set the referral options
|
||||
if ($refid && $ref)
|
||||
{
|
||||
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
$append = '&ref='. (string)$ref . $append;
|
||||
}
|
||||
|
||||
return $append;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run batch operations.
|
||||
*
|
||||
* @param object $model The model.
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public function batch($model = null)
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('Context', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=contexts' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to cancel an edit.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
*
|
||||
* @return boolean True if access level checks pass, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
|
||||
$cancel = parent::cancel($key);
|
||||
|
||||
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if successful, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
|
||||
|
||||
if ($this->ref || $this->refid || $canReturn)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
// This is not needed since parent save already does this
|
||||
// Due to the ref and refid implementation we need to add this
|
||||
if ($canReturn)
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that allows child controller access to model data
|
||||
* after the data has been saved.
|
||||
*
|
||||
* @param JModel &$model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
protected function postSaveHook(JModelLegacy $model, $validData = array())
|
||||
return parent::allowEdit($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL arguments to append to an item redirect.
|
||||
*
|
||||
* @param integer $recordId The primary key id for the item.
|
||||
* @param string $urlVar The name of the URL variable for the id.
|
||||
*
|
||||
* @return string The arguments to append to the redirect URL.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
// get the referral options (old method use return instead see parent)
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// get redirect info.
|
||||
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
|
||||
|
||||
// set the referral options
|
||||
if ($refid && $ref)
|
||||
{
|
||||
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
$append = '&ref='. (string)$ref . $append;
|
||||
}
|
||||
|
||||
return $append;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run batch operations.
|
||||
*
|
||||
* @param object $model The model.
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public function batch($model = null)
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('Context', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=contexts' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to cancel an edit.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
*
|
||||
* @return boolean True if access level checks pass, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
|
||||
$cancel = parent::cancel($key);
|
||||
|
||||
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if successful, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
|
||||
|
||||
if ($this->ref || $this->refid || $canReturn)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
// This is not needed since parent save already does this
|
||||
// Due to the ref and refid implementation we need to add this
|
||||
if ($canReturn)
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that allows child controller access to model data
|
||||
* after the data has been saved.
|
||||
*
|
||||
* @param JModel &$model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
protected function postSaveHook(JModelLegacy $model, $validData = array())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,44 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Contexts Controller
|
||||
*/
|
||||
class Release_checkingControllerContexts extends JControllerAdmin
|
||||
{
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING_CONTEXTS';
|
||||
|
||||
/**
|
||||
* Method to get a model object, loading it if required.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JModelLegacy The model.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Context', $prefix = 'Release_checkingModel', $config = array('ignore_request' => true))
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Contexts Admin Controller
|
||||
*/
|
||||
class Release_checkingControllerContexts extends AdminController
|
||||
{
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING_CONTEXTS';
|
||||
|
||||
/**
|
||||
* Method to get a model object, loading it if required.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JModelLegacy The model.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Context', $prefix = 'Release_checkingModel', $config = array('ignore_request' => true))
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
|
@ -53,7 +55,7 @@ class Release_checkingControllerContexts extends JControllerAdmin
|
|||
$input = JFactory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
ArrayHelper::toInteger($pks);
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Contexts');
|
||||
// get the data to export
|
||||
|
@ -102,5 +104,5 @@ class Release_checkingControllerContexts extends JControllerAdmin
|
|||
$message = JText::_('COM_RELEASE_CHECKING_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=contexts', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,53 +1,55 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checking Import Controller
|
||||
*/
|
||||
class Release_checkingControllerImport extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Import an spreadsheet.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function import()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$model = $this->getModel('import');
|
||||
if ($model->import())
|
||||
{
|
||||
$cache = JFactory::getCache('mod_menu');
|
||||
$cache->clean();
|
||||
// TODO: Reset the users acl here as well to kill off any missing bits
|
||||
}
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$redirect_url = $app->getUserState('com_release_checking.redirect_url');
|
||||
if (empty($redirect_url))
|
||||
{
|
||||
$redirect_url = JRoute::_('index.php?option=com_release_checking&view=import', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// wipe out the user state when we're going to redirect
|
||||
$app->setUserState('com_release_checking.redirect_url', '');
|
||||
$app->setUserState('com_release_checking.message', '');
|
||||
$app->setUserState('com_release_checking.extension_message', '');
|
||||
}
|
||||
$this->setRedirect($redirect_url);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checking Import Base Controller
|
||||
*/
|
||||
class Release_checkingControllerImport extends BaseController
|
||||
{
|
||||
/**
|
||||
* Import an spreadsheet.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function import()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$model = $this->getModel('import');
|
||||
if ($model->import())
|
||||
{
|
||||
$cache = JFactory::getCache('mod_menu');
|
||||
$cache->clean();
|
||||
// TODO: Reset the users acl here as well to kill off any missing bits
|
||||
}
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$redirect_url = $app->getUserState('com_release_checking.redirect_url');
|
||||
if (empty($redirect_url))
|
||||
{
|
||||
$redirect_url = JRoute::_('index.php?option=com_release_checking&view=import', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// wipe out the user state when we're going to redirect
|
||||
$app->setUserState('com_release_checking.redirect_url', '');
|
||||
$app->setUserState('com_release_checking.message', '');
|
||||
$app->setUserState('com_release_checking.extension_message', '');
|
||||
}
|
||||
$this->setRedirect($redirect_url);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,54 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Joomla_version Controller
|
||||
*/
|
||||
class Release_checkingControllerJoomla_version extends JControllerForm
|
||||
{
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
*
|
||||
* @var string
|
||||
* @since 12.2
|
||||
* @note Replaces _task.
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array $config A named array of configuration variables.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->view_list = 'Joomla_versions'; // safeguard for setting the return view listing to the main view.
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Controller\FormController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Joomla_version Form Controller
|
||||
*/
|
||||
class Release_checkingControllerJoomla_version extends FormController
|
||||
{
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
*
|
||||
* @var string
|
||||
* @since 12.2
|
||||
* @note Replaces _task.
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array $config A named array of configuration variables.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->view_list = 'Joomla_versions'; // safeguard for setting the return view listing to the main view.
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
{
|
||||
// Get user object.
|
||||
$user = JFactory::getUser();
|
||||
|
@ -60,20 +62,20 @@ class Release_checkingControllerJoomla_version extends JControllerForm
|
|||
}
|
||||
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return parent::allowAdd($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
return parent::allowAdd($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
{
|
||||
// get user object.
|
||||
$user = JFactory::getUser();
|
||||
|
@ -116,199 +118,199 @@ class Release_checkingControllerJoomla_version extends JControllerForm
|
|||
}
|
||||
}
|
||||
// Since there is no permission, revert to the component permissions.
|
||||
return parent::allowEdit($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL arguments to append to an item redirect.
|
||||
*
|
||||
* @param integer $recordId The primary key id for the item.
|
||||
* @param string $urlVar The name of the URL variable for the id.
|
||||
*
|
||||
* @return string The arguments to append to the redirect URL.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||
{
|
||||
// get the referral options (old method use return instead see parent)
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// get redirect info.
|
||||
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
|
||||
|
||||
// set the referral options
|
||||
if ($refid && $ref)
|
||||
{
|
||||
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
$append = '&ref='. (string)$ref . $append;
|
||||
}
|
||||
|
||||
return $append;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run batch operations.
|
||||
*
|
||||
* @param object $model The model.
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public function batch($model = null)
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('Joomla_version', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=joomla_versions' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to cancel an edit.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
*
|
||||
* @return boolean True if access level checks pass, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
|
||||
$cancel = parent::cancel($key);
|
||||
|
||||
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if successful, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
|
||||
|
||||
if ($this->ref || $this->refid || $canReturn)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
// This is not needed since parent save already does this
|
||||
// Due to the ref and refid implementation we need to add this
|
||||
if ($canReturn)
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that allows child controller access to model data
|
||||
* after the data has been saved.
|
||||
*
|
||||
* @param JModel &$model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
protected function postSaveHook(JModelLegacy $model, $validData = array())
|
||||
return parent::allowEdit($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL arguments to append to an item redirect.
|
||||
*
|
||||
* @param integer $recordId The primary key id for the item.
|
||||
* @param string $urlVar The name of the URL variable for the id.
|
||||
*
|
||||
* @return string The arguments to append to the redirect URL.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
// get the referral options (old method use return instead see parent)
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// get redirect info.
|
||||
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
|
||||
|
||||
// set the referral options
|
||||
if ($refid && $ref)
|
||||
{
|
||||
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
$append = '&ref='. (string)$ref . $append;
|
||||
}
|
||||
|
||||
return $append;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run batch operations.
|
||||
*
|
||||
* @param object $model The model.
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public function batch($model = null)
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('Joomla_version', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=joomla_versions' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to cancel an edit.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
*
|
||||
* @return boolean True if access level checks pass, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
|
||||
$cancel = parent::cancel($key);
|
||||
|
||||
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if successful, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
|
||||
|
||||
if ($this->ref || $this->refid || $canReturn)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
// This is not needed since parent save already does this
|
||||
// Due to the ref and refid implementation we need to add this
|
||||
if ($canReturn)
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that allows child controller access to model data
|
||||
* after the data has been saved.
|
||||
*
|
||||
* @param JModel &$model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
protected function postSaveHook(JModelLegacy $model, $validData = array())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,44 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Joomla_versions Controller
|
||||
*/
|
||||
class Release_checkingControllerJoomla_versions extends JControllerAdmin
|
||||
{
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING_JOOMLA_VERSIONS';
|
||||
|
||||
/**
|
||||
* Method to get a model object, loading it if required.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JModelLegacy The model.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Joomla_version', $prefix = 'Release_checkingModel', $config = array('ignore_request' => true))
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Joomla_versions Admin Controller
|
||||
*/
|
||||
class Release_checkingControllerJoomla_versions extends AdminController
|
||||
{
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING_JOOMLA_VERSIONS';
|
||||
|
||||
/**
|
||||
* Method to get a model object, loading it if required.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JModelLegacy The model.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Joomla_version', $prefix = 'Release_checkingModel', $config = array('ignore_request' => true))
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
|
@ -53,7 +55,7 @@ class Release_checkingControllerJoomla_versions extends JControllerAdmin
|
|||
$input = JFactory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
ArrayHelper::toInteger($pks);
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Joomla_versions');
|
||||
// get the data to export
|
||||
|
@ -102,5 +104,5 @@ class Release_checkingControllerJoomla_versions extends JControllerAdmin
|
|||
$message = JText::_('COM_RELEASE_CHECKING_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=joomla_versions', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,54 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_check Controller
|
||||
*/
|
||||
class Release_checkingControllerRelease_check extends JControllerForm
|
||||
{
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
*
|
||||
* @var string
|
||||
* @since 12.2
|
||||
* @note Replaces _task.
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array $config A named array of configuration variables.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->view_list = 'Release_checks'; // safeguard for setting the return view listing to the main view.
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Controller\FormController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_check Form Controller
|
||||
*/
|
||||
class Release_checkingControllerRelease_check extends FormController
|
||||
{
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
*
|
||||
* @var string
|
||||
* @since 12.2
|
||||
* @note Replaces _task.
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array $config A named array of configuration variables.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->view_list = 'Release_checks'; // safeguard for setting the return view listing to the main view.
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
{
|
||||
// Get user object.
|
||||
$user = JFactory::getUser();
|
||||
|
@ -60,20 +62,20 @@ class Release_checkingControllerRelease_check extends JControllerForm
|
|||
}
|
||||
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return parent::allowAdd($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
return parent::allowAdd($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
{
|
||||
// get user object.
|
||||
$user = JFactory::getUser();
|
||||
|
@ -116,199 +118,199 @@ class Release_checkingControllerRelease_check extends JControllerForm
|
|||
}
|
||||
}
|
||||
// Since there is no permission, revert to the component permissions.
|
||||
return parent::allowEdit($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL arguments to append to an item redirect.
|
||||
*
|
||||
* @param integer $recordId The primary key id for the item.
|
||||
* @param string $urlVar The name of the URL variable for the id.
|
||||
*
|
||||
* @return string The arguments to append to the redirect URL.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||
{
|
||||
// get the referral options (old method use return instead see parent)
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// get redirect info.
|
||||
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
|
||||
|
||||
// set the referral options
|
||||
if ($refid && $ref)
|
||||
{
|
||||
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
$append = '&ref='. (string)$ref . $append;
|
||||
}
|
||||
|
||||
return $append;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run batch operations.
|
||||
*
|
||||
* @param object $model The model.
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public function batch($model = null)
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('Release_check', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=release_checks' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to cancel an edit.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
*
|
||||
* @return boolean True if access level checks pass, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
|
||||
$cancel = parent::cancel($key);
|
||||
|
||||
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if successful, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
|
||||
|
||||
if ($this->ref || $this->refid || $canReturn)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
// This is not needed since parent save already does this
|
||||
// Due to the ref and refid implementation we need to add this
|
||||
if ($canReturn)
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that allows child controller access to model data
|
||||
* after the data has been saved.
|
||||
*
|
||||
* @param JModel &$model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
protected function postSaveHook(JModelLegacy $model, $validData = array())
|
||||
return parent::allowEdit($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL arguments to append to an item redirect.
|
||||
*
|
||||
* @param integer $recordId The primary key id for the item.
|
||||
* @param string $urlVar The name of the URL variable for the id.
|
||||
*
|
||||
* @return string The arguments to append to the redirect URL.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
// get the referral options (old method use return instead see parent)
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// get redirect info.
|
||||
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
|
||||
|
||||
// set the referral options
|
||||
if ($refid && $ref)
|
||||
{
|
||||
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
$append = '&ref='. (string)$ref . $append;
|
||||
}
|
||||
|
||||
return $append;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run batch operations.
|
||||
*
|
||||
* @param object $model The model.
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public function batch($model = null)
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('Release_check', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=release_checks' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to cancel an edit.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
*
|
||||
* @return boolean True if access level checks pass, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
|
||||
$cancel = parent::cancel($key);
|
||||
|
||||
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if successful, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
|
||||
|
||||
if ($this->ref || $this->refid || $canReturn)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
// This is not needed since parent save already does this
|
||||
// Due to the ref and refid implementation we need to add this
|
||||
if ($canReturn)
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that allows child controller access to model data
|
||||
* after the data has been saved.
|
||||
*
|
||||
* @param JModel &$model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
protected function postSaveHook(JModelLegacy $model, $validData = array())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,44 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checks Controller
|
||||
*/
|
||||
class Release_checkingControllerRelease_checks extends JControllerAdmin
|
||||
{
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING_RELEASE_CHECKS';
|
||||
|
||||
/**
|
||||
* Method to get a model object, loading it if required.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JModelLegacy The model.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Release_check', $prefix = 'Release_checkingModel', $config = array('ignore_request' => true))
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checks Admin Controller
|
||||
*/
|
||||
class Release_checkingControllerRelease_checks extends AdminController
|
||||
{
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING_RELEASE_CHECKS';
|
||||
|
||||
/**
|
||||
* Method to get a model object, loading it if required.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JModelLegacy The model.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Release_check', $prefix = 'Release_checkingModel', $config = array('ignore_request' => true))
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
|
@ -53,7 +55,7 @@ class Release_checkingControllerRelease_checks extends JControllerAdmin
|
|||
$input = JFactory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
ArrayHelper::toInteger($pks);
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Release_checks');
|
||||
// get the data to export
|
||||
|
@ -102,5 +104,5 @@ class Release_checkingControllerRelease_checks extends JControllerAdmin
|
|||
$message = JText::_('COM_RELEASE_CHECKING_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=release_checks', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,69 +1,70 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
class release_checkingHeaderCheck
|
||||
{
|
||||
function js_loaded($script_name)
|
||||
{
|
||||
// UIkit check point
|
||||
if (strpos($script_name,'uikit') !== false)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$getTemplateName = $app->getTemplate('template')->template;
|
||||
|
||||
if (strpos($getTemplateName,'yoo') !== false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
$head_data = $document->getHeadData();
|
||||
foreach (array_keys($head_data['scripts']) as $script)
|
||||
{
|
||||
if (stristr($script, $script_name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function css_loaded($script_name)
|
||||
{
|
||||
// UIkit check point
|
||||
if (strpos($script_name,'uikit') !== false)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$getTemplateName = $app->getTemplate('template')->template;
|
||||
|
||||
if (strpos($getTemplateName,'yoo') !== false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
$head_data = $document->getHeadData();
|
||||
|
||||
foreach (array_keys($head_data['styleSheets']) as $script)
|
||||
{
|
||||
if (stristr($script, $script_name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
class release_checkingHeaderCheck
|
||||
{
|
||||
function js_loaded($script_name)
|
||||
{
|
||||
// UIkit check point
|
||||
if (strpos($script_name,'uikit') !== false)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$getTemplateName = $app->getTemplate('template')->template;
|
||||
|
||||
if (strpos($getTemplateName,'yoo') !== false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
$head_data = $document->getHeadData();
|
||||
foreach (array_keys($head_data['scripts']) as $script)
|
||||
{
|
||||
if (stristr($script, $script_name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function css_loaded($script_name)
|
||||
{
|
||||
// UIkit check point
|
||||
if (strpos($script_name,'uikit') !== false)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$getTemplateName = $app->getTemplate('template')->template;
|
||||
|
||||
if (strpos($getTemplateName,'yoo') !== false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
$head_data = $document->getHeadData();
|
||||
|
||||
foreach (array_keys($head_data['styleSheets']) as $script)
|
||||
{
|
||||
if (stristr($script, $script_name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,76 +1,77 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Utility class to render a list view batch selection options
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
abstract class JHtmlBatch_
|
||||
{
|
||||
/**
|
||||
* ListSelection
|
||||
*
|
||||
* @var array
|
||||
* @since 3.0
|
||||
*/
|
||||
protected static $ListSelection = array();
|
||||
|
||||
/**
|
||||
* Render the batch selection options.
|
||||
*
|
||||
* @return string The necessary HTML to display the batch selection options
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static function render()
|
||||
{
|
||||
// Collect display data
|
||||
$data = new stdClass;
|
||||
$data->ListSelection = static::getListSelection();
|
||||
|
||||
// Create a layout object and ask it to render the batch selection options
|
||||
$layout = new JLayoutFile('batchselection');
|
||||
$batchHtml = $layout->render($data);
|
||||
|
||||
return $batchHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to add a list selection to the batch modal
|
||||
*
|
||||
* @param string $label Label for the menu item.
|
||||
* @param string $name Name for the filter. Also used as id.
|
||||
* @param string $options Options for the select field.
|
||||
* @param bool $noDefault Don't the label as the empty option
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static function addListSelection($label, $name, $options, $noDefault = false)
|
||||
{
|
||||
array_push(static::$ListSelection, array('label' => $label, 'name' => $name, 'options' => $options, 'noDefault' => $noDefault));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all ListSelection
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static function getListSelection()
|
||||
{
|
||||
return static::$ListSelection;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Utility class to render a list view batch selection options
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
abstract class JHtmlBatch_
|
||||
{
|
||||
/**
|
||||
* ListSelection
|
||||
*
|
||||
* @var array
|
||||
* @since 3.0
|
||||
*/
|
||||
protected static $ListSelection = array();
|
||||
|
||||
/**
|
||||
* Render the batch selection options.
|
||||
*
|
||||
* @return string The necessary HTML to display the batch selection options
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static function render()
|
||||
{
|
||||
// Collect display data
|
||||
$data = new stdClass;
|
||||
$data->ListSelection = static::getListSelection();
|
||||
|
||||
// Create a layout object and ask it to render the batch selection options
|
||||
$layout = new JLayoutFile('batchselection');
|
||||
$batchHtml = $layout->render($data);
|
||||
|
||||
return $batchHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to add a list selection to the batch modal
|
||||
*
|
||||
* @param string $label Label for the menu item.
|
||||
* @param string $name Name for the filter. Also used as id.
|
||||
* @param string $options Options for the select field.
|
||||
* @param bool $noDefault Don't the label as the empty option
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static function addListSelection($label, $name, $options, $noDefault = false)
|
||||
{
|
||||
array_push(static::$ListSelection, array('label' => $label, 'name' => $name, 'options' => $options, 'noDefault' => $noDefault));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all ListSelection
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static function getListSelection()
|
||||
{
|
||||
return static::$ListSelection;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,17 +32,14 @@ COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_UNFEATURED="%s Actions unfeatured."
|
|||
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_UNFEATURED_1="%s Action unfeatured."
|
||||
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_UNPUBLISHED="%s Actions unpublished."
|
||||
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_UNPUBLISHED_1="%s Action unpublished."
|
||||
COM_RELEASE_CHECKING_ACTION_ALIAS="Alias"
|
||||
COM_RELEASE_CHECKING_ACTION_ALIAS_HINT="Auto-generated from name"
|
||||
COM_RELEASE_CHECKING_ACTION_ALIAS_LABEL="Alias"
|
||||
COM_RELEASE_CHECKING_ACTION_CONTEXT="Context"
|
||||
COM_RELEASE_CHECKING_ACTION_CONTEXT_DESCRIPTION="Select the context."
|
||||
COM_RELEASE_CHECKING_ACTION_CONTEXT_LABEL="Context"
|
||||
COM_RELEASE_CHECKING_ACTION_CREATED_BY_DESC="The user that created this Action."
|
||||
COM_RELEASE_CHECKING_ACTION_CREATED_BY_LABEL="Created By"
|
||||
COM_RELEASE_CHECKING_ACTION_CREATED_DATE_DESC="The date this Action was created."
|
||||
COM_RELEASE_CHECKING_ACTION_CREATED_DATE_LABEL="Created Date"
|
||||
COM_RELEASE_CHECKING_ACTION_DESCRIPTION="Description"
|
||||
COM_RELEASE_CHECKING_ACTION_DESCRIPTION_DESCRIPTION="Add Description Here"
|
||||
COM_RELEASE_CHECKING_ACTION_DESCRIPTION_HINT="Add Description Here"
|
||||
COM_RELEASE_CHECKING_ACTION_DESCRIPTION_LABEL="Description"
|
||||
|
@ -54,7 +51,6 @@ COM_RELEASE_CHECKING_ACTION_MODIFIED_BY_DESC="The last user that modified this A
|
|||
COM_RELEASE_CHECKING_ACTION_MODIFIED_BY_LABEL="Modified By"
|
||||
COM_RELEASE_CHECKING_ACTION_MODIFIED_DATE_DESC="The date this Action was modified."
|
||||
COM_RELEASE_CHECKING_ACTION_MODIFIED_DATE_LABEL="Modified Date"
|
||||
COM_RELEASE_CHECKING_ACTION_NAME="Name"
|
||||
COM_RELEASE_CHECKING_ACTION_NAME_DESCRIPTION="Enter Name Here"
|
||||
COM_RELEASE_CHECKING_ACTION_NAME_HINT="Name Here"
|
||||
COM_RELEASE_CHECKING_ACTION_NAME_LABEL="Name"
|
||||
|
@ -69,6 +65,7 @@ COM_RELEASE_CHECKING_ACTION_VERSION_DESC="A count of the number of times this Ac
|
|||
COM_RELEASE_CHECKING_ACTION_VERSION_LABEL="Version"
|
||||
COM_RELEASE_CHECKING_ALL_DONE_HERE_SELECT_THE_NEXT_CONTEXT="All done here, select the next context"
|
||||
COM_RELEASE_CHECKING_ARCHIVED="Archived"
|
||||
COM_RELEASE_CHECKING_ARE_YOU_SURE_YOU_WANT_TO_DELETE_CONFIRMING_WILL_PERMANENTLY_DELETE_THE_SELECTED_ITEMS="Are you sure you want to delete? Confirming will permanently delete the selected item(s)!"
|
||||
COM_RELEASE_CHECKING_AUTHOR="Author"
|
||||
COM_RELEASE_CHECKING_BACK="Back"
|
||||
COM_RELEASE_CHECKING_CHECKED_BY="Checked By"
|
||||
|
@ -121,7 +118,6 @@ COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_UNFEATURED="%s Contexts unfeatured."
|
|||
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_UNFEATURED_1="%s Context unfeatured."
|
||||
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_UNPUBLISHED="%s Contexts unpublished."
|
||||
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_UNPUBLISHED_1="%s Context unpublished."
|
||||
COM_RELEASE_CHECKING_CONTEXT_ALIAS="Alias"
|
||||
COM_RELEASE_CHECKING_CONTEXT_ALIAS_HINT="Auto-generated from name"
|
||||
COM_RELEASE_CHECKING_CONTEXT_ALIAS_LABEL="Alias"
|
||||
COM_RELEASE_CHECKING_CONTEXT_CREATED_BY_DESC="The user that created this Context."
|
||||
|
@ -136,7 +132,6 @@ COM_RELEASE_CHECKING_CONTEXT_MODIFIED_BY_DESC="The last user that modified this
|
|||
COM_RELEASE_CHECKING_CONTEXT_MODIFIED_BY_LABEL="Modified By"
|
||||
COM_RELEASE_CHECKING_CONTEXT_MODIFIED_DATE_DESC="The date this Context was modified."
|
||||
COM_RELEASE_CHECKING_CONTEXT_MODIFIED_DATE_LABEL="Modified Date"
|
||||
COM_RELEASE_CHECKING_CONTEXT_NAME="Name"
|
||||
COM_RELEASE_CHECKING_CONTEXT_NAME_DESCRIPTION="Enter Name Here"
|
||||
COM_RELEASE_CHECKING_CONTEXT_NAME_HINT="Name Here"
|
||||
COM_RELEASE_CHECKING_CONTEXT_NAME_LABEL="Name"
|
||||
|
@ -163,9 +158,40 @@ COM_RELEASE_CHECKING_EDIT_CREATED_DATE_DESC="Allows users in this group to edit
|
|||
COM_RELEASE_CHECKING_EDIT_S="Edit %s"
|
||||
COM_RELEASE_CHECKING_EDIT_VERSIONS="Edit Version"
|
||||
COM_RELEASE_CHECKING_EDIT_VERSIONS_DESC="Allows users in this group to edit versions."
|
||||
COM_RELEASE_CHECKING_EMPTY_TRASH="Empty trash"
|
||||
COM_RELEASE_CHECKING_EXIT_TRASH="Exit trash"
|
||||
COM_RELEASE_CHECKING_EXPORT_DATA="Export Data"
|
||||
COM_RELEASE_CHECKING_EXPORT_DATA_DESC="Allows users in this group to export data."
|
||||
COM_RELEASE_CHECKING_EXPORT_FAILED="Export Failed"
|
||||
COM_RELEASE_CHECKING_FILTER_ACTION_ASCENDING="Action ascending"
|
||||
COM_RELEASE_CHECKING_FILTER_ACTION_DESCENDING="Action descending"
|
||||
COM_RELEASE_CHECKING_FILTER_CONTEXT_ASCENDING="Context ascending"
|
||||
COM_RELEASE_CHECKING_FILTER_CONTEXT_DESCENDING="Context descending"
|
||||
COM_RELEASE_CHECKING_FILTER_CREATED_BY_ASCENDING="Created By ascending"
|
||||
COM_RELEASE_CHECKING_FILTER_CREATED_BY_DESCENDING="Created By descending"
|
||||
COM_RELEASE_CHECKING_FILTER_JOOMLA_VERSION_ASCENDING="Joomla Version ascending"
|
||||
COM_RELEASE_CHECKING_FILTER_JOOMLA_VERSION_DESCENDING="Joomla Version descending"
|
||||
COM_RELEASE_CHECKING_FILTER_NAME_ASCENDING="Name ascending"
|
||||
COM_RELEASE_CHECKING_FILTER_NAME_DESCENDING="Name descending"
|
||||
COM_RELEASE_CHECKING_FILTER_OUTCOME_ASCENDING="Outcome ascending"
|
||||
COM_RELEASE_CHECKING_FILTER_OUTCOME_DESCENDING="Outcome descending"
|
||||
COM_RELEASE_CHECKING_FILTER_PUBLISHED="Status"
|
||||
COM_RELEASE_CHECKING_FILTER_PUBLISHED_ACTIONS="Status options for actions"
|
||||
COM_RELEASE_CHECKING_FILTER_PUBLISHED_CONTEXTS="Status options for contexts"
|
||||
COM_RELEASE_CHECKING_FILTER_PUBLISHED_JOOMLA_VERSIONS="Status options for joomla versions"
|
||||
COM_RELEASE_CHECKING_FILTER_PUBLISHED_RELEASE_CHECKS="Status options for release checks"
|
||||
COM_RELEASE_CHECKING_FILTER_SEARCH="Searchrelease checks"
|
||||
COM_RELEASE_CHECKING_FILTER_SEARCH_ACTIONS="Search the action items. Prefix with ID: to search for an item by ID."
|
||||
COM_RELEASE_CHECKING_FILTER_SEARCH_CONTEXTS="Search the context items. Prefix with ID: to search for an item by ID."
|
||||
COM_RELEASE_CHECKING_FILTER_SEARCH_JOOMLA_VERSIONS="Search the joomla version items. Prefix with ID: to search for an item by ID."
|
||||
COM_RELEASE_CHECKING_FILTER_SEARCH_RELEASE_CHECKS="Search the release check items. Prefix with ID: to search for an item by ID."
|
||||
COM_RELEASE_CHECKING_FILTER_SELECT_ACCESS="Select Access"
|
||||
COM_RELEASE_CHECKING_FILTER_SELECT_ACTION="Select Action"
|
||||
COM_RELEASE_CHECKING_FILTER_SELECT_CONTEXT="Select Context"
|
||||
COM_RELEASE_CHECKING_FILTER_SELECT_CREATED_BY="Select Created By"
|
||||
COM_RELEASE_CHECKING_FILTER_SELECT_JOOMLA_VERSION="Select Joomla Version"
|
||||
COM_RELEASE_CHECKING_FILTER_SELECT_NAME="Select Name"
|
||||
COM_RELEASE_CHECKING_FILTER_SELECT_OUTCOME="Select Outcome"
|
||||
COM_RELEASE_CHECKING_HELP_MANAGER="Help"
|
||||
COM_RELEASE_CHECKING_IMPORT_CONTINUE="Continue"
|
||||
COM_RELEASE_CHECKING_IMPORT_DATA="Import Data"
|
||||
|
@ -242,7 +268,6 @@ COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_UNPUBLISHED="%s Joomla Versions unp
|
|||
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_UNPUBLISHED_1="%s Joomla Version unpublished."
|
||||
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_SUBMENU="Joomla Versions Submenu"
|
||||
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_SUBMENU_DESC="Allows the users in this group to submenu of joomla version"
|
||||
COM_RELEASE_CHECKING_JOOMLA_VERSION_ALIAS="Alias"
|
||||
COM_RELEASE_CHECKING_JOOMLA_VERSION_ALIAS_HINT="Auto-generated from name"
|
||||
COM_RELEASE_CHECKING_JOOMLA_VERSION_ALIAS_LABEL="Alias"
|
||||
COM_RELEASE_CHECKING_JOOMLA_VERSION_CREATED_BY_DESC="The user that created this Joomla Version."
|
||||
|
@ -257,7 +282,6 @@ COM_RELEASE_CHECKING_JOOMLA_VERSION_MODIFIED_BY_DESC="The last user that modifie
|
|||
COM_RELEASE_CHECKING_JOOMLA_VERSION_MODIFIED_BY_LABEL="Modified By"
|
||||
COM_RELEASE_CHECKING_JOOMLA_VERSION_MODIFIED_DATE_DESC="The date this Joomla Version was modified."
|
||||
COM_RELEASE_CHECKING_JOOMLA_VERSION_MODIFIED_DATE_LABEL="Modified Date"
|
||||
COM_RELEASE_CHECKING_JOOMLA_VERSION_NAME="Name"
|
||||
COM_RELEASE_CHECKING_JOOMLA_VERSION_NAME_DESCRIPTION="Enter Name Here"
|
||||
COM_RELEASE_CHECKING_JOOMLA_VERSION_NAME_HINT="Name Here"
|
||||
COM_RELEASE_CHECKING_JOOMLA_VERSION_NAME_LABEL="Name"
|
||||
|
@ -332,14 +356,11 @@ COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_UNPUBLISHED="%s Release Checks unpub
|
|||
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_UNPUBLISHED_1="%s Release Check unpublished."
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECKS_SUBMENU="Release Checks Submenu"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECKS_SUBMENU_DESC="Allows the users in this group to submenu of release check"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_ACTION="Action"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_ACTION_DESCRIPTION="Please select the action this release_check belongs to."
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_ACTION_LABEL="Action"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_CHECKING="Checking"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_CONTEXT="Context"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_CONTEXT_DESCRIPTION="Select the context."
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_CONTEXT_LABEL="Context"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_CREATED_BY="Created By"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_CREATED_BY_DESC="The user that created this Release Check."
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_CREATED_BY_DESCRIPTION="The user that created this."
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_CREATED_BY_LABEL="Created By"
|
||||
|
@ -349,7 +370,6 @@ COM_RELEASE_CHECKING_RELEASE_CHECK_EDIT="Editing the Release Check"
|
|||
COM_RELEASE_CHECKING_RELEASE_CHECK_ERROR_UNIQUE_ALIAS="Another Release Check has the same alias."
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_FAILURE="Failure"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_ID="Id"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_JOOMLA_VERSION="Joomla Version"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_JOOMLA_VERSION_DESCRIPTION="Select the Joomla version being tested"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_JOOMLA_VERSION_LABEL="Joomla Version"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_MODIFIED_BY_DESC="The last user that modified this Release Check."
|
||||
|
@ -358,7 +378,6 @@ COM_RELEASE_CHECKING_RELEASE_CHECK_MODIFIED_DATE_DESC="The date this Release Che
|
|||
COM_RELEASE_CHECKING_RELEASE_CHECK_MODIFIED_DATE_LABEL="Modified Date"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_NEW="A New Release Check"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_ORDERING_LABEL="Ordering"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_OUTCOME="Outcome"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_OUTCOME_DESCRIPTION="Select the test outcome"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_OUTCOME_LABEL="Outcome"
|
||||
COM_RELEASE_CHECKING_RELEASE_CHECK_PERMISSION="Permissions"
|
||||
|
@ -375,6 +394,8 @@ COM_RELEASE_CHECKING_SELECT="Select"
|
|||
COM_RELEASE_CHECKING_SUBMENU_JOOMLA_VERSIONS="Joomla Versions"
|
||||
COM_RELEASE_CHECKING_SUBMENU_RELEASE_CHECKS="Release Checks"
|
||||
COM_RELEASE_CHECKING_TRASHED="Trashed"
|
||||
COM_RELEASE_CHECKING_TRASHED_ITEMS="Trashed items"
|
||||
COM_RELEASE_CHECKING_TRASH_AREA="Trash Area"
|
||||
COM_RELEASE_CHECKING_TYPE_ACTION="Action"
|
||||
COM_RELEASE_CHECKING_TYPE_CONTEXT="Context"
|
||||
COM_RELEASE_CHECKING_TYPE_JOOMLA_VERSION="Joomla Version"
|
||||
|
@ -383,4 +404,6 @@ COM_RELEASE_CHECKING_USE_BATCH="Use Batch"
|
|||
COM_RELEASE_CHECKING_USE_BATCH_DESC="Allows users in this group to use batch copy/update method."
|
||||
COM_RELEASE_CHECKING_VERSION="Version"
|
||||
COM_RELEASE_CHECKING_WEBSITE="Website"
|
||||
COM_RELEASE_CHECKING_YOU_ARE_CURRENTLY_VIEWING_THE_TRASHED_ITEMS="You are currently viewing the trashed items."
|
||||
COM_RELEASE_CHECKING_YOU_ARE_CURRENTLY_VIEWING_THE_TRASH_AREA_AND_YOU_DONT_HAVE_ANY_ITEMS_IN_TRASH_AT_THE_MOMENT="You are currently viewing the trash area, and you don't have any items in trash at the moment!"
|
||||
COM_RELEASE_CHECKING_YOU_MUST_FIRST_SELECT_THE_JOOMLA_VERSION_BEING_TESTED="You must first select the Joomla version being tested!"
|
|
@ -1,43 +1,44 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'name',
|
||||
'alias'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<div class="form-inline form-inline-header">
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
'alias'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<div class="form-inline form-inline-header">
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,42 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'description'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<div class="form-vertical">
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'description'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<div class="form-vertical">
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,40 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'context'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'context'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,43 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'title',
|
||||
'created',
|
||||
'created_by',
|
||||
'modified',
|
||||
'modified_by'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
'modified_by'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,45 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'published',
|
||||
'ordering',
|
||||
'access',
|
||||
'version',
|
||||
'hits',
|
||||
'id'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
'id'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,46 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
JHtmlBehavior::core();
|
||||
$divWrapper = range(1,120,2);
|
||||
$counter = 0;
|
||||
?>
|
||||
<?php if ($displayData->ListSelection) : ?>
|
||||
<div class="row-fluid">
|
||||
<?php foreach ($displayData->ListSelection as $ListSelection) : ?>
|
||||
<div class="control-group span6">
|
||||
<div class="controls">
|
||||
<label for="<?php echo $ListSelection['name']; ?>" class="element-invisible"><?php echo $ListSelection['label']; ?></label>
|
||||
<select name="<?php echo $ListSelection['name']; ?>" id="<?php echo $ListSelection['name']; ?>" class="span12 small">
|
||||
<?php if (!$ListSelection['noDefault']) : ?>
|
||||
<option value=""><?php echo $ListSelection['label']; ?></option>
|
||||
<?php endif; ?>
|
||||
<?php echo $ListSelection['options']; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (in_array($counter,$divWrapper)) : ?>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<?php endif; ?>
|
||||
<?php $counter++; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="control-group radio" id="batch-move-copy">
|
||||
<div class="controls">
|
||||
<label class="radio" id="batch[move_copy]c-lbl" for="batch[move_copy]c">
|
||||
<input type="radio" value="c" id="batch[move_copy]c" name="batch[move_copy]"><?php echo JText::_('Copy'); ?></label>
|
||||
<label class="radio" id="batch[move_copy]m-lbl" for="batch[move_copy]m">
|
||||
<input type="radio" checked="checked" value="m" id="batch[move_copy]m" name="batch[move_copy]"><?php echo JText::_('Update'); ?></label>
|
||||
</div>
|
||||
</div>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
JHtmlBehavior::core();
|
||||
$divWrapper = range(1,120,2);
|
||||
$counter = 0;
|
||||
?>
|
||||
<?php if ($displayData->ListSelection) : ?>
|
||||
<div class="row-fluid">
|
||||
<?php foreach ($displayData->ListSelection as $ListSelection) : ?>
|
||||
<div class="control-group span6">
|
||||
<div class="controls">
|
||||
<label for="<?php echo $ListSelection['name']; ?>" class="element-invisible"><?php echo $ListSelection['label']; ?></label>
|
||||
<select name="<?php echo $ListSelection['name']; ?>" id="<?php echo $ListSelection['name']; ?>" class="span12 small">
|
||||
<?php if (!$ListSelection['noDefault']) : ?>
|
||||
<option value=""><?php echo $ListSelection['label']; ?></option>
|
||||
<?php endif; ?>
|
||||
<?php echo $ListSelection['options']; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (in_array($counter,$divWrapper)) : ?>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<?php endif; ?>
|
||||
<?php $counter++; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="control-group radio" id="batch-move-copy">
|
||||
<div class="controls">
|
||||
<label class="radio" id="batch[move_copy]c-lbl" for="batch[move_copy]c">
|
||||
<input type="radio" value="c" id="batch[move_copy]c" name="batch[move_copy]"><?php echo JText::_('Copy'); ?></label>
|
||||
<label class="radio" id="batch[move_copy]m-lbl" for="batch[move_copy]m">
|
||||
<input type="radio" checked="checked" value="m" id="batch[move_copy]m" name="batch[move_copy]"><?php echo JText::_('Update'); ?></label>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
|
@ -1,40 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'name'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'name'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,40 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'alias'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'alias'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,43 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'title',
|
||||
'created',
|
||||
'created_by',
|
||||
'modified',
|
||||
'modified_by'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
'modified_by'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,45 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'published',
|
||||
'ordering',
|
||||
'access',
|
||||
'version',
|
||||
'hits',
|
||||
'id'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
'id'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'name'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
|
@ -1,43 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'name',
|
||||
'alias'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<div class="form-inline form-inline-header">
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'alias'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
|
@ -1,43 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'title',
|
||||
'created',
|
||||
'created_by',
|
||||
'modified',
|
||||
'modified_by'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
'modified_by'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,45 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'published',
|
||||
'ordering',
|
||||
'access',
|
||||
'version',
|
||||
'hits',
|
||||
'id'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
'id'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,42 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'joomla_version'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<div class="form-inline form-inline-header">
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'joomla_version'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<div class="form-inline form-inline-header">
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,41 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'context',
|
||||
'action'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
'action'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,40 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'outcome'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'outcome'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,43 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'title',
|
||||
'created',
|
||||
'created_by',
|
||||
'modified',
|
||||
'modified_by'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
'modified_by'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,45 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'published',
|
||||
'ordering',
|
||||
'access',
|
||||
'version',
|
||||
'hits',
|
||||
'id'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
'id'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die('Restricted access');
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<?php if ($displayData->state->get('filter.published') == -2 && ($displayData->canState && $displayData->canDelete)) : ?>
|
||||
<script>
|
||||
// change the class of the delete button
|
||||
jQuery("#toolbar-delete button").toggleClass("btn-danger");
|
||||
// function to empty the trash
|
||||
function emptyTrash() {
|
||||
if (document.adminForm.boxchecked.value == 0) {
|
||||
// select all the items visable
|
||||
document.adminForm.elements['checkall-toggle'].checked=1;
|
||||
Joomla.checkAll(document.adminForm.elements['checkall-toggle']);
|
||||
// check to confirm the deletion
|
||||
if(confirm('<?= JText::_("COM_RELEASE_CHECKING_ARE_YOU_SURE_YOU_WANT_TO_DELETE_CONFIRMING_WILL_PERMANENTLY_DELETE_THE_SELECTED_ITEMS") ?>')) {
|
||||
Joomla.submitbutton('<?= $displayData->get("name") ?>.delete');
|
||||
} else {
|
||||
document.adminForm.elements['checkall-toggle'].checked=0;
|
||||
Joomla.checkAll(document.adminForm.elements['checkall-toggle']);
|
||||
}
|
||||
} else {
|
||||
// confirm deletion of those selected
|
||||
if (confirm('<?= JText::_("COM_RELEASE_CHECKING_ARE_YOU_SURE_YOU_WANT_TO_DELETE_CONFIRMING_WILL_PERMANENTLY_DELETE_THE_SELECTED_ITEMS") ?>')) {
|
||||
Joomla.submitbutton('<?= $displayData->get("name") ?>.delete');
|
||||
};
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// function to exit the tash state
|
||||
function exitTrash() {
|
||||
document.adminForm.filter_published.selectedIndex = 0;
|
||||
document.adminForm.submit();
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<div class="alert alert-error">
|
||||
<?php if (empty($displayData->items)): ?>
|
||||
<h4 class="alert-heading">
|
||||
<span class="icon-trash"></span>
|
||||
<?= JText::_("COM_RELEASE_CHECKING_TRASH_AREA") ?>
|
||||
</h4>
|
||||
<p><?= JText::_("COM_RELEASE_CHECKING_YOU_ARE_CURRENTLY_VIEWING_THE_TRASH_AREA_AND_YOU_DONT_HAVE_ANY_ITEMS_IN_TRASH_AT_THE_MOMENT") ?></p>
|
||||
<?php else: ?>
|
||||
<h4 class="alert-heading">
|
||||
<span class="icon-trash"></span>
|
||||
<?= JText::_("COM_RELEASE_CHECKING_TRASHED_ITEMS") ?>
|
||||
</h4>
|
||||
<p><?= JText::_("COM_RELEASE_CHECKING_YOU_ARE_CURRENTLY_VIEWING_THE_TRASHED_ITEMS") ?></p>
|
||||
<button onclick="emptyTrash();" class="btn btn-small btn-danger">
|
||||
<span class="icon-delete" aria-hidden="true"></span>
|
||||
<?= JText::_("COM_RELEASE_CHECKING_EMPTY_TRASH") ?>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<button onclick="exitTrash();" class="btn btn-small">
|
||||
<span class="icon-back" aria-hidden="true"></span>
|
||||
<?= JText::_("COM_RELEASE_CHECKING_EXIT_TRASH") ?>
|
||||
</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
|
@ -1,29 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\AdminModel;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checking Action Model
|
||||
*/
|
||||
class Release_checkingModelAction extends JModelAdmin
|
||||
{
|
||||
/**
|
||||
* The tab layout fields array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checking Action Admin Model
|
||||
*/
|
||||
class Release_checkingModelAction extends AdminModel
|
||||
{
|
||||
/**
|
||||
* The tab layout fields array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $tabLayoutFields = array(
|
||||
'details' => array(
|
||||
'left' => array(
|
||||
|
@ -37,94 +39,88 @@ class Release_checkingModelAction extends JModelAdmin
|
|||
'alias'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING';
|
||||
|
||||
/**
|
||||
* The type alias for this content type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
public $typeAlias = 'com_release_checking.action';
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it
|
||||
*
|
||||
* @param type $type The table type to instantiate
|
||||
* @param string $prefix A prefix for the table class name. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JTable A database object
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTable($type = 'action', $prefix = 'Release_checkingTable', $config = array())
|
||||
{
|
||||
// add table path for when model gets used from other component
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_release_checking/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
*
|
||||
* @param integer $pk The id of the primary key.
|
||||
*
|
||||
* @return mixed Object on success, false on failure.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
if ($item = parent::getItem($pk))
|
||||
{
|
||||
if (!empty($item->params) && !is_array($item->params))
|
||||
{
|
||||
// Convert the params field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->params);
|
||||
$item->params = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->metadata))
|
||||
{
|
||||
// Convert the metadata field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->metadata);
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->id))
|
||||
{
|
||||
$item->tags = new JHelperTags;
|
||||
$item->tags->getTagIds($item->id, 'com_release_checking.action');
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
*
|
||||
* @return mixed A JForm object on success, false on failure
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
|
||||
{
|
||||
// set load data option
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING';
|
||||
|
||||
/**
|
||||
* The type alias for this content type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
public $typeAlias = 'com_release_checking.action';
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it
|
||||
*
|
||||
* @param type $type The table type to instantiate
|
||||
* @param string $prefix A prefix for the table class name. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JTable A database object
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTable($type = 'action', $prefix = 'Release_checkingTable', $config = array())
|
||||
{
|
||||
// add table path for when model gets used from other component
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_release_checking/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
*
|
||||
* @param integer $pk The id of the primary key.
|
||||
*
|
||||
* @return mixed Object on success, false on failure.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
if ($item = parent::getItem($pk))
|
||||
{
|
||||
if (!empty($item->params) && !is_array($item->params))
|
||||
{
|
||||
// Convert the params field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->params);
|
||||
$item->params = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->metadata))
|
||||
{
|
||||
// Convert the metadata field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->metadata);
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
*
|
||||
* @return mixed A JForm object on success, false on failure
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
|
||||
{
|
||||
// set load data option
|
||||
$options['load_data'] = $loadData;
|
||||
// check if xpath was set in options
|
||||
$xpath = false;
|
||||
|
@ -217,29 +213,29 @@ class Release_checkingModelAction extends JModelAdmin
|
|||
$form->setValue($redirectedField, null, $redirectedValue);
|
||||
}
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the form
|
||||
*
|
||||
* @return string script files
|
||||
*/
|
||||
public function getScript()
|
||||
{
|
||||
return 'administrator/components/com_release_checking/models/forms/action.js';
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canDelete($record)
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the form
|
||||
*
|
||||
* @return string script files
|
||||
*/
|
||||
public function getScript()
|
||||
{
|
||||
return 'media/com_release_checking/js/action.js';
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canDelete($record)
|
||||
{
|
||||
if (!empty($record->id))
|
||||
{
|
||||
|
@ -252,19 +248,19 @@ class Release_checkingModelAction extends JModelAdmin
|
|||
// The record has been set. Check the record permissions.
|
||||
return $user->authorise('core.delete', 'com_release_checking.action.' . (int) $record->id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can have its state edited.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canEditState($record)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can have its state edited.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canEditState($record)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$recordId = (!empty($record->id)) ? $record->id : 0;
|
||||
|
@ -279,103 +275,103 @@ class Release_checkingModelAction extends JModelAdmin
|
|||
}
|
||||
}
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return parent::canEditState($record);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
return parent::canEditState($record);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
{
|
||||
// Check specific edit permission then general edit permission.
|
||||
|
||||
return JFactory::getUser()->authorise('core.edit', 'com_release_checking.action.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and sanitise the table data prior to saving.
|
||||
*
|
||||
* @param JTable $table A JTable object.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if (isset($table->name))
|
||||
{
|
||||
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
|
||||
}
|
||||
|
||||
if (isset($table->alias) && empty($table->alias))
|
||||
{
|
||||
$table->generateAlias();
|
||||
}
|
||||
|
||||
if (empty($table->id))
|
||||
{
|
||||
$table->created = $date->toSql();
|
||||
// set the user
|
||||
if ($table->created_by == 0 || empty($table->created_by))
|
||||
{
|
||||
$table->created_by = $user->id;
|
||||
}
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__release_checking_action'));
|
||||
$db->setQuery($query);
|
||||
$max = $db->loadResult();
|
||||
|
||||
$table->ordering = $max + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->modified = $date->toSql();
|
||||
$table->modified_by = $user->id;
|
||||
}
|
||||
|
||||
if (!empty($table->id))
|
||||
{
|
||||
// Increment the items version number.
|
||||
$table->version++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('com_release_checking.edit.action.data', array());
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
// run the perprocess of the data
|
||||
$this->preprocessData('com_release_checking.action', $data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
return JFactory::getUser()->authorise('core.edit', 'com_release_checking.action.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and sanitise the table data prior to saving.
|
||||
*
|
||||
* @param JTable $table A JTable object.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if (isset($table->name))
|
||||
{
|
||||
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
|
||||
}
|
||||
|
||||
if (isset($table->alias) && empty($table->alias))
|
||||
{
|
||||
$table->generateAlias();
|
||||
}
|
||||
|
||||
if (empty($table->id))
|
||||
{
|
||||
$table->created = $date->toSql();
|
||||
// set the user
|
||||
if ($table->created_by == 0 || empty($table->created_by))
|
||||
{
|
||||
$table->created_by = $user->id;
|
||||
}
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__release_checking_action'));
|
||||
$db->setQuery($query);
|
||||
$max = $db->loadResult();
|
||||
|
||||
$table->ordering = $max + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->modified = $date->toSql();
|
||||
$table->modified_by = $user->id;
|
||||
}
|
||||
|
||||
if (!empty($table->id))
|
||||
{
|
||||
// Increment the items version number.
|
||||
$table->version++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('com_release_checking.edit.action.data', array());
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
// run the perprocess of the data
|
||||
$this->preprocessData('com_release_checking.action', $data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -388,141 +384,141 @@ class Release_checkingModelAction extends JModelAdmin
|
|||
protected function getUniqueFields()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to delete one or more records.
|
||||
*
|
||||
* @param array &$pks An array of record primary keys.
|
||||
*
|
||||
* @return boolean True if successful, false if an error occurs.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function delete(&$pks)
|
||||
{
|
||||
if (!parent::delete($pks))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the published state of one or more records.
|
||||
*
|
||||
* @param array &$pks A list of the primary keys to change.
|
||||
* @param integer $value The value of the published state.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function publish(&$pks, $value = 1)
|
||||
{
|
||||
if (!parent::publish($pks, $value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to perform batch operations on an item or a set of items.
|
||||
*
|
||||
* @param array $commands An array of commands to perform.
|
||||
* @param array $pks An array of item ids.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return boolean Returns true on success, false on failure.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function batch($commands, $pks, $contexts)
|
||||
{
|
||||
// Sanitize ids.
|
||||
$pks = array_unique($pks);
|
||||
ArrayHelper::toInteger($pks);
|
||||
|
||||
// Remove any values of zero.
|
||||
if (array_search(0, $pks, true))
|
||||
{
|
||||
unset($pks[array_search(0, $pks, true)]);
|
||||
}
|
||||
|
||||
if (empty($pks))
|
||||
{
|
||||
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = false;
|
||||
|
||||
// Set some needed variables.
|
||||
$this->user = JFactory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = Release_checkingHelper::getActions('action');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->type == false)
|
||||
{
|
||||
$type = new JUcmType;
|
||||
$this->type = $type->getTypeByAlias($this->typeAlias);
|
||||
}
|
||||
|
||||
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
|
||||
|
||||
if (!empty($commands['move_copy']))
|
||||
{
|
||||
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||
|
||||
if ($cmd == 'c')
|
||||
{
|
||||
$result = $this->batchCopy($commands, $pks, $contexts);
|
||||
|
||||
if (is_array($result))
|
||||
{
|
||||
foreach ($result as $old => $new)
|
||||
{
|
||||
$contexts[$new] = $contexts[$old];
|
||||
}
|
||||
$pks = array_values($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = true;
|
||||
}
|
||||
|
||||
if (!$done)
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to delete one or more records.
|
||||
*
|
||||
* @param array &$pks An array of record primary keys.
|
||||
*
|
||||
* @return boolean True if successful, false if an error occurs.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function delete(&$pks)
|
||||
{
|
||||
if (!parent::delete($pks))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the published state of one or more records.
|
||||
*
|
||||
* @param array &$pks A list of the primary keys to change.
|
||||
* @param integer $value The value of the published state.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function publish(&$pks, $value = 1)
|
||||
{
|
||||
if (!parent::publish($pks, $value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to perform batch operations on an item or a set of items.
|
||||
*
|
||||
* @param array $commands An array of commands to perform.
|
||||
* @param array $pks An array of item ids.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return boolean Returns true on success, false on failure.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function batch($commands, $pks, $contexts)
|
||||
{
|
||||
// Sanitize ids.
|
||||
$pks = array_unique($pks);
|
||||
ArrayHelper::toInteger($pks);
|
||||
|
||||
// Remove any values of zero.
|
||||
if (array_search(0, $pks, true))
|
||||
{
|
||||
unset($pks[array_search(0, $pks, true)]);
|
||||
}
|
||||
|
||||
if (empty($pks))
|
||||
{
|
||||
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = false;
|
||||
|
||||
// Set some needed variables.
|
||||
$this->user = JFactory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = Release_checkingHelper::getActions('action');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->type == false)
|
||||
{
|
||||
$type = new JUcmType;
|
||||
$this->type = $type->getTypeByAlias($this->typeAlias);
|
||||
}
|
||||
|
||||
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
|
||||
|
||||
if (!empty($commands['move_copy']))
|
||||
{
|
||||
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||
|
||||
if ($cmd == 'c')
|
||||
{
|
||||
$result = $this->batchCopy($commands, $pks, $contexts);
|
||||
|
||||
if (is_array($result))
|
||||
{
|
||||
foreach ($result as $old => $new)
|
||||
{
|
||||
$contexts[$new] = $contexts[$old];
|
||||
}
|
||||
$pks = array_values($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = true;
|
||||
}
|
||||
|
||||
if (!$done)
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -769,38 +765,38 @@ class Release_checkingModelAction extends JModelAdmin
|
|||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
* @param array $data The form data.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$input = JFactory::getApplication()->input;
|
||||
$filter = JFilterInput::getInstance();
|
||||
|
||||
// set the metadata to the Item Data
|
||||
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
||||
{
|
||||
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
|
||||
|
||||
$metadata = new JRegistry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
{
|
||||
$params = new JRegistry;
|
||||
$params->loadArray($data['params']);
|
||||
$data['params'] = (string) $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
* @param array $data The form data.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$input = JFactory::getApplication()->input;
|
||||
$filter = JFilterInput::getInstance();
|
||||
|
||||
// set the metadata to the Item Data
|
||||
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
||||
{
|
||||
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
|
||||
|
||||
$metadata = new JRegistry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
{
|
||||
$params = new JRegistry;
|
||||
$params->loadArray($data['params']);
|
||||
$data['params'] = (string) $params;
|
||||
}
|
||||
|
||||
// Alter the name for save as copy
|
||||
|
@ -868,37 +864,37 @@ class Release_checkingModelAction extends JModelAdmin
|
|||
$data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parent::save($data))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a unique value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
*
|
||||
* @return string New value.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function generateUnique($field,$value)
|
||||
{
|
||||
|
||||
// set field value unique
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load(array($field => $value)))
|
||||
{
|
||||
$value = StringHelper::increment($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (parent::save($data))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a unique value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
*
|
||||
* @return string New value.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function generateUnique($field,$value)
|
||||
{
|
||||
|
||||
// set field value unique
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load(array($field => $value)))
|
||||
{
|
||||
$value = StringHelper::increment($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -946,5 +942,5 @@ class Release_checkingModelAction extends JModelAdmin
|
|||
}
|
||||
// We only had an alias
|
||||
return $alias;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,106 +1,131 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Actions Model
|
||||
*/
|
||||
class Release_checkingModelActions extends JModelList
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Actions List Model
|
||||
*/
|
||||
class Release_checkingModelActions extends ListModel
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
'a.id','id',
|
||||
'a.published','published',
|
||||
'a.access','access',
|
||||
'a.ordering','ordering',
|
||||
'a.created_by','created_by',
|
||||
'a.modified_by','modified_by',
|
||||
'a.name','name',
|
||||
'g.name'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}
|
||||
'g.name','context'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @param string $ordering An optional ordering field.
|
||||
* @param string $direction An optional direction (asc|desc).
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}
|
||||
|
||||
// Check if the form was submitted
|
||||
$formSubmited = $app->input->post->get('form_submited');
|
||||
|
||||
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
|
||||
if ($formSubmited)
|
||||
{
|
||||
$access = $app->input->post->get('access');
|
||||
$this->setState('filter.access', $access);
|
||||
}
|
||||
|
||||
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
|
||||
$this->setState('filter.published', $published);
|
||||
|
||||
$created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
|
||||
$this->setState('filter.created_by', $created_by);
|
||||
|
||||
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
|
||||
$this->setState('filter.created', $created);
|
||||
|
||||
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||
$this->setState('filter.sorting', $sorting);
|
||||
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
|
||||
$this->setState('filter.name', $name);
|
||||
if ($formSubmited)
|
||||
{
|
||||
$name = $app->input->post->get('name');
|
||||
$this->setState('filter.name', $name);
|
||||
}
|
||||
|
||||
$context = $this->getUserStateFromRequest($this->context . '.filter.context', 'filter_context');
|
||||
$this->setState('filter.context', $context);
|
||||
|
||||
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||
$this->setState('filter.sorting', $sorting);
|
||||
|
||||
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
|
||||
$this->setState('filter.access', $access);
|
||||
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
|
||||
$this->setState('filter.published', $published);
|
||||
|
||||
$created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
|
||||
$this->setState('filter.created_by', $created_by);
|
||||
|
||||
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
|
||||
$this->setState('filter.created', $created);
|
||||
|
||||
// List state information.
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
if ($formSubmited)
|
||||
{
|
||||
$context = $app->input->post->get('context');
|
||||
$this->setState('filter.context', $context);
|
||||
}
|
||||
|
||||
// List state information.
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
// check in items
|
||||
// Check in items
|
||||
$this->checkInNow();
|
||||
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Get the user object.
|
||||
$user = JFactory::getUser();
|
||||
// Create a new query object.
|
||||
|
@ -132,9 +157,17 @@ class Release_checkingModelActions extends JModelList
|
|||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
$_access = $this->getState('filter.access');
|
||||
if ($_access && is_numeric($_access))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
$query->where('a.access = ' . (int) $_access);
|
||||
}
|
||||
elseif (Release_checkingHelper::checkArray($_access))
|
||||
{
|
||||
// Secure the array for the query
|
||||
$_access = ArrayHelper::toInteger($_access);
|
||||
// Filter by the Access Array.
|
||||
$query->where('a.access IN (' . implode(',', $_access) . ')');
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_release_checking'))
|
||||
|
@ -158,9 +191,21 @@ class Release_checkingModelActions extends JModelList
|
|||
}
|
||||
|
||||
// Filter by Name.
|
||||
if ($name = $this->getState('filter.name'))
|
||||
$_name = $this->getState('filter.name');
|
||||
if (is_numeric($_name))
|
||||
{
|
||||
$query->where('a.name = ' . $db->quote($db->escape($name)));
|
||||
if (is_float($_name))
|
||||
{
|
||||
$query->where('a.name = ' . (float) $_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where('a.name = ' . (int) $_name);
|
||||
}
|
||||
}
|
||||
elseif (Release_checkingHelper::checkString($_name))
|
||||
{
|
||||
$query->where('a.name = ' . $db->quote($db->escape($_name)));
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
|
@ -171,7 +216,7 @@ class Release_checkingModelActions extends JModelList
|
|||
$query->order($db->escape($orderCol . ' ' . $orderDirn));
|
||||
}
|
||||
|
||||
return $query;
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -296,27 +341,39 @@ class Release_checkingModelActions extends JModelList
|
|||
return $headers;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
*
|
||||
* @return string A store id.
|
||||
*
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
*
|
||||
* @return string A store id.
|
||||
*
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':' . $this->getState('filter.id');
|
||||
$id .= ':' . $this->getState('filter.search');
|
||||
$id .= ':' . $this->getState('filter.published');
|
||||
// Check if the value is an array
|
||||
$_access = $this->getState('filter.access');
|
||||
if (Release_checkingHelper::checkArray($_access))
|
||||
{
|
||||
$id .= ':' . implode(':', $_access);
|
||||
}
|
||||
// Check if this is only an number or string
|
||||
elseif (is_numeric($_access)
|
||||
|| Release_checkingHelper::checkString($_access))
|
||||
{
|
||||
$id .= ':' . $_access;
|
||||
}
|
||||
$id .= ':' . $this->getState('filter.ordering');
|
||||
$id .= ':' . $this->getState('filter.created_by');
|
||||
$id .= ':' . $this->getState('filter.modified_by');
|
||||
$id .= ':' . $this->getState('filter.name');
|
||||
$id .= ':' . $this->getState('filter.context');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
$id .= ':' . $this->getState('filter.context');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -335,17 +392,19 @@ class Release_checkingModelActions extends JModelList
|
|||
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// reset query
|
||||
// Reset query.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('*');
|
||||
$query->from($db->quoteName('#__release_checking_action'));
|
||||
$db->setQuery($query);
|
||||
// Only select items that are checked out.
|
||||
$query->where($db->quoteName('checked_out') . '!=0');
|
||||
$db->setQuery($query, 0, 1);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
// Get Yesterdays date
|
||||
// Get Yesterdays date.
|
||||
$date = JFactory::getDate()->modify($time)->toSql();
|
||||
// reset query
|
||||
// Reset query.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Fields to update.
|
||||
|
@ -360,7 +419,7 @@ class Release_checkingModelActions extends JModelList
|
|||
$db->quoteName('checked_out_time') . '<\''.$date.'\''
|
||||
);
|
||||
|
||||
// Check table
|
||||
// Check table.
|
||||
$query->update($db->quoteName('#__release_checking_action'))->set($fields)->where($conditions);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
@ -370,5 +429,5 @@ class Release_checkingModelActions extends JModelList
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,30 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checking Ajax Model
|
||||
*/
|
||||
class Release_checkingModelAjax extends JModelList
|
||||
{
|
||||
protected $app_params;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
// get params
|
||||
$this->app_params = JComponentHelper::getParams('com_release_checking');
|
||||
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checking Ajax List Model
|
||||
*/
|
||||
class Release_checkingModelAjax extends ListModel
|
||||
{
|
||||
protected $app_params;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
// get params
|
||||
$this->app_params = JComponentHelper::getParams('com_release_checking');
|
||||
|
||||
}
|
||||
|
||||
// Used in release_check
|
||||
|
@ -59,7 +62,7 @@ class Release_checkingModelAjax extends JModelList
|
|||
$query->select($db->quoteName( array('a.id') ));
|
||||
$query->from($db->quoteName('#__release_checking_action', 'a'));
|
||||
// we also filter out the actions this user already did on this context
|
||||
if (Release_checkingHelper::checkArray($result['removed_ids']))
|
||||
if (UtilitiesArrayHelper::check($result['removed_ids']))
|
||||
{
|
||||
$query->where($db->quoteName('a.id') . ' NOT IN (' . implode(', ', $result['removed_ids']) . ')');
|
||||
}
|
||||
|
@ -92,5 +95,5 @@ class Release_checkingModelAjax extends JModelList
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,29 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\AdminModel;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checking Context Model
|
||||
*/
|
||||
class Release_checkingModelContext extends JModelAdmin
|
||||
{
|
||||
/**
|
||||
* The tab layout fields array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checking Context Admin Model
|
||||
*/
|
||||
class Release_checkingModelContext extends AdminModel
|
||||
{
|
||||
/**
|
||||
* The tab layout fields array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $tabLayoutFields = array(
|
||||
'details' => array(
|
||||
'left' => array(
|
||||
|
@ -33,94 +35,88 @@ class Release_checkingModelContext extends JModelAdmin
|
|||
'alias'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING';
|
||||
|
||||
/**
|
||||
* The type alias for this content type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
public $typeAlias = 'com_release_checking.context';
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it
|
||||
*
|
||||
* @param type $type The table type to instantiate
|
||||
* @param string $prefix A prefix for the table class name. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JTable A database object
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTable($type = 'context', $prefix = 'Release_checkingTable', $config = array())
|
||||
{
|
||||
// add table path for when model gets used from other component
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_release_checking/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
*
|
||||
* @param integer $pk The id of the primary key.
|
||||
*
|
||||
* @return mixed Object on success, false on failure.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
if ($item = parent::getItem($pk))
|
||||
{
|
||||
if (!empty($item->params) && !is_array($item->params))
|
||||
{
|
||||
// Convert the params field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->params);
|
||||
$item->params = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->metadata))
|
||||
{
|
||||
// Convert the metadata field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->metadata);
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->id))
|
||||
{
|
||||
$item->tags = new JHelperTags;
|
||||
$item->tags->getTagIds($item->id, 'com_release_checking.context');
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
*
|
||||
* @return mixed A JForm object on success, false on failure
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
|
||||
{
|
||||
// set load data option
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING';
|
||||
|
||||
/**
|
||||
* The type alias for this content type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
public $typeAlias = 'com_release_checking.context';
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it
|
||||
*
|
||||
* @param type $type The table type to instantiate
|
||||
* @param string $prefix A prefix for the table class name. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JTable A database object
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTable($type = 'context', $prefix = 'Release_checkingTable', $config = array())
|
||||
{
|
||||
// add table path for when model gets used from other component
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_release_checking/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
*
|
||||
* @param integer $pk The id of the primary key.
|
||||
*
|
||||
* @return mixed Object on success, false on failure.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
if ($item = parent::getItem($pk))
|
||||
{
|
||||
if (!empty($item->params) && !is_array($item->params))
|
||||
{
|
||||
// Convert the params field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->params);
|
||||
$item->params = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->metadata))
|
||||
{
|
||||
// Convert the metadata field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->metadata);
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
*
|
||||
* @return mixed A JForm object on success, false on failure
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
|
||||
{
|
||||
// set load data option
|
||||
$options['load_data'] = $loadData;
|
||||
// check if xpath was set in options
|
||||
$xpath = false;
|
||||
|
@ -213,29 +209,29 @@ class Release_checkingModelContext extends JModelAdmin
|
|||
$form->setValue($redirectedField, null, $redirectedValue);
|
||||
}
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the form
|
||||
*
|
||||
* @return string script files
|
||||
*/
|
||||
public function getScript()
|
||||
{
|
||||
return 'administrator/components/com_release_checking/models/forms/context.js';
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canDelete($record)
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the form
|
||||
*
|
||||
* @return string script files
|
||||
*/
|
||||
public function getScript()
|
||||
{
|
||||
return 'media/com_release_checking/js/context.js';
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canDelete($record)
|
||||
{
|
||||
if (!empty($record->id))
|
||||
{
|
||||
|
@ -248,19 +244,19 @@ class Release_checkingModelContext extends JModelAdmin
|
|||
// The record has been set. Check the record permissions.
|
||||
return $user->authorise('core.delete', 'com_release_checking.context.' . (int) $record->id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can have its state edited.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canEditState($record)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can have its state edited.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canEditState($record)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$recordId = (!empty($record->id)) ? $record->id : 0;
|
||||
|
@ -275,103 +271,103 @@ class Release_checkingModelContext extends JModelAdmin
|
|||
}
|
||||
}
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return parent::canEditState($record);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
return parent::canEditState($record);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
{
|
||||
// Check specific edit permission then general edit permission.
|
||||
|
||||
return JFactory::getUser()->authorise('core.edit', 'com_release_checking.context.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and sanitise the table data prior to saving.
|
||||
*
|
||||
* @param JTable $table A JTable object.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if (isset($table->name))
|
||||
{
|
||||
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
|
||||
}
|
||||
|
||||
if (isset($table->alias) && empty($table->alias))
|
||||
{
|
||||
$table->generateAlias();
|
||||
}
|
||||
|
||||
if (empty($table->id))
|
||||
{
|
||||
$table->created = $date->toSql();
|
||||
// set the user
|
||||
if ($table->created_by == 0 || empty($table->created_by))
|
||||
{
|
||||
$table->created_by = $user->id;
|
||||
}
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__release_checking_context'));
|
||||
$db->setQuery($query);
|
||||
$max = $db->loadResult();
|
||||
|
||||
$table->ordering = $max + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->modified = $date->toSql();
|
||||
$table->modified_by = $user->id;
|
||||
}
|
||||
|
||||
if (!empty($table->id))
|
||||
{
|
||||
// Increment the items version number.
|
||||
$table->version++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('com_release_checking.edit.context.data', array());
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
// run the perprocess of the data
|
||||
$this->preprocessData('com_release_checking.context', $data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
return JFactory::getUser()->authorise('core.edit', 'com_release_checking.context.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and sanitise the table data prior to saving.
|
||||
*
|
||||
* @param JTable $table A JTable object.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if (isset($table->name))
|
||||
{
|
||||
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
|
||||
}
|
||||
|
||||
if (isset($table->alias) && empty($table->alias))
|
||||
{
|
||||
$table->generateAlias();
|
||||
}
|
||||
|
||||
if (empty($table->id))
|
||||
{
|
||||
$table->created = $date->toSql();
|
||||
// set the user
|
||||
if ($table->created_by == 0 || empty($table->created_by))
|
||||
{
|
||||
$table->created_by = $user->id;
|
||||
}
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__release_checking_context'));
|
||||
$db->setQuery($query);
|
||||
$max = $db->loadResult();
|
||||
|
||||
$table->ordering = $max + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->modified = $date->toSql();
|
||||
$table->modified_by = $user->id;
|
||||
}
|
||||
|
||||
if (!empty($table->id))
|
||||
{
|
||||
// Increment the items version number.
|
||||
$table->version++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('com_release_checking.edit.context.data', array());
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
// run the perprocess of the data
|
||||
$this->preprocessData('com_release_checking.context', $data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -384,141 +380,141 @@ class Release_checkingModelContext extends JModelAdmin
|
|||
protected function getUniqueFields()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to delete one or more records.
|
||||
*
|
||||
* @param array &$pks An array of record primary keys.
|
||||
*
|
||||
* @return boolean True if successful, false if an error occurs.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function delete(&$pks)
|
||||
{
|
||||
if (!parent::delete($pks))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the published state of one or more records.
|
||||
*
|
||||
* @param array &$pks A list of the primary keys to change.
|
||||
* @param integer $value The value of the published state.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function publish(&$pks, $value = 1)
|
||||
{
|
||||
if (!parent::publish($pks, $value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to perform batch operations on an item or a set of items.
|
||||
*
|
||||
* @param array $commands An array of commands to perform.
|
||||
* @param array $pks An array of item ids.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return boolean Returns true on success, false on failure.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function batch($commands, $pks, $contexts)
|
||||
{
|
||||
// Sanitize ids.
|
||||
$pks = array_unique($pks);
|
||||
ArrayHelper::toInteger($pks);
|
||||
|
||||
// Remove any values of zero.
|
||||
if (array_search(0, $pks, true))
|
||||
{
|
||||
unset($pks[array_search(0, $pks, true)]);
|
||||
}
|
||||
|
||||
if (empty($pks))
|
||||
{
|
||||
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = false;
|
||||
|
||||
// Set some needed variables.
|
||||
$this->user = JFactory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = Release_checkingHelper::getActions('context');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->type == false)
|
||||
{
|
||||
$type = new JUcmType;
|
||||
$this->type = $type->getTypeByAlias($this->typeAlias);
|
||||
}
|
||||
|
||||
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
|
||||
|
||||
if (!empty($commands['move_copy']))
|
||||
{
|
||||
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||
|
||||
if ($cmd == 'c')
|
||||
{
|
||||
$result = $this->batchCopy($commands, $pks, $contexts);
|
||||
|
||||
if (is_array($result))
|
||||
{
|
||||
foreach ($result as $old => $new)
|
||||
{
|
||||
$contexts[$new] = $contexts[$old];
|
||||
}
|
||||
$pks = array_values($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = true;
|
||||
}
|
||||
|
||||
if (!$done)
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to delete one or more records.
|
||||
*
|
||||
* @param array &$pks An array of record primary keys.
|
||||
*
|
||||
* @return boolean True if successful, false if an error occurs.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function delete(&$pks)
|
||||
{
|
||||
if (!parent::delete($pks))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the published state of one or more records.
|
||||
*
|
||||
* @param array &$pks A list of the primary keys to change.
|
||||
* @param integer $value The value of the published state.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function publish(&$pks, $value = 1)
|
||||
{
|
||||
if (!parent::publish($pks, $value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to perform batch operations on an item or a set of items.
|
||||
*
|
||||
* @param array $commands An array of commands to perform.
|
||||
* @param array $pks An array of item ids.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return boolean Returns true on success, false on failure.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function batch($commands, $pks, $contexts)
|
||||
{
|
||||
// Sanitize ids.
|
||||
$pks = array_unique($pks);
|
||||
ArrayHelper::toInteger($pks);
|
||||
|
||||
// Remove any values of zero.
|
||||
if (array_search(0, $pks, true))
|
||||
{
|
||||
unset($pks[array_search(0, $pks, true)]);
|
||||
}
|
||||
|
||||
if (empty($pks))
|
||||
{
|
||||
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = false;
|
||||
|
||||
// Set some needed variables.
|
||||
$this->user = JFactory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = Release_checkingHelper::getActions('context');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->type == false)
|
||||
{
|
||||
$type = new JUcmType;
|
||||
$this->type = $type->getTypeByAlias($this->typeAlias);
|
||||
}
|
||||
|
||||
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
|
||||
|
||||
if (!empty($commands['move_copy']))
|
||||
{
|
||||
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||
|
||||
if ($cmd == 'c')
|
||||
{
|
||||
$result = $this->batchCopy($commands, $pks, $contexts);
|
||||
|
||||
if (is_array($result))
|
||||
{
|
||||
foreach ($result as $old => $new)
|
||||
{
|
||||
$contexts[$new] = $contexts[$old];
|
||||
}
|
||||
$pks = array_values($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = true;
|
||||
}
|
||||
|
||||
if (!$done)
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -765,38 +761,38 @@ class Release_checkingModelContext extends JModelAdmin
|
|||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
* @param array $data The form data.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$input = JFactory::getApplication()->input;
|
||||
$filter = JFilterInput::getInstance();
|
||||
|
||||
// set the metadata to the Item Data
|
||||
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
||||
{
|
||||
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
|
||||
|
||||
$metadata = new JRegistry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
{
|
||||
$params = new JRegistry;
|
||||
$params->loadArray($data['params']);
|
||||
$data['params'] = (string) $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
* @param array $data The form data.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$input = JFactory::getApplication()->input;
|
||||
$filter = JFilterInput::getInstance();
|
||||
|
||||
// set the metadata to the Item Data
|
||||
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
||||
{
|
||||
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
|
||||
|
||||
$metadata = new JRegistry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
{
|
||||
$params = new JRegistry;
|
||||
$params->loadArray($data['params']);
|
||||
$data['params'] = (string) $params;
|
||||
}
|
||||
|
||||
// Alter the name for save as copy
|
||||
|
@ -864,37 +860,37 @@ class Release_checkingModelContext extends JModelAdmin
|
|||
$data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parent::save($data))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a unique value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
*
|
||||
* @return string New value.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function generateUnique($field,$value)
|
||||
{
|
||||
|
||||
// set field value unique
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load(array($field => $value)))
|
||||
{
|
||||
$value = StringHelper::increment($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (parent::save($data))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a unique value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
*
|
||||
* @return string New value.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function generateUnique($field,$value)
|
||||
{
|
||||
|
||||
// set field value unique
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load(array($field => $value)))
|
||||
{
|
||||
$value = StringHelper::increment($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -942,5 +938,5 @@ class Release_checkingModelContext extends JModelAdmin
|
|||
}
|
||||
// We only had an alias
|
||||
return $alias;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,102 +1,123 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Contexts Model
|
||||
*/
|
||||
class Release_checkingModelContexts extends JModelList
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Contexts List Model
|
||||
*/
|
||||
class Release_checkingModelContexts extends ListModel
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
'a.id','id',
|
||||
'a.published','published',
|
||||
'a.access','access',
|
||||
'a.ordering','ordering',
|
||||
'a.created_by','created_by',
|
||||
'a.modified_by','modified_by',
|
||||
'a.name','name'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}
|
||||
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
|
||||
$this->setState('filter.name', $name);
|
||||
|
||||
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||
$this->setState('filter.sorting', $sorting);
|
||||
|
||||
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
|
||||
$this->setState('filter.access', $access);
|
||||
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
|
||||
$this->setState('filter.published', $published);
|
||||
|
||||
$created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
|
||||
$this->setState('filter.created_by', $created_by);
|
||||
|
||||
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
|
||||
$this->setState('filter.created', $created);
|
||||
|
||||
// List state information.
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
'a.name','name'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @param string $ordering An optional ordering field.
|
||||
* @param string $direction An optional direction (asc|desc).
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
// check in items
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}
|
||||
|
||||
// Check if the form was submitted
|
||||
$formSubmited = $app->input->post->get('form_submited');
|
||||
|
||||
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
|
||||
if ($formSubmited)
|
||||
{
|
||||
$access = $app->input->post->get('access');
|
||||
$this->setState('filter.access', $access);
|
||||
}
|
||||
|
||||
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
|
||||
$this->setState('filter.published', $published);
|
||||
|
||||
$created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
|
||||
$this->setState('filter.created_by', $created_by);
|
||||
|
||||
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
|
||||
$this->setState('filter.created', $created);
|
||||
|
||||
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||
$this->setState('filter.sorting', $sorting);
|
||||
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
|
||||
if ($formSubmited)
|
||||
{
|
||||
$name = $app->input->post->get('name');
|
||||
$this->setState('filter.name', $name);
|
||||
}
|
||||
|
||||
// List state information.
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
// Check in items
|
||||
$this->checkInNow();
|
||||
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Get the user object.
|
||||
$user = JFactory::getUser();
|
||||
// Create a new query object.
|
||||
|
@ -124,9 +145,17 @@ class Release_checkingModelContexts extends JModelList
|
|||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
$_access = $this->getState('filter.access');
|
||||
if ($_access && is_numeric($_access))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
$query->where('a.access = ' . (int) $_access);
|
||||
}
|
||||
elseif (Release_checkingHelper::checkArray($_access))
|
||||
{
|
||||
// Secure the array for the query
|
||||
$_access = ArrayHelper::toInteger($_access);
|
||||
// Filter by the Access Array.
|
||||
$query->where('a.access IN (' . implode(',', $_access) . ')');
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_release_checking'))
|
||||
|
@ -150,9 +179,21 @@ class Release_checkingModelContexts extends JModelList
|
|||
}
|
||||
|
||||
// Filter by Name.
|
||||
if ($name = $this->getState('filter.name'))
|
||||
$_name = $this->getState('filter.name');
|
||||
if (is_numeric($_name))
|
||||
{
|
||||
$query->where('a.name = ' . $db->quote($db->escape($name)));
|
||||
if (is_float($_name))
|
||||
{
|
||||
$query->where('a.name = ' . (float) $_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where('a.name = ' . (int) $_name);
|
||||
}
|
||||
}
|
||||
elseif (Release_checkingHelper::checkString($_name))
|
||||
{
|
||||
$query->where('a.name = ' . $db->quote($db->escape($_name)));
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
|
@ -163,7 +204,7 @@ class Release_checkingModelContexts extends JModelList
|
|||
$query->order($db->escape($orderCol . ' ' . $orderDirn));
|
||||
}
|
||||
|
||||
return $query;
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -280,26 +321,38 @@ class Release_checkingModelContexts extends JModelList
|
|||
return $headers;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
*
|
||||
* @return string A store id.
|
||||
*
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
*
|
||||
* @return string A store id.
|
||||
*
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':' . $this->getState('filter.id');
|
||||
$id .= ':' . $this->getState('filter.search');
|
||||
$id .= ':' . $this->getState('filter.published');
|
||||
// Check if the value is an array
|
||||
$_access = $this->getState('filter.access');
|
||||
if (Release_checkingHelper::checkArray($_access))
|
||||
{
|
||||
$id .= ':' . implode(':', $_access);
|
||||
}
|
||||
// Check if this is only an number or string
|
||||
elseif (is_numeric($_access)
|
||||
|| Release_checkingHelper::checkString($_access))
|
||||
{
|
||||
$id .= ':' . $_access;
|
||||
}
|
||||
$id .= ':' . $this->getState('filter.ordering');
|
||||
$id .= ':' . $this->getState('filter.created_by');
|
||||
$id .= ':' . $this->getState('filter.modified_by');
|
||||
$id .= ':' . $this->getState('filter.name');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
$id .= ':' . $this->getState('filter.name');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -318,17 +371,19 @@ class Release_checkingModelContexts extends JModelList
|
|||
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// reset query
|
||||
// Reset query.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('*');
|
||||
$query->from($db->quoteName('#__release_checking_context'));
|
||||
$db->setQuery($query);
|
||||
// Only select items that are checked out.
|
||||
$query->where($db->quoteName('checked_out') . '!=0');
|
||||
$db->setQuery($query, 0, 1);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
// Get Yesterdays date
|
||||
// Get Yesterdays date.
|
||||
$date = JFactory::getDate()->modify($time)->toSql();
|
||||
// reset query
|
||||
// Reset query.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Fields to update.
|
||||
|
@ -343,7 +398,7 @@ class Release_checkingModelContexts extends JModelList
|
|||
$db->quoteName('checked_out_time') . '<\''.$date.'\''
|
||||
);
|
||||
|
||||
// Check table
|
||||
// Check table.
|
||||
$query->update($db->quoteName('#__release_checking_context'))->set($fields)->where($conditions);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
@ -353,5 +408,5 @@ class Release_checkingModelContexts extends JModelList
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Actions Form Field class for the Release_checking component
|
||||
*/
|
||||
class JFormFieldActions extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The actions field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Actions Form Field class for the Release_checking component
|
||||
*/
|
||||
class JFormFieldActions extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The actions field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'actions';
|
||||
|
||||
/**
|
||||
|
@ -128,15 +129,15 @@ class JFormFieldActions extends JFormFieldList
|
|||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
// Get the user object.
|
||||
$user = JFactory::getUser();
|
||||
// Get the databse object.
|
||||
|
@ -162,12 +163,14 @@ class JFormFieldActions extends JFormFieldList
|
|||
$options = array();
|
||||
if ($items)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '', 'Select an action');
|
||||
if ($this->multiple === false) {
|
||||
$options[] = JHtml::_('select.option', '', 'Select an option');
|
||||
}
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $item->id, $item->action_name);
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Actionsfiltername Form Field class for the Release_checking component
|
||||
*/
|
||||
class JFormFieldActionsfiltername extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The actionsfiltername field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'actionsfiltername';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select the text.
|
||||
$query->select($db->quoteName('name'));
|
||||
$query->from($db->quoteName('#__release_checking_action'));
|
||||
$query->order($db->quoteName('name') . ' ASC');
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$db->setQuery($query);
|
||||
|
||||
$_results = $db->loadColumn();
|
||||
$_filter = array();
|
||||
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_RELEASE_CHECKING_FILTER_SELECT_NAME') . ' -');
|
||||
|
||||
if ($_results)
|
||||
{
|
||||
$_results = array_unique($_results);
|
||||
foreach ($_results as $name)
|
||||
{
|
||||
// Now add the name and its text to the options array
|
||||
$_filter[] = JHtml::_('select.option', $name, $name);
|
||||
}
|
||||
}
|
||||
return $_filter;
|
||||
}
|
||||
}
|
|
@ -1,29 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Contexts Form Field class for the Release_checking component
|
||||
*/
|
||||
class JFormFieldContexts extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The contexts field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Contexts Form Field class for the Release_checking component
|
||||
*/
|
||||
class JFormFieldContexts extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The contexts field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'contexts';
|
||||
|
||||
/**
|
||||
|
@ -128,15 +129,15 @@ class JFormFieldContexts extends JFormFieldList
|
|||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
// Get the user object.
|
||||
$user = JFactory::getUser();
|
||||
// Get the databse object.
|
||||
|
@ -161,12 +162,14 @@ class JFormFieldContexts extends JFormFieldList
|
|||
$options = array();
|
||||
if ($items)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '', 'Select an option');
|
||||
if ($this->multiple === false) {
|
||||
$options[] = JHtml::_('select.option', '', 'Select an option');
|
||||
}
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $item->id, $item->context_name);
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Contextsfiltername Form Field class for the Release_checking component
|
||||
*/
|
||||
class JFormFieldContextsfiltername extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The contextsfiltername field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'contextsfiltername';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select the text.
|
||||
$query->select($db->quoteName('name'));
|
||||
$query->from($db->quoteName('#__release_checking_context'));
|
||||
$query->order($db->quoteName('name') . ' ASC');
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$db->setQuery($query);
|
||||
|
||||
$_results = $db->loadColumn();
|
||||
$_filter = array();
|
||||
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_RELEASE_CHECKING_FILTER_SELECT_NAME') . ' -');
|
||||
|
||||
if ($_results)
|
||||
{
|
||||
$_results = array_unique($_results);
|
||||
foreach ($_results as $name)
|
||||
{
|
||||
// Now add the name and its text to the options array
|
||||
$_filter[] = JHtml::_('select.option', $name, $name);
|
||||
}
|
||||
}
|
||||
return $_filter;
|
||||
}
|
||||
}
|
|
@ -1,29 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Joomlaversions Form Field class for the Release_checking component
|
||||
*/
|
||||
class JFormFieldJoomlaversions extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The joomlaversions field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Joomlaversions Form Field class for the Release_checking component
|
||||
*/
|
||||
class JFormFieldJoomlaversions extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The joomlaversions field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'joomlaversions';
|
||||
|
||||
/**
|
||||
|
@ -128,15 +129,15 @@ class JFormFieldJoomlaversions extends JFormFieldList
|
|||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
// Get the user object.
|
||||
$user = JFactory::getUser();
|
||||
// Get the databse object.
|
||||
|
@ -161,12 +162,14 @@ class JFormFieldJoomlaversions extends JFormFieldList
|
|||
$options = array();
|
||||
if ($items)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '', 'Select an option');
|
||||
if ($this->multiple === false) {
|
||||
$options[] = JHtml::_('select.option', '', 'Select an option');
|
||||
}
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $item->id, $item->joomla_version_name);
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Releasechecksfiltercreatedby Form Field class for the Release_checking component
|
||||
*/
|
||||
class JFormFieldReleasechecksfiltercreatedby extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The releasechecksfiltercreatedby field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'releasechecksfiltercreatedby';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select the text.
|
||||
$query->select($db->quoteName('created_by'));
|
||||
$query->from($db->quoteName('#__release_checking_release_check'));
|
||||
$query->order($db->quoteName('created_by') . ' ASC');
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$db->setQuery($query);
|
||||
|
||||
$_results = $db->loadColumn();
|
||||
$_filter = array();
|
||||
|
||||
if ($_results)
|
||||
{
|
||||
$_results = array_unique($_results);
|
||||
foreach ($_results as $created_by)
|
||||
{
|
||||
// Now add the created_by and its text to the options array
|
||||
$_filter[] = JHtml::_('select.option', $created_by, JFactory::getUser($created_by)->name);
|
||||
}
|
||||
}
|
||||
return $_filter;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Releasechecksfilteroutcome Form Field class for the Release_checking component
|
||||
*/
|
||||
class JFormFieldReleasechecksfilteroutcome extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The releasechecksfilteroutcome field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'releasechecksfilteroutcome';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select the text.
|
||||
$query->select($db->quoteName('outcome'));
|
||||
$query->from($db->quoteName('#__release_checking_release_check'));
|
||||
$query->order($db->quoteName('outcome') . ' ASC');
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$db->setQuery($query);
|
||||
|
||||
$_results = $db->loadColumn();
|
||||
$_filter = array();
|
||||
|
||||
if ($_results)
|
||||
{
|
||||
// get release_checksmodel
|
||||
$_model = Release_checkingHelper::getModel('release_checks');
|
||||
$_results = array_unique($_results);
|
||||
foreach ($_results as $outcome)
|
||||
{
|
||||
// Translate the outcome selection
|
||||
$_text = $_model->selectionTranslation($outcome,'outcome');
|
||||
// Now add the outcome and its text to the options array
|
||||
$_filter[] = JHtml::_('select.option', $outcome, JText::_($_text));
|
||||
}
|
||||
}
|
||||
return $_filter;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_release_checking/models/rules"
|
||||
addfieldpath="/administrator/components/com_release_checking/models/fields"
|
||||
>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_release_checking/models/rules"
|
||||
addfieldpath="/administrator/components/com_release_checking/models/fields"
|
||||
>
|
||||
<fieldset name="details">
|
||||
<!-- Default Fields. -->
|
||||
<!-- Id Field. Type: Text (joomla) -->
|
||||
|
@ -84,6 +84,14 @@
|
|||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Was added due to Permissions JS needing a Title field -->
|
||||
<!-- Let us know at gh-629 should this change -->
|
||||
<!-- https://github.com/vdm-io/Joomla-Component-Builder/issues/629#issuecomment-750117235 -->
|
||||
<field
|
||||
name="title"
|
||||
type="hidden"
|
||||
default="release_checking action"
|
||||
/>
|
||||
<!-- Dynamic Fields. -->
|
||||
<!-- Name Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
|
@ -133,8 +141,8 @@
|
|||
filter="STRING"
|
||||
hint="COM_RELEASE_CHECKING_ACTION_ALIAS_HINT"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<!-- Access Control Fields. -->
|
||||
<fieldset name="accesscontrol">
|
||||
<!-- Asset Id Field. Type: Hidden (joomla) -->
|
||||
|
@ -155,5 +163,5 @@
|
|||
component="com_release_checking"
|
||||
section="action"
|
||||
/>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</form>
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_release_checking/models/rules"
|
||||
addfieldpath="/administrator/components/com_release_checking/models/fields"
|
||||
>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_release_checking/models/rules"
|
||||
addfieldpath="/administrator/components/com_release_checking/models/fields"
|
||||
>
|
||||
<fieldset name="details">
|
||||
<!-- Default Fields. -->
|
||||
<!-- Id Field. Type: Text (joomla) -->
|
||||
|
@ -84,6 +84,14 @@
|
|||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Was added due to Permissions JS needing a Title field -->
|
||||
<!-- Let us know at gh-629 should this change -->
|
||||
<!-- https://github.com/vdm-io/Joomla-Component-Builder/issues/629#issuecomment-750117235 -->
|
||||
<field
|
||||
name="title"
|
||||
type="hidden"
|
||||
default="release_checking context"
|
||||
/>
|
||||
<!-- Dynamic Fields. -->
|
||||
<!-- Name Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
|
@ -110,8 +118,8 @@
|
|||
filter="STRING"
|
||||
hint="COM_RELEASE_CHECKING_CONTEXT_ALIAS_HINT"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<!-- Access Control Fields. -->
|
||||
<fieldset name="accesscontrol">
|
||||
<!-- Asset Id Field. Type: Hidden (joomla) -->
|
||||
|
@ -132,5 +140,5 @@
|
|||
component="com_release_checking"
|
||||
section="context"
|
||||
/>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</form>
|
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_release_checking/models/rules"
|
||||
addfieldpath="/administrator/components/com_release_checking/models/fields"
|
||||
>
|
||||
<fields name="filter">
|
||||
<field
|
||||
type="text"
|
||||
name="search"
|
||||
inputmode="search"
|
||||
label="COM_RELEASE_CHECKING_FILTER_SEARCH"
|
||||
description="COM_RELEASE_CHECKING_FILTER_SEARCH_ACTIONS"
|
||||
hint="JSEARCH_FILTER"
|
||||
/>
|
||||
<field
|
||||
type="status"
|
||||
name="published"
|
||||
label="COM_RELEASE_CHECKING_FILTER_PUBLISHED"
|
||||
description="COM_RELEASE_CHECKING_FILTER_PUBLISHED_ACTIONS"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_PUBLISHED</option>
|
||||
</field>
|
||||
<field
|
||||
type="accesslevel"
|
||||
name="access"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
multiple="true"
|
||||
class="multipleAccessLevels"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<field
|
||||
type="actionsfiltername"
|
||||
name="name"
|
||||
label="COM_RELEASE_CHECKING_ACTION_NAME_LABEL"
|
||||
multiple="false"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<input type="hidden" name="form_submited" value="1"/>
|
||||
</fields>
|
||||
|
||||
<fields name="list">
|
||||
<field
|
||||
name="fullordering"
|
||||
type="list"
|
||||
label="COM_CONTENT_LIST_FULL_ORDERING"
|
||||
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
|
||||
onchange="this.form.submit();"
|
||||
default="a.id desc"
|
||||
validate="options"
|
||||
>
|
||||
<option value="">JGLOBAL_SORT_BY</option>
|
||||
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
|
||||
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
|
||||
<option value="a.published ASC">JSTATUS_ASC</option>
|
||||
<option value="a.published DESC">JSTATUS_DESC</option>
|
||||
<option value="a.name ASC">COM_RELEASE_CHECKING_FILTER_NAME_ASCENDING</option>
|
||||
<option value="a.name DESC">COM_RELEASE_CHECKING_FILTER_NAME_DESCENDING</option>
|
||||
<option value="g.name ASC">COM_RELEASE_CHECKING_FILTER_CONTEXT_ASCENDING</option>
|
||||
<option value="g.name DESC">COM_RELEASE_CHECKING_FILTER_CONTEXT_DESCENDING</option>
|
||||
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
|
||||
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="limit"
|
||||
type="limitbox"
|
||||
label="COM_CONTENT_LIST_LIMIT"
|
||||
description="COM_CONTENT_LIST_LIMIT_DESC"
|
||||
class="input-mini"
|
||||
default="25"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
</fields>
|
||||
</form>
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_release_checking/models/rules"
|
||||
addfieldpath="/administrator/components/com_release_checking/models/fields"
|
||||
>
|
||||
<fields name="filter">
|
||||
<field
|
||||
type="text"
|
||||
name="search"
|
||||
inputmode="search"
|
||||
label="COM_RELEASE_CHECKING_FILTER_SEARCH"
|
||||
description="COM_RELEASE_CHECKING_FILTER_SEARCH_CONTEXTS"
|
||||
hint="JSEARCH_FILTER"
|
||||
/>
|
||||
<field
|
||||
type="status"
|
||||
name="published"
|
||||
label="COM_RELEASE_CHECKING_FILTER_PUBLISHED"
|
||||
description="COM_RELEASE_CHECKING_FILTER_PUBLISHED_CONTEXTS"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_PUBLISHED</option>
|
||||
</field>
|
||||
<field
|
||||
type="accesslevel"
|
||||
name="access"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
multiple="true"
|
||||
class="multipleAccessLevels"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<field
|
||||
type="contextsfiltername"
|
||||
name="name"
|
||||
label="COM_RELEASE_CHECKING_CONTEXT_NAME_LABEL"
|
||||
multiple="false"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<input type="hidden" name="form_submited" value="1"/>
|
||||
</fields>
|
||||
|
||||
<fields name="list">
|
||||
<field
|
||||
name="fullordering"
|
||||
type="list"
|
||||
label="COM_CONTENT_LIST_FULL_ORDERING"
|
||||
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
|
||||
onchange="this.form.submit();"
|
||||
default="a.id desc"
|
||||
validate="options"
|
||||
>
|
||||
<option value="">JGLOBAL_SORT_BY</option>
|
||||
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
|
||||
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
|
||||
<option value="a.published ASC">JSTATUS_ASC</option>
|
||||
<option value="a.published DESC">JSTATUS_DESC</option>
|
||||
<option value="a.name ASC">COM_RELEASE_CHECKING_FILTER_NAME_ASCENDING</option>
|
||||
<option value="a.name DESC">COM_RELEASE_CHECKING_FILTER_NAME_DESCENDING</option>
|
||||
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
|
||||
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="limit"
|
||||
type="limitbox"
|
||||
label="COM_CONTENT_LIST_LIMIT"
|
||||
description="COM_CONTENT_LIST_LIMIT_DESC"
|
||||
class="input-mini"
|
||||
default="25"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
</fields>
|
||||
</form>
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_release_checking/models/rules"
|
||||
addfieldpath="/administrator/components/com_release_checking/models/fields"
|
||||
>
|
||||
<fields name="filter">
|
||||
<field
|
||||
type="text"
|
||||
name="search"
|
||||
inputmode="search"
|
||||
label="COM_RELEASE_CHECKING_FILTER_SEARCH"
|
||||
description="COM_RELEASE_CHECKING_FILTER_SEARCH_JOOMLA_VERSIONS"
|
||||
hint="JSEARCH_FILTER"
|
||||
/>
|
||||
<field
|
||||
type="status"
|
||||
name="published"
|
||||
label="COM_RELEASE_CHECKING_FILTER_PUBLISHED"
|
||||
description="COM_RELEASE_CHECKING_FILTER_PUBLISHED_JOOMLA_VERSIONS"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_PUBLISHED</option>
|
||||
</field>
|
||||
<field
|
||||
type="accesslevel"
|
||||
name="access"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
multiple="true"
|
||||
class="multipleAccessLevels"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<input type="hidden" name="form_submited" value="1"/>
|
||||
</fields>
|
||||
|
||||
<fields name="list">
|
||||
<field
|
||||
name="fullordering"
|
||||
type="list"
|
||||
label="COM_CONTENT_LIST_FULL_ORDERING"
|
||||
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
|
||||
onchange="this.form.submit();"
|
||||
default="a.id desc"
|
||||
validate="options"
|
||||
>
|
||||
<option value="">JGLOBAL_SORT_BY</option>
|
||||
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
|
||||
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
|
||||
<option value="a.published ASC">JSTATUS_ASC</option>
|
||||
<option value="a.published DESC">JSTATUS_DESC</option>
|
||||
<option value="a.name ASC">COM_RELEASE_CHECKING_FILTER_NAME_ASCENDING</option>
|
||||
<option value="a.name DESC">COM_RELEASE_CHECKING_FILTER_NAME_DESCENDING</option>
|
||||
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
|
||||
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="limit"
|
||||
type="limitbox"
|
||||
label="COM_CONTENT_LIST_LIMIT"
|
||||
description="COM_CONTENT_LIST_LIMIT_DESC"
|
||||
class="input-mini"
|
||||
default="25"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
</fields>
|
||||
</form>
|
|
@ -0,0 +1,115 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_release_checking/models/rules"
|
||||
addfieldpath="/administrator/components/com_release_checking/models/fields"
|
||||
>
|
||||
<fields name="filter">
|
||||
<field
|
||||
type="text"
|
||||
name="search"
|
||||
inputmode="search"
|
||||
label="COM_RELEASE_CHECKING_FILTER_SEARCH"
|
||||
description="COM_RELEASE_CHECKING_FILTER_SEARCH_RELEASE_CHECKS"
|
||||
hint="JSEARCH_FILTER"
|
||||
/>
|
||||
<field
|
||||
type="status"
|
||||
name="published"
|
||||
label="COM_RELEASE_CHECKING_FILTER_PUBLISHED"
|
||||
description="COM_RELEASE_CHECKING_FILTER_PUBLISHED_RELEASE_CHECKS"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_PUBLISHED</option>
|
||||
</field>
|
||||
<field
|
||||
type="accesslevel"
|
||||
name="access"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
multiple="true"
|
||||
class="multipleAccessLevels"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<field
|
||||
type="contexts"
|
||||
name="context"
|
||||
label="COM_RELEASE_CHECKING_RELEASE_CHECK_CONTEXT_LABEL"
|
||||
class="multipleContexts"
|
||||
multiple="true"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<field
|
||||
type="actions"
|
||||
name="action"
|
||||
label="COM_RELEASE_CHECKING_RELEASE_CHECK_ACTION_LABEL"
|
||||
class="multipleActions"
|
||||
multiple="true"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<field
|
||||
type="releasechecksfilteroutcome"
|
||||
name="outcome"
|
||||
label="COM_RELEASE_CHECKING_RELEASE_CHECK_OUTCOME_LABEL"
|
||||
class="multipleReleasechecksfilteroutcome"
|
||||
multiple="true"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<field
|
||||
type="joomlaversions"
|
||||
name="joomla_version"
|
||||
label="COM_RELEASE_CHECKING_RELEASE_CHECK_JOOMLA_VERSION_LABEL"
|
||||
class="multipleJoomlaversions"
|
||||
multiple="true"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<field
|
||||
type="releasechecksfiltercreatedby"
|
||||
name="created_by"
|
||||
label="COM_RELEASE_CHECKING_RELEASE_CHECK_CREATED_BY_LABEL"
|
||||
class="multipleReleasechecksfiltercreatedby"
|
||||
multiple="true"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<input type="hidden" name="form_submited" value="1"/>
|
||||
</fields>
|
||||
|
||||
<fields name="list">
|
||||
<field
|
||||
name="fullordering"
|
||||
type="list"
|
||||
label="COM_CONTENT_LIST_FULL_ORDERING"
|
||||
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
|
||||
onchange="this.form.submit();"
|
||||
default="a.id desc"
|
||||
validate="options"
|
||||
>
|
||||
<option value="">JGLOBAL_SORT_BY</option>
|
||||
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
|
||||
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
|
||||
<option value="a.published ASC">JSTATUS_ASC</option>
|
||||
<option value="a.published DESC">JSTATUS_DESC</option>
|
||||
<option value="g.name ASC">COM_RELEASE_CHECKING_FILTER_CONTEXT_ASCENDING</option>
|
||||
<option value="g.name DESC">COM_RELEASE_CHECKING_FILTER_CONTEXT_DESCENDING</option>
|
||||
<option value="h.name ASC">COM_RELEASE_CHECKING_FILTER_ACTION_ASCENDING</option>
|
||||
<option value="h.name DESC">COM_RELEASE_CHECKING_FILTER_ACTION_DESCENDING</option>
|
||||
<option value="a.outcome ASC">COM_RELEASE_CHECKING_FILTER_OUTCOME_ASCENDING</option>
|
||||
<option value="a.outcome DESC">COM_RELEASE_CHECKING_FILTER_OUTCOME_DESCENDING</option>
|
||||
<option value="i.name ASC">COM_RELEASE_CHECKING_FILTER_JOOMLA_VERSION_ASCENDING</option>
|
||||
<option value="i.name DESC">COM_RELEASE_CHECKING_FILTER_JOOMLA_VERSION_DESCENDING</option>
|
||||
<option value="a.created_by ASC">COM_RELEASE_CHECKING_FILTER_CREATED_BY_ASCENDING</option>
|
||||
<option value="a.created_by DESC">COM_RELEASE_CHECKING_FILTER_CREATED_BY_DESCENDING</option>
|
||||
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
|
||||
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="limit"
|
||||
type="limitbox"
|
||||
label="COM_CONTENT_LIST_LIMIT"
|
||||
description="COM_CONTENT_LIST_LIMIT_DESC"
|
||||
class="input-mini"
|
||||
default="25"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
</fields>
|
||||
</form>
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_release_checking/models/rules"
|
||||
addfieldpath="/administrator/components/com_release_checking/models/fields"
|
||||
>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_release_checking/models/rules"
|
||||
addfieldpath="/administrator/components/com_release_checking/models/fields"
|
||||
>
|
||||
<fieldset name="details">
|
||||
<!-- Default Fields. -->
|
||||
<!-- Id Field. Type: Text (joomla) -->
|
||||
|
@ -84,6 +84,14 @@
|
|||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Was added due to Permissions JS needing a Title field -->
|
||||
<!-- Let us know at gh-629 should this change -->
|
||||
<!-- https://github.com/vdm-io/Joomla-Component-Builder/issues/629#issuecomment-750117235 -->
|
||||
<field
|
||||
name="title"
|
||||
type="hidden"
|
||||
default="release_checking joomla_version"
|
||||
/>
|
||||
<!-- Dynamic Fields. -->
|
||||
<!-- Name Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
|
@ -110,8 +118,8 @@
|
|||
filter="STRING"
|
||||
hint="COM_RELEASE_CHECKING_JOOMLA_VERSION_ALIAS_HINT"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<!-- Access Control Fields. -->
|
||||
<fieldset name="accesscontrol">
|
||||
<!-- Asset Id Field. Type: Hidden (joomla) -->
|
||||
|
@ -132,5 +140,5 @@
|
|||
component="com_release_checking"
|
||||
section="joomla_version"
|
||||
/>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</form>
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_release_checking/models/rules"
|
||||
addfieldpath="/administrator/components/com_release_checking/models/fields"
|
||||
>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_release_checking/models/rules"
|
||||
addfieldpath="/administrator/components/com_release_checking/models/fields"
|
||||
>
|
||||
<fieldset name="details">
|
||||
<!-- Default Fields. -->
|
||||
<!-- Id Field. Type: Text (joomla) -->
|
||||
|
@ -77,6 +77,14 @@
|
|||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Was added due to Permissions JS needing a Title field -->
|
||||
<!-- Let us know at gh-629 should this change -->
|
||||
<!-- https://github.com/vdm-io/Joomla-Component-Builder/issues/629#issuecomment-750117235 -->
|
||||
<field
|
||||
name="title"
|
||||
type="hidden"
|
||||
default="release_checking release_check"
|
||||
/>
|
||||
<!-- Dynamic Fields. -->
|
||||
<!-- Context Field. Type: Contexts. (custom) -->
|
||||
<field
|
||||
|
@ -138,8 +146,8 @@
|
|||
label="COM_RELEASE_CHECKING_RELEASE_CHECK_CREATED_BY_LABEL"
|
||||
description="COM_RELEASE_CHECKING_RELEASE_CHECK_CREATED_BY_DESCRIPTION"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<!-- Access Control Fields. -->
|
||||
<fieldset name="accesscontrol">
|
||||
<!-- Asset Id Field. Type: Hidden (joomla) -->
|
||||
|
@ -160,5 +168,5 @@
|
|||
component="com_release_checking"
|
||||
section="release_check"
|
||||
/>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</form>
|
|
@ -1,361 +1,365 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
||||
/**
|
||||
* Release_checking Import Model
|
||||
*/
|
||||
class Release_checkingModelImport extends JModelLegacy
|
||||
{
|
||||
// set uploading values
|
||||
protected $use_streams = false;
|
||||
protected $allow_unsafe = false;
|
||||
protected $safeFileOptions = array();
|
||||
|
||||
/**
|
||||
* @var object JTable object
|
||||
*/
|
||||
protected $_table = null;
|
||||
|
||||
/**
|
||||
* @var object JTable object
|
||||
*/
|
||||
protected $_url = null;
|
||||
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_context = 'com_release_checking.import';
|
||||
|
||||
/**
|
||||
* Import Settings
|
||||
*/
|
||||
protected $getType = NULL;
|
||||
protected $dataType = NULL;
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
$app = JFactory::getApplication('administrator');
|
||||
|
||||
$this->setState('message', $app->getUserState('com_release_checking.message'));
|
||||
$app->setUserState('com_release_checking.message', '');
|
||||
|
||||
// Recall the 'Import from Directory' path.
|
||||
$path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path'));
|
||||
$this->setState('import.directory', $path);
|
||||
parent::populateState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Import an spreadsheet from either folder, url or upload.
|
||||
*
|
||||
* @return boolean result of import
|
||||
*
|
||||
*/
|
||||
public function import()
|
||||
{
|
||||
$this->setState('action', 'import');
|
||||
$app = JFactory::getApplication();
|
||||
$session = JFactory::getSession();
|
||||
$package = null;
|
||||
$continue = false;
|
||||
// get import type
|
||||
$this->getType = $app->input->getString('gettype', NULL);
|
||||
// get import type
|
||||
$this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL);
|
||||
|
||||
if ($package === null)
|
||||
{
|
||||
switch ($this->getType)
|
||||
{
|
||||
case 'folder':
|
||||
// Remember the 'Import from Directory' path.
|
||||
$app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory');
|
||||
$package = $this->_getPackageFromFolder();
|
||||
break;
|
||||
|
||||
case 'upload':
|
||||
$package = $this->_getPackageFromUpload();
|
||||
break;
|
||||
|
||||
case 'url':
|
||||
$package = $this->_getPackageFromUrl();
|
||||
break;
|
||||
|
||||
case 'continue':
|
||||
$continue = true;
|
||||
$package = $session->get('package', null);
|
||||
$package = json_decode($package, true);
|
||||
// clear session
|
||||
$session->clear('package');
|
||||
$session->clear('dataType');
|
||||
$session->clear('hasPackage');
|
||||
break;
|
||||
|
||||
default:
|
||||
$app->setUserState('com_release_checking.message', JText::_('COM_RELEASE_CHECKING_IMPORT_NO_IMPORT_TYPE_FOUND'));
|
||||
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Was the package valid?
|
||||
if (!$package || !$package['type'])
|
||||
{
|
||||
if (in_array($this->getType, array('upload', 'url')))
|
||||
{
|
||||
$this->remove($package['packagename']);
|
||||
}
|
||||
|
||||
$app->setUserState('com_release_checking.message', JText::_('COM_RELEASE_CHECKING_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// first link data to table headers
|
||||
if(!$continue){
|
||||
$package = json_encode($package);
|
||||
$session->set('package', $package);
|
||||
$session->set('dataType', $this->dataType);
|
||||
$session->set('hasPackage', true);
|
||||
return true;
|
||||
}
|
||||
|
||||
// set the data
|
||||
$headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false), true);
|
||||
if (!$this->setData($package,$this->dataType,$headerList))
|
||||
{
|
||||
// There was an error importing the package
|
||||
$msg = JText::_('COM_RELEASE_CHECKING_IMPORT_ERROR');
|
||||
$back = $session->get('backto_VDM_IMPORT', NULL);
|
||||
if ($back)
|
||||
{
|
||||
$app->setUserState('com_release_checking.redirect_url', 'index.php?option=com_release_checking&view='.$back);
|
||||
$session->clear('backto_VDM_IMPORT');
|
||||
}
|
||||
$result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Package imported sucessfully
|
||||
$msg = JText::sprintf('COM_RELEASE_CHECKING_IMPORT_SUCCESS', $package['packagename']);
|
||||
$back = $session->get('backto_VDM_IMPORT', NULL);
|
||||
if ($back)
|
||||
{
|
||||
$app->setUserState('com_release_checking.redirect_url', 'index.php?option=com_release_checking&view='.$back);
|
||||
$session->clear('backto_VDM_IMPORT');
|
||||
}
|
||||
$result = true;
|
||||
}
|
||||
|
||||
// Set some model state values
|
||||
$app->enqueueMessage($msg);
|
||||
|
||||
// remove file after import
|
||||
$this->remove($package['packagename']);
|
||||
$session->clear($this->getType.'_VDM_IMPORTHEADERS');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Works out an importation spreadsheet from a HTTP upload
|
||||
*
|
||||
* @return spreadsheet definition or false on failure
|
||||
*/
|
||||
protected function _getPackageFromUpload()
|
||||
{
|
||||
// Get the uploaded file information
|
||||
$app = JFactory::getApplication();
|
||||
$input = $app->input;
|
||||
|
||||
// Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get.
|
||||
$userfile = $input->files->get('import_package', null, 'raw');
|
||||
|
||||
// Make sure that file uploads are enabled in php
|
||||
if (!(bool) ini_get('file_uploads'))
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_WARNIMPORTFILE'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// If there is no uploaded file, we have a problem...
|
||||
if (!is_array($userfile))
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_NO_FILE_SELECTED'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if there was a problem uploading the file.
|
||||
if ($userfile['error'] || $userfile['size'] < 1)
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Build the appropriate paths
|
||||
$config = JFactory::getConfig();
|
||||
$tmp_dest = $config->get('tmp_path') . '/' . $userfile['name'];
|
||||
$tmp_src = $userfile['tmp_name'];
|
||||
|
||||
// Move uploaded file
|
||||
jimport('joomla.filesystem.file');
|
||||
$p_file = JFile::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions);
|
||||
|
||||
// Was the package downloaded?
|
||||
if (!$p_file)
|
||||
{
|
||||
$session = JFactory::getSession();
|
||||
$session->clear('package');
|
||||
$session->clear('dataType');
|
||||
$session->clear('hasPackage');
|
||||
// was not uploaded
|
||||
return false;
|
||||
}
|
||||
|
||||
// check that this is a valid spreadsheet
|
||||
$package = $this->check($userfile['name']);
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import an spreadsheet from a directory
|
||||
*
|
||||
* @return array Spreadsheet details or false on failure
|
||||
*
|
||||
*/
|
||||
protected function _getPackageFromFolder()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$input = $app->input;
|
||||
|
||||
// Get the path to the package to import
|
||||
$p_dir = $input->getString('import_directory');
|
||||
$p_dir = JPath::clean($p_dir);
|
||||
// Did you give us a valid path?
|
||||
if (!file_exists($p_dir))
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Detect the package type
|
||||
$type = $this->getType;
|
||||
|
||||
// Did you give us a valid package?
|
||||
if (!$type)
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning');
|
||||
}
|
||||
|
||||
// check the extention
|
||||
if(!$this->checkExtension($p_dir))
|
||||
{
|
||||
// set error message
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
$package['packagename'] = null;
|
||||
$package['dir'] = $p_dir;
|
||||
$package['type'] = $type;
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import an spreadsheet from a URL
|
||||
*
|
||||
* @return Package details or false on failure
|
||||
*
|
||||
*/
|
||||
protected function _getPackageFromUrl()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$input = $app->input;
|
||||
|
||||
// Get the URL of the package to import
|
||||
$url = $input->getString('import_url');
|
||||
|
||||
// Did you give us a URL?
|
||||
if (!$url)
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_ENTER_A_URL'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Download the package at the URL given
|
||||
$p_file = JInstallerHelper::downloadPackage($url);
|
||||
|
||||
// Was the package downloaded?
|
||||
if (!$p_file)
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_INVALID_URL'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// check that this is a valid spreadsheet
|
||||
$package = $this->check($p_file);
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a file and verifies it as a spreadsheet file
|
||||
* Supports .csv .xlsx .xls and .ods
|
||||
*
|
||||
* @param string $p_filename The uploaded package filename or import directory
|
||||
*
|
||||
* @return array of elements
|
||||
*
|
||||
*/
|
||||
protected function check($archivename)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
// Clean the name
|
||||
$archivename = JPath::clean($archivename);
|
||||
|
||||
// check the extention
|
||||
if(!$this->checkExtension($archivename))
|
||||
{
|
||||
// Cleanup the import files
|
||||
$this->remove($archivename);
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
$config = JFactory::getConfig();
|
||||
// set Package Name
|
||||
$check['packagename'] = $archivename;
|
||||
|
||||
// set directory
|
||||
$check['dir'] = $config->get('tmp_path'). '/' .$archivename;
|
||||
|
||||
// set type
|
||||
$check['type'] = $this->getType;
|
||||
|
||||
return $check;
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
||||
/***
|
||||
* Release_checking Import Base Database Model
|
||||
*/
|
||||
class Release_checkingModelImport extends BaseDatabaseModel
|
||||
{
|
||||
// set uploading values
|
||||
protected $use_streams = false;
|
||||
protected $allow_unsafe = false;
|
||||
protected $safeFileOptions = array();
|
||||
|
||||
/**
|
||||
* @var object JTable object
|
||||
*/
|
||||
protected $_table = null;
|
||||
|
||||
/**
|
||||
* @var object JTable object
|
||||
*/
|
||||
protected $_url = null;
|
||||
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_context = 'com_release_checking.import';
|
||||
|
||||
/**
|
||||
* Import Settings
|
||||
*/
|
||||
protected $getType = NULL;
|
||||
protected $dataType = NULL;
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
$app = JFactory::getApplication('administrator');
|
||||
|
||||
$this->setState('message', $app->getUserState('com_release_checking.message'));
|
||||
$app->setUserState('com_release_checking.message', '');
|
||||
|
||||
// Recall the 'Import from Directory' path.
|
||||
$path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path'));
|
||||
$this->setState('import.directory', $path);
|
||||
parent::populateState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Import an spreadsheet from either folder, url or upload.
|
||||
*
|
||||
* @return boolean result of import
|
||||
*
|
||||
*/
|
||||
public function import()
|
||||
{
|
||||
$this->setState('action', 'import');
|
||||
$app = JFactory::getApplication();
|
||||
$session = JFactory::getSession();
|
||||
$package = null;
|
||||
$continue = false;
|
||||
// get import type
|
||||
$this->getType = $app->input->getString('gettype', NULL);
|
||||
// get import type
|
||||
$this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL);
|
||||
|
||||
if ($package === null)
|
||||
{
|
||||
switch ($this->getType)
|
||||
{
|
||||
case 'folder':
|
||||
// Remember the 'Import from Directory' path.
|
||||
$app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory');
|
||||
$package = $this->_getPackageFromFolder();
|
||||
break;
|
||||
|
||||
case 'upload':
|
||||
$package = $this->_getPackageFromUpload();
|
||||
break;
|
||||
|
||||
case 'url':
|
||||
$package = $this->_getPackageFromUrl();
|
||||
break;
|
||||
|
||||
case 'continue':
|
||||
$continue = true;
|
||||
$package = $session->get('package', null);
|
||||
$package = json_decode($package, true);
|
||||
// clear session
|
||||
$session->clear('package');
|
||||
$session->clear('dataType');
|
||||
$session->clear('hasPackage');
|
||||
break;
|
||||
|
||||
default:
|
||||
$app->setUserState('com_release_checking.message', JText::_('COM_RELEASE_CHECKING_IMPORT_NO_IMPORT_TYPE_FOUND'));
|
||||
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Was the package valid?
|
||||
if (!$package || !$package['type'])
|
||||
{
|
||||
if (in_array($this->getType, array('upload', 'url')))
|
||||
{
|
||||
$this->remove($package['packagename']);
|
||||
}
|
||||
|
||||
$app->setUserState('com_release_checking.message', JText::_('COM_RELEASE_CHECKING_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// first link data to table headers
|
||||
if(!$continue){
|
||||
$package = json_encode($package);
|
||||
$session->set('package', $package);
|
||||
$session->set('dataType', $this->dataType);
|
||||
$session->set('hasPackage', true);
|
||||
return true;
|
||||
}
|
||||
|
||||
// set the data
|
||||
$headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false), true);
|
||||
if (!$this->setData($package,$this->dataType,$headerList))
|
||||
{
|
||||
// There was an error importing the package
|
||||
$msg = JText::_('COM_RELEASE_CHECKING_IMPORT_ERROR');
|
||||
$back = $session->get('backto_VDM_IMPORT', NULL);
|
||||
if ($back)
|
||||
{
|
||||
$app->setUserState('com_release_checking.redirect_url', 'index.php?option=com_release_checking&view='.$back);
|
||||
$session->clear('backto_VDM_IMPORT');
|
||||
}
|
||||
$result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Package imported sucessfully
|
||||
$msg = JText::sprintf('COM_RELEASE_CHECKING_IMPORT_SUCCESS', $package['packagename']);
|
||||
$back = $session->get('backto_VDM_IMPORT', NULL);
|
||||
if ($back)
|
||||
{
|
||||
$app->setUserState('com_release_checking.redirect_url', 'index.php?option=com_release_checking&view='.$back);
|
||||
$session->clear('backto_VDM_IMPORT');
|
||||
}
|
||||
$result = true;
|
||||
}
|
||||
|
||||
// Set some model state values
|
||||
$app->enqueueMessage($msg);
|
||||
|
||||
// remove file after import
|
||||
$this->remove($package['packagename']);
|
||||
$session->clear($this->getType.'_VDM_IMPORTHEADERS');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Works out an importation spreadsheet from a HTTP upload
|
||||
*
|
||||
* @return spreadsheet definition or false on failure
|
||||
*/
|
||||
protected function _getPackageFromUpload()
|
||||
{
|
||||
// Get the uploaded file information
|
||||
$app = JFactory::getApplication();
|
||||
$input = $app->input;
|
||||
|
||||
// Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get.
|
||||
$userfile = $input->files->get('import_package', null, 'raw');
|
||||
|
||||
// Make sure that file uploads are enabled in php
|
||||
if (!(bool) ini_get('file_uploads'))
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_WARNIMPORTFILE'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// If there is no uploaded file, we have a problem...
|
||||
if (!is_array($userfile))
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_NO_FILE_SELECTED'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if there was a problem uploading the file.
|
||||
if ($userfile['error'] || $userfile['size'] < 1)
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Build the appropriate paths
|
||||
$config = JFactory::getConfig();
|
||||
$tmp_dest = $config->get('tmp_path') . '/' . $userfile['name'];
|
||||
$tmp_src = $userfile['tmp_name'];
|
||||
|
||||
// Move uploaded file
|
||||
jimport('joomla.filesystem.file');
|
||||
$p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions);
|
||||
|
||||
// Was the package downloaded?
|
||||
if (!$p_file)
|
||||
{
|
||||
$session = JFactory::getSession();
|
||||
$session->clear('package');
|
||||
$session->clear('dataType');
|
||||
$session->clear('hasPackage');
|
||||
// was not uploaded
|
||||
return false;
|
||||
}
|
||||
|
||||
// check that this is a valid spreadsheet
|
||||
$package = $this->check($userfile['name']);
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import an spreadsheet from a directory
|
||||
*
|
||||
* @return array Spreadsheet details or false on failure
|
||||
*
|
||||
*/
|
||||
protected function _getPackageFromFolder()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$input = $app->input;
|
||||
|
||||
// Get the path to the package to import
|
||||
$p_dir = $input->getString('import_directory');
|
||||
$p_dir = JPath::clean($p_dir);
|
||||
// Did you give us a valid path?
|
||||
if (!file_exists($p_dir))
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Detect the package type
|
||||
$type = $this->getType;
|
||||
|
||||
// Did you give us a valid package?
|
||||
if (!$type)
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning');
|
||||
}
|
||||
|
||||
// check the extention
|
||||
if(!$this->checkExtension($p_dir))
|
||||
{
|
||||
// set error message
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
$package['packagename'] = null;
|
||||
$package['dir'] = $p_dir;
|
||||
$package['type'] = $type;
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import an spreadsheet from a URL
|
||||
*
|
||||
* @return Package details or false on failure
|
||||
*
|
||||
*/
|
||||
protected function _getPackageFromUrl()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$input = $app->input;
|
||||
|
||||
// Get the URL of the package to import
|
||||
$url = $input->getString('import_url');
|
||||
|
||||
// Did you give us a URL?
|
||||
if (!$url)
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_ENTER_A_URL'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Download the package at the URL given
|
||||
$p_file = JInstallerHelper::downloadPackage($url);
|
||||
|
||||
// Was the package downloaded?
|
||||
if (!$p_file)
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_INVALID_URL'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// check that this is a valid spreadsheet
|
||||
$package = $this->check($p_file);
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a file and verifies it as a spreadsheet file
|
||||
* Supports .csv .xlsx .xls and .ods
|
||||
*
|
||||
* @param string $p_filename The uploaded package filename or import directory
|
||||
*
|
||||
* @return array of elements
|
||||
*
|
||||
*/
|
||||
protected function check($archivename)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
// Clean the name
|
||||
$archivename = JPath::clean($archivename);
|
||||
|
||||
// check the extention
|
||||
if(!$this->checkExtension($archivename))
|
||||
{
|
||||
// Cleanup the import files
|
||||
$this->remove($archivename);
|
||||
$app->enqueueMessage(JText::_('COM_RELEASE_CHECKING_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
$config = JFactory::getConfig();
|
||||
// set Package Name
|
||||
$check['packagename'] = $archivename;
|
||||
|
||||
// set directory
|
||||
$check['dir'] = $config->get('tmp_path'). '/' .$archivename;
|
||||
|
||||
// set type
|
||||
$check['type'] = $this->getType;
|
||||
|
||||
return $check;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -378,33 +382,33 @@ class Release_checkingModelImport extends JModelLegacy
|
|||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up temporary uploaded spreadsheet
|
||||
*
|
||||
* @param string $package Name of the uploaded spreadsheet file
|
||||
*
|
||||
* @return boolean True on success
|
||||
*
|
||||
*/
|
||||
protected function remove($package)
|
||||
{
|
||||
jimport('joomla.filesystem.file');
|
||||
|
||||
$config = JFactory::getConfig();
|
||||
$package = $config->get('tmp_path'). '/' .$package;
|
||||
|
||||
// Is the package file a valid file?
|
||||
if (is_file($package))
|
||||
{
|
||||
JFile::delete($package);
|
||||
}
|
||||
elseif (is_file(JPath::clean($package)))
|
||||
{
|
||||
// It might also be just a base filename
|
||||
JFile::delete(JPath::clean($package));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up temporary uploaded spreadsheet
|
||||
*
|
||||
* @param string $package Name of the uploaded spreadsheet file
|
||||
*
|
||||
* @return boolean True on success
|
||||
*
|
||||
*/
|
||||
protected function remove($package)
|
||||
{
|
||||
jimport('joomla.filesystem.file');
|
||||
|
||||
$config = JFactory::getConfig();
|
||||
$package = $config->get('tmp_path'). '/' .$package;
|
||||
|
||||
// Is the package file a valid file?
|
||||
if (is_file($package))
|
||||
{
|
||||
File::delete($package);
|
||||
}
|
||||
elseif (is_file(JPath::clean($package)))
|
||||
{
|
||||
// It might also be just a base filename
|
||||
File::delete(JPath::clean($package));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -668,70 +672,70 @@ class Release_checkingModelImport extends JModelLegacy
|
|||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getAlias($name,$type = false)
|
||||
{
|
||||
// sanitize the name to an alias
|
||||
if (JFactory::getConfig()->get('unicodeslugs') == 1)
|
||||
{
|
||||
$alias = JFilterOutput::stringURLUnicodeSlug($name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$alias = JFilterOutput::stringURLSafe($name);
|
||||
}
|
||||
// must be a uniqe alias
|
||||
if ($type)
|
||||
{
|
||||
return $this->getUniqe($alias,'alias',$type);
|
||||
}
|
||||
return $alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a uniqe value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
* @param string $type table.
|
||||
*
|
||||
* @return string New value.
|
||||
*/
|
||||
protected function getUniqe($value,$field,$type)
|
||||
{
|
||||
// insure the filed is always uniqe
|
||||
while (isset($this->uniqeValueArray[$type][$field][$value]))
|
||||
{
|
||||
$value = JString::increment($value, 'dash');
|
||||
}
|
||||
$this->uniqeValueArray[$type][$field][$value] = $value;
|
||||
return $value;
|
||||
}
|
||||
|
||||
protected function getAliasesUsed($table)
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// first we check if there is a alias column
|
||||
$columns = $db->getTableColumns('#__release_checking_'.$table);
|
||||
if(isset($columns['alias'])){
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('alias')));
|
||||
$query->from($db->quoteName('#__release_checking_'.$table));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
$aliases = $db->loadColumn();
|
||||
foreach($aliases as $alias)
|
||||
{
|
||||
$this->uniqeValueArray[$table]['alias'][$alias] = $alias;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function getAlias($name,$type = false)
|
||||
{
|
||||
// sanitize the name to an alias
|
||||
if (JFactory::getConfig()->get('unicodeslugs') == 1)
|
||||
{
|
||||
$alias = JFilterOutput::stringURLUnicodeSlug($name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$alias = JFilterOutput::stringURLSafe($name);
|
||||
}
|
||||
// must be a uniqe alias
|
||||
if ($type)
|
||||
{
|
||||
return $this->getUniqe($alias,'alias',$type);
|
||||
}
|
||||
return $alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a uniqe value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
* @param string $type table.
|
||||
*
|
||||
* @return string New value.
|
||||
*/
|
||||
protected function getUniqe($value,$field,$type)
|
||||
{
|
||||
// insure the filed is always uniqe
|
||||
while (isset($this->uniqeValueArray[$type][$field][$value]))
|
||||
{
|
||||
$value = JString::increment($value, 'dash');
|
||||
}
|
||||
$this->uniqeValueArray[$type][$field][$value] = $value;
|
||||
return $value;
|
||||
}
|
||||
|
||||
protected function getAliasesUsed($table)
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// first we check if there is a alias column
|
||||
$columns = $db->getTableColumns('#__release_checking_'.$table);
|
||||
if(isset($columns['alias'])){
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('alias')));
|
||||
$query->from($db->quoteName('#__release_checking_'.$table));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
$aliases = $db->loadColumn();
|
||||
foreach($aliases as $alias)
|
||||
{
|
||||
$this->uniqeValueArray[$table]['alias'][$alias] = $alias;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,124 +1,122 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\AdminModel;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checking Joomla_version Model
|
||||
*/
|
||||
class Release_checkingModelJoomla_version extends JModelAdmin
|
||||
{
|
||||
/**
|
||||
* The tab layout fields array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checking Joomla_version Admin Model
|
||||
*/
|
||||
class Release_checkingModelJoomla_version extends AdminModel
|
||||
{
|
||||
/**
|
||||
* The tab layout fields array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $tabLayoutFields = array(
|
||||
'details' => array(
|
||||
'above' => array(
|
||||
'name',
|
||||
'left' => array(
|
||||
'name'
|
||||
),
|
||||
'right' => array(
|
||||
'alias'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING';
|
||||
|
||||
/**
|
||||
* The type alias for this content type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
public $typeAlias = 'com_release_checking.joomla_version';
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it
|
||||
*
|
||||
* @param type $type The table type to instantiate
|
||||
* @param string $prefix A prefix for the table class name. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JTable A database object
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTable($type = 'joomla_version', $prefix = 'Release_checkingTable', $config = array())
|
||||
{
|
||||
// add table path for when model gets used from other component
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_release_checking/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
*
|
||||
* @param integer $pk The id of the primary key.
|
||||
*
|
||||
* @return mixed Object on success, false on failure.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
if ($item = parent::getItem($pk))
|
||||
{
|
||||
if (!empty($item->params) && !is_array($item->params))
|
||||
{
|
||||
// Convert the params field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->params);
|
||||
$item->params = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->metadata))
|
||||
{
|
||||
// Convert the metadata field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->metadata);
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->id))
|
||||
{
|
||||
$item->tags = new JHelperTags;
|
||||
$item->tags->getTagIds($item->id, 'com_release_checking.joomla_version');
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
*
|
||||
* @return mixed A JForm object on success, false on failure
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
|
||||
{
|
||||
// set load data option
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING';
|
||||
|
||||
/**
|
||||
* The type alias for this content type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
public $typeAlias = 'com_release_checking.joomla_version';
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it
|
||||
*
|
||||
* @param type $type The table type to instantiate
|
||||
* @param string $prefix A prefix for the table class name. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JTable A database object
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTable($type = 'joomla_version', $prefix = 'Release_checkingTable', $config = array())
|
||||
{
|
||||
// add table path for when model gets used from other component
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_release_checking/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
*
|
||||
* @param integer $pk The id of the primary key.
|
||||
*
|
||||
* @return mixed Object on success, false on failure.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
if ($item = parent::getItem($pk))
|
||||
{
|
||||
if (!empty($item->params) && !is_array($item->params))
|
||||
{
|
||||
// Convert the params field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->params);
|
||||
$item->params = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->metadata))
|
||||
{
|
||||
// Convert the metadata field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->metadata);
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
*
|
||||
* @return mixed A JForm object on success, false on failure
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
|
||||
{
|
||||
// set load data option
|
||||
$options['load_data'] = $loadData;
|
||||
// check if xpath was set in options
|
||||
$xpath = false;
|
||||
|
@ -211,29 +209,29 @@ class Release_checkingModelJoomla_version extends JModelAdmin
|
|||
$form->setValue($redirectedField, null, $redirectedValue);
|
||||
}
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the form
|
||||
*
|
||||
* @return string script files
|
||||
*/
|
||||
public function getScript()
|
||||
{
|
||||
return 'administrator/components/com_release_checking/models/forms/joomla_version.js';
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canDelete($record)
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the form
|
||||
*
|
||||
* @return string script files
|
||||
*/
|
||||
public function getScript()
|
||||
{
|
||||
return 'media/com_release_checking/js/joomla_version.js';
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canDelete($record)
|
||||
{
|
||||
if (!empty($record->id))
|
||||
{
|
||||
|
@ -246,19 +244,19 @@ class Release_checkingModelJoomla_version extends JModelAdmin
|
|||
// The record has been set. Check the record permissions.
|
||||
return $user->authorise('core.delete', 'com_release_checking.joomla_version.' . (int) $record->id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can have its state edited.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canEditState($record)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can have its state edited.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canEditState($record)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$recordId = (!empty($record->id)) ? $record->id : 0;
|
||||
|
@ -273,103 +271,103 @@ class Release_checkingModelJoomla_version extends JModelAdmin
|
|||
}
|
||||
}
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return parent::canEditState($record);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
return parent::canEditState($record);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
{
|
||||
// Check specific edit permission then general edit permission.
|
||||
|
||||
return JFactory::getUser()->authorise('core.edit', 'com_release_checking.joomla_version.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and sanitise the table data prior to saving.
|
||||
*
|
||||
* @param JTable $table A JTable object.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if (isset($table->name))
|
||||
{
|
||||
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
|
||||
}
|
||||
|
||||
if (isset($table->alias) && empty($table->alias))
|
||||
{
|
||||
$table->generateAlias();
|
||||
}
|
||||
|
||||
if (empty($table->id))
|
||||
{
|
||||
$table->created = $date->toSql();
|
||||
// set the user
|
||||
if ($table->created_by == 0 || empty($table->created_by))
|
||||
{
|
||||
$table->created_by = $user->id;
|
||||
}
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__release_checking_joomla_version'));
|
||||
$db->setQuery($query);
|
||||
$max = $db->loadResult();
|
||||
|
||||
$table->ordering = $max + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->modified = $date->toSql();
|
||||
$table->modified_by = $user->id;
|
||||
}
|
||||
|
||||
if (!empty($table->id))
|
||||
{
|
||||
// Increment the items version number.
|
||||
$table->version++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('com_release_checking.edit.joomla_version.data', array());
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
// run the perprocess of the data
|
||||
$this->preprocessData('com_release_checking.joomla_version', $data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
return JFactory::getUser()->authorise('core.edit', 'com_release_checking.joomla_version.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and sanitise the table data prior to saving.
|
||||
*
|
||||
* @param JTable $table A JTable object.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if (isset($table->name))
|
||||
{
|
||||
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
|
||||
}
|
||||
|
||||
if (isset($table->alias) && empty($table->alias))
|
||||
{
|
||||
$table->generateAlias();
|
||||
}
|
||||
|
||||
if (empty($table->id))
|
||||
{
|
||||
$table->created = $date->toSql();
|
||||
// set the user
|
||||
if ($table->created_by == 0 || empty($table->created_by))
|
||||
{
|
||||
$table->created_by = $user->id;
|
||||
}
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__release_checking_joomla_version'));
|
||||
$db->setQuery($query);
|
||||
$max = $db->loadResult();
|
||||
|
||||
$table->ordering = $max + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->modified = $date->toSql();
|
||||
$table->modified_by = $user->id;
|
||||
}
|
||||
|
||||
if (!empty($table->id))
|
||||
{
|
||||
// Increment the items version number.
|
||||
$table->version++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('com_release_checking.edit.joomla_version.data', array());
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
// run the perprocess of the data
|
||||
$this->preprocessData('com_release_checking.joomla_version', $data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -382,141 +380,141 @@ class Release_checkingModelJoomla_version extends JModelAdmin
|
|||
protected function getUniqueFields()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to delete one or more records.
|
||||
*
|
||||
* @param array &$pks An array of record primary keys.
|
||||
*
|
||||
* @return boolean True if successful, false if an error occurs.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function delete(&$pks)
|
||||
{
|
||||
if (!parent::delete($pks))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the published state of one or more records.
|
||||
*
|
||||
* @param array &$pks A list of the primary keys to change.
|
||||
* @param integer $value The value of the published state.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function publish(&$pks, $value = 1)
|
||||
{
|
||||
if (!parent::publish($pks, $value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to perform batch operations on an item or a set of items.
|
||||
*
|
||||
* @param array $commands An array of commands to perform.
|
||||
* @param array $pks An array of item ids.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return boolean Returns true on success, false on failure.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function batch($commands, $pks, $contexts)
|
||||
{
|
||||
// Sanitize ids.
|
||||
$pks = array_unique($pks);
|
||||
ArrayHelper::toInteger($pks);
|
||||
|
||||
// Remove any values of zero.
|
||||
if (array_search(0, $pks, true))
|
||||
{
|
||||
unset($pks[array_search(0, $pks, true)]);
|
||||
}
|
||||
|
||||
if (empty($pks))
|
||||
{
|
||||
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = false;
|
||||
|
||||
// Set some needed variables.
|
||||
$this->user = JFactory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = Release_checkingHelper::getActions('joomla_version');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->type == false)
|
||||
{
|
||||
$type = new JUcmType;
|
||||
$this->type = $type->getTypeByAlias($this->typeAlias);
|
||||
}
|
||||
|
||||
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
|
||||
|
||||
if (!empty($commands['move_copy']))
|
||||
{
|
||||
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||
|
||||
if ($cmd == 'c')
|
||||
{
|
||||
$result = $this->batchCopy($commands, $pks, $contexts);
|
||||
|
||||
if (is_array($result))
|
||||
{
|
||||
foreach ($result as $old => $new)
|
||||
{
|
||||
$contexts[$new] = $contexts[$old];
|
||||
}
|
||||
$pks = array_values($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = true;
|
||||
}
|
||||
|
||||
if (!$done)
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to delete one or more records.
|
||||
*
|
||||
* @param array &$pks An array of record primary keys.
|
||||
*
|
||||
* @return boolean True if successful, false if an error occurs.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function delete(&$pks)
|
||||
{
|
||||
if (!parent::delete($pks))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the published state of one or more records.
|
||||
*
|
||||
* @param array &$pks A list of the primary keys to change.
|
||||
* @param integer $value The value of the published state.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function publish(&$pks, $value = 1)
|
||||
{
|
||||
if (!parent::publish($pks, $value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to perform batch operations on an item or a set of items.
|
||||
*
|
||||
* @param array $commands An array of commands to perform.
|
||||
* @param array $pks An array of item ids.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return boolean Returns true on success, false on failure.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function batch($commands, $pks, $contexts)
|
||||
{
|
||||
// Sanitize ids.
|
||||
$pks = array_unique($pks);
|
||||
ArrayHelper::toInteger($pks);
|
||||
|
||||
// Remove any values of zero.
|
||||
if (array_search(0, $pks, true))
|
||||
{
|
||||
unset($pks[array_search(0, $pks, true)]);
|
||||
}
|
||||
|
||||
if (empty($pks))
|
||||
{
|
||||
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = false;
|
||||
|
||||
// Set some needed variables.
|
||||
$this->user = JFactory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = Release_checkingHelper::getActions('joomla_version');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->type == false)
|
||||
{
|
||||
$type = new JUcmType;
|
||||
$this->type = $type->getTypeByAlias($this->typeAlias);
|
||||
}
|
||||
|
||||
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
|
||||
|
||||
if (!empty($commands['move_copy']))
|
||||
{
|
||||
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||
|
||||
if ($cmd == 'c')
|
||||
{
|
||||
$result = $this->batchCopy($commands, $pks, $contexts);
|
||||
|
||||
if (is_array($result))
|
||||
{
|
||||
foreach ($result as $old => $new)
|
||||
{
|
||||
$contexts[$new] = $contexts[$old];
|
||||
}
|
||||
$pks = array_values($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = true;
|
||||
}
|
||||
|
||||
if (!$done)
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -763,38 +761,38 @@ class Release_checkingModelJoomla_version extends JModelAdmin
|
|||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
* @param array $data The form data.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$input = JFactory::getApplication()->input;
|
||||
$filter = JFilterInput::getInstance();
|
||||
|
||||
// set the metadata to the Item Data
|
||||
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
||||
{
|
||||
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
|
||||
|
||||
$metadata = new JRegistry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
{
|
||||
$params = new JRegistry;
|
||||
$params->loadArray($data['params']);
|
||||
$data['params'] = (string) $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
* @param array $data The form data.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$input = JFactory::getApplication()->input;
|
||||
$filter = JFilterInput::getInstance();
|
||||
|
||||
// set the metadata to the Item Data
|
||||
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
||||
{
|
||||
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
|
||||
|
||||
$metadata = new JRegistry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
{
|
||||
$params = new JRegistry;
|
||||
$params->loadArray($data['params']);
|
||||
$data['params'] = (string) $params;
|
||||
}
|
||||
|
||||
// Alter the name for save as copy
|
||||
|
@ -862,37 +860,37 @@ class Release_checkingModelJoomla_version extends JModelAdmin
|
|||
$data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parent::save($data))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a unique value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
*
|
||||
* @return string New value.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function generateUnique($field,$value)
|
||||
{
|
||||
|
||||
// set field value unique
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load(array($field => $value)))
|
||||
{
|
||||
$value = StringHelper::increment($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (parent::save($data))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a unique value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
*
|
||||
* @return string New value.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function generateUnique($field,$value)
|
||||
{
|
||||
|
||||
// set field value unique
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load(array($field => $value)))
|
||||
{
|
||||
$value = StringHelper::increment($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -940,5 +938,5 @@ class Release_checkingModelJoomla_version extends JModelAdmin
|
|||
}
|
||||
// We only had an alias
|
||||
return $alias;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,102 +1,123 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Joomla_versions Model
|
||||
*/
|
||||
class Release_checkingModelJoomla_versions extends JModelList
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Joomla_versions List Model
|
||||
*/
|
||||
class Release_checkingModelJoomla_versions extends ListModel
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
'a.id','id',
|
||||
'a.published','published',
|
||||
'a.access','access',
|
||||
'a.ordering','ordering',
|
||||
'a.created_by','created_by',
|
||||
'a.modified_by','modified_by',
|
||||
'a.name','name'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}
|
||||
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
|
||||
$this->setState('filter.name', $name);
|
||||
|
||||
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||
$this->setState('filter.sorting', $sorting);
|
||||
|
||||
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
|
||||
$this->setState('filter.access', $access);
|
||||
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
|
||||
$this->setState('filter.published', $published);
|
||||
|
||||
$created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
|
||||
$this->setState('filter.created_by', $created_by);
|
||||
|
||||
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
|
||||
$this->setState('filter.created', $created);
|
||||
|
||||
// List state information.
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
'a.name','name'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @param string $ordering An optional ordering field.
|
||||
* @param string $direction An optional direction (asc|desc).
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
// check in items
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}
|
||||
|
||||
// Check if the form was submitted
|
||||
$formSubmited = $app->input->post->get('form_submited');
|
||||
|
||||
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
|
||||
if ($formSubmited)
|
||||
{
|
||||
$access = $app->input->post->get('access');
|
||||
$this->setState('filter.access', $access);
|
||||
}
|
||||
|
||||
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
|
||||
$this->setState('filter.published', $published);
|
||||
|
||||
$created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
|
||||
$this->setState('filter.created_by', $created_by);
|
||||
|
||||
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
|
||||
$this->setState('filter.created', $created);
|
||||
|
||||
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||
$this->setState('filter.sorting', $sorting);
|
||||
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
|
||||
if ($formSubmited)
|
||||
{
|
||||
$name = $app->input->post->get('name');
|
||||
$this->setState('filter.name', $name);
|
||||
}
|
||||
|
||||
// List state information.
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
// Check in items
|
||||
$this->checkInNow();
|
||||
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Get the user object.
|
||||
$user = JFactory::getUser();
|
||||
// Create a new query object.
|
||||
|
@ -124,9 +145,17 @@ class Release_checkingModelJoomla_versions extends JModelList
|
|||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
$_access = $this->getState('filter.access');
|
||||
if ($_access && is_numeric($_access))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
$query->where('a.access = ' . (int) $_access);
|
||||
}
|
||||
elseif (Release_checkingHelper::checkArray($_access))
|
||||
{
|
||||
// Secure the array for the query
|
||||
$_access = ArrayHelper::toInteger($_access);
|
||||
// Filter by the Access Array.
|
||||
$query->where('a.access IN (' . implode(',', $_access) . ')');
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_release_checking'))
|
||||
|
@ -158,7 +187,7 @@ class Release_checkingModelJoomla_versions extends JModelList
|
|||
$query->order($db->escape($orderCol . ' ' . $orderDirn));
|
||||
}
|
||||
|
||||
return $query;
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -275,26 +304,38 @@ class Release_checkingModelJoomla_versions extends JModelList
|
|||
return $headers;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
*
|
||||
* @return string A store id.
|
||||
*
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
*
|
||||
* @return string A store id.
|
||||
*
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':' . $this->getState('filter.id');
|
||||
$id .= ':' . $this->getState('filter.search');
|
||||
$id .= ':' . $this->getState('filter.published');
|
||||
// Check if the value is an array
|
||||
$_access = $this->getState('filter.access');
|
||||
if (Release_checkingHelper::checkArray($_access))
|
||||
{
|
||||
$id .= ':' . implode(':', $_access);
|
||||
}
|
||||
// Check if this is only an number or string
|
||||
elseif (is_numeric($_access)
|
||||
|| Release_checkingHelper::checkString($_access))
|
||||
{
|
||||
$id .= ':' . $_access;
|
||||
}
|
||||
$id .= ':' . $this->getState('filter.ordering');
|
||||
$id .= ':' . $this->getState('filter.created_by');
|
||||
$id .= ':' . $this->getState('filter.modified_by');
|
||||
$id .= ':' . $this->getState('filter.name');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
$id .= ':' . $this->getState('filter.name');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -313,17 +354,19 @@ class Release_checkingModelJoomla_versions extends JModelList
|
|||
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// reset query
|
||||
// Reset query.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('*');
|
||||
$query->from($db->quoteName('#__release_checking_joomla_version'));
|
||||
$db->setQuery($query);
|
||||
// Only select items that are checked out.
|
||||
$query->where($db->quoteName('checked_out') . '!=0');
|
||||
$db->setQuery($query, 0, 1);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
// Get Yesterdays date
|
||||
// Get Yesterdays date.
|
||||
$date = JFactory::getDate()->modify($time)->toSql();
|
||||
// reset query
|
||||
// Reset query.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Fields to update.
|
||||
|
@ -338,7 +381,7 @@ class Release_checkingModelJoomla_versions extends JModelList
|
|||
$db->quoteName('checked_out_time') . '<\''.$date.'\''
|
||||
);
|
||||
|
||||
// Check table
|
||||
// Check table.
|
||||
$query->update($db->quoteName('#__release_checking_joomla_version'))->set($fields)->where($conditions);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
@ -348,5 +391,5 @@ class Release_checkingModelJoomla_versions extends JModelList
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\AdminModel;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checking Release_check Model
|
||||
*/
|
||||
class Release_checkingModelRelease_check extends JModelAdmin
|
||||
{
|
||||
/**
|
||||
* The tab layout fields array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checking Release_check Admin Model
|
||||
*/
|
||||
class Release_checkingModelRelease_check extends AdminModel
|
||||
{
|
||||
/**
|
||||
* The tab layout fields array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $tabLayoutFields = array(
|
||||
'checking' => array(
|
||||
'left' => array(
|
||||
|
@ -37,39 +39,39 @@ class Release_checkingModelRelease_check extends JModelAdmin
|
|||
'joomla_version'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING';
|
||||
|
||||
/**
|
||||
* The type alias for this content type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
public $typeAlias = 'com_release_checking.release_check';
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it
|
||||
*
|
||||
* @param type $type The table type to instantiate
|
||||
* @param string $prefix A prefix for the table class name. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JTable A database object
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTable($type = 'release_check', $prefix = 'Release_checkingTable', $config = array())
|
||||
{
|
||||
// add table path for when model gets used from other component
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_release_checking/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_RELEASE_CHECKING';
|
||||
|
||||
/**
|
||||
* The type alias for this content type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
public $typeAlias = 'com_release_checking.release_check';
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it
|
||||
*
|
||||
* @param type $type The table type to instantiate
|
||||
* @param string $prefix A prefix for the table class name. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JTable A database object
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTable($type = 'release_check', $prefix = 'Release_checkingTable', $config = array())
|
||||
{
|
||||
// add table path for when model gets used from other component
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_release_checking/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
protected function getLatestJoomlaVersion()
|
||||
|
@ -91,61 +93,55 @@ class Release_checkingModelRelease_check extends JModelAdmin
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
*
|
||||
* @param integer $pk The id of the primary key.
|
||||
*
|
||||
* @return mixed Object on success, false on failure.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
if ($item = parent::getItem($pk))
|
||||
{
|
||||
if (!empty($item->params) && !is_array($item->params))
|
||||
{
|
||||
// Convert the params field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->params);
|
||||
$item->params = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->metadata))
|
||||
{
|
||||
// Convert the metadata field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->metadata);
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->id))
|
||||
{
|
||||
$item->tags = new JHelperTags;
|
||||
$item->tags->getTagIds($item->id, 'com_release_checking.release_check');
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
*
|
||||
* @return mixed A JForm object on success, false on failure
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
|
||||
{
|
||||
// set load data option
|
||||
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
*
|
||||
* @param integer $pk The id of the primary key.
|
||||
*
|
||||
* @return mixed Object on success, false on failure.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
if ($item = parent::getItem($pk))
|
||||
{
|
||||
if (!empty($item->params) && !is_array($item->params))
|
||||
{
|
||||
// Convert the params field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->params);
|
||||
$item->params = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->metadata))
|
||||
{
|
||||
// Convert the metadata field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->metadata);
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
*
|
||||
* @return mixed A JForm object on success, false on failure
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
|
||||
{
|
||||
// set load data option
|
||||
$options['load_data'] = $loadData;
|
||||
// check if xpath was set in options
|
||||
$xpath = false;
|
||||
|
@ -254,29 +250,29 @@ class Release_checkingModelRelease_check extends JModelAdmin
|
|||
{
|
||||
$form->setValue('joomla_version', null, $joomla_version);
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the form
|
||||
*
|
||||
* @return string script files
|
||||
*/
|
||||
public function getScript()
|
||||
{
|
||||
return 'administrator/components/com_release_checking/models/forms/release_check.js';
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canDelete($record)
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the form
|
||||
*
|
||||
* @return string script files
|
||||
*/
|
||||
public function getScript()
|
||||
{
|
||||
return 'media/com_release_checking/js/release_check.js';
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canDelete($record)
|
||||
{
|
||||
if (!empty($record->id))
|
||||
{
|
||||
|
@ -289,19 +285,19 @@ class Release_checkingModelRelease_check extends JModelAdmin
|
|||
// The record has been set. Check the record permissions.
|
||||
return $user->authorise('core.delete', 'com_release_checking.release_check.' . (int) $record->id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can have its state edited.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canEditState($record)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can have its state edited.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canEditState($record)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$recordId = (!empty($record->id)) ? $record->id : 0;
|
||||
|
@ -316,104 +312,104 @@ class Release_checkingModelRelease_check extends JModelAdmin
|
|||
}
|
||||
}
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return parent::canEditState($record);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
return parent::canEditState($record);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
{
|
||||
// Check specific edit permission then general edit permission.
|
||||
$user = JFactory::getUser();
|
||||
|
||||
return $user->authorise('core.edit', 'com_release_checking.release_check.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('core.edit', 'com_release_checking');
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and sanitise the table data prior to saving.
|
||||
*
|
||||
* @param JTable $table A JTable object.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if (isset($table->name))
|
||||
{
|
||||
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
|
||||
}
|
||||
|
||||
if (isset($table->alias) && empty($table->alias))
|
||||
{
|
||||
$table->generateAlias();
|
||||
}
|
||||
|
||||
if (empty($table->id))
|
||||
{
|
||||
$table->created = $date->toSql();
|
||||
// set the user
|
||||
if ($table->created_by == 0 || empty($table->created_by))
|
||||
{
|
||||
$table->created_by = $user->id;
|
||||
}
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__release_checking_release_check'));
|
||||
$db->setQuery($query);
|
||||
$max = $db->loadResult();
|
||||
|
||||
$table->ordering = $max + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->modified = $date->toSql();
|
||||
$table->modified_by = $user->id;
|
||||
}
|
||||
|
||||
if (!empty($table->id))
|
||||
{
|
||||
// Increment the items version number.
|
||||
$table->version++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('com_release_checking.edit.release_check.data', array());
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
// run the perprocess of the data
|
||||
$this->preprocessData('com_release_checking.release_check', $data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
return $user->authorise('core.edit', 'com_release_checking.release_check.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('core.edit', 'com_release_checking');
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and sanitise the table data prior to saving.
|
||||
*
|
||||
* @param JTable $table A JTable object.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if (isset($table->name))
|
||||
{
|
||||
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
|
||||
}
|
||||
|
||||
if (isset($table->alias) && empty($table->alias))
|
||||
{
|
||||
$table->generateAlias();
|
||||
}
|
||||
|
||||
if (empty($table->id))
|
||||
{
|
||||
$table->created = $date->toSql();
|
||||
// set the user
|
||||
if ($table->created_by == 0 || empty($table->created_by))
|
||||
{
|
||||
$table->created_by = $user->id;
|
||||
}
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__release_checking_release_check'));
|
||||
$db->setQuery($query);
|
||||
$max = $db->loadResult();
|
||||
|
||||
$table->ordering = $max + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->modified = $date->toSql();
|
||||
$table->modified_by = $user->id;
|
||||
}
|
||||
|
||||
if (!empty($table->id))
|
||||
{
|
||||
// Increment the items version number.
|
||||
$table->version++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('com_release_checking.edit.release_check.data', array());
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
// run the perprocess of the data
|
||||
$this->preprocessData('com_release_checking.release_check', $data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -426,141 +422,141 @@ class Release_checkingModelRelease_check extends JModelAdmin
|
|||
protected function getUniqueFields()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to delete one or more records.
|
||||
*
|
||||
* @param array &$pks An array of record primary keys.
|
||||
*
|
||||
* @return boolean True if successful, false if an error occurs.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function delete(&$pks)
|
||||
{
|
||||
if (!parent::delete($pks))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the published state of one or more records.
|
||||
*
|
||||
* @param array &$pks A list of the primary keys to change.
|
||||
* @param integer $value The value of the published state.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function publish(&$pks, $value = 1)
|
||||
{
|
||||
if (!parent::publish($pks, $value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to perform batch operations on an item or a set of items.
|
||||
*
|
||||
* @param array $commands An array of commands to perform.
|
||||
* @param array $pks An array of item ids.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return boolean Returns true on success, false on failure.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function batch($commands, $pks, $contexts)
|
||||
{
|
||||
// Sanitize ids.
|
||||
$pks = array_unique($pks);
|
||||
ArrayHelper::toInteger($pks);
|
||||
|
||||
// Remove any values of zero.
|
||||
if (array_search(0, $pks, true))
|
||||
{
|
||||
unset($pks[array_search(0, $pks, true)]);
|
||||
}
|
||||
|
||||
if (empty($pks))
|
||||
{
|
||||
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = false;
|
||||
|
||||
// Set some needed variables.
|
||||
$this->user = JFactory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = Release_checkingHelper::getActions('release_check');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->type == false)
|
||||
{
|
||||
$type = new JUcmType;
|
||||
$this->type = $type->getTypeByAlias($this->typeAlias);
|
||||
}
|
||||
|
||||
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
|
||||
|
||||
if (!empty($commands['move_copy']))
|
||||
{
|
||||
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||
|
||||
if ($cmd == 'c')
|
||||
{
|
||||
$result = $this->batchCopy($commands, $pks, $contexts);
|
||||
|
||||
if (is_array($result))
|
||||
{
|
||||
foreach ($result as $old => $new)
|
||||
{
|
||||
$contexts[$new] = $contexts[$old];
|
||||
}
|
||||
$pks = array_values($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = true;
|
||||
}
|
||||
|
||||
if (!$done)
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to delete one or more records.
|
||||
*
|
||||
* @param array &$pks An array of record primary keys.
|
||||
*
|
||||
* @return boolean True if successful, false if an error occurs.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function delete(&$pks)
|
||||
{
|
||||
if (!parent::delete($pks))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the published state of one or more records.
|
||||
*
|
||||
* @param array &$pks A list of the primary keys to change.
|
||||
* @param integer $value The value of the published state.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function publish(&$pks, $value = 1)
|
||||
{
|
||||
if (!parent::publish($pks, $value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to perform batch operations on an item or a set of items.
|
||||
*
|
||||
* @param array $commands An array of commands to perform.
|
||||
* @param array $pks An array of item ids.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return boolean Returns true on success, false on failure.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function batch($commands, $pks, $contexts)
|
||||
{
|
||||
// Sanitize ids.
|
||||
$pks = array_unique($pks);
|
||||
ArrayHelper::toInteger($pks);
|
||||
|
||||
// Remove any values of zero.
|
||||
if (array_search(0, $pks, true))
|
||||
{
|
||||
unset($pks[array_search(0, $pks, true)]);
|
||||
}
|
||||
|
||||
if (empty($pks))
|
||||
{
|
||||
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = false;
|
||||
|
||||
// Set some needed variables.
|
||||
$this->user = JFactory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = Release_checkingHelper::getActions('release_check');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->type == false)
|
||||
{
|
||||
$type = new JUcmType;
|
||||
$this->type = $type->getTypeByAlias($this->typeAlias);
|
||||
}
|
||||
|
||||
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
|
||||
|
||||
if (!empty($commands['move_copy']))
|
||||
{
|
||||
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||
|
||||
if ($cmd == 'c')
|
||||
{
|
||||
$result = $this->batchCopy($commands, $pks, $contexts);
|
||||
|
||||
if (is_array($result))
|
||||
{
|
||||
foreach ($result as $old => $new)
|
||||
{
|
||||
$contexts[$new] = $contexts[$old];
|
||||
}
|
||||
$pks = array_values($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = true;
|
||||
}
|
||||
|
||||
if (!$done)
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -812,38 +808,38 @@ class Release_checkingModelRelease_check extends JModelAdmin
|
|||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
* @param array $data The form data.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$input = JFactory::getApplication()->input;
|
||||
$filter = JFilterInput::getInstance();
|
||||
|
||||
// set the metadata to the Item Data
|
||||
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
||||
{
|
||||
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
|
||||
|
||||
$metadata = new JRegistry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
{
|
||||
$params = new JRegistry;
|
||||
$params->loadArray($data['params']);
|
||||
$data['params'] = (string) $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
* @param array $data The form data.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$input = JFactory::getApplication()->input;
|
||||
$filter = JFilterInput::getInstance();
|
||||
|
||||
// set the metadata to the Item Data
|
||||
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
||||
{
|
||||
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
|
||||
|
||||
$metadata = new JRegistry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
{
|
||||
$params = new JRegistry;
|
||||
$params->loadArray($data['params']);
|
||||
$data['params'] = (string) $params;
|
||||
}
|
||||
|
||||
// Alter the unique field for save as copy
|
||||
|
@ -858,37 +854,37 @@ class Release_checkingModelRelease_check extends JModelAdmin
|
|||
$data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parent::save($data))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a unique value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
*
|
||||
* @return string New value.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function generateUnique($field,$value)
|
||||
{
|
||||
|
||||
// set field value unique
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load(array($field => $value)))
|
||||
{
|
||||
$value = StringHelper::increment($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (parent::save($data))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a unique value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
*
|
||||
* @return string New value.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function generateUnique($field,$value)
|
||||
{
|
||||
|
||||
// set field value unique
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load(array($field => $value)))
|
||||
{
|
||||
$value = StringHelper::increment($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -911,5 +907,5 @@ class Release_checkingModelRelease_check extends JModelAdmin
|
|||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,104 +1,138 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checks Model
|
||||
*/
|
||||
class Release_checkingModelRelease_checks extends JModelList
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checks List Model
|
||||
*/
|
||||
class Release_checkingModelRelease_checks extends ListModel
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
'a.id','id',
|
||||
'a.published','published',
|
||||
'a.access','access',
|
||||
'a.ordering','ordering',
|
||||
'a.created_by','created_by',
|
||||
'a.modified_by','modified_by',
|
||||
'g.name',
|
||||
'h.name',
|
||||
'g.name','context',
|
||||
'h.name','action',
|
||||
'a.outcome','outcome',
|
||||
'i.name'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}
|
||||
'i.name','joomla_version'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @param string $ordering An optional ordering field.
|
||||
* @param string $direction An optional direction (asc|desc).
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}
|
||||
|
||||
// Check if the form was submitted
|
||||
$formSubmited = $app->input->post->get('form_submited');
|
||||
|
||||
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
|
||||
if ($formSubmited)
|
||||
{
|
||||
$access = $app->input->post->get('access');
|
||||
$this->setState('filter.access', $access);
|
||||
}
|
||||
|
||||
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
|
||||
$this->setState('filter.published', $published);
|
||||
|
||||
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
|
||||
$this->setState('filter.created', $created);
|
||||
|
||||
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||
$this->setState('filter.sorting', $sorting);
|
||||
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$context = $this->getUserStateFromRequest($this->context . '.filter.context', 'filter_context');
|
||||
$this->setState('filter.context', $context);
|
||||
if ($formSubmited)
|
||||
{
|
||||
$context = $app->input->post->get('context');
|
||||
$this->setState('filter.context', $context);
|
||||
}
|
||||
|
||||
$action = $this->getUserStateFromRequest($this->context . '.filter.action', 'filter_action');
|
||||
$this->setState('filter.action', $action);
|
||||
if ($formSubmited)
|
||||
{
|
||||
$action = $app->input->post->get('action');
|
||||
$this->setState('filter.action', $action);
|
||||
}
|
||||
|
||||
$outcome = $this->getUserStateFromRequest($this->context . '.filter.outcome', 'filter_outcome');
|
||||
$this->setState('filter.outcome', $outcome);
|
||||
if ($formSubmited)
|
||||
{
|
||||
$outcome = $app->input->post->get('outcome');
|
||||
$this->setState('filter.outcome', $outcome);
|
||||
}
|
||||
|
||||
$joomla_version = $this->getUserStateFromRequest($this->context . '.filter.joomla_version', 'filter_joomla_version');
|
||||
$this->setState('filter.joomla_version', $joomla_version);
|
||||
if ($formSubmited)
|
||||
{
|
||||
$joomla_version = $app->input->post->get('joomla_version');
|
||||
$this->setState('filter.joomla_version', $joomla_version);
|
||||
}
|
||||
|
||||
$created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by');
|
||||
$this->setState('filter.created_by', $created_by);
|
||||
|
||||
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||
$this->setState('filter.sorting', $sorting);
|
||||
|
||||
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
|
||||
$this->setState('filter.access', $access);
|
||||
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
|
||||
$this->setState('filter.published', $published);
|
||||
|
||||
$created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
|
||||
$this->setState('filter.created_by', $created_by);
|
||||
|
||||
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
|
||||
$this->setState('filter.created', $created);
|
||||
|
||||
// List state information.
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
if ($formSubmited)
|
||||
{
|
||||
$created_by = $app->input->post->get('created_by');
|
||||
$this->setState('filter.created_by', $created_by);
|
||||
}
|
||||
|
||||
// List state information.
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
// check in items
|
||||
// Check in items
|
||||
$this->checkInNow();
|
||||
|
||||
// load parent items
|
||||
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
// Set values to display correctly.
|
||||
|
@ -127,10 +161,10 @@ class Release_checkingModelRelease_checks extends JModelList
|
|||
$item->outcome = $this->selectionTranslation($item->outcome, 'outcome');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,15 +189,15 @@ class Release_checkingModelRelease_checks extends JModelList
|
|||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Get the user object.
|
||||
$user = JFactory::getUser();
|
||||
// Create a new query object.
|
||||
|
@ -203,9 +237,17 @@ class Release_checkingModelRelease_checks extends JModelList
|
|||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
$_access = $this->getState('filter.access');
|
||||
if ($_access && is_numeric($_access))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
$query->where('a.access = ' . (int) $_access);
|
||||
}
|
||||
elseif (Release_checkingHelper::checkArray($_access))
|
||||
{
|
||||
// Secure the array for the query
|
||||
$_access = ArrayHelper::toInteger($_access);
|
||||
// Filter by the Access Array.
|
||||
$query->where('a.access IN (' . implode(',', $_access) . ')');
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_release_checking'))
|
||||
|
@ -228,30 +270,205 @@ class Release_checkingModelRelease_checks extends JModelList
|
|||
}
|
||||
}
|
||||
|
||||
// Filter by context.
|
||||
if ($context = $this->getState('filter.context'))
|
||||
// Filter by Context.
|
||||
$_context = $this->getState('filter.context');
|
||||
if (is_numeric($_context))
|
||||
{
|
||||
$query->where('a.context = ' . $db->quote($db->escape($context)));
|
||||
if (is_float($_context))
|
||||
{
|
||||
$query->where('a.context = ' . (float) $_context);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where('a.context = ' . (int) $_context);
|
||||
}
|
||||
}
|
||||
// Filter by action.
|
||||
if ($action = $this->getState('filter.action'))
|
||||
elseif (Release_checkingHelper::checkString($_context))
|
||||
{
|
||||
$query->where('a.action = ' . $db->quote($db->escape($action)));
|
||||
$query->where('a.context = ' . $db->quote($db->escape($_context)));
|
||||
}
|
||||
elseif (Release_checkingHelper::checkArray($_context))
|
||||
{
|
||||
// Secure the array for the query
|
||||
$_context = array_map( function ($val) use(&$db) {
|
||||
if (is_numeric($val))
|
||||
{
|
||||
if (is_float($val))
|
||||
{
|
||||
return (float) $val;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int) $val;
|
||||
}
|
||||
}
|
||||
elseif (Release_checkingHelper::checkString($val))
|
||||
{
|
||||
return $db->quote($db->escape($val));
|
||||
}
|
||||
}, $_context);
|
||||
// Filter by the Context Array.
|
||||
$query->where('a.context IN (' . implode(',', $_context) . ')');
|
||||
}
|
||||
// Filter by Action.
|
||||
$_action = $this->getState('filter.action');
|
||||
if (is_numeric($_action))
|
||||
{
|
||||
if (is_float($_action))
|
||||
{
|
||||
$query->where('a.action = ' . (float) $_action);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where('a.action = ' . (int) $_action);
|
||||
}
|
||||
}
|
||||
elseif (Release_checkingHelper::checkString($_action))
|
||||
{
|
||||
$query->where('a.action = ' . $db->quote($db->escape($_action)));
|
||||
}
|
||||
elseif (Release_checkingHelper::checkArray($_action))
|
||||
{
|
||||
// Secure the array for the query
|
||||
$_action = array_map( function ($val) use(&$db) {
|
||||
if (is_numeric($val))
|
||||
{
|
||||
if (is_float($val))
|
||||
{
|
||||
return (float) $val;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int) $val;
|
||||
}
|
||||
}
|
||||
elseif (Release_checkingHelper::checkString($val))
|
||||
{
|
||||
return $db->quote($db->escape($val));
|
||||
}
|
||||
}, $_action);
|
||||
// Filter by the Action Array.
|
||||
$query->where('a.action IN (' . implode(',', $_action) . ')');
|
||||
}
|
||||
// Filter by Outcome.
|
||||
if ($outcome = $this->getState('filter.outcome'))
|
||||
$_outcome = $this->getState('filter.outcome');
|
||||
if (is_numeric($_outcome))
|
||||
{
|
||||
$query->where('a.outcome = ' . $db->quote($db->escape($outcome)));
|
||||
if (is_float($_outcome))
|
||||
{
|
||||
$query->where('a.outcome = ' . (float) $_outcome);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where('a.outcome = ' . (int) $_outcome);
|
||||
}
|
||||
}
|
||||
// Filter by joomla_version.
|
||||
if ($joomla_version = $this->getState('filter.joomla_version'))
|
||||
elseif (Release_checkingHelper::checkString($_outcome))
|
||||
{
|
||||
$query->where('a.joomla_version = ' . $db->quote($db->escape($joomla_version)));
|
||||
$query->where('a.outcome = ' . $db->quote($db->escape($_outcome)));
|
||||
}
|
||||
elseif (Release_checkingHelper::checkArray($_outcome))
|
||||
{
|
||||
// Secure the array for the query
|
||||
$_outcome = array_map( function ($val) use(&$db) {
|
||||
if (is_numeric($val))
|
||||
{
|
||||
if (is_float($val))
|
||||
{
|
||||
return (float) $val;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int) $val;
|
||||
}
|
||||
}
|
||||
elseif (Release_checkingHelper::checkString($val))
|
||||
{
|
||||
return $db->quote($db->escape($val));
|
||||
}
|
||||
}, $_outcome);
|
||||
// Filter by the Outcome Array.
|
||||
$query->where('a.outcome IN (' . implode(',', $_outcome) . ')');
|
||||
}
|
||||
// Filter by Joomla_version.
|
||||
$_joomla_version = $this->getState('filter.joomla_version');
|
||||
if (is_numeric($_joomla_version))
|
||||
{
|
||||
if (is_float($_joomla_version))
|
||||
{
|
||||
$query->where('a.joomla_version = ' . (float) $_joomla_version);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where('a.joomla_version = ' . (int) $_joomla_version);
|
||||
}
|
||||
}
|
||||
elseif (Release_checkingHelper::checkString($_joomla_version))
|
||||
{
|
||||
$query->where('a.joomla_version = ' . $db->quote($db->escape($_joomla_version)));
|
||||
}
|
||||
elseif (Release_checkingHelper::checkArray($_joomla_version))
|
||||
{
|
||||
// Secure the array for the query
|
||||
$_joomla_version = array_map( function ($val) use(&$db) {
|
||||
if (is_numeric($val))
|
||||
{
|
||||
if (is_float($val))
|
||||
{
|
||||
return (float) $val;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int) $val;
|
||||
}
|
||||
}
|
||||
elseif (Release_checkingHelper::checkString($val))
|
||||
{
|
||||
return $db->quote($db->escape($val));
|
||||
}
|
||||
}, $_joomla_version);
|
||||
// Filter by the Joomla_version Array.
|
||||
$query->where('a.joomla_version IN (' . implode(',', $_joomla_version) . ')');
|
||||
}
|
||||
// Filter by Created_by.
|
||||
if ($created_by = $this->getState('filter.created_by'))
|
||||
$_created_by = $this->getState('filter.created_by');
|
||||
if (is_numeric($_created_by))
|
||||
{
|
||||
$query->where('a.created_by = ' . $db->quote($db->escape($created_by)));
|
||||
if (is_float($_created_by))
|
||||
{
|
||||
$query->where('a.created_by = ' . (float) $_created_by);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where('a.created_by = ' . (int) $_created_by);
|
||||
}
|
||||
}
|
||||
elseif (Release_checkingHelper::checkString($_created_by))
|
||||
{
|
||||
$query->where('a.created_by = ' . $db->quote($db->escape($_created_by)));
|
||||
}
|
||||
elseif (Release_checkingHelper::checkArray($_created_by))
|
||||
{
|
||||
// Secure the array for the query
|
||||
$_created_by = array_map( function ($val) use(&$db) {
|
||||
if (is_numeric($val))
|
||||
{
|
||||
if (is_float($val))
|
||||
{
|
||||
return (float) $val;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int) $val;
|
||||
}
|
||||
}
|
||||
elseif (Release_checkingHelper::checkString($val))
|
||||
{
|
||||
return $db->quote($db->escape($val));
|
||||
}
|
||||
}, $_created_by);
|
||||
// Filter by the Created_by Array.
|
||||
$query->where('a.created_by IN (' . implode(',', $_created_by) . ')');
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
|
@ -262,7 +479,7 @@ class Release_checkingModelRelease_checks extends JModelList
|
|||
$query->order($db->escape($orderCol . ' ' . $orderDirn));
|
||||
}
|
||||
|
||||
return $query;
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -414,29 +631,84 @@ class Release_checkingModelRelease_checks extends JModelList
|
|||
return $headers;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
*
|
||||
* @return string A store id.
|
||||
*
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
*
|
||||
* @return string A store id.
|
||||
*
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':' . $this->getState('filter.id');
|
||||
$id .= ':' . $this->getState('filter.search');
|
||||
$id .= ':' . $this->getState('filter.published');
|
||||
// Check if the value is an array
|
||||
$_access = $this->getState('filter.access');
|
||||
if (Release_checkingHelper::checkArray($_access))
|
||||
{
|
||||
$id .= ':' . implode(':', $_access);
|
||||
}
|
||||
// Check if this is only an number or string
|
||||
elseif (is_numeric($_access)
|
||||
|| Release_checkingHelper::checkString($_access))
|
||||
{
|
||||
$id .= ':' . $_access;
|
||||
}
|
||||
$id .= ':' . $this->getState('filter.ordering');
|
||||
$id .= ':' . $this->getState('filter.created_by');
|
||||
$id .= ':' . $this->getState('filter.modified_by');
|
||||
$id .= ':' . $this->getState('filter.context');
|
||||
$id .= ':' . $this->getState('filter.action');
|
||||
$id .= ':' . $this->getState('filter.outcome');
|
||||
$id .= ':' . $this->getState('filter.joomla_version');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
// Check if the value is an array
|
||||
$_context = $this->getState('filter.context');
|
||||
if (Release_checkingHelper::checkArray($_context))
|
||||
{
|
||||
$id .= ':' . implode(':', $_context);
|
||||
}
|
||||
// Check if this is only an number or string
|
||||
elseif (is_numeric($_context)
|
||||
|| Release_checkingHelper::checkString($_context))
|
||||
{
|
||||
$id .= ':' . $_context;
|
||||
}
|
||||
// Check if the value is an array
|
||||
$_action = $this->getState('filter.action');
|
||||
if (Release_checkingHelper::checkArray($_action))
|
||||
{
|
||||
$id .= ':' . implode(':', $_action);
|
||||
}
|
||||
// Check if this is only an number or string
|
||||
elseif (is_numeric($_action)
|
||||
|| Release_checkingHelper::checkString($_action))
|
||||
{
|
||||
$id .= ':' . $_action;
|
||||
}
|
||||
// Check if the value is an array
|
||||
$_outcome = $this->getState('filter.outcome');
|
||||
if (Release_checkingHelper::checkArray($_outcome))
|
||||
{
|
||||
$id .= ':' . implode(':', $_outcome);
|
||||
}
|
||||
// Check if this is only an number or string
|
||||
elseif (is_numeric($_outcome)
|
||||
|| Release_checkingHelper::checkString($_outcome))
|
||||
{
|
||||
$id .= ':' . $_outcome;
|
||||
}
|
||||
// Check if the value is an array
|
||||
$_joomla_version = $this->getState('filter.joomla_version');
|
||||
if (Release_checkingHelper::checkArray($_joomla_version))
|
||||
{
|
||||
$id .= ':' . implode(':', $_joomla_version);
|
||||
}
|
||||
// Check if this is only an number or string
|
||||
elseif (is_numeric($_joomla_version)
|
||||
|| Release_checkingHelper::checkString($_joomla_version))
|
||||
{
|
||||
$id .= ':' . $_joomla_version;
|
||||
}
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -455,17 +727,19 @@ class Release_checkingModelRelease_checks extends JModelList
|
|||
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// reset query
|
||||
// Reset query.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('*');
|
||||
$query->from($db->quoteName('#__release_checking_release_check'));
|
||||
$db->setQuery($query);
|
||||
// Only select items that are checked out.
|
||||
$query->where($db->quoteName('checked_out') . '!=0');
|
||||
$db->setQuery($query, 0, 1);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
// Get Yesterdays date
|
||||
// Get Yesterdays date.
|
||||
$date = JFactory::getDate()->modify($time)->toSql();
|
||||
// reset query
|
||||
// Reset query.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Fields to update.
|
||||
|
@ -480,7 +754,7 @@ class Release_checkingModelRelease_checks extends JModelList
|
|||
$db->quoteName('checked_out_time') . '<\''.$date.'\''
|
||||
);
|
||||
|
||||
// Check table
|
||||
// Check table.
|
||||
$query->update($db->quoteName('#__release_checking_release_check'))->set($fields)->where($conditions);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
@ -490,5 +764,5 @@ class Release_checkingModelRelease_checks extends JModelList
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +1,81 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
JHtml::_('behavior.tabstate');
|
||||
|
||||
// Access check.
|
||||
if (!JFactory::getUser()->authorise('core.manage', 'com_release_checking'))
|
||||
{
|
||||
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
|
||||
};
|
||||
|
||||
// Add CSS file for all pages
|
||||
$document = JFactory::getDocument();
|
||||
$document->addStyleSheet('components/com_release_checking/assets/css/admin.css');
|
||||
$document->addScript('components/com_release_checking/assets/js/admin.js');
|
||||
|
||||
// require helper files
|
||||
JLoader::register('Release_checkingHelper', __DIR__ . '/helpers/release_checking.php');
|
||||
JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php');
|
||||
|
||||
// Get an instance of the controller prefixed by Release_checking
|
||||
$controller = JControllerLegacy::getInstance('Release_checking');
|
||||
|
||||
// Perform the Request task
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
|
||||
// Redirect if set by the controller
|
||||
$controller->redirect();
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// register this component namespace
|
||||
spl_autoload_register(function ($class) {
|
||||
// project-specific base directories and namespace prefix
|
||||
$search = [
|
||||
'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla'
|
||||
];
|
||||
// Start the search and load if found
|
||||
$found = false;
|
||||
$found_base_dir = "";
|
||||
$found_len = 0;
|
||||
foreach ($search as $base_dir => $prefix)
|
||||
{
|
||||
// does the class use the namespace prefix?
|
||||
$len = strlen($prefix);
|
||||
if (strncmp($prefix, $class, $len) === 0)
|
||||
{
|
||||
// we have a match so load the values
|
||||
$found = true;
|
||||
$found_base_dir = $base_dir;
|
||||
$found_len = $len;
|
||||
// done here
|
||||
break;
|
||||
}
|
||||
}
|
||||
// check if we found a match
|
||||
if (!$found)
|
||||
{
|
||||
// not found so move to the next registered autoloader
|
||||
return;
|
||||
}
|
||||
// get the relative class name
|
||||
$relative_class = substr($class, $found_len);
|
||||
// replace the namespace prefix with the base directory, replace namespace
|
||||
// separators with directory separators in the relative class name, append
|
||||
// with .php
|
||||
$file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php';
|
||||
// if the file exists, require it
|
||||
if (file_exists($file))
|
||||
{
|
||||
require $file;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Access check.
|
||||
if (!JFactory::getUser()->authorise('core.manage', 'com_release_checking'))
|
||||
{
|
||||
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
|
||||
};
|
||||
|
||||
// Add CSS file for all pages
|
||||
$document = JFactory::getDocument();
|
||||
$document->addStyleSheet('components/com_release_checking/assets/css/admin.css');
|
||||
$document->addScript('components/com_release_checking/assets/js/admin.js');
|
||||
|
||||
// require helper files
|
||||
JLoader::register('Release_checkingHelper', __DIR__ . '/helpers/release_checking.php');
|
||||
JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php');
|
||||
|
||||
// Get an instance of the controller prefixed by Release_checking
|
||||
$controller = JControllerLegacy::getInstance('Release_checking');
|
||||
|
||||
// Perform the Request task
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
|
||||
// Redirect if set by the controller
|
||||
$controller->redirect();
|
||||
|
|
|
@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS `#__release_checking_release_check` (
|
|||
`created_by` INT(11) NOT NULL DEFAULT 0,
|
||||
`joomla_version` INT(11) NOT NULL DEFAULT 0,
|
||||
`outcome` TINYINT(1) NOT NULL DEFAULT -1,
|
||||
`params` text NOT NULL,
|
||||
`params` text NULL,
|
||||
`published` TINYINT(3) NOT NULL DEFAULT 1,
|
||||
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
|
@ -33,7 +33,7 @@ CREATE TABLE IF NOT EXISTS `#__release_checking_joomla_version` (
|
|||
`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
|
||||
`alias` CHAR(64) NOT NULL DEFAULT '',
|
||||
`name` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`params` text NOT NULL,
|
||||
`params` text NULL,
|
||||
`published` TINYINT(3) NOT NULL DEFAULT 1,
|
||||
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
|
@ -60,7 +60,7 @@ CREATE TABLE IF NOT EXISTS `#__release_checking_context` (
|
|||
`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
|
||||
`alias` CHAR(64) NOT NULL DEFAULT '',
|
||||
`name` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`params` text NOT NULL,
|
||||
`params` text NULL,
|
||||
`published` TINYINT(3) NOT NULL DEFAULT 1,
|
||||
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
|
@ -89,7 +89,7 @@ CREATE TABLE IF NOT EXISTS `#__release_checking_action` (
|
|||
`context` INT(11) NOT NULL DEFAULT 0,
|
||||
`description` TEXT NOT NULL,
|
||||
`name` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`params` text NOT NULL,
|
||||
`params` text NULL,
|
||||
`published` TINYINT(3) NOT NULL DEFAULT 1,
|
||||
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
|
@ -112,179 +112,169 @@ CREATE TABLE IF NOT EXISTS `#__release_checking_action` (
|
|||
KEY `idx_state` (`published`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
||||
|
||||
--
|
||||
-- Dumping data for table `#__release_checking_joomla_version`
|
||||
--
|
||||
|
||||
INSERT INTO `#__release_checking_joomla_version` (`id`, `alias`, `name`, `published`) VALUES
|
||||
(1, '3-9-5-rc', '3.9.5 RC ', 1),
|
||||
(2, '3-9-5-stable-release', '3.9.5 Stable Release', 1),
|
||||
(3, '3-9-6-rc', '3.9.6 RC', 1),
|
||||
(4, '3-9-6-rc2', '3.9.6 RC2', 1),
|
||||
(5, '3-9-7-stable', '3.9.7 Stable', 1),
|
||||
(6, '3-9-18', '3.9.18', 1),
|
||||
(7, '3-9-8-stable', '3.9.8 Stable', 1),
|
||||
(8, '3-9-9-dev', '3.9.9-dev', 1),
|
||||
(9, '3-9-11-rc', '3.9.11 RC', 1),
|
||||
(10, '3-19-13', '3.19.13', 1),
|
||||
(11, '3-9-14', '3.9.14', 1),
|
||||
(12, '3-9-15', '3.9.15', 1),
|
||||
(13, '3-9-16', '3.9.16', 1),
|
||||
(14, '3-9-17', '3.9.17', 1),
|
||||
(15, '3-9-19', '3.9.19', 1),
|
||||
(16, '3-9-20', '3.9.20', 1),
|
||||
(17, '3-9-21', '3.9.21', 1),
|
||||
--
|
||||
-- Dumping data for table `#__release_checking_joomla_version`
|
||||
--
|
||||
|
||||
INSERT INTO `#__release_checking_joomla_version` (`id`, `alias`, `name`, `published`) VALUES
|
||||
(1, '3-9-5-rc', '3.9.5 RC ', 1),
|
||||
(2, '3-9-5-stable-release', '3.9.5 Stable Release', 1),
|
||||
(3, '3-9-6-rc', '3.9.6 RC', 1),
|
||||
(4, '3-9-6-rc2', '3.9.6 RC2', 1),
|
||||
(5, '3-9-7-stable', '3.9.7 Stable', 1),
|
||||
(6, '3-9-18', '3.9.18', 1),
|
||||
(7, '3-9-8-stable', '3.9.8 Stable', 1),
|
||||
(8, '3-9-9-dev', '3.9.9-dev', 1),
|
||||
(9, '3-9-11-rc', '3.9.11 RC', 1),
|
||||
(10, '3-19-13', '3.19.13', 1),
|
||||
(11, '3-9-14', '3.9.14', 1),
|
||||
(12, '3-9-15', '3.9.15', 1),
|
||||
(13, '3-9-16', '3.9.16', 1),
|
||||
(14, '3-9-17', '3.9.17', 1),
|
||||
(15, '3-9-19', '3.9.19', 1),
|
||||
(16, '3-9-20', '3.9.20', 1),
|
||||
(17, '3-9-21', '3.9.21', 1),
|
||||
(18, '3-9-22', '3.9.22', 1);
|
||||
|
||||
--
|
||||
-- Dumping data for table `#__release_checking_context`
|
||||
--
|
||||
|
||||
INSERT INTO `#__release_checking_context` (`id`, `alias`, `name`, `published`, `created`) VALUES
|
||||
(1, 'com_installer', 'com_installer', 1, '2020-10-31 14:20:29'),
|
||||
(2, 'com_users', 'com_users', 1, '2020-10-31 20:21:11'),
|
||||
(3, 'com_menu', 'com_menu', 1, '2020-10-31 20:21:31'),
|
||||
(4, 'com_categories-and-com_content', 'com_categories and com_content', 1, '2020-10-31 20:21:48'),
|
||||
(5, 'com_fields', 'com_fields', 1, '2020-10-31 20:22:20'),
|
||||
(6, 'com_tags', 'com_tags', 1, '2020-10-31 20:22:37'),
|
||||
(7, 'com_media', 'com_media', 1, '2020-10-31 20:22:56'),
|
||||
(9, 'com_plugins-com_installer', 'com_plugins (+ com_installer)', 1, '2020-10-31 20:25:17'),
|
||||
(10, 'com_modules', 'com_modules', 1, '2020-10-31 20:25:32'),
|
||||
(11, 'com_templates', 'com_templates', 1, '2020-10-31 20:25:50'),
|
||||
(12, 'com_languages', 'com_languages', 1, '2020-10-31 20:26:10'),
|
||||
(13, 'com_config', 'com_config', 1, '2020-10-31 20:26:43'),
|
||||
(14, 'editors', 'Editors', 1, '2020-10-31 20:26:59'),
|
||||
(15, 'com_admin-and-com_cache', 'com_admin and com_cache', 1, '2020-10-31 20:27:36'),
|
||||
(16, 'com_search', 'com_search', 1, '2020-10-31 20:27:59'),
|
||||
(17, 'com_finder', 'com_finder', 1, '2020-10-31 20:28:53'),
|
||||
(18, 'com_redirect', 'com_redirect', 1, '2020-10-31 20:29:11'),
|
||||
(19, 'com_weblinks', 'com_weblinks', 1, '2020-10-31 20:29:54'),
|
||||
(20, 'com_privacy', 'com_privacy', 1, '2020-10-31 20:30:15'),
|
||||
(21, 'com_actionlog', 'com_actionlog', 1, '2020-10-31 20:30:48'),
|
||||
(22, 'com_login', 'com_login', 1, '2020-10-31 20:31:03'),
|
||||
(23, 'com_contenthistory', 'com_contenthistory', 1, '2020-10-31 20:31:17'),
|
||||
(24, 'com_contact', 'com_contact', 1, '2020-10-31 20:31:36'),
|
||||
(25, 'com_checkin', 'com_checkin', 1, '2020-10-31 20:31:52'),
|
||||
(26, 'com_banners', 'com_banners', 1, '2020-10-31 20:32:11'),
|
||||
(27, 'com_mailto-only-frontend', 'com_mailto (only frontend)', 1, '2020-10-31 20:32:47'),
|
||||
(28, 'category-filter-in-the-featured-view', 'category filter in the featured view', 1, '2020-10-31 20:33:08'),
|
||||
(29, 'whitespace-characters-etc-new-users', 'whitespace characters etc new users', 1, '2020-10-31 20:33:31'),
|
||||
(30, 'com_fields-sql-field', 'com_fields SQL field', 1, '2020-10-31 20:33:51'),
|
||||
(31, 'beez3-and-protostar-forms,-button-groups', 'beez3 and protostar forms, button groups', 1, '2020-10-31 20:34:18'),
|
||||
(32, 'template-crop-and-resize-image-functionality', 'template crop and resize image functionality', 1, '2020-10-31 20:34:37'),
|
||||
(33, 'superusers-edit-templates-in-backend', 'superusers edit templates in backend', 1, '2020-10-31 20:35:04'),
|
||||
(34, 'com_joomlaupdate', 'com_joomlaupdate', 1, '2020-10-31 20:35:28'),
|
||||
--
|
||||
-- Dumping data for table `#__release_checking_context`
|
||||
--
|
||||
|
||||
INSERT INTO `#__release_checking_context` (`id`, `alias`, `name`, `published`, `created`) VALUES
|
||||
(1, 'com_installer', 'com_installer', 1, '2020-10-31 14:20:29'),
|
||||
(2, 'com_users', 'com_users', 1, '2020-10-31 20:21:11'),
|
||||
(3, 'com_menu', 'com_menu', 1, '2020-10-31 20:21:31'),
|
||||
(4, 'com_categories-and-com_content', 'com_categories and com_content', 1, '2020-10-31 20:21:48'),
|
||||
(5, 'com_fields', 'com_fields', 1, '2020-10-31 20:22:20'),
|
||||
(6, 'com_tags', 'com_tags', 1, '2020-10-31 20:22:37'),
|
||||
(7, 'com_media', 'com_media', 1, '2020-10-31 20:22:56'),
|
||||
(9, 'com_plugins-com_installer', 'com_plugins (+ com_installer)', 1, '2020-10-31 20:25:17'),
|
||||
(10, 'com_modules', 'com_modules', 1, '2020-10-31 20:25:32'),
|
||||
(11, 'com_templates', 'com_templates', 1, '2020-10-31 20:25:50'),
|
||||
(12, 'com_languages', 'com_languages', 1, '2020-10-31 20:26:10'),
|
||||
(13, 'com_config', 'com_config', 1, '2020-10-31 20:26:43'),
|
||||
(14, 'editors', 'Editors', 1, '2020-10-31 20:26:59'),
|
||||
(15, 'com_admin-and-com_cache', 'com_admin and com_cache', 1, '2020-10-31 20:27:36'),
|
||||
(16, 'com_search', 'com_search', 1, '2020-10-31 20:27:59'),
|
||||
(17, 'com_finder', 'com_finder', 1, '2020-10-31 20:28:53'),
|
||||
(18, 'com_redirect', 'com_redirect', 1, '2020-10-31 20:29:11'),
|
||||
(19, 'com_weblinks', 'com_weblinks', 1, '2020-10-31 20:29:54'),
|
||||
(20, 'com_privacy', 'com_privacy', 1, '2020-10-31 20:30:15'),
|
||||
(21, 'com_actionlog', 'com_actionlog', 1, '2020-10-31 20:30:48'),
|
||||
(22, 'com_login', 'com_login', 1, '2020-10-31 20:31:03'),
|
||||
(23, 'com_contenthistory', 'com_contenthistory', 1, '2020-10-31 20:31:17'),
|
||||
(24, 'com_contact', 'com_contact', 1, '2020-10-31 20:31:36'),
|
||||
(25, 'com_checkin', 'com_checkin', 1, '2020-10-31 20:31:52'),
|
||||
(26, 'com_banners', 'com_banners', 1, '2020-10-31 20:32:11'),
|
||||
(27, 'com_mailto-only-frontend', 'com_mailto (only frontend)', 1, '2020-10-31 20:32:47'),
|
||||
(28, 'category-filter-in-the-featured-view', 'category filter in the featured view', 1, '2020-10-31 20:33:08'),
|
||||
(29, 'whitespace-characters-etc-new-users', 'whitespace characters etc new users', 1, '2020-10-31 20:33:31'),
|
||||
(30, 'com_fields-sql-field', 'com_fields SQL field', 1, '2020-10-31 20:33:51'),
|
||||
(31, 'beez3-and-protostar-forms,-button-groups', 'beez3 and protostar forms, button groups', 1, '2020-10-31 20:34:18'),
|
||||
(32, 'template-crop-and-resize-image-functionality', 'template crop and resize image functionality', 1, '2020-10-31 20:34:37'),
|
||||
(33, 'superusers-edit-templates-in-backend', 'superusers edit templates in backend', 1, '2020-10-31 20:35:04'),
|
||||
(34, 'com_joomlaupdate', 'com_joomlaupdate', 1, '2020-10-31 20:35:28'),
|
||||
(35, 'recaptcha', 'Recaptcha', 1, '2020-10-31 20:35:46');
|
||||
|
||||
--
|
||||
-- Dumping data for table `#__release_checking_action`
|
||||
--
|
||||
|
||||
INSERT INTO `#__release_checking_action` (`id`, `alias`, `context`, `description`, `name`, `published`) VALUES
|
||||
(1, 'installing-joomla', 1, '', 'Installing Joomla', 1),
|
||||
(2, 'adding-new-user-backend', 2, '', 'Adding new user (Backend)', 1),
|
||||
(3, 'amending-user-details', 2, '', 'Amending user details', 1),
|
||||
(4, 'amending-user-access-privileges', 2, '', 'Amending user access privileges', 1),
|
||||
(5, 'deleting-user', 2, '', 'Deleting user', 1),
|
||||
(6, 'creating-new-user-group', 2, '', 'Creating new User Group', 1),
|
||||
(7, 'configuring-viewing-access-levels-for-new-user-group', 2, '', 'Configuring Viewing Access Levels for new User Group', 1),
|
||||
(8, 'deleting-user-group', 2, '', 'Deleting User Group', 1),
|
||||
(9, 'email-notifications', 2, '', 'Email notifications', 1),
|
||||
(10, 'creating-new-menu', 3, '', 'Creating new Menu', 1),
|
||||
(11, 'linking-module-to-new-menu', 3, '', 'Linking Module to new Menu', 1),
|
||||
(12, 'create-new-menu-item', 3, '', 'Create new Menu Item', 1),
|
||||
(13, 'deleting-menu-item', 3, '', 'Deleting Menu Item', 1),
|
||||
(14, 'deleting-menu', 3, '', 'Deleting Menu', 1),
|
||||
(15, 'empty-menu-trash', 3, '', 'Empty Menu Trash', 1),
|
||||
(16, 'create-new-category', 4, '', 'Create new Category', 1),
|
||||
(17, 'create-new-article', 4, '', 'Create new Article', 1),
|
||||
(18, 'assign-category-to-article', 4, '', 'Assign category to article', 1),
|
||||
(19, 'toggle-featured-status-on-article', 4, '', 'Toggle Featured status on article', 1),
|
||||
(20, 'delete-category', 4, '', 'Delete category', 1),
|
||||
(21, 'clear-category-trash', 4, '', 'Clear Category Trash', 1),
|
||||
(22, 'delete-article', 4, '', 'Delete article', 1),
|
||||
(23, 'clear-article-trash', 4, '', 'Clear Article Trash', 1),
|
||||
(24, 'archive-article', 4, '', 'Archive Article', 1),
|
||||
(25, 'un-archive-article', 4, '', 'Un-Archive Article', 1),
|
||||
(26, 'check-versioning', 4, '', 'Check Versioning', 1),
|
||||
(27, 'create-field-group', 5, '', 'Create Field Group', 1),
|
||||
(28, 'create-field', 5, '', 'Create Field', 1),
|
||||
(29, 'fill-in-field-in-an-article', 5, '', 'Fill-in field in an article', 1),
|
||||
(30, 'delete-field', 5, '', 'Delete Field', 1),
|
||||
(31, 'clear-field-trash', 5, '', 'Clear Field Trash', 1),
|
||||
(32, 'delete-field-group', 5, '', 'Delete Field Group', 1),
|
||||
(33, 'clear-field-group-trash', 5, '', 'Clear Field Group Trash', 1),
|
||||
(34, 'create-new-tag', 6, '', 'Create new Tag', 1),
|
||||
(35, 'assign-tag-to-article', 6, '', 'Assign tag to article', 1),
|
||||
(36, 'remove-tag-from-article', 6, '', 'Remove tag from article', 1),
|
||||
(37, 'delete-tag', 6, '', 'Delete Tag', 1),
|
||||
(38, 'clear-tag-trash', 6, '', 'Clear Tag trash', 1),
|
||||
(39, 'add-to-the-menu-system-and-check-tags-»-compact-list-of-tagged-i', 6, '', 'Add to the menu system and check Tags » Compact List of Tagged Items', 1),
|
||||
(40, 'add-to-the-menu-system-and-check-tags-»-list-all-tags', 6, '', 'Add to the menu system and check Tags » List All Tags', 1),
|
||||
(41, 'add-to-the-menu-system-and-check-tags-»-tagged-items', 6, '', 'Add to the menu system and check Tags » Tagged Items', 1),
|
||||
(42, 'media-manager-back-end-changing-legal-extensions,-legal-image-ex', 7, '', 'Media Manager Back-end - Changing Legal Extensions, Legal Image Extensions, and Legal MIME Types', 1),
|
||||
(43, 'media-manager-back-end-uploading-image', 7, '', 'Media Manager Back-end - Uploading image', 1),
|
||||
(44, 'media-manager-back-end-deleting-image', 7, '', 'Media Manager Back-end - Deleting image', 1),
|
||||
(45, 'media-manager-back-end-uploading-video', 7, '', 'Media Manager Back-end - Uploading video', 1),
|
||||
(46, 'media-manager-back-end-deleting-video', 7, '', 'Media Manager Back-end - Deleting video', 1),
|
||||
(47, 'media-manager-back-end-create-folder', 7, '', 'Media Manager Back-end - Create Folder', 1),
|
||||
(48, 'media-manager-back-end-delete-folder', 7, '', 'Media Manager Back-end - Delete Folder', 1),
|
||||
(49, 'drag-n-drop-adding-new-image-in-tiny-mce-specify-folder-in-plugi', 7, '', 'Drag\'n\'Drop adding new image in Tiny MCE (specify folder in plugin)', 1),
|
||||
(50, 'install-a-component-via-browse-for-file', 1, '', 'Install a component via \"Browse for File\"', 1),
|
||||
(51, 'install-a-component-via-drag-n-drop', 1, '', 'Install a component via Drag\'n\'Drop', 1),
|
||||
(52, 'update-component', 1, '', 'Update component', 1),
|
||||
(53, 'uninstall-a-component', 1, '', 'Uninstall a component', 1),
|
||||
(54, 'install-a-plugin', 9, '', 'Install a plugin', 1),
|
||||
(55, 'turn-on-plugin', 9, '', 'Turn on plugin', 1),
|
||||
(56, 'update-plugin', 9, '', 'Update plugin', 1),
|
||||
(57, 'turn-off-plugin', 9, '', 'Turn off plugin', 1),
|
||||
(58, 'uninstall-a-plugin', 9, '', 'Uninstall a plugin', 1),
|
||||
(59, 'install-module', 10, '', 'Install module', 1),
|
||||
(60, 'assign-module-to-module-position', 10, '', 'Assign module to module position', 1),
|
||||
(61, 'create-new-module-position', 10, '', 'Create new module position', 1),
|
||||
(62, 'remove-module-from-module-position', 10, '', 'Remove module from module position', 1),
|
||||
(63, 'delete-module', 10, '', 'Delete Module', 1),
|
||||
(64, 'clear-module-trash', 10, '', 'Clear Module trash', 1),
|
||||
(65, 'install-a-template', 11, '', 'Install a template', 1),
|
||||
(66, 'turn-on-template', 11, '', 'Turn on template', 1),
|
||||
(67, 'remove-template', 11, '', 'Remove template', 1),
|
||||
(68, 'install-language-package', 12, '', 'Install Language Package', 1),
|
||||
(69, 'uninstall-language-package', 12, '', 'Uninstall Language Package', 1),
|
||||
(70, 'language-associations', 12, '', 'Language associations', 1),
|
||||
(71, 'global-configuration-change-site-name', 13, '', 'Global Configuration: Change Site Name', 1),
|
||||
(72, 'global-configuration-set-site-to-offline', 13, '', 'Global Configuration: Set site to Offline', 1),
|
||||
(73, 'global-configuration-set-site-online', 13, '', 'Global Configuration: Set site Online', 1),
|
||||
(74, 'global-configuration-configure-mail-settings,-and-send-test-mail', 13, '', 'Global Configuration: Configure Mail Settings, and send test mail', 1),
|
||||
(75, 'install-new-editor-program', 14, '', 'Install new Editor program', 1),
|
||||
(76, 'global-configuration-change-default-editor', 14, '', 'Global Configuration: Change Default Editor', 1),
|
||||
(77, 'clear-cache', 15, '', 'Clear Cache', 1),
|
||||
(78, 'clear-expire-cache', 15, '', 'Clear Expire Cache', 1),
|
||||
(79, 'switch-on-statistics-gathering', 16, '', 'Switch on statistics gathering', 1),
|
||||
(80, 'add-to-menu', 16, '', 'Add to menu', 1),
|
||||
(81, 'switch-off-statistics-gathering', 16, '', 'Switch off statistics gathering', 1),
|
||||
(82, 'switch-on-content-smart-search-plugin', 17, '', 'Switch on Content Smart search plugin', 1),
|
||||
(83, 'index-content', 17, '', 'Index content', 1),
|
||||
(84, 'check-search-is-working-on-the-front', 17, '', 'Check search is working on the front', 1),
|
||||
(85, 'switch-off-content-smart-search-plugin', 17, '', 'Switch off Content Smart search plugin', 1),
|
||||
(86, 'switch-on-redirect-plugin', 18, '', 'Switch on Redirect Plugin', 1),
|
||||
(87, 'create-a-url-to-redirect', 18, '', 'create a url to redirect', 1),
|
||||
(88, 'add-a-redirect-rule,-test-it-redir', 18, '', ' Add a redirect rule, test it redir', 1),
|
||||
(89, 'test-the-redirect', 18, '', 'Test the redirect', 1),
|
||||
(90, 'turn-redirect-off', 18, '', 'Turn redirect off', 1),
|
||||
(91, 'test-it-no-longer-works', 18, '', 'Test it no longer works', 1),
|
||||
(92, 'check-if-user-activities-are-logged', 21, '', 'Check if user activities are logged', 1),
|
||||
(93, 'live-update-with-custom-url-for-rc', 34, '', 'Live Update (with custom URL for RC)', 1),
|
||||
(94, 'upload-update-with-zip-package', 34, '', 'Upload & Update (with ZIP package)', 1),
|
||||
--
|
||||
-- Dumping data for table `#__release_checking_action`
|
||||
--
|
||||
|
||||
INSERT INTO `#__release_checking_action` (`id`, `alias`, `context`, `description`, `name`, `published`) VALUES
|
||||
(1, 'installing-joomla', 1, '', 'Installing Joomla', 1),
|
||||
(2, 'adding-new-user-backend', 2, '', 'Adding new user (Backend)', 1),
|
||||
(3, 'amending-user-details', 2, '', 'Amending user details', 1),
|
||||
(4, 'amending-user-access-privileges', 2, '', 'Amending user access privileges', 1),
|
||||
(5, 'deleting-user', 2, '', 'Deleting user', 1),
|
||||
(6, 'creating-new-user-group', 2, '', 'Creating new User Group', 1),
|
||||
(7, 'configuring-viewing-access-levels-for-new-user-group', 2, '', 'Configuring Viewing Access Levels for new User Group', 1),
|
||||
(8, 'deleting-user-group', 2, '', 'Deleting User Group', 1),
|
||||
(9, 'email-notifications', 2, '', 'Email notifications', 1),
|
||||
(10, 'creating-new-menu', 3, '', 'Creating new Menu', 1),
|
||||
(11, 'linking-module-to-new-menu', 3, '', 'Linking Module to new Menu', 1),
|
||||
(12, 'create-new-menu-item', 3, '', 'Create new Menu Item', 1),
|
||||
(13, 'deleting-menu-item', 3, '', 'Deleting Menu Item', 1),
|
||||
(14, 'deleting-menu', 3, '', 'Deleting Menu', 1),
|
||||
(15, 'empty-menu-trash', 3, '', 'Empty Menu Trash', 1),
|
||||
(16, 'create-new-category', 4, '', 'Create new Category', 1),
|
||||
(17, 'create-new-article', 4, '', 'Create new Article', 1),
|
||||
(18, 'assign-category-to-article', 4, '', 'Assign category to article', 1),
|
||||
(19, 'toggle-featured-status-on-article', 4, '', 'Toggle Featured status on article', 1),
|
||||
(20, 'delete-category', 4, '', 'Delete category', 1),
|
||||
(21, 'clear-category-trash', 4, '', 'Clear Category Trash', 1),
|
||||
(22, 'delete-article', 4, '', 'Delete article', 1),
|
||||
(23, 'clear-article-trash', 4, '', 'Clear Article Trash', 1),
|
||||
(24, 'archive-article', 4, '', 'Archive Article', 1),
|
||||
(25, 'un-archive-article', 4, '', 'Un-Archive Article', 1),
|
||||
(26, 'check-versioning', 4, '', 'Check Versioning', 1),
|
||||
(27, 'create-field-group', 5, '', 'Create Field Group', 1),
|
||||
(28, 'create-field', 5, '', 'Create Field', 1),
|
||||
(29, 'fill-in-field-in-an-article', 5, '', 'Fill-in field in an article', 1),
|
||||
(30, 'delete-field', 5, '', 'Delete Field', 1),
|
||||
(31, 'clear-field-trash', 5, '', 'Clear Field Trash', 1),
|
||||
(32, 'delete-field-group', 5, '', 'Delete Field Group', 1),
|
||||
(33, 'clear-field-group-trash', 5, '', 'Clear Field Group Trash', 1),
|
||||
(34, 'create-new-tag', 6, '', 'Create new Tag', 1),
|
||||
(35, 'assign-tag-to-article', 6, '', 'Assign tag to article', 1),
|
||||
(36, 'remove-tag-from-article', 6, '', 'Remove tag from article', 1),
|
||||
(37, 'delete-tag', 6, '', 'Delete Tag', 1),
|
||||
(38, 'clear-tag-trash', 6, '', 'Clear Tag trash', 1),
|
||||
(39, 'add-to-the-menu-system-and-check-tags-»-compact-list-of-tagged-i', 6, '', 'Add to the menu system and check Tags » Compact List of Tagged Items', 1),
|
||||
(40, 'add-to-the-menu-system-and-check-tags-»-list-all-tags', 6, '', 'Add to the menu system and check Tags » List All Tags', 1),
|
||||
(41, 'add-to-the-menu-system-and-check-tags-»-tagged-items', 6, '', 'Add to the menu system and check Tags » Tagged Items', 1),
|
||||
(42, 'media-manager-back-end-changing-legal-extensions,-legal-image-ex', 7, '', 'Media Manager Back-end - Changing Legal Extensions, Legal Image Extensions, and Legal MIME Types', 1),
|
||||
(43, 'media-manager-back-end-uploading-image', 7, '', 'Media Manager Back-end - Uploading image', 1),
|
||||
(44, 'media-manager-back-end-deleting-image', 7, '', 'Media Manager Back-end - Deleting image', 1),
|
||||
(45, 'media-manager-back-end-uploading-video', 7, '', 'Media Manager Back-end - Uploading video', 1),
|
||||
(46, 'media-manager-back-end-deleting-video', 7, '', 'Media Manager Back-end - Deleting video', 1),
|
||||
(47, 'media-manager-back-end-create-folder', 7, '', 'Media Manager Back-end - Create Folder', 1),
|
||||
(48, 'media-manager-back-end-delete-folder', 7, '', 'Media Manager Back-end - Delete Folder', 1),
|
||||
(49, 'drag-n-drop-adding-new-image-in-tiny-mce-specify-folder-in-plugi', 7, '', 'Drag\'n\'Drop adding new image in Tiny MCE (specify folder in plugin)', 1),
|
||||
(50, 'install-a-component-via-browse-for-file', 1, '', 'Install a component via \"Browse for File\"', 1),
|
||||
(51, 'install-a-component-via-drag-n-drop', 1, '', 'Install a component via Drag\'n\'Drop', 1),
|
||||
(52, 'update-component', 1, '', 'Update component', 1),
|
||||
(53, 'uninstall-a-component', 1, '', 'Uninstall a component', 1),
|
||||
(54, 'install-a-plugin', 9, '', 'Install a plugin', 1),
|
||||
(55, 'turn-on-plugin', 9, '', 'Turn on plugin', 1),
|
||||
(56, 'update-plugin', 9, '', 'Update plugin', 1),
|
||||
(57, 'turn-off-plugin', 9, '', 'Turn off plugin', 1),
|
||||
(58, 'uninstall-a-plugin', 9, '', 'Uninstall a plugin', 1),
|
||||
(59, 'install-module', 10, '', 'Install module', 1),
|
||||
(60, 'assign-module-to-module-position', 10, '', 'Assign module to module position', 1),
|
||||
(61, 'create-new-module-position', 10, '', 'Create new module position', 1),
|
||||
(62, 'remove-module-from-module-position', 10, '', 'Remove module from module position', 1),
|
||||
(63, 'delete-module', 10, '', 'Delete Module', 1),
|
||||
(64, 'clear-module-trash', 10, '', 'Clear Module trash', 1),
|
||||
(65, 'install-a-template', 11, '', 'Install a template', 1),
|
||||
(66, 'turn-on-template', 11, '', 'Turn on template', 1),
|
||||
(67, 'remove-template', 11, '', 'Remove template', 1),
|
||||
(68, 'install-language-package', 12, '', 'Install Language Package', 1),
|
||||
(69, 'uninstall-language-package', 12, '', 'Uninstall Language Package', 1),
|
||||
(70, 'language-associations', 12, '', 'Language associations', 1),
|
||||
(71, 'global-configuration-change-site-name', 13, '', 'Global Configuration: Change Site Name', 1),
|
||||
(72, 'global-configuration-set-site-to-offline', 13, '', 'Global Configuration: Set site to Offline', 1),
|
||||
(73, 'global-configuration-set-site-online', 13, '', 'Global Configuration: Set site Online', 1),
|
||||
(74, 'global-configuration-configure-mail-settings,-and-send-test-mail', 13, '', 'Global Configuration: Configure Mail Settings, and send test mail', 1),
|
||||
(75, 'install-new-editor-program', 14, '', 'Install new Editor program', 1),
|
||||
(76, 'global-configuration-change-default-editor', 14, '', 'Global Configuration: Change Default Editor', 1),
|
||||
(77, 'clear-cache', 15, '', 'Clear Cache', 1),
|
||||
(78, 'clear-expire-cache', 15, '', 'Clear Expire Cache', 1),
|
||||
(79, 'switch-on-statistics-gathering', 16, '', 'Switch on statistics gathering', 1),
|
||||
(80, 'add-to-menu', 16, '', 'Add to menu', 1),
|
||||
(81, 'switch-off-statistics-gathering', 16, '', 'Switch off statistics gathering', 1),
|
||||
(82, 'switch-on-content-smart-search-plugin', 17, '', 'Switch on Content Smart search plugin', 1),
|
||||
(83, 'index-content', 17, '', 'Index content', 1),
|
||||
(84, 'check-search-is-working-on-the-front', 17, '', 'Check search is working on the front', 1),
|
||||
(85, 'switch-off-content-smart-search-plugin', 17, '', 'Switch off Content Smart search plugin', 1),
|
||||
(86, 'switch-on-redirect-plugin', 18, '', 'Switch on Redirect Plugin', 1),
|
||||
(87, 'create-a-url-to-redirect', 18, '', 'create a url to redirect', 1),
|
||||
(88, 'add-a-redirect-rule,-test-it-redir', 18, '', ' Add a redirect rule, test it redir', 1),
|
||||
(89, 'test-the-redirect', 18, '', 'Test the redirect', 1),
|
||||
(90, 'turn-redirect-off', 18, '', 'Turn redirect off', 1),
|
||||
(91, 'test-it-no-longer-works', 18, '', 'Test it no longer works', 1),
|
||||
(92, 'check-if-user-activities-are-logged', 21, '', 'Check if user activities are logged', 1),
|
||||
(93, 'live-update-with-custom-url-for-rc', 34, '', 'Live Update (with custom URL for RC)', 1),
|
||||
(94, 'upload-update-with-zip-package', 34, '', 'Upload & Update (with ZIP package)', 1),
|
||||
(95, 'make-sure-google-recaptcha-still-works', 35, '', 'Make sure Google recaptcha still works', 1);
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Always insure this column rules is large enough for all the access control values.
|
||||
--
|
||||
ALTER TABLE `#__assets` CHANGE `rules` `rules` MEDIUMTEXT NOT NULL COMMENT 'JSON encoded access control.';
|
||||
|
||||
--
|
||||
-- Always insure this column name is large enough for long component and view names.
|
||||
--
|
||||
ALTER TABLE `#__assets` CHANGE `name` `name` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The unique name for the asset.';
|
||||
|
|
|
@ -2,3 +2,4 @@ DROP TABLE IF EXISTS `#__release_checking_release_check`;
|
|||
DROP TABLE IF EXISTS `#__release_checking_joomla_version`;
|
||||
DROP TABLE IF EXISTS `#__release_checking_context`;
|
||||
DROP TABLE IF EXISTS `#__release_checking_action`;
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
|
||||
|
||||
|
|
|
@ -1,311 +1,313 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Actions Table class
|
||||
*/
|
||||
class Release_checkingTableAction extends JTable
|
||||
{
|
||||
/**
|
||||
* Ensure the params and metadata in json encoded in the bind method
|
||||
*
|
||||
* @var array
|
||||
* @since 3.3
|
||||
*/
|
||||
protected $_jsonEncode = array('params', 'metadata');
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Database connector object
|
||||
*/
|
||||
function __construct(&$db)
|
||||
{
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Table\Table;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Actions Table class
|
||||
*/
|
||||
class Release_checkingTableAction extends Table
|
||||
{
|
||||
/**
|
||||
* Ensure the params and metadata in json encoded in the bind method
|
||||
*
|
||||
* @var array
|
||||
* @since 3.3
|
||||
*/
|
||||
protected $_jsonEncode = array('params', 'metadata');
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Database connector object
|
||||
*/
|
||||
function __construct(&$db)
|
||||
{
|
||||
parent::__construct('#__release_checking_action', 'id', $db);
|
||||
|
||||
// Adding History Options
|
||||
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_release_checking.action'));
|
||||
}
|
||||
|
||||
public function bind($array, $ignore = '')
|
||||
{
|
||||
|
||||
if (isset($array['params']) && is_array($array['params']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['params']);
|
||||
$array['params'] = (string) $registry;
|
||||
}
|
||||
|
||||
if (isset($array['metadata']) && is_array($array['metadata']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['metadata']);
|
||||
$array['metadata'] = (string) $registry;
|
||||
}
|
||||
|
||||
// Bind the rules.
|
||||
if (isset($array['rules']) && is_array($array['rules']))
|
||||
{
|
||||
$rules = new JAccessRules($array['rules']);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload the store method for the Action table.
|
||||
*
|
||||
* @param boolean Toggle whether null values should be updated.
|
||||
* @return boolean True on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function store($updateNulls = false)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
// Existing item
|
||||
$this->modified = $date->toSql();
|
||||
$this->modified_by = $user->get('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
// New action. A action created and created_by field can be set by the user,
|
||||
// so we don't touch either of these if they are set.
|
||||
if (!(int) $this->created)
|
||||
{
|
||||
$this->created = $date->toSql();
|
||||
}
|
||||
if (empty($this->created_by))
|
||||
{
|
||||
$this->created_by = $user->get('id');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Verify that the alias is unique
|
||||
$table = JTable::getInstance('action', 'Release_checkingTable');
|
||||
|
||||
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->setError(JText::_('COM_RELEASE_CHECKING_ACTION_ERROR_UNIQUE_ALIAS'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->url))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->url = JStringPunycode::urlToPunycode($this->url);
|
||||
}
|
||||
if (isset($this->website))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->website = JStringPunycode::urlToPunycode($this->website);
|
||||
}
|
||||
|
||||
return parent::store($updateNulls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded check method to ensure data integrity.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Generate a valid alias
|
||||
$this->generateAlias();
|
||||
|
||||
$table = JTable::getInstance('action', 'release_checkingTable');
|
||||
|
||||
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->alias = StringHelper::increment($this->alias, 'dash');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up keywords -- eliminate extra spaces between phrases
|
||||
* and cr (\r) and lf (\n) characters from string.
|
||||
* Only process if not empty.
|
||||
*/
|
||||
if (!empty($this->metakey))
|
||||
{
|
||||
// Array of characters to remove.
|
||||
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||
|
||||
// Remove bad characters.
|
||||
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
|
||||
|
||||
// Create array using commas as delimiter.
|
||||
$keys = explode(',', $after_clean);
|
||||
$clean_keys = array();
|
||||
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
// Ignore blank keywords.
|
||||
if (trim($key))
|
||||
{
|
||||
$clean_keys[] = trim($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Put array back together delimited by ", "
|
||||
$this->metakey = implode(", ", $clean_keys);
|
||||
}
|
||||
|
||||
// Clean up description -- eliminate quotes and <> brackets
|
||||
if (!empty($this->metadesc))
|
||||
{
|
||||
// Only process if not empty
|
||||
$bad_characters = array("\"", "<", ">");
|
||||
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
|
||||
}
|
||||
|
||||
// If we don't have any access rules set at this point just use an empty JAccessRules class
|
||||
if (!$this->getRules())
|
||||
{
|
||||
$rules = $this->getDefaultAssetValues('com_release_checking.action.'.$this->id);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
|
||||
// Set ordering
|
||||
if ($this->published < 0)
|
||||
{
|
||||
// Set ordering to 0 if state is archived or trashed
|
||||
$this->ordering = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default asset values for a component.
|
||||
*
|
||||
* @param $string $component The component asset name to search for
|
||||
*
|
||||
* @return JAccessRules The JAccessRules object for the asset
|
||||
*/
|
||||
protected function getDefaultAssetValues($component, $try = true)
|
||||
{
|
||||
// Need to find the asset id by the name of the component.
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__assets'))
|
||||
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->loadRowList())
|
||||
{
|
||||
// asset already set so use saved rules
|
||||
$assetId = (int) $db->loadResult();
|
||||
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
|
||||
}
|
||||
// try again
|
||||
elseif ($try)
|
||||
{
|
||||
$try = explode('.',$component);
|
||||
$result = $this->getDefaultAssetValues($try[0], false);
|
||||
if ($result instanceof JAccessRules)
|
||||
{
|
||||
if (isset($try[1]))
|
||||
{
|
||||
$_result = (string) $result;
|
||||
$_result = json_decode($_result);
|
||||
foreach ($_result as $name => &$rule)
|
||||
{
|
||||
$v = explode('.', $name);
|
||||
if ($try[1] !== $v[0])
|
||||
{
|
||||
// remove since it is not part of this view
|
||||
unset($_result->$name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the value since we inherit
|
||||
$rule = array();
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count( (array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
// Instantiate and return the JAccessRules object for the asset rules.
|
||||
$rules = new JAccessRules;
|
||||
$rules->mergeCollection($_result);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return JAccess::getAssetRules(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to compute the default name of the asset.
|
||||
* The default name is in the form 'table_name.id'
|
||||
* where id is the value of the primary key of the table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetName()
|
||||
{
|
||||
$k = $this->_tbl_key;
|
||||
return 'com_release_checking.action.'.(int) $this->$k;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to return the title to use for the asset table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetTitle()
|
||||
{
|
||||
if (isset($this->title))
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent asset id for the record
|
||||
*
|
||||
* @return int
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
|
||||
{
|
||||
$asset = JTable::getInstance('Asset');
|
||||
$asset->loadByName('com_release_checking');
|
||||
|
||||
return $asset->id;
|
||||
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_release_checking.action'));
|
||||
}
|
||||
|
||||
public function bind($array, $ignore = '')
|
||||
{
|
||||
|
||||
if (isset($array['params']) && is_array($array['params']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['params']);
|
||||
$array['params'] = (string) $registry;
|
||||
}
|
||||
|
||||
if (isset($array['metadata']) && is_array($array['metadata']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['metadata']);
|
||||
$array['metadata'] = (string) $registry;
|
||||
}
|
||||
|
||||
// Bind the rules.
|
||||
if (isset($array['rules']) && is_array($array['rules']))
|
||||
{
|
||||
$rules = new JAccessRules($array['rules']);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload the store method for the Action table.
|
||||
*
|
||||
* @param boolean Toggle whether null values should be updated.
|
||||
* @return boolean True on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function store($updateNulls = false)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
// Existing item
|
||||
$this->modified = $date->toSql();
|
||||
$this->modified_by = $user->get('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
// New action. A action created and created_by field can be set by the user,
|
||||
// so we don't touch either of these if they are set.
|
||||
if (!(int) $this->created)
|
||||
{
|
||||
$this->created = $date->toSql();
|
||||
}
|
||||
if (empty($this->created_by))
|
||||
{
|
||||
$this->created_by = $user->get('id');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Verify that the alias is unique
|
||||
$table = JTable::getInstance('action', 'Release_checkingTable');
|
||||
|
||||
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->setError(JText::_('COM_RELEASE_CHECKING_ACTION_ERROR_UNIQUE_ALIAS'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->url))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->url = JStringPunycode::urlToPunycode($this->url);
|
||||
}
|
||||
if (isset($this->website))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->website = JStringPunycode::urlToPunycode($this->website);
|
||||
}
|
||||
|
||||
return parent::store($updateNulls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded check method to ensure data integrity.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Generate a valid alias
|
||||
$this->generateAlias();
|
||||
|
||||
$table = JTable::getInstance('action', 'release_checkingTable');
|
||||
|
||||
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->alias = StringHelper::increment($this->alias, 'dash');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up keywords -- eliminate extra spaces between phrases
|
||||
* and cr (\r) and lf (\n) characters from string.
|
||||
* Only process if not empty.
|
||||
*/
|
||||
if (!empty($this->metakey))
|
||||
{
|
||||
// Array of characters to remove.
|
||||
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||
|
||||
// Remove bad characters.
|
||||
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
|
||||
|
||||
// Create array using commas as delimiter.
|
||||
$keys = explode(',', $after_clean);
|
||||
$clean_keys = array();
|
||||
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
// Ignore blank keywords.
|
||||
if (trim($key))
|
||||
{
|
||||
$clean_keys[] = trim($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Put array back together delimited by ", "
|
||||
$this->metakey = implode(", ", $clean_keys);
|
||||
}
|
||||
|
||||
// Clean up description -- eliminate quotes and <> brackets
|
||||
if (!empty($this->metadesc))
|
||||
{
|
||||
// Only process if not empty
|
||||
$bad_characters = array("\"", "<", ">");
|
||||
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
|
||||
}
|
||||
|
||||
// If we don't have any access rules set at this point just use an empty JAccessRules class
|
||||
if (!$this->getRules())
|
||||
{
|
||||
$rules = $this->getDefaultAssetValues('com_release_checking.action.'.$this->id);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
|
||||
// Set ordering
|
||||
if ($this->published < 0)
|
||||
{
|
||||
// Set ordering to 0 if state is archived or trashed
|
||||
$this->ordering = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default asset values for a component.
|
||||
*
|
||||
* @param $string $component The component asset name to search for
|
||||
*
|
||||
* @return JAccessRules The JAccessRules object for the asset
|
||||
*/
|
||||
protected function getDefaultAssetValues($component, $try = true)
|
||||
{
|
||||
// Need to find the asset id by the name of the component.
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__assets'))
|
||||
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->loadRowList())
|
||||
{
|
||||
// asset already set so use saved rules
|
||||
$assetId = (int) $db->loadResult();
|
||||
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
|
||||
}
|
||||
// try again
|
||||
elseif ($try)
|
||||
{
|
||||
$try = explode('.',$component);
|
||||
$result = $this->getDefaultAssetValues($try[0], false);
|
||||
if ($result instanceof JAccessRules)
|
||||
{
|
||||
if (isset($try[1]))
|
||||
{
|
||||
$_result = (string) $result;
|
||||
$_result = json_decode($_result);
|
||||
foreach ($_result as $name => &$rule)
|
||||
{
|
||||
$v = explode('.', $name);
|
||||
if ($try[1] !== $v[0])
|
||||
{
|
||||
// remove since it is not part of this view
|
||||
unset($_result->$name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the value since we inherit
|
||||
$rule = array();
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count( (array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
// Instantiate and return the JAccessRules object for the asset rules.
|
||||
$rules = new JAccessRules;
|
||||
$rules->mergeCollection($_result);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return JAccess::getAssetRules(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to compute the default name of the asset.
|
||||
* The default name is in the form 'table_name.id'
|
||||
* where id is the value of the primary key of the table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetName()
|
||||
{
|
||||
$k = $this->_tbl_key;
|
||||
return 'com_release_checking.action.'.(int) $this->$k;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to return the title to use for the asset table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetTitle()
|
||||
{
|
||||
if (isset($this->title))
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent asset id for the record
|
||||
*
|
||||
* @return int
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
|
||||
{
|
||||
$asset = JTable::getInstance('Asset');
|
||||
$asset->loadByName('com_release_checking');
|
||||
|
||||
return $asset->id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -321,7 +323,7 @@ class Release_checkingTableAction extends JTable
|
|||
$this->alias = $this->name;
|
||||
}
|
||||
|
||||
$this->alias = JApplication::stringURLSafe($this->alias);
|
||||
$this->alias = JApplicationHelper::stringURLSafe($this->alias);
|
||||
|
||||
if (trim(str_replace('-', '', $this->alias)) == '')
|
||||
{
|
||||
|
@ -329,6 +331,6 @@ class Release_checkingTableAction extends JTable
|
|||
}
|
||||
|
||||
return $this->alias;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,311 +1,313 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Contexts Table class
|
||||
*/
|
||||
class Release_checkingTableContext extends JTable
|
||||
{
|
||||
/**
|
||||
* Ensure the params and metadata in json encoded in the bind method
|
||||
*
|
||||
* @var array
|
||||
* @since 3.3
|
||||
*/
|
||||
protected $_jsonEncode = array('params', 'metadata');
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Database connector object
|
||||
*/
|
||||
function __construct(&$db)
|
||||
{
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Table\Table;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Contexts Table class
|
||||
*/
|
||||
class Release_checkingTableContext extends Table
|
||||
{
|
||||
/**
|
||||
* Ensure the params and metadata in json encoded in the bind method
|
||||
*
|
||||
* @var array
|
||||
* @since 3.3
|
||||
*/
|
||||
protected $_jsonEncode = array('params', 'metadata');
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Database connector object
|
||||
*/
|
||||
function __construct(&$db)
|
||||
{
|
||||
parent::__construct('#__release_checking_context', 'id', $db);
|
||||
|
||||
// Adding History Options
|
||||
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_release_checking.context'));
|
||||
}
|
||||
|
||||
public function bind($array, $ignore = '')
|
||||
{
|
||||
|
||||
if (isset($array['params']) && is_array($array['params']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['params']);
|
||||
$array['params'] = (string) $registry;
|
||||
}
|
||||
|
||||
if (isset($array['metadata']) && is_array($array['metadata']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['metadata']);
|
||||
$array['metadata'] = (string) $registry;
|
||||
}
|
||||
|
||||
// Bind the rules.
|
||||
if (isset($array['rules']) && is_array($array['rules']))
|
||||
{
|
||||
$rules = new JAccessRules($array['rules']);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload the store method for the Context table.
|
||||
*
|
||||
* @param boolean Toggle whether null values should be updated.
|
||||
* @return boolean True on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function store($updateNulls = false)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
// Existing item
|
||||
$this->modified = $date->toSql();
|
||||
$this->modified_by = $user->get('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
// New context. A context created and created_by field can be set by the user,
|
||||
// so we don't touch either of these if they are set.
|
||||
if (!(int) $this->created)
|
||||
{
|
||||
$this->created = $date->toSql();
|
||||
}
|
||||
if (empty($this->created_by))
|
||||
{
|
||||
$this->created_by = $user->get('id');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Verify that the alias is unique
|
||||
$table = JTable::getInstance('context', 'Release_checkingTable');
|
||||
|
||||
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->setError(JText::_('COM_RELEASE_CHECKING_CONTEXT_ERROR_UNIQUE_ALIAS'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->url))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->url = JStringPunycode::urlToPunycode($this->url);
|
||||
}
|
||||
if (isset($this->website))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->website = JStringPunycode::urlToPunycode($this->website);
|
||||
}
|
||||
|
||||
return parent::store($updateNulls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded check method to ensure data integrity.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Generate a valid alias
|
||||
$this->generateAlias();
|
||||
|
||||
$table = JTable::getInstance('context', 'release_checkingTable');
|
||||
|
||||
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->alias = StringHelper::increment($this->alias, 'dash');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up keywords -- eliminate extra spaces between phrases
|
||||
* and cr (\r) and lf (\n) characters from string.
|
||||
* Only process if not empty.
|
||||
*/
|
||||
if (!empty($this->metakey))
|
||||
{
|
||||
// Array of characters to remove.
|
||||
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||
|
||||
// Remove bad characters.
|
||||
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
|
||||
|
||||
// Create array using commas as delimiter.
|
||||
$keys = explode(',', $after_clean);
|
||||
$clean_keys = array();
|
||||
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
// Ignore blank keywords.
|
||||
if (trim($key))
|
||||
{
|
||||
$clean_keys[] = trim($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Put array back together delimited by ", "
|
||||
$this->metakey = implode(", ", $clean_keys);
|
||||
}
|
||||
|
||||
// Clean up description -- eliminate quotes and <> brackets
|
||||
if (!empty($this->metadesc))
|
||||
{
|
||||
// Only process if not empty
|
||||
$bad_characters = array("\"", "<", ">");
|
||||
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
|
||||
}
|
||||
|
||||
// If we don't have any access rules set at this point just use an empty JAccessRules class
|
||||
if (!$this->getRules())
|
||||
{
|
||||
$rules = $this->getDefaultAssetValues('com_release_checking.context.'.$this->id);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
|
||||
// Set ordering
|
||||
if ($this->published < 0)
|
||||
{
|
||||
// Set ordering to 0 if state is archived or trashed
|
||||
$this->ordering = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default asset values for a component.
|
||||
*
|
||||
* @param $string $component The component asset name to search for
|
||||
*
|
||||
* @return JAccessRules The JAccessRules object for the asset
|
||||
*/
|
||||
protected function getDefaultAssetValues($component, $try = true)
|
||||
{
|
||||
// Need to find the asset id by the name of the component.
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__assets'))
|
||||
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->loadRowList())
|
||||
{
|
||||
// asset already set so use saved rules
|
||||
$assetId = (int) $db->loadResult();
|
||||
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
|
||||
}
|
||||
// try again
|
||||
elseif ($try)
|
||||
{
|
||||
$try = explode('.',$component);
|
||||
$result = $this->getDefaultAssetValues($try[0], false);
|
||||
if ($result instanceof JAccessRules)
|
||||
{
|
||||
if (isset($try[1]))
|
||||
{
|
||||
$_result = (string) $result;
|
||||
$_result = json_decode($_result);
|
||||
foreach ($_result as $name => &$rule)
|
||||
{
|
||||
$v = explode('.', $name);
|
||||
if ($try[1] !== $v[0])
|
||||
{
|
||||
// remove since it is not part of this view
|
||||
unset($_result->$name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the value since we inherit
|
||||
$rule = array();
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count( (array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
// Instantiate and return the JAccessRules object for the asset rules.
|
||||
$rules = new JAccessRules;
|
||||
$rules->mergeCollection($_result);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return JAccess::getAssetRules(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to compute the default name of the asset.
|
||||
* The default name is in the form 'table_name.id'
|
||||
* where id is the value of the primary key of the table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetName()
|
||||
{
|
||||
$k = $this->_tbl_key;
|
||||
return 'com_release_checking.context.'.(int) $this->$k;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to return the title to use for the asset table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetTitle()
|
||||
{
|
||||
if (isset($this->title))
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent asset id for the record
|
||||
*
|
||||
* @return int
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
|
||||
{
|
||||
$asset = JTable::getInstance('Asset');
|
||||
$asset->loadByName('com_release_checking');
|
||||
|
||||
return $asset->id;
|
||||
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_release_checking.context'));
|
||||
}
|
||||
|
||||
public function bind($array, $ignore = '')
|
||||
{
|
||||
|
||||
if (isset($array['params']) && is_array($array['params']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['params']);
|
||||
$array['params'] = (string) $registry;
|
||||
}
|
||||
|
||||
if (isset($array['metadata']) && is_array($array['metadata']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['metadata']);
|
||||
$array['metadata'] = (string) $registry;
|
||||
}
|
||||
|
||||
// Bind the rules.
|
||||
if (isset($array['rules']) && is_array($array['rules']))
|
||||
{
|
||||
$rules = new JAccessRules($array['rules']);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload the store method for the Context table.
|
||||
*
|
||||
* @param boolean Toggle whether null values should be updated.
|
||||
* @return boolean True on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function store($updateNulls = false)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
// Existing item
|
||||
$this->modified = $date->toSql();
|
||||
$this->modified_by = $user->get('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
// New context. A context created and created_by field can be set by the user,
|
||||
// so we don't touch either of these if they are set.
|
||||
if (!(int) $this->created)
|
||||
{
|
||||
$this->created = $date->toSql();
|
||||
}
|
||||
if (empty($this->created_by))
|
||||
{
|
||||
$this->created_by = $user->get('id');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Verify that the alias is unique
|
||||
$table = JTable::getInstance('context', 'Release_checkingTable');
|
||||
|
||||
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->setError(JText::_('COM_RELEASE_CHECKING_CONTEXT_ERROR_UNIQUE_ALIAS'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->url))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->url = JStringPunycode::urlToPunycode($this->url);
|
||||
}
|
||||
if (isset($this->website))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->website = JStringPunycode::urlToPunycode($this->website);
|
||||
}
|
||||
|
||||
return parent::store($updateNulls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded check method to ensure data integrity.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Generate a valid alias
|
||||
$this->generateAlias();
|
||||
|
||||
$table = JTable::getInstance('context', 'release_checkingTable');
|
||||
|
||||
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->alias = StringHelper::increment($this->alias, 'dash');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up keywords -- eliminate extra spaces between phrases
|
||||
* and cr (\r) and lf (\n) characters from string.
|
||||
* Only process if not empty.
|
||||
*/
|
||||
if (!empty($this->metakey))
|
||||
{
|
||||
// Array of characters to remove.
|
||||
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||
|
||||
// Remove bad characters.
|
||||
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
|
||||
|
||||
// Create array using commas as delimiter.
|
||||
$keys = explode(',', $after_clean);
|
||||
$clean_keys = array();
|
||||
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
// Ignore blank keywords.
|
||||
if (trim($key))
|
||||
{
|
||||
$clean_keys[] = trim($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Put array back together delimited by ", "
|
||||
$this->metakey = implode(", ", $clean_keys);
|
||||
}
|
||||
|
||||
// Clean up description -- eliminate quotes and <> brackets
|
||||
if (!empty($this->metadesc))
|
||||
{
|
||||
// Only process if not empty
|
||||
$bad_characters = array("\"", "<", ">");
|
||||
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
|
||||
}
|
||||
|
||||
// If we don't have any access rules set at this point just use an empty JAccessRules class
|
||||
if (!$this->getRules())
|
||||
{
|
||||
$rules = $this->getDefaultAssetValues('com_release_checking.context.'.$this->id);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
|
||||
// Set ordering
|
||||
if ($this->published < 0)
|
||||
{
|
||||
// Set ordering to 0 if state is archived or trashed
|
||||
$this->ordering = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default asset values for a component.
|
||||
*
|
||||
* @param $string $component The component asset name to search for
|
||||
*
|
||||
* @return JAccessRules The JAccessRules object for the asset
|
||||
*/
|
||||
protected function getDefaultAssetValues($component, $try = true)
|
||||
{
|
||||
// Need to find the asset id by the name of the component.
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__assets'))
|
||||
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->loadRowList())
|
||||
{
|
||||
// asset already set so use saved rules
|
||||
$assetId = (int) $db->loadResult();
|
||||
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
|
||||
}
|
||||
// try again
|
||||
elseif ($try)
|
||||
{
|
||||
$try = explode('.',$component);
|
||||
$result = $this->getDefaultAssetValues($try[0], false);
|
||||
if ($result instanceof JAccessRules)
|
||||
{
|
||||
if (isset($try[1]))
|
||||
{
|
||||
$_result = (string) $result;
|
||||
$_result = json_decode($_result);
|
||||
foreach ($_result as $name => &$rule)
|
||||
{
|
||||
$v = explode('.', $name);
|
||||
if ($try[1] !== $v[0])
|
||||
{
|
||||
// remove since it is not part of this view
|
||||
unset($_result->$name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the value since we inherit
|
||||
$rule = array();
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count( (array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
// Instantiate and return the JAccessRules object for the asset rules.
|
||||
$rules = new JAccessRules;
|
||||
$rules->mergeCollection($_result);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return JAccess::getAssetRules(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to compute the default name of the asset.
|
||||
* The default name is in the form 'table_name.id'
|
||||
* where id is the value of the primary key of the table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetName()
|
||||
{
|
||||
$k = $this->_tbl_key;
|
||||
return 'com_release_checking.context.'.(int) $this->$k;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to return the title to use for the asset table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetTitle()
|
||||
{
|
||||
if (isset($this->title))
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent asset id for the record
|
||||
*
|
||||
* @return int
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
|
||||
{
|
||||
$asset = JTable::getInstance('Asset');
|
||||
$asset->loadByName('com_release_checking');
|
||||
|
||||
return $asset->id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -321,7 +323,7 @@ class Release_checkingTableContext extends JTable
|
|||
$this->alias = $this->name;
|
||||
}
|
||||
|
||||
$this->alias = JApplication::stringURLSafe($this->alias);
|
||||
$this->alias = JApplicationHelper::stringURLSafe($this->alias);
|
||||
|
||||
if (trim(str_replace('-', '', $this->alias)) == '')
|
||||
{
|
||||
|
@ -329,6 +331,6 @@ class Release_checkingTableContext extends JTable
|
|||
}
|
||||
|
||||
return $this->alias;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,311 +1,313 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Joomla_versions Table class
|
||||
*/
|
||||
class Release_checkingTableJoomla_version extends JTable
|
||||
{
|
||||
/**
|
||||
* Ensure the params and metadata in json encoded in the bind method
|
||||
*
|
||||
* @var array
|
||||
* @since 3.3
|
||||
*/
|
||||
protected $_jsonEncode = array('params', 'metadata');
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Database connector object
|
||||
*/
|
||||
function __construct(&$db)
|
||||
{
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Table\Table;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Joomla_versions Table class
|
||||
*/
|
||||
class Release_checkingTableJoomla_version extends Table
|
||||
{
|
||||
/**
|
||||
* Ensure the params and metadata in json encoded in the bind method
|
||||
*
|
||||
* @var array
|
||||
* @since 3.3
|
||||
*/
|
||||
protected $_jsonEncode = array('params', 'metadata');
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Database connector object
|
||||
*/
|
||||
function __construct(&$db)
|
||||
{
|
||||
parent::__construct('#__release_checking_joomla_version', 'id', $db);
|
||||
|
||||
// Adding History Options
|
||||
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_release_checking.joomla_version'));
|
||||
}
|
||||
|
||||
public function bind($array, $ignore = '')
|
||||
{
|
||||
|
||||
if (isset($array['params']) && is_array($array['params']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['params']);
|
||||
$array['params'] = (string) $registry;
|
||||
}
|
||||
|
||||
if (isset($array['metadata']) && is_array($array['metadata']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['metadata']);
|
||||
$array['metadata'] = (string) $registry;
|
||||
}
|
||||
|
||||
// Bind the rules.
|
||||
if (isset($array['rules']) && is_array($array['rules']))
|
||||
{
|
||||
$rules = new JAccessRules($array['rules']);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload the store method for the Joomla_version table.
|
||||
*
|
||||
* @param boolean Toggle whether null values should be updated.
|
||||
* @return boolean True on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function store($updateNulls = false)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
// Existing item
|
||||
$this->modified = $date->toSql();
|
||||
$this->modified_by = $user->get('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
// New joomla_version. A joomla_version created and created_by field can be set by the user,
|
||||
// so we don't touch either of these if they are set.
|
||||
if (!(int) $this->created)
|
||||
{
|
||||
$this->created = $date->toSql();
|
||||
}
|
||||
if (empty($this->created_by))
|
||||
{
|
||||
$this->created_by = $user->get('id');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Verify that the alias is unique
|
||||
$table = JTable::getInstance('joomla_version', 'Release_checkingTable');
|
||||
|
||||
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->setError(JText::_('COM_RELEASE_CHECKING_JOOMLA_VERSION_ERROR_UNIQUE_ALIAS'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->url))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->url = JStringPunycode::urlToPunycode($this->url);
|
||||
}
|
||||
if (isset($this->website))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->website = JStringPunycode::urlToPunycode($this->website);
|
||||
}
|
||||
|
||||
return parent::store($updateNulls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded check method to ensure data integrity.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Generate a valid alias
|
||||
$this->generateAlias();
|
||||
|
||||
$table = JTable::getInstance('joomla_version', 'release_checkingTable');
|
||||
|
||||
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->alias = StringHelper::increment($this->alias, 'dash');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up keywords -- eliminate extra spaces between phrases
|
||||
* and cr (\r) and lf (\n) characters from string.
|
||||
* Only process if not empty.
|
||||
*/
|
||||
if (!empty($this->metakey))
|
||||
{
|
||||
// Array of characters to remove.
|
||||
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||
|
||||
// Remove bad characters.
|
||||
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
|
||||
|
||||
// Create array using commas as delimiter.
|
||||
$keys = explode(',', $after_clean);
|
||||
$clean_keys = array();
|
||||
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
// Ignore blank keywords.
|
||||
if (trim($key))
|
||||
{
|
||||
$clean_keys[] = trim($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Put array back together delimited by ", "
|
||||
$this->metakey = implode(", ", $clean_keys);
|
||||
}
|
||||
|
||||
// Clean up description -- eliminate quotes and <> brackets
|
||||
if (!empty($this->metadesc))
|
||||
{
|
||||
// Only process if not empty
|
||||
$bad_characters = array("\"", "<", ">");
|
||||
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
|
||||
}
|
||||
|
||||
// If we don't have any access rules set at this point just use an empty JAccessRules class
|
||||
if (!$this->getRules())
|
||||
{
|
||||
$rules = $this->getDefaultAssetValues('com_release_checking.joomla_version.'.$this->id);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
|
||||
// Set ordering
|
||||
if ($this->published < 0)
|
||||
{
|
||||
// Set ordering to 0 if state is archived or trashed
|
||||
$this->ordering = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default asset values for a component.
|
||||
*
|
||||
* @param $string $component The component asset name to search for
|
||||
*
|
||||
* @return JAccessRules The JAccessRules object for the asset
|
||||
*/
|
||||
protected function getDefaultAssetValues($component, $try = true)
|
||||
{
|
||||
// Need to find the asset id by the name of the component.
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__assets'))
|
||||
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->loadRowList())
|
||||
{
|
||||
// asset already set so use saved rules
|
||||
$assetId = (int) $db->loadResult();
|
||||
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
|
||||
}
|
||||
// try again
|
||||
elseif ($try)
|
||||
{
|
||||
$try = explode('.',$component);
|
||||
$result = $this->getDefaultAssetValues($try[0], false);
|
||||
if ($result instanceof JAccessRules)
|
||||
{
|
||||
if (isset($try[1]))
|
||||
{
|
||||
$_result = (string) $result;
|
||||
$_result = json_decode($_result);
|
||||
foreach ($_result as $name => &$rule)
|
||||
{
|
||||
$v = explode('.', $name);
|
||||
if ($try[1] !== $v[0])
|
||||
{
|
||||
// remove since it is not part of this view
|
||||
unset($_result->$name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the value since we inherit
|
||||
$rule = array();
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count( (array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
// Instantiate and return the JAccessRules object for the asset rules.
|
||||
$rules = new JAccessRules;
|
||||
$rules->mergeCollection($_result);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return JAccess::getAssetRules(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to compute the default name of the asset.
|
||||
* The default name is in the form 'table_name.id'
|
||||
* where id is the value of the primary key of the table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetName()
|
||||
{
|
||||
$k = $this->_tbl_key;
|
||||
return 'com_release_checking.joomla_version.'.(int) $this->$k;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to return the title to use for the asset table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetTitle()
|
||||
{
|
||||
if (isset($this->title))
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent asset id for the record
|
||||
*
|
||||
* @return int
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
|
||||
{
|
||||
$asset = JTable::getInstance('Asset');
|
||||
$asset->loadByName('com_release_checking');
|
||||
|
||||
return $asset->id;
|
||||
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_release_checking.joomla_version'));
|
||||
}
|
||||
|
||||
public function bind($array, $ignore = '')
|
||||
{
|
||||
|
||||
if (isset($array['params']) && is_array($array['params']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['params']);
|
||||
$array['params'] = (string) $registry;
|
||||
}
|
||||
|
||||
if (isset($array['metadata']) && is_array($array['metadata']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['metadata']);
|
||||
$array['metadata'] = (string) $registry;
|
||||
}
|
||||
|
||||
// Bind the rules.
|
||||
if (isset($array['rules']) && is_array($array['rules']))
|
||||
{
|
||||
$rules = new JAccessRules($array['rules']);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload the store method for the Joomla_version table.
|
||||
*
|
||||
* @param boolean Toggle whether null values should be updated.
|
||||
* @return boolean True on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function store($updateNulls = false)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
// Existing item
|
||||
$this->modified = $date->toSql();
|
||||
$this->modified_by = $user->get('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
// New joomla_version. A joomla_version created and created_by field can be set by the user,
|
||||
// so we don't touch either of these if they are set.
|
||||
if (!(int) $this->created)
|
||||
{
|
||||
$this->created = $date->toSql();
|
||||
}
|
||||
if (empty($this->created_by))
|
||||
{
|
||||
$this->created_by = $user->get('id');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Verify that the alias is unique
|
||||
$table = JTable::getInstance('joomla_version', 'Release_checkingTable');
|
||||
|
||||
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->setError(JText::_('COM_RELEASE_CHECKING_JOOMLA_VERSION_ERROR_UNIQUE_ALIAS'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->url))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->url = JStringPunycode::urlToPunycode($this->url);
|
||||
}
|
||||
if (isset($this->website))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->website = JStringPunycode::urlToPunycode($this->website);
|
||||
}
|
||||
|
||||
return parent::store($updateNulls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded check method to ensure data integrity.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Generate a valid alias
|
||||
$this->generateAlias();
|
||||
|
||||
$table = JTable::getInstance('joomla_version', 'release_checkingTable');
|
||||
|
||||
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->alias = StringHelper::increment($this->alias, 'dash');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up keywords -- eliminate extra spaces between phrases
|
||||
* and cr (\r) and lf (\n) characters from string.
|
||||
* Only process if not empty.
|
||||
*/
|
||||
if (!empty($this->metakey))
|
||||
{
|
||||
// Array of characters to remove.
|
||||
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||
|
||||
// Remove bad characters.
|
||||
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
|
||||
|
||||
// Create array using commas as delimiter.
|
||||
$keys = explode(',', $after_clean);
|
||||
$clean_keys = array();
|
||||
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
// Ignore blank keywords.
|
||||
if (trim($key))
|
||||
{
|
||||
$clean_keys[] = trim($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Put array back together delimited by ", "
|
||||
$this->metakey = implode(", ", $clean_keys);
|
||||
}
|
||||
|
||||
// Clean up description -- eliminate quotes and <> brackets
|
||||
if (!empty($this->metadesc))
|
||||
{
|
||||
// Only process if not empty
|
||||
$bad_characters = array("\"", "<", ">");
|
||||
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
|
||||
}
|
||||
|
||||
// If we don't have any access rules set at this point just use an empty JAccessRules class
|
||||
if (!$this->getRules())
|
||||
{
|
||||
$rules = $this->getDefaultAssetValues('com_release_checking.joomla_version.'.$this->id);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
|
||||
// Set ordering
|
||||
if ($this->published < 0)
|
||||
{
|
||||
// Set ordering to 0 if state is archived or trashed
|
||||
$this->ordering = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default asset values for a component.
|
||||
*
|
||||
* @param $string $component The component asset name to search for
|
||||
*
|
||||
* @return JAccessRules The JAccessRules object for the asset
|
||||
*/
|
||||
protected function getDefaultAssetValues($component, $try = true)
|
||||
{
|
||||
// Need to find the asset id by the name of the component.
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__assets'))
|
||||
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->loadRowList())
|
||||
{
|
||||
// asset already set so use saved rules
|
||||
$assetId = (int) $db->loadResult();
|
||||
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
|
||||
}
|
||||
// try again
|
||||
elseif ($try)
|
||||
{
|
||||
$try = explode('.',$component);
|
||||
$result = $this->getDefaultAssetValues($try[0], false);
|
||||
if ($result instanceof JAccessRules)
|
||||
{
|
||||
if (isset($try[1]))
|
||||
{
|
||||
$_result = (string) $result;
|
||||
$_result = json_decode($_result);
|
||||
foreach ($_result as $name => &$rule)
|
||||
{
|
||||
$v = explode('.', $name);
|
||||
if ($try[1] !== $v[0])
|
||||
{
|
||||
// remove since it is not part of this view
|
||||
unset($_result->$name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the value since we inherit
|
||||
$rule = array();
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count( (array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
// Instantiate and return the JAccessRules object for the asset rules.
|
||||
$rules = new JAccessRules;
|
||||
$rules->mergeCollection($_result);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return JAccess::getAssetRules(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to compute the default name of the asset.
|
||||
* The default name is in the form 'table_name.id'
|
||||
* where id is the value of the primary key of the table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetName()
|
||||
{
|
||||
$k = $this->_tbl_key;
|
||||
return 'com_release_checking.joomla_version.'.(int) $this->$k;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to return the title to use for the asset table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetTitle()
|
||||
{
|
||||
if (isset($this->title))
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent asset id for the record
|
||||
*
|
||||
* @return int
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
|
||||
{
|
||||
$asset = JTable::getInstance('Asset');
|
||||
$asset->loadByName('com_release_checking');
|
||||
|
||||
return $asset->id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -321,7 +323,7 @@ class Release_checkingTableJoomla_version extends JTable
|
|||
$this->alias = $this->name;
|
||||
}
|
||||
|
||||
$this->alias = JApplication::stringURLSafe($this->alias);
|
||||
$this->alias = JApplicationHelper::stringURLSafe($this->alias);
|
||||
|
||||
if (trim(str_replace('-', '', $this->alias)) == '')
|
||||
{
|
||||
|
@ -329,6 +331,6 @@ class Release_checkingTableJoomla_version extends JTable
|
|||
}
|
||||
|
||||
return $this->alias;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,311 +1,313 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checks Table class
|
||||
*/
|
||||
class Release_checkingTableRelease_check extends JTable
|
||||
{
|
||||
/**
|
||||
* Ensure the params and metadata in json encoded in the bind method
|
||||
*
|
||||
* @var array
|
||||
* @since 3.3
|
||||
*/
|
||||
protected $_jsonEncode = array('params', 'metadata');
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Database connector object
|
||||
*/
|
||||
function __construct(&$db)
|
||||
{
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Table\Table;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Release_checks Table class
|
||||
*/
|
||||
class Release_checkingTableRelease_check extends Table
|
||||
{
|
||||
/**
|
||||
* Ensure the params and metadata in json encoded in the bind method
|
||||
*
|
||||
* @var array
|
||||
* @since 3.3
|
||||
*/
|
||||
protected $_jsonEncode = array('params', 'metadata');
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Database connector object
|
||||
*/
|
||||
function __construct(&$db)
|
||||
{
|
||||
parent::__construct('#__release_checking_release_check', 'id', $db);
|
||||
|
||||
// Adding History Options
|
||||
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_release_checking.release_check'));
|
||||
}
|
||||
|
||||
public function bind($array, $ignore = '')
|
||||
{
|
||||
|
||||
if (isset($array['params']) && is_array($array['params']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['params']);
|
||||
$array['params'] = (string) $registry;
|
||||
}
|
||||
|
||||
if (isset($array['metadata']) && is_array($array['metadata']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['metadata']);
|
||||
$array['metadata'] = (string) $registry;
|
||||
}
|
||||
|
||||
// Bind the rules.
|
||||
if (isset($array['rules']) && is_array($array['rules']))
|
||||
{
|
||||
$rules = new JAccessRules($array['rules']);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload the store method for the Release_check table.
|
||||
*
|
||||
* @param boolean Toggle whether null values should be updated.
|
||||
* @return boolean True on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function store($updateNulls = false)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
// Existing item
|
||||
$this->modified = $date->toSql();
|
||||
$this->modified_by = $user->get('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
// New release_check. A release_check created and created_by field can be set by the user,
|
||||
// so we don't touch either of these if they are set.
|
||||
if (!(int) $this->created)
|
||||
{
|
||||
$this->created = $date->toSql();
|
||||
}
|
||||
if (empty($this->created_by))
|
||||
{
|
||||
$this->created_by = $user->get('id');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Verify that the alias is unique
|
||||
$table = JTable::getInstance('release_check', 'Release_checkingTable');
|
||||
|
||||
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->setError(JText::_('COM_RELEASE_CHECKING_RELEASE_CHECK_ERROR_UNIQUE_ALIAS'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->url))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->url = JStringPunycode::urlToPunycode($this->url);
|
||||
}
|
||||
if (isset($this->website))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->website = JStringPunycode::urlToPunycode($this->website);
|
||||
}
|
||||
|
||||
return parent::store($updateNulls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded check method to ensure data integrity.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Generate a valid alias
|
||||
$this->generateAlias();
|
||||
|
||||
$table = JTable::getInstance('release_check', 'release_checkingTable');
|
||||
|
||||
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->alias = StringHelper::increment($this->alias, 'dash');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up keywords -- eliminate extra spaces between phrases
|
||||
* and cr (\r) and lf (\n) characters from string.
|
||||
* Only process if not empty.
|
||||
*/
|
||||
if (!empty($this->metakey))
|
||||
{
|
||||
// Array of characters to remove.
|
||||
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||
|
||||
// Remove bad characters.
|
||||
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
|
||||
|
||||
// Create array using commas as delimiter.
|
||||
$keys = explode(',', $after_clean);
|
||||
$clean_keys = array();
|
||||
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
// Ignore blank keywords.
|
||||
if (trim($key))
|
||||
{
|
||||
$clean_keys[] = trim($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Put array back together delimited by ", "
|
||||
$this->metakey = implode(", ", $clean_keys);
|
||||
}
|
||||
|
||||
// Clean up description -- eliminate quotes and <> brackets
|
||||
if (!empty($this->metadesc))
|
||||
{
|
||||
// Only process if not empty
|
||||
$bad_characters = array("\"", "<", ">");
|
||||
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
|
||||
}
|
||||
|
||||
// If we don't have any access rules set at this point just use an empty JAccessRules class
|
||||
if (!$this->getRules())
|
||||
{
|
||||
$rules = $this->getDefaultAssetValues('com_release_checking.release_check.'.$this->id);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
|
||||
// Set ordering
|
||||
if ($this->published < 0)
|
||||
{
|
||||
// Set ordering to 0 if state is archived or trashed
|
||||
$this->ordering = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default asset values for a component.
|
||||
*
|
||||
* @param $string $component The component asset name to search for
|
||||
*
|
||||
* @return JAccessRules The JAccessRules object for the asset
|
||||
*/
|
||||
protected function getDefaultAssetValues($component, $try = true)
|
||||
{
|
||||
// Need to find the asset id by the name of the component.
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__assets'))
|
||||
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->loadRowList())
|
||||
{
|
||||
// asset already set so use saved rules
|
||||
$assetId = (int) $db->loadResult();
|
||||
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
|
||||
}
|
||||
// try again
|
||||
elseif ($try)
|
||||
{
|
||||
$try = explode('.',$component);
|
||||
$result = $this->getDefaultAssetValues($try[0], false);
|
||||
if ($result instanceof JAccessRules)
|
||||
{
|
||||
if (isset($try[1]))
|
||||
{
|
||||
$_result = (string) $result;
|
||||
$_result = json_decode($_result);
|
||||
foreach ($_result as $name => &$rule)
|
||||
{
|
||||
$v = explode('.', $name);
|
||||
if ($try[1] !== $v[0])
|
||||
{
|
||||
// remove since it is not part of this view
|
||||
unset($_result->$name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the value since we inherit
|
||||
$rule = array();
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count( (array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
// Instantiate and return the JAccessRules object for the asset rules.
|
||||
$rules = new JAccessRules;
|
||||
$rules->mergeCollection($_result);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return JAccess::getAssetRules(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to compute the default name of the asset.
|
||||
* The default name is in the form 'table_name.id'
|
||||
* where id is the value of the primary key of the table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetName()
|
||||
{
|
||||
$k = $this->_tbl_key;
|
||||
return 'com_release_checking.release_check.'.(int) $this->$k;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to return the title to use for the asset table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetTitle()
|
||||
{
|
||||
if (isset($this->title))
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent asset id for the record
|
||||
*
|
||||
* @return int
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
|
||||
{
|
||||
$asset = JTable::getInstance('Asset');
|
||||
$asset->loadByName('com_release_checking');
|
||||
|
||||
return $asset->id;
|
||||
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_release_checking.release_check'));
|
||||
}
|
||||
|
||||
public function bind($array, $ignore = '')
|
||||
{
|
||||
|
||||
if (isset($array['params']) && is_array($array['params']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['params']);
|
||||
$array['params'] = (string) $registry;
|
||||
}
|
||||
|
||||
if (isset($array['metadata']) && is_array($array['metadata']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['metadata']);
|
||||
$array['metadata'] = (string) $registry;
|
||||
}
|
||||
|
||||
// Bind the rules.
|
||||
if (isset($array['rules']) && is_array($array['rules']))
|
||||
{
|
||||
$rules = new JAccessRules($array['rules']);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload the store method for the Release_check table.
|
||||
*
|
||||
* @param boolean Toggle whether null values should be updated.
|
||||
* @return boolean True on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function store($updateNulls = false)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
// Existing item
|
||||
$this->modified = $date->toSql();
|
||||
$this->modified_by = $user->get('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
// New release_check. A release_check created and created_by field can be set by the user,
|
||||
// so we don't touch either of these if they are set.
|
||||
if (!(int) $this->created)
|
||||
{
|
||||
$this->created = $date->toSql();
|
||||
}
|
||||
if (empty($this->created_by))
|
||||
{
|
||||
$this->created_by = $user->get('id');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Verify that the alias is unique
|
||||
$table = JTable::getInstance('release_check', 'Release_checkingTable');
|
||||
|
||||
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->setError(JText::_('COM_RELEASE_CHECKING_RELEASE_CHECK_ERROR_UNIQUE_ALIAS'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->url))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->url = JStringPunycode::urlToPunycode($this->url);
|
||||
}
|
||||
if (isset($this->website))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->website = JStringPunycode::urlToPunycode($this->website);
|
||||
}
|
||||
|
||||
return parent::store($updateNulls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded check method to ensure data integrity.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Generate a valid alias
|
||||
$this->generateAlias();
|
||||
|
||||
$table = JTable::getInstance('release_check', 'release_checkingTable');
|
||||
|
||||
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->alias = StringHelper::increment($this->alias, 'dash');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up keywords -- eliminate extra spaces between phrases
|
||||
* and cr (\r) and lf (\n) characters from string.
|
||||
* Only process if not empty.
|
||||
*/
|
||||
if (!empty($this->metakey))
|
||||
{
|
||||
// Array of characters to remove.
|
||||
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||
|
||||
// Remove bad characters.
|
||||
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
|
||||
|
||||
// Create array using commas as delimiter.
|
||||
$keys = explode(',', $after_clean);
|
||||
$clean_keys = array();
|
||||
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
// Ignore blank keywords.
|
||||
if (trim($key))
|
||||
{
|
||||
$clean_keys[] = trim($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Put array back together delimited by ", "
|
||||
$this->metakey = implode(", ", $clean_keys);
|
||||
}
|
||||
|
||||
// Clean up description -- eliminate quotes and <> brackets
|
||||
if (!empty($this->metadesc))
|
||||
{
|
||||
// Only process if not empty
|
||||
$bad_characters = array("\"", "<", ">");
|
||||
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
|
||||
}
|
||||
|
||||
// If we don't have any access rules set at this point just use an empty JAccessRules class
|
||||
if (!$this->getRules())
|
||||
{
|
||||
$rules = $this->getDefaultAssetValues('com_release_checking.release_check.'.$this->id);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
|
||||
// Set ordering
|
||||
if ($this->published < 0)
|
||||
{
|
||||
// Set ordering to 0 if state is archived or trashed
|
||||
$this->ordering = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default asset values for a component.
|
||||
*
|
||||
* @param $string $component The component asset name to search for
|
||||
*
|
||||
* @return JAccessRules The JAccessRules object for the asset
|
||||
*/
|
||||
protected function getDefaultAssetValues($component, $try = true)
|
||||
{
|
||||
// Need to find the asset id by the name of the component.
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__assets'))
|
||||
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->loadRowList())
|
||||
{
|
||||
// asset already set so use saved rules
|
||||
$assetId = (int) $db->loadResult();
|
||||
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
|
||||
}
|
||||
// try again
|
||||
elseif ($try)
|
||||
{
|
||||
$try = explode('.',$component);
|
||||
$result = $this->getDefaultAssetValues($try[0], false);
|
||||
if ($result instanceof JAccessRules)
|
||||
{
|
||||
if (isset($try[1]))
|
||||
{
|
||||
$_result = (string) $result;
|
||||
$_result = json_decode($_result);
|
||||
foreach ($_result as $name => &$rule)
|
||||
{
|
||||
$v = explode('.', $name);
|
||||
if ($try[1] !== $v[0])
|
||||
{
|
||||
// remove since it is not part of this view
|
||||
unset($_result->$name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the value since we inherit
|
||||
$rule = array();
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count( (array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
// Instantiate and return the JAccessRules object for the asset rules.
|
||||
$rules = new JAccessRules;
|
||||
$rules->mergeCollection($_result);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return JAccess::getAssetRules(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to compute the default name of the asset.
|
||||
* The default name is in the form 'table_name.id'
|
||||
* where id is the value of the primary key of the table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetName()
|
||||
{
|
||||
$k = $this->_tbl_key;
|
||||
return 'com_release_checking.release_check.'.(int) $this->$k;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to return the title to use for the asset table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetTitle()
|
||||
{
|
||||
if (isset($this->title))
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent asset id for the record
|
||||
*
|
||||
* @return int
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
|
||||
{
|
||||
$asset = JTable::getInstance('Asset');
|
||||
$asset->loadByName('com_release_checking');
|
||||
|
||||
return $asset->id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -316,6 +318,6 @@ class Release_checkingTableRelease_check extends JTable
|
|||
public function generateAlias()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
Joomla.submitbutton = function(task)
|
||||
{
|
||||
if (task == ''){
|
||||
return false;
|
||||
} else {
|
||||
var action = task.split('.');
|
||||
if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){
|
||||
Joomla.submitform(task, document.getElementById("adminForm"));
|
||||
return true;
|
||||
} else {
|
||||
alert(Joomla.JText._('action, some values are not acceptable.','Some values are unacceptable'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
Joomla.submitbutton = function(task)
|
||||
{
|
||||
if (task == ''){
|
||||
return false;
|
||||
} else {
|
||||
var action = task.split('.');
|
||||
if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){
|
||||
Joomla.submitform(task, document.getElementById("adminForm"));
|
||||
return true;
|
||||
} else {
|
||||
alert(Joomla.JText._('action, some values are not acceptable.','Some values are unacceptable'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,22 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
JHtml::_('behavior.tooltip');
|
||||
JHtml::_('behavior.formvalidation');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
JHtml::_('behavior.keepalive');
|
||||
$componentParams = $this->params; // will be removed just use $this->params instead
|
||||
?>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
JHtml::_('behavior.formvalidator');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
JHtml::_('behavior.keepalive');
|
||||
$componentParams = $this->params; // will be removed just use $this->params instead
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
// waiting spinner
|
||||
var outerDiv = jQuery('body');
|
||||
|
@ -39,8 +39,8 @@ $componentParams = $this->params; // will be removed just use $this->params inst
|
|||
jQuery('#loading').hide();
|
||||
});
|
||||
</script>
|
||||
<div id="release_checking_loader" style="display: none;">
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_release_checking&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
<div id="release_checking_loader" style="display: none;">
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_release_checking&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
|
||||
<?php echo JLayoutHelper::render('action.details_above', $this); ?>
|
||||
<div class="form-horizontal">
|
||||
|
@ -102,6 +102,6 @@ $componentParams = $this->params; // will be removed just use $this->params inst
|
|||
<input type="hidden" name="task" value="action.edit" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -1,81 +1,84 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* Action View class
|
||||
*/
|
||||
class Release_checkingViewAction extends JViewLegacy
|
||||
{
|
||||
/**
|
||||
* display method of View
|
||||
* @return void
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// set params
|
||||
$this->params = JComponentHelper::getParams('com_release_checking');
|
||||
// Assign the variables
|
||||
$this->form = $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->script = $this->get('Script');
|
||||
$this->state = $this->get('State');
|
||||
// get action permissions
|
||||
$this->canDo = Release_checkingHelper::getActions('action', $this->item);
|
||||
// get input
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$this->ref = $jinput->get('ref', 0, 'word');
|
||||
$this->refid = $jinput->get('refid', 0, 'int');
|
||||
$return = $jinput->get('return', null, 'base64');
|
||||
// set the referral string
|
||||
$this->referral = '';
|
||||
if ($this->refid && $this->ref)
|
||||
{
|
||||
// return to the item that referred to this item
|
||||
$this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
|
||||
}
|
||||
elseif($this->ref)
|
||||
{
|
||||
// return to the list view that referred to this item
|
||||
$this->referral = '&ref=' . (string)$this->ref;
|
||||
}
|
||||
// check return value
|
||||
if (!is_null($return))
|
||||
{
|
||||
// add the return value
|
||||
$this->referral .= '&return=' . (string)$return;
|
||||
}
|
||||
|
||||
// Set the toolbar
|
||||
$this->addToolBar();
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
|
||||
// Set the document
|
||||
$this->setDocument();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
*/
|
||||
protected function addToolBar()
|
||||
{
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\View\HtmlView;
|
||||
|
||||
/**
|
||||
* Action Html View class
|
||||
*/
|
||||
class Release_checkingViewAction extends HtmlView
|
||||
{
|
||||
/**
|
||||
* display method of View
|
||||
* @return void
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// set params
|
||||
$this->params = JComponentHelper::getParams('com_release_checking');
|
||||
// Assign the variables
|
||||
$this->form = $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->script = $this->get('Script');
|
||||
$this->state = $this->get('State');
|
||||
// get action permissions
|
||||
$this->canDo = Release_checkingHelper::getActions('action', $this->item);
|
||||
// get input
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$this->ref = $jinput->get('ref', 0, 'word');
|
||||
$this->refid = $jinput->get('refid', 0, 'int');
|
||||
$return = $jinput->get('return', null, 'base64');
|
||||
// set the referral string
|
||||
$this->referral = '';
|
||||
if ($this->refid && $this->ref)
|
||||
{
|
||||
// return to the item that referred to this item
|
||||
$this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
|
||||
}
|
||||
elseif($this->ref)
|
||||
{
|
||||
// return to the list view that referred to this item
|
||||
$this->referral = '&ref=' . (string)$this->ref;
|
||||
}
|
||||
// check return value
|
||||
if (!is_null($return))
|
||||
{
|
||||
// add the return value
|
||||
$this->referral .= '&return=' . (string)$return;
|
||||
}
|
||||
|
||||
// Set the toolbar
|
||||
$this->addToolBar();
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
|
||||
// Set the document
|
||||
$this->setDocument();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
*/
|
||||
protected function addToolBar()
|
||||
{
|
||||
JFactory::getApplication()->input->set('hidemainmenu', true);
|
||||
$user = JFactory::getUser();
|
||||
$userId = $user->id;
|
||||
|
@ -147,47 +150,47 @@ class Release_checkingViewAction extends JViewLegacy
|
|||
}
|
||||
JToolbarHelper::divider();
|
||||
// set help url for this view if found
|
||||
$help_url = Release_checkingHelper::getHelpUrl('action');
|
||||
if (Release_checkingHelper::checkString($help_url))
|
||||
$this->help_url = Release_checkingHelper::getHelpUrl('action');
|
||||
if (Release_checkingHelper::checkString($this->help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_RELEASE_CHECKING_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
*/
|
||||
public function escape($var)
|
||||
{
|
||||
if(strlen($var) > 30)
|
||||
{
|
||||
// use the helper htmlEscape method instead and shorten the string
|
||||
return Release_checkingHelper::htmlEscape($var, $this->_charset, true, 30);
|
||||
}
|
||||
// use the helper htmlEscape method instead.
|
||||
return Release_checkingHelper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set up the document properties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setDocument()
|
||||
{
|
||||
$isNew = ($this->item->id < 1);
|
||||
if (!isset($this->document))
|
||||
{
|
||||
$this->document = JFactory::getDocument();
|
||||
}
|
||||
$this->document->setTitle(JText::_($isNew ? 'COM_RELEASE_CHECKING_ACTION_NEW' : 'COM_RELEASE_CHECKING_ACTION_EDIT'));
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_release_checking/assets/css/action.css", (Release_checkingHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
$this->document->addScript(JURI::root() . $this->script, (Release_checkingHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
$this->document->addScript(JURI::root() . "administrator/components/com_release_checking/views/action/submitbutton.js", (Release_checkingHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
JText::script('view not acceptable. Error');
|
||||
}
|
||||
}
|
||||
JToolbarHelper::help('COM_RELEASE_CHECKING_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
*/
|
||||
public function escape($var)
|
||||
{
|
||||
if(strlen($var) > 30)
|
||||
{
|
||||
// use the helper htmlEscape method instead and shorten the string
|
||||
return Release_checkingHelper::htmlEscape($var, $this->_charset, true, 30);
|
||||
}
|
||||
// use the helper htmlEscape method instead.
|
||||
return Release_checkingHelper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set up the document properties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setDocument()
|
||||
{
|
||||
$isNew = ($this->item->id < 1);
|
||||
if (!isset($this->document))
|
||||
{
|
||||
$this->document = JFactory::getDocument();
|
||||
}
|
||||
$this->document->setTitle(JText::_($isNew ? 'COM_RELEASE_CHECKING_ACTION_NEW' : 'COM_RELEASE_CHECKING_ACTION_EDIT'));
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_release_checking/assets/css/action.css", (Release_checkingHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
$this->document->addScript(JURI::root() . $this->script, (Release_checkingHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
$this->document->addScript(JURI::root() . "administrator/components/com_release_checking/views/action/submitbutton.js", (Release_checkingHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
JText::script('view not acceptable. Error');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,83 +1,66 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// load tooltip behavior
|
||||
JHtml::_('behavior.tooltip');
|
||||
JHtml::_('behavior.multiselect');
|
||||
JHtml::_('dropdown.init');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
|
||||
if ($this->saveOrder)
|
||||
{
|
||||
$saveOrderingUrl = 'index.php?option=com_release_checking&task=actions.saveOrderAjax&tmpl=component';
|
||||
JHtml::_('sortablelist.sortable', 'actionList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
Joomla.orderTable = function()
|
||||
{
|
||||
table = document.getElementById("sortTable");
|
||||
direction = document.getElementById("directionTable");
|
||||
order = table.options[table.selectedIndex].value;
|
||||
if (order != '<?php echo $this->listOrder; ?>')
|
||||
{
|
||||
dirn = 'asc';
|
||||
}
|
||||
else
|
||||
{
|
||||
dirn = direction.options[direction.selectedIndex].value;
|
||||
}
|
||||
Joomla.tableOrdering(order, dirn, '');
|
||||
}
|
||||
</script>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_release_checking&view=actions'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if(!empty( $this->sidebar)): ?>
|
||||
<div id="j-sidebar-container" class="span2">
|
||||
<?php echo $this->sidebar; ?>
|
||||
</div>
|
||||
<div id="j-main-container" class="span10">
|
||||
<?php else : ?>
|
||||
<div id="j-main-container">
|
||||
<?php endif; ?>
|
||||
<?php if (empty($this->items)): ?>
|
||||
<?php echo $this->loadTemplate('toolbar');?>
|
||||
<div class="alert alert-no-items">
|
||||
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<?php echo $this->loadTemplate('toolbar');?>
|
||||
<table class="table table-striped" id="actionList">
|
||||
<thead><?php echo $this->loadTemplate('head');?></thead>
|
||||
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
|
||||
<tbody><?php echo $this->loadTemplate('body');?></tbody>
|
||||
</table>
|
||||
<?php //Load the batch processing form. ?>
|
||||
<?php if ($this->canCreate && $this->canEdit) : ?>
|
||||
<?php echo JHtml::_(
|
||||
'bootstrap.renderModal',
|
||||
'collapseModal',
|
||||
array(
|
||||
'title' => JText::_('COM_RELEASE_CHECKING_ACTIONS_BATCH_OPTIONS'),
|
||||
'footer' => $this->loadTemplate('batch_footer')
|
||||
),
|
||||
$this->loadTemplate('batch_body')
|
||||
); ?>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="filter_order" value="<?php echo $this->listOrder; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->listDirn; ?>" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHtml::_('behavior.multiselect');
|
||||
JHtml::_('dropdown.init');
|
||||
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_RELEASE_CHECKING_FILTER_SELECT_ACCESS') . ' -'));
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
if ($this->saveOrder)
|
||||
{
|
||||
$saveOrderingUrl = 'index.php?option=com_release_checking&task=actions.saveOrderAjax&tmpl=component';
|
||||
JHtml::_('sortablelist.sortable', 'actionList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
|
||||
}
|
||||
?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_release_checking&view=actions'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if(!empty( $this->sidebar)): ?>
|
||||
<div id="j-sidebar-container" class="span2">
|
||||
<?php echo $this->sidebar; ?>
|
||||
</div>
|
||||
<div id="j-main-container" class="span10">
|
||||
<?php else : ?>
|
||||
<div id="j-main-container">
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
// Add the trash helper layout
|
||||
echo JLayoutHelper::render('trashhelper', $this);
|
||||
// Add the searchtools
|
||||
echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
|
||||
?>
|
||||
<?php if (empty($this->items)): ?>
|
||||
<div class="alert alert-no-items">
|
||||
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<table class="table table-striped" id="actionList">
|
||||
<thead><?php echo $this->loadTemplate('head');?></thead>
|
||||
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
|
||||
<tbody><?php echo $this->loadTemplate('body');?></tbody>
|
||||
</table>
|
||||
<?php // Load the batch processing form. ?>
|
||||
<?php if ($this->canCreate && $this->canEdit) : ?>
|
||||
<?php echo JHtml::_(
|
||||
'bootstrap.renderModal',
|
||||
'collapseModal',
|
||||
array(
|
||||
'title' => JText::_('COM_RELEASE_CHECKING_ACTIONS_BATCH_OPTIONS'),
|
||||
'footer' => $this->loadTemplate('batch_footer')
|
||||
),
|
||||
$this->loadTemplate('batch_body')
|
||||
); ?>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
|
||||
<p><?php echo JText::_('COM_RELEASE_CHECKING_ACTIONS_BATCH_TIP'); ?></p>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
|
||||
<p><?php echo JText::_('COM_RELEASE_CHECKING_ACTIONS_BATCH_TIP'); ?></p>
|
||||
<?php echo $this->batchDisplay; ?>
|
|
@ -1,21 +1,22 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<!-- clear the batch values if cancel -->
|
||||
<button class="btn" type="button" onclick="" data-dismiss="modal">
|
||||
<?php echo JText::_('JCANCEL'); ?>
|
||||
</button>
|
||||
<!-- post the batch values if process -->
|
||||
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('action.batch');">
|
||||
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<!-- clear the batch values if cancel -->
|
||||
<button class="btn" type="button" onclick="" data-dismiss="modal">
|
||||
<?php echo JText::_('JCANCEL'); ?>
|
||||
</button>
|
||||
<!-- post the batch values if process -->
|
||||
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('action.batch');">
|
||||
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
|
||||
</button>
|
|
@ -1,18 +1,19 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$edit = "index.php?option=com_release_checking&view=actions&task=action.edit";
|
||||
|
||||
?>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$edit = "index.php?option=com_release_checking&view=actions&task=action.edit";
|
||||
|
||||
?>
|
||||
<?php foreach ($this->items as $i => $item): ?>
|
||||
<?php
|
||||
$canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0;
|
||||
|
@ -23,11 +24,8 @@ $edit = "index.php?option=com_release_checking&view=actions&task=action.edit";
|
|||
<td class="order nowrap center hidden-phone">
|
||||
<?php if ($canDo->get('core.edit.state')): ?>
|
||||
<?php
|
||||
if ($this->saveOrder)
|
||||
{
|
||||
$iconClass = ' inactive';
|
||||
}
|
||||
else
|
||||
$iconClass = '';
|
||||
if (!$this->saveOrder)
|
||||
{
|
||||
$iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
|
||||
}
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="7"><?php echo $this->pagination->getListFooter(); ?></td>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="7"><?php echo $this->pagination->getListFooter(); ?></td>
|
||||
</tr>
|
|
@ -1,20 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<?php if ($this->canEdit&& $this->canState): ?>
|
||||
<th width="1%" class="nowrap center hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?>
|
||||
<?php echo JHtml::_('searchtools.sort', '', 'a.ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
|
||||
</th>
|
||||
<th width="20" class="nowrap center">
|
||||
<?php echo JHtml::_('grid.checkall'); ?>
|
||||
|
@ -28,17 +29,17 @@ defined('_JEXEC') or die('Restricted access');
|
|||
</th>
|
||||
<?php endif; ?>
|
||||
<th class="nowrap" >
|
||||
<?php echo JHtml::_('grid.sort', 'COM_RELEASE_CHECKING_ACTION_NAME_LABEL', 'a.name', $this->listDirn, $this->listOrder); ?>
|
||||
<?php echo JHtml::_('searchtools.sort', 'COM_RELEASE_CHECKING_ACTION_NAME_LABEL', 'a.name', $this->listDirn, $this->listOrder); ?>
|
||||
</th>
|
||||
<th class="nowrap hidden-phone" >
|
||||
<?php echo JHtml::_('grid.sort', 'COM_RELEASE_CHECKING_ACTION_CONTEXT_LABEL', 'g.name', $this->listDirn, $this->listOrder); ?>
|
||||
<?php echo JHtml::_('searchtools.sort', 'COM_RELEASE_CHECKING_ACTION_CONTEXT_LABEL', 'g.name', $this->listDirn, $this->listOrder); ?>
|
||||
</th>
|
||||
<th class="nowrap hidden-phone" >
|
||||
<?php echo JText::_('COM_RELEASE_CHECKING_ACTION_DESCRIPTION_LABEL'); ?>
|
||||
</th>
|
||||
<?php if ($this->canState): ?>
|
||||
<th width="10" class="nowrap center" >
|
||||
<?php echo JHtml::_('grid.sort', 'COM_RELEASE_CHECKING_ACTION_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
|
||||
<?php echo JHtml::_('searchtools.sort', 'COM_RELEASE_CHECKING_ACTION_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
|
||||
</th>
|
||||
<?php else: ?>
|
||||
<th width="10" class="nowrap center" >
|
||||
|
@ -46,6 +47,6 @@ defined('_JEXEC') or die('Restricted access');
|
|||
</th>
|
||||
<?php endif; ?>
|
||||
<th width="5" class="nowrap center hidden-phone" >
|
||||
<?php echo JHtml::_('grid.sort', 'COM_RELEASE_CHECKING_ACTION_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
|
||||
<?php echo JHtml::_('searchtools.sort', 'COM_RELEASE_CHECKING_ACTION_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
|
||||
</th>
|
||||
</tr>
|
|
@ -1,43 +1,44 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<div id="filter-bar" class="btn-toolbar">
|
||||
<div class="filter-search btn-group pull-left">
|
||||
<label for="filter_search" class="element-invisible"><?php echo JText::_('Search');?></label>
|
||||
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('Search Actions'); ?>" />
|
||||
</div>
|
||||
<div class="btn-group pull-left">
|
||||
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
|
||||
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
|
||||
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
|
||||
<option value="asc" <?php if ($this->listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
|
||||
<option value="desc" <?php if ($this->listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="btn-group pull-right">
|
||||
<label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
|
||||
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
|
||||
<?php echo JHtml::_('select.options', $this->getSortFields(), 'value', 'text', $this->listOrder);?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<div id="filter-bar" class="btn-toolbar">
|
||||
<div class="filter-search btn-group pull-left">
|
||||
<label for="filter_search" class="element-invisible"><?php echo JText::_('Search');?></label>
|
||||
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('Search Actions'); ?>" />
|
||||
</div>
|
||||
<div class="btn-group pull-left">
|
||||
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
|
||||
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
|
||||
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
|
||||
<option value="asc" <?php if ($this->listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
|
||||
<option value="desc" <?php if ($this->listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="btn-group pull-right">
|
||||
<label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
|
||||
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
|
||||
<?php echo JHtml::_('select.options', $this->getSortFields(), 'value', 'text', $this->listOrder);?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"> </div>
|
|
@ -1,299 +1,251 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* Release_checking View class for the Actions
|
||||
*/
|
||||
class Release_checkingViewActions extends JViewLegacy
|
||||
{
|
||||
/**
|
||||
* Actions view display method
|
||||
* @return void
|
||||
*/
|
||||
function display($tpl = null)
|
||||
{
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
// Include helper submenu
|
||||
Release_checkingHelper::addSubmenu('actions');
|
||||
}
|
||||
|
||||
// Assign data to the view
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->state = $this->get('State');
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\View\HtmlView;
|
||||
|
||||
/**
|
||||
* Release_checking Html View class for the Actions
|
||||
*/
|
||||
class Release_checkingViewActions extends HtmlView
|
||||
{
|
||||
/**
|
||||
* Actions view display method
|
||||
* @return void
|
||||
*/
|
||||
function display($tpl = null)
|
||||
{
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
// Include helper submenu
|
||||
Release_checkingHelper::addSubmenu('actions');
|
||||
}
|
||||
|
||||
// Assign data to the view
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->state = $this->get('State');
|
||||
$this->user = JFactory::getUser();
|
||||
// Load the filter form from xml.
|
||||
$this->filterForm = $this->get('FilterForm');
|
||||
// Load the active filters.
|
||||
$this->activeFilters = $this->get('ActiveFilters');
|
||||
// Add the list ordering clause.
|
||||
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
|
||||
$this->listDirn = $this->escape($this->state->get('list.direction', 'desc'));
|
||||
$this->saveOrder = $this->listOrder == 'ordering';
|
||||
// set the return here value
|
||||
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
|
||||
// get global action permissions
|
||||
$this->listDirn = $this->escape($this->state->get('list.direction', 'desc'));
|
||||
$this->saveOrder = $this->listOrder == 'a.ordering';
|
||||
// set the return here value
|
||||
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
|
||||
// get global action permissions
|
||||
$this->canDo = Release_checkingHelper::getActions('action');
|
||||
$this->canEdit = $this->canDo->get('core.edit');
|
||||
$this->canState = $this->canDo->get('core.edit.state');
|
||||
$this->canCreate = $this->canDo->get('core.create');
|
||||
$this->canDelete = $this->canDo->get('core.delete');
|
||||
$this->canBatch = $this->canDo->get('core.batch');
|
||||
|
||||
// We don't need toolbar in the modal window.
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
$this->addToolbar();
|
||||
$this->sidebar = JHtmlSidebar::render();
|
||||
// load the batch html
|
||||
if ($this->canCreate && $this->canEdit && $this->canState)
|
||||
{
|
||||
$this->batchDisplay = JHtmlBatch_::render();
|
||||
}
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
|
||||
// Set the document
|
||||
$this->setDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
*/
|
||||
protected function addToolBar()
|
||||
{
|
||||
JToolBarHelper::title(JText::_('COM_RELEASE_CHECKING_ACTIONS'), 'joomla');
|
||||
JHtmlSidebar::setAction('index.php?option=com_release_checking&view=actions');
|
||||
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
|
||||
|
||||
if ($this->canCreate)
|
||||
{
|
||||
JToolBarHelper::addNew('action.add');
|
||||
}
|
||||
|
||||
// Only load if there are items
|
||||
if (Release_checkingHelper::checkArray($this->items))
|
||||
{
|
||||
if ($this->canEdit)
|
||||
{
|
||||
JToolBarHelper::editList('action.edit');
|
||||
}
|
||||
|
||||
if ($this->canState)
|
||||
{
|
||||
JToolBarHelper::publishList('actions.publish');
|
||||
JToolBarHelper::unpublishList('actions.unpublish');
|
||||
JToolBarHelper::archiveList('actions.archive');
|
||||
|
||||
if ($this->canDo->get('core.admin'))
|
||||
{
|
||||
JToolBarHelper::checkin('actions.checkin');
|
||||
}
|
||||
}
|
||||
|
||||
// Add a batch button
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
|
||||
{
|
||||
// Get the toolbar object instance
|
||||
$bar = JToolBar::getInstance('toolbar');
|
||||
// set the batch button name
|
||||
$title = JText::_('JTOOLBAR_BATCH');
|
||||
// Instantiate a new JLayoutFile instance and render the batch button
|
||||
$layout = new JLayoutFile('joomla.toolbar.batch');
|
||||
// add the button to the page
|
||||
$dhtml = $layout->render(array('title' => $title));
|
||||
$bar->appendButton('Custom', $dhtml, 'batch');
|
||||
}
|
||||
|
||||
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||
{
|
||||
JToolbarHelper::deleteList('', 'actions.delete', 'JTOOLBAR_EMPTY_TRASH');
|
||||
}
|
||||
elseif ($this->canState && $this->canDelete)
|
||||
{
|
||||
JToolbarHelper::trash('actions.trash');
|
||||
$this->canBatch = $this->canDo->get('core.batch');
|
||||
|
||||
// We don't need toolbar in the modal window.
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
$this->addToolbar();
|
||||
$this->sidebar = JHtmlSidebar::render();
|
||||
// load the batch html
|
||||
if ($this->canCreate && $this->canEdit && $this->canState)
|
||||
{
|
||||
$this->batchDisplay = JHtmlBatch_::render();
|
||||
}
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
|
||||
// Set the document
|
||||
$this->setDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
*/
|
||||
protected function addToolBar()
|
||||
{
|
||||
JToolBarHelper::title(JText::_('COM_RELEASE_CHECKING_ACTIONS'), 'joomla');
|
||||
JHtmlSidebar::setAction('index.php?option=com_release_checking&view=actions');
|
||||
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
|
||||
|
||||
if ($this->canCreate)
|
||||
{
|
||||
JToolBarHelper::addNew('action.add');
|
||||
}
|
||||
|
||||
// Only load if there are items
|
||||
if (Release_checkingHelper::checkArray($this->items))
|
||||
{
|
||||
if ($this->canEdit)
|
||||
{
|
||||
JToolBarHelper::editList('action.edit');
|
||||
}
|
||||
|
||||
if ($this->canState)
|
||||
{
|
||||
JToolBarHelper::publishList('actions.publish');
|
||||
JToolBarHelper::unpublishList('actions.unpublish');
|
||||
JToolBarHelper::archiveList('actions.archive');
|
||||
|
||||
if ($this->canDo->get('core.admin'))
|
||||
{
|
||||
JToolBarHelper::checkin('actions.checkin');
|
||||
}
|
||||
}
|
||||
|
||||
// Add a batch button
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
|
||||
{
|
||||
// Get the toolbar object instance
|
||||
$bar = JToolBar::getInstance('toolbar');
|
||||
// set the batch button name
|
||||
$title = JText::_('JTOOLBAR_BATCH');
|
||||
// Instantiate a new JLayoutFile instance and render the batch button
|
||||
$layout = new JLayoutFile('joomla.toolbar.batch');
|
||||
// add the button to the page
|
||||
$dhtml = $layout->render(array('title' => $title));
|
||||
$bar->appendButton('Custom', $dhtml, 'batch');
|
||||
}
|
||||
|
||||
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||
{
|
||||
JToolbarHelper::deleteList('', 'actions.delete', 'JTOOLBAR_EMPTY_TRASH');
|
||||
}
|
||||
elseif ($this->canState && $this->canDelete)
|
||||
{
|
||||
JToolbarHelper::trash('actions.trash');
|
||||
}
|
||||
|
||||
if ($this->canDo->get('core.export') && $this->canDo->get('action.export'))
|
||||
{
|
||||
JToolBarHelper::custom('actions.exportData', 'download', '', 'COM_RELEASE_CHECKING_EXPORT_DATA', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->canDo->get('core.import') && $this->canDo->get('action.import'))
|
||||
{
|
||||
JToolBarHelper::custom('actions.importData', 'upload', '', 'COM_RELEASE_CHECKING_IMPORT_DATA', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$help_url = Release_checkingHelper::getHelpUrl('actions');
|
||||
if (Release_checkingHelper::checkString($help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_RELEASE_CHECKING_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
JToolBarHelper::preferences('com_release_checking');
|
||||
}
|
||||
|
||||
if ($this->canState)
|
||||
{
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_PUBLISHED'),
|
||||
'filter_published',
|
||||
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
|
||||
);
|
||||
// only load if batch allowed
|
||||
if ($this->canBatch)
|
||||
{
|
||||
JHtmlBatch_::addListSelection(
|
||||
JText::_('COM_RELEASE_CHECKING_KEEP_ORIGINAL_STATE'),
|
||||
'batch[published]',
|
||||
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_ACCESS'),
|
||||
'filter_access',
|
||||
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
|
||||
);
|
||||
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit)
|
||||
{
|
||||
JHtmlBatch_::addListSelection(
|
||||
JText::_('COM_RELEASE_CHECKING_KEEP_ORIGINAL_ACCESS'),
|
||||
'batch[access]',
|
||||
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
|
||||
);
|
||||
}
|
||||
|
||||
// Set Name Selection
|
||||
$this->nameOptions = $this->getTheNameSelections();
|
||||
// We do some sanitation for Name filter
|
||||
if (Release_checkingHelper::checkArray($this->nameOptions) &&
|
||||
isset($this->nameOptions[0]->value) &&
|
||||
!Release_checkingHelper::checkString($this->nameOptions[0]->value))
|
||||
// set help url for this view if found
|
||||
$this->help_url = Release_checkingHelper::getHelpUrl('actions');
|
||||
if (Release_checkingHelper::checkString($this->help_url))
|
||||
{
|
||||
unset($this->nameOptions[0]);
|
||||
JToolbarHelper::help('COM_RELEASE_CHECKING_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
// Only load Name filter if it has values
|
||||
if (Release_checkingHelper::checkArray($this->nameOptions))
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
// Name Filter
|
||||
JHtmlSidebar::addFilter(
|
||||
'- Select '.JText::_('COM_RELEASE_CHECKING_ACTION_NAME_LABEL').' -',
|
||||
'filter_name',
|
||||
JHtml::_('select.options', $this->nameOptions, 'value', 'text', $this->state->get('filter.name'))
|
||||
JToolBarHelper::preferences('com_release_checking');
|
||||
}
|
||||
|
||||
// Only load published batch if state and batch is allowed
|
||||
if ($this->canState && $this->canBatch)
|
||||
{
|
||||
JHtmlBatch_::addListSelection(
|
||||
JText::_('COM_RELEASE_CHECKING_KEEP_ORIGINAL_STATE'),
|
||||
'batch[published]',
|
||||
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit)
|
||||
// Only load access batch if create, edit and batch is allowed
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit)
|
||||
{
|
||||
JHtmlBatch_::addListSelection(
|
||||
JText::_('COM_RELEASE_CHECKING_KEEP_ORIGINAL_ACCESS'),
|
||||
'batch[access]',
|
||||
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
|
||||
);
|
||||
}
|
||||
|
||||
// Only load Name batch if create, edit, and batch is allowed
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit)
|
||||
{
|
||||
// Set Name Selection
|
||||
$this->nameOptions = JFormHelper::loadFieldType('actionsfiltername')->options;
|
||||
// We do some sanitation for Name filter
|
||||
if (Release_checkingHelper::checkArray($this->nameOptions) &&
|
||||
isset($this->nameOptions[0]->value) &&
|
||||
!Release_checkingHelper::checkString($this->nameOptions[0]->value))
|
||||
{
|
||||
// Name Batch Selection
|
||||
JHtmlBatch_::addListSelection(
|
||||
'- Keep Original '.JText::_('COM_RELEASE_CHECKING_ACTION_NAME_LABEL').' -',
|
||||
'batch[name]',
|
||||
JHtml::_('select.options', $this->nameOptions, 'value', 'text')
|
||||
);
|
||||
unset($this->nameOptions[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set up the document properties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setDocument()
|
||||
{
|
||||
if (!isset($this->document))
|
||||
{
|
||||
$this->document = JFactory::getDocument();
|
||||
}
|
||||
$this->document->setTitle(JText::_('COM_RELEASE_CHECKING_ACTIONS'));
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_release_checking/assets/css/actions.css", (Release_checkingHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
*/
|
||||
public function escape($var)
|
||||
{
|
||||
if(strlen($var) > 50)
|
||||
{
|
||||
// use the helper htmlEscape method instead and shorten the string
|
||||
return Release_checkingHelper::htmlEscape($var, $this->_charset, true);
|
||||
}
|
||||
// use the helper htmlEscape method instead.
|
||||
return Release_checkingHelper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of fields the table can be sorted by
|
||||
*
|
||||
* @return array Array containing the field name to sort by as the key and display text as value
|
||||
*/
|
||||
protected function getSortFields()
|
||||
{
|
||||
// Name Batch Selection
|
||||
JHtmlBatch_::addListSelection(
|
||||
'- Keep Original '.JText::_('COM_RELEASE_CHECKING_ACTION_NAME_LABEL').' -',
|
||||
'batch[name]',
|
||||
JHtml::_('select.options', $this->nameOptions, 'value', 'text')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set up the document properties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setDocument()
|
||||
{
|
||||
if (!isset($this->document))
|
||||
{
|
||||
$this->document = JFactory::getDocument();
|
||||
}
|
||||
$this->document->setTitle(JText::_('COM_RELEASE_CHECKING_ACTIONS'));
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_release_checking/assets/css/actions.css", (Release_checkingHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
*/
|
||||
public function escape($var)
|
||||
{
|
||||
if(strlen($var) > 50)
|
||||
{
|
||||
// use the helper htmlEscape method instead and shorten the string
|
||||
return Release_checkingHelper::htmlEscape($var, $this->_charset, true);
|
||||
}
|
||||
// use the helper htmlEscape method instead.
|
||||
return Release_checkingHelper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of fields the table can be sorted by
|
||||
*
|
||||
* @return array Array containing the field name to sort by as the key and display text as value
|
||||
*/
|
||||
protected function getSortFields()
|
||||
{
|
||||
return array(
|
||||
'ordering' => JText::_('JGRID_HEADING_ORDERING'),
|
||||
'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
|
||||
'a.published' => JText::_('JSTATUS'),
|
||||
'a.name' => JText::_('COM_RELEASE_CHECKING_ACTION_NAME_LABEL'),
|
||||
'g.name' => JText::_('COM_RELEASE_CHECKING_ACTION_CONTEXT_LABEL'),
|
||||
'a.id' => JText::_('JGRID_HEADING_ID')
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
protected function getTheNameSelections()
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select the text.
|
||||
$query->select($db->quoteName('name'));
|
||||
$query->from($db->quoteName('#__release_checking_action'));
|
||||
$query->order($db->quoteName('name') . ' ASC');
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$db->setQuery($query);
|
||||
|
||||
$results = $db->loadColumn();
|
||||
|
||||
if ($results)
|
||||
{
|
||||
$results = array_unique($results);
|
||||
$_filter = array();
|
||||
foreach ($results as $name)
|
||||
{
|
||||
// Now add the name and its text to the options array
|
||||
$_filter[] = JHtml::_('select.option', $name, $name);
|
||||
}
|
||||
return $_filter;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
Joomla.submitbutton = function(task)
|
||||
{
|
||||
if (task == ''){
|
||||
return false;
|
||||
} else {
|
||||
var action = task.split('.');
|
||||
if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){
|
||||
Joomla.submitform(task, document.getElementById("adminForm"));
|
||||
return true;
|
||||
} else {
|
||||
alert(Joomla.JText._('context, some values are not acceptable.','Some values are unacceptable'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
Joomla.submitbutton = function(task)
|
||||
{
|
||||
if (task == ''){
|
||||
return false;
|
||||
} else {
|
||||
var action = task.split('.');
|
||||
if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){
|
||||
Joomla.submitform(task, document.getElementById("adminForm"));
|
||||
return true;
|
||||
} else {
|
||||
alert(Joomla.JText._('context, some values are not acceptable.','Some values are unacceptable'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,22 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
JHtml::_('behavior.tooltip');
|
||||
JHtml::_('behavior.formvalidation');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
JHtml::_('behavior.keepalive');
|
||||
$componentParams = $this->params; // will be removed just use $this->params instead
|
||||
?>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
JHtml::_('behavior.formvalidator');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
JHtml::_('behavior.keepalive');
|
||||
$componentParams = $this->params; // will be removed just use $this->params instead
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
// waiting spinner
|
||||
var outerDiv = jQuery('body');
|
||||
|
@ -39,8 +39,8 @@ $componentParams = $this->params; // will be removed just use $this->params inst
|
|||
jQuery('#loading').hide();
|
||||
});
|
||||
</script>
|
||||
<div id="release_checking_loader" style="display: none;">
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_release_checking&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
<div id="release_checking_loader" style="display: none;">
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_release_checking&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
|
||||
<div class="form-horizontal">
|
||||
|
||||
|
@ -99,6 +99,6 @@ $componentParams = $this->params; // will be removed just use $this->params inst
|
|||
<input type="hidden" name="task" value="context.edit" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -1,81 +1,84 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* Context View class
|
||||
*/
|
||||
class Release_checkingViewContext extends JViewLegacy
|
||||
{
|
||||
/**
|
||||
* display method of View
|
||||
* @return void
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// set params
|
||||
$this->params = JComponentHelper::getParams('com_release_checking');
|
||||
// Assign the variables
|
||||
$this->form = $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->script = $this->get('Script');
|
||||
$this->state = $this->get('State');
|
||||
// get action permissions
|
||||
$this->canDo = Release_checkingHelper::getActions('context', $this->item);
|
||||
// get input
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$this->ref = $jinput->get('ref', 0, 'word');
|
||||
$this->refid = $jinput->get('refid', 0, 'int');
|
||||
$return = $jinput->get('return', null, 'base64');
|
||||
// set the referral string
|
||||
$this->referral = '';
|
||||
if ($this->refid && $this->ref)
|
||||
{
|
||||
// return to the item that referred to this item
|
||||
$this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
|
||||
}
|
||||
elseif($this->ref)
|
||||
{
|
||||
// return to the list view that referred to this item
|
||||
$this->referral = '&ref=' . (string)$this->ref;
|
||||
}
|
||||
// check return value
|
||||
if (!is_null($return))
|
||||
{
|
||||
// add the return value
|
||||
$this->referral .= '&return=' . (string)$return;
|
||||
}
|
||||
|
||||
// Set the toolbar
|
||||
$this->addToolBar();
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
|
||||
// Set the document
|
||||
$this->setDocument();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
*/
|
||||
protected function addToolBar()
|
||||
{
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\View\HtmlView;
|
||||
|
||||
/**
|
||||
* Context Html View class
|
||||
*/
|
||||
class Release_checkingViewContext extends HtmlView
|
||||
{
|
||||
/**
|
||||
* display method of View
|
||||
* @return void
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// set params
|
||||
$this->params = JComponentHelper::getParams('com_release_checking');
|
||||
// Assign the variables
|
||||
$this->form = $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->script = $this->get('Script');
|
||||
$this->state = $this->get('State');
|
||||
// get action permissions
|
||||
$this->canDo = Release_checkingHelper::getActions('context', $this->item);
|
||||
// get input
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$this->ref = $jinput->get('ref', 0, 'word');
|
||||
$this->refid = $jinput->get('refid', 0, 'int');
|
||||
$return = $jinput->get('return', null, 'base64');
|
||||
// set the referral string
|
||||
$this->referral = '';
|
||||
if ($this->refid && $this->ref)
|
||||
{
|
||||
// return to the item that referred to this item
|
||||
$this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
|
||||
}
|
||||
elseif($this->ref)
|
||||
{
|
||||
// return to the list view that referred to this item
|
||||
$this->referral = '&ref=' . (string)$this->ref;
|
||||
}
|
||||
// check return value
|
||||
if (!is_null($return))
|
||||
{
|
||||
// add the return value
|
||||
$this->referral .= '&return=' . (string)$return;
|
||||
}
|
||||
|
||||
// Set the toolbar
|
||||
$this->addToolBar();
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
|
||||
// Set the document
|
||||
$this->setDocument();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
*/
|
||||
protected function addToolBar()
|
||||
{
|
||||
JFactory::getApplication()->input->set('hidemainmenu', true);
|
||||
$user = JFactory::getUser();
|
||||
$userId = $user->id;
|
||||
|
@ -147,47 +150,47 @@ class Release_checkingViewContext extends JViewLegacy
|
|||
}
|
||||
JToolbarHelper::divider();
|
||||
// set help url for this view if found
|
||||
$help_url = Release_checkingHelper::getHelpUrl('context');
|
||||
if (Release_checkingHelper::checkString($help_url))
|
||||
$this->help_url = Release_checkingHelper::getHelpUrl('context');
|
||||
if (Release_checkingHelper::checkString($this->help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_RELEASE_CHECKING_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
*/
|
||||
public function escape($var)
|
||||
{
|
||||
if(strlen($var) > 30)
|
||||
{
|
||||
// use the helper htmlEscape method instead and shorten the string
|
||||
return Release_checkingHelper::htmlEscape($var, $this->_charset, true, 30);
|
||||
}
|
||||
// use the helper htmlEscape method instead.
|
||||
return Release_checkingHelper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set up the document properties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setDocument()
|
||||
{
|
||||
$isNew = ($this->item->id < 1);
|
||||
if (!isset($this->document))
|
||||
{
|
||||
$this->document = JFactory::getDocument();
|
||||
}
|
||||
$this->document->setTitle(JText::_($isNew ? 'COM_RELEASE_CHECKING_CONTEXT_NEW' : 'COM_RELEASE_CHECKING_CONTEXT_EDIT'));
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_release_checking/assets/css/context.css", (Release_checkingHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
$this->document->addScript(JURI::root() . $this->script, (Release_checkingHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
$this->document->addScript(JURI::root() . "administrator/components/com_release_checking/views/context/submitbutton.js", (Release_checkingHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
JText::script('view not acceptable. Error');
|
||||
}
|
||||
}
|
||||
JToolbarHelper::help('COM_RELEASE_CHECKING_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
*/
|
||||
public function escape($var)
|
||||
{
|
||||
if(strlen($var) > 30)
|
||||
{
|
||||
// use the helper htmlEscape method instead and shorten the string
|
||||
return Release_checkingHelper::htmlEscape($var, $this->_charset, true, 30);
|
||||
}
|
||||
// use the helper htmlEscape method instead.
|
||||
return Release_checkingHelper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set up the document properties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setDocument()
|
||||
{
|
||||
$isNew = ($this->item->id < 1);
|
||||
if (!isset($this->document))
|
||||
{
|
||||
$this->document = JFactory::getDocument();
|
||||
}
|
||||
$this->document->setTitle(JText::_($isNew ? 'COM_RELEASE_CHECKING_CONTEXT_NEW' : 'COM_RELEASE_CHECKING_CONTEXT_EDIT'));
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_release_checking/assets/css/context.css", (Release_checkingHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
$this->document->addScript(JURI::root() . $this->script, (Release_checkingHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
$this->document->addScript(JURI::root() . "administrator/components/com_release_checking/views/context/submitbutton.js", (Release_checkingHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
JText::script('view not acceptable. Error');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,83 +1,66 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// load tooltip behavior
|
||||
JHtml::_('behavior.tooltip');
|
||||
JHtml::_('behavior.multiselect');
|
||||
JHtml::_('dropdown.init');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
|
||||
if ($this->saveOrder)
|
||||
{
|
||||
$saveOrderingUrl = 'index.php?option=com_release_checking&task=contexts.saveOrderAjax&tmpl=component';
|
||||
JHtml::_('sortablelist.sortable', 'contextList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
Joomla.orderTable = function()
|
||||
{
|
||||
table = document.getElementById("sortTable");
|
||||
direction = document.getElementById("directionTable");
|
||||
order = table.options[table.selectedIndex].value;
|
||||
if (order != '<?php echo $this->listOrder; ?>')
|
||||
{
|
||||
dirn = 'asc';
|
||||
}
|
||||
else
|
||||
{
|
||||
dirn = direction.options[direction.selectedIndex].value;
|
||||
}
|
||||
Joomla.tableOrdering(order, dirn, '');
|
||||
}
|
||||
</script>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_release_checking&view=contexts'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if(!empty( $this->sidebar)): ?>
|
||||
<div id="j-sidebar-container" class="span2">
|
||||
<?php echo $this->sidebar; ?>
|
||||
</div>
|
||||
<div id="j-main-container" class="span10">
|
||||
<?php else : ?>
|
||||
<div id="j-main-container">
|
||||
<?php endif; ?>
|
||||
<?php if (empty($this->items)): ?>
|
||||
<?php echo $this->loadTemplate('toolbar');?>
|
||||
<div class="alert alert-no-items">
|
||||
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<?php echo $this->loadTemplate('toolbar');?>
|
||||
<table class="table table-striped" id="contextList">
|
||||
<thead><?php echo $this->loadTemplate('head');?></thead>
|
||||
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
|
||||
<tbody><?php echo $this->loadTemplate('body');?></tbody>
|
||||
</table>
|
||||
<?php //Load the batch processing form. ?>
|
||||
<?php if ($this->canCreate && $this->canEdit) : ?>
|
||||
<?php echo JHtml::_(
|
||||
'bootstrap.renderModal',
|
||||
'collapseModal',
|
||||
array(
|
||||
'title' => JText::_('COM_RELEASE_CHECKING_CONTEXTS_BATCH_OPTIONS'),
|
||||
'footer' => $this->loadTemplate('batch_footer')
|
||||
),
|
||||
$this->loadTemplate('batch_body')
|
||||
); ?>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="filter_order" value="<?php echo $this->listOrder; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->listDirn; ?>" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHtml::_('behavior.multiselect');
|
||||
JHtml::_('dropdown.init');
|
||||
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_RELEASE_CHECKING_FILTER_SELECT_ACCESS') . ' -'));
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
if ($this->saveOrder)
|
||||
{
|
||||
$saveOrderingUrl = 'index.php?option=com_release_checking&task=contexts.saveOrderAjax&tmpl=component';
|
||||
JHtml::_('sortablelist.sortable', 'contextList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
|
||||
}
|
||||
?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_release_checking&view=contexts'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if(!empty( $this->sidebar)): ?>
|
||||
<div id="j-sidebar-container" class="span2">
|
||||
<?php echo $this->sidebar; ?>
|
||||
</div>
|
||||
<div id="j-main-container" class="span10">
|
||||
<?php else : ?>
|
||||
<div id="j-main-container">
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
// Add the trash helper layout
|
||||
echo JLayoutHelper::render('trashhelper', $this);
|
||||
// Add the searchtools
|
||||
echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
|
||||
?>
|
||||
<?php if (empty($this->items)): ?>
|
||||
<div class="alert alert-no-items">
|
||||
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<table class="table table-striped" id="contextList">
|
||||
<thead><?php echo $this->loadTemplate('head');?></thead>
|
||||
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
|
||||
<tbody><?php echo $this->loadTemplate('body');?></tbody>
|
||||
</table>
|
||||
<?php // Load the batch processing form. ?>
|
||||
<?php if ($this->canCreate && $this->canEdit) : ?>
|
||||
<?php echo JHtml::_(
|
||||
'bootstrap.renderModal',
|
||||
'collapseModal',
|
||||
array(
|
||||
'title' => JText::_('COM_RELEASE_CHECKING_CONTEXTS_BATCH_OPTIONS'),
|
||||
'footer' => $this->loadTemplate('batch_footer')
|
||||
),
|
||||
$this->loadTemplate('batch_body')
|
||||
); ?>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
|
||||
<p><?php echo JText::_('COM_RELEASE_CHECKING_CONTEXTS_BATCH_TIP'); ?></p>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
|
||||
<p><?php echo JText::_('COM_RELEASE_CHECKING_CONTEXTS_BATCH_TIP'); ?></p>
|
||||
<?php echo $this->batchDisplay; ?>
|
|
@ -1,21 +1,22 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<!-- clear the batch values if cancel -->
|
||||
<button class="btn" type="button" onclick="" data-dismiss="modal">
|
||||
<?php echo JText::_('JCANCEL'); ?>
|
||||
</button>
|
||||
<!-- post the batch values if process -->
|
||||
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('context.batch');">
|
||||
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<!-- clear the batch values if cancel -->
|
||||
<button class="btn" type="button" onclick="" data-dismiss="modal">
|
||||
<?php echo JText::_('JCANCEL'); ?>
|
||||
</button>
|
||||
<!-- post the batch values if process -->
|
||||
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('context.batch');">
|
||||
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
|
||||
</button>
|
|
@ -1,18 +1,19 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @subpackage com_release_checking
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$edit = "index.php?option=com_release_checking&view=contexts&task=context.edit";
|
||||
|
||||
?>
|
||||
/**
|
||||
* @package Joomla.CMS
|
||||
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
|
||||
*
|
||||
* @created 29th July, 2020
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$edit = "index.php?option=com_release_checking&view=contexts&task=context.edit";
|
||||
|
||||
?>
|
||||
<?php foreach ($this->items as $i => $item): ?>
|
||||
<?php
|
||||
$canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0;
|
||||
|
@ -23,11 +24,8 @@ $edit = "index.php?option=com_release_checking&view=contexts&task=context.edit";
|
|||
<td class="order nowrap center hidden-phone">
|
||||
<?php if ($canDo->get('core.edit.state')): ?>
|
||||
<?php
|
||||
if ($this->saveOrder)
|
||||
{
|
||||
$iconClass = ' inactive';
|
||||
}
|
||||
else
|
||||
$iconClass = '';
|
||||
if (!$this->saveOrder)
|
||||
{
|
||||
$iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue