Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Store and retrieve templates to/from file system #227

Merged
merged 29 commits into from
Jul 16, 2023

Conversation

johnhenley
Copy link
Collaborator

@johnhenley johnhenley commented Feb 6, 2023

Description of PR...

Editing and testing Forum Templates is cumbersome because the templates are in the database. File-based templates makes creating and maintaining templates much easier.

Changes made

  • Templates are now retrieved from .txt files rather than database

  • During upgrade, templates existing in the database table activeforums_templates are extracted to ~/DesktopModules/ActiveForums/{theme}/templates/ based on the theme associated with the template's module instance. Templates not associated to a module instance are written to ~/DesktopModules/ActiveForums/{theme}/templates/

  • Template files are named using the template's "title", e.g., ForumView.txt. If multiple templates with the same name exist within the same instance of the Forums module installed on the DNN host, the template file names are made unique by appending the ModuleId and TemplateId from activeforums_Templates to the filename, e.g., TopicView-43-18.txt.

  • When loading templates at runtime, they are loaded from (in high-to-low priority order):

  • ~/DesktopModules/ActiveForums/{theme}/templates/

  • ~/DesktopModules/ActiveForums/templates/

  • ~/DesktopModules/ActiveForums/config/templates/ (delivered templates)

  • Templates can either be edited directly on the server or can still be edited using the template editor in the Forums module. The template file name is displayed in the template editor:

image

PR Template Checklist

  • Fixes Bug
  • Feature solution
  • Other

Please mark which issue is solved

Closes #93

@johnhenley johnhenley added the enhancement New feature or request label Feb 6, 2023
@johnhenley johnhenley added this to the 08.00.00 milestone Feb 6, 2023
@johnhenley johnhenley self-assigned this Feb 6, 2023
@johnhenley
Copy link
Collaborator Author

@WillStrohl @Timo-Breumelhof Since previous PR #194 was just too big for good testing, I canceled it and I'm moving some of those changes into earlier PRs (like #226 for removing hardcoded paths). I will also be creating additional future PRs for moving templates to host folder rather than desktopmodules, moving themes to host folder rather than desktopmodules, and packaging up the themes from dnncommunity.org.

@Timo-Breumelhof
Copy link
Contributor

Ok seem logical, thank you:-)

@johnhenley johnhenley changed the title Store and retrieve templates to/from file system ENH: Store and retrieve templates to/from file system Jun 30, 2023
Copy link
Member

@WillStrohl WillStrohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@WillStrohl
Copy link
Member

@johnhenley These should be easy to remedy. :)

@johnhenley
Copy link
Collaborator Author

@johnhenley These should be easy to remedy. :)

done i hope :)

@WillStrohl
Copy link
Member

Yep, we're good this time! :)

@WillStrohl WillStrohl merged commit 43bf297 into DNNCommunity:dev Jul 16, 2023
1 check passed
@johnhenley johnhenley deleted the issues/93 branch July 16, 2023 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change Templates to Cached File based
3 participants