In my Drupal 9, Opigno distribution, website; Where can I find where the "Manage Display" of my files are being overwritten? - drupal

I have a Drupal 9 website with an Opigno distribution.
Opigno LMS has the following structure to learning: Training > Courses > Modules > Activities (ex. Quiz, or a YouTube video). I have structured my website as follows: Each Training has many Modules. Each Module has many Activities.
Opigno LMS has a feature called the Documents library. This allows the administrator to “add files” to a Training. This is likely to be reference materials for students.
The Documents library utilizes a Drupal module called Taxonomy File Tree (TFT).
The Admin can alter what “add a file” looks like by:
Go to “Structure” > “Media Types” > “File” > “Manage Fields”
Click “Add field” for a new, desired input field when “adding files”
Click on “Manage form display”
Edit the visible fields to insure your new field is added to the visible form
This works effectively, but there is one last step that is missing:
When one tries to alter what the “Manage Display” looks like, we see that everything is either “Disabled” or “- Hidden -” clearly indicating that the display of the files that are added are being controlled elsewhere. I tested this by attempting to enable the fields in the “Manage Display” section, only to see nothing was altered at all in the appearance of the files.
“Manage Display” typically is what would be used to determine what the list of the files from the “Documents library” would look like; However, that is not the case here. I am unsure where the “Manage Display” is being overwritten.
**Any ideas of where to look or where this functionality exists?
**
What am I trying to change:
I want to remove file uploads and replace them with a Link to a file that is being hosted elsewhere.
This provides a much more seamless experience internally as our documents are updated regularly, but our links to the documents do not change. (prevents uploading new documents each time there is a minor change)
I am able to add the Link using “Add field” and “Manage form display”; Additionally, When clicking “add file” using the native “Documents library” it does successfully add the file.
I am not able to see the Links I just added in the displayed “Documents library” files (“Manage Display” issue described above)
I am able to find all of the uploaded files using “Documents library” (.pdf, image, etc.) “Content” > “Media” > “Files”
*I am able to find all the Links added using “Documents library” (Link) “Content” > “Media”
The file path to these Links does not show up here.
What I know:
The contrib module opigno_group_manager (web/modules/contrib/opigno_group_manager) definitely communicates to the module tft (Taxonomy File Tree)
Tried looking in the opigno_group_manager code, but haven't been able to find the code that makes the change to the view.

Related

Create page structure one time for all languages

I'm testing the Django CMS and I'm looking for a way to create the pages one time for all languages. Currently I have to create a new page for each languages and the content/plugin/structure is not shared between the different languages.
Is there a way to achieve this?
Thanks in advance
The built-in management command ./manage.py cms copy lang copies the entire page tree from one language to another. The page tree stays unchanged and the plugin trees are transferred. That is fine if you want to bootstrap a new language for the entire site.
If you want to copy the plugin trees for only one page, you can use the language menu from the toolbar: Language -> Copy all plugins if you are viewing the target language. This is fine, if you only have one page.
If you want to bootstrap a language for a page tree, i.e. a page and all its children, then you either have a lot of clicking to do, or use this short management command I created based on the original DjangoCMS ./manage.py cms copy long command. It allows to specify a page to copy either by its id or by its name in the source language (attention: it has to be unique).
Copy this snippet into any of your application's command folder: my_app/management/commands/. Once you've copied the file you'll have a new Django management command available: ./manage.py copylang. Usage examples:
./manage.py copylang --from-lang=en --to-lang=nl --tree="Home"
./manage.py copylang --from-lang=en --to-lang=nl --tree_id=36 --force
The page id needed for the --tree_id option can be easily inferred from the page admin by hovering over the page's preview icon. The page id is part of the link: .../page/page_id/lang/preview/...
If you leave out the --treeand the --tree_id options the command will revert to DjangoCMS's original cms copy lang behaviour.
The management command provided by #Fabian is quite useful.
I updated the command code here to reflect the changes in django-cms API:
# pages = [head] + list(head.children.drafts())
pages = [head] + list(head.get_child_pages().drafts())
Tested against django-cms 3.5.3 and 3.7.4.
All credits go to #Fabian.

Plone setuphandler- In a setuphandler, how can I programatically add/create a folderish content type at root of Plonesite?

I have have made a folderish content type called supplier_folder, which displays a list of suppliers that can be added under it, and their information. I can add it through the navigation bar, but I would like to add it programatically during setup.
I have been following the tutorial on custom installer code (http://docs.plone.org/develop/addons/components/genericsetup.html#custom-installer-code-setuphandlers-py) and have looked at creating objects programatically (http://docs.plone.org/develop/plone/content/creating.html).
Unfortunately, the second article says I need to have a folder created. How can I get around this and add the supplier_folder object at the Plone Site outside of a folder?
IIRC, only users with role Manager or Site Administrator can add content to the root of the site; you can overcome this limitation in two ways:
by using the _constructInstance method as it bypasses the permissions when creating an item
by switching roles inside your code with plone.api.env.adopt_roles
I personally prefer the second one.
you can see an example of a pretty complex setuphandlers.py in interlegis.portalmodelo.policy package.
When you create a new Plone site, it's also creating some default content types.
Look at how Plone do: https://github.com/plone/Products.CMFPlone/blob/1471828ee97a8dd84396bad4a3286be514819869/Products/CMFPlone/setuphandlers.py#L119
There are a couple of ways to achieve this. The buildin mechanism is to use GenericSetup in combination with "structure" folder as described here: http://koansys.com/tech/create-plone-initial-content-with-generic-setup
In short you need the following:
Create a folder "structure" in your Generic Setup profile (in general, under profiles/default)
Create a .objects file with the following content: "suppliers,supplier_folder"
in "structure" create a folder "suppliers" with a .properties file and content:
[DEFAULT]
title = Suppliers
description = Some usefull description text
As far as I remember this is ok for simple structures likes your. If you have complex structures with folders and sub-folders and want more specific control you probably need to write python code. I made some stuff here: https://github.com/collective/zettwerk.setup/blob/master/zettwerk/setup/structure.py
But zettwerk.setup is not yet released, but you should be able to integrate the structure.py right into your project. Than you can the handle_structure method into your setuphandlers.py and passing a structure dict like this:
handle_structure(portal, [{'id': 'suppliers', 'portal_type': 'supplier_folder'}])
The advantage of this method is, that you can also control metadata like workflow state, default page setting, portlets, local roles and some others.

TinyMCE 3.5.8: Detailed Steps for Creating a Button that Acquires a Value from User and Inserts it Between a Pair of Tags

TinyMCE 3.5.8
I merely need to create a button (and module) that acquires a user-entered value from a popup and places it between two tags, e.g., [bib][/bib]
I am having trouble finding a "step-by-step" for doing this, including what files, where code goes, etc. This must be rather simple?
I have replaced all of the occurrences of "example" with my module name in the "Example" module, but that is where my information ends.
If someone would be so kind !
P.S.: It would be even better if the form field would javascript validate for "integer", but maybe I ask too much?
download the tinymce development version
use tiny_mce_dev.js instead of tinymce.js for developement in order to get more usefull error messages
create an own tinymce plugin (this is not that difficult) that opens a popup
get the content of a popup field
insert it at the right place in the editor
You should have a look at other tinymce plugins (in the plugins directory under the tiny_mce dir) to get to know how some things work. There are many plugins, some of them use popups.
I.E. the searchreplace popup

Pasted folder invisible to Plone but not to Zope

I am getting a very weird problem when attempted to cut-and-paste folders from one place to another in our intranet Plone site. The paste operation returned the error "Nothing in the clipboard". However it had gone and removed the folder from where it had originally been, and it looks as though it hasn't been inserted yet into the new location. Showing the Content view of the folder in which the paste happened does not show the pasted folder. However, through the ZMI interface I can see that the paste has happened. Clearly something threw an error before the pasted content was moved successfully, and it is left in a weird state.
For example the site search can find the content in the new pasted location, and the bread-crumbs show that those content pages are beneath the folder which is otherwise invisible to Plone.
Is it possible - maybe through the ZMI - to get this folder to be visible in the Plone world?
That is a weird bug. The quick solution to get the folder to display in Plone is to go to the ZMI, then visit portal_catalog, then locate (in one of the tabs) the button to rebuild the catalog. This ought to regenerate the catalog indexes (which may have failed to be updated when you did the cut/paste, through no fault of your own) and thus all the views (folder listings, etc) in Plone will display the new index (the views use the catalog to know what to display).
The same problem as I copied a folder from one language folder to an other the pasted object was only visible in ZMI
As fRiSi said the problem was the language category in Categorization tab > Language
Because I had many subobjects inside a folder I run the script below to change the language categorization recursively
Based on Convert LinguaPlone sub-language back to language for all content?
path = '/'.join(context.getPhysicalPath())
for brain in context.portal_catalog(path={'query': path, 'depth': 1000}, Language="it"):
obj = brain.getObject()
obj.setLanguage('en')
obj.reindexObject(idxs=['Language'])
print brain.getURL()
return printed

Drupal6: View that shows a directory structure

I've built a content type to handle document upload. My content type uses a Book node to handle directories/subdirectories and I would like to show a couple of Views that shows the directories structure. When clicking on a directory I would like to show, in another view, all the documents inserted in that directory.
Do you know any existing examples of Views/Panels? That shows a similar structure, as in the Windows Explorer, using Views2?
You can use this module: views_tree
Also tree-like can be built via argument handlers...

Resources