add audiences
authorcavaliet
Wed, 18 Sep 2013 16:49:58 +0200
changeset 99 0d54489e8b26
parent 98 7b6ca4ca3f67
child 100 5b076700ac05
add audiences
src/p4l/locale/en/LC_MESSAGES/django.po
src/p4l/locale/es/LC_MESSAGES/django.po
src/p4l/locale/fr/LC_MESSAGES/django.mo
src/p4l/locale/fr/LC_MESSAGES/django.po
src/p4l/settings.py
src/p4l/static/p4l/css/semantictree.css
src/p4l/static/p4l/templates/addSemanticUriForm.html
src/p4l/templates/p4l/p4l_record_view.html
src/p4l/templates/p4l/record_update_form.html
src/p4l/templates/p4l/translations.html
src/p4l/views.py
--- a/src/p4l/locale/en/LC_MESSAGES/django.po	Wed Sep 18 15:51:57 2013 +0200
+++ b/src/p4l/locale/en/LC_MESSAGES/django.po	Wed Sep 18 16:49:58 2013 +0200
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-09-16 09:15-0500\n"
+"POT-Creation-Date: 2013-09-18 09:42-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -123,23 +123,23 @@
 msgstr "View"
 
 #: templates/p4l/p4l_record_view.html:10
-#: templates/p4l/p4l_record_view.html:225 templates/p4l/translations.html:20
+#: templates/p4l/p4l_record_view.html:236 templates/p4l/translations.html:21
 #, fuzzy
 msgid "Edit the record"
 msgstr "Modify the record type"
 
 #: templates/p4l/p4l_record_view.html:11
-#: templates/p4l/p4l_record_view.html:226
+#: templates/p4l/p4l_record_view.html:237
 #: templates/p4l/record_update_form.html:48
-#: templates/p4l/record_update_form.html:224
+#: templates/p4l/record_update_form.html:236
 msgid ""
 "Are your sure you want to delete this record ? This action est irreversible."
 msgstr ""
 
 #: templates/p4l/p4l_record_view.html:11
-#: templates/p4l/p4l_record_view.html:226
+#: templates/p4l/p4l_record_view.html:237
 #: templates/p4l/record_update_form.html:48
-#: templates/p4l/record_update_form.html:224
+#: templates/p4l/record_update_form.html:236
 #, fuzzy
 msgid "Delete the record"
 msgstr "Modify the record type"
@@ -289,36 +289,45 @@
 msgstr "corporate authors"
 
 #: templates/p4l/p4l_record_view.html:195
+#, fuzzy
+msgid "corporate author label"
+msgstr "corporate authors"
+
+#: templates/p4l/p4l_record_view.html:199
 msgid "Urls"
 msgstr "Urls"
 
-#: templates/p4l/p4l_record_view.html:201
+#: templates/p4l/p4l_record_view.html:205
 msgid "Address"
 msgstr "Address"
 
-#: templates/p4l/p4l_record_view.html:202
+#: templates/p4l/p4l_record_view.html:206
 msgid "Display"
 msgstr "Display"
 
-#: templates/p4l/p4l_record_view.html:203
-msgid "Access level"
-msgstr "Access level"
-
-#: templates/p4l/p4l_record_view.html:211
+#: templates/p4l/p4l_record_view.html:214
 msgid "record type"
 msgstr "record type"
 
-#: templates/p4l/p4l_record_view.html:215
+#: templates/p4l/p4l_record_view.html:218
+msgid "audiences"
+msgstr ""
+
+#: templates/p4l/p4l_record_view.html:222
 msgid "is document part"
 msgstr "is document part"
 
-#: templates/p4l/p4l_record_view.html:219
-msgid "is multilingual"
-msgstr "is multilingual"
+#: templates/p4l/p4l_record_view.html:226
+msgid "is hidden"
+msgstr ""
+
+#: templates/p4l/p4l_record_view.html:230
+msgid "is restricted"
+msgstr ""
 
 #: templates/p4l/record_update_form.html:47
-#: templates/p4l/record_update_form.html:223
-#: templates/p4l/translations.html:19
+#: templates/p4l/record_update_form.html:235
+#: templates/p4l/translations.html:20
 #, fuzzy
 msgid "View the record"
 msgstr "Modify the record type"
@@ -360,30 +369,35 @@
 msgstr "Add a new organization"
 
 #: templates/p4l/translations.html:12
