# HG changeset patch # User cavaliet # Date 1378828285 -7200 # Node ID 8433e12362e0c4e3ed3164cf3113b44359b7da77 # Parent 305f9fcd409bf17d6dd5b0d3352c53b8edb4e496 angular for simple sparql and checkbox. Languages updated diff -r 305f9fcd409b -r 8433e12362e0 src/p4l/locale/en/LC_MESSAGES/django.mo Binary file src/p4l/locale/en/LC_MESSAGES/django.mo has changed diff -r 305f9fcd409b -r 8433e12362e0 src/p4l/locale/en/LC_MESSAGES/django.po --- a/src/p4l/locale/en/LC_MESSAGES/django.po Tue Sep 10 16:54:29 2013 +0200 +++ b/src/p4l/locale/en/LC_MESSAGES/django.po Tue Sep 10 17:51:25 2013 +0200 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-06 12:13-0500\n" +"POT-Creation-Date: 2013-09-10 10:40-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -289,12 +289,51 @@ msgstr "Add" #: templates/p4l/translations.html:4 +msgid "Save" +msgstr "Save" + +#: templates/p4l/translations.html:5 +msgid "Update" +msgstr "" + +#: templates/p4l/translations.html:6 msgid "Add a new subject" msgstr "Add a new subject" -#: templates/p4l/translations.html:5 -msgid "Save" -msgstr "Save" +#: templates/p4l/translations.html:7 +#, fuzzy +msgid "Add a new theme" +msgstr "Add a new subject" + +#: templates/p4l/translations.html:8 +#, fuzzy +msgid "Add a new country" +msgstr "Add a new subject" + +#: templates/p4l/translations.html:9 +#, fuzzy +msgid "Add a new language" +msgstr "Add a new subject" + +#: templates/p4l/translations.html:10 +#, fuzzy +msgid "Add a new project" +msgstr "Add a new subject" + +#: templates/p4l/translations.html:11 +#, fuzzy +msgid "Add a new organization" +msgstr "Add a new subject" + +#: templates/p4l/translations.html:12 +#, fuzzy +msgid "Modify the language" +msgstr "other languages" + +#: templates/p4l/translations.html:13 +#, fuzzy +msgid "Modify the record type" +msgstr "record type" #: templates/registration/login.html:8 msgid "Sorry, that's not a valid username or password." diff -r 305f9fcd409b -r 8433e12362e0 src/p4l/locale/es/LC_MESSAGES/django.mo Binary file src/p4l/locale/es/LC_MESSAGES/django.mo has changed diff -r 305f9fcd409b -r 8433e12362e0 src/p4l/locale/es/LC_MESSAGES/django.po --- a/src/p4l/locale/es/LC_MESSAGES/django.po Tue Sep 10 16:54:29 2013 +0200 +++ b/src/p4l/locale/es/LC_MESSAGES/django.po Tue Sep 10 17:51:25 2013 +0200 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-06 12:13-0500\n" +"POT-Creation-Date: 2013-09-10 10:40-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -290,12 +290,51 @@ msgstr "Add" #: templates/p4l/translations.html:4 +msgid "Save" +msgstr "Save" + +#: templates/p4l/translations.html:5 +msgid "Update" +msgstr "" + +#: templates/p4l/translations.html:6 msgid "Add a new subject" msgstr "Add a new subject" -#: templates/p4l/translations.html:5 -msgid "Save" -msgstr "Save" +#: templates/p4l/translations.html:7 +#, fuzzy +msgid "Add a new theme" +msgstr "Add a new subject" + +#: templates/p4l/translations.html:8 +#, fuzzy +msgid "Add a new country" +msgstr "Add a new subject" + +#: templates/p4l/translations.html:9 +#, fuzzy +msgid "Add a new language" +msgstr "Add a new subject" + +#: templates/p4l/translations.html:10 +#, fuzzy +msgid "Add a new project" +msgstr "Add a new subject" + +#: templates/p4l/translations.html:11 +#, fuzzy +msgid "Add a new organization" +msgstr "Add a new subject" + +#: templates/p4l/translations.html:12 +#, fuzzy +msgid "Modify the language" +msgstr "other languages" + +#: templates/p4l/translations.html:13 +#, fuzzy +msgid "Modify the record type" +msgstr "record type" #: templates/registration/login.html:8 msgid "Sorry, that's not a valid username or password." diff -r 305f9fcd409b -r 8433e12362e0 src/p4l/locale/fr/LC_MESSAGES/django.mo Binary file src/p4l/locale/fr/LC_MESSAGES/django.mo has changed diff -r 305f9fcd409b -r 8433e12362e0 src/p4l/locale/fr/LC_MESSAGES/django.po --- a/src/p4l/locale/fr/LC_MESSAGES/django.po Tue Sep 10 16:54:29 2013 +0200 +++ b/src/p4l/locale/fr/LC_MESSAGES/django.po Tue Sep 10 17:51:25 2013 +0200 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-06 12:13-0500\n" +"POT-Creation-Date: 2013-09-10 10:40-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,7 +17,9 @@ "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: admin.py:10 forms.py:36 templates/p4l/p4l_record_view.html:51 +#: admin.py:10 +#: forms.py:36 +#: templates/p4l/p4l_record_view.html:51 msgid "language" msgstr "langue" @@ -37,20 +39,22 @@ msgid "Search" msgstr "Chercher" -#: semantictree/forms/widgets.py:43 semantictree/forms/widgets.py:80 +#: semantictree/forms/widgets.py:43 +#: semantictree/forms/widgets.py:80 msgid "" "\"data-url\", \"data-query\", \"data-root-query\", \"data-childs-query\" and " "\"data-child-count-query\" must be set in CharField configuration" -msgstr "" -"\"data-url\", \"data-query\", \"data-root-query\", \"data-childs-query\" et " +msgstr "\"data-url\", \"data-query\", \"data-root-query\", \"data-childs-query\" et " "\"data-child-count-query\" doivent être renseignés dans la configuration " "CharField" -#: semantictree/forms/widgets.py:44 semantictree/forms/widgets.py:81 +#: semantictree/forms/widgets.py:44 +#: semantictree/forms/widgets.py:81 msgid "Browse" msgstr "Parcourir" -#: semantictree/forms/widgets.py:49 semantictree/forms/widgets.py:86 +#: semantictree/forms/widgets.py:49 +#: semantictree/forms/widgets.py:86 msgid "or" msgstr "ou" @@ -58,16 +62,19 @@ msgid "logout" msgstr "deconnection" -#: templates/p4l/p4l_base.html:37 templates/registration/login.html:4 +#: templates/p4l/p4l_base.html:37 +#: templates/registration/login.html:4 #: templates/registration/login.html:27 msgid "login" msgstr "connection" -#: templates/p4l/p4l_home.html:6 templates/p4l/p4l_home.html.py:10 +#: templates/p4l/p4l_home.html:6 +#: templates/p4l/p4l_home.html.py:10 msgid "Record List" msgstr "Liste notice" -#: templates/p4l/p4l_home.html:6 templates/p4l/p4l_home.html.py:29 +#: templates/p4l/p4l_home.html:6 +#: templates/p4l/p4l_home.html.py:29 #: templates/p4l/p4l_home.html:66 msgid "Page" msgstr "Page" @@ -76,19 +83,23 @@ msgid "Title" msgstr "Titre" -#: templates/p4l/p4l_home.html:26 templates/p4l/p4l_home.html.py:63 +#: templates/p4l/p4l_home.html:26 +#: templates/p4l/p4l_home.html.py:63 msgid "Previous" msgstr "Préc." -#: templates/p4l/p4l_home.html:29 templates/p4l/p4l_home.html.py:66 +#: templates/p4l/p4l_home.html:29 +#: templates/p4l/p4l_home.html.py:66 msgid "on" msgstr "sur" -#: templates/p4l/p4l_home.html:32 templates/p4l/p4l_home.html.py:69 +#: templates/p4l/p4l_home.html:32 +#: templates/p4l/p4l_home.html.py:69 msgid "Next" msgstr "Suiv." -#: templates/p4l/p4l_home.html:39 templates/p4l/p4l_record_view.html:59 +#: templates/p4l/p4l_home.html:39 +#: templates/p4l/p4l_record_view.html:59 msgid "titles" msgstr "titres" @@ -291,21 +302,56 @@ msgstr "Ajouter" #: templates/p4l/translations.html:4 +msgid "Save" +msgstr "Sauver" + +#: templates/p4l/translations.html:5 +msgid "Update" +msgstr "Mettre à jour" + +#: templates/p4l/translations.html:6 msgid "Add a new subject" msgstr "Ajouter un nouveau sujet" -#: templates/p4l/translations.html:5 -msgid "Save" -msgstr "Sauver" +#: templates/p4l/translations.html:7 +msgid "Add a new theme" +msgstr "Ajouter un nouveau thème" + +#: templates/p4l/translations.html:8 +msgid "Add a new country" +msgstr "Ajouter un nouveau pays" + +#: templates/p4l/translations.html:9 +msgid "Add a new language" +msgstr "Ajouter une nouvelle langue" + +#: templates/p4l/translations.html:10 +msgid "Add a new project" +msgstr "Ajouter un nouveau projet" + +#: templates/p4l/translations.html:11 +msgid "Add a new organization" +msgstr "Ajouter une nouvelle organisation" + +#: templates/p4l/translations.html:12 +msgid "Modify the language" +msgstr "Modifier la langue" + +#: templates/p4l/translations.html:13 +msgid "Modify the record type" +msgstr "Modifier le type de notice" #: templates/registration/login.html:8 msgid "Sorry, that's not a valid username or password." msgstr "Désolé, utilisateur ou mot de passe invalide" -#: templates/registration/login.html:14 templates/registration/login.html:16 +#: templates/registration/login.html:14 +#: templates/registration/login.html:16 msgid "Username" msgstr "Utilisateur" -#: templates/registration/login.html:20 templates/registration/login.html:22 +#: templates/registration/login.html:20 +#: templates/registration/login.html:22 msgid "Password" msgstr "Mot de passe" + diff -r 305f9fcd409b -r 8433e12362e0 src/p4l/models/data.py --- a/src/p4l/models/data.py Tue Sep 10 16:54:29 2013 +0200 +++ b/src/p4l/models/data.py Tue Sep 10 17:51:25 2013 +0200 @@ -167,7 +167,7 @@ #subjectMeetings = foreign key from 'p4l.SubjectMeeting' #iiep:subjectMeeting corporateAuthors = models.ManyToManyField('p4l.CorporateAuthor', related_name='recordsCorporateAuthor') #iiep:subjectCorporateBody # #urls foreign Key from Url #iiep:url - recordType = models.URLField(max_length=2048) #dct:type + recordType = models.URLField(max_length=2048) #dct:type # isDocumentPart = models.BooleanField() #iiep:isDocumentPart isMultilingual = models.BooleanField() #iiep:isMultilingual diff -r 305f9fcd409b -r 8433e12362e0 src/p4l/settings.py --- a/src/p4l/settings.py Tue Sep 10 16:54:29 2013 +0200 +++ b/src/p4l/settings.py Tue Sep 10 17:51:25 2013 +0200 @@ -454,6 +454,41 @@ } """ } +SPARQL_TYPE_QUERIES = { +'filter' : """ +PREFIX skos: +PREFIX rdf: +PREFIX owl: +PREFIX rdfs: +SELECT DISTINCT ?uri ?label +WHERE { + ?uri a skos:Concept. + ?uri skos:inScheme . + ?uri skos:prefLabel ?label. + FILTER (lang(?label) = %s). + ?uri skos:prefLabel ?lab. + FILTER regex (str(?lab), ?reg, 'i'). + FILTER (lang (?lab) = %s). + BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). + BIND (STRLEN(STR(?lab)) AS ?len) +} +ORDER BY ?place ?len ?lab +""", +'root' : """ +PREFIX skos: +PREFIX rdf: +PREFIX owl: +PREFIX rdfs: +SELECT DISTINCT ?uri ?label +WHERE { + ?uri a skos:Concept ; + skos:inScheme ; + skos:prefLabel ?label . + FILTER (lang(?label) = %s). + FILTER NOT EXISTS { [skos:narrower ?uri] } +} +""" +} REST_FRAMEWORK = { diff -r 305f9fcd409b -r 8433e12362e0 src/p4l/static/p4l/js/p4l.js --- a/src/p4l/static/p4l/js/p4l.js Tue Sep 10 16:54:29 2013 +0200 +++ b/src/p4l/static/p4l/js/p4l.js Tue Sep 10 17:51:25 2013 +0200 @@ -167,6 +167,50 @@ } }); +app.directive('simpleSemUri', function(RecordModel, context, $timeout){ + return { + restrict: 'E', + replace: true, + transclude: true, + scope: { + listname:"@", + val:"=", + placeholder:"@", + }, + templateUrl: function(tElement, tAttrs) { + return context.urls.base_static+'p4l/templates/simpleSemanticUriForm.html'; + }, + link: function($scope, $element, $attrs) { + // Get queries attributes from $scope listname and context query dict + attr_dict = context.query_dicts[$scope.listname]; + for (var k in attr_dict){ + if (attr_dict.hasOwnProperty(k)) { + $scope[k] = attr_dict[k]; + } + } + // initalize autocomplete and browse thesaurus events + // We have to timeout because init_browse needs the real ids and not {{ $id }} + // NB : scope.apply generates bug + $timeout(function(){ + init_autocomplete(); + init_browse(); + }, 0); + }, + controller: function($scope, $element, $attrs, $transclude, RecordModel){ + $scope.record = RecordModel.record; + $scope.uriLabels = RecordModel.uriLabels; + $scope.addUriText = ''; + + $scope.updateVal = function() { + $scope.val = $scope.addUriText; + }; + + $scope.updateUriLabelDict = function(k,v) { + $scope.uriLabels[k] = v; + }; + } + } + }); app.controller("RecordCtrl", function($scope, RecordModel, context){ diff -r 305f9fcd409b -r 8433e12362e0 src/p4l/static/p4l/templates/simpleSemanticUriForm.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/p4l/static/p4l/templates/simpleSemanticUriForm.html Tue Sep 10 17:51:25 2013 +0200 @@ -0,0 +1,18 @@ +
+

