View Full Version : Intranet Userspecific Framepage
hertsch
04-28-2004, 01:21 PM
Folks
We run a little Intranetsite (all handmade in our sparetime). I have now a problem and I don't find the solution.
Based on the User I would like to display in a Frame a different Framepage or call up an Userform. I have something similar on forms with VB:
Sub User()
Dim User As String
User = Application.UserName
If User = "Jack" Or _
User = "Joe" Or _
User = "David" Or _
User = "Sam" Then
Call Intranet
Else
Call Joke
End If
End Sub
Sub Intranet()
VBA.UserForms.Add("UserForm").Show
End SubIf USer
Is there a posibility to this with a JavaScript within Framework?
Thanks for your replay
HERTSCH
sad69
04-28-2004, 07:59 PM
I don't really understand what you're asking. I also don't think I understand why you're asking this particular question.
Do you want to convert that VB code to Javascript? If so, why?
Actually taking a second look tells me that your code is not VBScript, but in fact VB (like .NET or VB6 or something..).
So are you trying to convert your VB application to a web-based application using Javascript? If so, you're going to have to give a little more background on what you're trying to do, and what HTML/Javascript code you've got working thus far before we can be of any real assistance.
Good luck,
Sadiq.
hertsch
04-29-2004, 06:12 AM
How to tell what I want, when I never did it and don't know how to do it?
Based on the User (e.g. "Application.UserName", if possible) I would like to call up two different frames in a frame page. This means, if User Joe opens this page, header 1 will displayed, if Mary opens the same page, header 2 will displayed. See attachment. As an alternative it could be also: popup window/no window.
I have created this on excel forms available on the page (see previous post) and this works.
I hope this explains it.
Thanks
HERTSCH
glenngv
04-29-2004, 06:24 AM
Are you using a server-side language to get the username?
I think you're using ASP.
<%
dim page, User
'set value of User here...
Select Case User
Case "Joe"
page="header1.htm"
Case "Mary"
page="header2.htm"
'...and so on
Case Else 'default
page="defaultheader.htm"
End Select
%>
<frameset ...>
<frame name="header" src="<%=page%>">
...
</frameset>
hertsch
04-29-2004, 09:30 AM
Thanks to glenngv.
I have incorporated your sugestion into the html of the "FramePage". But something don't work. Could someone help me further. Is there a way to have a "CASE OR" link like:
Case "1" or
Case "2" or
Case "3"
Page....
Case Else....
Code of the "Frame Page"
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>CTD</title>
<link rel="stylesheet" type="text/css" href="Page_Ressources/CTD.css">
</head>
<%
dim page, User
'set value of User here...
Select Case User
Case "Joe"
page="MainFrame.htm"
Case "Sally"
page="MainFrame.htm"
Case "Mary"
page="MainFrame.htm"
Case Else 'default
page="MainFrame_Special.htm"
End Select
%>
<frameset rows="77,*" border="0" frameborder="0" framespacing="0">
<frame name="Header" scrolling="no" noresize target="contents" src="CTD_Header.htm" marginwidth="10" marginheight="0" style="border-style: inset; border-width: 3">
<frameset cols="221,*">
<frameset rows="*,323">
<frame name="Tree" target="main" src="CTD_Tree.html" marginwidth="10" marginheight="0" scrolling="auto" noresize style="border-style: inset; border-width: 3">
<frame name="Tree1" src="Bilder_Scroll.html" target="_self" scrolling="no" noresize marginwidth="3" marginheight="2" style="border-style: inset; border-width: 3">
</frameset>
<frame name="MainFrame" src="%=page%" target="_self" marginwidth="0" marginheight="0" scrolling="auto" style="border-style: inset; border-width: 3">
</frameset>
<noframes>
<body style="border-style: groove; border-color: #C0C0C0">
<p>This page uses frames, but your browser doesn't support them.</p>
</body>
</noframes>
</frameset>
</html>
glenngv
04-29-2004, 10:58 AM
Select Case User
Case "Joe"
Case "Sally"
Case "Mary"
page="MainFrame.htm"
Case Else 'default
page="MainFrame_Special.htm"
End Select
...
<frame name="MainFrame" src="<%=page%>" ...>
Don't forget the < and > signs.
hertsch
04-29-2004, 11:53 AM
Have made it like sugested. Don't work :mad:
From where it knows the "User"? (Windows XP User)
Do I have to add someting like "<Script language....>?
Spudhead
04-29-2004, 03:40 PM
dim User : User = request.servervariables("LOGON_USER")
Select Case User
Case "Joe"
Case "Sally"
Case "Mary"
page="MainFrame.htm"
Case Else 'default
page="MainFrame_Special.htm"
End Select
...
<frame name="MainFrame" src="<%=page%>" ...>
http://www.webmasterworld.com/forum47/61.htm
I'm not sure about LOGON_USER, though - I don't think it's always available in the servervariables collection.
glenngv
04-30-2004, 03:20 AM
I don't know where would User come from, that's why I leave it in my suggested code. I dont't know how his login process goes.
LOGON_USER is only available if you set IIS not to allow Anonymous access and set Basic Authentication. This means that a login prompt dialog will be displayed if your site is accessed by any user.
This should be moved to ASP forum to get more help.
glenngv
04-30-2004, 03:28 AM
I only noticed now from your screenshot that the file extension of your page is .htm. Are you using any server-side language like ASP or something? If not, the previous code suggested is not for you. If this is really a static html page, then you should tell us how do you know who's logged in to your site. Do you provide a login page?
hertsch
04-30-2004, 07:03 AM
Glenn
From that technical stuff you writte I don't understand much.
I run this Web only internal and everybody has to go true a login process on his PC (Power on).
With VBA in Excel I can get the User with....
Sub User()
Dim User As String
User = Application.UserName
This brings back the Username and based on it I'm able to create a IF-THEN-ELSE routine. Anything like that I need to controll the frames.......
HERTSCH
glenngv
04-30-2004, 09:24 AM
You need to have your Web application its own login process.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.