Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/components/com_tjucm/administrator/access.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
<action name="core.type.createitem" title="COM_TJUCM_PERMISSION_TYPE_ITEM_CREATE" description="COM_TJUCM_PERMISSION_TYPE_ITEM_CREATE_DESC" />
<action name="core.type.importitem" title="COM_TJUCM_PERMISSION_TYPE_ITEM_IMPORT" description="COM_TJUCM_PERMISSION_TYPE_ITEM_IMPORT_DESC" />
<action name="core.type.viewitem" title="COM_TJUCM_PERMISSION_TYPE_ITEM_VIEW" description="COM_TJUCM_PERMISSION_TYPE_ITEM_VIEW_DESC" />
<action name="core.type.edititem" title="COM_TJUCM_PERMISSION_TYPE_ITEM_EDIT" description="COM_TJUCM_PERMISSION_TYPE_ITEM_EDIT_DESC" />
<action name="core.type.edititemstate" title="COM_TJUCM_PERMISSION_TYPE_ITEM_EDITSTATE" description="COM_TJUCM_PERMISSION_TYPE_ITEM_EDITSTATE_DESC" />
<action name="core.type.editownitem" title="COM_TJUCM_PERMISSION_TYPE_ITEM_EDITOWN" description="COM_TJUCM_PERMISSION_TYPE_ITEM_EDITOWN_DESC" />
<action name="core.type.deleteitem" title="COM_TJUCM_PERMISSION_TYPE_ITEM_DELETE" description="COM_TJUCM_PERMISSION_TYPE_ITEM_DELETE_DESC" />
<action name="core.type.deleteownitem" title="COM_TJUCM_PERMISSION_TYPE_ITEM_DELETEOWN" description="COM_TJUCM_PERMISSION_TYPE_ITEM_DELETEOWN_DESC" />
<action name="core.type.copyitem" title="COM_TJUCM_PERMISSION_TYPE_ITEM_COPYITEM" description="COM_TJUCM_PERMISSION_TYPE_ITEM_COPYITEM_DESC" />
</section>
</access>
6 changes: 0 additions & 6 deletions src/components/com_tjucm/administrator/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,4 @@
<fieldset name="permissions" description="JCONFIG_PERMISSIONS_DESC" label="JCONFIG_PERMISSIONS_LABEL">
<field name="rules" type="rules" component="com_tjucm" class="inputbox" filter="rules" validate="rules" label="JCONFIG_PERMISSIONS_LABEL" section="component" />
</fieldset>
<fieldset name="component" label="COM_TJUCM_COPY_ITEM_SETTING_LABEL">
<field name="tjqueue_copy_items" class="btn-group" type="radio" default="0" label="COM_TJUCM_USE_TJQUEUE_WHILE_COPY_ITEM" description="COM_TJUCM_USE_TJQUEUE_WHILE_COPY_ITEM_DESC">
<option value="0">COM_TJUCM_NO</option>
<option value="1">COM_TJUCM_YES</option>
</field>
</fieldset>
</config>
11 changes: 7 additions & 4 deletions src/components/com_tjucm/administrator/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,31 @@

// No direct access
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Filter\InputFilter;
use Joomla\CMS\Factory;

