Project

General

Profile

La timeline du portal » History » Version 3

Anonymous, 04/07/2012 16:38

1 1 Anonymous
h1. La timeline du portal
2 1 Anonymous
3 1 Anonymous
La timeline est un plugin indépendant qui doit être accessible sur le server, actuellement : _/usr/local/Sitools2_Corot/workspace/client-public/timeline_v2.3.0_
4 1 Anonymous
5 1 Anonymous
Un onglet "timeline" spécifique a été créer dans le portal pour pouvoir afficher ou non cette timeline.
6 1 Anonymous
7 1 Anonymous
Pour configurer les données affichées sur la timeline ainsi que les couleurs, éditer */usr/local/Sitools2_Corot/workspace/client-public/timeline_v2.3.0corot_timeline.xml*
8 1 Anonymous
9 1 Anonymous
Le code extJS pour la timeline : Dans le fichier *portal.js* (_/usr/local/Sitools2_Corot/workspace/client-user/js/portal_)
10 1 Anonymous
11 1 Anonymous
<pre><code class="javascript">
12 1 Anonymous
13 1 Anonymous
 /***************************************************************************      ligne 270                                                                                                                    
14 1 Anonymous
     * Creation du portlet Timeline                                                                                                                                                                                  
15 1 Anonymous
     */
16 1 Anonymous
17 1 Anonymous
    var portlet_timeline = new Ext.ux.Portlet({
18 1 Anonymous
        layout : 'fit',
19 1 Anonymous
        xtype : 'portal',
20 1 Anonymous
        portalId : "idPortal",
21 1 Anonymous
	id : ID.PORTLET.TIMELINE,
22 1 Anonymous
        title : 'Timeline',
23 1 Anonymous
        height : 300,
24 1 Anonymous
        autoload: true,
25 1 Anonymous
        triggerAction : 'all',
26 1 Anonymous
        items : [ new Ext.ux.ManagedIFrame.Panel({
27 1 Anonymous
            defaultSrc : "res/html/" + LOCALE + "/timeline.html",
28 1 Anonymous
            autoScroll : true
29 1 Anonymous
        })]
30 1 Anonymous
    });
