web/polemicaltimeline.php
changeset 1539 2eca6c367a75
parent 1518 a3c6f244dbc1
child 1558 761ba7426984
--- a/web/polemicaltimeline.php	Tue Jan 12 13:47:11 2021 +0100
+++ b/web/polemicaltimeline.php	Tue Jan 12 17:29:44 2021 +0100
@@ -171,6 +171,34 @@
 <?php endif; ?>
             },
 <?php endif; ?>
+<?php if ($protocol_level > 1): ?>
+            {
+                type: "Polemic",
+                max_elements: 60,
+                default_version: "1",
+                annotation_type: ["chat"],
+                defaultcolor: "#9b8864",
+<?php if (isset($annotations)): ?>
+                polemics : { "<?php echo($annotation_protocol_version)?>":[
+<?php foreach ($annotations as $annot_key => $annot_def): ?>
+    <?php 
+    $hVal = (isset($annot_def['colors'])&&isset($annot_def['colors']['h']))?floatval($annot_def['colors']['h']):0.17;
+    $hVal = ($hVal<1)?floor($hVal*360.0):$hVal;
+    $sVal = (isset($annot_def['colors'])&&isset($annot_def['colors']['s']))?floatval($annot_def['colors']['s']):1.0;
+
+    $polemicColor = isset($annot_def['polemic_color'])?$annot_def['polemic_color']:rgb2hex(hsl2Rgb($hVal, $sVal, 0.5));
+
+    if($annot_key == 'default') { continue; } ?>
+                    {
+                        "name" : "<?php echo $annot_def['polemic_cat']; ?>",
+                        "keywords" : <?php echo json_encode($annot_def['polemic_keywords']); ?>,
+                        "color" : "<?php echo $polemicColor; ?>"
+                    },
+<?php endforeach; ?>
+                ]}
+<?php endif; ?>
+            },
+<?php endif; ?>
 <?php if ($protocol_level > 1 || isset($annotations)): ?>
             {
                 type: "MultiSegments",
@@ -193,16 +221,16 @@
                 //foreign_url : "<?php echo(LDT_PLATFORM); ?>ldtplatform/ldt/front/player/{{media}}/{{project}}/{{annotationType}}#id={{annotation}}",
                 container: "AnnotationsListContainer"
             },
-            {
-                type: "CreateAnnotation",
-                api_endpoint_template: "<?php echo(LDT_PLATFORM); ?>ldtplatform/api/ldt/1.0/annotations/",
-                api_method: 'POST',
-                after_send_timeout: 8000,
-                show_mic_record: false,
-                close_after_send: false,
-                slice_annotation_type: ["chap","découpage"],
-                creator_avatar: "<?php echo(URL_ROOT); ?>images/avatar.png"
-            },
+            // {
+            //     type: "CreateAnnotation",
+            //     api_endpoint_template: "<?php echo(LDT_PLATFORM); ?>ldtplatform/api/ldt/1.0/annotations/",
+            //     api_method: 'POST',
+            //     after_send_timeout: 8000,
+            //     show_mic_record: false,
+            //     close_after_send: false,
+            //     slice_annotation_type: ["chap","découpage"],
+            //     creator_avatar: "<?php echo(URL_ROOT); ?>images/avatar.png"
+            // },
 <?php endif; ?>
             { type: "Mediafragment"},
         ]