change on the embed popup configuration to have a checkbox autostart
authorgrandjoncl
Fri, 08 Feb 2013 17:21:27 +0100
changeset 1097 9a75d5046c35
parent 1096 1ae23cea5c58
child 1098 5243cff1f293
change on the embed popup configuration to have a checkbox autostart
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_iframe.html
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_popup.html
src/ldt/ldt/ldt_utils/views/workspace.py
src/ldt/ldt/static/ldt/js/embed_popup.js
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_iframe.html	Fri Feb 08 16:44:17 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_iframe.html	Fri Feb 08 17:21:27 2013 +0100
@@ -70,7 +70,7 @@
 			                    },
 			            {% endif %}
 			            height: '{{ player_height }}',
-			            autostart: true
+			            autostart: {% if autostart %} true {% else %} false {% endif %}
 			        }  {% if polemic == 'all' or polemic == 'tweet' %},
 			        {
 			            type: "Polemic",
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_popup.html	Fri Feb 08 16:44:17 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_popup.html	Fri Feb 08 17:21:27 2013 +0100
@@ -111,6 +111,9 @@
 							<span class="title">{% trans 'Create your own configuration' %}</span>
 						</a><br>
 							<div id="embed_personnalisation" class="embedPersonnalisation">
+								<input type="checkbox" id="autostart_checkbox" value="autostart" onClick="put_new_code()">
+									<span class="infostooltip title" data-title="AutoStart" data-desc="{% trans 'The video starts automatically' %}">Autostart</span>	
+								</input><br>
 								<div id="createannotation_block">
 									<input type="checkbox" id="createannotation_checkbox" value="createannotation" onClick="put_new_code(); display_createannotation();" > 
 										<span class="infostooltip title" data-title="createAnnotation" data-desc="{% trans 'Displays a form to create a new annotation' %}">CreateAnnotation</span>
--- a/src/ldt/ldt/ldt_utils/views/workspace.py	Fri Feb 08 16:44:17 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/views/workspace.py	Fri Feb 08 17:21:27 2013 +0100
@@ -163,7 +163,10 @@
         else:
             rend_dict["polemic_qColor"] = "036aae"
             
-
+    if request.GET.has_key("autostart"):
+        rend_dict["autostart"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("autostart").lower())
+    else : 
+        rend_dict["autostart"] = True
     if request.GET.has_key("createannotation"):
         rend_dict["createannotation"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("createannotation").lower())
     if request.GET.has_key("show_mic_record"):
--- a/src/ldt/ldt/static/ldt/js/embed_popup.js	Fri Feb 08 16:44:17 2013 +0100
+++ b/src/ldt/ldt/static/ldt/js/embed_popup.js	Fri Feb 08 17:21:27 2013 +0100
@@ -40,6 +40,8 @@
 	$j("#sparkline_fill_color").val("#aeaeb8");
 	var type_embed=document.getElementById("type_embed_div");
 	type_embed.checked=true;
+	var autostart_val = document.getElementById("autostart_checkbox");
+	autostart_val.checked = true;
 	$j("#createannotation_options").toggle(false);
 	mode1();
 	
@@ -194,6 +196,7 @@
 
 function generate_widget_code(){
 	var annotationslist_val=document.getElementById('annotations_list_checkbox');
+	var autostart_val = document.getElementById('autostart_checkbox');
 	var slideshare_val=document.getElementById('slideshare_checkbox');
 	var social_val=document.getElementById('social_checkbox');
 	var annotation_val=document.getElementById('annotation_checkbox');
@@ -225,9 +228,17 @@
 	}
 	
 	widget_code+='\
-			height: '+player_height_val+',\n\
+			height: '+player_height_val+',\n';
+	if (autostart_val.checked){
+		widget_code+='\
 	        autostart: true\n\
 	    }';
+	}
+	else{
+		widget_code+='\
+	        autostart: false\n\
+	    }';
+	}
 	if (polemic_val.checked){	
 		defaultcolor= $j("#polemic_default_color").val();
 		foundcolor=$j("#polemic_found_color").val();
@@ -640,6 +651,7 @@
 
 function generate_iframeUrl(){
 	var createannotation_val=document.getElementById('createannotation_checkbox');
+	var autostart_val = document.getElementById('autostart_checkbox');
 	var annotationslist_val=document.getElementById('annotations_list_checkbox');
 	var slideshare_val=document.getElementById('slideshare_checkbox');
 	var social_val=document.getElementById('social_checkbox');
@@ -655,7 +667,9 @@
 		iframeUrl+="&player_height="+$j("#player_height").val();
 	if ($j("#player_width").val()!=550)
 		iframeUrl+="&player_width="+$j("#player_width").val();
-		
+	if(!autostart_val.checked){
+		iframeUrl+="&autostart=False";
+	}	
 	if(createannotation_val.checked){
 		iframeUrl+="&createannotation=True";
 		var show_mic_record_val = document.getElementById('show_mic_record_checkbox');