Basically, this feature is pretty simple to implement, or something like it...as we will be releasing this concept on our community site this March, but it's the concept of Document Templates. In order to make this work, we had to mildly customize the DocCreateAction, the doc-create.ftl, and add some Extended Properties here and there. The feature set we were looking to provide were the following:
- Spring board content contributors into a Template that focuses them on content, and less layout. (more fill in the blank)
- Global switch to turn on/off the Document Templates feature
- Global definition of Templates available to all containers
- Global definition of Default Template selection, this will default the content editor's content.
- Container definition of Custom Templates, available only for that container
- Container definition of Default Template (same as above)
- Auto-Tagging of Documents when template select, helps propogate a standard dimension to slice the community
Basically, our implementation manifests itself as a dropdown about the subject bar, with some JS attached to it to update the TinyMCE editor when a template is changed. On page-load, the template default and default content are already loaded from the server side, as well as the default tagging structure per the default selection. On change of the dropdown, a confirmation box asks the user if they want to apped the template and/or replace all of the content. As such, we check the tags field as well, and attempt to clear out the previous default tag (if that is the only one defined), and replace/add the new corresponding tag. The System and Container Extended Properties we use share the same naming structure, I hve provided an example below:
- template.enabled (true/false)
- template.default = Tutorial
- template.names = Example,Tutorial
- template.Example.label = Example Code
- template.Example.template = <p>...</p>
Container would defined the following:
- template.default = Textbook (overrides global if found)
- template.names = Textbook (additive to global when in container)
- template.Textbook.template = <p>...</p>
Here is a screen shot of the drop-down discussed above, all Templates defined under "Custom Templates" are container specific, all above are global.
As a side note, we also manifested this template "type" information into a Document Extended Property, and customized the SearchAction and view-documents.ftl to add in filters for these template types. From a separate initiative, we also added in the sorting by columns types.
Here are some of those screen-shots:
Note: The same global + local container filtering applies here...if I were in a different container where textbook was not definied, I wouldn't see it.
Also, note the Sort by functionality. We had to disable it when the "All Documents" were being pulled as that was not constructing a query, instead it pulls from the Recent Content Manager which is cached.
Any ways, I hope this gives you guys some ideas about this feature. As you can see, the UI's aren't great and true Clearspace-y, but the functionality is there. Perhaps a richer plugin for TinyMCE to expose this as a drop-down inside the editor? Anyways, this is a feature that is going to give us a lot of power on our community for styling and content creation and thought I would share with the masses. I am happy to provide details for those that are interested.