📄 client_master.js
字号:
if( args.isRich ) { this.elem.innerHTML = args.defaultValue; } else if( this.elemType == "TEXTAREA" ) { this.elem.rows = args.rows; this.elem.cols = args.cols; } else { if( args.cols ) this.elem.size = args.cols; if( args.isPassword ) this.elem.type = "password"; } if( this.onKeyUp ) { this.RollingDelayChanged = function(evt) { this.SetRollingDelay( "onchangedTimer", this.OnChanged, 300 ); } dojo.event.connect( this.elem, "onkeyup", this, "RollingDelayChanged" ); } if( args.isDisabled ) this.elem.disabled = true; this.elem.className = args.className; this.elem.value = args.defaultValue ? args.defaultValue : ''; this.elem.id = args.id; dojo.event.connect( this.elem, "onchange", this, "OnChanged" ); this.SetValue = this.SetText; this.GetValue = function() { if( args.isRich ) return this.editor.getEditorContent(); else return this.elem.value; };}TextBox.prototype.SetText = function( newText, width ){ this.elem.value = newText ? newText : this.defaultValue ? this.defaultValue : ''; if( width ) this.elem.style.width = width; //if( this.rows == 1 && newText ) this.elem.size = newText.length + 5;}var tbid = 0;var tinyLoaded = false;TextBox.prototype.Render = function(index){ this.uber("Render", index); if( this.args.isRich ) { this.elem.style.height = this.rows + "em"; this.elem.style.width = this.cols + "em"; dojo.require("dojo.widget.Editor2"); this.editor = dojo.widget.createWidget("Editor2", { shareToolbar: false, toolbarAlwaysVisible: true, focusOnLoad: false },this.elem); dojo.event.connect(this.editor,"onBlur",this,"OnChanged"); this.elem = this.editor.domNode; this.elem.style.border = "1px solid black"; this.uber("Render", index); } else if( this.args.isCodeView ) { loadUri(getRoot() + "scripts/CodeView/shCore.js" ); dojo.style.insertCssFile( getRoot() + "scripts/CodeView/SyntaxHighlighter.css" ) switch( this.args.lang ) { case "c#": loadUri(getRoot() + "scripts/CodeView/shBrushCSharp.js" ); break; case "javascript": loadUri(getRoot() + "scripts/CodeView/shBrushJScript.js" ); break; case "xml": loadUri(getRoot() + "scripts/CodeView/shBrushXml.js" ); break; case "sql": loadUri(getRoot() + "scripts/CodeView/shBrushSql.js" ); break; } this.elem.name = this.id; this.elem.className = this.args.lang; //dojo.debug(this.elem.className); dp.SyntaxHighlighter.HighlightAll(this.id); this.elem = this.baseElem.getElementsByTagName('DIV')[1]; }}function globalTextCallBack(inst){ Send(inst.formTargetElementId, "OnChanged",inst.getBody().innerHTML);}SelectItem.inherits( Widget );function SelectItem( args ){ this.elemType = "INPUT"; this.Widget(args); dojo.event.connect( this.elem, "onchange",this, "OnChanged" ); this.elem.arg = this.arg; this.GetValue = function() { return this.elem.checked; }}Literal.inherits( Widget );function Literal( args ){ this.Widget( args ); this.elem = document.createTextNode(args.html); //this.elem.id = args.id;}Label.inherits( Widget );function Label( args ) //id, baseElem, className, html, htmlFor ){ this.elemType = "DIV"; this.className = "label"; this.Widget( args ); this.elem.innerHTML = args.html ? args.html : ' '; this.SetValue = this.SetText;}Label.prototype.SetText = function( html ){ //this.textNode.data = newText; this.elem.innerHTML = html;}Label.prototype.AppendText = function( newText ){ if( newText.indexOf( "Server Error in" ) == -1 ) newText = "<PRE>" + newText + "</PRE>"; this.elem.innerHTML += newText ;}DatePicker.inherits( Widget );function DatePicker( args ){ //this.elemType = "DIV"; this.elemType = "IMG"; this.Widget(args); this.elem.src = "images/calendar_click.gif"; this.elem.style.verticalAlign = "bottom"; this.elem.style.padding = "3px"; dojo.event.connect( this.elem, "onclick", this, "ShowCal"); //this.elem.onclick = this.ShowCal.bindAsEventListener(this);}DatePicker.prototype.ShowCal = function(){ if( ! this.dojoDatePicker ) { dojo.require("dojo.widget.DatePicker"); var div = document.createElement("DIV"); this.elem.parentNode.appendChild( div ); this.dojoDatePicker = dojo.widget.createWidget("DatePicker",{id:this.id + "_datepicker"},div); this.dojoDatePicker.domNode.style.top = (this.elem.offsetTop+this.elem.offsetParent.offsetTop+this.elem.height-1)+20 + "px"; this.dojoDatePicker.domNode.style.left = (this.elem.offsetLeft+this.elem.offsetParent.offsetLeft) + "px"; this.dojoDatePicker.domNode.style.display = "block"; this.dojoDatePicker.domNode.style.backgroundColor = "white"; this.dojoDatePicker.domNode.style.position = "absolute"; this.dojoDatePicker.domNode.style.zIndex = 100; dojo.event.connect( this.dojoDatePicker, "onSetDate", this, "SelectDate"); this.dojoDatePicker.date = this.date; this.dojoDatePicker.setDate(dojo.widget.DatePicker.util.toRfcDate(this.date)) this.dojoDatePicker.initUI(); } else { this.dojoDatePicker.toggleShowing(); }}DatePicker.prototype.SelectDate = function(date){ Send( this.id, "SetDate", this.dojoDatePicker.toRfcDate(this.dojoDatePicker.date) ); this.dojoDatePicker.hide();}function SetDateFieldValue( widget, value ){ var date = new Date(value); widget.widgets[0].SetValue(date.getMonth()); widget.widgets[1].SetValue(date.getDate()); widget.widgets[3].SetValue(date.getFullYear()); widget.widgets[4].date = new Date(value); if( widget.widgets[4].dojoDatePicker ) widget.widgets[4].dojoDatePicker.setDate(date);}Window.inherits( Widget );function Window( args ){ dojo.require("dojo.widget.ResizeHandle"); dojo.require("dojo.widget.FloatingPane"); this.elemType = "DIV"; this.Widget(args);}Window.prototype.Render = function(){ this.uber("Render", arguments); var win = this.window = dojo.widget.createWidget("FloatingPane",{id:this.id + "_win",title:this.args.label,displayCloseAction:this.displayClose},this.elem); win.resizeTo(this.height, this.width); this.elem = win.containerNode;}ContextMenu.inherits( Widget );function ContextMenu( args ){ dojo.require("dojo.widget.Menu2"); this.elemType = "DIV"; this.Widget(args); this.OnChildAdded = function(child){ var menuItem = dojo.widget.createWidget("MenuItem2",{id:child.id + "_mi",iconSrc:child.icon,caption:child.label,submenuId:child.subMenuId}); this.menu.addChild(menuItem); dojo.event.connect( menuItem, "onClick", child, "Click" ); }} ContextMenu.prototype.Render = function(){ this.uber("Render", arguments); var menu = this.menu = dojo.widget.createWidget("PopupMenu2",{id:this.id + "_cm",contextMenuForWindow:true},this.elem); this.elem = menu.domNode;}MenuItem.inherits( Widget );function MenuItem( args ){ this.elemType = "DIV"; this.Widget(args);}TreeNode.inherits( Widget );function TreeNode( args ){ this.elemType = "DIV"; this.Widget(args); this.OnChildAdded = function(child){ var treeNode = dojo.widget.createWidget("TreeNode",{id:child.id + "_n",title:child.label}); child.node = treeNode; this.node.addChild(treeNode); dojo.event.connect( treeNode, "onTitleClick", child, "Click" ); }}Tree.inherits( Widget );function Tree( args ){ this.elemType = "DIV"; this.Widget(args); this.OnChildAdded = function(child){ var treeNode = dojo.widget.createWidget("TreeNode",{id:child.id + "_n",title:child.label}); child.node = treeNode; this.tree.addChild(treeNode); dojo.event.connect( treeNode, "onTitleClick", child, "Click" ); }}Tree.prototype.Render = function(){ dojo.require("dojo.widget.Tree"); dojo.require("dojo.widget.TreeNode"); dojo.require("dojo.widget.TreeSelector"); this.uber("Render", arguments); var tree = this.tree = dojo.widget.createWidget("Tree",{id:this.id + "_t"},this.elem); this.elem = tree.domNode;}Toolbar.inherits( Widget );function Toolbar( args ){ this.elemType = "DIV"; this.Widget(args); this.OnChildAdded = function(child){ var toolbarItem = dojo.widget.createWidget("ToolbarButton",{id:child.id + "_i",icon:child.icon,label:child.label}); this.toolbar.addChild(toolbarItem); dojo.event.connect( toolbarItem, "onClick", child, "Click" ); }}Toolbar.prototype.Render = function(){ dojo.require("dojo.widget.Toolbar"); this.uber("Render", arguments); var toolbarContainer = this.toolbarContainer = dojo.widget.createWidget("ToolbarContainer",{id:this.id + "_tc"},this.elem); var toolbar = this.toolbar = dojo.widget.createWidget("Toolbar",{id:this.id + "_tb"}); toolbarContainer.addChild(toolbar); this.elem = toolbarContainer.domNode;}TabPane.inherits( Widget );function TabPane( args ){ dojo.require("dojo.widget.TabContainer"); dojo.require("dojo.widget.ContentPane"); this.elemType = "DIV"; this.OnChildAdded = function(child){ var newTab = dojo.widget.createWidget("ContentPane",{id:child.id + "_cp",label:child.elemArgs.label},child.elem); //this.tabPane._setupTab(newTab); this.tabPane.addChild(newTab); child.Render = function() {}; //this.tabPane._doSizing(); } this.Widget(args);}TabPane.prototype.Render = function(){ var closeMode = this.closeMode ? this.closeMode.toLowerCase() : 'none'; var labelPosition = this.labelPosition ? this.labelPosition.toLowerCase() : 'top'; if( labelPosition == "left" || labelPosition == "right" ) { labelPosition += "-h"; } var tabPane = dojo.widget.createWidget("TabContainer",{id:this.id + "_tp",closeButton:closeMode,labelPosition:labelPosition}); this.tabPane = tabPane; this.tabPane._doSizing(); if( this.args["top"] ) tabPane.domNode.style.top = this.args["top"]; if( this.args["left"] ) tabPane.domNode.style.left = this.args["left"]; if( this.args["height"] ) tabPane.domNode.style.height = this.args["height"]; if( this.args["width"] ) tabPane.domNode.style.width = this.args["width"]; this.elem = tabPane.domNode; this.isLoading = true; this.OnTabChanged = function(tab) { if( this.isLoading ) { this.selectedTab = tab; this.isLoading = false; return; } if( this.selectedTab == tab ) return; this.selectedTab = tab; Send(this.id, "OnTabChanged", tab.label); } dojo.event.connect( tabPane, "_showTab", this, "OnTabChanged"); this.tabPane = tabPane; this.uber("Render", arguments);}SplitPane.inherits( Widget );function SplitPane( args ){ dojo.require("dojo.widget.SplitContainer"); this.elemType = "DIV"; this.Widget(args); this.OnChildAdded = function(child){ var newPane = dojo.widget.createWidget("SplitContainerPanel",{id:child.id + "_spp"},child.elem); this.splitPane.addChild(newPane); this.splitPane.postCreate({}); this.splitPane.onResized(); //if( this.widgets.length > 1 ) // { //this.splitPane.postCreate({}); // // this.elem.style.visibility = 'visible'; // } }}SplitPane.prototype.Render = function(){ this.uber("Render", arguments); //this.elem.setAttribute("orientation","vertical"); //this.elem.setAttribute("style","width: 50%; height: 50%;"); if( ! this.orientation ) { this.orientation = "horizontal"; } else { this.orientation = this.orientation.toLowerCase(); } var isHorizontal = this.orientation == "horizontal" ? 1 : 0; dojo.debug("orientation:" + isHorizontal); var spArgs = {sizerWidth:4,sizeMin:50,sizeShare:85,id:this.id + "_sp",activeSizing:1,isHorizontal:isHorizontal,orientation:this.orientation}; var splitPane = this.window = dojo.widget.createWidget("SplitContainer",spArgs,this.elem); if( this.args["top"] ) splitPane.domNode.style.top = this.args["top"]; if( this.args["left"] ) splitPane.domNode.style.left = this.args["left"]; if( this.args["height"] ) splitPane.domNode.style.height = this.args["height"]; if( this.args["width"] ) splitPane.domNode.style.width = this.args["width"]; this.elem = splitPane.domNode; //this.elem.style.visibility = 'hidden'; this.isLoading = true; this.splitPane = splitPane;}SliderWidget.inherits( Widget );function SliderWidget(args){ dojo.require ("dojo.widget.html.Slider"); this.elemType = "DIV"; this.orientation = "Horizontal"; this.Widget( args ); this.GetValue = function() { return this.val; } this.DelayChangeEvent = function() { this.val = Math.round(this.slider.getValue()); if( this.timeoutid ) clearTimeout( this.timeoutid ); this.timeoutid = dojo.lang.setTimeout( this, this.OnChanged, 200 ); }}SliderWidget.prototype.Render = function(index){ this.uber("Render", index); this.slider = dojo.widget.createWidget("Slider" + this.orientation, { minimum:this.min, maximum:this.max, value:this.val, activeDrag:true, snapValues:this.max-this.min },this.elem); this.elem = this.slider.domWidget; dojo.event.connect(this.slider,"onValueChanged", this, "DelayChangeEvent");}SliderWidget.prototype.SetAttribute = function(attribute, value ){ //dojo.debug(dojo.string.paramString( "val == 'val' ? %{expr}", {expr:attribute=="val"} ) ); switch(attribute) { case "val": this.slider.setValue(value); break; case "min": this.slider.setMinimum(value); break; case "max": this.slider.setMaximum(value); break; default: this.uber("SetAttribute", attribute, value ); break; }}//dojo.require("dojo.xml.Parse");//var parser = new dojo.xml.Parse();DropDown.inherits( Widget );function DropDown( args ) //id, baseElem, className, options, selIndex ){ this.elemType = "SELECT"; this.Widget( args ); this.optionList = args.options.split(","); this.idsList = null; if( args.ids ) this.idsList = args.ids.split(","); for( var i = 0; i < this.optionList.length; i++ ) { this.AddOption( this.optionList[i], this.idsList ? this.idsList[i] : i ); } if( ! this.isComboBox ) { dojo.event.connect( this.elem, "onchange", this, "OnChanged" ); this.GetValue = function() { return this.elem.value; }; } if( args.selectedIndex >= 0 ) this.SetSelectedIndex(args.selectedIndex);}DropDown.prototype.Render = function(){ this.uber("Render",arguments); if( this.isComboBox ) { dojo.require("dojo.widget.ComboBox"); this.combobox = dojo.widget.createWidget("ComboBox",{id:this.id + "_cb"},this.elem); this.RollingDelayChanged = function(evt) { this.SetRollingDelay( "onchangedTimer", this.OnChanged, 300 ); } dojo.event.connect( this.combobox, "setValue", this, "RollingDelayChanged" ); this.GetValue = function() { return dojo.widget.getWidgetById(this.id + "_cb").getValue(); } }}DropDown.prototype.AddOption = function( label, id ){ var o = document.createElement("OPTION"); o.appendChild( document.createTextNode( label ) ); if( id == null ) { id = this.optionList.length - 1; } o.value = id; if( id == this.selIndex ) o.selected = true; this.elem.appendChild( o );}DropDown.prototype.SetSelectedIndex = function( newIndex ){ if( this.selIndex ) this.elem.childNodes[ this.selIndex ].selected = false; this.elem.childNodes[ newIndex ].selected = true; this.selIndex = newIndex;}DropDown.prototype.SetValue = function ( value ){ for( var i = 0; i < this.elem.childNodes.length; i++ ) { if( this.elem.childNodes[i].value == value || this.elem.childNodes[i].innerHTML == value ) { this.SetSelectedIndex( i ); return; } }}PlaceHolder.inherits( Widget );function PlaceHolder( args ){ this.elemType = "SPAN"; this.Widget(args);}FadingAlert.inherits( Widget );function FadingAlert( args ){ this.elemType = "DIV"; this.className = "fadingAlert"; this.Widget( args ); this.elem.innerHTML = args.html;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -