📄 正在查看:admin/view/default/article_set.htm
大小:6,946 字节 · 修改:2014-01-24 01:15:24 · 行数:192
1{inc:header.htm}
2<div class="m">
3 <div class="p">
4 <form id="article_set" action="index.php?u=article-{$_GET['action']}-ajax-1" method="post">
5 <input name="id" type="hidden" value="{$data[id]}" />
6 <input name="color" type="hidden" value="{$data[color]}" />
7 <input name="seo_title" type="hidden" value="{$data[seo_title]}" />
8 <div class="cc contadd">
9 <table><tr valign="top">
10 <td><table class="tb tl">
11 <tr>
12 <th class="th"><div style="width:65px"><b>*</b>分类</div></th>
13 <td class="col">
14 {$cidhtml}
15 </td>
16 </tr>
17 <tr>
18 <th class="th"><b>*</b>标题</th>
19 <td class="col"><input name="title" type="text" value="{$data[title]}" class="inp w98" /></td>
20 </tr>
21 <tr>
22 <th class="th"><b>*</b>内容</th>
23 <td class="col">
24 <textarea id="content" class="inp w98" name="content" style="height:80px">{$data[content]}</textarea>
25 <div class="addition">
26 <label title="远程抓取图片比较消耗服务器资源,影响发布速度">
27 <input name="isremote" type="checkbox" value="1"> 远程图片本地化
28 </label>
29 </div>
30 </td>
31 </tr>
32 <tr>
33 <th class="th">别名</th>
34 <td class="col"><input name="alias" type="text" value="{$data[alias]}" class="inp w1" /></td>
35 </tr>
36 <tr>
37 <th class="th">标签</th>
38 <td class="col"><input name="tags" type="text" value="{$data[tags]}" class="inp w1" /></td>
39 </tr>
40 <tr>
41 <th class="th">摘要</th>
42 <td class="col">
43 <textarea name="intro" class="inp w98" style="height:60px" titile="如果不填,程序自动生成摘要" maxlength="255">{$data[intro]}</textarea>
44 </td>
45 </tr>
46 <tr>
47 <th class="th"></th>
48 <td class="col"><input type="submit" value="&#20445;&#23384;" class="but1" style="margin:0" /></td>
49 </tr>
50 </table></td>
51 <td width="398"><table class="tb">
52 <tr>
53 <th class="th"><div style="width:90px">缩略图</div></th>
54 <td class="col">
55 <input id="tw_pic_val" name="pic" type="hidden" value="{$data[pic]}" />
56 <div class="picimg"><img id="tw_pic_img" src="{$data[pic_src]}" /></div>
57 <div class="picbut"><a id="tw_pic_but" class="but3" href="javascript:;">上传缩略图</a></div>
58 </td>
59 </tr>
60 <tr>
61 <th class="th">属性</th>
62 <td class="col">
63 <label><input class="mr3" name="flag[]" type="checkbox" value="1"{if:in_array(1,$data[flags])} checked{/if}>推荐</label>
64 <label><input class="mr3" name="flag[]" type="checkbox" value="2"{if:in_array(2,$data[flags])} checked{/if}>热点</label>
65 <label><input class="mr3" name="flag[]" type="checkbox" value="3"{if:in_array(3,$data[flags])} checked{/if}>头条</label>
66 <label><input class="mr3" name="flag[]" type="checkbox" value="4"{if:in_array(4,$data[flags])} checked{/if}>精选</label>
67 <label><input class="mr3" name="flag[]" type="checkbox" value="5"{if:in_array(5,$data[flags])} checked{/if}>幻灯</label>
68 </td>
69 </tr>
70 <tr>
71 <th class="th">作者</th>
72 <td class="col"><input name="author" type="text" value="{$data[author]}" class="inp w1" /></td>
73 </tr>
74 <tr>
75 <th class="th">来源</th>
76 <td class="col"><input name="source" type="text" value="{$data[source]}" class="inp w1" /></td>
77 </tr>
78 {if:$_GET['action'] == 'edit'}
79 <tr>
80 <th class="th">发布时间</th>
81 <td class="col"><input name="dateline" type="text" value="{$data[dateline]}" class="inp w1" /></td>
82 </tr>
83 {/if}
84 <tr>
85 <th class="th">浏览次数</th>
86 <td class="col"><input name="views" type="text" value="{$data[views]}" class="inp w1" /></td>
87 </tr>
88 <tr>
89 <th class="th">禁止评论</th>
90 <td class="col"><input name="iscomment" type="checkbox" value="1"{if:!empty($data['iscomment'])} checked="checked"{/if}></td>
91 </tr>
92 <tr>
93 <th class="th">SEO关键字</th>
94 <td class="col"><input name="seo_keywords" type="text" value="{$data[seo_keywords]}" class="inp w1" /></td>
95 </tr>
96 <tr>
97 <th class="th">SEO描述</th>
98 <td class="col"><input name="seo_description" type="text" value="{$data[seo_description]}" class="inp w1" /></td>
99 </tr>
100 </table></td>
101 </tr></table>
102 </div>
103 </form>
104 </div>
105</div>
106
107<iframe name="tw_upifr" style="display:none"></iframe>
108<form id="tw_pic_upform" target="tw_upifr" method="post" enctype="multipart/form-data" action="index.php?u=attach-upload_image&type=pic{$edit_cid_id}">
109 <input id="tw_pic_upfile" type="file" name="upfile" accept="image/jpg,image/jpeg,image/png,image/gif" />
110</form>
111<form id="tw_img_upform" target="tw_upifr" method="post" enctype="multipart/form-data" action="index.php?u=attach-upload_image&type=img{$edit_cid_id}">
112 <input id="tw_img_upfile" type="file" name="upfile" accept="image/jpg,image/jpeg,image/png,image/gif" multiple="multiple" />
113</form>
114
115<script type="text/javascript">
116// 编辑器API
117window.editor_api = {
118 // 内容
119 content : {
120 obj : $('#content'),
121 get : function() {
122 return this.obj.val();
123 },
124 set : function(s) {
125 return this.obj.val(s);
126 },
127 focus : function() {
128 return this.obj.focus();
129 }
130 }
131}
132
133// 自动保存
134var action = "{$_GET['action']}";
135window.autoSave = function() {
136 if(action != "add") return;
137 var data = $("#article_set").serialize();
138 twAjax.post("index.php?u=article-auto_save-ajax-1", data, function(html) { });
139};
140
141// 传统上传缩略图
142document.getElementById("tw_pic_upfile").onchange = function() {
143 document.getElementById("tw_pic_upform").submit();
144};
145
146// 设置显示缩略图 (iframe使用)
147function setDisplayPic(path, thumb) {
148 $("#tw_pic_val").val(thumb);
149 $("#tw_pic_img").attr("src", "../"+thumb);
150 autoSave();
151}
152
153// 定位缩略图上传按钮
154function setPicBut() {
155 var obj = $("#tw_pic_but"),
156 p = obj.position(),
157 w = obj.outerWidth(true),
158 h = obj.outerHeight(true),
159 r = $(document).width() - w - p.left;
160 $("#tw_pic_upfile").hover(function(){
161 obj.addClass("but_on");
162 }, function(){
163 obj.removeClass("but_on");
164 }).show().css({"position":"absolute", "top":p.top, "right":r, "width":w, "height":h});
165}
166
167setPicBut();
168
169// 触发自动保存
170$("#article_set input, #article_set textarea, #article_set select").change(autoSave);
171
172// 提交表单
173twAjax.submit("#article_set", function(data){
174 twAjax.alert(data);
175 if(window.twData.err==0) {
176 setTimeout(function(){
177 var i = P("#box_tab ul li[urlKey='article-index']").index();
178 if(i != -1) parent.ifrRefresh(i);
179 parent.oneTab("article-index");
180
181 var j = P("#box_tab ul li[urlKey='"+urlKey+"']").index();
182 parent.rmTab(j);
183 }, 1200);
184 }
185});
186</script>
187
188{hook:admin_content_add_after.htm}
189
190</body>
191</html>
192