# HG changeset patch # User cavaliet # Date 1322479892 -3600 # Node ID 16b5fd8d5405f968fa3bc9c79631876aaf5e1b93 # Parent 34718ebfb3c0b4875239f6e27d997eb132134719# Parent e25a00a6f9e1f14d5e2189a35caae9f7c8940ce8 Merge diff -r e25a00a6f9e1 -r 16b5fd8d5405 .hgtags diff -r e25a00a6f9e1 -r 16b5fd8d5405 Command/CreateFullTextIndexesCommand.php diff -r e25a00a6f9e1 -r 16b5fd8d5405 Command/GenerateDocumentClassCommand.php diff -r e25a00a6f9e1 -r 16b5fd8d5405 Command/PurgeTagsCommand.php diff -r e25a00a6f9e1 -r 16b5fd8d5405 Command/QueryWikipediaCommand.php diff -r e25a00a6f9e1 -r 16b5fd8d5405 Command/ReorderTagsCommand.php diff -r e25a00a6f9e1 -r 16b5fd8d5405 Controller/WikiTagController.php --- a/Controller/WikiTagController.php Sun Nov 27 23:48:40 2011 +0100 +++ b/Controller/WikiTagController.php Mon Nov 28 12:31:32 2011 +0100 @@ -90,10 +90,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,9 +558,7 @@ // We get the Wikipedia informations for the sent label $tag_label_normalized = WikiTagUtils::normalizeTag($label); $wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized); - $tag->setWikipediaInfo($wp_response); - // Save datas. $em = $this->getDoctrine()->getEntityManager(); $em->persist($tag); @@ -615,7 +620,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 e25a00a6f9e1 -r 16b5fd8d5405 DependencyInjection/Configuration.php --- a/DependencyInjection/Configuration.php Sun Nov 27 23:48:40 2011 +0100 +++ b/DependencyInjection/Configuration.php Mon Nov 28 12:31:32 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 e25a00a6f9e1 -r 16b5fd8d5405 DependencyInjection/WikiTagExtension.php --- a/DependencyInjection/WikiTagExtension.php Sun Nov 27 23:48:40 2011 +0100 +++ b/DependencyInjection/WikiTagExtension.php Mon Nov 28 12:31:32 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 e25a00a6f9e1 -r 16b5fd8d5405 Event/DocumentTagEvent.php diff -r e25a00a6f9e1 -r 16b5fd8d5405 Event/WikiTagEvents.php diff -r e25a00a6f9e1 -r 16b5fd8d5405 Listener/WikiTagDocumentListener.php diff -r e25a00a6f9e1 -r 16b5fd8d5405 Resources/meta/LICENSE diff -r e25a00a6f9e1 -r 16b5fd8d5405 Resources/public/js/wikiTag.js --- a/Resources/public/js/wikiTag.js Sun Nov 27 23:48:40 2011 +0100 +++ b/Resources/public/js/wikiTag.js Mon Nov 28 12:31:32 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 }, @@ -270,7 +274,6 @@ }, success: function( data ) { response( $.map( data["query"]["search"], function( item ) { - console.log(item); return { label: item["title"], snippet: item["snippet"], @@ -307,7 +310,7 @@ add_tag($("#wikitag_wp_search_context").val()); } }); -}; +} function wikitag_update_tag(btn) { @@ -334,6 +337,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 +375,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 +398,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 +430,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 e25a00a6f9e1 -r 16b5fd8d5405 Resources/views/WikiTag/contextSearchDiv.html.twig diff -r e25a00a6f9e1 -r 16b5fd8d5405 Resources/views/WikiTag/documentTags.html.twig --- a/Resources/views/WikiTag/documentTags.html.twig Sun Nov 27 23:48:40 2011 +0100 +++ b/Resources/views/WikiTag/documentTags.html.twig Mon Nov 28 12:31:32 2011 +0100 @@ -6,6 +6,7 @@ Ajouter un tag : OK +
{% include 'WikiTagBundle:WikiTag:tagTable.html.twig' %} diff -r e25a00a6f9e1 -r 16b5fd8d5405 Resources/views/WikiTag/tagTable.html.twig --- a/Resources/views/WikiTag/tagTable.html.twig Sun Nov 27 23:48:40 2011 +0100 +++ b/Resources/views/WikiTag/tagTable.html.twig Mon Nov 28 12:31:32 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 e25a00a6f9e1 -r 16b5fd8d5405 Search/Search.php diff -r e25a00a6f9e1 -r 16b5fd8d5405 Tests/Search/SearchServiceTest.php diff -r e25a00a6f9e1 -r 16b5fd8d5405 Utils/SchemaUtils.php