1

GETメソッドのパラメータからxPageの挙動をコントロールする方法

Posted by Viruke on 12月 29, 2009 in Lotus Domino Designer, Lotus Notes, xPages

他のページからジャンプしてきた時に、xPageの表示内容を変更したい時などに役立つ知識だと思います。

引用元のブログではGETメソッドのパラメータを使って表示するカテゴリのフィルタリングを行っています。

What this code does is before the page has loaded it looks at the URL and finds the location= part and if it exists it puts whatever the value is into a sessionscope variable called 'locationfilter'. Session Scope is a special scope where you can add variables that only last for the duration of the users session. As soon as they close their web browser the session scope variables are lost. There is also an Application Scope and a Page Scope that you can use to store these values. Heres how the code will look in the source view of your xpage, you can see the resource for the server side script library and the beforePageLoad script. As you get more advanced in XPages you may find yourself writing code directly in the source view.

引用元: Dec’s Dom Blog :: Learning XPages Part 20 : Restricting The Repeat To A Single Category.

実際、GETメソッドのパラメータをbeforePageLoadイベントでチェックするのに

var cgi = new CGIVariables();
var param = cgi.getURLParam(”Location”);
if (param) {
if (param != “” )
sessionScope.locationfilter = param;
}

引用元: Dec’s Dom Blog :: Learning XPages Part 20 : Restricting The Repeat To A Single Category.

というサンプルコードがあるのですが、Louts Notes/Domino 8.5に付属してくるディスカッションテンプレートにあるxpCGIVariables Script Libraryではcgi.getURLParam()というファンクションがないため上手く動きません。

そこで、taskjam.netからTaskJam V1.0とうテンプレートをダウンロードしてもってきます。

ここで、とても興味深かったのが、ブログで寄せられているコメントなんですが、

There is also a MUCH easier way to get the parameter instead of including the script library (although it’s probably good that you showed that).

Use the global “context” JavaScript object:
context.getUrlParameter(”Location”)

という書き込みがあり、「context.getUrlParameter(”Location”)を使うともっと簡単にパラメータが取ってこれるよ」、と言っています。

で、ブロガーのDec自身が

I was thinking the exact same thing but have come to realise over the past couple of days that context.getUrlParameter() is not available in certain contexts, such as described above, and when programmatically getting the document id.

と返事してます。

実は自分も同じようにcontext.getUrlParameter(”Location”)beforePageLoadイベントで使おうとしたんですが、なぜか値を取得しなくて、調べている内に彼のブログに辿り着きました。

興味ある方は、TaskJam V1.0テンプレートのxpCGIVariablesを覗いて頂ければ分かるとおもうのですが、

自分の結論としてはbeforePageLoadイベントでは

context.getUrlParameter()

はまだ値が格納されておらず、

facesContext.getExternalContext().getRequest()

には格納されている。

ということにしておきました :-) (自分はIBMの人間じゃないので間違っている可能性大です><)

さらに突っ込むと、同じコメント欄で

パラメータを渡すようなことをしなくてもリンク元でsessionScopeを使って予め設定しておけばいいんじゃないの?

というコメントも寄せられていて、

実際、自分もそれをまず試したのですが、結論としては(自分の環境では)動きませんでした。

リンクが同じデータベース内にあって、リンクをクリックされたとき、onclickイベントなどでsessionScopeを使って値を設定する場合は、正常に動作するとおもうのですが、

自分の場合は、他のデータベースに貼ってあるリンクからジャンプさせていたので、onclickイベントでsessionScopeの値を設定しても、リンク先のデータベースではsessionScopeの値を取得出来ませんでした。

ここで、悩んだのが、sessionScopeっていったい、どこの保存されているのか?

これも、自分の憶測と断って書かせてもらうと、

sessionScopeはUserがログインしている間保存されるが、その値自体は、定義したデータベースが持つ。なので、2つのデータベースで同じ変数のsessionScopeの値が違うということはありえる。

ということです。 検証しようと思えば簡単なので、時間が出来たときにやってみたいと思います。もしくは答えを知っているかたがおられたら教えてください(><)

タグ: ,

 
0

