From 3f6d8dd1d92a8b03de384f131745f8846a92da0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Wed, 4 Aug 2010 08:33:17 +0200 Subject: [PATCH] =?UTF-8?q?CSS=20et=20page=20d'accueil=20(tr=C3=A8s=20inco?= =?UTF-8?q?mpl=C3=A8te).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __cms__/code/chemin/chemin.php | 6 ++-- __cms__/code/cms/page.php | 12 +++++++ .../code/modules/galerie/galerie-photo.php | 3 +- __cms__/code/modules/include.php | 1 + __cms__/code/modules/site/include.php | 5 +++ __cms__/code/modules/site/site-index.php | 33 +++++++++++++++++++ __cms__/code/site/css.php | 6 +++- __cms__/code/site/include.php | 1 + __cms__/code/site/squelette.php | 5 ++- __cms__/donnees/__prop__type | 2 +- 10 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 __cms__/code/modules/site/include.php create mode 100644 __cms__/code/modules/site/site-index.php diff --git a/__cms__/code/chemin/chemin.php b/__cms__/code/chemin/chemin.php index 68ff6f5..b4c6293 100644 --- a/__cms__/code/chemin/chemin.php +++ b/__cms__/code/chemin/chemin.php @@ -46,14 +46,16 @@ class Chemin { // Invariant de sécurité : la chaîne renvoyée ne commence ni ne // termine par '/'. - public function get($slash_debut = false) { + public function get($slash_debut = true) { return ($slash_debut ? '/' : '') . join($this->segments, '/'); } public function get_url($fin = "") { // Config::get("url_base") DOIT se terminer par '/', tel que spécifié // dans config.php. - return Config::get("url_base") . $this->get() . '/' . $fin; + $ch = $this->get(false) . "/"; + if ($ch == '/') $ch = ''; + return Config::get("url_base") . $ch . $fin; } public function get_fs_stockage() { diff --git a/__cms__/code/cms/page.php b/__cms__/code/cms/page.php index f102463..8be6b5b 100644 --- a/__cms__/code/cms/page.php +++ b/__cms__/code/cms/page.php @@ -13,6 +13,8 @@ class Page { $this->set_page($a, $b); } else if ($type == "sendfile") { $this->set_sendfile($a, $b); + } else if ($type == "raw") { + $this->set_raw($a, $b); } else if ($type == "redirect") { $this->set_redirect($a, $b); } @@ -30,6 +32,12 @@ class Page { $this->type = "sendfile"; } + public function set_raw($données, $mime) { + $this->raw_données = $données; + $this->raw_mime = $mime; + $this->type = "raw"; + } + public function set_redirect($destination, $params = "") { if (!is_string($destination)) $destination = $destination->get_url(); $this->redirect_destination = $destination . $params; @@ -42,11 +50,15 @@ class Page { echo Squelette::enrober($this); } else if ($this->type == "sendfile") { Stockage::get_prop_sendfile($this->sendfile_chemin, $this->sendfile_prop); + } else if ($this->type == "raw") { + header("Content-Type: " . $this->raw_mime); + echo $this->raw_données; } else if ($this->type == "redirect") { echo "TODO : Redirection vers redirect_destination . "\">" . $this->redirect_destination . ""; } + // TODO : else erreur } } diff --git a/__cms__/code/modules/galerie/galerie-photo.php b/__cms__/code/modules/galerie/galerie-photo.php index 77389e5..7fd6b3a 100644 --- a/__cms__/code/modules/galerie/galerie-photo.php +++ b/__cms__/code/modules/galerie/galerie-photo.php @@ -46,7 +46,7 @@ class GaleriePhoto { $ret .= affichage_texte_enrichi(Stockage::get_prop($chemin, "message")); } return new Page($ret, Stockage::get_prop($chemin, "titre")); - } else if ($vue == "miniature") { + } else if ($vue == "miniature" || $vue == "mini") { $ret = ''; return new Page($ret, Stockage::get_prop($chemin, "titre")); @@ -55,6 +55,7 @@ class GaleriePhoto { } else if ($vue == "image_mini") { return new Page($chemin, "image_mini", "sendfile"); } + return new Page('',''); // TODO : devrait renvoyer une page d'erreur ! } } diff --git a/__cms__/code/modules/include.php b/__cms__/code/modules/include.php index a6cd774..ead5360 100644 --- a/__cms__/code/modules/include.php +++ b/__cms__/code/modules/include.php @@ -2,6 +2,7 @@ require_once(dirname(__FILE__) . "/modules.php"); +require_once(dirname(__FILE__) . "/site/include.php"); require_once(dirname(__FILE__) . "/admin/include.php"); require_once(dirname(__FILE__) . "/forum/include.php"); require_once(dirname(__FILE__) . "/galerie/include.php"); diff --git a/__cms__/code/modules/site/include.php b/__cms__/code/modules/site/include.php new file mode 100644 index 0000000..96a416b --- /dev/null +++ b/__cms__/code/modules/site/include.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/__cms__/code/modules/site/site-index.php b/__cms__/code/modules/site/site-index.php new file mode 100644 index 0000000..6794c1a --- /dev/null +++ b/__cms__/code/modules/site/site-index.php @@ -0,0 +1,33 @@ +" . Stockage::get_prop($chemin, "nom_site") . ""; + $ret .= ""; + return new Page($ret, Stockage::get_prop($chemin, "nom_site")); + } else if ($vue == "css") { + return new Page(get_css(), "text/css", "raw"); + } + return new Page('',''); // TODO : devrait renvoyer une page d'erreur ! + } +} + +Modules::enregister_module("SiteIndex", "site-index", "vue", "titre"); + +?> \ No newline at end of file diff --git a/__cms__/code/site/css.php b/__cms__/code/site/css.php index 1efaa65..a196dfd 100644 --- a/__cms__/code/site/css.php +++ b/__cms__/code/site/css.php @@ -1,4 +1,7 @@ -.galerie img { + \ No newline at end of file diff --git a/__cms__/code/site/squelette.php b/__cms__/code/site/squelette.php index b0415ee..94ce331 100644 --- a/__cms__/code/site/squelette.php +++ b/__cms__/code/site/squelette.php @@ -9,6 +9,9 @@ class Squelette { } public static function en_tete($page) { + // TODO : chemin css relatif. + $chemin_css = new Chemin('/'); + $chemin_css = $chemin_css->get_url('?vue=css'); return ' @@ -16,7 +19,7 @@ class Squelette { ' . $page->titre . ' - + '; // diff --git a/__cms__/donnees/__prop__type b/__cms__/donnees/__prop__type index 19d44d7..15322bf 100644 --- a/__cms__/donnees/__prop__type +++ b/__cms__/donnees/__prop__type @@ -1 +1 @@ -galerie-index \ No newline at end of file +site-index \ No newline at end of file