Added the code for the track release checking component, v1.0.4

This commit is contained in:
Llewellyn van der Merwe 2020-11-02 18:03:39 +02:00
parent 62fe770b5e
commit 87c56f00fd
Signed by: Llewellyn
GPG Key ID: EFC0C720A240551C
524 changed files with 132429 additions and 0 deletions

54
admin/README.txt Normal file
View File

@ -0,0 +1,54 @@
# 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
# Build Details
+ *Company*: [Open Source Matters](http://www.joomla.org)
+ *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
+ *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
**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

64
admin/access.xml Normal file
View File

@ -0,0 +1,64 @@
<?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" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
<action name="core.export" title="COM_RELEASE_CHECKING_EXPORT_DATA" description="COM_RELEASE_CHECKING_EXPORT_DATA_DESC" />
<action name="core.import" title="COM_RELEASE_CHECKING_IMPORT_DATA" description="COM_RELEASE_CHECKING_IMPORT_DATA_DESC" />
<action name="core.batch" title="COM_RELEASE_CHECKING_USE_BATCH" description="COM_RELEASE_CHECKING_USE_BATCH_DESC" />
<action name="core.version" title="COM_RELEASE_CHECKING_EDIT_VERSIONS" description="COM_RELEASE_CHECKING_EDIT_VERSIONS_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_ACCESS_EDITSTATE_DESC" />
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_COMPONENT_DESC" />
<action name="core.edit.created_by" title="COM_RELEASE_CHECKING_EDIT_CREATED_BY" description="COM_RELEASE_CHECKING_EDIT_CREATED_BY_DESC" />
<action name="core.edit.created" title="COM_RELEASE_CHECKING_EDIT_CREATED_DATE" description="COM_RELEASE_CHECKING_EDIT_CREATED_DATE_DESC" />
<action name="action.access" title="COM_RELEASE_CHECKING_ACTIONS_ACCESS" description="COM_RELEASE_CHECKING_ACTIONS_ACCESS_DESC" />
<action name="action.batch" title="COM_RELEASE_CHECKING_ACTIONS_BATCH_USE" description="COM_RELEASE_CHECKING_ACTIONS_BATCH_USE_DESC" />
<action name="action.version" title="COM_RELEASE_CHECKING_ACTIONS_EDIT_VERSION" description="COM_RELEASE_CHECKING_ACTIONS_EDIT_VERSION_DESC" />
<action name="action.export" title="COM_RELEASE_CHECKING_ACTIONS_EXPORT" description="COM_RELEASE_CHECKING_ACTIONS_EXPORT_DESC" />
<action name="action.import" title="COM_RELEASE_CHECKING_ACTIONS_IMPORT" description="COM_RELEASE_CHECKING_ACTIONS_IMPORT_DESC" />
<action name="context.access" title="COM_RELEASE_CHECKING_CONTEXTS_ACCESS" description="COM_RELEASE_CHECKING_CONTEXTS_ACCESS_DESC" />
<action name="context.batch" title="COM_RELEASE_CHECKING_CONTEXTS_BATCH_USE" description="COM_RELEASE_CHECKING_CONTEXTS_BATCH_USE_DESC" />
<action name="context.version" title="COM_RELEASE_CHECKING_CONTEXTS_EDIT_VERSION" description="COM_RELEASE_CHECKING_CONTEXTS_EDIT_VERSION_DESC" />
<action name="context.export" title="COM_RELEASE_CHECKING_CONTEXTS_EXPORT" description="COM_RELEASE_CHECKING_CONTEXTS_EXPORT_DESC" />
<action name="context.import" title="COM_RELEASE_CHECKING_CONTEXTS_IMPORT" description="COM_RELEASE_CHECKING_CONTEXTS_IMPORT_DESC" />
<action name="joomla_version.access" title="COM_RELEASE_CHECKING_JOOMLA_VERSIONS_ACCESS" description="COM_RELEASE_CHECKING_JOOMLA_VERSIONS_ACCESS_DESC" />
<action name="joomla_version.batch" title="COM_RELEASE_CHECKING_JOOMLA_VERSIONS_BATCH_USE" description="COM_RELEASE_CHECKING_JOOMLA_VERSIONS_BATCH_USE_DESC" />
<action name="joomla_version.version" title="COM_RELEASE_CHECKING_JOOMLA_VERSIONS_EDIT_VERSION" description="COM_RELEASE_CHECKING_JOOMLA_VERSIONS_EDIT_VERSION_DESC" />
<action name="joomla_version.export" title="COM_RELEASE_CHECKING_JOOMLA_VERSIONS_EXPORT" description="COM_RELEASE_CHECKING_JOOMLA_VERSIONS_EXPORT_DESC" />
<action name="joomla_version.import" title="COM_RELEASE_CHECKING_JOOMLA_VERSIONS_IMPORT" description="COM_RELEASE_CHECKING_JOOMLA_VERSIONS_IMPORT_DESC" />
<action name="joomla_version.submenu" title="COM_RELEASE_CHECKING_JOOMLA_VERSIONS_SUBMENU" description="COM_RELEASE_CHECKING_JOOMLA_VERSIONS_SUBMENU_DESC" />
<action name="release_check.access" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_ACCESS" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_ACCESS_DESC" />
<action name="release_check.batch" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_BATCH_USE" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_BATCH_USE_DESC" />
<action name="release_check.dashboard_list" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_DASHBOARD_LIST" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_DASHBOARD_LIST_DESC" />
<action name="release_check.edit.created_by" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_BY" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_BY_DESC" />
<action name="release_check.version" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_VERSION" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_VERSION_DESC" />
<action name="release_check.export" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_EXPORT" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_EXPORT_DESC" />
<action name="release_check.import" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_IMPORT" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_IMPORT_DESC" />
<action name="release_check.submenu" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_SUBMENU" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_SUBMENU_DESC" />
</section>
<section name="release_check">
<action name="core.edit" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_DESC" />
<action name="core.edit.own" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_OWN" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_OWN_DESC" />
<action name="core.edit.state" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_STATE" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_STATE_DESC" />
<action name="core.edit.access" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_ACCESS" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_ACCESS_DESC" />
<action name="core.edit.created_by" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_BY" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_BY_DESC" />
<action name="core.edit.created" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_DATE" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_DATE_DESC" />
<action name="core.create" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_CREATE" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_CREATE_DESC" />
<action name="core.delete" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_DELETE" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_DELETE_DESC" />
<action name="release_check.edit.created_by" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_BY" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_BY_DESC" />
<action name="release_check.version" title="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_VERSION" description="COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_VERSION_DESC" />
</section>
<section name="joomla_version">
<action name="joomla_version.version" title="COM_RELEASE_CHECKING_JOOMLA_VERSIONS_EDIT_VERSION" description="COM_RELEASE_CHECKING_JOOMLA_VERSIONS_EDIT_VERSION_DESC" />
</section>
<section name="context">
<action name="context.version" title="COM_RELEASE_CHECKING_CONTEXTS_EDIT_VERSION" description="COM_RELEASE_CHECKING_CONTEXTS_EDIT_VERSION_DESC" />
</section>
<section name="action">
<action name="action.version" title="COM_RELEASE_CHECKING_ACTIONS_EDIT_VERSION" description="COM_RELEASE_CHECKING_ACTIONS_EDIT_VERSION_DESC" />
</section>
</access>

View File

@ -0,0 +1,11 @@
/**
* @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 */

View File

@ -0,0 +1,11 @@
/**
* @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 */

View File

@ -0,0 +1,13 @@
/**
* @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;
}

View File

@ -0,0 +1,11 @@
/**
* @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 */

View File

@ -0,0 +1,11 @@
/**
* @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 */

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,11 @@
/**
* @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 */

View File

@ -0,0 +1,11 @@
/**
* @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 */

View File

@ -0,0 +1,23 @@
/**
* @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 */
.control-wrapper-context .input-append {
width: 85% !important;
}
.control-wrapper-context .input-append #jform_context_chzn {
width: 100% !important;
}
.control-wrapper-action .input-append {
width: 85% !important;
}
.control-wrapper-action .input-append #jform_action_chzn {
width: 100% !important;
}

View File

@ -0,0 +1,29 @@
/**
* @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 */
.outcome {
padding: 10px;
-webkit-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow:inset 0 0 3px 1px #0A0A0A;
box-shadow:inset 0 0 3px 1px #0A0A0A;
line-height: 32px;
color: #fff;
}
.outcome-failure {
background-color: red;
}
.outcome-success {
background-color: green;
}
.outcome-undecided {
background-color: blue;
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

1
admin/assets/index.html Normal file
View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

9
admin/assets/js/admin.js Normal file
View File

@ -0,0 +1,9 @@
/**
* @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
*/
/* JS Document */

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

107
admin/config.xml Normal file
View File

@ -0,0 +1,107 @@
<?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"
name="global_config"
label="COM_RELEASE_CHECKING_CONFIG_GLOBAL_LABEL"
description="COM_RELEASE_CHECKING_CONFIG_GLOBAL_DESC">
<field
name="check_in"
type="list"
default="0"
label="COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_LABEL"
description="COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_DESC">
<option
value="-5 hours">COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_OPTION_ONE</option>
<option
value="-12 hours">COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_OPTION_TWO</option>
<option
value="-1 day">COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_OPTION_THREE</option>
<option
value="-2 day">COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_OPTION_FOUR</option>
<option
value="-1 week">COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_OPTION_FIVE</option>
<option
value="0">COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_OPTION_SIX</option>
</field>
<field type="spacer" name="spacerAuthor" hr="true" />
<field
name="save_history"
type="radio"
class="btn-group btn-group-yesno"
default="1"
label="JGLOBAL_SAVE_HISTORY_OPTIONS_LABEL"
description="JGLOBAL_SAVE_HISTORY_OPTIONS_DESC"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="history_limit"
type="text"
filter="integer"
label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL"
description="JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC"
default="10"
/>
<field type="spacer" name="spacerHistory" hr="true" />
<field name="autorTitle"
type="spacer"
label="COM_RELEASE_CHECKING_CONFIG_AUTHOR"
/>
<field name="autorName"
type="text"
label="COM_RELEASE_CHECKING_CONFIG_AUTHOR_NAME_LABEL"
description="COM_RELEASE_CHECKING_CONFIG_AUTHOR_NAME_DESC"
size="60"
default="Joomla! Project"
readonly="true"
class="readonly"
/>
<field name="autorEmail"
type="email"
label="COM_RELEASE_CHECKING_CONFIG_AUTHOR_EMAIL_LABEL"
description="COM_RELEASE_CHECKING_CONFIG_AUTHOR_EMAIL_DESC"
size="60"
default="admin@joomla.org"
readonly="true"
class="readonly"
/>
</fieldset>
<fieldset
name="export_text_only_config"
label="COM_RELEASE_CHECKING_CONFIG_EXPORT_TEXT_ONLY_TAB_LABEL"
description="COM_RELEASE_CHECKING_CONFIG_EXPORT_TEXT_ONLY_TAB_DESCRIPTION">
<!-- Export Text Only Field. Type: Radio. (joomla) -->
<field
type="radio"
name="export_text_only"
label="COM_RELEASE_CHECKING_CONFIG_EXPORT_TEXT_ONLY_LABEL"
description="COM_RELEASE_CHECKING_CONFIG_EXPORT_TEXT_ONLY_DESCRIPTION"
class="btn-group btn-group-yesno"
default="0">
<!-- Option Set. -->
<option value="1">
COM_RELEASE_CHECKING_CONFIG_ACTIVATE</option>
<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>
</config>

113
admin/controller.php Normal file
View File

@ -0,0 +1,113 @@
<?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
$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;
}
}

View File

@ -0,0 +1,314 @@
<?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())
{
// Get user object.
$user = JFactory::getUser();
// Access check.
$access = $user->authorise('action.access', 'com_release_checking');
if (!$access)
{
return false;
}
// 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')
{
// get user object.
$user = JFactory::getUser();
// get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('core.edit', 'com_release_checking.action.' . (int) $recordId);
if (!$permission)
{
if ($user->authorise('core.edit.own', 'com_release_checking.action.' . $recordId))
{
// Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
if (empty($ownerId))
{
// Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId);
if (empty($record))
{
return false;
}
$ownerId = $record->created_by;
}
// If the owner matches 'me' then allow.
if ($ownerId == $user->id)
{
if ($user->authorise('core.edit.own', 'com_release_checking'))
{
return true;
}
}
}
return false;
}
}
// 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;
}
}

View File

@ -0,0 +1,106 @@
<?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);
}
public function exportData()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if export is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('action.export', 'com_release_checking') && $user->authorise('core.export', 'com_release_checking'))
{
// Get the input
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
// Get the model
$model = $this->getModel('Actions');
// get the data to export
$data = $model->getExportData($pks);
if (Release_checkingHelper::checkArray($data))
{
// now set the data to the spreadsheet
$date = JFactory::getDate();
Release_checkingHelper::xls($data,'Actions_'.$date->format('jS_F_Y'),'Actions exported ('.$date->format('jS F, Y').')','actions');
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_RELEASE_CHECKING_EXPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=actions', false), $message, 'error');
return;
}
public function importData()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if import is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('action.import', 'com_release_checking') && $user->authorise('core.import', 'com_release_checking'))
{
// Get the import model
$model = $this->getModel('Actions');
// get the headers to import
$headers = $model->getExImPortHeaders();
if (Release_checkingHelper::checkObject($headers))
{
// Load headers to session.
$session = JFactory::getSession();
$headers = json_encode($headers);
$session->set('action_VDM_IMPORTHEADERS', $headers);
$session->set('backto_VDM_IMPORT', 'actions');
$session->set('dataType_VDM_IMPORTINTO', 'action');
// Redirect to import view.
$message = JText::_('COM_RELEASE_CHECKING_IMPORT_SELECT_FILE_FOR_ACTIONS');
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=import', false), $message);
return;
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_RELEASE_CHECKING_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=actions', false), $message, 'error');
return;
}
}

View File

@ -0,0 +1,136 @@
<?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", "*");
// 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)
{
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');
if($contextValue && $user->id != 0 && $joomla_versionValue)
{
$result = $this->getModel('ajax')->getAction($contextValue, $joomla_versionValue, $current_idValue);
}
else
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback."(".json_encode($e).");";
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case 'getActionDescription':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$actionValue = $jinput->get('action', NULL, 'INT');
if($actionValue && $user->id != 0)
{
$result = $this->getModel('ajax')->getActionDescription($actionValue);
}
else
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback."(".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).");";
}
}
}
}

View File

@ -0,0 +1,314 @@
<?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())
{
// Get user object.
$user = JFactory::getUser();
// Access check.
$access = $user->authorise('context.access', 'com_release_checking');
if (!$access)
{
return false;
}
// 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')
{
// get user object.
$user = JFactory::getUser();
// get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('core.edit', 'com_release_checking.context.' . (int) $recordId);
if (!$permission)
{
if ($user->authorise('core.edit.own', 'com_release_checking.context.' . $recordId))
{
// Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
if (empty($ownerId))
{
// Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId);
if (empty($record))
{
return false;
}
$ownerId = $record->created_by;
}
// If the owner matches 'me' then allow.
if ($ownerId == $user->id)
{
if ($user->authorise('core.edit.own', 'com_release_checking'))
{
return true;
}
}
}
return false;
}
}
// 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;
}
}

View File

@ -0,0 +1,106 @@
<?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);
}
public function exportData()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if export is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('context.export', 'com_release_checking') && $user->authorise('core.export', 'com_release_checking'))
{
// Get the input
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
// Get the model
$model = $this->getModel('Contexts');
// get the data to export
$data = $model->getExportData($pks);
if (Release_checkingHelper::checkArray($data))
{
// now set the data to the spreadsheet
$date = JFactory::getDate();
Release_checkingHelper::xls($data,'Contexts_'.$date->format('jS_F_Y'),'Contexts exported ('.$date->format('jS F, Y').')','contexts');
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_RELEASE_CHECKING_EXPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=contexts', false), $message, 'error');
return;
}
public function importData()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if import is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('context.import', 'com_release_checking') && $user->authorise('core.import', 'com_release_checking'))
{
// Get the import model
$model = $this->getModel('Contexts');
// get the headers to import
$headers = $model->getExImPortHeaders();
if (Release_checkingHelper::checkObject($headers))
{
// Load headers to session.
$session = JFactory::getSession();
$headers = json_encode($headers);
$session->set('context_VDM_IMPORTHEADERS', $headers);
$session->set('backto_VDM_IMPORT', 'contexts');
$session->set('dataType_VDM_IMPORTINTO', 'context');
// Redirect to import view.
$message = JText::_('COM_RELEASE_CHECKING_IMPORT_SELECT_FILE_FOR_CONTEXTS');
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=import', false), $message);
return;
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_RELEASE_CHECKING_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=contexts', false), $message, 'error');
return;
}
}

View File

@ -0,0 +1,53 @@
<?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);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,314 @@
<?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())
{
// Get user object.
$user = JFactory::getUser();
// Access check.
$access = $user->authorise('joomla_version.access', 'com_release_checking');
if (!$access)
{
return false;
}
// 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')
{
// get user object.
$user = JFactory::getUser();
// get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('core.edit', 'com_release_checking.joomla_version.' . (int) $recordId);
if (!$permission)
{
if ($user->authorise('core.edit.own', 'com_release_checking.joomla_version.' . $recordId))
{
// Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
if (empty($ownerId))
{
// Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId);
if (empty($record))
{
return false;
}
$ownerId = $record->created_by;
}
// If the owner matches 'me' then allow.
if ($ownerId == $user->id)
{
if ($user->authorise('core.edit.own', 'com_release_checking'))
{
return true;
}
}
}
return false;
}
}
// 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;
}
}

View File

