16 KiB
Template Wizard and HTML Importer
Overview
The Template Wizard is a FirstSpirit tool that automates the conversion of HTML mockups into FirstSpirit project templates. It streamlines the template development process by importing external HTML designs and automatically generating FirstSpirit components.
Purpose
The Template Wizard significantly reduces the time and effort required from delivery of HTML mockups to creation of the initial project prototype by:
- Importing HTML/JSP structures from local sources or URLs
- Automatically transferring referenced images and files from HTML mockups
- Extracting design and layout specifications
- Generating FirstSpirit input components (e.g., DOM editors, image references)
- Mapping form elements and content areas to FirstSpirit templates
Key Benefits
- Automation: Automatically imports HTML structures and associated assets
- Design Transfer: Extracts and transfers design specifications from HTML
- Component Generation: Creates FirstSpirit components matching HTML content
- Rapid Prototyping: Accelerates the journey from mockup to working prototype
Accessing the Template Wizard
Access Control
As of version 5.2R2, administrators can restrict access to the Template Wizard through the "FS-AgencySupport-ProjectPermissions" project component in ServerManager. This allows limiting usage to specific user groups.
Starting the Wizard
The Template Wizard can be accessed through the toolbar buttons in the import interface:
- "Select HTML file" button: Opens a file selection dialog with the import project root directory as default
- "Select URL" button: Allows input of external URLs for importing remote HTML structures
Template Wizard Workflow
The wizard guides developers through a structured process:
- Import HTML structures - Import HTML/JSP files from local sources or URLs
- Auto-import assets - Automatically transfer referenced images, files, and external content
- Transfer design specifications - Extract layout and design elements from HTML
- Build forms - Use Form Builder to create FirstSpirit components matching HTML content
- Assign form elements - Map form components to templates
- Configure content areas - Define editable regions for page templates
Importing HTML Structures
Import Process
- Select Source: Choose between local HTML files or external URLs using the toolbar buttons
- Automatic Transfer: Upon confirmation, the HTML structure transfers to the import project
- Asset Import: Referenced images, files, and external content are automatically imported where possible
Limitations
The Template Wizard cannot automatically handle:
- Images/files embedded in JavaScript: Assets loaded dynamically via JavaScript must be imported manually
- Navigation structures: HTML navigation elements must be manually mapped to FirstSpirit navigation
- JavaScript-based content: Dynamic content loaded through JavaScript requires manual configuration
Reimport Considerations
Important Warning: Reimporting HTML structures will overwrite current project modifications. The wizard cannot merge reimported changes with existing customizations. Always backup your project before reimporting.
Analyzing and Working with HTML Structure
HTML Preview Interface
After importing HTML, you can analyze and work with the structure:
- Select an entry in the import project
- Click "Edit entry" to open the preview tab
- View HTML preview showing the page structure
Interactive Selection
The preview interface provides powerful selection capabilities:
- Click inside preview: Displays an overlay window revealing the HTML hierarchy at that location
- Multiple selection: Hold Ctrl while clicking to select multiple elements
- Visual feedback: Hover over overlay entries to highlight corresponding areas in the preview
- Selection confirmation: Selected areas display with green frames once saved
Creating FirstSpirit Components
The Template Wizard can generate various FirstSpirit components from HTML structures:
Automatically Generated Components
PAGE_TEMPLATE
- Created automatically when HTML structures are added to the import project
- Becomes a full FirstSpirit template after content areas and input components are defined
- Serves as the foundation for page layouts
Components Created via Preview Selection
BODY/Content Areas
- Define editable page sections
- Mark regions where editors can add and modify content
- Created by selecting areas in the HTML preview
SECTION_TEMPLATE
- Reusable template structures
- Created from repeating HTML patterns
- Can be nested within page templates
INPUT_COMPONENT
- Form elements for editorial input
- Automatically generated from HTML form elements (e.g., image components from
<img>tags) - Maps HTML inputs to FirstSpirit form components
LINK_TEMPLATE
- Navigation elements
- Created from HTML anchor tags and navigation structures
- Enables dynamic link management
RENDER_TEMPLATE
- Format templates for content rendering
- Controls how content is displayed in different contexts
- Separates content from presentation
MediaMapping
- Images or files imported as FirstSpirit media
- Automatically maps HTML media references to FirstSpirit Media Store
- Preserves asset organization and references
Component Creation Workflow
- Analyze HTML: Review the imported HTML structure in the preview
- Identify areas: Select HTML elements that should become FirstSpirit components
- Generate components: Use the wizard to create appropriate component types
- Visual confirmation: Selected areas show green frames indicating successful creation
- Configure properties: Set component properties and configuration options
Form Builder
Overview
The Form Builder is an integral part of the Template Wizard that simplifies creation of reusable form components. Forms are essential FirstSpirit template components that "provide the editor with a means of adding editorial content to pages and sections."
Component Templates
Component templates are "flexible form boilerplates which are created once and can then be reused again and again." They combine GOM definition elements with FirstSpirit template syntax.
Key Advantages:
- One-time creation: Create once, reuse multiple times
- Server-wide availability: Access templates across projects through "Import templates from project" function
- Reusable boilerplates: Share form structures across current and other projects
- Flexibility: Combine GOM definitions with template syntax for customization
Form Component Types
Forms utilize two primary component categories:
Input Components
- Accommodate editorial content
- Examples:
CMS_INPUT_DATE,CMS_INPUT_DOM,CMS_INPUT_TEXT,CMS_INPUT_TEXTAREA - Map to HTML form elements and content areas
- Enable structured content entry
Design Components
- Visualize the input components
- Control layout and presentation of form elements
- Provide visual structure for editors
- Enhance user experience in ContentCreator
Creating Forms
- Access Form Builder: Navigate to the Settings tab in the Template Wizard
- Create component templates: Define new form boilerplates
- Configure input components: Set up components for specific application scenarios
- Design layout: Arrange input and design components
- Save and reuse: Make templates available for current and future projects
Form Builder Limitations
The Template Wizard has two significant constraints for form creation:
Cannot Group Input Components
- The wizard does not support automatic creation of
CMS_GROUPelements - Manual adaptation required post-import to group related input components
- Grouping must be done in FirstSpirit SiteArchitect after wizard-based creation
No Dynamic Forms Support
- The wizard cannot create dynamic forms that change based on user input
- Complex conditional logic requires manual template modification
- Dynamic form behaviors must be implemented in SiteArchitect
Post-Wizard Form Customization
For complex form requirements beyond wizard capabilities, manual template modification in FirstSpirit SiteArchitect may be necessary:
- Adding
CMS_GROUPelements to organize related inputs - Implementing dynamic form behaviors with conditional logic
- Creating custom validation rules
- Adding advanced input component configurations
- Implementing complex data models
Best Practices
HTML Preparation
Structure for Import
- Use clean, semantic HTML markup
- Avoid complex JavaScript-based layouts
- Keep navigation structures simple and well-organized
- Use standard HTML form elements where possible
- Externalize CSS and JavaScript files for easier import
Asset Organization
- Use relative paths for images and files
- Keep assets in logical directory structures
- Avoid embedding resources in JavaScript
- Use standard image formats (JPG, PNG, GIF, SVG)
Wizard Usage
Planning Phase
- Analyze HTML mockups before importing
- Identify reusable components and patterns
- Map HTML structures to FirstSpirit component types
- Plan content areas and editorial workflows
- Document navigation and link structures
Import Strategy
- Start with simple page templates
- Import one section at a time for complex sites
- Backup projects before reimporting
- Test imports in development environment first
- Verify asset imports are complete
Component Creation
- Use descriptive names for components
- Create section templates for reusable structures
- Define content areas strategically for editor flexibility
- Map HTML semantic elements to appropriate FirstSpirit components
- Leverage component templates for consistency
Form Builder Best Practices
Template Design
- Create component templates for frequently used form patterns
- Use clear, descriptive names for input components
- Design forms with editor experience in mind
- Balance flexibility with structure
- Document component template purposes
Component Configuration
- Configure input components for specific use cases
- Set appropriate validation rules
- Provide helpful labels and descriptions
- Consider default values for common scenarios
- Test forms with actual editorial content
Post-Import Enhancement
- Group related input components with
CMS_GROUPafter import - Add validation rules in SiteArchitect
- Implement conditional logic for complex forms
- Enhance user experience with custom styling
- Add help text and documentation for editors
Multi-User Considerations
Important Limitation: The Template Wizard does not support multi-user operations. Best practices:
- Coordinate wizard usage with team members
- Designate one developer for initial imports
- Use version control for tracking changes
- Document wizard-created templates
- Plan import schedules to avoid conflicts
Maintenance and Updates
Version Management
- Document wizard-generated templates
- Track manual modifications separately
- Create backup before reimporting HTML
- Test updated HTML in isolated environment
- Maintain changelog of template modifications
Ongoing Development
- Reserve wizard for initial template creation
- Use SiteArchitect for ongoing modifications
- Avoid reimporting unless necessary
- Keep HTML mockups synchronized with templates
- Document deviations from original HTML
Common Workflows
Creating a New Page Template from HTML
- Import HTML file using "Select HTML file" button
- Verify asset imports - Check that images and files imported correctly
- Analyze structure in HTML preview
- Define content areas by selecting editable regions
- Create input components for dynamic content
- Configure form elements using Form Builder
- Test in ContentCreator with sample content
- Enhance manually in SiteArchitect as needed
Building Reusable Section Templates
- Identify repeating patterns in HTML mockups
- Import HTML containing the section structure
- Select section elements in preview
- Create SECTION_TEMPLATE from selection
- Define input components for variable content
- Configure component template for reusability
- Test section in multiple contexts
- Make available across project
Converting HTML Forms to FirstSpirit
- Import HTML with form elements
- Analyze form structure and fields
- Use Form Builder to create component templates
- Map HTML inputs to FirstSpirit input components
- Configure validation and constraints
- Group related fields manually with
CMS_GROUP - Test editorial workflow in ContentCreator
- Document form usage for editors
Updating Templates from New HTML Versions
- Backup current project state
- Document manual modifications made since last import
- Import updated HTML (will overwrite existing)
- Verify component mappings remain correct
- Reapply manual modifications from backup
- Test thoroughly before deploying
- Update documentation with changes
Troubleshooting
Assets Not Importing
Problem: Images or files referenced in HTML don't import automatically
Solutions:
- Check that asset paths are relative, not absolute
- Verify assets aren't embedded in JavaScript
- Manually import missing assets through Media Store
- Update references in templates after manual import
Navigation Not Mapping Correctly
Problem: HTML navigation doesn't transfer to FirstSpirit structure
Solution: The wizard cannot automatically map navigation. Manually create:
- Navigation structure in SiteArchitect
- Link templates for navigation elements
- Menu templates for dynamic navigation
Reimport Overwrites Customizations
Problem: Reimporting HTML loses manual template modifications
Prevention:
- Always backup before reimporting
- Document all manual changes
- Consider if reimport is truly necessary
- Plan to reapply customizations after reimport
Form Groups Missing
Problem: Related form fields aren't grouped
Solution: The wizard doesn't create CMS_GROUP elements automatically. After import:
- Open template in SiteArchitect
- Add
CMS_GROUPtags around related input components - Configure group properties (collapsed, labels, etc.)
Dynamic Form Features Needed
Problem: Need conditional or dynamic form behaviors
Solution: Wizard doesn't support dynamic forms. In SiteArchitect:
- Add conditional logic with template syntax
- Implement visibility rules
- Create dependent field behaviors
- Use scripts for complex interactions
Technical Considerations
Performance
- Large HTML structures may take time to analyze
- Asset import speed depends on file sizes and quantity
- Preview rendering affected by HTML complexity
- Consider importing complex sites in sections
Compatibility
- Supports HTML and JSP file formats
- Works with standard HTML form elements
- Compatible with CSS and JavaScript files
- Integrates with FirstSpirit Media Store
Limitations Summary
The Template Wizard has specific limitations that require manual intervention:
- No JavaScript asset handling - Dynamically loaded assets must be imported manually
- No navigation mapping - Navigation structures require manual configuration
- No merge on reimport - Reimports overwrite existing modifications
- No multi-user support - Single-user tool for template creation
- No component grouping -
CMS_GROUPmust be added manually - No dynamic forms - Complex form logic requires SiteArchitect
Summary
The Template Wizard accelerates FirstSpirit template development by automating HTML import and component generation. While powerful for initial template creation, it works best as part of a hybrid approach:
- Use wizard for: Initial HTML import, asset transfer, basic component creation, form boilerplates
- Use SiteArchitect for: Component grouping, dynamic forms, navigation mapping, complex customizations
By understanding both the capabilities and limitations of the Template Wizard, developers can efficiently create FirstSpirit templates while knowing when to transition to manual development for advanced features.