From b6cb278b0282e848ea5eec279a023ffb85d94133 Mon Sep 17 00:00:00 2001
From: wyu <kknd09321@nate.com>
Date: 월, 29 11월 2021 14:26:24 +0900
Subject: [PATCH] 사용자 정의 필드 정규표현식 추가

---
 src/main/webapp/views/customField/customFieldAdd.html                |   83 +++++++++++++++++++++++++++
 src/main/webapp/i18n/ko/global.json                                  |    6 +
 src/main/webapp/scripts/app/customField/customFieldAdd.controller.js |   64 ++++++++++++++++++++
 3 files changed, 148 insertions(+), 5 deletions(-)

diff --git a/src/main/webapp/i18n/ko/global.json b/src/main/webapp/i18n/ko/global.json
index 86869a5..8378ef3 100644
--- a/src/main/webapp/i18n/ko/global.json
+++ b/src/main/webapp/i18n/ko/global.json
@@ -831,7 +831,11 @@
         "ipAddressField": "IP Address �븘�뱶",
         "emailField": "�씠硫붿씪 �븘�뱶",
         "siteField": "URL �븘�뱶",
-        "telField": "�쟾�솕踰덊샇 �븘�뱶"
+        "telField": "�쟾�솕踰덊샇 �븘�뱶",
+        "invalidipAdressFormat": "IP 二쇱냼 �삎�떇�씠 留욎� �븡�뒿�땲�떎.",
+        "invalidEmailFormat": "�씠硫붿씪 �삎�떇�씠 留욎� �븡�뒿�땲�떎.",
+        "invalidSiteFormat": "�솃�럹�씠吏� 二쇱냼 �삎�떇�씠 留욎� �븡�뒿�땲�떎.",
+        "invalidTelFormat": "�쟾�솕踰덊샇 �삎�떇�씠 留욎� �븡�뒿�땲�떎."
     },
     "tasks": {
         "agileBoardTitle": "移몃컲 蹂대뱶"
diff --git a/src/main/webapp/scripts/app/customField/customFieldAdd.controller.js b/src/main/webapp/scripts/app/customField/customFieldAdd.controller.js
index ac901db..563582d 100644
--- a/src/main/webapp/scripts/app/customField/customFieldAdd.controller.js
+++ b/src/main/webapp/scripts/app/customField/customFieldAdd.controller.js
@@ -16,7 +16,7 @@
                     formCheck : formCheck,  //  �뤌 泥댄겕
                     addOption : addOption,   //  �샃�뀡 媛� 異붽��븯湲�
                     removeOption : removeOption,    //  �샃�뀡 �궘�젣
-                    changeFieldType : changeFieldType   //  �븘�뱶 �쑀�삎 蹂�寃�
+                    changeFieldType : changeFieldType,   //  �븘�뱶 �쑀�삎 蹂�寃�
                 };
 
                 $scope.vm = {
@@ -25,7 +25,12 @@
                         customFieldType : "INPUT",    //  �궗�슜�옄 �젙�쓽 �븘�뱶 �쑀�삎
                         defaultValue : "",  //  湲곕낯 媛�
                         options : [],   //  �샃�뀡
-                        optionText : ""  //  �샃�뀡 媛�
+                        optionText : "",  //  �샃�뀡 媛�
+                        numberType : "",
+                        ipAdress : "",
+                        email : "",
+                        site : "",
+                        tel : ""
                     }
                 };
 
@@ -43,6 +48,7 @@
 
                     $scope.vm.form.defaultValue = "";
                 }
+
 
                 //  Select �샃�뀡 媛� 異붽��븯湲�
                 function addOption() {
@@ -87,6 +93,55 @@
                     }
                 }
 
