Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/webobjects/woextensions/JSConfirmPanel.java


1   /*
2    * JSConfirmPanel.java
3    * © Copyright 2001 Apple Computer, Inc. All rights reserved.
4    * This a modified version.
5    * Original license: http://www.opensource.apple.com/apsl/
6    */
7   
8   package com.webobjects.woextensions;
9   
10  import com.webobjects.appserver.*;
11  import com.webobjects.foundation.*;
12  
13  public class JSConfirmPanel extends JSAlertPanel {
14      public JSConfirmPanel(WOContext aContext)  {
15          super(aContext);
16      }
17  
18      public String confirmJSMessage() {
19  
20          String theMessage = (String)_WOJExtensionsUtil.valueForBindingOrNull("confirmMessage",this);
21  
22              // Put in a default message if one was not provided
23          if (theMessage==null) {
24              theMessage = "Are you sure you want to do this?";
25  
26          } else {
27              // Strip out the tags in the message that will mess things up - like apostrophes and quotes
28      theMessage = NSArray.componentsSeparatedByString(theMessage, "'").componentsJoinedByString("");
29      theMessage = NSArray.componentsSeparatedByString(theMessage, "\"").componentsJoinedByString("");
30          }  
31  
32          // Return the opening string for the Javascript function
33          return "return confirm('"+theMessage+"')";
34  
35      }
36  }