Lotus Notes 8.5.1のためLotus Expeditor ToolkitをEclipseに設定する時の注意点

Posted by Viruke on 11月 25, 2009 in Composite Application, Lotus Domino Designer, Lotus Expeditor, Lotus Notes

Lotus Notes 8.5.1の埋め込みブラウザをSSO(Single-Sign-On)対応させるために、Lotus Expeditor Toolkitを使ったEclipseの設定をしようとしたのですが、Lotus Notes 8.5.1のVMが見当たらないので、ググッてみると以下のように構造に変更があったみたいです。

There’s no longer a JRE stored in the plugin directory way down in the directory structure. Now you simply use the JVM in /jvm – simple right?!

This is nice but it means that your Eclipse configuration needs to be a little different JVM wise. I have therefore updated my Eclipse configuration guidelines to work with Notes 8.5.1.

引用元: Configure Eclipse 3.4 for Notes 8.5.1 – lekkimworld.com.

以前は、

<Notes install dir>/framework/rcp/eclipse/plugins/com.ibm.rcp.j2se.win32.x86_1.5.0.SR4-200707311521/jre

などとなっていたのですが、Lotus Notes 8.5.1では引用元の紹介にもあるように、

<Notes install dir>/jvm

に変更になっていました。
詳しくは Eclipse configuration guidelines to work with Notes 8.5.1に書いてあります。

これは、自分の設定した場合、

Lotus Notes 8.5.1 VM

なお、Lotus Expeditor Toolkitの設定自体は以下のリンク等にかいてあるのが参考になるとおもいます。

http://www.ibm.com/developerworks/lotus/library/expeditor-notes-sametime/
http://www.ibm.com/developerworks/lotus/library/expeditor-browser/

タグ: , , ,

 
0

Notes ClientでxPageをオープンするための?OpenXPages

Posted by Viruke on 11月 24, 2009 in Composite Application, Lotus Domino Designer, Lotus Notes, xPages

前回の投稿に続き、Lotus Notes 8.5.1からxPagesをComposite ApplicationにComponentsとして追加できる機能がついたので、早速試してみたのですが、Dblookupで他のデータベースからドキュメント情報を取得することは出来るけど、いざ、そのドキュメントをオープンさせようとしたときに、上手いこといかない、という問題に躓いたので記しておきます。

実際、なにが上手いこと行かなかったかというと、

  1. http:// のプロトコルでリンクを手前で生成しているような場合に、Lotus NotesはWebブラウザで開けようとするが、認証をもう一度求められてしまう。
  2. リンクを参照パスにしても、Proxyエラーや、404エラーとなってしまって開くことが出来ない。

で、どうするのかな~と思い調べてみると、答えはxPagesのブログに有りました。

?OpenXPage has been added as a supported parameters for the notes:// protocol to launch an XPage in the Notes client.

引用元: What’s New For XPages in 8.5.1 – XPages Blog – The XPages Blog.

Lotus Notes 8.5.1 のxPagesの新しい機能紹介の投稿なんですが、

Notes ClientでxPageをランチするために notes:// プロトコルの?OpenXPages というパラメータをサポートしました。

ということらしいので、自分の探していたのはこれかも?!と思い試してみたら見事に動きました。

自分の例では、

Link Core ControlのOptionsで「Link type」を「URL」にして、以下のようなComputed Valueで上手くいきました。

return “Notes:///88257656006337D3/content.xsp?OpenXPage”

余談ですがxPagesをComposite ApplicationのComponentとして使いたい場合は、極力xPagesで用意されたCore Controls等を使って作っていくのが近道っぽいです。もちろんThemeなども。

自分はxPagesのSourceタブからhtmlコードやCSSファイルをガツガツ埋め込んでいっていたので、Componentにしたとき、ほとんど動かず、結局かなり作り直すはめになっちゃいました・・・(涙)

追記:12月16日2009年
Domino Designere URLs for xPgages というエントリーがDomino Designer Wikiに追加されてます。

http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Domino_Designer_URLs_for_XPages

タグ: , ,

Copyright © 2010 無限なる開発ブログ All rights reserved. Theme by Laptop Geek.