Common. js used in the filemanage Function

Source: Internet
Author: User

Function f_framestyleresize (targobj)
{
VaR targwin = targobj.parent.doc ument. All [targobj. Name];
If (targwin! = NULL)
{
VaR heightvalue = targobj.doc ument. Body. scrollheight
If (heightvalue <300) {heightvalue = 300} // not less than 600
Targwin. style. pixelheight = heightvalue;
}
}
Function f_iframeresize ()
{
Bloadcomplete = true;
F_framestyleresize (Self );
}

VaR XMLHTTP = false;
Try {
XMLHTTP = new activexobject ("msxml2.xmlhttp ");
} Catch (e ){
Try {
XMLHTTP = new activexobject ("Microsoft. XMLHTTP ");
} Catch (E2 ){
XMLHTTP = false;
}
}
If (! XMLHTTP & typeof XMLHttpRequest! = 'Undefined '){
XMLHTTP = new XMLHttpRequest ();
}

Function showfiles (){
VaR url = "showfile. asp? PID "+ math. Random ();
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = reloadx;
XMLHTTP. Send (null );
}

Function showfiles2 (folder ){
VaR url = "showfile. asp? Foldername = "+ folder +" & pid "+ math. Random ();
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = reloadx;
XMLHTTP. Send (null );
}

Function Goback (){
VaR url = "showfile. asp? Go = back "+" & pid "+ math. Random ();
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = reloadx;
XMLHTTP. Send (null );
}

Function gonow (){
Document. getelementbyid ("filemanage_all"). style. Display = "Block ";
VaR url = "showfile. asp? Go = now "+" & pid "+ math. Random ();
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = reloadx;
XMLHTTP. Send (null );
}

Function reloadx (){
If (XMLHTTP. readystate <4 ){
Setmsg (' data loading, please wait ...');
}
If (XMLHTTP. readystate = 4 ){
F_iframeresize ();
VaR response = XMLHTTP. responsetext;
Document. getelementbyid ("myfile"). innerhtml = response;
VaR bloadcomplete = false;
F_iframeresize ();
}
}

