on 09-06-2005 10:38 AM
Hi!
we have a BPS Web-interface with several tabs, each containing a Web-layout. User access is restricted via R_PARAM to certain tabs/layouts ... and this works fine (user gets a message "no access" when he tries to open an restricted tab).
Is there a way to hide these tabs that are restricted for a certain user?
Thanks,
Holger
Hello Holger,
here's how to do it. First create a numeric variable in BPS of type exit. In the exit you do the auth.check and return for example 0 if all tabs should be displayed and 1 if certain tabs should be hidden. This logic can be of course more sophisticated.
Add this variable to the end of the web interface (component name = VarAuthCheck). Then add a text component (HTML = true) with the following script:
<script language="JavaScript">
function wif_hide_tab(wif_tabstrip, wif_tabpage) {
var tabitem = wif_tabstrip + "-itm-" + wif_tabpage;
// Alternative 1: Disable Tab
document.all(tabitem).onclick = new Function ('return false;');
document.all(tabitem).onkeydown = new Function ('return false;');
document.all(tabitem).style.cursor = "default";
document.all(tabitem + "-txt").innerHTML = "(not authorized)";
// Alternative 2: Hide tab
document.all(tabitem).style.display = "none";
var tabstrip = wif_tabstrip + "-tbl";
var tabfocus = document.all(tabstrip).getAttribute("focusedtab");
var tabcount = document.all(tabstrip).getAttribute("tabcount") - 1;
if ( tabcount == wif_tabpage ) {
tabitem = wif_tabstrip + "-n";
document.all(tabitem).style.display = "none";
tabitem = wif_tabstrip + "-itm-" + wif_tabpage + "-a";
tabcount -= 1;
if ( tabcount == tabfocus )
document.all(tabitem).className = "urTbsLastOnNextOff";
else
document.all(tabitem).className = "urTbsLastOffNextOff";
}
else {
if ( tabfocus < wif_tabpage ) wif_tabpage += 1;
tabitem = wif_tabstrip + "-itm-" + wif_tabpage + "-a";
document.all(tabitem).style.display = "none";
}
}
var wif_varcheck = "VarAuthCheck";
var theForm = getForm();
if ( theForm.elements(wif_varcheck).value == 1 ) {
// note: tab numbering starts with zero
wif_hide_tab("TabStrip1", 1);
wif_hide_tab("TabStrip1", 2);
}
theForm.elements(wif_varcheck).style.display = "none";
</script>
In this example, the tabstrip is called "TabStrip1" and the second and third tabpage are hidden.
Of course the logic of passing the return code of the auth check in the script and evaluating, which tabs should be hidden, could be much more complex.
Regards,
Marc
SAP NetWeaver RIG
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marc,
your solution is verygood,I used your code and solved my problem,but I found maybe there's a little bug in it.I have 2 tabpage under my Tabstrip1,when I hide the second tabpage,everything is fine,but when I hide my first tabpage and run my Web application,I can still see the first tabpage at the first time,when I click the second tabpage(Not hide) and back to click the first tabpage,it disabled,how can I hide the first tabpage successfully?
hope for the answer,thank you very much!
Hi Holger Mertens,
I working on same application as you mentioned here,
could you tell me what is mean by User access is restricted via R_PARAM to certain tabs/layouts ... what is R_PARAM.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi denni,
I should use this process for my WIB. Could you provide example of your exit ?
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.