Umstellung auf Contao 4 Bundle

This commit is contained in:
Carsten Götzinger 2018-02-14 08:30:39 +01:00
parent b922fe527c
commit b1d3d540bb
129 changed files with 812 additions and 423 deletions

View File

@ -1,8 +1,9 @@
{ {
"name":"cgo-it/rate-it", "name":"cgo-it/contao-rate-it-bundle",
"description":"RateIt extension for the Contao Open Source CMS", "description":"RateIt extension for the Contao Open Source CMS as contao 4 bundle",
"keywords":["contao", "rating", "rateit", "bewertung"], "keywords":["contao", "rating", "rateit", "bewertung", "bundle"],
"type":"contao-module", "type":"contao-bundle",
"homepage":"https://cgo-it.de",
"license":"LGPL-3.0+", "license":"LGPL-3.0+",
"authors":[ "authors":[
{ {
@ -13,34 +14,38 @@
} }
], ],
"support": { "support": {
"email": "info@cgo-it.de",
"issues": "https://git.cgo-it.de/contao/rate-it/issues", "issues": "https://git.cgo-it.de/contao/rate-it/issues",
"forum": "https://community.contao.org/de/showthread.php?38471-Rate-It", "forum": "https://community.contao.org/de/showthread.php?38471-Rate-It",
"source": "https://git.cgo-it.de/contao/rate-it.git" "source": "https://git.cgo-it.de/contao/rate-it.git"
}, },
"require":{ "require":{
"php":">=5.6", "php":">=7.0",
"contao/core":">=3.0||<5", "contao/core-bundle": "^4.4",
"contao-community-alliance/composer-plugin": "~2.0", "cgo-it/xls-export-bundle": "^4.0",
"cgo-it/xls_export":"^3.1" "richardhj/contao-simple-ajax": "^1.3"
}, },
"replace": { "require-dev": {
"cgo-it/rate-it": "<3.5.4" "contao/manager-plugin": "^2.0"
}, },
"conflict": { "conflict": {
"contao/core": "<3.0" "contao/core": "*",
"contao/manager-plugin": "<2.0 || >=3.0",
}, },
"extra":{ "autoload": {
"contao": { "psr-4": {
"sources":{ "cgoIT\\rateit\\": "src/"
"":"system/modules/rateit"
}, },
"transifex":{ "classmap": [
"project": "rateit", "src/Resources/contao/"
"prefix": "core-", ],
"languages_cto": "languages", "exclude-from-classmap": [
"languages_tx": "languages" "src/Resources/contao/config/",
} "src/Resources/contao/dca/",
} "src/Resources/contao/languages/",
"src/Resources/contao/templates/"
]
},
"extra": {
"contao-manager-plugin": "cgoIT\\rateit\\ContaoManagerPlugin"
} }
} }

View File

@ -1,7 +0,0 @@
;;
; Configure what you want the autoload creator to register
;;
register_namespaces = true
register_classes = true
register_templates = true

View File

@ -1,73 +0,0 @@
<?php
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2014 Leo Feyer
*
* @package Rateit
* @link https://contao.org
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
*/
/**
* Register the namespaces
*/
ClassLoader::addNamespaces(array
(
'cgoIT',
));
/**
* Register the classes
*/
ClassLoader::addClasses(array
(
// Classes
'cgoIT\rateit\DcaHelper' => 'system/modules/rateit/classes/DcaHelper.php',
'cgoIT\rateit\RateItArticle' => 'system/modules/rateit/classes/RateItArticle.php',
'cgoIT\rateit\RateItBackend' => 'system/modules/rateit/classes/RateItBackend.php',
'cgoIT\rateit\RateItCE' => 'system/modules/rateit/classes/RateItCE.php',
'cgoIT\rateit\RateItFaq' => 'system/modules/rateit/classes/RateItFaq.php',
'cgoIT\rateit\RateItFrontend' => 'system/modules/rateit/classes/RateItFrontend.php',
'cgoIT\rateit\RateItHybrid' => 'system/modules/rateit/classes/RateItHybrid.php',
'cgoIT\rateit\RateItModule' => 'system/modules/rateit/classes/RateItModule.php',
'cgoIT\rateit\RateItNews' => 'system/modules/rateit/classes/RateItNews.php',
'cgoIT\rateit\RateItPage' => 'system/modules/rateit/classes/RateItPage.php',
'cgoIT\rateit\RateItRating' => 'system/modules/rateit/classes/RateItRating.php',
'cgoIT\rateit\RateItBackendModule' => 'system/modules/rateit/classes/RateItBackendModule.php',
'cgoIT\rateit\RateItTopRatingsModule' => 'system/modules/rateit/classes/RateItTopRatingsModule.php',
'cgoIT\rateit\RateIt' => 'system/modules/rateit/public/php/rateit.php',
'simple_html_dom' => 'system/modules/rateit/classes/extern/simple_html_dom.php',
));
/**
* Register the templates
*/
TemplateLoader::addFiles(array
(
'article_rateit_default' => 'system/modules/rateit/templates',
'article_rateit_default_microdata' => 'system/modules/rateit/templates',
'gallery_rateit_default' => 'system/modules/rateit/templates',
'j_colorbox_rateit' => 'system/modules/rateit/templates',
'mod_article_list_rateit' => 'system/modules/rateit/templates',
'mod_article_rateit_default_microdata_teaser' => 'system/modules/rateit/templates',
'mod_article_rateit_default_teaser' => 'system/modules/rateit/templates',
'mod_rateit_top_ratings' => 'system/modules/rateit/templates',
'moo_mediabox_rateit' => 'system/modules/rateit/templates',
'news_full_rateit' => 'system/modules/rateit/templates',
'news_full_rateit_microdata' => 'system/modules/rateit/templates',
'news_latest_rateit' => 'system/modules/rateit/templates',
'news_latest_rateit_microdata' => 'system/modules/rateit/templates',
'news_short_rateit' => 'system/modules/rateit/templates',
'news_short_rateit_microdata' => 'system/modules/rateit/templates',
'news_simple_rateit' => 'system/modules/rateit/templates',
'news_simple_rateit_microdata' => 'system/modules/rateit/templates',
'rateitbe_ratinglist' => 'system/modules/rateit/templates',
'rateitbe_ratingview' => 'system/modules/rateit/templates',
'rateit_default' => 'system/modules/rateit/templates',
'rateit_microdata' => 'system/modules/rateit/templates',
));

View File

@ -1,139 +0,0 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright Leo Unglaub 2012
* @author Leo Unglaub <leo@leo-unglaub.net>
* @package simple_ajax
* @license LGPL
*/
// simple trick for Contao < 2.10
$arrPost = $_POST;
unset($_POST);
// inizialize the contao framework
define('TL_MODE', 'FE');
require('../../../../initialize.php');
// write the post data back into the array
$_POST = $arrPost;
/**
* Class RateitAjax
* Contain methods to catch ajax requests and send responses back to the client.
*
* Description
* ```````````
*
* The usage of the RateitAjax extensions is very easy. The extension provides
* the hook $GLOBALS['TL_HOOKS']['rateitAjax'] for extension developers. You
* simply have to register your class/method and the extension will call
* your class if there is an incomming ajax request.
*
* You simply have to deside if it's an ajax request for your module and return
* the data you want.
*
* There are a few thinks you should know about the extension:
* * YOU have the full controll over the response. That also means
* that you have to set the correct header.
* * YOU have to terminate the request after you have send the response.
* * If the ajax request is not for your method you simply have nothing to
* * return.
*
*
* Usage
* `````
* // config.php
* $GLOBALS['TL_HOOKS']['rateitAjax'][] = array('MyClass', 'myMethod');
*
* // MyClass.php
* class MyClass extends System
* {
* public function myMethod()
* {
* if ($this->Input->get('acid') == 'myrequest')
* {
* $arrReturn = array('foo', 'bar', 'foobar');
*
* header('Content-Type: application/json');
* echo json_encode($arrReturn);
* exit;
* }
* }
* }
*/
class RateitAjax extends Controller
{
/**
* Call the parent constructor.
*
* !!! DON'T REMOVE THIS !!!
*
* If you remove this you get the following error message:
* Fatal error: Call to protected System::__construct() from invalid
* context
*
* @param void
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Get the ajax request and call all hooks
*
* @param void
* @return void
*/
public function run()
{
// check if a hook is registered
if (is_array($GLOBALS['TL_HOOKS']['rateitAjax']) && count($GLOBALS['TL_HOOKS']['rateitAjax']) > 0)
{
// execute every registered callback
foreach ($GLOBALS['TL_HOOKS']['rateitAjax'] as $callback)
{
$this->import($callback[0]);
$this->{$callback[0]}->{$callback[1]}();
}
}
// if there is no other output, we generate a 412 error response
header('HTTP/1.1 412 Precondition Failed');
die('Rateit Ajax: Invalid AJAX call.');
}
}
// create a rateit-ajax instance and run it
$objRateitAjax = new RateitAjax();
$objRateitAjax->run();
?>

