Skip to content

Commit

Permalink
Merge pull request #26 from jonathanheilmann/v0.1.0
Browse files Browse the repository at this point in the history
[RELEASE] Release of version 0.1.0
  • Loading branch information
jonathanheilmann committed Feb 14, 2017
2 parents 8bac229 + b2a98cd commit 291bbb7
Show file tree
Hide file tree
Showing 33 changed files with 1,526 additions and 231 deletions.
61 changes: 43 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,43 @@
## TYPO3 v4
# Ignore serveral upload and file directories.
/fileadmin/user_upload/
/fileadmin/_temp_/
/uploads/
# Ignore cache
/typo3conf/temp_CACHED*
/typo3conf/temp_fieldInfo.php
# Ignore local config which overrides typo3 config.
# You should include your local stuff with `@include('localconf_local.php');` at the end of localconf.php.
# See http://stackoverflow.com/questions/11905360/how-best-to-manage-typo3-installations-using-git for details.
/typo3conf/localconf_local.php
# Ignore system folders, you should have them symlinked.
# If not comment out the following two entries.
/typo3
/t3lib
# Ignore temp directory.
/typo3temp/
##
# Local
##


##
# https://gist.github.com/jonathanheilmann/79228adada3521a90a54
##

##
# OSX
##
.DS_Store
.AppleDouble
.LSOverride

##
# Windows
##
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk

##
# all OS
##
*.bak

##
# PhpStorm
##
.idea/*
88 changes: 79 additions & 9 deletions Classes/Controller/Pi1Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2014-2016 Jonathan Heilmann <mail@jonathan-heilmann.de>
* (c) 2014-2017 Jonathan Heilmann <mail@jonathan-heilmann.de>
*
* All rights reserved
*
Expand All @@ -24,7 +24,7 @@
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use \TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

/**
Expand All @@ -34,6 +34,22 @@
class Pi1Controller extends ActionController
{

/**
* PageRepository
*
* @var \TYPO3\CMS\Frontend\Page\PageRepository
* @inject
*/
protected $pageRepository = null;

/**
* File Repository
*
* @var \TYPO3\CMS\Core\Resource\FileRepository
* @inject
*/
protected $fileRepository = null;

/**
* data
*
Expand All @@ -53,18 +69,21 @@ public function showAction()

$this->cObj = $this->configurationManager->getContentObject();
$this->data = $this->cObj->data;

// Get localized record
$localizedRecord = $this->pageRepository->getRecordOverlay('tt_content', $this->data, $GLOBALS['TSFE']->sys_language_uid, $GLOBALS['TSFE']->sys_language_mode);
if ($localizedRecord !== false && isset($localizedRecord['_LOCALIZED_UID']))
$this->data = $localizedRecord;

$viewAssign['data'] = $this->data;

// Get images and preview-image
$fileRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
$fileObjects = $fileRepository->findByRelation('tt_content', 'tx_jhphotoswipe_pi1', $this->data['uid']);
$fileObjects = $this->fileRepository->findByRelation('tt_content', 'tx_jhphotoswipe_pi1', isset($this->data['_LOCALIZED_UID']) ? $this->data['_LOCALIZED_UID'] : $this->data['uid']);
$viewAssign['files'] = $fileObjects;
if ($this->settings['flexform']['firstFilePreviewOnly']) {
if ($this->settings['flexform']['firstFilePreviewOnly'])
unset($viewAssign['files'][0]);
}
$previewImage = $fileObjects[0];
$viewAssign['previewImage'] = $previewImage;
$viewAssign['previewImageCaption'] = $previewImage->getProperty('description');

$viewAssign['previewImage'] = $fileObjects[0];

// Get orientation of preview-image
switch ($this->settings['flexform']['preview_orient']) {
Expand All @@ -79,6 +98,57 @@ public function showAction()
$viewAssign['previewOrient'] = 'center';
}

// Signal to modify $viewAssign
$this->signalSlotDispatcher->dispatch(__CLASS__, 'afterShowAction', array(&$viewAssign, $this));

// Assign array to fluid-template
$this->view->assignMultiple($viewAssign);
}

/**
* multi thumbnail action
*
* @return void
*/
public function multiThumbnailAction()
{
// Assign multiple values
$viewAssign = array();

$this->cObj = $this->configurationManager->getContentObject();
$this->data = $this->cObj->data;

// Get localized record
$localizedRecord = $this->pageRepository->getRecordOverlay('tt_content', $this->data, $GLOBALS['TSFE']->sys_language_uid, $GLOBALS['TSFE']->sys_language_mode);
if ($localizedRecord !== false && isset($localizedRecord['_LOCALIZED_UID']))
$this->data = $localizedRecord;

$viewAssign['data'] = $this->data;

// Get images and preview-image
$viewAssign['files'] = $this->fileRepository->findByRelation('tt_content', 'tx_jhphotoswipe_pi1', isset($this->data['_LOCALIZED_UID']) ? $this->data['_LOCALIZED_UID'] : $this->data['uid']);

// CssStyledContent modifications
if (ExtensionManagementUtility::isLoaded('css_styled_content'))
{
$imgList = array();
foreach ($viewAssign['files'] as $file)
$imgList[] = $file->getUid();

$this->data['image'] = implode(',', $imgList);
$this->data['imagewidth'] = $this->settings['flexform']['preview_width'];
$this->data['imageheight'] = $this->settings['flexform']['preview_height'];
$this->data['imagecols'] = $this->settings['flexform']['preview_columns'];
$this->data['imageorient'] = $this->settings['flexform']['preview_orient'];
$this->data['image_noRows'] = $this->settings['flexform']['image_noRows'];
$this->data['imageborder'] = $this->settings['flexform']['imageborder'];
$this->data['imagecaption_position'] = $this->settings['flexform']['imagecaption_position'];
$viewAssign['data'] = $this->data;
}

// Signal to modify $viewAssign
$this->signalSlotDispatcher->dispatch(__CLASS__, 'afterMultiThumbnailAction', array(&$viewAssign, $this));

// Assign array to fluid-template
$this->view->assignMultiple($viewAssign);
}
Expand Down
67 changes: 0 additions & 67 deletions Classes/ViewHelpers/AddJsFooterInlineCodeViewHelper.php

This file was deleted.

65 changes: 65 additions & 0 deletions Classes/ViewHelpers/CssStyledContent/RenderTextpicViewHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php
namespace Heilmann\JhPhotoswipe\ViewHelpers\CssStyledContent;

/***************************************************************
*
* Copyright notice
*
* (c) 2016-2017 Jonathan Heilmann <mail@jonathan-heilmann.de>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script 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 General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\CssStyledContent\Controller\CssStyledContentController;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;

/**
* Class RenderTextpicViewHelperViewHelper
* @package Heilmann\JhPhotoswipe\ViewHelpers\CssStyledContent
*/
class RenderTextpicViewHelper extends AbstractViewHelper
{

/**
* Render method
*
* @param string $typoscriptObjectPath
* @param array $data
* @return string
*/
public function render($typoscriptObjectPath, array $data)
{
$typoscriptObjectPath = GeneralUtility::trimExplode('.', $typoscriptObjectPath, true);
$setup = $GLOBALS['TSFE']->tmpl->setup;
foreach ($typoscriptObjectPath as $pathSegment)
$setup = isset($setup[$pathSegment . '.']) ? $setup[$pathSegment . '.'] : null;
if ($setup === null)
return '';


/** @var CssStyledContentController $cssStyledContentController */
$cssStyledContentController = $this->objectManager->get(CssStyledContentController::class);
/** @var ContentObjectRenderer cObj */
$cssStyledContentController->cObj = $this->objectManager->get(ContentObjectRenderer::class);
$cssStyledContentController->cObj->start($data, 'tt_content');

return $cssStyledContentController->render_textpic('', $setup);
}
}
68 changes: 68 additions & 0 deletions Classes/ViewHelpers/Extension/InListLoadedViewHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
namespace Heilmann\JhPhotoswipe\ViewHelpers\Extension;

/***************************************************************
*
* Copyright notice
*
* (c) 2016-2017 Jonathan Heilmann <mail@jonathan-heilmann.de>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script 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 General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;

/**
* Class InListLoadedViewHelper
* @package Heilmann\JhPhotoswipe\ViewHelpers\Extension
*/
class InListLoadedViewHelper extends AbstractViewHelper
{

/**
* Initialize arguments
*/
public function initializeArguments()
{
parent::initializeArguments();
$this->registerArgument('list', 'string', 'Comma separated list of extensions names that may be loaded, UpperCamelCase', true);
}

/**
* Render method
*
* @return string Name of the loaded extension. If no extension from list ist loaded, false is returned
*/
public function render()
{
$listItems = GeneralUtility::trimExplode(',', $this->arguments['list'], true);

if (count($listItems) >= 1)
foreach ($listItems as $extensionName)
{
$extensionKey = GeneralUtility::camelCaseToLowerCaseUnderscored($extensionName);
$isLoaded = ExtensionManagementUtility::isLoaded($extensionKey);
if ($isLoaded)
return $extensionName;
}

return false;
}
}
Loading

0 comments on commit 291bbb7

Please sign in to comment.