-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
fritzmg
committed
Feb 13, 2016
1 parent
3d3a72e
commit e79d75b
Showing
9 changed files
with
111 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* | ||
* Extension to replace the ArticleModel in order to allow inheritable articles | ||
* | ||
* @copyright inspiredminds 2015 | ||
* @copyright inspiredminds 2016 | ||
* @package inherit_article | ||
* @link http://www.inspiredminds.at | ||
* @author Fritz Michael Gschwantner <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* | ||
* Extension to replace the ArticleModel in order to allow inheritable articles | ||
* | ||
* @copyright inspiredminds 2015 | ||
* @copyright inspiredminds 2016 | ||
* @package inherit_article | ||
* @link http://www.inspiredminds.at | ||
* @author Fritz Michael Gschwantner <[email protected]> | ||
|
@@ -16,7 +16,9 @@ | |
/** | ||
* Add palettes to tl_article | ||
*/ | ||
$GLOBALS['TL_DCA']['tl_article']['palettes']['default'] = str_replace( '{publish_legend', '{inherit_legend:hide},inherit,inheritLevel,inheritAfter;{publish_legend', $GLOBALS['TL_DCA']['tl_article']['palettes']['default']); | ||
$GLOBALS['TL_DCA']['tl_article']['palettes']['default'] = str_replace( '{publish_legend', '{inherit_legend:hide},inherit;{publish_legend', $GLOBALS['TL_DCA']['tl_article']['palettes']['default']); | ||
$GLOBALS['TL_DCA']['tl_article']['palettes']['__selector__'][] = 'inherit'; | ||
$GLOBALS['TL_DCA']['tl_article']['subpalettes']['inherit'] = 'inheritLevel,inheritPriority'; | ||
|
||
/** | ||
* Add fields to tl_article | ||
|
@@ -26,7 +28,7 @@ | |
'exclude' => true, | ||
'label' => &$GLOBALS['TL_LANG']['tl_article']['inherit'], | ||
'inputType' => 'checkbox', | ||
'eval' => array('tl_class'=>'w50 m12'), | ||
'eval' => array('submitOnChange'=>true), | ||
'sql' => "char(1) NOT NULL default ''" | ||
); | ||
|
||
|
@@ -39,11 +41,11 @@ | |
'sql' => "smallint(5) unsigned NOT NULL default '0'" | ||
); | ||
|
||
$GLOBALS['TL_DCA']['tl_article']['fields']['inheritAfter'] = array | ||
$GLOBALS['TL_DCA']['tl_article']['fields']['inheritPriority'] = array | ||
( | ||
'label' => &$GLOBALS['TL_LANG']['tl_article']['inheritAfter'], | ||
'label' => &$GLOBALS['TL_LANG']['tl_article']['inheritPriority'], | ||
'exclude' => true, | ||
'inputType' => 'checkbox', | ||
'eval' => array('tl_class'=>'w50'), | ||
'sql' => "char(1) NOT NULL default ''" | ||
'inputType' => 'text', | ||
'eval' => array('maxlength'=>5, 'rgxp'=>'digit', 'tl_class'=>'w50'), | ||
'sql' => "smallint(5) NOT NULL default '0'" | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* | ||
* Extension to replace the ArticleModel in order to allow inheritable articles | ||
* | ||
* @copyright inspiredminds 2015 | ||
* @copyright inspiredminds 2016 | ||
* @package inherit_article | ||
* @link http://www.inspiredminds.at | ||
* @author Fritz Michael Gschwantner <[email protected]> | ||
|
@@ -16,4 +16,4 @@ | |
$GLOBALS['TL_LANG']['tl_article']['inherit_legend'] = 'Vererbung'; | ||
$GLOBALS['TL_LANG']['tl_article']['inherit'] = array('Vererben','Artikel in der Seitenstruktur nach unten vererben.'); | ||
$GLOBALS['TL_LANG']['tl_article']['inheritLevel'] = array('Maximale Vererbung','Anzahl an Seitenebenen, die der Artikel maximal nach unten vererbt wird (0 = kein Limit).'); | ||
$GLOBALS['TL_LANG']['tl_article']['inheritAfter'] = array('Am Ende hinzufügen','Fügt diesen Artikel hinter den anderen an, wenn er vererbt wird.'); | ||
$GLOBALS['TL_LANG']['tl_article']['inheritPriority'] = array('Priorität','Legt die Reihenfolge der kombinierten Artikel fest (negative Werte benutzen, um vererbte Artikel hinten an zu stellen).'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* | ||
* Extension to replace the ArticleModel in order to allow inheritable articles | ||
* | ||
* @copyright inspiredminds 2015 | ||
* @copyright inspiredminds 2016 | ||
* @package inherit_article | ||
* @link http://www.inspiredminds.at | ||
* @author Fritz Michael Gschwantner <[email protected]> | ||
|
@@ -16,4 +16,4 @@ | |
$GLOBALS['TL_LANG']['tl_article']['inherit_legend'] = 'Inheritance'; | ||
$GLOBALS['TL_LANG']['tl_article']['inherit'] = array('Inherit','Inherit the article downwards in the page hierarchy.'); | ||
$GLOBALS['TL_LANG']['tl_article']['inheritLevel'] = array('Maximum inheritance','Number of pages the article is inherited downwards in the hierarchy (0 = all).'); | ||
$GLOBALS['TL_LANG']['tl_article']['inheritAfter'] = array('Add to end','Adds this inherited article to the end of the others.'); | ||
$GLOBALS['TL_LANG']['tl_article']['inheritPriority'] = array('Priority','Determines the order of the combined articles (use negative values to put inherited articles to the bottom).'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
/** | ||
* Contao Open Source CMS | ||
* | ||
* Extension to replace the ArticleModel in order to allow inheritable articles | ||
* | ||
* @copyright inspiredminds 2016 | ||
* @package inherit_article | ||
* @link http://www.inspiredminds.at | ||
* @author Fritz Michael Gschwantner <[email protected]> | ||
* @license GPL-2.0 | ||
*/ | ||
|
||
|
||
/** | ||
* Runonce for autoupdate | ||
*/ | ||
class InheritArticleRunOnce | ||
{ | ||
|
||
public function run() | ||
{ | ||
// get the database | ||
$objDb = \Database::getInstance(); | ||
|
||
if( $objDb->tableExists('tl_article') ) | ||
{ | ||
if( $objDb->fieldExists('inheritAfter', 'tl_article') && !$objDb->fieldExists('inheritPriority', 'tl_article') ) | ||
{ | ||
// create field | ||
$objDb->execute("ALTER TABLE `tl_article` ADD `inheritPriority` smallint(5) NOT NULL default '0'"); | ||
|
||
if( $objDb->fieldExists('inheritPriority', 'tl_article', true) ) | ||
{ | ||
$objDb->execute("UPDATE tl_article SET inheritPriority = '-1' WHERE inheritAfter = '1' AND inherit = '1'"); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
$objInheritArticleRunOnce = new InheritArticleRunOnce(); | ||
$objInheritArticleRunOnce->run(); |