integration/js/edition.js
changeset 42 95e64fb6730f
parent 38 0e6e631718ee
child 48 827066f875c7
--- a/integration/js/edition.js	Mon May 27 16:08:26 2013 +0200
+++ b/integration/js/edition.js	Mon May 27 16:09:52 2013 +0200
@@ -386,6 +386,7 @@
             annotation.type = dataAnnotation.type;
             annotation.color = global.colors[(global.colorsIndex<global.colors.length) ? global.colorsIndex++ : (global.colorsIndex=0)];
             annotation.keywords = dataAnnotation.keywords;
+            annotation.content = getContentAnnotationByType(dataAnnotation.type);
 
         annotations.push(annotation);
         
@@ -519,19 +520,16 @@
 
             //particularité selon type
             switch(type){
-                case 'son':
+                case 'sound':
                     break;
                 case 'video':
                     break;
                 case 'text': 
                     var cledit = $(tabContent).find('.wysiwyg').cleditor(wysiwygConfig)[0];
-
-                    break;
-                case 'html': 
                     break;
-                case 'lien': 
+                case 'links': 
                     break;
-                case 'diaporama': 
+                case 'slideshow': 
                     $(tabContent).find('.number-spin').spin(spinParam);
                     $(tabContent).find('.ui-sortable').sortable({
                         stop : function(event, ui){
@@ -553,7 +551,7 @@
     function getIcon(type){
         var icon;
         switch(type){
-            case 'son': icon = 'volume-up';
+            case 'sound': icon = 'volume-up';
                 break;
             case 'video': icon = 'film';
                 break;
@@ -562,9 +560,9 @@
                 break;
             case 'html': icon = 'code';
                 break;
-            case 'lien': icon = 'link';
+            case 'links': icon = 'link';
                 break;
-            case 'diaporama': icon = 'picture';
+            case 'slideshow': icon = 'picture';
                 break;
         }
         return icon;
@@ -735,37 +733,49 @@
 
 }
 
-//content annotations
-var contentAnnotationText = {
-    mimetype : "application/x-ldt-text",
-    markup : "html",
-    text : ""
-};
-
-var contentAnnotationLinks = {
-    mimetype : "application/x-ldt-links",
-    markup : "html",
-    links : []
-};
+function getContentAnnotationByType(type){
+    var content;
+    switch(type){
+        case 'sound':
+            content = {
+                mimetype : "application/x-ldt-sound",
+                url : "",
+                embedcode : ""
+            };
+            break;
+        case 'video':
+            content = {
+                mimetype : "application/x-ldt-video",
+                url : "",
+                embedcode : ""
+            };
+            break;
+        case 'text': 
+            content = {
+                mimetype : "application/x-ldt-text",
+                markup : "html",
+                text : ""
+            };
+            break;
+        case 'links': 
+            content = {
+                mimetype : "application/x-ldt-links",
+                markup : "html",
+                links : []
+            };
+            break;
+        case 'slideshow': 
+            content = {
+                mimetype : "application/x-ldt-slideshow",
+                duration : 1,
+                autostart : false,
+                images : []
+            };
+            break;
+    }
+    return content;
+}//getContentAnnotationByType
 
-var contentAnnotationVideo = {
-    mimetype : "application/x-ldt-video",
-    url : "",
-    embedcode : ""
-};
-
-var contentAnnotationSon = {
-    mimetype : "application/x-ldt-sound",
-    url : "",
-    embedcode : ""
-};
-
-var contentAnnotationDiaporama = {
-    mimetype : "application/x-ldt-slideshow",
-    duration : 1,
-    autostart : false,
-    images : []
-};
 
 //test
 a = $(".wysiwyg").cleditor(wysiwygConfig);