A template gallery is a virtual storage space that provides a way to store and organize template metadata. Template metadata is usually referred to as just a template; it includes references to a template file location, placeholder definitions, and custom property definitions. Templates and template files are created and managed using the Template Explorer within Visual Studio .NET.
NOTE: Template galleries can be created using the Site Manager as well as the Template Explorer in Visual Studio .NET. User rights to template galleries can be assigned only using the Site Manager.
In this section, we will look into working with template galleries using the Site Manager. It is similar to working with folders in Windows Explorer. Site managers, channel managers, and template designers can create and administer template galleries.
To access the template galleries tree, click the Template Gallery icon in the left pane of the Site Manager window (Figure 16-19).
Figure 16-19. Template gallery hierarchy
Renaming, Moving, and Copying a Template Gallery
To rename a template gallery, right-click the template gallery you'd like to rename, select Rename, and type the new name. If you want to change the gallery's description, you can do it from the Properties > General tab (Figure 16-20).
Figure 16-20. Template gallery properties
NOTE: To access the Properties dialog box, right-click the template gallery and select Properties.
To move or copy a template gallery, right-click the template gallery you'd like to move or copy, and select either Cut or Copy; then right-click the destination gallery where you want it to be moved or copied, and click Paste.
The Site Manager allows galleries with the same name to be stored inside the parent gallery because they have different GUIDs. However, it is a good practice to rename the template gallery immediately after you've copied it into the same gallery as the original; otherwise, it could become very confusing for both authors and administrators of your site.
Deleting, Removing, and Restoring a Template Gallery
To delete a template gallery, right-click it and click Delete. Deleted template galleries are moved to the Deleted Items container. From there, you can either remove the deleted gallery permanently by right-clicking it and selecting Delete, or restore the gallery by moving it back to the template galleries tree.
Moving, Copying, and Deleting Templates in a Template Gallery
To move or copy a template, right-click the template you'd like to move or copy and select either Cut or Copy; then right-click the template gallery where you want the template to be moved or copied, and click Paste. You can also drag and drop the template onto a template gallery in the tree pane.
Templates, and other CMS objects, are identified by GUIDs; therefore, the Site Manager allows templates with the same name to be stored inside a template gallery. You cannot rename the template from the Site Manager, you can rename it only from the Template Explorer in Visual Studio .NET.
To delete a template, right-click the template and click Delete. Deleted templates are moved to the Deleted Items container in the template galleries hierarchy. From there, you can either restore the template by moving it back into a template gallery or remove it permanently by right-clicking it and selecting Delete. If you'd like to permanently remove all templates and template galleries in the Deleted Items container, right-click it and select Clear Deleted Items.
Reverting a Template
Sometimes, after you have changed a template but haven't approved it, you need to go back to the template that has been previously approved. You can achieve this "rollback" functionality in the Site Manager by right-clicking the template and selecting Revert to Approved. If this option is grayed out, it means that this particular template cannot be reverted.
NOTE: The Revert to Approved option allows you to revert the template metadata, including placeholder definitions, custom properties definitions, and the template file location. However, this option doesn't control the changes to the template ASPX file. Using the Revert to Approved option, you can revert changes to the metadata, but not the code.
A template's dependent report shows all pages that are based on this template. To run a dependent report for a template, right-click the template and select Dependent Report. The report is displayed in an Internet Explorer pop-up window, as shown in Figure 16-21.
Figure 16-21. Dependent report
NOTE: You can revert templates and run dependent reports only from the Site Manager.
Assigning Rights to a Template Gallery
Rights to an existing template gallery are assigned using the Properties > Rights tab (Figure 16-22). If you want your template gallery to have the same rights group assignment as its parent gallery, click Modify and then click Add Parent's Rights. We will look into assigning rights in the next chapter.
Figure 16-22. Template gallery rights