@ -0,0 +1,106 @@
<?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);
}
public function exportData()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if export is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('joomla_version.export', 'com_release_checking') && $user->authorise('core.export', 'com_release_checking'))
{
// Get the input
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
// Get the model
$model = $this->getModel('Joomla_versions');
// get the data to export
$data = $model->getExportData($pks);
if (Release_checkingHelper::checkArray($data))
{
// now set the data to the spreadsheet
$date = JFactory::getDate();
Release_checkingHelper::xls($data,'Joomla_versions_'.$date->format('jS_F_Y'),'Joomla versions exported ('.$date->format('jS F, Y').')','joomla versions');
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_RELEASE_CHECKING_EXPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=joomla_versions', false), $message, 'error');
return;
}
public function importData()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if import is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('joomla_version.import', 'com_release_checking') && $user->authorise('core.import', 'com_release_checking'))
{
// Get the import model
$model = $this->getModel('Joomla_versions');
// get the headers to import
$headers = $model->getExImPortHeaders();
if (Release_checkingHelper::checkObject($headers))
{
// Load headers to session.
$session = JFactory::getSession();
$headers = json_encode($headers);
$session->set('joomla_version_VDM_IMPORTHEADERS', $headers);
$session->set('backto_VDM_IMPORT', 'joomla_versions');
$session->set('dataType_VDM_IMPORTINTO', 'joomla_version');
// Redirect to import view.
$message = JText::_('COM_RELEASE_CHECKING_IMPORT_SELECT_FILE_FOR_JOOMLA_VERSIONS');
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=import', false), $message);
return;
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_RELEASE_CHECKING_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=joomla_versions', false), $message, 'error');
return;
}
}

View File

@ -0,0 +1,314 @@
<?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())
{
// Get user object.
$user = JFactory::getUser();
// Access check.
$access = $user->authorise('release_check.access', 'com_release_checking');
if (!$access)
{
return false;
}
// 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')
{
// get user object.
$user = JFactory::getUser();
// get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('core.edit', 'com_release_checking.release_check.' . (int) $recordId);
if (!$permission)
{
if ($user->authorise('core.edit.own', 'com_release_checking.release_check.' . $recordId))
{
// Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
if (empty($ownerId))
{
// Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId);
if (empty($record))
{
return false;
}
$ownerId = $record->created_by;
}
// If the owner matches 'me' then allow.
if ($ownerId == $user->id)
{
if ($user->authorise('core.edit.own', 'com_release_checking'))
{
return true;
}
}
}
return false;
}
}
// 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;
}
}

View File

@ -0,0 +1,106 @@
<?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);
}
public function exportData()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if export is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('release_check.export', 'com_release_checking') && $user->authorise('core.export', 'com_release_checking'))
{
// Get the input
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
// Get the model
$model = $this->getModel('Release_checks');
// get the data to export
$data = $model->getExportData($pks);
if (Release_checkingHelper::checkArray($data))
{
// now set the data to the spreadsheet
$date = JFactory::getDate();
Release_checkingHelper::xls($data,'Release_checks_'.$date->format('jS_F_Y'),'Release checks exported ('.$date->format('jS F, Y').')','release checks');
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_RELEASE_CHECKING_EXPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=release_checks', false), $message, 'error');
return;
}
public function importData()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if import is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('release_check.import', 'com_release_checking') && $user->authorise('core.import', 'com_release_checking'))
{
// Get the import model
$model = $this->getModel('Release_checks');
// get the headers to import
$headers = $model->getExImPortHeaders();
if (Release_checkingHelper::checkObject($headers))
{
// Load headers to session.
$session = JFactory::getSession();
$headers = json_encode($headers);
$session->set('release_check_VDM_IMPORTHEADERS', $headers);
$session->set('backto_VDM_IMPORT', 'release_checks');
$session->set('dataType_VDM_IMPORTINTO', 'release_check');
// Redirect to import view.
$message = JText::_('COM_RELEASE_CHECKING_IMPORT_SELECT_FILE_FOR_RELEASE_CHECKS');
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=import', false), $message);
return;
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_RELEASE_CHECKING_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_release_checking&view=release_checks', false), $message, 'error');
return;
}
}

View File

@ -0,0 +1,69 @@
<?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;
}
}

View File

@ -0,0 +1,76 @@
<?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;
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

1
admin/helpers/index.html Normal file
View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

File diff suppressed because it is too large Load Diff

1
admin/index.html Normal file
View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,386 @@
COM_RELEASE_CHECKING="Track Release Checking"
COM_RELEASE_CHECKING_ACTION="Action"
COM_RELEASE_CHECKING_ACTIONS="Actions"
COM_RELEASE_CHECKING_ACTIONS_ACCESS="Actions Access"
COM_RELEASE_CHECKING_ACTIONS_ACCESS_DESC="Allows the users in this group to access access actions"
COM_RELEASE_CHECKING_ACTIONS_BATCH_OPTIONS="Batch process the selected Actions"
COM_RELEASE_CHECKING_ACTIONS_BATCH_TIP="All changes will be applied to all selected Actions"
COM_RELEASE_CHECKING_ACTIONS_BATCH_USE="Actions Batch Use"
COM_RELEASE_CHECKING_ACTIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch actions"
COM_RELEASE_CHECKING_ACTIONS_EDIT_VERSION="Actions Edit Version"
COM_RELEASE_CHECKING_ACTIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version actions"
COM_RELEASE_CHECKING_ACTIONS_EXPORT="Actions Export"
COM_RELEASE_CHECKING_ACTIONS_EXPORT_DESC="Allows the users in this group to export export actions"
COM_RELEASE_CHECKING_ACTIONS_IMPORT="Actions Import"
COM_RELEASE_CHECKING_ACTIONS_IMPORT_DESC="Allows the users in this group to import import actions"
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_ARCHIVED="%s Actions archived."
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_ARCHIVED_1="%s Action archived."
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_CHECKED_IN_0="No Action successfully checked in."
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_CHECKED_IN_1="%d Action successfully checked in."
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_CHECKED_IN_MORE="%d Actions successfully checked in."
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_DELETED="%s Actions deleted."
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_DELETED_1="%s Action deleted."
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_FAILED_PUBLISHING="%s Actions failed publishing."
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_FAILED_PUBLISHING_1="%s Action failed publishing."
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_FEATURED="%s Actions featured."
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_FEATURED_1="%s Action featured."
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_PUBLISHED="%s Actions published."
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_PUBLISHED_1="%s Action published."
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_TRASHED="%s Actions trashed."
COM_RELEASE_CHECKING_ACTIONS_N_ITEMS_TRASHED_1="%s Action trashed."
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"
COM_RELEASE_CHECKING_ACTION_DETAILS="Details"
COM_RELEASE_CHECKING_ACTION_EDIT="Editing the Action"
COM_RELEASE_CHECKING_ACTION_ERROR_UNIQUE_ALIAS="Another Action has the same alias."
COM_RELEASE_CHECKING_ACTION_ID="Id"
COM_RELEASE_CHECKING_ACTION_MODIFIED_BY_DESC="The last user that modified this Action."
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"
COM_RELEASE_CHECKING_ACTION_NAME_MESSAGE="Error! Please add name here."
COM_RELEASE_CHECKING_ACTION_NEW="A New Action"
COM_RELEASE_CHECKING_ACTION_ORDERING_LABEL="Ordering"
COM_RELEASE_CHECKING_ACTION_PERMISSION="Permissions"
COM_RELEASE_CHECKING_ACTION_PUBLISHING="Publishing"
COM_RELEASE_CHECKING_ACTION_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Action to customise the alias."
COM_RELEASE_CHECKING_ACTION_STATUS="Status"
COM_RELEASE_CHECKING_ACTION_VERSION_DESC="A count of the number of times this Action has been revised."
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_AUTHOR="Author"
COM_RELEASE_CHECKING_BACK="Back"
COM_RELEASE_CHECKING_CHECKED_BY="Checked By"
COM_RELEASE_CHECKING_CLOSE_NEW="Close & New"
COM_RELEASE_CHECKING_CONFIG_AUTHOR="Author Info"
COM_RELEASE_CHECKING_CONFIG_AUTHOR_EMAIL_DESC="The email address of the author of this component."
COM_RELEASE_CHECKING_CONFIG_AUTHOR_EMAIL_LABEL="Author Email"
COM_RELEASE_CHECKING_CONFIG_AUTHOR_NAME_DESC="The name of the author of this component."
COM_RELEASE_CHECKING_CONFIG_AUTHOR_NAME_LABEL="Author Name"
COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_DESC="Set the intervals for the auto checkin fuction of tables that checks out the items to an user."
COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_LABEL="Check in timer"
COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_OPTION_FIVE="Once a week"
COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_OPTION_FOUR="Every second day"
COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_OPTION_ONE="Every five hours"
COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_OPTION_SIX="Never"
COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_OPTION_THREE="Once a day"
COM_RELEASE_CHECKING_CONFIG_CHECK_TIMER_OPTION_TWO="Every twelve hours"
COM_RELEASE_CHECKING_CONFIG_GLOBAL_DESC="The Global Parameters"
COM_RELEASE_CHECKING_CONFIG_GLOBAL_LABEL="Global"
COM_RELEASE_CHECKING_CONTEXT="Context"
COM_RELEASE_CHECKING_CONTEXTS="Contexts"
COM_RELEASE_CHECKING_CONTEXTS_ACCESS="Contexts Access"
COM_RELEASE_CHECKING_CONTEXTS_ACCESS_DESC="Allows the users in this group to access access contexts"
COM_RELEASE_CHECKING_CONTEXTS_BATCH_OPTIONS="Batch process the selected Contexts"
COM_RELEASE_CHECKING_CONTEXTS_BATCH_TIP="All changes will be applied to all selected Contexts"
COM_RELEASE_CHECKING_CONTEXTS_BATCH_USE="Contexts Batch Use"
COM_RELEASE_CHECKING_CONTEXTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch contexts"
COM_RELEASE_CHECKING_CONTEXTS_EDIT_VERSION="Contexts Edit Version"
COM_RELEASE_CHECKING_CONTEXTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version contexts"
COM_RELEASE_CHECKING_CONTEXTS_EXPORT="Contexts Export"
COM_RELEASE_CHECKING_CONTEXTS_EXPORT_DESC="Allows the users in this group to export export contexts"
COM_RELEASE_CHECKING_CONTEXTS_IMPORT="Contexts Import"
COM_RELEASE_CHECKING_CONTEXTS_IMPORT_DESC="Allows the users in this group to import import contexts"
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_ARCHIVED="%s Contexts archived."
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_ARCHIVED_1="%s Context archived."
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_CHECKED_IN_0="No Context successfully checked in."
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_CHECKED_IN_1="%d Context successfully checked in."
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_CHECKED_IN_MORE="%d Contexts successfully checked in."
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_DELETED="%s Contexts deleted."
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_DELETED_1="%s Context deleted."
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_FAILED_PUBLISHING="%s Contexts failed publishing."
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_FAILED_PUBLISHING_1="%s Context failed publishing."
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_FEATURED="%s Contexts featured."
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_FEATURED_1="%s Context featured."
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_PUBLISHED="%s Contexts published."
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_PUBLISHED_1="%s Context published."
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_TRASHED="%s Contexts trashed."
COM_RELEASE_CHECKING_CONTEXTS_N_ITEMS_TRASHED_1="%s Context trashed."
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."
COM_RELEASE_CHECKING_CONTEXT_CREATED_BY_LABEL="Created By"
COM_RELEASE_CHECKING_CONTEXT_CREATED_DATE_DESC="The date this Context was created."
COM_RELEASE_CHECKING_CONTEXT_CREATED_DATE_LABEL="Created Date"
COM_RELEASE_CHECKING_CONTEXT_DETAILS="Details"
COM_RELEASE_CHECKING_CONTEXT_EDIT="Editing the Context"
COM_RELEASE_CHECKING_CONTEXT_ERROR_UNIQUE_ALIAS="Another Context has the same alias."
COM_RELEASE_CHECKING_CONTEXT_ID="Id"
COM_RELEASE_CHECKING_CONTEXT_MODIFIED_BY_DESC="The last user that modified this Context."
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"
COM_RELEASE_CHECKING_CONTEXT_NAME_MESSAGE="Error! Please add name here."
COM_RELEASE_CHECKING_CONTEXT_NEW="A New Context"
COM_RELEASE_CHECKING_CONTEXT_ORDERING_LABEL="Ordering"
COM_RELEASE_CHECKING_CONTEXT_PERMISSION="Permissions"
COM_RELEASE_CHECKING_CONTEXT_PUBLISHING="Publishing"
COM_RELEASE_CHECKING_CONTEXT_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Context to customise the alias."
COM_RELEASE_CHECKING_CONTEXT_STATUS="Status"
COM_RELEASE_CHECKING_CONTEXT_VERSION_DESC="A count of the number of times this Context has been revised."
COM_RELEASE_CHECKING_CONTEXT_VERSION_LABEL="Version"
COM_RELEASE_CHECKING_CONTRIBUTOR="Contributor"
COM_RELEASE_CHECKING_CONTRIBUTORS="Contributors"
COM_RELEASE_CHECKING_CREATE="Create"
COM_RELEASE_CHECKING_CREATE_NEW_S="Create New %s"
COM_RELEASE_CHECKING_DASH="Dashboard"
COM_RELEASE_CHECKING_DASHBOARD="Track Release Checking Dashboard"
COM_RELEASE_CHECKING_DATE="Date"
COM_RELEASE_CHECKING_EDIT_CREATED_BY="Edit Created By"
COM_RELEASE_CHECKING_EDIT_CREATED_BY_DESC="Allows users in this group to edit created by."
COM_RELEASE_CHECKING_EDIT_CREATED_DATE="Edit Created Date"
COM_RELEASE_CHECKING_EDIT_CREATED_DATE_DESC="Allows users in this group to edit created date."
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_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_HELP_MANAGER="Help"
COM_RELEASE_CHECKING_IMPORT_CONTINUE="Continue"
COM_RELEASE_CHECKING_IMPORT_DATA="Import Data"
COM_RELEASE_CHECKING_IMPORT_DATA_DESC="Allows users in this group to import data."
COM_RELEASE_CHECKING_IMPORT_ERROR="Import error."
COM_RELEASE_CHECKING_IMPORT_FAILED="Import Failed"
COM_RELEASE_CHECKING_IMPORT_FILE_COLUMNS="File Columns"
COM_RELEASE_CHECKING_IMPORT_FORMATS_ACCEPTED="formats accepted"
COM_RELEASE_CHECKING_IMPORT_FROM_DIRECTORY="Directory"
COM_RELEASE_CHECKING_IMPORT_FROM_UPLOAD="Upload"
COM_RELEASE_CHECKING_IMPORT_FROM_URL="URL"
COM_RELEASE_CHECKING_IMPORT_GET_BOTTON="Get File"
COM_RELEASE_CHECKING_IMPORT_IGNORE_COLUMN="-- Ignore This Column --"
COM_RELEASE_CHECKING_IMPORT_LINK_FILE_TO_TABLE_COLUMNS="Link File to Table Columns"
COM_RELEASE_CHECKING_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE="Does not have a valid file type."
COM_RELEASE_CHECKING_IMPORT_MSG_ENTER_A_URL="Please enter a url."
COM_RELEASE_CHECKING_IMPORT_MSG_INVALID_URL="Invalid url."
COM_RELEASE_CHECKING_IMPORT_MSG_NO_FILE_SELECTED="No import file selected."
COM_RELEASE_CHECKING_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE="Path does not have a valid file."
COM_RELEASE_CHECKING_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY="Please enter the file directory."
COM_RELEASE_CHECKING_IMPORT_MSG_PLEASE_SELECT_ALL_COLUMNS="Please link all columns."
COM_RELEASE_CHECKING_IMPORT_MSG_PLEASE_SELECT_A_DIRECTORY="Please enter the file directory."
COM_RELEASE_CHECKING_IMPORT_MSG_PLEASE_SELECT_A_FILE="Please select a file to import."
COM_RELEASE_CHECKING_IMPORT_MSG_WARNIMPORTFILE="Warning, import file error."
COM_RELEASE_CHECKING_IMPORT_MSG_WARNIMPORTUPLOADERROR="Warning, import upload error."
COM_RELEASE_CHECKING_IMPORT_NO_IMPORT_TYPE_FOUND="Import type not found."
COM_RELEASE_CHECKING_IMPORT_PLEASE_SELECT_COLUMN="-- Please Select Column --"
COM_RELEASE_CHECKING_IMPORT_SELECT_FILE="Select File"
COM_RELEASE_CHECKING_IMPORT_SELECT_FILE_DIRECTORY="Set the path to file"
COM_RELEASE_CHECKING_IMPORT_SELECT_FILE_FOR_ACTIONS="Select the file to import data to actions."
COM_RELEASE_CHECKING_IMPORT_SELECT_FILE_FOR_CONTEXTS="Select the file to import data to contexts."
COM_RELEASE_CHECKING_IMPORT_SELECT_FILE_FOR_JOOMLA_VERSIONS="Select the file to import data to joomla_versions."
COM_RELEASE_CHECKING_IMPORT_SELECT_FILE_FOR_RELEASE_CHECKS="Select the file to import data to release_checks."
COM_RELEASE_CHECKING_IMPORT_SELECT_FILE_URL="Enter file URL"
COM_RELEASE_CHECKING_IMPORT_SUCCESS="Great! Import successful."
COM_RELEASE_CHECKING_IMPORT_TABLE_COLUMNS="Table Columns"
COM_RELEASE_CHECKING_IMPORT_TITLE="Data Importer"
COM_RELEASE_CHECKING_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE="Package to import not found."
COM_RELEASE_CHECKING_IMPORT_UPDATE_DATA="Import Data"
COM_RELEASE_CHECKING_IMPORT_UPLOAD_BOTTON="Upload File"
COM_RELEASE_CHECKING_INACTIVE="Inactive"
COM_RELEASE_CHECKING_JOOMLA_VERSION="Joomla Version"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS="Joomla Versions"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_ACCESS="Joomla Versions Access"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_ACCESS_DESC="Allows the users in this group to access access joomla versions"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_BATCH_OPTIONS="Batch process the selected Joomla Versions"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_BATCH_TIP="All changes will be applied to all selected Joomla Versions"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_BATCH_USE="Joomla Versions Batch Use"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla versions"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_EDIT_VERSION="Joomla Versions Edit Version"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla versions"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_EXPORT="Joomla Versions Export"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_EXPORT_DESC="Allows the users in this group to export export joomla versions"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_IMPORT="Joomla Versions Import"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_IMPORT_DESC="Allows the users in this group to import import joomla versions"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_ARCHIVED="%s Joomla Versions archived."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_ARCHIVED_1="%s Joomla Version archived."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_CHECKED_IN_0="No Joomla Version successfully checked in."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_CHECKED_IN_1="%d Joomla Version successfully checked in."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_CHECKED_IN_MORE="%d Joomla Versions successfully checked in."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_DELETED="%s Joomla Versions deleted."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_DELETED_1="%s Joomla Version deleted."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_FAILED_PUBLISHING="%s Joomla Versions failed publishing."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_FAILED_PUBLISHING_1="%s Joomla Version failed publishing."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_FEATURED="%s Joomla Versions featured."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_FEATURED_1="%s Joomla Version featured."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_PUBLISHED="%s Joomla Versions published."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_PUBLISHED_1="%s Joomla Version published."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_TRASHED="%s Joomla Versions trashed."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_TRASHED_1="%s Joomla Version trashed."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_UNFEATURED="%s Joomla Versions unfeatured."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_UNFEATURED_1="%s Joomla Version unfeatured."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_N_ITEMS_UNPUBLISHED="%s Joomla Versions unpublished."
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."
COM_RELEASE_CHECKING_JOOMLA_VERSION_CREATED_BY_LABEL="Created By"
COM_RELEASE_CHECKING_JOOMLA_VERSION_CREATED_DATE_DESC="The date this Joomla Version was created."
COM_RELEASE_CHECKING_JOOMLA_VERSION_CREATED_DATE_LABEL="Created Date"
COM_RELEASE_CHECKING_JOOMLA_VERSION_DETAILS="Details"
COM_RELEASE_CHECKING_JOOMLA_VERSION_EDIT="Editing the Joomla Version"
COM_RELEASE_CHECKING_JOOMLA_VERSION_ERROR_UNIQUE_ALIAS="Another Joomla Version has the same alias."
COM_RELEASE_CHECKING_JOOMLA_VERSION_ID="Id"
COM_RELEASE_CHECKING_JOOMLA_VERSION_MODIFIED_BY_DESC="The last user that modified this Joomla Version."
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"
COM_RELEASE_CHECKING_JOOMLA_VERSION_NAME_MESSAGE="Error! Please add name here."
COM_RELEASE_CHECKING_JOOMLA_VERSION_NEW="A New Joomla Version"
COM_RELEASE_CHECKING_JOOMLA_VERSION_ORDERING_LABEL="Ordering"
COM_RELEASE_CHECKING_JOOMLA_VERSION_PERMISSION="Permissions"
COM_RELEASE_CHECKING_JOOMLA_VERSION_PUBLISHING="Publishing"
COM_RELEASE_CHECKING_JOOMLA_VERSION_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Joomla Version to customise the alias."
COM_RELEASE_CHECKING_JOOMLA_VERSION_STATUS="Status"
COM_RELEASE_CHECKING_JOOMLA_VERSION_VERSION_DESC="A count of the number of times this Joomla Version has been revised."
COM_RELEASE_CHECKING_JOOMLA_VERSION_VERSION_LABEL="Version"
COM_RELEASE_CHECKING_KEEP_ORIGINAL_ACCESS="- Keep Original Access -"
COM_RELEASE_CHECKING_KEEP_ORIGINAL_CATEGORY="- Keep Original Category -"
COM_RELEASE_CHECKING_KEEP_ORIGINAL_STATE="- Keep Original State -"
COM_RELEASE_CHECKING_LICENSE="License"
COM_RELEASE_CHECKING_NEW="New"
COM_RELEASE_CHECKING_NOT_FOUND_OR_ACCESS_DENIED="Not found or access denied!"
COM_RELEASE_CHECKING_NO_ACCESS_GRANTED="No Access Granted!"
COM_RELEASE_CHECKING_PUBLISHED="Published"
COM_RELEASE_CHECKING_RELEASE_CHECK="Release Check"
COM_RELEASE_CHECKING_RELEASE_CHECKS="Release Checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_ACCESS="Release Checks Access"
COM_RELEASE_CHECKING_RELEASE_CHECKS_ACCESS_DESC="Allows the users in this group to access access release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_BATCH_OPTIONS="Batch process the selected Release Checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_BATCH_TIP="All changes will be applied to all selected Release Checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_BATCH_USE="Release Checks Batch Use"
COM_RELEASE_CHECKING_RELEASE_CHECKS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_CREATE="Release Checks Create"
COM_RELEASE_CHECKING_RELEASE_CHECKS_CREATE_DESC="Allows the users in this group to create create release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_DASHBOARD_LIST="Release Checks Dashboard List"
COM_RELEASE_CHECKING_RELEASE_CHECKS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of release check"
COM_RELEASE_CHECKING_RELEASE_CHECKS_DELETE="Release Checks Delete"
COM_RELEASE_CHECKING_RELEASE_CHECKS_DELETE_DESC="Allows the users in this group to delete delete release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_DETAILS="Details"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT="Release Checks Edit"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_ACCESS="Release Checks Edit Access"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_ACCESS_DESC="Allows the users in this group to change the access of the edit access release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_BY="Release Checks Edit Created By"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_DATE="Release Checks Edit Created Date"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_DESC="Allows the users in this group to edit the release check"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_OWN="Release Checks Edit Own"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_OWN_DESC="Allows the users in this group to edit edit own release checks created by them"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_STATE="Release Checks Edit State"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_STATE_DESC="Allows the users in this group to update the state of the release check"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_VERSION="Release Checks Edit Version"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EXPORT="Release Checks Export"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EXPORT_DESC="Allows the users in this group to export export release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_IMPORT="Release Checks Import"
COM_RELEASE_CHECKING_RELEASE_CHECKS_IMPORT_DESC="Allows the users in this group to import import release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_ARCHIVED="%s Release Checks archived."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_ARCHIVED_1="%s Release Check archived."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_CHECKED_IN_0="No Release Check successfully checked in."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_CHECKED_IN_1="%d Release Check successfully checked in."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_CHECKED_IN_MORE="%d Release Checks successfully checked in."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_DELETED="%s Release Checks deleted."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_DELETED_1="%s Release Check deleted."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_FAILED_PUBLISHING="%s Release Checks failed publishing."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_FAILED_PUBLISHING_1="%s Release Check failed publishing."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_FEATURED="%s Release Checks featured."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_FEATURED_1="%s Release Check featured."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_PUBLISHED="%s Release Checks published."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_PUBLISHED_1="%s Release Check published."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_TRASHED="%s Release Checks trashed."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_TRASHED_1="%s Release Check trashed."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_UNFEATURED="%s Release Checks unfeatured."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_UNFEATURED_1="%s Release Check unfeatured."
COM_RELEASE_CHECKING_RELEASE_CHECKS_N_ITEMS_UNPUBLISHED="%s Release Checks unpublished."
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"
COM_RELEASE_CHECKING_RELEASE_CHECK_CREATED_DATE_DESC="The date this Release Check was created."
COM_RELEASE_CHECKING_RELEASE_CHECK_CREATED_DATE_LABEL="Created Date"
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."
COM_RELEASE_CHECKING_RELEASE_CHECK_MODIFIED_BY_LABEL="Modified By"
COM_RELEASE_CHECKING_RELEASE_CHECK_MODIFIED_DATE_DESC="The date this Release Check was modified."
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"
COM_RELEASE_CHECKING_RELEASE_CHECK_PUBLISHING="Publishing"
COM_RELEASE_CHECKING_RELEASE_CHECK_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Release Check to customise the alias."
COM_RELEASE_CHECKING_RELEASE_CHECK_STATUS="Status"
COM_RELEASE_CHECKING_RELEASE_CHECK_SUCCESSFUL="Successful"
COM_RELEASE_CHECKING_RELEASE_CHECK_UNDECIDED="Undecided"
COM_RELEASE_CHECKING_RELEASE_CHECK_VERSION_DESC="A count of the number of times this Release Check has been revised."
COM_RELEASE_CHECKING_RELEASE_CHECK_VERSION_LABEL="Version"
COM_RELEASE_CHECKING_SAVE_SUCCESS="Great! Item successfully saved."
COM_RELEASE_CHECKING_SAVE_WARNING="The value already existed so please select another."
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_TYPE_ACTION="Action"
COM_RELEASE_CHECKING_TYPE_CONTEXT="Context"
COM_RELEASE_CHECKING_TYPE_JOOMLA_VERSION="Joomla Version"
COM_RELEASE_CHECKING_TYPE_RELEASE_CHECK="Release Check"
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_MUST_FIRST_SELECT_THE_JOOMLA_VERSION_BEING_TESTED="You must first select the Joomla version being tested!"

