Ergebnis 1 bis 15 von 15

Thema: tiny4 verwenden

  1. #1
    Contao-Fan Avatar von Hauge
    Registriert seit
    31.01.2010.
    Beiträge
    643

    Standard tiny4 verwenden

    mit dem Update der contao-Installation auf 3.3.x gibt's ja den tiny4 Editor dazu.
    Mit der letzten funktionierenden Version von mm krieg ich den aber nicht zum laufen: alle html-Tags werden - egal bei welcher Einstellung - wieder gelöscht.

    kann das jemand bestätigen?

  2. #2
    Contao-Fan Avatar von Hauge
    Registriert seit
    31.01.2010.
    Beiträge
    643

    Standard

    habe gerade downgrade auf contao 3.2.14 gemacht > fehler liegt nicht in der Einbindung des tiny4 sondern besteht auch im tiny3

  3. #3
    Contao-Fan Avatar von Hauge
    Registriert seit
    31.01.2010.
    Beiträge
    643

    Standard

    Sollte jemand das gleiche Problem haben -> letzte funktionierende Version:
    HTML-Code:
    Name                                                  Version              Last modification
    ==============================================================================================
    http://bit3.de
    bit3/contao-meta-palettes                             dev-master @ ad7068  2014-07-23 06:49:07
    ----------------------------------------------------------------------------------------------
    
    http://c-c-a.org/
    contao-community-alliance/backports-initialize-system dev-develop @ 0d0515 2014-06-05 11:58:46
    contao-community-alliance/composer-plugin             dev-master @ 0bc66a  2014-07-22 21:27:29
    contao-community-alliance/dc-general                  dev-develop @ aa1ae9 2014-07-16 16:55:05
    contao-community-alliance/dependency-container        dev-develop @ 7fa301 2014-06-05 08:30:58
    contao-community-alliance/event-dispatcher            dev-develop @ 61fabc 2014-06-05 08:36:18
    contao-community-alliance/events-contao-bindings      dev-master @ b654fe  2014-06-18 12:55:45
    contao-community-alliance/translator                  dev-develop @ 02feca 2014-06-05 08:57:37
    ----------------------------------------------------------------------------------------------
    
    https://www.cyberspectrum.de
    discordier/justtextwidgets                            dev-master @ 687e04  2014-02-05 22:52:54
    ----------------------------------------------------------------------------------------------
    
    http://www.leo-unglaub.net
    leounglaub/contao-simple-ajax                         1.0.2                2014-02-07 22:35:55
    ----------------------------------------------------------------------------------------------
    
    http://www.men-at-work.de
    menatwork/contao-multicolumnwizard                    dev-dev @ 5c5b45     2014-07-08 12:15:01
    ----------------------------------------------------------------------------------------------
    
    http://now.metamodel.me/
    metamodels/attribute_alias                            dev-tng @ 2987ee     2014-04-18 21:43:43
    metamodels/attribute_checkbox                         dev-tng @ d7df92     2014-07-23 13:09:00
    metamodels/attribute_combinedvalues                   dev-tng @ 0d488b     2014-05-22 21:58:55
    metamodels/attribute_country                          dev-tng @ 758290     2014-04-25 03:48:52
    metamodels/attribute_decimal                          dev-tng @ 6a1e12     2014-04-25 04:07:23
    metamodels/attribute_file                             dev-tng @ 6a39ae     2014-07-23 15:29:41
    metamodels/attribute_langcode                         dev-tng @ a591de     2014-04-25 05:10:59
    metamodels/attribute_longtext                         dev-tng @ 75f88e     2014-04-25 05:21:23
    metamodels/attribute_numeric                          dev-tng @ 1da7ca     2014-04-25 11:56:41
    metamodels/attribute_rating                           dev-tng @ 326fbe     2014-04-25 07:16:15
    metamodels/attribute_select                           dev-tng @ a68798     2014-06-07 13:30:28
    metamodels/attribute_tabletext                        dev-tng @ 33d137     2014-04-25 08:46:27
    metamodels/attribute_tags                             dev-tng @ f20cc7     2014-06-27 09:23:30
    metamodels/attribute_text                             dev-tng @ 4f995c     2014-04-25 10:03:23
    metamodels/attribute_timestamp                        dev-tng @ 5b60c1     2014-06-12 10:48:08
    metamodels/attribute_translatedalias                  dev-tng @ 7aabdb     2014-05-13 16:07:33
    metamodels/attribute_translatedcheckbox               dev-tng @ e9fbcc     2014-04-30 19:46:32
    metamodels/attribute_translatedcombinedvalues         dev-tng @ 720b42     2014-05-22 22:10:08
    metamodels/attribute_translatedfile                   dev-tng @ a577eb     2014-03-28 16:24:01
    metamodels/attribute_translatedlongtext               dev-tng @ 33249b     2014-03-11 16:26:23
    metamodels/attribute_translatedselect                 dev-tng @ 323a5e     2014-06-03 14:48:31
    metamodels/attribute_translatedtabletext              dev-tng @ 8e8818     2014-04-09 20:22:59
    metamodels/attribute_translatedtags                   dev-tng @ 3c08d9     2014-06-03 14:51:51
    metamodels/attribute_translatedtext                   dev-tng @ ac10a6     2014-03-11 16:27:17
    metamodels/attribute_url                              dev-tng @ e06357     2014-06-04 08:50:44
    metamodels/bundle_all                                 dev-master @ f58927  2013-10-01 20:03:31
    metamodels/bundle_attributes                          dev-master @ 058e26  2014-02-03 14:19:34
    metamodels/bundle_filter                              dev-master @ 45d9cf  2013-05-03 07:16:44
    metamodels/bundle_nontranslated                       dev-master @ 5f2b3f  2014-02-17 14:37:26
    metamodels/bundle_translated                          dev-master @ 4bc0c1  2014-02-17 14:34:39
    metamodels/core                                       dev-tng @ bc0354     2014-07-23 13:59:19
    metamodels/filter_checkbox                            dev-tng @ a8ede1     2014-04-25 13:36:43
    metamodels/filter_fromto                              dev-tng @ 752049     2014-06-17 20:09:31
    metamodels/filter_range                               dev-tng @ e445a8     2014-04-25 16:23:28
    metamodels/filter_select                              dev-tng @ 181348     2014-04-25 17:22:37
    metamodels/filter_tags                                dev-tng @ 114268     2014-05-08 03:50:18
    metamodels/filter_text                                dev-tng @ 0a5fd4     2014-04-28 19:04:46
    ----------------------------------------------------------------------------------------------
    
    http://pimple.sensiolabs.org
    pimple/pimple                                         1.1.x-dev @ bc2fc1   2014-04-20 07:24:09
    ----------------------------------------------------------------------------------------------
    
    http://symfony.com
    symfony/event-dispatcher                              dev-master @ c2f8a5  2014-07-09 09:06:26
    ----------------------------------------------------------------------------------------------
    
    other
    contao-community-alliance/url-builder                 dev-master @ e6ba52  2014-06-18 13:52:45

  4. #4
    Contao-Fan Avatar von Hauge
    Registriert seit
    31.01.2010.
    Beiträge
    643

    Standard

    +++Push
    Auf Contao 3.3.5, aktuelle nightly

  5. #5
    Contao-Fan
    Registriert seit
    09.09.2009.
    Beiträge
    366

    Standard

    Schau mal auf github (metamodels/core), da gibt es ein Ticket mit einer Lösung.

  6. #6
    Contao-Fan Avatar von Hauge
    Registriert seit
    31.01.2010.
    Beiträge
    643

    Standard

    Hallo Typo,

    ich hatte bereits auf github gesucht - jedoch nix gefunden.
    Habe auch ein Ticket angelegt.

    Bin jetzt auf github nochmal alles durchgegangen und hab auch wiederholt die Suchfunktion bemüht...

    Ich seh es einfach nicht :-(
    Hast Du evtl. einen Anhaltspunkt?

  7. #7
    Contao-Fan Avatar von Hauge
    Registriert seit
    31.01.2010.
    Beiträge
    643

    Daumen hoch

    Habs gefunden > ist auf github in den dc-General gewandert.

    Edit: Grad getestet > funktioniert:
    Datei: system/modules/dc-general/classes/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/ContaoWidgetManager.php
    Zeile 343:
    Code:
    $selector = $propertyId;
    einfügen:

    Teilansicht:
    PHP-Code:
                    // Backwards compatibility.
                    
    $language substr($GLOBALS['TL_LANGUAGE'], 02);

                    if (!
    file_exists(TL_ROOT '/assets/tinymce/langs/' $language '.js')) {
                        
    $language 'en';
                    }
                    
    $selector $propertyId;
                    
    ob_start();
                    include 
    TL_ROOT '/system/config/' $file '.php';
                    
    $updateMode ob_get_contents();
                    
    ob_end_clean(); 

    Danke Typo...
    Geändert von Hauge (27.09.2014 um 09:13 Uhr)

  8. #8
    Contao-Fan
    Registriert seit
    09.09.2009.
    Beiträge
    366

    Standard

    Oups ... Ich dachte ich hätte das im core geschrieben. Aber be DcGeneral ist es natürlich richtig ...

  9. #9
    Contao-Nutzer Avatar von justs
    Registriert seit
    29.11.2011.
    Ort
    Diepenheim, NL
    Beiträge
    19

    Standard

    Hi there,

    I have the same problem with TinyMCE4. Of course I tried this solution, but it didn't work. I get the same error "ReferenceError: Can't find variable: tinyMCE".

    Any other ideas?

    Just

  10. #10
    Contao-Fan Avatar von Hauge
    Registriert seit
    31.01.2010.
    Beiträge
    643

    Standard

    Hi justs,

    can you show us the version of dc-general, mm core and contao?

  11. #11
    Contao-Nutzer Avatar von justs
    Registriert seit
    29.11.2011.
    Ort
    Diepenheim, NL
    Beiträge
    19

    Standard

    Hi Hauge,

    Well, to be honest, I think I'm a bit lost in the jungle of MM installation... I tried to do the whole installation over Composer, but I get the impression that some parts of the complex MM installation don't have a compatible version. Just now, I re-installed MM 2.x (for Contao 3) by hand from the latest nightly download. Still no TinyMCE...

    DC-general: dev-develop @ 6312da
    MM core: dev-tng @ 8b9f9d
    Contao: 3.3.5

  12. #12
    Contao-Fan Avatar von Hauge
    Registriert seit
    31.01.2010.
    Beiträge
    643

    Standard

    Right,
    here is my ContaoWidgetManager.php - maybe it will help you?
    Please make a backup file!

    PHP-Code:
    <?php
    /**
     * PHP version 5
     *
     * @package    generalDriver
     * @author     Christian Schiffler <c.schiffler@cyberspectrum.de>
     * @author     Stefan Heimes <stefan_heimes@hotmail.com>
     * @author     Tristan Lins <tristan.lins@bit3.de>
     * @copyright  The MetaModels team.
     * @license    LGPL.
     * @filesource
     */

    namespace ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView;

    use 
    ContaoCommunityAlliance\Contao\Bindings\ContaoEvents;
    use 
    ContaoCommunityAlliance\Contao\Bindings\Events\Backend\AddToUrlEvent;
    use 
    ContaoCommunityAlliance\Contao\Bindings\Events\Image\GenerateHtmlEvent;
    use 
    ContaoCommunityAlliance\Contao\Bindings\Events\Widget\GetAttributesFromDcaEvent;
    use 
    ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\DcCompat;
    use 
    ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\BuildWidgetEvent;
    use 
    ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\DecodePropertyValueForWidgetEvent;
    use 
    ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\EncodePropertyValueFromWidgetEvent;
    use 
    ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\GetPropertyOptionsEvent;
    use 
    ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\ManipulateWidgetEvent;
    use 
    ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\ResolveWidgetErrorMessageEvent;
    use 
    ContaoCommunityAlliance\DcGeneral\Data\ModelInterface;
    use 
    ContaoCommunityAlliance\DcGeneral\Data\PropertyValueBag;
    use 
    ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\Properties\PropertyInterface;
    use 
    ContaoCommunityAlliance\DcGeneral\EnvironmentInterface;
    use 
    ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralInvalidArgumentException;
    use 
    ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralRuntimeException;

    /**
     * Class ContaoWidgetManager.
     *
     * This class is responsible for creating widgets and processing data through them.
     *
     * @package DcGeneral\Contao\View\Contao2BackendView
     */
    class ContaoWidgetManager
    {
        
    /**
         * The environment in use.
         *
         * @var EnvironmentInterface
         */
        
    protected $environment;

        
    /**
         * The model for which widgets shall be generated.
         *
         * @var ModelInterface
         */
        
    protected $model;

        
    /**
         * Create a new instance.
         *
         * @param EnvironmentInterface $environment The environment in use.
         *
         * @param ModelInterface       $model       The model for which widgets shall be generated.
         */
        
    public function __construct(EnvironmentInterface $environmentModelInterface $model)
        {
            
    $this->environment $environment;
            
    $this->model       $model;

            
    $this->preLoadRichTextEditor();
        }

        
    /**
         * Encode a value from the widget to native data of the data provider via event.
         *
         * @param string           $property       The property.
         *
         * @param mixed            $value          The value of the property.
         *
         * @param PropertyValueBag $propertyValues The property value bag the property value originates from.
         *
         * @return mixed
         */
        
    public function encodeValue($property$valuePropertyValueBag $propertyValues)
        {
            
    $environment $this->getEnvironment();

            
    $event = new EncodePropertyValueFromWidgetEvent($environment$this->model$propertyValues);
            
    $event
                
    ->setProperty($property)
                ->
    setValue($value);

            
    $environment->getEventPropagator()->propagate(
                
    $event::NAME,
                
    $event,
                array(
                    
    $environment->getDataDefinition()->getName(),
                    
    $property
                
    )
            );

            return 
    $event->getValue();
        }

        
    /**
         * Decode a value from native data of the data provider to the widget via event.
         *
         * @param string $property The property.
         *
         * @param mixed  $value    The value of the property.
         *
         * @return mixed
         */
        
    public function decodeValue($property$value)
        {
            
    $environment $this->getEnvironment();

            
    $event = new DecodePropertyValueForWidgetEvent($environment$this->model);
            
    $event
                
    ->setProperty($property)
                ->
    setValue($value);

            
    $environment->getEventPropagator()->propagate(
                
    $event::NAME,
                
    $event,
                array(
                    
    $environment->getDataDefinition()->getName(),
                    
    $property
                
    )
            );

            return 
    $event->getValue();
        }

        
    /**
         * {@inheritdoc}
         */
        
    public function getEnvironment()
        {
            return 
    $this->environment;
        }

        
    /**
         * {@inheritDoc}
         */
        
    public function hasWidget($property)
        {
            try {
                return 
    $this->getWidget($property) !== null;
            } catch (\
    Exception $e) {
                
    // Fall though and return false.
            
    }
            return 
    false;
        }

        
    /**
         * Get special labels.
         *
         * @param PropertyInterface $propInfo The property for which the X label shall be generated.
         *
         * @return string
         */
        
    protected function getXLabel($propInfo)
        {
            
    $strXLabel   '';
            
    $environment $this->getEnvironment();
            
    $defName     $environment->getDataDefinition()->getName();
            
    $translator  $environment->getTranslator();

            
    // Toggle line wrap (textarea).
            
    if ($propInfo->getWidgetType() === 'textarea' && !array_key_exists('rte'$propInfo->getExtra())) {
                
    $event = new GenerateHtmlEvent(
                    
    'wrap.gif',
                    
    $translator->translate('wordWrap''MSC'),
                    
    sprintf(
                        
    'title="%s" class="toggleWrap" onclick="Backend.toggleWrap(\'ctrl_%s\');"',
                        
    specialchars($translator->translate('wordWrap''MSC')),
                        
    $propInfo->getName()
                    )
                );

                
    $environment->getEventPropagator()->propagate(ContaoEvents::IMAGE_GET_HTML$event);

                
    $strXLabel .= ' ' $event->getHtml();
            }

            
    // Add the help wizard.
            
    if ($propInfo->getExtra() && array_key_exists('helpwizard'$propInfo->getExtra())) {
                
    $event = new GenerateHtmlEvent(
                    
    'about.gif',
                    
    $translator->translate('helpWizard''MSC'),
                    
    'style="vertical-align:text-bottom;"'
                
    );

                
    $environment->getEventPropagator()->propagate(ContaoEvents::IMAGE_GET_HTML$event);

                
    $strXLabel .= sprintf(
                    
    ' <a href="contao/help.php?table=%s&amp;field=%s" ' .
                    
    'title="%s" ' .
                    
    'onclick="Backend.openWindow(this, 600, 500); return false;">%s</a>',
                    
    $defName,
                    
    $propInfo->getName(),
                    
    specialchars($translator->translate('helpWizard''MSC')),
                    
    $event->getHtml()
                );
            }

            
    // Add the popup file manager.
            
    if ($propInfo->getWidgetType() === 'fileTree') {
                
    // In Contao 3 it is always a file picker - no need for the button.
                
    if (version_compare(VERSION'3.0''<')) {
                    
    $event = new GenerateHtmlEvent(
                        
    'filemanager.gif',
                        
    $translator->translate('fileManager''MSC'),
                        
    'style="vertical-align:text-bottom;"'
                    
    );

                    
    $environment->getEventPropagator()->propagate(ContaoEvents::IMAGE_GET_HTML$event);

                    
    $strXLabel .= sprintf(
                        
    ' <a href="contao/files.php" ' .
                        
    'title="%s"' .
                        
    'onclick="Backend.getScrollOffset(); Backend.openWindow(this, 750, 500); return false;">%s</a>',
                        
    specialchars($translator->translate('fileManager''MSC')),
                        
    $event->getHtml()
                    );
                }
            } elseif (
    $propInfo->getWidgetType() === 'tableWizard') {
                
    // Add table import wizard.
                
    $urlEvent = new AddToUrlEvent('key=table');

                
    $importTableEvent = new GenerateHtmlEvent(
                    
    'tablewizard.gif',
                    
    $translator->translate('importTable.0'$defName),
                    
    'style="vertical-align:text-bottom;"'
                
    );

                
    $shrinkEvent = new GenerateHtmlEvent(
                    
    'demagnify.gif',
                    
    $translator->translate('shrink.0'$defName),
                    
    sprintf(
                        
    'title="%s" ' .
                        
    'style="vertical-align:text-bottom; cursor:pointer;" ' .
                        
    'onclick="Backend.tableWizardResize(0.9);"',
                        
    specialchars($translator->translate('shrink.1'$defName))
                    )
                );

                
    $expandEvent = new GenerateHtmlEvent(
                    
    'magnify.gif',
                    
    $translator->translate('expand.0'$defName),
                    
    sprintf(
                        
    'title="%s" ' .
                        
    'style="vertical-align:text-bottom; cursor:pointer;" ' .
                        
    'onclick="Backend.tableWizardResize(1.1);"',
                        
    specialchars($translator->translate('expand.1'$defName))
                    )
                );

                
    $environment->getEventPropagator()->propagate(ContaoEvents::BACKEND_ADD_TO_URL$urlEvent);

                
    $environment->getEventPropagator()->propagate(ContaoEvents::IMAGE_GET_HTML$importTableEvent);
                
    $environment->getEventPropagator()->propagate(ContaoEvents::IMAGE_GET_HTML$shrinkEvent);
                
    $environment->getEventPropagator()->propagate(ContaoEvents::IMAGE_GET_HTML$expandEvent);

                
    $strXLabel .= sprintf(
                    
    ' <a href="%s" title="%s" onclick="Backend.getScrollOffset();">%s</a> %s%s',
                    
    ampersand($urlEvent->getUrl()),
                    
    specialchars($translator->translate('importTable.1'$defName)),
                    
    $importTableEvent->getHtml(),
                    
    $shrinkEvent->getHtml(),
                    
    $expandEvent->getHtml()
                );
            } elseif (
    $propInfo->getWidgetType() === 'listWizard') {
                
    // Add list import wizard.
                
    $urlEvent = new AddToUrlEvent('key=list');

                
    $importListEvent = new GenerateHtmlEvent(
                    
    'tablewizard.gif',
                    
    $translator->translate('importList.0'$defName),
                    
    'style="vertical-align:text-bottom;"'
                
    );

                
    $environment->getEventPropagator()->propagate(ContaoEvents::BACKEND_ADD_TO_URL$urlEvent);
                
    $environment->getEventPropagator()->propagate(ContaoEvents::IMAGE_GET_HTML$importListEvent);

                
    $strXLabel .= sprintf(
                    
    ' <a href="%s" title="%s" onclick="Backend.getScrollOffset();">%s</a>',
                    
    ampersand($urlEvent->getUrl()),
                    
    specialchars($translator->translate('importList.1'$defName)),
                    
    $importListEvent->getHtml()
                );
            }

            return 
    $strXLabel;
        }

        
    /**
         * Function for pre-loading the tiny mce.
         *
         * @return void
         *
         * @throws \Exception When the rich text editor config file can not be found.
         *
         * @SuppressWarnings(PHPMD.Superglobals)
         * @SuppressWarnings(PHPMD.CamelCaseVariableName)
         */
        
    public function preLoadRichTextEditor()
        {
            foreach (
    $this->getEnvironment()->getDataDefinition()->getPropertiesDefinition()->getProperties(
            ) as 
    $property) {
                
    /** @var PropertyInterface $property */
                
    $extra $property->getExtra();

                if (!isset(
    $extra['rte'])) {
                    continue;
                }

                if (
    strncmp($extra['rte'], 'tiny'4) !== 0) {
                    continue;
                }

                list(
    $file$type) = explode('|'$extra['rte']);

                
    $propertyId 'ctrl_' $property->getName();

                if (
    version_compare(VERSION'3.3''<')) {
                    
    $GLOBALS['TL_RTE'][$file][$propertyId] = array(
                        
    'id'   => $propertyId,
                        
    'file' => $file,
                        
    'type' => $type
                    
    );
                } else {
                    if (!
    file_exists(TL_ROOT '/system/config/' $file '.php')) {
                        throw new \
    Exception(sprintf('Cannot find editor configuration file "%s.php"'$file));
                    }

                    
    // Backwards compatibility.
                    
    $language substr($GLOBALS['TL_LANGUAGE'], 02);

                    if (!
    file_exists(TL_ROOT '/assets/tinymce/langs/' $language '.js')) {
                        
    $language 'en';
                    }
                    
    $selector $propertyId;
                    
    ob_start();
                    include 
    TL_ROOT '/system/config/' $file '.php';
                    
    $updateMode ob_get_contents();
                    
    ob_end_clean();

                    
    $GLOBALS['TL_MOOTOOLS'][] = $updateMode;
                }
            }
        }

        
    /**
         * Retrieve the instance of a widget for the given property.
         *
         * @param string           $property    Name of the property for which the widget shall be retrieved.
         *
         * @param PropertyValueBag $inputValues The input values to use (optional).
         *
         * @throws DcGeneralInvalidArgumentException When an unknown property has been passed.
         *
         * @return \Widget
         *
         * @SuppressWarnings(PHPMD.Superglobals)
         * @SuppressWarnings(PHPMD.CamelCaseVariableName)
         */
        
    public function getWidget($propertyPropertyValueBag $inputValues null)
        {
            
    $environment         $this->getEnvironment();
            
    $defName             $environment->getDataDefinition()->getName();
            
    $propertyDefinitions $environment->getDataDefinition()->getPropertiesDefinition();

            if (!
    $propertyDefinitions->hasProperty($property)) {
                throw new 
    DcGeneralInvalidArgumentException(
                    
    'Property ' $property ' is not defined in propertyDefinitions.'
                
    );
            }

            
    $event = new BuildWidgetEvent($environment$this->model$propertyDefinitions->getProperty($property));

            
    $environment->getEventPropagator()->propagate(
                
    $event::NAME,
                
    $event,
                array(
                    
    $defName,
                    
    $property
                
    )
            );

            if (
    $event->getWidget()) {
                return 
    $event->getWidget();
            }

            
    $propInfo  $propertyDefinitions->getProperty($property);
            
    $propExtra $propInfo->getExtra();
            
    $varValue  $this->decodeValue($property$this->model->getProperty($property));
            
    $xLabel    $this->getXLabel($propInfo);

            
    $strClass $GLOBALS['BE_FFL'][$propInfo->getWidgetType()];
            if (!
    class_exists($strClass)) {
                return 
    null;
            }

            
    // FIXME TEMPORARY WORKAROUND! To be fixed in the core: Controller::prepareForWidget(..).
            
    if ((isset($propExtra['rgxp']) && in_array($propExtra['rgxp'], array('date''time''datim')))
                && empty(
    $propExtra['mandatory'])
                && 
    is_numeric($varValue) && $varValue == 0
            
    ) {
                
    $varValue '';
            }

            
    // OH: why not $required = $mandatory always? source: DataContainer 226.
            // OH: the whole prepareForWidget(..) thing is an only mess
            // Widgets should parse the configuration by themselves, depending on what they need.
            
    $propExtra['required'] = ($varValue == '') && !empty($propExtra['mandatory']);

            if (
    $inputValues) {
                
    $model = clone $this->model;
                
    $model->setId($this->model->getId());
                
    $this->environment->getController()->updateModelFromPropertyBag($model$inputValues);
            } else {
                
    $model $this->model;
            }

            
    $options $propInfo->getOptions();
            
    $event   = new GetPropertyOptionsEvent($environment$model);
            
    $event->setPropertyName($property);
            
    $event->setOptions($options);
            
    $environment->getEventPropagator()->propagate(
                
    $event::NAME,
                
    $event,
                
    $environment->getDataDefinition()->getName(),
                
    $property
            
    );

            if (
    $event->getOptions() !== $options) {
                
    $options $event->getOptions();
            }

            
    $arrConfig = array(
                
    'inputType' => $propInfo->getWidgetType(),
                
    'label'     => array(
                    
    $propInfo->getLabel(),
                    
    $propInfo->getDescription()
                ),
                
    'options'   => $options,
                
    'eval'      => $propExtra,
                
    // TODO: populate these.
                // 'foreignKey' => null
            
    );

            if (isset(
    $propExtra['reference'])) {
                
    $arrConfig['reference'] = $propExtra['reference'];
            }

            
    $event = new GetAttributesFromDcaEvent(
                
    $arrConfig,
                
    $propInfo->getName(),
                
    $varValue,
                
    $property,
                
    $defName,
                new 
    DcCompat($environment$this->model$property)
            );

            
    $environment->getEventPropagator()->propagate(
                
    ContaoEvents::WIDGET_GET_ATTRIBUTES_FROM_DCA,
                
    $event,
                
    $environment->getDataDefinition()->getName(),
                
    $property
            
    );

            
    $arrPrepared $event->getResult();

            
    // Bugfix CS: ajax subpalettes are really broken.
            // Therefore we reset to the default checkbox behaviour here and submit the entire form.
            // This way, the javascript needed by the widget (wizards) will be correctly evaluated.
            
    if ($arrConfig['inputType'] == 'checkbox'
                
    && isset($GLOBALS['TL_DCA'][$defName]['subpalettes'])
                && 
    is_array($GLOBALS['TL_DCA'][$defName]['subpalettes'])
                && 
    in_array($propertyarray_keys($GLOBALS['TL_DCA'][$defName]['subpalettes']))
                && 
    $arrConfig['eval']['submitOnChange']
            ) {
                
    $arrPrepared['onclick'] = $arrConfig['eval']['submitOnChange']
                    ? 
    "Backend.autoSubmit('" $defName "')"
                    
    '';
            }

            
    $objWidget = new $strClass($arrPrepared, new DcCompat($environment$this->model$property));
            
    // OH: what is this? source: DataContainer 232.
            
    $objWidget->currentRecord $this->model->getId();

            
    $objWidget->wizard .= $xLabel;

            
    $event = new ManipulateWidgetEvent($environment$this->model$propInfo$objWidget);
            
    $environment->getEventPropagator()->propagate(
                
    $event::NAME,
                
    $event,
                array(
                    
    $defName,
                    
    $property
                
    )
            );

            return 
    $objWidget;
        }

        
    /**
         * Build the date picker string.
         *
         * @param \Contao\Widget $objWidget The widget instance to generate the date picker string for.
         *
         * @return string
         *
         * @SuppressWarnings(PHPMD.Superglobals)
         * @SuppressWarnings(PHPMD.CamelCaseVariableName)
         */
        
    protected function buildDatePicker($objWidget)
        {
            
    $translator $this->getEnvironment()->getTranslator();
            
    // TODO: need better interface to Contao Config class here.
            
    $strFormat $GLOBALS['TL_CONFIG'][$objWidget->rgxp 'Format'];

            
    $arrConfig = array(
                
    'allowEmpty'        => true,
                
    'toggleElements'    => '#toggle_' $objWidget->id,
                
    'pickerClass'       => 'datepicker_dashboard',
                
    'format'            => $strFormat,
                
    'inputOutputFormat' => $strFormat,
                
    'positionOffset'    => array(
                    
    'x' => 130,
                    
    'y' => -185
                
    ),
                
    'startDay'          => $translator->translate('weekOffset''MSC'),
                
    'days'              => array_values((array)$translator->translate('DAYS''MSC')),
                
    'dayShort'          => $translator->translate('dayShortLength''MSC'),
                
    'months'            => array_values((array)$translator->translate('MONTHS''MSC')),
                
    'monthShort'        => $translator->translate('monthShortLength''MSC')
            );

            switch (
    $objWidget->rgxp) {
                case 
    'datim':
                    
    $arrConfig['timePicker'] = true;

                    
    $time ",\n      timePicker:true";
                    break;

                case 
    'time':
                    
    $arrConfig['timePickerOnly'] = true;

                    
    $time ",\n      pickOnly:\"time\"";
                    break;
                default:
                    
    $time '';
            }

            if ((
    version_compare(DATEPICKER'2.1''>') && version_compare(VERSION'3.1''<'))
                || (
    version_compare(DATEPICKER'2.0''>') && version_compare(VERSION'3.1''>='))
            ) {
                return 
    'new Picker.Date($$("#ctrl_' $objWidget->id '"), {
                    draggable:false,
                    toggle:$$("#toggle_' 
    $objWidget->id '"),
                    format:"' 
    . \Date::formatToJs($strFormat) . '",
                    positionOffset:{x:-197,y:-182}' 
    $time ',
                    pickerClass:"' 
    . (
                        
    version_compare(VERSION'3.3''>=')
                            ? 
    'datepicker_bootstrap'
                            
    'datepicker_dashboard'
                    
    ) . '",
                    useFadeInOut:!Browser.ie,
                    startDay:' 
    $translator->translate('weekOffset''MSC') . ',
                    titleFormat:"' 
    $translator->translate('titleFormat''MSC') . '"
                });'
    ;
            }

            return 
    'new DatePicker(' json_encode('#ctrl_' $objWidget->id) . ', ' json_encode($arrConfig) . ');';
        }

        
    /**
         * Generate the help msg for a property.
         *
         * @param string $property The name of the property.
         *
         * @return string
         *
         * @SuppressWarnings(PHPMD.Superglobals)
         * @SuppressWarnings(PHPMD.CamelCaseVariableName)
         */
        
    protected function generateHelpText($property)
        {
            
    $environment $this->getEnvironment();
            
    $propInfo    $environment->getDataDefinition()->getPropertiesDefinition()->getProperty($property);
            
    $label       $propInfo->getDescription();
            
    $widgetType  $propInfo->getWidgetType();

            
    // TODO: need better interface to Contao Config class here.
            
    if (!$GLOBALS['TL_CONFIG']['showHelp'] || $widgetType == 'password' || !strlen($label)) {
                return 
    '';
            }

            return 
    '<p class="tl_help tl_tip">' $label '</p>';
        }

        
    /**
         * Render the widget for the named property.
         *
         * @param string           $property     The name of the property for which the widget shall be rendered.
         *
         * @param bool             $ignoreErrors Flag if the error property of the widget shall get cleared prior rendering.
         *
         * @param PropertyValueBag $inputValues  The input values to use (optional).
         *
         * @return string
         *
         * @throws DcGeneralRuntimeException For unknown properties.
         */
        
    public function renderWidget($property$ignoreErrors falsePropertyValueBag $inputValues null)
        {
            
    $environment         $this->getEnvironment();
            
    $definition          $environment->getDataDefinition();
            
    $propertyDefinitions $definition->getPropertiesDefinition();
            
    $propInfo            $propertyDefinitions->getProperty($property);
            
    $propExtra           $propInfo->getExtra();
            
    $widget              $this->getWidget($property$inputValues);

            
    /** @var \Contao\Widget $widget */
            
    if (!$widget) {
                throw new 
    DcGeneralRuntimeException('No widget for property ' $property);
            }

            if (
    $ignoreErrors) {
                
    // Clean the errors array and fix up the CSS class.
                
    $reflection = new \ReflectionProperty(get_class($widget), 'arrErrors');
                
    $reflection->setAccessible(true);
                
    $reflection->setValue($widget, array());
                
    $reflection = new \ReflectionProperty(get_class($widget), 'strClass');
                
    $reflection->setAccessible(true);
                
    $reflection->setValue($widgetstr_replace('error'''$reflection->getValue($widget)));
            } else {
                if (
    $inputValues && $inputValues->hasPropertyValue($property)
                    && 
    $inputValues->isPropertyValueInvalid($property)
                ) {
                    foreach (
    $inputValues->getPropertyValueErrors($property) as $error) {
                        
    $widget->addError($error);
                    }
                }
            }

            
    $strDatePicker '';
            if (isset(
    $propExtra['datepicker'])) {
                
    $strDatePicker $this->buildDatePicker($widget);
            }

            
    $objTemplateFoo = new ContaoBackendViewTemplate('dcbe_general_field');
            
    $objTemplateFoo->setData(
                array(
                    
    'strName'       => $property,
                    
    'strClass'      => isset($propExtra['tl_class']) ? $propExtra['tl_class'] : null,
                    
    'widget'        => $widget->parse(),
                    
    'hasErrors'     => $widget->hasErrors(),
                    
    'strDatepicker' => $strDatePicker,
                    
    // TODO: need 'update' value.
                    // Old code:
                    // (\Input::get('act') == 'overrideAll'
                    // && ($arrData['inputType'] == 'checkbox'
                    // || $arrData['inputType'] == 'checkboxWizard')
                    // && $arrData['eval']['multiple'])
                    
    'blnUpdate'     => false,
                    
    // $blnUpdate,
                    
    'strHelp'       => $this->generateHelpText($property),
                    
    'strId'         => $widget->id
                
    )
            );

            
    $buffer $objTemplateFoo->parse();

            if (isset(
    $propExtra['rte']) && strncmp($propExtra['rte'], 'tiny'4) === 0) {
                
    $propertyId 'ctrl_' $property;

                
    $buffer .= <<<EOF
    <script>tinyMCE.execCommand('mceAddControl', false, '{$propertyId}');$('{$propertyId}').erase('required');</script>
    EOF;
            }

            return 
    $buffer;
        }

        
    /**
         * {@inheritDoc}
         *
         * @SuppressWarnings(PHPMD.Superglobals)
         * @SuppressWarnings(PHPMD.CamelCaseVariableName)
         */
        
    public function processInput(PropertyValueBag $propertyValues)
        {
            
    // @codingStandardsIgnoreStart - Remember current POST data and clear it.
            
    $post  $_POST;
            
    $_POST = array();
            
    // @codingStandardsIgnoreEnd
            
    \Input::resetCache();

            
    // Set all POST data, these get used within the Widget::validate() method.
            
    foreach ($propertyValues as $property => $propertyValue) {
                
    $_POST[$property] = $propertyValue;
            }

            
    // Now get and validate the widgets.
            
    foreach (array_keys($propertyValues->getArrayCopy()) as $property) {
                
    // NOTE: the passed input values are RAW DATA from the input provider - aka widget known values and not
                // native data as in the model.
                // Therefore we do not need to decode them but MUST encode them.
                
    $widget $this->getWidget($property$propertyValues);
                
    $widget->validate();

                if (
    $widget->hasErrors()) {
                    foreach (
    $widget->getErrors() as $error) {
                        
    $propertyValues->markPropertyValueAsInvalid($property$error);
                    }
                } elseif (
    $widget->submitInput()) {
                    try {
                        
    $propertyValues->setPropertyValue(
                            
    $property,
                            
    $this->encodeValue($property$widget->value$propertyValues)
                        );
                    } catch (\
    Exception $e) {
                        
    $widget->addError($e->getMessage());
                        
    $propertyValues->markPropertyValueAsInvalid($property$e->getMessage());
                    }
                }
            }

            
    $_POST $post;
            \
    Input::resetCache();
        }

        
    /**
         * {@inheritDoc}
         */
        
    public function processErrors(PropertyValueBag $propertyValues)
        {
            
    $propertyErrors $propertyValues->getInvalidPropertyErrors();
            
    $definitionName $this->getEnvironment()->getDataDefinition()->getName();

            if (
    $propertyErrors) {
                
    $propagator $this->getEnvironment()->getEventPropagator();

                foreach (
    $propertyErrors as $property => $errors) {
                    
    $widget $this->getWidget($property);

                    foreach (
    $errors as $error) {
                        
    $event = new ResolveWidgetErrorMessageEvent($this->getEnvironment(), $error);
                        
    $propagator->propagate(
                            
    $event::NAME,
                            
    $event,
                            array(
                                
    $definitionName,
                                
    $property
                            
    )
                        );

                        
    $widget->addError($event->getError());
                    }
                }
            }
        }
    }

  13. #13
    Contao-Nutzer Avatar von justs
    Registriert seit
    29.11.2011.
    Ort
    Diepenheim, NL
    Beiträge
    19

    Standard

    Danke Hauge, aber so sah meins auch schon aus... Offenbar gibt es ein anderes Problem, vielleicht eine inkompatible Extension.

  14. #14
    Contao-Nutzer Avatar von justs
    Registriert seit
    29.11.2011.
    Ort
    Diepenheim, NL
    Beiträge
    19

    Standard

    Leider noch immer keine Lösung. TinyMCE 4 (oder 3) funktioniert nicht. Ich brauche es! Hat jemand eine Idee?

  15. #15
    Contao-Fan Avatar von Hauge
    Registriert seit
    31.01.2010.
    Beiträge
    643

    Standard

    Habe grad die aktuelle nightly hochgeladen

    Code:
    contao-community-alliance/dc-general                  dev-develop @ 535895    2014-10-08 20:35:20
    > funktioniert so wie es aussieht nun ohne Anpassung...
    Geändert von Hauge (09.10.2014 um 07:31 Uhr)

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •