resourcesEdit.jsp 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <%--
  2. time:2011-12-05 17:00:54
  3. desc:edit the 子系统资源
  4. --%>
  5. <%@page language="java" pageEncoding="UTF-8"%>
  6. <%@include file="/commons/include/html_doctype.html"%>
  7. <html>
  8. <head>
  9. <title>编辑子系统资源</title>
  10. <%@include file="/commons/include/form.jsp" %>
  11. <script type="text/javascript" src="${ctx }/js/lg/plugins/ligerComboBox.js"></script>
  12. <script type="text/javascript" src="${ctx }/js/lg/plugins/ligerWindow.js" ></script>
  13. <script type="text/javascript" src="${ctx }/js/hotent/platform/system/IconDialog.js"></script>
  14. <script type="text/javascript" src="${ctx}/js/hotent/platform/system/Share.js"></script>
  15. <script type="text/javascript" src="${ctx}/servlet/ValidJs?form=resources"></script>
  16. <script type="text/javascript">
  17. var i=100;
  18. var ctx="${ctx}";
  19. $(function() {
  20. function showRequest(formData, jqForm, options) {
  21. return true;
  22. }
  23. if(${resources.alias==null||resources.alias==""}){
  24. valid(showRequest,showResponse,1);
  25. $("#resName").blur(function(){
  26. var obj=$(this);
  27. autoPingin(obj);
  28. });
  29. }else{
  30. valid(showRequest,showResponse);
  31. }
  32. $("a.save").click(function() {
  33. $('#resourcesForm').submit();
  34. });
  35. });
  36. function showResponse(responseText){
  37. var json=eval("("+responseText+")");
  38. if(json.result==1){
  39. var resName=$("#resName").val();
  40. var isFolder=$("#isFolder").val();
  41. var icon=$("#icon").val();
  42. if(json.operate=='add'){
  43. parent.addResource(json.resId,resName,icon,isFolder);
  44. $.ligerDialog.confirm('添加节点成功,继续添加吗?','提示信息',function(rtn){
  45. if(rtn){
  46. $("#resName,#alias,#defaultUrl").val("");
  47. }
  48. else{
  49. location.href=ctx +"/platform/system/resources/get.ht?resId="+ json.resId;
  50. }
  51. });
  52. }
  53. else{
  54. parent.editResource(resName,icon,isFolder);
  55. $.ligerDialog.success('编辑节点成功!','提示信息');
  56. }
  57. }
  58. else{
  59. $.ligerDialog.err('出错信息',"编辑节点失败",json.message);
  60. }
  61. }
  62. function selectIcon(){
  63. IconDialog({callback:function(src){
  64. $("#icon").val(src);
  65. $("#iconImg").attr("src",src);
  66. $("#iconImg").show();
  67. }});
  68. };
  69. function add(){
  70. var aryTr=[
  71. '<tr>',
  72. '<td style="text-align: center;">',
  73. '<input name="chDefaultUrl" type="radio" onclick="setDefaultUrl(this);">',
  74. '</td>',
  75. '<td style="text-align: center;">',
  76. '<input class="inputText" type="text" name="name" style="width: 95%;" >',
  77. '</td>',
  78. '<td style="text-align: center;">',
  79. '<input class="inputText" type="text" name="url" style="width: 95%;" >',
  80. '</td>',
  81. '<td style="text-align:center;">',
  82. '<a href="javascript:;" class="link del" onclick="singleDell(this);">删除</a>',
  83. '</td>',
  84. '</tr>'];
  85. $("#resourcesUrlItem").append(aryTr.join(""));
  86. $("#notSetURL").remove();
  87. };
  88. function checkDell(){
  89. var trCheckeds=$("#resourcesUrlItem").find(":checkbox[name='resUrlId'][checked]");
  90. $.each(trCheckeds,function(i,c){
  91. var tr=$(c).parents('tr');
  92. $(tr).remove();
  93. });
  94. };
  95. function singleDell(obj){
  96. var tr=$(obj).parents('tr');
  97. $(tr).remove();
  98. };
  99. function setDefaultUrl(obj){
  100. var tr=$(obj).parents('tr');
  101. $("#defaultUrl").val( tr.find(":input[name='url']").val());
  102. };
  103. function autoPingin(obj){
  104. var value=obj.val();
  105. Share.getPingyin({
  106. input:value,
  107. postCallback:function(data){
  108. $("#alias").val(data.output);
  109. }
  110. });
  111. }
  112. </script>
  113. </head>
  114. <body>
  115. <form id="resourcesForm" method="post" action="save.ht">
  116. <div class="panel">
  117. <div class="panel-top">
  118. <div class="tbar-title">
  119. <span class="tbar-label">
  120. <c:if test="${resources.resId==null }">添加子系统资源</c:if>
  121. <c:if test="${resources.resId!=null }">编辑子系统资源</c:if>
  122. </span>
  123. </div>
  124. <div class="panel-toolbar">
  125. <div class="toolBar">
  126. <div class="group"><a class="link save" id="dataFormSave" href="javascript:;"><span></span>保存</a></div>
  127. <div class="l-bar-separator"></div>
  128. </div>
  129. </div>
  130. </div>
  131. <div class="panel-body">
  132. <table id="resourcesTable" class="table-detail" cellpadding="0" cellspacing="0" border="0">
  133. <tr>
  134. <th width="20%">资源名称: <span class="required">*</span></th>
  135. <td><input type="text" id="resName" name="resName" value="${resources.resName}" class="inputText longInputText"/></td>
  136. </tr>
  137. <tr>
  138. <th width="20%">资源别名: </th>
  139. <td><input type="text" id="alias" name="alias" value="${resources.alias}" class="inputText longInputText"/></td>
  140. </tr>
  141. <tr>
  142. <th width="20%">资源图标: </th>
  143. <td>
  144. <input type="hidden" id="icon" name="icon" value="${resources.icon}" class="inputText"/>
  145. <img id="iconImg" alt="" src="${resources.icon}" <c:if test="${resources.icon==null}">style="display:none;"</c:if>>
  146. <a class="link detail" href="javascript:selectIcon();">选择</a>
  147. </td>
  148. </tr>
  149. <tr>
  150. <th width="20%">默认地址: </th>
  151. <td><input type="text" id="defaultUrl" name="defaultUrl" style="width:400px" value="${resources.defaultUrl}" class="inputText"/>
  152. </tr>
  153. <tr>
  154. <th width="20%">是否有子节点: </th>
  155. <td>
  156. <select id="isFolder" name="isFolder">
  157. <option value="0" <c:if test="${resources.isFolder==0}">selected="selected"</c:if>>否</option>
  158. <option value="1" <c:if test="${resources.isFolder==1}">selected="selected"</c:if>>是</option>
  159. </select>
  160. </td>
  161. </tr>
  162. <tr>
  163. <th width="20%">显示到菜单: </th>
  164. <td>
  165. <select id="isDisplayInMenu" name="isDisplayInMenu">
  166. <option value="0" <c:if test="${resources.isDisplayInMenu==0}">selected="selected"</c:if>>否</option>
  167. <option value="1" <c:if test="${resources.isDisplayInMenu==1}">selected="selected"</c:if>>是</option>
  168. </select>
  169. </td>
  170. </tr>
  171. <tr>
  172. <th width="20%">默认打开: </th>
  173. <td>
  174. <select id="isOpen" name="isOpen">
  175. <option value="0" <c:if test="${resources.isOpen==0}">selected="selected"</c:if>>否</option>
  176. <option value="1" <c:if test="${resources.isOpen==1}">selected="selected"</c:if>>是</option>
  177. </select>
  178. </td>
  179. </tr>
  180. <tr>
  181. <th width="20%">是否打开新窗口: </th>
  182. <td>
  183. <select id="isNewOpen" name="isNewOpen">
  184. <option value="0" <c:if test="${resources.isNewOpen==0}">selected="selected"</c:if>>否</option>
  185. <option value="1" <c:if test="${resources.isNewOpen==1}">selected="selected"</c:if>>是</option>
  186. </select>
  187. </td>
  188. </tr>
  189. <tr>
  190. <th width="20%">同级排序: </th>
  191. <td><input type="text" id="sn" name="sn" value="${resources.sn}" class="inputText"/></td>
  192. </tr>
  193. <tr style="display: none;">
  194. <th width="20%">父ID: </th>
  195. <td><input type="text" id="parentId" name="parentId" value="${resources.parentId}" class="inputText"/></td>
  196. </tr>
  197. <tr style="display: none;">
  198. <th width="20%">systemId: </th>
  199. <td><input type="text" id="systemId" name="systemId" value="${resources.systemId}" class="inputText"/></td>
  200. </tr>
  201. </table>
  202. <input type="hidden" id="resId" name="resId" value="${resources.resId}" />
  203. <input type="hidden" id="returnUrl" value="${returnUrl}" />
  204. </div>
  205. <c:if test="${resources.isFolder==0 && resources.resId!=null}">
  206. <div class="panel-top">
  207. <div class="tbar-title">
  208. <span class="tbar-label">资源URL</span>
  209. </div>
  210. <div class="panel-toolbar">
  211. <div class="toolBar">
  212. <div class="group"><a onclick="add();" class="link add"><span></span>添加</a></div>
  213. </div>
  214. </div>
  215. </div>
  216. <div class="panel-body">
  217. <table id="resourcesUrlItem" class="table-grid table-list" id="0" cellpadding="1" cellspacing="1">
  218. <tr>
  219. <th width="10%">默认URL</th>
  220. <th width="30%">名称</th>
  221. <th width="50%">URL</th>
  222. <th width="10%" style="text-align: center;">管理</th>
  223. </tr>
  224. <tbody>
  225. <c:forEach items="${resourcesUrlList}" var="resourcesUrlItem">
  226. <tr>
  227. <td style="text-align: center;">
  228. <input name="chDefaultUrl" type="radio" <c:if test="${resourcesUrlItem.url==resources.defaultUrl}">checked="checked"</c:if> onclick="setDefaultUrl(this);">
  229. </td>
  230. <td style="text-align: center;">
  231. <input class="inputText" type="text" name="name" style="width: 95%;" value="${resourcesUrlItem.name}">
  232. </td>
  233. <td style="text-align: center;">
  234. <input class="inputText" type="text" name="url" style="width: 95%;" value="${resourcesUrlItem.url}" >
  235. </td>
  236. <td style="text-align: center;">
  237. <a href="javascript:;" class="link del" onclick="singleDell(this);">删除</a>
  238. </td>
  239. </tr>
  240. </c:forEach>
  241. </tbody>
  242. </table>
  243. <c:if test="${resourcesUrlList=='[]'}">
  244. <div id="notSetURL" width="90%">
  245. 当前没有设置资源URL
  246. </div>
  247. </c:if>
  248. </div>
  249. </c:if>
  250. </div>
  251. </form>
  252. </body>
  253. </html>