📄 client_master.js
字号:
this.elem.style.display = "none";}FadingAlert.prototype.Render = function(){ this.uber("Render"); Effect.Appear( this.elem );};Poller.inherits( Widget );function Poller( args ){ this.Widget( args );}Poller.prototype.Render = function(){}Poller.prototype.Start = function(){ this.timerId = setInterval( this.id + ".Poll();", this.interval );}Poller.prototype.Poll = function(){ Send( this.id, "OnPoll", null );}DataGrid.inherits( Widget );function DataGrid( args ){ //is two dimensional array, rows/cols //exposes two complex args -- rowTemplate and rows this.elemType = "TABLE"; this.className = "dataGrid"; this.count = 0; this.pageIndex = 0; this.pages = {}; this.Widget(args); this.pages[this.pageIndex] = this.rows; var eTable = this.elem; var eTBody = document.createElement("TBODY"); eTable.appendChild( eTBody ); this.tbody = eTBody; this.SetHeader(); this.SetRows(); if( this.footerButtons ) { var foot = this.elem.createTFoot(); var tr = document.createElement("TR"); var td = document.createElement("TD"); foot.appendChild( tr ); td.colSpan = this.rowTemplate.length; for( var i = 0; i < this.footerButtons.length; i++ ) { var name = this.footerButtons[i]; var newLinkButton = new LinkButton({id:this.id + "_-1_-1_" + name, onClick:1, label:name, baseElem:td }); this.footerButtons[name] = newLinkButton; newLinkButton.evt = name; td.appendChild( newLinkButton.elem ); } tr.appendChild( td ); this.footTd = td; }}DataGrid.prototype.AddFooterButton = function( args ){ var newLinkButton = new LinkButton({id:this.id + "_-1_-1_" + args.name, onClick:1, label:args.name, baseElem:this.footTd }); newLinkButton.evt = args.name; this.footerButtons[args.name] = newLinkButton; if( args.pos >= this.footTd.childNodes.length ) { this.footTd.appendChild( newLinkButton.elem ); } else { this.footTd.insertBefore( newLinkButton.elem, this.footTd.childNodes[args.pos] ); }}DataGrid.prototype.RemoveFooterButton = function( name ){ this.footerButtons[ name ].Remove();}DataGrid.prototype.NewRow = function(newId){ this.rows[ this.rows.length ] = []; var newRow = []; for( var i = 0; i < this.rowTemplate.length;i++ ) { var value = this.rowTemplate[i]; newRow[ newRow.length ] = value.viewTemplate.Clone({id:this.id + "_" + this.rows.length + "_" + i + "_view",parent:this}); } newRow.newId = newId; this.AddRow("TD", newRow, this.rows.length-1 );}DataGrid.prototype.SetHeader = function (){ this.headers = []; for( var i = 0; i < this.rowTemplate.length; i++ ) this.headers[this.headers.length] = this.rowTemplate[i].headerTemplate; this.AddRow("TH", this.headers , -1, CellHeaderClicked );}function CellHeaderClicked(){ Send( this.grid.id, "OnHeaderClick", this.colName );}DataGrid.prototype.SetRows = function (){ for( var i = 0; i < this.rows.length; i++ ) { var newRow = []; for( var j = 0; j < this.rowTemplate.length;j++ ) { var value = this.rowTemplate[j]; newRow[ newRow.length ] = value.viewTemplate.Clone({id:this.id + "_" + i + "_" + j + "_view",parent:this}); if( this.rows[i][j] && newRow[ newRow.length -1].SetText ) newRow[ newRow.length-1 ].SetText(this.rows[i][j] ); } this.AddRow("TD", newRow, i ); } }DataGrid.prototype.DataBind = function( rows ){ for( var i = 0; i < this.rows.length; i++ ) { this.rows[i].rowElem.elem.parentNode.removeChild( this.rows[i].rowElem.elem); } this.pages = {}; this.rows = rows; this.count = 0; this.pageIndex = 0; this.pages[this.pageIndex] = rows; this.SetRows();}DataGrid.prototype.AddRow = function( rowType, rowData, rowIndex, cellClickEvent ){ var eRow = new DataRow( this, rowIndex ); for( var i = 0; i < rowData.length; i++ ) { var eCell = document.createElement(rowType); if( rowData[i].elem ) { eCell.appendChild( rowData[i].elem ); eCell.newId = rowData.newId; eCell.viewWidget = rowData[i]; if( this.rowTemplate[i].editTemplate && rowType != "TH" ) { eCell.className = "unselectedCell"; eCell.grid = this; eCell.rowIndex = rowIndex; eCell.editTemplate = this.rowTemplate[i].editTemplate; for( var widget in eCell.editTemplate.widgets ) { if( eCell.editTemplate.widgets[widget].SetValue ) eCell.editTemplate.widgets[widget].SetValue(); } eCell.elem = rowData[i].elem; eCell.CellOnClick = CellOnClick; dojo.event.connect( eCell, "onclick", eCell, "CellOnClick"); } if( cellClickEvent ) { eCell.grid = this; eCell.colName = this.rowTemplate[i].name; eCell.onclick = cellClickEvent; } } eRow.elem.appendChild( eCell ); eRow.cells[ eRow.cells.length ] = eCell; } this.tbody.appendChild( eRow.elem ); if( rowIndex >= 0 && rowIndex < this.rows.length ) this.rows[rowIndex].rowElem = eRow; this.count++;}DataGrid.prototype.RemoveRow = function( index ){ this.tbody.deleteRow( this.rows[index].rowElem.elem.rowIndex ); this.rows.splice( index, 1 );}function DataRow( datagrid, index ){ this.grid = datagrid; this.index = index; this.elem = document.createElement("TR"); dojo.event.connect( this.elem, "onclick", this, "RowSelect"); //this.elem.onclick = this.RowSelect.bindAsEventListener(this); this.cells = [];}DataRow.prototype.RowSelect = function(){ if( ! this.grid.selIndex ) this.grid.selIndex = this.index; else if( this.grid.selIndex == this.index ) return; this.grid.selIndex = this.index; Send( this.grid.id, "OnRowSelect",this.index );}DataGrid.prototype.ChangePage = function ( args ){ for( var i = 0; i < this.rows.length;i++ ) { this.rows[i].rowElem.elem.style.display="none"; } if( !this.pages[this.pageIndex] ) this.pages[this.pageIndex] = this.rows; this.pageIndex = args.pageIndex; if( !this.pages[this.pageIndex] ) this.rows = args.rows; else this.rows = this.pages[this.pageIndex] this.SetRows();}function CellOnClick(evt){ if( this.grid.currentCell ) { dojo.event.connect( this.grid.currentCell, "onclick", this.grid.currentCell, "CellOnClick"); this.grid.currentCell.editElem.style.display = "none"; this.grid.currentCell.elem.style.display = ""; this.grid.currentCell.className = "unselectedCell"; this.onkeydown = null; //Send( this.grid.id, "OnEdit", "{rowIndex:" + this.grid.currentCell.rowIndex + ",cellIndex:" + } this.grid.currentCell = this; this.className = "selectedCell"; if( ! this.editElem ) { var newString = this.newId ? "_newId_" + this.newId : ""; this.editWidget = this.editTemplate.Clone({id:this.grid.id + "_" + this.rowIndex + "_" + this.cellIndex + "_edit" + newString,parent:this.grid}); this.editWidget.evt = "OnEdit"; this.editWidget.elem.id = this.editWidget.id; if( this.editWidget.SetValue && this.grid.rows[ this.rowIndex ] ) { this.editWidget.SetValue( this.grid.rows[ this.rowIndex ][ this.cellIndex ], this.clientWidth ); } this.editElem = this.editWidget.elem; this.appendChild( this.editElem ); } else { this.editElem.style.display = "block"; } this.CellKeyPressHandler = CellKeyPressHandler; dojo.event.connect( this.editElem, "onkeydown", this, "CellKeyPressHandler"); this.elem.style.display = "none"; this.editElem.focus(); dojo.event.disconnect( this, "onclick", this, "CellOnClick"); //if(evt && evt.preventBubble )evt.preventBubble();}function CellKeyPressHandler( evt ){ if( ! evt ) evt = window.event; if( ! evt.ctrlKey && evt.keyCode != Event.KEY_TAB) return; var update = true; switch( evt.keyCode ) { case Event.KEY_LEFT: this.grid.Select( this.cellIndex -1, this.rowIndex ); break; case Event.KEY_RIGHT: case Event.KEY_TAB: this.grid.Select( this.cellIndex +1, this.rowIndex ); break; case Event.KEY_UP: this.grid.Select( this.cellIndex, this.rowIndex-1 ); break; case Event.KEY_DOWN: this.grid.Select( this.cellIndex, this.rowIndex+1 ); break; default: update = false; } if( update && this.editElem.onchange ) this.editElem.onchange();}DataGrid.prototype.Select = function ( x, y ){ if( this.rows[ y ] && this.rows[ y ].rowElem.cells[ x ] ) { var cell = this.rows[ y ].rowElem.cells[ x ]; if( cell && cell.onclick ) cell.onclick(); }}DataGrid.prototype.AddCell = function ( rowIndex, cellIndex, id ){ var td = this.rows[ rowIndex ].element.insertCell( cellIndex ); this.rows[ rowIndex ].cells[ id ] = td;}Comet.inherits(Widget);function Comet(args){ this.elemType = "IFRAME"; this.Widget(args); this.elem.style.width = 1; this.elem.style.height = 1; this.elem.style.visibility = 'hidden'; //this.elem.innerHTML = this.elem.src; var _this = this; if( dojo.render.html.ie ) { this.elem.onreadystatechange = function() { if( _this.elem.readyState == "complete" ) _this.elem.src = _this.args.elemArgs.src; }; }}Pane.inherits(Widget);function Pane( args ){ if( ! this.elemType ) this.elemType = "DIV"; //this.className = "pane"; this.Widget(args); if( this.left ) this.elem.style.left = this.left; if( this.top ) this.elem.style.top = this.top; if( this.width ) this.elem.style.width = this.width; if( this.height ) this.elem.style.height = this.height;}FlashPane.inherits( Pane );function FlashPane( args ){ this.Pane( args ); var flashHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="500" height="500" id="testXml-01" align="middle"><param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="%{src}" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="%{src}" quality="high" bgcolor="#ffffff" width="500" height="500" name="testXml-01" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'; this.elem.innerHTML = dojo.string.paramString( flashHTML, {src:args.src} );}function getHost(){ return document.location.hostname;}var documentWriteBuffer = null;document.writeln = document.write = function(str){documentWriteBuffer+=str;}Browser.inherits( Pane );function Browser( args ){ var _this = this; this.Pane(args); this.GetValue = function() { { return _this.source; } } this.hostBaseUrl = getRoot(); //getSchemeAndDomain(); this.hostAbsoluteBaseUrl = getSchemeAndDomain(); if( this.source ) this.source = new dojo.uri.Uri( this.source );}document.domain = getHost();cssOwnerPropertyName = "ownerNode";parentNodePropertyName = "parentNode";if( dojo.render.html.ie ){ window.onerror = function(){ return true; } cssOwnerPropertyName = "owningElement"; parentNodePropertyName = "parentElement";}Browser.prototype.Paint = function(data){ //data = "<scr" + "ipt>document.domain = '" + getHost() + "'</sc" + "ript>" + data; //this.elem.src = this.source; //dojo.debug( "document.styleSheets.length (before):" + document.styleSheets.length ); while( document.styleSheets.length > 2 ) { document.styleSheets[document.styleSheets.length-1][cssOwnerPropertyName][parentNodePropertyName].removeChild(document.styleSheets[document.styleSheets.length-1][cssOwnerPropertyName]); } dojo.debug("document.styleSheets.length (after):" + document.styleSheets.length ) this.elem.style.visibility = "hidden"; this.elem.innerHTML = data; this.baseUrl = this.source.scheme + '://' + this.source.authority + '/'; if( this.source.path == '' && this.source[this.source.length-1] != '/' ) this.source.uri += '/'; this.frameBaseUrl = buildRoot( this.source.uri ); this.frameAbsoluteBaseUrl = this.source.scheme + '://' + this.source.authority + '/'; var alinks = this.elem.getElementsByTagName('A'); var imgs = this.elem.getElementsByTagName('IMG'); var scripts = this.elem.getElementsByTagName('SCRIPT'); var links = null; if( dojo.render.html.ie ) { var re = /<link.*?href="?(.*?\.css)"?.*?>/gi; var linkStrings = data.match(re) var linkIndex = 0; if( linkStrings ) while( linkStrings[linkIndex] ) { var str = "" + linkStrings[linkIndex].toString(); var match = /<link.*?href="?(.*?\.css)"?.*?>/gi.exec(str); var url = match[1]; this.insertCssFile( this.fixUri(url) ) linkIndex++; } } var imports = data.match(/@import\s+"(\S+)"/g); if( imports ) for( var i = 0; i < imports.length; i++ ) { var url = /@import\s+"(\S+)"/.exec(imports[i])[1]; this.insertCssFile( this.fixUri(url) ); } if( ! dojo.render.html.ie ) { links = this.elem.getElementsByTagName('LINK'); } this.fixUris( imgs, "src" ); this.fixUris( scripts, "src" ); this.fixUris( alinks, "href" ); if( links ) { this.fixUris( links, "href" ); this.fixUris( links, "HREF" ); } for( var i = 0; i < alinks.length; i++ ) { var link = alinks[i]; link.href = "javascript:" + this.id + ".GoTo('" + link.href +"');"; link.target = ''; for( var k in link ) { if( k.indexOf("on") == 0 ) { link[k] = null; } } } for( var i = 0; i < scripts.length; i++ ) { break; documentWriteBuffer = ''; var s = scripts[i]; if( s.src ) { try { var js = dojo.hostenv.getText( s.src, false, false ); js = js.replace(/var/g,"\r\n"); js = js.replace(/function (\S+?)\s*?\(/g,"$1 = function(") dojo.debug("external js:\r\n" + js); eval( js ); } catch(e){dojo.debug("external js error:" + e.message);} } else { try { var js = s.text.replace(/function (\S+?)\s*?\(/g,"$1 = function("); js = js.replace(/var/g,"\r\n"); dojo.debug("inline js:\r\n" + js); eval( js ); } catch(e){dojo.debug("inline js error:" + e.message);} } if( documentWriteBuffer != '' ) { var span = document.createElement("SPAN"); span.innerHTML = documentWriteBuffer; s.parentNode.replaceChild(span, s); } } if( links ) for( var i = 0; i < links.length;i++ ) { var link = links[i]; if( link.rel=="stylesheet" ) { dojo.debug("inserting stylesheet: " + link.href ); this.insertCssFile( link.href ) } } this.elem.style.height = document.body.clientHeight; //this.elem.style.width = "70%"; this.elem.style.visibility = "visible";}Browser.prototype.insertCssFile = function(filename){ dojo.style.insertCssFile( filename ); var styleSheets = document.styleSheets; for( var i = 0; i < styleSheets.length; i++ ) { if(styleSheets[i][cssOwnerPropertyName].href == filename ) { dojo.lang.setTimeout( this, "sandBoxCss", 500, styleSheets[i] ); break; } }}Browser.prototype.sandBoxCss = function( sheet ){ for( var k in sheet ) { dojo.debug( k ); }}Browser.prototype.fixUris = function( list, prop ){ for( var i = 0; i < list.length; i++ ) { var e = list[i]; e[prop] = this.fixUri(e[prop]); }}Browser.prototype.fixUri = function(str){ if( str && str.indexOf( "http://" ) == -1 )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -