Commit 910b1143 authored by Thorsten Griebenow's avatar Thorsten Griebenow
Browse files

Merge branch '52-bootstrapping-the-ter-detail-view' into 'develop'

Beginning "Bootstrapping the TER detail view"

See merge request !61
parents 0b618283 a373e75c
Pipeline #350 passed with stages
in 1 minute and 46 seconds
<?php
/**
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = '.*';
$GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel'] = 'normal';
\ No newline at end of file
......@@ -35,12 +35,8 @@ define('PATH_tslib', PATH_typo3 . 'sysext/cms/tslib/');
define('PATH_typo3conf', PATH_site . 'typo3conf/');
define('TYPO3_mainDir', 'typo3/');
if (!defined('TYPO3_db')) {
die('The configuration file was not included.');
}
$serviceLocation = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'index.php?id=ter';
$WSDLSource = file_get_contents(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ter') . 'tx_ter.wsdl');
$serviceLocation = $_SERVER['HTTP_HOST'] . 'index.php?id=ter';
$WSDLSource = file_get_contents('tx_ter.wsdl');
$WSDLSource = trim(str_replace('---SERVICE_LOCATION---', $serviceLocation, $WSDLSource));
if (!headers_sent()) {
......@@ -48,5 +44,3 @@ if (!headers_sent()) {
header('Content-Length: ' . strlen($WSDLSource));
}
echo($WSDLSource);
?>
\ No newline at end of file
......@@ -65,7 +65,7 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst
protected $persistenceManager;
/**
* @var Tx_TerFe2_Domain_Repository_UserRepository
* @var \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository
*/
protected $ownerRepository;
......@@ -85,7 +85,7 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst
$this->tagRepository = $this->objectManager->get('Tx_TerFe2_Domain_Repository_TagRepository');
$this->versionRepository = $this->objectManager->get('Tx_TerFe2_Domain_Repository_VersionRepository');
$this->authorRepository = $this->objectManager->get('Tx_TerFe2_Domain_Repository_AuthorRepository');
$this->ownerRepository = $this->objectManager->get(Tx_TerFe2_Domain_Repository_UserRepository::class);
$this->ownerRepository = $this->objectManager->get(\TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository::class);
$this->providerManager = $this->objectManager->get('Tx_TerFe2_Provider_ProviderManager');
$this->session = $this->objectManager->get('Tx_TerFe2_Persistence_Session');
$this->persistenceManager = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::class);
......@@ -196,7 +196,7 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst
$versionHistoryCount = (!empty($this->settings['versionHistoryCount']) ? $this->settings['versionHistoryCount'] : 5);
$skipLatestVersion = (isset($this->settings['skipLatestVersion']) ? $this->settings['skipLatestVersion'] : TRUE);
$loggedInUser = $this->ownerRepository->findCurrent();
//$loggedInUser = $this->ownerRepository->findCurrent();
if ($extension !== NULL &&
$extension instanceof Tx_TerFe2_Domain_Model_Extension &&
......@@ -212,8 +212,8 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst
$this->view->assign('loggedInUser', $loggedInUser);
/** @var Tx_TerFe2_Service_Documentation $documentationService */
$documentationService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_TerFe2_Service_Documentation');
$documentationLink = $documentationService->getDocumentationLink($extension->getExtKey(), $extension->getLastVersion()->getVersionString());
//$documentationService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_TerFe2_Service_Documentation');
//$documentationLink = $documentationService->getDocumentationLink($extension->getExtKey(), $extension->getLastVersion()->getVersionString());
$this->view->assign('documentationLink', $documentationLink);
$GLOBALS['TSFE']->getPageRenderer()->addMetaTag('<meta name="description" content="' . htmlspecialchars($extension->getLastVersion()->getDescription()) . '" />');
......
......@@ -42,7 +42,7 @@ class Tx_TerFe2_Controller_RegisterkeyController extends Tx_TerFe2_Controller_Ab
protected $versionRepository;
/**
* @var Tx_TerFe2_Domain_Repository_UserRepository
* @var \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository
*/
protected $userRepository;
......@@ -100,7 +100,7 @@ class Tx_TerFe2_Controller_RegisterkeyController extends Tx_TerFe2_Controller_Ab
// Register the extension key at ter server, if successfull, add it to the extension table
if ($this->terConnection->registerExtension($extensionData)) {
// Create extension model
$extension = $this->objectManager->create('Tx_TerFe2_Domain_Model_Extension');
$extension = $this->objectManager->get('Tx_TerFe2_Domain_Model_Extension');
$extension->setExtKey($extensionKey);
$extension->setFrontendUser($this->frontendUser['username']);
......@@ -119,9 +119,9 @@ class Tx_TerFe2_Controller_RegisterkeyController extends Tx_TerFe2_Controller_Ab
$extension = $this->extensionRepository->findOneByExtKey($extensionKey);
$message = '';
if ($extension instanceof Tx_TerFe2_Domain_Model_Extension && $extension->getFrontendUser()) {
/** @var Tx_Ajaxlogin_Domain_Model_User $frontendUser */
/** @var \TYPO3\CMS\Extbase\Domain\Model\FrontendUser $frontendUser */
$frontendUser = $this->userRepository->findOneByUsername($extension->getFrontendUser());
if ($frontendUser instanceof Tx_Ajaxlogin_Domain_Model_User) {
if ($frontendUser instanceof \TYPO3\CMS\Extbase\Domain\Model\FrontendUser) {
$message = $this->resolveWSErrorMessage(
$error . '.message',
array(
......@@ -180,7 +180,7 @@ class Tx_TerFe2_Controller_RegisterkeyController extends Tx_TerFe2_Controller_Ab
// );
$countSkipped++;
} else {
$extensionModel = $this->objectManager->create('Tx_TerFe2_Domain_Model_Extension');
$extensionModel = $this->objectManager->get('Tx_TerFe2_Domain_Model_Extension');
$extensionModel->setExtKey($extensionKey);
$extensionModel->setFrontendUser($extension['ownerusername']);
......
......@@ -29,17 +29,11 @@
class Tx_TerFe2_Domain_Repository_ExtensionRepository extends Tx_TerFe2_Domain_Repository_AbstractRepository
{
/**
* @var Tx_TerFe2_Domain_Repository_SearchRepository
*/
protected $searchRepository;
/**
* @var boolean
*/
protected $showInsecure = TRUE;
/**
* Allow the listing of insecure extensions or not
*
......@@ -153,29 +147,6 @@ class Tx_TerFe2_Domain_Repository_ExtensionRepository extends Tx_TerFe2_Domain_R
return $query->execute();
}
/**
* Returns all extensions by an author
*
* @param Tx_TerFe2_Domain_Model_Author $author The Author to search for
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage Objects
*/
public function findByAuthor(Tx_TerFe2_Domain_Model_Author $author)
{
$uids = $this->searchRepository->findUidsByAuthor($author);
// Workaround to enable paginate
$query = $this->createQuery();
$query->getQuerySettings()->setRespectStoragePage(FALSE);
$query->getQuerySettings()->setRespectSysLanguage(FALSE);
$query->setOrderings(
array('extKey' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING)
);
$this->match($query, $query->in('uid', $uids));
return $query->execute();
}
/**
*
* @param string $frontendUser
......
<?php
class Tx_TerFe2_Domain_Repository_UserRepository extends \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository
class \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository extends \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository
{
/**
* Find an Object using the UID of the current fe_user
* @return Tx_Ajaxlogin_Domain_Model_User the current fe_user or null if none
* @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser the current fe_user or null if none
*/
public function findCurrent()
{
......@@ -23,7 +23,7 @@ class Tx_TerFe2_Domain_Repository_UserRepository extends \TYPO3\CMS\Extbase\Doma
/**
* Find an Object using the UID of the current fe_user
* @return Tx_Ajaxlogin_Domain_Model_User
* @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
*/
public function findOneByForgotHashAndEmail($forgotHash, $email)
{
......@@ -43,7 +43,7 @@ class Tx_TerFe2_Domain_Repository_UserRepository extends \TYPO3\CMS\Extbase\Doma
/**
* Find an Object using the UID of the current fe_user
* @return Tx_Ajaxlogin_Domain_Model_User
* @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
*/
public function findOneByVerificationHashAndEmail($verificationHash, $email)
{
......@@ -62,7 +62,7 @@ class Tx_TerFe2_Domain_Repository_UserRepository extends \TYPO3\CMS\Extbase\Doma
}
/**
* @return Tx_Ajaxlogin_Domain_Model_User
* @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
*/
public function findOneByEmail($email)
{
......@@ -80,7 +80,7 @@ class Tx_TerFe2_Domain_Repository_UserRepository extends \TYPO3\CMS\Extbase\Doma
}
/**
* @return Tx_Ajaxlogin_Domain_Model_User
* @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
*/
public function findOneByUsername($username)
{
......@@ -101,7 +101,7 @@ class Tx_TerFe2_Domain_Repository_UserRepository extends \TYPO3\CMS\Extbase\Doma
/**
* Find an Object using the UID of the current fe_user
* @return Tx_Ajaxlogin_Domain_Model_User
* @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
*/
public function findOneByEnableHash($enableHash)
{
......@@ -143,7 +143,7 @@ class Tx_TerFe2_Domain_Repository_UserRepository extends \TYPO3\CMS\Extbase\Doma
/**
* @param $uid
*
* @return Tx_Ajaxlogin_Domain_Model_User
* @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
*/
public function findUserByUid($uid)
{
......
......@@ -143,3 +143,5 @@ plugin.tx_terfe2 {
jqplot.load = 1
}
}
const.page.ter_fe = 1
......@@ -73,6 +73,11 @@ plugin.tx_terfe2 {
}
}
}
\TYPO3\CMS\Extbase\Domain\Model\FrontendUser {
mapping {
tableName = fe_users
}
}
}
}
......@@ -122,3 +127,19 @@ page.includeJSFooterlibs.tx_terfe2 = EXT:ter_fe2/Resources/Public/Javascript/Def
[usergroup = {$plugin.tx_ter_pi1.reviewersFrontendUsergroupUid}] || [globalVar = LIT:1 = {$plugin.tx_terfe2.settings.show.reviewForm}]
plugin.tx_terfe2.settings.show.reviewForm = 1
[global]
##### switch between EXT:solr and EXT:ter_fe2 #####
# EXT:solr
[page|uid = {$const.page.ter_fe}] && [globalVar = GP:tx_terfe2_pi1|action =]
tt_content.list.20.terfe2_pi1 >
tt_content.list.20.terfe2_pi1 = TEXT
tt_content.list.20.terfe2_pi1.value =
[global]
# EXT:ter_fe2
[page|uid = {$const.page.ter_fe}] && [globalString = GP:tx_terfe2_pi1|action = ?*]
tt_content.list.20.solr_pi_results >
tt_content.list.20.solr_pi_results = TEXT
tt_content.list.20.solr_pi_results.value =
[global]
{namespace terfe2=Tx_TerFe2_ViewHelpers}
<div class="ter-ext-single-info ter-ext-info">
<table>
<tr class="ter-ext-single-info-key">
<th>
<f:translate key="extensionKey"/>
</th>
<td><strong>{extension.extKey}</strong></td>
</tr>
<tr>
<th>
<f:translate key="version"/>
</th>
<td>{extension.lastVersion.versionString} <span
class="ter-ext-state ter-ext-state-{extension.lastVersion.state}">{extension.lastVersion.state}</span>
</td>
</tr>
<tr>
<th>
<f:translate key="last_updated"/>
</th>
<td>
<terfe2:dateTime format="{settings.dateFormat}">{extension.lastVersion.uploadDate}</terfe2:dateTime>
</td>
</tr>
<tr>
<th>
<f:translate key="first_upload"/>
</th>
<td>
<terfe2:dateTime format="{settings.dateFormat}">{extension.crdate}</terfe2:dateTime>
</td>
</tr>
<tr>
<th>
<f:translate key="downloads"/>
</th>
<td>
<f:format.number decimals="0" thousandsSeparator="," decimalSeparator=".">{extension.downloads}
</f:format.number>
</td>
</tr>
<dl class="row">
<dt class="col-sm-3"><f:translate key="version" /></dt>
<dd class="col-sm-9">{extension.lastVersion.versionString}</dd>
<dt class="col-sm-3"><f:translate key="last_updated" /></dt>
<dd class="col-sm-9"><terfe2:dateTime format="{settings.dateFormat}">{extension.lastVersion.uploadDate}</terfe2:dateTime></dd>
<dt class="col-sm-3"><f:translate key="first_upload" /></dt>
<dd class="col-sm-9"><terfe2:dateTime format="{settings.dateFormat}">{extension.crdate}</terfe2:dateTime></dd>
<dt class="col-sm-3"><f:translate key="downloads" /></dt>
<dd class="col-sm-9"><f:format.number decimals="0" thousandsSeparator="," decimalSeparator=".">{extension.downloads}</f:format.number></dd>
<f:security.ifHasRole role="{settings.reviewerGroupUid}">
<tr>
<th>Owner:</th>
<td> Name: {owner.name}
<br/>Email: {owner.email}
<br/>Username: {owner.username}
</td>
</tr>
<dt class="col-sm-3">Owner:</dt>
<dd class="col-sm-9">Name: {owner.name}<br />Email: {owner.email}<br />Username: {owner.username}</dd>
</f:security.ifHasRole>
<tr>
<th>
<f:translate key="category"/>
</th>
<td>
<dt class="col-sm-3"><f:translate key="category" /></dt>
<dd class="col-sm-9">
<f:if condition="{extension.lastVersion.emCategory}">
<f:then>
<f:translate key="category_{extension.lastVersion.emCategory}"/>
<f:translate key="category_{extension.lastVersion.emCategory}" />
</f:then>
<f:else>
<f:translate key="none"/>
<f:translate key="none" />
</f:else>
</f:if>
</td>
</tr>
<tr class="ter-ext-single-info-relations">
<th>
<f:translate key="dependencies"/>
</th>
<td>
<f:render partial="InlineRelationList" arguments="{relations: extension.lastVersion.dependencies}"/>
</td>
</tr>
<tr class="ter-ext-single-info-relations">
<th>
<f:translate key="conflicts"/>
</th>
<td>
<f:render partial="InlineRelationList" arguments="{relations: extension.lastVersion.conflicts}"/>
</td>
</tr>
<tr class="ter-ext-single-info-manual">
<th>
<f:translate key="manual"/>
</th>
<td>
</dd>
<dt class="col-sm-3"><f:translate key="dependencies" /></dt>
<dd class="col-sm-9"><f:render partial="InlineRelationList" arguments="{relations: extension.lastVersion.dependencies}" /></dd>
<dt class="col-sm-3"><f:translate key="conflicts" /></dt>
<dd class="col-sm-9"><f:render partial="InlineRelationList" arguments="{relations: extension.lastVersion.conflicts}" /></dd>
<dt class="col-sm-3"><f:translate key="manual" /></dt>
<dd class="col-sm-9">
<f:if condition="{documentationLink}">
<f:then>
<terfe2:raw>{documentationLink}</terfe2:raw>
<f:if condition="{extension.externalManual}">
<br/>
<br />
<f:link.external rel="nofollow" uri="{extension.externalManual}" target="_blank">
<f:translate key="external_manual"/>
<f:translate key="external_manual" />
</f:link.external>
</f:if>
</f:then>
......@@ -100,84 +44,56 @@
<f:if condition="{extension.externalManual}">
<f:then>
<f:link.external rel="nofollow" uri="{extension.externalManual}" target="_blank">
<f:translate key="extension_manual"/>
<f:translate key="extension_manual" />
</f:link.external>
</f:then>
<f:else>
<f:translate key="extension_manual_not_available"/>
<f:translate key="extension_manual_not_available" />
</f:else>
</f:if>
</f:else>
</f:if>
</td>
</tr>
</dd>
<f:if condition="{extension.forgeLink}">
<tr class="ter-ext-single-info-key">
<th>
<f:translate key="bugtracker"/>
</th>
<td>
<dt class="col-sm-3">
<f:translate key="bugtracker" />
</dt>
<dd class="col-sm-9">
<f:link.external rel="nofollow" uri="{extension.forgeLink}" target="_blank">
<f:translate key="found_a_bug"/>
<f:translate key="found_a_bug" />
</f:link.external>
</td>
</tr>
</dd>
</f:if>
<f:if condition="{extension.repositoryUrl}">
<tr class="ter-ext-single-info-key">
<th>
<f:translate key="repository_url"/>
</th>
<td>
<dt class="col-sm-3">
<f:translate key="repository_url" />
</dt>
<dd class="col-sm-9">
<f:link.external rel="nofollow" uri="{extension.repositoryUrl}" target="_blank">
<f:translate key="repository_url_value"/>
<f:translate key="repository_url_value" />
</f:link.external>
</td>
</tr>
</dd>
</f:if>
<f:if condition="{flattrUrl}">
<tr class="ter-ext-single-flattr">
<th>
<f:translate key="donate"/>
</th>
<td>
<dt class="col-sm-3">
<f:translate key="donate" />
</dt>
<dd class="col-sm-9">
<f:link.external uri="{flattrUrl}" target="_blank"><img
src="https://api.flattr.com/button/flattr-badge-large.png"
alt="{f:translate(key:'donate')}"/></f:link.external>
</td>
</tr>
alt="{f:translate(key:'donate')}" /></f:link.external>
</dd>
</f:if>
<f:if condition="{extension.paypalUrl}">
<tr class="ter-ext-single-info-key">
<th>
<f:translate key="like_it"/>
</th>
<td>
<dt class="col-sm-3">
<f:translate key="like_it" />
</dt>
<dd class="col-sm-9">
<f:link.external rel="nofollow" uri="{extension.paypalUrl}" target="_blank">
<f:translate key="donate_url"/>
<f:translate key="donate_url" />
</f:link.external>
</td>
</tr>
</dd>
</f:if>
<f:if condition="{owner.username}">
<tr>
<th>Username</th>
<td>
{owner.username}
</td>
</tr>
</f:if>
<f:if condition="{owner}">
<tr>
<th>
<f:translate key="author"/>
</th>
<td>
{owner.name}
<br/>
<terfe2:userImage user="{owner}" alt="{owner.name}" size="mid"/>
</td>
</tr>
</f:if>
</table>
</div>
<dt class="col-sm-3"><f:translate key="author" /></dt>
<dd class="col-sm-9">{owner.name}</dd>
</dl>
{namespace terfe2=Tx_TerFe2_ViewHelpers}
<table>
<table class="table table-hover">
<thead>
<tr>
<th class="col-sm-3"><i class="fa fa-info"></i> Version</th>
<th class="col-sm-4"><i class="fa fa-comment-o"></i> Upload comment</th>
<th class="col-sm-3">Supports TYPO3 version</th>
<th class="col-sm-2"><i class="fa fa-download"></i> Download</th>
</tr>
</thead>
<tbody>
<f:for each="{versionHistory}" as="version">
<tr
<f:if condition="{version} == {version.extension.lastVersion}">class="latest-version-row"</f:if>
<f:if condition="{version.reviewState} == -1">class="insecure-version-row"</f:if>
<f:if condition="{version} == {version.extension.lastVersion}">class="table-success"</f:if>
<f:if condition="{version.reviewState} == -1">class="table-danger"</f:if>
>
<td class="col1">
<td>
<strong>{version.versionString}</strong>
<br/>
<br />
<small>
<f:format.date format="F d, Y">{version.uploadDate}</f:format.date>
</small>
</td>
<td class="col2">
<td>
<f:format.nl2br>{version.uploadComment}</f:format.nl2br>
</td>
<td>
<f:if condition="{version.typo3Dependency}">
<f:then>
<br/>
<strong>Supports TYPO3 version {version.typo3Dependency.versionString}</strong>
</f:then>
<strong>{version.typo3Dependency.versionString}</strong>
</f:if>
</td>
<td class="col3">
<td>
<f:if condition="{version.reviewState} != -1">
<f:then>
<f:link.action controller="Extension" action="download"
arguments="{extension : extension, versionString : version.versionString, format : 't3x'}"
title="{f:translate(key:'filesize')}: {version.t3xFileSize -> terfe2:filesize()}"
class="ter-download-icon ter-download-icon-t3x">
<f:translate key="download_t3x"/>
</f:link.action>
<f:link.action controller="Extension" action="download"
arguments="{extension : extension, versionString : version.versionString, format : 'zip'}"
title="{f:translate(key:'filesize')}: {version.zipFileSize -> terfe2:filesize()}"
class="ter-download-icon ter-download-icon-zip">
<f:translate key="download_zip"/>
class="btn btn-primary">
<f:translate key="download_zip" />
</f:link.action>
</f:then>
<f:else>
<f:security.ifHasRole role="{settings.reviewerGroupUid}">
<f:then>
<f:link.action controller="Extension" action="download"
arguments="{extension : extension, versionString : version.versionString, format : 't3x'}"
class="ter-download-icon ter-download-icon-t3x"
title="{f:translate(key:'filesize')}: {version.t3xFileSize -> terfe2:filesize()}">
<f:translate key="download_t3x"/>
</f:link.action>
<f:link.action controller="Extension" action="download"
arguments="{extension : extension, versionString : version.versionString, format : 'zip'}"
class="ter-download-icon ter-download-icon-zip"
title="{f:translate(key:'filesize')}: {version.zipFileSize -> terfe2:filesize()}">