Das Notes Forum
Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: lotus blue am 07.07.05 - 14:52:10
-
Hallo Leute,
spiele mich gerade ein wenig mit einer DB die im Client hervorragend läuft und jetzt browserfähig gemacht werden soll.
Kann mir jemand weiterhelfen in Punkto Auto-Start von Anhängen (pdf usw.).
Im Client funktioniert es einwandfrei, im Browser nicht.
Habe es bisher nur über die Maskeneigenschaft probiert.
Vielen Dank im voraus
-
Ohne JavaScript wirst Du wahrscheinlich nicht weiter kommen.
Oder es könnte auch mit einem WebQueryOpen Agent gehen welcher die URL des PDF's oder was auch immer an den Browser schickt....
gruss
umi
-
Wo sollte ich denn dann Java einbauen?
Benötige ich zwei verschiedene Masken ????
Da ich von Java so viel ??? Ahnung habe, könnte mir bitte jemand weiterhelfen ????????
:'(
-
Ich rede von JavaScript !
Im OnLoad Event des Dokuments könntest Du die URL Deines Attachments an den Browser übergeben.
gruss
umi
-
Ich glaub das hast du gesucht:
Auto-Launch a file attachment
In the Notes Client there is an option when designing a form to tell it to launch the first attachment when a document is opened. How about doing this in the browser? I've thought of two ways of doing it:
Meta-Tags
JavaScript
1. Meta Tags - Using the Refresh meta-tag we can tell the browser to redirect the page to the chosen attachment.
Place the following line in the $$HTMLHead field (or its equivalent in R5)
path := @ReplaceSubstring(@Subset(@DBName; -1); "\\"; "/");
file := @ReplaceSubstring(@Subset(@AttachmentNames; 1); " "; "+");
@If(@Attachments;
"<META HTTP-EQUIV=\"refresh\" CONTENT=\"0;URL=/" + path + "/0/" + @Text(@DocumentUniqueID) + "/$file/" + file + "\">"
;"")
When the page is opened it automatically opens the first attachment. What happens next depends on the browser, the file type and the user's preferences. In IE, if the file is an office document it will probably launch automatically. Text (.txt) files should open on all browsers as should Adobe Acrobat (.pdf) files and standard HTML files. The user also has the option to tell the browser what to do with each type of file.
2. JavaScript This method is number two as it is not as fool proof as the meta-tag method. Place the following somewhere in your header ($$HTMLHead field) and as soon as the browser encounters the JavaScript that is generated it will redirect to the attachment.
path := @ReplaceSubstring(@Subset(@DBName; -1); "\\"; "/");
file := @ReplaceSubstring(@Subset(@AttachmentNames; 1); " "; "+");
@If(@Attachments;
"<script type=\"text/javascript\">"+@NewLine+
"<!-- "+@NewLine+
"location.replace(\'/" + path + "/0/" + @Text(@DocumentUniqueID) + "/$file/" + file + "\');"+@NewLine+
" -->"+@NewLine+
"</script>"
;"")
JavaScript that is generated:
<script type="text/javascript">
location.replace( '/dir/db.nsf/0/1d45..49de/$file/test.txt' );
</script>
Note: This could be done simply by changing the value of location.href but there is a good reason not to. If you simply change the location href then the "redirect" page is still in the browser's history and every time the user hits the back button they will simply re-run the above script and end up back in the page they were already in. Hence, "breaking the back button" = very annoying. Using the replace method tells the browser not to remember the current page and make the back button go to the page they were in before the "redirect" page.
Das ist von Jake Howlett