function delfile ()
{< br> If (window. Confirm ("are you sure you want to delete the selected file? ") = True)
{< br> var fileid =" ";
var OBJ = document. getelementsbyname ('myselect');
for (VAR I = 0; I If (OBJ [I]. checked)
fileid = fileid + OBJ [I]. value + ',';
}< br> If (fileid)
{< br> var url = ".. /delfile. asp? FID = "+ fileid +" & pid "+ math. random ();
XMLHTTP. open ("get", URL, true);
XMLHTTP. onreadystatechange = delfileok;
XMLHTTP. send (null);
}< br> else
{< br> alert ("select a file first! ");
}< BR >}

Function share ()
{
VaR fileid = "";
VaR OBJ = Document. getelementsbyname ('myselect ');
For (VAR I = 0; I <obj. length; I ++ ){
If (OBJ [I]. Checked)
Fileid = fileid + OBJ [I]. Value + ',';
}
If (fileid)
{
VaR url = "../retry it. asp? Action = share & myselect = "+ fileid +" & pid "+ math. Random ();
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = ready OK;
XMLHTTP. Send (null );
}
Else
{
Alert ("select a file first! ");
}

}

Function delfolder (FID)
{
If (window. Confirm ("are you sure you want to delete the selected folder? ") = True)
{
VaR url = ".../delfolder. asp? Action = del & FID = "+ FID;
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = delfolderok;
XMLHTTP. Send (null );
}
}

Function dellink (LID)
{
If (window. Confirm ("are you sure you want to delete the selected URL tag? ") = True)
{
VaR url = "dellink. asp? Id = "+ lid;
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = dellinkok;
XMLHTTP. Send (null );
}
}

Function formate ()
{
If (window. Confirm ("the system will clear all data in your network disk. Are you sure you want to continue? ") = True)
{
VaR url = "formate. asp? PID "+ math. Random ();
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = formateok;
XMLHTTP. Send (null );
}
}

Function compute OK (){
If (XMLHTTP. readystate = 4 ){
Gonow ();
Setmsg ('file sharing successful! ');
}
}

Function delfolderok (){
If (XMLHTTP. readystate = 4 ){
Gonow ();
Setmsg ('selected folder deleted successfully! ');
}
}

Function delfileok (){
If (XMLHTTP. readystate = 4 ){
Gonow ();
Setmsg ('selected File deleted successfully! ');
}
}

Function dellinkok (){
If (XMLHTTP. readystate = 4 ){
Gonow ();
Setmsg ('selected URL tag deleted successfully! ');
}
}

Function formateok (){
If (XMLHTTP. readystate = 4 ){
Showfiles ();
Setmsg ('network disk data has been cleared! ');
}
}

Function setmsg (Message ){
Document. getelementbyid ("smessage"). style. Display = "Block ";
Document. getelementbyid ("messagebody"). innerhtml = message;
SetTimeout (function () {document. getelementbyid ("smessage"). style. Display = "NONE"}, 1000 );
}

function editfolder (FID, inputname, inputvalue, share, npwd, PWD) {
document. getelementbyid (inputvalue ). innerhtml = " folder Name: share Password required access password: ";
}

function editfolder2 (inputname, FID) {
var foldernamex = document. getelementbyid ("Temp "). value
var y1x = 'no';
var y2x = 'no';
var pwdx = document. getelementbyid ("passwordinx "). value;
If (document. getelementbyid ("everyonex "). checked)
{< br> y1x = document. getelementbyid ("everyonex "). value;
}< br> If (document. getelementbyid ("needpasswordx "). checked)
{< br> y2x = document. getelementb Yid ("needpasswordx"). value;
}< br> If (foldernamex! = Undefined)
{< br> var url = ".../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);
}< br> else
{< br> setmsg ('cancel editing folder! ');
}< BR >}

Function editfolderok (){
If (XMLHTTP. readystate = 4 ){
Gonow ();
Setmsg ('Folder edited successfully! ');
}
}

Function editfile (fileid, inputname, inputvalue, fileintro, share ){

Document. getelementbyid (fileid ). innerhtml = "<font size = '2'> File Name: </font> <input size = 16 name = 'filename' class = 'inputbox' value = '"+ inputvalue +"'> <font size = '2'> Public </font> <input type = 'checkbox' name = 'fileshare' value = 'ture' "+ share +"> <font size = '2'> edit description: </font> <input size = 21 name = 'fileintro' class = 'inputbox' value = '"+ fileintro +"'> <input type = 'button 'value = 'Edit 'name = 'b5 'class = 'myclick' onclick = editfile2 (' "+ fileid +" ');> ";
}

Function editfile2 (fileid ){
VaR filerename = Document. getelementbyid ("filerename"). Value
VaR fileshare = 'no ';
VaR fileintro = Document. getelementbyid ("fileintro"). value;

If (document. getelementbyid ("fileshare"). Checked)
{
Fileshare = Document. getelementbyid ("fileshare"). value;
}

If (filerename! = Undefined)
{
VaR url = "../editfile. asp? Action = Save & rename = "+ escape (filerename) +" & Share = "+ fileshare +" & intro = "+ fileintro +" & id = "+ fileid;
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = editfileok;
XMLHTTP. Send (null );
}
}

Function editfileok (){
If (XMLHTTP. readystate = 4 ){
Gonow ();
Setmsg ('file edited successfully! ');
}
}

Function checkall (form)
{
For (VAR I = 0; I <form. elements. length; I ++)
{
VaR E = form. elements [I];
E. Checked = true
}
}
Function checkothers (form)
{
For (VAR I = 0; I <form. elements. length; I ++)
{
VaR E = form. elements [I];
If (E. Checked = false)
{
E. Checked = true;
}
Else
{
E. Checked = false;
}
}
}

Function creatfolder (){
VaR Foldername = Document. getelementbyid ("Foldername"). value;
VaR Y1 = 'no ';
VaR y2 = 'no ';
VaR Pwd = 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)
{
VaR url = "../createfolder. asp? Action = create & Foldername = "+ Foldername +" & everyone = "+ Y1 +" & needpassword = "+ y2 +" & passwordin = "+ PWD;
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = creatfolderok;
XMLHTTP. Send (null );
}
}

Function creatfolderok (){
If (XMLHTTP. readystate = 4 ){
Hidemenu ();
Gonow ();
Setmsg ('Folder created successfully! ');
}
}

Function addlink (){
VaR urlname = Document. getelementbyid ("urlname"). value;
VaR Y1 = 'no ';
VaR urllocation = Document. getelementbyid ("urllocation"). value;
If (document. getelementbyid ("sharethis"). Checked)
{
Y1 = Document. getelementbyid ("sharethis"). value;
}
If (urlname! = Undefined)
{
VaR url = "addlink. asp? Uname = "+ urlname +" & Share = "+ Y1 +" & uloction = "+ urllocation;
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = addlinkok;
XMLHTTP. Send (null );
}
}

Function addlinkok (){
If (XMLHTTP. readystate = 4 ){
Hidemenu1 ();
Gonow ();
Setmsg ('url tag added successfully! ');
}
}

Function movefiles (){
VaR fileid = "";
VaR OBJ = Document. getelementsbyname ('myselect ');
For (VAR I = 0; I <obj. length; I ++ ){
If (OBJ [I]. Checked)
Fileid = fileid + OBJ [I]. Value + ',';
}
If (fileid)
{
VaR Foldername = Document. getelementbyid ("folder"). value;
VaR url = "../moveitok. asp? Action = createbyurl & folder = "+ Foldername +" & my_select = "+ fileid;
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = movefilesok;
XMLHTTP. Send (null );
}
Else
{
Alert ("select a file first! ");
}
}

Function movefilesok (){
If (XMLHTTP. readystate = 4 ){
Hidemenu ();
Gonow ();
Setmsg ('file moved successfully! ');
}
}

VaR showl = true;

Function showmenu2 (){
Document. getelementbyid ("movefiles"). style. Display = "Block ";
Document. getelementbyid ('movefiles'). style. Height = 20;
}
Function showmenu1 (){
Document. getelementbyid ("createfolder"). style. Display = "Block ";
Document. getelementbyid ('createfolder'). style. Height = 20;
}

Function showmenu4 (){
Document. getelementbyid ("addlink"). style. Display = "Block ";
Document. getelementbyid ('addlink'). style. Height = 20;
}

Function showmenu3 (){
If (showl! = False)
{
Document. getelementbyid ('showloctionx'). innerhtml = " ";
Document. getelementbyid ("mylocation"). style. Display = "Block ";
Document. getelementbyid ('mylocation'). style. Height = 20;
Showl = false
}
Else
{
Document. getelementbyid ('showloctionx'). innerhtml = " ";
Document. getelementbyid ("mylocation"). style. Display = "NONE ";
Showl = true;
}

}

Function hidemenu (){
Document. getelementbyid ("movefiles"). style. Display = "NONE ";
Document. getelementbyid ("createfolder"). style. Display = "NONE ";
}

Function hidemenu1 (){
Document. getelementbyid ("addlink"). style. Display = "NONE ";
}

Function setorderby (){
VaR orderby = Document. getelementbyid ("orderby"). value;
VaR url = "setorderby. asp? Setby = "+ orderby +" & pid = "+ math. Random ();
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = setorderbyok;
XMLHTTP. Send (null );
}

Function setorderbyok (){
If (XMLHTTP. readystate = 4 ){
Gonow ();
Setmsg ('file sorting setting successful! ');
}
}

Function editlink (linkid, urlname, urloction, share ){
Document. getelementbyid (linkid ). innerhtml = "<font size = '2'> tag name: </font> <input size = 13 name = 'editlinkname' class = 'inputbox' value = '"+ urlname +"'> <font size = '2'> Public </font> <input type = 'checkbox' name = 'editlinkshare' value = 'Yes' "+ share +"> <font size = '2'> URL Editing: </font> <input size = 25 name = 'editlinkloaction' class = 'inputbox' value = '"+ urloction +"'> <input type = 'button 'value = 'Edit 'name = 'b5 'class = 'myclick' onclick = editlink2 (' "+ escape (linkid) + "');> ";
}

Function editlink2 (linkidx ){
VaR urlname = Document. getelementbyid ("editlinkname"). value;
VaR linkshare = 'no ';
VaR urloction = Document. getelementbyid ("editlinkloaction"). value;
If (document. getelementbyid ("editlinkshare"). Checked)
{
Linkshare = Document. getelementbyid ("editlinkshare"). value;
}
If (urlname! = Undefined)
{
VaR url = "editlink. asp? Uname = "+ urlname +" & Share = "+ linkshare +" & uloction = "+ urloction +" & id = "+ linkidx +" & pid = "+ math. random ();
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = editlinkok;
XMLHTTP. Send (null );
}
}

Function editlinkok (){
If (XMLHTTP. readystate = 4 ){
Gonow ();
Setmsg ('url tag edited successfully! ');
}
}

Function highlightme (o ){
O. parentnode. parentnode. style. backgroundcolor = (O. Checked )? "# Ffebd7 ":""
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.