v1.52.3 : enhancements on mdp for group page. V01.52.03
authorcavaliet
Thu, 06 Feb 2014 14:51:58 +0100
changeset 1284 a799cc823285
parent 1283 85cc73d6f152
child 1285 efe2907f38c5
v1.52.3 : enhancements on mdp for group page.
src/ldt/ldt/__init__.py
src/ldt/ldt/ldt_utils/templates/front/front_player.html
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html
src/ldt/ldt/static/ldt/metadataplayer/Annotation.js
src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js
src/ldt/ldt/static/ldt/metadataplayer/Segments.js
src/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js
--- a/src/ldt/ldt/__init__.py	Fri Jan 03 17:38:41 2014 +0100
+++ b/src/ldt/ldt/__init__.py	Thu Feb 06 14:51:58 2014 +0100
@@ -1,6 +1,6 @@
 __all__ = ["VERSION", "get_version", "__version__"]
 
-VERSION = (1, 52, 2, "final", 0)
+VERSION = (1, 52, 3, "final", 0)
 
 
 def get_version():
--- a/src/ldt/ldt/ldt_utils/templates/front/front_player.html	Fri Jan 03 17:38:41 2014 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_player.html	Thu Feb 06 14:51:58 2014 +0100
@@ -54,7 +54,19 @@
 </div>
 
 <!-- Right column -->
-<div id="player_col_d">
+{% if toggle_multisegments %}
+<div id="player_col_d" style="width: 854px;">
+    <div id="TagcloudContainer" class="ext_widget" style="float:right;"></div>
+    <div id="Slideshare_ext" class="ext_widget">
+    </div>
+    <div class="li_h2">
+        <h2>{% trans 'All annotations on the media' %}</h2>
+    </div>
+    <div id="AnnotationsList_ext" class="ext_widget"></div>
+    <div id="Social_ext"></div>
+</div>
+{% else %}
+<div id="player_col_d" >
     <div id="Social_ext"></div>
     <div id="Slideshare_ext" class="ext_widget">
     </div>
@@ -63,5 +75,6 @@
     </div>
     <div id="AnnotationsList_ext" class="ext_widget"></div>
 </div>
+{% endif %}
 {% endblock %}
 
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Fri Jan 03 17:38:41 2014 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Thu Feb 06 14:51:58 2014 +0100
@@ -106,6 +106,15 @@
             url: document.location.href.replace(/#.*$/,""),
             text: document.title
         }
+        {% if toggle_multisegments %},{
+            type: "Tagcloud",
+            container: "TagcloudContainer",
+            include_titles: false,
+            include_descriptions: false,
+            min_count: 0,
+            tag_count: 100
+        }
+        {% endif %}
     ]
 };
 
--- a/src/ldt/ldt/static/ldt/metadataplayer/Annotation.js	Fri Jan 03 17:38:41 2014 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Annotation.js	Thu Feb 06 14:51:58 2014 +0100
@@ -126,6 +126,7 @@
         }
         if (_this.show_annotation_type) {
             _this.$.find(".Ldt-Annotation-Type").text(_annotation.getAnnotationType().title);
+            _this.$.find(".Ldt-Annotation-Type").attr("title", _annotation.getAnnotationType().description);
         }
         _this.$.find(".Ldt-Annotation-Begin").text(_annotation.begin.toString());
         _this.$.find(".Ldt-Annotation-End").text(_annotation.end.toString());
--- a/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js	Fri Jan 03 17:38:41 2014 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js	Thu Feb 06 14:51:58 2014 +0100
@@ -458,6 +458,26 @@
     return res;
 };
 
+List.prototype.searchByTags = function(_text) {
+    if (!_text) {
+        this.trigger("clear-search");
+        return this;
+    }
+    this.searching = true;
+    this.trigger("search", _text);
+    var rxsource = fullTextRegexps(_text),
+        rgxp = new RegExp(rxsource,"im");
+    this.regexp = new RegExp(rxsource,"gim");
+    var res = this.filter(function(_element, _k) {
+        var _isfound = rgxp.test(_element.getTagTexts());
+        _element.found = _isfound;
+        _element.trigger(_isfound ? "found" : "not-found");
+        return _isfound;
+    });
+    this.trigger(res.length ? "found" : "not-found",res);
+    return res;
+};
+
 List.prototype.getTitles = function() {
     return this.map(function(_el) {
         return _el.title;
--- a/src/ldt/ldt/static/ldt/metadataplayer/Segments.js	Fri Jan 03 17:38:41 2014 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Segments.js	Thu Feb 06 14:51:58 2014 +0100
@@ -77,7 +77,7 @@
             color : color,
             medcolor: medcolor,
             lowcolor: lowcolor,
-            text: _fulltext.replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{120,140})[\s].+$/m,'$1&hellip;'),
+            text: (_annotation.creator ? (_annotation.creator + " : ") : "" ) + _fulltext.replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{120,140})[\s].+$/m,'$1&hellip;'),
             left : _left,
             width : _width,
             top: _top,
--- a/src/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js	Fri Jan 03 17:38:41 2014 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js	Thu Feb 06 14:51:58 2014 +0100
@@ -21,7 +21,8 @@
     annotation_type: false,
     segment_annotation_type: false,
     min_font_size: 10,
-    max_font_size: 26
+    max_font_size: 26,
+    min_count: 2
 };
 
 IriSP.Widgets.Tagcloud.prototype.stopword_lists = {
@@ -54,7 +55,7 @@
 
 IriSP.Widgets.Tagcloud.prototype.redraw = function(_from, _to) {
     var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g,
-        _regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g,
+        _regexpword = /[^\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g,
         _words = {},
         _this = this,
         _annotations = this.getWidgetAnnotations();
@@ -64,7 +65,6 @@
             return _annotation.begin >= _from && _annotation.end <= _to;
         });
     }
-    
     _annotations.forEach(function(_annotation) {
        var _txt =
             (_this.include_titles ? _annotation.title : '')
@@ -73,6 +73,7 @@
             + ' '
             + (_this.include_tag_texts ? _annotation.getTagTexts() : '');
        IriSP._(_txt.toLowerCase().replace(_urlRegExp, '').match(_regexpword)).each(function(_word) {
+    	   _word = _word.trim();
            if (IriSP._(_this.stopwords).indexOf(_word) == -1 && (!_this.exclude_pattern || !_this.exclude_pattern.test(_word))) {
                _words[_word] = 1 + (_words[_word] || 0);
            }
@@ -87,7 +88,7 @@
             };
         })
         .filter(function(_v) {
-            return _v.count > 2;
+            return _v.count > _this.min_count;
         })
         .sortBy(function(_v) {
             return - _v.count;
@@ -105,7 +106,7 @@
     this.$.html(Mustache.to_html(this.template,  {words: _words }));
     this.$.find(".Ldt-Tagcloud-item").click(function() {
         var _txt = IriSP.jQuery(this).attr("content");
-        _this.source.getAnnotations().search(_txt);
+        _this.source.getAnnotations().searchByTags(_txt);
     });
     this.source.getAnnotations().on("search", this.functionWrapper("onSearch"));
     this.source.getAnnotations().on("search-cleared", this.functionWrapper("onSearch"));