@@ -49,29 +49,31 @@ var GlpiGantt = (function() {
49
49
break ;
50
50
}
51
51
52
+ gantt . i18n . setLocale ( CFG_GLPI . language . substr ( 0 , 2 ) ) ;
53
+
52
54
var formatFunc = gantt . date . date_to_str ( parseDateFormat ) ;
53
55
54
56
return {
55
57
init : function ( $ID ) {
56
58
57
59
var project_subtypes = [
58
- { key : gantt . config . types . project , label : _n ( "Project" , "Projects" , 1 ) } ,
59
- { key : gantt . config . types . task , label : _n ( "Task" , "Tasks" , 1 ) } ,
60
- { key : gantt . config . types . milestone , label : __ ( "Milestone" ) }
60
+ { key : gantt . config . types . project , label : _n ( "Project" , "Projects" , 1 , 'gantt' ) } ,
61
+ { key : gantt . config . types . task , label : _n ( "Task" , "Tasks" , 1 , 'gantt' ) } ,
62
+ { key : gantt . config . types . milestone , label : __ ( "Milestone" , 'gantt' ) }
61
63
] ;
62
64
63
65
var task_subtypes = [
64
- { key : gantt . config . types . task , label : _n ( "Task" , "Tasks" , 1 ) } ,
65
- { key : gantt . config . types . milestone , label : __ ( "Milestone" ) }
66
+ { key : gantt . config . types . task , label : _n ( "Task" , "Tasks" , 1 , 'gantt' ) } ,
67
+ { key : gantt . config . types . milestone , label : __ ( "Milestone" , 'gantt' ) }
66
68
] ;
67
69
68
70
var default_section = [
69
- { name : "description" , height : 70 , map_to : "text" , type : "textarea" , focus : true , default_value : __ ( "New project" ) } ,
71
+ { name : "description" , height : 70 , map_to : "text" , type : "textarea" , focus : true , default_value : __ ( "New project" , 'gantt' ) } ,
70
72
{ name : "time" , type : "duration" , map_to : "auto" }
71
73
] ;
72
74
73
75
var new_project_section = [
74
- { name : "description" , height : 70 , map_to : "text" , type : "textarea" , focus : true , default_value : __ ( "New project" ) } ,
76
+ { name : "description" , height : 70 , map_to : "text" , type : "textarea" , focus : true , default_value : __ ( "New project" , 'gantt' ) } ,
75
77
{ name : "time" , type : "duration" , map_to : "auto" } ,
76
78
{ name : "type" , type : "radio" , map_to : "type" , options : project_subtypes , default_value : gantt . config . types . project }
77
79
] ;
@@ -145,24 +147,24 @@ var GlpiGantt = (function() {
145
147
146
148
gantt . templates . tooltip_text = function ( start , end , task ) {
147
149
var text = "<b><span class=\"capitalize\">" +
148
- task . type + ":</span></b> " + task . text + "<br/><b>" + __ ( "Start date:" ) + "</b> " +
150
+ task . type + ":</span></b> " + task . text + "<br/><b>" + __ ( "Start date:" , 'gantt' ) + "</b> " +
149
151
gantt . templates . tooltip_date_format ( start ) +
150
- "<br/><b>" + __ ( "End date:" ) + "</b> " + gantt . templates . tooltip_date_format ( end ) +
151
- "<br/><b>" + __ ( "Progress:" ) + "</b> " + parseInt ( task . progress * 100 ) + "%" ;
152
+ "<br/><b>" + __ ( "End date:" , 'gantt' ) + "</b> " + gantt . templates . tooltip_date_format ( end ) +
153
+ "<br/><b>" + __ ( "Progress:" , 'gantt' ) + "</b> " + parseInt ( task . progress * 100 ) + "%" ;
152
154
if ( task . content && task . content . length > 0 ) {
153
- text += "<br/><b>" + __ ( "Description:" ) + "</b><div style=\"padding-left:25px\">" + task . content + "</div>" ;
155
+ text += "<br/><b>" + __ ( "Description:" , 'gantt' ) + "</b><div style=\"padding-left:25px\">" + task . content + "</div>" ;
154
156
}
155
157
if ( task . comment && task . comment . length > 0 ) {
156
- text += "<br/><b>" + __ ( "Comment:" ) + "</b><div style=\"padding-left:25px\">" + task . comment + "</div>" ;
158
+ text += "<br/><b>" + __ ( "Comment:" , 'gantt' ) + "</b><div style=\"padding-left:25px\">" + task . comment + "</div>" ;
157
159
}
158
160
return text ;
159
161
} ;
160
162
161
163
// columns definition
162
164
gantt . config . columns = [
163
- { name : "text" , label : __ ( "Project / Task" ) , width : 290 , tree : true , align : "left" } ,
164
- { name : "start_date" , label : __ ( "Start date" ) , align : "left" , width : 90 } ,
165
- { name : "duration" , label : __ ( "Duration" ) , align : "center" , width : 47 } ,
165
+ { name : "text" , label : __ ( "Project / Task" , 'gantt' ) , width : 290 , tree : true , align : "left" } ,
166
+ { name : "start_date" , label : __ ( "Start date" , 'gantt' ) , align : "left" , width : 90 } ,
167
+ { name : "duration" , label : __ ( "Duration" , 'gantt' ) , align : "center" , width : 47 } ,
166
168
{ name : "add" , align : "center" }
167
169
] ;
168
170
@@ -210,7 +212,7 @@ var GlpiGantt = (function() {
210
212
} ,
211
213
{
212
214
unit : "week" ,
213
- format : __ ( "Week #%s" ) . replace ( '%s' , '%W' )
215
+ format : __ ( "Week #%s" , 'gantt' ) . replace ( '%s' , '%W' )
214
216
}
215
217
]
216
218
} ,
@@ -321,7 +323,7 @@ var GlpiGantt = (function() {
321
323
if ( task . $new ) {
322
324
gantt . getLightboxSection ( "time" ) . setValue ( new Date ( ) ) ;
323
325
if ( ! isNaN ( task . parent ) ) {
324
- gantt . getLightboxSection ( "description" ) . setValue ( __ ( 'New project' ) ) ;
326
+ gantt . getLightboxSection ( "description" ) . setValue ( __ ( 'New project' , 'gantt' ) ) ;
325
327
}
326
328
} else {
327
329
if ( gantt . getLightboxSection ( "type" ) ) {
@@ -370,16 +372,16 @@ var GlpiGantt = (function() {
370
372
371
373
switch ( parseInt ( link . type ) ) {
372
374
case parseInt ( gantt . config . links . finish_to_start ) :
373
- linkTitle = __ ( "Finish to Start: " ) ;
375
+ linkTitle = __ ( "Finish to Start: " , 'gantt' ) ;
374
376
break ;
375
377
case parseInt ( gantt . config . links . finish_to_finish ) :
376
- linkTitle = __ ( "Finish to Finish: " ) ;
378
+ linkTitle = __ ( "Finish to Finish: " , 'gantt' ) ;
377
379
break ;
378
380
case parseInt ( gantt . config . links . start_to_start ) :
379
- linkTitle = __ ( "Start to Start: " ) ;
381
+ linkTitle = __ ( "Start to Start: " , 'gantt' ) ;
380
382
break ;
381
383
case parseInt ( gantt . config . links . start_to_finish ) :
382
- linkTitle = __ ( "Start to Finish: " ) ;
384
+ linkTitle = __ ( "Start to Finish: " , 'gantt' ) ;
383
385
break ;
384
386
}
385
387
@@ -388,12 +390,12 @@ var GlpiGantt = (function() {
388
390
modal = gantt . modalbox ( {
389
391
title : `<p class="gantt_cal_lsection" style="line-height:normal">${ linkTitle } </p>` ,
390
392
text : `<div class="gantt_cal_lsection">
391
- <label>${ __ ( "Lag" ) } <input type="number" class="lag-input" /></label>
393
+ <label>${ __ ( "Lag" , 'gantt' ) } <input type="number" class="lag-input" /></label>
392
394
</div>` ,
393
395
buttons : [
394
- { label : __ ( "Save" ) , css : "gantt_save_btn" , value : "save" } ,
395
- { label : __ ( "Cancel" ) , css : "gantt_cancel_btn" , value : "cancel" } ,
396
- { label : __ ( "Delete" ) , css : "gantt_delete_btn" , value : "delete" }
396
+ { label : __ ( "Save" , 'gantt' ) , css : "gantt_save_btn" , value : "save" } ,
397
+ { label : __ ( "Cancel" , 'gantt' ) , css : "gantt_cancel_btn" , value : "cancel" } ,
398
+ { label : __ ( "Delete" , 'gantt' ) , css : "gantt_delete_btn" , value : "delete" }
397
399
] ,
398
400
width : "500px" ,
399
401
callback : function ( result ) {
@@ -515,7 +517,7 @@ var GlpiGantt = (function() {
515
517
gantt . message . position = 'bottom' ;
516
518
gantt . message ( {
517
519
type : 'warning' ,
518
- text : __ ( 'Gantt mode: \'Readonly\'' ) ,
520
+ text : __ ( 'Gantt mode: \'Readonly\'' , 'gantt' ) ,
519
521
expire : - 1
520
522
} ) ;
521
523
}
@@ -561,22 +563,22 @@ var GlpiGantt = (function() {
561
563
var valid = true ;
562
564
563
565
if ( source . type == 'project' && target . type == 'project' ) {
564
- gantt . alert ( __ ( "Links between projects cannot be created." ) ) ;
566
+ gantt . alert ( __ ( "Links between projects cannot be created." , 'gantt' ) ) ;
565
567
valid = false ;
566
568
} else if ( source . type == 'project' || target . type == 'project' ) {
567
- gantt . alert ( __ ( "Links between projects and tasks cannot be created." ) ) ;
569
+ gantt . alert ( __ ( "Links between projects and tasks cannot be created." , 'gantt' ) ) ;
568
570
valid = false ;
569
571
} else if ( type == gantt . config . links . finish_to_start && target . start_date < source . end_date ) {
570
- gantt . alert ( __ ( "Target task can't start before source task ends." ) ) ;
572
+ gantt . alert ( __ ( "Target task can't start before source task ends." , 'gantt' ) ) ;
571
573
valid = false ;
572
574
} else if ( type == gantt . config . links . start_to_start && target . start_date < source . start_date ) {
573
- gantt . alert ( __ ( "Target task can't start before source task starts." ) ) ;
575
+ gantt . alert ( __ ( "Target task can't start before source task starts." , 'gantt' ) ) ;
574
576
valid = false ;
575
577
} else if ( type == gantt . config . links . finish_to_finish && target . end_date < source . end_date ) {
576
- gantt . alert ( __ ( "Target task can't end before source task ends." ) ) ;
578
+ gantt . alert ( __ ( "Target task can't end before source task ends." , 'gantt' ) ) ;
577
579
valid = false ;
578
580
} else if ( type == gantt . config . links . start_to_finish && target . end_date < source . start_date ) {
579
- gantt . alert ( __ ( "Target task can't end before the source task starts." ) ) ;
581
+ gantt . alert ( __ ( "Target task can't end before the source task starts." , 'gantt' ) ) ;
580
582
valid = false ;
581
583
}
582
584
return valid ;
@@ -604,7 +606,7 @@ var GlpiGantt = (function() {
604
606
gantt . deleteTask ( id ) ;
605
607
displayAjaxMessageAfterRedirect ( ) ;
606
608
} else {
607
- gantt . alert ( __ ( 'Could not create task: ' ) + json . error ) ;
609
+ gantt . alert ( __ ( 'Could not create task: ' , 'gantt' ) + json . error ) ;
608
610
}
609
611
} ,
610
612
error : function ( resp ) {
@@ -638,7 +640,7 @@ var GlpiGantt = (function() {
638
640
gantt . hideLightbox ( ) ;
639
641
displayAjaxMessageAfterRedirect ( ) ;
640
642
} else
641
- gantt . alert ( __ ( 'Could not update Task[%s]: ' ) . replace ( '%s' , item . text ) + json . error ) ;
643
+ gantt . alert ( __ ( 'Could not update Task[%s]: ' , 'gantt' ) . replace ( '%s' , item . text ) + json . error ) ;
642
644
} ,
643
645
error : function ( resp ) {
644
646
gantt . alert ( resp . responseText ) ;
@@ -665,7 +667,7 @@ var GlpiGantt = (function() {
665
667
gantt . updateTask ( task . id ) ;
666
668
displayAjaxMessageAfterRedirect ( ) ;
667
669
} else {
668
- gantt . alert ( __ ( 'Could not update Task[%s]: ' ) . replace ( '%s' , task . text ) + json . error ) ;
670
+ gantt . alert ( __ ( 'Could not update Task[%s]: ' , 'gantt' ) . replace ( '%s' , task . text ) + json . error ) ;
669
671
gantt . undo ( ) ;
670
672
}
671
673
}
@@ -743,7 +745,7 @@ var GlpiGantt = (function() {
743
745
gantt . deleteTask ( id ) ;
744
746
displayAjaxMessageAfterRedirect ( ) ;
745
747
} else {
746
- gantt . alert ( __ ( 'Could not create project: ' ) + json . error ) ;
748
+ gantt . alert ( __ ( 'Could not create project: ' , 'gantt' ) + json . error ) ;
747
749
}
748
750
} ,
749
751
error : function ( resp ) {
@@ -771,7 +773,7 @@ var GlpiGantt = (function() {
771
773
gantt . hideLightbox ( ) ;
772
774
displayAjaxMessageAfterRedirect ( ) ;
773
775
} else {
774
- gantt . alert ( __ ( 'Could not update Project[%s]: ' ) . replace ( '%s' , item . text ) + json . error ) ;
776
+ gantt . alert ( __ ( 'Could not update Project[%s]: ' , 'gantt' ) . replace ( '%s' , item . text ) + json . error ) ;
775
777
}
776
778
} ,
777
779
error : function ( resp ) {
0 commit comments