plugin in vollen Fenster anzeigen

Ideen für neue Funktionen in CONTENIDO?
Gesperrt
josh
Beiträge: 156
Registriert: Do 24. Jun 2004, 09:25
Wohnort: Ahlen
Kontaktdaten:

plugin in vollen Fenster anzeigen

Beitrag von josh » Mi 14. Jul 2004, 17:33

Ich beschäftige mich gerade mit dem Einbinden von Plugins in Contenido.

Der Beitrag von emergence http://www.contenido.de/forum/viewtopic ... ght=plugin hat mir dabei sehr geholfen.

Vielen Dank emergence!


In dem Beispiel wird ein Frameset geladen wie fast überall im Backend.
Ich möchte aber ein Plugin im vollem Fenster anzeigen wie z.B. bei Content/Kategorie.

Kann ich irgendwie den Parameter &menuless=1 übergeben?
Dieser wird in frameset.php abgefragt und verzeigt dann zu alternativen Framesets. Oder gibt es eine andere Möglichkeit?

emergence
Beiträge: 10644
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence » Mi 14. Jul 2004, 18:09

intressante möglichkeit an die ich nicht gedacht habe... momentan ist ein übergeben von menuless=1 nicht möglich...
würde es sogar als feature request einstufen...

eventuell eine weitere tabelle in der db welche die frameless areas beinhaltet und in der frameset.php abgefragt werden.
wenn ein typ dort eingetragen ist eh klar wird frameless genommen...

andere möglichkeit das xml file dementsprechend erweitern (mittels eines attributs) da müsste aber der xml parser angepasst werden und class.navigation.php

an sich wäre mir die möglichkeit mit dem xml file lieber...

da sollte sich timo noch zu wort melden...
*** make your own tools (wishlist :: thx)

timo
Beiträge: 6284
Registriert: Do 15. Mai 2003, 18:32
Wohnort: Da findet ihr mich nie!
Kontaktdaten:

Beitrag von timo » Mi 14. Jul 2004, 19:11

"geplant" ist sowas nicht, aber wäre nett, wenn so etwas reinkommen würde (das WIE ist die große frage).

bisher habe ich es bei meinen Plugins so gelöst, daß ich das linke Frame (in der 4.5) über JS verkleinert habe.

emergence
Beiträge: 10644
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence » Mi 14. Jul 2004, 21:00

verschoben...

nun ja betrachten wir es mal als feature request... ;-)

also die möglichkeit mit der db tabelle ist easy umsetzbar...

die xml geschichte mit dem parser find ich aber wesentlich geiler...
soweit ich das im cvs_head gesehen habe gibt es in für frameless content doch ein paar sehr unsaubere hacks...

dann machen wir es doch gleich richtig und nehmen die anderen xml bugs des parsers gleich mit... (da hab ich doch was im bugtracker gesehen.. ;-)) das ding gehört sowieso mal ordendlich getestet...

ich sehe mir das mal an...
*** make your own tools (wishlist :: thx)

emergence
Beiträge: 10644
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence » Do 15. Jul 2004, 15:46

ähm den anderen bug in class.xml.php auf die schnelle zu beheben ist etwas problematisch... wenn man keinen tree baut wird das ein wenig kompliziert... wenn nicht sogar unmöglich...
irgendwie müsste man sich ne komplett andere möglichkeit überlegen wie
function valueOf diesen part erledigt...
*** make your own tools (wishlist :: thx)

emergence
Beiträge: 10644
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence » Mo 19. Jul 2004, 04:28

ich hab mich gerade mal etwas hingesetzt und die class.xml.php
valueOf art und weise etwas modifiziert...

die werte werden jetzt auf grund des geparsten baumes rausgesucht...

die interne function _getElement

ist jetzt mal komplett rausgeflogen...

hier die neue function

Code: Alles auswählen

    /**
     * valueOf()
     *
     * Extract one node value from the XML document.
     * Use simplified XPath syntax to specify the node.
     * F.e. 'root/test/firstnode'
     *
     * @return String Value of XML node
     */
     function valueOf($xpath) {

        if (!is_array($this->$tree)) $this->$tree = $this->parse(); // build tree once

        $arr_xpath = explode("/", $xpath);

        $tree = $this->$tree;

        if ($arr_xpath[0] != "language") {
            $keynode = "['language']"; // subnavigation doesn't add language to $xpath -> this is a bug
        } else {
            $keynode = "";
        }

        foreach ($arr_xpath as $key => $value) {
            $keynode .= "['".$value."']";
        }

        eval('$value = $tree'.$keynode.';');

        if ($value == NULL) { return "Not found"; }

        if (is_array($value)) { return "Has children"; }

        return $value;

    } // end function
