filemanage功能中用到的common.js

时间:2021-05-28

functionf_frameStyleResize(targObj)
{
vartargWin=targObj.parent.document.all[targObj.name];
if(targWin!=null)
{
varHeightvalue=targObj.document.body.scrollHeight
if(Heightvalue<300){Heightvalue=300}//不小于600
targWin.style.pixelHeight=Heightvalue;
}
}
functionf_iframeResize()
{
bLoadComplete=true;
f_frameStyleResize(self);
}


varxmlHttp=false;
try{
xmlHttp=newActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlHttp=newActiveXObject("Microsoft.XMLHTTP");
}catch(e2){
xmlHttp=false;
}
}
if(!xmlHttp&&typeofXMLHttpRequest!='undefined'){
xmlHttp=newXMLHttpRequest();
}


functionshowfiles(){
varurl="showfile.asp?pid"+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=reloadX;
xmlHttp.send(null);
}

functionshowfiles2(folder){
varurl="showfile.asp?foldername="+folder+"&pid"+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=reloadX;
xmlHttp.send(null);
}

functiongoback(){
varurl="showfile.asp?go=back"+"&pid"+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=reloadX;
xmlHttp.send(null);
}

functiongonow(){
document.getElementById("filemanage_all").style.display="block";
varurl="showfile.asp?go=now"+"&pid"+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=reloadX;
xmlHttp.send(null);
}

functionreloadX(){
if(xmlHttp.readyState<4){
setmsg('&nbsp;<IMGsrc=img/loading_pic.gifwidth=16height=16>&nbsp;数据载入,请稍候...');
}
if(xmlHttp.readyState==4){
f_iframeResize();
varresponse=xmlHttp.responseText;
document.getElementById("myfile").innerHTML=response;
varbLoadComplete=false;
f_iframeResize();
}
}

functiondelfile()
{
if(window.confirm("你确定要删除选定文件吗?")==true)
{
varfileid="";
varobj=document.getElementsByName('myselect');
for(vari=0;i<obj.length;i++){
if(obj[i].checked)
fileid=fileid+obj[i].value+',';
}
if(fileid)
{
varurl="../delfile.asp?fid="+fileid+"&pid"+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=delfileok;
xmlHttp.send(null);
}
else
{
alert("请先选择文件!");
}
}
}

functionshare()
{
varfileid="";
varobj=document.getElementsByName('myselect');
for(vari=0;i<obj.length;i++){
if(obj[i].checked)
fileid=fileid+obj[i].value+',';
}
if(fileid)
{
varurl="../shareit.asp?action=share&myselect="+fileid+"&pid"+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=shareok;
xmlHttp.send(null);
}
else
{
alert("请先选择文件!");
}

}

functiondelfolder(fid)
{
if(window.confirm("你确定要删除选定文件夹吗?")==true)
{
varurl="../delfolder.asp?action=del&fid="+fid;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=delfolderok;
xmlHttp.send(null);
}
}

functiondellink(lid)
{
if(window.confirm("你确定要删除选定网址标签吗?")==true)
{
varurl="dellink.asp?id="+lid;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=dellinkok;
xmlHttp.send(null);
}
}

functionformate()
{
if(window.confirm("系统将清除您网盘内的所有数据,您确定要继续吗?")==true)
{
varurl="formate.asp?pid"+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=formateok;
xmlHttp.send(null);
}
}

functionshareok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('&nbsp;文件共享成功!');
}
}

functiondelfolderok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('&nbsp;选定文件夹删除成功!');
}
}

functiondelfileok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('&nbsp;选定文件删除成功!');
}
}

functiondellinkok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('&nbsp;选定网址标签删除成功!');
}
}

functionformateok(){
if(xmlHttp.readyState==4){
showfiles();
setmsg('&nbsp;网盘数据已经全部清空!');
}
}

functionsetmsg(message){
document.getElementById("smessage").style.display="block";
document.getElementById("messagebody").innerHTML=message;
setTimeout(function(){document.getElementById("smessage").style.display="none"},1000);
}


