epic_era1 Posted April 1, 2008 Share Posted April 1, 2008 I AM DEVELOPING AN INTRANET APP BUT I'VE COME ACROSS A PROBLEM: THE ADMINISTRATOR MUST BE ABLE TO MAKE BACKUPS OF THE DATABASE FROM ANYWHERE IN THE INTRANET, THE PROBLEM IS THAT I CANT FIND A WAY FOR THE ADMIN. TO SELECT WHAT DRIVE HE WHANTS TO MAKE THE BACKUP IN, CAN ANYONE HELP ME PLEASE? Link to comment https://forums.phpfreaks.com/topic/99056-drive-select-option/ Share on other sites More sharing options...
trq Posted April 1, 2008 Share Posted April 1, 2008 You do realise that a post with all caps is considered yelling? Link to comment https://forums.phpfreaks.com/topic/99056-drive-select-option/#findComment-506881 Share on other sites More sharing options...
Caesar Posted April 1, 2008 Share Posted April 1, 2008 I think your caps lock button is stuck buddy. That aside, can you please give us some specifics like, what OS your server is running (Hopefully a *nix/Apache setup and not a craptastic Windows/IIS setup). Thanks. Link to comment https://forums.phpfreaks.com/topic/99056-drive-select-option/#findComment-506883 Share on other sites More sharing options...
epic_era1 Posted April 1, 2008 Author Share Posted April 1, 2008 I'm using Windows OS with Apache server Link to comment https://forums.phpfreaks.com/topic/99056-drive-select-option/#findComment-506887 Share on other sites More sharing options...
trq Posted April 1, 2008 Share Posted April 1, 2008 Have you got any code? All you really need is a html dropdown your admin can select the drive with. From there, you can use this selected value in the path to where you store these backups. Link to comment https://forums.phpfreaks.com/topic/99056-drive-select-option/#findComment-506893 Share on other sites More sharing options...
epic_era1 Posted April 1, 2008 Author Share Posted April 1, 2008 This is the code I'm using: <script language="JavaScript"> function getFolder(){ return showModalDialog("folderDialog.html","","width:400px;height:400px;resizeable:yes;"); } </SCRIPT> <style type="text/css"> <!-- .style1 { font-size: 16px; font-family: Geneva, Arial, Helvetica, sans-serif; } .style5 { color: #000000; font-size: 16px; } .style6 {font-family: Geneva, Arial, Helvetica, sans-serif} .style7 {font-size: 14px} --> </style> <form action="index.php"> <div align="center"> <h2 class="style5">RESPALDO DE INFORMACION </h2> <h2 class="style5"> <span class="style1"> <input type="text" name="dir"><input type="button" value="seleccionar" onclick="this.form.dir.value=getFolder()"> </span></h2> <p>SELECCIONE DIRECTORIO DESTINO <input type="hidden" name="page" value="backupdbscript.php"> <input type="hidden" name="rep" value="<? echo $rep;?>"> <input type="hidden" name="au" value="<? echo $au;?>"> </p> <fieldset class="tblFooters"> <center> </center> <p><br> <input name="submit" type="submit" value="CREAR RESPALDO" /> </p> </fieldset> </div> </form> but can't get any functionality Link to comment https://forums.phpfreaks.com/topic/99056-drive-select-option/#findComment-506902 Share on other sites More sharing options...
epic_era1 Posted April 1, 2008 Author Share Posted April 1, 2008 the folderdialog code is: <html> <head> <title>Browse Folders</title> <SCRIPT LANGUAGE="JavaScript"> <!-- var currentFolder=""; function GetDriveList(){ var fso, obj, n, e, item, arr=[]; try { fso = new ActiveXObject("Scripting.FileSystemObject"); } catch(er) { alert('Could not load Drives. The ActiveX control could not be started.'); cancelFolder(); } e = new Enumerator(fso.Drives); for(;!e.atEnd();e.moveNext()){ item = e.item(); obj = {letter:"",description:""}; obj.letter = item.DriveLetter; if (item.DriveType == 3) obj.description = item.ShareName; else if (item.IsReady) obj.description = item.VolumeName; else obj.description = "[Drive not ready]"; arr[arr.length]=obj; } return(arr); } function GetSubFolderList(fld){ var e, arr=[]; var fso = new ActiveXObject("Scripting.FileSystemObject"); var f = fso.GetFolder(fld.toString()); var e = new Enumerator(f.SubFolders); for(;!e.atEnd();e.moveNext()){ arr[arr.length]=e.item().Name; } return(arr); } function loadDrives(){ var drives=GetDriveList(),list=""; for(var i=0;i<drives.length;i++){ list+="<div onclick=\"loadList('"+drives[i].letter+':\\\\\')" class="folders" onmouseover="highlight(this)" onmouseout="unhighlight(this)">'+drives[i].letter+':\\ - '+ drives[i].description+'</div>'; } document.getElementById("path").innerHTML='<a href="" onclick="loadDrives();return false" title="My Computer">My Computer</a>\\'; document.getElementById("list").innerHTML=list; currentFolder=""; } function loadList(fld){ var path="",list="",paths=fld.split("\\"); var divPath=document.getElementById("path"); var divList=document.getElementById("list"); for(var i=0;i<paths.length-1;i++){ if(i==paths.length-2){ path+=paths[i]+' \\'; }else{ path+="<a href=\"\" onclick=\"loadList('"; for(var j=0;j<i+1;j++){ path+=paths[j]+"\\\\"; } path+='\');return false">'+paths[i]+'</a> \\ '; } } divPath.innerHTML='<a href="" onclick="loadDrives();return false">My Computer</a> \\ '+path; divPath.title="My Computer\\"+paths.toString().replace(/,/g,"\\"); currentFolder=paths.toString().replace(/,/g,"\\"); var subfolders=GetSubFolderList(fld); for(var j=0;j<subfolders.length;j++){ list+="<div onclick=\"loadList('"+(fld+subfolders[j]).replace(/\\/g,"\\\\")+'\\\\\')" onmouseover="highlight(this)" onmouseout="unhighlight(this)" title="'+subfolders[j]+'" class="folders">'+subfolders[j]+"</div>"; } divList.innerHTML=list; resizeList(); divPath.scrollIntoView(); } function resizeList(){ var divList=document.getElementById("list"); var divPath=document.getElementById("path"); if(document.body.clientHeight>0 && divPath.offsetHeight>0){ divList.style.height=document.body.clientHeight-divPath.scrollHeight; } } function highlight(div){ div.className="folderButton"; } function unhighlight(div){ div.className="folders"; } function selectFolder(){ window.returnValue=currentFolder; window.close(); } function cancelFolder(){ window.returnValue=""; window.close(); } --> </SCRIPT> <style> #header{ background-color: #CCCCCC; border-bottom: solid 1px black; } #path{ position:relative; font-size: 8pt; font-family: Arial; font-weight: bold; padding: 2px; } #list{ font-size: 10pt; font-family: Arial; overflow:auto; } .folders{ padding: 1px; border-top: solid 1px white; border-left: solid 1px white; border-right: solid 1px white; border-bottom: solid 1px black; cursor: hand; pointer: hand; background-color: white; } .folderButton{ padding: 0px; border-style: outset; border-width: 2px; border-color:; cursor: hand; pointer: hand; background-color: #CCCCCC; } A{ color:blue; text-decoration:none; padding:3px; } A:hover{ background-color: #CCCCCC; padding:1px; border-style: outset; border-width: 2px; } </style> </head> <body onLoad="loadDrives()" onResize="resizeList()" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" scroll=no> <form> <div id="container"> <table border="0" cellpadding="0" cellspacing="0" id="header"> <tr> <td><div id="path"></div></td> <td align="right" width="1%" nowrap> <input type="button" value="Select" onClick="selectFolder()"><input type="button" value="Cancel" onClick="cancelFolder()"> </td> </tr> </table> <div id="list">You must allow the ActiveX control to run in order to use this dialog.</div> </div> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/99056-drive-select-option/#findComment-506909 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.