Seite 1 von 1

[CON-1883] Teaserplugin Verbesserungsvorschläge

Verfasst: Do 19. Jun 2014, 12:22
von rethus
Wenn man den Teaser öffnet, gibt es ja die Tabs "Automatisch" und "Manuell"

Für "Automatisch" gibt es ein Textfeld überschrift, für Manuell nicht.
Aktiviert man "Manuell" wird auch keine Überschrift genommen, selbst wenn diese im Titel-Tag von Automatisch angegeben wurde.

Hier sollte entweder auch für das Tab Manuell ein Title-Feld ergänzt werden (sauberste Lösung), oder ein Fallback gemacht werden : Wenn im Tab "Automatisch" überschrift gesetzt, und im Teaser sebst kein HTMLHEAD-Element genutzt, dann nehme die Überschrift aus dem Title vom Tab "Automatisch"

Und hier die einfachste Lösung dafür:
File: class.content.type.teaser.php Zeile: 430

Code: Alles auswählen

            // set generated values to teaser template
            if(empty($title) && !empty($this->_settings['teaser_title'])) $title=$this->_settings['teaser_title'];  // <-- hinzugefügt
            $template->set('d', 'TITLE', $title);
 

Re: Teaserplugin Verbesserung: Title

Verfasst: Do 17. Jul 2014, 14:24
von frederic.schneider_4fb
Hey,

wir werden das entsprechende Eingabefeld für den Teaser-Titel @ Manuell-Tab in einer der nächsten Versionen implementieren.

Re: Teaserplugin Verbesserungsvorschläge

Verfasst: Mo 28. Jul 2014, 14:32
von rethus
Hier ein weiterer Vorschlag:

Download und Video-Taeser per Default verfügbar machen.... und so gehts:

class.content.type.teaser.php:
Zeile: 378 (nach $title=…)

