# HG changeset patch # User ymh # Date 1374223157 -7200 # Node ID 3fde7d26ad087ecbda0e45bc293a737fc0104f0c # Parent 1add6bd2794b3bf2adc4db1d7da3b5f2355c0cd8 Add link_semantic_level to filter (bug #17542) diff -r 1add6bd2794b -r 3fde7d26ad08 src/core/locale/en/LC_MESSAGES/django.mo Binary file src/core/locale/en/LC_MESSAGES/django.mo has changed diff -r 1add6bd2794b -r 3fde7d26ad08 src/core/locale/en/LC_MESSAGES/django.po --- a/src/core/locale/en/LC_MESSAGES/django.po Thu Jul 18 15:02:16 2013 +0200 +++ b/src/core/locale/en/LC_MESSAGES/django.po Fri Jul 19 10:39:17 2013 +0200 @@ -42,16 +42,16 @@ #: models/term.py:54 msgid "EE" -msgstr "EE: exact equivalence" +msgstr "EE" #: models/term.py:55 msgid "EI" -msgstr "EI: inaccurate equivalence" +msgstr "EI" #: models/term.py:56 msgid "BM" -msgstr "BM: equivalence to a broader concept" +msgstr "BM" #: models/term.py:57 msgid "NM" -msgstr "NM: equivalence to a narrower concept" +msgstr "NM" diff -r 1add6bd2794b -r 3fde7d26ad08 src/core/locale/fr/LC_MESSAGES/django.mo Binary file src/core/locale/fr/LC_MESSAGES/django.mo has changed diff -r 1add6bd2794b -r 3fde7d26ad08 src/core/locale/fr/LC_MESSAGES/django.po --- a/src/core/locale/fr/LC_MESSAGES/django.po Thu Jul 18 15:02:16 2013 +0200 +++ b/src/core/locale/fr/LC_MESSAGES/django.po Fri Jul 19 10:39:17 2013 +0200 @@ -43,16 +43,16 @@ #: models/term.py:54 msgid "EE" -msgstr "EE : équivalence exacte" +msgstr "EE" #: models/term.py:55 msgid "EI" -msgstr "EI : équivalence inexacte" +msgstr "EI" #: models/term.py:56 msgid "BM" -msgstr "BM : équivalence vers un concept plus vaste" +msgstr "BM" #: models/term.py:57 msgid "NM" -msgstr "NM : équivalence vers un concept moins vaste" +msgstr "NM" diff -r 1add6bd2794b -r 3fde7d26ad08 src/core/models/__init__.py --- a/src/core/models/__init__.py Thu Jul 18 15:02:16 2013 +0200 +++ b/src/core/models/__init__.py Fri Jul 19 10:39:17 2013 +0200 @@ -2,10 +2,10 @@ 'AutrNoticeTerm', 'DomnNoticeTerm', 'EcolNoticeTerm', 'EpoqNoticeTerm', 'LieuxNoticeTerm', 'PeriNoticeTerm', 'ReprNoticeTerm', 'SrepNoticeTerm', - 'TERM_URL_STATUS_CHOICES', 'TERM_URL_STATUS_CHOICES_TRANS', 'TERM_URL_STATUS_DICT'] + 'TERM_URL_STATUS_CHOICES', 'TERM_URL_STATUS_CHOICES_TRANS', 'TERM_URL_STATUS_DICT', 'TERM_WK_LINK_SEMANTIC_LEVEL_CHOICES_TRANS'] from .notice import (Notice, NoticeImage, NoticeTerm, AutrNoticeTerm, DomnNoticeTerm, EcolNoticeTerm, EpoqNoticeTerm, LieuxNoticeTerm, PeriNoticeTerm, ReprNoticeTerm, SrepNoticeTerm) from .term import (Term, TermLabel, Thesaurus, TERM_URL_STATUS_CHOICES, - TERM_URL_STATUS_CHOICES_TRANS, TERM_URL_STATUS_DICT) + TERM_URL_STATUS_CHOICES_TRANS, TERM_URL_STATUS_DICT, TERM_WK_LINK_SEMANTIC_LEVEL_CHOICES_TRANS) diff -r 1add6bd2794b -r 3fde7d26ad08 src/core/wp_utils.py --- a/src/core/wp_utils.py Thu Jul 18 15:02:16 2013 +0200 +++ b/src/core/wp_utils.py Fri Jul 19 10:39:17 2013 +0200 @@ -168,7 +168,9 @@ def process_term(site, term, lang, label=None, verbosity=0): - + + label_is_url = False + fragment = "" if not label: label = term.label else: @@ -178,6 +180,9 @@ lang = lang_code url_parts = urlparse(label) label = urllib2.unquote(str(url_parts.path.split('/')[-1])).decode("utf-8") + if url_parts.fragment: + label_is_url = True + fragment = url_parts.fragment break if site == None: @@ -187,7 +192,7 @@ new_label = wp_res['new_label'] alternative_label= wp_res['alternative_label'] status = wp_res['status'] - url = wp_res['wikipedia_url'] + url = wp_res['wikipedia_url'] + ("#"+fragment if label_is_url else "") alternative_url = wp_res['alternative_wikipedia_url'] pageid = wp_res['pageid'] alternative_pageid = wp_res['alternative_pageid'] diff -r 1add6bd2794b -r 3fde7d26ad08 src/jocondelab/forms.py --- a/src/jocondelab/forms.py Thu Jul 18 15:02:16 2013 +0200 +++ b/src/jocondelab/forms.py Fri Jul 19 10:39:17 2013 +0200 @@ -4,7 +4,8 @@ @author: ymh ''' -from core.models import Thesaurus, Term, TERM_URL_STATUS_CHOICES_TRANS +from core.models import (Thesaurus, Term, TERM_URL_STATUS_CHOICES_TRANS, + TERM_WK_LINK_SEMANTIC_LEVEL_CHOICES_TRANS) from django.forms import Form, fields, ModelChoiceField from django.forms.util import flatatt from django.forms.widgets import Widget @@ -80,6 +81,7 @@ thesaurus_tree = ModelChoiceField(label=_("thesaurus tree"), queryset=Term.objects.all(), required=False, widget=ThesaurusTreeWidget) # @UndefinedVariable label = fields.CharField(label=_("label"), required=False) link_status = fields.TypedChoiceField(label=_("link_status"), required=False, empty_value=-1, coerce=int, choices=tuple([(-1,'---------')]+[(v, l) for v,l in TERM_URL_STATUS_CHOICES_TRANS])) + link_semantic_level = fields.TypedChoiceField(label=_("link_semantic_level"), required=False, empty_value=0, coerce=int, choices=TERM_WK_LINK_SEMANTIC_LEVEL_CHOICES_TRANS) validated = fields.TypedChoiceField(label=_("validated"), required=False, empty_value=None, coerce=validated_to_bool, choices=(("", "---"),("1", _("yes")), ("0", _("no")))) order_by = fields.ChoiceField(label=_("order_by"), required=False, choices=(('normalized_label',_('label')),('nb_notice',_('nb notice')),('level',_('level')))) order_dir = fields.ChoiceField(label=_("order_dir"), required=False, choices=(('asc',_('asc')), ('desc',_('desc')))) @@ -102,6 +104,10 @@ if lk_status>=0: qs = qs.filter(url_status=lk_status) + lk_semantic_level = self.cleaned_data.get('link_semantic_level', 0) + if lk_semantic_level: + qs = qs.filter(link_semantic_level=lk_semantic_level) + validated = self.cleaned_data.get('validated', None) if validated is not None: qs = qs.filter(validated=validated) diff -r 1add6bd2794b -r 3fde7d26ad08 src/jocondelab/locale/en/LC_MESSAGES/django.mo Binary file src/jocondelab/locale/en/LC_MESSAGES/django.mo has changed diff -r 1add6bd2794b -r 3fde7d26ad08 src/jocondelab/locale/en/LC_MESSAGES/django.po --- a/src/jocondelab/locale/en/LC_MESSAGES/django.po Thu Jul 18 15:02:16 2013 +0200 +++ b/src/jocondelab/locale/en/LC_MESSAGES/django.po Fri Jul 19 10:39:17 2013 +0200 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-18 10:33+0200\n" +"POT-Creation-Date: 2013-07-18 21:28+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,64 +20,68 @@ msgid "language" msgstr "language" -#: forms.py:45 forms.py:47 +#: forms.py:46 forms.py:48 msgid "Open Dialog" msgstr "Open thesaurus" -#: forms.py:63 +#: forms.py:64 msgid "Wikipedia version" msgstr "Wikipedia version" -#: forms.py:79 templates/jocondelab/term_list.html:20 +#: forms.py:80 templates/jocondelab/term_list.html:20 msgid "thesaurus" msgstr "thesaurus" -#: forms.py:80 +#: forms.py:81 msgid "thesaurus tree" msgstr "thesaurus tree" -#: forms.py:81 forms.py:84 templates/jocondelab/term_edit.html:75 +#: forms.py:82 forms.py:86 templates/jocondelab/term_edit.html:80 msgid "label" msgstr "label" -#: forms.py:82 +#: forms.py:83 msgid "link_status" msgstr "link status" -#: forms.py:83 +#: forms.py:84 +msgid "link_semantic_level" +msgstr "link level" + +#: forms.py:85 msgid "validated" msgstr "valid." -#: forms.py:83 +#: forms.py:85 msgid "yes" msgstr "yes" -#: forms.py:83 +#: forms.py:85 msgid "no" msgstr "no" -#: forms.py:84 +#: forms.py:86 msgid "order_by" msgstr "order by" -#: forms.py:84 templates/jocondelab/term_edit.html:174 +#: forms.py:86 templates/jocondelab/term_edit.html:179 #: templates/jocondelab/term_list.html:20 msgid "nb notice" msgstr "nb of notice" -#: forms.py:84 templates/jocondelab/term_list.html:20 +#: forms.py:86 templates/jocondelab/term_list.html:20 msgid "level" msgstr "level" -#: forms.py:85 +#: forms.py:87 msgid "order_dir" msgstr "sort order" -#: forms.py:85 +#: forms.py:87 msgid "asc" msgstr "asc." -#: forms.py:85 +#: forms.py:87 msgid "desc" msgstr "desc." @@ -85,53 +89,53 @@ msgid "French" msgstr "French" -#: templates/jocondelab/term_edit.html:68 +#: templates/jocondelab/term_edit.html:73 msgid "prev" msgstr "prev" -#: templates/jocondelab/term_edit.html:69 +#: templates/jocondelab/term_edit.html:74 #: templates/jocondelab/partial/pagination.html:27 #: templates/jocondelab/partial/pagination.html:29 msgid "next" msgstr "next" -#: templates/jocondelab/term_edit.html:79 +#: templates/jocondelab/term_edit.html:84 msgid "alternative labels" msgstr "alternative labels" -#: templates/jocondelab/term_edit.html:89 +#: templates/jocondelab/term_edit.html:94 msgid "id" msgstr "id" -#: templates/jocondelab/term_edit.html:93 +#: templates/jocondelab/term_edit.html:98 msgid "uri" msgstr "uri" -#: templates/jocondelab/term_edit.html:97 +#: templates/jocondelab/term_edit.html:102 msgid "ancestors" msgstr "ancestors" -#: templates/jocondelab/term_edit.html:105 +#: templates/jocondelab/term_edit.html:110 msgid "info wikipedia" msgstr "Wikipedia info" -#: templates/jocondelab/term_edit.html:114 +#: templates/jocondelab/term_edit.html:119 msgid "Créer page WK" msgstr "Create WK page" -#: templates/jocondelab/term_edit.html:114 +#: templates/jocondelab/term_edit.html:119 msgid "Need wikipedia article" msgstr "Need wikipedia article" -#: templates/jocondelab/term_edit.html:145 +#: templates/jocondelab/term_edit.html:150 msgid "Rech. joconde" msgstr "Joconde search" -#: templates/jocondelab/term_edit.html:151 +#: templates/jocondelab/term_edit.html:156 msgid "Edition wk" msgstr "WK Edition" -#: templates/jocondelab/term_edit.html:178 +#: templates/jocondelab/term_edit.html:183 msgid "notices" msgstr "notices" @@ -178,5 +182,5 @@ msgid "login" msgstr "login" -msgid "English" -msgstr "English" +#msgid "English" +#msgstr "English" diff -r 1add6bd2794b -r 3fde7d26ad08 src/jocondelab/locale/fr/LC_MESSAGES/django.mo Binary file src/jocondelab/locale/fr/LC_MESSAGES/django.mo has changed diff -r 1add6bd2794b -r 3fde7d26ad08 src/jocondelab/locale/fr/LC_MESSAGES/django.po --- a/src/jocondelab/locale/fr/LC_MESSAGES/django.po Thu Jul 18 15:02:16 2013 +0200 +++ b/src/jocondelab/locale/fr/LC_MESSAGES/django.po Fri Jul 19 10:39:17 2013 +0200 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-18 10:33+0200\n" +"POT-Creation-Date: 2013-07-18 21:28+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -21,65 +21,68 @@ msgid "language" msgstr "langue" -#: forms.py:45 forms.py:47 +#: forms.py:46 forms.py:48 msgid "Open Dialog" msgstr "Ouvrir thésaurus" -#: forms.py:63 -#, fuzzy +#: forms.py:64 msgid "Wikipedia version" msgstr "Version wikipedia" -#: forms.py:79 templates/jocondelab/term_list.html:20 +#: forms.py:80 templates/jocondelab/term_list.html:20 msgid "thesaurus" msgstr "thésaurus" -#: forms.py:80 +#: forms.py:81 msgid "thesaurus tree" msgstr "Arbre du thésaurus" -#: forms.py:81 forms.py:84 templates/jocondelab/term_edit.html:75 +#: forms.py:82 forms.py:86 templates/jocondelab/term_edit.html:80 msgid "label" msgstr "label" -#: forms.py:82 +#: forms.py:83 msgid "link_status" msgstr "statut lien" -#: forms.py:83 +#: forms.py:84 +msgid "link_semantic_level" +msgstr "niveau lien" + +#: forms.py:85 msgid "validated" msgstr "validé" -#: forms.py:83 +#: forms.py:85 msgid "yes" msgstr "oui" -#: forms.py:83 +#: forms.py:85 msgid "no" msgstr "non" -#: forms.py:84 +#: forms.py:86 msgid "order_by" msgstr "ord. par" -#: forms.py:84 templates/jocondelab/term_edit.html:174 +#: forms.py:86 templates/jocondelab/term_edit.html:179 #: templates/jocondelab/term_list.html:20 msgid "nb notice" msgstr "nb notice" -#: forms.py:84 templates/jocondelab/term_list.html:20 +#: forms.py:86 templates/jocondelab/term_list.html:20 msgid "level" msgstr "niveau" -#: forms.py:85 +#: forms.py:87 msgid "order_dir" msgstr "ordre tri" -#: forms.py:85 +#: forms.py:87 msgid "asc" msgstr "asc." -#: forms.py:85 +#: forms.py:87 msgid "desc" msgstr "desc." @@ -87,53 +90,53 @@ msgid "French" msgstr "Français" -#: templates/jocondelab/term_edit.html:68 +#: templates/jocondelab/term_edit.html:73 msgid "prev" msgstr "préc." -#: templates/jocondelab/term_edit.html:69 +#: templates/jocondelab/term_edit.html:74 #: templates/jocondelab/partial/pagination.html:27 #: templates/jocondelab/partial/pagination.html:29 msgid "next" msgstr "suiv." -#: templates/jocondelab/term_edit.html:79 +#: templates/jocondelab/term_edit.html:84 msgid "alternative labels" msgstr "Autres labels" -#: templates/jocondelab/term_edit.html:89 +#: templates/jocondelab/term_edit.html:94 msgid "id" msgstr "id" -#: templates/jocondelab/term_edit.html:93 +#: templates/jocondelab/term_edit.html:98 msgid "uri" msgstr "uri" -#: templates/jocondelab/term_edit.html:97 +#: templates/jocondelab/term_edit.html:102 msgid "ancestors" msgstr "ancêtres" -#: templates/jocondelab/term_edit.html:105 +#: templates/jocondelab/term_edit.html:110 msgid "info wikipedia" msgstr "info wikipedia" -#: templates/jocondelab/term_edit.html:114 +#: templates/jocondelab/term_edit.html:119 msgid "Créer page WK" msgstr "Créer page WK" -#: templates/jocondelab/term_edit.html:114 +#: templates/jocondelab/term_edit.html:119 msgid "Need wikipedia article" msgstr "Besoin article Wikipedia" -#: templates/jocondelab/term_edit.html:145 +#: templates/jocondelab/term_edit.html:150 msgid "Rech. joconde" msgstr "Rech. Joconde" -#: templates/jocondelab/term_edit.html:151 +#: templates/jocondelab/term_edit.html:156 msgid "Edition wk" msgstr "Edition wk" -#: templates/jocondelab/term_edit.html:178 +#: templates/jocondelab/term_edit.html:183 msgid "notices" msgstr "notices" @@ -180,5 +183,5 @@ msgid "login" msgstr "connex." -#~ msgid "English" -#~ msgstr "Anglais" +msgid "English" +msgstr "Anglais" diff -r 1add6bd2794b -r 3fde7d26ad08 src/jocondelab/static/jocondelab/js/jocondelab.js --- a/src/jocondelab/static/jocondelab/js/jocondelab.js Thu Jul 18 15:02:16 2013 +0200 +++ b/src/jocondelab/static/jocondelab/js/jocondelab.js Fri Jul 19 10:39:17 2013 +0200 @@ -83,12 +83,12 @@ ); }); - $("#link_semantic_level").change(function(e) { + $("#wp_link_semantic_level").change(function(e) { $.post(link_semantic_level_url, { csrfmiddlewaretoken:global_csrf_token, term_id:term_id, - link_semantic_level: $("#link_semantic_level").val() + link_semantic_level: $("#wp_link_semantic_level").val() }, function(data, textStatus) { window.location.reload(true); diff -r 1add6bd2794b -r 3fde7d26ad08 src/jocondelab/templates/jocondelab/term_edit.html --- a/src/jocondelab/templates/jocondelab/term_edit.html Thu Jul 18 15:02:16 2013 +0200 +++ b/src/jocondelab/templates/jocondelab/term_edit.html Fri Jul 19 10:39:17 2013 +0200 @@ -135,7 +135,7 @@ {% if term.wikipedia_url and term.wikipedia_url != "" %} - {% for val, label in link_semantic_level_choice %} {% endfor %} diff -r 1add6bd2794b -r 3fde7d26ad08 src/jocondelab/views.py --- a/src/jocondelab/views.py Thu Jul 18 15:02:16 2013 +0200 +++ b/src/jocondelab/views.py Fri Jul 19 10:39:17 2013 +0200 @@ -239,7 +239,7 @@ self.term.dbpedia_uri = None self.term.wikipedia_revision_id = None self.term.url_status = TERM_URL_STATUS_DICT["unsemantized"] - self.link_semantic_level = TERM_WK_LINK_SEMANTIC_LEVEL_DICT['--'] + self.term.link_semantic_level = TERM_WK_LINK_SEMANTIC_LEVEL_DICT['--'] self.term.save()