diff --git a/library/StaticHtmlOutput.php b/library/StaticHtmlOutput.php index b8f0c764..aa392831 100644 --- a/library/StaticHtmlOutput.php +++ b/library/StaticHtmlOutput.php @@ -185,6 +185,7 @@ class StaticHtmlOutput do_action(self::HOOK . '-saveOptions'); + $this->_view ->setTemplate('options-page') ->assign('exportLog', $this->_exportLog) diff --git a/views/options-page.phtml b/views/options-page.phtml index 24fc548f..72e009a8 100644 --- a/views/options-page.phtml +++ b/views/options-page.phtml @@ -119,6 +119,37 @@ jQuery(document).ready(function($){ $('.options-form:last').clone().insertAfter('.options-form:last'); }); + + // load existing settings + if (settings != 'banana') { + console.log('existing settings found, lets use those'); + + archives = settings.split('baseUrl='); + // remove crufty first element + archives.shift(); + console.log(archives); + + + // iterate each saved settings chunk and create forms for them + $.each(archives, function(index, value) { + // add back in the 'baseUrl=' + archive = 'baseUrl=' + value; + // trim trailing field + //archive = archive.substring(0, archive.indexOf('&staticExportSettings=&')); + archive = archive.substring(0, archive.indexOf('&staticExportSettings=')); + //archive = archive.substring(0, archive.indexOf('staticExportSettings=')); + console.log(archive); + + settingsBlock = JSON.parse('{"' + decodeURI(archive).replace(/\n/g, ",").replace(/\r/g, ",").replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"') + '"}'); + + console.log(settingsBlock); + }); + + + + + } + });