Code: Alles auswählen

           if($this->_settings['teaser_style']=="cms_teaser_download.html"){
            	$text_c = trim(strip_tags($text));
            	$text 	= trim(strip_tags($text,'<a>'));
				$text_l  = $this->_settings['teaser_character_limit'];
              	if (strlen($text_c) > $this->_settings['teaser_character_limit']) {
              		$slice = ($text_l + (strlen($text) - strlen($text_c)) );
                	$text = capiStrTrimAfterWord($text, $slice .'...');
              	}
            }
            elseif($this->_settings['teaser_style']=="cms_teaser_video.html"){
            	$text = preg_replace('#<a href#', '<a rel="prettyPhoto" href', $text);
            	if(!cRegistry::isBackendEditMode()) {
            	$pre_text 	= '<script type="text/javascript" charset="utf-8">
								$(document).ready(function(){
									$("a[rel^=\'prettyPhoto\']").prettyPhoto();
								});
							</script>';}else $pre_text ="";

Funktion generateEditCode:
(Der einfachheit halber hier einfach die gesamte Funktion mit den neuen Platzhaltern... notfalls einfach ein diff zur orginal-Datei machen)

Code: Alles auswählen

public function generateEditCode() {
        $this->_initCmsTypes();

        $template = new cTemplate();
        // Set some values into javascript for a better handling
        $template->set('s', 'PATH_BACKEND', $this->_cfg['path']['contenido_fullhtml']);
        $template->set('s', 'ID', $this->_id);
        $template->set('s', 'IDARTLANG', $this->_idArtLang);
        $template->set('s', 'CONTENIDO', $_REQUEST['contenido']);
        $template->set('s', 'FIELDS', "'" . implode("','", $this->_formFields) . "'");

        $templateTabs = new cTemplate();
        $templateTabs->set('s', 'PREFIX', $this->_prefix);

        // create code for general tab
        $templateTabs->set('d', 'TAB_ID', 'general');
        $templateTabs->set('d', 'TAB_CLASS', 'general');
        $templateTabs->set('d', 'TAB_CONTENT', $this->_generateTabGeneral());
        $templateTabs->next();

        // create code for advanced tab
        $templateTabs->set('d', 'TAB_ID', 'advanced');
        $templateTabs->set('d', 'TAB_CLASS', 'advanced');
        $templateTabs->set('d', 'TAB_CONTENT', $this->_generateTabAdvanced());
        $templateTabs->next();

        // create code for manual tab
        $templateTabs->set('d', 'TAB_ID', 'manual');
        $templateTabs->set('d', 'TAB_CLASS', 'manual');
        $templateTabs->set('d', 'TAB_CONTENT', $this->_generateTabManual());
        $templateTabs->next();

        $codeTabs = $templateTabs->generate($this->_cfg['path']['contenido'] . 'templates/standard/template.cms_abstract_tabbed_edit_tabs.html', true);

        // construct the top code of the template
        $templateTop = new cTemplate();
        $templateTop->set('s', 'PATH_BACKEND', $this->_cfg['path']['contenido_fullhtml']);
        $templateTop->set('s', 'ICON', 'images/isstart0.gif');
        $templateTop->set('s', 'ID', $this->_id);
        $templateTop->set('s', 'PREFIX', $this->_prefix);
        $templateTop->set('s', 'HEADLINE', i18n('Teaser settings'));
        $codeTop = $templateTop->generate($this->_cfg['path']['contenido'] . 'templates/standard/template.cms_abstract_tabbed_edit_top.html', true);

        // define the available tabs
        $tabMenu = array(
            'general' => i18n('Automatic'),
            'advanced' => i18n('Manual'),
            'manual' => i18n('Settings')
        );

        // construct the bottom code of the template
        $templateBottom = new cTemplate();
        $templateBottom->set('s', 'PATH_BACKEND', $this->_cfg['path']['contenido_fullhtml']);
        $templateBottom->set('s', 'PATH_FRONTEND', $this->_cfgClient[$this->_client]['path']['htmlpath']);
        $templateBottom->set('s', 'ID', $this->_id);
        $templateBottom->set('s', 'PREFIX', $this->_prefix);
        $templateBottom->set('s', 'IDARTLANG', $this->_idArtLang);
        $templateBottom->set('s', 'CONTENIDO', $_REQUEST['contenido']);
        $templateBottom->set('s', 'FIELDS', "'" . implode("','", $this->_formFields) . "'");
        $templateBottom->set('s', 'SETTINGS', json_encode($this->_settings));
        $templateBottom->set('s', 'JS_CLASS_SCRIPT', $this->_cfg['path']['contenido_fullhtml'] . 'scripts/content_types/cmsTeaser.js');
        $templateBottom->set('s', 'JS_CLASS_NAME', 'Con.cContentTypeTeaser');
        $codeBottom = $templateBottom->generate($this->_cfg['path']['contenido'] . 'templates/standard/template.cms_abstract_tabbed_edit_bottom.html', true);

        // construct the whole template code
        $code = $this->generateViewCode();
        $code .= $this->_encodeForOutput($codeTop);
        $code .= $this->_generateTabMenuCode($tabMenu);
        $code .= $this->_encodeForOutput($codeTabs);
        $code .= $this->_generateActionCode();
        $code .= $this->_encodeForOutput($codeBottom);

        return $code;
    }
Zeile 740:

Code: Alles auswählen

		$htmlSelectOption = new cHTMLOptionElement(i18n("Download Liste"), 'cms_teaser_download.html', false);
        $htmlSelect->appendOptionElement($htmlSelectOption);

	    $htmlSelectOption = new cHTMLOptionElement(i18n("Video"), 'cms_teaser_video.html', false);
        $htmlSelect->appendOptionElement($htmlSelectOption);
Dann natürlich noch die beiden Template-Vorlagen /cms/templates hinzufügen:

cms_teaser_download.html

Code: Alles auswählen

<div class="column_quarter text teaser_download">
    <!-- BEGIN:BLOCK -->
    <h2>{TITLE}</h2>
    <div class="col">
       <p>{TEXT}</p>
    </div>
    <!-- END:BLOCK -->
</div>
cms_teaser_video.html

Code: Alles auswählen

<div class="column_quarter text teaser_video">
    <!-- BEGIN:BLOCK --> 
   <h2>{TITLE}</h2>
    <div class="col">
		{TEXT}
    </div>
    <!-- END:BLOCK -->
</div>
Für das Video-Template habe ich via JQuery-Plugin "Pretty-Photo" ein Modal (Popup) eingebunden, in dem das Video dann angezeigt wird.
Da die PrettyPhoto-Page derzeit off zu sein scheint, anbei die Files in einem ZIP

Re: Teaserplugin Verbesserung: Title

Verfasst: Mo 28. Jul 2014, 14:44
von rethus
frederic.schneider_4fb hat geschrieben:Hey,

wir werden das entsprechende Eingabefeld für den Teaser-Titel @ Manuell-Tab in einer der nächsten Versionen implementieren.
Gibt es hierzu schon eine Ticketnummer?

Re: Teaserplugin Verbesserungsvorschläge

Verfasst: Do 31. Jul 2014, 08:01
von frederic.schneider_4fb