functioneditfolder(fid,inputname,inputvalue,share,npwd,pwd){
document.getElementById(inputvalue).innerHTML="<fontsize='2'>文件夹名:</font><inputname='"+inputname+"'type='text'size='10'value='"+inputvalue+"'class='inputbox'onMouseOver=this.style.background='#FFF1BB'onMouseOut=this.style.background=''>&nbsp;&nbsp;<inputtype='checkbox'name='everyonex'value='yes'"+share+">共享<inputtype='checkbox'name='needpasswordx'value='yes'"+npwd+">需要密码<fontsize='2'>访问密码:</font><inputtype='password'value='"+pwd+"'name='passwordinx'size='20'class='inputbox'onMouseOver=this.style.background='#FFF1BB'onMouseOut=this.style.background=''>&nbsp;<inputtype='button'class='mybutton'value='编辑'name='B1'onclick=editfolder2('"+escape(inputvalue)+"','"+fid+"');>";
}

functioneditfolder2(inputname,fid){
varfoldernamex=document.getElementById("temp").value
vary1x='no';
vary2x='no';
varpwdx=document.getElementById("passwordinx").value;
if(document.getElementById("everyonex").checked)
{
y1x=document.getElementById("everyonex").value;
}
if(document.getElementById("needpasswordx").checked)
{
y2x=document.getElementById("needpasswordx").value;
}
if(foldernamex!=undefined)
{
varurl="../editfolder.asp?action=editit&rename="+escape(foldernamex)+"&everyone="+y1x+"&needpassword="+y2x+"&passwordin="+pwdx+"&foldername=/"+inputname+"/&folderid="+fid+"&pid="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=editfolderok;
xmlHttp.send(null);
}
else
{
setmsg('&nbsp;编辑文件夹取消!');
}
}

functioneditfolderok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('&nbsp;编辑文件夹成功!');
}
}

functioneditfile(fileid,inputname,inputvalue,fileintro,share){

document.getElementById(fileid).innerHTML="<fontsize='2'>文件名:</font><INPUTsize=16name='filerename'class='inputbox'value='"+inputvalue+"'><fontsize='2'>&nbsp;是否公享</font><inputtype='checkbox'name='fileshare'value='ture'"+share+">&nbsp;<fontsize='2'>说明编辑:</font><INPUTsize=21name='fileintro'class='inputbox'value='"+fileintro+"'><inputtype='button'value='编辑'name='B5'class='mybutton'onClick=editfile2('"+fileid+"');>";
}

functioneditfile2(fileid){
varfilerename=document.getElementById("filerename").value
varfileshare='no';
varfileintro=document.getElementById("fileintro").value;

if(document.getElementById("fileshare").checked)
{
fileshare=document.getElementById("fileshare").value;
}

if(filerename!=undefined)
{
varurl="../editfile.asp?action=save&rename="+escape(filerename)+"&share="+fileshare+"&intro="+fileintro+"&id="+fileid;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=editfileok;
xmlHttp.send(null);
}
}

functioneditfileok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('&nbsp;编辑文件成功!');
}
}

functionCheckAll(form)
{
for(vari=0;i<form.elements.length;i++)
{
vare=form.elements[i];
e.checked=true
}
}
functionCheckOthers(form)
{
for(vari=0;i<form.elements.length;i++)
{
vare=form.elements[i];
if(e.checked==false)
{
e.checked=true;
}
else
{
e.checked=false;
}
}
}

functioncreatfolder(){
varfoldername=document.getElementById("foldername").value;
vary1='no';
vary2='no';
varpwd=document.getElementById("passwordin").value;

if(document.getElementById("everyone").checked)
{
y1=document.getElementById("everyone").value;
}

if(document.getElementById("needpassword").checked)
{
y2=document.getElementById("needpassword").value;
}

if(foldername!=undefined)
{
varurl="../createfolder.asp?action=create&foldername="+foldername+"&everyone="+y1+"&needpassword="+y2+"&passwordin="+pwd;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=creatfolderok;
xmlHttp.send(null);
}
}

functioncreatfolderok(){
if(xmlHttp.readyState==4){
hidemenu();
gonow();
setmsg('&nbsp;新建文件夹成功!');
}
}