31 1 Anonymous
32 1 Anonymous
[.............]
33 1 Anonymous
34 1 Anonymous
35 1 Anonymous
/***************************************************************************      ligne 370     
36 1 Anonymous
37 1 Anonymous
 items : [ {
38 1 Anonymous
                    region : 'north',
39 1 Anonymous
                    //id : 'portalId',                                                                                                                                                                               
40 1 Anonymous
                    columnWidth : 1,
41 1 Anonymous
                    style : 'padding:10px 10px 10px 10px', // 10 0 10 10 MH 12dec                                                                                                                                    
42 1 Anonymous
                    // baseCls : 'portalMainPanel',                                                                                                                                                                  
43 1 Anonymous
                    items : [ portlet_timeline  ]
44 1 Anonymous
                }, 
45 1 Anonymous
46 1 Anonymous
47 1 Anonymous
[..............]
48 1 Anonymous
49 1 Anonymous
50 1 Anonymous
/***************************************************************************      ligne 416
51 1 Anonymous
52 1 Anonymous
  children : [ {
53 1 Anonymous
                id : ID.PORTALTREENAV.TIMELINE,
54 1 Anonymous
                panelId : ID.PORTLET.TIMELINE,
55 1 Anonymous
		icon : 'res/images/icons/portlet.png',
56 1 Anonymous
                text : 'Timeline',
57 1 Anonymous
                leaf : true,
58 1 Anonymous
                checked : true,
59 1 Anonymous
                listeners : {
60 1 Anonymous
                    checkchange : function (node) {
61 1 Anonymous
                        if (!node.attributes.checked) {
62 1 Anonymous
                            Ext.get(node.attributes.panelId).hide();
63 1 Anonymous
                            // Pour que le panel n'ait plus de place reservee                                                                                                                                        
64 1 Anonymous
                            // dans le portal                                                                                                                                                                        
65 1 Anonymous
                            Ext.get(node.attributes.panelId).addClass('x-hide-display');
66 1 Anonymous
                        } else {
67 1 Anonymous
                            Ext.get(node.attributes.panelId).show();
68 1 Anonymous
                            Ext.get(node.attributes.panelId).removeClass('x-hide-display');
69 1 Anonymous
                        }
70 1 Anonymous
                    }
71 1 Anonymous
		}
72 1 Anonymous
            },
73 1 Anonymous
74 1 Anonymous
75 1 Anonymous
76 1 Anonymous
</code></pre>
77 1 Anonymous
78 1 Anonymous
79 1 Anonymous
80 3 Anonymous
Dans le fichier *id.js* (_/usr/local/Sitools2_Corot/workspace/client-user/js_) : rajouter les lignes _TIMELINE : 'portletTimelineId'_ et TIMELINE : 'navTimelineId'
81 1 Anonymous
82 1 Anonymous
<pre><code class="javascript">
83 1 Anonymous
84 1 Anonymous
var ID = {
85 1 Anonymous
    PANEL : {
86 1 Anonymous
        MENU : 'menuPanelId',
87 1 Anonymous
        TREE : 'treePanelId',
88 1 Anonymous
        MAIN : 'mainPanelId',
89 1 Anonymous
        HELP : 'helpPanelId'
90 1 Anonymous
    },
91 1 Anonymous
    CMP : {
92 1 Anonymous
        TOOLBAR : 'toolbarId',
93 1 Anonymous
        MENU : 'menuId'
94 1 Anonymous
    },
95 1 Anonymous
    WIN : {
96 1 Anonymous
        LOGIN : 'loginWinId',
97 1 Anonymous
        ORDER : 'orderWinId'
98 1 Anonymous
    },
99 1 Anonymous
    BOX : {
100 1 Anonymous
        REG : 'regBoxId',
101 1 Anonymous
        USER : 'userBoxId',
102 1 Anonymous
        GROUP : 'groupBoxId',
103 1 Anonymous
        FIREWALL : 'firewallBoxId'
104 1 Anonymous
    },
105 1 Anonymous
    PORTLET : {
106 1 Anonymous
        PROJET : 'portletProjectId',
107 1 Anonymous
        RECHERCHE : 'portletRecherceID',
108 1 Anonymous
        FEEDS : 'portletFeedsId',
109 1 Anonymous
        TIMELINE : 'portletTimelineId'
110 1 Anonymous
    },
111 1 Anonymous
    PORTALTREENAV : {
112 1 Anonymous
        PROJET : 'navProjectId',
113 1 Anonymous
        RECHERCHE : 'navRechercheId',
114 1 Anonymous
        FEEDS : 'navFeedsId',
115 1 Anonymous
        TIMELINE : 'navTimelineId'
116 1 Anonymous
117 1 Anonymous
    }
118 1 Anonymous
};
119 1 Anonymous
120 1 Anonymous
</pre></code>
121 2 Anonymous
122 2 Anonymous
123 2 Anonymous
124 3 Anonymous
Dans le fichier _/usr/local/Sitools2_Corot/workspace/client-user/res/html/en/timeline.html_  mettre le code : 
125 2 Anonymous
126 2 Anonymous
<pre><code class="html">
127 2 Anonymous
128 2 Anonymous
<html>
129 2 Anonymous
130 2 Anonymous
  <head>
131 2 Anonymous
132 2 Anonymous
    <!-- Load the Timeline library after reseting the fonts, etc -->
133 2 Anonymous
    <script type="text/javascript">
134 2 Anonymous
      Timeline_ajax_url="/sitools/common/timeline_v2.3.0/timeline_ajax/simile-ajax-api.js";
135 2 Anonymous
      Timeline_urlPrefix="/sitools/common/timeline_v2.3.0/timeline_js/";
136 2 Anonymous
      Timeline_parameters='bundle=true';
137 2 Anonymous
    </script>
138 2 Anonymous
    <script
139 2 Anonymous
       src="/sitools/common/timeline_v2.3.0/timeline_js/timeline-api.js?bundle=true&timeline-use-local-resources"
140 2 Anonymous
       type="text/javascript"></script>
141 2 Anonymous
142 2 Anonymous
<script type="text/javascript">
143 2 Anonymous
      var tl;
144 2 Anonymous
      function timelineload() {
145 2 Anonymous
      var eventSource = new Timeline.DefaultEventSource();
146 2 Anonymous
      var bandInfos = [
147 2 Anonymous
      Timeline.createBandInfo({
148 2 Anonymous
      eventSource:    eventSource,
149 2 Anonymous
      width:          "70%",
150 2 Anonymous
      intervalUnit:   Timeline.DateTime.MONTH,
151 2 Anonymous
      intervalPixels: 50
152 2 Anonymous
      }),
153 2 Anonymous
      Timeline.createBandInfo({
154 2 Anonymous
      overview:       true,
155 2 Anonymous
      eventSource:    eventSource,
156 2 Anonymous
      width:          "30%",
157 2 Anonymous
      intervalUnit:   Timeline.DateTime.YEAR,
158 2 Anonymous
      intervalPixels: 100
159 2 Anonymous
      })
160 2 Anonymous
      ];
161 2 Anonymous
      bandInfos[1].syncWith = 0;
162 2 Anonymous
      bandInfos[1].highlight = true;
163 2 Anonymous
164 2 Anonymous
      tl = Timeline.create(document.getElementById("tl"), bandInfos);
165 2 Anonymous
      Timeline.loadXML("/sitools/common/timeline_v2.3.0/corot_timeline.xml", function(xml, url) { eventSource.loadXML(xml, url); });
166 2 Anonymous
      }
167 2 Anonymous
168 2 Anonymous
    </script>
169 2 Anonymous
170 2 Anonymous
    <script type="text/javascript">
171 2 Anonymous
      var resizeTimerID = null;
172 2 Anonymous
      function onResize() {
173 2 Anonymous
      if (resizeTimerID == null) {
174 2 Anonymous
      resizeTimerID = window.setTimeout(function() {
175 2 Anonymous
      resizeTimerID = null;
176 2 Anonymous
      tl.layout();
177 2 Anonymous
      }, 500);
178 2 Anonymous
      }
179 2 Anonymous
      }
180 2 Anonymous
181 2 Anonymous
    </script>
182 2 Anonymous
183 2 Anonymous
184 2 Anonymous
  </head>
185 2 Anonymous
186 2 Anonymous
  <body onload="timelineload();" onresize="onResize();">
187 2 Anonymous
188 2 Anonymous
    <div id="tl" style="height: 150px; border: 1px solid #aaa; font-size: 8pt;"></div>
189 2 Anonymous
190 2 Anonymous
    <div align="center" style="margin:15px 0px 0px 0px"> <noscript> <div align="center" style="width:140px;border:1px solid #ccc; background: #2D84EF; color: #F7F5F2;font-weight:bold;font-size:12px;"> <a style="t\
191 2 Anonymous
ext-decoration: none; color:#F7F5F2;" href="http://mycountdown.org/Event/Launch/">Launch Countdown</a></div> </noscript> <script type="text/javascript" src="http://mycountdown.org/countdown.php?cp3_Hex=0F0200&cp2\
192 2 Anonymous
_Hex=2D84EF&cp1_Hex=F7F5F2&ham=0&img=&hbg=0&hfg=0&sid=0&fwdt=170&lab=1&text1=Launch&text2=CoRoT Launch&group=Event&countdown=Launch&widget_number=3010&event_time=1167229380&timezone=Europe/Madrid"></script> </div\
193 2 Anonymous
>
194 2 Anonymous
195 2 Anonymous
  </body>
196 2 Anonymous
</html>
197 2 Anonymous
198 2 Anonymous
199 2 Anonymous
</pre></code>