{{uriLabels[val]}} ({{val}})

+
+
+ + {{ 'or' | translate}} + + {{'Browse' | translate}} + + +
+
+ +
+
+
\ No newline at end of file diff -r 305f9fcd409b -r 8433e12362e0 src/p4l/templates/p4l/record_update_form.html --- a/src/p4l/templates/p4l/record_update_form.html Tue Sep 10 16:54:29 2013 +0200 +++ b/src/p4l/templates/p4l/record_update_form.html Tue Sep 10 17:51:25 2013 +0200 @@ -85,7 +85,7 @@ {{ 'language' | translate }} - #todo WITH SPARQL + @@ -177,15 +177,15 @@ {{ 'record type' | translate }} - #todo WITH SPARQL + {{ 'is document part' | translate }} - #todo checkbox + {{ 'is multilingual' | translate }} - #todo checkbox + diff -r 305f9fcd409b -r 8433e12362e0 src/p4l/templates/p4l/translations.html --- a/src/p4l/templates/p4l/translations.html Tue Sep 10 16:54:29 2013 +0200 +++ b/src/p4l/templates/p4l/translations.html Tue Sep 10 17:51:25 2013 +0200 @@ -2,9 +2,12 @@ {% trans 'Add' %} {% trans 'Save' %} +{% trans 'Update' %} {% trans 'Add a new subject' %} {% trans 'Add a new theme' %} {% trans 'Add a new country' %} {% trans 'Add a new language' %} {% trans 'Add a new project' %} -{% trans 'Add a new organisation' %} \ No newline at end of file +{% trans 'Add a new organization' %} +{% trans 'Modify the language' %} +{% trans 'Modify the record type' %} \ No newline at end of file diff -r 305f9fcd409b -r 8433e12362e0 src/p4l/views.py --- a/src/p4l/views.py Tue Sep 10 16:54:29 2013 +0200 +++ b/src/p4l/views.py Tue Sep 10 17:51:25 2013 +0200 @@ -169,6 +169,13 @@ 'datarootquery': settings.SPARQL_ORGANIZATION_QUERIES["root"], 'datachildsquery': "", 'datachildcountquery': "" + }, + 'types' : { + 'dataurl': settings.SPARQL_QUERY_ENDPOINT, + 'dataquery': settings.SPARQL_TYPE_QUERIES["filter"] % (lang, lang), + 'datarootquery': settings.SPARQL_TYPE_QUERIES["root"] % lang, + 'datachildsquery': "", + 'datachildcountquery': "" } } context['query_dicts'] = json.dumps(query_dicts)