4.5刚发布我就提供了一次,当时只是简单整合,不过那帖子已经不见了,为了给需要的朋友方便,再次提供出来,这回已经整合了科讯自带的上传系统。
修改办法:
1、amin/ks.model.asp,第767行左右。加入红色部分。
.Write " <tr class='tdbg'>"
.Write " <td class='clefttitle'><div align=""right""><strong>编辑器类型:</strong><br><font color=red>选择您习惯使用的编辑器。</font></div></td>"
.Write " <td height=""30""> <input type=""radio"" name=""EditorType"" value=""0"" "
If EditorType = 0 Then .Write (" checked")
.Write ">"
.Write " KesionCMS自带编辑器"
.Write " <input type=""radio"" name=""EditorType"" value=""2"" "
If EditorType = 2 Then .Write (" checked")
.Write "> eWebeditor"
.Write " <input type=""radio"" name=""EditorType"" value=""1"" "
If EditorType = 1 Then .Write (" checked")
.Write ">"
.Write " FCKEditor </td>"
.Write " </tr>"
2、admin/KS.Article.asp ;1464行左右,加入红色部分,作用:把上传附件插入到编辑器中。
function insertHTMLToEditor(codeStr)
{
oEditor=FCKeditorAPI.GetInstance("content");
if(oEditor && oEditor.EditorWindow){
oEditor.InsertHtml(codeStr);
}
}
function insertHTMLToEditor1(codeStr)
{
eWebEditor1.appendHTML(codeStr);//在内容最后插入
//eWebEditor1.insertHTML(codeStr);//在光标处插入,但不成功,待高手再完善吧。
}
function InsertFileFromUp(FileList,InstallDir)
{
Files=FileList.split("|");
for(var i=0;i<Files.length-1;i++)
{ var ext=getFilePic(Files[i]);
var files=Files[i].split('/');
var file=files[files.length-1];
var br='';
if (i!=Files.length-1) br='<br />';
var str="<img border=0 src="+InstallDir+"KS_Editor/images/FileIcon/"+ext+"> <a href="+Files[i]+" target=_blank>[点击浏览该文件:"+file+"]</a>"+br;
insertHTMLToEditor(str);
}
}
function InsertFileFromUp1(FileList,InstallDir)
{
Files=FileList.split("|");
for(var i=0;i<Files.length-1;i++)
{ var ext=getFilePic(Files[i]);
var files=Files[i].split('/');
var file=files[files.length-1];
var br='';
if (i!=Files.length-1) br='<br />';
var str="<img border=0 src="+InstallDir+"KS_Editor/images/FileIcon/"+ext+"> <a href="+Files[i]+" target=_blank>[点击浏览该文件:"+file+"]</a>"+br;
insertHTMLToEditor1(str);
}
}
3、1641行,作用:不填内容时不给提交
<%If F_B_Arr(4)=1 and F_B_Arr(9)=1 Then%>
<%if KS.C_S(ChannelID,34)=0 Then%>
if (($("Changes").checked==false)&&($F("Content")==""))
{
frames["ArticleContent"].KS_EditArea.focus();
alert("<%=KS.C_S(ChannelID,3)%>内容不能留空!");
return false;
}
<%elseif KS.C_S(ChannelID,34)=1 then%>
if (($("Changes").checked==false)&&(FCKeditorAPI.GetInstance('content').GetXHTML(true)==""))
{
alert("<%=KS.C_S(ChannelID,3)%>内容不能留空!");
return false;
}
<%else '用ewebeditor编辑器%>
var sHTML = eWebEditor1.getHTML();
if (sHTML =="")
{
alert("<%=KS.C_S(ChannelID,3)%>内容不能留空!");
return false;}
<%end if%>
<%end if%>
4、1957行,作用:加入新编辑器,注意,要修改蓝色的eWebEditor1,必须同时修改上面的相关地方。
If KS.C_S(ChannelID,34)=0 Then
.Write " <input type='hidden' ID='Content' name='Content' value=""" & Server.HTMLEncode(ArticleContent) & """>"
.Write "<iframe id='ArticleContent' name='ArticleContent' src='KS.Editor.asp?ID=Content&style="&channelid&"&ChannelID=" & channelid & "' frameborder=0 scrolling=no width='700' height='350'></iframe>"
elseif KS.C_S(ChannelID,34)=2 Then
.Write " <input type='hidden' ID='Content' name='Content' value=""" & Server.HTMLEncode(ArticleContent) & """>"
.Write "<iframe id='eWebEditor1' name='eWebEditor1' src='../eWebEditor/ewebeditor.asp?id=Content&style=s_coolblue' frameborder=0 scrolling=no width='700' height='350'></iframe>"
Else
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "../KS_Editor/FCKeditor/"
oFCKeditor.ToolbarSet = "NewsTool"
oFCKeditor.Width = "695"
oFCKeditor.Height = "480"
oFCKeditor.Value = ArticleContent
oFCKeditor.Create "content"
End If
5、admin/include/upfilesave.asp 175行,作用:触发新的事件InsertFileFromUp1。
if UpType="File" Then '上传附件
If KS.C_S(ChannelID,34)=0 Then
Response.Write("parent.ArticleContent.InsertFileFromUp('" & TempFileStr &"','" & KS.Setting(3) & "');")
ElseIf KS.C_S(ChannelID,34)=1 Then
Response.Write("parent.InsertFileFromUp('" & TempFileStr &"','" & KS.Setting(3) & "');")
else
Response.Write("parent.InsertFileFromUp1('" & TempFileStr &"','" & KS.Setting(3) & "');")
End If
Response.Write("document.write(' <font size=2>附件上传成功!</font>');")
Else
6、eWebeditor部分(我用的是2.8)
eWebEditor/Dialog/img.htm 75行
// 图片来源单选点击事件
function RadioClick(what){
if (what=="url"){
d_checkfromfile.checked=false;
d_fromurl.disabled=false;
Button.disabled=false;
d_checkfromurl.checked=true;
d_file.myform.uploadfile.disabled=true;
}else{
d_checkfromurl.checked=false;
d_file.myform.uploadfile.disabled=false;
d_checkfromfile.checked=true;
d_fromurl.disabled=true;
Button.disabled=true;
}
}
同文件272行
<tr>
<td width=7></td>
<td width=54 align=right onClick="RadioClick('url')"><input type=radio id="d_checkfromurl" value="1" onClick="RadioClick('url')">网络:</td>
<td width=5></td>
<td colspan=5><input type=text id="d_fromurl" style="width:186" size=30 value=""><input type="button" name="Button" value="选择图片" onClick="var TempReturnValue=OpenWindow('http://127.0.0.1/admin/include/SelectPic.asp?ChannelID=1&CurrPath=/',500,290,window);if (TempReturnValue!='') d_fromurl.value=TempReturnValue;" class=Anbutc> </td>
<td width=7></td>
</tr>
<script language="JavaScript" src="../../KS_Inc/Common.js"></script>
[此贴子已经被作者于2007-12-19 11:40:58编辑过]