Commit e3b892c9 authored by speedprogs_de's avatar speedprogs_de

added controller for versions, readded lastUpdate field to extension model, extended demo templates

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/terfe/branches/ter_fe2@42325 735d13b6-9817-0410-8766-e36946ffe9aa
parent 08959907
......@@ -46,14 +46,20 @@
*/
protected function initializeAction() {
$this->extensionRepository = t3lib_div::makeInstance('Tx_TerFe2_Domain_Repository_ExtensionRepository');
// Pre-parse TypoScript
$typoScriptParser = t3lib_div::makeInstance('Tx_TerFe2_Service_TypoScriptParserService');
$this->settings = $typoScriptParser->getParsed($this->settings);
unset($typoScriptParser);
}
/**
* List action for this controller. Displays all Extensions.
* Index action, displays new and updated extensions
*/
public function indexAction() {
$extensions = $this->extensionRepository->findAll();
$latestCount = (!empty($this->settings['latestCount']) ? $this->settings['latestCount'] : 20);
$extensions = $this->extensionRepository->findNewAndUpdated($latestCount);
$this->view->assign('extensions', $extensions);
}
......
......@@ -53,31 +53,37 @@
protected $hudsonLink;
/**
* category
* @var Tx_TerFe2_Domain_Model_Category
* lastUpdate
* @var DateTime
*/
protected $category;
protected $lastUpdate;
/**
* tag
* categories
* @var Tx_Extbase_Persistence_ObjectStorage<Tx_TerFe2_Domain_Model_Category>
*/
protected $categories;
/**
* tags
* @var Tx_Extbase_Persistence_ObjectStorage<Tx_TerFe2_Domain_Model_Tag>
*/
protected $tag;
protected $tags;
/**
* version
* versions
* @var Tx_Extbase_Persistence_ObjectStorage<Tx_TerFe2_Domain_Model_Version>
*/
protected $version;
protected $versions;
/**
* Constructor. Initializes all Tx_Extbase_Persistence_ObjectStorage instances.
*/
public function __construct() {
$this->tag = new Tx_Extbase_Persistence_ObjectStorage();
$this->version = new Tx_Extbase_Persistence_ObjectStorage();
$this->categories = new Tx_Extbase_Persistence_ObjectStorage();
$this->tags = new Tx_Extbase_Persistence_ObjectStorage();
$this->versions = new Tx_Extbase_Persistence_ObjectStorage();
}
......@@ -145,87 +151,97 @@
/**
* Setter for category
* Setter for lastUpdate
*
* @param Tx_TerFe2_Domain_Model_Category $category category
* @param DataTime $lastUpdate lastUpdate
* @return void
*/
public function setCategory(Tx_TerFe2_Domain_Model_Category $category) {
$this->category = $category;
public function setLastUpdate($lastUpdate) {
$this->lastUpdate = $lastUpdate;
}
/**
* Getter for category
* Getter for hudsonLink
*
* @return Tx_TerFe2_Domain_Model_Category category
* @return DateTime lastUpdate
*/
public function getCategory() {
return $this->category;
public function getLastUpdate() {
return $this->lastUpdate;
}
/**
* Setter for tag
* Getter for categories
*
* @param Tx_Extbase_Persistence_ObjectStorage<Tx_TerFe2_Domain_Model_Tag> $tag tag
* @return void
* @return Tx_Extbase_Persistence_ObjectStorage<Tx_TerFe2_Domain_Model_Category> categories
*/
public function setTag(Tx_Extbase_Persistence_ObjectStorage $tag) {
$this->tag = $tag;
public function getCategories() {
return $this->categories;
}
/**
* Getter for tag
* Adds a category
*
* @return Tx_Extbase_Persistence_ObjectStorage<Tx_TerFe2_Domain_Model_Tag> tag
* @param Tx_TerFe2_Domain_Model_Category The Category to be added
* @return void
*/
public function getTag() {
return $this->tag;
public function addCategory(Tx_TerFe2_Domain_Model_Category $category) {
$this->categories->attach($category);
}
/**
* Adds a Tag
* Removes a category
*
* @param Tx_TerFe2_Domain_Model_Tag The Tag to be added
* @param Tx_TerFe2_Domain_Model_Category The Category to be removed
* @return void
*/
public function addTag(Tx_TerFe2_Domain_Model_Tag $tag) {
$this->tag->attach($tag);
public function removeCategory(Tx_TerFe2_Domain_Model_Category $category) {
$this->categories->detach($category);
}
/**
* Removes a Tag
* Getter for tags
*
* @param Tx_TerFe2_Domain_Model_Tag The Tag to be removed
* @return Tx_Extbase_Persistence_ObjectStorage<Tx_TerFe2_Domain_Model_Tag> tags
*/
public function getTags() {
return $this->tags;
}
/**
* Adds a Tag
*
* @param Tx_TerFe2_Domain_Model_Tag The Tag to be added
* @return void
*/
public function removeTag(Tx_TerFe2_Domain_Model_Tag $tag) {
$this->tag->detach($tag);
public function addTag(Tx_TerFe2_Domain_Model_Tag $tag) {
$this->tags->attach($tag);
}
/**
* Setter for version
* Removes a Tag
*
* @param Tx_Extbase_Persistence_ObjectStorage<Tx_TerFe2_Domain_Model_Version> $version version
* @param Tx_TerFe2_Domain_Model_Tag The Tag to be removed
* @return void
*/
public function setVersion(Tx_Extbase_Persistence_ObjectStorage $version) {
$this->version = $version;
public function removeTag(Tx_TerFe2_Domain_Model_Tag $tag) {
$this->tags->detach($tag);
}
/**
* Getter for version
* Getter for versions
*
* @return Tx_Extbase_Persistence_ObjectStorage<Tx_TerFe2_Domain_Model_Version> version
* @return Tx_Extbase_Persistence_ObjectStorage<Tx_TerFe2_Domain_Model_Version> versions
*/
public function getVersion() {
return $this->version;
public function getVersions() {
return $this->versions;
}
......@@ -236,7 +252,7 @@
* @return void
*/
public function addVersion(Tx_TerFe2_Domain_Model_Version $version) {
$this->version->attach($version);
$this->versions->attach($version);
}
......@@ -247,7 +263,7 @@
* @return void
*/
public function removeVersion(Tx_TerFe2_Domain_Model_Version $version) {
$this->version->detach($version);
$this->versions->detach($version);
}
}
......
......@@ -202,6 +202,12 @@
*/
protected $softwareRelation;
/**
* extension
* @var Tx_TerFe2_Domain_Model_Extension
*/
protected $extension;
/**
* Constructor. Initializes all Tx_Extbase_Persistence_ObjectStorage instances.
......@@ -845,5 +851,26 @@
$this->softwareRelation->detach($softwareRelation);
}
/**
* Setter for extension
*
* @param Tx_TerFe2_Domain_Model_Extension $extension extension
* @return void
*/
public function setExtension(Tx_TerFe2_Domain_Model_Extension $extension) {
$this->extension = $extension;
}
/**
* Getter for extension
*
* @return Tx_TerFe2_Domain_Model_Extension extension
*/
public function getExtension() {
return $this->extension;
}
}
?>
\ No newline at end of file
......@@ -33,5 +33,20 @@
*/
class Tx_TerFe2_Domain_Repository_ExtensionRepository extends Tx_Extbase_Persistence_Repository {
/**
* Returns new and updated extensions
*
* @param integer $latestCount Count of extensions
* @return array An array of extensions
*/
public function findNewAndUpdated($latestCount) {
$query = $this->createQuery();
$query->setLimit((int) $latestCount);
$query->setOrderings(
array('lastUpdate' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING)
);
return $query->execute();
}
}
?>
\ No newline at end of file
......@@ -6,10 +6,10 @@
$TCA['tx_terfe2_domain_model_extension'] = array(
'ctrl' => $TCA['tx_terfe2_domain_model_extension']['ctrl'],
'interface' => array(
'showRecordFieldList' => 'ext_key,forge_link,hudson_link,category,tag,version',
'showRecordFieldList' => 'ext_key,forge_link,hudson_link,last_update,categories,tags,versions',
),
'types' => array(
'1' => array('showitem' => 'ext_key,forge_link,hudson_link,category,tag,version'),
'1' => array('showitem' => 'ext_key,forge_link,hudson_link,last_update,categories,tags,versions'),
),
'palettes' => array(
'1' => array('showitem' => ''),
......@@ -88,23 +88,35 @@
'eval' => 'trim',
),
),
'category' => array(
'last_update' => array(
'exclude' => 1,
'label' => 'LLL:EXT:ter_fe2/Resources/Private/Language/locallang_db.xml:tx_terfe2_domain_model_extension.last_update',
'config' => array(
'type' => 'input',
'size' => 12,
'max' => 20,
'eval' => 'datetime',
'default' => '0',
),
),
'categories' => array(
'exclude' => 0,
'label' => 'LLL:EXT:ter_fe2/Resources/Private/Language/locallang_db.xml:tx_terfe2_domain_model_extension.category',
'label' => 'LLL:EXT:ter_fe2/Resources/Private/Language/locallang_db.xml:tx_terfe2_domain_model_extension.categories',
'config' => array(
'type' => 'inline',
'foreign_table' => 'tx_terfe2_domain_model_category',
'minitems' => 0,
'maxitems' => 1,
'appearance' => array(
'collapse' => 0,
'newRecordLinkPosition' => 'bottom',
),
'type' => 'select',
'size' => 3,
'minitems' => 0,
'maxitems' => 9999,
'autoSizeMax' => 10,
'multiple' => 0,
'foreign_table' => 'tx_terfe2_domain_model_category',
'MM' => 'tx_terfe2_extension_category_mm',
'MM_opposite_field' => 'extensions',
),
),
'tag' => array(
'tags' => array(
'exclude' => 0,
'label' => 'LLL:EXT:ter_fe2/Resources/Private/Language/locallang_db.xml:tx_terfe2_domain_model_extension.tag',
'label' => 'LLL:EXT:ter_fe2/Resources/Private/Language/locallang_db.xml:tx_terfe2_domain_model_extension.tags',
'config' => array(
'type' => 'inline',
'foreign_table' => 'tx_terfe2_domain_model_tag',
......@@ -116,9 +128,9 @@
),
),
),
'version' => array(
'versions' => array(
'exclude' => 0,
'label' => 'LLL:EXT:ter_fe2/Resources/Private/Language/locallang_db.xml:tx_terfe2_domain_model_extension.version',
'label' => 'LLL:EXT:ter_fe2/Resources/Private/Language/locallang_db.xml:tx_terfe2_domain_model_extension.versions',
'config' => array(
'type' => 'inline',
'foreign_table' => 'tx_terfe2_domain_model_version',
......
......@@ -10,9 +10,9 @@
<label index="tx_terfe2_domain_model_extension.ext_key">extKey</label>
<label index="tx_terfe2_domain_model_extension.forge_link">forgeLink</label>
<label index="tx_terfe2_domain_model_extension.hudson_link">hudsonLink</label>
<label index="tx_terfe2_domain_model_extension.category">category</label>
<label index="tx_terfe2_domain_model_extension.tag">tag</label>
<label index="tx_terfe2_domain_model_extension.version">version</label>
<label index="tx_terfe2_domain_model_extension.categories">categories</label>
<label index="tx_terfe2_domain_model_extension.tags">tags</label>
<label index="tx_terfe2_domain_model_extension.versions">versions</label>
<label index="tx_terfe2_domain_model_category">Frontend category of the extension</label>
<label index="tx_terfe2_domain_model_category.title">Title of the category</label>
<label index="tx_terfe2_domain_model_category.description">Description of the category</label>
......@@ -28,7 +28,7 @@
<label index="tx_terfe2_domain_model_version.upload_date">Upload date and time</label>
<label index="tx_terfe2_domain_model_version.upload_comment">The user comment for this version</label>
<label index="tx_terfe2_domain_model_version.download_counter">How many downloads for this version</label>
<label index="tx_terfe2_domain_model_version.status">Status of the extension (beta, stable, obsolete, etc.)</label>
<label index="tx_terfe2_domain_model_version.state">Status of the extension (beta, stable, obsolete, etc.)</label>
<label index="tx_terfe2_domain_model_version.em_category">The category of the extension manager (frontend plugin, backend module, etc.)</label>
<label index="tx_terfe2_domain_model_version.load_order">Loading order in Extension Manager</label>
<label index="tx_terfe2_domain_model_version.modify_tables">Information which existing DB tables will be modified</label>
......
......@@ -10,9 +10,10 @@
<label index="ext_key.description">extKey</label>
<label index="forge_link.description">forgeLink</label>
<label index="hudson_link.description">hudsonLink</label>
<label index="category.description">category</label>
<label index="tag.description">tag</label>
<label index="version.description">version</label>
<label index="last_update.description">lastUpdate</label>
<label index="categories.description">category</label>
<label index="tags.description">tag</label>
<label index="versions.description">version</label>
</languageKey>
</data>
</T3locallang>
\ No newline at end of file
......@@ -10,9 +10,10 @@
<label index="tx_terfe2_domain_model_extension.ext_key">Ext Key</label>
<label index="tx_terfe2_domain_model_extension.forge_link">Forge Link</label>
<label index="tx_terfe2_domain_model_extension.hudson_link">Hudson Link</label>
<label index="tx_terfe2_domain_model_extension.category">Category</label>
<label index="tx_terfe2_domain_model_extension.tag">Tag</label>
<label index="tx_terfe2_domain_model_extension.version">Version</label>
<label index="tx_terfe2_domain_model_extension.last_update">Last update</label>
<label index="tx_terfe2_domain_model_extension.categories">Categories</label>
<label index="tx_terfe2_domain_model_extension.tags">Tags</label>
<label index="tx_terfe2_domain_model_extension.versions">Versions</label>
<label index="tx_terfe2_domain_model_category">Category</label>
<label index="tx_terfe2_domain_model_category.title">Title</label>
......
......@@ -18,4 +18,5 @@ This template displays a EDIT form for the current domain object.
<f:form.textbox property="hudsonLink" /><br />
<f:form.submit value="Edit" />
</f:form>
<f:link.action action="index">Back to listing</f:link.action>
</f:section>
\ No newline at end of file
......@@ -3,16 +3,19 @@
This Template is responsible for creating a table of domain objects.
<f:section name="main">
<h1>Listing for Extension</h1>
<h1>Listing for Extensions</h1>
<f:flashMessages />
<table>
<table cellpadding="4" style="border:1px solid black;">
<tr>
<th><f:translate key="tx_terfe2_domain_model_extension.ext_key" /></th>
<th><f:translate key="tx_terfe2_domain_model_extension.forge_link" /></th>
<th><f:translate key="tx_terfe2_domain_model_extension.hudson_link" /></th>
<th><f:translate key="tx_terfe2_domain_model_extension.categories" /></th>
<th>Add Versions</th>
<th> </th>
<th> </th>
<th> </th>
</tr>
......@@ -22,11 +25,14 @@ This Template is responsible for creating a table of domain objects.
<td><f:link.action action="show" arguments="{extension : extension}"> {extension.extKey}</f:link.action></td>
<td><f:link.action action="show" arguments="{extension : extension}"> {extension.forgeLink}</f:link.action></td>
<td><f:link.action action="show" arguments="{extension : extension}"> {extension.hudsonLink}</f:link.action></td>
<td><f:link.action action="show" arguments="{extension : extension}"><f:for each="{extension.categories}" as="category">{category.title}<br /></f:for></f:link.action></td>
<td><f:link.action action="index" controller="Version" arguments="{extension : extension}">{extension.extKey} (<f:count subject="{extension.versions}" />)</f:link.action></td>
<td><f:link.action action="edit" arguments="{extension : extension}">Edit</f:link.action></td>
<td><f:link.action action="delete" arguments="{extension : extension}">Delete</f:link.action></td>
<td><f:link.action action="new" controller="Version" arguments="{extension : extension}">New Version</f:link.action></td>
</tr>
</f:for>
</table>
<br />
<f:link.action action="new">New Extension</f:link.action>
</f:section>
\ No newline at end of file
......@@ -18,4 +18,5 @@ This template displays a NEW form for the current domain object.
<f:form.textbox property="hudsonLink" /><br />
<f:form.submit value="Create new" />
</f:form>
<f:link.action action="index">Back to listing</f:link.action>
</f:section>
\ No newline at end of file
......@@ -7,7 +7,7 @@ This Template is responsible for creating a single view for a domain object
<f:flashMessages />
<table>
<table cellpadding="4" style="border:1px solid black;">
<tr>
<td><f:translate key="tx_terfe2_domain_model_extension.ext_key" /></td>
<td>{extension.extKey}</td>
......@@ -21,8 +21,8 @@ This Template is responsible for creating a single view for a domain object
<td>{extension.hudsonLink}</td>
</tr>
</table>
<br />
<f:link.action action="edit" arguments="{extension : extension}">Edit</f:link.action>
<f:link.action action="delete" arguments="{extension : extension}">Delete</f:link.action>
<f:link.action action="index">Back to listing</f:link.action>
</f:section>
\ No newline at end of file
......@@ -9,9 +9,11 @@
'Pi1',
array(
'Extension' => 'index, show, new, create, edit, update, delete',
'Version' => 'index, show, new, create',
),
array(
'Extension' => 'create, update, delete',
'Version' => 'create',
)
);
?>
\ No newline at end of file
......@@ -8,9 +8,10 @@ CREATE TABLE tx_terfe2_domain_model_extension (
ext_key tinytext,
forge_link tinytext,
hudson_link tinytext,
category int(11) unsigned DEFAULT '0',
tag int(11) unsigned DEFAULT '0' NOT NULL,
version int(11) unsigned DEFAULT '0' NOT NULL,
last_update int(11) unsigned DEFAULT '0',
categories int(11) unsigned DEFAULT '0',
tags int(11) unsigned DEFAULT '0' NOT NULL,
versions int(11) unsigned DEFAULT '0' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
......@@ -43,6 +44,7 @@ CREATE TABLE tx_terfe2_domain_model_category (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
extensions int(11) unsigned DEFAULT '0' NOT NULL,
title tinytext,
description tinytext,
......@@ -272,4 +274,18 @@ CREATE TABLE tx_terfe2_domain_model_relation (
PRIMARY KEY (uid),
KEY parent (pid)
);
# ======================================================================
# Table configuration for table "tx_terfe2_extension_category_mm"
# ======================================================================
CREATE TABLE tx_terfe2_extension_category_mm (
uid_local int(10) unsigned DEFAULT '0' NOT NULL,
uid_foreign int(10) unsigned DEFAULT '0' NOT NULL,
sorting int(10) unsigned DEFAULT '0' NOT NULL,
sorting_foreign int(10) unsigned DEFAULT '0' NOT NULL,
KEY uid_local (uid_local),
KEY uid_foreign (uid_foreign)
);
\ 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