+#, fuzzy
+msgid "Add a new audience"
+msgstr "Add a new subject"
+
+#: templates/p4l/translations.html:13
 msgid "Modify the language"
 msgstr "Modify the language"
 
-#: templates/p4l/translations.html:13
+#: templates/p4l/translations.html:14
 msgid "Modify the record type"
 msgstr "Modify the record type"
 
-#: templates/p4l/translations.html:14
+#: templates/p4l/translations.html:15
 msgid "title"
 msgstr "title"
 
-#: templates/p4l/translations.html:15
+#: templates/p4l/translations.html:16
 msgid "abstract"
 msgstr "abstract"
 
-#: templates/p4l/translations.html:16
+#: templates/p4l/translations.html:17
 msgid "collation"
 msgstr "collation"
 
-#: templates/p4l/translations.html:17
+#: templates/p4l/translations.html:18
 msgid "label"
 msgstr "label"
 
-#: templates/p4l/translations.html:18
+#: templates/p4l/translations.html:19
 msgid "name"
 msgstr "name"
 
@@ -398,3 +412,9 @@
 #: templates/registration/login.html:20 templates/registration/login.html:22
 msgid "Password"
 msgstr "Password"
+
+#~ msgid "Access level"
+#~ msgstr "Access level"
+
+#~ msgid "is multilingual"
+#~ msgstr "is multilingual"
--- a/src/p4l/locale/es/LC_MESSAGES/django.po	Wed Sep 18 15:51:57 2013 +0200
+++ b/src/p4l/locale/es/LC_MESSAGES/django.po	Wed Sep 18 16:49:58 2013 +0200
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-09-16 09:15-0500\n"
+"POT-Creation-Date: 2013-09-18 09:42-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -124,23 +124,23 @@
 msgstr "View"
 
 #: templates/p4l/p4l_record_view.html:10
-#: templates/p4l/p4l_record_view.html:225 templates/p4l/translations.html:20
+#: templates/p4l/p4l_record_view.html:236 templates/p4l/translations.html:21
 #, fuzzy
 msgid "Edit the record"
 msgstr "Modify the record type"
 
 #: templates/p4l/p4l_record_view.html:11
-#: templates/p4l/p4l_record_view.html:226
+#: templates/p4l/p4l_record_view.html:237
 #: templates/p4l/record_update_form.html:48
-#: templates/p4l/record_update_form.html:224
+#: templates/p4l/record_update_form.html:236
 msgid ""
 "Are your sure you want to delete this record ? This action est irreversible."
 msgstr ""
 
 #: templates/p4l/p4l_record_view.html:11
-#: templates/p4l/p4l_record_view.html:226
+#: templates/p4l/p4l_record_view.html:237
 #: templates/p4l/record_update_form.html:48
-#: templates/p4l/record_update_form.html:224
+#: templates/p4l/record_update_form.html:236
 #, fuzzy
 msgid "Delete the record"
 msgstr "Modify the record type"
@@ -290,36 +290,45 @@
 msgstr "corporate authors"
 
 #: templates/p4l/p4l_record_view.html:195
+#, fuzzy
+msgid "corporate author label"
+msgstr "corporate authors"
+
+#: templates/p4l/p4l_record_view.html:199
 msgid "Urls"
 msgstr "Urls"
 
-#: templates/p4l/p4l_record_view.html:201
+#: templates/p4l/p4l_record_view.html:205
 msgid "Address"
 msgstr "Address"
 
-#: templates/p4l/p4l_record_view.html:202
+#: templates/p4l/p4l_record_view.html:206
 msgid "Display"
 msgstr "Display"
 
-#: templates/p4l/p4l_record_view.html:203
-msgid "Access level"
-msgstr "Access level"
-
-#: templates/p4l/p4l_record_view.html:211
+#: templates/p4l/p4l_record_view.html:214
 msgid "record type"
 msgstr "record type"
 
-#: templates/p4l/p4l_record_view.html:215
+#: templates/p4l/p4l_record_view.html:218
+msgid "audiences"
+msgstr ""
+
+#: templates/p4l/p4l_record_view.html:222
 msgid "is document part"
 msgstr "is document part"
 
-#: templates/p4l/p4l_record_view.html:219
-msgid "is multilingual"
-msgstr "is multilingual"
+#: templates/p4l/p4l_record_view.html:226
+msgid "is hidden"
+msgstr ""
+
+#: templates/p4l/p4l_record_view.html:230
+msgid "is restricted"
+msgstr ""
 
 #: templates/p4l/record_update_form.html:47
