Skip to content

Commit

Permalink
Merge pull request joomla#42 from Buddhima/gsoc_com_services
Browse files Browse the repository at this point in the history
GSOC Project: com_services or front end website administration
  • Loading branch information
elinw committed Jun 26, 2013
2 parents 5db845f + e255478 commit 4078c9f
Show file tree
Hide file tree
Showing 196 changed files with 5,285 additions and 212 deletions.
6 changes: 6 additions & 0 deletions administrator/components/com_config/access.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<access component="com_config">
<section name="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
</section>
</access>
43 changes: 38 additions & 5 deletions administrator/components/com_config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,46 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;
// No direct access
defined('_JEXEC') or die('Restricted access');

// Access checks are done internally because of different requirements for the two controllers.
// Sessions
jimport('joomla.session.session');

// Load classes
JLoader::registerPrefix('Config', JPATH_COMPONENT);

// Tell the browser not to cache this page.
JResponse::setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT', true);

$controller = JControllerLegacy::getInstance('Config');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
// Application
$app = JFactory::getApplication();

if ($controllerTask = $app->input->get('controller'))
// Checking for new MVC controller
$array = explode(".", $controllerTask);
else
{
// Checking for old MVC task
$task = $app->input->get('task');
$array = explode(".", $task);
}

if (empty($array[1]))
$activity = 'display';
elseif ($array[1] == 'apply')
$activity = 'save';
else $activity = $array[1];

// Create the controller
// if ($array[0]=='application')
// For Application
$classname = 'ConfigControllerApplication' . ucfirst($activity);// only for applications
if ($array[0] == 'component')
// For Component
$classname = 'ConfigControllerComponent' . ucfirst($activity); // if task=component.* etc

$controller = new $classname;

// Perform the Request task
$controller->execute();
18 changes: 9 additions & 9 deletions administrator/components/com_config/config.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.1" method="upgrade">
<extension type="component" version="3.0" method="upgrade">
<name>com_config</name>
<author>Joomla! Project</author>
<creationDate>April 2006</creationDate>
<creationDate>June 2013</creationDate>
<copyright>(C) 2005 - 2013 Open Source Matters. All rights reserved. </copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<version>3.1.0</version>
<description>COM_CONFIG_XML_DESCRIPTION</description>
<administration>
<files folder="admin">
<filename>config.php</filename>
<filename>controller.php</filename>
<filename>access.xml</filename>
<filename>index.html</filename>
<folder>controllers</folder>
<folder>models</folder>
<folder>views</folder>
<folder>controller</folder>
<folder>model</folder>
<folder>view</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB.com_config.ini</language>
<language tag="en-GB">language/en-GB.com_config.sys.ini</language>
<language tag="en-GB">language/en-GB.com_config.ini
</language>
</languages>
</administration>
</extension>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_config
*
* @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('_JEXEC') or die('Restricted access');

/**
* Cancel Controller for global configuration
*
* @package Joomla.Administrator
* @subpackage com_config
* @since 3.2
*/
class ConfigControllerApplicationCancel extends JControllerBase
{

/**
* Method to cancel global configuration.
*
* @return bool True on success.
*
* @since 3.2
*/
public function execute()
{
// Check if the user is authorized to do this.
if (!JFactory::getUser()->authorise('core.admin', 'com_config'))
{
JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'));

return;
}

// Set FTP credentials, if given
JClientHelper::setCredentialsFromRequest('ftp');

// Clean the session data.
$app = JFactory::getApplication();
$app->setUserState('com_config.config.global.data', null);

$app->redirect(JRoute::_('index.php', false));

return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_config
*
* @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('_JEXEC') or die('Restricted access');

/**
* Display Controller for global configuration
*
* @package Joomla.Administrator
* @subpackage com_config
* @since 3.2
*/
class ConfigControllerApplicationDisplay extends JControllerBase
{
/**
* Method to display global configuration.
*
* @return bool True on success, false on failure.
*
* @since 3.2
*/
public function execute()
{

// Get the application
$app = $this->getApplication();

// Get the document object.
$document = JFactory::getDocument();

$viewName = $app->input->getWord('view', 'application');
$viewFormat = $document->getType();
$layoutName = $app->input->getWord('layout', 'default');

$app->input->set('view', $viewName);

// Register the layout paths for the view
$paths = new SplPriorityQueue;
$paths->insert(JPATH_COMPONENT . '/view/' . 'application' . '/tmpl', 'normal');

$viewClass = 'ConfigView' . ucfirst($viewName) . ucfirst($viewFormat);
$modelClass = 'ConfigModel' . ucfirst($viewName);

if ($view = new $viewClass)
{

if ($viewName != 'close')
{
$model = new $modelClass;

// Access check.
if (!JFactory::getUser()->authorise('core.admin', $model->getState('component.option')))
{
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}

// Set model
$view->setModel($model, true);
}

$view->setLayout($layoutName);

// Push document object into the view.
$view->document = $document;

// Reply for service requests
if ($viewFormat == 'json')
{
return $view->render();
}

// Render view.
echo $view->render();
}
return true;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_config
*
* @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('_JEXEC') or die('Restricted access');

/**
* Refresh Help Controller for global configuration
*
* @package Joomla.Administrator
* @subpackage com_config
* @since 3.2
*/
class ConfigControllerApplicationRefreshhelp extends JControllerBase
{

/**
* Method to refresh help in global configuration.
*
* @return bool True on success.
*
* @since 3.2
*/
public function execute()
{
jimport('joomla.filesystem.file');

// Set FTP credentials, if given
JClientHelper::setCredentialsFromRequest('ftp');

// Get application instance
$app = JFactory::getApplication();

if (($data = file_get_contents('http://help.joomla.org/helpsites.xml')) === false)
{
$app->redirect(JRoute::_('index.php?option=com_config', false), JText::_('COM_CONFIG_ERROR_HELPREFRESH_FETCH'), 'error');
}
elseif (!JFile::write(JPATH_BASE . '/help/helpsites.xml', $data))
{
$app->redirect(JRoute::_('index.php?option=com_config', false), JText::_('COM_CONFIG_ERROR_HELPREFRESH_ERROR_STORE'), 'error');
}
else
{
$app->redirect(JRoute::_('index.php?option=com_config', false), JText::_('COM_CONFIG_HELPREFRESH_SUCCESS'));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_config
*
* @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('_JEXEC') or die('Restricted access');

/**
* Remove Root Controller for global configuration
*
* @package Joomla.Administrator
* @subpackage com_config
* @since 3.2
*/
class ConfigControllerApplicationRemoveroot extends JControllerBase
{

/**
* Method to remove root in global configuration.
*
* @return bool True on success.
*
* @since 3.2
*/
public function execute()
{
// Check for request forgeries.
JSession::checkToken('get') or die('Invalid Token');

// Check if the user is authorized to do this.
if (!JFactory::getUser()->authorise('core.admin'))
{
JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'));

return;
}

// Initialise model.
$model = new ConfigModelsApplication;

// Attempt to save the configuration and remove root.
$return = $model->removeroot();

// Check the return value.
if ($return === false)
{
// Save failed, go back to the screen and display a notice.
JFactory::getApplication()->redirect(JRoute::_('index.php', false), JText::sprintf('JERROR_SAVE_FAILED', $model->getError()), 'error');

return false;
}

// Set the success message.
$message = JText::_('COM_CONFIG_SAVE_SUCCESS');

// Set the redirect based on the task.
JFactory::getApplication()->redirect(JRoute::_('index.php', false), $message);

return true;
}
}
Loading

0 comments on commit 4078c9f

Please sign in to comment.