/    Sign up×
Community /Pin to ProfileBookmark

A cookie that remembers the state of a sliding menu

I am going to try an explain my issue:

I have a switchmenu in an xslt page. I would offer a link but you have to be connected through our VPN. But the menu has the option to expand east and shorten west, in the code posted below the onRegionResized finds the exact width the menu is, Down near the bottom of the page I am calling the onRegionResized in onRegionResized: function(region, newSize) {
//alert(‘size: ‘ + newSize);},

I have the alert commented out cause I have figured out that is where I need a cookie set,

Ok now to my problem, I need a cookie set for when the menu is expanded east or west for the browser to remember the state of the menu while the user uses the site, and for when they return. I am going to post all my javascript code but I will try to specify the areas that are being used to try and make this work. I have been working on this for days and I can write a cookie but I have no idea how to do this, any help or suggestion would be appreciated. thanks for your time.

There are three spots that I have made the text red, the [west] in red is the menu state, it can expand to 300 and min of 100 and 200 is the normal state.

//
// used to detect the browser and include the correct library
//

//************************************************
//**

//** Java scripting for on-line help
//**

//*
***********************************************
function SetDynamicHelp(sLabel, sText) {
if (sText == ”) sText = ‘Enter a ‘ + sLabel;
if (getEl(“span_DynamicHelp”))
document.getElementById(‘span_DynamicHelp’).innerHTML = “<strong>” + sLabel + “</strong><br/><br/>” + sText;
}

function HideDynamicHelp() {
PageLayout.collapsePanel(‘east’);
}

var PageLayout = function() {
var layout;
var tb;
var pageTitle;
var menuTitle;
var authUserGUID;
var uirole;
var authpath;
var authuser;
var colorSchema;

return {

buildLayout: function(centerPanel) {
if (tb == null) {
tb = new YAHOO.ext.Toolbar(‘master-tb’);

tb.addButton({text: ‘My Account’, className: ‘ytb-text-icon tb-myacct’, click: this.onMyAcct.createDelegate(this) });
if (this.uirole >= 100) {
tb.addSeparator();
tb.addButton({text: ‘Manage Organization’, className: ‘ytb-text-icon tb-manageorg’, click: this.onManageOrg.createDelegate(this)});
}
tb.addSeparator();
tb.addButton({text: ‘Reporting’, className: ‘ytb-text-icon tb-reporting’, click: this.onReporting.createDelegate(this)});
if (this.uirole >= 2000) {
tb.addSeparator();
tb.addButton({text: ‘Administration’, className: ‘ytb-text-icon tb-administration’, click: this.onAdmin.createDelegate(this)});
}

if (this.uirole >= 2000) {
tb.addSeparator();
tb.addButton({text: ‘Inventory’, className: ‘ytb-text-icon tb-Inventory’, click: this.onInventory.createDelegate(this)});
}

if (this.uirole >= 2000) {
tb.addSeparator();
tb.addButton({text: ‘Search’, className: ‘ytb-text-icon tb-Search’, click: this.onSearch.createDelegate(this)});
}

tb.addSeparator();
tb.addButton({text: ‘Logout’, className: ‘ytb-text-icon tb-logout’, click: this.onLogout.createDelegate(this)});

}

if (layout == null) {
layout = new YAHOO.ext.BorderLayout(document.body, {
hideOnLayout: true,
north: {
split:false,
titlebar: false,
collapsible: false,
animate: false
},
south: {
split:false,
initialSize: 20,
titlebar: false,
collapsible: false,
animate: false
},
east: {
split:true,
initialSize: 150,
minSize: 100,
maxSize: 200,
titlebar: true,
collapsible: true,
animate: true,
autoScroll:false
},[COLOR=”Red”]
west: {
split:true,
initialSize: 200,
minSize: 100,
maxSize: 300,
titlebar: false,
collapsible: false,
animate: false,
autoScroll:false
},[/COLOR]
center: {
titlebar: true,
autoScroll:true
}
});
layout.beginUpdate();
layout.add(‘north’, new YAHOO.ext.ContentPanel(‘north’,{fitToFrame:true}));
layout.add(‘south’, new YAHOO.ext.ContentPanel(‘south’,{fitToFrame:true}));
layout.add(‘east’, new YAHOO.ext.ContentPanel(‘east’, {title: ‘Online Help’, fitToFrame:true, closable: false}));
layout.add(‘west’, new YAHOO.ext.ContentPanel(‘west’, {title: ‘Menu’, fitToFrame:true, closable: false}));
layout.add(‘center’, centerPanel);
layout.restoreState();
layout.endUpdate();
[COLOR=”Red”] layout.addListener(‘regionresized’,this.onRegionResized);
}
},[/COLOR]

load: function() {
this.buildLayout(new YAHOO.ext.ContentPanel(‘center’, {title: this.pageTitle, fitToFrame:true, closable: false}));
},

addPanel: function(region, panel) {
layout.add(region,panel);
},

removePanel: function(region, divid) {
layout.remove(region,divid);
},

collapsePanel: function(region) {
layout.getRegion(region).collapse(true);
},

expandPanel: function(region, collapsed) {
layout.getRegion(region).expand(true);
},

setPanelVisibility: function(region, tabindex, makeVisible) {
if (makeVisible)
layout.getRegion(region).showPanel(tabindex);
else
layout.getRegion(region).hidePanel(tabindex);
},

onMyAcct: function() {
window.location.href = ‘mpsadmin.asp?xsl=AD/UserProperties&mps=AD/UserProperties&pathGUID=’ + this.authpath + ‘&objGUID=’ + this.authuser;
},

onManageOrg: function() {
window.location.href = ‘mpsadmin.asp?xsl=AD/Users&mps=AD/UserSearch&pathGUID=’ + this.authpath + ‘&objGUID=’ + this.authuser;
},

onReporting: function() {
window.location.href = ‘mpsadmin.asp?xsl=VC/CallDetailReport&mps=VC/GetCallDetailReport’;
},

onAdmin: function() {
window.location.href = ‘mpsadmin.asp?xsl=AXL/UserSearch&mps=AD/OUProperties’;
},

onInventory: function() {
window.location.href = ‘mpsadmin.asp?xsl=Inventory/Carrier&amp;mps=Inventory/GetCarrier’;
},
onSearch: function() {
window.location.href = ‘mpsadmin.asp?xsl=Search/CompanySearch&amp;mps=AD/OUProperties’;
},

onLogout: function() {
window.location.href = ‘SessionLogout.htm’;
},

[COLOR=”Red”]onRegionResized: function(region, newSize) {
//alert(‘size: ‘ + newSize);
}[/COLOR]

};

}();

}();

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@mthorauthorOct 25.2007 — no ideas by anyone?
Copy linkTweet thisAlerts:
@mthorauthorOct 31.2007 — if anyone ever needs a switch menu that can expand east and west on the users request, I have finally solved my issue,

thanks to the people who looked at my post, PM me for functioning code
×

Success!

Help @mthor spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...