Das Notes Forum

Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: Toma Bogdan am 18.06.03 - 15:19:21

Titel: how to open the mail file dynamically with JavaScript ?
Beitrag von: Toma Bogdan am 18.06.03 - 15:19:21
how can I open the mail file dynamically with JavaScript ? something like this

- for user 1
Code
var win=window.open("http://server_name/mail/user1.nsf\\(MSG)?OpenView" , "tw", "width=680,height=500,status=yes,resizeable=no,left=200,top=100,scrollbars=yes");


- for user 2
Code
var win=window.open("http://server_name/mail/user2.nsf\\(MSG)?OpenView" , "tw", "width=680,height=500,status=yes,resizeable=no,left=200,top=100,scrollbars=yes");

and so on....

how to get the server_name and the user1, user2 ,..... with JavaScript ?
Titel: Re:how to open the mail file dynamically with JavaScript ?
Beitrag von: harkpabst_meliantrop am 18.06.03 - 16:12:13
You can't do that with JS only.

As long as your code runs on the same server as the mail files are located, you could of course examin the history.location object, but still no way to determin the username.

The easiest way would be to combine JS an @Formulas. Write your JS as Pass-Through-HTML on a Form or page and insert compted text where you need to make calculations with @formulas.

Titel: something like this ?
Beitrag von: Toma Bogdan am 18.06.03 - 16:41:55


// In the JS Header.
function greetUser( strUserName ) {
alert( "Hello, " + strUserName + "!" );
}

REM "Formula code, behind a buton.";
@URLOpen( "javascript:greetUser( '" + @Name( [CN]; @UserName ) + "')" );

'LotusScript code, behind a button.
Sub Click(Source As Button)
Dim n_session As New NotesSession
Dim n_uiws As New NotesUIWorkspace

Call n_uiws.URLOpen( "javascript:greetUser( '" & n_session.CommonUserName & "')" )
End Sub
Titel: Re:how to open the mail file dynamically with JavaScript ?
Beitrag von: Axel_Janssen am 18.06.03 - 17:01:02
other variant is to use passThru html and computed text.

To call your function greetUser() in js header.

All as passThru Html (in text menu) and the @username as computed text (in create menu):

simply write in form.

Code
<input type="button" value="click me" onClick="greetUser(\"@username\")"/ >

this way you use formula language to dynamically write JavaScript when the form is requested by the browser.

In Html-Head field you can write whole JavaScript functions with Formula Language.