📄 picturefunction.js
字号:
/*
文件名:PictureFunction.JS
作 用 :图片管理操作的函数集合
说 明 :在Picture_Main.asp文件中调用此JS
*/
var DocElementArrInitialFlag=false;
var SendToLeftFrameFistFlag=true;
var DocElementArr = new Array();
var DocContextMenuArr=new Array();
var SelectedFile='',SelectedFolder='';
function document.onreadystatechange()
{
SendToLeftFrame();
if (ClassID!='0')
parent.frames['LeftFrame'].frames['LeftInfoFrame'].SetEnabledStatus(false);
if (DocElementArrInitialFlag) return; //判断是否已初始化
InitialDocElementArr('FolderID','PictureID'); //初始化对象,FolderID为目录ID,PictureID为图片ID,对应调用图片<Span FolderID="值">目录名称</span><span PictureID="值">图片标题</Span>
InitialDocContextMenuArr();
DocElementArrInitialFlag=true;
}
function InitialDocContextMenuArr()
{ if (KeyWord=='')
{
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.CreateFolder();",'添加'+TempStr+'(N)','disabled');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.CreateNews('');",'添加图片(M)','disabled');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem('seperator','','');
}
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.SelectAllElement();",'全 选(A)','disabled');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.Edit('');",'编 辑(E)','disabled');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.Delete('');",'删 除(D)','disabled');
if (!(CutCopyPower=='False'))
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem('seperator','','');
if (ClassID!='0'||KeyWord!='')
{
if (!(CutCopyPower=='False'))
{
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.Cut();",'剪 切(X)','disabled');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.Copy();",'复 制(C)','disabled');
}
if (KeyWord=='')
{
if (!(CutCopyPower=='False'))
{
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.Paste();",'粘 贴(V)','disabled');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem('seperator','','');
}
}
else
{
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem('seperator','','');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.Verific(1);",'批量审核(P)','disabled');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.Verific(0);",'取消审核(Y)','disabled');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem('seperator','','');
}
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.AddToJS();",'加入JS(J)','disabled');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem('seperator','','');
}
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem('parent.ChangeUp();','后 退(B)','');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem('parent.Reload();','刷 新(Z)','');
}
function DocDisabledContextMenu()
{
var TempDisabledStr='';
var PasteTFStr='';
if (ClassID=='0') TempDisabledStr='添加图片(M),后 退(B),';
if (top.CommonCopyCut.PasteTypeID==0||top.CommonCopyCut.ChannelID!=2)PasteTFStr='粘 贴(V),';
DisabledContextMenu('FolderID','PictureID',PasteTFStr+TempDisabledStr+'编 辑(E),删 除(D),剪 切(X),复 制(C),加入JS(J),批量审核(P),取消审核(Y)',PasteTFStr+'编 辑(E)',PasteTFStr,PasteTFStr+'编 辑(E),加入JS(J),批量审核(P),取消审核(Y)',PasteTFStr+'编 辑(E),加入JS(J),批量审核(P),取消审核(Y)',PasteTFStr+'加入JS(J),批量审核(P),取消审核(Y)')
}
function show(tips,flag,url){
var my_tips=document.all.mytips;
if(flag){
my_tips.style.display="";
if (url!=null){my_tips.innerHTML="<table width='100%' border='0'><tr><td width='105' align='center'><img src='"+url+"'align='center' border='0' width='100' height='60'></td><td>"+tips+"</td></tr></table>";}
else{ my_tips.innerHTML=tips;}
my_tips.style.left=event.clientX-30;
my_tips.style.top=event.clientY+10;
}
else
{
my_tips.style.display="none";
}
}
function OpenTheFolder(FolderID)
{
location.href='Picture_Main.asp?DisplayMode='+DisplayMode+'&ID='+FolderID;
if (ShowDetail=='1') //判断是否显示详细信息
{
parent.frames['LeftFrame'].LeftInfoFrame.location.href='Picture_Left.asp?StatusFlag=1&Type=0&ID='+FolderID;
}
parent.frames['BottomFrame'].location.href='../Split.asp?ButtonSymbol=ViewPictureFolder&FolderID='+FolderID;
}
function ChangeUp()
{
if (ClassID=='0') return;
if (ShowDetail=='1') //判断是否显示详细信息
{
parent.frames['LeftFrame'].LeftInfoFrame.location.href='Picture_Left.asp?StatusFlag=1&Type=0&ID='+ParentID;
}
location.href='Picture_Main.asp?DisplayMode='+DisplayMode+'&ID='+ParentID;
if (ParentID=='0')
parent.frames['BottomFrame'].location.href='../Split.asp?OpStr=图片管理 >> <font color=red>浏览频道</font>&ButtonSymbol=Disabled&FolderID=0';
else
parent.frames['BottomFrame'].location.href='../Split.asp?ButtonSymbol=ViewPictureFolder&FolderID='+ParentID;
}
function CreateFolder()
{
OpenWindow('PictureFrame.asp?Url=Picture_CreateFolder.asp&PageTitle=添加'+TempStr+'&FolderID='+ClassID,450,360,window);
Reload();
}
function EditFolder(FolderID)
{
OpenWindow('PictureFrame.asp?Url=Picture_FolderEdit.asp&PageTitle=编辑'+TempStr+'&FolderID='+FolderID,450,360,window);
Reload();
}
function CreateNews(TempUrl)
{ GetSelectStatus('FolderID','PictureID');
if (SelectedFolder!='')
{
if (SelectedFolder.indexOf(',')==-1)
{
location.href=TempUrl+'Picture_add.asp?DisplayMode='+DisplayMode+'&Action=Add&FolderID='+SelectedFolder;
parent.frames['BottomFrame'].location.href=TempUrl+'../Split.asp?OpStr=添加图片&ButtonSymbol=AddPicture&FolderID='+SelectedFolder;
}
else
alert('添加图片只能先择一个'+TempStr+'!');
}
else
{ if (ClassID=='0')
alert('请选择您要添加图片的频道');
else
{
location.href=TempUrl+'Picture_add.asp?DisplayMode='+DisplayMode+'&Action=Add&FolderID='+ClassID;
parent.frames['BottomFrame'].location.href=TempUrl+'../Split.asp?OpStr=添加图片&ButtonSymbol=AddPicture&FolderID='+ClassID;
}
}
}
function Edit(TempUrl)
{ GetSelectStatus('FolderID','PictureID');
if (!((SelectedFile=='')&&(SelectedFolder=='')))
{
if (SelectedFolder!='')
if (TempUrl=='Folder'||TempUrl=='')
{ if (SelectedFolder.indexOf(',')==-1)
EditFolder(SelectedFolder);
else alert('一次只能够编辑一个'+TempStr);
}
if (SelectedFile!='')
if (TempUrl!='Folder'||TempUrl=='')
{ if (SelectedFile.indexOf(',')==-1)
{
location.href=TempUrl+'Picture_Add.asp?DisplayMode='+DisplayMode+'&Page='+Page+'&Action=Edit&'+SearchParam+'&PicID='+SelectedFile;
if (KeyWord=='')
parent.frames['BottomFrame'].location.href=TempUrl+'../Split.asp?OpStr=编辑图片&ButtonSymbol=AddPicture&FolderID='+ClassID;
else
parent.frames['BottomFrame'].location.href=TempUrl+'../Split.asp?OpStr=图片管理 >> 搜索结果 >> <font color=red>编辑图片</font>&ButtonSymbol=AddPicture';
}
else alert('一次只能够编辑一篇图片');
}
}
else
{
alert('请选择要编辑的图片或'+TempStr);
}
}
function Delete(TempUrl)
{ GetSelectStatus('FolderID','PictureID');
if (!((SelectedFile=='')&&(SelectedFolder=='')))
{ if (confirm('确定删除选中的目录或图片吗?'))
{if (SelectedFolder!='')
if (TempUrl=='Folder'||TempUrl=='')
{location="Picture_FolderDel.asp?DisplayMode="+DisplayMode+"&Page="+Page+"&FolderID="+SelectedFolder;}
if (SelectedFile!='')
if (TempUrl!='Folder'||TempUrl=='')
{ location=TempUrl+'Picture_Del.asp?DisplayMode='+DisplayMode+'&Page='+Page+'&'+SearchParam+'&PicID='+SelectedFile;}
}
//给选定项设为空
SelectedFile='';
SelectedFolder='';
}
else alert('请选择要删除的'+TempStr+'或图片!');
}
function Comment()
{ top.CommonComment.FromUrl='Picture_Main.asp?ID='+ClassID;
parent.frames['LeftFrame'].LeftInfoFrame.SetEnabledStatus(true);
parent.frames['BottomFrame'].location.href='../split.asp?ButtonSymbol=Disabled&Opstr=评论管理';
GetSelectStatus('FolderID','PictureID');
if (SelectedFolder=='')
{
location.href='Picture_CommentMain.asp?InfoID='+SelectedFile+'&ClassID='+ClassID;
}
else
{location.href='Picture_CommentMain.asp?ClassID='+SelectedFolder;}
}
function Cut()
{
GetSelectStatus('FolderID','PictureID');
if (!((SelectedFile=='')&&(SelectedFolder=='')))
{
top.CommonCopyCut.ChannelID=2;
top.CommonCopyCut.PasteTypeID=1;
top.CommonCopyCut.SourceFolderID=ClassID;
top.CommonCopyCut.FolderID=SelectedFolder;
top.CommonCopyCut.ContentID=SelectedFile;
SelectedFolder='';
SelectedFile='';
}
else
alert('请选择要剪切的目录或图片!');
}
function Copy()
{
GetSelectStatus('FolderID','PictureID');
if (!((SelectedFile=='')&&(SelectedFolder=='')))
{
top.CommonCopyCut.ChannelID=2;
top.CommonCopyCut.PasteTypeID=2;
top.CommonCopyCut.SourceFolderID=ClassID;
top.CommonCopyCut.FolderID=SelectedFolder;
top.CommonCopyCut.ContentID=SelectedFile;
SelectedFolder='';
SelectedFile='';
}
else
alert('请选择要复制的目录或图片!');
}
function Paste()
{ if (ClassID=='0')
{ top.CommonCopyCut.PasteTypeID=0;
alert('目标目录不存在!');
}
if (top.CommonCopyCut.ChannelID==2 && top.CommonCopyCut.PasteTypeID!=0)
{ var Param='';
Param='?DisplayMode='+DisplayMode+'&Page='+Page;
Param+='&PasteTypeID='+top.CommonCopyCut.PasteTypeID+'&DestFolderID='+ClassID+'&SourceFolderID='+top.CommonCopyCut.SourceFolderID+'&FolderID='+top.CommonCopyCut.FolderID+'&ContentID='+top.CommonCopyCut.ContentID;
if (top.CommonCopyCut.PasteTypeID==1) //剪切
{
top.CommonCopyCut.PasteTypeID=0; //设置为0,使粘贴不可用
if (top.CommonCopyCut.SourceFolderID==ClassID) return;
location.href='Picture_Paste.asp'+Param;
}
else if (top.CommonCopyCut.PasteTypeID==2) //复制
{
location.href='Picture_Paste.asp'+Param;
}
else
alert('非法操作!');
}
else
alert('系统剪切板没有内容!');
}
function Verific(Value)
{ var TempStr='',ValueStr='';
GetSelectStatus('FolderID','PictureID');
if (SelectedFile!='')
{ if (SelectedFile.indexOf(',')!=-1) TempStr='批量';
if (Value==1)
ValueStr="确定"+TempStr+"审核选中的图片吗?";
else
ValueStr="确定"+TempStr+"取消审核选中的图片吗?";
if (confirm(ValueStr))
{
location.href="Picture_Verific.asp?DisplayMode="+DisplayMode+"&"+SearchParam+"&PicID="+SelectedFile+"&Page="+Page+"&value="+Value;
}
SelectedFile='';
}
else
alert('您没有选择图片!');
}
function ViewByVerific(VerificTF)
{
location.href="Picture_Main.asp?DisplayMode="+DisplayMode+"&ID="+ClassID+"&VerificTF="+VerificTF
}
function AddToJS()
{ GetSelectStatus('FolderID','PictureID');
if (SelectedFile!='')
{
OpenWindow('PictureFrame.asp?PageTitle=图片加入到自由JS&URL=Picture_AddTOJS.asp&PicID='+SelectedFile,300,100,window);
}
else alert('请选择要加入JS的图片!');
SelectedFile=''
}
function ViewPicture(PictureID)
{
window.open (DomainStr+'Photo/ShowInfo.asp?ID='+PictureID);
}
function ChangeDisplayMode(ObjValue)
{
location.href=ObjValue;
}
function GetKeyDown()
{
if (event.ctrlKey)
switch (event.keyCode)
{ case 90 : Reload(); break;
case 78 : event.keyCode=0;event.returnValue=false;CreateFolder();break;
case 77 : CreateNews('');break;
case 65 : SelectAllElement();break;
case 83 : AddToSpecial();break;
case 74 : AddToJS();break;
case 66 : event.keyCode=0;event.returnValue=false;ChangeUp();break;
case 80 : event.keyCode=0;event.returnValue=false;Verific(1);break;
case 88 :
if (ClassID!='0')
{ event.keyCode=0;event.returnValue=false;Cut();}
else
return;
break;
case 67 :
if (ClassID!='0')
{event.keyCode=0;event.returnValue=false;Copy();}
else
return;
break;
case 86 :
if (top.CommonCopyCut.ChannelID==2 && top.CommonCopyCut.PasteTypeID!=0 && ClassID!='0')
{ event.keyCode=0;event.returnValue=false;Paste();}
else
return;
break;
case 89 : event.keyCode=0;event.returnValue=false;Verific(0);break;
case 69 : event.keyCode=0;event.returnValue=false;Edit('');break;
case 68 : Delete('');break;
case 70 : event.keyCode=0;event.returnValue=false;parent.frames['LeftFrame'].initializeSearch('Picture')
}
else if (event.keyCode==46) Delete('');
}
function Reload()
{
location.href='Picture_Main.asp?DisplayMode='+DisplayMode+'&ID='+ClassID+'&page='+Page+'&'+SearchParam;
}
function SendToLeftFrame()
{
if (ShowDetail=='0') return; //如果系统设置为不显示详细信息,则返回
var Type,ID,StatusFlag=1;
var el=event.srcElement;
if (el==null||el.type=='button') return;
el=el.parentElement;
if (el.PictureID!=null)
{Type=1;ID=el.PictureID;}
else if (el.FolderID!=null)
{Type=0;ID=el.FolderID;}
else
{
if (ClassID=='0')
{Type=-1;ID="0";}
else
{Type=0;ID=ClassID;}
}
if (ClassID=='0')
StatusFlag=0;
SendToLeftFrameFistFlag=false;
SelectedFile='';
SelectedFolder='';
parent.frames['LeftFrame'].LeftInfoFrame.location.href='Picture_Left.asp?StatusFlag='+StatusFlag+'&Type='+Type+'&ID='+ID;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -