[TYPO3-core] RFC: Integrate mod.web_list.deniedNewTables as opposite of allowedNewTables
Michael Stucki
michael at typo3.org
Fri Jul 6 19:02:14 CEST 2007
REMINDER
Oliver Hader schrieb:
> This is a SVN patch request.
>
> Problem:
> TSconfig mod.web_list.allowedNewTables allows to define a set of tables
> which are allowed as new records on a page. mod.web_list.hideTables
> hides existing records on a page to be displayed but doesn't affect
> creating new records.
>
> Solution:
> Integrate the opposite of allowedNewTables: mod.web_list.deniedNewTables
>
> Documentation changes:
> In doc_core_tsconfig, Page TSconfig, section Web>List (mod.web_list):
> Create a new property after "allowedNewTables":
> * Property: deniedNewTables
> * Data type: list of tablenames
> * Description: If this list is set, then the tables listed here won't
> have a link to "create news" in the page and subpages.
> This also affects "db_new.php" (the display of "Create new record").
> This is the oposite of the previous property "allowedNewTables".
> If allowedNewTables and deniedNewTables contain a common subset,
> allowedNewTables takes precedence.
> Example:
> mod.web_list {
> deniedNewTables = tt_news,tt_content
> }
>
> Branch: Trunk
>
>
> olly
>
>
> ------------------------------------------------------------------------
>
> Index: typo3/db_new.php
> ===================================================================
> --- typo3/db_new.php (Revision 2152)
> +++ typo3/db_new.php (Arbeitskopie)
> @@ -133,8 +133,10 @@
> var $newPagesAfter;
> var $web_list_modTSconfig;
> var $allowedNewTables;
> + var $deniedNewTables;
> var $web_list_modTSconfig_pid;
> var $allowedNewTables_pid;
> + var $deniedNewTables_pid;
> var $code;
> var $R_URI;
>
> @@ -229,16 +231,18 @@
> // Acquiring TSconfig for this module/current page:
> $this->web_list_modTSconfig = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
> $this->allowedNewTables = t3lib_div::trimExplode(',',$this->web_list_modTSconfig['properties']['allowedNewTables'],1);
> + $this->deniedNewTables = t3lib_div::trimExplode(',',$this->web_list_modTSconfig['properties']['deniedNewTables'],1);
>
> // Acquiring TSconfig for this module/parent page:
> $this->web_list_modTSconfig_pid = t3lib_BEfunc::getModTSconfig($this->pageinfo['pid'],'mod.web_list');
> $this->allowedNewTables_pid = t3lib_div::trimExplode(',',$this->web_list_modTSconfig_pid['properties']['allowedNewTables'],1);
> + $this->deniedNewTables_pid = t3lib_div::trimExplode(',',$this->web_list_modTSconfig_pid['properties']['deniedNewTables'],1);
>
> // More init:
> if (!$this->showNewRecLink('pages')) {
> $this->newPagesInto=0;
> }
> - if (!$this->showNewRecLink('pages',$this->allowedNewTables_pid)) {
> + if (!$this->showNewRecLink('pages',$this->allowedNewTables_pid,$this->deniedNewTables_pid)) {
> $this->newPagesAfter=0;
> }
>
> @@ -514,15 +518,32 @@
> }
>
> /**
> - * Returns true if the $table tablename is found in $allowedNewTables (or if $allowedNewTables is empty)
> - *
> + * Returns true if:
> + * - $allowedNewTables and $deniedNewTables are empty
> + * - the $table tablename is found in $allowedNewTables
> + * - the $table tablename is not found in $deniedNewTables and $allowedNewTables is empty
> + *
> + * If $table tablename is found in $allowedNewTables and $deniedNewTables, $allowedNewTables
> + * has priority over $deniedNewTables.
> + *
> * @param string Table name to test if in allowedTables
> * @param array Array of new tables that are allowed.
> - * @return boolean Returns true if the $table tablename is found in $allowedNewTables (or if $allowedNewTables is empty)
> + * @param array Array of new tables that are not allowed.
> + * @return boolean Returns true if a link for creating new records should be displayed for $table
> */
> - function showNewRecLink($table,$allowedNewTables='') {
> - $allowedNewTables = is_array($allowedNewTables) ? $allowedNewTables : $this->allowedNewTables;
> - return !count($allowedNewTables) || in_array($table,$allowedNewTables);
> + function showNewRecLink($table,$allowedNewTables='',$deniedNewTables='') {
> + $allowedNewTables = (is_array($allowedNewTables) ? $allowedNewTables : $this->allowedNewTables);
> + $deniedNewTables = (is_array($deniedNewTables) ? $deniedNewTables : $this->deniedNewTables);
> +
> + if (!count($allowedNewTables) && !count($deniedNewTables)) {
> + return true;
> + } elseif (in_array($table, $allowedNewTables)) {
> + return true;
> + } elseif (!count($allowedNewTables) && !in_array($table, $deniedNewTables)) {
> + return true;
> + } else {
> + return false;
> + }
> }
> }
>
> Index: typo3/class.db_list_extra.inc
> ===================================================================
> --- typo3/class.db_list_extra.inc (Revision 2152)
> +++ typo3/class.db_list_extra.inc (Arbeitskopie)
> @@ -92,6 +92,7 @@
> // External:
> var $alternateBgColors=FALSE; // If true, table rows in the list will alternate in background colors (and have background colors at all!)
> var $allowedNewTables=array(); // Used to indicate which tables (values in the array) that can have a create-new-record link. If the array is empty, all tables are allowed.
> + var $deniedNewTables=array(); // Used to indicate which tables (values in the array) that cannot have a create-new-record link. If the array is empty, all tables are allowed.
> var $newWizards=FALSE; // If true, the control panel will contain links to the create-new wizards for pages and tt_content elements (normally, the link goes to just creating a new element without the wizards!).
>
> var $dontShowClipControlPanels=FALSE; // If true, will disable the rendering of clipboard + control panels.
> @@ -1275,10 +1276,19 @@
> * Returns true if a link for creating new records should be displayed for $table
> *
> * @param string Table name
> - * @return boolean
> + * @return boolean Returns true if a link for creating new records should be displayed for $table
> + * @see SC_db_new::showNewRecLink
> */
> function showNewRecLink($table) {
> - return !count($this->allowedNewTables) || in_array($table,$this->allowedNewTables);
> + if (!count($this->allowedNewTables) && !count($this->deniedNewTables)) {
> + return true;
> + } elseif (in_array($table, $this->allowedNewTables)) {
> + return true;
> + } elseif (!count($this->allowedNewTables) && !in_array($table, $this->deniedNewTables)) {
> + return true;
> + } else {
> + return false;
> + }
> }
>
> /**
> Index: typo3/db_list.php
> ===================================================================
> --- typo3/db_list.php (Revision 2152)
> +++ typo3/db_list.php (Arbeitskopie)
> @@ -219,6 +219,7 @@
> $dblist->clickTitleMode = $this->modTSconfig['properties']['clickTitleMode'];
> $dblist->alternateBgColors=$this->modTSconfig['properties']['alternateBgColors']?1:0;
> $dblist->allowedNewTables = t3lib_div::trimExplode(',',$this->modTSconfig['properties']['allowedNewTables'],1);
> + $dblist->deniedNewTables = t3lib_div::trimExplode(',',$this->modTSconfig['properties']['deniedNewTables'],1);
> $dblist->newWizards=$this->modTSconfig['properties']['newWizards']?1:0;
>
>
--
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/
More information about the TYPO3-team-core
mailing list