craftsmancoding / assetmanager

Asset Manager for MODX Revolution
36 stars 15 forks source link

not working properly with contexts / Babel plugin #51

Open rygar4321 opened 9 years ago

rygar4321 commented 9 years ago

MODX is very often used in multi-language sites with Babel plugin, that allows for connecting documents in different contexts. Unfortunately there is no way to avoid duplication of resources in Asset Manager when using contexts for languages. There should be some way to import (or better share) data between contexts. This is pretty common use-case (it might be that it should be done on Babel side or both).

fireproofsocks commented 9 years ago

I'm unclear on how to reproduce the problem. Can you please elaborate?

rygar4321 commented 9 years ago

sure well, Babel works this way: lets say you have French and English versions of your website. When you create resource for EN version, is is being created in 'web' context. Then you can add another resource with FR translation in FR context. Babel adds relation (link) between them, and allows jumping between those 2 (different) resources. They are technically separate. When I add assets to English version of resource, it will not show up in FR resource, because these assets are not synchronised between those documents (so to see image gallery in both languages, I have to upload them 2 times, which makes no sense). Babel has ability to sync TVs, but i think Asset Manager is not based on TV, it attaches itself to resource via resource id (as I understand it).

So, to fix it, there would have to be some code to actually detect Babel and then act accordingly.

to 'reproduce' you simply to have setup simple multi-language (multi-context) site and use babel for syncing

fireproofsocks commented 9 years ago

Thank you, that's helpful. Yes, the Asset Manager attaches to a resource id. So maybe the solution requires that linking resource IDs, probably in a master/slave relationship OR syncing the relations between the 2 (or more) resource IDs.

rygar4321 commented 9 years ago

bit of thinking: if Asset Manager links its galleries using resource IDs, then 'fixing' would be quite simple, instead of looking for single 'resource id' it could look for 'id or babel-synced-ids' (all relations are already there in Babel's tables, so few lines of code should be enough to address the problem)

normally author should not really care about other plugins, but Babel is actually THE language solution for MODX, so (i guess) large audience cannot actually use both plugins

which is pity, as Asset Manager is really nicely done (and we mostly cannot just drop Babel because it provides essential functionality people need.

fireproofsocks commented 9 years ago

You could always pass an explicit page id to any of the Asset Manager snippets to work around the problem. If you've got a budget for this, I can prioritize development.

ufabooks commented 8 years ago

I need it too! very urgently! How many for you it is necessary to finish it in three days?

fireproofsocks commented 8 years ago

Github is for bug-reports and feature requests. If this is a request for an estimate, then please contact me via email or via the website.