<commit_before>o2.require("MWF.widget.Dialog", null, false);
o2.xDesktop.Dialog = o2.DDL = new Class({
	Extends: o2.widget.Dialog,
    options : {
        maxHeightPercent : "98%"
    },
//	_markShow: function(){
//
//		if (this.options.mark){
//			if (!this.markNode){
//				
//				this.markNode = new Element("div", {
//					styles: this.css.mark
//				}).inject($(document.body));
//				
//			}
////			if (this.options.markNode){
////				var size = this.options.markNode.getComputedSize();
////				var position = this.options.markNode.getPosition();
////				alert(size.totalHeight);
////				this.markNode.set("styles", {
////					"height": size.totalHeight+"px",
////					"width": size.totalWidth+"px",
////					"top": position.y,
////					"height": position.x
////				});
////
////			}else{
//				var size = MWF.getMarkSize();
//				this.markNode.set("styles", {
//					"height": size.y,
//					"width": size.x,
//					"top": "0xp",
//					"height": "0px"
//				});
////			}
//			
//			this.markNode.setStyle("display", "block");
//		}
//	},
	_markShow: function(){

		if (this.options.mark){
			if (!this.markNode){
				var size = MWF.getMarkSize(this.options.maskNode);
				var topNode = this.options.container || $(document.body);

                this.markNode = new Element("iframe", {
                    styles: this.css.mark
                }).inject(topNode);
                this.markNode.set("styles", {
                    "height": size.y,
                    "width": size.x
                });
				if (!this.markNode_up) this.markNode_up = new Element("div", { styles: this.css.mark }).inject(topNode);
                this.markNode_up.set("styles", {
                    "height": size.y,
                    "width": size.x
                });
			}
			this.markNode.setStyle("display", "block");
		}
	},
	getDialogNode: function(){
        this.width = this.options.width;
        this.height = this.options.height;

		this.node.set("styles", this.css.from);
		var topNode = this.options.container || $(document.body);
		this.node.inject(topNode);
//		this.node.addEvent("selectstart", function(e){
//		//	e.preventDefault();
//		});

		this.title = this.node.getElement(".MWF_dialod_title");
		this.titleCenter = this.node.getElement(".MWF_dialod_title_center");
		this.titleText = this.node.getElement(".MWF_dialod_title_text");
		this.titleAction = this.node.getElement(".MWF_dialod_title_action");
		this.content = this.node.getElement(".MWF_dialod_content");
		this.bottom = this.node.getElement(".MWF_dialod_bottom");
		this.resizeNode = this.node.getElement(".MWF_dialod_bottom_resize");
		this.button = this.node.getElement(".MWF_dialod_button");
        if( (!this.options.buttonList || this.options.buttonList.length === 0) && ( !this.options.buttons ) ){
            this.button.setStyle("display","none");
            this.buttonDisable = true;
        }else{
            this.okButton = this.node.getElement(".MWF_dialod_ok_button");
            this.cancelButton = this.node.getElement(".MWF_dialod_cancel_button");
        }
        this.backAction = this.node.getElement(".MWF_dialod_Action_back");

        if (!this.options.isTitle) {
            this.title.destroy();
            this.title = null;
            this.titleCenter = null;
            this.titleRefresh = null;
            this.titleText = null;
            this.titleAction = null;
        }

		if (this.title) this.setTitleEvent(); 
	//	if (this.titleText) this.getTitle();
		if (this.content) this.getContent();
		if (this.titleAction) this.getAction();
		if (this.resizeNode) this.setResizeNode();
	//	if (this.button) this.getButton();

		if (this.content) this.setContentSize();
        if (this.backAction)this.backAction.addEvent("click", this.close.bind(this))
	},
    getButton: function(){
        for (i in this.options.buttons){
            var button = new Element("input", {
                "type": "button",
                "value": i,
                "styles": this.css.button,
                "class": "mainColor_bg",
                "events": {
                    "click": this.options.buttons[i].bind(this)
                }
            }).inject(this.button);
        }
        if (this.options.buttonList){
            this.options.buttonList.each(function(bt){
                var styles = this.css.button;
                if( bt.type === "ok" && this.css.okButton )styles = this.css.okButton;
                if( bt.type === "cancel" && this.css.cancelButton )styles = this.css.cancelButton;
                if( bt.styles )styles = bt.styles;
                var button;
                if( bt.type === "ok" && this.okButton ){
                    button = this.okButton;
                    button.show();
                }else if( bt.type === "cancel" && this.cancelButton ){
                    button = this.cancelButton;
                    button.show();
                }else{
                    if( !bt.tag ){
                        button = new Element("input", {
                            "type": "button"
                        }).inject(this.button);
                    }else{
                        button = new Element( bt.tag, {}).inject(this.button);
                    }
                }
                debugger;
                if( button.get("type") === "button" ){
                    button.set({
                        "value": bt.text,
                        "title": bt.title,
                        "styles": styles,
                        "class": (bt.type!=="cancel") ? "mainColor_bg" : "",
                        "events": {
                            "click": function(e){bt.action.call(this, this, e)}.bind(this)
                        }
                    })
                }else{
                    button.set({
                        "text": bt.text,
                        "title": bt.title,
                        "styles": styles,
                        "class": (bt.type!=="cancel") ? "mainColor_bg" : "",
                        "events": {
                            "click": function(e){bt.action.call(this, this, e)}.bind(this)
                        }
                    })
                }
            }.bind(this));
        }
    },
    setTitleEvent: function(){
        var content;
        if( this.options.isMove ){
            if (layout.app) content = layout.app.content;
            if (layout.desktop.currentApp) content = layout.desktop.currentApp.content;
            this.containerDrag = new Drag.Move(this.node, {
                "handle": this.title,
                "container": this.options.container || this.markNode || content,
                "snap": 5
            });
        }
    },
    getAction: function(){
        //未完成................................
        if (this.options.isClose){
            this.closeAction = new Element("div", {"styles": this.css.closeAction}).inject(this.titleAction);
            this.closeAction.addEvent("click", this.close.bind(this));
        }
        if (this.options.isMax){
            this.maxAction = new Element("div", {"styles": this.css.maxAction}).inject(this.titleAction);<commit_msg>弹出对话框的移动限制在屏幕区域内<commit_after>o2.require("MWF.widget.Dialog", null, false);
o2.xDesktop.Dialog = o2.DDL = new Class({
	Extends: o2.widget.Dialog,
    options : {
        maxHeightPercent : "98%"
    },
//	_markShow: function(){
//
//		if (this.options.mark){
//			if (!this.markNode){
//				
//				this.markNode = new Element("div", {
//					styles: this.css.mark
//				}).inject($(document.body));
//				
//			}
////			if (this.options.markNode){
////				var size = this.options.markNode.getComputedSize();
////				var position = this.options.markNode.getPosition();
////				alert(size.totalHeight);
////				this.markNode.set("styles", {
////					"height": size.totalHeight+"px",
////					"width": size.totalWidth+"px",
////					"top": position.y,
////					"height": position.x
////				});
////
////			}else{
//				var size = MWF.getMarkSize();
//				this.markNode.set("styles", {
//					"height": size.y,
//					"width": size.x,
//					"top": "0xp",
//					"height": "0px"
//				});
////			}
//			
//			this.markNode.setStyle("display", "block");
//		}
//	},
	_markShow: function(){

		if (this.options.mark){
			if (!this.markNode){
				var size = MWF.getMarkSize(this.options.maskNode);
				var topNode = this.options.container || $(document.body);

                this.markNode = new Element("iframe", {
                    styles: this.css.mark
                }).inject(topNode);
                this.markNode.set("styles", {
                    "height": size.y,
                    "width": size.x
                });
				if (!this.markNode_up) this.markNode_up = new Element("div", { styles: this.css.mark }).inject(topNode);
                this.markNode_up.set("styles", {
                    "height": size.y,
                    "width": size.x
                });
			}
			this.markNode.setStyle("display", "block");
		}
	},
	getDialogNode: function(){
        this.width = this.options.width;
        this.height = this.options.height;

		this.node.set("styles", this.css.from);
		var topNode = this.options.container || $(document.body);
		this.node.inject(topNode);
//		this.node.addEvent("selectstart", function(e){
//		//	e.preventDefault();
//		});

		this.title = this.node.getElement(".MWF_dialod_title");
		this.titleCenter = this.node.getElement(".MWF_dialod_title_center");
		this.titleText = this.node.getElement(".MWF_dialod_title_text");
		this.titleAction = this.node.getElement(".MWF_dialod_title_action");
		this.content = this.node.getElement(".MWF_dialod_content");
		this.bottom = this.node.getElement(".MWF_dialod_bottom");
		this.resizeNode = this.node.getElement(".MWF_dialod_bottom_resize");
		this.button = this.node.getElement(".MWF_dialod_button");
        if( (!this.options.buttonList || this.options.buttonList.length === 0) && ( !this.options.buttons ) ){
            this.button.setStyle("display","none");
            this.buttonDisable = true;
        }else{
            this.okButton = this.node.getElement(".MWF_dialod_ok_button");
            this.cancelButton = this.node.getElement(".MWF_dialod_cancel_button");
        }
        this.backAction = this.node.getElement(".MWF_dialod_Action_back");

        if (!this.options.isTitle) {
            this.title.destroy();
            this.title = null;
            this.titleCenter = null;
            this.titleRefresh = null;
            this.titleText = null;
            this.titleAction = null;
        }

		if (this.title) this.setTitleEvent(); 
	//	if (this.titleText) this.getTitle();
		if (this.content) this.getContent();
		if (this.titleAction) this.getAction();
		if (this.resizeNode) this.setResizeNode();
	//	if (this.button) this.getButton();

		if (this.content) this.setContentSize();
        if (this.backAction)this.backAction.addEvent("click", this.close.bind(this))
	},
    getButton: function(){
        for (i in this.options.buttons){
            var button = new Element("input", {
                "type": "button",
                "value": i,
                "styles": this.css.button,
                "class": "mainColor_bg",
                "events": {
                    "click": this.options.buttons[i].bind(this)
                }
            }).inject(this.button);
        }
        if (this.options.buttonList){
            this.options.buttonList.each(function(bt){
                var styles = this.css.button;
                if( bt.type === "ok" && this.css.okButton )styles = this.css.okButton;
                if( bt.type === "cancel" && this.css.cancelButton )styles = this.css.cancelButton;
                if( bt.styles )styles = bt.styles;
                var button;
                if( bt.type === "ok" && this.okButton ){
                    button = this.okButton;
                    button.show();
                }else if( bt.type === "cancel" && this.cancelButton ){
                    button = this.cancelButton;
                    button.show();
                }else{
                    if( !bt.tag ){
                        button = new Element("input", {
                            "type": "button"
                        }).inject(this.button);
                    }else{
                        button = new Element( bt.tag, {}).inject(this.button);
                    }
                }
                debugger;
                if( button.get("type") === "button" ){
                    button.set({
                        "value": bt.text,
                        "title": bt.title,
                        "styles": styles,
                        "class": (bt.type!=="cancel") ? "mainColor_bg" : "",
                        "events": {
                            "click": function(e){bt.action.call(this, this, e)}.bind(this)
                        }
                    })
                }else{
                    button.set({
                        "text": bt.text,
                        "title": bt.title,
                        "styles": styles,
                        "class": (bt.type!=="cancel") ? "mainColor_bg" : "",
                        "events": {
                            "click": function(e){bt.action.call(this, this, e)}.bind(this)
                        }
                    })
                }
            }.bind(this));
        }
    },
    setTitleEvent: function(){
        var content;
        if( this.options.isMove ){
            if (layout.app) content = layout.app.content;
            if (layout.desktop.currentApp) content = layout.desktop.currentApp.content;
            this.containerDrag = new Drag.Move(this.node, {
                "handle": this.title,
                "container": this.options.positionNode || this.options.container || this.markNode || content,
                "snap": 5
            });
        }
    },
    getAction: function(){
        //未完成................................
        if (this.options.isClose){
            this.closeAction = new Element("div", {"styles": this.css.closeAction}).inject(this.titleAction);
            this.closeAction.addEvent("click", this.close.bind(this));
        }
        if (this.options.isMax){
            this.maxAction = new Element("div", {"styles": this.css.maxAction}).inject(this.titleAction);
{'fraction_non_alphanumeric': 0.16655042544287907, 'fraction_numerical': 0.0013948946854512485, 'mean_word_length': 1.6123155401712517, 'pattern_counts': {'":': 72, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6975489', 'n_tokens_mistral': 4493, 'n_tokens_neox': 4142, 'n_words': 672}