mise a jour pour mtweb.0.6.0 mw_pages.0.5
authordj3c1t <dj3c1t@free.fr>
Sun, 16 Dec 2012 20:30:48 +0000 (21:30 +0100)
committerdj3c1t <dj3c1t@free.fr>
Sun, 16 Dec 2012 20:30:48 +0000 (21:30 +0100)
16 files changed:
app/mods/pages/admin.php
app/mods/pages/view.php
mw_pages.php
out/default/css/actions/pages_admin.css [new file with mode: 0644]
out/default/css/actions/pages_view.css [moved from out/dist/css/actions/pages_view.css with 100% similarity]
out/default/functions.php [moved from out/dist/functions.php with 100% similarity]
out/default/js/actions/pages_admin.js [moved from out/dist/js/actions/pages_admin.js with 100% similarity]
out/default/layouts/pages.xml [moved from out/dist/layouts/pages.xml with 100% similarity]
out/default/page.php [moved from out/dist/page.php with 91% similarity]
out/default/views/pages/admin/add.php [moved from out/dist/views/pages/admin/add.php with 66% similarity]
out/default/views/pages/admin/edit.php [moved from out/dist/views/pages/admin/edit.php with 64% similarity]
out/default/views/pages/admin/list.php [moved from out/dist/views/pages/admin/list.php with 55% similarity]
out/default/views/pages/colonne.php [moved from out/dist/views/pages/colonne.php with 100% similarity]
out/default/views/pages/view/index.php [moved from out/dist/views/pages/view/index.php with 100% similarity]
out/default/views/pages/view/page.php [moved from out/dist/views/pages/view/page.php with 56% similarity]
out/dist/css/actions/pages_admin.css [deleted file]

index 3498dca..551d9c8 100644 (file)
@@ -43,8 +43,8 @@
           $_page["title"] = isset($_POST["title"]) ? $_POST["title"] : ($page["title"] ? $page["title"] : null);
           $_page["content"] = isset($_POST["content"]) ? $_POST["content"] : ($page["content"] ? $page["content"] : null);
           $_page["user"] = $user["id"];
