-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathauxiliary.app
77 lines (65 loc) · 1.81 KB
/
auxiliary.app
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
module auxiliary
// type String{
// substring(Int,Int):String
// }
// function abbreviate(s : String, length : Int) : String {
// if(s.length() <= length) {
// return s;
// } else {
// return s.substring(0,length - 4) + " ...";
// }
// }
// function prefix(s : String, length : Int) : String {
// return s.substring(0,length);
// }
// function max(i1 : Int, i2 : Int) : Int {
// if(i1 >= i2) {
// return i1;
// }
// return i2;
// }
function maxList(is : List<Int>) : Int {
var m : Int := is.get(0);
for(i : Int from 0 to is.length - 1) {
var current : Int := is.get(i);
m := max(m, current);
}
return m;
}
function prefix(s : List<Issue>, length : Int) : List<Issue> {
if(s.length <= length) {
return s;
} else {
s.removeAt(length);
return prefix(s, length);
}
}
define ajax validationFeedback(vem : ValidationExceptionMultiple){
for(ve : ValidationException in vem.exceptions){
output(ve.message)
} separated-by { "; " }
}
function format(date : DateTime) : String {
if(now().format("yyyy") == date.format("yyyy")) {
return date.format("MMM d");
} else {
return date.format("MMM ''yy");
}
}
// function format(date : DateTime) : String {
// if(now().format("yyyy") == date.format("yyyy")) {
// return date.format("d/MM");
// } else {
// return date.format("d/MM/yy");
// }
// }
//define ajax template empty() {}
/* Provides continously loading pages: whenever the user scrolls down, more page is loaded
* While higher-order templates are not yet supported:
* Define an ajax template with a button of class continuousLoader, which triggers loading
* of additional page content.
*/
define template continuousLoading() {
includeJS(IncludePaths.jQueryJS()) //already included, but we must make sure this one gets included before auxiliary.js
includeJS("auxiliary.js")
}