+                // function chkPhoneType(type) {
+                //     var input = $scope.vm.form.tel
+                //
+                //     //focus out�씤 寃쎌슦
+                //     //input type�쓣 text濡� 諛붽씀怨� '-'異붽�
+                //     if(type == 'blur'){
+                //         $scope.vm.form.tel;
+                //         var phone = chkItemPhone(input);
+                //     }
+                //
+                //     //focus�씤 寃쎌슦
+                //     //input type�쓣 number濡� 諛붽씀怨� '-' �젣嫄�
+                //     if(type == 'focus'){
+                //         var phone = input.replace( /-/gi, '');
+                //         $scope.vm.form.tel('type', 'number');
+                //     }
+                //
+                //     $scope.vm.form.tel(phone);
+                // }
+                //
+                // function chkItemPhone(temp) {
+                //     var number = temp.replace(/[^0-9]/g, "");
+                //     var phone = "";
+                //
+                //     if (number.length < 9) {
+                //         return number;
+                //     } else if (number.length < 10) {
+                //         phone += number.substr(0, 2);
+                //         phone += "-";
+                //         phone += number.substr(2, 3);
+                //         phone += "-";
+                //         phone += number.substr(5);
+                //     } else if (number.length < 11) {
+                //         phone += number.substr(0, 3);
+                //         phone += "-";
+                //         phone += number.substr(3, 3);
+                //         phone += "-";
+                //         phone += number.substr(6);
+                //     } else {
+                //         phone += number.substr(0, 3);
+                //         phone += "-";
+                //         phone += number.substr(3, 4);
+                //         phone += "-";
+                //         phone += number.substr(7);
+                //     }
+                //
+                //     return phone;
+                // }
+
                 //  �뤌 泥댄겕
                 function formCheck(formInvalid) {
                     if (formInvalid) {
@@ -110,6 +165,11 @@
 
                     var content = angular.copy($scope.vm.form);
                     content.name = $rootScope.preventXss(content.name);
+                    content.numberType = $rootScope.preventXss(content.numberType);
+                    content.ipAdress = $rootScope.preventXss(content.ipAdress);
+                    content.email = $rootScope.preventXss(content.email);
+                    content.site = $rootScope.preventXss(content.site);
+                    content.tel = $rootScope.preventXss(content.tel);
 
                     if ($scope.vm.form.customFieldType === 'MULTI_SELECT'|| $scope.vm.form.customFieldType === "SINGLE_SELECT") {
                         var convertDefaultValues = "";
diff --git a/src/main/webapp/views/customField/customFieldAdd.html b/src/main/webapp/views/customField/customFieldAdd.html
index 2c76559..dafd16c 100644
--- a/src/main/webapp/views/customField/customFieldAdd.html
+++ b/src/main/webapp/views/customField/customFieldAdd.html
@@ -55,7 +55,8 @@
                 <label ng-show="vm.form.customFieldType == 'MULTI_SELECT'"><span
                         translate="customField.createMultiFieldList">�떎以� �꽑�깮 �븘�뱶 紐⑸줉 留뚮뱾湲�</span> <code
                         class="highlighter-rouge">*</code></label>
-                <div class="input-group">
+
+                <div class="input-group" ng-show="vm.form.customFieldType == 'SINGLE_SELECT' || vm.form.customFieldType == 'MULTI_SELECT'">
                     <input id="optionAdd"
                            type="text"
                            name="options"
@@ -83,7 +84,8 @@
 
             <div class="form-group">
                 <label for="customFieldAddForm3"><span translate="customField.defaultValue">湲곕낯媛�</span> </label>
-                <input id="customFieldAddForm3"
+                <input ng-if="vm.form.customFieldType == 'INPUT' || vm.form.customFieldType == 'SINGLE_SELECT' || vm.form.customFieldType == 'MULTI_SELECT'"
+                       id="customFieldAddForm3"
                        type="text"
                        name="defaultValue"
                        class="form-control"
@@ -92,9 +94,86 @@
                        kr-input
                        ng-maxlength="100"
                        autocomplete="off">
+
+
+                <input ng-if="vm.form.customFieldType == 'NUMBER'"
+                       name="numberType"
+                       type="number"
+                       class="form-control"
+                       kr-input
+                       ng-pattern="/^[0-9]*$/"
+                       placeholder="�닽�옄留� �엯�젰 媛��뒫�빀�땲�떎."
+                       autocomplete="off"
+                       ng-model="vm.form.numberType">
+
+                <input ng-if="vm.form.customFieldType == 'DATETIME'"
+                       type="date"
+                       class="form-control"
+                       kr-input
+                       ng-pattern="/^(19|20)\d{2}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[0-1])$/"
+                       placeholder="�궇吏� �삎�떇留� �엯�젰 媛��뒫�빀�땲�떎."
+                       autocomplete="off">
+
+                <input ng-if="vm.form.customFieldType == 'IP_ADDRESS'"
+                       name="ipAdress"
+                       type="text"
+                       class="form-control"
+                       kr-input
+                       ng-pattern="/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/"
+                       placeholder="IP 二쇱냼 �삎�떇留� �엯�젰 媛��뒫�빀�땲�떎."
+                       autocomplete="off"
+                       ng-model="vm.form.ipAdress">
+                <div ng-show="customFieldAddForm.ipAdress.$error.pattern" class="help-block form-text text-danger"
+                     translate="common.invalidipAdressFormat">IP二쇱냼 �삎�떇�씠 留욎� �븡�뒿�땲�떎.
+                </div>
+<!--                /@^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/-->
+                <input ng-if="vm.form.customFieldType == 'EMAIL'"
+                       name="email"
+                       type="email"
+                       class="form-control"
+                       maxlength="30"
+                       kr-input
+                       ng-pattern="/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/"
+                       placeholder="�씠硫붿씪 �삎�떇留� �엯�젰 媛��뒫�빀�땲�떎."
+                       autocomplete="off"
+                       ng-model="vm.form.email">
+                <div ng-show="customFieldAddForm.email.$error.pattern" class="help-block form-text text-danger"
+                     translate="common.invalidEmailFormat">�씠硫붿씪 �삎�떇�씠 留욎� �븡�뒿�땲�떎.
+                </div>
+
+                <input ng-if="vm.form.customFieldType == 'SITE'"
+                       name="site"
+                       type="text"
+                       class="form-control"
+                       maxlength="30"
+                       kr-input
+                       ng-pattern="/(http(s)?:\/\/)([a-z0-9\w]+\.*)+[a-z0-9]{2,4}/gi"
+                       placeholder="�솃�럹�씠吏� 二쇱냼 �삎�떇留� �엯�젰 媛��뒫�빀�땲�떎."
+                       autocomplete="off"
+                       ng-model="vm.form.site">
+                <div ng-show="customFieldAddForm.site.$error.pattern" class="help-block form-text text-danger"
+                     translate="common.invalidSiteFormat">�솃�럹�씠吏� 二쇱냼 �삎�떇�씠 留욎� �븡�뒿�땲�떎.
+                </div>
+
+
+                <input ng-if="vm.form.customFieldType == 'TEL'"
+                       id="phone"
+                       name="tel"
+                       type="number"
+                       class="form-control"
+                       kr-input
+                       ng-pattern="/^\d{2,3}-\d{3,4}-\d{4}$/"
+                       placeholder="�뿰�씫泥� �삎�떇留� �엯�젰 媛��뒫�빀�땲�떎."
+                       autocomplete="off"
+                       ng-model="vm.form.tel">
+                <div ng-show="customFieldAddForm.tel.$error.pattern" class="help-block form-text text-danger"
+                     translate="common.invalidTelFormat">�쟾�솕踰덊샇 �삎�떇�씠 留욎� �븡�뒿�땲�떎.
+                </div>
+
                 <small ng-show="vm.form.customFieldType == 'INPUT'" translate="common.upTo100Characters">
                     理쒕� 100湲��옄源뚯� �엯�젰�븷 �닔 �엳�뒿�땲�떎.
                 </small>
+
                 <div class="help-block form-text text-danger" ng-show="vm.form.customFieldType == 'SINGLE_SELECT'"
                      translate="customField.selectSingleFieldListHashTag">
                     �떒�씪 �꽑�깮 �븘�뱶 紐⑸줉�뿉 �엳�뒗 媛믪쓣 湲곕낯�쟻�쑝濡� �꽑�깮�븯怨� �떢�쓣 �븣�뒗 �빐�떆�깭洹몃�� �궗�슜�빐�빞�빀�땲�떎. ex) #���긽媛�

--
Gitblit v1.8.0