Radio button to choose between div and iframe embed code.
Embed code selected by default
Iframe embed code generated in javascript in the embed_popup template
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_popup.html Wed Oct 10 16:19:10 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_popup.html Wed Oct 10 17:55:18 2012 +0200
@@ -1,4 +1,5 @@
{% load i18n %}
+{% load set_var %}
{% load analytics %}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
@@ -21,37 +22,38 @@
<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/workspace.css" type="text/css"/>
<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/embed_popup.css" type="text/css"/>
<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/jq-css/jquery.qtip.css" type="text/css"/>
-
- <script type="text/javascript">
- $j(document).ready(function(){
- $j("#project_id_select").click(function(){
- $j("#project_id_input").focus();
- $j("#project_id_input").select();
- });
- });
- </script>
<script type="text/javascript">
- $j(document).ready(function(){
- $j("#player_button").click(function(){
- $j("#player_id_code").focus();
- $j("#player_id_code").select();
- $j("#iframe_player_id_code").focus();
- $j("#iframe_player_id_code").select();
-
- });
-
- $j("#seo_body_button").click(function(){
- $j("#seo_body_id_code").focus();
- $j("#seo_body_id_code").select();
- });
- $j("#seo_meta_button").click(function(){
- $j("#seo_meta_id_code").focus();
- $j("#seo_meta_id_code").select();
- });
- });
+ function iframe_event(){
+ var code_embed=document.getElementById("player_id_code");
+ iframeUrl= "{{iframe_url}}&polemic={{polemic}}&show_mic_record={{show_mic_record}}&annotations_list={{annotations_list}}";
+ player_width=570;
+ player_height=678;
+ frame = document.createElement("iframe");
+ frame.width = 570;
+ frame.height = 678;
+ frame.src = iframeUrl;
+ frame.frameBorder = 0;
+ frame.seamless = "seamless";
+ $j("#wrapper_{{player_id}}").html(frame);
+ iframe_code="<iframe src='"+iframeUrl+"' width='570' height='678' seamless='seamless'></iframe>";
+ $j("#player_id_code").val(iframe_code);
+ $j("#player_id_code").focus();
+ $j("#player_id_code").select();
+ }
</script>
- <script type="text/javascript">
+ <script type="text/javascript">
+ function div_event(){
+ var new_code=document.getElementById("embed_code_var").value;
+ var code_embed=document.getElementById("player_id_code");
+ $j("#wrapper_{{player_id}}").html(new_code);
+ code_embed.value= new_code;
+ $j("#player_id_code").focus();
+ $j("#player_id_code").select();
+ }
+ </script>
+
+ <script type="text/javascript">
function toggle() {
var element = document.getElementById("wrapper_{{player_id}}");
var text = document.getElementById("displayPlayer");
@@ -64,16 +66,15 @@
text.innerHTML = "{% trans 'Show Player' %}";
}
}
- </script>
-
+ </script>
</head>
<body id="init_embed_popup">
-
- <div id='ldt_id'>
+ <textarea id="embed_code_var" readonly="readonly" class="ldt_player_code" style="display:none">{{ embed_rendered.player }}</textarea>
+ <div id='ldt_id>
<div id='ldt_id_title'>{% trans 'project id' %} <span id="project_id_select">({% trans 'Select' %})</span> : <input id="project_id_input" value="{{ldt_id}}"/></div>
</div>
-
+
<a id="displayPlayer" href="javascript:toggle();">{% trans 'Show Player' %}</a>
<div class="ldt_player" id="wrapper_{{player_id}}" style="display:none">
{% include "ldt/ldt_utils/partial/embed_player.html" %}
@@ -85,16 +86,21 @@
</div>
<div>
- <code id ="code_{{player_id}}" >
- <div id="player_code">
- <textarea id="player_id_code" readonly="readonly" class="ldt_player_code">{{ embed_rendered.player }}</textarea>
- <textarea id="iframe_player_id_code" readonly="readonly" class="ldt_player_code">{{ iframe }}</textarea>
- </div>
- <div id="seo_body_code"><textarea id="seo_body_id_code" readonly="readonly" class="ldt_player_code" >{{ embed_rendered.seo_body }}</textarea></div>
- <div id="seo_meta_code"><textarea id="seo_meta_id_code" readonly="readonly" class="ldt_player_code">{{ embed_rendered.seo_meta }}</textarea></div>
- </code>
-
- <div id="links_code" class="ldt_player_code">{% include "ldt/ldt_utils/partial/embed_links.html" %}</div>
+ <br></br>
+ <code id ="code_{{player_id}}" >
+ <div id="player_code">
+ <br><div align="center">
+ <input type="radio" name="player_code_type" value="div" checked onClick="div_event()" > {% trans 'Use the div integration mode' %}</input><br>
+ <input type="radio" name="player_code_type" value="iframe" onClick="iframe_event()"> {% trans 'Use the iframe integration mode' %}</input><br>
+ </div></br>
+ <textarea id="player_id_code" readonly="readonly" class="ldt_player_code">{{ embed_rendered.player }}</textarea>
+ </div>
+ <div id="seo_body_code"><textarea id="seo_body_id_code" readonly="readonly" class="ldt_player_code" >{{ embed_rendered.seo_body }}</textarea></div>
+ <div id="seo_meta_code"><textarea id="seo_meta_id_code" readonly="readonly" class="ldt_player_code">{{ embed_rendered.seo_meta }}</textarea></div>
+ </code>
+ <br>
+ <div id="links_code" class="ldt_player_code">{% include "ldt/ldt_utils/partial/embed_links.html" %}</div>
+ </br>
</div>
<a href="{{json_url}}?escape=true&mimetype=text/plain" class="ldt_json_link" >{% trans 'clik here to see the project content' %}</a>
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/iframe_embed_player.html Wed Oct 10 16:19:10 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-{% spaceless %}
-{% load i18n %}
-{% load thumbnail %}
-
-<iframe src="{{WEB_URL}}{{BASE_URL}}ldtplatform/ldt/embediframe/?content_id={{iri_id}}&polemic={{polemic}}&show_mic_record={{show_mic_record}}&annotations_list={{annotations_list}}" seamless="seamless" width='800' height='1000'></iframe>
-{% endspaceless %}
\ No newline at end of file
--- a/src/ldt/ldt/ldt_utils/views/workspace.py Wed Oct 10 16:19:10 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/views/workspace.py Wed Oct 10 17:55:18 2012 +0200
@@ -25,6 +25,8 @@
import ldt.auth as ldt_auth
import lxml.etree
import logging
+from django.utils.safestring import SafeUnicode, mark_safe
+
@login_required
@@ -108,9 +110,6 @@
(lambda s:escape(render_to_string("ldt/ldt_utils/partial/embed_%s.html" % (s), rend_dict, context_instance=RequestContext(request))))(typestr))
for typestr in ('player', 'seo_body', 'seo_meta', 'links'))
rend_dict['embed_rendered'] = embed_rendered
- iframe=render_to_string("ldt/ldt_utils/partial/iframe_embed_player.html", rend_dict, context_instance=RequestContext(request))
- rend_dict['iframe']=iframe
- logging.debug("louiseredhotpeppers iframe : "+str(iframe)+" bla")
return render_to_response("ldt/ldt_utils/embed_popup.html", rend_dict, context_instance=RequestContext(request))
@@ -153,7 +152,7 @@
project = Project.safe_objects.get(ldt_id=ldt_id); #@UndefinedVariable
project_contents = project.contents.all()
content=project_contents[0]
- iri_id=content.iri_id
+ iframe_url = mark_safe(settings.WEB_URL+settings.BASE_URL+"ldtplatform/ldt/embediframe/?content_id="+content.iri_id)
external_url = None
if content.src is not None:
for external_src in settings.EXTERNAL_STREAM_SRC:
@@ -178,7 +177,7 @@
annotations = ps.get_annotations(first_cutting=True)
rend_dict = {'json_url':json_url, 'player_id':player_id, 'annotations':annotations, 'ldt_id': ldt_id, 'stream_mode': stream_mode,
'player_width': player_width, 'player_height': player_height, 'external_url': external_url,
- 'polemic':False, 'show_mic_record':False, 'annotations_list':False, 'iri_id': iri_id}
+ 'polemic':False, 'show_mic_record':False, 'annotations_list':False, 'iframe_url':iframe_url}
return rend_dict
Binary file src/ldt/ldt/locale/fr/LC_MESSAGES/django.mo has changed
--- a/src/ldt/ldt/locale/fr/LC_MESSAGES/django.po Wed Oct 10 16:19:10 2012 +0200
+++ b/src/ldt/ldt/locale/fr/LC_MESSAGES/django.po Wed Oct 10 17:55:18 2012 +0200
@@ -7,7 +7,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-10-08 11:10+0200\n"
+"POT-Creation-Date: 2012-10-08 18:09+0200\n"
"PO-Revision-Date: 2010-03-09 15:52+0100\n"
"Last-Translator: Yves-Marie Haussonne <ymh.work@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -313,7 +313,7 @@
msgstr "<b>Lignes</b> de temps"
#: .\ldt_utils\templates\front\front_base.html.py:59
-#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:67
+#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:68
msgid "My projects"
msgstr "Mes projets"
@@ -412,8 +412,8 @@
#: .\ldt_utils\templates\ldt\ldt_utils\groups.html.py:113
#: .\ldt_utils\templates\ldt\ldt_utils\ldt_list.html.py:80
#: .\ldt_utils\templates\ldt\ldt_utils\published_projects.html.py:70
-#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:55
-#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:70
+#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:56
+#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:71
#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:129
#: .\templates\ldt\ldt_base.html.py:127
msgid "search"
@@ -504,7 +504,7 @@
msgstr "Copier votre projet"
#: .\ldt_utils\templates\ldt\ldt_utils\copy_ldt.html.py:17
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:88
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:96
msgid "Title"
msgstr "Titre"
@@ -537,7 +537,7 @@
"resoumettre le formulaire media après avoir fait les changements suivants:"
#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:85
-#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:52
+#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:53
msgid "Create content"
msgstr "Créer un contenu"
@@ -546,7 +546,7 @@
msgstr "Front project actuel"
#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:127
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:141
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:149
#: .\ldt_utils\templates\ldt\ldt_utils\reset_confirm.html.py:39
#: .\ldt_utils\templates\ldt\ldt_utils\reset_confirm_popup.html.py:54
msgid "reset_front_project"
@@ -558,7 +558,7 @@
#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:145
#: .\ldt_utils\templates\ldt\ldt_utils\create_group.html.py:101
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:137
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:145
#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm.html.py:37
#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm_popup.html.py:53
#: .\ldt_utils\templates\ldt\ldt_utils\reset_confirm.html.py:38
@@ -615,79 +615,87 @@
msgid "hide"
msgstr "Réduire"
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:82
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:90
msgid "Update your project"
msgstr "Mettre à jour votre projet Lignes de Temps"
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:82
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:90
msgid "Create your project"
msgstr "Créer votre projet Lignes de Temps"
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:93
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:101
msgid "Description :"
msgstr "Description :"
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:98
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:106
msgid "List of contents"
msgstr "Liste de contenus"
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:112
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:120
#: .\ldt_utils\templates\ldt\ldt_utils\partial\contentslist.html.py:21
#: .\ldt_utils\templates\ldt\ldt_utils\partial\projectslist.html.py:12
#: .\ldt_utils\templates\ldt\ldt_utils\partial\publishedprojectslist.html.py:12
msgid "name"
msgstr "Nom"
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:128
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:136
msgid "More options"
msgstr "Plus d'options"
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:139
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:147
msgid "delete_project"
msgstr "Effacer"
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:143
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:151
msgid "update_project"
msgstr "Mettre à jour"
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:145
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:153
msgid "create_project"
msgstr "Créer un nouveau projet Ligne de Temps"
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:57
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:50
msgid "Hide Player"
msgstr "Masquer le Lecteur métadata "
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:61
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:74
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:54
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:67
msgid "Show Player"
msgstr "Afficher le Lecteur métadata"
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:71
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:64
msgid "project id"
msgstr "Identifiant du projet "
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:71
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:64
msgid "Select"
msgstr "Sélectionner"
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:80
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:73
msgid "popup_player"
msgstr "Code Lecteur métadata"
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:80
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:73
msgid "popup_seo_body"
msgstr "Code SEO"
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:80
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:73
msgid "popup_seo_meta"
msgstr "Code balise meta en-tête"
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:80
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:73
msgid "popup_links"
msgstr "Liste de liens"
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:100
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:82
+msgid "Use the div integration mode"
+msgstr "Utiliser le mode d'integration div"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:83
+msgid "Use the iframe integration mode"
+msgstr "Utiliser le mode d'integration iframe"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:95
msgid "clik here to see the project content"
msgstr "cliquer ici pour voir le contenu du projet"
@@ -753,7 +761,7 @@
msgstr "Projets publiés"
#: .\ldt_utils\templates\ldt\ldt_utils\published_projects.html.py:68
-#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:68
+#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:69
msgid "Create project"
msgstr "Créer un nouveau projet d'indexation"
@@ -788,7 +796,7 @@
msgid "Page %(number)s of %(num_pages)s"
msgstr "Page %(number)s de %(num_pages)s"
-#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:51
+#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:52
msgid "content list"
msgstr "Liste des contenus"
@@ -986,7 +994,7 @@
"(project_titles)s'.Veuillez les effacer préalablement."
#: .\ldt_utils\views\json.py:40 .\ldt_utils\views\rdf.py:15
-#: .\ldt_utils\views\workspace.py:173
+#: .\ldt_utils\views\workspace.py:175
msgid "You can not access this project"
msgstr "vous n'avez pas l'autorisation d'accéder à ce projet"
--- a/src/ldt/ldt/static/ldt/js/embed_popup.js Wed Oct 10 16:19:10 2012 +0200
+++ b/src/ldt/ldt/static/ldt/js/embed_popup.js Wed Oct 10 17:55:18 2012 +0200
@@ -16,6 +16,13 @@
$j(document).ready(function(){
toggle_display();
+ $j("#player_id_code").focus();
+ $j("#player_id_code").select();
+
+ $j("#project_id_select").click(function(){
+ $j("#project_id_input").focus();
+ $j("#project_id_input").select();
+ });
$j('.ldt_json_link').click(function(e) {
e.preventDefault();
@@ -44,6 +51,22 @@
$j("#copy_button").click(function(e) {
alert($j("#"+display_state+"_code").html());
- });
+ });
+
+ $j("#player_button").click(function(){
+ $j("#player_id_code").focus();
+ $j("#player_id_code").select();
+ });
+
+ $j("#seo_body_button").click(function(){
+ $j("#seo_body_id_code").focus();
+ $j("#seo_body_id_code").select();
+ });
+ $j("#seo_meta_button").click(function(){
+ $j("#seo_meta_id_code").focus();
+ $j("#seo_meta_id_code").select();
+ });
});
+
+