geht sicher auch noch eleganter...

am beginn der klasse bei den variablen hab ich momentan

Code: Alles auswählen

    /**
     * @var parsed array
     */
    var $tree;
ergänzt.

es muss jetzt möglich sein das konstruktionen wie
language/content/upload/upload funktionieren !

@timo
vielleicht hast du ja zeit dir das mal etwas anzusehen...
die attribute könnte man ähnlich abfragen wenn der geparste tree diese berücksichtigen würde...
*** make your own tools (wishlist :: thx)

emergence
Beiträge: 10644
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence » Mo 19. Jul 2004, 05:34

wie geschrieben ist das oben nur ein ansatz... bezieht sich auf http://bugs.contenido.de/bug_view_page. ... id=0000126
nun ja aufgrund das ich das jetzt geändert habe, bin ich natürlich auf ein paar bugs drauf genagelt... und zwar
-> lang_de_DE.xml und jede weitere xml datei
findet sich am ende

Code: Alles auswählen

         <mycontenido>MyContenido</mycontenido>
hat dort nichts verloren... etwas darüber steht es nämlich nochmals...
wirkt sich sonst in den bereichen aus...

des weiteren sollte man sich in includes/ alle dateien mit valueOf mal raussuchen...

da sind teilweise auch ganz nette konstruktionen drinnen die mir nicht klar sind...
zB:
grouprights.inc.php|rights.inc.php -> valueOf("language/sub");
grouprights.inc.php|rights.inc.php -> valueOf("language/action");

mit den plugins hab ich das jetzt aber noch nicht getestet... wird vermutlich nicht ohne modifikationen funktionieren...
*** make your own tools (wishlist :: thx)

emergence
Beiträge: 10644
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence » Fr 6. Aug 2004, 11:45

ich verknüpf das mal weils direkt damit zusammenhängt...
zumindestens behebt es fast alle probleme mit valueOf

http://www.contenido.de/forum/viewtopic ... highlight=

die schlussendliche version von valueOf könnte dann so aussehen...

Code: Alles auswählen

    /** 
     * valueOf() 
     * 
     * Extract one node value from the XML document. 
     * Use simplified XPath syntax to specify the node. 
     * F.e. 'root/test/firstnode' 
     * 
     * @return String Value of XML node 
     */ 
     function valueOf($xpath) { 

        if (!is_array($this->$tree)) $this->$tree = $this->parse(); // build tree once 

        $arr_xpath = explode("/", $xpath); 

        $tree = $this->$tree; 

        $keynode = ""; 

        foreach ($arr_xpath as $key => $value) { 
            $keynode .= "['".$value."']"; 
        } 

        eval('$value = $tree'.$keynode.';'); 

        if ($value == NULL) { return "Not found"; } 

        if (is_array($value)) { return "Has children"; } 

        return $value; 

    } // end function
*** make your own tools (wishlist :: thx)

emergence
Beiträge: 10644
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence » Sa 7. Aug 2004, 09:46

hab mir das jetzt mit menuless noch etwas überlegt...

ich denke das vernünfigste ist es dies bei con_area als neues feld mit reinzuziehen....
einfach ne neue spalte mit menuless ergänzen...
und in der frameset.php diesen parameter abfragen...

sieht folgender massen aus...

in contenido/upgrade.php

nach

Code: Alles auswählen

dbUpgradeTable($prefix."_area", 'online', 'tinyint(1)', '', '', '0', '','');
folgendes ergänzen

Code: Alles auswählen

dbUpgradeTable($prefix."_area", 'menuless', 'tinyint(1)', '', '', '0', '','');
in contenido/frameset.php anstelle von

Code: Alles auswählen

/* Hide menu-frame for some areas */
$menuless_areas = array("str", "logs", "debug", "system");
folgendes einbauen

Code: Alles auswählen

/* Hide menu-frame for some areas */
$sql = "SELECT name FROM ".$cfg["tab"]["area"]." WHERE menuless='1'";
$db->query($sql);
while ($db->next_record()) {
    $menuless_areas[] = $db->f("name");
}
in setup/sql/base.sql

bei allen insert !PREFIX!_area am ende des queries durch

Code: Alles auswählen

, '0');
ersetzen bis auf str, debug, logs, system dort

Code: Alles auswählen

, '1');
verwenden...

upgrade über setup fahren fertig...

bei einträgen die man selbst dann vornimmt in der con_area braucht man dann eigentlich nur mehr den wert menuless beachten...
javascript entfällt somit um das linke frameset auszublenden...