View File

@ -0,0 +1,83 @@
COM_RELEASE_CHECKING="Track Release Checking"
COM_RELEASE_CHECKING_ACTIONS_ACCESS="Actions Access"
COM_RELEASE_CHECKING_ACTIONS_ACCESS_DESC="Allows the users in this group to access access actions"
COM_RELEASE_CHECKING_ACTIONS_BATCH_USE="Actions Batch Use"
COM_RELEASE_CHECKING_ACTIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch actions"
COM_RELEASE_CHECKING_ACTIONS_EDIT_VERSION="Actions Edit Version"
COM_RELEASE_CHECKING_ACTIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version actions"
COM_RELEASE_CHECKING_ACTIONS_EXPORT="Actions Export"
COM_RELEASE_CHECKING_ACTIONS_EXPORT_DESC="Allows the users in this group to export export actions"
COM_RELEASE_CHECKING_ACTIONS_IMPORT="Actions Import"
COM_RELEASE_CHECKING_ACTIONS_IMPORT_DESC="Allows the users in this group to import import actions"
COM_RELEASE_CHECKING_CONFIGURATION="Track Release Checking Configuration"
COM_RELEASE_CHECKING_CONFIG_ACTIVATE="Activate"
COM_RELEASE_CHECKING_CONFIG_DEACTIVATE="Deactivate"
COM_RELEASE_CHECKING_CONFIG_EXPORT_TEXT_ONLY_DESCRIPTION="This option enables the export of string/text instead of linked IDs in all admin views that have an export option."
COM_RELEASE_CHECKING_CONFIG_EXPORT_TEXT_ONLY_LABEL="Export Text Only"
COM_RELEASE_CHECKING_CONFIG_EXPORT_TEXT_ONLY_TAB_DESCRIPTION="Here are some extra option to adjust the export behavior of admin views."
COM_RELEASE_CHECKING_CONFIG_EXPORT_TEXT_ONLY_TAB_LABEL="Export Options"
COM_RELEASE_CHECKING_CONTEXTS_ACCESS="Contexts Access"
COM_RELEASE_CHECKING_CONTEXTS_ACCESS_DESC="Allows the users in this group to access access contexts"
COM_RELEASE_CHECKING_CONTEXTS_BATCH_USE="Contexts Batch Use"
COM_RELEASE_CHECKING_CONTEXTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch contexts"
COM_RELEASE_CHECKING_CONTEXTS_EDIT_VERSION="Contexts Edit Version"
COM_RELEASE_CHECKING_CONTEXTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version contexts"
COM_RELEASE_CHECKING_CONTEXTS_EXPORT="Contexts Export"
COM_RELEASE_CHECKING_CONTEXTS_EXPORT_DESC="Allows the users in this group to export export contexts"
COM_RELEASE_CHECKING_CONTEXTS_IMPORT="Contexts Import"
COM_RELEASE_CHECKING_CONTEXTS_IMPORT_DESC="Allows the users in this group to import import contexts"
COM_RELEASE_CHECKING_EDIT_CREATED_BY="Edit Created By"
COM_RELEASE_CHECKING_EDIT_CREATED_BY_DESC="Allows users in this group to edit created by."
COM_RELEASE_CHECKING_EDIT_CREATED_DATE="Edit Created Date"
COM_RELEASE_CHECKING_EDIT_CREATED_DATE_DESC="Allows users in this group to edit created date."
COM_RELEASE_CHECKING_EDIT_VERSIONS="Edit Version"
COM_RELEASE_CHECKING_EDIT_VERSIONS_DESC="Allows users in this group to edit versions."
COM_RELEASE_CHECKING_EXPORT_DATA="Export Data"
COM_RELEASE_CHECKING_EXPORT_DATA_DESC="Allows users in this group to export data."
COM_RELEASE_CHECKING_IMPORT_DATA="Import Data"
COM_RELEASE_CHECKING_IMPORT_DATA_DESC="Allows users in this group to import data."
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_ACCESS="Joomla Versions Access"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_ACCESS_DESC="Allows the users in this group to access access joomla versions"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_BATCH_USE="Joomla Versions Batch Use"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla versions"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_EDIT_VERSION="Joomla Versions Edit Version"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla versions"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_EXPORT="Joomla Versions Export"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_EXPORT_DESC="Allows the users in this group to export export joomla versions"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_IMPORT="Joomla Versions Import"
COM_RELEASE_CHECKING_JOOMLA_VERSIONS_IMPORT_DESC="Allows the users in this group to import import joomla versions"
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_MENU="Track Release Checking"
COM_RELEASE_CHECKING_RELEASE_CHECKS_ACCESS="Release Checks Access"
COM_RELEASE_CHECKING_RELEASE_CHECKS_ACCESS_DESC="Allows the users in this group to access access release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_BATCH_USE="Release Checks Batch Use"
COM_RELEASE_CHECKING_RELEASE_CHECKS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_CREATE="Release Checks Create"
COM_RELEASE_CHECKING_RELEASE_CHECKS_CREATE_DESC="Allows the users in this group to create create release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_DASHBOARD_LIST="Release Checks Dashboard List"
COM_RELEASE_CHECKING_RELEASE_CHECKS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of release check"
COM_RELEASE_CHECKING_RELEASE_CHECKS_DELETE="Release Checks Delete"
COM_RELEASE_CHECKING_RELEASE_CHECKS_DELETE_DESC="Allows the users in this group to delete delete release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT="Release Checks Edit"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_ACCESS="Release Checks Edit Access"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_ACCESS_DESC="Allows the users in this group to change the access of the edit access release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_BY="Release Checks Edit Created By"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_DATE="Release Checks Edit Created Date"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_DESC="Allows the users in this group to edit the release check"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_OWN="Release Checks Edit Own"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_OWN_DESC="Allows the users in this group to edit edit own release checks created by them"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_STATE="Release Checks Edit State"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_STATE_DESC="Allows the users in this group to update the state of the release check"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_VERSION="Release Checks Edit Version"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EXPORT="Release Checks Export"
COM_RELEASE_CHECKING_RELEASE_CHECKS_EXPORT_DESC="Allows the users in this group to export export release checks"
COM_RELEASE_CHECKING_RELEASE_CHECKS_IMPORT="Release Checks Import"
COM_RELEASE_CHECKING_RELEASE_CHECKS_IMPORT_DESC="Allows the users in this group to import import release checks"
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_USE_BATCH="Use Batch"
COM_RELEASE_CHECKING_USE_BATCH_DESC="Allows users in this group to use batch copy/update method."

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +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(
'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; ?>

View File

@ -0,0 +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(
'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; ?>

View File

@ -0,0 +1,40 @@
<?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; ?>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +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(
'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; ?>

View File

@ -0,0 +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(
'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; ?>

View File

@ -0,0 +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('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; ?>

View File

@ -0,0 +1,40 @@
<?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; ?>

View File

@ -0,0 +1,40 @@
<?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; ?>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +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(
'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; ?>

View File

@ -0,0 +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(
'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; ?>

1
admin/layouts/index.html Normal file
View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +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(
'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; ?>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +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(
'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; ?>

View File

@ -0,0 +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(
'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; ?>

View File

@ -0,0 +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(
'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; ?>

View File

@ -0,0 +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',
'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; ?>

View File

@ -0,0 +1,40 @@
<?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; ?>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +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(
'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; ?>

View File

@ -0,0 +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(
'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; ?>

950
admin/models/action.php Normal file
View File

@ -0,0 +1,950 @@
<?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_checking Action Model
*/
class Release_checkingModelAction extends JModelAdmin
{
/**
* The tab layout fields array.
*
* @var array
*/
protected $tabLayoutFields = array(
'details' => array(
'left' => array(
'context'
),
'fullwidth' => array(
'description'
),
'above' => array(
'name',
'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
$options['load_data'] = $loadData;
// check if xpath was set in options
$xpath = false;
if (isset($options['xpath']))
{
$xpath = $options['xpath'];
unset($options['xpath']);
}
// check if clear form was set in options
$clear = false;
if (isset($options['clear']))
{
$clear = $options['clear'];
unset($options['clear']);
}
// Get the form.
$form = $this->loadForm('com_release_checking.action', 'action', $options, $clear, $xpath);
if (empty($form))
{
return false;
}
$jinput = JFactory::getApplication()->input;
// The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
if ($jinput->get('a_id'))
{
$id = $jinput->get('a_id', 0, 'INT');
}
// The back end uses id so we use that the rest of the time and set it to 0 by default.
else
{
$id = $jinput->get('id', 0, 'INT');
}
$user = JFactory::getUser();
// Check for existing item.
// Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('core.edit.state', 'com_release_checking.action.' . (int) $id))
|| ($id == 0 && !$user->authorise('core.edit.state', 'com_release_checking')))
{
// Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true');
// Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset');
}
// If this is a new item insure the greated by is set.
if (0 == $id)
{
// Set the created_by to this user
$form->setValue('created_by', null, $user->id);
}
// Modify the form based on Edit Creaded By access controls.
if (!$user->authorise('core.edit.created_by', 'com_release_checking'))
{
// Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
// Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true');
// Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
// Modify the form based on Edit Creaded Date access controls.
if (!$user->authorise('core.edit.created', 'com_release_checking'))
{
// Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
// Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset');
}
// Only load these values if no id is found
if (0 == $id)
{
// Set redirected view name
$redirectedView = $jinput->get('ref', null, 'STRING');
// Set field name (or fall back to view name)
$redirectedField = $jinput->get('field', $redirectedView, 'STRING');
// Set redirected view id
$redirectedId = $jinput->get('refid', 0, 'INT');
// Set field id (or fall back to redirected view id)
$redirectedValue = $jinput->get('field_id', $redirectedId, 'INT');
if (0 != $redirectedValue && $redirectedField)
{
// Now set the local-redirected field default value
$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)
{
if (!empty($record->id))
{
if ($record->published != -2)
{
return;
}
$user = JFactory::getUser();
// 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)
{
$user = JFactory::getUser();
$recordId = (!empty($record->id)) ? $record->id : 0;
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('core.edit.state', 'com_release_checking.action.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
return false;
}
}
// 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')
{
// 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;
}
/**
* Method to get the unique fields of this table.
*
* @return mixed An array of field names, boolean false if none is set.
*
* @since 3.0
*/
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;
}
/**
* Batch copy items to a new category or current.
*
* @param integer $values The new values.
* @param array $pks An array of row IDs.
* @param array $contexts An array of item contexts.
*
* @return mixed An array of new IDs on success, boolean false on failure.
*
* @since 12.2
*/
protected function batchCopy($values, $pks, $contexts)
{
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->canDo = Release_checkingHelper::getActions('action');
}
if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch'))
{
return false;
}
// get list of unique fields
$uniqueFields = $this->getUniqueFields();
// remove move_copy from array
unset($values['move_copy']);
// make sure published is set
if (!isset($values['published']))
{
$values['published'] = 0;
}
elseif (isset($values['published']) && !$this->canDo->get('core.edit.state'))
{
$values['published'] = 0;
}
$newIds = array();
// Parent exists so let's proceed
while (!empty($pks))
{
// Pop the first ID off the stack
$pk = array_shift($pks);
$this->table->reset();
// only allow copy if user may edit this item.
if (!$this->user->authorise('core.edit', $contexts[$pk]))
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name);
// insert all set values
if (Release_checkingHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
if (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}
}
}
// update all unique fields
if (Release_checkingHelper::checkArray($uniqueFields))
{
foreach ($uniqueFields as $uniqueField)
{
$this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
}
}
// Reset the ID because we are making a copy
$this->table->id = 0;
// TODO: Deal with ordering?
// $this->table->ordering = 1;
// Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
return false;
}
if (!empty($this->type))
{
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
// Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
return false;
}
// Get the new item ID
$newId = $this->table->get('id');
// Add the new ID to the array
$newIds[$pk] = $newId;
}
// Clean the cache
$this->cleanCache();
return $newIds;
}
/**
* Batch move items to a new category
*
* @param integer $value The new category ID.
* @param array $pks An array of row IDs.
* @param array $contexts An array of item contexts.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 12.2
*/
protected function batchMove($values, $pks, $contexts)
{
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->canDo = Release_checkingHelper::getActions('action');
}
if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('core.edit.state'))
{
unset($values['published']);
}
// remove move_copy from array
unset($values['move_copy']);
// Parent exists so we proceed
foreach ($pks as $pk)
{
if (!$this->user->authorise('core.edit', $contexts[$pk]))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
// insert all set values.
if (Release_checkingHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
// Do special action for access.
if ('access' === $key && strlen($value) > 0)
{
$this->table->$key = $value;
}
elseif (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}
}
}
// Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
return false;
}
if (!empty($this->type))
{
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
// Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
return false;
}
}
// Clean the cache
$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;
}
// Alter the name for save as copy
if ($input->get('task') === 'save2copy')
{
$origTable = clone $this->getTable();
$origTable->load($input->getInt('id'));
if ($data['name'] == $origTable->name)
{
list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']);
$data['name'] = $name;
$data['alias'] = $alias;
}
else
{
if ($data['alias'] == $origTable->alias)
{
$data['alias'] = '';
}
}
$data['published'] = 0;
}
// Automatic handling of alias for empty fields
if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0)
{
if ($data['alias'] == null || empty($data['alias']))
{
if (JFactory::getConfig()->get('unicodeslugs') == 1)
{
$data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']);
}
else
{
$data['alias'] = JFilterOutput::stringURLSafe($data['name']);
}
$table = JTable::getInstance('action', 'release_checkingTable');
if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0))
{
$msg = JText::_('COM_RELEASE_CHECKING_ACTION_SAVE_WARNING');
}
$data['alias'] = $this->_generateNewTitle($data['alias']);
if (isset($msg))
{
JFactory::getApplication()->enqueueMessage($msg, 'warning');
}
}
}
// Alter the unique field for save as copy
if ($input->get('task') === 'save2copy')
{
// Automatic handling of other unique fields
$uniqueFields = $this->getUniqueFields();
if (Release_checkingHelper::checkArray($uniqueFields))
{
foreach ($uniqueFields as $uniqueField)
{
$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;
}
/**
* Method to change the title/s & alias.
*
* @param string $alias The alias.
* @param string/array $title The title.
*
* @return array/string Contains the modified title/s and/or alias.
*
*/
protected function _generateNewTitle($alias, $title = null)
{
// Alter the title/s & alias
$table = $this->getTable();
while ($table->load(array('alias' => $alias)))
{
// Check if this is an array of titles
if (Release_checkingHelper::checkArray($title))
{
foreach($title as $nr => &$_title)
{
$_title = StringHelper::increment($_title);
}
}
// Make sure we have a title
elseif ($title)
{
$title = StringHelper::increment($title);
}
$alias = StringHelper::increment($alias, 'dash');
}
// Check if this is an array of titles
if (Release_checkingHelper::checkArray($title))
{
$title[] = $alias;
return $title;
}
// Make sure we have a title
elseif ($title)
{
return array($title, $alias);
}
// We only had an alias
return $alias;
}
}

374
admin/models/actions.php Normal file
View File

@ -0,0 +1,374 @@
<?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(
'a.id','id',
'a.published','published',
'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;
}
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_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()
{
// 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()
{
// Get the user object.
$user = JFactory::getUser();
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select('a.*');
// From the release_checking_item table
$query->from($db->quoteName('#__release_checking_action', 'a'));
// From the release_checking_context table.
$query->select($db->quoteName('g.name','context_name'));
$query->join('LEFT', $db->quoteName('#__release_checking_context', 'g') . ' ON (' . $db->quoteName('a.context') . ' = ' . $db->quoteName('g.id') . ')');
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published))
{
$query->where('a.published = ' . (int) $published);
}
elseif ($published === '')
{
$query->where('(a.published = 0 OR a.published = 1)');
}
// Join over the asset groups.
$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'))
{
$query->where('a.access = ' . (int) $access);
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_release_checking'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
// Filter by search.
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0)
{
$query->where('a.id = ' . (int) substr($search, 3));
}
else
{
$search = $db->quote('%' . $db->escape($search) . '%');
$query->where('(a.name LIKE '.$search.' OR a.context LIKE '.$search.' OR g.name LIKE '.$search.' OR a.description LIKE '.$search.')');
}
}
// Filter by Name.
if ($name = $this->getState('filter.name'))
{
$query->where('a.name = ' . $db->quote($db->escape($name)));
}
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'desc');
if ($orderCol != '')
{
$query->order($db->escape($orderCol . ' ' . $orderDirn));
}
return $query;
}
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
{
// setup the query
if (($pks_size = Release_checkingHelper::checkArray($pks)) !== false || 'bulk' === $pks)
{
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (!isset($user) || !Release_checkingHelper::checkObject($user))
{
$user = JFactory::getUser();
}
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select('a.*');
// From the release_checking_action table
$query->from($db->quoteName('#__release_checking_action', 'a'));
// The bulk export path
if ('bulk' === $pks)
{
$query->where('a.id > 0');
}
// A large array of ID's will not work out well
elseif ($pks_size > 500)
{
// Use lowest ID
$query->where('a.id >= ' . (int) min($pks));
// Use highest ID
$query->where('a.id <= ' . (int) max($pks));
}
// The normal default path
else
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// Get global switch to activate text only export
$export_text_only = JComponentHelper::getParams('com_release_checking')->get('export_text_only', 0);
// Add these queries only if text only is required
if ($export_text_only)
{
// From the release_checking_context table.
$query->select($db->quoteName('g.name','context'));
$query->join('LEFT', $db->quoteName('#__release_checking_context', 'g') . ' ON (' . $db->quoteName('a.context') . ' = ' . $db->quoteName('g.id') . ')');
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_release_checking'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
// Order the results by ordering
$query->order('a.id desc');
// Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$items = $db->loadObjectList();
// Set values to display correctly.
if (Release_checkingHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
// unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);
unset($item->checked_out_time);
}
}
// Add headers to items array.
$headers = $this->getExImPortHeaders();
if (Release_checkingHelper::checkObject($headers))
{
array_unshift($items,$headers);
}
return $items;
}
}
return false;
}
/**
* Method to get header.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExImPortHeaders()
{
// Get a db connection.
$db = JFactory::getDbo();
// get the columns
$columns = $db->getTableColumns("#__release_checking_action");
if (Release_checkingHelper::checkArray($columns))
{
// remove the headers you don't import/export.
unset($columns['asset_id']);
unset($columns['checked_out']);
unset($columns['checked_out_time']);
$headers = new stdClass();
foreach ($columns as $column => $type)
{
$headers->{$column} = $column;
}
return $headers;
}
return false;
}
/**
* 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');
$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);
}
/**
* Build an SQL query to checkin all items left checked out longer then a set time.
*
* @return a bool
*
*/
protected function checkInNow()
{
// Get set check in time
$time = JComponentHelper::getParams('com_release_checking')->get('check_in');
if ($time)
{
// Get a db connection.
$db = JFactory::getDbo();
// reset query
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__release_checking_action'));
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
// Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql();
// reset query
$query = $db->getQuery(true);
// Fields to update.
$fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0'
);
// Conditions for which records should be updated.
$conditions = array(
$db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\''
);
// Check table
$query->update($db->quoteName('#__release_checking_action'))->set($fields)->where($conditions);
$db->setQuery($query);
$db->execute();
}
}
return false;
}
}

96
admin/models/ajax.php Normal file
View File

@ -0,0 +1,96 @@
<?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');
}
// Used in release_check
public function getAction($context, $joomlaVersion, $currentId)
{
// return array
$result = array('removed_ids' => array(), 'ids' => array());
// Get a db connection.
$db = JFactory::getDbo();
// Get the user object.
$user_id = JFactory::getUser()->get('id', 0);
// we first get what is already set
$query = $db->getQuery(true);
$query->select($db->quoteName( array('r.action') ));
$query->from($db->quoteName('#__release_checking_release_check', 'r'));
// we also filter out the actions this user already did on this context
$query->where($db->quoteName('r.created_by') . ' = ' . (int) $user_id);
$query->where($db->quoteName('r.context') . ' = ' . (int) $context);
$query->where($db->quoteName('r.joomla_version') . ' = ' . (int) $joomlaVersion);
if ($currentId > 0)
{
$query->where($db->quoteName('r.id') . ' != ' . (int) $currentId);
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$result['removed_ids'] = $db->loadColumn();
}
// Create a new query object.
$query = $db->getQuery(true);
$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']))
{
$query->where($db->quoteName('a.id') . ' NOT IN (' . implode(', ', $result['removed_ids']) . ')');
}
// check for context and action
$query->where($db->quoteName('a.context') . ' = '. (int) $context);
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$result['ids'] = $db->loadColumn();
}
return $result;
}
public function getActionDescription($action)
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName( array('a.description') ));
$query->from($db->quoteName('#__release_checking_action', 'a'));
// check for context and action
$query->where($db->quoteName('a.id') . ' = ' . (int) $action);
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
return $db->loadResult();
}
return false;
}
}

