ssdevClient_login.home.jsp 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <%@ page import="java.io.File" %>
  2. <%@ page import="java.io.BufferedReader" %>
  3. <%@ page import="java.io.InputStreamReader" %>
  4. <%@ page import="java.io.FileInputStream" %><%-- 去掉,去掉 basePath(String),直接用 /page/ = AppC.PAGE_path。Lin
  5. <%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false"%>
  6. <jsp:directive.page import="java.io.*"/>
  7. <%
  8. String path = request.getContextPath();
  9. String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  10. %>
  11. --%>
  12. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  13. <html>
  14. <head>
  15. <%-- 去掉,去掉 basePath(String),直接用 /page/ = AppC.PAGE_path。Lin
  16. <base href="<%=basePath%>">
  17. --%>
  18. <title>My JSP 'index.jsp' starting page</title>
  19. <meta http-equiv="pragma" content="no-cache">
  20. <meta http-equiv="cache-control" content="no-cache">
  21. <meta http-equiv="expires" content="0">
  22. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
  23. <meta http-equiv="description" content="This is my page">
  24. <link href="/skin/ssdev/style.css" rel="stylesheet" type="text/css">
  25. <js.ss file="/ss/common.js"/> <%-- ="wd/js/common.js"。Lin --%>
  26. <js.ss file="/ss/jquery/jquery-1.7.2.min.js"/> <%-- ="/wd/js/jquery-1.6.2.min.js"。Lin --%>
  27. <js.ss file="/ss/json2.js"/> <%-- ="wd/js/json2.js"。Lin --%>
  28. <script type="text/javascript">
  29. <%-- 先去掉,用到再加 -- 去掉 "wd/apps/apps"。Lin
  30. <%
  31. wd.dev.DevConstVars.devHttpPort = request.getServerPort();
  32. /// 先去掉 apps 文件,用到再弄 -- 考虑改为服务。Lin
  33. // 输出了 request."method" 的处理程序,包括 createApp("创建应用")、saveApps("保存应用")、createDebug("创建调试")、getDebugInfo("获得调试信息")
  34. String appsPath = session.getServletContext().getRealPath("wd/apps/apps");
  35. ///
  36. File file = new File(appsPath);
  37. if(!file.exists()){
  38. out.write("var appInfo = [];");
  39. }else{
  40. BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
  41. String s = "";
  42. String buf = "";
  43. while(null!=(buf=br.readLine())){
  44. s += buf;
  45. }
  46. if("".equals(s)){
  47. out.write("var appInfo = [];");
  48. }else{
  49. out.write("var appInfo = "+s+";");
  50. }
  51. }
  52. %>
  53. --%>
  54. /* 去掉,没用到。Lin
  55. function initAppSel() {
  56. appInfo = appInfo || [];
  57. var appSel = g('app');
  58. appSel.options.length = 0;
  59. for(var i = 0; i < appInfo.length; i++) {
  60. var item = appInfo[i];
  61. var name = item['name'];
  62. addOption(appSel, name, name);
  63. }
  64. }
  65. function cascadeJndiName() {
  66. var appName = g('app').value;
  67. if('' == appName) return;
  68. for(var i = 0; i < appInfo.length; i++) {
  69. var item = appInfo[i];
  70. var name = item['name'];
  71. if(name == appName) {
  72. var jndi = item['jndi'];
  73. g('defaultJndiName').value = jndi;
  74. break;
  75. }
  76. }
  77. }
  78. function createApp() {
  79. var newAppName = g('newAppName').value.trim();
  80. var tip = checkNull('newAppName', '应用名');
  81. //tip += 'WD'== newAppName.toUpperCase() ? '应用名不能为wd!\n' : '';
  82. tip += appNameExist(newAppName) ? '应用名:' + newAppName + '已经存在\n' : '';
  83. if('' != tip) {
  84. alert(tip);
  85. return;
  86. }
  87. $.ajax({
  88. url: "<@%=path%>/wd/apps / apps.jsp ? method = createApp ",
  89. type: "POST",
  90. dataType: "text",
  91. data: {
  92. "newAppName": newAppName
  93. },
  94. success: function(msg) {
  95. if('success' == msg.trim()) {
  96. var item = {};
  97. item['name'] = newAppName;
  98. item['jndi'] = '';
  99. appInfo.push(item);
  100. initAppSel();
  101. g('app').value = newAppName;
  102. g('app').onchange();
  103. alert('创建应用 ' + newAppName + ' 成功!');
  104. }
  105. }
  106. });
  107. }
  108. function appNameExist(appName) {
  109. var result = false;
  110. for(var i = 0; i < appInfo.length; i++) {
  111. var name = appInfo[i]['name'];
  112. if(name == appName) {
  113. result = true;
  114. break;
  115. }
  116. }
  117. return result;
  118. }
  119. */
  120. function mySubmit() {
  121. document.forms[0].submit();
  122. }
  123. //打开调试服务程序的窗口
  124. /* 去掉,没用到了 -- 没有 id="toServer"、id="toServerIP" 了。Lin
  125. function bindOpenDebugWindowEvent() {
  126. g('toServer').onclick = function() {
  127. var url = 'http://' + g('toServerIP').value + '/initDevParams.jsp?wd.dev.host=<@%=wd.core.common.CoreConstVars.listenIP %>& wd.dev.port =<@%=wd.dev.DevConstVars.debugPort %>';
  128. window.open(url);
  129. };
  130. }
  131. */
  132. function addEvent() {
  133. // g('createApp').onclick = createApp;
  134. // g('app').onchange = cascadeJndiName;
  135. g('loginBtn').onclick = mySubmit;
  136. }
  137. onload = function() {
  138. // initAppSel();
  139. addEvent();
  140. // g('app').onchange();
  141. /* 去掉,没用到了 -- 没有 id="toServer"、id="toServerIP" 了。Lin
  142. bindOpenDebugWindowEvent();
  143. */
  144. }
  145. </script>
  146. </head>
  147. <body leftmargin="0" topmargin="0">
  148. <form action="<serv.ss name='ssdevClient_login' dest='ssdev_home'/>" method="post"> <%-- ="/pmsAction.do?action=login"。Lin --%>
  149. <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  150. <tr>
  151. <td align="center" height="120">
  152. <table width="100%" >
  153. <tr>
  154. <td align="center" width="100%" height="20"><h1>欢迎使用 SS 开发平台</h1></td>
  155. </tr>
  156. <tr>
  157. <td align="center" width="100%" height="20"><div class="login">
  158. <table>
  159. <!--<tr>
  160. <th>应用名:</th>
  161. <td>
  162. <select id="app" name="<@%=ServiceConst.APP_NAME %>" class="login-select"></select>
  163. </td>
  164. </tr
  165. <tr>
  166. <th>默认数据库JNDI名:</th>
  167. <td><input id="defaultJndiName" name="<@%=ServiceConst.DEFAULT_JNDI_NAME %>" type="text" class=" login-text" id="textfield" ></td>
  168. </tr>-->
  169. <tr>
  170. <th>用户名</th>
  171. <td><input type="text" name="yhm" /></td>
  172. </tr>
  173. <tr>
  174. <th>密码</th>
  175. <td><input type="password" name="mm" /></td>
  176. </tr>
  177. <tr>          
  178. <td colspan="2"><p>
  179. <input type="button" name="loginBtn" id="loginBtn" value="登录" class="edit-button">
  180. </p></td>
  181. </tr>
  182. </table>
  183. <%-- 去掉,没有 <div>。Lin
  184. </div>
  185. --%>
  186. </td>
  187. </tr>
  188. <!--<tr><td>&nbsp;</td></tr>
  189. <tr>
  190. <td align="center" width="100%" height="20">
  191. <div class="login">
  192. <table >
  193. <tr>
  194. <th>应用名:</th>
  195. <td><input name="newAppName" type="text" class=" login-text" id="textfield2" >
  196. <input type="button" name="button2" id="createApp" value="创 建" class="edit-button"></td>
  197. </tr>
  198. </table>
  199. </div></td>
  200. </tr>-->
  201. <tr><td>&nbsp;</td></tr>
  202. <tr>
  203. <!--<td align="center" width="100%" height="20">
  204. <div class="login">
  205. <table >
  206. <tr>
  207. <th>服务器地址:</th>
  208. <td><input name="toServerIP" type="text" class=" login-text" id="toServerIP" value="localhost:8081" >
  209. <input type="button" name="toServer" id="toServer" value="跳 转" class="edit-button"></td>
  210. </tr>
  211. </table>
  212. </div></td>-->
  213. </tr>
  214. </table>
  215. </td>
  216. </tr>
  217. </table>
  218. <%-- 去掉,改为 <serv@ss。Lin
  219. <input type="hidden" name="<@%=ServiceConst.SUCCESS_PATH %>" value="/wd/base/index.jsp" />
  220. --%>
  221. </form>
  222. </body>
  223. </html>