Skip to content

Commit

Permalink
Collected commit for version 1.4.0 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
thucke committed Jun 26, 2016
1 parent a397531 commit 90e03b1
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 54 deletions.
51 changes: 17 additions & 34 deletions Classes/Controller/VoteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -845,47 +845,30 @@ protected function getErrorFlashMessage() {
* Checks all storagePid settings and
* sets them to SITEROOT if zero or empty
*
* @throws \Thucke\ThRating\Exception\InvalidStoragePageException if plugin.tx_thrating.storagePid has not been set
* @throws \Thucke\ThRating\Exception\FeUserStoragePageException if plugin.tx_felogin.storagePid has not been set
* @return void
*/
protected function setStoragePids() {
$siteRootPids = $this->getTypoScriptFrontendController()->getStorageSiterootPids();
$siteRoot = $siteRootPids['_SITEROOT'];
$storagePid = $siteRootPids['_STORAGE_PID'];
$frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
$storagePids = \TYPO3\CMS\Extbase\Utility\ArrayUtility::integerExplode(',', $frameworkConfiguration['persistence']['storagePid'], true);
foreach ($storagePids as $i => $value) {
if ( !is_null($value) && (empty($value) || $value==$siteRoot) ) {
unset($storagePids[$i]); //cleanup invalid values
}
}
$storagePids = array_values($storagePids); //re-index array
if ( count($storagePids)<2 && !is_null($storagePid) && !(empty($storagePid) || $storagePid==$siteRoot) ) {
array_unshift($storagePids, $storagePid); //append the page storagePid if it is assumed to be missed and is valid
}
$frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
$feUserStoragePid = \TYPO3\CMS\Extbase\Utility\ArrayUtility::integerExplode(',', $frameworkConfiguration['plugin.']['tx_felogin.']['storagePid'], true);
$frameworkConfiguration = $frameworkConfiguration['plugin.']['tx_thrating.'];

$storagePids = \TYPO3\CMS\Extbase\Utility\ArrayUtility::integerExplode(',', $frameworkConfiguration['storagePid'], true);

foreach ( $frameworkConfiguration['persistence']['pluginCheckHelper'] as $x => $y) {
if (intval($y)==0) {
$frameworkConfiguration['persistence']['pluginCheckHelper'][$x] = 0;
}
}
if (empty($storagePids[0])) {
$this->logFlashMessage( \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('flash.vote.general.invalidStoragePid', 'ThRating', array (1=>$storagePid)),
\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('flash.heading.error', 'ThRating'),
"ERROR", array('errorCode' => 1403203519));
throw new \Thucke\ThRating\Exception\InvalidStoragePageException(
\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('flash.vote.general.invalidStoragePid', 'ThRating'), 1403203519
);
}
if ( empty($frameworkConfiguration['persistence']['pluginCheckHelper']['pluginStoragePid']) ) {
$frameworkConfiguration['persistence']['classes']['Thucke\ThRating\Domain\Model\Ratingobject']['newRecordStoragePid'] = $storagePid;
$this->logFlashMessage( \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('flash.pluginConfiguration.missing.pluginStoragePid', 'ThRating', array(1=>$storagePid)),
\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('flash.configuration.error', 'ThRating'),
"WARNING", array('errorCode' => 1403203529,
'_STORAGE_PID' => $storagePid));
}
if ( empty($frameworkConfiguration['persistence']['pluginCheckHelper']['feUserStoragePid']) ) {
$this->logFlashMessage( \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('flash.pluginConfiguration.missing.feUserStoragePid', 'ThRating', array()),
\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('flash.configuration.error', 'ThRating'),
"ERROR", array('errorCode' => 1403190539));

if ( empty($feUserStoragePid[0]) ) {
throw new \Thucke\ThRating\Exception\FeUserStoragePageException(
\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('flash.pluginConfiguration.missing.feUserStoragePid', 'ThRating'), 1403190539
);
}
$frameworkConfiguration['persistence']['storagePid'] = implode(',', $storagePids);
array_push($storagePids, $feUserStoragePid[0]);
$frameworkConfiguration['persistence.']['storagePid'] = implode(',', $storagePids);
$this->setFrameworkConfiguration($frameworkConfiguration);
}

Expand Down
26 changes: 26 additions & 0 deletions Classes/Exception/Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
namespace Thucke\ThRating\Exception;

/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

/**
* A generic Cache exception
*
* This file is a backport from FLOW3
*
* @api
*/
class Exception extends \Exception
{
}
24 changes: 24 additions & 0 deletions Classes/Exception/FeUserStoragePageException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
namespace Thucke\ThRating\Exception;

/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

/**
* A "Storage page not set in Plugin configuration" exception
*
* @api
*/
class FeUserStoragePageException extends \Thucke\ThRating\Exception\Exception
{
}
24 changes: 24 additions & 0 deletions Classes/Exception/InvalidStoragePageException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
namespace Thucke\ThRating\Exception;

/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

/**
* A "Storage page not set in Plugin configuration" exception
*
* @api
*/
class InvalidStoragePageException extends \Thucke\ThRating\Exception\Exception
{
}
2 changes: 0 additions & 2 deletions Configuration/TypoScript/constants.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ plugin.tx_thrating {
settings {
# cat=plugin.tx_thrating//a; type=int; label=General storage page where all records are stored
pluginStoragePid = 0
# cat=plugin.tx_thrating//a; type=int; label=FE Users and Groups [pid]: Enter the PID where website users and groups are stored
feUserStoragePid = 0
}
}
8 changes: 2 additions & 6 deletions Configuration/TypoScript/setup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ plugin.tx_thrating {
vendorName = Thucke
controller = Vote
mvc.callDefaultActionIfActionCantBeResolved = 1
storagePid = {$plugin.tx_thrating.settings.pluginStoragePid}
switchableControllerActions {
Vote {
1 = ratinglinks
Expand Down Expand Up @@ -66,14 +67,9 @@ plugin.tx_thrating {
}
}
persistence {
pluginCheckHelper {
pluginStoragePid = {$plugin.tx_thrating.settings.pluginStoragePid}
feUserStoragePid = {$plugin.tx_thrating.settings.feUserStoragePid}
}
storagePid = {$plugin.tx_thrating.settings.pluginStoragePid},{$plugin.tx_thrating.settings.feUserStoragePid}
classes {
Thucke\ThRating\Domain\Model\Ratingobject {
newRecordStoragePid = {$plugin.tx_thrating.settings.pluginStoragePid}
newRecordStoragePid < plugin.tx_thrating.storagePid
}
}
}
Expand Down
13 changes: 5 additions & 8 deletions Resources/Private/Language/locallang.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,11 @@
<source>Votings</source>
</trans-unit>
<trans-unit id="flash.vote.general.invalidStoragePid" xml:space="preserve">
<source>Invalid storage page</source>
<target></target></trans-unit>
<source>"plugin.tx_thrating.storagePid" not set.</source>
</trans-unit>
<trans-unit id="flash.pluginConfiguration.missing.feUserStoragePid" xml:space="preserve">
<source>"plugin.tx_felogin.storagePid" not set.</source>
</trans-unit>
<trans-unit id="error.validator.ratingobject_table_extbase" xml:space="preserve">
<source>Missing table name in ratingobject.</source>
</trans-unit>
Expand Down Expand Up @@ -279,12 +282,6 @@
<trans-unit id="flash.renderCSS.noStepconf" xml:space="preserve">
<source>Stepconf missing in ratingobject configuration of UID %1$s - check PID %2$s.</source>
</trans-unit>
<trans-unit id="flash.pluginConfiguration.missing.pluginStoragePid" xml:space="preserve">
<source>Constant pluginStoragePid not set using default %1$s.</source>
</trans-unit>
<trans-unit id="flash.pluginConfiguration.missing.feUserStoragePid" xml:space="preserve">
<source>Constant "plugin.tx_thrating.settings.feUserStoragePid" not set.</source>
</trans-unit>
<trans-unit id="flash.renderCSS.incompatible620" xml:space="preserve">
<source>Incompatible version - please upgrade to at least TYPO3 6.2.1</source>
</trans-unit>
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Partials/ratinglinkBlock.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<f:if condition="{settings.fluid.templates.ratinglinks.likesMode}">
<f:then><f:comment><!-- display no current rating if in likesMode --></f:comment></f:then>
<f:else>
<li class="current-rating {barimage} {f:if(condition: '{0: ratingClass} == {0: \'tilt\'}', then: 'tx_thrating_ajax-ratingCalculatedRateHeight', else: 'tx_thrating_ajax-ratingCalculatedRateWidth')}"
<li data-role="onCurrentRateActive" class="current-rating {barimage} {f:if(condition: '{0: ratingClass} == {0: \'tilt\'}', then: 'tx_thrating_ajax-ratingCalculatedRateHeight', else: 'tx_thrating_ajax-ratingCalculatedRateWidth')}"
style="{f:if(condition: '{0: ratingClass} == {0: \'tilt\'}', then: 'height:{rating.calculatedRate}%;', else: 'width:{rating.calculatedRate}%;')} {f:if(condition: '{rating.calculatedRate}', then: '', else: 'display:none;')}"
title="<f:translate key='fluid.template.ratinglinks.currentRating' default='fluid.template.ratinglinks.currentRating' arguments='{1:currentRates, 2:stepCount}'/>">
<f:translate key='fluid.template.ratinglinks.currentRating' default='fluid.template.ratinglinks.currentRating' arguments='{1:currentRates, 2:stepCount}'/>
Expand Down
6 changes: 5 additions & 1 deletion changes.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
- Bug #76630: Cookie protection only working after page refresh
- Major Feature #73635: Raise compatibility to PHP 7
- Bug #76630: Cookie protection only working after page refresh
- Bug #76650: First rating won't show up after AJAX response
- Task #76597: Check for impact of "Deprecation: #65790 - Remove pages.storage_pid and logic"
- Task #76601: Check for impact of "Feature: #68700 - Autoload definition can be provided in ext_emconf.php"
Loading

0 comments on commit 90e03b1

Please sign in to comment.