Skip to main content
summaryrefslogtreecommitdiffstats
blob: 8c8e9163975001d68589b8bd195b7b0a4d06f3e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<%
/*******************************************************************************
 * Copyright (c) 2003, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
%>
<%@ page contentType="text/html; charset=UTF-8" import="org.eclipse.wst.ws.internal.explorer.platform.perspective.*,
                                                        org.eclipse.wst.ws.internal.explorer.platform.constants.*,
                                                        org.eclipse.wst.ws.internal.explorer.platform.actions.*,
                                                        org.eclipse.wst.ws.internal.explorer.platform.engine.ActionEngine,
                                                        java.net.*" %>
<%
String sessionId = request.getParameter(ActionInputs.SESSIONID);
HttpSession currentSession = (HttpSession)application.getAttribute(sessionId);
Controller controller = (Controller)currentSession.getAttribute("controller");
ActionEngine actionEngine = controller.getActionEngine();
String modeString = request.getParameter(ActionInputs.ACTION_ENGINE_MODE);
if (modeString != null && modeString.length() > 0)
{
  try
  {
    byte mode = Byte.parseByte(modeString);
    actionEngine.setMode(mode);
  }
  catch (Throwable t)
  {
  }
}
String playFileId = "playFileId";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html lang="<%=response.getLocale().getLanguage()%>">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title><%=controller.getMessage("TITLE_ACTION_RECORDER")%></title>
  <script language="javascript">
    function setMode(mode)
    {
      <%
      StringBuffer formAction = new StringBuffer(response.encodeURL(controller.getPathWithContext("actionengine_container.jsp?")));
      formAction.append(ActionInputs.SESSIONID);
      formAction.append("=");
      formAction.append(sessionId);
      formAction.append("&");
      formAction.append(ActionInputs.ACTION_ENGINE_MODE);
      formAction.append("=");
      %>
      var form = document.forms[0];
      form.action = '<%=formAction.toString()%>' + mode;
      form.target = "_self";
      form.submit();
    }

    function play()
    {
      var playFile = document.getElementById("<%=playFileId%>");
      if (playFile.value != null && playFile.value.length > 0)
      {
        var form = document.forms[0];
        form.action = '<%=response.encodeURL(controller.getPathWithContext("wsexplorer.jsp"))%>';
        form.target = "<%=FrameNames.WINDOW_NAME_WSEXPLORER_JSP%>";
        form.enctype = "multipart/form-data";
        // for backward compatibility
        form.encoding = "multipart/form-data";
        form.submit();
        setMode('<%=ActionEngine.MODE_PLAY%>');
      }
      else
        alert('<%=controller.getMessage("MSG_ERROR_INVALID_PLAY_FILE")%>');
    }

    function save()
    {
      var form = document.forms[0];
      form.action = '<%=response.encodeURL(controller.getPathWithContext("actions/SaveActionEngineScenario.jsp"))%>';
      form.target = "_self";
      form.submit();
    }
  </script>
</head>
<body dir="<%=org.eclipse.wst.ws.internal.explorer.platform.util.DirUtils.getDir()%>">
  <form method="post">
    <%
    String labelModePlay = controller.getMessage("FORM_LABEL_MODE_PLAY");
    String labelModeStop = controller.getMessage("FORM_LABEL_MODE_STOP");
    String labelModeRecord = controller.getMessage("FORM_LABEL_MODE_RECORD");
    String labelSave = controller.getMessage("FORM_LABEL_SAVE");
    byte mode = actionEngine.getMode();
    String imgPlay = (mode == ActionEngine.MODE_PLAY) ? "images/elcl16/actionengine_play.gif" : "images/dlcl16/actionengine_play.gif";
    String imgStop = (mode == ActionEngine.MODE_STOP) ? "images/elcl16/actionengine_stop.gif" : "images/dlcl16/actionengine_stop.gif";
    String imgRecord = (mode == ActionEngine.MODE_RECORD) ? "images/elcl16/actionengine_record.gif" : "images/dlcl16/actionengine_record.gif";
    String imgSave = "images/dlcl16/actionengine_save.gif";
    %>
    <table border=0 cellpadding=3 cellspacing=3>
      <tr>
        <td valign="middle" align="left" class="labels" nowrap>
          <a href="javascript:play()">
            <img class="normal" border=0 alt="<%=labelModePlay%>" title="<%=labelModePlay%>" src="<%=response.encodeURL(controller.getPathWithContext(imgPlay))%>">
            <%=controller.getMessage("FORM_LABEL_MODE_PLAY")%>
          </a>
        </td>
        <td valign="middle" align="left" class="labels" nowrap>
          <a href="javascript:setMode('<%=String.valueOf(ActionEngine.MODE_STOP)%>')">
            <img class="normal" border=0 alt="<%=labelModeStop%>" title="<%=labelModeStop%>" src="<%=response.encodeURL(controller.getPathWithContext(imgStop))%>">
            <%=controller.getMessage("FORM_LABEL_MODE_STOP")%>
          </a>
        </td>
        <td valign="middle" align="left" class="labels" nowrap>
          <a href="javascript:setMode('<%=String.valueOf(ActionEngine.MODE_RECORD)%>')">
            <img class="normal" border=0 alt="<%=labelModeRecord%>" title="<%=labelModeRecord%>" src="<%=response.encodeURL(controller.getPathWithContext(imgRecord))%>">
            <%=controller.getMessage("FORM_LABEL_MODE_RECORD")%>
          </a>
        </td>
        <td valign="middle" align="left" class="labels" nowrap>
          <a href="javascript:save()">
            <img class="normal" border=0 alt="<%=labelSave%>" title="<%=labelSave%>" src="<%=response.encodeURL(controller.getPathWithContext(imgSave))%>">
            <%=controller.getMessage("FORM_LABEL_SAVE")%>
          </a>
        </td>
      </tr>
    </table>
    <table border=0 cellpadding=3 cellspacing=3>
      <tr>
        <td valign="center" align="left" class="labels" nowrap><%=controller.getMessage("FORM_LABEL_PLAY_FILE")%></td>
        <td valign="center" align="left" class="labels">
          <input type="file" id="<%=playFileId%>" name="<%=ActionInputs.ACTION_ENGINE_SCENARIO%>">
        </td>
      </tr>
    </table>
  </form>
</body>
</html>

Back to the top