946
admin/models/context.php Normal file
View File

@ -0,0 +1,946 @@
<?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_checking Context Model
*/
class Release_checkingModelContext extends JModelAdmin
{
/**
* The tab layout fields array.
*
* @var array
*/
protected $tabLayoutFields = array(
'details' => array(
'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.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
$options['load_data'] = $loadData;
// check if xpath was set in options
$xpath = false;
if (isset($options['xpath']))
{
$xpath = $options['xpath'];
unset($options['xpath']);
}
// check if clear form was set in options
$clear = false;
if (isset($options['clear']))
{
$clear = $options['clear'];
unset($options['clear']);
}
// Get the form.
$form = $this->loadForm('com_release_checking.context', 'context', $options, $clear, $xpath);
if (empty($form))
{
return false;
}
$jinput = JFactory::getApplication()->input;
// The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
if ($jinput->get('a_id'))
{
$id = $jinput->get('a_id', 0, 'INT');
}
// The back end uses id so we use that the rest of the time and set it to 0 by default.
else
{
$id = $jinput->get('id', 0, 'INT');
}
$user = JFactory::getUser();
// Check for existing item.
// Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('core.edit.state', 'com_release_checking.context.' . (int) $id))
|| ($id == 0 && !$user->authorise('core.edit.state', 'com_release_checking')))
{
// Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true');
// Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset');
}
// If this is a new item insure the greated by is set.
if (0 == $id)
{
// Set the created_by to this user
$form->setValue('created_by', null, $user->id);
}
// Modify the form based on Edit Creaded By access controls.
if (!$user->authorise('core.edit.created_by', 'com_release_checking'))
{
// Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
// Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true');
// Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
// Modify the form based on Edit Creaded Date access controls.
if (!$user->authorise('core.edit.created', 'com_release_checking'))
{
// Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
// Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset');
}
// Only load these values if no id is found
if (0 == $id)
{
// Set redirected view name
$redirectedView = $jinput->get('ref', null, 'STRING');
// Set field name (or fall back to view name)
$redirectedField = $jinput->get('field', $redirectedView, 'STRING');
// Set redirected view id
$redirectedId = $jinput->get('refid', 0, 'INT');
// Set field id (or fall back to redirected view id)
$redirectedValue = $jinput->get('field_id', $redirectedId, 'INT');
if (0 != $redirectedValue && $redirectedField)
{
// Now set the local-redirected field default value
$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)
{
if (!empty($record->id))
{
if ($record->published != -2)
{
return;
}
$user = JFactory::getUser();
// 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)
{
$user = JFactory::getUser();
$recordId = (!empty($record->id)) ? $record->id : 0;
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('core.edit.state', 'com_release_checking.context.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
return false;
}
}
// 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')
{
// 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;
}
/**
* Method to get the unique fields of this table.
*
* @return mixed An array of field names, boolean false if none is set.
*
* @since 3.0
*/
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;
}
/**
* Batch copy items to a new category or current.
*
* @param integer $values The new values.
* @param array $pks An array of row IDs.
* @param array $contexts An array of item contexts.
*
* @return mixed An array of new IDs on success, boolean false on failure.
*
* @since 12.2
*/
protected function batchCopy($values, $pks, $contexts)
{
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->canDo = Release_checkingHelper::getActions('context');
}
if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch'))
{
return false;
}
// get list of unique fields
$uniqueFields = $this->getUniqueFields();
// remove move_copy from array
unset($values['move_copy']);
// make sure published is set
if (!isset($values['published']))
{
$values['published'] = 0;
}
elseif (isset($values['published']) && !$this->canDo->get('core.edit.state'))
{
$values['published'] = 0;
}
$newIds = array();
// Parent exists so let's proceed
while (!empty($pks))
{
// Pop the first ID off the stack
$pk = array_shift($pks);
$this->table->reset();
// only allow copy if user may edit this item.
if (!$this->user->authorise('core.edit', $contexts[$pk]))
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name);
// insert all set values
if (Release_checkingHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
if (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}
}
}
// update all unique fields
if (Release_checkingHelper::checkArray($uniqueFields))
{
foreach ($uniqueFields as $uniqueField)
{
$this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
}
}
// Reset the ID because we are making a copy
$this->table->id = 0;
// TODO: Deal with ordering?
// $this->table->ordering = 1;
// Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
return false;
}
if (!empty($this->type))
{
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
// Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
return false;
}
// Get the new item ID
$newId = $this->table->get('id');
// Add the new ID to the array
$newIds[$pk] = $newId;
}
// Clean the cache
$this->cleanCache();
return $newIds;
}
/**
* Batch move items to a new category
*
* @param integer $value The new category ID.
* @param array $pks An array of row IDs.
* @param array $contexts An array of item contexts.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 12.2
*/
protected function batchMove($values, $pks, $contexts)
{
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->canDo = Release_checkingHelper::getActions('context');
}
if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('core.edit.state'))
{
unset($values['published']);
}
// remove move_copy from array
unset($values['move_copy']);
// Parent exists so we proceed
foreach ($pks as $pk)
{
if (!$this->user->authorise('core.edit', $contexts[$pk]))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
// insert all set values.
if (Release_checkingHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
// Do special action for access.
if ('access' === $key && strlen($value) > 0)
{
$this->table->$key = $value;
}
elseif (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}
}
}
// Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
return false;
}
if (!empty($this->type))
{
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
// Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
return false;
}
}
// Clean the cache
$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;
}
// Alter the name for save as copy
if ($input->get('task') === 'save2copy')
{
$origTable = clone $this->getTable();
$origTable->load($input->getInt('id'));
if ($data['name'] == $origTable->name)
{
list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']);
$data['name'] = $name;
$data['alias'] = $alias;
}
else
{
if ($data['alias'] == $origTable->alias)
{
$data['alias'] = '';
}
}
$data['published'] = 0;
}
// Automatic handling of alias for empty fields
if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0)
{
if ($data['alias'] == null || empty($data['alias']))
{
if (JFactory::getConfig()->get('unicodeslugs') == 1)
{
$data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']);
}
else
{
$data['alias'] = JFilterOutput::stringURLSafe($data['name']);
}
$table = JTable::getInstance('context', 'release_checkingTable');
if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0))
{
$msg = JText::_('COM_RELEASE_CHECKING_CONTEXT_SAVE_WARNING');
}
$data['alias'] = $this->_generateNewTitle($data['alias']);
if (isset($msg))
{
JFactory::getApplication()->enqueueMessage($msg, 'warning');
}
}
}
// Alter the unique field for save as copy
if ($input->get('task') === 'save2copy')
{
// Automatic handling of other unique fields
$uniqueFields = $this->getUniqueFields();
if (Release_checkingHelper::checkArray($uniqueFields))
{
foreach ($uniqueFields as $uniqueField)
{
$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;
}
/**
* Method to change the title/s & alias.
*
* @param string $alias The alias.
* @param string/array $title The title.
*
* @return array/string Contains the modified title/s and/or alias.
*
*/
protected function _generateNewTitle($alias, $title = null)
{
// Alter the title/s & alias
$table = $this->getTable();
while ($table->load(array('alias' => $alias)))
{
// Check if this is an array of titles
if (Release_checkingHelper::checkArray($title))
{
foreach($title as $nr => &$_title)
{
$_title = StringHelper::increment($_title);
}
}
// Make sure we have a title
elseif ($title)
{
$title = StringHelper::increment($title);
}
$alias = StringHelper::increment($alias, 'dash');
}
// Check if this is an array of titles
if (Release_checkingHelper::checkArray($title))
{
$title[] = $alias;
return $title;
}
// Make sure we have a title
elseif ($title)
{
return array($title, $alias);
}
// We only had an alias
return $alias;
}
}

357
admin/models/contexts.php Normal file
View File

@ -0,0 +1,357 @@
<?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(
'a.id','id',
'a.published','published',
'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()
{
// 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()
{
// Get the user object.
$user = JFactory::getUser();
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select('a.*');
// From the release_checking_item table
$query->from($db->quoteName('#__release_checking_context', 'a'));
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published))
{
$query->where('a.published = ' . (int) $published);
}
elseif ($published === '')
{
$query->where('(a.published = 0 OR a.published = 1)');
}
// Join over the asset groups.
$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'))
{
$query->where('a.access = ' . (int) $access);
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_release_checking'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
// Filter by search.
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0)
{
$query->where('a.id = ' . (int) substr($search, 3));
}
else
{
$search = $db->quote('%' . $db->escape($search) . '%');
$query->where('(a.name LIKE '.$search.')');
}
}
// Filter by Name.
if ($name = $this->getState('filter.name'))
{
$query->where('a.name = ' . $db->quote($db->escape($name)));
}
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'desc');
if ($orderCol != '')
{
$query->order($db->escape($orderCol . ' ' . $orderDirn));
}
return $query;
}
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
{
// setup the query
if (($pks_size = Release_checkingHelper::checkArray($pks)) !== false || 'bulk' === $pks)
{
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (!isset($user) || !Release_checkingHelper::checkObject($user))
{
$user = JFactory::getUser();
}
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select('a.*');
// From the release_checking_context table
$query->from($db->quoteName('#__release_checking_context', 'a'));
// The bulk export path
if ('bulk' === $pks)
{
$query->where('a.id > 0');
}
// A large array of ID's will not work out well
elseif ($pks_size > 500)
{
// Use lowest ID
$query->where('a.id >= ' . (int) min($pks));
// Use highest ID
$query->where('a.id <= ' . (int) max($pks));
}
// The normal default path
else
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// Get global switch to activate text only export
$export_text_only = JComponentHelper::getParams('com_release_checking')->get('export_text_only', 0);
// Implement View Level Access
if (!$user->authorise('core.options', 'com_release_checking'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
// Order the results by ordering
$query->order('a.id desc');
// Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$items = $db->loadObjectList();
// Set values to display correctly.
if (Release_checkingHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
// unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);
unset($item->checked_out_time);
}
}
// Add headers to items array.
$headers = $this->getExImPortHeaders();
if (Release_checkingHelper::checkObject($headers))
{
array_unshift($items,$headers);
}
return $items;
}
}
return false;
}
/**
* Method to get header.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExImPortHeaders()
{
// Get a db connection.
$db = JFactory::getDbo();
// get the columns
$columns = $db->getTableColumns("#__release_checking_context");
if (Release_checkingHelper::checkArray($columns))
{
// remove the headers you don't import/export.
unset($columns['asset_id']);
unset($columns['checked_out']);
unset($columns['checked_out_time']);
$headers = new stdClass();
foreach ($columns as $column => $type)
{
$headers->{$column} = $column;
}
return $headers;
}
return false;
}
/**
* 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');
$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);
}
/**
* Build an SQL query to checkin all items left checked out longer then a set time.
*
* @return a bool
*
*/
protected function checkInNow()
{
// Get set check in time
$time = JComponentHelper::getParams('com_release_checking')->get('check_in');
if ($time)
{
// Get a db connection.
$db = JFactory::getDbo();
// reset query
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__release_checking_context'));
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
// Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql();
// reset query
$query = $db->getQuery(true);
// Fields to update.
$fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0'
);
// Conditions for which records should be updated.
$conditions = array(
$db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\''
);
// Check table
$query->update($db->quoteName('#__release_checking_context'))->set($fields)->where($conditions);
$db->setQuery($query);
$db->execute();
}
}
return false;
}
}