in class.navigation.php könnte man die menuless=1 bei mycontenido_overview und info ebenfalls entfernen wenn man sie in con_area am schluss als 1 definiert.... (nur so nebenbei mycontenido ist falsch definiert in con_frame_files die einträge sind dort unnötig zumindestens in der 4.4.x serie)

das ist es...
*** make your own tools (wishlist :: thx)

emergence
Beiträge: 10644
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence » Fr 10. Sep 2004, 10:39

eine ergänzung hab ich da noch...

in main.login.php kann man
das menuless=1 raus nehmen (3x)

und bei
con_area den wert menuless bei

mycontenido mycontenido_overview
mycontenido mycontenido_settings
0 symbolhelp

auf 1 setzen, dann wäre alles an einer zentralen stelle...

im cvs_head könnte man dies ebenso bei
mycontenido mycontenido_tasks auf 1 setzen...
*** make your own tools (wishlist :: thx)

emergence
Beiträge: 10644
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence » Di 14. Sep 2004, 12:52

ad. http://www.contenido.de/forum/viewtopic ... 8459#28459

ich hab das gerade mal mit php5 getestet...
und bin da ein problem mit umlauten gestossen...

ich hab das class.xml.php so geändert das es die umlaute korrekt berücksichtigt...

das intressante am xml_parse ist:
sobald ein sonderzeichen gefunden wird setzt der befehl ein zeilen umbruch rein..
Empfänger wird zu änger
Empf&auml;nger wird zu auml;nger
und ein
Empf&auml;nger wie es korrekt wäre zeigt Empf

ich hab die datei nun so modifiziert das diese fälle ausgeräumt sind...
äöüß etc. werden nun as is angezeigt
&auml; wird in ä modifiziert
&auml; wird zu &auml;

ehrlich gesagt hab ich keine ahnung warum das so ist, sein soll...

wie auch immer die datei mit sämtlichen änderungen...

Code: Alles auswählen

<?php

/**
 * Class XML_doc
 *
 * Simple class for extracting values
 * from a XML document. Uses a simplified
 * XPath syntax to access the elements.
 * For example: 'root/person/name' would
 * return the value of the 'name' node in
 * 'root/person' node. You have to specify
 * the root node name. Can't access node
 * attributes yet.
 *
 * @copyright four for business AG <http://www.4fb.de>
 * @author Jan Lengowski <Jan.Lengowski@4fb.de>
 * @modified Martin Horwath <horwath@dayside.net>
 * @version 0.9.5
 * @package 4fb_XML
 */
class XML_doc {

    /**
     * @var array $errors
     */
     var $errors = array();

    /**
     * @var string xml
     */
     var $xml;

    /**
     * @var parsed array
     */
    var $parsearray;

    /**
     * @var help array
     */
    var $itemname;

    /**
     * XML Parser Object
     */
    var $parser;

    /**
     * Previous Data Element
     */
    var $previous;

    /**
     * Class Construcor
     */
    function XML_doc() {
      // do nothing
    } // end function


    /**
     * load()
     *
     * Load the XML file
     *
     * @param string XML document filename
	 * @return boolean true if the load was successful
     */
    function load($filename) {

        if (file_exists($filename)) {
            $fp = fopen ($filename, "rb");

            if ($fp === false)
            {
            	return (false);
            }

            unset($this->xml);
            $this->xml = fread ($fp, filesize ($filename));
            fclose ($fp);

            // useful if enties are found in xml file
            $this->xml = $this->_translateLiteral2NumericEntities($this->xml);

            unset($this->parsearray);
            return (true);

        } else {
            //die('no XML file ('.$filename.')');
			return (false);

        }

    } // end function


    /**
     * valueOf()
     *
     * Extract one node value from the XML document.
     * Use simplified XPath syntax to specify the node.
     * F.e. 'root/test/firstnode'
     *
     * @return String Value of XML node
     */
     function valueOf($xpath) {

        if (!is_array($this->parsearray)) { // build tree once
            $this->parse(false);
        }

        $arr_xpath = explode("/", $xpath);

        $keynode = "";

        foreach ($arr_xpath as $key => $value) {
            $keynode .= "['".$value."']";
        }

        eval('$value = $this->parsearray'.$keynode.';');

        if ($value == NULL) { return "Not found"; }

        if (is_array($value)) { return "Has children"; }

        return $value;

    } // end function




    /**
     * parse()
     *
     * Parse the xml file in an array
     *
     *
     *
     * @return array parsearray
     */

    function parse($send=true) {
        // set up a new XML parser to do all the work for us
        $this->parser = xml_parser_create();
        xml_set_object($this->parser, $this);
        xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false);
        xml_set_element_handler($this->parser, "startElement", "endElement");
        xml_set_character_data_handler($this->parser, "characterData");

