editlabel.html 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>选择标签</title>
  6. <script type="text/javascript" src="${ctx}/assets/lib/jquery/1.9.1/jquery.min.js"></script>
  7. <style type="text/css">
  8. ul.ztree {margin-top: 10px;border: 1px solid #617775;background: #f0f6e4;width:220px;height:360px;overflow-y:scroll;overflow-x:auto;}
  9. .bq{font-size:14px;padding:5px 0 5px 30px;font-family: Microsoft YaHei;color:#4d4d4d;}
  10. .lm_lm{margin:10px 10px;}
  11. .lable{margin-right:5px;diaplay:inline;}
  12. </style>
  13. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" >
  14. <script src="${ctx}/assets/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js" type="text/javascript" ></script>
  15. <script type="text/javascript">
  16. var _workbench=$("#workbench",parent.document.body).contents();
  17. var context=_workbench.find("[objid='${objid}']")[0].outerHTML;
  18. var cmstag=_workbench.find("[objid='${objid}']").attr("cmstag");
  19. var labelID1="";
  20. if(cmstag!=null&&cmstag!="undefined"){
  21. labelID1=cmstag.split(":")[0];
  22. }
  23. $(function(){
  24. if(labelID1=="xxlb"||labelID1=="lnlbfy"){
  25. $("#but").css('display','block');
  26. }
  27. document.getElementById("context").value = context;
  28. })
  29. function qd(){
  30. var contextedit=document.getElementById("context").value;
  31. _workbench.find("[objid='${objid}']")[0].outerHTML=contextedit;
  32. window.parent.closeDialog(window.parent.dialogIndex);
  33. }
  34. function getPosition(obj){
  35. var result = 0;
  36. if(obj.selectionStart){ //IE以外
  37. result = obj.selectionStart
  38. }else{ //IE
  39. var rng;
  40. if(obj.tagName == "textarea"){ //TEXTAREA
  41. rng = event.srcElement.createTextRange();
  42. rng.moveToPoint(event.x,event.y);
  43. }else{ //Text
  44. rng = document.selection.createRange();
  45. }
  46. rng.moveStart("character",-event.srcElement.value.length);
  47. result = rng.text.length;
  48. }
  49. return result;
  50. }
  51. function getValue(obj){
  52. if(labelID1=="xxlb"||labelID1=="lnlbfy"){
  53. var pos = getPosition(obj);
  54. var val1=obj.value.substr(0,pos);
  55. var val2=obj.value.substr(pos,obj.value.length);
  56. $("#val1").val(val1);
  57. $("#val2").val(val2);
  58. }
  59. }
  60. function edit(typeVal,name){
  61. var val1=$("#val1").val();
  62. var val2=$("#val2").val();
  63. var val3="";
  64. var f="$";
  65. if(typeVal=="infoURL"){
  66. val3="<a th:herf=\""+f+"{web.getStr('"+typeVal+"')}\" href='#'></a>";
  67. }else{
  68. val3="<span th:utext=\""+f+"{web.getStr('"+typeVal+"')}\" >"+name+"</span>";
  69. }
  70. document.getElementById("context").value = val1+val3+val2;
  71. }
  72. </script>
  73. </head>
  74. <body>
  75. <div><div id="nrmb" style="float:left;width: 80%;"><textarea cols="80" rows="20" name="context" id="context" onclick="getValue(this)"></textarea></div>
  76. <input type="hidden" id="val1">
  77. <input type="hidden" id="val2">
  78. <div style="display:none; " id="but">
  79. <input type="button" value="标题" onclick="edit('listtitle','标题')"><br>
  80. <input type="button" value="副标题" onclick="edit('Subhead','副标题')"><br>
  81. <input type="button" value="作者" onclick="edit('Author','作者')"><br>
  82. <input type="button" value="发布时间" onclick="edit('ReleaseTime','发布时间')"><br>
  83. <input type="button" value="摘要" onclick="edit('InfoSummary','摘要')"><br>
  84. <input type="button" value="文章链接" onclick="edit('infoURL','文章链接')"><br>
  85. </div></div>
  86. <div style="text-align:center;margin-top:40px;"><button id="qd" onclick="qd()" style="background:#4285f4;border-radius:5px;color:#fff;border:none;padding:8px 18px;font-size:13px;margin-right: 10px;">确定</button></div>
  87. </body>
  88. </html>