--- a/Controller/WikiTagController.php Thu Nov 17 11:29:26 2011 +0100
+++ b/Controller/WikiTagController.php Thu Nov 17 11:37:05 2011 +0100
@@ -59,7 +59,20 @@
}
// ... so we create is json like {"":""},{"Créateur":"Créateur"},{"Datation":"Datation"},...
$categories = json_encode($ar);
- return $this->render('WikiTagBundle:WikiTag:javascript.html.twig', array('categories' => $categories,'tags_list' => $tags_list));
+ return $this->render('WikiTagBundle:WikiTag:javascript.html.twig', array('categories' => $categories, 'tags_list' => $tags_list));
+ }
+
+ /**
+ * Renders the little html to add the javascript for context search
+ */
+ public function addJavascriptForContextSearchAction($context_name)
+ {
+ // WARNING : PREREQUISITE : the request to add a tag needs the external document id,
+ // which is gotten by the jQuery call $('#wikitag_document_id').val() in the page.
+ // So the page holding this context search MUST have a input value with this id.
+ // We add the reactive selectors
+ $reactive_selectors = $this->container->getParameter("wiki_tag.reactive_selectors");
+ return $this->render('WikiTagBundle:WikiTag:javascriptForContextSearch.html.twig', array('reactive_selectors' => $reactive_selectors));
}
/**
@@ -151,7 +164,7 @@
$i = 0;
while($i<$nb_tags && $found==false){
$dt = $tags[$i];
- if(strtolower($dt->getTag()->getLabel())==strtolower($tag_label)){
+ if($dt->getTag()->getLabel()==$tag_label){
$found = true;
}
$i++;
@@ -161,7 +174,7 @@
return new Response(json_encode(array('error' => 'duplicate_tag', 'message' => sprintf("Le tag %s existe déjà pour cette fiche.", $tag_label))),400);
}
// We create the new tag or get the already existing tag. $tag, $revision_id, $created
- $ar = WikiTagUtils::getOrCreateTag($tag_label, $this->getDoctrine());// tag, revision_id, created = get_or_create_tag(tag_label)
+ $ar = WikiTagUtils::getOrCreateTag($tag_label, $this->getDoctrine());
$tag = $ar[0];
$revision_id = $ar[1];
$created = $ar[2];
@@ -188,9 +201,9 @@
$doc->setManualOrder(true);
// We save the datas
$em->flush();
- // We render the document's tags
- return $this->renderDocTags($id_doc);
}
+ // We render the document's tags
+ return $this->renderDocTags($id_doc);
}