bouton pour publier une derivation
authordj3c1t <dj3c1t@free.fr>
Sun, 13 Oct 2013 01:38:52 +0000 (03:38 +0200)
committerdj3c1t <dj3c1t@free.fr>
Sun, 13 Oct 2013 01:38:52 +0000 (03:38 +0200)
app/controllers/users/morceaux.php
app/controllers/users/pistes.php
app/data/modules/share/sml_data_sources_xml_format.php
app/out/default/css/actions/sources.css
app/out/default/views/sources/morceau/view.php
app/out/default/views/sources/piste/view.php

index eb1eeff..fce394f 100644 (file)
       $upload_dir = $env->path("content")."uploads/".$this->user["id"];
       $_SESSION["upload_dir"] = $web_path.($web_path ? "" : "/").$env->path("content")."uploads/".$this->user["id"];
       $users_sources_mod = $env->get_controller("users/sources");
-      if($_POST){
+      if(isset($_POST["button_derive"])){
+        if(
+              ($origin_source_id = $_POST["button_derive"])
+          &&  ($origin_source_xml_url = $data->source_xml_url($origin_source_id))
+          &&  ($origin_source_xml_content = $data->get_source_xml($origin_source_id))
+        ){
+          $morceau["derivations"][$origin_source_id] = $users_sources_mod->get_source_from_xml(
+            $env,
+            $origin_source_xml_url,
+            $origin_source_xml_content,
+            true
+          );
+        }
+      }
+      elseif($_POST){
         if(!($groupe = $data->groupe($_POST["id_groupe"]))){
           $env->erreur("Impossible de lire les informations du groupe");
           return;
index 0b2d177..c1a70df 100644 (file)
       $upload_dir = $env->path("content")."uploads/".$this->user["id"];
       $_SESSION["upload_dir"] = $web_path.($web_path ? "" : "/").$env->path("content")."uploads/".$this->user["id"];
       $users_sources_mod = $env->get_controller("users/sources");
-      if($_POST){
+      if(isset($_POST["button_derive"])){
+        if(
+              ($origin_source_id = $_POST["button_derive"])
+          &&  ($origin_source_xml_url = $data->source_xml_url($origin_source_id))
+          &&  ($origin_source_xml_content = $data->get_source_xml($origin_source_id))
+        ){
+          $piste["derivations"][$origin_source_id] = $users_sources_mod->get_source_from_xml(
+            $env,
+            $origin_source_xml_url,
+            $origin_source_xml_content,
+            true
+          );
+        }
+      }
+      elseif($_POST){
         if(!($groupe = $data->groupe($_POST["id_groupe"]))){
           $env->erreur("Impossible de lire les informations du groupe");
           return;
index b087aae..1916bea 100644 (file)
               );
             }
             else
-            { $source[$key] = $value[0]["data"];
+            { if(isset($value[0]["data"])) $source[$key] = $value[0]["data"];
             }
           }
           $source["auteur"] = "";
index a9f661d..756ef6b 100644 (file)
@@ -495,3 +495,23 @@ ul#lien_contact li a
 .loading span{
   display: none;
 }
+
+/* ----------------------------------- bouton de derivation --------- */
+
+form.button_derive{
+  text-align: right;
+}
+
+form.button_derive div{
+  display: inline;
+}
+form.button_derive div input[type=submit]{
+  background-color: transparent;
+  color: #333333;
+  border: solid 1px #c0c0c0;
+  padding: 1em;
+  border-radius: 5px;
+}
+form.button_derive div input[type=submit]:hover{
+  color: #c0c0c0;
+}
index cafa1cd..16c8991 100644 (file)
 ?>
 </ul>
 
+<?php if($this->action_allowed("users/morceaux/add")) : ?>
+<form class="button_derive" action="<?php echo $this->url("users/morceaux/add"); ?>" method="post">
+  <input type="hidden" name="button_derive" value="<?php echo $morceau["id"];?>" />
+  <div>
+    <input type="submit" value="Publier une dérivation" />
+  </div>
+</form>
+<?php endif; ?>
+
 <?php if(isset($morceau["description"]) && !$display_name) : ?>
 <div class="description">
   <?php echo $morceau["description"] ?>
index 09526b2..7b474a0 100644 (file)
 ?>
 </ul>
 
+<?php if($this->action_allowed("users/pistes/add")) : ?>
+<form class="button_derive" action="<?php echo $this->url("users/pistes/add"); ?>" method="post">
+  <input type="hidden" name="button_derive" value="<?php echo $piste["id"];?>" />
+  <div>
+    <input type="submit" value="Publier une dérivation" />
+  </div>
+</form>
+<?php endif; ?>
+
 <?php if(isset($piste["description"]) && !$display_name) : ?>
 <div class="description">
   <?php echo $piste["description"] ?>