-#: templates/p4l/record_update_form.html:223
-#: templates/p4l/translations.html:19
+#: templates/p4l/record_update_form.html:235
+#: templates/p4l/translations.html:20
 #, fuzzy
 msgid "View the record"
 msgstr "Modify the record type"
@@ -361,30 +370,35 @@
 msgstr "Add a new organization"
 
 #: templates/p4l/translations.html:12
+#, fuzzy
+msgid "Add a new audience"
+msgstr "Add a new subject"
+
+#: templates/p4l/translations.html:13
 msgid "Modify the language"
 msgstr "Modify the language"
 
-#: templates/p4l/translations.html:13
+#: templates/p4l/translations.html:14
 msgid "Modify the record type"
 msgstr "Modify the record type"
 
-#: templates/p4l/translations.html:14
+#: templates/p4l/translations.html:15
 msgid "title"
 msgstr "title"
 
-#: templates/p4l/translations.html:15
+#: templates/p4l/translations.html:16
 msgid "abstract"
 msgstr "abstract"
 
-#: templates/p4l/translations.html:16
+#: templates/p4l/translations.html:17
 msgid "collation"
 msgstr "collation"
 
-#: templates/p4l/translations.html:17
+#: templates/p4l/translations.html:18
 msgid "label"
 msgstr "label"
 
-#: templates/p4l/translations.html:18
+#: templates/p4l/translations.html:19
 msgid "name"
 msgstr "name"
 
@@ -399,3 +413,9 @@
 #: templates/registration/login.html:20 templates/registration/login.html:22
 msgid "Password"
 msgstr "Password"
+
+#~ msgid "Access level"
+#~ msgstr "Access level"
+
+#~ msgid "is multilingual"
+#~ msgstr "is multilingual"
Binary file src/p4l/locale/fr/LC_MESSAGES/django.mo has changed
--- a/src/p4l/locale/fr/LC_MESSAGES/django.po	Wed Sep 18 15:51:57 2013 +0200
+++ b/src/p4l/locale/fr/LC_MESSAGES/django.po	Wed Sep 18 16:49:58 2013 +0200
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-09-16 09:15-0500\n"
+"POT-Creation-Date: 2013-09-18 09:42-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -135,24 +135,24 @@
 msgstr "Vue"
 
 #: templates/p4l/p4l_record_view.html:10
-#: templates/p4l/p4l_record_view.html:225
-#: templates/p4l/translations.html:20
+#: templates/p4l/p4l_record_view.html:236
+#: templates/p4l/translations.html:21
 msgid "Edit the record"
 msgstr "Modifier la notice"
 
 #: templates/p4l/p4l_record_view.html:11
-#: templates/p4l/p4l_record_view.html:226
+#: templates/p4l/p4l_record_view.html:237
 #: templates/p4l/record_update_form.html:48
-#: templates/p4l/record_update_form.html:224
+#: templates/p4l/record_update_form.html:236
 msgid ""
 "Are your sure you want to delete this record ? This action est irreversible."
 msgstr "Êtes-vous sûr sur vouloir effacer cette notice ? Cette action est "
 "irréversible."
 
 #: templates/p4l/p4l_record_view.html:11
-#: templates/p4l/p4l_record_view.html:226
+#: templates/p4l/p4l_record_view.html:237
 #: templates/p4l/record_update_form.html:48
-#: templates/p4l/record_update_form.html:224
+#: templates/p4l/record_update_form.html:236
 msgid "Delete the record"
 msgstr "Effacer la notice"
 
@@ -301,36 +301,44 @@
 msgstr "entités auteurs"
 
 #: templates/p4l/p4l_record_view.html:195
+msgid "corporate author label"
+msgstr "Libellé de l'auteur institutionnel"
+
+#: templates/p4l/p4l_record_view.html:199
 msgid "Urls"
 msgstr "Urls"
 
-#: templates/p4l/p4l_record_view.html:201
+#: templates/p4l/p4l_record_view.html:205
 msgid "Address"
 msgstr "Adresse"
 
-#: templates/p4l/p4l_record_view.html:202
+#: templates/p4l/p4l_record_view.html:206
 msgid "Display"
 msgstr "Affichage"
 
-#: templates/p4l/p4l_record_view.html:203
-msgid "Access level"
-msgstr "Niveau d'accès"
-
-#: templates/p4l/p4l_record_view.html:211
+#: templates/p4l/p4l_record_view.html:214
 msgid "record type"
 msgstr "type de notice"
 
