-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding the Multilanguage Associations Manager #13537
Merged
wilsonge
merged 41 commits into
joomla:staging
from
rdeutz:com_associations_rewrite_merge
Jan 17, 2017
Merged
Changes from 15 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
0fbc25a
Merge Associations rewrite
rdeutz f341aad
updated searchtool with the new way
rdeutz 79d95a5
udpated edit view title
rdeutz 7cf3996
added contact associationshelper class
rdeutz c1ebda1
temp fix
rdeutz b662491
fix for category filter
rdeutz f7c85a5
added newsfeeds associations helper
rdeutz 0495886
CAPS for params
rdeutz ebe4afc
lang tag and added a helper function
rdeutz 00eb70b
added land tags
rdeutz a54d3f7
code style fix
rdeutz f7ebff9
better title in associations view
rdeutz 87a3138
better title
rdeutz 100fb42
use the usual naming
rdeutz 7b0b75f
fix language tag, thanks to brian teeman and twitter :-)
rdeutz 417f0fc
Merge branch 'com_associations_rewrite_merge' of https://github.com/r…
zero-24 f50ad78
initial review
zero-24 b2fda8a
on simple change
zero-24 67d6000
on simple change 2
zero-24 90f7639
simple
zero-24 f5ce260
some more helper changes
zero-24 31a0185
Update associations.php
zero-24 55dc10c
Update associations.php
zero-24 0826d30
Merge pull request #7 from zero-24/com_associations_rewrite_merge
rdeutz 7e8422b
app isn’t set a model property
rdeutz 1ca1c8e
correct return value
rdeutz dbba275
simplify code adn use helper method
rdeutz fc79b46
use typename directly
rdeutz d64c742
changed the tooltip position
rdeutz edccd27
Correct menu helper
infograf768 868edd4
remove unreacable code
rdeutz ca50fd1
correcting checked_out
infograf768 04df8c3
com_menus
infograf768 7ab1191
Merge pull request #8 from infograf768/patch-10
rdeutz e5fb8bd
Merge pull request #9 from infograf768/patch-11
rdeutz 97c437f
Merge pull request #11 from infograf768/patch-13
rdeutz 406d18d
fixed not supportted message
rdeutz e4f03ee
installation
rdeutz cc61448
fix menu install
rdeutz 95fc4b6
Merge branch 'staging' into com_associations_rewrite_merge
rdeutz 9fd1d9b
Spaces -> tabs
wilsonge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<access component="com_associations"> | ||
<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" /> | ||
</section> | ||
</access> |
40 changes: 40 additions & 0 deletions
40
administrator/components/com_associations/associations.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Administrator | ||
* @subpackage com_associations | ||
* | ||
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
JHtml::_('behavior.tabstate'); | ||
|
||
if (!JFactory::getUser()->authorise('core.manage', 'com_associations')) | ||
{ | ||
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); | ||
} | ||
|
||
JLoader::register('AssociationsHelper', __DIR__ . '/helpers/associations.php'); | ||
|
||
// Check if user has permission to access the component item type. | ||
$itemtype = JFactory::getApplication()->input->get('itemtype', '', 'string'); | ||
|
||
if ($itemtype !== '') | ||
{ | ||
list($extensionName, $typeName) = explode('.', $itemtype); | ||
|
||
if (! AssociationsHelper::hasSupport($extensionName)) | ||
{ | ||
throw new Exception(JText::_('COM_ASSOCIATIONS_COMPONENT_NOT_SUPPORTED') . ' ' . $itemType->realcomponent, 404); | ||
} | ||
|
||
if (!JFactory::getUser()->authorise('core.manage', $extensionName)) | ||
{ | ||
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); | ||
} | ||
} | ||
|
||
$controller = JControllerLegacy::getInstance('Associations'); | ||
$controller->execute(JFactory::getApplication()->input->get('task')); | ||
$controller->redirect(); |
30 changes: 30 additions & 0 deletions
30
administrator/components/com_associations/associations.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<extension type="component" version="3.7" method="upgrade"> | ||
<name>com_associations</name> | ||
<author>Joomla! Project</author> | ||
<creationDate>September 2016</creationDate> | ||
<copyright>(C) 2005 - 2016 Open Source Matters. All rights reserved.</copyright> | ||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license> | ||
<authorEmail>admin@joomla.org</authorEmail> | ||
<authorUrl>www.joomla.org</authorUrl> | ||
<version>__DEPLOY_VERSION__</version> | ||
<description>COM_ASSOCIATIONS_XML_DESCRIPTION</description> | ||
<administration> | ||
<menu img="class:associations">COM_ASSOCIATIONS</menu> | ||
<files folder="admin"> | ||
<filename>access.xml</filename> | ||
<filename>config.xml</filename> | ||
<filename>associations.php</filename> | ||
<filename>controller.php</filename> | ||
<folder>controllers</folder> | ||
<folder>helpers</folder> | ||
<folder>layouts</folder> | ||
<folder>models</folder> | ||
<folder>views</folder> | ||
</files> | ||
<languages folder="admin"> | ||
<language tag="en-GB">language/en-GB.com_associations.ini</language> | ||
<language tag="en-GB">language/en-GB.com_associations.sys.ini</language> | ||
</languages> | ||
</administration> | ||
</extension> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<config> | ||
<fieldset | ||
name="permissions" | ||
label="JCONFIG_PERMISSIONS_LABEL" | ||
description="JCONFIG_PERMISSIONS_DESC" > | ||
<field | ||
name="rules" | ||
type="rules" | ||
label="JCONFIG_PERMISSIONS_LABEL" | ||
filter="rules" | ||
validate="rules" | ||
component="com_associations" | ||
section="component" /> | ||
</fieldset> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Administrator | ||
* @subpackage com_associations | ||
* | ||
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
|
||
/** | ||
* Component Controller | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
class AssociationsController extends JControllerLegacy | ||
{ | ||
/** | ||
* @var string The default view. | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
protected $default_view = 'associations'; | ||
|
||
} |
92 changes: 92 additions & 0 deletions
92
administrator/components/com_associations/controllers/association.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Administrator | ||
* @subpackage com_associations | ||
* | ||
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
|
||
JLoader::register('AssociationsHelper', JPATH_ADMINISTRATOR . '/components/com_associations/helpers/associations.php'); | ||
|
||
/** | ||
* Association edit controller class. | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
class AssociationsControllerAssociation extends JControllerForm | ||
{ | ||
/** | ||
* Method to edit an existing 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 access level check and checkout passes, false otherwise. | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function edit($key = null, $urlVar = null) | ||
{ | ||
$input = JFactory::getApplication()->input; | ||
|
||
list($extensionName, $typeName) = explode('.', $input->get('itemtype')); | ||
|
||
$id = $input->get('id', 0); | ||
|
||
// Check if reference item can be edited. | ||
if (!AssociationsHelper::allowEdit($extensionName, $typeName, $id)) | ||
{ | ||
JFactory::getApplication()->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED'), 'error'); | ||
$this->setRedirect(JRoute::_('index.php?option=com_associations&view=associations', false)); | ||
|
||
return false; | ||
} | ||
|
||
return parent::display(); | ||
} | ||
|
||
/** | ||
* Method for canceling the edit action | ||
* | ||
* @param string $key The name of the primary key of the URL variable. | ||
* | ||
* @return void. | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function cancel($key = null) | ||
{ | ||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); | ||
|
||
$input = JFactory::getApplication()->input; | ||
|
||
list($extensionName, $typeName) = explode('.', $input->get('itemtype')); | ||
|
||
$id = $input->get('id', 0); | ||
|
||
// Only check in, if component item type allows to check out. | ||
if (AssociationsHelper::typeSupportsCheckout($extensionName, $typeName)) | ||
{ | ||
$ids = array(); | ||
$targetId = $this->input->get('target-id', '', 'string'); | ||
|
||
if ($targetId !== '') | ||
{ | ||
$ids = array_unique(explode(',', $targetId)); | ||
} | ||
|
||
$ids[] = $id; | ||
|
||
foreach ($ids as $key => $id) | ||
{ | ||
AssociationsHelper::getItem($extensionName, $typeName, $id)->checkin(); | ||
} | ||
} | ||
|
||
$this->setRedirect(JRoute::_('index.php?option=com_associations&view=associations', false)); | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
administrator/components/com_associations/controllers/associations.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Administrator | ||
* @subpackage com_content | ||
* | ||
* @copyright Copyright (C) 2005 - 2016 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"); | ||
|
||
JLoader::register('AssociationsHelper', JPATH_ADMINISTRATOR . '/components/com_associations/helpers/associations.php'); | ||
|
||
/** | ||
* Associations controller class. | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
class AssociationsControllerAssociations extends JControllerAdmin | ||
{ | ||
/** | ||
* The URL view list variable. | ||
* | ||
* @var string | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
protected $view_list = 'associations'; | ||
|
||
/** | ||
* Proxy for getModel. | ||
* | ||
* @param string $name The model name. Optional. | ||
* @param string $prefix The class prefix. Optional. | ||
* @param array $config The array of possible config values. Optional. | ||
* | ||
* @return JModel | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function getModel($name = 'Associations', $prefix = 'AssociationsModel', $config = array('ignore_request' => true)) | ||
{ | ||
return parent::getModel($name, $prefix, $config); | ||
} | ||
|
||
/** | ||
* Method to purge the associations table. | ||
* | ||
* @return void | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function purge() | ||
{ | ||
$model = $this->getModel('associations'); | ||
$model->purge(); | ||
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false)); | ||
} | ||
|
||
/** | ||
* Method to delete the orphans from the associations table. | ||
* | ||
* @return void | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function clean() | ||
{ | ||
$model = $this->getModel('associations'); | ||
$model->clean(); | ||
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false)); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
$itemType->realcomponent
exists? or is a leftover?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the lang string
COM_ASSOCIATIONS_COMPONENT_NOT_SUPPORTED
is not present in the ini file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should have something like:
throw new Exception(JText::sprintf('COM_ASSOCIATIONS_COMPONENT_NOT_SUPPORTED', JText::_($extensionName), 404);
and
COM_ASSOCIATIONS_COMPONENT_NOT_SUPPORTED="The extension %s does not support multilingual associations."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed with 406d18d thanks!