- [x] Configuration JSON du dispatcher

- [x] Simplification de 2 tableaux lies par indice en 1
This commit is contained in:
xdrm-brackets 2016-02-03 10:13:31 +01:00
parent fb17230c80
commit 9ffef15f8a
5 changed files with 129 additions and 53 deletions

View File

@ -10,9 +10,7 @@
public static $parents_config_path = '/config/dispatcher-tree.json'; public static $parents_config_path = '/config/dispatcher-tree.json';
public static $supported_extensions; public static $supported_extensions;
public static $supported_extensions_header;
public static $supported_parents; public static $supported_parents;
public static $supported_parents_folder;
// Attributs prives utiles (initialisation) // Attributs prives utiles (initialisation)
private $header; private $header;
@ -34,23 +32,12 @@
=====================================================*/ =====================================================*/
// Extensions supportees // Extensions supportees
$extensions_conf = json_decode( file_get_contents('http://'.$_SERVER['HTTP_HOST'].self::$extension_config_path), true )['extensions']; $extensions_conf = json_decode( file_get_contents('http://'.$_SERVER['HTTP_HOST'].self::$extension_config_path), true )['extensions'];
self::$supported_extensions = array(); self::$supported_extensions = $extensions_conf;
self::$supported_extensions_header = array();
foreach($extensions_conf as $ext=>$head){
array_push(self::$supported_extensions, $ext);
array_push(self::$supported_extensions_header, $head);
}
// Dossiers supportes // Dossiers supportes
$parents_conf = json_decode( file_get_contents('http://'.$_SERVER['HTTP_HOST'].self::$parents_config_path), true )['parents']; $parents_conf = json_decode( file_get_contents('http://'.$_SERVER['HTTP_HOST'].self::$parents_config_path), true )['parents'];
self::$supported_parents = array(); self::$supported_parents = $parents_conf;
self::$supported_parents_folder = array();
foreach($parents_conf as $alias=>$folder){
array_push(self::$supported_parents, $alias);
array_push(self::$supported_parents_folder, $folder);
}
/* [1] On recupere les donnees de l'URL /* [1] On recupere les donnees de l'URL
@ -96,13 +83,13 @@
$correct = $correct && count($serialFlags) >= 3; $correct = $correct && count($serialFlags) >= 3;
// Verification que l'extension est correcte // Verification que l'extension est correcte
$correct = $correct && array_search($serialFlags[0], self::$supported_extensions) !== false; $correct = $correct && array_key_exists($serialFlags[0], self::$supported_extensions);
// Verification du filename // Verification du filename
$correct = $correct && preg_match('#^[\w_-]+$#i', $serialFlags[1]); $correct = $correct && preg_match('#^[\w_-]+$#i', $serialFlags[1]);
// Verification du parent // Verification du parent
$correct = $correct && array_search($serialFlags[2], self::$supported_parents) !== false; $correct = $correct && array_key_exists($serialFlags[2], self::$supported_parents);
// Verification du sous-parent (optionnel) // Verification du sous-parent (optionnel)
$opt_subParent = count($serialFlags) >= 4; $opt_subParent = count($serialFlags) >= 4;
@ -147,16 +134,11 @@
private function buildPath(){ private function buildPath(){
/* [1] On recupere le HEADER associe a l'extension /* [1] On recupere le HEADER associe a l'extension
==========================================================*/ ==========================================================*/
$index_header = array_search($this->flags['extension'], self::$supported_extensions); // Si aucun header pour cet cle, on retourne une erreur
if( !isset(self::$supported_extensions[$this->flags['extension']]) ) return false;
// Si l'extension n'est pas repertoriee, on retourne une erreur
if( $index_header === false ) return false;
// Si aucun header pour cet indice, on retourne une erreur
if( !isset(self::$supported_extensions_header[$index_header]) ) return false;
// On recupere le header associe // On recupere le header associe
$header = self::$supported_extensions_header[$index_header]; $header = self::$supported_extensions[$this->flags['extension']];
@ -164,16 +146,11 @@
/* [2] On recupere le chemin associe au parent /* [2] On recupere le chemin associe au parent
==========================================================*/ ==========================================================*/
$index_parent = array_search($this->flags['parent'], self::$supported_parents);
// Si le parent n'est pas repertorie, on retourne une erreur
if( $index_parent === false ) return false;
// Si aucun dossier pour cet indice, on retourne une erreur // Si aucun dossier pour cet indice, on retourne une erreur
if( !isset(self::$supported_parents_folder[$index_parent]) ) return false; if( !isset(self::$supported_parents[$this->flags['parent']]) ) return false;
// On recupere le dossier associe // On recupere le dossier associe
$parent = self::$supported_parents_folder[$index_parent]; $parent = self::$supported_parents[$this->flags['parent']];
/* [3] Gestion du sous-parent optionnel /* [3] Gestion du sous-parent optionnel

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
enable-background="new 0 0 64 64"
height="32"
id="Layer_1"
version="1.1"
viewBox="0 0 32 32"
width="32"
xml:space="preserve"
inkscape:version="0.48.4 r9939"
sodipodi:docname="analytics.svg"><metadata
id="metadata13"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs11" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1056"
id="namedview9"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:snap-page="true"
inkscape:zoom="7.432393"
inkscape:cx="35.205979"
inkscape:cy="12.754823"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" /><g
id="g3"
transform="matrix(0.63920738,0,0,0.63920738,-4.4546362,-4.4546361)"><path
d="M 29.568,11.75 C 17.086,11.749 6.968,21.867 6.969,34.349 6.968,46.831 17.086,56.949 29.568,56.948 42.05,56.949 52.168,46.831 52.167,34.349 L 29.568,34.348 V 11.75 z"
id="path5"
inkscape:connector-curvature="0" /><path
d="m 34.432,7.052 v 22.6 H 57.031 C 57.032,17.169 46.915,7.05 34.432,7.052 z"
id="path7"
inkscape:connector-curvature="0" /></g></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
enable-background="new 0 0 32 32"
height="32.65485"
id="Layer_1"
version="1.1"
viewBox="0 0 32 32.65485"
width="32"
xml:space="preserve"
inkscape:version="0.48.4 r9939"
sodipodi:docname="sync.svg"><metadata
id="metadata3001"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
id="defs2999" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1056"
id="namedview2997"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="7.375"
inkscape:cx="11.819212"
inkscape:cy="12.061024"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" /><g
id="g2991"
transform="matrix(1.0784002,0,0,1.0784002,-1.2543254,-0.92699409)"><path
d="m 25.444,4.291 c 0,0 -1.325,1.293 -2.243,2.201 C 18.514,3.068 11.909,3.456 7.676,7.689 c -2.47,2.47 -3.623,5.747 -3.484,8.983 h 4 C 8.051,14.46 8.81,12.205 10.5,10.514 c 2.663,-2.663 6.735,-3.043 9.812,-1.162 -1.042,1.032 -2.245,2.238 -2.245,2.238 -0.841,1.009 0.104,1.592 0.584,1.577 l 5.624,-10e-4 c 0.297,0 0.539,10e-4 0.539,10e-4 0,0 0.245,0 0.543,0 h 1.092 c 0.298,0 0.54,-0.243 0.54,-0.541 V 4.895 C 27.023,4.188 26.247,3.502 25.444,4.291 z"
id="path2993"
inkscape:connector-curvature="0"
style="fill:#515151" /><path
d="m 6.555,27.709 c 0,0 1.326,-1.293 2.243,-2.201 4.688,3.424 11.292,3.036 15.526,-1.197 2.47,-2.471 3.622,-5.747 3.484,-8.983 h -4.001 c 0.142,2.211 -0.617,4.467 -2.308,6.159 -2.663,2.662 -6.735,3.043 -9.812,1.161 1.042,-1.032 2.245,-2.238 2.245,-2.238 0.841,-1.01 -0.104,-1.592 -0.584,-1.577 l -5.624,0.002 c -0.297,0 -0.54,-0.002 -0.54,-0.002 0,0 -0.245,0 -0.543,0 h -1.09 c -0.298,0 -0.54,0.242 -0.541,0.541 v 7.732 c -0.033,0.706 0.743,1.392 1.545,0.603 z"
id="path2995"
inkscape:connector-curvature="0"
style="fill:#515151" /></g></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -13,8 +13,6 @@
############ ############
# EN COURS # # EN COURS #
############ ############
- [ ] Configuration JSON du dispatcher
- [ ] Simplification de 2 tableaux lies par indice en 1
- [.] Gestion JS de la navigation - [.] Gestion JS de la navigation
- [x] Gestion de liens+URL du menu - [x] Gestion de liens+URL du menu
@ -24,6 +22,8 @@
######## ########
# FAIT # # FAIT #
######## ########
- [x] Configuration JSON du dispatcher
- [x] Simplification de 2 tableaux lies par indice en 1
- [x] Configuration JSON du dispatcher - [x] Configuration JSON du dispatcher
- [x] Gestion des extensions/headers - [x] Gestion des extensions/headers
- [x] Gestion de l'arbre virtuel des fichiers - [x] Gestion de l'arbre virtuel des fichiers

View File

@ -1,29 +1,19 @@
<!-- [1] Gestion du sous-menu de gauche --> <!-- [1] Gestion du sous-menu de gauche -->
<nav class='sub-menu-side'> <nav class='sub-menu-side'>
<span data-sublink='displayall'> <span data-sublink='analytics'>
<span class='svg'><?php echo file_get_contents( 'http://'.$_SERVER['HTTP_HOST'].'/f/svg/analytics/st/sub-menu-side' ); ?></span>
<span>Statistiques</span>
</span>
<span data-sublink='view' >
<span class='svg'><?php echo file_get_contents( 'http://'.$_SERVER['HTTP_HOST'].'/f/svg/view/st/sub-menu-side' ); ?></span> <span class='svg'><?php echo file_get_contents( 'http://'.$_SERVER['HTTP_HOST'].'/f/svg/view/st/sub-menu-side' ); ?></span>
<span>Tout afficher</span> <span>Consulter le suivi</span>
</span> </span>
<span data-sublink='create' > <span data-sublink='start' >
<span class='svg'><?php echo file_get_contents( 'http://'.$_SERVER['HTTP_HOST'].'/f/svg/create/st/sub-menu-side' ); ?></span> <span class='svg'><?php echo file_get_contents( 'http://'.$_SERVER['HTTP_HOST'].'/f/svg/sync/st/sub-menu-side' ); ?></span>
<span>Creation</span> <span>Demarrer un suivi</span>
</span>
<span data-sublink='remove' >
<span class='svg'><?php echo file_get_contents( 'http://'.$_SERVER['HTTP_HOST'].'/f/svg/remove/st/sub-menu-side' ); ?></span>
<span>Suppression</span>
</span>
<span data-sublink='edit' >
<span class='svg'><?php echo file_get_contents( 'http://'.$_SERVER['HTTP_HOST'].'/f/svg/edit/st/sub-menu-side' ); ?></span>
<span>Modification</span>
</span>
<span data-sublink='filter' >
<span class='svg'><?php echo file_get_contents( 'http://'.$_SERVER['HTTP_HOST'].'/f/svg/filter/st/sub-menu-side' ); ?></span>
<span>Filtrer</span>
</span> </span>
<span data-sublink='search' > <span data-sublink='search' >