Manage Learn to apply best practices and optimize your operations.

Adding a Domino hide-when to a HTML file

Let us say that you have an HTML page on the server with links to various databases within your Intranet. Users login to the server using basic browser authentication to a database called home.nsf. One of the databases is restricted to a group of users. So, you do not really want the other users to see the link. The HTML pages on the server are managed by users via FTP (they have no access to a Domino designer client). So how do we accomplish the hide-when?

The answer is simple:

Create a LotusScript agent in the home.nsf DB called checkUser.js and set it to run as web user. The agent checks the users' group details using an @userNamesList function and then prints a JavaScript function called writeLink(). This will write the link.

Next, in your HTML file (<Head> section) reference the agent as an include for JavaScript: <script language='javascript' src='/domino/intranet/home.nsf/checkUser.js'> </script> The browser thinks it is just a JavaScript text module.

In your HTML file, place a call to the writeLink() function in the place that you want your link to be written.


LotusScript Agent in Home.nsf DB (run a web user)

Sub Initialize

   

Dim temp As Variant

   

Const GROUP = "BookingAdmin"

   

'Grab a list of groups that the web user belongs to - implode them into a string     temp = Evaluate("@implode(@userNamesList; " & Chr$(34) & "<br>" & Chr$(34) & ")")

   

'tells Domino to send the results as plain text only (no HTML tags)     Print "Content-type:text/plain"

   

'start creating the function     Print "function writeLink(){"

   

'check to see if the list contains the group     If Instr("" & temp(0), GROUP) > 0 Then         'the user is in the group then create WRITE command         Print "document.write('Click here to access the <a href=" + Chr$(34) + "CBookingV2.nsf/frmFirst?OpenForm" + "" + Chr$(34) +">Booking System</a>" + "');"

   

End If

   

'close the JavaScript function     Print "}"

End Sub

HTML Page:

<HTML> <HEAD> <TITLE>Test Links</TITLE> <script language='javascript' src='/domino/intranet/home.nsf/checkUser.js'> </script> </HEAD> <BODY BGCOLOR="white">

<!-- call to javaScript function --> <p><font face="arial"> <script language="javascript"> writeLink(); </script>

</BODY> </HTML>

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close