View File

@ -0,0 +1,173 @@
<?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
*/
public $type = 'actions';
/**
* Override to add new button
*
* @return string The field input markup.
*
* @since 3.2
*/
protected function getInput()
{
// see if we should add buttons
$set_button = $this->getAttribute('button');
// get html
$html = parent::getInput();
// if true set button
if ($set_button === 'true')
{
$button = array();
$script = array();
$button_code_name = $this->getAttribute('name');
// get the input from url
$app = JFactory::getApplication();
$jinput = $app->input;
// get the view name & id
$values = $jinput->getArray(array(
'id' => 'int',
'view' => 'word'
));
// check if new item
$ref = '';
$refJ = '';
if (!is_null($values['id']) && strlen($values['view']))
{
// only load referral if not new item.
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) JUri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;
$refJ .= '&return=' . $_return;
}
// get button label
$button_label = trim($button_code_name);
$button_label = preg_replace('/_+/', ' ', $button_label);
$button_label = preg_replace('/\s+/', ' ', $button_label);
$button_label = preg_replace("/[^A-Za-z ]/", '', $button_label);
$button_label = ucfirst(strtolower($button_label));
// get user object
$user = JFactory::getUser();
// only add if user allowed to create action
if ($user->authorise('core.create', 'com_release_checking') && $app->isAdmin()) // TODO for now only in admin area.
{
// build Create button
$button[] = '<a id="'.$button_code_name.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_RELEASE_CHECKING_CREATE_NEW_S', $button_label).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
href="index.php?option=com_release_checking&amp;view=action&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span></a>';
}
// only add if user allowed to edit action
if ($user->authorise('core.edit', 'com_release_checking') && $app->isAdmin()) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_RELEASE_CHECKING_EDIT_S', $button_label).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "
jQuery(document).ready(function() {
jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) {
e.preventDefault();
var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
".$button_code_name."Button(".$button_code_name."Value);
});
var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
".$button_code_name."Button(".$button_code_name."Value);
});
function ".$button_code_name."Button(value) {
if (value > 0) {
// hide the create button
jQuery('#".$button_code_name."Create').hide();
// show edit button
jQuery('#".$button_code_name."Edit').show();
var url = 'index.php?option=com_release_checking&view=actions&task=action.edit&id='+value+'".$refJ."';
jQuery('#".$button_code_name."Edit').attr('href', url);
} else {
// show the create button
jQuery('#".$button_code_name."Create').show();
// hide edit button
jQuery('#".$button_code_name."Edit').hide();
}
}";
}
// check if button was created for action field.
if (is_array($button) && count($button) > 0)
{
// Load the needed script.
$document = JFactory::getDocument();
$document->addScriptDeclaration(implode(' ',$script));
// return the button attached to input field.
return '<div class="input-append">' .$html . implode('',$button).'</div>';
}
}
return $html;
}
/**
* 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.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name'),array('id','action_name')));
$query->from($db->quoteName('#__release_checking_action', 'a'));
$query->join('LEFT', '#__release_checking_context AS b ON b.id = a.context');
$query->where($db->quoteName('a.published') . ' >= 1');
$query->order('a.name ASC');
// Implement View Level Access (if set in table)
if (!$user->authorise('core.options', 'com_release_checking'))
{
$columns = $db->getTableColumns('#__release_checking_action');
if(isset($columns['access']))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
}
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = JHtml::_('select.option', '', 'Select an action');
foreach($items as $item)
{
$options[] = JHtml::_('select.option', $item->id, $item->action_name);
}
}
return $options;
}
}

View File

@ -0,0 +1,172 @@
<?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
*/
public $type = 'contexts';
/**
* Override to add new button
*
* @return string The field input markup.
*
* @since 3.2
*/
protected function getInput()
{
// see if we should add buttons
$set_button = $this->getAttribute('button');
// get html
$html = parent::getInput();
// if true set button
if ($set_button === 'true')
{
$button = array();
$script = array();
$button_code_name = $this->getAttribute('name');
// get the input from url
$app = JFactory::getApplication();
$jinput = $app->input;
// get the view name & id
$values = $jinput->getArray(array(
'id' => 'int',
'view' => 'word'
));
// check if new item
$ref = '';
$refJ = '';
if (!is_null($values['id']) && strlen($values['view']))
{
// only load referral if not new item.
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) JUri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;
$refJ .= '&return=' . $_return;
}
// get button label
$button_label = trim($button_code_name);
$button_label = preg_replace('/_+/', ' ', $button_label);
$button_label = preg_replace('/\s+/', ' ', $button_label);
$button_label = preg_replace("/[^A-Za-z ]/", '', $button_label);
$button_label = ucfirst(strtolower($button_label));
// get user object
$user = JFactory::getUser();
// only add if user allowed to create context
if ($user->authorise('core.create', 'com_release_checking') && $app->isAdmin()) // TODO for now only in admin area.
{
// build Create button
$button[] = '<a id="'.$button_code_name.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_RELEASE_CHECKING_CREATE_NEW_S', $button_label).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
href="index.php?option=com_release_checking&amp;view=context&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span></a>';
}
// only add if user allowed to edit context
if ($user->authorise('core.edit', 'com_release_checking') && $app->isAdmin()) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_RELEASE_CHECKING_EDIT_S', $button_label).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "
jQuery(document).ready(function() {
jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) {
e.preventDefault();
var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
".$button_code_name."Button(".$button_code_name."Value);
});
var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
".$button_code_name."Button(".$button_code_name."Value);
});
function ".$button_code_name."Button(value) {
if (value > 0) {
// hide the create button
jQuery('#".$button_code_name."Create').hide();
// show edit button
jQuery('#".$button_code_name."Edit').show();
var url = 'index.php?option=com_release_checking&view=contexts&task=context.edit&id='+value+'".$refJ."';
jQuery('#".$button_code_name."Edit').attr('href', url);
} else {
// show the create button
jQuery('#".$button_code_name."Create').show();
// hide edit button
jQuery('#".$button_code_name."Edit').hide();
}
}";
}
// check if button was created for context field.
if (is_array($button) && count($button) > 0)
{
// Load the needed script.
$document = JFactory::getDocument();
$document->addScriptDeclaration(implode(' ',$script));
// return the button attached to input field.
return '<div class="input-append">' .$html . implode('',$button).'</div>';
}
}
return $html;
}
/**
* 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.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name'),array('id','context_name')));
$query->from($db->quoteName('#__release_checking_context', 'a'));
$query->where($db->quoteName('a.published') . ' >= 1');
$query->order('a.ordering ASC');
// Implement View Level Access (if set in table)
if (!$user->authorise('core.options', 'com_release_checking'))
{
$columns = $db->getTableColumns('#__release_checking_context');
if(isset($columns['access']))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
}
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = JHtml::_('select.option', '', 'Select an option');
foreach($items as $item)
{
$options[] = JHtml::_('select.option', $item->id, $item->context_name);
}
}
return $options;
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,172 @@
<?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
*/
public $type = 'joomlaversions';
/**
* Override to add new button
*
* @return string The field input markup.
*
* @since 3.2
*/
protected function getInput()
{
// see if we should add buttons
$set_button = $this->getAttribute('button');
// get html
$html = parent::getInput();
// if true set button
if ($set_button === 'true')
{
$button = array();
$script = array();
$button_code_name = $this->getAttribute('name');
// get the input from url
$app = JFactory::getApplication();
$jinput = $app->input;
// get the view name & id
$values = $jinput->getArray(array(
'id' => 'int',
'view' => 'word'
));
// check if new item
$ref = '';
$refJ = '';
if (!is_null($values['id']) && strlen($values['view']))
{
// only load referral if not new item.
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) JUri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;
$refJ .= '&return=' . $_return;
}
// get button label
$button_label = trim($button_code_name);
$button_label = preg_replace('/_+/', ' ', $button_label);
$button_label = preg_replace('/\s+/', ' ', $button_label);
$button_label = preg_replace("/[^A-Za-z ]/", '', $button_label);
$button_label = ucfirst(strtolower($button_label));
// get user object
$user = JFactory::getUser();
// only add if user allowed to create joomla_version
if ($user->authorise('core.create', 'com_release_checking') && $app->isAdmin()) // TODO for now only in admin area.
{
// build Create button
$button[] = '<a id="'.$button_code_name.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_RELEASE_CHECKING_CREATE_NEW_S', $button_label).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
href="index.php?option=com_release_checking&amp;view=joomla_version&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span></a>';
}
// only add if user allowed to edit joomla_version
if ($user->authorise('core.edit', 'com_release_checking') && $app->isAdmin()) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_RELEASE_CHECKING_EDIT_S', $button_label).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "
jQuery(document).ready(function() {
jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) {
e.preventDefault();
var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
".$button_code_name."Button(".$button_code_name."Value);
});
var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
".$button_code_name."Button(".$button_code_name."Value);
});
function ".$button_code_name."Button(value) {
if (value > 0) {
// hide the create button
jQuery('#".$button_code_name."Create').hide();
// show edit button
jQuery('#".$button_code_name."Edit').show();
var url = 'index.php?option=com_release_checking&view=joomla_versions&task=joomla_version.edit&id='+value+'".$refJ."';
jQuery('#".$button_code_name."Edit').attr('href', url);
} else {
// show the create button
jQuery('#".$button_code_name."Create').show();
// hide edit button
jQuery('#".$button_code_name."Edit').hide();
}
}";
}
// check if button was created for joomla_version field.
if (is_array($button) && count($button) > 0)
{
// Load the needed script.
$document = JFactory::getDocument();
$document->addScriptDeclaration(implode(' ',$script));
// return the button attached to input field.
return '<div class="input-append">' .$html . implode('',$button).'</div>';
}
}
return $html;
}
/**
* 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.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name'),array('id','joomla_version_name')));
$query->from($db->quoteName('#__release_checking_joomla_version', 'a'));
$query->where($db->quoteName('a.published') . ' >= 1');
$query->order('a.id DESC');
// Implement View Level Access (if set in table)
if (!$user->authorise('core.options', 'com_release_checking'))
{
$columns = $db->getTableColumns('#__release_checking_joomla_version');
if(isset($columns['access']))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
}
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = JHtml::_('select.option', '', 'Select an option');
foreach($items as $item)
{
$options[] = JHtml::_('select.option', $item->id, $item->joomla_version_name);
}
}
return $options;
}
}

View File

@ -0,0 +1,9 @@
/**
* @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
*/

View File

@ -0,0 +1,159 @@
<?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) -->
<field
name="id"
type="text" class="readonly" label="JGLOBAL_FIELD_ID_LABEL"
description ="JGLOBAL_FIELD_ID_DESC" size="10" default="0"
readonly="true"
/>
<!-- Date Created Field. Type: Calendar (joomla) -->
<field
name="created"
type="calendar"
label="COM_RELEASE_CHECKING_ACTION_CREATED_DATE_LABEL"
description="COM_RELEASE_CHECKING_ACTION_CREATED_DATE_DESC"
size="22"
format="%Y-%m-%d %H:%M:%S"
filter="user_utc"
/>
<!-- User Created Field. Type: User (joomla) -->
<field
name="created_by"
type="user"
label="COM_RELEASE_CHECKING_ACTION_CREATED_BY_LABEL"
description="COM_RELEASE_CHECKING_ACTION_CREATED_BY_DESC"
/>
<!-- Published Field. Type: List (joomla) -->
<field name="published" type="list" label="JSTATUS"
description="JFIELD_PUBLISHED_DESC" class="chzn-color-state"
filter="intval" size="1" default="1" >
<option value="1">
JPUBLISHED</option>
<option value="0">
JUNPUBLISHED</option>
<option value="2">
JARCHIVED</option>
<option value="-2">
JTRASHED</option>
</field>
<!-- Date Modified Field. Type: Calendar (joomla) -->
<field name="modified" type="calendar" class="readonly"
label="COM_RELEASE_CHECKING_ACTION_MODIFIED_DATE_LABEL" description="COM_RELEASE_CHECKING_ACTION_MODIFIED_DATE_DESC"
size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" />
<!-- User Modified Field. Type: User (joomla) -->
<field name="modified_by" type="user"
label="COM_RELEASE_CHECKING_ACTION_MODIFIED_BY_LABEL"
description="COM_RELEASE_CHECKING_ACTION_MODIFIED_BY_DESC"
class="readonly"
readonly="true"
filter="unset"
/>
<!-- Access Field. Type: Accesslevel (joomla) -->
<field name="access"
type="accesslevel"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
default="1"
required="false"
/>
<!-- Ordering Field. Type: Numbers (joomla) -->
<field
name="ordering"
type="number"
class="inputbox validate-ordering"
label="COM_RELEASE_CHECKING_ACTION_ORDERING_LABEL"
description=""
default="0"
size="6"
required="false"
/>
<!-- Version Field. Type: Text (joomla) -->
<field
name="version"
type="text"
class="readonly"
label="COM_RELEASE_CHECKING_ACTION_VERSION_LABEL"
description="COM_RELEASE_CHECKING_ACTION_VERSION_DESC"
size="6"
readonly="true"
filter="unset"
/>
<!-- Dynamic Fields. -->
<!-- Name Field. Type: Text. (joomla) -->
<field
type="text"
name="name"
label="COM_RELEASE_CHECKING_ACTION_NAME_LABEL"
size="40"
maxlength="150"
description="COM_RELEASE_CHECKING_ACTION_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_RELEASE_CHECKING_ACTION_NAME_MESSAGE"
hint="COM_RELEASE_CHECKING_ACTION_NAME_HINT"
/>
<!-- Context Field. Type: Contexts. (custom) -->
<field
type="contexts"
name="context"
label="COM_RELEASE_CHECKING_ACTION_CONTEXT_LABEL"
description="COM_RELEASE_CHECKING_ACTION_CONTEXT_DESCRIPTION"
class="list_class"
multiple="false"
required="true"
button="true"
/>
<!-- Description Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="description"
label="COM_RELEASE_CHECKING_ACTION_DESCRIPTION_LABEL"
rows="11"
cols="10"
description="COM_RELEASE_CHECKING_ACTION_DESCRIPTION_DESCRIPTION"
class="text_area span12"
filter="HTML"
hint="COM_RELEASE_CHECKING_ACTION_DESCRIPTION_HINT"
/>
<!-- Alias Field. Type: Text. (joomla) -->
<field
type="text"
name="alias"
label="COM_RELEASE_CHECKING_ACTION_ALIAS_LABEL"
description="JFIELD_ALIAS_DESC"
filter="STRING"
hint="COM_RELEASE_CHECKING_ACTION_ALIAS_HINT"
/>
</fieldset>
<!-- Access Control Fields. -->
<fieldset name="accesscontrol">
<!-- Asset Id Field. Type: Hidden (joomla) -->
<field
name="asset_id"
type="hidden"
filter="unset"
/>
<!-- Rules Field. Type: Rules (joomla) -->
<field
name="rules"
type="rules"
label="Permissions in relation to this action"
translate_label="false"
filter="rules"
validate="rules"
class="inputbox"
component="com_release_checking"
section="action"
/>
</fieldset>
</form>

View File

@ -0,0 +1,9 @@
/**
* @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
*/

View File

