Subversion Repositories ALCASAR

Rev

Rev 2565 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2565 Rev 2626
Line 13... Line 13...
13
    }
13
    }
14
 
14
 
15
    return radiusPeriod.join(',');
15
    return radiusPeriod.join(',');
16
}
16
}
17
 
17
 
18
function addPeriodToArray(array, index, hours) {
18
function addPeriodToArray(array, day, hours) {
19
    array[index].push([
19
    array[radiusDays.indexOf(day)].push([
20
        hours[0].substr(0,2) + ':' + hours[0].substr(2,4),
20
        hours[0].substr(0,2) + ':' + hours[0].substr(2,4),
21
        hours[1].substr(0,2) + ':' + hours[1].substr(2,4)
21
        hours[1].substr(0,2) + ':' + hours[1].substr(2,4)
22
    ]);
22
    ]);
23
}
23
}
24
 
24
 
Line 31... Line 31...
31
 
31
 
32
    radiusAttr = radiusAttr.split(',');
32
    radiusAttr = radiusAttr.split(',');
33
 
33
 
34
 
34
 
35
    for(let period of radiusAttr) {
35
    for(let period of radiusAttr) {
36
        day = radiusDays.indexOf(period.substr(0, 2));
36
        hours = /[0-9]{4}-[0-9]{4}$/.exec(period);
37
 
37
 
-
 
38
        if(hours === null) {
-
 
39
            hours = "0000-2400";
-
 
40
        } else {
38
        hours = period.substr(2).split('-');
41
            hours = hours[0]
-
 
42
        }
39
 
43
 
40
        if(hours.length !== 2) continue;
44
        hours = hours.split('-');
41
 
45
 
42
        if(day === -1) {
-
 
43
            if(period.substr(0, 2) === 'Wk') {
-
 
44
                for (let i = 0; i < 5; ++i) {
-
 
45
                    addPeriodToArray(res, i, hours);
-
 
46
                }
-
 
47
            } else if(period.substr(0, 3) === 'Any') {
-
 
48
                hours = period.substr(3).split('-');
-
 
49
 
46
 
-
 
47
        days = /^[a-zA-Z]{2,3}(?:-[a-zA-Z]{2})?/.exec(period);
-
 
48
 
-
 
49
        if(days === null) {
-
 
50
            continue;
-
 
51
        } else {
-
 
52
            days = days[0].split('-');
50
                for (let i = 0; i < 7; ++i) {
53
            if(days.length > 1) {
-
 
54
                dBegin = radiusDays.indexOf(days[0]);
51
                    addPeriodToArray(res, i, hours);
55
                dEnd = radiusDays.indexOf(days[1]);
-
 
56
 
-
 
57
                if(dBegin === -1 || dEnd === -1 || dBegin > dEnd) {
-
 
58
                    continue;
52
                }
59
                }
-
 
60
 
-
 
61
                days = radiusDays.slice(dBegin, dEnd + 1);
-
 
62
            }
-
 
63
        }
-
 
64
 
-
 
65
        if(hours.length !== 2) continue;
-
 
66
 
-
 
67
        if(days[0] === 'Wk') {
-
 
68
            for (let i = 0; i < 5; ++i) {
-
 
69
                addPeriodToArray(res, radiusDays[i], hours);
-
 
70
            }
-
 
71
        } else if(days[0] === 'Any' || days[0] == 'Al') {
-
 
72
            for (day of radiusDays) {
-
 
73
                addPeriodToArray(res, day, hours);
53
            }
74
            }
54
        } else {
75
        } else {
-
 
76
            for(day of days) {
55
            addPeriodToArray(res, day, hours);
77
                addPeriodToArray(res, day, hours);
-
 
78
            }
56
        }
79
        }
57
    }
80
    }
58
 
81
 
59
    return res;
82
    return res;
60
 
-
 
61
}
83
}
62
 
84
 
63
(function ($) {
85
(function ($) {
64
    let schedule = $("#login-time-schedule");
86
    let schedule = $("#login-time-schedule");
65
    
87