edit_blog.html
6.66 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
<%
var headContent = {
%>
<% include("/template/bbs/includes/header.html"){} %>
<!-- jquery -->
<% include("/template/includes/jquery.html"){} %>
<% include("/template/includes/ueditor.html"){} %>
<script type="text/javascript">
var ue;
$(document).ready(function(){
ue = UE.getEditor('editor',{
initialFrameHeight:350 //初始化编辑器高度,默认320
,compressSide:1
,imageScaleEnabled:false // 图片不允许拖拽
, toolbars: [[
'source', '|',
'bold', 'italic', 'underline', 'strikethrough', 'insertorderedlist', 'insertunorderedlist', 'paragraph', '|',
'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
'link', 'unlink', '|',
'simpleupload', 'insertimage', 'emotion' , 'insertcode'
]]
});
});
function oper_save(id) {
var folderId = $('[name="model.folder_id"]').val();
if(folderId=='-1') {
Alert('请选择栏目');
return false;
}
var title = $('[name="model.title"]').val();
if(title=='') {
Alert('请输入博文题目');
return false;
}
if(title.length > 80 ) {
Alert('博文('+title.length+'字)题目过长,请输入小于80个字');
return false;
}
if(!ue.hasContents()){
Alert('请输入博文内容');
return false;
}
if(ue.getContentTxt().length > 1200){
Alert('博文('+ue.getContentTxt().length+'字)文字过长,请输入小于1200个字');
return false;
}
var tags = $('#tags_content').val().replace(/,/g, ",");
if(tags!='' && tags.length > 150 ) {
Alert('关键词('+tags.length+'字)过长,请输入小于150个字');
return false;
}
if(tags!='') {
$('[name="tags"]').val(tags);
}
jQuery.ajax({
type:'POST',
url:jflyfox.BASE_PATH + 'front/person/saveblog/'+id,
data:$("form").serialize(),
success:function(data){
if(data.status==1){
alert('发布成功');
form1.action = jflyfox.BASE_PATH + "front/person";
form1.submit();
return true;
} else {
alert('发布失败:'+data.msg);
}
$('[name="old_password"]').val('');
$('[name="new_password"]').val('');
$('[name="new_password2"]').val('');
},
error:function(html){
var flag = (typeof console != 'undefined');
if(flag) console.log("服务器忙,提交数据失败,代码:" +html.status+ ",请联系管理员!");
alert("服务器忙,提交数据失败,请联系管理员!");
}
});
return false;
}
</script>
<%
};
var bodyContent = {
%>
<% include("/template/bbs/includes/header_menu.html"){} %>
<div id="main" style="margin:0 2%;">
<div class="row">
<!-- 文章 -->
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading" style="padding:0px;">
<ol class="breadcrumb" style="margin:0px;">
<li><a href="${BASE_PATH }home.html">首页</a></li>
<li><a href="${BASE_PATH }front/person">我的空间</a></li>
<li>发布博文</li>
</ol>
</div>
<div class="panel-body">
<form class="form-horizontal" name="form1" action="" method="post">
<input type="hidden" name="model.id" class="form-control" id="model.id"
value="${model.id!'0'}">
<div class="form-group">
<label for="model.folder_id" class="col-sm-2 control-label">栏目</label>
<div class="col-sm-10" >
<select class="form-control" name="model.folder_id">
<option value="-1">--请选择栏目--</option>
<% if (!isEmpty(folders)){
for(item in folders["0"]){
if(item.key == 'home' || item.key == 'tags' || item.key == 'advice'){
continue;
}
var childs = folders[item.id+''];
if(isEmpty(childs)) {
%>
<option value="${item.id}" ${item.id==model.folder_id!0?'selected':''} >${item.name}</option>
<%
}else {
%>
<option value="${item.id}" disabled="disabled">${item.name}</option>
<% for(childsItem in childs){ %>
<option value="${childsItem.id}" ${item.id==model.folder_id!0?'selected':''}>|-- ${childsItem.name}</option>
<% } %>
<%
}
}
}
%>
</select>
</div>
</div>
<div class="form-group">
<label for="model.title" class="col-sm-2 control-label">题目</label>
<div class="col-sm-10">
<input name="model.title" class="form-control" id="model.title"
value="${model.title!''}" placeholder="博文题目">
</div>
</div>
<div class="form-group">
<label for="remark" class="col-sm-2 control-label">内容</label>
<div class="col-sm-10">
<script id="editor" type="text/plain" name="model.content"
style="width: 98%; height: 320px;">${model.content!''}</script>
</div>
</div>
<div class="form-group">
<label for="title_url" class="col-sm-2 control-label">关键词</label>
<div class="col-sm-10">
<input name="tags" type="hidden" value="${tags!''}" />
<input name="tags_content" type="text" class="form-control" id="tags_content"
value="${tags!''}" placeholder="关键词">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="button" value="发 布" class="btn btn-primary" onclick="oper_save(${model.id!'0'});"/>
<input type="reset" value="重 置" class="btn btn-default" />
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10" style="color: red;">
1. 博文题目必须填写,并且不能超过80个文字。<br>
2. 博文内容尽量控制在1200个文字内,内容合法健康,否则可能会被删除。<br>
3. 关键词请使用逗号分隔不同标签,最多5个哦,并且不能超过150个文字。 <br>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- 信息列表 -->
<div class="col-md-4">
<!-- 用户信息 -->
<%include("/template/bbs/includes/userinfo.html"){} %>
<!-- 推荐文章 -->
<% include("/template/bbs/includes/recommend.html"){} %>
<!-- 友情链接 -->
<% include("/template/bbs/includes/friendly.html"){} %>
</div>
</div>
</div>
<% include("/template/bbs/includes/footer.html"){} %>
<a id="scrollTop" href="javacript:void(0);" title="返回顶部" style="display: inline;"></a>
<%}; %>
<% layout("/pages/template/_layout.html",{head:headContent,body:bodyContent}){ %>
<%} %>