-          $_page["enabled"] = isset($_POST["enabled"]) ? $_POST["enabled"] : ($page["enabled"] ? $page["enabled"] : 1);
-          $_page["position"] = isset($_POST["position"]) ? $_POST["position"] : ($page["position"] ? $page["position"] : 0);
+          $_page["enabled"] = isset($_POST["enabled"]) ? $_POST["enabled"] : (isset($page["enabled"]) ? $page["enabled"] : 1);
+          $_page["position"] = isset($_POST["position"]) ? $_POST["position"] : (isset($page["position"]) ? $page["position"] : 0);
         }
       }
       else $env->message("impossible de lire les informations de l'utilisateur");
 
     function add(&$env){
       $data = $env->data();
+      $_SESSION["upload_dir"] = $env->path("web").($env->path("web") ? "" : "/").$env->path("content")."uploads";
       if(($arbo = $data->pages_arbo()) !== false){
         $env->set_out("arbo", $arbo);
-        $page = array();
+        $page = array(
+          "title" => "",
+          "content" => ""
+        );
         if($_POST){
           $page = $this->validate_POST_page($env);
           if(!$env->messages()){
@@ -75,6 +79,7 @@
 
     function edit(&$env){
       $data = $env->data();
+      $_SESSION["upload_dir"] = $env->path("web").($env->path("web") ? "" : "/").$env->path("content")."uploads";
       if($page = $data->page($_GET[$env->param("id")])){
         if(($arbo = $data->pages_arbo()) !== false){
           $env->set_out("arbo", $arbo);
index cb94a99..e5604da 100644 (file)
@@ -7,7 +7,7 @@
 
     function page(&$env){
       $data = $env->data();
-      if(($arbo = $data->pages_arbo(array("enabled" => 1))) !== false){
+      if(($arbo = $data->pages_arbo(array("enabled" => 1, "order_by" => "position", "order" => "ASC"))) !== false){
         $env->set_out("arbo", $arbo);
         if(($page = $data->page($_GET[$env->param("id")])) && $page["enabled"]){
           $env->set_out("page", $page);
index bb6d9b6..0e99cd4 100644 (file)
@@ -2,11 +2,11 @@
 
   class mw_pages extends mw_plugin{
 
-    function title($env){
+    function title(){
       return "Pages";
     }
 
-    function description($env){
+    function description(){
       return "Pour ajouter des pages, avec un &eacute;diteur dans l'administration du site";
     }
 
diff --git a/out/default/css/actions/pages_admin.css b/out/default/css/actions/pages_admin.css
new file mode 100644 (file)
index 0000000..064036c
--- /dev/null
@@ -0,0 +1 @@
+@import url("../../../../../../out/default/css/actions/admin.css");
similarity index 91%
rename from out/dist/page.php
rename to out/default/page.php
index cfb4e37..2a3201d 100644 (file)
@@ -28,7 +28,7 @@
         </div>
 <?php endif; ?>
 
-        <div id="center"<?= $this->out_config("colonne") ? "" : " class=\"no_colonne\"" ?>>
+        <div id="center"<?php echo $this->out_config("colonne") ? "" : " class=\"no_colonne\""; ?>>
 <?php require $this->out_file("views/messages.php"); ?>
 <?php
 
similarity index 66%
rename from out/dist/views/pages/admin/add.php
rename to out/default/views/pages/admin/add.php
index c17f1af..53e160c 100644 (file)
@@ -3,15 +3,15 @@
 <h2>Nouvelle page</h2>
 
 <ul class="admin">
-  <li><a href="<?= $this->url("pages/admin") ?>">Retour &agrave; la liste des pages</a></li>
+  <li><a href="<?php echo $this->url("pages/admin"); ?>">Retour &agrave; la liste des pages</a></li>
 </ul>
 
-<form name="page_form" action="<?= $this->url("pages/admin/add") ?>" method="post">
+<form name="page_form" action="<?php echo $this->url("pages/admin/add"); ?>" method="post">
   <ul class="form">
     <li>
       <p>
         Titre :
-        <input type="text" size="50" name="title" id="title" value="<?= $this->out["page"]["title"] ?>" />
+        <input type="text" size="50" name="title" id="title" value="<?php echo $this->out["page"]["title"]; ?>" />
       </p>
     </li>
     <li>
@@ -23,7 +23,7 @@
       </p>
     </li>
     <li>
-      <textarea class="tinymce" cols="60" rows="10" name="content" id="content"><?= htmlspecialchars($this->out["page"]["content"]) ?></textarea>
+      <textarea class="tinymce" cols="60" rows="10" name="content" id="content"><?php echo htmlspecialchars($this->out["page"]["content"]); ?></textarea>
     </li>
     <li class="buttons">
       <input type="submit" value="Ajouter" />
similarity index 64%
rename from out/dist/views/pages/admin/edit.php
rename to out/default/views/pages/admin/edit.php
index 3b3abc7..a5f5e2f 100644 (file)
@@ -3,15 +3,15 @@
 <h2>Modifier une page</h2>
 
 <ul class="admin">
-  <li><a href="<?= $this->url("pages/admin") ?>">Retour &agrave; la liste des pages</a></li>
+  <li><a href="<?php echo $this->url("pages/admin"); ?>">Retour &agrave; la liste des pages</a></li>
 </ul>
 
-<form name="page_form" action="<?= $this->url("pages/admin/edit", array("id" => $this->out["page"]["id"])) ?>" method="post">
+<form name="page_form" action="<?php echo $this->url("pages/admin/edit", array("id" => $this->out["page"]["id"])); ?>" method="post">
   <ul class="form">
     <li>
       <p>
         Titre :
-        <input type="text" size="50" name="title" id="title" value="<?= $this->out["page"]["title"] ?>" />
+        <input type="text" size="50" name="title" id="title" value="<?php echo $this->out["page"]["title"]; ?>" />
       </p>
     </li>
     <li>
@@ -23,7 +23,7 @@
       </p>
     </li>
     <li>
-      <textarea class="tinymce" cols="60" rows="10" name="content" id="content"><?= htmlspecialchars($this->out["page"]["content"]) ?></textarea>
+      <textarea class="tinymce" cols="60" rows="10" name="content" id="content"><?php echo htmlspecialchars($this->out["page"]["content"]); ?></textarea>
     </li>
     <li class="buttons">
       <input type="submit" value="Enregistrer" />
similarity index 55%
rename from out/dist/views/pages/admin/list.php
rename to out/default/views/pages/admin/list.php
index a48ef7f..89c5bfb 100644 (file)
@@ -1,15 +1,15 @@
 <h2>Pages</h2>
 
 <ul class="admin">
-  <li><a class="add" href="<?= $this->url("pages/admin/add") ?>">Nouvelle page</a></li>
+  <li><a class="add" href="<?php echo $this->url("pages/admin/add"); ?>">Nouvelle page</a></li>
 </ul>
 
-<form name="accueil_form" action="<?= $this->url("pages/admin/set_accueil") ?>" method="post">
+<form name="accueil_form" action="<?php echo $this->url("pages/admin/set_accueil"); ?>" method="post">
 <ul class="admin">
   <li>Page d'accueil du site</li>
   <li>
     <select name="id">
-      <option value=""<?= $this->config("start_action") ? "" : " selected=\"selected\"" ?>>Page par d&eacute;faut du site</option>
+      <option value=""<?php echo $this->config("start_action") ? "" : " selected=\"selected\""; ?>>Page par d&eacute;faut du site</option>
       <?php echo pages_arbo_start_select_options($this, $this->out["arbo"], $this->config("start_action"), $this->config("start_action_params"), "&nbsp;&nbsp;"); ?>
     </select>
   </li>
@@ -23,7 +23,7 @@
   <li>Page parente</li>
   <li>
     <select onchange="document.location=this.options[this.selectedIndex].value;">
-      <option value="<?= $this->url("pages/admin") ?>"<?= isset($_GET[$this->param("parent")]) ? "" : " selected=\"selected\"" ?>>Afficher toutes les pages</option>
+      <option value="<?php echo $this->url("pages/admin"); ?>"<?php echo isset($_GET[$this->param("parent")]) ? "" : " selected=\"selected\""; ?>>Afficher toutes les pages</option>
       <?php echo pages_arbo_list_select_options($this, "pages/admin", $this->out["arbo"], $_GET[$this->param("parent")], "&nbsp;&nbsp;"); ?>
     </select>
   </li>
 
 <?php if($this->out["pages"]["total"]) : ?>
 
-<?php if($this->out["pages"]["total"] > $this->config("max_list")) : ?>
-
 <?php $items = "pages"; $legend = "pages"; require $this->out_file("views/navig.php"); ?>
 
-<?php endif; ?>
-
-<form name="pages_form" action="<?= $this->url("pages/admin/edit_pages") ?>" method="post">
+<form name="pages_form" action="<?php echo $this->url("pages/admin/edit_pages"); ?>" method="post">
 <table class="admin">
   <tr>
     <th>titre</th>
   </tr>
 <?php foreach($this->out["pages"]["list"] as $id_page => $page) : ?>
   <tr class="hl">
-    <td><?= $page["title"] ?></td>
-    <td><?= date("j M Y : G\hi", datetime2timestamp($page["date_creation"])) ?></td>
-    <td class="action"><input type="text" size="3" name="position_<?= $id_page ?>" value="<?= $page["position"] ?>" /></td>
-    <td class="action"><input type="checkbox" name="enabled_<?= $id_page ?>" <?= $page["enabled"] ? "checked=\"checked\"" : "" ?> /></td>
+    <td><?php echo $page["title"]; ?></td>
+    <td><?php echo date("j M Y : G\hi", datetime2timestamp($page["date_creation"])); ?></td>
+    <td class="action"><input type="text" size="3" name="position_<?php echo $id_page; ?>" value="<?php echo $page["position"]; ?>" /></td>
+    <td class="action"><input type="checkbox" name="enabled_<?php echo $id_page; ?>" <?php echo $page["enabled"] ? "checked=\"checked\"" : ""; ?> /></td>
     <td class="action">
-    <a href="<?= $this->url("pages/admin/edit", array("id" => $id_page)) ?>"
+    <a href="<?php echo $this->url("pages/admin/edit", array("id" => $id_page)); ?>"
        class="admin_link"
-       title="modifier cette page"><img src="<?= $this->out_file("icons/edit.gif") ?>" /></a>
+       title="modifier cette page"><img src="<?php echo $this->out_url("icons/edit.gif"); ?>" /></a>
     </td>
     <td class="action">
-    <a href="<?= $this->url("pages/admin/del", array("id" => $id_page)) ?>"
+    <a href="<?php echo $this->url("pages/admin/del", array("id" => $id_page)); ?>"
        class="admin_link"
-       title="supprimer cette page"><img src="<?= $this->out_file("icons/del.gif") ?>"
+       title="supprimer cette page"><img src="<?php echo $this->out_url("icons/del.gif"); ?>"
        onclick="return confirm('Supprimer cette page ?')"/></a>
     </td>
   </tr>
similarity index 56%
rename from out/dist/views/pages/view/page.php
rename to out/default/views/pages/view/page.php
index f6413ef..3fd77b3 100644 (file)
@@ -3,22 +3,22 @@
   <?php if($k > 0) : ?>
   &raquo;
   <?php endif; ?>
-  <a href="<?= $this->url("pages/view/page", array("id" => $page["id"])) ?>"><?= $page["title"] ?></a>
+  <a href="<?php echo $this->url("pages/view/page", array("id" => $page["id"])); ?>"><?php echo $page["title"]; ?></a>
 <?php $k++; endif; endforeach; ?>
   <?php if($k > 0) : ?>
   &raquo;
   <?php endif; ?>
-  <?= $this->out["page"]["title"] ?>
+  <?php echo $this->out["page"]["title"]; ?>
 </h2>
 
 <?php if($this->out["pages"]["list"]) : ?>
 <ul class="pages_menu">
 <?php foreach($this->out["pages"]["list"] as $page) : ?>
-  <li><a href="<?= $this->url("pages/view/page", array("id" => $page["id"])) ?>"><?= $page["title"] ?></a></li>
+  <li><a href="<?php echo $this->url("pages/view/page", array("id" => $page["id"])); ?>"><?php echo $page["title"]; ?></a></li>
 <?php endforeach; ?>
 </ul>
 <?php endif; ?>
 
 <div>
-  <?= $this->out["page"]["content"]  ?>
+  <?php echo $this->out["page"]["content"]; ?>
 </div>
diff --git a/out/dist/css/actions/pages_admin.css b/out/dist/css/actions/pages_admin.css
deleted file mode 100644 (file)
index cb9a939..0000000
+++ /dev/null
@@ -1 +0,0 @@
-@import url("../../../../../../out/dist/css/actions/admin.css");