functionaddlink(){
varurlname=document.getElementById("urlname").value;
vary1='no';
varurllocation=document.getElementById("urllocation").value;
if(document.getElementById("sharethis").checked)
{
y1=document.getElementById("sharethis").value;
}
if(urlname!=undefined)
{
varurl="addlink.asp?uname="+urlname+"&share="+y1+"&uloction="+urllocation;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=addlinkok;
xmlHttp.send(null);
}
}

functionaddlinkok(){
if(xmlHttp.readyState==4){
hidemenu1();
gonow();
setmsg('&nbsp;网址标签添加成功!');
}
}

functionmovefiles(){
varfileid="";
varobj=document.getElementsByName('myselect');
for(vari=0;i<obj.length;i++){
if(obj[i].checked)
fileid=fileid+obj[i].value+',';
}
if(fileid)
{
varfoldername=document.getElementById("folder").value;
varurl="../moveitok.asp?action=createbyurl&folder="+foldername+"&my_select="+fileid;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=movefilesok;
xmlHttp.send(null);
}
else
{
alert("&nbsp;请先选择文件!");
}
}

functionmovefilesok(){
if(xmlHttp.readyState==4){
hidemenu();
gonow();
setmsg('&nbsp;文件移动成功!');
}
}

varshowl=true;

functionshowmenu2(){
document.getElementById("Movefiles").style.display="block";
document.getElementById('Movefiles').style.height=20;
}
functionshowmenu1(){
document.getElementById("CreateFolder").style.display="block";
document.getElementById('CreateFolder').style.height=20;
}

functionshowmenu4(){
document.getElementById("addlink").style.display="block";
document.getElementById('addlink').style.height=20;
}

functionshowmenu3(){
if(showl!=false)
{
document.getElementById('showloctionx').innerHTML="<imgborder='0'src='img/showup.gif'width='16'height='16'>";
document.getElementById("mylocation").style.display="block";
document.getElementById('mylocation').style.height=20;
showl=false
}
else
{
document.getElementById('showloctionx').innerHTML="<imgborder='0'src='img/show.gif'width='16'height='16'>";
document.getElementById("mylocation").style.display="none";
showl=true;
}

}

functionhidemenu(){
document.getElementById("Movefiles").style.display="none";
document.getElementById("CreateFolder").style.display="none";
}

functionhidemenu1(){
document.getElementById("addlink").style.display="none";
}

functionsetorderby(){
varorderby=document.getElementById("orderby").value;
varurl="setorderby.asp?setby="+orderby+"&pid="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=setorderbyok;
xmlHttp.send(null);
}

functionsetorderbyok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('&nbsp;文件排序设置成功!');
}
}


functioneditlink(linkid,urlname,urlloction,share){
document.getElementById(linkid).innerHTML="<fontsize='2'>标签名:</font><INPUTsize=13name='editlinkname'class='inputbox'value='"+urlname+"'><fontsize='2'>&nbsp;是否公享</font><inputtype='checkbox'name='editlinkshare'value='yes'"+share+">&nbsp;<fontsize='2'>网址编辑:</font><INPUTsize=25name='editlinkloaction'class='inputbox'value='"+urlloction+"'><inputtype='button'value='编辑'name='B5'class='mybutton'onClick=editlink2('"+escape(linkid)+"');>";
}

functioneditlink2(linkidx){
varurlname=document.getElementById("editlinkname").value;
varlinkshare='no';
varurlloction=document.getElementById("editlinkloaction").value;
if(document.getElementById("editlinkshare").checked)
{
linkshare=document.getElementById("editlinkshare").value;
}
if(urlname!=undefined)
{
varurl="editlink.asp?uname="+urlname+"&share="+linkshare+"&uloction="+urlloction+"&id="+linkidx+"&pid="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=editlinkok;
xmlHttp.send(null);
}
}

functioneditlinkok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('&nbsp;编辑网址标签成功!');
}
}

functionhighlightme(o){
o.parentNode.parentNode.style.backgroundColor=(o.checked)?"#FFEBD7":""
}

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章