\DynamicTemplateFilesField
Form field that shows a list of files within a dynamic template. This is based on what's in the manifest, merged with files in the dynamic template.
The following are possible:
- a File object exists and it's in the manifest.
- a relative link is in the manifest, pointing to a file outside
of the dynamic template, and no File exists.
- a File object exists, but is not in the manifest, such as for images.
The tree display is done by treeTable.
Synopsis
class DynamicTemplateFilesField
extends FormField
{
- // methods
- public void __construct()
- protected void getDynamicTemplate()
- protected void calcTree()
- public void Field()
- protected void actionsForFile()
- public void editLink()
- public void viewLinkedFileLink()
- public void deleteLink()
- public void unlinkLink()
- public void changeTemplateTypeLink()
Hierarchy
Extends
- FormField
Tasks
Line | Task |
---|---|
34+ | Currently this totally ignores actions, effectively only including what's in 'index' action. |
Methods
protected
- actionsForFile()
- calcTree() — Generate a nested. Top level is the subfolders of the dynamic template. Level beneath are the files. Each file is map, with 'path' property, and 'ID' if it has an actual File object.
- getDynamicTemplate()
public
- __construct()
- Field()
- changeTemplateTypeLink() — Given a file map from the tree, generate a link to the ajax method for changing a template type. Given that we can't always identify template files by ID (they could be linked), we encode the dynamic template ID and path separated by colons in base 64.
- deleteLink() — Given a file map from the tree, generate a link to the ajax method to delete a file. Link has the file ID.
- editLink() — Given the file map from the tree, generate a link to the edit form. This is a link on DynamicTemplateAdmin that returns an edit form via ajax that will edit the content of the file.
- unlinkLink() — Given a file map from the tree, generate a link to the ajax method to unlink a file. Given that linked files are not File objects, but just paths, we encode have to encode the path. We also need to encode the subfolder and the dynamic template ID is this, separated by colons.
- viewLinkedFileLink()