*
* @package SendStudio
* @subpackage SendStudio_Functions
*/
/**
* Include the base sendstudio functions.
*/
require(dirname(__FILE__) . '/sendstudio_functions.php');
/**
* Class for handling previewing of items like templates, newsletters, autoresponders and forms.
*
* @package SendStudio
* @subpackage SendStudio_Functions
*/
class Preview extends SendStudio_Functions
{
/**
* Process
* Prints out the preview frames.
*
* @return Void Prints out the frame previews, doesn't return anything.
*/
function Process()
{
$design_rule_directory = IEM_PATH . '/resources/design_rules/';
$design_rule_files = list_files($design_rule_directory);
foreach ($design_rule_files as $design_rule) {
$filename_parts = pathinfo($design_rule);
if (isset($filename_parts['extension']) && $filename_parts['extension'] == 'php') {
require_once $design_rule_directory . $design_rule;
}
}
$valid_design_rules = array_keys($GLOBALS['Design_Rules']);
$action = '';
if (isset($_GET['Action'])) {
$action = strtolower($_GET['Action']);
}
$sync_key = urldecode($this->_getGETRequest('sync', false));
if ($sync_key) {
$details = IEM::sessionGet('PreviewWindowHash');
$details = $details[$sync_key];
} else {
$details = IEM::sessionGet('PreviewWindow');
}
if (empty($details)) {
return;
}
switch ($action) {
case 'top':
$GLOBALS['SwitchOptions'] = '';
if ($details['format'] == 't' || $details['format'] == 'b') {
$GLOBALS['SwitchOptions'] .= '';
$GLOBALS['HideDescription'] = "'';";
$GLOBALS['ShowDescription'] = "none;";
}
if ($details['format'] == 'h' || $details['format'] == 'b') {
$GLOBALS['SwitchOptions'] .= '';
$GLOBALS['ShowDescription'] = "'';";
$GLOBALS['HideDescription'] = "none;";
}
if ($details['showBroken']) {
$designrules_description = ''.GetLang('OriginalHTMLVersion').'';
foreach ($valid_design_rules as $design_rule) {
$designrules_description .= ' | '.
' '.$design_rule.
'';
}
$GLOBALS['DesignRules_Description'] = $designrules_description;
} else $GLOBALS['DesignRules_Description'] = '';
$this->ParseTemplate('Preview_Window_TopFrame', false, false);
break;
case 'brokenrules':
$content = '';
if (isset($details['htmlcontent'])) {
$content = $details['htmlcontent'];
}
$GLOBALS['BrokenRuleList'] = '';
foreach ($valid_design_rules as $design_rule) {
$GLOBALS['BrokenRuleList'] .= ''.
'