Solved

can we write formula and javascript as one event

Posted on 2001-08-03
24
432 Views
Last Modified: 2013-12-18
hello experts,
    i have a ellispe button in navigator and when on this button.both individual is working fine.But
i want two things should happen on one button click

 1. @URLOpen("http://abc/abcTest.nsf/abclogin?     openagent")
  2.javascript code below like this


<script language="javascript">
var the_window = null;
function test()
{
if(!the_window  || the_window .closed)
{
the_window  = window.open('http://abc/abc.nsf/child?openform','tie','left=30,top=200, width=500,height=600,toolbar=0,resizable=0,scrollbars=0,status=0,menubar=0,directories=0,location=0');
 return false;
}
else
{
 the_window.focus();
}
}
</script>
<input type=button onclick="test()" value="new">

i dont want to click on the new button.when i click on ellispe button it will open mailfile window if the same window is minimized when click again on the ellispe button it should be maximized.

can we achieve the both should work in on ellispe click

can anybody will help me.


Saleem.
0
Comment
Question by:saleemkhan
  • 13
  • 11
24 Comments
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
The javascript code for
@URLOpen("http://abc/abcTest.nsf/abclogin?    openagent")
is:
window.location.href="http://abc/abcTest.nsf/abclogin?openagent"

Simply add that code to your button, and start the function on the next line:

window.location......
test()

0
 

Author Comment

by:saleemkhan
Comment Utility
hello crak,
   i wrote the code ellispse button.we can write only 1.formula
2.simple action
3.lotus script
 
so on ellispe click(ellispe is there in navigator)
1.i want formula @urlopen("http://abc/abctest.nsf/abclogin?openagent")
2.And the ellispe button click event i want to write
the java script code.


  i think for ellipse button we cant write javascript code.can we?
can u help reg this.

saleem.
0
 

Author Comment

by:saleemkhan
Comment Utility
hello crak,
  i think my question is some what confusing u

here is my question

1.i have one formula @urlopen

2.one javascript code.


what i want is when i click on ellispe button i want both the both(formula as well as javascript code) should work .

Both of them are working individually fine.


waiting for reply.

saleem.
0
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
Use this formula:

@URLOpen("Javascript:alert(\'Perform 1st action here\'); alert(\'Perform 2nd action here\')")

Substitute both alert()-instructions for the location.href= and the function call.

I hope the function is called before the new URL gets loaded....
(You could change the URL from inside the function to!)
0
 

Author Comment

by:saleemkhan
Comment Utility
hello crak,
  sorry to ask to many question
i tried like this

1.@URLOpen("javascript:location.href=(\'http://abc/abctest.nsf/abclogin?openagent\');location.href=(\'test()\')")

but the problem is i am writing the formula in navigator in ellipse button but as u said function is calling before the url and the problem is i cant put html code in a navigator.

the javascript code is like this
<script language="javascript">
var the_window = null;
function test()
{
if(!the_window  || the_window .closed)
{
the_window  = window.open('http://abc/abc.nsf/child?openform','tie','left=30,top=200, width=500,height=600,toolbar=0,resizable=0,scrollbars=0,status=0,menubar=0,directories=0,location=0');
return false;
}
else
{
the_window.focus();
}
}
</script>
can u please help .

waiting for ur reply.