@ -0,0 +1,136 @@
<?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) -->
<field
name="id"
type="text" class="readonly" label="JGLOBAL_FIELD_ID_LABEL"
description ="JGLOBAL_FIELD_ID_DESC" size="10" default="0"
readonly="true"
/>
<!-- Date Created Field. Type: Calendar (joomla) -->
<field
name="created"
type="calendar"
label="COM_RELEASE_CHECKING_CONTEXT_CREATED_DATE_LABEL"
description="COM_RELEASE_CHECKING_CONTEXT_CREATED_DATE_DESC"
size="22"
format="%Y-%m-%d %H:%M:%S"
filter="user_utc"
/>
<!-- User Created Field. Type: User (joomla) -->
<field
name="created_by"
type="user"
label="COM_RELEASE_CHECKING_CONTEXT_CREATED_BY_LABEL"
description="COM_RELEASE_CHECKING_CONTEXT_CREATED_BY_DESC"
/>
<!-- Published Field. Type: List (joomla) -->
<field name="published" type="list" label="JSTATUS"
description="JFIELD_PUBLISHED_DESC" class="chzn-color-state"
filter="intval" size="1" default="1" >
<option value="1">
JPUBLISHED</option>
<option value="0">
JUNPUBLISHED</option>
<option value="2">
JARCHIVED</option>
<option value="-2">
JTRASHED</option>
</field>
<!-- Date Modified Field. Type: Calendar (joomla) -->
<field name="modified" type="calendar" class="readonly"
label="COM_RELEASE_CHECKING_CONTEXT_MODIFIED_DATE_LABEL" description="COM_RELEASE_CHECKING_CONTEXT_MODIFIED_DATE_DESC"
size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" />
<!-- User Modified Field. Type: User (joomla) -->
<field name="modified_by" type="user"
label="COM_RELEASE_CHECKING_CONTEXT_MODIFIED_BY_LABEL"
description="COM_RELEASE_CHECKING_CONTEXT_MODIFIED_BY_DESC"
class="readonly"
readonly="true"
filter="unset"
/>
<!-- Access Field. Type: Accesslevel (joomla) -->
<field name="access"
type="accesslevel"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
default="1"
required="false"
/>
<!-- Ordering Field. Type: Numbers (joomla) -->
<field
name="ordering"
type="number"
class="inputbox validate-ordering"
label="COM_RELEASE_CHECKING_CONTEXT_ORDERING_LABEL"
description=""
default="0"
size="6"
required="false"
/>
<!-- Version Field. Type: Text (joomla) -->
<field
name="version"
type="text"
class="readonly"
label="COM_RELEASE_CHECKING_CONTEXT_VERSION_LABEL"
description="COM_RELEASE_CHECKING_CONTEXT_VERSION_DESC"
size="6"
readonly="true"
filter="unset"
/>
<!-- Dynamic Fields. -->
<!-- Name Field. Type: Text. (joomla) -->
<field
type="text"
name="name"
label="COM_RELEASE_CHECKING_CONTEXT_NAME_LABEL"
size="40"
maxlength="150"
description="COM_RELEASE_CHECKING_CONTEXT_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_RELEASE_CHECKING_CONTEXT_NAME_MESSAGE"
hint="COM_RELEASE_CHECKING_CONTEXT_NAME_HINT"
/>
<!-- Alias Field. Type: Text. (joomla) -->
<field
type="text"
name="alias"
label="COM_RELEASE_CHECKING_CONTEXT_ALIAS_LABEL"
description="JFIELD_ALIAS_DESC"
filter="STRING"
hint="COM_RELEASE_CHECKING_CONTEXT_ALIAS_HINT"
/>
</fieldset>
<!-- Access Control Fields. -->
<fieldset name="accesscontrol">
<!-- Asset Id Field. Type: Hidden (joomla) -->
<field
name="asset_id"
type="hidden"
filter="unset"
/>
<!-- Rules Field. Type: Rules (joomla) -->
<field
name="rules"
type="rules"
label="Permissions in relation to this context"
translate_label="false"
filter="rules"
validate="rules"
class="inputbox"
component="com_release_checking"
section="context"
/>
</fieldset>
</form>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,9 @@
/**
* @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
*/

View File

@ -0,0 +1,136 @@
<?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) -->
<field
name="id"
type="text" class="readonly" label="JGLOBAL_FIELD_ID_LABEL"
description ="JGLOBAL_FIELD_ID_DESC" size="10" default="0"
readonly="true"
/>
<!-- Date Created Field. Type: Calendar (joomla) -->
<field
name="created"
type="calendar"
label="COM_RELEASE_CHECKING_JOOMLA_VERSION_CREATED_DATE_LABEL"
description="COM_RELEASE_CHECKING_JOOMLA_VERSION_CREATED_DATE_DESC"
size="22"
format="%Y-%m-%d %H:%M:%S"
filter="user_utc"
/>
<!-- User Created Field. Type: User (joomla) -->
<field
name="created_by"
type="user"
label="COM_RELEASE_CHECKING_JOOMLA_VERSION_CREATED_BY_LABEL"
description="COM_RELEASE_CHECKING_JOOMLA_VERSION_CREATED_BY_DESC"
/>
<!-- Published Field. Type: List (joomla) -->
<field name="published" type="list" label="JSTATUS"
description="JFIELD_PUBLISHED_DESC" class="chzn-color-state"
filter="intval" size="1" default="1" >
<option value="1">
JPUBLISHED</option>
<option value="0">
JUNPUBLISHED</option>
<option value="2">
JARCHIVED</option>
<option value="-2">
JTRASHED</option>
</field>
<!-- Date Modified Field. Type: Calendar (joomla) -->
<field name="modified" type="calendar" class="readonly"
label="COM_RELEASE_CHECKING_JOOMLA_VERSION_MODIFIED_DATE_LABEL" description="COM_RELEASE_CHECKING_JOOMLA_VERSION_MODIFIED_DATE_DESC"
size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" />
<!-- User Modified Field. Type: User (joomla) -->
<field name="modified_by" type="user"
label="COM_RELEASE_CHECKING_JOOMLA_VERSION_MODIFIED_BY_LABEL"
description="COM_RELEASE_CHECKING_JOOMLA_VERSION_MODIFIED_BY_DESC"
class="readonly"
readonly="true"
filter="unset"
/>
<!-- Access Field. Type: Accesslevel (joomla) -->
<field name="access"
type="accesslevel"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
default="1"
required="false"
/>
<!-- Ordering Field. Type: Numbers (joomla) -->
<field
name="ordering"
type="number"
class="inputbox validate-ordering"
label="COM_RELEASE_CHECKING_JOOMLA_VERSION_ORDERING_LABEL"
description=""
default="0"
size="6"
required="false"
/>
<!-- Version Field. Type: Text (joomla) -->
<field
name="version"
type="text"
class="readonly"
label="COM_RELEASE_CHECKING_JOOMLA_VERSION_VERSION_LABEL"
description="COM_RELEASE_CHECKING_JOOMLA_VERSION_VERSION_DESC"
size="6"
readonly="true"
filter="unset"
/>
<!-- Dynamic Fields. -->
<!-- Name Field. Type: Text. (joomla) -->
<field
type="text"
name="name"
label="COM_RELEASE_CHECKING_JOOMLA_VERSION_NAME_LABEL"
size="40"
maxlength="150"
description="COM_RELEASE_CHECKING_JOOMLA_VERSION_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_RELEASE_CHECKING_JOOMLA_VERSION_NAME_MESSAGE"
hint="COM_RELEASE_CHECKING_JOOMLA_VERSION_NAME_HINT"
/>
<!-- Alias Field. Type: Text. (joomla) -->
<field
type="text"
name="alias"
label="COM_RELEASE_CHECKING_JOOMLA_VERSION_ALIAS_LABEL"
description="JFIELD_ALIAS_DESC"
filter="STRING"
hint="COM_RELEASE_CHECKING_JOOMLA_VERSION_ALIAS_HINT"
/>
</fieldset>
<!-- Access Control Fields. -->
<fieldset name="accesscontrol">
<!-- Asset Id Field. Type: Hidden (joomla) -->
<field
name="asset_id"
type="hidden"
filter="unset"
/>
<!-- Rules Field. Type: Rules (joomla) -->
<field
name="rules"
type="rules"
label="Permissions in relation to this joomla_version"
translate_label="false"
filter="rules"
validate="rules"
class="inputbox"
component="com_release_checking"
section="joomla_version"
/>
</fieldset>
</form>

View File

