[CON-1883] Teaserplugin Verbesserungsvorschläge

Fragen zur Installation von CONTENIDO 4.9? Probleme bei der Konfiguration? Hinweise oder Fragen zur Entwicklung des Systemes oder zur Sicherheit?
Antworten
rethus
Beiträge: 1851
Registriert: Di 28. Mär 2006, 11:55
Wohnort: Mönchengladbach
Kontaktdaten:

[CON-1883] Teaserplugin Verbesserungsvorschläge

Beitrag 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);
 
Zuletzt geändert von rethus am Mo 28. Jul 2014, 14:46, insgesamt 2-mal geändert.
Could I help you... you can help me... buy me a coffee . (vielen ❤ Dank an: Seelauer, Peanut, fauxxami )

xstable.com: - HighSpeed Hosting, Domains, DomainReselling, Linux-Administration
suther.de: - App-Programierung, High-Performance-Webpages, MicroServices, API-Anbindungen & Erstellung

Software... ein Blick wert: GoogleCalender Eventlist, xst_dynamic_contentType
frederic.schneider_4fb
Beiträge: 967
Registriert: Do 15. Apr 2004, 17:12
Wohnort: Eschborn-Niederhöchstadt
Kontaktdaten:

Re: Teaserplugin Verbesserung: Title

Beitrag von frederic.schneider_4fb »

Hey,

wir werden das entsprechende Eingabefeld für den Teaser-Titel @ Manuell-Tab in einer der nächsten Versionen implementieren.
Frederic Schneider
Entwickler bei der four for business AG
rethus
Beiträge: 1851
Registriert: Di 28. Mär 2006, 11:55
Wohnort: Mönchengladbach
Kontaktdaten:

Re: Teaserplugin Verbesserungsvorschläge

Beitrag 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
Dateianhänge
content.type.teaser_additional_Files.zip
(204.58 KiB) 83-mal heruntergeladen
Could I help you... you can help me... buy me a coffee . (vielen ❤ Dank an: Seelauer, Peanut, fauxxami )

xstable.com: - HighSpeed Hosting, Domains, DomainReselling, Linux-Administration
suther.de: - App-Programierung, High-Performance-Webpages, MicroServices, API-Anbindungen & Erstellung

Software... ein Blick wert: GoogleCalender Eventlist, xst_dynamic_contentType
rethus
Beiträge: 1851
Registriert: Di 28. Mär 2006, 11:55
Wohnort: Mönchengladbach
Kontaktdaten:

Re: Teaserplugin Verbesserung: Title

Beitrag 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?
Could I help you... you can help me... buy me a coffee . (vielen ❤ Dank an: Seelauer, Peanut, fauxxami )

xstable.com: - HighSpeed Hosting, Domains, DomainReselling, Linux-Administration
suther.de: - App-Programierung, High-Performance-Webpages, MicroServices, API-Anbindungen & Erstellung

Software... ein Blick wert: GoogleCalender Eventlist, xst_dynamic_contentType
frederic.schneider_4fb
Beiträge: 967
Registriert: Do 15. Apr 2004, 17:12
Wohnort: Eschborn-Niederhöchstadt
Kontaktdaten:

Re: Teaserplugin Verbesserungsvorschläge

Beitrag von frederic.schneider_4fb »

Frederic Schneider
Entwickler bei der four for business AG
Antworten