--- a/src/metadatacomposer/static/metadatacomposer/css/style.css Thu Jun 06 14:59:59 2013 +0200
+++ b/src/metadatacomposer/static/metadatacomposer/css/style.css Thu Jun 06 15:00:21 2013 +0200
@@ -44,6 +44,7 @@
.project-action a:last-child{margin-right: 20px;}
.chapter-widget-info{margin-bottom: 20px;}
.chapter-widget form{ margin: 0;}
+.form-info-general-annotation{background-color: #ecf0f1;}
.chapter-widget input, .form-info-general-annotation input, .form-info-general-annotation textarea{width: 196px; max-width: 196px; }
.chapter-widget textarea{width: 426px; max-width: 426px; min-width: 426px; height: 20px;-webkit-transition: height .3s ease;-moz-transition: height .3s ease;transition: height .3s ease;}
.form-chapter-edit{}
@@ -86,10 +87,11 @@
.close-tab:hover{color:#2c3e50;}
.html-apercu{overflow: auto; margin-top: 10px;}
.input-image-url{display: none;}
+.slider-duration.ui-slider.ui-slider-horizontal.ui-widget.ui-widget-content.ui-corner-all{ background: #202020;}
.timeline-annotations-wrap{position: relative;background-color: #202020;}
.timeline-annotations{width: 460px;height: auto; position: relative; margin: 0; padding-top: 4px;}
.timeline-annotations li{display: block; width: 460px;height: 10px; position: relative; padding-bottom: 4px;}
-.timeline-annotations .annotation{width: 10px; height: 10px; background-color: #c0392b; position: absolute; top:0px;}
+.timeline-annotations .annotation{ color:#000; text-align:center; font-size : 10px; overflow: hidden; line-height: 9px; width: 10px; height: 10px; background-color: #c0392b; position: absolute; top:0px;}
ul.tagit{margin-left: 10px;-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;}
@@ -111,6 +113,10 @@
td.image-slideshow-row img{width: 60px; height: 60px;}
.project-title-editor input{margin-bottom: 0;}
#templates{display: none;}
+
+.title-slideshow-row{word-wrap: break-word;width: 76px;}
+.description-slideshow-row{word-wrap: break-word; width: 180px;}
+.description-slideshow-row textarea{width: 164px; max-width: 164px; height: 164px;}
/* Tangle */
.time-tangle {
color: #2c3e50; cursor: w-resize; position: relative;
--- a/src/metadatacomposer/static/metadatacomposer/js/edition.js Thu Jun 06 14:59:59 2013 +0200
+++ b/src/metadatacomposer/static/metadatacomposer/js/edition.js Thu Jun 06 15:00:21 2013 +0200
@@ -1,6 +1,6 @@
-var myMedia = null,
- currentChapter = null,
- currentAnnotation = null,
+var myMedia = undefined,
+ currentChapter = undefined,
+ currentAnnotation = undefined,
chapters = [],
annotations = [];
@@ -9,10 +9,10 @@
var global = {
colorsIndex : 0,
colors :
- ['#f39c12', '#2ecc71', '#3498db', '#9b59b6',
- '#f1c40f', '#e67e22', '#e74c3c',
- '#16a085', '#27ae60', '#2980b9', '#8e44ad',
- '#d35400', '#c0392b', '#bdc3c7']
+ ['#1abc9c', '#3498db', '#9b59b6', '#2ecc71',
+ '#f1c40f', '#ecf0f1', '#e67e22', '#e74c3c', '#95a5a6',
+ '#16a085', '#2980b9', '#8e44ad', '#27ae60',
+ '#f39c12', '#c0392b', '#bdc3c7', '#d35400', '#7f8c8d']
};
@@ -79,10 +79,10 @@
url_transform: function(src) {
return [{
type: "video/mp4",
- src: src.replace(/\.[\d\w]+$/,'.mp4').replace('rtmp://media.iri.centrepompidou.fr/ddc_player', 'http://media.iri.centrepompidou.fr')
+ src: src.replace(/\.[\d\w]+$/,'.mp4')
}, {
type: "video/webm",
- src: src.replace(/\.[\d\w]+$/,'.webm').replace('rtmp://media.iri.centrepompidou.fr/ddc_player', 'http://media.iri.centrepompidou.fr')
+ src: src.replace(/\.[\d\w]+$/,'.webm')
}];
}
}
@@ -102,47 +102,57 @@
}else{
btnCutChapter.css("left",pos);
}
-
//annotations view
- var currentAnnotationsDisplay = new Array();
- $.each(annotations, function(k, v){
-
- if(v.begin <= t && v.end >= t){
- currentAnnotationsDisplay.push(v.id);
- if(!$('#item-current-annotation-'+v.id).length){
- var itemAnnotation =
- $('<li>')
- .attr('id', 'item-current-annotation-'+v.id)
- .attr('data-id', v.id)
- .append(
- $('<a>')
- .css('backgroundColor', v.color)
- .attr('data-id', v.id)
- .attr('href', '#')
- .append(
- $('<i>').addClass('icon-'+getIcon(v.type))
- )
- );
- $('.list-current-annotations').append(itemAnnotation)
- }
- }
- });
- $.each($('.list-current-annotations li'), function(k, v){
- var idAnnotation = $(this).attr('data-id'),
- annotationDisplayView = $('.annotation-display-view');
- if($.inArray(idAnnotation, currentAnnotationsDisplay)<0){//il ne doit plus être affiché
- $('#item-current-annotation-'+idAnnotation).remove();
- if(annotationDisplayView.attr('data-id') == idAnnotation && annotationDisplayView.is(":visible")){
- annotationDisplayView.hide();
- }
- }
- });
-
+ refreshAnnotationDisplay(t);
});//timeupdate
});//myProject.onLoad
+function refreshAnnotationDisplay(t){
+
+ var currentAnnotationsDisplay = new Array();
+ $.each(annotations, function(k, v){
+
+ if(v.begin <= t && v.end >= t){
+ currentAnnotationsDisplay.push(v.id);
+ if(!$('#item-current-annotation-'+v.id).length){
+ var itemAnnotation =
+ $('<li>')
+ .attr('id', 'item-current-annotation-'+v.id)
+ .attr('data-id', v.id)
+ .append(
+ $('<a>')
+ .css('backgroundColor', v.color)
+ .attr('data-id', v.id)
+ .attr('href', '#')
+ .append(
+ $('<i>').addClass('icon-'+getIcon(v.type))
+ )
+ );
+ $('.list-current-annotations').append(itemAnnotation)
+ }
+ }
+ });
+ $.each($('.list-current-annotations li'), function(k, v){
+ var idAnnotation = $(this).attr('data-id'),
+ annotationDisplayView = $('.annotation-display-view');
+ if($.inArray(idAnnotation, currentAnnotationsDisplay)<0){//il ne doit plus être affiché
+ $('#item-current-annotation-'+idAnnotation).remove();
+ if(annotationDisplayView.attr('data-id') == idAnnotation && annotationDisplayView.is(":visible")){
+ annotationDisplayView.hide();
+ }
+ }
+ });
+ if(currentAnnotation !== undefined){
+ showCurrentAnnotationInTimeline(currentAnnotation.id);
+ }
+}
+
+function showCurrentAnnotationInTimeline(idAnnotation){
+ $('.timeline-annotations .annotation').empty();
+ $('#annotation-timeline-'+idAnnotation).text('en cours');
+}
//display annotation view
$('.list-current-annotations').on('click', 'a', function(e){
e.preventDefault();
@@ -176,9 +186,6 @@
//select on bibliotheque
-
-
-
//confirmation suppression
$("#modal-confirm").on('click', '#btn-delete-modal', function(e){
@@ -203,7 +210,10 @@
var input = $('<input type="text" />');
input.val(html);
$('.project-title').replaceWith(input);
- input.focus();
+ input.focus().keypress(function(e){
+ code = (e.keyCode ? e.keyCode : e.which);
+ if (code == 13) $(this).blur();
+ });
});
$(document).on('blur', '.project-title-editor input', function(){
var newTitle = $(this).val();
@@ -500,7 +510,7 @@
}
});
- $('.tab-content').on('keyup', 'input[name=title], textarea', function(e){
+ $('.tab-content').on('keyup', '.form-info-general-annotation input[name=title], .form-info-general-annotation textarea', function(e){
var name = $(this).attr('name'),
value = $(this).val();
currentAnnotation[name] = value;
@@ -547,7 +557,7 @@
});
function openTab(type, data){
-
+
var dataView;
if(_.isUndefined(data)){//nouveau
var currentTimePlusUnMin = 60 * 1000 + myMedia.currentTime,
@@ -571,14 +581,13 @@
iconTab;
currentAnnotation = _.find(annotations, function(c){ return c.id == idAnnotation; });
-
-
-
+ showCurrentAnnotationInTimeline(idAnnotation);
//head commun à tous
var tplHead = getTemplate('#tpl-head');
var output = Mustache.render(tplHead, dataView);
$(tabContent).append(output);
$(tabContent).find(".slider-duration").slider(configSlider(dataView));
+ $(tabContent).find(".ui-slider-range.ui-widget-header.ui-corner-all").css('background', dataView.color);
$(tabContent).find('.tag-it').tagit(tagitParam);
//type
var viewType = {
@@ -680,10 +689,12 @@
$('#onglet-annotations').on('show', 'a[data-toggle="annotation"]', function (e) {
var idAnnotation = $(e.target).attr('data-id');
currentAnnotation = _.find(annotations, function(c){ return c.id == idAnnotation; });
+ showCurrentAnnotationInTimeline(idAnnotation);
});
//rafraichit annotations au retour sur la liste
$('#onglet-annotations').on('show', 'a[data-toggle="list-annotations"]', function (e) {
+ currentAnnotation = undefined;
renderAnnotation();
});
@@ -768,6 +779,41 @@
};
+ //edit title / description
+ $('.tab-content').on('click', '.title-slideshow-row', function(){
+ if($(this).find('input').length) return;
+ var html = $(this).find('span').html();
+ var input = $('<input type="text" />').addClass('input-mini').attr('name', 'title');
+ input.val(html);
+ $(this).find('span').replaceWith(input);
+ input.focus().keypress(function(e){
+ code = (e.keyCode ? e.keyCode : e.which);
+ if (code == 13) $(this).blur();
+ });
+ });
+
+ $('.tab-content').on('click', '.description-slideshow-row', function(){
+ if($(this).find('textarea').length) return;
+ var html = $(this).find('span').html();
+ var input = $('<textarea>').attr('name', 'description');
+ input.val(html);
+ $(this).find('span').replaceWith(input);
+ input.focus().keypress(function(e){
+ code = (e.keyCode ? e.keyCode : e.which);
+ if (code == 13) $(this).blur();
+ });
+ });
+
+ $(document).on('blur', '.title-slideshow-row input, .description-slideshow-row textarea', function(){
+ var newValue = $(this).val(),
+ name = $(this).attr('name'),
+ span = $('<span>').html(newValue),
+ indexRow = $(this).parents('.row-image-diaporama').index();
+ $(this).replaceWith(span);
+
+ currentAnnotation.content.images[indexRow][name] = newValue;
+ });
+
//bouton up / down
$(document).on('click', '.ui-sortable .btn-sort', function(e){
e.preventDefault();
@@ -946,7 +992,8 @@
annotationTimeline.css('z-index',100);
},
stop : function(){
- renderAnnotation()
+ renderAnnotation();
+ refreshAnnotationDisplay(myMedia.getCurrentTime());
}
};
}
--- a/src/metadatacomposer/templates/metadatacomposer_project_list.html Thu Jun 06 14:59:59 2013 +0200
+++ b/src/metadatacomposer/templates/metadatacomposer_project_list.html Thu Jun 06 15:00:21 2013 +0200
@@ -38,16 +38,12 @@
<td>{% with c=p.contents.all|first %}<a href="{% url 'embediframe_page' %}?content_id={{ c.iri_id }}" data-type-media="video" data-title="{{ c.title }}" class="open-modal" data-hide-add-new data-iframe>{{ c.title }}</a>{% endwith %}</td>
<td>{{ p.modification_date|date:"Y/m/d" }}</td>
<td>
- <form action="#">
- <input class="input-small in-table" id="url_{{ p.ldt_id }}" type="text" value="{% absurl 'composer_player' branding=branding ldt_id=p.ldt_id %}" readonly="readonly">
- <a href="#" class="btn clipboard" data-clipboard-target="url_{{ p.ldt_id }}"><i class="icon-link"></i></a>
- </form>
+ <input class="input-small in-table" id="url_{{ p.ldt_id }}" type="text" value="{% absurl 'composer_preview_player' branding=branding ldt_id=p.ldt_id %}" readonly="readonly">
+ <a href="#" class="btn clipboard" data-clipboard-target="url_{{ p.ldt_id }}"><i class="icon-link"></i></a>
</td>
<td>
- <form action="#">
- <input class="input-small in-table" id="embed_{{ p.ldt_id }}" type="text" value="<iframe src='{% absurl 'composer_player' branding=branding ldt_id=p.ldt_id %}' width='1000' height='700' frameborder='0'></iframe>" readonly="readonly">
- <a href="#" class="btn clipboard" data-clipboard-target="embed_{{ p.ldt_id }}"><i class="icon-link"></i></a>
- </form>
+ <input class="input-small in-table" id="embed_{{ p.ldt_id }}" type="text" value="<iframe src='{% absurl 'composer_player' branding=branding ldt_id=p.ldt_id %}' width='1000' height='700' frameborder='0'></iframe>" readonly="readonly">
+ <a href="#" class="btn clipboard" data-clipboard-target="embed_{{ p.ldt_id }}"><i class="icon-link"></i></a>
</td>
<td class="actions">
<table>
@@ -57,7 +53,7 @@
</tr>
<tr>
<td><a class="btn" href="{% url 'composer_preview_player' branding=branding ldt_id=p.ldt_id %}" target="_blank"><i class="icon-eye-open"></i></a></td>
- <td><a class="btn" href="#"><i class="icon-copy"></i></a></td>
+ <td><a class="btn" href="{% url 'composer_duplicate_project' branding=branding %}?ldt_id={{ p.ldt_id }}"><i class="icon-copy"></i></a></td>
</tr>
</table>
</td>
--- a/src/metadatacomposer/urls.py Thu Jun 06 14:59:59 2013 +0200
+++ b/src/metadatacomposer/urls.py Thu Jun 06 15:00:21 2013 +0200
@@ -7,7 +7,7 @@
MetadataComposerRemoveProject, MetadataComposerImage,\
MetadataComposerModalContentLibrary, MetadataComposerPlayer,\
MetadataComposerPreviewPlayer, MetadataComposerEdit,\
- MetadataComposerNewProject
+ MetadataComposerNewProject, MetadataComposerDuplicateProject
urlpatterns = patterns('',
url(r'^jsi18n/(?P<packages>\S+?)/$', 'django.views.i18n.javascript_catalog', name='jsi18n'),
@@ -23,6 +23,7 @@
url(r'^(?P<branding>.*)/removecontent/$', MetadataComposerRemoveContent.as_view(), name="composer_remove_content"),
url(r'^(?P<branding>.*)/removeimage/$', MetadataComposerRemoveImage.as_view(), name="composer_remove_image"),
url(r'^(?P<branding>.*)/removeproject/$', MetadataComposerRemoveProject.as_view(), name="composer_remove_project"),
+ url(r'^(?P<branding>.*)/duplicateproject/$', MetadataComposerDuplicateProject.as_view(), name="composer_duplicate_project"),
url(r'^(?P<branding>.*)/image/(?P<image_pk>[\w-]+)/$', MetadataComposerImage.as_view(), name="composer_image"),
url(r'^(?P<branding>.*)/player/(?P<ldt_id>[\w-]+)/$', MetadataComposerPlayer.as_view(), name="composer_player"),
url(r'^(?P<branding>.*)/previewplayer/(?P<ldt_id>[\w-]+)/$', MetadataComposerPreviewPlayer.as_view(), name="composer_preview_player"),
--- a/src/metadatacomposer/views.py Thu Jun 06 14:59:59 2013 +0200
+++ b/src/metadatacomposer/views.py Thu Jun 06 15:00:21 2013 +0200
@@ -558,11 +558,37 @@
assign('view_project', u, project)
assign('change_project', u, project)
# Since the project is published by default, we assign permission for the everyone group
- everyone = Group.objects.get(name=settings.PUBLIC_GROUP_NAME)
- assign('ldt_utils.view_project', everyone, project)
+ assign('ldt_utils.view_project', Group.objects.get(name=settings.PUBLIC_GROUP_NAME), project)
# Redirect to project edition in composer interface
return redirect('composer_edit', branding=branding, ldt_id=project.ldt_id)
+class MetadataComposerDuplicateProject(View):
+
+ @method_decorator(login_required)
+ def get(self, request, branding="iri", **kwargs):
+ self.branding = branding
+ ldt_id = request.GET.get("ldt_id") or None
+ if ldt_id:
+ proj = get_object_or_404(Project, ldt_id=ldt_id)
+ u = request.user
+ # Create project
+ newproj = Project.create_project(title="Copy of " + proj.title,
+ user=u, contents=proj.contents.all(),
+ description=proj.description,
+ set_icon=False)
+ # Save ldt content and set project state to "published" and save
+ newproj.ldt = proj.ldt
+ newproj.state = 2
+ newproj.save()
+ assign('view_project', u, newproj)
+ assign('change_project', u, newproj)
+ # Since the project is published by default, we assign permission for the everyone group
+ assign('ldt_utils.view_project', Group.objects.get(name=settings.PUBLIC_GROUP_NAME), newproj)
+
+ return redirect("composer_project_list", branding=branding)
+
+
+