@ -0,0 +1,148 @@
/**
* @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
*/
// set actions that are on the page
actions = {};
var action = 0;
jQuery(document).ready(function($)
{
// when it changes
$('#adminForm').on('change', '#jform_context',function (e) {
e.preventDefault();
getAction();
});
// should the version change we should check again
$('#adminForm').on('change', '#jform_joomla_version',function (e) {
e.preventDefault();
getAction();
});
// when it changes
$('#adminForm').on('change', '#jform_action',function (e) {
e.preventDefault();
getActionDescription();
});
// set buckets
jQuery("#jform_action option").each(function()
{
let key = jQuery(this).val();
let text = jQuery(this).text();
actions[key] = text;
});
action = jQuery('#jform_action').val();
// on load we also update the selection
getAction();
});
function getAction_server(context, joomla_version, current_id){
var getUrl = JRouter("index.php?option=com_release_checking&task=ajax.getAction&raw=true&format=json");
if(token.length > 0 && context > 0 && joomla_version > 0){
var request = token+'=1&context='+context+'&joomla_version='+joomla_version+'&current_id='+current_id;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getAction(){
jQuery("#loading").show();
// get country value if set
var current_id = jQuery('#jform_id').val();
var context = jQuery('#jform_context').val();
var joomla_version = jQuery('#jform_joomla_version').val();
// clear the selection
jQuery('#jform_action').find('option').remove().end();
jQuery('#jform_action').trigger('liszt:updated');
// make sure we have a value selected
if (context > 0 && joomla_version > 0) {
getAction_server(context, joomla_version, current_id).done(function(result) {
setAction(result);
jQuery("#loading").hide();
if (typeof actionButton !== 'undefined') {
// ensure button is correct
var action = jQuery('#jform_action').val();
actionButton(action);
}
});
} else {
// we do not have a value so we remove the spinner
jQuery("#loading").hide();
// if version is not selected give notice to select the version
if (context > 0 && joomla_version == 0) {
alert(Joomla.JText._('COM_RELEASE_CHECKING_YOU_MUST_FIRST_SELECT_THE_JOOMLA_VERSION_BEING_TESTED'));
jQuery('#jform_action').val(0);
jQuery('#jform_action').trigger('liszt:updated');
jQuery('#jform_context').val(0);
jQuery('#jform_context').trigger('liszt:updated');
}
}
}
function setAction(array){
if (array.ids && array.ids.length > 0) {
jQuery('#jform_action').append('<option value="">' + Joomla.JText._('COM_RELEASE_CHECKING_SELECT') + '...</option>');
jQuery.each(array.ids, function( i, id ) {
if (id in actions) {
jQuery('#jform_action').append('<option value="'+id+'">' + actions[id] + '</option>');
}
if (id == action) {
jQuery('#jform_action').val(id);
}
});
} else {
if (array.removed_ids && array.removed_ids.length > 0){
// this will only trigger if user has already tested all action in this context.
jQuery('#jform_action').append('<option value="">' + Joomla.JText._('COM_RELEASE_CHECKING_ALL_DONE_HERE_SELECT_THE_NEXT_CONTEXT') + '...</option>');
} else {
// this will only trigger if this context has not actions set
jQuery('#jform_action').append('<option value="">' + Joomla.JText._('COM_RELEASE_CHECKING_CREATE') + '...</option>');
}
}
jQuery('#jform_action').trigger('liszt:updated');
}
function getActionDescription_server(action){
var getUrl = JRouter("index.php?option=com_release_checking&task=ajax.getActionDescription&raw=true&format=json");
if(token.length > 0 && action > 0){
var request = token+'=1&action='+action;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getActionDescription(){
jQuery("#loading").show();
// get country value if set
var action = jQuery('#jform_action').val();
// make sure we have a value selected
if (action > 0) {
getActionDescription_server(action).done(function(result) {
setActionDescription(result);
jQuery("#loading").hide();
});
} else {
// we do not have a value so we remove the spinner
jQuery("#loading").hide();
}
}
function setActionDescription(desc){
// we can load the action description to the page
if (desc) {
console.log(desc);
} else {
console.log(desc);
}
}

View File

@ -0,0 +1,164 @@
<?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) -->
<field
name="id"
type="text" class="readonly" label="JGLOBAL_FIELD_ID_LABEL"
description ="JGLOBAL_FIELD_ID_DESC" size="10" default="0"
readonly="true"
/>
<!-- Date Created Field. Type: Calendar (joomla) -->
<field
name="created"
type="calendar"
label="COM_RELEASE_CHECKING_RELEASE_CHECK_CREATED_DATE_LABEL"
description="COM_RELEASE_CHECKING_RELEASE_CHECK_CREATED_DATE_DESC"
size="22"
format="%Y-%m-%d %H:%M:%S"
filter="user_utc"
/>
<!-- Published Field. Type: List (joomla) -->
<field name="published" type="list" label="JSTATUS"
description="JFIELD_PUBLISHED_DESC" class="chzn-color-state"
filter="intval" size="1" default="1" >
<option value="1">
JPUBLISHED</option>
<option value="0">
JUNPUBLISHED</option>
<option value="2">
JARCHIVED</option>
<option value="-2">
JTRASHED</option>
</field>
<!-- Date Modified Field. Type: Calendar (joomla) -->
<field name="modified" type="calendar" class="readonly"
label="COM_RELEASE_CHECKING_RELEASE_CHECK_MODIFIED_DATE_LABEL" description="COM_RELEASE_CHECKING_RELEASE_CHECK_MODIFIED_DATE_DESC"
size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" />
<!-- User Modified Field. Type: User (joomla) -->
<field name="modified_by" type="user"
label="COM_RELEASE_CHECKING_RELEASE_CHECK_MODIFIED_BY_LABEL"
description="COM_RELEASE_CHECKING_RELEASE_CHECK_MODIFIED_BY_DESC"
class="readonly"
readonly="true"
filter="unset"
/>
<!-- Access Field. Type: Accesslevel (joomla) -->
<field name="access"
type="accesslevel"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
default="1"
required="false"
/>
<!-- Ordering Field. Type: Numbers (joomla) -->
<field
name="ordering"
type="number"
class="inputbox validate-ordering"
label="COM_RELEASE_CHECKING_RELEASE_CHECK_ORDERING_LABEL"
description=""
default="0"
size="6"
required="false"
/>
<!-- Version Field. Type: Text (joomla) -->
<field
name="version"
type="text"
class="readonly"
label="COM_RELEASE_CHECKING_RELEASE_CHECK_VERSION_LABEL"
description="COM_RELEASE_CHECKING_RELEASE_CHECK_VERSION_DESC"
size="6"
readonly="true"
filter="unset"
/>
<!-- Dynamic Fields. -->
<!-- Context Field. Type: Contexts. (custom) -->
<field
type="contexts"
name="context"
label="COM_RELEASE_CHECKING_RELEASE_CHECK_CONTEXT_LABEL"
description="COM_RELEASE_CHECKING_RELEASE_CHECK_CONTEXT_DESCRIPTION"
class="list_class"
multiple="false"
required="true"
button="true"
/>
<!-- Action Field. Type: Actions. (custom) -->
<field
type="actions"
name="action"
label="COM_RELEASE_CHECKING_RELEASE_CHECK_ACTION_LABEL"
description="COM_RELEASE_CHECKING_RELEASE_CHECK_ACTION_DESCRIPTION"
class="list_class"
multiple="false"
default="0"
required="true"
button="true"
/>
<!-- Outcome Field. Type: List. (joomla) -->
<field
type="list"
name="outcome"
label="COM_RELEASE_CHECKING_RELEASE_CHECK_OUTCOME_LABEL"
description="COM_RELEASE_CHECKING_RELEASE_CHECK_OUTCOME_DESCRIPTION"
class="list_class"
multiple="false"
required="true"
default="2">
<!-- Option Set. -->
<option value="2">
COM_RELEASE_CHECKING_RELEASE_CHECK_UNDECIDED</option>
<option value="-1">
COM_RELEASE_CHECKING_RELEASE_CHECK_FAILURE</option>
<option value="1">
COM_RELEASE_CHECKING_RELEASE_CHECK_SUCCESSFUL</option>
</field>
<!-- Joomla_version Field. Type: Joomlaversions. (custom) -->
<field
type="joomlaversions"
name="joomla_version"
label="COM_RELEASE_CHECKING_RELEASE_CHECK_JOOMLA_VERSION_LABEL"
description="COM_RELEASE_CHECKING_RELEASE_CHECK_JOOMLA_VERSION_DESCRIPTION"
class="list_class"
multiple="false"
default="0"
required="true"
button="true"
/>
<!-- Created_by Field. Type: User. (joomla) -->
<field
type="user"
name="created_by"
label="COM_RELEASE_CHECKING_RELEASE_CHECK_CREATED_BY_LABEL"
description="COM_RELEASE_CHECKING_RELEASE_CHECK_CREATED_BY_DESCRIPTION"
/>
</fieldset>
<!-- Access Control Fields. -->
<fieldset name="accesscontrol">
<!-- Asset Id Field. Type: Hidden (joomla) -->
<field
name="asset_id"
type="hidden"
filter="unset"
/>
<!-- Rules Field. Type: Rules (joomla) -->
<field
name="rules"
type="rules"
label="Permissions in relation to this release_check"
translate_label="false"
filter="rules"
validate="rules"
class="inputbox"
component="com_release_checking"
section="release_check"
/>
</fieldset>
</form>

737
admin/models/import.php Normal file
View File

@ -0,0 +1,737 @@
<?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;
}
/**
* Check the extension
*
* @param string $file Name of the uploaded file
*
* @return boolean True on success
*
*/
protected function checkExtension($file)
{
// check the extention
switch(strtolower(pathinfo($file, PATHINFO_EXTENSION)))
{
case 'xls':
case 'ods':
case 'csv':
return true;
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));
}
}
/**
* Set the data from the spreadsheet to the database
*
* @param string $package Paths to the uploaded package file
*
* @return boolean false on failure
*
**/
protected function setData($package,$table,$target_headers)
{
if (Release_checkingHelper::checkArray($target_headers))
{
// make sure the file is loaded
Release_checkingHelper::composerAutoload('phpspreadsheet');
$jinput = JFactory::getApplication()->input;
foreach($target_headers as $header)
{
if (($column = $jinput->getString($header, false)) !== false ||
($column = $jinput->getString(strtolower($header), false)) !== false)
{
$data['target_headers'][$header] = $column;
}
else
{
$data['target_headers'][$header] = null;
}
}
// set the data
if(isset($package['dir']))
{
$inputFileType = IOFactory::identify($package['dir']);
$excelReader = IOFactory::createReader($inputFileType);
$excelReader->setReadDataOnly(true);
$excelObj = $excelReader->load($package['dir']);
$data['array'] = $excelObj->getActiveSheet()->toArray(null, true,true,true);
$excelObj->disconnectWorksheets();
unset($excelObj);
return $this->save($data, $table);
}
}
return false;
}
/**
* Save the data from the file to the database
*
* @param string $package Paths to the uploaded package file
*
* @return boolean false on failure
*
**/
protected function save($data,$table)
{
// import the data if there is any
if(Release_checkingHelper::checkArray($data['array']))
{
// get user object
$user = JFactory::getUser();
// remove header if it has headers
$id_key = $data['target_headers']['id'];
$published_key = $data['target_headers']['published'];
$ordering_key = $data['target_headers']['ordering'];
// get the first array set
$firstSet = reset($data['array']);
// check if first array is a header array and remove if true
if($firstSet[$id_key] == 'id' || $firstSet[$published_key] == 'published' || $firstSet[$ordering_key] == 'ordering')
{
array_shift($data['array']);
}
// make sure there is still values in array and that it was not only headers
if(Release_checkingHelper::checkArray($data['array']) && $user->authorise($table.'.import', 'com_release_checking') && $user->authorise('core.import', 'com_release_checking'))
{
// set target.
$target = array_flip($data['target_headers']);
// Get a db connection.
$db = JFactory::getDbo();
// set some defaults
$todayDate = JFactory::getDate()->toSql();
// get global action permissions
$canDo = Release_checkingHelper::getActions($table);
$canEdit = $canDo->get('core.edit');
$canState = $canDo->get('core.edit.state');
$canCreate = $canDo->get('core.create');
$hasAlias = $this->getAliasesUsed($table);
// prosses the data
foreach($data['array'] as $row)
{
$found = false;
if (isset($row[$id_key]) && is_numeric($row[$id_key]) && $row[$id_key] > 0)
{
// raw items import & update!
$query = $db->getQuery(true);
$query
->select('version')
->from($db->quoteName('#__release_checking_'.$table))
->where($db->quoteName('id') . ' = '. $db->quote($row[$id_key]));
// Reset the query using our newly populated query object.
$db->setQuery($query);
$db->execute();
$found = $db->getNumRows();
}
if($found && $canEdit)
{
// update item
$id = $row[$id_key];
$version = $db->loadResult();
// reset all buckets
$query = $db->getQuery(true);
$fields = array();
// Fields to update.
foreach($row as $key => $cell)
{
// ignore column
if ('IGNORE' == $target[$key])
{
continue;
}
// update modified
if ('modified_by' == $target[$key])
{
continue;
}
// update modified
if ('modified' == $target[$key])
{
continue;
}
// update version
if ('version' == $target[$key])
{
$cell = (int) $version + 1;
}
// verify publish authority
if ('published' == $target[$key] && !$canState)
{
continue;
}
// set to update array
if(in_array($key, $data['target_headers']) && is_numeric($cell))
{
$fields[] = $db->quoteName($target[$key]) . ' = ' . $cell;
}
elseif(in_array($key, $data['target_headers']) && is_string($cell))
{
$fields[] = $db->quoteName($target[$key]) . ' = ' . $db->quote($cell);
}
elseif(in_array($key, $data['target_headers']) && is_null($cell))
{
// if import data is null then set empty
$fields[] = $db->quoteName($target[$key]) . " = ''";
}
}
// load the defaults
$fields[] = $db->quoteName('modified_by') . ' = ' . $db->quote($user->id);
$fields[] = $db->quoteName('modified') . ' = ' . $db->quote($todayDate);
// Conditions for which records should be updated.
$conditions = array(
$db->quoteName('id') . ' = ' . $id
);
$query->update($db->quoteName('#__release_checking_'.$table))->set($fields)->where($conditions);
$db->setQuery($query);
$db->execute();
}
elseif ($canCreate)
{
// insert item
$query = $db->getQuery(true);
// reset all buckets
$columns = array();
$values = array();
$version = false;
// Insert columns. Insert values.
foreach($row as $key => $cell)
{
// ignore column
if ('IGNORE' == $target[$key])
{
continue;
}
// remove id
if ('id' == $target[$key])
{
continue;
}
// update created
if ('created_by' == $target[$key])
{
continue;
}
// update created
if ('created' == $target[$key])
{
continue;
}
// Make sure the alias is incremented
if ('alias' == $target[$key])
{
$cell = $this->getAlias($cell,$table);
}
// update version
if ('version' == $target[$key])
{
$cell = 1;
$version = true;
}
// set to insert array
if(in_array($key, $data['target_headers']) && is_numeric($cell))
{
$columns[] = $target[$key];
$values[] = $cell;
}
elseif(in_array($key, $data['target_headers']) && is_string($cell))
{
$columns[] = $target[$key];
$values[] = $db->quote($cell);
}
elseif(in_array($key, $data['target_headers']) && is_null($cell))
{
// if import data is null then set empty
$columns[] = $target[$key];
$values[] = "''";
}
}
// load the defaults
$columns[] = 'created_by';
$values[] = $db->quote($user->id);
$columns[] = 'created';
$values[] = $db->quote($todayDate);
if (!$version)
{
$columns[] = 'version';
$values[] = 1;
}
// Prepare the insert query.
$query
->insert($db->quoteName('#__release_checking_'.$table))
->columns($db->quoteName($columns))
->values(implode(',', $values));
// Set the query using our newly populated query object and execute it.
$db->setQuery($query);
$done = $db->execute();
if ($done)
{
$aId = $db->insertid();
// make sure the access of asset is set
Release_checkingHelper::setAsset($aId,$table);
}
}
else
{
return false;
}
}
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
admin/models/index.html Normal file
View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,944 @@
<?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_checking Joomla_version Model
*/
class Release_checkingModelJoomla_version extends JModelAdmin
{
/**
* The tab layout fields array.
*
* @var array
*/
protected $tabLayoutFields = array(
'details' => array(
'above' => array(
'name',
'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
$options['load_data'] = $loadData;
// check if xpath was set in options
$xpath = false;
if (isset($options['xpath']))
{
$xpath = $options['xpath'];
unset($options['xpath']);
}
// check if clear form was set in options
$clear = false;
if (isset($options['clear']))
{
$clear = $options['clear'];
unset($options['clear']);
}
// Get the form.
$form = $this->loadForm('com_release_checking.joomla_version', 'joomla_version', $options, $clear, $xpath);
if (empty($form))
{
return false;
}
$jinput = JFactory::getApplication()->input;
// The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
if ($jinput->get('a_id'))
{
$id = $jinput->get('a_id', 0, 'INT');
}
// The back end uses id so we use that the rest of the time and set it to 0 by default.
else
{
$id = $jinput->get('id', 0, 'INT');
}
$user = JFactory::getUser();
// Check for existing item.
// Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('core.edit.state', 'com_release_checking.joomla_version.' . (int) $id))
|| ($id == 0 && !$user->authorise('core.edit.state', 'com_release_checking')))
{
// Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true');
// Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset');
}
// If this is a new item insure the greated by is set.
if (0 == $id)
{
// Set the created_by to this user
$form->setValue('created_by', null, $user->id);
}
// Modify the form based on Edit Creaded By access controls.
if (!$user->authorise('core.edit.created_by', 'com_release_checking'))
{
// Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
// Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true');
// Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
// Modify the form based on Edit Creaded Date access controls.
if (!$user->authorise('core.edit.created', 'com_release_checking'))
{
// Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
// Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset');
}
// Only load these values if no id is found
if (0 == $id)
{
// Set redirected view name
$redirectedView = $jinput->get('ref', null, 'STRING');
// Set field name (or fall back to view name)
$redirectedField = $jinput->get('field', $redirectedView, 'STRING');
// Set redirected view id
$redirectedId = $jinput->get('refid', 0, 'INT');
// Set field id (or fall back to redirected view id)
$redirectedValue = $jinput->get('field_id', $redirectedId, 'INT');
if (0 != $redirectedValue && $redirectedField)
{
// Now set the local-redirected field default value
$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)
{
if (!empty($record->id))
{
if ($record->published != -2)
{
return;
}
$user = JFactory::getUser();
// 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)
{
$user = JFactory::getUser();
$recordId = (!empty($record->id)) ? $record->id : 0;
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('core.edit.state', 'com_release_checking.joomla_version.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
return false;
}
}
// 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')
{
// 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;
}
/**
* Method to get the unique fields of this table.
*
* @return mixed An array of field names, boolean false if none is set.
*
* @since 3.0
*/
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;
}
/**
* Batch copy items to a new category or current.
*
* @param integer $values The new values.
* @param array $pks An array of row IDs.
* @param array $contexts An array of item contexts.
*
* @return mixed An array of new IDs on success, boolean false on failure.
*
* @since 12.2
*/
protected function batchCopy($values, $pks, $contexts)
{
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->canDo = Release_checkingHelper::getActions('joomla_version');
}
if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch'))
{
return false;
}
// get list of unique fields
$uniqueFields = $this->getUniqueFields();
// remove move_copy from array
unset($values['move_copy']);
// make sure published is set
if (!isset($values['published']))
{
$values['published'] = 0;
}
elseif (isset($values['published']) && !$this->canDo->get('core.edit.state'))
{
$values['published'] = 0;
}
$newIds = array();
// Parent exists so let's proceed
while (!empty($pks))
{
// Pop the first ID off the stack
$pk = array_shift($pks);
$this->table->reset();
// only allow copy if user may edit this item.
if (!$this->user->authorise('core.edit', $contexts[$pk]))
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name);
// insert all set values
if (Release_checkingHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
if (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}
}
}
// update all unique fields
if (Release_checkingHelper::checkArray($uniqueFields))
{
foreach ($uniqueFields as $uniqueField)
{
$this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
}
}
// Reset the ID because we are making a copy
$this->table->id = 0;
// TODO: Deal with ordering?
// $this->table->ordering = 1;
// Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
return false;
}
if (!empty($this->type))
{
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
// Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
return false;
}
// Get the new item ID
$newId = $this->table->get('id');
// Add the new ID to the array
$newIds[$pk] = $newId;
}
// Clean the cache
$this->cleanCache();
return $newIds;
}
/**
* Batch move items to a new category
*
* @param integer $value The new category ID.
* @param array $pks An array of row IDs.
* @param array $contexts An array of item contexts.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 12.2
*/
protected function batchMove($values, $pks, $contexts)
{
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->canDo = Release_checkingHelper::getActions('joomla_version');
}
if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('core.edit.state'))
{
unset($values['published']);
}
// remove move_copy from array
unset($values['move_copy']);
// Parent exists so we proceed
foreach ($pks as $pk)
{
if (!$this->user->authorise('core.edit', $contexts[$pk]))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
// insert all set values.
if (Release_checkingHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
// Do special action for access.
if ('access' === $key && strlen($value) > 0)
{
$this->table->$key = $value;
}
elseif (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}
}
}
// Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
return false;
}
if (!empty($this->type))
{
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
// Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
return false;
}
}
// Clean the cache
$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;
}
// Alter the name for save as copy
if ($input->get('task') === 'save2copy')
{
$origTable = clone $this->getTable();
$origTable->load($input->getInt('id'));
if ($data['name'] == $origTable->name)
{
list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']);
$data['name'] = $name;
$data['alias'] = $alias;
}
else
{
if ($data['alias'] == $origTable->alias)
{
$data['alias'] = '';
}
}
$data['published'] = 0;
}
// Automatic handling of alias for empty fields
if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0)
{
if ($data['alias'] == null || empty($data['alias']))
{
if (JFactory::getConfig()->get('unicodeslugs') == 1)
{
$data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']);
}
else
{
$data['alias'] = JFilterOutput::stringURLSafe($data['name']);
}
$table = JTable::getInstance('joomla_version', 'release_checkingTable');
if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0))
{
$msg = JText::_('COM_RELEASE_CHECKING_JOOMLA_VERSION_SAVE_WARNING');
}
$data['alias'] = $this->_generateNewTitle($data['alias']);
if (isset($msg))
{
JFactory::getApplication()->enqueueMessage($msg, 'warning');
}
}
}
// Alter the unique field for save as copy
if ($input->get('task') === 'save2copy')
{
// Automatic handling of other unique fields
$uniqueFields = $this->getUniqueFields();
if (Release_checkingHelper::checkArray($uniqueFields))
{
foreach ($uniqueFields as $uniqueField)
{
$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;
}
/**
* Method to change the title/s & alias.
*
* @param string $alias The alias.
* @param string/array $title The title.
*
* @return array/string Contains the modified title/s and/or alias.
*
*/
protected function _generateNewTitle($alias, $title = null)
{
// Alter the title/s & alias
$table = $this->getTable();
while ($table->load(array('alias' => $alias)))
{
// Check if this is an array of titles
if (Release_checkingHelper::checkArray($title))
{
foreach($title as $nr => &$_title)
{
$_title = StringHelper::increment($_title);
}
}
// Make sure we have a title
elseif ($title)
{
$title = StringHelper::increment($title);
}
$alias = StringHelper::increment($alias, 'dash');
}
// Check if this is an array of titles
if (Release_checkingHelper::checkArray($title))
{
$title[] = $alias;
return $title;
}
// Make sure we have a title
elseif ($title)
{
return array($title, $alias);
}
// We only had an alias
return $alias;
}
}

View File

@ -0,0 +1,352 @@
<?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(
'a.id','id',
'a.published','published',
'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()
{
// 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()
{
// Get the user object.
$user = JFactory::getUser();
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select('a.*');
// From the release_checking_item table
$query->from($db->quoteName('#__release_checking_joomla_version', 'a'));
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published))
{
$query->where('a.published = ' . (int) $published);
}
elseif ($published === '')
{
$query->where('(a.published = 0 OR a.published = 1)');
}
// Join over the asset groups.
$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'))
{
$query->where('a.access = ' . (int) $access);
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_release_checking'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
// Filter by search.
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0)
{
$query->where('a.id = ' . (int) substr($search, 3));
}
else
{
$search = $db->quote('%' . $db->escape($search) . '%');
$query->where('(a.name LIKE '.$search.' OR a.alias LIKE '.$search.')');
}
}
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'desc');
if ($orderCol != '')
{
$query->order($db->escape($orderCol . ' ' . $orderDirn));
}
return $query;
}
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
{
// setup the query
if (($pks_size = Release_checkingHelper::checkArray($pks)) !== false || 'bulk' === $pks)
{
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (!isset($user) || !Release_checkingHelper::checkObject($user))
{
$user = JFactory::getUser();
}
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select('a.*');
// From the release_checking_joomla_version table
$query->from($db->quoteName('#__release_checking_joomla_version', 'a'));
// The bulk export path
if ('bulk' === $pks)
{
$query->where('a.id > 0');
}
// A large array of ID's will not work out well
elseif ($pks_size > 500)
{
// Use lowest ID
$query->where('a.id >= ' . (int) min($pks));
// Use highest ID
$query->where('a.id <= ' . (int) max($pks));
}
// The normal default path
else
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// Get global switch to activate text only export
$export_text_only = JComponentHelper::getParams('com_release_checking')->get('export_text_only', 0);
// Implement View Level Access
if (!$user->authorise('core.options', 'com_release_checking'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
// Order the results by ordering
$query->order('a.id desc');
// Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$items = $db->loadObjectList();
// Set values to display correctly.
if (Release_checkingHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
// unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);
unset($item->checked_out_time);
}
}
// Add headers to items array.
$headers = $this->getExImPortHeaders();
if (Release_checkingHelper::checkObject($headers))
{
array_unshift($items,$headers);
}
return $items;
}
}
return false;
}
/**
* Method to get header.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExImPortHeaders()
{
// Get a db connection.
$db = JFactory::getDbo();
// get the columns
$columns = $db->getTableColumns("#__release_checking_joomla_version");
if (Release_checkingHelper::checkArray($columns))
{
// remove the headers you don't import/export.
unset($columns['asset_id']);
unset($columns['checked_out']);
unset($columns['checked_out_time']);
$headers = new stdClass();
foreach ($columns as $column => $type)
{
$headers->{$column} = $column;
}
return $headers;
}
return false;
}
/**
* 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');
$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);
}
/**
* Build an SQL query to checkin all items left checked out longer then a set time.
*
* @return a bool
*
*/
protected function checkInNow()
{
// Get set check in time
$time = JComponentHelper::getParams('com_release_checking')->get('check_in');
if ($time)
{
// Get a db connection.
$db = JFactory::getDbo();
// reset query
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__release_checking_joomla_version'));
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
// Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql();
// reset query
$query = $db->getQuery(true);
// Fields to update.
$fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0'
);
// Conditions for which records should be updated.
$conditions = array(
$db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\''
);
// Check table
$query->update($db->quoteName('#__release_checking_joomla_version'))->set($fields)->where($conditions);
$db->setQuery($query);
$db->execute();
}
}
return false;
}
}

View File

