[TYPO3] TSConfig restrict languages by pagetree

Grégory Duchesnes g.duchesnes at free.fr
Wed Aug 13 17:44:49 CEST 2008


Answering to myself :

I made it and here is my solution (no XCLASS, prettu proud of this one).


I created the following hook (page and group ids are hard coded for  
now but will be stored in TSConfig) :

<?php

class tx_myext_t3libuserauthgroup {

	function recordEditAccessInternals ($params,&$parent) {
		if( // check for context, i don't want this behavior on any page and  
table
			$params['table'] == 'tx_myext_news'
			&& $params['idOrRow']['pid'] == '58'
			&& $params['idOrRow']['sys_language_uid'] == '0'
		) {
			if(!isset($parent->userGroups[2])) { // only member of groupid=2  
are allowed to edit default language
				$parent->errorMsg = 'You can only translate this document';
				return false;
			}
		}
		
		return true;
	}
}

?>


and in localconf.php

require_once 
(t3lib_extMgm 
::extPath('flb_myext').'class.tx_flbmyext_t3lib_userauthgroup.php');
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/ 
class.t3lib_userauthgroup.php']['recordEditAccessInternals'][] =  
'tx_flbmyext_t3libuserauthgroup->recordEditAccessInternals';



Hope it's gonna be useful to someone else

regards,
Duch


Le 13 août 08 à 15:04, Grégory Duchesnes a écrit :

> Thanks for your hint, i'm not using templavoilà but i will try to
> adapt the concept to my case. The only thing i have to find is the
> right xclass or hook to unset the undesired language in the list view
> of my table.
>
> Anyone knows?
>
> Duch
>
> Le 13 août 08 à 13:21, Xavier Perseguers a écrit :
>
>> Hi Grégory,
>>
>>> Is there a mean (by TSConfig or anything else) to restrict editiing
>>> of a
>>> specific language under a given page tree? and this only for a
>>> specific
>>> user (gasp) since the site administrator should be able to edit
>>> content
>>> in any language.
>>> By the way, contents stored in this shared page tree are not  
>>> standard
>>> CTypes but table entries, so i might be able to digg into the TCA  
>>> for
>>> that, is it possible to make conditions in the TCA?
>>
>> I did something like that for a website where I wanted the default
>> language to be sometimes English, German or French and then being  
>> able
>> to translate it into the other languages. And for this I had to  
>> create
>> the English language as another possible language overlay. Default
>> language being said to be French, English or German with pageTS:
>>
>> mod.SHARED {
>> 	defaultLanguageFlag = fr.gif
>> 	defaultLanguageLabel = French
>> }
>>
>> I then had to "remove" one of the available translation languages  
>> that
>> was shown with TemplaVoila (or the default page form too but I use TV
>> and as such did the stuff for it). The idea was to remove French as
>> translation in this case when default language was already in French,
>> leaving only German and English as overlay languages. For this I
>> created
>> a new option to mod.SHARED:
>>
>> mod.SHARED {
>> 	disableLanguages = 2
>> }
>>
>> where 2 stands for the UID of sys_language French in my website and
>> then
>> XCLASSed TV to use this new option:
>>
>> class ux_tx_templavoila_module1 extends tx_templavoila_module1 {
>> 	
>> 	function getAvailableLanguages($id=0, $onlyIsoCoded=true,
>> $setDefault=true, $setMulti=false)	{
>> 		$languages = parent::getAvailableLanguages($id, $onlyIsoCoded,
>> $setDefault, $setMulti);
>> 		
>> 		$disableLanguages = t3lib_div::trimExplode(',',
>> $this->modSharedTSconfig['properties']['disableLanguages'], 1);
>> 		
>> 		foreach ($disableLanguages as $pid) {
>> 			unset($languages[$pid]);
>> 		}
>> 		
>> 		return $languages;
>> 	}
>>
>> }
>>
>> I hope you'll get an idea for your problem.
>>
>> -- 
>> Xavier Perseguers
>> http://xavier.perseguers.ch/en/tutorials/typo3.html
>> _______________________________________________
>> TYPO3-english mailing list
>> TYPO3-english at lists.netfielders.de
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
>>
>
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
>



More information about the TYPO3-english mailing list