パーソナルツール
現在の場所: ホーム zope 2.8 + plone 2.1 新機能一覧 #24: フォームの内容を保存しないときは確認する
書いた本
Plone 完全活用ガイド の Chapter 1, 2, 3, 11 を執筆しました。
plone のインストール、使い方から、機能・デザインのカスタマイズ、プロダクトの作り方まで、 plone のすべてがぎゅっと詰まっている書籍になっていると思います。
plone に興味がある人から、すでに使いこなしている方まで、ぜひ読んでみてください。
Plone 完全活用ガイドのサポートページ
ナビゲーション

 
文書操作

#24: フォームの内容を保存しないときは確認する

作成者 takanori 最終変更日時 2008年06月04日 12時41分

入力フォームに対して変更を加えた後に、保存しないで画面を移動しようとすると確認をする必要があります。

#24: Confirm changes before unloading form

動機づけ

しばしば、ユーザーがたくさんのテキストを書いたあとにて、「保存」ボタンのクリックを忘れるか、偶然リンクをクリックするか、別の URL(おそらく他のアプリケーションから呼び出されたURL)へ移動するということがあります。 そのような状況で、Web Browser(plone)があなたが本当に画面を遷移して、編集内容を失ってもよいか確認することが望ましいです。

提案

On browsers which support it, Plone should warn before allowing the user to navigate away from a page which contains an edited form. Right now, IE and Mozilla 1.7+ support the onBeforeUnload event that is fired before the browser navigates away. The event allows for displaying a form which gives the user the option to continue to navigate away from the page, or to cancel the navigation and return to editing the form. それを支持するブラウザーで、Ploneはユーザーが編集された形式を含むページから離れて操縦するのを許す前に警告しなければなりません。たった今、IE とMozilla 1.7+は、ブラウザーが離れてナビゲートする前に、焼かれるonBeforeUnloadイベントを支えます。イベントは、ページから離れて操縦するか、ナビゲーションをキャンセルして、形式を編集することに戻り続けるためにユーザーにオプションを与える形式を示すことを考慮に入れます。

The idea is to add handling code linked to this event, that checks if the user has edited/modified the form and if no submit is clicked, he is presented a dialog where he can confirm his action. Browsers that do not support the event won't notice this mechanism (graceful degredation). 考えはこのイベントとの関連があるコードを取り扱うことを加えることになっています、ユーザーがedited/modifiedを持つならば、形式ともしもが少しも降参しないことを確認しますチャンネルを変えます、彼は彼が彼の行動を確かめることができる対話を贈られます。イベントを支えないブラウザーは、このメカニズム(上品なdegredation)に言及しません。

The handler should ignore the supplementary forms which can appear on a page (such as the search box, or login portlet). In addition it should be able to work cleanly with add-on products such as Epoz and Kupu where additional code may be required to detect edits. ハンドラーは、ページ(例えば検索ボックスまたはログインportlet)に載ることができる補足書式を無視しなければなりません。それに加えて、それは付加的なコードが編集を見つけることを要求されるかもしれないEpozとKupuのようなアドオン製品できれいに働くことができなければなりません。

実装

The original idea is base on an article Tracking changes to a form by Jake Howlett. A sample implementation with documentation and unit tests exists in the kupu editor. 最初の考えは、記事Trackingのベースがジェイクハウレットによって形式に変わるということです。ドキュメンテーションと単位テストによるサンプル実施は、kupuエディタの中に存在します。 Deliverables 配達可能なもの

What code and documentation needs to be produced? In addition to the standard items: 生じられるどんなコードとドキュメンテーションニーズ?標準のアイテムに加えて:

*

Unit tests 単位テスト

(There isn't any framework for javascript unit tests in Plone, so one will have to be added.) (javascript単位テストに対する少しのフレームワークもPloneでありませんので、1は加えられなければならないです。) *

Localization 局地化

The kupu code to be used as a base does not currently handle localization. The simplest way seems to be to add a translated string to plone_javascript_variables.js ベースとして使用されるkupuコードは、局地化を現在取り扱いません。最も単純な方法は、翻訳されたストリングをplone_javascript_variables.jsに加えることになっているようです *

Documentation ドキュメンテーション

Consideration for special fields 特別なフィールドに対する思いやり

Plone has a lot of special form fields that use javascript themselves. We need to take special considerations for these. Examples to investigate : Epoz, Kupu, Archetypes widgets (the boolean and the date ones do some js trickery) Ploneには、彼ら自身javascriptを使う多くの特別な形式フィールドがあります。我々は、これらに対する特別な思いやりをとる必要があります。調査する例:Epoz、Kupu、Archetypes装置(ブーリアンと日付ものは、数js詐欺をします)

Epoz Epoz It is probably easiest to get Epoz to add in support for PLIP24 when it is used in a PLIP24-enabled Plone. それがPLIP24対応Ploneで使われるとき、PLIP24に対する支持において加えるEpozを得ることは多分最も簡単でしょう。 Kupu Kupu It is proposed to use the existing code from Kupu as a base for the implementation. The main requirement for Kupu therefore is to maintain a compatible API, and to make it possible for Kupu to give precedence to the Plone handler code. 実施のためにベースとしてKupuから既存のコードを使用することは、提案されます。 Kupuの主な必要条件は、したがって、互換性を持つAPIを維持して、KupuがPloneハンドラーコードを優先することを可能にすることです。 Calendar widget カレンダー装置 The calendar widget uses a hidden field to send back the value entered, and a set of select fields which are used client-side only. The code must ignore the state of the client-side fields (since they are updated by javascript after the form has loaded) but must not ignore the hidden field. カレンダー装置は、入れられる価値と使い古したクライアント側だけである一組の選ばれたフィールドを送り返すために、隠れたフィールドを使用します。コードはクライアント側フィールド(形式がロードしたあと彼らがjavascriptによって更新される時から)の国を無視しなければならないが、隠れたフィールドを無視してはなりません。 Archetypes boolean widget 原型ブールの装置 As with the calendar, this uses a combination of hidden and visible controls. In this case the visible control has the correct initial setting so it is sufficient to track the state of either the visible or the hidden control, or both. i.e. there should be no issues here. カレンダーと同様に、これは隠れて見える規制の組合せを使います。この場合、見える支配は、正しい初期設定を持ちますので、それは見えるか隠れた支配または両方ともの国を追跡するのに十分です。すなわち、問題がここにあってはなりません。 Others 他 The documented api should give sufficient control for most conceivable forms. 文書化されたapiは、大部分の考えられる形式のために十分な支配をしなければなりません。


Powered by vine linux, python, zope, plone, coreblog