saleem
0
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
You mean that location.href=(\'test()\') actually worked?
I assumed you would adress it as:
@URLOpen("javascript:location.href=(\'http://abc/abctest.nsf/abclogin?openagent\'); test()")

Anyway; you'll still get stuck on the same problem.

I think you are trying to execute an agent in the current window, and load/focus a login pop-up window (you may want to add a focus-instruction in the window.open-block as well...).

Is it possible just to open that pop-up window, and when closing it (in an onClick or onSubmit-event) set opener.location.href to the agent's url?

As you've seen it's easy to perform two things in one click, but to really solve your problem I need to find out what the real problem is that you're trying to solve.
0
 

Author Comment

by:saleemkhan
Comment Utility
hello crak,
  what u said is correct.i want to execute an agent(what this agent will do is i will open a perticular user mail file)in the parent window and show his mail file in a popup window.if the popup window is minimized if the user agin click on main window button again the popup window should open.
    my problem i am using framset and in the frame i am embedding navigator when click on the navigator ellispe button the above two events should happen.


can u help me reg this.
0
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
Try this in the button:

newURL = '<agentURL>';
top.popUp = window.open(newURL, 'PopUp', 'height=400,width=600,direcories=no,hotkeys=no,menubar=yes,resizable=yes,location=yes,scrollbars=yes,status=no,titlebar=no,dependent=yes');
top.popUp.focus();

Change parameters where applicable and make sure the agent launches the url to the mailbox.

A popUp handler is stored in the frameset (top). As the frameset is not reloaded, the handler should stay there.
If the user activates the routine again, the handler is re-used, so the popup-window is re-used; if closed, minimised, blurred or focussed.....!
0
 

Author Comment

by:saleemkhan
Comment Utility
hello crak,
  As per ur hint
i wrote like this

newurl='http://abc/abc.nsf/maillogin?openagent';
top.popup=window.open(newurl,'popup','height=400,width=600,direcories=no,hotkeys=no,menubar=yes,resizable=yes,location=yes,scrollbars=yes,status=no,titlebar=no,dependent=yes');
top.popUp.focus();

i am getting an operator or semicolon was expected but none was expected and its pointing at popup.what is the error.


the newurl is the url which opens a perticular user mailbox.

waiting for reply.

saleem.

0
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
There are supposed to be three (3) lines:

newurl=...;

top.popup=.....;

top.popup.focus();


There is one little error in your code: you wrote:
top.popup=window......
and:
top.pupUp.focus()

As javascript is case-sensitive, make the popup-phrases identical; either popup or popUp (whatever you like, as long as their upper/lowercase characters match).
0
 

Author Comment

by:saleemkhan
Comment Utility
hai crak,

here are the three lines

newurl='http://abc/abc.nsf/maillogin?openagent';
top.popup=window.open(newurl,'popup','height=400,width=600,direcories=no,hotkeys=no,menubar=yes,resizable=yes,location=yes,scrollbars=yes,status=no,titlebar=no,dependent=yes');
top.popup.focus();

in code i put them correct only but by mistake i send u wrong.
what i did is i just removed the  third line and in the second line like
top.popup=window.open(newurl,'popup')eventhough i am getting "an operator or semicolor was expected but none was expected".
  its stopping at popup.


can u help me in this.
if u help in this i will be relieved from a big problem.
otherwise if u send ur mail i will the database as attachemnet so its easy for u to debug.
please.
waiting for reply.
saleem.


0
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
notes.domino@12move.nl
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:saleemkhan
Comment Utility
please check mail
0
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
Nothing received yet.....!?
0
 

Author Comment

by:saleemkhan
Comment Utility
i send but delivery failure once again sending to the address.please check again.
0
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
Wow.... received both now. What a delay!

I've tested your code and think I have found a very easy solution:

Your agent contains following line:

Print "[http://shaik/" + ReplaceSubstring(doc.MailFile(0), "\","/") + ".nsf" +"/iNotes/Mail/?OpenDocument]"

I have not been able to test it with that specific url, so I replaced it with one opening names.nsf. If you replace your line of code with following (and re-define the url) it should work just as you wish:

Print "<Script language=""Javascript"">"
Print "window.focus();"    
Print "location.href='/names.nsf';" ' open the correct url here
Print "</Script>"

As you can see I am NOT using referring to a specific server ("http://shaik"): starting the url with "/" will open the specified url from the "current server". If you would run it on a different server, or rename "shaik", it would still work (i.e. if application server = mail server).

Good luck!
0
 

Author Comment

by:saleemkhan
Comment Utility
hello crak

thans for ur response.
you mean
print"location.href='/names.nsf';" then no need of

+ ReplaceSubstring(doc.MailFile(0), "\","/") + ".nsf" +"/iNotes/Mail/?OpenDocument]"
i replaced the print stat with the above print stat.but
its taking very long time to run the application.
can u please send the steps to be done.


saleem.
0
 

Author Comment

by:saleemkhan
Comment Utility
hello crak,
   please send me the modified database to me.check mail.
0
 
LVL 13

Accepted Solution

by:
CRAK earned 150 total points
Comment Utility
Problem with your agent: it's scheduled by your administrator, and only his mailfile can be found: the agent runs on his id....


The workaround: pass the username to the agent via the agent's url. Act as follows:


Modify the action behind the mail-button:

db:=@ReplaceSubstring(@Subset(@DbName; -1); "\\"; "/");
@URLOpen("/" + db + "/shaikmaillogin?openagent&Usr=" + @Name([Abbreviate]; @UserName))


Modify the initialize-event of your shaikmaillogin-agent:

Sub Initialize
     Dim s As New Notessession
     Dim db As New NotesDatabase("","names.nsf")
     Dim user As NotesName
     Dim v As NotesView
     Dim doc As NotesDocument
     Dim QueryStr As String
     Dim CurDoc As NotesDocument
     Dim p As Integer
     
     Set CurDoc = s.DocumentContext ' Agent environment contains CGI fields
     ' retrieve decoded Query_String
     QueryStr = CurDoc.Query_String_Decoded(0)
     ' isolate data passed after &Usr= (I assume nothing trails that parameters data)
     Parm = "&Usr="
     p = Instr(1, QueryStr, Parm)
     QueryStr = Right$(QueryStr, (Len(QueryStr)+1) - (p+Len(Parm)))
     ' use remainder as username
     Set user = New NotesName(QueryStr)
'     Set user = New NotesName(s.EffectiveUserName)
     
     Set v = db.GetView("($Users)")
     Set doc = v.GetDocumentbyKey(user.Abbreviated)
'     Print "[http://shaik/" + ReplaceSubstring(doc.MailFile(0), "\","/") + ".nsf" +"/iNotes/Mail/?OpenDocument]"
     Print "<Script language=""Javascript"">"
     Print "alert('" + QueryStr + "')" ' remove this line: it only demonstrates that the username is available
     Print "window.focus();"    
     Print "location.href='/names.nsf';"
     Print "</Script>"
End Sub

It'll still need some modification:
remove the alert-box from the javascript in the Print-statements and
open the correct mailfile instead of names.nsf

I'm sure you'll find your way now. I'll return the database per e-mail again....

Good luck!
0
 

Author Comment

by:saleemkhan
Comment Utility
hai crak,
  can u please send me the print stat to open mail file.when i tried with the print stat i am getting object varible not set when i tried with
Print "location.href='/"+ReplaceSubstring(doc.mailfile(0),"\","/")+".nsf"+"';"

its redirecting to again admin mail file.
the url the mail file should be like this
http://shaik/mail/admin.nsf/iNotes/Mail/?OpenDocument


can u please send me the print stat(to open mail file) also.

waiting for reply.

saleem.

0
 

Author Comment

by:saleemkhan
Comment Utility
for abc user
http://shaik/mail/abc.nsf/inotes/mail/?opendocumnet
for testuser user
http://shaik/mail/testuser.nsf/inotes/mail/?opendocumnet
sorry to ask so many questions.

waiting for reply.
0
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
Sorry...
I thought you'd understand to use your original URL definition instead of the /names.nsf one that I used for testing.
The exact code under initialise in the shaikmaillogin-agent should be:



Dim s As New Notessession
Dim db As New NotesDatabase("","names.nsf")
Dim user As NotesName
Dim v As NotesView
Dim doc As NotesDocument
Dim QueryStr As String
Dim CurDoc As NotesDocument
Dim p As Integer

Set CurDoc = s.DocumentContext ' Agent environment contains CGI fields
' retrieve decoded Query_String
QueryStr = CurDoc.Query_String_Decoded(0)
' isolate data passed after &Usr= (I assume nothing trails that parameters data)
Parm = "&Usr="
p = Instr(1, QueryStr, Parm)
QueryStr = Right$(QueryStr, (Len(QueryStr)+1) - (p+Len(Parm)))
' use remainder as username
Set user = New NotesName(QueryStr)
     
Set v = db.GetView("($Users)")
Set doc = v.GetDocumentbyKey(user.Abbreviated)
Print "<Script language=""Javascript"">"
Print "window.focus();"    
Print "location.href='/" + ReplaceSubstring(doc.MailFile(0), "\","/") + ".nsf" +"/iNotes/Mail/?OpenDocument';"
Print "</Script>"



Have not been able to test this: I don't use web-enabled mail. However, the generated URL's do match the decribed format and are retrieved from the public NAB...
Should work!
0
 

Author Comment

by:saleemkhan
Comment Utility
hai crak,
   Thanks once again for ur kind help.U helped with a lot of patience.i asked so many silly questions eventhough u helped me a lot.In future i need ur help.May be tomorrow i will send u mail.i have one more problem.
  where are u from.



Thanks once again. for giving me such a good information.

saleem.
0
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
Thanks!

I'm Dutch (Netherlands).
And you?
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now