# HG changeset patch # User cavaliet # Date 1319128533 -7200 # Node ID 7d2fb5d7c9fff6d099ab7d154e7b520bec6773e3 # Parent 7a877de630fd790d2bab926ed1c1a67aef82d997 debug addtag for document diff -r 7a877de630fd -r 7d2fb5d7c9ff .buildpath diff -r 7a877de630fd -r 7d2fb5d7c9ff .hgignore diff -r 7a877de630fd -r 7d2fb5d7c9ff .project diff -r 7a877de630fd -r 7d2fb5d7c9ff Command/SyncDocumentsCommand.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Controller/WikiTagController.php --- a/Controller/WikiTagController.php Wed Oct 19 15:44:23 2011 +0200 +++ b/Controller/WikiTagController.php Thu Oct 20 18:35:33 2011 +0200 @@ -215,13 +215,12 @@ //TODO : translation return new Response(json_encode(array('error' => 'duplicate_tag', 'message' => sprintf("Le tag %s existe déjà pour cette fiche.", $tag_label))),400); } - // $tag, $revision_id, $created + // returns array($tag, $revision_id, $created) $ar = WikiTagUtils::getOrCreateTag($tag_label, $this->getDoctrine());// tag, revision_id, created = get_or_create_tag(tag_label) - $tag = $ar[0]; $revision_id = $ar[1]; $created = $ar[2]; - + $tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findByDocumentExternalId($id_doc, array('tag'=>$tag->getId())); $nb_tags = count($tags); @@ -276,7 +275,7 @@ } // We associate the unsemantized tag to the DocumentTag and save datas // TODO: do the request on external id of document - $dt = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOneByDocumentExternalId($id_doc, array('tag' => $idTag)); + $dt = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOneBy(array('document' => $id_doc, 'tag' => $id_tag)); $dt->setTag($un_tag); $em->flush(); @@ -352,13 +351,25 @@ */ public function allTagsAction() { - $tags = $this->getDoctrine()->getRepository('WikiTagBundle:WikiTagTag')->findAll(); + $tags = $this->getDoctrine()->getRepository('WikiTagBundle:Tag')->findBy(array('id' => '10')); // $this->getRequest()->query->get('foo') does not work "because" we are a second controller. So we have to use $_GET. $toto = null; if(array_key_exists('toto', $_GET)){ $toto = $_GET['toto']; } - return $this->render('WikiTagBundle:WikiTag:TagList.html.twig', array('tags' => $tags, 'toto' => $toto)); + $searched = "truc"; + $search_def = array('A', 'B'); + $nb_by_page = 50; + $sort = "p+"; + $current_page = NULL;// avec start_index et end_index + $nb_total = "truc";// nb de pages + $num_page = 2; + $last_page = 4; + $prev_page = 1; + $next_page = 3; + return $this->render('WikiTagBundle:WikiTag:TagList.html.twig', + array('tags' => $tags, 'searched' => $searched, '$search_def' => $search_def, '$nb_by_page' => $nb_by_page, '$sort' => $sort, '$current_page' => $current_page, + '$nb_total' => $nb_total, '$num_page' => $num_page, '$last_page' => $last_page, '$prev_page' => $prev_page, '$next_page' => $next_page)); } diff -r 7a877de630fd -r 7d2fb5d7c9ff DependencyInjection/Configuration.php diff -r 7a877de630fd -r 7d2fb5d7c9ff DependencyInjection/WikiTagExtension.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Entity/Category.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Entity/CategoryRepository.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Entity/Document.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Entity/DocumentListener.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Entity/DocumentRepository.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Entity/DocumentTag.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Entity/DocumentTagRepository.php --- a/Entity/DocumentTagRepository.php Wed Oct 19 15:44:23 2011 +0200 +++ b/Entity/DocumentTagRepository.php Thu Oct 20 18:35:33 2011 +0200 @@ -56,9 +56,10 @@ if(!is_null($filter_array)) { foreach ($filter_array as $key => $value) { - $qb = $qb->where("dt.$key = :p_$key"); - $params["p_$key"] = $value; + $qb = $qb->andWhere("dt.$key = :$key"); + //$params[$key] = $value; } + $params = array_merge($params, $filter_array); } $qb = $qb->setParameters($params); diff -r 7a877de630fd -r 7d2fb5d7c9ff Entity/Tag.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Entity/TagRepository.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Model/BaseDocumentInterface.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Model/Category.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Model/CategoryInterface.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Model/Document.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Model/DocumentInterface.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Model/DocumentTag.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Model/DocumentTagInterface.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Model/Tag.php --- a/Model/Tag.php Wed Oct 19 15:44:23 2011 +0200 +++ b/Model/Tag.php Thu Oct 20 18:35:33 2011 +0200 @@ -9,7 +9,9 @@ */ namespace IRI\Bundle\WikiTagBundle\Model; - abstract class Tag implements TagInterface { + use IRI\Bundle\WikiTagBundle\Utils\WikiTagUtils; + +abstract class Tag implements TagInterface { public static $TAG_URL_STATUS_DICT = array('null_result'=>0,'redirection'=>1,'homonyme'=>2,'match'=>3); @@ -87,6 +89,7 @@ public function setLabel($label) { $this->label = $label; + $this->normalizedLabel = WikiTagUtils::normalizeTag($label); } /** diff -r 7a877de630fd -r 7d2fb5d7c9ff Model/TagInterface.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/config/doctrine/Category.orm.yml diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/config/doctrine/Document.orm.yml diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/config/doctrine/DocumentTag.orm.yml diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/config/doctrine/Tag.orm.yml --- a/Resources/config/doctrine/Tag.orm.yml Wed Oct 19 15:44:23 2011 +0200 +++ b/Resources/config/doctrine/Tag.orm.yml Thu Oct 20 18:35:33 2011 +0200 @@ -27,16 +27,20 @@ type: string length: '2048' column: wikipedia_url + nullable: true wikipediaPageId: type: bigint column: normalized_pageid + nullable: true urlStatus: type: smallint column: url_status + nullable: true dbpediaUri: type: string length: '2048' column: dbpedia_uri + nullable: true popularity: type: integer manyToOne: diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/config/routing.yml diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/config/services.yml diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/doc/index.rst diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/css/smoothness/images/ui-icons_222222_256x240.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/css/smoothness/images/ui-icons_2e83ff_256x240.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/css/smoothness/images/ui-icons_454545_256x240.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/css/smoothness/images/ui-icons_888888_256x240.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/css/smoothness/images/ui-icons_cd0a0a_256x240.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/css/smoothness/jquery-ui-1.8.13.custom.css diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/css/wikiTag.css diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/images/arrow_green_right.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/images/arrow_right.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/images/arrow_up_down.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/images/clock_arrow.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/images/indicator.gif diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/images/red_cross.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/images/sort-asc.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/images/sort-desc.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/images/sort-descending.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/images/tag_remove.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/images/wikipedia_search.png diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/js/jquery-ui.min.js diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/js/jquery.jeditable.js diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/js/jquery.min.js diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/js/jquery.qtip.min.js diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/js/jquery.tablednd_0_5.js diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/js/jquery.textchange.min.js diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/js/jquery.tools.min.js diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/js/jquery.validate.js diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/public/js/wikiTag.js diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/translations/messages.fr.xliff diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/views/WikiTag/TagList.html.twig --- a/Resources/views/WikiTag/TagList.html.twig Wed Oct 19 15:44:23 2011 +0200 +++ b/Resources/views/WikiTag/TagList.html.twig Thu Oct 20 18:35:33 2011 +0200 @@ -1,4 +1,52 @@ -DUDE 1. -{% if toto and toto != "" %} -toto = {{toto}} -{% endif %} \ No newline at end of file +
+

