Added pictos
authorveltr
Thu, 19 Sep 2013 19:34:29 +0200
changeset 96 7d1c2c21d891
parent 95 907a53a35a95
child 97 0444ad28e6ba
Added pictos
timeline/css/base.css
timeline/css/timeline.css
timeline/img/flash.png
timeline/img/previously.png
timeline/img/regle.png
timeline/img/roman.png
timeline/img/sondage.png
timeline/img/struggle.png
timeline/img/temoignage.png
timeline/js/timeline.js
timeline/timeline.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/timeline/css/base.css	Thu Sep 19 19:34:29 2013 +0200
@@ -0,0 +1,55 @@
+html, body, div, span, applet, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, big, cite, code,
+del, dfn, em, img, ins, kbd, q, s, samp,
+small, strike, strong, sub, sup, tt, var,
+b, u, i, center,
+dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td,
+article, aside, canvas, details, embed, 
+figure, figcaption, footer, header, hgroup, 
+menu, nav, output, ruby, section, summary,
+time, mark, audio, video {
+    margin: 0;
+    padding: 0;
+    border: 0;
+    font-size: 100%;
+    font: inherit;
+    vertical-align: baseline;
+}
+
+ul, li {
+    list-style: none;
+}
+
+input::-moz-focus-inner /*Remove button padding in FF*/
+{ 
+    border: 0;
+    padding: 0;
+}
+
+table {
+    border-collapse: separate; border-spacing: 0;
+}
+
+th, td {
+    vertical-align: top;
+}
+
+img a {
+    border: none;
+}
+
+body {
+    font-size: 10px; font-family: Arial, Helvetica, sans-serif;
+}
+
+/* FRONT PAGE SPECIFIC */
+
+h1 {
+    text-align: center; font-size: 20px; font-weight: bold; margin: 5px;
+}
+#timeline {
+    width: 780px; margin: 5px auto; text-align: center;
+}
\ No newline at end of file
--- a/timeline/css/timeline.css	Wed Sep 04 18:23:51 2013 +0200
+++ b/timeline/css/timeline.css	Thu Sep 19 19:34:29 2013 +0200
@@ -1,52 +1,3 @@
-html, body, div, span, applet, object, iframe,
-h1, h2, h3, h4, h5, h6, p, blockquote, pre,
-a, abbr, acronym, address, big, cite, code,
-del, dfn, em, img, ins, kbd, q, s, samp,
-small, strike, strong, sub, sup, tt, var,
-b, u, i, center,
-dl, dt, dd, ol, ul, li,
-fieldset, form, label, legend,
-table, caption, tbody, tfoot, thead, tr, th, td,
-article, aside, canvas, details, embed, 
-figure, figcaption, footer, header, hgroup, 
-menu, nav, output, ruby, section, summary,
-time, mark, audio, video {
-    margin: 0;
-    padding: 0;
-    border: 0;
-    font-size: 100%;
-    font: inherit;
-    vertical-align: baseline;
-}
-
-ul, li {
-    list-style: none;
-}
-
-input::-moz-focus-inner /*Remove button padding in FF*/
-{ 
-    border: 0;
-    padding: 0;
-}
-
-table {
-    border-collapse: separate; border-spacing: 0;
-}
-
-th, td {
-    vertical-align: top;
-}
-
-img a {
-    border: none;
-}
-
-body {
-    font-size: 10px; font-family: Arial, Helvetica, sans-serif;
-}
-
-/************************************************/
-
 .Tl-Main {
     font-family: Arial, Helvetica, sans-serif; text-align: left;
     position: relative;
@@ -123,7 +74,7 @@
 }
 
 .Tl-Occurrence {
-    width: 38px; height: 38px; cursor: pointer; border: 2px solid rgba(255,255,255,.9);
+    width: 32px; height: 32px; cursor: pointer; border: 2px solid rgba(255,255,255,.9);
 }
 
 .Tl-Occurrence img {
Binary file timeline/img/flash.png has changed
Binary file timeline/img/previously.png has changed
Binary file timeline/img/regle.png has changed
Binary file timeline/img/roman.png has changed
Binary file timeline/img/sondage.png has changed
Binary file timeline/img/struggle.png has changed
Binary file timeline/img/temoignage.png has changed
--- 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 || [];
--- a/timeline/timeline.html	Wed Sep 04 18:23:51 2013 +0200
+++ b/timeline/timeline.html	Thu Sep 19 19:34:29 2013 +0200
@@ -7,14 +7,9 @@
         <meta name="description" content="" />
         <meta name="author" content="Institut de Recherche et d'Innovation (IRI)" />
         <link rel="stylesheet" type="text/css" href="lib/jquery-ui.min.css" />
+        <link rel="stylesheet" type="text/css" href="css/base.css" />
         <link rel="stylesheet" type="text/css" href="css/timeline.css" />
         <style type="text/css">
-            h1 {
-                text-align: center; font-size: 20px; font-weight: bold; margin: 5px;
-            }
-            #timeline {
-                width: 780px; margin: 5px auto; text-align: center;
-            }
         </style>
         <script type="text/javascript" src="lib/jquery.min.js"> </script>
         <script type="text/javascript" src="lib/jquery.mousewheel.min.js"> </script>
@@ -32,17 +27,12 @@
                 _tl = new Tlns.Classes.Timeline({
                     email: 'anarchy@solicis.fr',
                     token: token,
-                    linelabels: [
-                        "Les jalons de l'histoire",
-                        "L'actualité",
-                        "Les appels à contribuer",
-                        "Les Persos d'Anarchy"
-                    ],
                     api_endpoint: "http://anarchy2.solicis.fr/api/cms/content?callback=?",
                     container: "timeline",
                     sync_now: false,
-                    central_time: Date.parse("2013-07-18T00:00:00Z"),
+                    central_time: Date.now(),//Date.parse("2013-07-18T00:00:00Z"),
                     maxtime: Date.now(),
+                    picto_url: "img/",
                     url_base: "http://anarchy2.solicis.fr"
                 });
             });