⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 members.js

📁 很全面的hrm管理。提供通用的企业人力资源管理。
💻 JS
📖 第 1 页 / 共 2 页
字号:

var gsGraphicsPath = "Images/";
var gsStoreName="workshop";

var gsTabControl="";


var gaDivs = new Array();
var gaTabs = new Array();
var goPersist = null;		// creation of this object is defered until after the entire objectmembers system
							// has been rendered.  That is because I need a reference to content div.
var gsPageId = "";

function CPersist(attachedTo, storePath){
	if( oBD.doesPersistence ){
		this._obj = attachedTo;
		this._obj.addBehavior("#default#userData");
		this._path = storePath;
		this._loaded = false;
	}
}

CPersist.prototype.Save = function(){
	if( oBD.doesPersistence ){
		if(this.IsLoaded()){
			var enabled = true;
			var code = "try{ this.GetAttached().save(this._path); } catch(e) {enabled = false;}";
			eval(code);
		}
	}
}

CPersist.prototype.Load = function(){
	if( oBD.doesPersistence ){
		if(!this.IsLoaded()){
			var enabled = true;
			var code = "try{ this.GetAttached().load(this._path); } catch(e) {enabled = false;}";
			eval(code);
			
			if(!enabled) return;
			
			this._loaded = true;
		}
	}
}

CPersist.prototype.GetAttached = function(){
	if( oBD.doesPersistence ) return this._obj;
}

CPersist.prototype.IsLoaded = function(){
	if( oBD.doesPersistence ) return this._loaded;
}

CPersist.prototype.SetAttribute = function(key, value){
	if( oBD.doesPersistence ){
		if( !this.IsLoaded() ) this.Load();

		if( this.IsLoaded() ){			// confirm that the load actually happened.  Cannot add data if load failed.
			if( !gsPageId ) pageID = "unknown"; else pageID = gsPageId;	
			this.GetAttached().setAttribute(pageID + "." + key, value);
		}
		
		this.Save();
	}
}

CPersist.prototype.GetAttribute = function(key){
	if( oBD.doesPersistence ){
		if( !this.IsLoaded() ) this.Load();

		if( this.IsLoaded() ){			// confirm that the load actually happened.  Cannot get data if load failed.
			if( !gsPageId ) pageID = "unknown"; else pageID = gsPageId;	
			var value = this.GetAttached().getAttribute(pageID + "." + key);
		}
	
		if(key == "selectedTab"){
			if(!value) value = 0;
		} else if(key == "expanded"){
			if(value == "true")
				value = true;
			else
				value = false;
		} else if(key == "scroll"){
			if(!value) value = 0;
		}
	
		return value;
	}
}

//
// initilizes a new, logical tab for objectmembers.  A "tab" consists of both
// the tab and the member content.
//
function CTabber(newTab){
	this._caption = ""; this._content = null; this._tab = null;

	// only initialize of this is actually a tab.  Tabs are identifed by a @tabName attribute.
	if(newTab.tabName){
		this._initializeComponent(newTab);
	} else {
		return null;
	}
}

//
// Returns the caption used for the tab.
//
CTabber.prototype.GetCaption = function(){
	return this._caption;
}

//
// Sets the caption used for the tab.  Also updates the tabbed title bar.
//
CTabber.prototype.SetCaption = function(newCaption){
	this._caption = newCaption;
	
	if(this.IsActive){		// should only change title bar if currently active.
		oMTitle.innerText = newCaption;
	}
}

// 
// Returns the <div> that is attached to this tab object.
//
CTabber.prototype.GetContent = function(){
	return this._content;
}

//
// Returns the rendered tab (<TD>) for this tab object.
//
CTabber.prototype.GetTab = function(){
	return this._tab;
}

//
// Returns true if this tab object is currently being rendered (e.g. the <div> is displayed),
// otherwise returns false.
//
CTabber.prototype.IsActive = function(){
	return (this.GetTab().className == "oMTabOn" ? true : false);
}

