Commit d80a30a5 authored by speedprogs_de's avatar speedprogs_de

added view helpers, moved CSS folder to Javascript, add provider name to version object

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/terfe/branches/ter_fe2@51640 735d13b6-9817-0410-8766-e36946ffe9aa
parent 879db2f3
......@@ -199,6 +199,7 @@
$version = $this->objectBuilder->create('Tx_TerFe2_Domain_Model_Version', $versionRow);
$version->setExtension($extension);
$version->setExtensionProvider($this->providerName);
$modified = TRUE;
// Relations
......
<?php
/*******************************************************************
* Copyright notice
*
* (c) 2011 Kai Vogel <kai.vogel@speedprogs.de>, Speedprogs.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 2 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!
******************************************************************/
/**
* CDATA wrapper view helper
*/
class Tx_TerFe2_ViewHelpers_CdataViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
/**
* @var string CDATA wrap
*/
protected $cdataWrap = '<![CDATA[|]]>';
/**
* Renders a CDATA tag around content
*
* @param string $content Content to wrap with CDATA
* @return string Wrapped content
*/
public function render($content = NULL) {
if ($content === NULL) {
$content = $this->renderChildren();
}
return str_replace('|', $content, $this->cdataWrap);
}
}
?>
\ No newline at end of file
<?php
/*******************************************************************
* Copyright notice
*
* (c) 2011 Kai Vogel <kai.vogel@speedprogs.de>, Speedprogs.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 2 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!
******************************************************************/
/**
* Chart view helper
*/
class Tx_TerFe2_ViewHelpers_ChartViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
/**
* Renders a jqPlot chart
*
* @param array $points Array of points on chart
* @return string Chart
*/
public function render($content = NULL) {
if ($content === NULL) {
$content = $this->renderChildren();
}
/*
$(document).ready(function(){
var line1=[['2008-06-30 8:00AM',4], ['2008-7-30 8:00AM',6.5], ['2008-8-30 8:00AM',5.7], ['2008-9-30 8:00AM',9], ['2008-10-30 8:00AM',8.2]];
var plot2 = $.jqplot('chart2', [line1], {
title:'Customized Date Axis',
gridPadding:{right:35},
axes:{
xaxis:{
renderer:$.jqplot.DateAxisRenderer,
tickOptions:{formatString:'%b %#d, %y'},
min:'May 30, 2008',
tickInterval:'1 month'
}
},
series:[{lineWidth:4, markerOptions:{style:'square'}}]
});
});
*/
}
}
?>
\ No newline at end of file
<?php
/*******************************************************************
* Copyright notice
*
* (c) 2011 Kai Vogel <kai.vogel@speedprogs.de>, Speedprogs.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 2 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!
******************************************************************/
/**
* DateTime view helper
*/
class Tx_TerFe2_ViewHelpers_DateTimeViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
/**
* @var string
*/
protected $defaultFormat = '';
/**
* Initialize configuration, will be invoked just before the render method
*
* @return void
*/
public function initialize() {
$ddmmyy = trim($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']);
$hhmm = trim($GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm']);
$this->defaultFormat = trim($ddmmyy . ' ' . $hhmm);
}
/**
* Renders a formated date / time
*
* @param mixed $dateTime Time to format
* @param string $format Format of the resulting time
* @return string Formated time
*/
public function render($dateTime = NULL, $format = '') {
if (empty($format)) {
$format = $this->defaultFormat;
}
if ($dateTime === NULL) {
$dateTime = $this->renderChildren();
}
if (empty($dateTime)) {
$dateTime = new DateTime;
}
if (is_int($dateTime) || is_string($dateTime)) {
return date($format, (int) $dateTime);
}
if ($dateTime instanceof DateTime) {
return $dateTime->format($format);
}
return '';
}
}
?>
\ No newline at end of file
<?php
/*******************************************************************
* Copyright notice
*
* (c) 2011 Kai Vogel <kai.vogel@speedprogs.de>, Speedprogs.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 2 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!
******************************************************************/
/**
* Extension icon view helper
*/
class Tx_TerFe2_ViewHelpers_ExtensionIconViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper {
/**
* @var string
*/
protected $tagName = 'img';
/**
* @var Tx_TerFe2_Provider_ProviderManager
*/
protected $providerManager;
/**
* Inject provider manager
*
* @param Tx_TerFe2_Provider_ProviderManager $providerManager
* @return void
*/
public function injectProviderManager(Tx_TerFe2_Provider_ProviderManager $providerManager) {
$this->providerManager = $providerManager;
}
/**
* Initialize arguments
*
* @return void
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerUniversalTagAttributes();
$this->registerTagAttribute('alt', 'string', 'Specifies an alternate text for an image', TRUE);
}
/**
* Renders an extension icon for given version object
*
* @param Tx_TerFe2_Domain_Model_Version $version Version object
* @param string $fileType File type
* @return string Rendered image tag
*/
public function render(Tx_TerFe2_Domain_Model_Version $version = NULL, $fileType = 'gif') {
if ($version === NULL) {
$version = $this->renderChildren();
}
$imageUrl = 'clear.gif';
$provider = $version->getExtensionProvider();
if (!empty($provider)) {
$imageUrl = $this->providerManager->getProvider($provider)->getIconUrl($version, $fileType);
}
$this->tag->addAttribute('src', $imageUrl);
return $this->tag->render();
}
}
?>
\ No newline at end of file
<?php
/*******************************************************************
* Copyright notice
*
* (c) 2011 Kai Vogel <kai.vogel@speedprogs.de>, Speedprogs.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 2 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!
******************************************************************/
/**
* Raw content view helper
*/
class Tx_TerFe2_ViewHelpers_RawViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
/**
* Disable the escaping interceptor
*/
protected $escapingInterceptorEnabled = FALSE;
/**
* Renders raw content
*
* @param string $content Content to return
* @return string Raw content
*/
public function render($content = NULL) {
if ($content === NULL) {
$content = $this->renderChildren();
}
return $content;
}
}
?>
\ No newline at end of file
......@@ -46,4 +46,4 @@ plugin.tx_terfe2 {
# ======================================================================
# Page object configuration of the extension "ter_fe2"
# ======================================================================
page.includeCSS.tx_terfe2 = EXT:ter_fe2/Resources/Public/CSS/tx_terfe2_default.css
\ No newline at end of file
page.includeCSS.tx_terfe2 = EXT:ter_fe2/Resources/Public/Stylesheet/Default.css
\ No newline at end of file
......@@ -35,5 +35,10 @@
'tx_terfe2_utility_file' => $extensionClassesPath . 'Utility/File.php',
'tx_terfe2_utility_soap' => $extensionClassesPath . 'Utility/Soap.php',
'tx_terfe2_utility_typoscript' => $extensionClassesPath . 'Utility/TypoScript.php',
'tx_terfe2_viewhelpers_cdataviewhelper' => $extensionClassesPath . 'ViewHelpers/CdataViewHelper.php',
'tx_terfe2_viewhelpers_chartviewhelper' => $extensionClassesPath . 'ViewHelpers/ChartViewHelper.php',
'tx_terfe2_viewhelpers_datetimeviewhelper' => $extensionClassesPath . 'ViewHelpers/DateTimeViewHelper.php',
'tx_terfe2_viewhelpers_extensioniconviewhelper' => $extensionClassesPath . 'ViewHelpers/ExtensionIconViewHelper.php',
'tx_terfe2_viewhelpers_rawviewhelper' => $extensionClassesPath . 'ViewHelpers/RawViewHelper.php',
);
?>
\ 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