OWL ITS + 탐지시스템(인터넷 진흥원)
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
'use strict';
 
define(['app', 'angular'],
    function (app, angular) {
        app.provider("$treeProvider", function () {
            return {
                $get : function ($log) {
                    return {
                        config : function () {
                            var tableConfig = {
                                hName : "",    //    헤더 이름
                                hChecked : false,    //    체크 박스 선택 여부
                                dName : "",    //    데이터 이름
                                dVisible : "",  //      bootstrap 반응형 컬럼 표시 여부
                                dType : "none",        // 태그 타입
                                dDateFormat : "",   //  날짜 형식
                                subHead : false,    //  만약 rowspan, colspan 을 사용하게 되면 true 로 셋팅.
                                columnHint : "",    //  컬럼 정보를 추출하기 위한 힌트 정보를 준다 - tableColumnGenerator 의 사용자 정의 필드 부분에서 사용
                                setHName : function (hName) {
                                    this.hName = hName;
                                    return this;
                                },
                                setHChecked : function (hChecked) {
                                    this.hChecked = hChecked;
                                    return this;
                                },
                                setDName : function (dName) {
                                    this.dName = dName;
                                    return this;
                                },
                                setDVisible : function (dVisible) {
                                    this.dVisible = dVisible;
                                    return this;
                                },
                                setDType : function (dType) {
                                    this.dType = dType;
                                    return this;
                                },
                                setDDateFormat : function (dDateFormat) {
                                    this.dDateFormat = dDateFormat;
                                    return this;
                                },
                                setSubHead : function (dSubHead) {
                                    this.subHead = dSubHead;
                                    return this;
                                },
                                setColumnHint : function (dColumnHint) {
                                    this.columnHint = dColumnHint;
                                    return this;
                                }
                            };
 
                            return tableConfig;
                        },
                        orderByColumn : "",  // table order By column name
                        reverse : true,
                        setOrderByColumn : function (column) {
                            if (column == "") {
                                return;
                            }
 
                            if (this.orderByColumn == column) {
                                this.reverse = !this.reverse;
                            }
                            else {
                                this.reverse = true;
                            }
 
                            this.orderByColumn = column;
                            return this;
                        },
                        getDateFormat : function (formatType, date) {
                            if (formatType == "" || formatType == null) {
                                formatType = "01";
                            }
                            Date.prototype.format = function (f) {
                                if (!this.valueOf()) {
                                    return " ";
                                }
                                var weekName = ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"];
                                var d = this;
 
                                return f.replace(/(yyyy|yy|MM|dd|E|hh|mm|ss|a\/p)/gi, function ($1) {
                                    switch ($1) {
                                        case "yyyy":
                                            return d.getFullYear();
                                        case "yy":
                                            return (d.getFullYear() % 1000).zf(2);
                                        case "MM":
                                            return (d.getMonth() + 1).zf(2);
                                        case "dd":
                                            return d.getDate().zf(2);
                                        case "E":
                                            return weekName[d.getDay()];
                                        case "HH":
                                            return d.getHours().zf(2);
                                        case "hh":
                                            var h = d.getHours();
                                            return ((h = d.getHours() % 12) ? h : 12).zf(2);
                                        case "mm":
                                            return d.getMinutes().zf(2);
                                        case "ss":
                                            return d.getSeconds().zf(2);
                                        case "a/p":
                                            return d.getHours() < 12 ? "오전" : "오후";
                                        default:
                                            return $1;
                                    }
                                });
                            };
 
                            String.prototype.string = function (len) {
                                var s = '', i = 0;
                                while (i++ < len) {
                                    s += this;
                                }
                                return s;
                            };
                            String.prototype.zf = function (len) {
                                return "0".string(len - this.length) + this;
                            };
                            Number.prototype.zf = function (len) {
                                return this.toString().zf(len);
                            };
 
                            var dateFormat = "";
                            var dynamicTime = false;
                            var today = new Date().format("yyyy-MM-dd");
                            var compareDate = new Date(date).format("yyyy-MM-dd");
 
                            if (today == compareDate) {
                                dynamicTime = true;
                            }
 
                            switch (formatType) {
                                case "01":  //  날짜
                                    dateFormat = "yyyy-MM-dd";
                                    break;
                                case "02":  //  날짜 + 시간
                                    dateFormat = "yyyy-MM-dd HH:mm";
                                    break;
                                case "03":  //  유동적 표시
                                    if (dynamicTime) {
                                        dateFormat = "HH:mm";
                                    }
                                    else {
                                        dateFormat = "yyyy-MM-dd HH:mm";
                                    }
 
                                    break;
                            }
 
                            return dateFormat;
                        }
                    }
                }
            }
        });
    });