//
// Not used, ignore.
//
CTabber.prototype._setColumnHeaders = function(){
	var heads = this.GetContent().getElementsByTagName("TH");
	for(var i=0; i<heads.length; i++){
		var cn = heads[i].cloneNode(true);
		oMHeadings.appendChild(cn);
		heads[i].style.display = "none";
	}
}

// 
// Forces a an inactive tab to become active.  That means that the 
// tab itself changes state and the <div> is rendered.
//
// Any previously active tab is made inactive first.
//
CTabber.prototype.MakeActive = function(){
	var tab = this.GetActiveTab();
	if(tab) tab.MakeInActive();

	oMTitle.innerText = this.GetCaption();
	this.GetTab().className = "oMTabOn";
	oMTData.appendChild(this.GetContent());
	
	
	//contents.src = this.doURL;
    //contents.location.href=this.doURL;
	//alert(contents.src);
//	innerForm = window.document.getElementById("innerForm");
	_Submit(this.doURL,'innerForm','');

	this.GetContent().style.display = "block";
	this.SetScrollPosition(0);		// reset the scroll bar.
	oMTData.scrollTop = this.GetScrollPosition();
	
	// save the state to a userData store.
	goPersist.SetAttribute("selectedTab", this.GetCaption());
}

CTabber.prototype.GetActiveTab  = function(){
	for(var i=0; i<gaTabs.length; i++){
		var tab = gaTabs[i];
		if(tab.IsActive()) return tab;
	}
}

//
// Forces an active tab to become inactive.  Changes the state of the tab
// and removes the <div> from the screen.
//
CTabber.prototype.MakeInActive = function(){
	this.GetContent().style.display = "none";
	this.GetTab().className = "oMTab";
	oMTitle.innerText = "";
}

//
// Event for when the mouse moves over the tab button.
//
CTabber.prototype.OnMouseHover = function(){
	if(!this.IsActive())		// should only run event if not already active.
		this.GetTab().className = "oMTabHover";
}

//
// Event for when the user clicks the tab button.
//
CTabber.prototype.OnMouseClick = function(){
	if(!this.IsActive()){		// should only run event if not already active.
		this.MakeActive();
	}
}

//
// Event for when the user moves the mouse from within the tab button area.
//
CTabber.prototype.OnMouseFlee = function(){
	if(!this.IsActive())		// should only run event if not alreay active.
		this.GetTab().className = "oMTab";
}

// 
// Returns the scroll position for the <div> associated with this tab object.
//
CTabber.prototype.GetScrollPosition = function(){
	this._scroll;
}

//
// Sets the scroll position for the <div> associated with this tab object.
//
CTabber.prototype.SetScrollPosition = function(newValue){
	this._scroll = newValue;
	
	if(this.IsActive()) oMTData.scrollTop = newValue;
	
	goPersist.SetAttribute("scroll", newValue);
	goPersist.Save();
}

//
// Initializes the state of the tab.  This includes creating the physical tab
// as well as associated a <div> with it.
//
CTabber.prototype._initializeComponent = function(newTab){
	this._caption = newTab.tabName;			// the name used for the tab.
	this._content = newTab;					// the <div> that contains the tabbed data.
	this._scroll = 0;						// position of the scroll bar.
	this.doURL = newTab.doURL;

	// prepare the tab for use.  Create the necessary structure.
	this._tab = document.createElement("TD");
	this._tab.onmouseover = onMouseOverRedirect;
	this._tab.onmouseout = onMouseOutRedirect;
	this._tab.onmousedown = onMouseClickRedirect;
	this._tab.onkeypress = onMouseClickRedirect;
	this._tab.onclick = onMouseClickRedirect;
	this._tab.title = this.GetCaption();
	this._tab.className = "oMTab";
	this._tab.tabIndex = "0";
	this._tab.innerText = this.GetCaption();
	this._tab.tab = this;					// simply attachs a reference to this tab object onto the <TD>.
	this.GetContent().tab = this;
}

//
// functions that dispatch the event to the correct handler.  This is done because

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -