initial checkin from subversion
This commit is contained in:
100
menuBarControl.js
Normal file
100
menuBarControl.js
Normal file
@@ -0,0 +1,100 @@
|
||||
function menuBarControl() {
|
||||
var m_displayDom=document.createElement("div");
|
||||
m_displayDom.setAttribute("class","menuBar");
|
||||
m_displayDom.setAttribute("id","menuBar");
|
||||
var m_fsControl=new fileSelectorControl(getFileList());
|
||||
var m_fileName=new textControl("FILENAME",true);
|
||||
var m_userName=new textControl("USER",true,true);
|
||||
|
||||
return(construct());
|
||||
|
||||
function construct() {
|
||||
m_fileName.setDisplayMode();
|
||||
m_displayDom.appendChild(m_fileName);
|
||||
m_userName.setDisplayMode();
|
||||
m_userName.setAttribute('id','userName');
|
||||
m_userName.setAttribute('class','userName');
|
||||
m_userName.setText(getUserInfo("name"));
|
||||
var profileLink=document.createElement("span");
|
||||
profileLink.setAttribute("class","link");
|
||||
profileLink.appendChild(document.createTextNode("[Profile]"));
|
||||
profileLink.onclick=function(){ window.open("profile.html"); }
|
||||
m_userName.appendChild(document.createTextNode(" "));
|
||||
m_userName.appendChild(profileLink);
|
||||
m_displayDom.appendChild(m_userName);
|
||||
|
||||
var menuItems = new Array();
|
||||
menuItems[menuItems.length]=new textMenuItem("Files",onFilesClick,"menuBarRootItem");
|
||||
menuItems[menuItems.length]=new textMenuItem("Save",onSaveClick,"menuBarRootItem");
|
||||
menuItems[menuItems.length]=new textMenuItem("More",onMoreClick,"menuBarRootItem");
|
||||
menuItems[menuItems.length]=new textMenuItem("Log Out",logOutUser,"menuBarRootItem");
|
||||
|
||||
m_displayDom.menu=new menuControl(menuItems,0);
|
||||
m_displayDom.menu.setAttribute("class","menuBarMenu");
|
||||
|
||||
m_displayDom.appendChild(m_displayDom.menu);
|
||||
|
||||
m_fsControl.hide();
|
||||
m_displayDom.appendChild(m_fsControl);
|
||||
document.addSubscriber(m_fsControl.hide,"clicked");
|
||||
|
||||
m_displayDom.setFileDescription=setFileDescription;
|
||||
m_displayDom.show=show;
|
||||
m_displayDom.hide=hide;
|
||||
|
||||
return(m_displayDom);
|
||||
function onMoreClick(){
|
||||
if (!this.menu){
|
||||
var menuItems = new Array();
|
||||
menuItems[menuItems.length]=new textMenuItem("New Map/Clear",onNewClick,"menuBarSubItem");
|
||||
menuItems[menuItems.length]=new textMenuItem("Save Copy As",onSaveAsClick,"menuBarSubItem");
|
||||
menuItems[menuItems.length]=new textMenuItem("Add Rootnode",onNewRootNodeClick,"menuBarSubItem");
|
||||
menuItems[menuItems.length]=new textMenuItem("Reposition Nodes",autoRepositionNodes,"menuBarSubItem");
|
||||
|
||||
this.menu= new menuControl(menuItems,1);
|
||||
this.menu.setAttribute("class","menuBarMenu");
|
||||
this.appendChild(this.menu);
|
||||
document.addSubscriber(this.menu.hide,"clicked");
|
||||
} else {
|
||||
this.menu.toggleVisible();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onNewRootNodeClick(){
|
||||
rootNode[rootNode.length]=new node(dataTools.getNewPKey(),"(enter text)");
|
||||
}
|
||||
|
||||
function onNewClick() {
|
||||
g_filePKey=null;
|
||||
setFileDescription("FILENAME");
|
||||
|
||||
deleteAllRootNodes();
|
||||
rootNode[0]=new node(dataTools.getNewPKey(),"(enter text)");
|
||||
}
|
||||
function onSaveClick() {
|
||||
saveMap(m_fileName.getText());
|
||||
m_fsControl.update(getFileList());
|
||||
}
|
||||
function onSaveAsClick() {
|
||||
g_filePKey=null;
|
||||
saveMap(m_fileName.getText());
|
||||
m_fsControl.update(getFileList());
|
||||
}
|
||||
function onFilesClick() {
|
||||
if (m_fsControl.isVisible) {
|
||||
m_fsControl.hide();
|
||||
} else {
|
||||
m_fsControl.show();
|
||||
}
|
||||
}
|
||||
function setFileDescription(description) {
|
||||
m_fileName.setText(description);
|
||||
}
|
||||
function hide() {
|
||||
this.style.display="none";
|
||||
}
|
||||
function show() {
|
||||
this.style.display="block";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user