input.jsp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <%@page language="java" pageEncoding="UTF-8" %>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <title></title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <%@include file="/commons/include/form.jsp" %>
  8. <link rel="stylesheet" type="text/css" href="../input.css">
  9. <link rel="stylesheet" type="text/css" href="${ctx}/styles/default/css/form.css">
  10. <script type="text/javascript" src="${ctx}/js/ueditor2/dialogs/internal.js"></script>
  11. <style type="text/css">
  12. body{
  13. overflow:hidden;
  14. }
  15. a.extend{
  16. display:inline;
  17. }
  18. </style>
  19. <script type="text/javascript">
  20. var _element;
  21. $(".button-td").bind("mouseenter mouseleave",function(){
  22. $(this).toggleClass("button-td-hover");
  23. });
  24. $(function() {
  25. _element = null;
  26. _element = editor.curInput;
  27. if (_element) {
  28. bindData();
  29. }
  30. });
  31. function openIconDialog() {
  32. var url= __ctx+"/js/ueditor2/dialogs/extend/input/icons.jsp";
  33. var dialogWidth=500;
  34. var dialogHeight=400;
  35. conf=$.extend({},{dialogWidth:dialogWidth ,dialogHeight:dialogHeight ,help:0,status:0,scroll:0,center:1});
  36. var winArgs="dialogWidth="+conf.dialogWidth+"px;dialogHeight="+conf.dialogHeight
  37. +"px;help=" + conf.help +";status=" + conf.status +";scroll=" + conf.scroll +";center=" +conf.center;
  38. /* var rtn=window.showModalDialog(url,"",winArgs);
  39. if(rtn!=undefined){
  40. $("#preview-button").attr("class",rtn.cla);
  41. } */
  42. /*KILLDIALOG*/
  43. DialogUtil.open({
  44. height:conf.dialogHeight,
  45. width: conf.dialogWidth,
  46. title : '',
  47. url: url,
  48. isResize: true,
  49. //自定义参数
  50. sucCall:function(rtn){
  51. $("#preview-button").attr("class",rtn.cla);
  52. }
  53. });
  54. };
  55. function bindData() {
  56. var child = _element.childNodes[0];
  57. if (child) {
  58. var cla = $(child).attr("class"), label = $(child).text();
  59. $("#preview-button").attr("class", cla);
  60. $("#a-label").val(label);
  61. }
  62. };
  63. dialog.onok = function() {
  64. var label = $("#a-label").val();
  65. //如果是手机端
  66. if("${param.type}"=='mb'){
  67. var child = utils.parseDomByString('<span class="am-input-group-btn"> <button ht-customerDialog="" class="am-btn am-btn-default" type="button">'+label+'</button></span>');
  68. var start = editor.selection.getStart();
  69. if(!start||!child)return;
  70. if(start.tagName!= "INPUT"){
  71. start.appendChild(utils.parseDomByString('<button ht-customerDialog="[]" class="am-btn am-btn-default" type="button">'+label+'</button>'));
  72. }
  73. else{
  74. var div =$("<div class='am-input-group' type='customerButton'></div>");
  75. start = domUtils.findEditableInput(start);
  76. $(start.parentElement).append(div);
  77. div.append(start);
  78. div.append(child);
  79. }
  80. return;
  81. }
  82. var html = '<span name="editable-input" style="display:inline-block;">';
  83. var cla = $("#preview-button").attr("class");
  84. html += '<a href="javascript:;" ';
  85. if(cla)html+='class="'+cla+'"';
  86. html +='>' + label + '</a>';
  87. html += '</span> ';
  88. if(_element){
  89. editor.curInput.outerHTML=html;
  90. }
  91. else{
  92. var child = utils.parseDomByString(html);
  93. var start = editor.selection.getStart();
  94. if(!start||!child)return;
  95. if(start.tagName=='TD'){
  96. start.appendChild(child);
  97. }
  98. else{
  99. start = domUtils.findEditableInput(start);
  100. utils.insertAfter(child, start);
  101. }
  102. }
  103. };
  104. </script>
  105. </head>
  106. <body>
  107. <div id="inputPanel">
  108. <fieldset class="base">
  109. <legend><var id="lang_button_prop"></var></legend>
  110. <table>
  111. <tr>
  112. <th><var id="lang_button_label"></var>:</th>
  113. <td><input id="a-label" type="text" value="选择"/></td>
  114. </tr>
  115. <c:if test="${empty param.type}">
  116. <tr>
  117. <th><var id="lang_button_img"></var>:</th>
  118. <td>
  119. <a href="javascript:;" id="preview-button"></a>
  120. <div class="button-td" onclick="openIconDialog()">
  121. <var id="lang_choose_img"></var>
  122. </div>
  123. </td>
  124. </tr>
  125. </c:if>
  126. </table>
  127. </fieldset>
  128. </div>
  129. </body>
  130. </html>