Skip to content
Closed
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
45eb8d6
Merge pull request #2 from joomla/master
Mathewlenning Sep 18, 2013
2be4e10
Added Single Task Controllers to the CMS Directory
Mathewlenning Apr 25, 2014
9f7a6d3
Removed the cms/model and cms/view directories. I'm going to create
Mathewlenning Apr 25, 2014
8f149bb
Change the class name of cms/controller/update/close.php to fit the
Mathewlenning Apr 25, 2014
a308d43
Updated cms/controller/add.php & cms/controller/edit.php to return the
Mathewlenning Apr 25, 2014
2addb89
Renamed controllers to work with naming convention.
Mathewlenning Apr 26, 2014
bbb3330
slight changes
Mathewlenning Apr 30, 2014
5da5e13
Merge pull request #6 from Mathewlenning/revised
Mathewlenning Apr 30, 2014
83fc12c
Adjusted the alignment on the @subpackage tag
Mathewlenning May 3, 2014
12426a6
Fixed typo in JControllerCreateBase. Thanks Herman
Mathewlenning May 4, 2014
4654fd6
Added the models to the cms dir
Mathewlenning May 4, 2014
ab223dd
Codesniffer changes and refactoring of getModel to remove duplicate c…
Mathewlenning May 5, 2014
486546b
Refactoring task abort redirections
Mathewlenning May 6, 2014
9f5c697
Reformatted to fit Joomla! standards
Mathewlenning May 6, 2014
eb88f74
More reformatted
Mathewlenning May 6, 2014
a734bef
Added JControllerCms::internalRedirect, JControllerCms::mergeModels, …
Mathewlenning May 6, 2014
8a65be7
Renamed JControllerCms::internalRedirect to JControllerCms::executeIn…
Mathewlenning May 6, 2014
00c442f
Added Ajax support for publish & unpublish.
Mathewlenning May 7, 2014
3c9d4e8
Cleaning up the models. Changed JModelData::getTable and createTable …
Mathewlenning May 8, 2014
cfd10cf
Added the views
Mathewlenning May 8, 2014
5176d24
Added the table. This is still extending JTable, but it was written u…
Mathewlenning May 8, 2014
a443c47
Fixed JViewCms::setModel call in JControllerDisplay::execute method
Mathewlenning May 9, 2014
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
50 changes: 50 additions & 0 deletions libraries/cms/controller/add.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Controller
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('JPATH_PLATFORM') or die;

class JControllerAdd extends JControllerDisplay
{
/**
* Instantiate the controller.
*
* @param JInput $input The input object.
* @param JApplicationBase $app The application object.
* @param array $config Configuration
* @since 12.1
*/
public function __construct(JInput $input, $app = null, $config = array())
{
$input->set('layout', 'edit');

parent::__construct($input, $app, $config);
}

/**
* (non-PHPdoc)
* @see JControllerDisplay::execute()
*/
public function execute()
{
$config = $this->config;
$prefix = $this->getPrefix();
$model = $this->getModel($prefix, $config['subject'], $config);

if (!$model->allowAction('core.create'))
{
$msg = $this->translate('JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED');
$url = 'index.php?option='.$config['option'].'&task=display.'.$config['subject'];
$this->setRedirect($url, $msg, 'error');
return false;
}

return parent::execute();
}

}
49 changes: 49 additions & 0 deletions libraries/cms/controller/cancel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Controller
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('JPATH_PLATFORM') or die;

class JControllerCancel extends JControllerCms
{
/**
* (non-PHPdoc)
* @see JController::execute()
*/
public function execute()
{
$config = $this->config;
$url = 'index.php?option='.$config['option'].'&task=display.'.$config['subject'];

$prefix = $this->getPrefix();
$model = $this->getModel($prefix, $config['subject'], $config);
$keyName = $model->getKeyName();

$input = $this->input;
$pk = $input->getInt($keyName, 0);

if ($pk != 0)
{
try
{
$model->checkin($pk);
}
catch (Exception $e)
{
$msg = $e->getMessage();
$this->setRedirect($url, $msg, 'warning');
return false;
}
}

$this->setRedirect($url);
return true;
}


}
60 changes: 60 additions & 0 deletions libraries/cms/controller/checkin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Controller
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('JPATH_PLATFORM') or die;

class JControllerCheckin extends JControllerCms
{
/**
* (non-PHPdoc)
* @see JController::execute()
*/
public function execute()
{
//Check for request forgeries
$this->validateSession();

$config = $this->config;
$url = 'index.php?option='.$config['option'].'&task=display.'.$config['subject'];

$prefix = $this->getPrefix();
$model = $this->getModel($prefix, $config['subject'], $config);

if (!$model->allowAction('core.manage'))
{
$msg = $this->translate('JLIB_APPLICATION_ERROR_CHECKIN_NOT_ALLOWED');
$this->setRedirect($url, $msg, 'error');
return false;
}

$input = $this->input;
$cid = $input->post->get('cid', array(), 'array');
// Make sure the item ids are integers
$cid = $this->cleanCid($cid);


try
{
foreach ($cid AS $pk)
{
$model->checkin($pk);
}
}
catch (Exception $e)
{
$msg = $e->getMessage();
$this->setRedirect($url, $msg, 'warning');
return false;
}

$msg = $this->translate('JLIB_APPLICATION_MSG_CHECKIN_SUCCEEDED');
$this->setRedirect($url, $msg, 'message');
return true;
}
}
Loading