-#: templates/p4l/p4l_record_view.html:215
+#: templates/p4l/p4l_record_view.html:218
+msgid "audiences"
+msgstr "audiences"
+
+#: templates/p4l/p4l_record_view.html:222
 msgid "is document part"
 msgstr "document partiel"
 
-#: templates/p4l/p4l_record_view.html:219
-msgid "is multilingual"
-msgstr "multilingue"
+#: templates/p4l/p4l_record_view.html:226
+msgid "is hidden"
+msgstr "caché"
+
+#: templates/p4l/p4l_record_view.html:230
+msgid "is restricted"
+msgstr "restreint"
 
 #: templates/p4l/record_update_form.html:47
-#: templates/p4l/record_update_form.html:223
-#: templates/p4l/translations.html:19
+#: templates/p4l/record_update_form.html:235
+#: templates/p4l/translations.html:20
 msgid "View the record"
 msgstr "Voir la notice"
 
@@ -371,30 +379,34 @@
 msgstr "Ajouter une nouvelle organisation"
 
 #: templates/p4l/translations.html:12
+msgid "Add a new audience"
+msgstr "Ajouter une nouvelle audience"
+
+#: templates/p4l/translations.html:13
 msgid "Modify the language"
 msgstr "Modifier la langue"
 
-#: templates/p4l/translations.html:13
+#: templates/p4l/translations.html:14
 msgid "Modify the record type"
 msgstr "Modifier le type de notice"
 
-#: templates/p4l/translations.html:14
+#: templates/p4l/translations.html:15
 msgid "title"
 msgstr "titre"
 
-#: templates/p4l/translations.html:15
+#: templates/p4l/translations.html:16
 msgid "abstract"
 msgstr "résumé"
 
-#: templates/p4l/translations.html:16
+#: templates/p4l/translations.html:17
 msgid "collation"
 msgstr "pagination"
 
-#: templates/p4l/translations.html:17
+#: templates/p4l/translations.html:18
 msgid "label"
 msgstr "label"
 
-#: templates/p4l/translations.html:18
+#: templates/p4l/translations.html:19
 msgid "name"
 msgstr "Nom"
 
