co_add_step2.htm
15.1 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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<script language="javascript" type="text/javascript" src="js/co.js"></script>
<title>新增采集节点</title>
<link href="css/base.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {
color: #660000;
font-weight: bold;
}
.adline {
border-bottom:1px solid #cdcdcd;
}
.autotb td{
padding-left:3px;
}
-->
</style>
</head>
<body>
<div class="bodytitle" style="width:98%">
<div class="bodytitleleft"></div>
<div class="bodytitletxt" style="padding-left:10px;"><b>新增采集节点:第二步设置内容字段获取规则</b></div>
</div>
<form name="form1" method="post" action="co_add.php">
<input type='hidden' name='nid' value='<?php echo $nid; ?>' />
<input type='hidden' name='channelid' value='<?php echo $channelid; ?>' />
<input type='hidden' name='step' value='5' />
<table width="98%" border="0" cellpadding="3" cellspacing="1" bgcolor="#D6D6D6" align="center">
<tr>
<td background="images/tbg.gif" bgcolor="#F2F6E5">
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr class="top" onClick="showHide('sart');" style="cursor:pointer">
<td width="26" align="center"><img src="images/file_tt.gif" width="7" height="8"></td>
<td width="374"><b>网页内容获取规则</b></td>
</tr>
</table>
</td>
</tr>
<tr id="sart">
<td height="113" valign="top" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr id='achelp' style="display:none">
<td height="60" colspan="3">1、匹配规则:在匹配区域规则中,规则一般为“<font color="#FF0000">起始无重复HTML</font><span class="STYLE1">[内容]</span><font color="#FF0000">结尾无重复HTML</font>”(普通匹配,非正则)。<br/>
2、字段值:如果指定的字段没有指定区域匹配规则,用这个值作为默认值。<br />
3、过滤规则:如果有多个规则,用<br /><font color='#6B7360'>
{dede:trim replace=""}规则一{/dede:trim}<br />
{dede:trim replace=""}规则二{/dede:trim}<br />
...</font>表示,如果要替换成指定的值,在 replace=""里设置即可
</td>
</tr>
<tr>
<td height="35">预览网址:</td>
<td><input type="text" name="previewurl" id="previewurl" style="width:90%" value="<?php echo $previewurl; ?>" /></td>
<td> </td>
</tr>
<tr>
<td width="18%" height="60"><a href="#" onclick="showHide('achelp')"><img src="images/help.gif" width="16" height="16" /></a>内容分页导航所在的区域匹配规则:<br/></td>
<td><textarea name="sppage" rows="3" id="sppage" style="width:90%"></textarea></td>
<td width="37%">
<input name="sptype" type="radio" value="full" class="np" checked='1' />
全部列出的分页列表<br/>
<input type="radio" name="sptype" class="np" value="next" />
上下页形式或不完整的分页列表
<br />
<input type="radio" name="sptype" class="np" value="diyrule"/>
分页列表规则 开始:
<input name="srul" type="text" value="1" size="4" />
结束:
<input name="erul" type="text" value="5" size="4" />
</td>
</tr>
<tr>
<td height="35" colspan="3" bgcolor="#FBFCE2" id="dyrule">如果设定分页列表规则.可采用地址规则(正则),其中{p}是递增变量,从1开始每次增加1,例如:{path}{file}_{p}{ext}<br />
<strong>规则说明:{path}</strong>地址+目录 <strong>{file}</strong>文件 <strong>{ext}</strong>文件扩展名<strong>{p}</strong>分页列表数</td>
</tr>
<tr>
<td height="24" colspan="3" bgcolor="#F9FCEF">
<strong>以下为固定的采集项目:</strong>(项目点击可展开/隐藏,内容摘要、关键字、缩略图系统会用正则进行自动匹配)
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="50%" valign="top">
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="24">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%" height="80">关键字过滤内容:</td>
<td height="20" colspan="2">
<textarea name="keywordtrim" rows="4" id="keywordtrim" style="width:90%"></textarea>
</td>
</tr>
</table></td>
</tr>
</table>
</td>
<td valign="top">
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="24">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%" height="80">摘要过滤内容:</td>
<td height="20" colspan="2">
<textarea name="descriptiontrim" rows="4" id="descriptiontrim" style="width:90%"></textarea>
</td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="50%" valign="top">
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#F9FCEF">
<td height="24" class="adline"> <a href="#" onclick="showHide('ttitle')"><b><u>文章标题</u></b></a></td>
</tr>
<tr>
<td height="24" id="ttitle">
<input type='checkbox' name='fields[]' checked='1' value='title' style='display:none' />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%" height="80">匹配规则:</td>
<td height="20" colspan="2">
<textarea name="match_title" rows="4" id="match_title" style="width:90%"><title>[内容]</title></textarea>
</td>
</tr>
<tr>
<td height="63">过滤规则:</td>
<td width="53%" height="63"><textarea name="trim_title" cols="20" rows="3" id="trim_title" style="width:90%"></textarea> </td>
<td height="63"><input type="button" name="button" id="button" value="常用规则" onclick="selTrim('trim_title')" /> </td>
</tr>
</table></td>
</tr>
</table>
</td>
<td valign="top">
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#F9FCEF">
<td height="24" class="adline"> <a href="#" onclick="showHide('twriter')"><b><u>文章作者</u></b></a> </td>
</tr>
<tr id="twriter">
<td height="24">
<input type='checkbox' name='fields[]' checked='1' value='writer' style='display:none' />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%" height="80">匹配规则:</td>
<td height="20" colspan="2"><textarea name="match_writer" rows="4" id="match_writer" style="width:90%"></textarea>
</td>
</tr>
<tr>
<td height="63">过滤规则:</td>
<td width="53%" height="63"><textarea name="trim_writer" cols="20" rows="3" id="trim_writer" style="width:90%"></textarea>
</td>
<td width="29%" height="63"><input type="button" name="button2" id="button2" value="常用规则" onclick="selTrim('trim_writer')" />
</td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#EBEFD1">
<td height="24" bgcolor="#F0F7D9" class="adline"> <a href="#" onclick="showHide('tsource')"><b><u>文章来源</u></b></a> </td>
</tr>
<tr id="tsource">
<td height="24">
<input type='checkbox' name='fields[]' checked='1' value='source' style='display:none' />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%" height="80">匹配规则:</td>
<td height="20" colspan="2"><textarea name="match_source" rows="4" id="match_source" style="width:90%"></textarea>
</td>
</tr>
<tr>
<td height="63">过滤规则:</td>
<td width="53%" height="63"><textarea name="trim_source" cols="20" rows="3" id="trim_source" style="width:90%"></textarea>
</td>
<td height="63"><input type="button" name="button4" id="button4" value="常用规则" onclick="selTrim('trim_source')" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td valign="top">
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#F9FCEF">
<td height="24" class="adline"> <a href="#" onclick="showHide('tpubdate')"><b><u>发布时间</u></b></a> </td>
</tr>
<tr id="tpubdate">
<td height="24">
<input type='checkbox' name='fields[]' checked='1' value='pubdate' style='display:none' />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%" height="80">匹配规则:</td>
<td height="20" colspan="2"><textarea name="match_pubdate" rows="4" id="match_pubdate" style="width:90%"></textarea>
</td>
</tr>
<tr>
<td height="63">过滤规则:</td>
<td width="53%" height="63"><textarea name="trim_pubdate" cols="20" rows="3" id="trim_pubdate" style="width:90%"></textarea>
</td>
<td width="29%" height="63"><input type="button" name="button3" id="button3" value="常用规则" onclick="selTrim('trim_pubdate')" />
</td>
</tr>
</table>
<input name="function_pubdate" type="hidden" id="function_pubdate" value="@me=GetMkTime(@me);" />
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- 固定项目结束,下面为自动项目 -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="55%" height="24" colspan="3" bgcolor="#FBFCE2">
<strong>以下是针对模型设置的采集项目:</strong>
</td>
</tr>
</table>
<?php
$row = $dsql->GetOne("Select * From `#@__channeltype` where id='$channelid' ");
$dtp = new DedeTagParse();
$dtp->SetNameSpace('field','<','>');
$dtp->LoadString($row['fieldset']);
foreach($dtp->CTags as $ctag)
{
//采集禁用的字段
$notsend = $ctag->GetAtt('notsend');
if($notsend==1) continue;
$fieldtype = $ctag->GetAtt('type');
$tname = $ctag->GetTagName();
$iname = $ctag->GetAtt('itemname');
//设置转换函数
if($fieldtype=='img') $functions = "@me=TurnImageTag(@me);";
else if($fieldtype=='softlinks'||$fieldtype=='addon') $functions = "@me=TurnLinkTag(@me);";
else if($fieldtype=='dtime') $functions = "@me=GetMkTime(@me);";
else $functions = '';
//对不同类型设置默认值
if($ctag->GetAtt('default')!='') {
$dfvalue = $ctag->GetAtt('default');
}
else if($fieldtype=='int'||$fieldtype=='float'||$fieldtype=='number') {
$dfvalue = '0';
}
else if($fieldtype=='dtime') {
$dfvalue = time();
}
else {
$dfvalue = '';
}
?>
<input type='checkbox' name='fields[]' checked='1' value='<?php echo $tname; ?>' style='display:none' />
<table width="99%" border="0" cellspacing="0" cellpadding="0" class='autotb' style="margin-top:2px">
<tr bgcolor="#F9FCEF">
<td width="18%" height="24" class="adline">
<a href="#" onclick="showHide('t<?php echo $tname; ?>')"><b><u><?php echo $iname; ?></u></b></a>
</td>
<td width="12%" class="adline"> </td>
<td width="10%" class="adline"><strong>字段默认值:</strong></td>
<td class="adline">
<input name="value_<?php echo $tname; ?>" type="text" id="value_<?php echo $tname; ?>" value="<?php echo $dfvalue; ?>" size="25" style="width:250px" />
</td>
</tr>
<tr id="t<?php echo $tname; ?>">
<td height="24" colspan="4">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="16%" height="80">匹配规则:</td>
<td height="20">
<textarea name="match_<?php echo $tname; ?>" rows="4" id="match_<?php echo $tname; ?>" style="width:90%"></textarea>
</td>
<td height="20">
<?php
if($fieldtype=='htmltext' || $fieldtype=='img')
{
?>
<input name="isunit_<?php echo $tname; ?>" type="checkbox" id="isunit_<?php echo $tname; ?>" value="1" class="np" checked='checked' />
分页内容字段(规则中只允许单一的该类型字段)<br/>
<input name="isdown_<?php echo $tname; ?>" type="checkbox" id="isdown_<?php echo $tname; ?>" value="1" class="np" checked='checked' />
下载字段里的多媒体资源
<?php
}
?>
</td>
</tr>
<tr>
<td height="63">过滤规则:</td>
<td height="63">
<textarea name="trim_<?php echo $tname; ?>" cols="20" rows="3" id="trim_<?php echo $tname; ?>" style="width:90%"></textarea>
</td>
<td height="63">
<input type="button" name="button<?php echo $tname; ?>" id="button<?php echo $tname; ?>" value="常用规则" onclick="selTrim('trim_<?php echo $tname; ?>')" />
</td>
</tr>
<tr>
<td width="18%" height="60">自定义处理接口:</td>
<td width="52%" height="20">
<textarea name="function_<?php echo $tname; ?>" cols="20" rows="3" id="function_<?php echo $tname; ?>" style="width:90%"><?php
echo $functions;
?></textarea>
</td>
<td width="30%" height="20">
函数或程序的变量<br />
@body 表示原始网页 @litpic 缩略图<br />
@me 表示当前标记值和最终结果
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php } ?>
</td>
</tr>
<tr>
<td height="52" align="center" bgcolor="#FFFFFF">
<input type="submit" name="b12" value="保存配置并预览" class="coolbg" style="width:150px" />
</td>
</tr>
</table>
</form>
</body>
</html>