Commit 93d0527a authored by christian.zenker's avatar christian.zenker

removed ajax request for banners and included them in the source


git-svn-id: http://svn.t3o.typo3.org/extensions/projects/t3org/randombanners/trunk@2287 e8cb78a8-64f2-4011-8042-bd1ea5058d47
parent 49911bed
......@@ -48,7 +48,14 @@ class Tx_Randombanners_Controller_BannerController extends Tx_Extbase_MVC_Contro
* @return void
*/
public function indexAction() {
$banners = $this->bannerRepository->findAll();
foreach ($banners as $banner) {
if (!($banner->getLogo() instanceof Tx_Extbase_Domain_Model_Dam)) {
$banner->setLogo(Tx_ExtbaseDam_Utility_Dam::getOne('tx_randombanners_domain_model_banner', $banner->getUid(), 'tx_randombanner_dam_images'));
}
}
$this->view->assign('banners', $banners);
}
......@@ -71,20 +78,20 @@ class Tx_Randombanners_Controller_BannerController extends Tx_Extbase_MVC_Contro
*
* @return void
*/
public function listAction() {
// initialization
$banners = $this->bannerRepository->findAll();
foreach ($banners as $banner) {
if (!($banner->getLogo() instanceof Tx_Extbase_Domain_Model_Dam)) {
$banner->setLogo(Tx_ExtbaseDam_Utility_Dam::getOne('tx_randombanners_domain_model_banner', $banner->getUid(), 'tx_randombanner_dam_images'));
}
// increment the displayed counter
// $banner->setDisplayedThisMonth($banner->getDisplayedThisMonth() + 1); // seems rather useless when caching is enabled
}
$this->view->assign('banners', $banners);
}
// public function listAction() {
// // initialization
// $banners = $this->bannerRepository->findAll();
//
// foreach ($banners as $banner) {
// if (!($banner->getLogo() instanceof Tx_Extbase_Domain_Model_Dam)) {
// $banner->setLogo(Tx_ExtbaseDam_Utility_Dam::getOne('tx_randombanners_domain_model_banner', $banner->getUid(), 'tx_randombanner_dam_images'));
// }
//
// // increment the displayed counter
//// $banner->setDisplayedThisMonth($banner->getDisplayedThisMonth() + 1); // seems rather useless when caching is enabled
// }
// $this->view->assign('banners', $banners);
// }
}
......
......@@ -8,8 +8,6 @@ plugin.tx_randombanners {
storagePid = {$plugin.tx_randombanners.persistence.storagePid}
}
settings {
numberOfBannersShown = 0
pid = {$const.page.root}
}
}
......
<div id="randombanners">
<span style="display: none;" id="randombannersUrl"><f:uri.action action="list" pageType="69" pageUid="{settings.pid}" /></span>
<div class="tx-randombanners">
<f:for each="{banners}" as="banner">
<div class="tx-randombanners-item">
<a class="tx-randombanners-link" onclick="clickBanner($(this));" href="<f:uri.external uri='{banner.link}' />" data-itemId="{banner.uid}" target="_blank">
<f:image src="{banner.logo.filePath}{banner.logo.fileName}" alt="{banner.name}" />
</a>
</div>
</f:for>
</div>
</div>
\ No newline at end of file
var banner_position_array = new Array();
function clickBanner(el) {
$.ajax({
url: '/index.php?type=69&tx_randombanners_list[action]=show&tx_randombanners_list[banner]=' + parseInt($(el).attr('rel')) +'&tx_randombanners_list[controller]=Banner',
url: '/index.php?type=69&tx_randombanners_list[action]=show&tx_randombanners_list[banner]=' + parseInt($(el).attr('data-itemId')) +'&tx_randombanners_list[controller]=Banner',
success: function(backData) {
return true;
}
......@@ -87,19 +87,8 @@ function initBanners() {
$(document).ready(function() {
if ($('#randombanners').length > 0) {
if($('#randombannersNumber')) {
// if: load via ajax should be done
$.ajax({
url: $('#randombannersUrl').text(),
success: function(html) {
$('#randombanners').append(html);
initBanners();
}
});
} else {
initBanners();
}
if ($('#randombanners')) {
initBanners();
}
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment