Srinivasarao_Ko
I'm new here

Images inside a folder is not coming as used although the media folder is referenced

Jump to solution

Hello,

We have one section template for image gallery where editors can create the gallery by selecting individual images. recently we enhanced this feature by allowing the editors to select the folder for gallery (with help of <ALLOW type="mediafolder"/> in FS_REFERENCE). we customized the section template code to retrieve the content from selected folder and to show those pics as one gallery. this is all working good as expected.

But we observed one thing  now that, although a media folder is been used(referenced) in image gallery, if we check the usages (show usages option) of any individual image inside of the selected folder then it is showing as no use found. We are concerned on this because based on this information some users may delete the pics as it showing not being used.

We are expecting when a folder is referenced in some place which means all its content inside the folder is referenced (used). hence  individual items of that folder should appear as used. I hope our expectation is valid and FirstSpirit is not showing as we expected. People who have any idea on this please comment here.

Thanks,

Srinivas.

0 Kudos
1 Solution

Accepted Solutions
mbergmann
Crownpeak employee

Hello Srinivas,

what you describe is the expected behaviour. Usages are calculated using the "reference graph" which only reflect direct references between objects. Those are created when - for example - an object is used in a FS_REFERENCE, in the GOM definition of a template, as direct (not "calculated"!) reference inside $CMS_REF(media:"..,")$ etc.

The fact that by referencing ONE object (=the folder) means you are "using" other related objects (the child elements in your case) by some kind of evaluation is part of your concrete implementation and cannot be resolved by FirstSpirit because it's project specific logic.

To avoid accidential deletion, you can implement a delete workflow which replaces the standard delete action and uses scripts to check if the media files should be considered being "used" concerning your project structure. But your workflow would have to be able to handle any possible object type because a delete workflow can only be configured globally (per project).

Another, maybe better option is to implement a mechanism that makes it easier for editors to explicitly link individual media elements by just choosing a folder. This can be done by an FS_BUTTON that starts an Executable which opens a dialog where the editor chooses a folder. The Executable can then fill a FS_CATALOG or FS_LIST with linktemplates referencing one media item each.

The Button can also be implemented as a drop target accepting media folders (and the start quite the same logic).

Michael

View solution in original post

0 Kudos
2 Replies
mbergmann
Crownpeak employee

Hello Srinivas,

what you describe is the expected behaviour. Usages are calculated using the "reference graph" which only reflect direct references between objects. Those are created when - for example - an object is used in a FS_REFERENCE, in the GOM definition of a template, as direct (not "calculated"!) reference inside $CMS_REF(media:"..,")$ etc.

The fact that by referencing ONE object (=the folder) means you are "using" other related objects (the child elements in your case) by some kind of evaluation is part of your concrete implementation and cannot be resolved by FirstSpirit because it's project specific logic.

To avoid accidential deletion, you can implement a delete workflow which replaces the standard delete action and uses scripts to check if the media files should be considered being "used" concerning your project structure. But your workflow would have to be able to handle any possible object type because a delete workflow can only be configured globally (per project).

Another, maybe better option is to implement a mechanism that makes it easier for editors to explicitly link individual media elements by just choosing a folder. This can be done by an FS_BUTTON that starts an Executable which opens a dialog where the editor chooses a folder. The Executable can then fill a FS_CATALOG or FS_LIST with linktemplates referencing one media item each.

The Button can also be implemented as a drop target accepting media folders (and the start quite the same logic).

Michael

0 Kudos

Hello Michael,

Thanks for your reply. I got the behaviour now.

Thanks,

Srinivas.

0 Kudos