# HG changeset patch # User cavaliet # Date 1322472864 -3600 # Node ID 6f643fc1de26d521dbfea7b2d2b929f480029b83 # Parent 1c4e3fdba170fcdfd868a5b880623e9ffe1c5817 commit changes before update. diff -r 1c4e3fdba170 -r 6f643fc1de26 .hgtags diff -r 1c4e3fdba170 -r 6f643fc1de26 Command/CreateFullTextIndexesCommand.php diff -r 1c4e3fdba170 -r 6f643fc1de26 Command/GenerateDocumentClassCommand.php diff -r 1c4e3fdba170 -r 6f643fc1de26 Command/PurgeTagsCommand.php diff -r 1c4e3fdba170 -r 6f643fc1de26 Command/QueryWikipediaCommand.php diff -r 1c4e3fdba170 -r 6f643fc1de26 Command/ReorderTagsCommand.php diff -r 1c4e3fdba170 -r 6f643fc1de26 Controller/WikiTagController.php --- 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(); diff -r 1c4e3fdba170 -r 6f643fc1de26 DependencyInjection/Configuration.php --- a/DependencyInjection/Configuration.php Thu Nov 24 13:05:33 2011 +0100 +++ b/DependencyInjection/Configuration.php Mon Nov 28 10:34:24 2011 +0100 @@ -58,6 +58,13 @@ ->useAttributeAsKey('name') ->prototype('variable') ->end() + ->end() + ->arrayNode('document_list_profile') + ->treatNullLike(array()) + ->useAttributeAsKey('name') + ->prototype('variable') + ->end() + ->end() ->end(); return $treeBuilder; diff -r 1c4e3fdba170 -r 6f643fc1de26 DependencyInjection/WikiTagExtension.php --- a/DependencyInjection/WikiTagExtension.php Thu Nov 24 13:05:33 2011 +0100 +++ b/DependencyInjection/WikiTagExtension.php Mon Nov 28 10:34:24 2011 +0100 @@ -46,5 +46,6 @@ $container->setParameter("wiki_tag.fields_all", $fields); $container->setParameter("wiki_tag.route_for_documents_by_tag", $config['route_for_documents_by_tag']); $container->setParameter("wiki_tag.reactive_selectors", $config['reactive_selectors']); + $container->setParameter("wiki_tag.document_list_profile", $config['document_list_profile']); } } diff -r 1c4e3fdba170 -r 6f643fc1de26 Event/DocumentTagEvent.php diff -r 1c4e3fdba170 -r 6f643fc1de26 Event/WikiTagEvents.php diff -r 1c4e3fdba170 -r 6f643fc1de26 Listener/WikiTagDocumentListener.php diff -r 1c4e3fdba170 -r 6f643fc1de26 Resources/meta/LICENSE diff -r 1c4e3fdba170 -r 6f643fc1de26 Resources/public/js/wikiTag.js --- a/Resources/public/js/wikiTag.js Thu Nov 24 13:05:33 2011 +0100 +++ b/Resources/public/js/wikiTag.js Mon Nov 28 10:34:24 2011 +0100 @@ -31,8 +31,9 @@ tooltip : "Cliquer pour éditer...", onblur : "submit", submitdata: { - csrfmiddlewaretoken:global_csrf_token, + csrfmiddlewaretoken:global_csrf_token, wikitag_document_id:$('#wikitag_document_id').val(), + wikitag_document_profile:$('#wikitag_document_profile').val(), num_page:(('num_page' in getUrlVars()) ? getUrlVars()['num_page'] : undefined), nb_by_page:(('nb_by_page' in getUrlVars()) ? getUrlVars()['nb_by_page'] : undefined), sort:((('sort' in getUrlVars()) && (typeof(getUrlVars()['sort'])=="string")) ? getUrlVars()['sort'] : undefined), @@ -87,8 +88,9 @@ tooltip : "Cliquer pour éditer...", onblur : "submit", submitdata: { - csrfmiddlewaretoken:global_csrf_token, + csrfmiddlewaretoken:global_csrf_token, wikitag_document_id:$('#wikitag_document_id').val(), + wikitag_document_profile:$('#wikitag_document_profile').val(), num_page:(('num_page' in getUrlVars()) ? getUrlVars()['num_page'] : undefined), nb_by_page:(('nb_by_page' in getUrlVars()) ? getUrlVars()['nb_by_page'] : undefined), sort:((('sort' in getUrlVars()) && (typeof(getUrlVars()['sort'])=="string")) ? getUrlVars()['sort'] : undefined), @@ -111,6 +113,7 @@ submitdata: { csrfmiddlewaretoken:global_csrf_token, wikitag_document_id:$('#wikitag_document_id').val(), + wikitag_document_profile:$('#wikitag_document_profile').val(), num_page:(('num_page' in getUrlVars()) ? getUrlVars()['num_page'] : undefined), nb_by_page:(('nb_by_page' in getUrlVars()) ? getUrlVars()['nb_by_page'] : undefined), sort:((('sort' in getUrlVars()) && (typeof(getUrlVars()['sort'])=="string")) ? getUrlVars()['sort'] : undefined), @@ -138,6 +141,7 @@ type: 'POST', data: {csrfmiddlewaretoken:global_csrf_token, wikitag_document_id:$('#wikitag_document_id').val(), + wikitag_document_profile:$('#wikitag_document_profile').val(), new_order:new_order, old_order:old_order }, @@ -334,6 +338,7 @@ type: 'POST', data: {csrfmiddlewaretoken:global_csrf_token, wikitag_document_id:$('#wikitag_document_id').val(), + wikitag_document_profile:$('#wikitag_document_profile').val(), num_page:(('num_page' in getUrlVars()) ? getUrlVars()['num_page'] : undefined), nb_by_page:(('nb_by_page' in getUrlVars()) ? getUrlVars()['nb_by_page'] : undefined), sort:((('sort' in getUrlVars()) && (typeof(getUrlVars()['sort'])=="string")) ? getUrlVars()['sort'] : undefined), @@ -371,6 +376,7 @@ type: 'POST', data: {csrfmiddlewaretoken:global_csrf_token, wikitag_document_id:$('#wikitag_document_id').val(), + wikitag_document_profile:$('#wikitag_document_profile').val(), tag_id:id_tag, move:mv, tag_pos:pos_tag @@ -393,6 +399,7 @@ type: 'POST', data: {csrfmiddlewaretoken:global_csrf_token, wikitag_document_id:$('#wikitag_document_id').val(), + wikitag_document_profile:$('#wikitag_document_profile').val(), value:tag_label }, // bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType @@ -424,7 +431,8 @@ type: 'POST', data: { csrfmiddlewaretoken:global_csrf_token, - wikitag_document_id:$('#wikitag_document_id').val() + wikitag_document_id:$('#wikitag_document_id').val(), + wikitag_document_profile:$('#wikitag_document_profile').val() }, success: function(msg, textStatus, XMLHttpRequest) { $('#wikitag_table_container').html(msg); diff -r 1c4e3fdba170 -r 6f643fc1de26 Resources/views/WikiTag/contextSearchDiv.html.twig diff -r 1c4e3fdba170 -r 6f643fc1de26 Resources/views/WikiTag/documentTags.html.twig --- a/Resources/views/WikiTag/documentTags.html.twig Thu Nov 24 13:05:33 2011 +0100 +++ b/Resources/views/WikiTag/documentTags.html.twig Mon Nov 28 10:34:24 2011 +0100 @@ -6,6 +6,7 @@ Ajouter un tag : OK +
{% include 'WikiTagBundle:WikiTag:tagTable.html.twig' %} diff -r 1c4e3fdba170 -r 6f643fc1de26 Resources/views/WikiTag/tagTable.html.twig --- a/Resources/views/WikiTag/tagTable.html.twig Thu Nov 24 13:05:33 2011 +0100 +++ b/Resources/views/WikiTag/tagTable.html.twig Mon Nov 28 10:34:24 2011 +0100 @@ -1,23 +1,54 @@ {# partial display document's tags (table only) #} + {% if columns is null or "order" in columns %} + {% endif %} + {% if columns is null or "move_up_down" in columns %} + {% endif %} + {% if columns is null or "id" in columns %} + {% endif %} + {% if columns is null or "label" in columns %} + {% endif %} + {% if columns is null or "wikipedia_link" in columns %} + {% endif %} + {% if columns is null or "wikipedia_permalink" in columns %} + {% endif %} + {% if columns is null or "dbpedia_link" in columns %} + {% endif %} + {% if columns is null or "category" in columns %} + {% endif %} + {% if columns is null or "remove_wikipedia_link" in columns %} + {% endif %} + {% if columns is null or "alias" in columns %} + {% endif %} + {% if columns is null or "remove_tag_from_list" in columns %} + {% endif %} {% for t in ordered_tags %} + {% if columns is null or "order" in columns %} + {% endif %} + {% if columns is null or "move_up_down" in columns %} + {% endif %} + {% if columns is null or "id" in columns %} + {% endif %} + {% if columns is null or "label" in columns %} + {% endif %} + {% if columns is null or "wikipedia_link" in columns %} + {% endif %} + {% if columns is null or "wikipedia_permalink" in columns %} + {% endif %} + {% if columns is null or "dbpedia_link" in columns %} + {% endif %} + {% if columns is null or "category" in columns %} + {% endif %} + {% if columns is null or "remove_wikipedia_link" in columns %} + {% endif %} + {% if columns is null or "alias" in columns %} + {% endif %} + {% if columns is null or "remove_tag_from_list" in columns %} + {% endif %} {% endfor %}
#idlabelLien WpLien WLien DCatégorieSupprimer
le lien W
AliasRetirer le tag
{{loop.index}}updown{{t.tag.id}}{{t.tag.label}} {% if t.tag.wikipediaurl and t.tag.wikipediaurl != "" %} @@ -25,6 +56,8 @@ {% endif %} {% if t.wikipediarevisionid %} @@ -32,6 +65,8 @@   {% endif %} {% if t.tag.dbpediauri and t.tag.dbpediauri != "" %} @@ -39,9 +74,18 @@   {% endif %} {% if t.tag.category %}{{ t.tag.category.label }}{% endif %}{{t.tag.label}}{% if t.tag.alias %}{{t.tag.alias}}{% endif %}{{t.tag.label}}
diff -r 1c4e3fdba170 -r 6f643fc1de26 Search/Search.php diff -r 1c4e3fdba170 -r 6f643fc1de26 Tests/Search/SearchServiceTest.php diff -r 1c4e3fdba170 -r 6f643fc1de26 Utils/SchemaUtils.php