timeline/js/timeline.js
changeset 84 2448fdcef656
parent 83 f8b1d6f5bb33
child 85 7a0de7ed7575
--- a/timeline/js/timeline.js	Fri Jul 20 16:37:23 2012 +0200
+++ b/timeline/js/timeline.js	Tue Jul 24 12:30:56 2012 +0200
@@ -522,7 +522,7 @@
             case "occurrence":
                 var _event = ( this.editing_occurrence.just_created ? "Ajout" : "MiseAJour" ) + "OccurrenceTimeline",
                     _data = {
-                        id: this.editing_occurrence.original_id,
+                        id: ( this.editing_occurrence.just_created ? undefined : this.editing_occurrence.original_id),
                         typeOccurrence: "Occurrence" + this.editing_occurrence.type.replace(/^./,function(_l) { return _l.toUpperCase()}),
                         datePublication : Math.floor(this.editing_occurrence.date / 1000),
                         titre : this.editing_occurrence.title,
@@ -839,7 +839,7 @@
             return _o.date;
         });
         _cluster.contents = _cluster.occurrences.map(function(_o) {
-            return _o.type + ":" + _o.id;
+            return _o.id;
         }).join("|");
         if (_cluster.contents == _this.open_cluster) {
             _openCluster = _cluster;
@@ -1068,8 +1068,8 @@
 
 Tlns.Classes.Occurrence.prototype.update = function(_type, _data) {
     this.type = _type;
-    if (typeof _data.idOccurrencePublication !== "undefined" || typeof _data.id !== "undefined" || typeof this.original_id === "undefined") {
-        this.original_id = _data.idOccurrencePublication || _data.id || Tlns.Utils.guid();
+    if (typeof _data.idOccurrenceNarrative !== "undefined" || typeof _data.idOccurrencePublication !== "undefined" || typeof _data.id !== "undefined" || typeof this.original_id === "undefined") {
+        this.original_id = _data.idOccurrenceNarrative || _data.idOccurrencePublication || _data.id || Tlns.Utils.guid();
     }
     this.id = _type + "_" + this.original_id;
     if (typeof _data.date !== "undefined" || typeof _data.datePublication !== "undefined") {
@@ -1093,16 +1093,14 @@
             case "valide":
                 this.status = "valide"
             break;
-            case "A valider":
-            case "a_valider":
-                this.status = "a_valider";
-            break;
             case "A réaliser":
             case "a_realiser":
                 this.status = "a_realiser";
             break;
+            case "A valider":
+            case "a_valider":
             default:
-                this.status = false;
+                this.status = "a_valider";
         }
     }
     if (typeof _data.typeOccurrencePublication !== "undefined" || typeof this.format === "undefined") {