OpenSource » SampleCode » Brail2Razor
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

Added additional methods for date time components and updated the test files

Changeset dd227daa1d04

Parent a3abb5320257

by Profile picture of User 253Rondell Hames <rondell.hames@nexportengineering.com>

Changes to 3 files · Browse files at dd227daa1d04 Showing diff from parent a3abb5320257 Diff from another changeset...

 
29
30
31
32
 
33
34
35
 
43
44
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
47
48
 
147
148
149
 
150
151
152
 
153
154
155
156
157
158
159
160
161
162
 
 
 
 
 
163
164
165
166
167
168
 
 
 
 
 
169
170
171
172
173
174
175
176
 
 
177
178
179
 
188
189
190
 
 
 
 
 
 
 
 
 
191
192
193
194
 
195
196
 
 
 
 
 
 
 
 
 
 
 
197
198
199
200
201
202
 
203
204
205
 
252
253
254
255
256
257
258
 
 
 
 
 
 
 
259
260
261
 
278
279
280
281
 
282
283
284
 
288
289
290
291
 
292
293
294
 
305
306
307
308
 
309
310
311
 
370
371
372
373
374
 
 
 
 
 
 
 
 
375
376
377
 
388
389
390
 
391
392
393
 
398
399
400
 
 
 
401
402
403
 
29
30
31
 
32
33
34
35
 
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
 
161
162
163
164
165
166
 
167
168
169
170
171
172
173
 
 
 
 
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
 
 
196
197
198
199
200
 
209
210
211
212
213
214
215
216
217
218
219
220
221
 
 
 
222
223
 
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
 
240
241
242
243
 
290
291
292
 
 
 
 
293
294
295
296
297
298
299
300
301
302
 
319
320
321
 
322
323
324
325
 
329
330
331
 
332
333
334
335
 
346
347
348
 
349
350
351
352
 
411
412
413
 
 
414
415
416
417
418
419
420
421
422
423
424
 
435
436
437
438
439
440
441
 
446
447
448
449
450
451
452
453
454
@@ -29,7 +29,7 @@
  );     public static Regex TernaryBlockRegex = new Regex( - "\\(\\s*((?:\\w|[().])+)\\s+if\\s+(.+)\\s+else\\s+(.+)\\s*\\)", + @"\(\s*((?:\w|[().""'])+)\s+if\s+(.+)\s+else\s+(.+)\s*\)",   RegexOptions.Singleline   | RegexOptions.CultureInvariant   | RegexOptions.Compiled @@ -43,6 +43,20 @@
  | RegexOptions.Compiled   );   + public static Regex DateFormatComponentRegex = new Regex( + @"component\s+DateFormat\,\s*(\{.*\})\s*:\s*end", + RegexOptions.Singleline + | RegexOptions.CultureInvariant + | RegexOptions.Compiled + ); + + public static Regex Colon2EqualInDateFormatComponentRegex = new Regex( + @"\""([^""]*)\""\s*\:", + RegexOptions.Singleline + | RegexOptions.CultureInvariant + | RegexOptions.Compiled + ); +   public static Regex OutputSubviewSingleParamRegex = new Regex(   "OutputSubView\\s*\\(\\s*(\\\"[^\"]*\\\"\\s*)\\s*\\)",   RegexOptions.Singleline @@ -147,33 +161,40 @@
  private static SearchOption _allDirs;   private static bool _insideElement;   private static List<string> _imports; + private static string _singleFile;     - static void Main(string[] args) + static void Main(string[] args)   {   var p = new FluentCommandLineParser();     p.SetupHelp("?", "help")   .Callback(text => Console.WriteLine(text));   - p.Setup<string>('d', "directory") - .WithDescription("The directory to scan for brail files.") - .Callback(dir => _directory = dir) - .Required(); + p.Setup<string>('d', "directory") + .WithDescription("The directory to scan for brail files.") + .Callback(dir => _directory = dir) + .SetDefault(null) + ;     p.Setup<string>('e', "extension")   .WithDescription("The brail file extension. The default is .brail")   .Callback(ext => _extension = ext.StartsWith(".") ? ext.Substring(1) : ext)   .SetDefault("brail");   + p.Setup<string>('f', "file") + .WithDescription("The brail file to convert.") + .Callback(file => _singleFile = file) + .SetDefault(null); +   p.Setup<bool>('s', "subdirs")   .WithDescription("If set then the converter will include sub directories.")   .Callback(include => _allDirs = include ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);       var result = p.Parse(args); - - if (result.HasErrors) + + if (result.HasErrors || (!File.Exists(_singleFile) && !Directory.Exists(_directory)))   {   Console.WriteLine(result.ErrorText);   @@ -188,18 +209,35 @@
  }     Console.WriteLine("Starting brail to razor conversion of directory {0}", _directory); + string[] files; + if (_singleFile != null) + { + files = new[] {_singleFile}; + } + else + { + files = System.IO.Directory.GetFiles(_directory, "*." + _extension, _allDirs); + }   - var files = System.IO.Directory.GetFiles(_directory, "*." + _extension, _allDirs); - - foreach (var file in files) + foreach (var file in files)   { - BrailConvert(file, Path.ChangeExtension(file, "cshtml")); + try + { + BrailConvert(file, Path.ChangeExtension(file, "cshtml")); + Console.WriteLine("SUCCESS: " + file + "\n"); + } + catch (Exception ex) + { + Console.WriteLine("FAILED: " + file); + Console.WriteLine("Message: " + ex.Message); + } +   }   }     private static void BrailConvert(string brailPath, string outPath)   { - _imports = new List<string>(); + _imports = new List<string>() { "using NexportVirtualCampus.Utilities" };     Console.WriteLine("Converting file {0}", brailPath);   string code; @@ -252,10 +290,13 @@
  break;   case "%>":   //Get rid of the extra stuff - currentCodeBlock.Remove(currentCodeBlock.Length - 2,2); - string converted = ConvertBrailBlockToRazor(currentCodeBlock.ToString()); - razorOut.Append(converted); - currentCodeBlock.Clear(); + if(currentCodeBlock.Length > 0) + { + currentCodeBlock.Remove(Math.Max(0, currentCodeBlock.Length - 2),2); + string converted = ConvertBrailBlockToRazor(currentCodeBlock.ToString()); + razorOut.Append(converted); + currentCodeBlock.Clear(); + }   codeLocation = CodeLocationEnum.NormalText;   break;   case "${": @@ -278,7 +319,7 @@
    if (previosChar == '<' && codeLocation == CodeLocationEnum.NormalText)   { - // INSIDE AN ELEMENT + // INSIDE AN ELEMENTl   _insideElement = true;   }   @@ -288,7 +329,7 @@
  }     //Add the imports - var imports = String.Join(Environment.NewLine, _imports.Select(i => "@" + i + ";").ToArray()); + var imports = String.Join(Environment.NewLine, _imports.Select(i => "@" + i).ToArray());   File.WriteAllText(outPath, imports + Environment.NewLine + razorOut.ToString());     } @@ -305,7 +346,7 @@
  finalResult = "</text>" + finalResult;     } - else if (brail.Trim().Equals("else:")) + else if (brail.Trim().Equals("else:") || brail.Trim().Equals("else :"))   {   finalResult += "}else{";   if (_insideElement) @@ -370,8 +411,14 @@
  lineResult = NotIsNullRegex.Replace(lineResult, " $1 != null ");   lineResult = FixStandaloneNotRegex.Replace(lineResult, "!($1)");   lineResult = lineResult.Replace(" is null", " == null"); - - lineResult = lineResult.Replace("ViewHelper.TableStripe()", "new HtmlTableStripePainter()"); + lineResult = lineResult.Replace(" is !(", " != ("); + if (DateFormatComponentRegex.IsMatch(lineResult)) + { + lineResult = DateFormatComponentRegex.Replace(lineResult, + "Html.DisplayDate(new DisplayDateProperties()$1)"); + lineResult = Colon2EqualInDateFormatComponentRegex.Replace(lineResult, "$1 = "); + } + lineResult = lineResult.Replace("ViewHelper.TableStripe()", "new HtmlTableStripePainter()");     if(lineResult.Trim() == "end")   lineResult = lineResult.Replace("end", "}"); @@ -388,6 +435,7 @@
    if (NewLineRegex.IsMatch(finalResult))   { + //Multiline statement!   finalResult = finalResult.Trim();   if (finalResult[0] == '@')   finalResult = finalResult.Substring(1); @@ -398,6 +446,9 @@
  }   else   { + //Singleline Statement + //Change RenderPartial to just Partial + finalResult = finalResult.Replace("Html.RenderPartial", "Html.Partial");   finalResult = "@" + finalResult.Trim();     }
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
 
@@ -1,67 +1,106 @@
-<% -import Nexport.Models -import Nexport.Models.Assignments +<% import System %> +<% dialogTitle = 'Attempt ' + (attempt.AttemptIndex+1) + ' for ' + attempt.AssignmentStatus.Enrollment.Subscription.User.FormalName + score = (Math.Round(attempt.Score,0) if attempt.IsComplete else '-') + isLocked = assignment.IsTimedTest and attempt.IsComplete == false and attempt.IsWithinGracePeriod() == false and not attempt.AllowReLaunch + if score == '-': + if isLocked: + statusIcon = "lock" + else: + statusIcon = "" + end + else: + if score >= assignment.MasteryScore: + statusIcon = "validate-ok" + else: + statusIcon = "validate-fail" + end + end   -OutputSubView("WithSpace/DisplayITrainingDates") - + canStudentReview = assignment.CanStudentReview and isInstructor == false and attempt.IsComplete and score >= assignment.MasteryScore  %> -<% OutputSubView("WithSpace/DisplayITrainingDates") %> -<div class="layout-percent"> - <div class="col width-1of2 right"><label>Is Academically Overridden?:</label></div> - <div class="col last width-1of2 left"><label><% if item.AcademicOverride: %>!{commonText.yes}<% else: %>!{commonText.no}<% end %></label></div> -</div> -<div class="layout-percent"> - <div class="col width-1of2 right"><label>Academic Override By:</label></div> - <div class="col last width-1of2 left"><label><% foo = (item.AcademicOverrideAdmin.FullName if item.AcademicOverride and not item.AcademicOverrideAdmin == null else "n/a") %>!{foo}</label></div> -</div> - -<% if item.AcademicOverrideAdmin == null and not rt == rt :%> - +<td><span class="icon-only !{statusIcon}">&nbsp;</span></td> +<td> + <input type="hidden" class="identity" value="!{?attempt.Id}" /> + + ${attempt.AttemptIndex + 1} +</td> +<td>!{score}</td> +<td>${TestHelper.AnsweredQuestionsCount(attempt)}/${attempt.NumQuestions}</td> +<% if assignment.IsTimedTest: %><td>!{attempt.TimeLeftFormatted}</td><% end %> +<td><% component DateFormat, { "Date": attempt.StartDate, "Format": "TerseDateTime", "DoShift": true }: end %></td> +<td><% if attempt.FinishDate != null: %><% component DateFormat, { "Date": attempt.FinishDate, "Format": "TerseDateTime", "DoShift": true }: end %><% end %> + <% if canStudentReview : %> + <% showScript = "openAttemptDetails('${attempt.Id}');return false;" + showTitle = "Show attempt answers" + showIcon = "magnifier" + %> + &nbsp; <% OutputSubView ('..\\..\\Common\\UtilityBars\\ManageBar', {"Details": showScript, "DetailsTitle": showTitle }) %> +<% end %> +</td> +<% if isInstructor: %> +<td class="center"> + <div class="managementBar"> + <% showScript = "openAttemptDetails('${attempt.Id}');return false;" + showTitle = "Show attempt answers" + showIcon = "magnifier" + allowScript = ("allowRelaunch(this);return false;" if isLocked else "return false;") + allowTitle = "Allow the student to continue work on this attempt" + allowDisable = (false if isLocked else true) + allowIcon = ("lock-delete" if isLocked else "lock-delete-disabled") + endScript = ("endAttempt(this);return false;" if isLocked else "return false;") + endTitle = "Force the attempt to be complete" + endIcon = ("time-delete" if isLocked else "time-delete-disabled") + endDisable = (false if isLocked else true) %> + <% if assignment.IsTimedTest: %> + <% OutputSubView ('..\\..\\Common\\UtilityBars\\ManageBar', {"Details": showScript, "DetailsTitle": showTitle, + "Remove": allowScript, "RemoveTitle": allowTitle, "RemoveIcon": allowIcon, + "RemoveDisable": allowDisable, "BombDisable": endDisable, + "Bomb": endScript, "BombTitle": endTitle, "BombIcon": endIcon }) %> + <% else: %> + <% OutputSubView ('..\\..\\Common\\UtilityBars\\ManageBar', {"Details": showScript, "DetailsTitle": showTitle }) %> + <% end %> + </div> +</td>  <% end %>   -<% if rondell is null:%> +<script type="text/javascript"> + var openAttemptDetails = function (attemptId) { + var specs = "toolbar=yes,location=no,directories=no,menubar=yes,scrollbars=yes"; + window.open(siteRoot + '/TestAssignment/AttemptDetails.rails?attempt='+ attemptId,'_blank',specs); + }   -<% end %> + var allowRelaunch = function (element) { + if (!confirm("Are you sure you would like to allow the student to relaunch the timed test?")) + return; + $.ajax({ + url: siteRoot + "/TestAssignment/AllowReLaunch.rails", + data: { 'attempt': $(element).closest('.testResultAttempt').find('.identity').val() }, + success: function (html, status) { + // update the table row + $(element).closest('.testResultAttempt').html(html); + } + }); + }   -<% if rondell is null :%> + var endAttempt = function (element) { + if (!confirm("Are you sure you would like to end the student's attempt?")) + return; + $.ajax({ + url: siteRoot + "/TestAssignment/EndAttempt.rails", + data: { 'attempt': $(element).closest('.testResultAttempt').find('.identity').val() }, + success: function (html, status) { + $(element).closest('.testResultAttempt').html(html); + } + }); + } +</script>   -<% end %> - -<% if item.AcademicOverrideAdmin == null and not rt == rt and not re != re.Tom() :%> - -<% end %> -<% if item.AcademicOverrideAdmin == null and not rt == rt and not re != re.Eddie :%> - -<% end %> - -<% if not item.AcademicOverrideAdmin == null and rt == rt and not re != re.Eddie :%> - -<% end %> - -<% if item.AcademicOverrideAdmin == null and rt == rt :%> - -<% OutputSubView("templates/DisplayITrainingDates", {"item": assignmentStatus}) %> - <% OutputSubView("templates/DisplayITrainingStatus", {"item": assignmentStatus}) %> - <% OutputSubView("templates/DisplayITrainingAcademicOverride", {"item": assignmentStatus}) %> - <% OutputSubView ("WithSpace/DisplayITrainingDates", {"item": assignmentStatus}) %> - - - <button type="button" onclick="aoTool.overrideAssignmentStatus(this);"><span class="icon save">Override</span></button> - <% disabled = ' disabled="disabled"' - if not assignmentStatus is null and assignmentStatus.AcademicOverride: - disabled = '' - end - %> - <button type="button" onclick="aoTool.removeAssignmentStatusOverride(this);"${disabled}><span class="icon undo">Undo Override</span></button> - - - <div class="col last width-1of2 left"> - <% if assignment.NameToken == "Assignments_Courseware": %> - <button type="button"<% if not canImpersonate: %> disabled="disabled"<% else: %> onclick="window.open('!{realSlimShady}/Scorm/Impersonate.rails?assignment=!{assignment.Id}&enrollment=!{sectionEnrollment.Id}', 'Impersonate');"<% end %> > - <span class="icon magnifier">${AdministrationText.Impersonate}</span> - </button> - <% end %> - <button type="button" onclick="aoTool.deleteAssignmentStatus(this); return false;"><span class="icon bomb">Destroy</span></button> - </div> - - <% end %> \ No newline at end of file
+<% if status.Phase.ToString() == "ToBeGraded": %> +<td style="font-weight:bold;"> + ${EnumHelper.GetTranslation(status.Phase)} +</td> +<% else : %> +<td> + ${EnumHelper.GetTranslation(status.Phase)} +</td> +<% end %> \ No newline at end of file
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
 
@@ -1,64 +1,117 @@
-@using Nexport.Models; -@using Nexport.Models.Assignments; -@Html.RenderPartial("WithSpace/DisplayITrainingDates") -@Html.RenderPartial("WithSpace/DisplayITrainingDates") -<div class="layout-percent"> - <div class="col width-1of2 right"><label>Is Academically Overridden?:</label></div> - <div class="col last width-1of2 left"><label>@if(item.AcademicOverride){@commonText.yes}else{@commonText.no}</label></div> -</div> -<div class="layout-percent"> - <div class="col width-1of2 right"><label>Academic Override By:</label></div> - <div class="col last width-1of2 left"><label>@foo = (item.AcademicOverride && !(item.AcademicOverrideAdmin == null) ? item.AcademicOverrideAdmin.FullName : "n/a")@foo</label></div> -</div> +@using NexportVirtualCampus.Utilities; +@using System;   -@if(item.AcademicOverrideAdmin == null && !(rt == rt) ){ +@(dialogTitle = "Attempt " + (attempt.AttemptIndex+1) + " for " + attempt.AssignmentStatus.Enrollment.Subscription.User.FormalName; + +score = (Math.Round(attempt.Score,0) if attempt.IsComplete else "-"); + +isLocked = assignment.IsTimedTest and attempt.IsComplete == false and attempt.IsWithinGracePeriod() == false and !(attempt.AllowReLaunch); + +if(score == "-"){ +if(isLocked){ +statusIcon = "lock"; + +else:; + +statusIcon = "";    } +else:;   -@if(rondell == null){ +if(score >= assignment.MasteryScore){ +statusIcon = "validate-ok"; + +else:; + +statusIcon = "validate-fail";    } +} +canStudentReview = assignment.CanStudentReview and isInstructor == false and attempt.IsComplete and score >= assignment.MasteryScore) +<td><span class="icon-only @statusIcon">&nbsp;</span></td> +<td> + <input type="hidden" class="identity" value="@?attempt.Id" /> + + @attempt.AttemptIndex + 1 +</td> +<td>@score</td> +<td>@TestHelper.AnsweredQuestionsCount(attempt)/@attempt.NumQuestions</td> +@if(assignment.IsTimedTest){<td>@attempt.TimeLeftFormatted</td>} +<td>@Html.DisplayDate(new DisplayDateProperties(){ Date = attempt.StartDate, Format = "TerseDateTime", DoShift = true })</td> +<td>@if(attempt.FinishDate != null){@Html.DisplayDate(new DisplayDateProperties(){ Date = attempt.FinishDate, Format = "TerseDateTime", DoShift = true })} + @if(canStudentReview ){@showScript = "openAttemptDetails('${attempt.Id');return false;" + showTitle = "Show attempt answers" + showIcon = "magnifier" + %> + &nbsp; @OutputSubView ("..\\..\\Common\\UtilityBars\\ManageBar", {"Details": showScript, "DetailsTitle": showTitle }) +} +</td> +@if(isInstructor){ +<td class="center"> + <div class="managementBar">@showScript = "openAttemptDetails('${attempt.Id');return false;" + showTitle = "Show attempt answers" + showIcon = "magnifier" + allowScript = ("allowRelaunch(this);return false;" if isLocked else "return false;") + allowTitle = "Allow the student to continue work on this attempt" + allowDisable = (false if isLocked else true) + allowIcon = ("lock-delete" if isLocked else "lock-delete-disabled") + endScript = ("endAttempt(this);return false;" if isLocked else "return false;") + endTitle = "Force the attempt to be complete" + endIcon = ("time-delete" if isLocked else "time-delete-disabled") + endDisable = (false if isLocked else true) %> + @if(assignment.IsTimedTest){ + @(OutputSubView ("..\\..\\Common\\UtilityBars\\ManageBar", {"Details": showScript, "DetailsTitle": showTitle,;   -@if(rondell == null ){ +"Remove": allowScript, "RemoveTitle": allowTitle, "RemoveIcon": allowIcon,;   +"RemoveDisable": allowDisable, "BombDisable": endDisable,; + +"Bomb": endScript, "BombTitle": endTitle, "BombIcon": endIcon })) + }else{ + @OutputSubView ("..\\..\\Common\\UtilityBars\\ManageBar", {"Details": showScript, "DetailsTitle": showTitle }) + } + </div> +</td>  }   -@if(item.AcademicOverrideAdmin == null && !(rt == rt && !(re != re.Tom())) ){ +<script type="text/javascript"> + var openAttemptDetails = function (attemptId) { + var specs = "toolbar=yes,location=no,directories=no,menubar=yes,scrollbars=yes"; + window.open(siteRoot + '/TestAssignment/AttemptDetails.rails?attempt='+ attemptId,'_blank',specs); + }   -} -@if(item.AcademicOverrideAdmin == null && !(rt == rt && !(re != re.Eddie)) ){ + var allowRelaunch = function (element) { + if (!confirm("Are you sure you would like to allow the student to relaunch the timed test?")) + return; + $.ajax({ + url: siteRoot + "/TestAssignment/AllowReLaunch.rails", + data: { 'attempt': $(element).closest('.testResultAttempt').find('.identity').val() }, + success: function (html, status) { + // update the table row + $(element).closest('.testResultAttempt').html(html); + } + }); + }   -} + var endAttempt = function (element) { + if (!confirm("Are you sure you would like to end the student's attempt?")) + return; + $.ajax({ + url: siteRoot + "/TestAssignment/EndAttempt.rails", + data: { 'attempt': $(element).closest('.testResultAttempt').find('.identity').val() }, + success: function (html, status) { + $(element).closest('.testResultAttempt').html(html); + } + }); + } +</script>   -@if(!(item.AcademicOverrideAdmin == null )&& rt == rt && !(re != re.Eddie) ){ - -} - -@if(item.AcademicOverrideAdmin == null && rt == rt ){ - -@Html.RenderPartial("templates/DisplayITrainingDates",new ViewDataDictionary( new {item = assignmentStatus} )) - @Html.RenderPartial("templates/DisplayITrainingStatus",new ViewDataDictionary( new {item = assignmentStatus} )) - @Html.RenderPartial("templates/DisplayITrainingAcademicOverride",new ViewDataDictionary( new {item = assignmentStatus} )) - @Html.RenderPartial("WithSpace/DisplayITrainingDates",new ViewDataDictionary( new {item = assignmentStatus} )) - - - <button type="button" onclick="aoTool.overrideAssignmentStatus(this);"><span class="icon save">Override</span></button> - @(disabled = " disabled=\"disabled\""; - -if( assignmentStatus != null && assignmentStatus.AcademicOverride){ -disabled = ""; - -}) - <button type="button" onclick="aoTool.removeAssignmentStatusOverride(this);"@disabled><span class="icon undo">Undo Override</span></button> - - - <div class="col last width-1of2 left"> - @if(assignment.NameToken == "Assignments_Courseware"){ - <button type="button"@if(!(canImpersonate)){<text> disabled="disabled"</text>}else{<text> onclick="window.open('@realSlimShady/Scorm/Impersonate.rails?assignment=@assignment.Id&enrollment=@sectionEnrollment.Id', 'Impersonate');"</text>} > - <span class="icon magnifier">@AdministrationText.Impersonate</span> - </button> - } - <button type="button" onclick="aoTool.deleteAssignmentStatus(this); return false;"><span class="icon bomb">Destroy</span></button> - </div> - - } \ No newline at end of file
+@if(status.Phase.ToString() == "ToBeGraded"){ +<td style="font-weight:bold;"> + @EnumHelper.GetTranslation(status.Phase) +</td> +}else{ +<td> + @EnumHelper.GetTranslation(status.Phase) +</td> +} \ No newline at end of file