Commit e4e26764 authored by speedprogs_de's avatar speedprogs_de
Browse files

added paginate relation, added file utility methods

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/terfe/branches/ter_fe2@52128 735d13b6-9817-0410-8766-e36946ffe9aa
parent 7a7e0aef
......@@ -86,23 +86,27 @@
* @return void
*/
public function indexAction() {
// Get all extensions
$extensions = $this->extensionRepository->findAll();
$this->view->assign('extensions', $extensions);
// Get latest extensions
$latestCount = (!empty($this->settings['latestCount']) ? $this->settings['latestCount'] : 10);
/*$latestCount = (!empty($this->settings['latestCount']) ? $this->settings['latestCount'] : 10);
$latestExtensions = $this->extensionRepository->findNewAndUpdated($latestCount);
$this->view->assign('latestExtensions', $latestExtensions);
$this->view->assign('latestExtensions', $latestExtensions);*/
// Get top rated extensions
$topRatedCount = (!empty($this->settings['topRatedCount']) ? $this->settings['topRatedCount'] : 10);
/*$topRatedCount = (!empty($this->settings['topRatedCount']) ? $this->settings['topRatedCount'] : 10);
$topRatedExtensions = $this->extensionRepository->findTopRated($topRatedCount);
$this->view->assign('topRatedExtensions', $topRatedExtensions);
$this->view->assign('topRatedExtensions', $topRatedExtensions);*/
// Get all categories
$categories = $this->categoryRepository->findAll();
$this->view->assign('categories', $categories);
// Get all tags
$tags = $this->tagRepository->findAll();
$this->view->assign('tags', $tags);
/*$tags = $this->tagRepository->findAll();
$this->view->assign('tags', $tags);*/
// Get random authors
/*$randomAuthorCount = (!empty($this->settings['randomAuthorCount']) ? $this->settings['randomAuthorCount'] : 10);
......
......@@ -284,17 +284,18 @@
// Remove existing when successfully fetched new file
if ($toFileExists) {
unlink($toFileName);
self::removeFile($toFileName);
}
// Copy file to new name
$result = t3lib_div::writeFile($toFileName, $fromFile);
return ($result !== FALSE);
}
/**
* Move a file or folder
* Move a file
*
* @param string $fromFileName Existing file
* @param string $toFileName File name of the new file
......@@ -304,12 +305,38 @@
public static function moveFile($fromFileName, $toFileName, $overwrite = FALSE) {
$result = self::copyFile($fromFileName, $toFileName, $overwrite);
if ($result && self::isAbsolutePath($fromFileName)) {
unlink($fromFileName);
self::removeFile($fromFileName);
}
return $result;
}
/**
* Remove a file
*
* @param string $filename Path to the file
* @return boolean TRUE if success
*/
public static function removeFile($filename) {
if (self::fileExists($filename)) {
return unlink($filename);
}
return TRUE;
}
/**
* Remove a directory and all contents
*
* @param string $directory Directory path
* @param boolean $removeNonEmpty Remove non empty directories
* @return TRUE if success
*/
public static function removeDirectory($directory, $removeNonEmpty = TRUE) {
return t3lib_div::rmdir($directory, (bool) $removeNonEmpty);
}
/**
* Check if a URL is located to current server
*
......
......@@ -3,6 +3,9 @@
# ======================================================================
plugin.tx_terfe2 {
settings {
# cat=TER Frontend/settings/90; type=int+; label=List count: Count of Extensions per page in list view
listCount = 10
# cat=TER Frontend/settings/100; type=int+; label=Latest count: Count of latest Extensions
latestCount = 10
......@@ -81,7 +84,7 @@ plugin.tx_terfe2 {
}
libraries {
# cat=TER Frontend/libraries/500; type=string; label=Load jQuery: Load jQuery libraray into footer
# cat=TER Frontend/libraries/500; type=string; label=Load jQuery: Load jQuery libraray into footer
jquery.load = 1
# cat=TER Frontend/libraries/510; type=string; label=Load jqPlot: Load jqPlot libraray into footer
......
......@@ -5,6 +5,7 @@ plugin.tx_terfe2 {
## General settings
settings {
latestCount = {$plugin.tx_terfe2.settings.latestCount}
listCount = {$plugin.tx_terfe2.settings.listCount}
topRatedCount = {$plugin.tx_terfe2.settings.topRatedCount}
randomAuthorCount = {$plugin.tx_terfe2.settings.randomAuthorCount}
descriptionLength = {$plugin.tx_terfe2.settings.descriptionLength}
......
{namespace terfe2=Tx_TerFe2_ViewHelpers}
{namespace p=Tx_Paginate_ViewHelpers}
<f:if condition="{extensions}">
<f:then>
<f:for each="{extensions}" as="extension">
<div class="extension-row">
<p:widget.paginate objects="{extensions}" as="paginateExtensions" configuration="{margin: 2, itemsPerPage: settings.listCount, insertAbove: 1, insertBelow: 1}">
<f:for each="{paginateExtensions}" as="extension">
<div class="extension-row">
<!-- Headline -->
<div class="extension-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}" class="extension-row-toggle">{extension.lastVersion.title}</f:link.action>
<span class="extension-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>
<!-- Headline -->
<div class="extension-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}" class="extension-row-toggle">{extension.lastVersion.title}</f:link.action>
<span class="extension-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>
<!-- Content area -->
<div class="extension-regular">
<!-- Content area -->
<div class="extension-regular">
<!-- Description -->
<div class="extension-description">
<p><terfe2:crop length="{settings.descriptionLength}">{extension.lastVersion.description}</terfe2:crop></p>
</div>
<!-- Description -->
<div class="extension-description">
<p><terfe2:crop length="{settings.descriptionLength}">{extension.lastVersion.description}</terfe2:crop></p>
</div>
<!-- General information -->
<div class="extension-info">
<table>
<tr>
<td class="extension-label"><f:translate key="extension"/>:</td>
<td>{extension.extKey}</td>
</tr>
<tr>
<td class="extension-label"><f:translate key="author"/>:</td>
<td><f:link.action controller="Author" action="show" arguments="{author : extension.lastVersion.author}">{extension.lastVersion.author.name}</f:link.action></td>
</tr>
<tr>
<td class="extension-label"><f:translate key="category"/>:</td>
<td><f:render partial="InlineCategoryList" arguments="{categories: extension.categories}"/></td>
</tr>
<tr>
<td class="extension-label"><f:translate key="votes"/>:</td>
<td><span class="extension-plus">+&nbsp;{extension.votes.positive}</span>&nbsp;&nbsp;|&nbsp;&nbsp;<span class="extension-minus">-&nbsp;{extension.votes.negative}</span></td>
</tr>
</table>
</div>
<!-- General information -->
<div class="extension-info">
<table>
<tr>
<td class="extension-label"><f:translate key="extension"/>:</td>
<td>{extension.extKey}</td>
</tr>
<tr>
<td class="extension-label"><f:translate key="author"/>:</td>
<td><f:link.action controller="Author" action="show" arguments="{author : extension.lastVersion.author}">{extension.lastVersion.author.name}</f:link.action></td>
</tr>
<tr>
<td class="extension-label"><f:translate key="category"/>:</td>
<td><f:render partial="InlineCategoryList" arguments="{categories: extension.categories}"/></td>
</tr>
<tr>
<td class="extension-label"><f:translate key="votes"/>:</td>
<td><span class="extension-plus">+&nbsp;{extension.votes.positive}</span>&nbsp;&nbsp;|&nbsp;&nbsp;<span class="extension-minus">-&nbsp;{extension.votes.negative}</span></td>
</tr>
</table>
</div>
<div class="extension-additional" style="display:none;">
</div>
<div class="extension-additional" style="display:none;">
<!-- Additional description -->
<div class="extension-description">
<!-- Additional description -->
<div class="extension-description">
<!-- Images and other media -->
<div class="extension-images">
<f:if condition="{extension.lastVersion.media}">
<f:for each="{extension.lastVersion.media}" as="media">
<!-- display only images in the list view -->
<f:if condition="{media.type} == 0">
<!-- add shadowbox effect to images -->
<a href="{settings.mediaRootPath}{extension.extKey}/{media.source}" rel="shadowbox[{extension.extKey}]">
<f:image src="{settings.mediaRootPath}{extension.extKey}/{media.source}" width="150" maxHeight="120" alt="{media.title}" />
</a>
</f:if>
</f:for>
</f:if>
</div>
<!-- Images and other media -->
<div class="extension-images">
<f:if condition="{extension.lastVersion.media}">
<f:for each="{extension.lastVersion.media}" as="media">
<!-- display only images in the list view -->
<f:if condition="{media.type} == 0">
<!-- add shadowbox effect to images -->
<a href="{settings.mediaRootPath}{extension.extKey}/{media.source}" rel="shadowbox[{extension.extKey}]">
<f:image src="{settings.mediaRootPath}{extension.extKey}/{media.source}" width="150" maxHeight="120" alt="{media.title}" />
</a>
</f:if>
</f:for>
<!-- Comments / changelog -->
<f:if condition="{extension.lastVersion.uploadComment}">
<div class="lastUploadComment">
<h4><f:translate key="last_upload_comment"/></h4>
<p>{extension.lastVersion.uploadComment}</p>
</div>
</f:if>
</div>
<!-- Comments / changelog -->
<f:if condition="{extension.lastVersion.uploadComment}">
<div class="lastUploadComment">
<h4><f:translate key="last_upload_comment"/></h4>
<p>{extension.lastVersion.uploadComment}</p>
</div>
</f:if>
<div class="detailLink">
<f:link.action action="show" arguments="{extension: extension}"><f:translate key="link.extension_details" /></f:link.action>
</div>
<!--
<div class="accordion ">
<h5 class="a-h open"><span><f:translate key="upload_comment"/></span></h5>
<div class="a-body">
<div class="a-content">
<p>{extension.lastVersion.uploadComment}</p>
</div>
<div class="detailLink">
<f:link.action action="show" arguments="{extension: extension}"><f:translate key="link.extension_details" /></f:link.action>
</div>
<h5 class="a-h closed"><span><f:translate key="version_history"/></span></h5>
<div class="a-body">
<div class="a-content">
<p>TODO: Version history from old upload comments</p>
<!--
<div class="accordion ">
<h5 class="a-h open"><span><f:translate key="upload_comment"/></span></h5>
<div class="a-body">
<div class="a-content">
<p>{extension.lastVersion.uploadComment}</p>
</div>
</div>
</div>
<h5 class="a-h closed"><span><f:translate key="changelog"/></span></h5>
<div class="a-body">
<div class="a-content">
<p>TODO: Changelog from file</p>
<h5 class="a-h closed"><span><f:translate key="version_history"/></span></h5>
<div class="a-body">
<div class="a-content">
<p>TODO: Version history from old upload comments</p>
</div>
</div>
</div>-->
<!--
<h5 class="a-h closed"><span><f:translate key="files"/></span></h5>
<div class="a-body">
<div class="a-content">
<p>TODO: File links (scrollable div), will be displayed in new window (target)</p>
<h5 class="a-h closed"><span><f:translate key="changelog"/></span></h5>
<div class="a-body">
<div class="a-content">
<p>TODO: Changelog from file</p>
</div>
</div>-->
<!--
<h5 class="a-h closed"><span><f:translate key="files"/></span></h5>
<div class="a-body">
<div class="a-content">
<p>TODO: File links (scrollable div), will be displayed in new window (target)</p>
</div>
</div>
</div>
-->
<!--</div>-->
</div>
-->
<!--</div>-->
</div>
<!-- Additional information -->
<div class="extension-info">
<table>
<tr>
<td class="extension-label"><f:translate key="relations"/>:</td>
<td><f:render partial="InlineRelationList" arguments="{relations: extension.lastVersion.filteredSoftwareRelations}"/></td>
</tr>
<!-- <tr>
<td class="extension-label"><f:translate key="reverse_relations"/>:</td>
<td>TODO: Related to this</td>
</tr> -->
<tr>
<td class="extension-label"><f:translate key="manual"/>:</td>
<td><terfe2:documentationLink>{extension.lastVersion}</terfe2:documentationLink></td>
</tr>
<!-- <tr>
<td class="extension-label"><f:translate key="tags"/>:</td>
<td><f:render partial="InlineTagList" arguments="{tags: extension.tags}"/></td>
</tr> -->
<tr>
<td colspan="2"><f:translate key="downloads_by_version"/>:<terfe2:chart object="{extension}" method="downloadsByVersion" height="120" width="200" renderOnLoad="0" /></td>
</tr>
</table>
</div>
<!-- Additional information -->
<div class="extension-info">
<table>
<tr>
<td class="extension-label"><f:translate key="relations"/>:</td>
<td><f:render partial="InlineRelationList" arguments="{relations: extension.lastVersion.filteredSoftwareRelations}"/></td>
</tr>
<!-- <tr>
<td class="extension-label"><f:translate key="reverse_relations"/>:</td>
<td>TODO: Related to this</td>
</tr> -->
<tr>
<td class="extension-label"><f:translate key="manual"/>:</td>
<td><terfe2:documentationLink>{extension.lastVersion}</terfe2:documentationLink></td>
</tr>
<!-- <tr>
<td class="extension-label"><f:translate key="tags"/>:</td>
<td><f:render partial="InlineTagList" arguments="{tags: extension.tags}"/></td>
</tr> -->
<tr>
<td colspan="2"><f:translate key="downloads_by_version"/>:<terfe2:chart object="{extension}" method="downloadsByVersion" height="120" width="200" renderOnLoad="0" /></td>
</tr>
</table>
</div>
<br class="tx_terfe2-clear" />
</div>
<br class="tx_terfe2-clear" />
<!-- Buttons -->
<div class="extension-buttons">
<span class="extension-button extension-row-toggle"><f:translate key="details"/></span>
<span class="extension-button extension-button-right"><f:link.action controller="Extension" action="download" arguments="{extension : extension, version : extension.lastVersion, format : 't3x'}"><f:translate key="download_t3x"/></f:link.action></span>
<f:if condition="{extension.lastVersion.mediaCreated}">
<span class="extension-button extension-button-right"><f:link.action controller="Extension" action="download" arguments="{extension : extension, version : extension.lastVersion, format : 'zip'}"><f:translate key="download_zip"/></f:link.action></span>
</f:if>
</div>
<!-- Buttons -->
<div class="extension-buttons">
<span class="extension-button extension-row-toggle"><f:translate key="details"/></span>
<span class="extension-button extension-button-right"><f:link.action controller="Extension" action="download" arguments="{extension : extension, version : extension.lastVersion, format : 't3x'}"><f:translate key="download_t3x"/></f:link.action></span>
<f:if condition="{extension.lastVersion.mediaCreated}">
<span class="extension-button extension-button-right"><f:link.action controller="Extension" action="download" arguments="{extension : extension, version : extension.lastVersion, format : 'zip'}"><f:translate key="download_zip"/></f:link.action></span>
</f:if>
</div>
</div>
</f:for>
</f:for>
</p:widget.paginate>
</f:then>
<f:else>
<f:translate key="msg.no_entries_found"/>
......
......@@ -19,7 +19,7 @@
<div class="tab-panes">
<div class="csc-default show-tab" id="tx_terfe2_tab_extensions">
<div class="tab-content ">
<f:render partial="ExtensionList" arguments="{extensions: latestExtensions}"/>
<f:render partial="ExtensionList" arguments="{extensions: extensions}"/>
</div>
</div>
<div class="csc-default show-tab" id="tx_terfe2_tab_categories">
......
......@@ -35,6 +35,7 @@ $EM_CONF[$_EXTKEY] = array(
'cms' => '',
'extbase' => '',
'fluid' => '',
'paginate' => '',
),
'conflicts' => array(
),
......
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