Giter Club home page Giter Club logo

silverstripe-form-capture's People

Contributors

andrewhaine avatar kinglozzer avatar kris-coidan avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

silverstripe-form-capture's Issues

File Fields

Currently file and file attachment fields do not work this this module. Solution requires picking out the files on submission and providing a friendly link to them in the CMS.

The following works with > 3.1.* and Dropzone

// CapturedFormExtension
	case 'fileattachment':

                    $fileID = $field->dataValue();
                    $file = DataObject::get_by_id('File', $fileID);
                    $fileLink = $file->Link();
                    $fileName = $file->Name;

                    $val->Value = "<a target='_blank' href='$fileLink'>$fileName</a>";

                    break;

Note: this will also require adapting the CapturedField gridfield to render field values as HTMLText

Improve Export Button Removal

Currently we are removing all gridfield export buttons. Replace the existing code inside of getEditForm with this:

$vanillaExportButton = $gridField->getConfig()->getComponentByType('GridFieldExportButton');
$gridField->getConfig()->removeComponent($vanillaExportButton);

Allows for custom export buttons to be added in future, even if they are subclasses of the standard export button.

CSV export

This is kinda broken out of the box, it just shows the 3 summary fields and not actual submission data. It’s a tricky problem, as each form will have different fields so exporting to one CSV file would be very messy. As the data is split across tables, it’s also hard to avoid a large number of expensive database queries.

For one of our sites I hacked together a modified GridFieldExportButton which outputs one CSV file for each type of form: https://gist.github.com/kinglozzer/18c18344a94c5798d7127461e70e3cdd. (relies on league/csv, league/flysystem and league/flysystem-ziparchive).

While the above works, it may fall down at some point - most likely will hit memory and/or time limits. My suggestion would be to use the queuedjobs module and add a custom GridField button which will schedule an export job. It’ll then run on CLI “later” (you can set it up to export smaller chunks at a time, in case one big job would time-out) and could export the data to a folder in assets. That could either be part of this module, and try to detect whether the module is installed before adding the export button, or an entirely separate module that depends on this one + queuedjobs.

Save dates in locale format instead of ISO format

@feejin and @kinglozzer do you think it would be better if dates were saved in locale instead of ISO format? We can't adjust the value of the field before it is saved so it would have to be done at module level. We can add a config option to enable and disable in case for some reason someone did want ISO dates.

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.