--- a/integration/js/edition.js Tue May 28 11:54:04 2013 +0200
+++ b/integration/js/edition.js Tue May 28 16:27:45 2013 +0200
@@ -7,7 +7,6 @@
$(function(){
var global = {
- diaporama : null,
idAnnotation : null,
colorsIndex : 0,
colors :
@@ -26,7 +25,7 @@
//chargement des chapitres et annotations existants
loadInitChapters();
- loadInitAnnotation()
+ loadInitAnnotation();
IriSP.htmlPlayer(
myMedia,
@@ -115,12 +114,9 @@
//########### modal
$(document).on('click', 'a.open-modal', function(e){
- var diaporama = $(this).attr('data-diaporama'),
- idAnnotation = $(this).attr('data-id');
+ var idAnnotation = $(this).attr('data-id');
- if(diaporama !== undefined){
- global.diaporama = diaporama;
- }
+
if(idAnnotation !== undefined){
global.idAnnotation = idAnnotation;
}
@@ -133,7 +129,8 @@
$('.input-image-'+typeImage).show();
});
-//bibliotheque
+//select on bibliotheque
+
//video
$('.popup').on('click', '.bibliotheque-video a', function(e){
e.preventDefault();
@@ -149,14 +146,6 @@
});
});
- //image
- $('.popup').on('click', '.bibliotheque-image a', function(e){
- e.preventDefault();
- var listDiaporama = $('#'+global.diaporama);
- addImageToDiaporama(listDiaporama);
- $('.popup').modal('hide');
- });
-
//confirmation suppression
@@ -555,12 +544,20 @@
break;
case 'slideshow':
+
$(tabContent).find('.number-spin').spin(spinParam);
$(tabContent).find('.ui-sortable').sortable({
stop : function(event, ui){
disabledBtnSortable($(this));
}
});
+ var diaporama = $(tabContent).find('#diaporama-'+idAnnotation),
+ images = viewType.content.images;
+ if(images.length){
+ $.each(images, function(k,v){
+ addImageToDiaporama(diaporama, v);
+ });
+ }
break;
}
@@ -624,12 +621,29 @@
}
//diaporama
- function addImageToDiaporama(diaporama){
+
+ //bibliotheque
+ $('.popup').on('click', '.bibliotheque-image a', function(e){
+ e.preventDefault();
+
+ var url = $(this).attr('href'),
+ image = {
+ id : currentAnnotation.id,
+ url : url,
+ title : 'titre image',
+ description : 'description azerty'
+ };
+ currentAnnotation.content.images.push(image);
+
+ var listDiaporama = $('#diaporama-'+currentAnnotation.id);
+ addImageToDiaporama(listDiaporama, image);
+ $('.popup').modal('hide');
+ });
+
+ function addImageToDiaporama(diaporama, dataView){
$.get('template.html', function(templates){
- var tplDiapo = $(templates).filter('#tpl-diaporama-row').html(),
- uniqId = 'id' + (new Date()).getTime(),
- viewDiapo = { ridid : uniqId};
- tplDiapo = Mustache.render(tplDiapo, viewDiapo);
+ var tplDiapo = $(templates).filter('#tpl-diaporama-row').html();
+ tplDiapo = Mustache.render(tplDiapo, dataView);
diaporama.append(tplDiapo);
disabledBtnSortable(diaporama);
});
@@ -716,8 +730,23 @@
currentAnnotation.content[name] = value;
});
+//annotation slideshow
+$('.tab-content').on('click', '.btn-autostart', function(){
+ var autostart = $(this).attr('data-autostart');
+ if(autostart == "true"){ autostart = true;}
+ else {autostart = false;}
+ currentAnnotation.content.autostart = autostart;
+});
+
+
+$('.tab-content').on('change keyup', '.config-diaporama input[name=duration]', function(){
+ var value = $(this).val();
+ if(!isNaN(value)){
+ currentAnnotation.content.duration = value;
+ }
+});
+
//################ config
-
//tagit
function onTagItChange(e, ui) {
var tagitType = $(this).attr('data-type'),