<commit_before><?php

/**
 * Books Extension for Contao
 *
 * Copyright (c) 2012-2015 <NAME>
 *
 * @package Books
 * @link    https://github.com/falkoschumann/contao-books
 * @license http://opensource.org/licenses/MIT MIT
 */


/**
 * Data container array for table `tl_chapter`.
 *
 * Store chapters meta data like title and publishing state. The chapters text
 * is stored in child table `tl_content`.
 *
 * The chapters are shown as tree view.
 */
$GLOBALS['TL_DCA']['tl_chapter'] = array
(

    // Config
    'config'   => array
    (
        'label'            => $GLOBALS['TL_CONFIG']['websiteTitle'],
        'dataContainer'    => 'Table',
        'ctable'           => array('tl_content'),
        'enableVersioning' => true,
        'sql'              => array
        (
            'keys' => array
            (
                'id'    => 'primary',
                'pid'   => 'index',
                'alias' => 'index'
            )
        ),
        'backlink'         => 'do=books',
        'onload_callback'  => array
        (
            array('tl_chapter', 'filterChaptersOfSelectedBook')
        )
    ),
    // List
    'list'     => array
    (
        'sorting'           => array
        (
            'mode'                  => 5,
            'icon'                  => 'system/modules/books/assets/book.png',
            'paste_button_callback' => array('tl_chapter', 'pastePage'),
            'panelLayout'           => 'filter,search',
            'rootPaste'             => false
        ),
        'label'             => array
        (
            'fields'         => array('title'),
            'format'         => '%s',
            'label_callback' => array('tl_chapter', 'chapterLabel')
        ),
        'global_operations' => array
        (
            'editbookheaders' => array
            (
                'label' => &$GLOBALS['TL_LANG']['tl_chapter']['editbookheader'],
                'href'  => 'act=edit&amp;table=tl_book&amp;id=' . $_GET['book_id'],
                'icon'  => 'header.gif'
            ),
            'toggleNodes'     => array
            (
                'label' => &$GLOBALS['TL_LANG']['MSC']['toggleAll'],
                'href'  => 'ptg=all',
                'class' => 'header_toggle'
            ),
            'all'             => array
            (
                'label'      => &$GLOBALS['TL_LANG']['MSC']['all'],
                'href'       => 'act=select',
                'class'      => 'header_edit_all',
                'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"'
            )
        ),
        'operations'        => array
        (
            'edit'        => array
            (
                'label' => &$GLOBALS['TL_LANG']['tl_chapter']['edit'],
                'href'  => 'table=tl_content',
                'icon'  => 'edit.gif'
            ),
            'editheaders' => array
            (
                'label'           => &$GLOBALS['TL_LANG']['tl_chapter']['editheader'],
                'href'            => 'act=edit',
                'icon'            => 'header.gif',
                'button_callback' => array('tl_chapter', 'editHeaders')
            ),
            'copy'        => array
            (
                'label'           => &$GLOBALS['TL_LANG']['tl_chapter']['copy'],
                'href'            => 'act=paste&amp;mode=copy',
                'icon'            => 'copy.gif',
                'attributes'      => 'onclick="Backend.getScrollOffset()"',
                'button_callback' => array('tl_chapter', 'copyChapter')
            ),
            'copyChilds'  => array
            (
                'label'           => &$GLOBALS['TL_LANG']['tl_chapter']['copyChilds'],
                'href'            => 'act=paste&amp;mode=copy&amp;childs=1',
                'icon'            => 'copychilds.gif',
                'attributes'      => 'onclick="Backend.getScrollOffset()"',
                'button_callback' => array('tl_chapter', 'copyChapterWithSubchapters')
            ),
            'cut'         => array
            (
                'label'           => &$GLOBALS['TL_LANG']['tl_chapter']['cut'],
                'href'            => 'act=paste&amp;mode=cut',
                'icon'            => 'cut.gif',
                'attributes'      => 'onclick="Backend.getScrollOffset()"',
                'button_callback' => array('tl_chapter', 'cutChapter')
            ),
            'delete'      => array
            (
                'label'           => &$GLOBALS['TL_LANG']['tl_chapter']['delete'],
                'href'            => 'act=delete',
                'icon'            => 'delete.gif',
                'attributes'      => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"',
                'button_callback' => array('tl_chapter', 'deleteChapter')
            ),
            'toggle'      => array
            (
                'label'           => &$GLOBALS['TL_LANG']['tl_chapter']['toggle'],
                'icon'            => 'visible.gif',
                'attributes'      => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
                'button_callback' => array('tl_chapter', 'toggleIcon')
            ),
            'show'        => array
            (
                'label' => &$GLOBALS['TL_LANG']['tl_chapter']['show'],
                'href'  => 'act=show',
                'icon'  => 'show.gif'
            )
        )
    ),
    // Palettes
    'palettes' => array
    (
        '__selector__' => array('type'),
        'default'      => '',
        'regular'      => '{chapter_legend},title,alias;{meta_legend:hide},tags;{expert_legend:hide},cssID,hide;{publish_legend},published'
    ),
    // Fields
    'fields'   => array
    (
        'id'        => array
        (
            'label'  => array('ID'),
            'search' => true,
            'sql'    => "int(10) unsigned NOT NULL auto_increment"
        ),
        'pid'       => array
        (
            'sql' => "int(10) unsigned NOT NULL default '0'"
        ),
        'sorting'   => array
        (
            'sql' => "int(10) unsigned NOT NULL default '0'"
        ),
        'tstamp'    => array
        (
            'label' => &$GLOBALS['TL_LANG']['tl_chapter']['tstamp'],
            'sql'   => "int(10) unsigned NOT NULL default '0'"
        ),
        'title'     => array
        (
            'label'     => &$GLOBALS['TL_LANG']['tl_chapter']['title'],
            'exclude'   => true,
            'search'    => true,
            'inputType' => 'text',
            'eval'      => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'),
            'sql'       => "varchar(255) NOT NULL default ''"
        ),
        'alias'     => array
        (
            'label'         => $GLOBALS['TL_LANG']['tl_chapter']['alias'],
            'exclude'       => true,
            'search'        => true,
            'inputType'     => 'text',
            'eval'          => array(
                'rgxp'              => 'alnum',
                'unique'            => true,
                'doNotCopy'         => true,
                'spaceToUnderscore' => true,
                'maxlength'         => 128,
                'tl_class'          => 'w50'
            ),
            'sql'           => "varbinary(128) NOT NULL default ''",
            'save_callback' => array
            (
                array('tl_chapter', 'generateAlias')
            )
        ),
        'type'      => array
        (
            'label'   => &$GLOBALS['TL_LANG']['tl_chapter']['type'],
            'default' => 'regular',
            'sql'     => "varchar(32) NOT NULL default ''"
        ),
        'tags'      => array
        (
            'label'     => &$GLOBALS['TL_LANG']['tl_chapter']['tags'],
            'exclude'   => true,
            'search'    => true,
            'inputType' => 'text',
            'eval'      => array('maxlength' => 255, 'tl_class' => 'w50'),<commit_msg>Fix copy book with internal cache<commit_after><?php

/**
 * Books Extension for Contao
 *
 * Copyright (c) 2012-2015 <NAME>
 *
 * @package Books
 * @link    https://github.com/falkoschumann/contao-books
 * @license http://opensource.org/licenses/MIT MIT
 */


/**
 * Data container array for table `tl_chapter`.
 *
 * Store chapters meta data like title and publishing state. The chapters text
 * is stored in child table `tl_content`.
 *
 * The chapters are shown as tree view.
 */
$GLOBALS['TL_DCA']['tl_chapter'] = array
(

    // Config
    'config'   => array
    (
        'label'            => $GLOBALS['TL_CONFIG']['websiteTitle'],
        'dataContainer'    => 'Table',
        'ctable'           => array('tl_content'),
        'enableVersioning' => true,
        'sql'              => array
        (
            'keys' => array
            (
                'id'    => 'primary',
                'pid'   => 'index',
                'alias' => 'index'
            )
        ),
        'backlink'         => 'do=books',
        'onload_callback'  => array
        (
            array('tl_chapter', 'filterChaptersOfSelectedBook')
        )
    ),
    // List
    'list'     => array
    (
        'sorting'           => array
        (
            'mode'                  => 5,
            'icon'                  => 'system/modules/books/assets/book.png',
            'paste_button_callback' => array('tl_chapter', 'pastePage'),
            'panelLayout'           => 'filter,search',
            'rootPaste'             => false
        ),
        'label'             => array
        (
            'fields'         => array('title'),
            'format'         => '%s',
            'label_callback' => array('tl_chapter', 'chapterLabel')
        ),
        'global_operations' => array
        (
            'editbookheaders' => array
            (
                'label' => &$GLOBALS['TL_LANG']['tl_chapter']['editbookheader'],
                'href'  => 'act=edit&amp;table=tl_book&amp;id=' . $_GET['book_id'],
                'icon'  => 'header.gif'
            ),
            'toggleNodes'     => array
            (
                'label' => &$GLOBALS['TL_LANG']['MSC']['toggleAll'],
                'href'  => 'ptg=all',
                'class' => 'header_toggle'
            ),
            'all'             => array
            (
                'label'      => &$GLOBALS['TL_LANG']['MSC']['all'],
                'href'       => 'act=select',
                'class'      => 'header_edit_all',
                'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"'
            )
        ),
        'operations'        => array
        (
            'edit'        => array
            (
                'label' => &$GLOBALS['TL_LANG']['tl_chapter']['edit'],
                'href'  => 'table=tl_content',
                'icon'  => 'edit.gif'
            ),
            'editheaders' => array
            (
                'label'           => &$GLOBALS['TL_LANG']['tl_chapter']['editheader'],
                'href'            => 'act=edit',
                'icon'            => 'header.gif',
                'button_callback' => array('tl_chapter', 'editHeaders')
            ),
            'copy'        => array
            (
                'label'           => &$GLOBALS['TL_LANG']['tl_chapter']['copy'],
                'href'            => 'act=paste&amp;mode=copy',
                'icon'            => 'copy.gif',
                'attributes'      => 'onclick="Backend.getScrollOffset()"',
                'button_callback' => array('tl_chapter', 'copyChapter')
            ),
            'copyChilds'  => array
            (
                'label'           => &$GLOBALS['TL_LANG']['tl_chapter']['copyChilds'],
                'href'            => 'act=paste&amp;mode=copy&amp;childs=1',
                'icon'            => 'copychilds.gif',
                'attributes'      => 'onclick="Backend.getScrollOffset()"',
                'button_callback' => array('tl_chapter', 'copyChapterWithSubchapters')
            ),
            'cut'         => array
            (
                'label'           => &$GLOBALS['TL_LANG']['tl_chapter']['cut'],
                'href'            => 'act=paste&amp;mode=cut',
                'icon'            => 'cut.gif',
                'attributes'      => 'onclick="Backend.getScrollOffset()"',
                'button_callback' => array('tl_chapter', 'cutChapter')
            ),
            'delete'      => array
            (
                'label'           => &$GLOBALS['TL_LANG']['tl_chapter']['delete'],
                'href'            => 'act=delete',
                'icon'            => 'delete.gif',
                'attributes'      => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"',
                'button_callback' => array('tl_chapter', 'deleteChapter')
            ),
            'toggle'      => array
            (
                'label'           => &$GLOBALS['TL_LANG']['tl_chapter']['toggle'],
                'icon'            => 'visible.gif',
                'attributes'      => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
                'button_callback' => array('tl_chapter', 'toggleIcon')
            ),
            'show'        => array
            (
                'label' => &$GLOBALS['TL_LANG']['tl_chapter']['show'],
                'href'  => 'act=show',
                'icon'  => 'show.gif'
            )
        )
    ),
    // Palettes
    'palettes' => array
    (
        '__selector__' => array('type'),
        'default'      => '',
        'regular'      => '{chapter_legend},title,alias;{meta_legend:hide},tags;{expert_legend:hide},cssID,hide;{publish_legend},published'
    ),
    // Fields
    'fields'   => array
    (
        'id'        => array
        (
            'label'  => array('ID'),
            'search' => true,
            'sql'    => "int(10) unsigned NOT NULL auto_increment"
        ),
        'pid'       => array
        (
            'sql' => "int(10) unsigned NOT NULL default '0'"
        ),
        'sorting'   => array
        (
            'sql' => "int(10) unsigned NOT NULL default '0'"
        ),
        'tstamp'    => array
        (
            'label' => &$GLOBALS['TL_LANG']['tl_chapter']['tstamp'],
            'sql'   => "int(10) unsigned NOT NULL default '0'"
        ),
        'title'     => array
        (
            'label'     => &$GLOBALS['TL_LANG']['tl_chapter']['title'],
            'exclude'   => true,
            'search'    => true,
            'inputType' => 'text',
            'eval'      => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'),
            'sql'       => "varchar(255) NOT NULL default ''"
        ),
        'alias'     => array
        (
            'label'         => $GLOBALS['TL_LANG']['tl_chapter']['alias'],
            'exclude'       => true,
            'search'        => true,
            'inputType'     => 'text',
            'eval'          => array(
                'rgxp'              => 'folderalias',
                'doNotCopy'         => true,
                'maxlength'         => 128,
                'tl_class'          => 'w50'
            ),
            'sql'           => "varbinary(128) NOT NULL default ''",
            'save_callback' => array
            (
                array('tl_chapter', 'generateAlias')
            )
        ),
        'type'      => array
        (
            'label'   => &$GLOBALS['TL_LANG']['tl_chapter']['type'],
            'default' => 'regular',
            'sql'     => "varchar(32) NOT NULL default ''"
        ),
        'tags'      => array
        (
            'label'     => &$GLOBALS['TL_LANG']['tl_chapter']['tags'],
            'exclude'   => true,
            'search'    => true,
            'inputType' => 'text',
            'eval'      => array('maxlength' => 255, 'tl_class' => 'w50'),
{'fraction_non_alphanumeric': 0.16850863032410282, 'fraction_numerical': 0.005463802309698249, 'mean_word_length': 1.3026447462473194, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 267, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5066533', 'n_tokens_mistral': 4679, 'n_tokens_neox': 4382, 'n_words': 724}