Author: jeremy
Date: Mon Oct 11 06:30:17 2004
New Revision: 54581
Added:
cocoon/trunk/src/blocks/lucene/samples/query/screens/cancelled.xml
Modified:
cocoon/trunk/src/blocks/lucene/samples/query/query.js
cocoon/trunk/src/blocks/lucene/samples/query/screens/messages.xml
Log:
making the cancel button work
Modified: cocoon/trunk/src/blocks/lucene/samples/query/query.js
==============================================================================
--- cocoon/trunk/src/blocks/lucene/samples/query/query.js (original)
+++ cocoon/trunk/src/blocks/lucene/samples/query/query.js Mon Oct 11
06:30:17 2004
@@ -15,7 +15,7 @@
*/
// flowscripts for using the Query Bean
-// $Id: query.js,v 1.3 2004/07/05 14:56:03 asavory Exp $
+// $Id$
cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
@@ -63,13 +63,19 @@
query = new SimpleLuceneQueryBean(type, null, match,
field, cocoon.parameters["query"]);
} else if ( "".equals(historyid) ) { // test for:
new query
query = new SimpleLuceneQueryBean(type, null, match,
field, "");
- edit(query);
+ if (!edit(query)) {
+ cocoon.sendPage("screen/cancelled", {message:
"cancel.note"});
+ return;
+ }
} else {
try {
var edition = history.get(historyid);
if (page == null) { //
edit a query already in the history
query = edition.copy();
// clone it first so history items are separate
- edit(query);
+ if (!edit(query)) {
+
cocoon.sendPage("screen/cancelled", {message: "cancel.note"});
+ return;
+ }
} else { //
page a query already in the history
query = edition;
query.page = page;
@@ -123,6 +129,9 @@
form.showForm(cocoon.parameters["form"]);
if ("submit".equals(form.submitId)) {
form.save(query);
+ return true;
+ } else {
+ return false;
}
}
Added: cocoon/trunk/src/blocks/lucene/samples/query/screens/cancelled.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/lucene/samples/query/screens/cancelled.xml Mon Oct
11 06:30:17 2004
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<page xmlns:t="http://apache.org/cocoon/templates/jx/1.0"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <title>Cancelled</title>
+ <content>
+ <p><i18n:text i18n:catalogue="local">#{message}</i18n:text></p>
+ </content>
+</page>
Modified: cocoon/trunk/src/blocks/lucene/samples/query/screens/messages.xml
==============================================================================
--- cocoon/trunk/src/blocks/lucene/samples/query/screens/messages.xml
(original)
+++ cocoon/trunk/src/blocks/lucene/samples/query/screens/messages.xml Mon Oct
11 06:30:17 2004
@@ -15,7 +15,7 @@
limitations under the License.
-->
-<!-- $Id: messages.xml,v 1.1 2004/06/21 10:00:20 jeremy Exp $ -->
+<!-- $Id$ -->
<catalogue>
<!-- these keys are bound to your Index Field names -->
@@ -144,6 +144,7 @@
<message key="simple.page.note">Enter some words and hit submit.</message>
<message key="simple.page.title">A simple query</message>
<message key="required.note">* required</message>
+ <message key="cancel.note">you cancelled your edit</message>
<!-- errors -->
<message key="search.error.noquery">there was no query</message>
<message key="search.error.nohistory">you have no history at the
moment</message>