- [x] Configuration JSON du dispatcher

- [x] Gestion des extensions/headers
	- [x] Gestion de l'arbre virtuel des fichiers
This commit is contained in:
xdrm-brackets 2016-02-03 08:34:27 +01:00
parent ac149dc50c
commit e81a72757c
4 changed files with 50 additions and 6 deletions

View File

@ -0,0 +1,7 @@
{
"extensions": {
"svg": "image/svg+xml",
"css": "text/css",
"js": "text/js"
}
}

View File

@ -0,0 +1,8 @@
{
"parents": {
"st" : "/src/static",
"dy" : "/src/dynamic",
"css" : "/css",
"js" : "/js"
}
}

View File

@ -6,10 +6,13 @@
class Dispatcher{ class Dispatcher{
// Constantes (a dispatcher dans un .conf) // Constantes (a dispatcher dans un .conf)
public static $supported_extensions = array('svg'); public static $extension_config_path = '/config/dispatcher-extensions.json';
public static $supported_extensions_header = array('image/svg+xml'); public static $parents_config_path = '/config/dispatcher-tree.json';
public static $supported_parents = array('st', 'dy');
public static $supported_parents_folder = array('/src/static', '/src/dynamic'); public static $supported_extensions;
public static $supported_extensions_header;
public static $supported_parents;
public static $supported_parents_folder;
// Attributs prives utiles (initialisation) // Attributs prives utiles (initialisation)
private $header; private $header;
@ -27,6 +30,29 @@
* *
*/ */
public function __construct($url){ public function __construct($url){
/* [0] On met a jour la configuration
=====================================================*/
// Extensions supportees
$extensions_conf = json_decode( file_get_contents('http://'.$_SERVER['HTTP_HOST'].self::$extension_config_path), true )['extensions'];
self::$supported_extensions = array();
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
$parents_conf = json_decode( file_get_contents('http://'.$_SERVER['HTTP_HOST'].self::$parents_config_path), true )['parents'];
self::$supported_parents = array();
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
==================================================*/ ==================================================*/
$serialFlags = array_slice( explode('/',$url), 1 ); $serialFlags = array_slice( explode('/',$url), 1 );
@ -47,7 +73,6 @@
$this->view(); $this->view();
return true; return true;
} }

View File

@ -13,7 +13,8 @@
############ ############
# 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
@ -23,6 +24,9 @@
######## ########
# FAIT # # FAIT #
######## ########
- [x] Configuration JSON du dispatcher
- [x] Gestion des extensions/headers
- [x] Gestion de l'arbre virtuel des fichiers
- [x] Design de structure (layout navigation) - [x] Design de structure (layout navigation)
- [x] Header - [x] Header
- [x] Menu-side - [x] Menu-side