Menu

#562 GetProjectFile is doing make non-dynamically

workingwiki
closed
None
5
2014-06-25
2014-06-21
Lee Worden
No

[#544] succeeded at its main task, but I missed a piece: when called with make=yes, I think GetProjectFiles is doing the make operation before outputting the page with placeholder to load the file dynamically.

I hope this isn't too hard to unravel - the make step happens early, before it decides whether to stream the file raw, which happens before I do the placeholder.

Related

Bugs: #544

Discussion

  • Lee Worden

    Lee Worden - 2014-06-21

    So here's what the flow of GetProjectFiles looks like now that it includes the dynamic placeholder case:

    • read in the URL parameters and fill in default values as needed
    • do initial action (sync files, etc) if needed, and output its result.
    • If filename is bad, complain and quit
    • If project name is bad, complain and quit
    • If appropriate, ask ProjectEngine to make the target file
    • Decide whether it's going to be served raw (which requires that make succeeded)
    • Figure out whether it's a file in the resources directory rather than in a project (this logic seems to be in a few disparate places in the code, but it probably makes sense, I'm not really looking at this part)
    • Figure out default display mode of file based on its filename using WWInterface::default_display_mode (which only applies if not serving raw)
    • Do a little dance with display=link and display=download to avoid circular links
    • If file is going to be served raw and it's HTML, call display_file_contents to get its contents and then append .html to its filename (to make sure the browser recognizes the contents as html when it's output)
    • If not serving file raw:
      • retrieve it from PE
      • if it's a directory, make the directory listing
      • if it's html, check the beginning of the file contents to decide whether it's a complete page or not: if it is, decide to serve the file raw.
    • If serving the file raw:
      • guess whether it can go in browser tab or should be a download
      • if we have the file contents, serve up the file contents with appropriate headers
      • if we don't have the contents, ask PE to stream it, and pass the output verbatim to the browser
      • if anything went wrong, output a 404 or 500 error page (we need to do HTTP stuff correctly here, so that the browser will do the right thing as we're using GetProjectFile to display images).
    • If we get this far, we're not displaying the file raw. Create the output page's title, etc.
    • Report any WW errors that have occurred while retrieving the file or anything.
    • Construct the bracketed links, including 'make', 'page', 'download', 'upload', etc.
    • If doing dynamic display
      • produce the placeholder
    • else
      • Produce "make succeeded but did not create file" or, if make wasn't done, "file not found" message if appropriate.
      • call display_file_contents to produce the output html representation of the file.
    • report any errors.
     
  • Lee Worden

    Lee Worden - 2014-06-21

    It also looks like loading a file where the project directory doesn't exist is giving me an empty GPF page - I want at least a pulldown!

    In fact let's be more specific: I want the following sequence to work, because that's what I'm trying to do right now. On a page that has no project, create an image file offline and then insert a project-file tag for it. Hit preview, in order to get an error message with a pulldown, use the 'reload' link in the pulldown by dragging it to another browser tab, thus opening the not-found project file in GPF.

    Actually, my intention was to get that GPF so I could use the 'upload' link to upload the file, but now I realize that wouldn't work, because it only provides that link for source files (but maybe it shouldn't!).

    Regardless, there should never be an empty GPF page without a file unless there's an error message explaining why, and there should always be a pulldown.

     
  • Lee Worden

    Lee Worden - 2014-06-25
    • status: open --> closed
     
  • Lee Worden

    Lee Worden - 2014-06-25

    Adjusted GetProjectFile and found a bug in the js that was failing to display the pulldown. So this is better now.

    There are issues where sometimes there's a pulldown in the error message and one outside, and where it shows up in different places at different times, and where the error message is sometimes duplicated into a floating bubble and sometimes not. I'll leave those for other tickets, and some of them will mutate as we go into the Comet interface which probably won't use those bubbles.

     

Anonymous
Anonymous

Add attachments
Cancel