applicationDict.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. applicationDict_parameter = {};
  2. function applicationDict_query_init(id) {
  3. var str = '<table border="1" width="100%">';
  4. str += '<tr><td>application:</td><td><input type="text" id="application" style="width:95%"/></td></tr>';
  5. str += '<tr><td>applicationDict:</td><td><input type="text" id="applicationDict" style="width:95%"/></td></tr>';
  6. str += '<tr><td>path0:</td><td><input type="text" id="path0" style="width:95%"/></td></tr>';
  7. str += '<tr><td>path1:</td><td><input type="text" id="path1" style="width:95%"/></td></tr>';
  8. str += '<tr><td>path2:</td><td><input type="text" id="path2" style="width:95%"/></td></tr>';
  9. str += '<tr><td>path3:</td><td><input type="text" id="path3" style="width:95%"/></td></tr>';
  10. str += '<tr><td>path4:</td><td><input type="text" id="path4" style="width:95%"/></td></tr>';
  11. str += '<tr><td>path5:</td><td><input type="text" id="path5" style="width:95%"/></td></tr>';
  12. str += '<tr><td>path6:</td><td><input type="text" id="path6" style="width:95%"/></td></tr>';
  13. str += '<tr><td>path7:</td><td><input type="text" id="path7" style="width:95%"/></td></tr>';
  14. str += '<tr><td colspan="2"><a href="#" id="get">get</a></td></tr>';
  15. str += '<tr><td colspan="2"><textarea id="data" style="width:95%; height:500px"/></td></tr>';
  16. str += '<tr><td colspan="2"><a href="#" id="put">put</a></td></tr>';
  17. str += '</table>';
  18. $('#content').html(str);
  19. if (id) {
  20. $('#applicationDict', '#content').val(id);
  21. }
  22. $('#get', '#content').click(function() {
  23. applicationDict_query();
  24. });
  25. $('#put', '#content').click(function() {
  26. applicationDict_put();
  27. });
  28. }
  29. function applicationDict_query() {
  30. var url = +'../jaxrs/applicationdict/' + $('#applicationDict', '#content').val() + '/application/' + $('#application', '#content').val();
  31. var path0 = $('#path0', '#content').val();
  32. var path1 = $('#path1', '#content').val();
  33. var path2 = $('#path2', '#content').val();
  34. var path3 = $('#path3', '#content').val();
  35. var path4 = $('#path4', '#content').val();
  36. var path5 = $('#path5', '#content').val();
  37. var path6 = $('#path6', '#content').val();
  38. var path7 = $('#path7', '#content').val();
  39. if (path0.length > 0) {
  40. url += '/' + path0;
  41. if (path1.length > 0) {
  42. url += '/' + path1;
  43. if (path2.length > 0) {
  44. url += '/' + path2;
  45. if (path3.length > 0) {
  46. url += '/' + path3;
  47. if (path4.length > 0) {
  48. url += '/' + path4;
  49. if (path5.length > 0) {
  50. url += '/' + path5;
  51. if (path6.length > 0) {
  52. url += '/' + path6;
  53. if (path7.length > 0) {
  54. url += '/' + path7;
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }
  61. }
  62. }
  63. $.ajax({
  64. type : 'get',
  65. dataType : 'json',
  66. url : url + '/data',
  67. xhrFields : {
  68. 'withCredentials' : true
  69. },
  70. crossDomain : true
  71. }).done(function(data) {
  72. if (data.type == 'success') {
  73. if (data.data) {
  74. $('#data', '#content').val(JSON.stringify(data.data, null, '\t'));
  75. } else {
  76. $('#result', '#content').val('');
  77. }
  78. } else {
  79. failure(data);
  80. }
  81. });
  82. }
  83. function applicationDict_create() {
  84. var str = '<table border="1" width="100%">';
  85. str += '<tr><td colspan="2"><a href="#" id="post">post</a></td></tr>';
  86. str += '<tr><td>application:</td><td><input type="text" id="application" style="width:95%"/></td></tr>';
  87. str += '<tr><td>name:</td><td><input type="text" id="name" style="width:95%"/></td></tr>';
  88. str += '<tr><td>alias:</td><td><input type="text" id="alias" style="width:95%"/></td></tr>';
  89. str += '<tr><td>description:</td><td><input type="text" id="description" style="width:95%"/></td></tr>';
  90. str += '<tr><td colspan="2"><textarea style="width:95%; height:480px" id="data"/></td></tr>';
  91. str += '</table>';
  92. $('#content').html(str);
  93. $('#post', '#content').click(function() {
  94. applicationDict_post();
  95. });
  96. }
  97. function applicationDict_post() {
  98. $.ajax({
  99. type : 'post',
  100. dataType : 'json',
  101. url : '../jaxrs/applicationdict/',
  102. contentType : 'application/json; charset=utf-8',
  103. data : JSON.stringify({
  104. application : $('#application', '#content').val(),
  105. name : $('#name', '#content').val(),
  106. alias : $('#alias', '#content').val(),
  107. description : $('#description', '#content').val(),
  108. data : JSON.parse($('#data', '#content').val())
  109. }),
  110. xhrFields : {
  111. 'withCredentials' : true
  112. },
  113. crossDomain : true
  114. }).done(function(data) {
  115. if (data.type == 'success') {
  116. } else {
  117. failure(data);
  118. }
  119. });
  120. }
  121. function applicationDict_list_init() {
  122. var str = '<table border="1" width="100%">';
  123. str += '<tr><td>application:</td><td><input type="text" id="application" style="width:95%"/></td></tr>';
  124. str += '<tr><td colspan="2"><a href="#" id="list">list</a></td></tr>';
  125. str += '<tr><td colspan="2" id="result">&nbsp;</td></tr>';
  126. str += '</table>';
  127. $('#content').html(str);
  128. $('#list', '#content').click(function() {
  129. applicationDict_list();
  130. });
  131. }
  132. function applicationDict_list() {
  133. $.ajax({
  134. type : 'get',
  135. dataType : 'json',
  136. url : '../jaxrs/applicationdict/list/application/' + $('#application', '#content').val(),
  137. contentType : 'application/json; charset=utf-8',
  138. xhrFields : {
  139. 'withCredentials' : true
  140. },
  141. crossDomain : true
  142. }).done(function(data) {
  143. if (data.type == 'success') {
  144. $('#result', '#content').html(JSON.stringify(data.data, null, '<br/>'));
  145. } else {
  146. failure(data);
  147. }
  148. });
  149. }
  150. function applicationDict_view(id) {
  151. var str = '<table border="1" width="100%">';
  152. str += '<tr><td colspan="2"><a href="#" id="get">get</a>&nbsp;<a href="#" id="put">put</a>&nbsp;<a href="#" id="delete">delete</a></td></tr>';
  153. str += '<tr><td>applicationDict:</td><td><input type="text" id="id" style="width:95%"/></td></tr>';
  154. str += '<tr><td>application:</td><td id="application">&nbsp;</td></tr>';
  155. str += '<tr><td>name:</td><td><input type="text" id="name" style="width:95%"/></td></tr>';
  156. str += '<tr><td>alias:</td><td><input type="text" id="alias" style="width:95%"/></td></tr>';
  157. str += '<tr><td>description:</td><td><input type="text" id="description" style="width:95%"/></td></tr>';
  158. str += '<tr><td colspan="2">data:</td></tr>';
  159. str += '<tr><td colspan="2"><textarea style="width:95%; height:480px" id="data"/></td></tr>';
  160. str += '<tr><td colspan="2" id="result">&nbsp;</td></tr>';
  161. str += '</table>';
  162. $('#content').html(str);
  163. if (id) {
  164. $('#id', '#content').val(id);
  165. }
  166. $('#get', '#content').click(function() {
  167. applicationDict_get($('#id', '#content').val());
  168. });
  169. $('#put', '#content').click(function() {
  170. applicationDict_put($('#id', '#content').val());
  171. });
  172. $('#delete', '#content').click(function() {
  173. applicationDict_delete($('#id', '#content').val());
  174. });
  175. }
  176. function applicationDict_get(application, id) {
  177. $.ajax({
  178. type : 'get',
  179. dataType : 'json',
  180. url : '../jaxrs/applicationdict/' + id + '/application/' + application,
  181. contentType : 'application/json; charset=utf-8',
  182. xhrFields : {
  183. 'withCredentials' : true
  184. },
  185. crossDomain : true
  186. }).done(function(data) {
  187. if (data.type == 'success') {
  188. $('#id', '#content').val(data.data.id);
  189. $('#name', '#content').val(data.data.name);
  190. $('#application', '#content').html(data.data.application);
  191. $('#alias', '#content').val(data.data.alias);
  192. $('#description', '#content').val(data.data.description);
  193. $('#data', '#content').val(JSON.stringify(data.data.data, null, '\t'));
  194. } else {
  195. failure(data);
  196. }
  197. });
  198. }
  199. function applicationDict_put(id) {
  200. $.ajax({
  201. type : 'put',
  202. dataType : 'json',
  203. url : '../jaxrs/applicationdict/' + id,
  204. contentType : 'application/json; charset=utf-8',
  205. data : JSON.stringify({
  206. 'name' : $('#name', '#content').val(),
  207. 'alias' : $('#alias', '#content').val(),
  208. 'description' : $('#description', '#content').val(),
  209. 'data' : JSON.parse($('#data', '#content').val())
  210. }),
  211. xhrFields : {
  212. 'withCredentials' : true
  213. },
  214. crossDomain : true
  215. }).done(function(data) {
  216. if (data.type == 'success') {
  217. } else {
  218. failure(data);
  219. }
  220. });
  221. }
  222. function applicationDict_delete() {
  223. $.ajax({
  224. type : 'delete',
  225. dataType : 'json',
  226. url : '../jaxrs/applicationdict/' + $('#applicationDict', '#content').val(),
  227. contentType : 'application/json; charset=utf-8',
  228. xhrFields : {
  229. 'withCredentials' : true
  230. },
  231. crossDomain : true
  232. }).done(function(data) {
  233. if (data.type == 'success') {
  234. $('#result', '#content').html(JSON.stringify(data.data, null, '<br/>'));
  235. } else {
  236. failure(data);
  237. }
  238. });
  239. }