Version 4.1.2

This commit is contained in:
Neo committed 2025-12-19 05:32:19 -08:00
1 parent 3ba79295ee
commit 28bd025b35
1131 files changed
+63658 -20579

No files matched your search

@@ -42,7 +42,7 @@ class _emails extends \IPS\Dispatcher\Controller
public function manage()
{
/* Create the table */
$table = new \IPS\Helpers\Table\Db( 'core_email_templates', \IPS\Http\Url::internal( 'app=core&module=customization&controller=emails' ), array( "template_parent=?", 0 ) );
$table = new \IPS\Helpers\Table\Db( 'core_email_templates', \IPS\Http\Url::internal( 'app=core&module=customization&controller=emails' ), array( array( "template_parent=?", 0 ) ) );
$table->langPrefix = 'emailtpl_';
$table->mainColumn = 'template_name';
$table->include = array( 'template_name', 'template_app' );
@@ -94,14 +94,20 @@ class _emails extends \IPS\Dispatcher\Controller
return $return;
};
/* Import button */
/* Buttons */
\IPS\Output::i()->sidebar['actions'] = array(
'upload' => array(
'title' => 'upload_email_template',
'icon' => 'upload',
'link' => \IPS\Http\Url::internal( 'app=core&module=customization&controller=emails&do=import' ),
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('upload_email_template') )
),
),
'preview' => array(
'title' => 'preview_email_wrapper',
'icon' => 'search',
'link' => \IPS\Http\Url::internal( 'app=core&module=customization&controller=emails&do=preview' ),
'data' => array( 'ipsDialog' => \IPS\Http\Url::internal( 'app=core&module=customization&controller=emails&do=preview' ), 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('preview_email_wrapper') )
),
);
/* Display */
@@ -312,4 +318,38 @@ class _emails extends \IPS\Dispatcher\Controller
$key = $template['template_key'] . '_email_plaintext';
\IPS\Data\Store::i()->$key = $ptFunction;
}
/**
* Simple wrapper for the email out, so that we can show it in an iframe
*
* @return void
*/
public function preview()
{
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('emailtpl_edit');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'customization', 'core', 'admin' )->emailFrame( \IPS\Http\Url::internal( 'app=core&module=customization&controller=emails&do=emailPreview' ) );
}
/**
* Outputs the raw email preview HTML (to be called inside an iframe)
*
* @return void
*/
public function emailPreview()
{
/* Add some dummy content */
$body = \IPS\Theme::i()->getTemplate( 'customization', 'core', 'admin' )->emailPreview();
$templateData = \IPS\Db::i()->select( '*', 'core_email_templates', array( "template_app=? AND template_name=?", 'core', 'emailWrapper' ) )->first();
$template = "namespace IPS\Theme;\n" . \IPS\Theme::compileTemplate( $templateData['template_content_html'], "email_html_core_emailWrapper", $templateData['template_data'] );
if( !function_exists( 'IPS\\Theme\\email_html_core_emailWrapper' ) )
{
eval( $template );
}
$output = call_user_func_array( 'IPS\\Theme\\email_html_core_emailWrapper', array( NULL, new \IPS\Member, $body, NULL, FALSE, '', NULL ) );
\IPS\Output::i()->sendOutput( $output, 200, 'text/html' );
}
}