Salome HOME
Refactoring: kernel and som are moved to Siman-Common.
[tools/siman.git] / Workspace / Siman / WebContent / jvs / action.js
1     function executeConfirmedAction (action, message) {
2 //  -------------------------------------------------
3       if (confirm(message)) executeAction(action);
4       else                  ContextHide();
5     }
6
7     function executeAction (action) {
8 //  -------------------------------
9       ContextHide();
10       var open = action.indexOf("(");
11       if (open > 0 && action.charAt(action.length-1) == ")") {              // Function call
12
13 //      Client side execution via the "perform" Applet
14         var method = action.substring(0, open);                             // Better trim the result
15         var args   = action.substring(open+1, action.length-1).split(",");  // Better trim each argument
16         if (method == "launch") {
17 //        args[0] = executable name, args[1] = file name
18           if      (args.length == 1) {
19 //          alert("Executing " + args[0]);
20                 document.perform.launch(args[0], null);
21           } else if (args.length >= 2) {
22 //          alert("Executing " + args[0] + " with " + args[1]);
23                 document.perform.launch(args[0], args[1]);
24           }
25         }
26       } else {
27 //      Server side execution via a Struts action
28         window.location = action.replace("&", "&");                     // Due to string conversion in menupopup JSP
29       }
30     }