14
src/CgoITRateItBundle.php Normal file
View File

@ -0,0 +1,14 @@
<?php
namespace cgoIT\rateit;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Configures the Contao aeo bundle.
*
* @author Carsten Götzinger
*/
class CgoITRateItBundle extends Bundle
{
}

View File

@ -0,0 +1,28 @@
<?php
namespace cgoIT\rateit;
use Contao\CoreBundle\ContaoCoreBundle;
use Contao\ManagerPlugin\Bundle\Config\BundleConfig;
use Contao\ManagerPlugin\Bundle\BundlePluginInterface;
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
/**
* Plugin for the Contao Manager.
*
* @author Carsten Götzinger
*/
class ContaoManagerPlugin implements BundlePluginInterface
{
/**
* {@inheritdoc}
*/
public function getBundles(ParserInterface $parser)
{
return [
BundleConfig::create(CgoITRateItBundle::class)
->setLoadAfter([ContaoCoreBundle::class])
->setReplace(['rate-it']),
];
}
}

View File

@ -30,11 +30,14 @@
namespace cgoIT\rateit; namespace cgoIT\rateit;
use cgoIT\rateit\RateItFrontend;
define(RETURN_AJAX_HEADER, 'Content-Type: text/html'); define(RETURN_AJAX_HEADER, 'Content-Type: text/html');
class RateIt extends \Frontend { class RateIt extends \Frontend {
var $allowDuplicates = false; var $allowDuplicates = false;
var $rateItFrontend;
/** /**
* Initialize the controller * Initialize the controller
@ -42,6 +45,8 @@ class RateIt extends \Frontend {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
$this->rateItFrontend = new RateItFrontend();
$this->loadLanguageFile('default'); $this->loadLanguageFile('default');
$this->allowDuplicates = $GLOBALS['TL_CONFIG']['rating_allow_duplicate_ratings']; $this->allowDuplicates = $GLOBALS['TL_CONFIG']['rating_allow_duplicate_ratings'];
$this->allowDuplicatesForMembers = $GLOBALS['TL_CONFIG']['rating_allow_duplicate_ratings_for_members']; $this->allowDuplicatesForMembers = $GLOBALS['TL_CONFIG']['rating_allow_duplicate_ratings_for_members'];
@ -164,11 +169,10 @@ class RateIt extends \Frontend {
exit; exit;
} }
$this->import('rateit\\RateItFrontend', 'RateItFrontend'); $rating = $this->rateItFrontend->loadRating($id, $type);
$rating = $this->RateItFrontend->loadRating($id, $type);
header(RETURN_AJAX_HEADER); header(RETURN_AJAX_HEADER);
echo $this->RateItFrontend->getStarMessage($rating); echo $this->rateItFrontend->getStarMessage($rating);
exit; exit;
} }
} }

View File

@ -90,15 +90,15 @@ class RateItArticle extends RateItFrontend {
$objTemplate->rateit_rating_after = true; $objTemplate->rateit_rating_after = true;
} }
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/onReadyRateIt.js|static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/rateit.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/rateit.min.css||static';
switch ($GLOBALS['TL_CONFIG']['rating_type']) { switch ($GLOBALS['TL_CONFIG']['rating_type']) {
case 'hearts' : case 'hearts' :
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/heart.min.css||static';
break; break;
default: default:
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/star.min.css||static';
} }
} }
@ -148,15 +148,15 @@ class RateItArticle extends RateItFrontend {
$article['rateit_rating_after'] = true; $article['rateit_rating_after'] = true;
} }
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/onReadyRateIt.js|static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/rateit.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/rateit.min.css||static';
switch ($GLOBALS['TL_CONFIG']['rating_type']) { switch ($GLOBALS['TL_CONFIG']['rating_type']) {
case 'hearts' : case 'hearts' :
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/heart.min.css||static';
break; break;
default: default:
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/star.min.css||static';
} }
} }
@ -232,15 +232,15 @@ class RateItArticle extends RateItFrontend {
$objTemplate->arrRating = $arrRating; $objTemplate->arrRating = $arrRating;
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/onReadyRateIt.js|static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/rateit.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/rateit.min.css||static';
switch ($GLOBALS['TL_CONFIG']['rating_type']) { switch ($GLOBALS['TL_CONFIG']['rating_type']) {
case 'hearts' : case 'hearts' :
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/heart.min.css||static';
break; break;
default: default:
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/star.min.css||static';
} }
} }

View File

@ -32,7 +32,7 @@ namespace cgoIT\rateit;
class RateItBackend class RateItBackend
{ {
const path = 'system/modules/rateit/'; const path = 'bundles/cgoitrateit/';
/** /**
* Get a css file. * Get a css file.
@ -41,7 +41,7 @@ class RateItBackend
*/ */
public static function css($file) public static function css($file)
{ {
return self::path.'public/css/'. $file.'.css'; return self::path.'css/'. $file.'.css';
} // file } // file
/** /**
@ -51,7 +51,7 @@ class RateItBackend
*/ */
public static function js($file) public static function js($file)
{ {
return self::path.'public/js/'. $file.'.js'; return self::path.'js/'. $file.'.js';
} // file } // file
/** /**
@ -61,7 +61,7 @@ class RateItBackend
*/ */
public static function image($file) public static function image($file)
{ {
$url = self::path.'public/images/'; $url = self::path.'images/';
if (is_file(TL_ROOT.'/'.$url.$file.'.png')) return $url.$file.'.png'; if (is_file(TL_ROOT.'/'.$url.$file.'.png')) return $url.$file.'.png';
if (is_file(TL_ROOT.'/'.$url.$file.'.gif')) return $url.$file.'.gif'; if (is_file(TL_ROOT.'/'.$url.$file.'.gif')) return $url.$file.'.gif';
return $url.'default.png'; return $url.'default.png';

View File

@ -235,7 +235,7 @@ class rateitBackendModule extends \BackendModule
*/ */
protected function exportRatings() protected function exportRatings()
{ {
$this->import('String'); $this->import('StringUtil');
$rateit = &$this->Template->rateit; $rateit = &$this->Template->rateit;
$options['order'] = 'rating desc'; $options['order'] = 'rating desc';
@ -268,7 +268,7 @@ class rateitBackendModule extends \BackendModule
$intColCounter = 0; $intColCounter = 0;
foreach(array_keys($this->arrExportHeader) as $key) { foreach(array_keys($this->arrExportHeader) as $key) {
$strVal = $arrItem[$key]; $strVal = $arrItem[$key];
$strVal = $this->String->decodeEntities($strVal); $strVal = $this->StringUtil->decodeEntities($strVal);
$strVal = preg_replace(array('/<br.*\/*>/si'), array("\n"), $strVal); $strVal = preg_replace(array('/<br.*\/*>/si'), array("\n"), $strVal);
$strVal = $this->convertEncoding($strVal, $GLOBALS['TL_CONFIG']['characterSet'], 'CP1252'); $strVal = $this->convertEncoding($strVal, $GLOBALS['TL_CONFIG']['characterSet'], 'CP1252');
@ -449,7 +449,7 @@ class rateitBackendModule extends \BackendModule
'typ' => $typ 'typ' => $typ
); );
$this->import('String'); $this->import('StringUtil');
$rateit = &$this->Template->rateit; $rateit = &$this->Template->rateit;
// query ratings // query ratings
@ -484,7 +484,7 @@ class rateitBackendModule extends \BackendModule
$intColCounter = 0; $intColCounter = 0;
foreach(array_keys($this->arrExportHeaderDetails) as $key) { foreach(array_keys($this->arrExportHeaderDetails) as $key) {
$strVal = $arrItem[$key]; $strVal = $arrItem[$key];
$strVal = $this->String->decodeEntities($strVal); $strVal = $this->StringUtil->decodeEntities($strVal);
$strVal = preg_replace(array('/<br.*\/*>/si'), array("\n"), $strVal); $strVal = preg_replace(array('/<br.*\/*>/si'), array("\n"), $strVal);
$strVal = $this->convertEncoding($strVal, $GLOBALS['TL_CONFIG']['characterSet'], 'CP1252'); $strVal = $this->convertEncoding($strVal, $GLOBALS['TL_CONFIG']['characterSet'], 'CP1252');

View File

@ -30,13 +30,18 @@
namespace cgoIT\rateit; namespace cgoIT\rateit;
use cgoIT\rateit\RateItRating;
class RateItFaq extends RateItFrontend { class RateItFaq extends RateItFrontend {
var $rateItRating;
/** /**
* Initialize the controller * Initialize the controller
*/ */
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
$this->rateItRating = new RateItRating();
} }
public function getContentElementRateIt($objRow, $strBuffer) { public function getContentElementRateIt($objRow, $strBuffer) {
@ -54,15 +59,15 @@ class RateItFaq extends RateItFrontend {
$strBuffer = $this->generateForFaqPage($objModule, $strBuffer); $strBuffer = $this->generateForFaqPage($objModule, $strBuffer);
} }
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/onReadyRateIt.js|static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/rateit.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/rateit.min.css||static';
switch ($GLOBALS['TL_CONFIG']['rating_type']) { switch ($GLOBALS['TL_CONFIG']['rating_type']) {
case 'hearts' : case 'hearts' :
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/heart.min.css||static';
break; break;
default: default:
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/star.min.css||static';
} }
} }
} }
@ -144,12 +149,11 @@ class RateItFaq extends RateItFrontend {
->fetchAssoc(); ->fetchAssoc();
if ($actRecord['active']) { if ($actRecord['active']) {
$this->import('rateit\\RateItRating', 'RateItRating'); $this->rateItRating->rkey = $arrFaq['id'];
$this->RateItRating->rkey = $arrFaq['id']; $this->rateItRating->ratingType = 'faq';
$this->RateItRating->ratingType = 'faq'; $this->rateItRating->generate();
$this->RateItRating->generate();
$rating = $this->RateItRating->output(); $rating = $this->rateItRating->output();
} }
} }

View File

@ -66,15 +66,15 @@ abstract class RateItHybrid extends RateItFrontend
$this->strType = $GLOBALS['TL_CONFIG']['rating_type']; $this->strType = $GLOBALS['TL_CONFIG']['rating_type'];
$this->strTextPosition = $GLOBALS['TL_CONFIG']['rating_textposition']; $this->strTextPosition = $GLOBALS['TL_CONFIG']['rating_textposition'];
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/onReadyRateIt.js|static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/rateit.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/rateit.min.css||static';
switch ($this->strType) { switch ($this->strType) {
case 'hearts' : case 'hearts' :
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/heart.min.css||static';
break; break;
default: default:
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/star.min.css||static';
} }
return parent::generate(); return parent::generate();

View File

@ -69,15 +69,15 @@ class RateItNews extends RateItFrontend {
$objTemplate->rateit_rating_after = true; $objTemplate->rateit_rating_after = true;
} }
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/onReadyRateIt.js|static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/rateit.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/rateit.min.css||static';
switch ($GLOBALS['TL_CONFIG']['rating_type']) { switch ($GLOBALS['TL_CONFIG']['rating_type']) {
case 'hearts' : case 'hearts' :
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/heart.min.css||static';
break; break;
default: default:
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/star.min.css||static';
} }
} }
} }

View File

@ -29,14 +29,19 @@
namespace cgoIT\rateit; namespace cgoIT\rateit;
use cgoIT\rateit\RateItRating;
class RateItPage extends \Frontend { class RateItPage extends \Frontend {
var $rateItRating;
/** /**
* Initialize the controller * Initialize the controller
*/ */
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
$this->rateItRating = new RateItRating();
$this->loadDataContainer('settings'); $this->loadDataContainer('settings');
} }
@ -47,11 +52,10 @@ class RateItPage extends \Frontend {
->fetchAssoc(); ->fetchAssoc();
if ($actRecord['active']) { if ($actRecord['active']) {
$this->import('rateit\\RateItRating', 'RateItRating'); $this->rateItRating->rkey = $objPage->id;
$this->RateItRating->rkey = $objPage->id; $this->rateItRating->generate();
$this->RateItRating->generate();
$rating = $this->RateItRating->output(); $rating = $this->rateItRating->output();
$rating .= $this->includeJs(); $rating .= $this->includeJs();
$rating .= $this->includeCss(); $rating .= $this->includeCss();
@ -72,7 +76,7 @@ class RateItPage extends \Frontend {
$strHeadTags = ''; $strHeadTags = '';
if (is_array($GLOBALS['TL_CSS'])) { if (is_array($GLOBALS['TL_CSS'])) {
foreach ($GLOBALS['TL_CSS'] as $script) { foreach ($GLOBALS['TL_CSS'] as $script) {
if ($this->startsWith($script, 'system/modules/rateit/public/css/rateit') === true) { if ($this->startsWith($script, 'bundles/cgoitrateit/public/css/rateit') === true) {
$included = true; $included = true;
break; break;
} }
@ -80,13 +84,13 @@ class RateItPage extends \Frontend {
} }
if (!$included) { if (!$included) {
$strHeadTags = '<link rel="stylesheet" href="'.$this->addStaticUrlTo('system/modules/rateit/public/css/rateit.min.css').'">'; $strHeadTags = '<link rel="stylesheet" href="'.$this->addStaticUrlTo('bundles/cgoitrateit/public/css/rateit.min.css').'">';
switch ($GLOBALS['TL_CONFIG']['rating_type']) { switch ($GLOBALS['TL_CONFIG']['rating_type']) {
case 'hearts' : case 'hearts' :
$strHeadTags .= '<link rel="stylesheet" href="'.$this->addStaticUrlTo('system/modules/rateit/public/css/heart.min.css').'">'; $strHeadTags .= '<link rel="stylesheet" href="'.$this->addStaticUrlTo('bundles/cgoitrateit/public/css/heart.min.css').'">';
break; break;
default: default:
$strHeadTags .= '<link rel="stylesheet" href="'.$this->addStaticUrlTo('system/modules/rateit/public/css/star.min.css').'">'; $strHeadTags .= '<link rel="stylesheet" href="'.$this->addStaticUrlTo('bundles/cgoitrateit/public/css/star.min.css').'">';
} }
} }
return $strHeadTags; return $strHeadTags;
@ -97,7 +101,7 @@ class RateItPage extends \Frontend {
$strHeadTags = ''; $strHeadTags = '';
if (is_array($GLOBALS['TL_JAVASCRIPT'])) { if (is_array($GLOBALS['TL_JAVASCRIPT'])) {
foreach ($GLOBALS['TL_JAVASCRIPT'] as $script) { foreach ($GLOBALS['TL_JAVASCRIPT'] as $script) {
if ($this->startsWith($script, 'system/modules/rateit/public/js/rateit') === true) { if ($this->startsWith($script, 'bundles/cgoitrateit/public/js/rateit') === true) {
$included = true; $included = true;
break; break;
} }
@ -105,8 +109,8 @@ class RateItPage extends \Frontend {
} }
if (!$included) { if (!$included) {
$strHeadTags = '<script' . (($objPage->outputFormat == 'xhtml') ? ' type="text/javascript"' : '') . ' src="' . $this->addStaticUrlTo('system/modules/rateit/public/js/onReadyRateIt.js') . '"></script>' . "\n"; $strHeadTags = '<script' . (($objPage->outputFormat == 'xhtml') ? ' type="text/javascript"' : '') . ' src="' . $this->addStaticUrlTo('bundles/cgoitrateit/public/js/onReadyRateIt.js') . '"></script>' . "\n";
$strHeadTags .= '<script' . (($objPage->outputFormat == 'xhtml') ? ' type="text/javascript"' : '') . ' src="' . $this->addStaticUrlTo('system/modules/rateit/public/js/rateit.js') . '"></script>' . "\n"; $strHeadTags .= '<script' . (($objPage->outputFormat == 'xhtml') ? ' type="text/javascript"' : '') . ' src="' . $this->addStaticUrlTo('bundles/cgoitrateit/public/js/rateit.js') . '"></script>' . "\n";
} }
return $strHeadTags; return $strHeadTags;
} }

View File

@ -67,15 +67,15 @@ class RateItTopRatingsModule extends RateItFrontend
$this->arrTypes = deserialize($this->rateit_types); $this->arrTypes = deserialize($this->rateit_types);
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/onReadyRateIt.js|static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/rateit.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/rateit.min.css||static';
switch ($GLOBALS['TL_CONFIG']['rating_type']) { switch ($GLOBALS['TL_CONFIG']['rating_type']) {
case 'hearts' : case 'hearts' :
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/heart.min.css||static';
break; break;
default: default:
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static'; $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/star.min.css||static';
} }
return parent::generate(); return parent::generate();

View File

@ -33,18 +33,18 @@ use cgoIT\rateit\RateItBackend;
/** /**
* Hooks * Hooks
*/ */
$GLOBALS['TL_HOOKS']['generatePage'][] = array('rateit\\RateItPage', 'generatePage'); $GLOBALS['TL_HOOKS']['generatePage'][] = array('cgoIT\\rateit\\RateItPage', 'generatePage');
$GLOBALS['TL_HOOKS']['rateitAjax'][] = array('rateit\\RateIt', 'doVote'); $GLOBALS['TL_HOOKS']['simpleAjax'][] = array('cgoIT\\rateit\\RateIt', 'doVote');
$GLOBALS['TL_HOOKS']['parseArticles'][] = array('rateit\\RateItNews', 'parseArticle'); $GLOBALS['TL_HOOKS']['parseArticles'][] = array('cgoIT\\rateit\\RateItNews', 'parseArticle');
$GLOBALS['TL_HOOKS']['getContentElement'][] = array('rateit\\RateItFaq', 'getContentElementRateIt'); $GLOBALS['TL_HOOKS']['getContentElement'][] = array('cgoIT\\rateit\\RateItFaq', 'getContentElementRateIt');
$GLOBALS['TL_HOOKS']['parseTemplate'][] = array('rateit\\RateItArticle', 'parseTemplateRateIt'); $GLOBALS['TL_HOOKS']['parseTemplate'][] = array('cgoIT\\rateit\\RateItArticle', 'parseTemplateRateIt');
/** /**
* Back end modules * Back end modules
*/ */
array_insert($GLOBALS['BE_MOD']['content'], count($GLOBALS['BE_MOD']['content']), array_insert($GLOBALS['BE_MOD']['content'], count($GLOBALS['BE_MOD']['content']),
array('rateit' => array ( array('rateit' => array (
'callback' => 'rateit\\RateItBackendModule', 'callback' => 'cgoIT\\rateit\\RateItBackendModule',
'icon' => rateit\RateItBackend::image('icon'), 'icon' => rateit\RateItBackend::image('icon'),
'stylesheet' => rateit\RateItBackend::css('backend'), 'stylesheet' => rateit\RateItBackend::css('backend'),
'javascript' => rateit\RateItBackend::js('RateItBackend') 'javascript' => rateit\RateItBackend::js('RateItBackend')
@ -54,12 +54,12 @@ array_insert($GLOBALS['BE_MOD']['content'], count($GLOBALS['BE_MOD']['content'])
/** /**
* frontend moduls * frontend moduls
*/ */
$GLOBALS['FE_MOD']['application']['rateit'] = 'rateit\\RateItModule'; $GLOBALS['FE_MOD']['application']['rateit'] = 'cgoIT\\rateit\\RateItModule';
$GLOBALS['FE_MOD']['application']['rateit_top_ratings'] = 'rateit\\RateItTopRatingsModule'; $GLOBALS['FE_MOD']['application']['rateit_top_ratings'] = 'cgoIT\\rateit\\RateItTopRatingsModule';
/** /**
* content elements * content elements
*/ */
$GLOBALS['TL_CTE']['includes']['rateit'] = 'rateit\\RateItCE'; $GLOBALS['TL_CTE']['includes']['rateit'] = 'cgoIT\\rateit\\RateItCE';
?> ?>

View File

@ -112,22 +112,4 @@ $GLOBALS['TL_DCA']['tl_settings']['fields']['rating_description'] = array
'inputType' => 'text', 'inputType' => 'text',
'eval' => array('mandatory'=>true, 'allowHtml'=>true, 'tl_class'=>'w50') 'eval' => array('mandatory'=>true, 'allowHtml'=>true, 'tl_class'=>'w50')
); );
class tl_settings_rateit extends rateit\DcaHelper
{
public function getUserFullName() {
$this->import('jicw\\JICWHelper', 'JICWHelper');
return $this->JICWHelper->getUserFullName();
}
public function getUserEmail() {
$this->import('jicw\\JICWHelper', 'JICWHelper');
return $this->JICWHelper->getUserEmail();
}
public function getInstalledModules() {
$this->import('jicw\\JICWHelper', 'JICWHelper');
return $this->JICWHelper->getInstalledModules();
}
}
?> ?>

View File

@ -2,7 +2,7 @@
// Add the colorbox style sheet and javascript // Add the colorbox style sheet and javascript
$GLOBALS['TL_CSS'][] = 'assets/jquery/colorbox/'. COLORBOX .'/css/colorbox.min.css||static'; $GLOBALS['TL_CSS'][] = 'assets/jquery/colorbox/'. COLORBOX .'/css/colorbox.min.css||static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/jquery/colorbox/colorbox-rateit.min.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/jquery/colorbox/colorbox-rateit.min.js|static';
?> ?>

View File

@ -2,7 +2,7 @@
// Add the colorbox style sheet and javascript // Add the colorbox style sheet and javascript
$GLOBALS['TL_CSS'][] = 'assets/jquery/colorbox/'. COLORBOX .'/css/colorbox.min.css||static'; $GLOBALS['TL_CSS'][] = 'assets/jquery/colorbox/'. COLORBOX .'/css/colorbox.min.css||static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/jquery/colorbox/colorbox-rateit.min.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/jquery/colorbox/colorbox-rateit.min.js|static';
?> ?>

View File

@ -2,7 +2,7 @@
// Add the mediabox style sheet and javascript // Add the mediabox style sheet and javascript
$GLOBALS['TL_CSS'][] = 'assets/mootools/mediabox/'. MEDIABOX .'/css/mediaboxAdvBlack21.css||static'; $GLOBALS['TL_CSS'][] = 'assets/mootools/mediabox/'. MEDIABOX .'/css/mediaboxAdvBlack21.css||static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/mootools/mediabox/mediabox-rateit.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/mootools/mediabox/mediabox-rateit.js|static';
?> ?>

View File

@ -2,7 +2,7 @@
// Add the mediabox style sheet // Add the mediabox style sheet
$GLOBALS['TL_CSS'][] = 'assets/mootools/mediabox/'. MEDIABOX .'/css/mediaboxAdvBlack21.css||static'; $GLOBALS['TL_CSS'][] = 'assets/mootools/mediabox/'. MEDIABOX .'/css/mediaboxAdvBlack21.css||static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/mootools/mediabox/mediabox-rateit.js|static'; $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/mootools/mediabox/mediabox-rateit.js|static';
?> ?>

Some files were not shown because too many files have changed in this diff Show More