--- a/timeline/js/timeline.js Wed Sep 04 18:23:51 2013 +0200
+++ b/timeline/js/timeline.js Thu Sep 19 19:34:29 2013 +0200
@@ -119,8 +119,14 @@
height : 225,
min_width : 400,
min_height : 100,
- main_width : 700,
- linelabels : [],
+ main_width : 726,
+ linelabels : [
+ "RDV",
+ "Actu",
+ "Appels",
+ "Persos"
+ ],
+ picto_url: "img/",
timescales : [{
label : "Semaine",
span : 7 * 86400 * 1000,
@@ -154,22 +160,58 @@
occurrences: [],
grid_spacing: 12,
tooltip_date_format: '{{dayOfMonth}} {{shortMonthName}} {{year}} {{0hours}}:{{0minutes}}',
- statuses: {
- "valide": "Validée",
- "a_valider": "A valider",
- "a_realiser": "A réaliser"
- },
- class_labels: {
- "Cms\\Previously": "Précédemment",
- "Cms\\Chapter": "Chapitre",
- "Cms\\Article": "Article",
- "Cms\\Poll": "Sondage",
- "Cms\\CallWitness": "Appel à Témoins",
- "Cms\\CallCharacter": "Appel à Personnage",
- "Cms\\Message": "Message",
- "Cms\\Rule": "Règle",
- "Cms\\Video": "Vidéo",
- "Cms\\SweetCadaver": "Cadavre exquis"
+ class_info: {
+ "Cms\\Previously": {
+ label: "Précédemment",
+ univers_id: 0,
+ picto: "previously.png",
+ show: true
+ },
+ "Cms\\Chapter": {
+ label: "Roman",
+ univers_id: 0,
+ picto: "roman.png",
+ show: true
+ },
+ "Cms\\FlashTrash": {
+ label: "JT",
+ univers_id: 0,
+ picto: "flash.png",
+ show: true
+ },
+ "Cms\\Article": {
+ label: "Article",
+ univers_id: 1,
+ show: true
+ },
+ "Cms\\Poll": {
+ label: "Sondage",
+ univers_id: 2,
+ picto: "sondage.png",
+ show: true
+ },
+ "Cms\\CallWitness": {
+ label: "Appel à Témoins",
+ univers_id: 2,
+ picto: "temoignage.png",
+ show: true
+ },
+ "Cms\\Rule": {
+ label: "Règle du jour",
+ univers_id: 2,
+ picto: "regle.png",
+ show: true
+ },
+ "Cms\\CallCharacter": {
+ label: "Appel à Personnage",
+ univers_id: 3,
+ show: true
+ },
+ "Cms\\SweetCadaver": {
+ label: "Cadavre exquis",
+ univers_id: 3,
+ show: true
+ }
},
maxtime: false,
url_base: ""
@@ -191,7 +233,7 @@
Tlns.Templates.Univers = '<div class="Tl-UniversText">{{title}}</div>';
Tlns.Templates.Occurrence =
- '{{#occurrences}}<div class="Tl-Occurrence Tl-OccOnGrid Tl-Occ{{type}} Tl-Occ{{status}}{{#editing}} Tl-Editing{{/editing}}" occurrence-id="{{id}}" style="left: {{x}}px; top: {{y}}px;">'
+ '{{#occurrences}}<div class="Tl-Occurrence Tl-OccOnGrid Tl-Occ{{type}}{{#editing}} Tl-Editing{{/editing}}" occurrence-id="{{id}}" style="left: {{x}}px; top: {{y}}px;">'
+ '{{#image}}<img src="{{image}}" />{{/image}}'
+ '</div>{{/occurrences}}';
@@ -434,23 +476,14 @@
Tlns.Classes.Timeline.prototype.createOrUpdateOccurrence = function(_data) {
var _id = _data.id,
- _occurrence = this.getOccurrence(_id);
- switch (_data.__CLASS__) {
- case "Cms\\Previously":
- case "Cms\\Chapter":
- case "Cms\\Article":
- case "Cms\\Video":
- case "Cms\\Poll":
- case "Cms\\Rule":
- case "Cms\\CallWitness":
- case "Cms\\CallCharacter":
- case "Cms\\SweetCadaver":
- if (typeof _occurrence === "undefined") {
- _occurrence = new Tlns.Classes.Occurrence(this);
- this.occurrences.push(_occurrence);
- }
- _occurrence.update(_data);
- break;
+ _occurrence = this.getOccurrence(_id),
+ typeinfo = this.class_info[_data.__CLASS__];
+ if (typeinfo && typeinfo.show) {
+ if (typeof _occurrence === "undefined") {
+ _occurrence = new Tlns.Classes.Occurrence(this);
+ this.occurrences.push(_occurrence);
+ }
+ _occurrence.update(_data);
}
return _occurrence;
}
@@ -476,10 +509,10 @@
_occ.x = _this.current_scale * (_occ.date - _this.start_time);
_occ.y = _occ.univers.y;
});
- var minT = this.timeFromX(-38),
+ var minT = this.timeFromX(-32),
minI = this.timescales[this.level].min_importance;
var _visible = _(this.occurrences).filter(function(_occ) {
- return (_occ.date >= minT && _occ.date <= _this.end_time && _occ.status && (_occ.importance >= minI));
+ return (_occ.date >= minT && _occ.date <= _this.end_time && (_occ.importance >= minI));
});
var _moved = true, l = 0;
@@ -587,48 +620,17 @@
this.title = _data.title;
this.type = _data.__CLASS__;
this.importance = _data.importance;
- switch(_data.__CLASS__) {
- case "Cms\\Previously":
- case "Cms\\Chapter":
- case "Cms\\Video":
- this.univers_id = 0;
- break;
- case "Cms\\Article":
- this.univers_id = 1;
- break;
- case "Cms\\Poll":
- case "Cms\\Rule":
- case "Cms\\CallWitness":
- this.univers_id = 2;
- break;
- case "Cms\\CallCharacter":
- case "Cms\\SweetCadaver":
- this.univers_id = 3;
- break;
+ var typeinfo = this.timeline.class_info[_data.__CLASS__];
+ this.univers_id = typeinfo.univers_id;
+ if (_data.contentHasMedias && _data.contentHasMedias.length) {
+ this.image = _data.contentHasMedias[0].media.carre.replace(/carre\/[\d]+\/[\d]+/,'carre/32/32');
+ this.detail_image = _data.contentHasMedias[0].media.carre.replace(/carre\/[\d]+\/[\d]+/,'carre/135/135');
+ }
+ if (typeinfo.picto) {
+ this.image = this.timeline.picto_url + typeinfo.picto;
}
this.univers = this.timeline.univers[this.univers_id];
- if (typeof _data.statut !== "undefined" || typeof this.status === "undefined") {
- switch(_data.statut) {
- case "Validée":
- case "valide":
- this.status = "valide"
- break;
- case "A réaliser":
- case "a_realiser":
- this.status = "a_realiser";
- break;
- case "A valider":
- case "a_valider":
- default:
- this.status = "a_valider";
- }
- }
- this.format = this.timeline.class_labels[this.type];
- if (_data.contentHasMedias && _data.contentHasMedias.length) {
- this.image = _data.contentHasMedias[0].media.carre.replace(/carre\/[\d]+\/[\d]+/,'carre/38/38');
- this.detail_image = _data.contentHasMedias[0].media.carre.replace(/carre\/[\d]+\/[\d]+/,'carre/135/135');
- }
- this.translated_status = Tlns.Defaults.Timeline.statuses[this.status];
+ this.format = typeinfo.label;
// this.published = (_data.publication && _data.publication == "En ligne");
// this.locked = _data.verrouille || false;
// this.characters = _data.personnagesSecondaires || [];