Last active
December 21, 2015 13:08
-
-
Save benjaminrau/6310299 to your computer and use it in GitHub Desktop.
FCE to create a linklist with possibilty to choose how target is defined (internal by Page, external by url and filereferences with download)
Also Solution for a downloadAction to serve files for download through a controllerAction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{namespace flux=Tx_Flux_ViewHelpers} | |
{namespace v=Tx_Vhs_ViewHelpers} | |
{namespace w=Tx_Fluidwidget_ViewHelpers} | |
<f:layout name="Content"/> | |
<f:section name="Configuration"> | |
<flux:flexform id="appendixes" label="Appendixes" wizardTab="PRISMA"> | |
<flux:flexform.section name="appendixes" label="Anhänge / Verweise"> | |
<flux:flexform.object name="appendix" label="Anhang / Verweis"> | |
<flux:flexform.field.select name="linkType" label="Verweistyp" items="{page:'Interner Verweis',url:'Externer Verweis beginnend mit http://',filereference:'Dateianhang'}"></flux:flexform.field.select> | |
<flux:flexform.field.select name="linkIcon" label="Link Icon" items="{0:'kein Icon',calendar:'Kalender',bubble:'Sprechblase'}"></flux:flexform.field.select> | |
<flux:flexform.field.input name="linkTitle" label="Link Titel"/> | |
<flux:flexform.field.file name="filereference" label="Dateianhang" size="1" minItems="0" maxItems="1" displayCond="<![CDATA[FIELD:linkType:=:filereference]]>"/> | |
<flux:flexform.field.input name="page" label="Interner Verweis" displayCond="<![CDATA[FIELD:linkType:=:page]]>"> | |
<flux:flexform.field.wizard.link label="Linkziel wählen" activeTab="pages" /> | |
</flux:flexform.field.input> | |
<flux:flexform.field.input name="url" label="Externer Verweis" displayCond="<![CDATA[FIELD:linkType:=:url]]>"/> | |
<flux:flexform.field.custom name="warning" displayCond="<![CDATA[FIELD:linkType:REQ:FALSE]]>"> | |
<strong style="color: red;">Please save the record configure link target.</strong> | |
</flux:flexform.field.custom> | |
</flux:flexform.object> | |
</flux:flexform.section> | |
</flux:flexform> | |
</f:section> | |
<f:section name="Preview"> | |
<f:for each="{appendixes}" as="single"> | |
{single.appendix.linkTitle}<br> | |
</f:for> | |
</f:section> | |
<f:section name="Resources"> | |
</f:section> | |
<f:section name="Appendix"> | |
<v:switch value="{single.appendix.linkType}"> | |
<v:case case="page" break="TRUE"> | |
<a href="{f:uri.page(pageUid:single.appendix.page)}" title="{single.appendix.linkTitle}">{single.appendix.linkIcon->v:format.prepend(add:'<i class="icon-prisma-')->v:format.append(add:'"></i> ')->f:if(condition:single.appendix.linkIcon)} <strong>{single.appendix.linkTitle}</strong></a> | |
</v:case> | |
<v:case case="url" break="TRUE"> | |
<a href="{single.appendix.url}" title="{single.appendix.linkTitle}">{single.appendix.linkIcon->v:format.prepend(add:'<i class="icon-prisma-')->v:format.append(add:'"></i> ')->f:if(condition:single.appendix.linkIcon)} <strong>{single.appendix.linkTitle}</strong></a> | |
</v:case> | |
<v:case case="filereference" break="TRUE"> | |
<f:link.action controller="Task" pluginName="Task" action="download" extensionName="prisma" arguments="{target:single.appendix.filereference,mode:'passthrough'}">{single.appendix.linkIcon->v:format.prepend(add:'<i class="icon-prisma-')->v:format.append(add:'"></i> ')->f:if(condition:single.appendix.linkIcon)} <strong>{single.appendix.linkTitle}</strong></f:link.action> | |
</v:case> | |
</v:switch> | |
</f:section> | |
<f:section name="Main"> | |
<div class="appendixes"> | |
<f:if condition="{appendixes->f:count()}>1"> | |
<f:then> | |
<ul class="unstyled"> | |
<f:for each="{appendixes}" as="single"> | |
<li> | |
<f:render section="Appendix" arguments="{single:single}" /> | |
</li> | |
</f:for> | |
</ul> | |
</f:then> | |
<f:else> | |
<f:for each="{appendixes}" as="single"> | |
<f:render section="Appendix" arguments="{single:single}" /> | |
</f:for> | |
</f:else> | |
</f:if> | |
</div> | |
</f:section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make TaskController available | |
lib.prismatasks = USER | |
lib.prismatasks { | |
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run | |
pluginName = Task | |
extensionName = Prisma | |
controller = Task | |
vendorName = Codearts | |
action={GP:tx_prisma_task|action} | |
settings =< plugin.tx_prisma.settings | |
persistence =< plugin.tx_prisma.persistence | |
view =< plugin.tx_prisma.view | |
} | |
page.9999999 = COA | |
page.9999999 { | |
10 =< lib.prismatasks | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Codearts\Prisma\Controller; | |
/*************************************************************** | |
* Copyright notice | |
* | |
* (c) 2013 Benjamin Rau <rau@codearts.at>, Interwall | |
* | |
* 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! | |
***************************************************************/ | |
/** | |
* | |
* | |
* @package prisma | |
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later | |
* | |
*/ | |
class TaskController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController { | |
public function defaultAction() { | |
} | |
/** | |
* downloadAction | |
* | |
* @param string $target | |
* @param string $mode | |
* @return string | |
*/ | |
public function downloadAction($target=NULL, $mode='basic') { | |
if ($mode != 'passthrough') { | |
header('Location: ' . $target); | |
} else { | |
$absoluteTargetPath = \t3lib_div::getFileAbsFileName($target); | |
if (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { | |
header('Pragma: public'); | |
header('Expires: 0'); | |
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); | |
header('Content-type: application-download'); | |
header('Content-length: ' . filesize($absoluteTargetPath)); | |
header('Content-Transfer-Encoding: binary'); | |
} else { | |
header('Content-type: ' . mime_content_type($absoluteTargetPath)); | |
} | |
$handle = fopen($absoluteTargetPath, 'rb'); | |
$chunkSize = 1048576; | |
header('Content-disposition: attachment; filename="' . basename($absoluteTargetPath) . '"'); | |
while (FALSE === feof($handle)) { | |
echo fread($handle, $chunkSize); | |
ob_flush(); | |
flush(); | |
} | |
fclose($handle); | |
} | |
exit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't think that
is working, because the field "linkType" is in a flux:flexform.object, it's not on the first level. That's why it should be something like
(but this is also not working)