--- a/Controller/WikiTagController.php Thu Nov 24 13:05:33 2011 +0100
+++ b/Controller/WikiTagController.php Mon Nov 28 10:34:24 2011 +0100
@@ -88,10 +88,17 @@
* Display a list of ordered tag for a document
* @param integer $id_doc
*/
- public function documentTagsAction($id_doc)
+ public function documentTagsAction($id_doc, $profile_name="")
{
+ // Management of profiles for the list of displayed columns and reorder tag button
+ $profile_array = $this->container->getParameter("wiki_tag.document_list_profile");
+ $columns_array = null;
+ if($profile_array!=null && $profile_name!=null && $profile_name!=""){
+ $columns_array = $profile_array[$profile_name];
+ }
+
$ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOrderedTagsForDoc($id_doc);
- return $this->render('WikiTagBundle:WikiTag:documentTags.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc));
+ return $this->render('WikiTagBundle:WikiTag:documentTags.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'profile_name' => $profile_name, 'columns' => $columns_array));
}
/**
@@ -397,7 +404,7 @@
public function renderDocTags($id_doc)
{
$ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOrderedTagsForDoc($id_doc);
- return $this->render('WikiTagBundle:WikiTag:tagTable.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc));
+ return $this->render('WikiTagBundle:WikiTag:tagTable.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'columns' => null));
}
@@ -530,7 +537,7 @@
$id_moved_tag = $this->getRequest()->request->get('tag_id');
$moved_tag = $this->getDoctrine()->getRepository('WikiTagBundle:Tag')->findOneBy(array('id' => $id_moved_tag));
// We update the tag label and its wikipedia info with the original label.
- $this->updateTagWithNewLabel($moved_tag, $moved_tag->getOriginalLabel());
+ return $this->updateTagWithNewLabel($moved_tag, $moved_tag->getOriginalLabel());
// We render the tag list.
$num_page = $this->getRequest()->request->get('num_page');
@@ -551,7 +558,8 @@
// We get the Wikipedia informations for the sent label
$tag_label_normalized = WikiTagUtils::normalizeTag($label);
$wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized);
- $new_label = $wp_response['new_label'];
+ //return new Response(var_dump($wp_response));
+ $new_label = $tag_label_normalized;
$status = $wp_response['status'];
$url = $wp_response['wikipedia_url'];
$pageid = $wp_response['pageid'];
@@ -561,9 +569,15 @@
if($new_label!=null){
$tag->setLabel($new_label);
}
- if($status!=null){
+ else{
+ $tag->setLabel($tag_label_normalized);
+ }
+ if(!is_null($status)){
$tag->setUrlStatus($status);
}
+ else{
+ $tag->setUrlStatus(Tag::$TAG_URL_STATUS_DICT['null_result']);
+ }
$tag->setWikipediaUrl($url);
$tag->setWikipediaPageId($pageid);
$tag->setDbpediaUri($dbpedia_uri);
@@ -628,7 +642,7 @@
// We add the search string if necessary
if($searched!=""){
// We replace "*" by "%", and doctrine wants ' to be ''.
- $qb->where($qb->expr()->orx($qb->expr()->like('t.normalizedLabel', "'".str_replace("'", "''", str_replace("*", "%", $searched))."'")));
+ $qb->where($qb->expr()->orx($qb->expr()->like('t.normalizedLabel', "'".str_replace("'", "''", str_replace("*", "%", str_replace("+", " ", $searched)))."'")));
}
//return $qb->getDql();