Commit 057d22b7 authored by speedprogs_de's avatar speedprogs_de
Browse files

added view helpers to format and crop content, edited extension list template, added some partials

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/terfe/branches/ter_fe2@51925 735d13b6-9817-0410-8766-e36946ffe9aa
parent 45d746d1
......@@ -105,9 +105,13 @@
$this->view->assign('tags', $tags);
// Get random authors
$randomAuthorCount = (!empty($this->settings['randomAuthorCount']) ? $this->settings['randomAuthorCount'] : 10);
/*$randomAuthorCount = (!empty($this->settings['randomAuthorCount']) ? $this->settings['randomAuthorCount'] : 10);
$randomAuthors = $this->authorRepository->findRandom($randomAuthorCount);
$this->view->assign('randomAuthors', $randomAuthors);
$this->view->assign('randomAuthors', $randomAuthors);*/
// Get authors
$authors = $this->authorRepository->findAll();
$this->view->assign('authors', $authors);
}
......
<?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!
******************************************************************/
/**
* Crop content view helper
*/
class Tx_TerFe2_ViewHelpers_CropViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
/**
* Disable the escaping interceptor
*/
protected $escapingInterceptorEnabled = FALSE;
/**
* Returns cropped content
*
* @param string $content Content to return
* @param integer $length Text length
* @param boolean $keepWords Crop complete words
* @param string $ending Append string to cropped text
* @return string Cropped content
*/
public function render($content = NULL, $length = 100, $keepWords = TRUE, $ending = '...') {
if ($content === NULL) {
$content = $this->renderChildren();
}
$length = (int) $length;
if (empty($content) || strlen($content) <= abs($length)) {
return $content;
}
$languageObject = (isset($GLOBALS['LANG']) ? $GLOBALS['LANG'] : t3lib_div::makeInstance('language'));
if ($length < 0) {
$content = $languageObject->csConvObj->substr($languageObject->charSet, $content, $length);
$trunc = strpos($content, ' ');
$content = ($trunc && $keepWords ? $ending . substr($content, $trunc) : $ending . $content);
} else {
$content = $languageObject->csConvObj->substr($languageObject->charSet, $content, 0, $length);
$trunc = strrpos($content, ' ');
$content = ($trunc && $keepWords) ? substr($content, 0, $trunc) . $ending : $content . $ending;
}
return $content;
}
}
?>
\ 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!
******************************************************************/
/**
* Format view helper
*/
class Tx_TerFe2_ViewHelpers_FormatViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
/**
* Disable the escaping interceptor
*/
protected $escapingInterceptorEnabled = FALSE;
/**
* Formats content with given function
*
* @param string $content Content format
* @param string $function Function to format the content
* @return string Formated content
*/
public function render($content = NULL, $function) {
if ($content === NULL) {
$content = $this->renderChildren();
}
if (empty($function) || !function_exists($function)) {
throw new Exception('Function "' . $function . '" not found to modify content');
}
return call_user_func($function, $content);
}
}
?>
\ No newline at end of file
......@@ -11,6 +11,12 @@ plugin.tx_terfe2 {
# cat=TER Frontend/settings/120; type=int+; label=Count of random Authors
randomAuthorCount = 10
# cat=TER Frontend/settings/130; type=int+; label=Crop description at this count of signs
descriptionLength = 200
# cat=TER Frontend/settings/130; type=string; label=Date format
dateFormat = F j, Y
}
persistence {
......
......@@ -7,6 +7,8 @@ plugin.tx_terfe2 {
latestCount = {$plugin.tx_terfe2.settings.latestCount}
topRatedCount = {$plugin.tx_terfe2.settings.topRatedCount}
randomAuthorCount = {$plugin.tx_terfe2.settings.randomAuthorCount}
descriptionLength = {$plugin.tx_terfe2.settings.descriptionLength}
dateFormat = {$plugin.tx_terfe2.settings.dateFormat}
}
## Storage settings
......
......@@ -135,7 +135,11 @@
<label index="single_author">Show single Author</label>
<label index="author">Author</label>
<label index="relations">Relations</label>
<label index="categories">Categories</label>
<label index="category">Category</label>
<label index="download">Download</label>
<label index="details">Details</label>
<label index="extension">Extension</label>
<label index="version">Version</label>
<label index="back_to_list">Back to list</label>
<label index="back_to_detail">Back to details</label>
......
{namespace terfe2=Tx_TerFe2_ViewHelpers}
<f:if condition="{authors}">
<f:then>
<ul>
<f:for each="{authors}" as="author">
<li><f:link.action controller="Author" action="show" arguments="{author : author}">{author.name}</f:link.action></li>
</f:for>
</ul>
</f:then>
<f:else>
<f:translate key="msg.no_entries_found"/>
</f:else>
</f:if>
\ No newline at end of file
{namespace terfe2=Tx_TerFe2_ViewHelpers}
<f:if condition="{categories}">
<f:then>
<ul>
<f:for each="{categories}" as="category">
<li><f:link.action controller="Category" action="show" arguments="{category : category}">{category.title}</f:link.action></li>
</f:for>
</ul>
</f:then>
<f:else>
<f:translate key="msg.no_entries_found"/>
</f:else>
</f:if>
\ No newline at end of file
......@@ -2,35 +2,33 @@
<f:if condition="{extensions}">
<f:then>
<f:for each="{extensions}" as="extension">
<div class="tx_terfe2_list_entry <f:if condition='{extension.lastVersion.reviewState} < 0'>tx_terfe2_list_entry_marked</f:if>">
<h5>
<span class="tx_terfe2_list_entry_icon">
<terfe2:extensionIcon version="{extension.lastVersion}" alt="{extension.lastVersion.title}" />
</span>
<f:link.action controller="Extension" action="show" arguments="{extension : extension}">{extension.lastVersion.title} ({extension.extKey})</f:link.action>
<span class="tx_terfe2_extension_list_downloads">
<f:link.action controller="Extension" action="download" arguments="{version : extension.lastVersion}" class="bu">[t3x]</f:link.action>
<f:if condition="{extension.lastVersion.zipFile}">
<f:link.action controller="Extension" action="download" arguments="{version : extension.lastVersion, format : 'zip'}" class="bu">[t3x]</f:link.action>
</f:if>
</span>
</h5>
<div class="tx_terfe2_list_entry_content">
<div class="tx_terfe2_extension_list_description">{extension.lastVersion.description}</div>
<div>
<div class="tx_terfe2_extension_list_information">
<span class="tx_terfe2_extension_list_label"><f:translate key="author"/>: </span>{extension.lastVersion.author.name}<br />
<span class="tx_terfe2_extension_list_label"><f:translate key="relations"/>: </span><f:render partial="InlineCategoryList" arguments="{relations: extension.lastVersion.softwareRelations}"/><br />
<span class="tx_terfe2_extension_list_label"><f:translate key="categories"/>: </span><f:render partial="InlineCategoryList" arguments="{catgories: extension.categories}"/><br />
</div>
<div class="tx_terfe2_extension_list_chart">
<terfe2:chart object="{extension}" method="downloadsByVersion" height="100" width="150" />
<div class="b-news-list3">
<f:for each="{extensions}" as="extension">
<div class="extension-row">
<div class="cl">
<div class="news-container">
<div class="b-news-head">
<h4>
<span class="extension-icon"><terfe2:extensionIcon version="{extension.lastVersion}" alt="{extension.lastVersion.title}" /></span>
<f:link.action controller="Extension" action="show" arguments="{extension : extension}">{extension.lastVersion.title}</f:link.action>
<span class="b-news-head-date"><f:translate key="version"/> {extension.lastVersion.versionString} - <terfe2:dateTime format="{settings.dateFormat}">{extension.lastVersion.uploadDate}</terfe2:dateTime> | <strong><terfe2:format content="{extension.lastVersion.state}" function="ucfirst" /></strong></span>
</h4>
<div class="b-news-facts">
<span class="label"><f:translate key="extension"/>:</span>
{extension.extKey}
<br /><span class="label"><f:translate key="category"/>:</span>
<f:render partial="InlineCategoryList" arguments="{categories: extension.categories}"/>
<!-- <br /><span class="label"><f:translate key="author"/>:</span>
<f:link.action controller="Extension" action="listByAuthor" arguments="{author : extension.lastVersion.author}">{extension.lastVersion.author.name}</f:link.action><br /> -->
</div>
</div>
<p class="b-wi-text"><terfe2:crop length="{settings.descriptionLength}">{extension.lastVersion.description}</terfe2:crop></p>
<span class="bu bu-mini"><f:translate key="details"/></span>
</div>
</div>
</div>
</div>
</f:for>
</f:for>
</div>
</f:then>
<f:else>
<f:translate key="msg.no_entries_found"/>
......
<f:if condition="{categories}">
<f:for each="{categories}" as="{category}" iteration="categoryIteration">
<f:link.action controller="Extension" action="showByCategory" arguments="{category : category}">{category.title}</f:link.action>
<f:if condition="{categoryIteration.isFirst}"><f:then></f:then><f:else>, </f:else></f:if>
<f:for each="{categories}" as="category" iteration="categoryIteration">
<f:link.action controller="Extension" action="listByCategory" arguments="{category : category}">{category.title}</f:link.action><f:if condition="{categoryIteration.isLast}"><f:then></f:then><f:else>, </f:else></f:if>
</f:for>
</f:if>
\ No newline at end of file
<f:if condition="{relations}">
<f:for each="{relations}" as="{relation}" iteration="relationIteration">
<f:link.action controller="Extension" action="showByRelation" arguments="{relation : relation}">{relation.relationKey}</f:link.action>
<f:if condition="{relationIteration.isFirst}"><f:then></f:then><f:else>, </f:else></f:if>
<f:for each="{relations}" as="relation" iteration="relationIteration">
<f:link.action controller="Extension" action="listByRelation" arguments="{relation : relation}">{relation.relationKey}</f:link.action><f:if condition="{relationIteration.isLast}"><f:then></f:then><f:else>, </f:else></f:if>
</f:for>
</f:if>
\ No newline at end of file
{namespace terfe2=Tx_TerFe2_ViewHelpers}
<f:if condition="{tags}">
<f:then>
<ul>
<f:for each="{tags}" as="tag">
<li><f:link.action controller="Tag" action="show" arguments="{tag : tag}">{tag.title}</f:link.action></li>
</f:for>
</ul>
</f:then>
<f:else>
<f:translate key="msg.no_entries_found"/>
</f:else>
</f:if>
\ No newline at end of file
......@@ -24,14 +24,17 @@
</div>
<div class="csc-default show-tab" id="tx_terfe2_tab_categories">
<div class="tab-content ">
<f:render partial="CategoryList" arguments="{categories: categories}"/>
</div>
</div>
<div class="csc-default show-tab" id="tx_terfe2_tab_tags">
<div class="tab-content ">
<f:render partial="TagList" arguments="{tags: tags}"/>
</div>
</div>
<div class="csc-default show-tab" id="tx_terfe2_tab_authors">
<div class="tab-content ">
<f:render partial="AuthorList" arguments="{authors: authors}"/>
</div>
</div>
</div>
......
......@@ -2,66 +2,17 @@ div.tx_terfe2 {
}
div.tx_terfe2_messages {
}
div.tx_terfe2_content {
}
div.tx_terfe2_list_entry {
border: 1px solid #c8c8c8;
border-width: 0 1px 1px;
overflow: hidden;
margin: 0 0 17px 0;
}
div.tx_terfe2_list_entry h5 {
color: #000;
font-size: 12px;
font-weight: normal;
margin: 0;
border-top: 1px solid #c8c8c8;
padding: 6px 6px 5px 0;
cursor: pointer;
background: #EEE url(typo3conf/ext/t3org_template/i/header.png) repeat-x 0 0;
line-height: 18px;
-o-user-select: none;
-webkit-user-select: none;
-moz-user-select: -moz-none;
-khtml-user-select: none;
-ms-user-select: none;
user-select: none;
div.extension-row {
border: 1px solid #C8C8C8;
padding: 16px 15px 16px 15px;
margin-bottom: 25px;
}
div.tx_terfe2_list_entry h5 a {
font-weight: bold;
text-decoration: none;
border-bottom: none;
color: #000;
margin-left: 6px;
div.extension-row span.b-news-head-date {
color: #555555;
}
div.tx_terfe2_list_entry_content {
border-top: 1px solid #C8C8C8;
padding: 13px 15px 13px 25px;
overflow: hidden;
}
span.tx_terfe2_list_entry_icon {
display: block;
float: left;
margin: 1px 0 0 9px;
height: 20px;
width: 20px;
}
span.tx_terfe2_extension_list_downloads {
float: right;
margin-top: -4px;
}
span.tx_terfe2_extension_list_downloads a {
span.label {
width: 64px;
display: inline-block;
}
\ No newline at end of file
......@@ -54,9 +54,11 @@
'Tx_TerFe2_view_extension_listlatestjson' => $extensionClassesPath . 'View/Extension/ListLatestJson.php',
'tx_terfe2_viewhelpers_cdataviewhelper' => $extensionClassesPath . 'ViewHelpers/CdataViewHelper.php',
'tx_terfe2_viewhelpers_chartviewhelper' => $extensionClassesPath . 'ViewHelpers/ChartViewHelper.php',
'tx_terfe2_viewhelpers_cropviewhelper' => $extensionClassesPath . 'ViewHelpers/CropViewHelper.php',
'tx_terfe2_viewhelpers_datetimeviewhelper' => $extensionClassesPath . 'ViewHelpers/DateTimeViewHelper.php',
'tx_terfe2_viewhelpers_documentationlinkviewhelper' => $extensionClassesPath . 'ViewHelpers/DocumentationLinkViewHelper.php',
'tx_terfe2_viewhelpers_extensioniconviewhelper' => $extensionClassesPath . 'ViewHelpers/ExtensionIconViewHelper.php',
'tx_terfe2_viewhelpers_formatviewhelper' => $extensionClassesPath . 'ViewHelpers/FormatViewHelper.php',
'tx_terfe2_viewhelpers_rawviewhelper' => $extensionClassesPath . 'ViewHelpers/RawViewHelper.php',
);
?>
\ No newline at end of file
Supports Markdown
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