1
0

devTellerMap_edit.jsp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <%@ include file="../common/header.jsp"%>
  2. <script type="text/javascript" src="./js/autocomplete/jquery.js"></script>
  3. <script type='text/javascript' src='./js/autocomplete/jquery.bgiframe.min.js'></script>
  4. <script type='text/javascript' src='./js/autocomplete/jquery.ajaxQueue.js'></script>
  5. <script type='text/javascript' src='./js/autocomplete/thickbox-compressed.js'></script>
  6. <script type='text/javascript' src='./js/autocomplete/jquery.autocomplete.js'></script>
  7. <script type='text/javascript' src='./js/autocomplete/localdata.js'></script>
  8. <script type="text/javascript" language="javascript">
  9. <!--
  10. function doEditSearch(){
  11. var form = document.forms.devTellerMap;
  12. var message = "";
  13. var focus = false;
  14. if (trim(form.group_search.value).length == 0) {
  15. message = message + ("<bean:message key="error.devTellerMap.group" />\n");
  16. if (!focus) form.group_search.focus(); focus = true;
  17. }
  18. if (trim(form.deviceId_search.value).length == 0) {
  19. message = message + ("<bean:message key="error.devTellerMap.deviceId" />\n");
  20. if (!focus) form.deviceId_search.focus(); focus = true;
  21. }
  22. if (message == "") {
  23. form.action.value="edit_search";
  24. form.submit();
  25. doDisable(form, "button");
  26. } else {
  27. alert(message);
  28. }
  29. }
  30. function doEditOk(){
  31. var form = document.forms.devTellerMap;
  32. var message = "";
  33. var focus = false;
  34. if (trim(form.deviceName.value).length == 0) {
  35. message = message + ("<bean:message key="error.devTellerMap.deviceName" />\n");
  36. if (!focus) form.deviceName.focus(); focus = true;
  37. }
  38. if (trim(form.terminalId.value).length == 0) {
  39. message = message + ("<bean:message key="error.devTellerMap.terminalId" />\n");
  40. if (!focus) form.terminalId.focus(); focus = true;
  41. }
  42. if (trim(form.terminalIp.value).length == 0) {
  43. message = message + ("<bean:message key="error.devTellerMap.terminalIp" />\n");
  44. if (!focus) form.terminalIp.focus(); focus = true;
  45. }
  46. if (trim(form.tellerId.value).length == 0) {
  47. message = message + ("<bean:message key="error.devTellerMap.tellerId" />\n");
  48. if (!focus) form.tellerId_id.focus(); focus = true;
  49. } else if (trim(form.tellerId_id.value).length == 0) {
  50. message = message + ("<bean:message key="error.devTellerMap.tellerId" />\n");
  51. if (!focus) form.tellerId_id.focus(); focus = true;
  52. }
  53. if (message == "") {
  54. var x = window.confirm("<bean:message key="confirm.create" />")
  55. if (x) {
  56. form.action.value="edit_ok";
  57. form.submit();
  58. doDisable(form, "button");
  59. }
  60. } else {
  61. alert(message);
  62. }
  63. }
  64. function doBack(){
  65. var form = document.forms.devTellerMap;
  66. form.action.value="edit";
  67. form.submit();
  68. doDisable(form, "button");
  69. }
  70. $(function() {
  71. function format(jsonmap) {
  72. return jsonmap.tellerId+ " - " +jsonmap.tellerName+ " - " +jsonmap.ctrlUnitId;
  73. }
  74. $("#tellerId_id").autocomplete('devTellerMap.do?action=loadTeller', {
  75. dataType: "json",
  76. parse: function(data) {
  77. return $.map(data, function(row) {
  78. return {
  79. data: row,
  80. value: row.tellerName,
  81. result: row.tellerName
  82. }
  83. });
  84. },
  85. formatItem: function(jsonmap) {
  86. return format(jsonmap);
  87. },
  88. extraParams:{ group:function(){ return $("#group_id").val();} }
  89. }).result(function(e, jsonmap) {
  90. //after select
  91. $("#tellerId_id").val(format(jsonmap));
  92. $("#tellerId").val(jsonmap.tellerId);
  93. $("#tellerName").val(jsonmap.tellerName);
  94. $("#ctrlUnitId").val(jsonmap.ctrlUnitId);
  95. });
  96. });
  97. function doReloadTeller() {
  98. var form = document.forms.devTellerMap;
  99. var message = "";
  100. var group = form.group.value;
  101. if (trim(group).length == 0) {
  102. message = message + ("<bean:message key="error.devTellerMap.group" />\n");
  103. if (!focus) form.group.focus(); focus = true;
  104. }
  105. if (message == "") {
  106. var req = createXMLHttpRequest();
  107. try {
  108. var url = "devTellerMap.do?action=reloadTeller&group=" +group+ "&ts=" +new Date().getTime();
  109. req.open("GET", url);
  110. req.onreadystatechange = function(){
  111. if (req.readyState < 4){
  112. document.getElementById('tellerId_div').innerHTML = "<img src='./images/wait.gif' border=0 >&nbsp;<b>Please Wait...<\/b>";
  113. }
  114. if (req.readyState == 4){
  115. document.getElementById('tellerId_div').innerHTML = "";
  116. }
  117. }
  118. req.send(null);
  119. } catch(e) {
  120. alert(e);
  121. }
  122. } else {
  123. alert(message);
  124. }
  125. }
  126. -->
  127. </script>
  128. <!-- CONTENT -->
  129. <form name="devTellerMap" method="post" action="devTellerMap.do">
  130. <input type="hidden" name="action" value ="">
  131. <input type="hidden" name="clear" value ="">
  132. <input type="hidden" name="ctrlUnitId" id="ctrlUnitId" value="<logic:notEmpty name="devTellerMap"><bean:write name="devTellerMap" property="ctrlUnitId" /></logic:notEmpty>">
  133. <input type="hidden" name="deviceId" value="<logic:notEmpty name="devTellerMap" property="deviceId"><bean:write name="devTellerMap" property="deviceId" /></logic:notEmpty>">
  134. <input type="hidden" name="group" id="group_id" value="<logic:notEmpty name="devTellerMap" property="group"><bean:write name="devTellerMap" property="group" /></logic:notEmpty>">
  135. <input type="hidden" name="id" value="<logic:notEmpty name="devTellerMap" property="id"><bean:write name="devTellerMap" property="id" /></logic:notEmpty>">
  136. <input type="hidden" name="itemFocus" value="<logic:empty name="devTellerMap" property="id">group_search</logic:empty><logic:notEmpty name="devTellerMap" property="id">deviceName</logic:notEmpty>">
  137. <input type="hidden" name="tellerName" id="tellerName" value="<logic:notEmpty name="tellerName"><bean:write name="tellerName" /></logic:notEmpty>">
  138. <input type="hidden" name="tellerId" id="tellerId" value="<logic:notEmpty name="devTellerMap"><bean:write name="devTellerMap" property="tellerId" /></logic:notEmpty>">
  139. <table width="100%" border="0" align="center" cellpadding="2" cellspacing="4">
  140. <tr>
  141. <td class="titleHeader"><bean:message key="project.devTellerMap.key"/> - EDIT</td>
  142. </tr>
  143. </table>
  144. <table width="100%" border="0" align="center" cellpadding="2" cellspacing="4">
  145. <tr><td colspan="7"><html:errors/></td></tr>
  146. <tr>
  147. <td align="center">
  148. <table width="100%" border="0" cellspacing="1" cellpadding="2">
  149. <logic:empty name="devTellerMap" property="id">
  150. <tr align = "left">
  151. <td width="15%"><b><bean:message key="devTellerMap.group.key" /></b></td>
  152. <td width="10">:</td>
  153. <td width="30%">
  154. <select name="group_search" style="width:200" id="group_id">
  155. <option value="">-- Select Group --</option>
  156. <logic:notEmpty name="groupList">
  157. <logic:iterate id="element_group" name="groupList" >
  158. <option value="<bean:write name="element_group" property="name" />"
  159. <logic:notEmpty name="devTellerMap" property="group">
  160. <logic:equal name="devTellerMap" property="group" value="${element_group.name}">
  161. selected
  162. </logic:equal>
  163. </logic:notEmpty>
  164. ><bean:write name="element_group" property="name" /></option>
  165. </logic:iterate>
  166. </logic:notEmpty>
  167. </select>
  168. </td>
  169. <td width="5%">&nbsp;</td>
  170. <td width="15%">&nbsp;</td>
  171. <td width="10">&nbsp;</td>
  172. <td width="30%">&nbsp;</td>
  173. </tr>
  174. <tr align = "left">
  175. <td width="15%"><b><bean:message key="devTellerMap.deviceId.key" /></b></td>
  176. <td width="10">:</td>
  177. <td width="30%">
  178. <input type="text" name="deviceId_search" size="50" value="<logic:notEmpty name="devTellerMap" property="deviceId"><bean:write name="devTellerMap" property="deviceId" /></logic:notEmpty>">
  179. </td>
  180. <td width="5%">&nbsp;</td>
  181. <td width="15%">&nbsp;</td>
  182. <td width="10">&nbsp;</td>
  183. <td width="30%">&nbsp;</td>
  184. </tr>
  185. <tr align = "left">
  186. <td width="15%"></td>
  187. <td width="10"></td>
  188. <td width="30%">
  189. <input type="button" value="<bean:message key="button.edit"/>" onclick="javascript:doEditSearch();">
  190. </td>
  191. <td colspan="4">&nbsp;</td>
  192. </tr>
  193. </logic:empty>
  194. <logic:notEmpty name="devTellerMap" property="id">
  195. <tr>
  196. <td width="15%"><b><bean:message key="devTellerMap.group.key" /></b></td>
  197. <td width="10">:</td>
  198. <td width="30%">
  199. <bean:write name="devTellerMap" property="group"/>
  200. </td>
  201. <td width="5%">&nbsp;</td>
  202. <td width="15%">&nbsp;</td>
  203. <td width="10">&nbsp;</td>
  204. <td width="30%">&nbsp;</td>
  205. </tr>
  206. <tr>
  207. <td width="15%"><b><bean:message key="devTellerMap.deviceId.key"/></b></td>
  208. <td width="10">:</td>
  209. <td width="30%">
  210. <bean:write name="devTellerMap" property="deviceId"/>
  211. </td>
  212. <td width="5%">&nbsp;</td>
  213. <td width="15%">&nbsp;</td>
  214. <td width="10">&nbsp;</td>
  215. <td width="30%">&nbsp;</td>
  216. </tr>
  217. <tr>
  218. <td width="15%"><b><bean:message key="devTellerMap.deviceName.key"/></b></td>
  219. <td width="10">:</td>
  220. <td width="30%">
  221. <html:text name="devTellerMap" property="deviceName" size="30"/>
  222. </td>
  223. <td width="5%">&nbsp;</td>
  224. <td width="15%">&nbsp;</td>
  225. <td width="10">&nbsp;</td>
  226. <td width="30%">&nbsp;</td>
  227. </tr>
  228. <tr>
  229. <td width="15%"><b><bean:message key="devTellerMap.terminalId.key"/></b></td>
  230. <td width="10">:</td>
  231. <td width="30%">
  232. <html:text name="devTellerMap" property="terminalId" size="30"/>
  233. </td>
  234. <td width="5%">&nbsp;</td>
  235. <td width="15%">&nbsp;</td>
  236. <td width="10">&nbsp;</td>
  237. <td width="30%">&nbsp;</td>
  238. </tr>
  239. <tr>
  240. <td width="15%"><b><bean:message key="devTellerMap.terminalIp.key"/></b></td>
  241. <td width="10">:</td>
  242. <td width="30%">
  243. <html:text name="devTellerMap" property="terminalIp" size="30"/>
  244. </td>
  245. <td width="5%">&nbsp;</td>
  246. <td width="15%">&nbsp;</td>
  247. <td width="10">&nbsp;</td>
  248. <td width="30%">&nbsp;</td>
  249. </tr>
  250. <tr>
  251. <td width="15%"><b><bean:message key="devTellerMap.tellerId.key"/> <font color="#FF0000">*</font></b></td>
  252. <td width="10">:</td>
  253. <td width="30%">
  254. <input type="text" name="tellerId_id" size="50" id="tellerId_id" value="<logic:notEmpty name="combine"><bean:write name="combine" /></logic:notEmpty>">
  255. <input type="button" value="<bean:message key="button.reload"/>" onclick="javascript:doReloadTeller();">
  256. <div id="tellerId_div" align="left">&nbsp;</div>
  257. </td>
  258. <td width="5%">&nbsp;</td>
  259. <td width="15%">&nbsp;</td>
  260. <td width="10">&nbsp;</td>
  261. <td width="30%">&nbsp;</td>
  262. </tr>
  263. <tr>
  264. <td width="15%"></td>
  265. <td width="10"></td>
  266. <td width="30%">
  267. <input type="button" value="<bean:message key="button.back"/>" onclick="javascript:doBack();">
  268. &nbsp;
  269. <input type="button" value="<bean:message key="button.submit"/>" onclick="doEditOk();">
  270. </td>
  271. <td colspan="4">&nbsp;</td>
  272. </tr>
  273. <tr>
  274. <td>&nbsp;</td>
  275. <td>&nbsp;</td>
  276. <td>&nbsp;</td>
  277. <td>&nbsp;</td>
  278. <td>&nbsp;</td>
  279. <td>&nbsp;</td>
  280. <td>&nbsp;</td>
  281. </tr>
  282. </logic:notEmpty>
  283. </table>
  284. </td>
  285. </tr>
  286. <tr>
  287. <td>&nbsp;</td>
  288. </tr>
  289. </table>
  290. </form>
  291. <!-- END CONTENT -->
  292. <logic:notEmpty name="focus"><bean:write name="focus" filter="false" /></logic:notEmpty>
  293. <%@ include file="../common/footer.jsp"%>