Advertisement
Guest User

Untitled

a guest
Jul 11th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <g:if test="${gnInfo.duration > 0}">
  2. <g:javascript src="substitution/dhtmlxgantt.js"></g:javascript>
  3. <link href="${resource(dir: 'css', file: 'dhtmlxgantt.css')}" rel="stylesheet"/>
  4. <div id="gantt_here" style='width:1100px; height:400px;'></div>
  5. <script type="text/javascript">
  6.  
  7.     gantt.config.start_date =  "${gnInfo.t0Date.format('yyyy.MM.dd HH:mm')}";
  8.  
  9.     var dated = new Date("${gnInfo.t0Date.format('yyyy.MM.dd HH:mm')}");
  10.     dated.setTime(dated.getTime() + ${gnInfo.duration}*60*60*1000);
  11.     gantt.config.end_date = dated;
  12.  
  13.     var tasks = {
  14.         data:[
  15.             {id:1, text:"GN",start_date:"10-10-2010 13:10", duration:1/24,
  16.                 progress: 0.6, open: true},
  17.             {id:2, text:"Etape 1",   start_date:"10-10-2010 14:10", duration:2/24,
  18.                 progress: 1,   open: true, parent:1},
  19.             {id:3, text:"Etape 2",   start_date:"10-10-2010 15:10", duration:3/24,
  20.                 progress: 0.5, open: true, parent:1},
  21.             {id:4, text:"Etape 2.1", start_date:"10-10-2010 16:10", duration:4/24,
  22.                 progress: 1,   open: true, parent:3},
  23.             {id:5, text:"Etape 2.2", start_date:"10-10-2010 17:10", duration:5/24,
  24.                 progress: 0.8, open: true, parent:3},
  25.             {id:6, text:"Etape 2.3", start_date:"10-10-2010 18:10", duration:6/24,
  26.                 progress: 0.2, open: true, parent:3}
  27.         ],
  28.         links:[
  29.             {id:1, source:1, target:2, type:"1"},
  30.             {id:2, source:1, target:3, type:"1"},
  31.             {id:3, source:3, target:4, type:"1"},
  32.             {id:4, source:4, target:5, type:"0"},
  33.             {id:5, source:5, target:6, type:"0"}
  34.         ]
  35.     };
  36.  
  37.     gantt.config.time_step = 1;
  38.     gantt.config.scale_height = 54;
  39.     gantt.config.scale_unit = "day";
  40.     gantt.config.date_scale = "%d-%m-%Y";
  41.     gantt.config.subscales = [
  42.         {unit:"hour", step:1, date:"%H:%i"}
  43.     ];
  44.  
  45.     gantt.config.lightbox.sections = [
  46.         {name:"description", height:108 , map_to:"text", type:"textarea",focus:true},
  47.         {name:"time", height:72, type:"duration", map_to:"auto", time_format:["%d","%m", "%Y", "%H:%i"]}
  48.     ];
  49.  
  50.     gantt.init("gantt_here");
  51.     gantt.parse (tasks);
  52.  
  53.  
  54. </script>
  55. </g:if>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement