Giter Site home page Giter Site logo

Comments (11)

fgeyer16 avatar fgeyer16 commented on June 15, 2024 1

Ah thank you.

from docker-drupal.

patrickkaleta avatar patrickkaleta commented on June 15, 2024 1

Screenshots of maps and table are now being stored as Report images, which are linked to the corresponding GL-Step and can be viewed in the Summary tab and printed out in the report.

@p-a-s-c-a-l
FYI: I mainly followed your approach (thanks for providing the link) and managed to implement it in "plain" JavaScript.
Instead of sending a GET request for the GL-Step and later PATCHing that same GL-Step with the new Report Image, I'm sending another POST request in the end against the relationship endpoint for the Report Images array of the GL-Step. (more on this here)

So the whole approach looks like this:

  1. POST new file of the screenshot (same as your approach)
  2. POST new Report Image including the UUID of the new file retrieved in 1) (same as your approach)
  3. POST new Relationship for the respective GL-Step, payload only contains the entity type and UUID of the Report image (the GL-Step and the type of the relationship is already part of the URL)

from docker-drupal.

fgeyer16 avatar fgeyer16 commented on June 15, 2024

We could either add html2canvas.min.js to csis.libraries.yml in csis-theme and add a <button> + the respective REST calls to the Drupal API directly in an HTML field. Or we integrate the functionality (JS function) in the csis-helpers-module.

This has to be included in csis-helper module. Modules are for functionality themes for looking nice :-)
Maybe this should be a small separate module.

May be I missed something on glimpsing on html2canvas. But how do we get an Imagefile from that to upload to the server?

from docker-drupal.

p-a-s-c-a-l avatar p-a-s-c-a-l commented on June 15, 2024

May be I missed something on glimpsing on html2canvas. But how do we get an Imagefile from that to upload to the server?

Here is an example: https://github.com/clarity-h2020/scenario-analysis/blob/dev/app/scripts/controllers/mainController.js#L170

document.body.appendChild(canvas); is just for testing purposes. It should be commented out.
var imageBlob = canvas.toDataURL().replace(/^data:image\/(png|jpg);base64,/, ''); will get the image data from the canvas that was created by html2canvas from the html element identified by elementId

See also https://html2canvas.hertzen.com/

from docker-drupal.

p-a-s-c-a-l avatar p-a-s-c-a-l commented on June 15, 2024

@fgeyer16 Any progress, plans, suggestions, ... here :-)

Is this the 'Snapshot' Field?

from docker-drupal.

p-a-s-c-a-l avatar p-a-s-c-a-l commented on June 15, 2024

@patrickkaleta @fgeyer16
FYI: Complete example for taking screenshots and posting to Drupal API is available in drupalService.js

from docker-drupal.

patrickkaleta avatar patrickkaleta commented on June 15, 2024

I wouldn't close this issue just yet, since @DenoBeno suggested that we show to the user an Edit-form, where he/she can enter a description for the Report image, when they click on the "Include in Report" Button.
Reason: They can edit the description of a Report image on the Summary-Tab, but once they get to that tab, they might've already forgotten what this screenshot was really about.
Problem: We cannot show an Edit form for the Report Image directly, since this Report image doesn't exist until after the user clicks that button.
@fgeyer16 might've come up with a possible solution to this, so I will talk to him and try to implement it

from docker-drupal.

p-a-s-c-a-l avatar p-a-s-c-a-l commented on June 15, 2024

Any progress to report here?

from docker-drupal.

patrickkaleta avatar patrickkaleta commented on June 15, 2024

Already done. Suggestions by @DenoBeno have been implemented. I forgot to update & close the issue.

from docker-drupal.

p-a-s-c-a-l avatar p-a-s-c-a-l commented on June 15, 2024

The Button does not work for the Study Area Map.

from docker-drupal.

p-a-s-c-a-l avatar p-a-s-c-a-l commented on June 15, 2024

See clarity-h2020/csis-helpers-module#9

from docker-drupal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.