/trunk/serveur/generateur/eflore_generateur.php |
---|
New file |
0,0 → 1,84 |
<? |
require_once '..\\eflore_config.php'; |
header("Content-type: application/vnd.mozilla.xul+xml"); |
echo '<?xml version="1.0" encoding="UTF-8" ?>'; |
echo '<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>'; |
function ecrirelisteFichier($chemin) |
{ |
$repertoire = openDir($chemin); |
while ($fichier = readDir($repertoire)) |
{ |
if (($fichier !='.') && ($fichier !='..')) |
{ |
echo "<listitem label='$fichier'/>"; |
} |
} |
closeDir($repertoire); |
} |
function ecrireFichierMap() |
{ |
$fichierServicesMap = fopen('..\\'.$appConfig['service_map'],"r"); |
$ligne = 0; |
while($donnee=fscanf($fichierServicesMap,"%s\t%s\t%s\t%s\t%s\t%s",$keyName,$serviceName,$viewName,$schema,$ratio,$style)) |
{ |
$ligne++; |
if ($ligne>1) |
{ |
echo "<listitem><listcell label='$keyName'/><listcell label='$serviceName'/><listcell label='$viewName'/><listcell label='$schema'/><listcell label='$ratio'/><listcell label='$style'/></listitem>"; |
} |
} |
fclose($fichierServicesMap); |
} |
?> |
<!DOCTYPE window> |
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" > |
<script type="application/x-javascript" src="eflore_generateur.js" /> |
<hbox flex="1"> |
<vbox flex="1"> |
<label value="Macro Elements"/> |
<listbox id="listemacroelements"> |
<? ecrireListeFichier('..\\'.$appConfig['def_macro']); ?> |
</listbox> |
<hbox> |
<button label="Tout compiler" onclick="compileSelection('listemacroelements')"/> |
<button label="Afficher" onclick="afficheSelection('listemacroelements')"/> |
</hbox> |
</vbox> |
<vbox flex="1"> |
<label value="Service Donnees"/> |
<listbox id="groupesmacroelements"> |
<? ecrireListeFichier('..\\'.$appConfig['def_groupes']); ?> |
</listbox> |
<hbox> |
<button label="Tout compiler" onclick="compileSelection('groupesmacroelements')"/> |
<button label="Afficher" onclick="afficheSelection('groupesmacroelements')"/> |
</hbox> |
</vbox> |
<vbox flex="1"> |
<label value="Publications HTML"/> |
<listbox> |
<? ecrireListeFichier('..\\'.$appConfig['publi_html']); ?> |
</listbox> |
<hbox><button label="Tout compiler"/><button label="Afficher"/></hbox> |
</vbox> |
<vbox flex="1"> |
<label value="Publications XML"/> |
<listbox> |
<? ecrireListeFichier('..\\'.$appConfig['publi_xml']); ?> |
</listbox> |
<hbox><button label="Tout compiler"/><button label="Afficher"/></hbox> |
</vbox> |
</hbox> |
<hbox flex="1" > |
<listbox flex="1"> |
<listcols><listcol flex="1" /><listcol flex="1" /><listcol flex="1" /><listcol flex="1" /><listcol flex="1" /><listcol flex="1" /></listcols> |
<listhead><listheader label="Clef"/><listheader label="Service"/><listheader label="Publication"/><listheader label="Schema a respecter"/><listheader label="Ratio de control"/><listheader label="Style"/></listhead> |
<? ecrireFichierMap(); ?> |
</listbox> |
</hbox> |
</window> |
/trunk/serveur/generateur/eflore_traducteur.php |
---|
New file |
0,0 → 1,67 |
<? |
require_once '..\\eflore_config.php'; |
if(!empty($_REQUEST['listemacroelements'])) |
{ |
genererTousMacroElements('..\\'.$appConfig['def_macro']); |
} |
if(!empty($_REQUEST['groupesmacroelements'])) |
{ |
genererTousGroupesMacroElements('..\\'.$appConfig['def_groupes']); |
} |
function genererTousGroupesMacroElements($chemin) |
{ |
global $appConfig; |
$repertoire = openDir($chemin); |
while ($fichier = readDir($repertoire)) |
{ |
if (($fichier !='.') && ($fichier !='..')) |
{ |
echo "<li>$fichier début de la génération"; |
$res='..\\'.$appConfig['auto_groupes'].$fichier.'.php'; |
genererFichier('xslt\groupemacroelement.xslt',$chemin.$fichier,$res); |
echo "fin de la génération"; |
} |
} |
closeDir($repertoire); |
} |
function genererTousMacroElements($chemin) |
{ |
global $appConfig; |
$repertoire = openDir($chemin); |
while ($fichier = readDir($repertoire)) |
{ |
if (($fichier !='.') && ($fichier !='..')) |
{ |
echo "<li>$fichier début de la génération"; |
$res='..\\'.$appConfig['auto_macro'].$fichier.'.php'; |
genererFichier('xslt\macroelement.xslt',$chemin.$fichier,$res); |
echo "fin de la génération"; |
} |
} |
closeDir($repertoire); |
} |
function genererFichier($xsltFilePath,$xmlFilePath,$resFilePath) |
{ |
$processeur = new XSLTprocessor(); |
$style = new domDocument(); |
$style->load($xsltFilePath); |
$processeur->importStyleSheet($style); |
$doc = new domDocument(); |
$doc->load($xmlFilePath); |
$handle = fopen ($resFilePath, "w"); |
fwrite($handle,$processeur->transformToXML($doc)); |
fclose($handle); |
} |
?> |
/trunk/serveur/generateur/eflore_generateur.js |
---|
New file |
0,0 → 1,10 |
function afficheSelection(listid) |
{ |
var liste = document.getElementById(listid); |
window.location.assign("http://localhost/serveurXML/generateur/eflore_afficher.php?"+listid+"="+liste.selectedItem.label); |
} |
function compileSelection(listid) |
{ |
window.location.assign("http://localhost/serveurXML/generateur/eflore_traducteur.php?"+listid+"="+listid); |
} |
/trunk/serveur/generateur/eflore_afficher.php |
---|
New file |
0,0 → 1,21 |
<? |
require_once '..\\eflore_config.php'; |
header('Content-type: text/xml'); |
if(!empty($_REQUEST['listemacroelements'])) { |
$nom='..\\'.$appConfig['def_macro'].$_REQUEST['listemacroelements']; |
$file = fopen($nom,'r'); |
$taille =fileSize($nom); |
$lecture = fread($file,$taille); |
fclose($file); |
echo $lecture; |
} |
if(!empty($_REQUEST['groupesmacroelements'])) { |
$nom='..\\'.$appConfig['def_groupes'].$_REQUEST['groupesmacroelements']; |
$file = fopen($nom,'r'); |
$taille =fileSize($nom); |
$lecture = fread($file,$taille); |
fclose($file); |
echo $lecture; |
} |
?> |
/trunk/serveur/generateur/xslt/macroelement.xslt |
---|
New file |
0,0 → 1,115 |
<?xml version="1.0" encoding="UTF-8"?> |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes"/> |
<xsl:template match="/macroelement"><? |
<xsl:apply-templates select="//balise2" mode="require_once"/> |
class <xsl:value-of select="@nom"/> extends macroElement { |
function getSQL() |
{ |
$contexte = array(); |
<xsl:apply-templates select="requetes/requete"/> |
return; |
} |
<!--function buildRoot() |
{ |
<xsl:apply_templates select="mapping" mode="root"/> |
} |
--> |
} |
?> |
</xsl:template> |
<xsl:template match="mapping" mode="root"> |
<xsl:apply-templates select="*[@root]" mode="level1root"/> |
</xsl:template> |
<xsl:template match="requete"> |
if (<xsl:apply-templates select="parametres/parametre" mode="isnull"/>) |
{ |
<xsl:apply-templates select="parametres/parametre" mode="contexte"/> |
if(<xsl:apply-templates select="parametres/parametre" mode="renseigne"/>) |
{ return "<xsl:value-of select="sql"/>"; } |
} |
</xsl:template> |
<xsl:template match="parametre[position()=last()]" mode="isnull">array_key_exists('<xsl:value-of select="@nom"/>',$this->contexteRef) </xsl:template> |
<xsl:template match="parametre" mode="isnull">array_key_exists('<xsl:value-of select="@nom"/>',$this->contexteRef) and </xsl:template> |
<xsl:template match="parametre" mode="contexte"> |
$contexte['<xsl:value-of select="@nom"/>']= $this->contexteRef['<xsl:value-of select="@nom"/>']; |
</xsl:template> |
<xsl:template match="parametre[position()=last()]" mode="renseigne">!empty($contexte['<xsl:value-of select="@nom"/>']) </xsl:template> |
<xsl:template match="parametre" mode="renseigne">!empty($contexte['<xsl:value-of select="@nom"/>']) and </xsl:template> |
<xsl:template match="*" mode="level1root"> |
$element= new domElement('<xsl:value-of select="name()"/>'); |
$this->baseDOM->appendChild($element); |
<xsl:apply-templates select="@*"/> |
<xsl:apply-templates select="text()"/> |
</xsl:template> |
<xsl:template match="mapping" mode="fetch"> |
<xsl:apply-templates select="*" mode="level1"/> |
</xsl:template> |
<xsl:template match="*" mode="level1"> |
$element= new domElement('<xsl:value-of select="name()"/>'); |
$this->baseDOM->appendChild($element); |
<xsl:apply-templates select="@*"/> |
<xsl:apply-templates select="text()"/> |
<xsl:apply-templates select="*" mode="level2"/> |
</xsl:template> |
<xsl:template match="*" mode="level2"> |
$this->baseDOM = $element; |
$element= new domElement('<xsl:value-of select="name()"/>'); |
$this->baseDOM->appendChild($element); |
<xsl:apply-templates select="@*"/> |
<xsl:apply-templates select="text()"/> |
<xsl:apply-templates select="*" mode="level3"/> |
</xsl:template> |
<xsl:template match="*" mode="level3"> |
$this->baseDOM = $element; |
$element= new domElement('<xsl:value-of select="name()"/>'); |
$this->baseDOM->appendChild($element); |
<xsl:apply-templates select="@*"/> |
<xsl:apply-templates select="text()"/> |
<xsl:apply-templates select="*" mode="level4"/> |
</xsl:template> |
<xsl:template match="*" mode="level4"> |
$this->baseDOM = $element; |
$element= new domElement('<xsl:value-of select="name()"/>'); |
$this->baseDOM->appendChild($element); |
<xsl:apply-templates select="@*"/> |
<xsl:apply-templates select="text()"/> |
</xsl:template> |
<xsl:template match="@*"> |
$element->setAttribute('<xsl:value-of select="name()"/>',<xsl:value-of select="."/>); |
</xsl:template> |
<xsl:template match="text()"> |
/*text(<xsl:value-of select="."/>)*/ |
</xsl:template> |
</xsl:stylesheet> |
/trunk/serveur/generateur/xslt/groupemacroelement.xslt |
---|
New file |
0,0 → 1,51 |
<?xml version="1.0" encoding="UTF-8"?> |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes"/> |
<xsl:template match="/groupemacroelement"><? |
class <xsl:value-of select="@classe"/> extends groupeMacroElement { |
function __construct($aConn) |
{ |
parent::__construct($aConn); |
} |
function construire() |
{ |
$this->dblock= new blockdedonnees('<xsl:value-of select="@nom"/>'); |
<xsl:apply-templates select="parametres" /> |
$this->buildContext(); |
$this->addMacroElement(); |
} |
function buildContext() |
{ |
} |
function addMacroElement() |
{ |
<xsl:apply-templates select="macroelement" /> |
} |
} |
?> |
</xsl:template> |
<xsl:template match="parametres" > |
<xsl:apply-templates select="parametre" /> |
</xsl:template> |
<xsl:template match="parametre" > |
if (array_key_exists('<xsl:value-of select="@nom"/>',$_REQUEST)) { $this->dblock->ajouterDonnee('<xsl:value-of select="@nom"/>',$_REQUEST['<xsl:value-of select="@nom"/>']); } |
</xsl:template> |
<xsl:template match="macroelement" > |
/*balise:<xsl:value-of select="@nom"/>*/ |
$aMacroElement = $this->macroElementFactory('<xsl:value-of select="@nom"/>',$this->dblock); |
$aMacroElement->construire(); |
</xsl:template> |
</xsl:stylesheet> |