/**
* Class TjucmController
*
* @since 1.6
*/
class TjucmController extends JControllerLegacy
class TjucmController extends BaseController
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param mixed $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
* @param mixed $urlparams An array of safe url parameters and their variable types, for valid values see {@link InputFilter::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
$view = JFactory::getApplication()->input->getCmd('view', 'types');
JFactory::getApplication()->input->set('view', $view);
$view = Factory::getApplication()->input->getCmd('view', 'types');
Factory::getApplication()->input->set('view', $view);

parent::display($cachable, $urlparams);

Expand Down
79 changes: 42 additions & 37 deletions src/components/com_tjucm/administrator/controllers/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@

// No direct access
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Filesystem\File;

jimport('joomla.application.component.controllerform');

/**
* Item controller class.
*
* @since 1.6
*/
class TjucmControllerItem extends JControllerForm
class TjucmControllerItem extends FormController
{
/**
* Constructor
Expand All @@ -29,11 +34,11 @@ public function __construct()
{
$this->view_list = 'items';

$this->client = JFactory::getApplication()->input->get('client');
$this->client = Factory::getApplication()->input->get('client');

if (empty($this->client))
{
$this->client = JFactory::getApplication()->input->get('jform', array(), 'array')['client'];
$this->client = Factory::getApplication()->input->get('jform', array(), 'array')['client'];
}

parent::__construct();
Expand All @@ -59,10 +64,10 @@ public function apply()
*/
public function edit($key = null, $urlVar = null)
{
$input = JFactory::getApplication()->input;
$input = Factory::getApplication()->input;
$cid = $input->post->get('cid', array(), 'array');
$recordId = (int) (count($cid) ? $cid[0] : $input->getInt('id'));
$link = JRoute::_('index.php?option=com_tjucm&view=item&layout=edit&id=' . $recordId . '&client=' . $this->client, false);
$link = Route::_('index.php?option=com_tjucm&view=item&layout=edit&id=' . $recordId . '&client=' . $this->client, false);

$this->setRedirect($link);
}
Expand All @@ -82,11 +87,11 @@ public function add()
if (!$this->allowAdd())
{
// Set the internal error and also the redirect error.
$this->setError(JText::_('JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED'));
$this->setError(Text::_('JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED'));
$this->setMessage($this->getError(), 'error');

$this->setRedirect(
JRoute::_(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list . '&client=' . $this->client
. $this->getRedirectToListAppend(), false
)
Expand All @@ -96,11 +101,11 @@ public function add()
}

// Clear the record edit information from the session.
JFactory::getApplication()->setUserState($context . '.data', null);
Factory::getApplication()->setUserState($context . '.data', null);

// Redirect to the edit screen.
$this->setRedirect(
JRoute::_(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client
. $this->getRedirectToItemAppend(), false
)
Expand All @@ -120,7 +125,7 @@ public function add()
*/
public function cancel($key = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

$model = $this->getModel();
$table = $model->getTable();
Expand All @@ -141,11 +146,11 @@ public function cancel($key = null)
if ($model->checkin($recordId) === false)
{
// Check-in failed, go back to the record and display a notice.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
$this->setMessage($this->getError(), 'error');

$this->setRedirect(
JRoute::_(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client
. $this->getRedirectToItemAppend($recordId, $key), false
)
Expand All @@ -158,10 +163,10 @@ public function cancel($key = null)

// Clean the session data and redirect.
$this->releaseEditId($context, $recordId);
JFactory::getApplication()->setUserState($context . '.data', null);
Factory::getApplication()->setUserState($context . '.data', null);

$this->setRedirect(
JRoute::_(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list . '&client=' . $this->client
. $this->getRedirectToListAppend(), false
)
Expand All @@ -183,9 +188,9 @@ public function cancel($key = null)
public function save($key = null, $urlVar = null)
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
$lang = JFactory::getLanguage();
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
$app = Factory::getApplication();
$lang = Factory::getLanguage();
$model = $this->getModel();

// Set client value
Expand All @@ -194,11 +199,11 @@ public function save($key = null, $urlVar = null)
$table = $model->getTable();

// Get the user data.
$data = JFactory::getApplication()->input->get('jform', array(), 'array');
$data = Factory::getApplication()->input->get('jform', array(), 'array');
$all_jform_data = $data;

// Jform tweak - Get all posted data.
$post = JFactory::getApplication()->input->post;
$post = Factory::getApplication()->input->post;

$checkin = property_exists($table, 'checked_out');
$context = "$this->option.edit.$this->context";
Expand Down Expand Up @@ -228,11 +233,11 @@ public function save($key = null, $urlVar = null)
if ($checkin && $model->checkin($data[$key]) === false)
{
// Check-in failed. Go back to the item and display a notice.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
$this->setMessage($this->getError(), 'error');

$this->setRedirect(
JRoute::_(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client
. $this->getRedirectToItemAppend($recordId, $urlVar), false
)
Expand All @@ -250,11 +255,11 @@ public function save($key = null, $urlVar = null)
// Access check.
if (!$this->allowSave($data, $key))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'));
$this->setError(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'));
$this->setMessage($this->getError(), 'error');

$this->setRedirect(
JRoute::_(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list
. $this->getRedirectToListAppend(), false
)
Expand Down Expand Up @@ -301,7 +306,7 @@ public function save($key = null, $urlVar = null)

// Redirect back to the edit screen.
$this->setRedirect(
JRoute::_(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client
. $this->getRedirectToItemAppend($recordId, $urlVar), false
)
Expand All @@ -321,7 +326,7 @@ public function save($key = null, $urlVar = null)

$filePath = JPATH_ADMINISTRATOR . '/components/com_tjucm/models/forms/' . $client[1] . '_extra.xml';

if (JFile::exists($filePath))
if (File::exists($filePath))
{
// Validate the posted data.
$formExtra = $model->getFormExtra(
Expand Down Expand Up @@ -384,7 +389,7 @@ public function save($key = null, $urlVar = null)

// Redirect back to the edit screen.
$id = (int) $app->getUserState('com_tjucm.edit.item.id');
$this->setRedirect(JRoute::_('index.php?option=com_tjucm&view=itemform&layout=edit&client=' . $this->client . '&id=' . $id, false));
$this->setRedirect(Route::_('index.php?option=com_tjucm&view=itemform&layout=edit&client=' . $this->client . '&id=' . $id, false));

return false;
}
Expand All @@ -402,11 +407,11 @@ public function save($key = null, $urlVar = null)
$app->setUserState($context . '.data', $validData);

// Redirect back to the edit screen.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()));
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()));
$this->setMessage($this->getError(), 'error');

$this->setRedirect(
JRoute::_(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client
. $this->getRedirectToItemAppend($recordId, $urlVar), false
)
Expand All @@ -422,11 +427,11 @@ public function save($key = null, $urlVar = null)
$app->setUserState($context . '.data', $validData);

// Check-in failed, so go back to the record and display a notice.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
$this->setMessage($this->getError(), 'error');

$this->setRedirect(
JRoute::_(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client
. $this->getRedirectToItemAppend($recordId, $urlVar), false
)
Expand All @@ -435,10 +440,10 @@ public function save($key = null, $urlVar = null)
return false;
}

$langKey = $this->text_prefix . ($recordId == 0 && $app->isSite() ? '_SUBMIT' : '') . '_SAVE_SUCCESS';
$prefix = JFactory::getLanguage()->hasKey($langKey) ? $this->text_prefix : 'JLIB_APPLICATION';
$langKey = $this->text_prefix . ($recordId == 0 && $app->isClient('site') ? '_SUBMIT' : '') . '_SAVE_SUCCESS';
$prefix = Factory::getLanguage()->hasKey($langKey) ? $this->text_prefix : 'JLIB_APPLICATION';

$this->setMessage(JText::_($prefix . ($recordId == 0 && $app->isSite() ? '_SUBMIT' : '') . '_SAVE_SUCCESS'));
$this->setMessage(Text::_($prefix . ($recordId == 0 && $app->isClient('site') ? '_SUBMIT' : '') . '_SAVE_SUCCESS'));

// Redirect the user and adjust session state based on the chosen task.
switch ($task)
Expand All @@ -452,7 +457,7 @@ public function save($key = null, $urlVar = null)

// Redirect back to the edit screen.
$this->setRedirect(
JRoute::_(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client
. $this->getRedirectToItemAppend($recordId, $urlVar), false
)
Expand All @@ -467,7 +472,7 @@ public function save($key = null, $urlVar = null)

// Redirect back to the edit screen.
$this->setRedirect(
JRoute::_(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client
. $this->getRedirectToItemAppend(null, $urlVar), false
)
Expand All @@ -482,7 +487,7 @@ public function save($key = null, $urlVar = null)

// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list . '&client=' . $this->client
. $this->getRedirectToListAppend(), false
)
Expand Down
Loading