document.write(""); document.write(""); document.write(""); document.write(""); function CommentTool(target, target_name, target_link, config_obj) { this.target = target; this.target_name = target_name; this.target_link = target_link; this.button_id = 'commentBtn_rd_' + target; this.formWindow_id = 'commentWin_rd_' + target; this.permission = 2; this.instance_name = 'myComment'; this.popup_width = 600; this.popup_height = 450; this.window_title = ''; this.config_obj = null; if (config_obj) { this.config_obj = config_obj; if (config_obj.instance_name != null && config_obj.instance_name != "") { this.instance_name = config_obj.instance_name; } if (config_obj.popup_width != null && config_obj.popup_width > 0) { this.popup_width = config_obj.popup_width; } if (config_obj.popup_height != null && config_obj.popup_height > 0) { this.popup_height = config_obj.popup_height; } if (config_obj.window_title != null && config_obj.window_title != '') { this.window_title = config_obj.window_title; } } return; } CommentTool.prototype.commentButton = function() { if (this.permission >= 2) { document.write(""); //document.write("
"); } return; } CommentTool.prototype.commentForm = function() { var instance_name = this.instance_name; if (this.permission >= 2) { var button = Ext.get(this.button_id); var formHTML = ""; var winSizes = this.getWindowSizes(); var popup_pageX = (winSizes[0] - this.popup_width) / 2 + winSizes[2]; var popup_pageY = (winSizes[1] - this.popup_height) / 2 + winSizes[3]; // create the window on the first click and reuse on subsequent clicks if (!this.commentWindow) { var win = new Ext.Window({ //applyTo : "commentForm_" + this.formWindow_id, layout : 'fit', title : this.window_title, width : this.popup_width, height : this.popup_height, pageX : popup_pageX, pageY : popup_pageY, closeAction : 'hide', modal : true, plain : true, html : formHTML, buttons: [{ text : '關閉', handler : function() { win.hide(); self.location.href = self.location.href; } }] }); this.commentWindow = win; } else if (window[instance_name]) { window[instance_name].commentWindow.body.dom.innerHTML = formHTML; } this.commentWindow.show(button); } return; } CommentTool.prototype.deleteButton = function(id) { if (this.permission >= 3) { document.write("刪除"); //document.write(""); } return; } CommentTool.prototype.deleteForm = function(id) { var instance_name = this.instance_name; if (this.permission >= 3) { var button = Ext.get(this.button_id); var formHTML = ""; var winSizes = this.getWindowSizes(); var delete_width = 320; var delete_height = 240; var popup_pageX = (winSizes[0] - delete_width) / 2 + winSizes[2]; var popup_pageY = (winSizes[1] - delete_height) / 2 + winSizes[3]; // create the window on the first click and reuse on subsequent clicks if (!this.deleteWindow) { var win = new Ext.Window({ //applyTo : "commentDel_" + this.formWindow_id + "_" + id, layout : 'fit', title : '', width : delete_width, height : delete_height, pageX : popup_pageX, pageY : popup_pageY, closeAction : 'hide', modal : true, plain : true, html : formHTML, buttons: [{ text : '關閉', handler : function() { win.hide(); self.location.href = self.location.href; } }] }); this.deleteWindow = win; } else if (window[instance_name]) { window[instance_name].deleteWindow.body.dom.innerHTML = formHTML; } this.deleteWindow.show(button); } return; } CommentTool.prototype.commentList = function(div_id, numrow) { var layerObj = document.getElementById(div_id); if (layerObj) { var listHTML = ""; layerObj.innerHTML = listHTML; layerObj.style.visibility = 'visible'; } return; } CommentTool.prototype.getWindowSizes = function () { var sizes = new Array(0, 0, 0, 0); if( typeof( window.innerWidth ) == 'number' ) { //Non-IE sizes[0] = window.innerWidth; sizes[1] = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' sizes[0] = document.documentElement.clientWidth; sizes[1] = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible sizes[0] = document.body.clientWidth; sizes[1] = document.body.clientHeight; } if( typeof( window.pageYOffset ) == 'number' ) { //Netscape compliant sizes[2] = window.pageXOffset; sizes[3] = window.pageYOffset; } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { //DOM compliant sizes[2] = document.body.scrollLeft; sizes[3] = document.body.scrollTop; } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { //IE6 standards compliant mode sizes[2] = document.documentElement.scrollLeft; sizes[3] = document.documentElement.scrollTop; } return sizes; }