--- a/src/p4l/settings.py	Wed Sep 18 15:51:57 2013 +0200
+++ b/src/p4l/settings.py	Wed Sep 18 16:49:58 2013 +0200
@@ -506,7 +506,12 @@
 ORDER BY ?label
 """
 }
-
+SPARQL_AUDIENCE_QUERIES = {
+"filter" : "",
+"root" : "",
+"childs" : "",
+"child-count" : ""
+}
 
 REST_FRAMEWORK = {
     # Use hyperlinked styles by default.
--- a/src/p4l/static/p4l/css/semantictree.css	Wed Sep 18 15:51:57 2013 +0200
+++ b/src/p4l/static/p4l/css/semantictree.css	Wed Sep 18 16:49:58 2013 +0200
@@ -19,6 +19,9 @@
 ul .ui-autocomplete {
     max-height: 300px;
 }
+.thin-button{
+	padding-top: 3px;
+}
 /*
 .ng-scope {
     border: 1px dashed red;
--- a/src/p4l/static/p4l/templates/addSemanticUriForm.html	Wed Sep 18 15:51:57 2013 +0200
+++ b/src/p4l/static/p4l/templates/addSemanticUriForm.html	Wed Sep 18 16:49:58 2013 +0200
@@ -10,15 +10,15 @@
 	    <div class="form-group col-md-8">
 	        <input id="id_{{ $id }}" ng-model="addUriText" class="semantic-tree form-control col-md-10" type="text" placeholder="{{ placeholder }}"
 	               data-url="{{ dataurl }}" data-query="{{ dataquery }}" data-root-query="{{ datarootquery }}"
-	               data-childs-query="{{ datachildsquery }}" data-child-count-query="{{ datachildcountquery }}" />
+	               data-childs-query="{{ datachildsquery }}" data-child-count-query="{{ datachildcountquery }}" ng-disabled="dataquery==''" />
 	        {{ 'or' | translate}}
 	        <span id="dialog-link-container-{{ $id }}" class="dialog-link-container ui-state-default ui-corner-all">
-	            <a href="#" id="dialog-link-{{ $id }}" class="btn dialog-link" title="Browse">{{'Browse' | translate}}</a>
+	            <a href="#" id="dialog-link-{{ $id }}" class="btn dialog-link thin-button" title="Browse" ng-class="{disabled: datarootquery==''}" >{{'Browse' | translate}}</a>
 	        </span>
 	        <span id="dialog-{{ $id }}" class="dialog" title="Select term"><span id="term-tree-{{ $id }}"></span></span>
 	    </div>
 	    <div class="form-group">
-	        <button type="submit" class="btn btn-primary" ng-click="addUriToList()">{{'Add' | translate}}</button>
+	        <button type="submit" class="btn btn-primary" ng-click="addUriToList()" ng-class="{disabled: dataquery==''}">{{'Add' | translate}}</button>
 	    </div>
 	</form>
 </div>
\ No newline at end of file
--- a/src/p4l/templates/p4l/p4l_record_view.html	Wed Sep 18 15:51:57 2013 +0200
+++ b/src/p4l/templates/p4l/p4l_record_view.html	Wed Sep 18 16:49:58 2013 +0200
@@ -215,6 +215,10 @@
       <td>{{ recordType_label }} <small class="text-muted">({{ record.recordType|default:'' }})</small></td>
     </tr>
     <tr>
+      <td>{% trans 'audiences' %}</td>
+      <td><ul>{% for k,v in audiences_labels.items %}<li>{{ v }} <small class="text-muted">({{ k }})</small></li>{% endfor %}</ul></td>
+    </tr>
+    <tr>
       <td>{% trans 'is document part' %}</td>
       <td><input type="checkbox" disabled="disabled" {% if record.isDocumentPart %}checked="checked"{% endif %} /></td>
     </tr>
--- a/src/p4l/templates/p4l/record_update_form.html	Wed Sep 18 15:51:57 2013 +0200
+++ b/src/p4l/templates/p4l/record_update_form.html	Wed Sep 18 16:49:58 2013 +0200
@@ -203,6 +203,10 @@
       <td><simple-sem-uri val="record.recordType" listname="types" placeholder="{{'Modify the record type' | translate}}"></simple-sem-uri></td>
     </tr>
     <tr>
+      <td>{{ 'audiences' | translate }}</td>
+      <td><add-sem-uri list="record.audiences" listname="audiences" placeholder="{{'Add a new audience' | translate}}"></add-sem-uri></td>
+    </tr>
+    <tr>
       <td>{{ 'is document part' | translate }}</td>
       <td><input type="checkbox" ng-model="record.isDocumentPart" /></td>
     </tr>
--- a/src/p4l/templates/p4l/translations.html	Wed Sep 18 15:51:57 2013 +0200
+++ b/src/p4l/templates/p4l/translations.html	Wed Sep 18 16:49:58 2013 +0200
@@ -9,6 +9,7 @@
 {% trans 'Add a new language' %}
 {% trans 'Add a new project' %}
 {% trans 'Add a new organization' %}
+{% trans 'Add a new audience' %}
 {% trans 'Modify the language' %}
 {% trans 'Modify the record type' %}
 {% trans 'title' %}
--- a/src/p4l/views.py	Wed Sep 18 15:51:57 2013 +0200
+++ b/src/p4l/views.py	Wed Sep 18 16:49:58 2013 +0200
@@ -96,6 +96,11 @@
             uri_list = [self.object.recordType]
             uris_labels = get_labels_for_uris(uri_list, "http://www.iiep.unesco.org/plan4learning/scheme/DocumentType", lang, False)
             context['recordType_label'] = uris_labels[self.object.recordType]
+        # Here, in the future, there will be the request for audiences thesaurus
+        context['audiences_labels'] = {}
+        #uri_list = [s.uri for s in self.object.audiences.all()]
+        #uris_labels = get_labels_for_uris(uri_list, "http://www.iiep.unesco.org/plan4learning/scheme/Audiences", lang, False)
+        #context['audiences_labels'] = uris_labels
         
         return context
 
@@ -176,6 +181,13 @@
                 'datarootquery': settings.SPARQL_TYPE_QUERIES["root"] % lang,
                 'datachildsquery': "",
                 'datachildcountquery': ""
+            },
+            'audiences': {
+                'dataurl': settings.SPARQL_QUERY_ENDPOINT,
+                'dataquery': settings.SPARQL_AUDIENCE_QUERIES["filter"],
+                'datarootquery': settings.SPARQL_AUDIENCE_QUERIES["root"],
+                'datachildsquery': settings.SPARQL_AUDIENCE_QUERIES["childs"],
+                'datachildcountquery': settings.SPARQL_AUDIENCE_QUERIES["child-count"]
             }
         }
         context['query_dicts'] = json.dumps(query_dicts)