v1.52.4 : correct enhancements on mdp for group page. V01.52.04
authorcavaliet
Thu, 06 Feb 2014 16:23:01 +0100
changeset 1286 2bbc6c42ca9a
parent 1285 efe2907f38c5
child 1287 dd56e83e83f0
v1.52.4 : correct 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/ldt_utils/views/front.py
src/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js
--- a/src/ldt/ldt/__init__.py	Thu Feb 06 14:52:09 2014 +0100
+++ b/src/ldt/ldt/__init__.py	Thu Feb 06 16:23:01 2014 +0100
@@ -1,6 +1,6 @@
 __all__ = ["VERSION", "get_version", "__version__"]
 
-VERSION = (1, 52, 3, "final", 0)
+VERSION = (1, 52, 4, "final", 0)
 
 
 def get_version():
--- a/src/ldt/ldt/ldt_utils/templates/front/front_player.html	Thu Feb 06 14:52:09 2014 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_player.html	Thu Feb 06 16:23:01 2014 +0100
@@ -12,7 +12,7 @@
 <link rel="stylesheet" href='{% static "ldt/css/jq-css/jquery.qtip.css" %}' type="text/css"/>
 {% if toggle_multisegments %}
 <style type="text/css">
-	#{{player_id}}_embed_widget_MultiSegments_11 {
+	#{{player_id}}_embed_widget_MultiSegments_11, #TagcloudContainer {
 	    display: none;
 	}
 </style>
@@ -31,9 +31,12 @@
             $j("#search_submit").addClass('search_invalid').removeClass('search_valid');
             $j("#search_submit").attr('disabled', 'disabled');
         });
+      {% if toggle_multisegments %}
         $j(".toggle_multisegments").click(function () {
         	$j("#{{player_id}}_embed_widget_MultiSegments_11").toggle();
+        	$j("#TagcloudContainer").toggle();
         });
+      {% endif %}
     });
 </script>
 {% endblock %}
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Thu Feb 06 14:52:09 2014 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Thu Feb 06 16:23:01 2014 +0100
@@ -112,7 +112,8 @@
             include_titles: false,
             include_descriptions: false,
             min_count: 0,
-            tag_count: 100
+            tag_count: 100,
+            remove_zero_duration: {% if remove_zero_duration %}true{% else %}false{% endif %}
         }
         {% endif %}
     ]
--- a/src/ldt/ldt/ldt_utils/views/front.py	Thu Feb 06 14:52:09 2014 +0100
+++ b/src/ldt/ldt/ldt_utils/views/front.py	Thu Feb 06 16:23:01 2014 +0100
@@ -212,6 +212,11 @@
     group_id = request.GET.get("group")
     if group_id is not None :
         json_url += "?group=" + group_id
+    # add parameter to remove segment with duration = 0
+    remove_zero_duration = False
+    remove_zero_param = request.GET.get("remove_zero_duration")
+    if remove_zero_param is not None :
+        remove_zero_duration = {'true': True, 'false': False, "0": False, "1": True}.get(remove_zero_param.lower())
     
     player_width = 854
     player_height = 480
@@ -223,7 +228,7 @@
     return render_to_response("front/front_player.html",
                               {'content': content, 'player_id': player_id, 
                               'json_url': json_url, 'player_width':player_width, 'player_height':player_height, 'stream_mode':stream_mode, 'external_url':external_url,
-                               'is_gecko': is_gecko, 'annotation_block':annotation_block, 'toggle_multisegments':True},
+                               'is_gecko': is_gecko, 'annotation_block':annotation_block, 'toggle_multisegments':True, 'remove_zero_duration':remove_zero_duration},
                               context_instance=RequestContext(request))
 
 
--- a/src/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js	Thu Feb 06 14:52:09 2014 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js	Thu Feb 06 16:23:01 2014 +0100
@@ -22,7 +22,8 @@
     segment_annotation_type: false,
     min_font_size: 10,
     max_font_size: 26,
-    min_count: 2
+    min_count: 2,
+    remove_zero_duration: false
 };
 
 IriSP.Widgets.Tagcloud.prototype.stopword_lists = {
@@ -55,16 +56,29 @@
 
 IriSP.Widgets.Tagcloud.prototype.redraw = function(_from, _to) {
     var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g,
-        _regexpword = /[^\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g,
         _words = {},
         _this = this,
         _annotations = this.getWidgetAnnotations();
+    
+    if(!this.include_titles && !this.include_descriptions){
+    	var _regexpword = /[^\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»\/]{3,}/g;
+    }
+    else{
+    	var _regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g;
+    }
         
     if (typeof _from !== "undefined" && typeof _to !== "undefined") {
         _annotations = _annotations.filter(function(_annotation) {
             return _annotation.begin >= _from && _annotation.end <= _to;
         });
     }
+    
+    if(this.remove_zero_duration){
+    	_annotations = _annotations.filter(function(_annotation) {
+	        return _annotation.getDuration()>0;
+	    });
+    }
+    
     _annotations.forEach(function(_annotation) {
        var _txt =
             (_this.include_titles ? _annotation.title : '')