Chercher : +{#{% for s in search_def %} +{{s.0}} +{% endfor %}#} + +

+

Tags {#{{ current_page.start_index }} à {{ current_page.end_index }} sur {{ nb_total }}#}

+

+{# + {% if searched and searched != "" %} + <<   + <   + {{ num_page }}/{{ last_page }}   + >   + >>

+ {% else %} + <<   + <   + {{ num_page }}/{{ last_page }}   + >   + >> + {% endif %}

+#} +
+{# + + + + +#} +
+
+{% include "WikiTagBundle:WikiTag:TagListTable.html.twig" %} +
+

+{# + {% if searched and searched != "" %} + <<   + <   + {{ num_page }}/{{ last_page }}   + >   + >>

+ {% else %} + <<   + <   + {{ num_page }}/{{ last_page }}   + >   + >> + {% endif %}

+#} +
\ No newline at end of file diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/views/WikiTag/TagListTable.html.twig diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/views/WikiTag/css.html.twig diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/views/WikiTag/documentTags.html.twig diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/views/WikiTag/javascript.html.twig diff -r 7a877de630fd -r 7d2fb5d7c9ff Resources/views/WikiTag/tagTable.html.twig --- a/Resources/views/WikiTag/tagTable.html.twig Wed Oct 19 15:44:23 2011 +0200 +++ b/Resources/views/WikiTag/tagTable.html.twig Thu Oct 20 18:35:33 2011 +0200 @@ -16,7 +16,7 @@ {{loop.index}} updown - T-{{t.tag.id}} - {{t.tagorder}} - DT-{{t.id}} + {{t.tag.id}} {{t.tag.label}} {% if t.tag.wikipediaurl and t.tag.wikipediaurl != "" %} diff -r 7a877de630fd -r 7d2fb5d7c9ff Tests/Controller/DefaultControllerTest.php diff -r 7a877de630fd -r 7d2fb5d7c9ff Utils/WikiTagUtils.php --- a/Utils/WikiTagUtils.php Wed Oct 19 15:44:23 2011 +0200 +++ b/Utils/WikiTagUtils.php Thu Oct 20 18:35:33 2011 +0200 @@ -47,7 +47,6 @@ } else{ $created = false; - //$created = true; } // We request Wikipedia if the tag is created @@ -84,6 +83,7 @@ else{ $wikipedia_revision_id = null; } + //return "coucou4"; return array($tag, $wikipedia_revision_id, $created);//, $wpReponse); } @@ -91,7 +91,7 @@ /** * Cleans the tag label */ - private static function normalizeTag($tag_label) + public static function normalizeTag($tag_label) { if(strlen($tag_label)==0){ return $tag_label; diff -r 7a877de630fd -r 7d2fb5d7c9ff WikiTagBundle.php