# HG changeset patch # User ymh # Date 1328542583 -3600 # Node ID 005a74eaf91a7fca925b0d51737f6819ea86596b # Parent fe030de531a63f96d6933bc8497698ae4833ecc1# Parent 8589160ac9e3196bf12d2093e469b512b6f86083 Merge with 8589160ac9e3196bf12d2093e469b512b6f86083 diff -r fe030de531a6 -r 005a74eaf91a src/ldt/ldt/ldt_utils/admin.py --- a/src/ldt/ldt/ldt_utils/admin.py Mon Feb 06 15:02:21 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/admin.py Mon Feb 06 16:36:23 2012 +0100 @@ -6,6 +6,7 @@ from ldt.ldt_utils.fileimport import FileImport, FileImportError from ldt.ldt_utils.forms import LdtImportForm, ReindexForm, StatAnnotationForm from ldt.ldt_utils.models import Content, Project, Media, Author +from ldt.ldt_utils.stat import update_stat_content import ldt.indexation from guardian.admin import GuardedModelAdmin @@ -89,13 +90,13 @@ if form.is_valid(): if form.cleaned_data['choose_all']: - projects = Content.objects.all() + contents = Content.objects.all() else: - projects = form.cleaned_data['projects'] + contents = form.cleaned_data['contents'] -# for content in contents: -# compute_stats_for(content) - message = "Stats computed for :" + repr(projects) + for content in contents: + update_stat_content(content) + message = "Stats computed for :" + repr(contents) else: form = StatAnnotationForm() diff -r fe030de531a6 -r 005a74eaf91a src/ldt/ldt/ldt_utils/forms.py --- a/src/ldt/ldt/ldt_utils/forms.py Mon Feb 06 15:02:21 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/forms.py Mon Feb 06 16:36:23 2012 +0100 @@ -25,7 +25,7 @@ index_projects = forms.BooleanField(required=False, initial=False) class StatAnnotationForm(forms.Form): - projects = forms.ModelMultipleChoiceField(Project.objects.all()) + contents = forms.ModelMultipleChoiceField(Content.objects.all(), required=False) choose_all = forms.BooleanField(required=False, initial=False) class SearchForm(forms.Form): @@ -69,7 +69,7 @@ iriurl_data = "%s/%s.iri" % (iri_id_data, iri_id_data) cleaned_data['iriurl'] = iriurl_data # if needed, we add a comma to the tag list, to force comma separated list and enable tags with spaces. - if ',' not in cleaned_data['tags'] : + if ',' not in cleaned_data['tags'] and cleaned_data['tags']!="" : cleaned_data['tags'] = cleaned_data['tags'] + ',' return cleaned_data diff -r fe030de531a6 -r 005a74eaf91a src/ldt/ldt/static/ldt/js/LdtPlayer-release.js --- a/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js Mon Feb 06 15:02:21 2012 +0100 +++ b/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js Mon Feb 06 16:36:23 2012 +0100 @@ -1088,7 +1088,7 @@ }; IriSP.SparklineWidget_template = "
Loading
"; IriSP.annotation_template = "{{! template for an annotation displayed in a segmentWidget }}
"; -IriSP.annotationWidget_template = "{{! template for the annotation widget }}
"; +IriSP.annotationWidget_template = "{{! template for the annotation widget }}
"; IriSP.annotation_loading_template = "{{! template shown while the annotation widget is loading }}
 
Chargement...
"; IriSP.annotationsListWidget_template = "{{! template for the annotation list widget }}
"; IriSP.arrowWidget_template = "
"; @@ -2431,7 +2431,10 @@ if (IriSP.null_or_undefined(annotations)) return; + /* + commented in case we wanted to discriminate against some annotation types. var view_types = serializer.getIds("Contributions"); + */ var l = []; var media = this._serializer.currentMedia()["id"]; @@ -2525,6 +2528,7 @@ var begin = +annotation.begin / 1000; var end = +annotation.end / 1000; var duration = +this._serializer.currentMedia().meta["dc:duration"]; + var tags = ""; var title_templ = "{{title}} - ( {{begin}} - {{end}} )"; var endstr = Mustache.to_html(title_templ, {title: title, begin: IriSP.secondsToTime(begin), end: IriSP.secondsToTime(end)}); @@ -2532,6 +2536,28 @@ this.selector.find(".Ldt-SaTitle").text(endstr); this.selector.find(".Ldt-SaDescription").text(description); + + if (!IriSP.null_or_undefined(annotation.tags) && !IriSP.null_or_undefined(this._serializer._data.tags)) { + /* save the tag id and keywords in a unique structure */ + var tag_list = {}; + for (var i = 0; i < this._serializer._data.tags.length; i++) { + var id = this._serializer._data.tags[i]["id"]; + var keyword = this._serializer._data.tags[i]["meta"]["dc:title"]; + + tag_list[id] = keyword; + } + + /* then browse the list of defined tags for the current annotation */ + for (var i = 0; i < annotation.tags.length; i++) { + if (tag_list.hasOwnProperty(annotation.tags[i]["id-ref"])) + tags += tag_list[annotation.tags[i]["id-ref"]] + ", "; + } + } + + tags = "Keywords: " + tags.slice(0, tags.length - 2); + + this.selector.find(".Ldt-SaKeywords").text(tags); + // update sharing buttons var defaults = IriSP.widgetsDefaults.AnnotationsWidget; var text = defaults.share_text; @@ -5426,7 +5452,11 @@ name = name.toUpperCase(); var e; e = IriSP.underscore.find(this._data["annotation-types"], - function(entry) { return (entry["dc:title"].toUpperCase().indexOf(name) !== -1) }); + function(entry) { + if (IriSP.null_or_undefined(entry["dc:title"])) + return false; + + return (entry["dc:title"].toUpperCase().indexOf(name) !== -1) }); if (typeof(e) === "undefined") return; diff -r fe030de531a6 -r 005a74eaf91a web/static/media/.keepme diff -r fe030de531a6 -r 005a74eaf91a web/static/site/.keepme