1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
/*
Functions used in resource viewers
*/
function loadResourceViewer(resourceId, tab, display_title) {
$('resource_loading').show();
if (display_title == undefined) {
display_title = true;
}
new Ajax.Updater('resource_container', baseUrl + '/resource/index/' + resourceId + '?tab=' + tab + '&display_title=' + display_title, {asynchronous:true, evalScripts:true});
return false;
}
// Display GWT component
function loadGWT(gwtId, resourceId, resourceKey, resourceName, resourceScope, resourceQualifier, resourceLanguage) {
config["resource"] = [
{"id":resourceId, "key":resourceKey, "name":resourceName, "scope":resourceScope, "qualifier":resourceQualifier, "lang":resourceLanguage}
];
config["resource_key"] = resourceId;
modules[gwtId]();
}
// cancel action : hide form and refresh violation
function cancelViolationAction(violation_id) {
new Ajax.Updater(
'vId' + violation_id,
baseUrl + '/reviews/display_violation/' + violation_id,
{
asynchronous:true,
evalScripts:true
});
return false;
}
function hideMoreViolationActions(violation_id) {
var popup = $('more' + violation_id);
if (popup != null) {
popup.hide();
}
}
// show the form to comment violation
function sCF(violation_id, review_action_id) {
hideMoreViolationActions(violation_id);
new Ajax.Updater('reviewForm' + violation_id,
baseUrl + '/reviews/violation_comment_form/' + violation_id
+ (review_action_id==null ? "" : "?review_action_id=" + review_action_id),
{
asynchronous:true,
evalScripts:true,
onComplete:function (request) {
$('vActions' + violation_id).remove();
$('reviewForm' + violation_id).show();
$('commentText' + violation_id).focus();
}
});
return false;
}
// show the form to change severity
function sCSF(violation_id) {
hideMoreViolationActions(violation_id);
new Ajax.Updater('reviewForm' + violation_id,
baseUrl + '/reviews/violation_change_severity_form/' + violation_id,
{
asynchronous:true,
evalScripts:true,
onComplete:function (request) {
$('vActions' + violation_id).remove();
$('reviewForm' + violation_id).show();
$('selectSeverity' + violation_id).focus();
}
});
return false;
}
// show the form to change status
function sCStF(violation_id) {
hideMoreViolationActions(violation_id);
new Ajax.Updater('reviewForm' + violation_id,
baseUrl + '/reviews/violation_change_status_form/' + violation_id,
{
asynchronous:true,
evalScripts:true,
onComplete:function (request) {
$('vActions' + violation_id).remove();
$('reviewForm' + violation_id).show();
$('commentText' + violation_id).focus();
}
});
return false;
}
// show the form to flag as false-positive
function sFPF(violation_id) {
hideMoreViolationActions(violation_id);
new Ajax.Updater('reviewForm' + violation_id,
baseUrl + '/reviews/violation_false_positive_form/' + violation_id,
{
asynchronous:true,
evalScripts:true,
onComplete:function (request) {
$('vActions' + violation_id).remove();
$('reviewForm' + violation_id).show();
$('commentText' + violation_id).focus();
}
});
return false;
}
// show the form to assign violation
function sAF(violation_id) {
hideMoreViolationActions(violation_id);
new Ajax.Updater('reviewForm' + violation_id,
baseUrl + '/reviews/violation_assign_form/' + violation_id,
{
asynchronous:true,
evalScripts:true,
onComplete:function (request) {
$('vActions' + violation_id).remove();
$('reviewForm' + violation_id).show();
$('assignee_login').focus();
}
});
return false;
}
// show the form to link a review to an action plan
function sAPF(violation_id) {
hideMoreViolationActions(violation_id);
new Ajax.Updater('reviewForm' + violation_id,
baseUrl + '/reviews/violation_action_plan_form/' + violation_id,
{
asynchronous:true,
evalScripts:true,
onComplete:function (request) {
$('vActions' + violation_id).remove();
$('reviewForm' + violation_id).show();
$('action_plan').focus();
}
});
return false;
}
// show the form to create violation
function sVF(resource, line, gray_colspan, white_colspan) {
row = $('createViolationForm' + line);
if (row == null) {
new Ajax.Updater(
'pos' + line,
baseUrl + '/resource/show_create_violation_form',
{
parameters:{resource:resource, line:line, gray_colspan:gray_colspan, white_colspan:white_colspan},
asynchronous:true,
evalScripts:true,
insertion:'after'
});
}
return false;
}
// hide review form
function hVF(line) {
row = $('createViolationRow' + line);
if (row != null) {
row.remove();
}
return false;
}
|