hareesh27 / phpdesktop

Automatically exported from code.google.com/p/phpdesktop
0 stars 0 forks source link

Ability to download files #65

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is probably the only thing missing in phpdesktop right now, that would 
prevent existing web apps from working out of the box. This still needs work. 
We would need to implement CefDownoadHandler and display some "Save as" dialog 
using Windows API call, probably GetSaveFileName():

http://msdn.microsoft.com/en-us/library/windows/desktop/ms646928(v=vs.85).aspx

It would be nice to have the "Save as" in mouse context menu that would appear 
for links. It would give ability to download even those files that are not 
normally downloadable (no headers that identify it as an attachment).

I'm not yet completely sure about the "Save as" feature in context menu. How 
should it behave when user tries to download a link that is an html page? I 
don't think I'm going to implement the "Save complete webpage" feature, it's 
much more work, and it feels like it's a feature for a real web browser.

What would be the use cases for the "Save as" feature? I'm not yet convinced 
that we really need it. It would definitely need to be configurable through the 
settings.json file, because it's probably not desirable by everyone.

Original issue reported on code.google.com by czarek.t...@gmail.com on 23 Jan 2014 at 6:55

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
There is a way to provide an ability to download files for now, using only 
PHP/JS scripting. You can implement a custom SaveFilename dialog in PHP. When 
user clicks a download link, a javascript code opens a popup window. In that 
popup window you browse through drives/directories to select the path where to 
save the file, and enter the name of the file. Clicking OK closes the popup 
window and executes some code on the opener window to save the file to the 
chosen location. This could be a XMLHttpRequest thing doing it in a background. 
Optionally, some progress bar could be displayed.

Original comment by czarek.t...@gmail.com on 23 Jan 2014 at 7:03

GoogleCodeExporter commented 9 years ago
Ability to download files should be configurable through "enable_downloads" 
setting.

Original comment by czarek.t...@gmail.com on 23 Jan 2014 at 7:40

GoogleCodeExporter commented 9 years ago
Although it's important to be able to access the Windows Save As dialog to 
download files, it personally isn't important to me to have it in the right 
click context menu.  Having it in the right click menu kind of reveals to the 
user they are using a web app, not a desktop app.  To me, the point of PHP 
Desktop is to be able to present a web app as a desktop app and not have users 
know the difference. The fewer reveals that it is a web app the better. 

I'd personally like to be able to just turn off the right click menu altogether 
in settings.json and create my own right click menu as needed where appropriate 
via javascript.  Having said that, as long as there's an option to turn it off 
and on in the settings file, I'd hate to dash anyone's hopes who is looking 
forward to this feature.

Perhaps the best way to do this would be to add a section of the settings file 
devoted specifically to what is available in the right click menu.  So it could 
look like this:

    "context_menu": {
        "enabled": "true",
        "show_print": "true",
        "show_back": "true",
        "show_forward": "true",
        "show_save_as": "false"
    }

There could possibly be a few other settings here too I didn't think of.  This 
is all doable now via javascript, but having the option to do this in settings 
might be better.

Original comment by DallinHS...@gmail.com on 23 Jan 2014 at 8:45

GoogleCodeExporter commented 9 years ago
#4 DallinHSmith
It's a good idea to make the context menu configurable. There also appear other 
options in context menu when used with forms: Copy/Cut/Paste. I think these 
should stay. Dallin, please create a new issue in the tracker for this feature.

Original comment by czarek.t...@gmail.com on 23 Jan 2014 at 8:52

GoogleCodeExporter commented 9 years ago
Done in revision 961dca65478f. 

Added new option "enable_downloads" in the settings.json file. Added the 
download.php example.

Regarding the "Save as" feature, please create a new issue for that if you need 
it.

Original comment by czarek.t...@gmail.com on 24 Jan 2014 at 4:45

GoogleCodeExporter commented 9 years ago
If I change the file name in "Save as" dialog, the downloaded file loses the 
extension.

Original comment by marco.ol...@gmail.com on 10 Mar 2015 at 4:21