MapModelType.jsp
11.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/systeminfo/init_wev8.jsp"%>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs2" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="cmutil" class="weaver.km.util.CommonTransUtil" scope="page" />
<%
String mapId = Util.convertInput2DB(request.getParameter("mapId"));
String docmodecontents = "";
if(!"".equals(mapId)){
rs.executeSql("select docmodecontents from KT_Map where id="+mapId);
if(rs.next()){
docmodecontents = Util.toHtmlMode(rs.getString("docmodecontents"));
}
}
//设置知识百科模版的说明
String example = "<p style=\"text-align: center;\"> "+
" <span style=\"font-size: 24px;\">知识百科模式使用说明</span> "+
"</p> "+
"<h1 style=\"text-align: left;\"> "+
" <span style=\"font-family: 微软雅黑, \" microsoft=\"\" font-size:=\"\">标题1</span> "+
"</h1> "+
"<h2 style=\"text-align: left;\"> "+
" <span style=\"font-family: 微软雅黑, \" microsoft=\"\" font-size:=\"\"> 标题1.1<br/></span> "+
"</h2> "+
"<h2 style=\"text-align: left;\"> "+
" <span style=\"font-family: 微软雅黑, \" microsoft=\"\" font-size:=\"\"> 标题1.2</span> "+
"</h2> "+
"<h1 style=\"white-space: normal; text-align: left;\"> "+
" <span style=\"font-family: 微软雅黑, \" microsoft=\"\" font-size:=\"\">标题2</span> "+
"</h1> "+
"<h2 style=\"white-space: normal; text-align: left;\"> "+
" <span style=\"font-family: 微软雅黑, \" microsoft=\"\" font-size:=\"\"> 标题2.1<br/></span> "+
"</h2> "+
"<h2 style=\"white-space: normal; text-align: left;\"> "+
" <span style=\"font-family: 微软雅黑, \" microsoft=\"\" font-size:=\"\"> 标题2.2</span> "+
"</h2> "+
"<p> "+
" <span style=\"font-family: 微软雅黑, \" microsoft=\"\" font-size:=\"\"> <span style=\"font-size: 24px;\">选中内容后设置标题,左侧可以出现文档树形结构</span><br/></span> "+
"</p> ";
docmodecontents = docmodecontents.equals("")?example:docmodecontents;
docmodecontents = docmodecontents.replaceAll("\n", "<br>");
boolean isDocMode = false;
%>
<HTML>
<HEAD>
<title></title>
<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
<SCRIPT language="javascript" src="/knowledgeMap/js/common.js"></script>
<SCRIPT language="javascript" src="/js/weaver_wev8.js"></script>
<script language="JavaScript" src="/js/addRowBg_wev8.js"></script>
<script type="text/javascript" src="/wui/common/js/ckeditor/ckeditor_wev8.js"></script>
<script type="text/javascript" src="/wui/common/js/ckeditor/ckeditorext_wev8.js"></script>
<script type="text/javascript" src="../js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="../js/ueditor/ueditor.all.js"></script>
<script type="text/javascript" src="../js/ueditor/ueditor.parse.js"></script>
<script type="text/javascript" src="../js/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="/wui/theme/ecology8/page/perfect-scrollbar/perfect-scrollbar_wev8.js"></script>
<script type="text/javascript" src="/wui/theme/ecology8/page/perfect-scrollbar/jquery.mousewheel_wev8.js"></script>
<script src="/js/tabs/jquery.tabs.extend_wev8.js"></script>
<link type="text/css" href="/js/tabs/css/e8tabs1_wev8.css" rel="stylesheet" />
<link type="text/css" href="/knowledgeMap/css/rightmenu.css" rel="stylesheet" />
<SCRIPT language="javascript" src="/knowledgeMap/js/rightmenu.js"></script>
<style type="text/css">
Table.detail td{
line-height: 25px;
padding: 1px !important;
}
.addKnowCls{
width: 60px;
background: #F5EAFA;
height: 25px;
text-align: center;
line-height: 25px;
font-size: 12px;
cursor: pointer;
display: inline-block;
margin-right: 5px;
float: left;
border-radius: 4px;
}
.addKnowCls:hover{
background:#F5CAFA;
}
.ListStyle th{
padding-left: 12px;
}
TABLE.ListStyle tr {
border-bottom: 1px solid #E0E0E0;
}
.kt_moveUp{
cursor: pointer;
margin-left: 5px;
transform: rotateX(180deg);
display: none;
}
.kt_moveDown{
cursor: pointer;
margin-left: 5px;
display: none;
}
/**知识百科模式css样式**/
#directionContainer ul {
margin: 0px;
padding: 0px 0px 0px 20px;
}
.main {
width: 100%;
min-height: 500px;
margin-top: 5px;
}
.left {
width: 270px;
height: 50px;
float: left;
}
.right {
max-width: 78%;
float: left;
}
#directionWrapper {
padding: 15px 7px;
border: 1px solid #CCC;
margin-right: 14px;
width: 240px;
}
.directionTitle {
font-weight: bold;
font-size: 14px;
padding-bottom: 3px;
border-bottom: 1px dashed #ccc;
}
.sectionItem {
height: 22px;
line-height: 22px;
}
.sectionItem span {
*zoom: 1;
display: inline-block;
}
.selectIcon,.deleteIcon,.moveUp,.moveDown {
float: right;
color: red;
font-size: 0px;
line-height: 20px;
height: 20px;
text-align: center;
cursor: pointer;
}
.selectIcon,.moveUp,.moveDown {
width: 14px;
font-size: 10px;
}
.selectIcon:hover,.moveUp:hover,.moveDown:hover {
text-decoration: underline;
}
.deleteIcon {
width: 20px;
margin-left: 3px;
background: url('/knowledgeMap/js/ueditor/themes/default/images/icons-all.gif') 0 -89px;
}
.fixTop {
position: fixed;
top: -1px;
}
.btn {
width: 30px;
height: 30px;
line-height: 30px;
margin-left: 820px;
border: 1px #ccc solid;
border-radius: 50%;
color: #fff;
background-color: #2a7ee7;
cursor: pointer;
font-size: 12px;
text-align: center;
display: inline-block;
}
.edui-editor-toolbarbox,.edui-editor {
width: 100%;
}
div.edui-editor-iframeholder {
width: 100% !important;
}
/**知识百科模式css样式**/
</style>
</head>
<BODY>
<table width=100% border="0" cellspacing="0" cellpadding="0">
<colgroup>
<col width="10">
<col width="">
<col width="10">
</colgroup>
<tr>
<td height="10" colspan="3"></td>
</tr>
<tr>
<td></td>
<td valign="top">
<TABLE class=Shadow>
<tr>
<td valign="top">
<input class=inputstyle type="hidden" name=mapId value="<%=mapId %>"/>
<textarea id="contents" name="contents" rows="0" cols="0" style="display: none;"></textarea>
<TABLE class=ViewForm>
<TBODY>
<!-- 知识地图主题开始 -->
<TR>
<TD vAlign=top>
<div id="docMode">
<div class="main">
<div class="left">
<div id="directionWrapper">
<div class="directionTitle">目录:</div>
<div id="directionContainer"></div>
</div>
</div>
<div class="right">
<div id="editor" type="text/plain" style="height: 500px;"></div>
</div>
<div style="clear:both;"></div>
</div>
</div>
</div>
</TD>
</TR>
<!-- 知识地图主题结束 -->
</TBODY>
</TABLE>
</td>
</tr>
</TABLE>
</td>
<td></td>
</tr>
<tr>
<td height="10" colspan="3"></td>
</tr>
</table>
<div id="docmodecontents" style="display: none;"><%=docmodecontents %></div>
<script language=javascript>
function saveData(obj) {
return UE.getEditor("editor").getContent();
}
//实例化编辑器
var ue = UE.getEditor('editor');
ue.ready(function() {
ue.addListener('updateSections', resetHandler);
});
var resetHandler = function() {
var dirmap = {}, dir = ue.execCommand('getsections');
// 更新目录树
$('#directionContainer').html(traversal(dir) || null);
// 删除章节按钮
$('.deleteIcon').click(function(e) {
var $target = $(this), address = $target.parent().attr('data-address');
ue.execCommand('deletesection', dirmap[address]);
});
// 选中章节按钮
$('.selectIcon').click(function(e) {
var $target = $(this), address = $target.parent().attr('data-address');
ue.execCommand('selectsection', dirmap[address], true);
});
// 章节上移
$('.moveUp,.moveDown').click(function(e) {
var $target = $(this), address = $target.parent().attr('data-address'),
moveUp = $target.hasClass('moveUp') ? true : false;
if ($target.hasClass('moveUp')) {
ue.execCommand('movesection', dirmap[address], dirmap[address].previousSection);
} else {
ue.execCommand('movesection', dirmap[address], dirmap[address].nextSection, true);
}
});
// 页面网上滚动时,让目录固定在顶部
$(window).scroll(function(e) {
if ($('.left').offset().top < (document.body.scrollTop || document.documentElement.scrollTop)) {
$('#directionWrapper').addClass('fixTop');
} else {
$('#directionWrapper').removeClass('fixTop');
}
});
function traversal(section) {
var $list, $item, $itemContent, child, childList;
if (section.children.length) {
$list = $('<ul>');
for ( var i = 0; i < section.children.length; i++) {
child = section.children[i];
//设置目录节点内容标签
var title = getSubStr(child['title'], 18);
$itemContent = $('<div class="sectionItem"></div>').html($('<span class="itemTitle">' + title + '</span>'));
$itemContent.attr('data-address', child['startAddress'].join(','));
$itemContent.append($('<span class="deleteIcon">删</span>'
+ '<span class="selectIcon">选</span>'
+ '<span class="moveUp">↑</span>'
+ '<span class="moveDown">↓</span>'));
dirmap[child['startAddress'].join(',')] = child;
//设置目录节点容器标签
$item = $('<li>');
$item.append($itemContent);
//继续遍历子节点
if ($item.children.length) {
childList = traversal(child);
childList && $item.append(childList);
}
$list.append($item);
}
}
return $list;
}
}
function getSubStr(s, l) {
var i = 0, len = 0;
for (i; i < s.length; i++) {
if (s.charAt(i).match(/[^\x00-\xff]/g) != null) {
len += 2;
} else {
len++;
}
if (len > l) {
break;
}
}
return s.substr(0, i);
};
$(document).ready(function(){
jQuery(".right").width(jQuery(window).width()-jQuery(".left").width()-80);
uParse('#editor',{
'liiconpath':'/knowledgeMap/js/ueditor/themes/ueditor-list/' //使用 '/' 开头的绝对路径
})
//编辑器初始化设置内容
UE.getEditor("editor").ready(function() {
UE.getEditor("editor").setContent(jQuery("#docmodecontents").html());
});
jQuery("#directionWrapper").height(jQuery(window).height()*0.9);
$("#directionWrapper").perfectScrollbar();
jQuery(window).resize(function(){
jQuery(".right").width(jQuery(window).width()-jQuery(".left").width()-80);
jQuery("#edui1").width(jQuery("#editor").width());
});
});
</script>
</BODY>
</HTML>