%name:Template Manager% %version:v13.0.4.1% %wikipage:Template_Manager% %author:Bill Herndon% %description:
Supports the loading, unloading, saving, and erasing of template data from the TNG database. Local template configuration files having the same format as in previous TNG releases are used to store template data when not resident in the TNG database. The mod can be used to preserve templates across releases or for loading entirely new templates.
© 2018 - 2021, ArcLindon LLC, Some Rights Reserved**
** Users are granted a non-exclusive, non-transferable license to install and run this software for personal, non-commercial purposes. All other rights are reserved.
% %target:admin_templateconfig.php% %location:% if( $link ) { %end:% %insert:before% // BEGIN: Template Manager include("adminlog.php"); include($cms['tngpath'] . "$extspath/tmpltm_lib_templates.php" ); // END: Template Manager // BEGIN: Template Manager $umsg = null; $lmsg = null; $post = isset($_POST['action']); if ($post) { // we have a post - fetch the template $tmplt = $_POST['template']; if ($_POST['action'] == 'unload') { // unload the template $tfields = tmpltm_readTemplateFields($tmplt); $tname = (is_numeric($tmplt)) ? "template$tmplt" : $tmplt; $result = tmpltm_writeTemplateData($tfields, $tname); if ($result) { if (tmpltm_wipeTemplateFields($tmplt)) { $umsg = "Template '$tmplt' saved to the TNG installation and removed from the database."; } else { $umsg = "Saved template '$tmplt' but unable to remove from the database."; } } else { $umsg = "Attempt to unload template '$tname' failed."; } } else if ($_POST['action'] == 'wipe') { // remove from the database if (tmpltm_wipeTemplateFields($tmplt)) { $umsg = "Template '$tmplt' removed from the database."; } else { $umsg = "Unable to remove '$templt' from the database."; } } else if ($_POST['action'] == 'load') { // load a template $tdata = tmpltm_readTemplateData($tmplt); if ($tdata) { tmpltm_writeTemplateFields($tdata); $lmsg = "Template '$tmplt' loaded into the database"; } else { $lmsg = "Attempt to load template '$tmplt' failed."; } } else if ($_POST['action'] == 'persist') { // save a template $tfields = tmpltm_readTemplateFields($tmplt); $tname = (is_numeric($tmplt)) ? "template$tmplt" : $tmplt; $result = tmpltm_writeTemplateData($tfields, $tname); if ($result > 0) { $umsg = "Template '$tmplt' saved to the TNG installation."; } else { $umsg = "Attempt to save template '$tmplt' failed."; } } else if ($_POST['action'] == 'saveall') { // save all $result = tmpltm_saveAll(); $umsg = "Saved $result templates to the TNG installation."; } else if ($_POST['action'] == 'loadall') { // load all $result = tmpltm_loadAll(); $lmsg = "Loaded $result templates into the TNG database."; } else { // unrecognized action $lmsg = "I'm sorry Dave, I'm afraid I can't do that."; } } // END: Template Manager %end:% %location:%