home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / tour.js < prev    next >
Encoding:
Text File  |  2004-07-12  |  1.8 KB  |  62 lines

  1. /*
  2.  * Copyright 1999-2004 The Apache Software Foundation.
  3.  *
  4.  * Licensed under the Apache License, Version 2.0 (the "License");
  5.  * you may not use this file except in compliance with the License.
  6.  * You may obtain a copy of the License at
  7.  *
  8.  *      http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License.
  15.  */
  16.  
  17. // flowscript for supersonic tour example app
  18.  
  19. // Load the javascript Cocoon Forms library
  20. cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
  21.  
  22. // Access java "database" facade object
  23. var db = Packages.org.apache.cocoon.samples.tour.beans.DatabaseFacade.getInstance();
  24.  
  25. // Query all TaskBean objects and display them
  26. function query_allTasks() {
  27.     list = db.getTasks();
  28.  
  29.     cocoon.sendPage("internal/generate-view/taskList", {
  30.         title : "List of tasks",
  31.         task : list,
  32.         db : db
  33.     });
  34. }
  35.  
  36. // Query a single TaskBean object and display it
  37. function query_singleTask() {
  38.     id = cocoon.request.getParameter("taskId");
  39.     bean = db.getTaskBeanById(id);
  40.     displayTaskBean(id,bean);
  41. }
  42.  
  43. // Edit a single TaskBean object using Cocoon Forms
  44. function singleTaskEditor(form) {
  45.     id = cocoon.request.getParameter("taskId");
  46.     bean = db.getTaskBeanById(id);
  47.  
  48.     form.load(bean);
  49.     form.showForm("internal/show-form/singleTask");
  50.     form.save(bean);
  51.     displayTaskBean(id,bean);
  52. }
  53.  
  54. // Display a single TaskBean
  55. function displayTaskBean(id,bean) {
  56.     cocoon.sendPage("internal/generate-view/singleTask", {
  57.         title : "Task #" + id,
  58.         task : bean,
  59.         selectedTaskId : id
  60.     });
  61. }
  62.