--- a/src/metadatacomposer/static/metadatacomposer/css/style.css Tue Jun 11 15:46:43 2013 +0200
+++ b/src/metadatacomposer/static/metadatacomposer/css/style.css Tue Jun 11 15:47:02 2013 +0200
@@ -75,6 +75,7 @@
.table td{vertical-align: middle;}
.table td td{padding: 1px; border: none;}
.table td td a{width: 12px;display: block;}
+.table th.copy-url{width: 135px;}
.config-diaporama{color: #FFF;}
.config-diaporama form{background-color: #34495e; padding: 4px 0; margin: 0; overflow: hidden; line-height: 28px;}
.config-diaporama form label{display: inline-block; padding-left: 10px;}
@@ -117,7 +118,7 @@
.description-slideshow-row span{max-height: 100px; display: inline-block; overflow: auto;}
.description-slideshow-row textarea{width: 164px; max-width: 164px; height: 100px;}
.label-modify-video, .label-add-video{display: none;}
-.shadow {background-color: #00FFFF !important;}
+.shadow {background-color: #54D0ED !important;}
.alert-message{display: none;}
.alert{display: none;}
/* Tangle */
@@ -129,6 +130,13 @@
.time-tangle.deactivate:hover {border: none; color: #2c3e50;}
.time-tangle.deactivate:hover:after {display: none;}
+a.open-tab{text-shadow:none;}
+a.open-tab:hover{background-color: #E6E6E6;}
+.open-tab.video{background-color: #BE4477;}
+.open-tab.text{background-color:#5E90CB;}
+.open-tab.slideshow{background-color:#F69058;}
+.open-tab.audio{background-color:#63BE6C;}
+.open-tab.links{background-color:#8985BB;}
.loader {
background: url(../img/loader.gif) center no-repeat;
background-size: 25px 25px;
--- a/src/metadatacomposer/static/metadatacomposer/js/edition.js Tue Jun 11 15:46:43 2013 +0200
+++ b/src/metadatacomposer/static/metadatacomposer/js/edition.js Tue Jun 11 15:47:02 2013 +0200
@@ -4,15 +4,26 @@
currentSlider = undefined,
secMiniChapter = 10;
+
+
+
$(function(){
+ var annotationsColors = {
+ 'video' : '#BE4477',
+ 'text' : '#5E90CB',
+ 'slideshow' : '#F69058',
+ 'audio' : '#63BE6C',
+ 'links' : '#8985BB'
+ }
+
var global = {
colorsIndex : 0,
colors :
- ['#1abc9c', '#3498db', '#9b59b6', '#2ecc71',
- '#f1c40f', '#ecf0f1', '#e67e22', '#e74c3c', '#95a5a6',
- '#16a085', '#2980b9', '#8e44ad', '#27ae60',
- '#f39c12', '#c0392b', '#bdc3c7', '#d35400', '#7f8c8d']
+ ['#FF6138', '#FFFF9D', '#BEEB9F', '#79BD8F', '#00A388',
+ '#1695A3', '#ACF0F2', '#F3FFE2', '#EB7F00', '#FF8000',
+ '#FFD933', '#CCCC52', '#8FB359', '#FFD393', '#F54F29'
+ ]
};
function getTemplate(idTpl){
@@ -29,14 +40,25 @@
var anntypes = myProject.getAnnotationTypes().searchByTitle("chapitrage");
if (!anntypes.length) {
- chapterAnnType = new IriSP.AnnotationType(false, myProject);
+ chapterAnnType = new IriSP.Model.AnnotationType(false, myProject);
chapterAnnType.title = "chapitrage";
+ myProject.getAnnotationTypes().push(chapterAnnType);
} else {
chapterAnnType = anntypes[0];
}
//load Chapitre
chapters = chapterAnnType.getAnnotations();
+ if(!chapters.length){
+ var dataChapter = {
+ title : '',
+ begin : 0,
+ end : myMedia.duration,
+ description : '',
+ keywords : []
+ };
+ newChapter(dataChapter, true);
+ }
$.each(chapters, function(k, v){
v.color = getRandomColor();
});
@@ -45,8 +67,9 @@
//load Annotations
var anntypes = myProject.getAnnotationTypes().searchByTitle("annotations");
if (!anntypes.length) {
- annotationsAnnType = new IriSP.AnnotationType(false, myProject);
+ annotationsAnnType = new IriSP.Model.AnnotationType(false, myProject);
annotationsAnnType.title = "annotations";
+ myProject.getAnnotationTypes().push(annotationsAnnType);
} else {
annotationsAnnType = anntypes[0];
}
@@ -56,7 +79,7 @@
var type = v.content.mimetype.split('-');
type = type[type.length-1]
v.type = type;
- v.color = getRandomColor();
+ v.color = annotationsColors[type];
});
renderAnnotation();
@@ -421,7 +444,7 @@
annotation.title = dataAnnotation.title;
annotation.description = dataAnnotation.description;
annotation.type = dataAnnotation.type;
- annotation.color = global.colors[(global.colorsIndex<global.colors.length) ? global.colorsIndex++ : (global.colorsIndex=0)];
+ annotation.color = annotationsColors[dataAnnotation.type];
annotation.keywords = dataAnnotation.keywords;
annotation.content = getContentAnnotationByType(dataAnnotation.type);
@@ -568,7 +591,7 @@
function openTab(type, data){
- var dataView;
+ var dataView, isNew = false;
if(_.isUndefined(data)){//nouveau
var currentTimePlusUnMin = 60 * 1000 + myMedia.currentTime,
@@ -583,6 +606,7 @@
};
dataView = newAnnotation(dataAnnotation);
renderAnnotation();
+ isNew = true;
}else{//édition
dataView = data;
}
@@ -601,6 +625,7 @@
currentSlider = $(tabContent).find(".slider-duration");
$(tabContent).find(".ui-slider-range.ui-widget-header.ui-corner-all").css('background', dataView.color);
$(tabContent).find('.tag-it').tagit(tagitParam);
+
//type
var viewType = {
id : idAnnotation,
@@ -676,6 +701,8 @@
$(".nav-tabs li:last-child").after(onglet);
$('a[href=#tab-annotation-'+idAnnotation+']').tab('show');
+
+ if(isNew){$(tabContent).find('.head-title').focus();}
}//openTab()
@@ -911,6 +938,22 @@
currentAnnotation.content.links = links;
disabledPreview();
}
+ $('.tab-content').on('focus', '.url-link', function(){
+ var td = $(this).parents('td');
+ if(td.hasClass('error')) td.removeClass('error')
+ });
+
+ $('.tab-content').on('blur', '.url-link', function(){
+ var url = $(this).val(),
+ td = $(this).parents('td');
+ if(!isValidLink(url)){
+ td.addClass('error');
+ }
+ });
+
+ function isValidLink(url){
+ return /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(url);
+ }
//annotation audio
$('.tab-content').on('keyup', '.annotation-audio-content input, .annotation-audio-content textarea', function(){
--- a/src/metadatacomposer/templates/metadatacomposer_edit.html Tue Jun 11 15:46:43 2013 +0200
+++ b/src/metadatacomposer/templates/metadatacomposer_edit.html Tue Jun 11 15:47:02 2013 +0200
@@ -92,7 +92,7 @@
<div class="span6 chapitre-cut-wrap">
<div class="indicateur-chapter"></div>
<ul class="chapter-segments"></ul>
- <a href="#" class="btn btn-primary btn-cut-chapter"><i class="icon-flag"></i> <i class="icon-cut"></i><br/>
+ <a href="#" class="btn btn-primary btn-cut-chapter" title="Nouveau chapitre"><i class="icon-flag"></i> <i class="icon-cut"></i><br/>
<span class="info-time">0:00</span>
</a>
@@ -133,11 +133,11 @@
<div class="add-annotation-wrap section">
<h4 class="title-section"><i class="icon-bookmark"></i> <i class="icon-plus"></i> Ajouter une annotation de type</h4>
<div class="text-center">
- <a href="#" title="Son" data-type="audio" class="btn open-tab"><i class="icon-volume-up"></i> Son</a>
- <a href="#" title="Vidéo" data-type="video" class="btn open-tab"><i class="icon-film"></i> Vidéo</a>
- <a href="#" title="Diaporama" data-type="slideshow" class="btn open-tab"><i class="icon-picture"></i> Diaporama</a>
- <a href="#" title="Texte" data-type="text" class="btn open-tab"><i class="icon-align-left"></i> Texte</a>
- <a href="#" title="Lien" data-type="links" class="btn open-tab"><i class="icon-link"></i> Liens</a>
+ <a href="#" title="Son" data-type="audio" class="btn open-tab audio"><i class="icon-volume-up"></i> Son</a>
+ <a href="#" title="Vidéo" data-type="video" class="btn open-tab video"><i class="icon-film"></i> Vidéo</a>
+ <a href="#" title="Diaporama" data-type="slideshow" class="btn open-tab slideshow"><i class="icon-picture"></i> Diaporama</a>
+ <a href="#" title="Texte" data-type="text" class="btn open-tab text"><i class="icon-align-left"></i> Texte</a>
+ <a href="#" title="Lien" data-type="links" class="btn open-tab links"><i class="icon-link"></i> Liens</a>
</div>
</div>
<div class="list-annotation-wrap">
@@ -269,7 +269,7 @@
</div>
<div class="row annotation-video-content">
<div class="span6">
- <img src="img/460x345.gif" alt="">
+ <img src="{% static 'metadatacomposer/img/460x345.gif' %}" alt="">
<table class="table">
<tbody>
<tr>
@@ -355,7 +355,7 @@
</thead>
<tbody id="diaporama-id1" class="list-image-diaporama ui-sortable">
<tr id="rid-id1" class="row-image-diaporama">
- <td><img src="img/60x60.gif" alt=""> </td>
+ <td><img src="{% static 'metadatacomposer/img/60x60.gif' %}" alt=""> </td>
<td>Titre annotation 1</td>
<td>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Officiis aliquid non placeat consequuntur fugit minima.</td>
<td>
@@ -432,14 +432,14 @@
<div class="row">
<div class="span3 text-right">
- <label class="label-left" for="head-title">Titre :</label>
- <input class="label-left" id="head-title" type="text" placeholder="Titre de l'annotation.." name="title" value="{% templatetag openvariable %}title{% templatetag closevariable %}">
- <label class="label-left" for="head-description">Description :</label>
- <textarea id="head-description" name="description">{% templatetag openvariable %}description{% templatetag closevariable %}</textarea>
+ <label class="label-left" for="head-title-{% templatetag openvariable %}id{% templatetag closevariable %}">Titre :</label>
+ <input class="label-left head-title" id="head-title-{% templatetag openvariable %}id{% templatetag closevariable %}" type="text" placeholder="Titre de l'annotation.." name="title" value="{% templatetag openvariable %}title{% templatetag closevariable %}">
+ <label class="label-left" for="head-description-{% templatetag openvariable %}id{% templatetag closevariable %}">Description :</label>
+ <textarea id="head-description-{% templatetag openvariable %}id{% templatetag closevariable %}" name="description">{% templatetag openvariable %}description{% templatetag closevariable %}</textarea>
</div>
<div class="span3">
- <label for="head-tags">Tags :</label>
- <input id="head-tags" type="text" class="tag-it" data-type="annotation" value="{% templatetag openvariable %}keywords{% templatetag closevariable %}">
+ <label for="head-tags-{% templatetag openvariable %}id{% templatetag closevariable %}">Tags :</label>
+ <input id="head-tags-{% templatetag openvariable %}id{% templatetag closevariable %}" type="text" class="tag-it" data-type="annotation" value="{% templatetag openvariable %}keywords{% templatetag closevariable %}">
<table class="table text-right">
<thead>
<tr>
@@ -626,7 +626,7 @@
<script id="tpl-links-row" type="text/html">
<tr>
- <td><input class="input-medium url-link" type="text" value="{% templatetag openvariable %}url{% templatetag closevariable %}" placeholder="http://"></td>
+ <td class="control-group"><input class="input-medium url-link" type="text" value="{% templatetag openvariable %}url{% templatetag closevariable %}" placeholder="http://"></td>
<td><input class="input-medium title-link" type="text" value="{% templatetag openvariable %}title{% templatetag closevariable %}" placeholder="Titre du lien"></td>
<td>
<a class="btn delete-link" href="#"><i class="icon-trash"></i> </a>
--- a/src/metadatacomposer/templates/metadatacomposer_project_list.html Tue Jun 11 15:46:43 2013 +0200
+++ b/src/metadatacomposer/templates/metadatacomposer_project_list.html Tue Jun 11 15:47:02 2013 +0200
@@ -25,8 +25,8 @@
<th>Titre</th>
<th>Média associé</th>
<th>Modification</th>
- <th>URL</th>
- <th>Embed</th>
+ <th class="copy-url">URL</th>
+ <th class="copy-url">Embed</th>
<th>Actions</th>
</tr>
</thead>
@@ -113,4 +113,24 @@
<script>
var ZeroClipboardMoviePath = "{% static 'metadatacomposer/lib/ZeroClipboard/ZeroClipboard.swf' %}";
</script>
+ <script>
+ // pagination in modal
+ $(document).on('click', 'a.content_pagination_library', function(e){
+ e.preventDefault();e.stopPropagation();
+ var url = $(this).attr('href');
+ $(this).addClass("loader");
+ $.ajax({
+ url: url,
+ cache: false,
+ type: 'GET',
+ success: function(data, status, request) {
+ $("#content_list_container_library").html(data);
+ },
+ error: function(jqXHR, textStatus, errorThrown) {
+ resp = $.parseJSON(jqXHR.responseText);
+ alert(resp.message);
+ }
+ });
+ });
+ </script>
{% endblock %}
--- a/src/metadatacomposer/views.py Tue Jun 11 15:46:43 2013 +0200
+++ b/src/metadatacomposer/views.py Tue Jun 11 15:47:02 2013 +0200
@@ -10,7 +10,7 @@
from guardian.shortcuts import assign
from ldt.ldt_utils.models import Project, Content
from ldt.ldt_utils.views.content import write_content_base, delete_content
-from ldt.ldt_utils.utils import generate_uuid
+from ldt.ldt_utils.utils import generate_uuid, copy_ldt
from ldt.security.permissionchecker import check_object_perm_for_user
from metadatacomposer.forms import ImageUploadModelForm
from metadatacomposer.models import Image
@@ -582,8 +582,9 @@
user=u, contents=proj.contents.all(),
description=proj.description,
set_icon=False)
+ # Copy project (copies xml/ldt data and updates the xml with the good new ldt_id)
+ newproj = copy_ldt(proj, newproj, u)
# 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)