1 /* set up the colors in the sidebar
2 Disables/Enables certain components based on various state data */
4 attachEvt("common", "init", initSideBar);
5 attachEvt("common", "init", setSidebarLinks);
7 attachEvt("common", "unload", sidebarTreesFree );
9 function initSideBar() {
10 var page = findCurrentPage();
13 unHideMe($("sidebar_results_wrapper"));
15 if( page == RRESULT ) {
16 unHideMe($("sidebar_results_wrapper"));
17 unHideMe(G.ui.sidebar[MRESULT]);
18 $("sidebar_title_group_results").setAttribute("href", buildOPACLink({ page: MRESULT }));
21 if( page == RDETAIL ) {
22 unHideMe($("sidebar_results_wrapper"));
23 $("sidebar_title_group_results").setAttribute("href", buildOPACLink({ page: MRESULT }));
24 unHideMe(G.ui.sidebar[MRESULT]);
25 $("sidebar_title_results").setAttribute("href", buildOPACLink({ page : RRESULT }));
26 unHideMe(G.ui.sidebar[RRESULT]);
29 unHideMe(G.ui.sidebar[page]);
30 addCSSClass(G.ui.sidebar[page], "sidebar_item_active");
32 /* if we're logged in, show it and replace the Login link with the Logout link */
34 G.ui.sidebar.username_dest.appendChild(text(G.user.usrname()));
35 unHideMe(G.ui.sidebar.logoutbox);
36 unHideMe(G.ui.sidebar.logged_in_as);
37 hideMe(G.ui.sidebar.loginbox);
40 if(G.ui.sidebar.login) G.ui.sidebar.login.onclick = initLogin;
41 if(G.ui.sidebar.logout) G.ui.sidebar.logout.onclick = doLogout;
44 /* sets up the login ui components */
45 var loginBoxVisible = false;
47 function loginDance() {
50 G.ui.sidebar.username_dest.appendChild(text(G.user.usrname()));
51 unHideMe(G.ui.sidebar.logoutbox);
52 unHideMe(G.ui.sidebar.logged_in_as);
53 hideMe(G.ui.sidebar.loginbox);
54 runEvt("common", "loggedIn");
58 function initLogin() {
60 G.ui.login.button.onclick = loginDance;
61 G.ui.login.username.onkeydown =
62 function(evt) {if(userPressedEnter(evt)) loginDance();};
63 G.ui.login.password.onkeydown =
64 function(evt) {if(userPressedEnter(evt)) loginDance();};
69 swapCanvas(G.ui.login.box);
70 try{G.ui.login.username.focus();}catch(e){}
73 loginBoxVisible = !loginBoxVisible;
74 G.ui.login.cancel.onclick = showCanvas;
77 function setSidebarLinks() {
78 G.ui.sidebar.home_link.setAttribute("href", buildOPACLink({page:HOME}));
79 G.ui.sidebar.advanced_link.setAttribute("href", buildOPACLink({page:ADVANCED}));
80 G.ui.sidebar.myopac_link.setAttribute("href", buildOPACLink({page:MYOPAC}, false, true));
83 function sidebarTreesFree() {
84 removeChildren($(subjectSidebarTree.rootid));
85 removeChildren($(authorSidebarTree.rootid));
86 removeChildren($(seriesSidebarTree.rootid));
87 subjectSidebarTree = null;
88 authorSidebarTree = null;
89 seriesSidebarTree = null;