diff --git a/_AXJ/lib/AXJ.js b/_AXJ/lib/AXJ.js
index fb6cb2d1..d97a0716 100644
--- a/_AXJ/lib/AXJ.js
+++ b/_AXJ/lib/AXJ.js
@@ -4135,6 +4135,7 @@ var AXContextMenuClass = Class.create(AXJ, {
var filter = this.filter.bind(this);
var getSubMenu = this.getSubMenu.bind(this);
var po = [];
+ var showItemCount = 0;
po.push("
");
AXUtil.each(obj.menu, function (idx, menu) {
if (filter(objSeq, objID, myobj, menu)) {
@@ -4168,9 +4169,13 @@ var AXContextMenuClass = Class.create(AXJ, {
if (menu.underLine) {
po.push("
");
}
+ showItemCount++;
}
});
po.push("
");
+
+ if(showItemCount == 0) return false; // 보여줄 메뉴가 없다면 출력 안함.
+
axdom(document.body).append(po.join(''));
axdom("#" + objID + " .contextMenuItem:first-child").addClass("first");
diff --git a/_AXJ/lib/AXSelect.js b/_AXJ/lib/AXSelect.js
index 1fb4fd9f..2b8242ef 100644
--- a/_AXJ/lib/AXSelect.js
+++ b/_AXJ/lib/AXSelect.js
@@ -1,971 +1,979 @@
/* AXISJ Javascript UI Framework */
/* http://www.axisj.com, license : http://www.axisj.com/license */
-
+
/**
* AXSelectConverter
* @class AXSelectConverter
* @extends AXJ
- * @version v2.50
+ * @version v2.51
* @author tom@axisj.com
* @logs
- "2012-12-19 오후 12:00:43",
- "2013-04-24 오후 5:45:44 - value change bug fix",
- "2013-06-04 오전 11:00:42 - bind 메소드 업그레이드",
- "2013-07-26 오후 1:14:16 - bind, unbind, bindSetConfig 픽스",
- "2013-08-21 오후 4:45:02 - 연속 appendAnchor 버그픽스",
- "2013-08-23 오후 8:14:22 - expandBox 포지션 가변 처리",
- "2013-09-06 오전 10:08:28 - bindSelect % 버그픽스",
- "2013-09-27 오후 1:29:14 - onLoad 추가 : tom",
- "2013-10-02 오후 6:15:38 - bindSelectDisabled 기능 추가 : tom",
- "2013-10-24 오후 5:54:05 - resizeAnchor 기능 추가 : tom",
- "2013-11-06 오후 12:47:53 - tabindex 속성 가져오기 기능 추가 : tom",
- "2013-11-27 오후 8:03:57 - tom : positionFixed 기능 추가",
- "2013-12-09 오후 7:03:57 - tom : bindSelectUpdate 기능추가",
- "2014-01-10 오후 5:08:59 - tom : event modify & bugFix",
- "2014-03-11 오전 11:08:54 - tom : add bindSelectGetValue ",
- "2014-03-18 오후 10:09:21 - tom : select 포커스 후 키입력 하면 optionValue를 비교하여 선택처리 기능 구현 - 2차버전에 한글 포커스 밑 optionText 비교 처리 구문 추가",
- "2014-03-27 오후 3:38:25 - tom : onchange 함수가 setValue 속성을 부여해야만 작동하던 것을 무조건 작동 하도록 변경",
- "2014-03-31 오후 4:41:18 - tom : 셀렉트 포커스 된 상태에서 키 입력하면 입력된 값으로 select 처리 하기 (현재 영문만)"
+ "2012-12-19 오후 12:00:43",
+ "2013-04-24 오후 5:45:44 - value change bug fix",
+ "2013-06-04 오전 11:00:42 - bind 메소드 업그레이드",
+ "2013-07-26 오후 1:14:16 - bind, unbind, bindSetConfig 픽스",
+ "2013-08-21 오후 4:45:02 - 연속 appendAnchor 버그픽스",
+ "2013-08-23 오후 8:14:22 - expandBox 포지션 가변 처리",
+ "2013-09-06 오전 10:08:28 - bindSelect % 버그픽스",
+ "2013-09-27 오후 1:29:14 - onLoad 추가 : tom",
+ "2013-10-02 오후 6:15:38 - bindSelectDisabled 기능 추가 : tom",
+ "2013-10-24 오후 5:54:05 - resizeAnchor 기능 추가 : tom",
+ "2013-11-06 오후 12:47:53 - tabindex 속성 가져오기 기능 추가 : tom",
+ "2013-11-27 오후 8:03:57 - tom : positionFixed 기능 추가",
+ "2013-12-09 오후 7:03:57 - tom : bindSelectUpdate 기능추가",
+ "2014-01-10 오후 5:08:59 - tom : event modify & bugFix",
+ "2014-03-11 오전 11:08:54 - tom : add bindSelectGetValue ",
+ "2014-03-18 오후 10:09:21 - tom : select 포커스 후 키입력 하면 optionValue를 비교하여 선택처리 기능 구현 - 2차버전에 한글 포커스 밑 optionText 비교 처리 구문 추가",
+ "2014-03-27 오후 3:38:25 - tom : onchange 함수가 setValue 속성을 부여해야만 작동하던 것을 무조건 작동 하도록 변경",
+ "2014-03-31 오후 4:41:18 - tom : 셀렉트 포커스 된 상태에서 키 입력하면 입력된 값으로 select 처리 하기 (현재 영문만)",
+ "2014-04-10 오후 6:09:44 - tom : appendAnchor, alignAnchor 방식 변경 및 크기 버그 픽스 & select element hide 에서 투명으로 변경"
*
*/
var AXSelectConverter = Class.create(AXJ, {
- initialize: function (AXJ_super) {
- AXJ_super();
- this.objects = [];
- this.config.anchorClassName = "AXanchor";
- this.config.anchorSelectClassName = "AXanchorSelect";
- },
- init: function () {
- var browser = AXUtil.browser;
- this.isMobile = browser.mobile;
- $(window).resize(this.windowResize.bind(this));
- },
- windowResize: function () {
- if (this.windowResizeObs) clearTimeout(this.windowResizeObs);
- this.windowResizeObs = setTimeout(this.alignAllAnchor.bind(this), 10);
- },
- alignAllAnchor: function () {
- var alignAnchor = this.alignAnchor.bind(this);
- axf.each(this.objects, function (index, O) {
- alignAnchor(O.id, index);
- });
- },
- bindSetConfig: function (objID, configs) {
- var findIndex = null;
- for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
- if (O.id == objID && O.isDel != true) {
- findIndex = index;
- break;
- }
+ initialize: function (AXJ_super) {
+ AXJ_super();
+ this.objects = [];
+ this.config.anchorClassName = "AXanchor";
+ this.config.anchorSelectClassName = "AXanchorSelect";
+ },
+ init: function () {
+ var browser = AXUtil.browser;
+ this.isMobile = browser.mobile;
+ $(window).resize(this.windowResize.bind(this));
+ },
+ windowResize: function () {
+ if (this.windowResizeObs) clearTimeout(this.windowResizeObs);
+ this.windowResizeObs = setTimeout(this.alignAllAnchor.bind(this), 100);
+ },
+ alignAllAnchor: function () {
+ var alignAnchor = this.alignAnchor.bind(this);
+ axf.each(this.objects, function (index, O) {
+ alignAnchor(O.id, index);
+ });
+ },
+ bindSetConfig: function (objID, configs) {
+ var findIndex = null;
+ for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
+ if (O.id == objID && O.isDel != true) {
+ findIndex = index;
+ break;
+ }
}
if (findIndex == null) {
- //trace("바인드 된 오브젝트를 찾을 수 없습니다.");
- } else {
- var _self = this.objects[findIndex];
- jQuery.each(configs, function (k, v) {
- _self.config[k] = v;
- });
- }
- },
- unbind: function (obj) {
- //var collect = [];
- var removeAnchorId;
- var removeIdx;
- //trace(this.objects);
- for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
- if (O.id != obj.id) {
- // collect.push(this);
-
- } else {
- if (O.isDel != true) {
- removeAnchorId = O.anchorID;
- removeIdx = index;
- }
- }
- }
-
- //this.objects = collect;
-
- if (removeAnchorId) {
- var objDom = axdom("#" + obj.id), objAnchorDom = axdom("#" + removeAnchorId);
- this.objects[removeIdx].isDel = true;
+ //trace("바인드 된 오브젝트를 찾을 수 없습니다.");
+ } else {
+ var _self = this.objects[findIndex];
+ jQuery.each(configs, function (k, v) {
+ _self.config[k] = v;
+ });
+ }
+ },
+ unbind: function (obj) {
+ //var collect = [];
+ var removeAnchorId;
+ var removeIdx;
+ //trace(this.objects);
+ for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
+ if (O.id != obj.id) {
+ // collect.push(this);
+
+ } else {
+ if (O.isDel != true) {
+ removeAnchorId = O.anchorID;
+ removeIdx = index;
+ }
+ }
+ }
+
+ //this.objects = collect;
+
+ if (removeAnchorId) {
+ var objDom = axdom("#" + obj.id), objAnchorDom = axdom("#" + removeAnchorId);
+ this.objects[removeIdx].isDel = true;
objDom.removeAttr("data-axbind");
- if (this.isMobile) {
+ if (this.isMobile) {
objAnchorDom.before(jQuery("#" + obj.id));
objAnchorDom.remove();
- } else {
+ } else {
objAnchorDom.remove();
objDom.show();
- }
- }
- },
- bind: function (obj) {
- var cfg = this.config;
-
- if (!obj.id) {
- trace("bind 대상 ID가 없어 bind 처리할 수 없습니다.");
- return;
- }
- if (!AXgetId(obj.id)) {
- trace("bind 대상이 없어 bind 처리할 수 없습니다.");
- return;
- }
-
- var objID = obj.id;
- var objSeq = null;
-
- for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
- if (O.id == objID && O.isDel != true) {
- objSeq = index;
- break;
- }
- }
-
- if (obj.href == undefined) obj.href = cfg.href;
-
- if (objSeq == null) {
- objSeq = this.objects.length;
- this.objects.push({ id: objID, anchorID: cfg.targetID + "_AX_" + objID, config: obj });
- } else {
- this.objects[objSeq].isDel = undefined;
- this.objects[objSeq].config = obj;
- }
-
- this.appendAnchor(objID);
- this.bindSelect(objID, objSeq);
-
- },
- appendAnchor: function (objID) {
- var cfg = this.config;
- /*trace("appendAnchor");*/
- if (AXgetId(cfg.targetID + "_AX_" + objID)) {
- jQuery("#" + cfg.targetID + "_AX_" + objID).remove();
- }
+ }
+ }
+ },
+ bind: function (obj) {
+ var cfg = this.config;
+
+ if (!obj.id) {
+ trace("bind 대상 ID가 없어 bind 처리할 수 없습니다.");
+ return;
+ }
+ if (!AXgetId(obj.id)) {
+ trace("bind 대상이 없어 bind 처리할 수 없습니다.");
+ return;
+ }
+
+ var objID = obj.id;
+ var objSeq = null;
+
+ for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
+ if (O.id == objID && O.isDel != true) {
+ objSeq = index;
+ break;
+ }
+ }
+
+ if (obj.href == undefined) obj.href = cfg.href;
+
+ if (objSeq == null) {
+ objSeq = this.objects.length;
+ this.objects.push({ id: objID, anchorID: cfg.targetID + "_AX_" + objID, config: obj });
+ } else {
+ this.objects[objSeq].isDel = undefined;
+ this.objects[objSeq].config = obj;
+ }
+
+ this.appendAnchor(objID);
+ this.bindSelect(objID, objSeq);
+ this.windowResize();
+
+ },
+ appendAnchor: function (objID) {
+ var cfg = this.config;
+ /*trace("appendAnchor");*/
+ if (AXgetId(cfg.targetID + "_AX_" + objID)) {
+ jQuery("#" + cfg.targetID + "_AX_" + objID).remove();
+ }
var anchorNode = jQuery("");
var iobj = jQuery("#" + objID);
iobj.attr("data-axbind", "select");
iobj.after(anchorNode);
- /*var offSetParent = iobj.offsetParent();*/
- var iobjPosition = iobj.position();
- var l = iobjPosition.left, t = iobjPosition.top, w = 0, h = 0;
+
+ var iobjPosition = iobj.position();
+ var l = iobjPosition.left, t = iobjPosition.top, w = 0, h = 0;
- var borderW = iobj.css("border-left-width").number();
- var borderH = iobj.css("border-top-width").number();
- var marginW = iobj.css("margin-left").number();
- var marginH = iobj.css("margin-top").number();
+ var borderW = iobj.css("border-left-width").number();
+ var borderH = iobj.css("border-top-width").number();
+ var marginW = iobj.css("margin-left").number();
+ var marginH = iobj.css("margin-top").number();
- l = l + marginW;
- //t = t;
- w = iobj.outerWidth();
- h = iobj.outerHeight();
+ l = l + marginW;
+ //t = t;
+ w = iobj.outerWidth();
+ h = iobj.outerHeight();
- var css = { left: l, top: t, width: w, height: h }, objDom = axdom("#" + cfg.targetID + "_AX_" + objID);
+ var css = { left: l, top: t, width: w, height: h }, objDom = axdom("#" + cfg.targetID + "_AX_" + objID);
objDom.css(css);
objDom.data("height", h);
- },
- alignAnchor: function (objID){
- var cfg = this.config;
- var iobj = jQuery("#" + objID);
- var iobjPosition = iobj.position();
- var l = iobjPosition.left, t = iobjPosition.top, w = 0, h = 0;
-
- var borderW = iobj.css("border-left-width").number();
- var borderH = iobj.css("border-top-width").number();
- var marginW = iobj.css("margin-left").number();
- var marginH = iobj.css("margin-top").number();
- l = l + marginW;
- //t = t;
- w = iobj.outerWidth();
- h = iobj.outerHeight();
-
- var css = { left: l, top: t, width: w, height: h };
- axdom("#" + cfg.targetID + "_AX_" + objID).css(css);
- axdom("#" + cfg.targetID + "_AX_" + objID).data("height", h);
-
- axdom("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectBox").css({width:w, height:h});
- axdom("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectTextBox").css({height:(h-2)});
+
+ },
+ alignAnchor: function (objID){
+ var cfg = this.config;
+ var iobj = jQuery("#" + objID);
+ //iobj.show();
+ var iobjPosition = iobj.position();
+ var l = iobjPosition.left, t = iobjPosition.top, w = 0, h = 0;
+ /*
+ var borderW = iobj.css("border-left-width").number();
+ var borderH = iobj.css("border-top-width").number();
+ var marginW = iobj.css("margin-left").number();
+ var marginH = iobj.css("margin-top").number();
+ l = l + marginW;
+ */
+ //t = t;
+ w = iobj.outerWidth();
+ h = iobj.outerHeight();
+
+ var css = { left: l, top: t, width: w, height: h };
+ axdom("#" + cfg.targetID + "_AX_" + objID).css(css);
+ axdom("#" + cfg.targetID + "_AX_" + objID).data("height", h);
+
+ axdom("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectBox").css({width:w, height:h});
+ axdom("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectTextBox").css({height:(h-2)});
axdom("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectText").css({"line-height":(h-2)+"px"});
axdom("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectBoxArrow").css({height:h});
- },
- bindSelect: function (objID, objSeq) {
- var cfg = this.config, _this = this;
- var obj = this.objects[objSeq];
- var objDom = axdom("#" + cfg.targetID + "_AX_" + objID);
- if(!obj.config.onChange) obj.config.onChange = obj.config.onchange;
-
- var w = jQuery("#" + cfg.targetID + "_AX_" + objID).width();
- var h = jQuery("#" + cfg.targetID + "_AX_" + objID).data("height");
-
- //trace(obj.config);
-
- var fontSize = jQuery("#" + objID).css("font-size").number();
- var tabIndex = jQuery("#" + objID).attr("tabindex");
-
- var po = [];
- po.push("");
-
- //append to anchor
- jQuery("#" + cfg.targetID + "_AX_" + objID).empty();
- jQuery("#" + cfg.targetID + "_AX_" + objID).append(po.join(''));
- jQuery("#" + cfg.targetID + "_AX_" + objID).css({ height: h + "px", "position": "relative", display: "inline-block", left: "auto", top: "auto", "vertical-align": "middle" });
-
- jQuery("#" + cfg.targetID + "_AX_" + objID).show();
-
-
- //alert(AXgetId(objID).options.selectedIndex);
- obj.selectedIndex = AXgetId(objID).options.selectedIndex;
- var options = [];
- for (var oi = 0; oi < AXgetId(objID).options.length; oi++) {
- options.push({ optionValue: AXgetId(objID).options[oi].value, optionText: AXgetId(objID).options[oi].text.enc() });
- }
- obj.options = AXUtil.copyObject(options);
-
- if (this.isMobile) {
-
- // mobile 브라우저인 경우
- var bindSelectChange = this.bindSelectChange.bind(this);
- obj.objOnChange = function () {
- bindSelectChange(objID, objSeq);
- }
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectBox").append(jQuery("#" + objID));
- jQuery("#" + objID).addClass("rootSelectBox");
- jQuery("#" + objID).bind("change.AXSelect", obj.objOnChange);
-
- } else {
- //AXUtil.alert(obj.options);
-
- // PC 브라우저인 경우
- jQuery("#" + objID).hide();
- var bindSelectExpand = this.bindSelectExpand.bind(this);
- var bindSelectClose = this.bindSelectClose.bind(this);
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectTextBox").bind("click.AXSelect", function (event) {
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectTextBox").focus();
- bindSelectExpand(objID, objSeq, true, event);
- });
-
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectTextBox").bind("keydown.AXSelect", function (event) {
- if(event.keyCode == AXUtil.Event.KEY_SPACE) bindSelectExpand(objID, objSeq, true, event);
- if(event.keyCode == AXUtil.Event.KEY_TAB || event.keyCode == AXUtil.Event.KEY_RETURN) return;
- //trace(String.fromCharCode(event.keyCode));
-
- if(_this.selectTextBox_onkeydown_obj){
- clearTimeout(_this.selectTextBox_onkeydown_obj);
- _this.selectTextBox_onkeydown_data += String.fromCharCode(event.keyCode);
- }else{
- _this.selectTextBox_onkeydown_data = String.fromCharCode(event.keyCode);
- }
-
- _this.selectTextBox_onkeydown_obj = setTimeout(function(){
- _this.selectTextBox_onkeydown(objID, objSeq, event);
- }, 300);
- });
- }
-
- if (obj.config.ajaxUrl) {
-
- var bindSelectChangeBind = this.bindSelectChange.bind(this);
- var bindSelectChange = function () {
- bindSelectChangeBind(objID, objSeq);
- };
-
- var url = obj.config.ajaxUrl;
- var pars = obj.config.ajaxPars;
- obj.selectedIndex = null;
-
- jQuery("#" + objID).empty();
-
- obj.inProgress = true; //진행중 상태 변경
-
- var async = (obj.config.ajaxAsync == undefined) ? true : obj.config.ajaxAsync;
- new AXReq(url, {
- debug: false, async: async, pars: pars, onsucc: function (res) {
- if (res.result == AXUtil.ajaxOkCode) {
-
- //trace(res);
- var po = [];
- if (obj.config.isspace) {
- po.push("");
- }
- for (var opts, oidx = 0; (oidx < res.options.length && (opts = res.options[oidx])); oidx++) {
- po.push("");
- };
- jQuery("#" + objID).html(po.join(''));
-
- var options = [];
- for (var oi = 0; oi < AXgetId(objID).options.length; oi++) {
- options.push({ optionValue: AXgetId(objID).options[oi].value, optionText: AXgetId(objID).options[oi].text.enc() });
- }
- obj.options = AXUtil.copyObject(options);
- obj.selectedIndex = AXgetId(objID).options.selectedIndex;
-
- if (obj.config.onChange) {
- obj.config.focusedIndex = obj.selectedIndex;
- obj.config.selectedObject = obj.options[obj.selectedIndex];
- obj.config.onChange.call(obj.config.selectedObject, obj.config.selectedObject);
- }
-
- bindSelectChange();
-
- if (obj.config.onLoad) {
- obj.config.onLoad.call(res);
- }
-
- } else {
- //trace(res);
- }
- obj.inProgress = false;
- }
- });
-
- } else if (obj.config.options) {
-
- var po = [];
- if (obj.config.isspace) {
- po.push("");
- }
-
- for (var opts, oidx = 0; (oidx < obj.config.options.length && (opts = obj.config.options[oidx])); oidx++) {
- var optionText = (opts.optionText||"").dec();
- po.push("");
- };
- jQuery("#" + objID).html(po.join(''));
-
- var options = [];
- for (var oi = 0; oi < AXgetId(objID).options.length; oi++) {
- options.push({ optionValue: AXgetId(objID).options[oi].value, optionText: AXgetId(objID).options[oi].text.enc() });
- }
- obj.options = AXUtil.copyObject(options);
- obj.selectedIndex = AXgetId(objID).options.selectedIndex;
-
- this.bindSelectChange(objID, objSeq);
- /*
- if (obj.config.onChange) {
- obj.config.focusedIndex = obj.selectedIndex;
- obj.config.selectedObject = obj.options[obj.selectedIndex];
- obj.config.onChange.call(obj.config.selectedObject, obj.config.selectedObject);
- }
- */
-
- } else {
- this.bindSelectChange(objID, objSeq);
-
- /*
- if (obj.config.onChange) {
- var selectedOption = this.getSelectedOption(objID, objSeq);
- if (selectedOption) {
- var sendObj = {optionValue:selectedOption.value, optionText:selectedOption.text};
- obj.config.onChange.call(sendObj, sendObj);
- }
- }
- */
-
- }
- },
- selectTextBox_onkeydown: function(objID, objSeq, event){
- var cfg = this.config, _this = this;
- var obj = this.objects[objSeq];
-
- var bindSelectClose = this.bindSelectClose.bind(this);
- var chkVal = (_this.selectTextBox_onkeydown_data || ""), chkIndex = null;
-
- for (var O, index = 0; (index < obj.options.length && (O = obj.options[index])); index++) {
- if(O.optionValue.left(chkVal.length).lcase() == chkVal.lcase() || O.optionText.left(chkVal.length).lcase() == chkVal.lcase()){
- chkIndex = index;
- break;
- }
- };
- if(chkIndex != null){
- obj.selectedIndex = chkIndex;
- obj.config.focusedIndex = chkIndex;
- obj.config.selectedObject = obj.options[chkIndex];
- obj.config.isChangedSelect = true;
- bindSelectClose(objID, objSeq, event); // 값 전달 후 닫기
- }
- _this.selectTextBox_onkeydown_data = "";
- },
- getSelectedOption: function (objID, objSeq) {
- var cfg = this.config;
- var obj = this.objects[objSeq];
- if(AXgetId(objID).options.selectedIndex > -1){
- try{
- if(obj.selectedIndex != AXgetId(objID).options.selectedIndex) obj.selectedIndex = AXgetId(objID).options.selectedIndex;
- }catch(e){
-
- }
- return AXgetId(objID).options[AXgetId(objID).options.selectedIndex];
- }else{
- return AXgetId(objID).options[0];
- }
- },
- bindSelectChange: function (objID, objSeq) {
- var cfg = this.config;
- var obj = this.objects[objSeq];
- var selectedOption = this.getSelectedOption(objID, objSeq);
- if (selectedOption) {
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectText").html(selectedOption.text);
- }
- },
- bindSelectExpand: function (objID, objSeq, isToggle, event) {
- var cfg = this.config;
- var obj = this.objects[objSeq];
- var jqueryTargetObjID = jQuery("#"+ cfg.targetID + "_AX_" + objID);
- //Selector Option box Expand
-
- if(jqueryTargetObjID.data("disabled")) return;
-
- if (isToggle) { // 활성화 여부가 토글 이면
- if (AXgetId(cfg.targetID + "_AX_" + objID + "_AX_expandBox")) {
- if (obj.config.isChangedSelect) {
- this.bindSelectClose(objID, objSeq, event); // 닫기
- } else {
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandBox").remove(); // 개체 삭제 처리
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectBoxArrow").removeClass("on");
- //비활성 처리후 메소드 종료
- jQuery(document).unbind("click.AXSelect");
- jQuery(document).unbind("keydown.AXSelect");
- }
- return;
- }
- }
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandBox").remove(); // 활성화 전에 개체 삭제 처리
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectBoxArrow").removeClass("on");
-
- //Expand Box 생성 구문 작성
- var anchorWidth = jQuery("#" + cfg.targetID + "_AX_" + objID).width() - 2; // anchor width
- var anchorHeight = jQuery("#" + cfg.targetID + "_AX_" + objID).data("height") - 1;
- var styles = [];
- //styles.push("top:"+anchorHeight+"px");
- styles.push("width:" + anchorWidth + "px");
-
- var po = [];
- po.push("");
- po.push("
");
- po.push("
");
- jQuery(document.body).append(po.join(''));
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectBoxArrow").addClass("on");
-
- var expandBox = jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandBox");
- if(obj.config.positionFixed){
- expandBox.css({"position":"fixed"});
- }
- var expBoxHeight = expandBox.outerHeight();
- var offset = (obj.config.positionFixed) ? jqueryTargetObjID.position() : jqueryTargetObjID.offset();
-
- if(obj.config.position){
- offset = jqueryTargetObjID.offset();
- if(obj.config.position.top != undefined){
- offset.top = obj.config.position.top;
- }
- }
- var css = {};
- css.top = offset.top + anchorHeight;
- //css.top = offset.top;
- css.left = offset.left;
-
- var bodyHeight;
- (AXUtil.docTD == "Q") ? bodyHeight = document.body.scrollHeight : bodyHeight = document.documentElement.scrollHeight;
- //trace({bodyHeight:bodyHeight, top:css.top});
-
- if(!obj.config.positionFixed){
- if (bodyHeight < css.top.number() + expBoxHeight) {
- css = {
- top: offset.top - expBoxHeight,
- left: offset.left
- }
- }
- }
-
- expandBox.css(css);
-
- this.bindSelectSetOptions(objID, objSeq);
- },
- bindSelectClose: function (objID, objSeq, event) {
- var obj = this.objects[objSeq];
- //trace("bindSelectorClose");
- var cfg = this.config;
- if (AXgetId(cfg.targetID + "_AX_" + objID + "_AX_expandBox")) {
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandBox").remove(); // 개체 삭제 처리
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectBoxArrow").removeClass("on");
-
- //비활성 처리후 메소드 종료
- jQuery(document).unbind("click", obj.documentclickEvent);
- jQuery(document).unbind("keydown", obj.documentKeyup);
-
- if (obj.config.isChangedSelect) {
-
- AXgetId(objID).options[obj.selectedIndex].selected = true;
- if (obj.config.onChange) {
- obj.config.onChange.call(obj.config.selectedObject, obj.config.selectedObject);
- }
- obj.config.isChangedSelect = false;
-
- this.bindSelectChange(objID, objSeq);
-
- }
-
- if(event) event.stopPropagation(); // disableevent
- return;
- }else{
- if (obj.config.isChangedSelect) {
-
- AXgetId(objID).options[obj.selectedIndex].selected = true;
- if (obj.config.onChange) {
- obj.config.onChange.call(obj.config.selectedObject, obj.config.selectedObject);
- }
- obj.config.isChangedSelect = false;
-
- this.bindSelectChange(objID, objSeq);
-
- }
- }
- },
- bindSelectSetOptions: function (objID, objSeq) {
- var obj = this.objects[objSeq];
- var cfg = this.config;
- var jqueryTargetObjID = jQuery("#" + cfg.targetID + "_AX_" + objID);
- var maxHeight = obj.config.maxHeight || 200;
-
- if (!obj.options) return;
- if (obj.options.length == 0) {
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandBox").hide();
- }
-
- var po = [];
- for (var O, index = 0; (index < obj.options.length && (O = obj.options[index])); index++) {
- po.push("" + O.optionText.dec() + "");
- };
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandScroll").html(po.join(''));
-
- var expandScrollHeight = jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandScroll").height();
- if (expandScrollHeight > maxHeight) expandScrollHeight = maxHeight;
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandBox").css({ height: expandScrollHeight + "px" });
-
- var bindSelectOptionsClick = this.bindSelectOptionsClick.bind(this);
- obj.documentclickEvent = function (event) {
- bindSelectOptionsClick(objID, objSeq, event);
- }
- var bindSelectKeyup = this.bindSelectKeyup.bind(this);
- obj.documentKeyup = function (event) {
- bindSelectKeyup(objID, objSeq, event);
- }
- jQuery(document).bind("click.AXSelect", obj.documentclickEvent);
- jQuery(document).bind("keydown.AXSelect", obj.documentKeyup);
-
- if (obj.myUIScroll) obj.myUIScroll.unbind();
- obj.myUIScroll = new AXScroll();
- obj.myUIScroll.setConfig({
- CT_className: "AXScrollSmall",
- targetID: cfg.targetID + "_AX_" + objID + "_AX_expandBox",
- scrollID: cfg.targetID + "_AX_" + objID + "_AX_expandScroll",
- touchDirection: false
- });
-
- if (obj.selectedIndex != undefined) {
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_" + obj.selectedIndex + "_AX_option").addClass("on");
- obj.myUIScroll.focusElement(cfg.targetID + "_AX_" + objID + "_AX_" + obj.selectedIndex + "_AX_option"); //focus
- obj.config.focusedIndex = obj.selectedIndex;
- }
-
- // 위치 재 정의 필요하면 정의 할 것 ----------------------------------
- var bodyHeight;
- (AXUtil.docTD == "Q") ? bodyHeight = document.body.clientHeight : bodyHeight = document.documentElement.clientHeight;
- //trace({bodyHeight:bodyHeight, top:css.top});
-
- var anchorHeight = jqueryTargetObjID.data("height") - 1;
- var expandBox = jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandBox");
- var expBoxHeight = expandBox.outerHeight();
-
- var offset = (obj.config.positionFixed) ? jqueryTargetObjID.position() : jqueryTargetObjID.offset();
-
- if(obj.config.position){
- offset = jqueryTargetObjID.offset();
- if(obj.config.position.top != undefined){
- offset.top = obj.config.position.top;
- }
- }
-
- var css = {};
- css.top = offset.top + anchorHeight;
- if(!obj.config.positionFixed){
- if (bodyHeight < css.top.number() + expBoxHeight) {
- css = {
- top: offset.top - expBoxHeight,
- left: offset.left
- }
- expandBox.css(css);
- }
- }
- // 위치 재 정의 필요하면 정의 할 것 ----------------------------------
-
- },
- bindSelectOptionsClick: function (objID, objSeq, event) {
- var obj = this.objects[objSeq];
- var cfg = this.config;
- var isSelectorClick = false;
- var eid = event.target.id.split(/_AX_/g);
- var tgid = event.target.id;
- //trace(tgid.substr(eid[0].length, objID.length)+"///"+objID);
- if (event.target.id == "") isSelectorClick = false;
- else {
- if (event.target.id == objID || (eid[0] == cfg.targetID && tgid.substr(eid[0].length + 4, objID.length) == objID)) {
- isSelectorClick = true;
- }
- }
-
- if (!isSelectorClick) {
- this.bindSelectClose(objID, objSeq, event); // 셀럭터 외의 영역이 므로 닫기
- } else {
- if (eid.last() == "option") {
- var selectedIndex = eid[eid.length - 2];
- obj.selectedIndex = selectedIndex;
- obj.config.focusedIndex = selectedIndex;
- obj.config.selectedObject = obj.options[selectedIndex];
-
- obj.config.isChangedSelect = true;
- this.bindSelectClose(objID, objSeq, event); // 값 전달 후 닫기
- }
- }
- },
- bindSelectKeyup: function (objID, objSeq, event) {
- var obj = this.objects[objSeq];
- var cfg = this.config;
- if (event.keyCode == AXUtil.Event.KEY_TAB || event.keyCode == AXUtil.Event.KEY_ESC) {
- this.bindSelectClose(objID, objSeq, event); // 닫기
- return;
- } else if (event.keyCode == AXUtil.Event.KEY_UP) {
- if (!obj.options) return;
- if (obj.options.length == 0) return;
- var focusIndex = obj.options.length - 1;
- if (obj.config.focusedIndex == undefined || obj.config.focusedIndex == 0) {
-
- } else {
- focusIndex = (obj.config.focusedIndex) - 1;
- }
- this.bindSelectorSelect(objID, objSeq, focusIndex);
- } else if (event.keyCode == AXUtil.Event.KEY_DOWN) {
- if (!obj.options) return;
- if (obj.options.length == 0) return;
- var focusIndex = 0;
- if (obj.config.focusedIndex == undefined || obj.config.focusedIndex == obj.options.length - 1) {
-
- } else {
- focusIndex = (obj.config.focusedIndex).number() + 1;
- }
- this.bindSelectorSelect(objID, objSeq, focusIndex);
- } else if (event.keyCode == AXUtil.Event.KEY_RETURN) {
- //alert("RETURN");
- /*
- jQuery(document).unbind("click", obj.documentclickEvent);
- jQuery(document).unbind("keydown", obj.documentKeyup);
- */
- /*
- var selectedIndex = eid[eid.length - 2];
- obj.selectedIndex = selectedIndex;
- obj.config.focusedIndex = selectedIndex;
- obj.config.selectedObject = obj.options[selectedIndex];
-
- obj.config.isChangedSelect = true;
- this.bindSelectClose(objID, objSeq, event); // 값 전달 후 닫기
- */
-
- }
- },
- /* ~~~~~~~~~~~~~ */
-
- bindSelectorSelect: function (objID, objSeq, index, changeValue) {
- var obj = this.objects[objSeq];
- var cfg = this.config;
- if (obj.config.focusedIndex != undefined) {
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_" + obj.config.focusedIndex + "_AX_option").removeClass("on");
- }
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_" + index + "_AX_option").addClass("on");
- obj.config.focusedIndex = index;
- obj.selectedIndex = index;
- obj.config.selectedObject = obj.options[index];
- obj.config.isChangedSelect = true;
- obj.myUIScroll.focusElement(cfg.targetID + "_AX_" + objID + "_AX_" + index + "_AX_option"); //focus
- },
- bindSelectorSelectClear: function (objID, objSeq) {
-
- var obj = this.objects[objSeq];
- var cfg = this.config;
- if (obj.selectedIndex != undefined) {
- jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_" + obj.selectedIndex + "_AX_option").removeClass("on");
- }
- obj.selectedIndex = null;
- obj.config.focusedIndex = null;
- obj.config.selectedObject = null;
- obj.config.isChangedSelect = true;
- },
-
- /* ~~~~~~~~~~~~~ */
- bindSelectChangeValue: function (objID, value, onEnd) {
- var findIndex = null;
-
- for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
- if (O.id == objID && O.isDel != true) {
- findIndex = index;
- break;
- }
- };
-
- if (findIndex == null) {
- //trace("바인드 된 오브젝트를 찾을 수 없습니다.");
- return;
- } else {
- var obj = this.objects[findIndex];
- var cfg = this.config;
-
- if (this.isMobile) {
- for (var oi = 0; oi < AXgetId(objID).options.length; oi++) {
- if (AXgetId(objID).options[oi].value == value) {
- var selectedIndex = oi;
- AXgetId(objID).options[oi].selected = true;
- obj.config.selectedObject = { optionValue: AXgetId(objID).options[oi].value, optionText: AXgetId(objID).options[oi].text.enc() };
- this.bindSelectChange(objID, findIndex);
- if (obj.config.onChange) {
- obj.config.onChange.call(obj.config.selectedObject, obj.config.selectedObject);
- }
- break;
- }
- }
- } else {
- var selectedIndex = null;
- for (var O, oidx = 0; (oidx < obj.options.length && (O = obj.options[oidx])); oidx++) {
- if ((O.optionValue || O.value || "") == value) {
- selectedIndex = oidx;
- break;
- }
- };
-
- if (selectedIndex != null) {
-
- obj.selectedIndex = selectedIndex;
- obj.config.focusedIndex = selectedIndex;
-
- AXgetId(objID).options[obj.selectedIndex].selected = true;
- obj.config.selectedObject = obj.options[selectedIndex];
- this.bindSelectChange(objID, selectedIndex);
-
- if (obj.config.onChange) {
- obj.config.onChange.call(obj.config.selectedObject, obj.config.selectedObject);
- }
-
- } else {
- //trace("일치하는 값을 찾을 수 없습니다.");
- }
- }
- }
- },
- bindSelectDisabled: function(objID, disabled){
- var findIndex = null;
- for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
- if (O.id == objID && O.isDel != true) {
- findIndex = index;
- break;
- }
- };
-
- if (findIndex == null) {
- //trace("바인드 된 오브젝트를 찾을 수 없습니다.");
- return;
- } else {
- var obj = this.objects[findIndex];
- var cfg = this.config;
-
- if (this.isMobile) {
- AXgetId(objID).disabled = disabled;
- } else {
- AXgetId(objID).disabled = disabled;
- if(AXgetId(objID).disabled){
- jQuery("#"+ cfg.targetID + "_AX_" + objID).find(".AXanchorSelect").addClass("disabled");
- jQuery("#"+ cfg.targetID + "_AX_" + objID).data("disabled", AXgetId(objID).disabled);
- }else{
- jQuery("#"+ cfg.targetID + "_AX_" + objID).find(".AXanchorSelect").removeClass("disabled");
- jQuery("#"+ cfg.targetID + "_AX_" + objID).data("disabled", AXgetId(objID).disabled);
- }
-
- }
- }
- },
- bindSelectUpdate: function(objID){
- var findIndex = null;
- for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
- if (O.id == objID && O.isDel != true) {
- findIndex = index;
- break;
- }
- };
- if(findIndex != null){
- this.bindSelectChange(objID, findIndex);
- }
- },
- bindSelectFocus: function(objID){
- var cfg = this.config;
- var findIndex = null;
- for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
- if (O.id == objID && O.isDel != true) {
- findIndex = index;
- break;
- }
- };
- if(findIndex != null){
- AXgetId(cfg.targetID + "_AX_" + objID + "_AX_SelectTextBox").focus();
- }
- },
- bindSelectBlur: function(objID){
- var cfg = this.config;
- var findIndex = null;
- for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
- if (O.id == objID && O.isDel != true) {
- findIndex = index;
- break;
- }
- };
- if(findIndex != null){
- this.bindSelectClose(objID, findIndex);
- }
- },
- bindSelectGetAnchorObject: function(objID){
- var cfg = this.config;
- var findIndex = null;
- for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
- if (O.id == objID && O.isDel != true) {
- findIndex = index;
- break;
- }
- };
- if(findIndex != null){
- return jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectTextBox");
- }
- },
- bindSelectGetValue: function(objID, onEnd){
- var findIndex = null;
- for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
- if (O.id == objID && O.isDel != true) {
- findIndex = index;
- break;
- }
- };
-
- if (findIndex == null) {
- return { optionValue: null, optionText: null, error:"바인드 된 오브젝트를 찾을 수 없습니다." };
- } else {
- var obj = this.objects[findIndex];
- var cfg = this.config;
-
- if (obj.selectedIndex != undefined) {
- return { optionValue: AXgetId(objID).options[ obj.selectedIndex ].value, optionText: AXgetId(objID).options[ obj.selectedIndex ].text };
- }else{
- return { optionValue: null, optionText: null };
- }
- }
- }
+ //iobj.hide();
+
+ },
+ bindSelect: function (objID, objSeq) {
+ var cfg = this.config, _this = this;
+ var obj = this.objects[objSeq];
+ var objDom = axdom("#" + cfg.targetID + "_AX_" + objID);
+ if(!obj.config.onChange) obj.config.onChange = obj.config.onchange;
+
+ var w = jQuery("#" + cfg.targetID + "_AX_" + objID).width();
+ var h = jQuery("#" + cfg.targetID + "_AX_" + objID).data("height");
+
+ //trace(obj.config);
+
+ var fontSize = jQuery("#" + objID).css("font-size").number();
+ var tabIndex = jQuery("#" + objID).attr("tabindex");
+
+ var po = [];
+ po.push("");
+
+ //append to anchor
+ jQuery("#" + cfg.targetID + "_AX_" + objID).empty();
+ jQuery("#" + cfg.targetID + "_AX_" + objID).append(po.join(''));
+ //jQuery("#" + cfg.targetID + "_AX_" + objID).css({ height: h + "px", "position": "relative", display: "inline-block", left: "auto", top: "auto", "vertical-align": "middle" });
+ //jQuery("#" + cfg.targetID + "_AX_" + objID).css({ height: h + "px", "position": "relative", display: "inline-block", left: "auto", top: "auto", "vertical-align": "middle" });
+
+ jQuery("#" + cfg.targetID + "_AX_" + objID).show();
+
+
+ //alert(AXgetId(objID).options.selectedIndex);
+ obj.selectedIndex = AXgetId(objID).options.selectedIndex;
+ var options = [];
+ for (var oi = 0; oi < AXgetId(objID).options.length; oi++) {
+ options.push({ optionValue: AXgetId(objID).options[oi].value, optionText: AXgetId(objID).options[oi].text.enc() });
+ }
+ obj.options = AXUtil.copyObject(options);
+
+ if (this.isMobile) {
+
+ // mobile 브라우저인 경우
+ var bindSelectChange = this.bindSelectChange.bind(this);
+ obj.objOnChange = function () {
+ bindSelectChange(objID, objSeq);
+ }
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectBox").append(jQuery("#" + objID));
+ jQuery("#" + objID).addClass("rootSelectBox");
+ jQuery("#" + objID).bind("change.AXSelect", obj.objOnChange);
+
+ } else {
+ //AXUtil.alert(obj.options);
+
+ // PC 브라우저인 경우
+ jQuery("#" + objID).css({opacity:0});
+ var bindSelectExpand = this.bindSelectExpand.bind(this);
+ var bindSelectClose = this.bindSelectClose.bind(this);
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectTextBox").bind("click.AXSelect", function (event) {
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectTextBox").focus();
+ bindSelectExpand(objID, objSeq, true, event);
+ });
+
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectTextBox").bind("keydown.AXSelect", function (event) {
+ if(event.keyCode == AXUtil.Event.KEY_SPACE) bindSelectExpand(objID, objSeq, true, event);
+ if(event.keyCode == AXUtil.Event.KEY_TAB || event.keyCode == AXUtil.Event.KEY_RETURN) return;
+ //trace(String.fromCharCode(event.keyCode));
+
+ if(_this.selectTextBox_onkeydown_obj){
+ clearTimeout(_this.selectTextBox_onkeydown_obj);
+ _this.selectTextBox_onkeydown_data += String.fromCharCode(event.keyCode);
+ }else{
+ _this.selectTextBox_onkeydown_data = String.fromCharCode(event.keyCode);
+ }
+
+ _this.selectTextBox_onkeydown_obj = setTimeout(function(){
+ _this.selectTextBox_onkeydown(objID, objSeq, event);
+ }, 300);
+ });
+ }
+
+ if (obj.config.ajaxUrl) {
+
+ var bindSelectChangeBind = this.bindSelectChange.bind(this);
+ var bindSelectChange = function () {
+ bindSelectChangeBind(objID, objSeq);
+ };
+
+ var url = obj.config.ajaxUrl;
+ var pars = obj.config.ajaxPars;
+ obj.selectedIndex = null;
+
+ jQuery("#" + objID).empty();
+
+ obj.inProgress = true; //진행중 상태 변경
+
+ var async = (obj.config.ajaxAsync == undefined) ? true : obj.config.ajaxAsync;
+ new AXReq(url, {
+ debug: false, async: async, pars: pars, onsucc: function (res) {
+ if (res.result == AXUtil.ajaxOkCode) {
+
+ //trace(res);
+ var po = [];
+ if (obj.config.isspace) {
+ po.push("");
+ }
+ for (var opts, oidx = 0; (oidx < res.options.length && (opts = res.options[oidx])); oidx++) {
+ po.push("");
+ };
+ jQuery("#" + objID).html(po.join(''));
+
+ var options = [];
+ for (var oi = 0; oi < AXgetId(objID).options.length; oi++) {
+ options.push({ optionValue: AXgetId(objID).options[oi].value, optionText: AXgetId(objID).options[oi].text.enc() });
+ }
+ obj.options = AXUtil.copyObject(options);
+ obj.selectedIndex = AXgetId(objID).options.selectedIndex;
+
+ if (obj.config.onChange) {
+ obj.config.focusedIndex = obj.selectedIndex;
+ obj.config.selectedObject = obj.options[obj.selectedIndex];
+ obj.config.onChange.call(obj.config.selectedObject, obj.config.selectedObject);
+ }
+
+ bindSelectChange();
+
+ if (obj.config.onLoad) {
+ obj.config.onLoad.call(res);
+ }
+
+ } else {
+ //trace(res);
+ }
+ obj.inProgress = false;
+ }
+ });
+
+ } else if (obj.config.options) {
+
+ var po = [];
+ if (obj.config.isspace) {
+ po.push("");
+ }
+
+ for (var opts, oidx = 0; (oidx < obj.config.options.length && (opts = obj.config.options[oidx])); oidx++) {
+ var optionText = (opts.optionText||"").dec();
+ po.push("");
+ };
+ jQuery("#" + objID).html(po.join(''));
+
+ var options = [];
+ for (var oi = 0; oi < AXgetId(objID).options.length; oi++) {
+ options.push({ optionValue: AXgetId(objID).options[oi].value, optionText: AXgetId(objID).options[oi].text.enc() });
+ }
+ obj.options = AXUtil.copyObject(options);
+ obj.selectedIndex = AXgetId(objID).options.selectedIndex;
+
+ this.bindSelectChange(objID, objSeq);
+ /*
+ if (obj.config.onChange) {
+ obj.config.focusedIndex = obj.selectedIndex;
+ obj.config.selectedObject = obj.options[obj.selectedIndex];
+ obj.config.onChange.call(obj.config.selectedObject, obj.config.selectedObject);
+ }
+ */
+
+ } else {
+ this.bindSelectChange(objID, objSeq);
+
+ /*
+ if (obj.config.onChange) {
+ var selectedOption = this.getSelectedOption(objID, objSeq);
+ if (selectedOption) {
+ var sendObj = {optionValue:selectedOption.value, optionText:selectedOption.text};
+ obj.config.onChange.call(sendObj, sendObj);
+ }
+ }
+ */
+
+ }
+ },
+ selectTextBox_onkeydown: function(objID, objSeq, event){
+ var cfg = this.config, _this = this;
+ var obj = this.objects[objSeq];
+
+ var bindSelectClose = this.bindSelectClose.bind(this);
+ var chkVal = (_this.selectTextBox_onkeydown_data || ""), chkIndex = null;
+
+ for (var O, index = 0; (index < obj.options.length && (O = obj.options[index])); index++) {
+ if(O.optionValue.left(chkVal.length).lcase() == chkVal.lcase() || O.optionText.left(chkVal.length).lcase() == chkVal.lcase()){
+ chkIndex = index;
+ break;
+ }
+ };
+ if(chkIndex != null){
+ obj.selectedIndex = chkIndex;
+ obj.config.focusedIndex = chkIndex;
+ obj.config.selectedObject = obj.options[chkIndex];
+ obj.config.isChangedSelect = true;
+ bindSelectClose(objID, objSeq, event); // 값 전달 후 닫기
+ }
+ _this.selectTextBox_onkeydown_data = "";
+ },
+ getSelectedOption: function (objID, objSeq) {
+ var cfg = this.config;
+ var obj = this.objects[objSeq];
+ if(AXgetId(objID).options.selectedIndex > -1){
+ try{
+ if(obj.selectedIndex != AXgetId(objID).options.selectedIndex) obj.selectedIndex = AXgetId(objID).options.selectedIndex;
+ }catch(e){
+
+ }
+ return AXgetId(objID).options[AXgetId(objID).options.selectedIndex];
+ }else{
+ return AXgetId(objID).options[0];
+ }
+ },
+ bindSelectChange: function (objID, objSeq) {
+ var cfg = this.config;
+ var obj = this.objects[objSeq];
+ var selectedOption = this.getSelectedOption(objID, objSeq);
+ if (selectedOption) {
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectText").html(selectedOption.text);
+ }
+ },
+ bindSelectExpand: function (objID, objSeq, isToggle, event) {
+ var cfg = this.config;
+ var obj = this.objects[objSeq];
+ var jqueryTargetObjID = jQuery("#"+ cfg.targetID + "_AX_" + objID);
+ //Selector Option box Expand
+
+ if(jqueryTargetObjID.data("disabled")) return;
+
+ if (isToggle) { // 활성화 여부가 토글 이면
+ if (AXgetId(cfg.targetID + "_AX_" + objID + "_AX_expandBox")) {
+ if (obj.config.isChangedSelect) {
+ this.bindSelectClose(objID, objSeq, event); // 닫기
+ } else {
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandBox").remove(); // 개체 삭제 처리
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectBoxArrow").removeClass("on");
+ //비활성 처리후 메소드 종료
+ jQuery(document).unbind("click.AXSelect");
+ jQuery(document).unbind("keydown.AXSelect");
+ }
+ return;
+ }
+ }
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandBox").remove(); // 활성화 전에 개체 삭제 처리
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectBoxArrow").removeClass("on");
+
+ //Expand Box 생성 구문 작성
+ var anchorWidth = jQuery("#" + cfg.targetID + "_AX_" + objID).width() - 2; // anchor width
+ var anchorHeight = jQuery("#" + cfg.targetID + "_AX_" + objID).data("height") - 1;
+ var styles = [];
+ //styles.push("top:"+anchorHeight+"px");
+ styles.push("width:" + anchorWidth + "px");
+
+ var po = [];
+ po.push("");
+ po.push("
");
+ po.push("
");
+ jQuery(document.body).append(po.join(''));
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectBoxArrow").addClass("on");
+
+ var expandBox = jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandBox");
+ if(obj.config.positionFixed){
+ expandBox.css({"position":"fixed"});
+ }
+ var expBoxHeight = expandBox.outerHeight();
+ var offset = (obj.config.positionFixed) ? jqueryTargetObjID.position() : jqueryTargetObjID.offset();
+
+ if(obj.config.position){
+ offset = jqueryTargetObjID.offset();
+ if(obj.config.position.top != undefined){
+ offset.top = obj.config.position.top;
+ }
+ }
+ var css = {};
+ css.top = offset.top + anchorHeight;
+ //css.top = offset.top;
+ css.left = offset.left;
+
+ var bodyHeight;
+ (AXUtil.docTD == "Q") ? bodyHeight = document.body.scrollHeight : bodyHeight = document.documentElement.scrollHeight;
+ //trace({bodyHeight:bodyHeight, top:css.top});
+
+ if(!obj.config.positionFixed){
+ if (bodyHeight < css.top.number() + expBoxHeight) {
+ css = {
+ top: offset.top - expBoxHeight,
+ left: offset.left
+ }
+ }
+ }
+
+ expandBox.css(css);
+
+ this.bindSelectSetOptions(objID, objSeq);
+ },
+ bindSelectClose: function (objID, objSeq, event) {
+ var obj = this.objects[objSeq];
+ //trace("bindSelectorClose");
+ var cfg = this.config;
+ if (AXgetId(cfg.targetID + "_AX_" + objID + "_AX_expandBox")) {
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandBox").remove(); // 개체 삭제 처리
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectBoxArrow").removeClass("on");
+
+ //비활성 처리후 메소드 종료
+ jQuery(document).unbind("click", obj.documentclickEvent);
+ jQuery(document).unbind("keydown", obj.documentKeyup);
+
+ if (obj.config.isChangedSelect) {
+
+ AXgetId(objID).options[obj.selectedIndex].selected = true;
+ if (obj.config.onChange) {
+ obj.config.onChange.call(obj.config.selectedObject, obj.config.selectedObject);
+ }
+ obj.config.isChangedSelect = false;
+
+ this.bindSelectChange(objID, objSeq);
+
+ }
+
+ if(event) event.stopPropagation(); // disableevent
+ return;
+ }else{
+ if (obj.config.isChangedSelect) {
+
+ AXgetId(objID).options[obj.selectedIndex].selected = true;
+ if (obj.config.onChange) {
+ obj.config.onChange.call(obj.config.selectedObject, obj.config.selectedObject);
+ }
+ obj.config.isChangedSelect = false;
+
+ this.bindSelectChange(objID, objSeq);
+
+ }
+ }
+ },
+ bindSelectSetOptions: function (objID, objSeq) {
+ var obj = this.objects[objSeq];
+ var cfg = this.config;
+ var jqueryTargetObjID = jQuery("#" + cfg.targetID + "_AX_" + objID);
+ var maxHeight = obj.config.maxHeight || 200;
+
+ if (!obj.options) return;
+ if (obj.options.length == 0) {
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandBox").hide();
+ }
+
+ var po = [];
+ for (var O, index = 0; (index < obj.options.length && (O = obj.options[index])); index++) {
+ po.push("" + O.optionText.dec() + "");
+ };
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandScroll").html(po.join(''));
+
+ var expandScrollHeight = jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandScroll").height();
+ if (expandScrollHeight > maxHeight) expandScrollHeight = maxHeight;
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandBox").css({ height: expandScrollHeight + "px" });
+
+ var bindSelectOptionsClick = this.bindSelectOptionsClick.bind(this);
+ obj.documentclickEvent = function (event) {
+ bindSelectOptionsClick(objID, objSeq, event);
+ }
+ var bindSelectKeyup = this.bindSelectKeyup.bind(this);
+ obj.documentKeyup = function (event) {
+ bindSelectKeyup(objID, objSeq, event);
+ }
+ jQuery(document).bind("click.AXSelect", obj.documentclickEvent);
+ jQuery(document).bind("keydown.AXSelect", obj.documentKeyup);
+
+ if (obj.myUIScroll) obj.myUIScroll.unbind();
+ obj.myUIScroll = new AXScroll();
+ obj.myUIScroll.setConfig({
+ CT_className: "AXScrollSmall",
+ targetID: cfg.targetID + "_AX_" + objID + "_AX_expandBox",
+ scrollID: cfg.targetID + "_AX_" + objID + "_AX_expandScroll",
+ touchDirection: false
+ });
+
+ if (obj.selectedIndex != undefined) {
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_" + obj.selectedIndex + "_AX_option").addClass("on");
+ obj.myUIScroll.focusElement(cfg.targetID + "_AX_" + objID + "_AX_" + obj.selectedIndex + "_AX_option"); //focus
+ obj.config.focusedIndex = obj.selectedIndex;
+ }
+
+ // 위치 재 정의 필요하면 정의 할 것 ----------------------------------
+ var bodyHeight;
+ (AXUtil.docTD == "Q") ? bodyHeight = document.body.clientHeight : bodyHeight = document.documentElement.clientHeight;
+ //trace({bodyHeight:bodyHeight, top:css.top});
+
+ var anchorHeight = jqueryTargetObjID.data("height") - 1;
+ var expandBox = jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_expandBox");
+ var expBoxHeight = expandBox.outerHeight();
+
+ var offset = (obj.config.positionFixed) ? jqueryTargetObjID.position() : jqueryTargetObjID.offset();
+
+ if(obj.config.position){
+ offset = jqueryTargetObjID.offset();
+ if(obj.config.position.top != undefined){
+ offset.top = obj.config.position.top;
+ }
+ }
+
+ var css = {};
+ css.top = offset.top + anchorHeight;
+ if(!obj.config.positionFixed){
+ if (bodyHeight < css.top.number() + expBoxHeight) {
+ css = {
+ top: offset.top - expBoxHeight,
+ left: offset.left
+ }
+ expandBox.css(css);
+ }
+ }
+ // 위치 재 정의 필요하면 정의 할 것 ----------------------------------
+
+ },
+ bindSelectOptionsClick: function (objID, objSeq, event) {
+ var obj = this.objects[objSeq];
+ var cfg = this.config;
+ var isSelectorClick = false;
+ var eid = event.target.id.split(/_AX_/g);
+ var tgid = event.target.id;
+ //trace(tgid.substr(eid[0].length, objID.length)+"///"+objID);
+ if (event.target.id == "") isSelectorClick = false;
+ else {
+ if (event.target.id == objID || (eid[0] == cfg.targetID && tgid.substr(eid[0].length + 4, objID.length) == objID)) {
+ isSelectorClick = true;
+ }
+ }
+
+ if (!isSelectorClick) {
+ this.bindSelectClose(objID, objSeq, event); // 셀럭터 외의 영역이 므로 닫기
+ } else {
+ if (eid.last() == "option") {
+ var selectedIndex = eid[eid.length - 2];
+ obj.selectedIndex = selectedIndex;
+ obj.config.focusedIndex = selectedIndex;
+ obj.config.selectedObject = obj.options[selectedIndex];
+
+ obj.config.isChangedSelect = true;
+ this.bindSelectClose(objID, objSeq, event); // 값 전달 후 닫기
+ }
+ }
+ },
+ bindSelectKeyup: function (objID, objSeq, event) {
+ var obj = this.objects[objSeq];
+ var cfg = this.config;
+ if (event.keyCode == AXUtil.Event.KEY_TAB || event.keyCode == AXUtil.Event.KEY_ESC) {
+ this.bindSelectClose(objID, objSeq, event); // 닫기
+ return;
+ } else if (event.keyCode == AXUtil.Event.KEY_UP) {
+ if (!obj.options) return;
+ if (obj.options.length == 0) return;
+ var focusIndex = obj.options.length - 1;
+ if (obj.config.focusedIndex == undefined || obj.config.focusedIndex == 0) {
+
+ } else {
+ focusIndex = (obj.config.focusedIndex) - 1;
+ }
+ this.bindSelectorSelect(objID, objSeq, focusIndex);
+ } else if (event.keyCode == AXUtil.Event.KEY_DOWN) {
+ if (!obj.options) return;
+ if (obj.options.length == 0) return;
+ var focusIndex = 0;
+ if (obj.config.focusedIndex == undefined || obj.config.focusedIndex == obj.options.length - 1) {
+
+ } else {
+ focusIndex = (obj.config.focusedIndex).number() + 1;
+ }
+ this.bindSelectorSelect(objID, objSeq, focusIndex);
+ } else if (event.keyCode == AXUtil.Event.KEY_RETURN) {
+ //alert("RETURN");
+ /*
+ jQuery(document).unbind("click", obj.documentclickEvent);
+ jQuery(document).unbind("keydown", obj.documentKeyup);
+ */
+ /*
+ var selectedIndex = eid[eid.length - 2];
+ obj.selectedIndex = selectedIndex;
+ obj.config.focusedIndex = selectedIndex;
+ obj.config.selectedObject = obj.options[selectedIndex];
+
+ obj.config.isChangedSelect = true;
+ this.bindSelectClose(objID, objSeq, event); // 값 전달 후 닫기
+ */
+
+ }
+ },
+ /* ~~~~~~~~~~~~~ */
+
+ bindSelectorSelect: function (objID, objSeq, index, changeValue) {
+ var obj = this.objects[objSeq];
+ var cfg = this.config;
+ if (obj.config.focusedIndex != undefined) {
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_" + obj.config.focusedIndex + "_AX_option").removeClass("on");
+ }
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_" + index + "_AX_option").addClass("on");
+ obj.config.focusedIndex = index;
+ obj.selectedIndex = index;
+ obj.config.selectedObject = obj.options[index];
+ obj.config.isChangedSelect = true;
+ obj.myUIScroll.focusElement(cfg.targetID + "_AX_" + objID + "_AX_" + index + "_AX_option"); //focus
+ },
+ bindSelectorSelectClear: function (objID, objSeq) {
+
+ var obj = this.objects[objSeq];
+ var cfg = this.config;
+ if (obj.selectedIndex != undefined) {
+ jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_" + obj.selectedIndex + "_AX_option").removeClass("on");
+ }
+ obj.selectedIndex = null;
+ obj.config.focusedIndex = null;
+ obj.config.selectedObject = null;
+ obj.config.isChangedSelect = true;
+ },
+
+ /* ~~~~~~~~~~~~~ */
+ bindSelectChangeValue: function (objID, value, onEnd) {
+ var findIndex = null;
+
+ for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
+ if (O.id == objID && O.isDel != true) {
+ findIndex = index;
+ break;
+ }
+ };
+
+ if (findIndex == null) {
+ //trace("바인드 된 오브젝트를 찾을 수 없습니다.");
+ return;
+ } else {
+ var obj = this.objects[findIndex];
+ var cfg = this.config;
+
+ if (this.isMobile) {
+ for (var oi = 0; oi < AXgetId(objID).options.length; oi++) {
+ if (AXgetId(objID).options[oi].value == value) {
+ var selectedIndex = oi;
+ AXgetId(objID).options[oi].selected = true;
+ obj.config.selectedObject = { optionValue: AXgetId(objID).options[oi].value, optionText: AXgetId(objID).options[oi].text.enc() };
+ this.bindSelectChange(objID, findIndex);
+ if (obj.config.onChange) {
+ obj.config.onChange.call(obj.config.selectedObject, obj.config.selectedObject);
+ }
+ break;
+ }
+ }
+ } else {
+ var selectedIndex = null;
+ for (var O, oidx = 0; (oidx < obj.options.length && (O = obj.options[oidx])); oidx++) {
+ if ((O.optionValue || O.value || "") == value) {
+ selectedIndex = oidx;
+ break;
+ }
+ };
+
+ if (selectedIndex != null) {
+
+ obj.selectedIndex = selectedIndex;
+ obj.config.focusedIndex = selectedIndex;
+
+ AXgetId(objID).options[obj.selectedIndex].selected = true;
+ obj.config.selectedObject = obj.options[selectedIndex];
+ this.bindSelectChange(objID, selectedIndex);
+
+ if (obj.config.onChange) {
+ obj.config.onChange.call(obj.config.selectedObject, obj.config.selectedObject);
+ }
+
+ } else {
+ //trace("일치하는 값을 찾을 수 없습니다.");
+ }
+ }
+ }
+ },
+ bindSelectDisabled: function(objID, disabled){
+ var findIndex = null;
+ for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
+ if (O.id == objID && O.isDel != true) {
+ findIndex = index;
+ break;
+ }
+ };
+
+ if (findIndex == null) {
+ //trace("바인드 된 오브젝트를 찾을 수 없습니다.");
+ return;
+ } else {
+ var obj = this.objects[findIndex];
+ var cfg = this.config;
+
+ if (this.isMobile) {
+ AXgetId(objID).disabled = disabled;
+ } else {
+ AXgetId(objID).disabled = disabled;
+ if(AXgetId(objID).disabled){
+ jQuery("#"+ cfg.targetID + "_AX_" + objID).find(".AXanchorSelect").addClass("disabled");
+ jQuery("#"+ cfg.targetID + "_AX_" + objID).data("disabled", AXgetId(objID).disabled);
+ }else{
+ jQuery("#"+ cfg.targetID + "_AX_" + objID).find(".AXanchorSelect").removeClass("disabled");
+ jQuery("#"+ cfg.targetID + "_AX_" + objID).data("disabled", AXgetId(objID).disabled);
+ }
+
+ }
+ }
+ },
+ bindSelectUpdate: function(objID){
+ var findIndex = null;
+ for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
+ if (O.id == objID && O.isDel != true) {
+ findIndex = index;
+ break;
+ }
+ };
+ if(findIndex != null){
+ this.bindSelectChange(objID, findIndex);
+ }
+ },
+ bindSelectFocus: function(objID){
+ var cfg = this.config;
+ var findIndex = null;
+ for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
+ if (O.id == objID && O.isDel != true) {
+ findIndex = index;
+ break;
+ }
+ };
+ if(findIndex != null){
+ AXgetId(cfg.targetID + "_AX_" + objID + "_AX_SelectTextBox").focus();
+ }
+ },
+ bindSelectBlur: function(objID){
+ var cfg = this.config;
+ var findIndex = null;
+ for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
+ if (O.id == objID && O.isDel != true) {
+ findIndex = index;
+ break;
+ }
+ };
+ if(findIndex != null){
+ this.bindSelectClose(objID, findIndex);
+ }
+ },
+ bindSelectGetAnchorObject: function(objID){
+ var cfg = this.config;
+ var findIndex = null;
+ for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
+ if (O.id == objID && O.isDel != true) {
+ findIndex = index;
+ break;
+ }
+ };
+ if(findIndex != null){
+ return jQuery("#" + cfg.targetID + "_AX_" + objID + "_AX_SelectTextBox");
+ }
+ },
+ bindSelectGetValue: function(objID, onEnd){
+ var findIndex = null;
+ for (var O, index = 0; (index < this.objects.length && (O = this.objects[index])); index++) {
+ if (O.id == objID && O.isDel != true) {
+ findIndex = index;
+ break;
+ }
+ };
+
+ if (findIndex == null) {
+ return { optionValue: null, optionText: null, error:"바인드 된 오브젝트를 찾을 수 없습니다." };
+ } else {
+ var obj = this.objects[findIndex];
+ var cfg = this.config;
+
+ if (obj.selectedIndex != undefined) {
+ return { optionValue: AXgetId(objID).options[ obj.selectedIndex ].value, optionText: AXgetId(objID).options[ obj.selectedIndex ].text };
+ }else{
+ return { optionValue: null, optionText: null };
+ }
+ }
+ }
});
var AXSelect = new AXSelectConverter();
AXSelect.setConfig({ targetID: "AXselect" });
jQuery.fn.unbindSelect = function (config) {
- jQuery.each(this, function () {
- if (config == undefined) config = {};
- config.id = this.id;
- AXSelect.unbind(config);
- return this;
- });
+ jQuery.each(this, function () {
+ if (config == undefined) config = {};
+ config.id = this.id;
+ AXSelect.unbind(config);
+ return this;
+ });
};
jQuery.fn.bindSelect = function (config) {
- jQuery.each(this, function () {
- if (config == undefined) config = {};
- config.id = this.id;
- AXSelect.bind(config);
- return this;
- });
+ jQuery.each(this, function () {
+ if (config == undefined) config = {};
+ config.id = this.id;
+ AXSelect.bind(config);
+ return this;
+ });
};
jQuery.fn.setConfigSelect = function (config) {
- jQuery.each(this, function () {
- AXSelect.bindSetConfig(this.id, config);
- return this;
- });
+ jQuery.each(this, function () {
+ AXSelect.bindSetConfig(this.id, config);
+ return this;
+ });
};
jQuery.fn.bindSelectSetValue = function (value, onEnd) {
- jQuery.each(this, function () {
- AXSelect.bindSelectChangeValue(this.id, value, onEnd);
- return this;
- });
+ jQuery.each(this, function () {
+ AXSelect.bindSelectChangeValue(this.id, value, onEnd);
+ return this;
+ });
};
jQuery.fn.bindSelectGetValue = function (onEnd) {
- return AXSelect.bindSelectGetValue(this[0].id, onEnd);
+ return AXSelect.bindSelectGetValue(this[0].id, onEnd);
};
//SetText
//getText
jQuery.fn.setValueSelect = function (value, onEnd) {
- jQuery.each(this, function () {
- AXSelect.bindSelectChangeValue(this.id, value, onEnd);
- return this;
- });
+ jQuery.each(this, function () {
+ AXSelect.bindSelectChangeValue(this.id, value, onEnd);
+ return this;
+ });
};
jQuery.fn.bindSelectDisabled = function (Disabled) {
- jQuery.each(this, function () {
- AXSelect.bindSelectDisabled(this.id, Disabled);
- return this;
- });
+ jQuery.each(this, function () {
+ AXSelect.bindSelectDisabled(this.id, Disabled);
+ return this;
+ });
};
jQuery.fn.bindSelectUpdate = function () {
- jQuery.each(this, function () {
- AXSelect.bindSelectUpdate(this.id);
- return this;
- });
+ jQuery.each(this, function () {
+ AXSelect.bindSelectUpdate(this.id);
+ return this;
+ });
};
jQuery.fn.bindSelectFocus = function () {
- jQuery.each(this, function () {
- AXSelect.bindSelectFocus(this.id);
- return this;
- });
+ jQuery.each(this, function () {
+ AXSelect.bindSelectFocus(this.id);
+ return this;
+ });
};
jQuery.fn.bindSelectBlur = function () {
- jQuery.each(this, function () {
- AXSelect.bindSelectBlur(this.id);
- return this;
- });
+ jQuery.each(this, function () {
+ AXSelect.bindSelectBlur(this.id);
+ return this;
+ });
};
jQuery.fn.bindSelectGetAnchorObject = function(){
- var returnObj;
- jQuery.each(this, function () {
- returnObj = AXSelect.bindSelectGetAnchorObject(this.id);
- return this;
- });
- return returnObj;
+ var returnObj;
+ jQuery.each(this, function () {
+ returnObj = AXSelect.bindSelectGetAnchorObject(this.id);
+ return this;
+ });
+ return returnObj;
};
\ No newline at end of file
diff --git a/_AXJ/lib/AXUpload5.js b/_AXJ/lib/AXUpload5.js
index f2594d83..44527ebf 100644
--- a/_AXJ/lib/AXUpload5.js
+++ b/_AXJ/lib/AXUpload5.js
@@ -1139,7 +1139,7 @@ swfobject.addDomLoadEvent(function () {
var AXUpload5 = Class.create(AXJ, {
- version : "AXUpload5 V1.24",
+ version : "AXUpload5 V1.25",
author : "tom@axisj.com",
logs: [
"2013-10-02 오후 2:19:36 - 시작 tom",
@@ -1150,7 +1150,8 @@ var AXUpload5 = Class.create(AXJ, {
"2013-12-17 오전 11:24:38 - tom : AXUploadPreview css 적용",
"2014-02-11 오후 3:29:51 - tom : deleteFile 개선, 서버 JSON에 error 가 없으면 정상 처리 되도록 변경",
"2014-02-23 오후 7:39:11 - tom : this.uploadedList 초기화 버그 픽스",
- "2014-02-23 오후 8:44:07 - attr 인식 처리 구문 추가"
+ "2014-02-23 오후 8:44:07 - attr 인식 처리 구문 추가",
+ "2014-04-10 - tom 설정에 선언된 파일타입 체크하여 파일 셀렉트와 드랍 방지 처리 구문 추가"
],
initialize: function(AXJ_super){
AXJ_super();
@@ -1284,7 +1285,7 @@ var AXUpload5 = Class.create(AXJ, {
var onFileSelect = this.onFileSelect.bind(this);
var fileSelector = document.getElementById(cfg.targetID+'_AX_files');
- if(AXUtil.browser.name == "ie" && AXUtil.browser.version < 9){
+ if(axf.browser.name == "ie" && axf.browser.version < 9){
}else{
fileSelector.addEventListener('change', onFileSelect, false);
@@ -1721,10 +1722,12 @@ var AXUpload5 = Class.create(AXJ, {
}
}
if(hasSizeOverFile) cfg.onError("fileSize", {name:sizeOverFile.name, size:sizeOverFile.size});
-
+ if(!cfg.file_types) cfg.file_types = ".";
+ var fileTypeRe = new RegExp(cfg.file_types.replace(/\*/g, "[a-z]"), "ig");
var uploadedCount = this.uploadedList.length;
for (var i = 0, f; f = files[i]; i++) {
- if(f.size <= cfg.uploadMaxFileSize){
+ //trace(f.type, cfg.file_types);
+ if(f.size <= cfg.uploadMaxFileSize && fileTypeRe.test(f.type)){
uploadedCount++;
if(uploadedCount-1 < cfg.uploadMaxFileCount || cfg.uploadMaxFileCount == 0){
@@ -1787,10 +1790,11 @@ var AXUpload5 = Class.create(AXJ, {
}
}
if(hasSizeOverFile) cfg.onError("fileSize", {name:sizeOverFile.name, size:sizeOverFile.size});
-
+ if(!cfg.file_types) cfg.file_types = ".";
+ var fileTypeRe = new RegExp(cfg.file_types.replace(/\*/g, "[a-z]"), "ig");
var uploadedCount = this.uploadedList.length;
for (var i = 0, f; f = files[i]; i++) {
- if(f.size <= cfg.uploadMaxFileSize){
+ if(f.size <= cfg.uploadMaxFileSize && fileTypeRe.test(f.type)){
uploadedCount++;
if(uploadedCount-1 < cfg.uploadMaxFileCount || cfg.uploadMaxFileCount == 0){
var itemID = 'AX'+AXUtil.timekey()+'_AX_'+i;
diff --git a/samples/AXUpload5/index.html b/samples/AXUpload5/index.html
index da8cb66e..8d5513d8 100644
--- a/samples/AXUpload5/index.html
+++ b/samples/AXUpload5/index.html
@@ -49,7 +49,7 @@
targetID:"AXUpload5",
targetButtonClass:"Green",
uploadFileName:"files[]",
- file_types:"*.*", //audio/*|video/*|image/*|MIME_type (accept)
+ file_types:"*/*", //audio/*|video/*|image/*|MIME_type (accept)
dropBoxID:"uploadQueueBox",
queueBoxID:"uploadQueueBox", // upload queue targetID
//queueBoxAppendType:"(prepend || append)",
@@ -186,7 +186,7 @@ AXUpload5