Enhance SlideShare widget for it to point the a specified div. Clean url template for some api calls.
--- a/src/ldt/ldt/api/ldt/urls.py Wed Apr 18 15:29:06 2012 +0200
+++ b/src/ldt/ldt/api/ldt/urls.py Thu Apr 19 17:03:56 2012 +0200
@@ -1,4 +1,5 @@
from django.conf.urls.defaults import patterns, url
+from django.views.defaults import page_not_found
from piston.resource import Resource
from ldt.api.ldt.handlers import ProjectHandler, AnnotationHandler, ContentHandler, SegmentHandler
@@ -9,8 +10,10 @@
urlpatterns = patterns('',
url(r'projects/(?P<project_id>[^/.]+)\.?(?P<emitter_format>.*)$', project_handler, name='project_api'),
+ url(r'annotations/$', page_not_found, name='annotation_api_empty'),
url(r'annotations/(?P<project_id>[^/.]+)\.?(?P<emitter_format>.*)$', annotation_handler, name='annotation_api'),
url(r'contents/(?P<iri_id>[^/.]+)\.?(?P<emitter_format>.*)$', content_handler, name='content_api'),
+ url(r'segments/$', page_not_found, name='segment_api_empty'),
url(r'segments/(?P<iri_id>.*)/(?P<begin>.*)/(?P<end>.*)$', segment_handler, name='segment_api'),
)
--- a/src/ldt/ldt/ldt_utils/templates/front/front_player.html Wed Apr 18 15:29:06 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_player.html Thu Apr 19 17:03:56 2012 +0200
@@ -95,8 +95,8 @@
<div class="li_h2">
<h2>{% trans 'All annotations on the media' %}</h2>
</div>
- <div id="annot_media">
- </div>
+ <div id="slides_container"></div>
+ <div id="annot_media"></div>
</div>
{% endblock %}
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html Wed Apr 18 15:29:06 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html Thu Apr 19 17:03:56 2012 +0200
@@ -62,7 +62,8 @@
},
{
type: "AnnotationsListWidget",
- container: "annot_media"
+ container: "annot_media",
+ ajax_url: "{% url segment_api_empty %}{% templatetag openvariable %}media{% templatetag closevariable %}/{% templatetag openvariable %}begin{% templatetag closevariable %}/{% templatetag openvariable %}end{% templatetag closevariable %}"
},
{
type: "PlayerWidget",
@@ -96,11 +97,12 @@
},
{
type: "createAnnotationWidget",
- api_endpoint_template: "{{WEB_URL}}{{BASE_URL}}/ldtplatform/api/ldt/annotations/{% templatetag openvariable %}id{% templatetag closevariable %}{% templatetag closebrace %}.json",
+ api_endpoint_template: "{% url annotation_api_empty %}{% templatetag openvariable %}id{% templatetag closevariable %}{% templatetag closebrace %}.json",
keywords: ["#amateur", "#digital-humanities"]
},
{
- type: "SlideShareWidget"
+ type: "SlideShareWidget",
+ container: "slides_container"
}
]
},
--- a/src/ldt/ldt/static/ldt/css/front_player.css Wed Apr 18 15:29:06 2012 +0200
+++ b/src/ldt/ldt/static/ldt/css/front_player.css Thu Apr 19 17:03:56 2012 +0200
@@ -52,7 +52,7 @@
width: 400px; margin-left: 10px;
}
-#annot_media {
+#annot_media, #slides_container {
width: 400px; margin: 5px 0 10px 10px;
}
--- a/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js Wed Apr 18 15:29:06 2012 +0200
+++ b/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js Thu Apr 19 17:03:56 2012 +0200
@@ -1115,7 +1115,7 @@
IriSP.search_template = "{{! template for the search container }}<div class='LdtSearchContainer' style='margin-left: {{margin_left}}; position: absolute; margin-top: -60px;'> <div class='LdtSearch' style='display: none; background-color: #EEE; width: 165px; border-color: #CFCFCF; position: absolute; text-align: center;'> <input class='LdtSearchInput' style='margin-top: 1px; margin-bottom: 2px;' /> </div></div><div class='cleaner'></div>";
IriSP.share_template = "{{! social network sharing template }}<a onclick='__IriSP.MyApiPlayer.share(\'delicious\');' title='{{l10n.share_on}} delicious'><span class='share shareDelicious'> </span></a> <a onclick='__IriSP.MyApiPlayer.share(\'facebook\');' title='{{l10n.share_on}} facebook'> <span class='share shareFacebook'> </span></a><a onclick='__IriSP.MyApiPlayer.share(\'twitter\');' title='{{l10n.share_on}} twitter'> <span class='share shareTwitter'> </span></a><a onclick='__IriSP.MyApiPlayer.share(\'myspace\');' title='{{l10n.share_on}} Myspace'> <span class='share shareMySpace'> </span></a>";
IriSP.sliceWidget_template = "{{! template for the slice widget }}<div class='Ldt-sliceWidget'> {{! the whole bar }} <div class='Ldt-sliceBackground'></div> <div class='Ldt-sliceLeftHandle'></div> {{! the zone which represents our slice }} <div class='Ldt-sliceZone'></div> <div class='Ldt-sliceRightHandle'></div></div>";
-IriSP.slideShareWidget_template = "{{! template for the slideShare widget of the other }}<div class='Ldt-SlideShare'><!-- >p class='sync_links'><a class='sync_on'>Synchronise</a> - <a class='sync_off'>Ne synchronise pas</a></p--><div class='SlideShareContainer'></div></div>";
+IriSP.slideShareWidget_template = "{{! template for the slideShare widget of the other }}<div class='Ldt-SlideShare'><!--p> class='sync_links'><a class='sync_on'>Synchronise</a> - <a class='sync_off'>Ne synchronise pas</a></p--><div class='SlideShareContainer'></div></div>";
IriSP.sliderWidget_template = "{{! template for the slider widget - it's composed of two divs we one overlayed on top of the other }}<div class='Ldt-sliderBackground'></div><div class='Ldt-sliderForeground'></div><div class='Ldt-sliderPositionMarker Ldt-TraceMe'></div>";
IriSP.tooltip_template = "{{! template used by the jquery ui tooltip }}<div class='Ldt-tooltip'> <div class='title'>{{title}}</div> <div class='time'>{{begin}} : {{end}} </div> <div class='description'>{{description}}</div></div>";
IriSP.tooltipWidget_template = "{{! template for the tooltip widget }}<div class='tip'> <div class='tipcolor' style='height:10px;width:10px'></div> <div class='tiptext'></div>";
@@ -4898,8 +4898,13 @@
IriSP.SlideShareWidget.prototype.draw = function() {
var self = this;
+ // If the div supposed to host the slides does not exist, we cancel
+ if(this.selector.length==0){
+ if(console){ if(console.log){ console.log("No div for slideshare widget, this widget is canceled. id = " + this._id); } }
+ return;
+ }
var templ = Mustache.to_html(IriSP.slideShareWidget_template);
- this.selector.append(templ);
+ this.selector.html(templ);
// Synchro management
this._disableUpdate = false;
@@ -4925,7 +4930,8 @@
var annotations = this._serializer._data.annotations;
var view_type = this._serializer.getSlideShareType();
if(typeof(view_type) === "undefined") {
- return;
+ if(console){ if(console.log){ console.log("No annotation-type for slideshare widget, this widget is canceled."); } }
+ return;
}
var i = 0;
this.segments_slides = [];