        // parse the data and free the parser...
        xml_parse($this->parser, $this->xml);
        xml_parser_free($this->parser);
        if ($send) return $this->parsearray;
    } // end function

    /**
     *
     *
     *
     */
    function startElement($parser, $name, $attrs) {
        // Start a new Element.  This means we push the new element onto
        // store the name of this element
        $this->itemname[]="$name";
    } // end function

    /**
     *
     *
     *
     */
    function endElement($parser, $name) {
        // End an element.  This is done by popping the last element from
        // the stack and adding it to the previous element on the stack.
        // delete the old element from itemname
        array_pop($this->itemname);
    } // end function

    /**
     *
     *
     *
     */
    function characterData($parser, $data) {
        // Collect the data onto the end of the current chars it dont collect whitespaces.

        $data = eregi_replace ( "[[:space:]]+", " ", $data );

        // looks stupid but is useful to take care of entities
        // this corrects the line break issue
        // if you don't understand it, try to...
        if (!isset($this->previous)) {
            $this->previous = trim($data);
        } else {
            if ($this->previous != "" && trim($data) != "") {
                $string = $this->previous.trim($data);
                $data = $string;
            }
            $this->previous = trim($data);
        }

        if(trim($data)){
           //search for the element path
           foreach($this->itemname as $value){
                   $pos.="[$value]";
           }

           //set the new data in the parsearray
           eval("\$this->parsearray$pos=trim(\$data);");

        }

    } // end function

    /**
     * Translate literal entities to their numeric equivalents and vice versa.
     *
     * PHP's XML parser (in V 4.1.0) has problems with entities! The only one's that are recognized
     * are &, < > and ". *ALL* others (like &nbsp; &copy; a.s.o.) cause an
     * XML_ERROR_UNDEFINED_ENTITY error. I reported this as bug at http://bugs.php.net/bug.php?id=15092
     * The work around is to translate the entities found in the XML source to their numeric equivalent
     * E.g. &nbsp; to &#160; / &copy; to &#169; a.s.o.
     *
     * NOTE: Entities &, < > and " are left 'as is'
     *
     * @author Sam Blum bs_php@users.sourceforge.net
     * @param string $xmlSource The XML string
     * @param bool   $reverse (default=FALSE) Translate numeric entities to literal entities.
     * @return The XML string with translatet entities.
     */
    function _translateLiteral2NumericEntities($xmlSource, $reverse = FALSE) {
        static $literal2NumericEntity;

        if (empty($literal2NumericEntity)) {
            $transTbl = get_html_translation_table(HTML_ENTITIES);
            foreach ($transTbl as $char => $entity) {
                if (strpos('&"<>', $char) !== FALSE) continue;
                    $literal2NumericEntity[$entity] = '&#'.ord($char).';';
            }
        }

        if ($reverse) {
            return strtr($xmlSource, array_flip($literal2NumericEntity));
        } else {
            return strtr($xmlSource, $literal2NumericEntity);
        }
    }


} // end class XML_doc

?>
*** make your own tools (wishlist :: thx)

timo
Beiträge: 6284
Registriert: Do 15. Mai 2003, 18:32
Wohnort: Da findet ihr mich nie!
Kontaktdaten:

Beitrag von timo » Fr 14. Jan 2005, 16:47

Das mit dem menuless habe ich eingebaut, allerdings noch Sicherheitshalber eine Abfrage, ob die Spalte "menuless" auch wirklich existiert:

Code: Alles auswählen

/* First of all, fetch the meta data of the area table to check if there's a menuless column */
$aMetadata = $db->metadata($cfg["tab"]["area"]);
$bFound = false;

foreach ($aMetadata as $aFieldDescriptor)
{
	if ($aFieldDescriptor["name"] == "menuless")
	{
		$bFound = true;	
		break;
	}
}

$menuless_areas = array();

if ($bFound == true)
{
	/* Yes, a menuless column does exist */
	$sql = "SELECT name FROM ".$cfg["tab"]["area"]." WHERE menuless='1'";
	$db->query($sql);
	
	while ($db->next_record())
	{
	    $menuless_areas[] = $db->f("name");
	}
} else {
	/* No, use old style hard-coded menuless area stuff */
	$menuless_areas = array("str", "logs", "debug", "system");
}

Die geänderte XML-Klasse ist auch drin. Das mit dem Zeilenumbruch müßte man mal beobachten

emergence
Beiträge: 10644
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence » So 16. Jan 2005, 11:14

gecheckt und für gut befunden...
ich mach hier mal zu zwecks übersichtlichkeit...
*** make your own tools (wishlist :: thx)

Gesperrt