esmero / webform_strawberryfield

Provides Webform integrations to feed a field of Strawberries. Mr. Wizard of WebOz
GNU Lesser General Public License v3.0
2 stars 6 forks source link

Expose Media ordering via Webforms #12

Open DiegoPino opened 5 years ago

DiegoPino commented 5 years ago

Need

Now that the bookreader formatter is out we need a way to allowing people uploading individual pages to define the ordering of those, so the Manifest Templating system can avoid doing any logic at all.

How

The approaches are many: 1.- Generate an extra Form that deals just with this. Would allow to move Pages around without having to pass through Metadata validation on the main forms 2.- Incorporate a custom webform element that allows drag and drop for uploaded images 3.- Generate a TOC element that simply points to the pages in a defined order. (This is the lowest hanging fruit). This one would allow to just "add" a structure instead of affecting existing ones

Additional Issues

JSON encoding/decoding is not respecting Object ordering. So we need to check on that, maybe we need to just enforce a flag there or deal with the fact that the DB serialization applies some type of normalization.

giancarlobi commented 5 years ago

@DiegoPino some thoughts (I'm at the end of day so could be probably wrong):

So for a book of 50 pages we have 51 nodes , right? For each node we have a manifest OR (1 page = 1 canvas AND 1 book = 1 manifest/sequence) ?

The order into manifest/sequence == pages order, right? If we use a canvas label alphanumeric to number pages the number must be 00001, 00002, etc... to allow sort by canvas label OR we have to use an INT as canvas label to allow sort. These thoughts based on first manifest draft for IAB https://github.com/esmero/format_strawberryfield/pull/3

DiegoPino commented 5 years ago

1 node 1 page, 1 node 50 pages too 50 pages 1 node. See http://ec2-3-81-3-204.compute-1.amazonaws.com/do/acac40ce-952d-4a29-9e92-b52aa5a4a812#page/6/mode/2up

Each Node has a manifest, or a twig template that can be setup on the book reader field formatter Sorting is an issues. If we use INT as canvas label to allow sort, yes we can do that. That sounds good. The other option i was proposing was to create a ToC that simply points to the file and gives it an order, and a structure (like chapter). Then when i read that back in the viewer i can use that structure as reference for ordering or anything else

Does that make sense?

mitchellkeaney commented 4 years ago

@DiegoPino per our discussion IRL, I wanted to add a couple ideas to this issue.

It could be helpful to have the webform place the files in order based on:

1) the file's name, example: image1.jpg, image2.jpg, image3.jpg, etc. (though, perhaps this could create complications due to varying user's file-naming syntax?)

2) the order in which the user uploads the files

3) manually moving the files around. example: I am uploading 10 images but I accidentally labeled the 9th image as "image8.jpg", I would be able to assign the order of the files with a UI.

DiegoPino commented 4 years ago

@mitchellkeaney i agree. We need to act on this, there is no fun on ordering images once they are uploaded and saved. I will add this to my agenda. This needs to be solved soon. Thanks for documenting more options! I want us to research a better UI option. Some people solve this via table drag/order, which is native to Drupal, but it really makes no sense to have a 1000 or 2000 rows long table rendered. We can do better.

DiegoPino commented 4 years ago

Also, lastly. We need a fast sorting algorithm. There are many around and some are better for this use case than others. Probably our main use case will be to have 1.- Initial order 2.- In case of doubt (when deducing order from name) as the user if ImageA is the first and imageZ is the last_ 3.- A simpler form where people can select (search) for an image, get a result, set a sequence number and then decide if that will shift all other pages down, or will move the current page in that place to the place the one we want to change was? More options?

mitchellkeaney commented 4 years ago

@DiegoPino you just read my mind! i was thinking a helpful UI would be for the user to be able to select (or search for) an image (presumably within their 1000 file batch), get a result and select this file as their first (or even moving it to be their 357th) to either shift all files after or just move it from its current position to the correct one.

does that make sense?

DiegoPino commented 4 years ago

@mitchellkeaney exactly! we are on the same "page"... 👨 dad-joke

giancarlobi commented 4 years ago

@DiegoPino @mitchellkeaney I fully agree with you and the last simple solution because a complicated UI will never work and rarely used by user. A question: initial order is by file name, after move/reorder an image do we need to rename files? I think don't as json key will be sufficient for this.

DiegoPino commented 4 years ago

@giancarlobi thanks. Answering your question: no file renaming. Once there is a sequence: key in the as:image json, that is what mandates. Initial ordering based on filename is just to generate that structure during ingest, once sequence is there, it takes over =)