@ -0,0 +1,915 @@
<?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_checking Release_check Model
*/
class Release_checkingModelRelease_check extends JModelAdmin
{
/**
* The tab layout fields array.
*
* @var array
*/
protected $tabLayoutFields = array(
'checking' => array(
'left' => array(
'context',
'action'
),
'right' => array(
'outcome'
),
'above' => array(
'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);
}
protected function getLatestJoomlaVersion()
{
// Get a db connection.
$db = JFactory::getDbo();
// we first get what is already set
$query = $db->getQuery(true);
$query->select($db->quoteName( array('a.id') ));
$query->from($db->quoteName('#__release_checking_joomla_version', 'a'));
// we also filter out the actions this user already did on this context
$query->order($db->quoteName('a.id') . ' DESC');
$query->setLimit(1);
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
return $db->loadResult();
}
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
$options['load_data'] = $loadData;
// check if xpath was set in options
$xpath = false;
if (isset($options['xpath']))
{
$xpath = $options['xpath'];
unset($options['xpath']);
}
// check if clear form was set in options
$clear = false;
if (isset($options['clear']))
{
$clear = $options['clear'];
unset($options['clear']);
}
// Get the form.
$form = $this->loadForm('com_release_checking.release_check', 'release_check', $options, $clear, $xpath);
if (empty($form))
{
return false;
}
$jinput = JFactory::getApplication()->input;
// The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
if ($jinput->get('a_id'))
{
$id = $jinput->get('a_id', 0, 'INT');
}
// The back end uses id so we use that the rest of the time and set it to 0 by default.
else
{
$id = $jinput->get('id', 0, 'INT');
}
$user = JFactory::getUser();
// Check for existing item.
// Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('core.edit.state', 'com_release_checking.release_check.' . (int) $id))
|| ($id == 0 && !$user->authorise('core.edit.state', 'com_release_checking')))
{
// Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true');
// Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset');
}
// If this is a new item insure the greated by is set.
if (0 == $id)
{
// Set the created_by to this user
$form->setValue('created_by', null, $user->id);
}
// Modify the form based on Edit Creaded By access controls.
if ($id != 0 && (!$user->authorise('release_check.edit.created_by', 'com_release_checking.release_check.' . (int) $id))
|| ($id == 0 && !$user->authorise('release_check.edit.created_by', 'com_release_checking')))
{
// Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
// Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true');
// Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
// Modify the form based on Edit Creaded Date access controls.
if ($id != 0 && (!$user->authorise('core.edit.created', 'com_release_checking.release_check.' . (int) $id))
|| ($id == 0 && !$user->authorise('core.edit.created', 'com_release_checking')))
{
// Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
// Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset');
}
// Modify the form based on Edit Access 'access' controls.
if ($id != 0 && (!$user->authorise('core.edit.access', 'com_release_checking.release_check.' . (int) $id))
|| ($id == 0 && !$user->authorise('core.edit.access', 'com_release_checking')))
{
// Disable fields for display.
$form->setFieldAttribute('access', 'disabled', 'true');
// Disable fields while saving.
$form->setFieldAttribute('access', 'filter', 'unset');
}
// Only load these values if no id is found
if (0 == $id)
{
// Set redirected view name
$redirectedView = $jinput->get('ref', null, 'STRING');
// Set field name (or fall back to view name)
$redirectedField = $jinput->get('field', $redirectedView, 'STRING');
// Set redirected view id
$redirectedId = $jinput->get('refid', 0, 'INT');
// Set field id (or fall back to redirected view id)
$redirectedValue = $jinput->get('field_id', $redirectedId, 'INT');
if (0 != $redirectedValue && $redirectedField)
{
// Now set the local-redirected field default value
$form->setValue($redirectedField, null, $redirectedValue);
}
}
// Only load the latest version on new items
if (0 == $id && ($joomla_version = $this->getLatestJoomlaVersion()) !== false)
{
$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)
{
if (!empty($record->id))
{
if ($record->published != -2)
{
return;
}
$user = JFactory::getUser();
// 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)
{
$user = JFactory::getUser();
$recordId = (!empty($record->id)) ? $record->id : 0;
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('core.edit.state', 'com_release_checking.release_check.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
return false;
}
}
// 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')
{
// 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;
}
/**
* Method to get the unique fields of this table.
*
* @return mixed An array of field names, boolean false if none is set.
*
* @since 3.0
*/
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;
}
/**
* Batch copy items to a new category or current.
*
* @param integer $values The new values.
* @param array $pks An array of row IDs.
* @param array $contexts An array of item contexts.
*
* @return mixed An array of new IDs on success, boolean false on failure.
*
* @since 12.2
*/
protected function batchCopy($values, $pks, $contexts)
{
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->canDo = Release_checkingHelper::getActions('release_check');
}
if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch'))
{
return false;
}
// get list of unique fields
$uniqueFields = $this->getUniqueFields();
// remove move_copy from array
unset($values['move_copy']);
// make sure published is set
if (!isset($values['published']))
{
$values['published'] = 0;
}
elseif (isset($values['published']) && !$this->canDo->get('core.edit.state'))
{
$values['published'] = 0;
}
$newIds = array();
// Parent exists so let's proceed
while (!empty($pks))
{
// Pop the first ID off the stack
$pk = array_shift($pks);
$this->table->reset();
// only allow copy if user may edit this item.
if (!$this->user->authorise('core.edit', $contexts[$pk]))
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
// Only for strings
if (Release_checkingHelper::checkString($this->table->context) && !is_numeric($this->table->context))
{
$this->table->context = $this->generateUnique('context',$this->table->context);
}
// insert all set values
if (Release_checkingHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
if (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}
}
}
// update all unique fields
if (Release_checkingHelper::checkArray($uniqueFields))
{
foreach ($uniqueFields as $uniqueField)
{
$this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
}
}
// Reset the ID because we are making a copy
$this->table->id = 0;
// TODO: Deal with ordering?
// $this->table->ordering = 1;
// Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
return false;
}
if (!empty($this->type))
{
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
// Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
return false;
}
// Get the new item ID
$newId = $this->table->get('id');
// Add the new ID to the array
$newIds[$pk] = $newId;
}
// Clean the cache
$this->cleanCache();
return $newIds;
}
/**
* Batch move items to a new category
*
* @param integer $value The new category ID.
* @param array $pks An array of row IDs.
* @param array $contexts An array of item contexts.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 12.2
*/
protected function batchMove($values, $pks, $contexts)
{
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->canDo = Release_checkingHelper::getActions('release_check');
}
if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('core.edit.state'))
{
unset($values['published']);
}
// remove move_copy from array
unset($values['move_copy']);
// Parent exists so we proceed
foreach ($pks as $pk)
{
if (!$this->user->authorise('core.edit', $contexts[$pk]))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
// insert all set values.
if (Release_checkingHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
// Do special action for access.
if ('access' === $key && strlen($value) > 0)
{
$this->table->$key = $value;
}
elseif (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}
}
}
// Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
return false;
}
if (!empty($this->type))
{
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
// Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
return false;
}
}
// Clean the cache
$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;
}
// Alter the unique field for save as copy
if ($input->get('task') === 'save2copy')
{
// Automatic handling of other unique fields
$uniqueFields = $this->getUniqueFields();
if (Release_checkingHelper::checkArray($uniqueFields))
{
foreach ($uniqueFields as $uniqueField)
{
$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;
}
/**
* Method to change the title
*
* @param string $title The title.
*
* @return array Contains the modified title and alias.
*
*/
protected function _generateNewTitle($title)
{
// Alter the title
$table = $this->getTable();
while ($table->load(array('title' => $title)))
{
$title = StringHelper::increment($title);
}
return $title;
}
}

View File

@ -0,0 +1,494 @@
<?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(
'a.id','id',
'a.published','published',
'a.ordering','ordering',
'a.created_by','created_by',
'a.modified_by','modified_by',
'g.name',
'h.name',
'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;
}
$context = $this->getUserStateFromRequest($this->context . '.filter.context', 'filter_context');
$this->setState('filter.context', $context);
$action = $this->getUserStateFromRequest($this->context . '.filter.action', 'filter_action');
$this->setState('filter.action', $action);
$outcome = $this->getUserStateFromRequest($this->context . '.filter.outcome', 'filter_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);
$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()
{
// check in items
$this->checkInNow();
// load parent items
$items = parent::getItems();
// Set values to display correctly.
if (Release_checkingHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !Release_checkingHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
if (!isset($_export) || !$_export)
{
$item->outcome_style = ($item->outcome == 1) ? "outcome-success" : (($item->outcome == -1) ? "outcome-failure" : "outcome-undecided");
}
}
}
// set selection value to a translatable value
if (Release_checkingHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
// convert outcome
$item->outcome = $this->selectionTranslation($item->outcome, 'outcome');
}
}
// return items
return $items;
}
/**
* Method to convert selection values to translatable string.
*
* @return translatable string
*/
public function selectionTranslation($value,$name)
{
// Array of outcome language strings
if ($name === 'outcome')
{
$outcomeArray = array(
2 => 'COM_RELEASE_CHECKING_RELEASE_CHECK_UNDECIDED',
-1 => 'COM_RELEASE_CHECKING_RELEASE_CHECK_FAILURE',
1 => 'COM_RELEASE_CHECKING_RELEASE_CHECK_SUCCESSFUL'
);
// Now check if value is found in this array
if (isset($outcomeArray[$value]) && Release_checkingHelper::checkString($outcomeArray[$value]))
{
return $outcomeArray[$value];
}
}
return $value;
}
/**
* 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.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select('a.*');
// From the release_checking_item table
$query->from($db->quoteName('#__release_checking_release_check', 'a'));
// From the release_checking_context table.
$query->select($db->quoteName('g.name','context_name'));
$query->join('LEFT', $db->quoteName('#__release_checking_context', 'g') . ' ON (' . $db->quoteName('a.context') . ' = ' . $db->quoteName('g.id') . ')');
// From the release_checking_action table.
$query->select($db->quoteName('h.name','action_name'));
$query->join('LEFT', $db->quoteName('#__release_checking_action', 'h') . ' ON (' . $db->quoteName('a.action') . ' = ' . $db->quoteName('h.id') . ')');
// From the release_checking_joomla_version table.
$query->select($db->quoteName('i.name','joomla_version_name'));
$query->join('LEFT', $db->quoteName('#__release_checking_joomla_version', 'i') . ' ON (' . $db->quoteName('a.joomla_version') . ' = ' . $db->quoteName('i.id') . ')');
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published))
{
$query->where('a.published = ' . (int) $published);
}
elseif ($published === '')
{
$query->where('(a.published = 0 OR a.published = 1)');
}
// Join over the asset groups.
$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'))
{
$query->where('a.access = ' . (int) $access);
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_release_checking'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
// Filter by search.
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0)
{
$query->where('a.id = ' . (int) substr($search, 3));
}
else
{
$search = $db->quote('%' . $db->escape($search) . '%');
$query->where('(a.context LIKE '.$search.' OR g.name LIKE '.$search.' OR a.action LIKE '.$search.' OR h.name LIKE '.$search.' OR a.outcome LIKE '.$search.' OR a.joomla_version LIKE '.$search.' OR i.name LIKE '.$search.' OR a.created_by LIKE '.$search.')');
}
}
// Filter by context.
if ($context = $this->getState('filter.context'))
{
$query->where('a.context = ' . $db->quote($db->escape($context)));
}
// Filter by action.
if ($action = $this->getState('filter.action'))
{
$query->where('a.action = ' . $db->quote($db->escape($action)));
}
// Filter by Outcome.
if ($outcome = $this->getState('filter.outcome'))
{
$query->where('a.outcome = ' . $db->quote($db->escape($outcome)));
}
// Filter by joomla_version.
if ($joomla_version = $this->getState('filter.joomla_version'))
{
$query->where('a.joomla_version = ' . $db->quote($db->escape($joomla_version)));
}
// Filter by Created_by.
if ($created_by = $this->getState('filter.created_by'))
{
$query->where('a.created_by = ' . $db->quote($db->escape($created_by)));
}
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'desc');
if ($orderCol != '')
{
$query->order($db->escape($orderCol . ' ' . $orderDirn));
}
return $query;
}
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
{
// setup the query
if (($pks_size = Release_checkingHelper::checkArray($pks)) !== false || 'bulk' === $pks)
{
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (!isset($user) || !Release_checkingHelper::checkObject($user))
{
$user = JFactory::getUser();
}
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select('a.*');
// From the release_checking_release_check table
$query->from($db->quoteName('#__release_checking_release_check', 'a'));
// The bulk export path
if ('bulk' === $pks)
{
$query->where('a.id > 0');
}
// A large array of ID's will not work out well
elseif ($pks_size > 500)
{
// Use lowest ID
$query->where('a.id >= ' . (int) min($pks));
// Use highest ID
$query->where('a.id <= ' . (int) max($pks));
}
// The normal default path
else
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// Get global switch to activate text only export
$export_text_only = JComponentHelper::getParams('com_release_checking')->get('export_text_only', 0);
// Add these queries only if text only is required
if ($export_text_only)
{
// From the release_checking_context table.
$query->select($db->quoteName('g.name','context'));
$query->join('LEFT', $db->quoteName('#__release_checking_context', 'g') . ' ON (' . $db->quoteName('a.context') . ' = ' . $db->quoteName('g.id') . ')');
// From the release_checking_action table.
$query->select($db->quoteName('h.name','action'));
$query->join('LEFT', $db->quoteName('#__release_checking_action', 'h') . ' ON (' . $db->quoteName('a.action') . ' = ' . $db->quoteName('h.id') . ')');
// From the release_checking_joomla_version table.
$query->select($db->quoteName('i.name','joomla_version'));
$query->join('LEFT', $db->quoteName('#__release_checking_joomla_version', 'i') . ' ON (' . $db->quoteName('a.joomla_version') . ' = ' . $db->quoteName('i.id') . ')');
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_release_checking'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
// Order the results by ordering
$query->order('a.id desc');
// Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$items = $db->loadObjectList();
// Set values to display correctly.
if (Release_checkingHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
if (!isset($_export) || !$_export)
{
$item->outcome_style = ($item->outcome == 1) ? "outcome-success" : (($item->outcome == -1) ? "outcome-failure" : "outcome-undecided");
}
// unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);
unset($item->checked_out_time);
}
}
// Add headers to items array.
$headers = $this->getExImPortHeaders();
if (Release_checkingHelper::checkObject($headers))
{
array_unshift($items,$headers);
}
// Add these translation only if text only is required
if ($export_text_only)
{
// set selection value to a translatable value
if (Release_checkingHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
// convert outcome
$item->outcome = $this->selectionTranslation($item->outcome, 'outcome');
}
}
}
return $items;
}
}
return false;
}
/**
* Method to get header.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExImPortHeaders()
{
// Get a db connection.
$db = JFactory::getDbo();
// get the columns
$columns = $db->getTableColumns("#__release_checking_release_check");
if (Release_checkingHelper::checkArray($columns))
{
// remove the headers you don't import/export.
unset($columns['asset_id']);
unset($columns['checked_out']);
unset($columns['checked_out_time']);
$headers = new stdClass();
foreach ($columns as $column => $type)
{
$headers->{$column} = $column;
}
return $headers;
}
return false;
}
/**
* 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');
$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);
}
/**
* Build an SQL query to checkin all items left checked out longer then a set time.
*
* @return a bool
*
*/
protected function checkInNow()
{
// Get set check in time
$time = JComponentHelper::getParams('com_release_checking')->get('check_in');
if ($time)
{
// Get a db connection.
$db = JFactory::getDbo();
// reset query
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__release_checking_release_check'));
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
// Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql();
// reset query
$query = $db->getQuery(true);
// Fields to update.
$fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0'
);
// Conditions for which records should be updated.
$conditions = array(
$db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\''
);
// Check table
$query->update($db->quoteName('#__release_checking_release_check'))->set($fields)->where($conditions);
$db->setQuery($query);
$db->execute();
}
}
return false;
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,36 @@
<?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();

1
admin/sql/index.html Normal file
View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,290 @@
CREATE TABLE IF NOT EXISTS `#__release_checking_release_check` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
`action` INT(11) NOT NULL DEFAULT 0,
`context` INT(11) NOT NULL DEFAULT 0,
`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,
`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',
`modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`checked_out` int(11) unsigned NOT NULL DEFAULT 0,
`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`version` INT(10) unsigned NOT NULL DEFAULT 1,
`hits` INT(10) unsigned NOT NULL DEFAULT 0,
`access` INT(10) unsigned NOT NULL DEFAULT 0,
`ordering` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `idx_context` (`context`),
KEY `idx_action` (`action`),
KEY `idx_outcome` (`outcome`),
KEY `idx_created_by` (`created_by`),
KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_modifiedby` (`modified_by`),
KEY `idx_state` (`published`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
CREATE TABLE IF NOT EXISTS `#__release_checking_joomla_version` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`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,
`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,
`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`checked_out` int(11) unsigned NOT NULL DEFAULT 0,
`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`version` INT(10) unsigned NOT NULL DEFAULT 1,
`hits` INT(10) unsigned NOT NULL DEFAULT 0,
`access` INT(10) unsigned NOT NULL DEFAULT 0,
`ordering` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `idx_name` (`name`),
KEY `idx_alias` (`alias`),
KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_createdby` (`created_by`),
KEY `idx_modifiedby` (`modified_by`),
KEY `idx_state` (`published`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
CREATE TABLE IF NOT EXISTS `#__release_checking_context` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`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,
`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,
`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`checked_out` int(11) unsigned NOT NULL DEFAULT 0,
`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`version` INT(10) unsigned NOT NULL DEFAULT 1,
`hits` INT(10) unsigned NOT NULL DEFAULT 0,
`access` INT(10) unsigned NOT NULL DEFAULT 0,
`ordering` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `idx_name` (`name`),
KEY `idx_alias` (`alias`),
KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_createdby` (`created_by`),
KEY `idx_modifiedby` (`modified_by`),
KEY `idx_state` (`published`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
CREATE TABLE IF NOT EXISTS `#__release_checking_action` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
`alias` CHAR(64) NOT NULL DEFAULT '',
`context` INT(11) NOT NULL DEFAULT 0,
`description` TEXT NOT NULL,
`name` VARCHAR(255) NOT NULL DEFAULT '',
`params` text NOT 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,
`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`checked_out` int(11) unsigned NOT NULL DEFAULT 0,
`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`version` INT(10) unsigned NOT NULL DEFAULT 1,
`hits` INT(10) unsigned NOT NULL DEFAULT 0,
`access` INT(10) unsigned NOT NULL DEFAULT 0,
`ordering` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `idx_name` (`name`),
KEY `idx_context` (`context`),
KEY `idx_alias` (`alias`),
KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_createdby` (`created_by`),
KEY `idx_modifiedby` (`modified_by`),
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),
(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'),
(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),
(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.';

View File

@ -0,0 +1,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`;

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

334
admin/tables/action.php Normal file
View File

@ -0,0 +1,334 @@
<?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)
{
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;
}
/**
* Generate a valid alias from title / date.
* Remains public to be able to check for duplicated alias before saving
*
* @return string
*/
public function generateAlias()
{
if (empty($this->alias))
{
$this->alias = $this->name;
}
$this->alias = JApplication::stringURLSafe($this->alias);
if (trim(str_replace('-', '', $this->alias)) == '')
{
$this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
}
return $this->alias;
}
}

334
admin/tables/context.php Normal file
View File

@ -0,0 +1,334 @@
<?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)
{
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;
}
/**
* Generate a valid alias from title / date.
* Remains public to be able to check for duplicated alias before saving
*
* @return string
*/
public function generateAlias()
{
if (empty($this->alias))
{
$this->alias = $this->name;
}
$this->alias = JApplication::stringURLSafe($this->alias);
if (trim(str_replace('-', '', $this->alias)) == '')
{
$this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
}
return $this->alias;
}
}

1
admin/tables/index.html Normal file
View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

Some files were not shown because too many files have changed in this diff Show More