Commit a8360835 authored by robert's avatar robert

Changed a lot in pi3, created tx_terfe_common and converted locallang to XML


git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/terfe/trunk@2450 735d13b6-9817-0410-8766-e36946ffe9aa
parent 2914379f
17.01.2006 Robert Lemke <robert@typo3.org>
~ Changed a lot ...
~ Converted locallang to XML
+ Extracted many functions from tx_terfe_pi1 and created a new common library "tx_terfe_common"
09.01.2006 Robert Lemke <robert@typo3.org>
~ Commit of merge between Michael's and my modifications
......
This diff is collapsed.
......@@ -6,13 +6,13 @@ $TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY.'_pi1']='la
$TCA['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY.'_pi1']='pi_flexform';
t3lib_extMgm::addPiFlexFormValue($_EXTKEY.'_pi1', 'FILE:EXT:ter_fe/flexform_ds_pluginmode_pi1.xml');
t3lib_extMgm::addPlugin(Array('LLL:EXT:ter_fe/locallang_db.php:tt_content.list_type_pi1', $_EXTKEY.'_pi1'),'list_type');
t3lib_extMgm::addPlugin(Array('LLL:EXT:ter_fe/locallang_db.xml:tt_content.list_type_pi1', $_EXTKEY.'_pi1'),'list_type');
$TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY.'_pi2']='layout,select_key,pages,recursive';
t3lib_extMgm::addPlugin(Array('LLL:EXT:ter_fe/locallang_db.php:tt_content.list_type_pi2', $_EXTKEY.'_pi2'),'list_type');
t3lib_extMgm::addPlugin(Array('LLL:EXT:ter_fe/locallang_db.xml:tt_content.list_type_pi2', $_EXTKEY.'_pi2'),'list_type');
$TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY.'_pi3']='layout,select_key,pages,recursive';
t3lib_extMgm::addPlugin(Array('LLL:EXT:ter_fe/locallang_db.php:tt_content.list_type_pi3', $_EXTKEY.'_pi3'),'list_type');
t3lib_extMgm::addPlugin(Array('LLL:EXT:ter_fe/locallang_db.xml:tt_content.list_type_pi3', $_EXTKEY.'_pi3'),'list_type');
if (TYPO3_MODE=='BE') {
$TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']['tx_terfe_pi1_wizicon'] = t3lib_extMgm::extPath($_EXTKEY).'pi1/class.tx_terfe_pi1_wizicon.php';
......
#
# Table structure for table 'tx_terfe_extensions'
#
......@@ -59,45 +58,44 @@ CREATE TABLE tx_terfe_extensiondependencies (
#
CREATE TABLE tx_terfe_reviews (
uid int(11) unsigned DEFAULT '0' NOT NULL auto_increment,
reviewer text NOT NULL,
reviewers text NOT NULL,
extensionkey varchar(30) DEFAULT '' NOT NULL,
version varchar(11) DEFAULT '' NOT NULL,
t3xfilemd5 varchar(32) DEFAULT '' NOT NULL,
reviewstate int(11) DEFAULT '0' NOT NULL,
objections varchar(255) NOT NULL default '',
notes text NOT NULL,
tstamp int(11) NOT NULL default '0',
lastmodified int(11) NOT NULL default '0',
PRIMARY KEY (uid),
);
#
# Table structure for table 'tx_terfe_reviewratings'
#
CREATE TABLE tx_terfe_reviewratings (
uid int(11) unsigned DEFAULT '0' NOT NULL auto_increment,
extensionkey varchar(30) DEFAULT '' NOT NULL,
version varchar(11) DEFAULT '' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
reviewer text NOT NULL,
rating int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (uid)
KEY extkey (extensionkey)
KEY extversion (version)
);
#
# Table structure for table 'tx_terfe_reviewnotes'
#
CREATE TABLE tx_terfe_reviewnotes (
uid int(11) unsigned DEFAULT '0' NOT NULL auto_increment,
reviewuid int(11) unsigned DEFAULT '0' NOT NULL,
extensionkey varchar(30) DEFAULT '' NOT NULL,
version varchar(11) DEFAULT '' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
note text NOT NULL,
reviewer varchar(30) DEFAULT '' NOT NULL,
PRIMARY KEY (uid)
);
# Table structure for review ratings
CREATE TABLE `tx_terfe_ratings` (
`uid` int(11) NOT NULL auto_increment,
`extensionkey` varchar(255) NOT NULL default '',
`version` varchar(255) NOT NULL default '',
`username` varchar(255) NOT NULL default '',
`rating` int(1) NOT NULL default '0',
`notes` text NOT NULL,
`tstamp` int(11) NOT NULL default '0',
PRIMARY KEY (`uid`)
) TYPE = MYISAM ;
#
# Table structure for table 'tx_terfe_reviewemails'
#
......@@ -115,3 +113,16 @@ CREATE TABLE tx_terfe_reviewemails (
PRIMARY KEY (uid)
);
# Table structure for ratings
CREATE TABLE tx_terfe_ratings (
uid int(11) NOT NULL auto_increment,
extensionkey varchar(255) NOT NULL default '',
version varchar(255) NOT NULL default '',
username varchar(255) NOT NULL default '',
rating int(1) NOT NULL default '0',
notes text NOT NULL,
tstamp int(11) NOT NULL default '0',
PRIMARY KEY (uid)
);
<?php
/**
* Language labels for extension "ter_fe"
*
* This file is detected by the translation tool.
*/
$LOCAL_LANG = Array (
'default' => Array (
'pi1_title' => 'TER Frontend',
'pi1_plus_wiz_description' => 'Frontend for the TYPO3 Extensoin Repository',
'pi2_title' => 'TER Extension Key Management',
'pi2_plus_wiz_description' => 'Plugin for registering and managing extension keys',
'pi3_title' => 'TER Reviewing Framework',
'pi3_plus_wiz_description' => 'Plugin for reviewing extensions',
),
'dk' => Array (
),
'de' => Array (
),
'no' => Array (
),
'it' => Array (
),
'fr' => Array (
),
'es' => Array (
),
'nl' => Array (
),
'cz' => Array (
),
'pl' => Array (
),
'si' => Array (
),
'fi' => Array (
),
'tr' => Array (
),
'se' => Array (
),
'pt' => Array (
),
'ru' => Array (
),
'ro' => Array (
),
'ch' => Array (
),
'sk' => Array (
),
'lt' => Array (
),
'is' => Array (
),
'hr' => Array (
),
'hu' => Array (
),
'gl' => Array (
),
'th' => Array (
),
'gr' => Array (
),
'hk' => Array (
),
'eu' => Array (
),
'bg' => Array (
),
'br' => Array (
),
'et' => Array (
),
'ar' => Array (
),
'he' => Array (
),
'ua' => Array (
),
'lv' => Array (
),
'jp' => Array (
),
'vn' => Array (
),
'ca' => Array (
),
'ba' => Array (
),
'kr' => Array (
),
'eo' => Array (
),
'my' => Array (
),
);
?>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<?php
/**
* Language labels for database tables/fields belonging to extension "ter_fe"
*
* This file is detected by the translation tool.
*/
$LOCAL_LANG = Array (
'default' => Array (
'tt_content.list_type_pi1' => 'TER Frontend',
'tt_content.list_type_pi2' => 'TER Registration Key Management',
'tt_content.list_type_pi3' => 'TER Review Framework',
),
'de' => Array (
),
);
?>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<meta type="array">
<description>Database labels</description>
<type>database</type>
<csh_table></csh_table>
<fileId>EXT:ter_fe/locallang_db.xml</fileId>
<labelContext type="array">
<label index="tt_content.list_type_pi1"></label>
<label index="tt_content.list_type_pi2"></label>
<label index="tt_content.list_type_pi3"></label>
</labelContext>
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="tt_content.list_type_pi1">TER Frontend</label>
<label index="tt_content.list_type_pi2">TER Registration Key Management</label>
<label index="tt_content.list_type_pi3">TER Review Framework</label>
</languageKey>
<languageKey index="de" type="array">
</languageKey>
</data>
<orig_hash type="array">
<languageKey index="default" type="array">
<label index="tt_content.list_type_pi1" type="integer">231464011</label>
<label index="tt_content.list_type_pi2" type="integer">236057281</label>
<label index="tt_content.list_type_pi3" type="integer">216498405</label>
</languageKey>
<languageKey index="de" type="array">
</languageKey>
</orig_hash>
<orig_text type="array">
<languageKey index="default" type="array">
</languageKey>
<languageKey index="de" type="array">
</languageKey>
</orig_text>
</T3locallang>
\ No newline at end of file
This diff is collapsed.
......@@ -45,7 +45,7 @@ class tx_terfe_pi1_wizicon {
return $wizardItems;
}
function includeLocalLang() {
include(t3lib_extMgm::extPath('ter_fe').'locallang.php');
include(t3lib_extMgm::extPath('ter_fe').'locallang,xml');
return $LOCAL_LANG;
}
}
......
......@@ -5,19 +5,21 @@ class tx_terfe_ratings{
var $minRating = 1;
var $maxRating = 5;
var $ratingItems = array (1 => 'useless',2=> 'ok',3=>'average',4=>'good',5=>'excellent');
function __construct($extRow,&$backref){
function __construct($extensionRecord,&$backref){
global $TSFE;
$this->extRow = $extRow;
$this->extensionKey = $extRow['extensionkey'];
$this->version = $extRow['version'];
$this->extRow = $extensionRecord;
$this->extensionKey = $extensionRecord['extensionkey'];
$this->version = $extensionRecord['version'];
$this->username = $TSFE->fe_user->user['username'];
$this->backRef = &$backref;
}
/**
* [Describe function...]
*
* @return [type] ...
*/
function renderSingleView_rating() {
global $TSFE;
// return $this->db_getRatings($this->extensionKey,$this->version,$this->username);
......@@ -30,11 +32,11 @@ class tx_terfe_ratings{
} else {
$output .= "Could not save!";
}
}
// Rendering current rating
$output = '<em>Average rating:</em> ';
// $rating = $this->db_getAvgRating($this->extensionKey);
// $output .= $this->num_to_star($rating['average']);
......@@ -46,11 +48,11 @@ class tx_terfe_ratings{
// Rendering rating history
$ratings = $this->db_getRatings($this->extensionKey,$this->version);
if (is_array($ratings)){
$output .= $this->render_rating($rating_summary[$this->version]['avg'],$rating_summary[$this->version]['count']);
$output .= '<h2>Ratings for this extension version</h2><table><thead><tr><th>User</th><th>Rating</th><th>Notes</th></tr></thead>';
foreach ($ratings as $rating){
$output .= '<tr><td>'.$rating['username'].'</td><td>'.$this->num_to_star($rating['rating']).'</td><td>'.htmlspecialchars($rating['notes']).
'</td></tr>';
......@@ -60,6 +62,13 @@ class tx_terfe_ratings{
return $output;
}
/**
* [Describe function...]
*
* @param [type] $avg: ...
* @param [type] $num: ...
* @return [type] ...
*/
function render_rating($avg, $num){
$output = '<span class="t3rating_summary">';
$output .= $avg .'('.$num.' ratings)';
......@@ -68,13 +77,17 @@ class tx_terfe_ratings{
}
/**
* [Describe function...]
*
* @return [type] ...
*/
function can_be_rated(){
if(!$this->username){
return False;
}
if ($this->extRow['authorname'] == $this->username){
return False;
}
......@@ -82,14 +95,18 @@ class tx_terfe_ratings{
return False;
}
return True;
}
}
/**
* [Describe function...]
*
* @return [type] ...
*/
function render_rating_form(){
$output = '<form action="'.t3lib_div::linkThisScript().'" method="POST" class="rating">';
// $output .= '<fieldset style="float:left;">';
$outrows = array();
for ($i=$this->minRating;$i <= $this->maxRating; $i++){
......@@ -99,7 +116,7 @@ class tx_terfe_ratings{
$output .= implode('',array_reverse($outrows));
// $output .= '</fieldset>';
$output .= '<label for="notes">Add your review notes</label><br/><textarea name="notes" id="notes" cols="50" rows="5"></textarea>';
$output .= '<input type="hidden" name="no_cache" value="1"/>';
$output .= '<input type="submit" name="submit" value="Submit rating"/></form>';
......@@ -108,13 +125,19 @@ class tx_terfe_ratings{
}
/**
* [Describe function...]
*
* @param [type] $ratings: ...
* @return [type] ...
*/
function rating_summary($ratings){
if (!is_array($ratings)){
return False;
}
$rating_counter = array();
foreach ($ratings as $rating_row){
$rating_counter[$rating_row['version']][] = $rating_row['rating'];
}
......@@ -128,13 +151,24 @@ class tx_terfe_ratings{
return $rating_avgs;
}
/**
* [Describe function...]
*
* @param [type] $rating_summary: ...
* @param [type] $version: ...
* @return [type] ...
*/
function get_valid_avg($rating_summary,$version){
/* wenn genug Einträge, dann aktuelle Version, sonst ältere mit genug oder alle? */
}
/**
* [Describe function...]
*
* @param [type] $int: ...
* @return [type] ...
*/
function num_to_star($int){
$roundedvalue = round(($int*2), 0)/2;
$img = '<img src="fileadmin/stars/' . $roundedvalue. '.png"'.
......@@ -144,9 +178,13 @@ class tx_terfe_ratings{
}
/**
* [Describe function...]
*
* @param [type] $rating: ...
* @param [type] $notes: ...
* @return [type] ...
*/
function db_saveRating($rating, $notes=''){
if ( $rating > $this->maxRating || $rating < $this->minRating) {return False;}
......@@ -160,15 +198,22 @@ class tx_terfe_ratings{
'username' => $TYPO3_DB->quoteStr($this->username,$table),
'tstamp' => time()
);
$query = $TYPO3_DB->INSERTquery($table,$insertArr);
return $TYPO3_DB->sql(TYPO3_db,$query) ? True : $query;
}
/**
* [Describe function...]
*
* @param [type] $extensionkey: ...
* @param [type] $version: ...
* @param [type] $username: ...
* @return [type] ...
*/
function db_getRatings($extensionkey,$version='',$username=''){
global $TYPO3_DB, $TSFE;
$res = $TYPO3_DB->exec_SELECTquery (
'*',
......@@ -179,22 +224,28 @@ class tx_terfe_ratings{
'',
'version'
);
if ($res) {
$ratings = array();
while ($ratingRow = $TYPO3_DB->sql_fetch_assoc($res))
while ($ratingRow = $TYPO3_DB->sql_fetch_assoc($res))
{
$ratings[]=$ratingRow;
}
return $ratings;
}
}
/**
* [Describe function...]
*
* @param [type] $extensionkey: ...
* @param [type] $version: ...
* @return [type] ...
*/
function db_getAvgRating($extensionkey,$version=''){
global $TYPO3_DB, $TSFE;
$res = $TYPO3_DB->exec_SELECTquery (
'AVG(rating) as average, COUNT(rating) as num_ratings',
......@@ -202,7 +253,7 @@ class tx_terfe_ratings{
'extensionkey =' . $TYPO3_DB->fullQuoteStr($extensionkey,'tx_terfe_ratings')
.($version ? ' AND version = ' . $TYPO3_DB->fullQuoteStr($version,'tx_terfe_ratings') : '')
);
if ($res) {
$ratings = $TYPO3_DB->sql_fetch_assoc($res);
......
<?php
/**
* Language labels for plugin "tx_terfe_pi1"
*
* This file is detected by the translation tool.
*/
$LOCAL_LANG = Array (
'default' => Array (
'general_extensionrepository' => 'Extension Repository',
'general_back' => 'Back',
'general_dateandtimeformat' => 'd-m-y h:m',
'general_view' => 'View',
'general_download' => 'Download',
'general_terdocnotinstalled' => 'Documentation extension not installed',
'general_terdochtmlnotinstalled' => 'No online viewer installed',
'views_new' => 'New and updated',
'views_categories' => 'Categories',
'views_popular' => 'Popular',
'views_search' => 'Search',
'views_fulllist' => 'Full list',
'views_unsupported' => 'Unsupported',
'listview_new_introduction' => 'These extensions have been added or updated during the last %s days:',
'listview_popular_introduction' => 'This list shows the 20 most popular extensions measured by all time download numbers.',
'listview_fulllist_introduction' => 'This is a list of all extension versions which have at least roughly been checked for possible security issues. Although we have taken great care in reviewing these extensions we cannot guarantee that all of them are secure.',
'listview_unsupported_introduction' => 'The following list contains all extensions which have been uploaded recently and have not been reviewed yet or will never be imported into the official repository.',
'listview_unsupported_introduction_warning' => 'WARNING! These extensions have not been checked for security issues. It is not recommended using any of them in a production enviroment!',
'listview_search_searchbutton' => 'Search',
'listview_search_noresult' => 'Sorry, your search had no results.',
'extension_extensionkey' => 'Extension key',
'extension_title' => 'Title',
'extension_version' => 'Version',
'extension_downloads' => 'Downloads',
'extension_state' => 'State',
'extension_state_alpha' => 'Alpha',
'extension_state_beta' => 'Beta',
'extension_state_stable' => 'Stable',
'extension_state_test' => 'Test',
'extension_state_experimental' => 'Experimental',
'extension_state_obsolete' => 'Obsolete',
'extension_reviewstate' => 'Review state',
'extension_reviewstate_0' => 'Not reviewed!',
'extension_reviewstate_1' => 'Passed a basic security check',
'extension_dependencies' => 'Dependencies',
'extension_dependencies_kind_depends' => 'depends on',
'extension_dependencies_kind_conflicts' => 'conflicts with',
'extension_dependencies_kind_suggests' => 'suggests',
'extension_dependencies_kind_recommends' => 'recommends',
'extension_dependencies_kind_replaces' => 'replaces',
'extension_dependencies_someextensionsarenotavailable' => 'Warning: Some of the extensions (or versions) are not available in the official repository!',
'extension_reversedependencies' => 'Reverse dependencies',
'extension_reversedependencies_intro' => 'The following extension versions depend on this extension:',
'extension_authorname' => 'Author',
'extension_category' => 'Category',
'extension_category_be' => 'Backend',
'extension_category_module' => 'Backend Modules',
'extension_category_fe' => 'Frontend',
'extension_category_plugin' => 'Frontend Plugins',
'extension_category_misc' => 'Miscellaneous',
'extension_category_services' => 'Services',
'extension_category_templates' => 'Templates',
'extension_category_example' => 'Examples',
'extension_category_doc' => 'Documentation',
'extension_description' => 'Description',
'extension_ownerusername' => 'Owner',
'extension_uploadcomment' => 'Upload comment',
'extension_lastuploaddate' => 'Updated',
'extension_files' => 'Files',
'extension_filepreview' => 'Preview for file %s',
'extension_documentation' => 'Documentation',
'extensionfiles_downloadcompressedt3x' => 'Download compressed extension .T3X file',
'extensioninfo_views_info' => 'Info',
'extensioninfo_views_details' => 'Details',
'extensioninfo_views_bugs' => 'Bugs',
'extensioninfo_views_feedback' => 'Feedback',
'extensioninfo_views_edit' => 'Edit',
'extensioninfo_views_rating' => 'Ratings',
'extensioninfo_documentation' => 'Documentation',
'extensioninfo_feedback_feedbacktotheauthor' => 'Feedback to the author',
'extensioninfo_feedback_introduction' => '
Use this form to give feedback including bug reports to the author (%s) of this extension.
Remember that kind words are a special kind of fuel for the people donation time and talent
to an Open Source project like TYPO3. So be kind, constructive, encouraging, but honest at
the same time.
',
'extensioninfo_feedback_moreintroduction' => '
Please don\'t try to flatter the author for the sole purpose of getting some support for
free. That is not the point here.
',
'extensioninfo_feedback_yourname' => 'Your name',
'extensioninfo_feedback_youremailaddress' => 'Your email address',
'extensioninfo_feedback_yourcomment' => 'Your comment',
'extensioninfo_feedback_captchainstruction' => 'Please enter the following numbers / letters an submit the form',
'extensioninfo_feedback_sendfeedback' => 'Send feedback',
'extensioninfo_feedback_emailsent' => 'Email sent',
'extensioninfo_feedback_emailsent_details' => 'The feedback was sent to %s.',
'extensioninfo_feedback_invalidemailaddress' => 'ERROR: You did not enter a valid email address (%s)',
'extensioninfo_feedback_invalidcaptcha' => 'ERROR: You did not enter the correct numbers / letters',
),
'dk' => Array (
),
'de' => Array (
),
'no' => Array (
),
'it' => Array (
),
'fr' => Array (
),
'es' => Array (
),
'nl' => Array (
),
'cz' => Array (
),
'pl' => Array (
),
'si' => Array (
),
'fi' => Array (
),
'tr' => Array (
),
'se' => Array (
),
'pt' => Array (
),
'ru' => Array (
),
'ro' => Array (
),
'ch' => Array (
),
'sk' => Array (
),
'lt' => Array (
),
'is' => Array (
),
'hr' => Array (
),
'hu' => Array (
),
'gl' => Array (
),
'th' => Array (
),
'gr' => Array (
),
'hk' => Array (
),
'eu' => Array (
),
'bg' => Array (
),
'br' => Array (
),
'et' => Array (
),
'ar' => Array (
),
'he' => Array (
),
'ua' => Array (
),
'lv' => Array (
),
'jp' => Array (
),
'vn' => Array (
),
'ca' => Array (
),
'ba' => Array (
),
'kr' => Array (
),
'eo' => Array (
),
'my' => Array (
),
);
?>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -45,7 +45,7 @@ class tx_terfe_pi2_wizicon {
return $wizardItems;
}
function includeLocalLang() {
include(t3lib_extMgm::extPath('ter_fe').'locallang.php');