コード例 #1
0
ファイル: helper.php プロジェクト: rlee1962/diylegalcenter
 function increasePerf()
 {
     if (acymailing::bytes(@ini_get('memory_limit')) < 60000000) {
         @ini_set('memory_limit', '64M');
     }
     @ini_set('max_execution_time', 0);
 }
コード例 #2
0
ファイル: view.html.php プロジェクト: rlee1962/diylegalcenter
    function form()
    {
        $mailid = acymailing::getCID('mailid');
        $templateClass = acymailing::get('class.template');
        $config =& acymailing::config();
        if (!empty($mailid)) {
            $mailClass = acymailing::get('class.mail');
            $mail = $mailClass->get($mailid);
            if (!empty($mail->tempid)) {
                $myTemplate = $templateClass->get($mail->tempid);
            }
        } else {
            $mail->created = time();
            $mail->published = 0;
            $mail->visible = 1;
            $mail->html = 1;
            $mail->body = '';
            $mail->altbody = '';
            $mail->tempid = 0;
            $myTemplate = $templateClass->getDefault();
            if (!empty($myTemplate->tempid)) {
                $mail->body = acymailing::absoluteURL($myTemplate->body);
                $mail->altbody = $myTemplate->altbody;
                $mail->tempid = $myTemplate->tempid;
                $mail->subject = $myTemplate->subject;
                $mail->replyname = $myTemplate->replyname;
                $mail->replyemail = $myTemplate->replyemail;
                $mail->fromname = $myTemplate->fromname;
                $mail->fromemail = $myTemplate->fromemail;
            }
            if ($this->type == 'autonews') {
                $mail->frequency = 604800;
            }
        }
        $sentbyname = '';
        if (!empty($mail->sentby)) {
            $db =& JFactory::getDBO();
            $db->setQuery('SELECT `name` FROM `#__users` WHERE `id`= ' . intval($mail->sentby) . ' LIMIT 1');
            $sentbyname = $db->loadResult();
        }
        $this->assignRef('sentbyname', $sentbyname);
        if (JRequest::getVar('task', '') == 'replacetags') {
            $mailerHelper = acymailing::get('helper.mailer');
            JPluginHelper::importPlugin('acymailing');
            $dispatcher =& JDispatcher::getInstance();
            $dispatcher->trigger('acymailing_replacetags', array(&$mail));
            if (!empty($mail->altbody)) {
                $mail->altbody = $mailerHelper->textVersion($mail->altbody, false);
            }
        }
        $extraInfos = '';
        $values = null;
        if ($this->type == 'followup') {
            $campaignid = JRequest::getInt('campaign', 0);
            $extraInfos .= '&campaign=' . $campaignid;
            $values->delay = acymailing::get('type.delay');
            $this->assignRef('campaignid', $campaignid);
        } else {
            $listmailClass = acymailing::get('class.listmail');
            $lists = $listmailClass->getLists($mailid);
        }
        acymailing::setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=edit&mailid=' . $mailid . $extraInfos);
        $bar =& JToolBar::getInstance('toolbar');
        if (empty($mail->mailid)) {
            $bar->appendButton('Popup', 'acytemplate', JText::_('TEMPLATE'), acymailing::completeLink("template&task=theme", true));
        }
        $bar->appendButton('Popup', 'tag', JText::_('TAGS'), acymailing::completeLink("tag&task=tag&type=" . $this->type, true), 750, 550);
        if (in_array($this->type, array('news', 'followup'))) {
            JToolBarHelper::custom('replacetags', 'replacetag', '', JText::_('REPLACE_TAGS'), false);
        }
        $buttonPreview = JText::_('PREVIEW');
        if ($this->type == 'news') {
            $buttonPreview .= ' / ' . JText::_('SEND');
        }
        JToolBarHelper::divider();
        JToolBarHelper::custom('savepreview', 'preview', '', $buttonPreview, false);
        JToolBarHelper::save();
        JToolBarHelper::apply();
        JToolBarHelper::cancel();
        JToolBarHelper::divider();
        $bar->appendButton('Pophelp', $this->ctrl . '-form');
        jimport('joomla.html.pane');
        $tabs =& JPane::getInstance('tabs');
        $values->maxupload = acymailing::bytes(ini_get('upload_max_filesize')) > acymailing::bytes(ini_get('post_max_size')) ? ini_get('post_max_size') : ini_get('upload_max_filesize');
        $toggleClass = acymailing::get('helper.toggle');
        $editor = acymailing::get('helper.editor');
        $editor->name = 'editor_body';
        $editor->content = $mail->body;
        $js = "function updateEditor(htmlvalue){";
        $js .= 'if(htmlvalue == \'0\'){window.document.getElementById("htmlfieldset").style.display = \'none\'}else{window.document.getElementById("htmlfieldset").style.display = \'block\'}';
        $js .= '}';
        $js .= 'window.addEvent(\'load\', function(){ updateEditor(' . $mail->html . '); });';
        $script = 'function addFileLoader(){
		var divfile=window.document.getElementById("loadfile");
		var input = document.createElement(\'input\');
		input.type = \'file\';
		input.size = \'30\';
		input.name = \'attachments[]\';
		divfile.appendChild(document.createElement(\'br\'));
		divfile.appendChild(input);}
		';
        $script .= 'function submitbutton(pressbutton){
						if (pressbutton == \'cancel\') {
							submitform( pressbutton );
							return;
						}';
        $script .= 'if(window.document.getElementById("subject").value.length < 2){alert(\'' . JText::_('ENTER_SUBJECT', true) . '\'); return false;}';
        $script .= $editor->jsCode();
        $script .= 'submitform( pressbutton );}
		';
        $script .= "function changeTemplate(newhtml,newtext,newsubject,stylesheet,fromname,fromemail,replyname,replyemail,tempid){\r\r\n\t\t\tif(newhtml.length>2){" . $editor->setContent('newhtml') . "}\r\r\n\t\t\tvar vartextarea =\$('altbody'); if(newtext.length>2) vartextarea.setHTML(newtext);\r\r\n\t\t\tdocument.getElementById('tempid').value = tempid;\r\r\n\t\t\tif(fromname.length>1){document.getElementById('fromname').value = fromname;}\r\r\n\t\t\tif(fromemail.length>1){document.getElementById('fromemail').value = fromemail;}\r\r\n\t\t\tif(replyname.length>1){document.getElementById('replyname').value = replyname;}\r\r\n\t\t\tif(replyemail.length>1){document.getElementById('replyemail').value = replyemail;}\r\r\n\t\t\tif(newsubject.length>1){document.getElementById('subject').value = newsubject;}\r\r\n\t\t}\r\r\n\t\t";
        $script .= "function insertTag(tag){ try{jInsertEditorText(tag,'editor_body'); return true;} catch(err){alert('Your editor does not enable AcyMailing to automatically insert the tag, please copy/paste it manually in your Newsletter'); return false;}}";
        $script .= "window.addEvent('domready', function(){ mytoolbar = \$('toolbar'); if(!mytoolbar) return true; mytoolbar.addEvent('mouseover', function(){ try{IeCursorFix();}catch(e){} }); }); ";
        $doc =& JFactory::getDocument();
        $doc->addScriptDeclaration($js . $script);
        if ($this->type == 'autonews') {
            JHTML::_('behavior.modal', 'a.modal');
            $this->assignRef('delay', acymailing::get('type.delay'));
            $this->assignRef('generatingMode', acymailing::get('type.generatemode'));
            $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_autonews';
            $values->editnotification = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
        }
        $this->assignRef('toggleClass', $toggleClass);
        $this->assignRef('lists', $lists);
        $this->assignRef('editor', $editor);
        $this->assignRef('mail', $mail);
        $this->assignRef('tabs', $tabs);
        $this->assignRef('values', $values);
    }
コード例 #3
0
ファイル: file.php プロジェクト: rlee1962/diylegalcenter
 */
defined('_JEXEC') or die('Restricted access');
?>

<table class="admintable" cellspacing="1">
	<tr>
		<td class="key" >
			<?php 
echo JText::_('UPLOAD_FILE');
?>

		</td>
		<td>
			<input type="file" size="50" name="importfile" />
			<?php 
echo JText::sprintf('MAX_UPLOAD', acymailing::bytes(ini_get('upload_max_filesize')) > acymailing::bytes(ini_get('post_max_size')) ? ini_get('post_max_size') : ini_get('upload_max_filesize'));
?>

		</td>
	</tr>
	<tr>
		<td class="key" >
			<?php 
echo JText::_('CHARSET_FILE');
?>

		</td>
		<td>
			<?php 
$charsetType = acymailing::get('type.charset');
array_unshift($charsetType->values, JHTML::_('select.option', JText::_('UNKNOWN'), ''));
コード例 #4
0
ファイル: view.html.php プロジェクト: bizanto/Hooked
    function form()
    {
        JHTML::_('behavior.mootools');
        $mailid = acymailing::getCID('mailid');
        if (empty($mailid)) {
            $mailid = JRequest::getString('mailid');
        }
        $mailClass = acymailing::get('class.mail');
        $mail = $mailClass->get($mailid);
        if (empty($mail)) {
            $config =& acymailing::config();
            $mail->created = time();
            $mail->fromname = $config->get('from_name');
            $mail->fromemail = $config->get('from_email');
            $mail->replyname = $config->get('reply_name');
            $mail->replyemail = $config->get('reply_email');
            $mail->subject = '';
            $mail->type = JRequest::getString('type');
            $mail->published = 1;
            $mail->visible = 0;
            $mail->html = 1;
            $mail->body = '';
            $mail->altbody = '';
            $mail->tempid = 0;
        }
        jimport('joomla.html.pane');
        $tabs =& JPane::getInstance('tabs');
        $values = null;
        $values->maxupload = acymailing::bytes(ini_get('upload_max_filesize')) > acymailing::bytes(ini_get('post_max_size')) ? ini_get('post_max_size') : ini_get('upload_max_filesize');
        $toggleClass = acymailing::get('helper.toggle');
        $editor = acymailing::get('helper.editor');
        $editor->name = 'editor_body';
        $editor->content = $mail->body;
        $js = "function updateAcyEditor(htmlvalue){";
        $js .= 'if(htmlvalue == \'0\'){window.document.getElementById("htmlfieldset").style.display = \'none\'}else{window.document.getElementById("htmlfieldset").style.display = \'block\'}';
        $js .= '}';
        $js .= 'window.addEvent(\'load\', function(){ updateAcyEditor(' . $mail->html . '); });';
        $script = 'function addFileLoader(){
		var divfile=window.document.getElementById("loadfile");
		var input = document.createElement(\'input\');
		input.type = \'file\';
		input.size = \'30\';
		input.name = \'attachments[]\';
		divfile.appendChild(document.createElement(\'br\'));
		divfile.appendChild(input);}
		';
        if (version_compare(JVERSION, '1.6.0', '<')) {
            $script .= 'function submitbutton(pressbutton){
						if (pressbutton == \'cancel\') {
							submitform( pressbutton );
							return;
						}';
        } else {
            $script .= 'Joomla.submitbutton = function(pressbutton) {
						if (pressbutton == \'cancel\') {
							Joomla.submitform(pressbutton,document.adminForm);
							return;
						}';
        }
        $script .= 'if(window.document.getElementById("subject").value.length < 2){alert(\'' . JText::_('ENTER_SUBJECT', true) . '\'); return false;}';
        $script .= $editor->jsCode();
        if (version_compare(JVERSION, '1.6.0', '<')) {
            $script .= 'submitform( pressbutton );} ';
        } else {
            $script .= 'Joomla.submitform(pressbutton,document.adminForm);}; ';
        }
        $script .= "function insertTag(tag){ try{jInsertEditorText(tag,'editor_body'); document.getElementById('iframetag').style.display = 'none'; displayTags(); return true;} catch(err){alert('Your editor does not enable AcyMailing to automatically insert the tag, please copy/paste it manually in your Newsletter'); return false;}}";
        $iFrame = "'<iframe src=\\'index.php?option=com_acymailing&ctrl=tag&task=tag&type=news\\' width=\\'100%\\' height=\\'100%\\' scrolling=\\'auto\\'></iframe>'";
        $script .= "var openTag = true;\r\n\t\t\t\t\tfunction displayTags(){var box=\$('iframetag'); if(openTag){box.innerHTML = " . $iFrame . "; box.setStyle('display','block');}\r\n\t\t\t\t\ttry{\r\n\t\t\t\t\t\tvar fx = box.effects({duration: 1500, transition: Fx.Transitions.Quart.easeOut});\r\n\t\t\t\t\t\tif(openTag){fx.start({'height': 300});}else{fx.start({'height': 0}).chain(function() {box.innerHTML = '';box.setStyle('display','none');})};\r\n\t\t\t\t\t}catch(err){\r\n\t\t\t\t\t\tbox.style.height = '300px';\r\n\t\t\t\t\t\tvar myVerticalSlide = new Fx.Slide('iframetag');\r\n\t\t\t\t\t\tif(openTag){\r\n\t\t\t\t\t\t\tmyVerticalSlide.slideIn();\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tmyVerticalSlide.slideOut().chain(function() {\r\n\t\t\t\t\t\t\t\tbox.innerHTML='';\r\n\t\t\t\t\t\t\t\tbox.setStyle('display','none');\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\topenTag = !openTag;}";
        $iFrame = "'<iframe src=\\'index.php?option=com_acymailing&ctrl=template&task=theme&tmpl=component\\' width=\\'100%\\' height=\\'100%\\' scrolling=\\'auto\\'></iframe>'";
        $script .= "var openTemplate = true;\r\n\t\t\t\t\tfunction displayTemplates(){var box=\$('iframetemplate'); if(openTemplate){box.innerHTML = " . $iFrame . "; box.setStyle('display','block');}\r\n\t\t\t\t\ttry{\r\n\t\t\t\t\t\tvar fx = box.effects({duration: 1500, transition: Fx.Transitions.Quart.easeOut});\r\n\t\t\t\t\t\tif(openTemplate){fx.start({'height': 300});}else{fx.start({'height': 0}).chain(function() {box.innerHTML = '';box.setStyle('display','none');})};\r\n\t\t\t\t\t}catch(err){\r\n\t\t\t\t\t\tbox.style.height = '300px';\r\n\t\t\t\t\t\tvar myVerticalSlide = new Fx.Slide('iframetemplate');\r\n\t\t\t\t\t\tif(openTemplate){\r\n\t\t\t\t\t\t\tmyVerticalSlide.slideIn();\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tmyVerticalSlide.slideOut().chain(function() {\r\n\t\t\t\t\t\t\t\tbox.innerHTML='';\r\n\t\t\t\t\t\t\t\tbox.setStyle('display','none');\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\topenTemplate = !openTemplate;}";
        $script .= "function changeTemplate(newhtml,newtext,newsubject,stylesheet,fromname,fromemail,replyname,replyemail,tempid){\r\n\t\t\tif(newhtml.length>2){" . $editor->setContent('newhtml') . "}\r\n\t\t\tvar vartextarea =\$('altbody'); if(newtext.length>2) vartextarea.innerHTML = newtext;\r\n\t\t\tdocument.getElementById('tempid').value = tempid;\r\n\t\t\tif(fromname.length>1){document.getElementById('fromname').value = fromname;}\r\n\t\t\tif(fromemail.length>1){document.getElementById('fromemail').value = fromemail;}\r\n\t\t\tif(replyname.length>1){document.getElementById('replyname').value = replyname;}\r\n\t\t\tif(replyemail.length>1){document.getElementById('replyemail').value = replyemail;}\r\n\t\t\tif(newsubject.length>1){document.getElementById('subject').value = newsubject;}\r\n\t\t\tdocument.getElementById('iframetemplate').style.display = 'none'; displayTemplates();\r\n\t\t}\r\n\t\t";
        $doc =& JFactory::getDocument();
        $doc->addScriptDeclaration($js . $script);
        $doc->addStyleSheet(ACYMAILING_CSS . 'frontendedition.css');
        $this->assignRef('toggleClass', $toggleClass);
        $this->assignRef('editor', $editor);
        $this->assignRef('values', $values);
        $this->assignRef('mail', $mail);
        $this->assignRef('tabs', $tabs);
    }
コード例 #5
0
ファイル: view.html.php プロジェクト: rlee1962/diylegalcenter
    function form()
    {
        JHTML::_('behavior.modal', 'a.modal');
        $templateClass = acymailing::get('class.template');
        $mailid = acymailing::getCID('mailid');
        $my = JFactory::getUser();
        if (!empty($mailid)) {
            $mailClass = acymailing::get('class.mail');
            $mail = $mailClass->get($mailid);
            if (!empty($mail->tempid)) {
                $myTemplate = $templateClass->get($mail->tempid);
            }
        } else {
            $config =& acymailing::config();
            $mail->created = time();
            $mail->published = 0;
            $mail->visible = 1;
            $mail->html = 1;
            $mail->body = '';
            $mail->altbody = '';
            $mail->tempid = 0;
            $myTemplate = $templateClass->getDefault();
            if (!empty($myTemplate->tempid)) {
                $mail->body = $myTemplate->body;
                $mail->altbody = $myTemplate->altbody;
                $mail->tempid = $myTemplate->tempid;
                $mail->subject = $myTemplate->subject;
                $mail->replyname = $myTemplate->replyname;
                $mail->replyemail = $myTemplate->replyemail;
                $mail->fromname = $myTemplate->fromname;
                $mail->fromemail = $myTemplate->fromemail;
            }
            if ($config->get('frontend_sender', 0)) {
                $mail->fromname = $my->name;
                $mail->fromemail = $my->email;
            } else {
                if (empty($mail->fromname)) {
                    $mail->fromname = $config->get('from_name');
                }
                if (empty($mail->fromemail)) {
                    $mail->fromemail = $config->get('from_email');
                }
            }
            if ($config->get('frontend_reply', 0)) {
                $mail->replyname = $my->name;
                $mail->replyemail = $my->email;
            } else {
                if (empty($mail->replyname)) {
                    $mail->replyname = $config->get('reply_name');
                }
                if (empty($mail->replyemail)) {
                    $mail->replyemail = $config->get('reply_email');
                }
            }
        }
        $sentbyname = '';
        if (!empty($mail->sentby)) {
            $db =& JFactory::getDBO();
            $db->setQuery('SELECT `name` FROM `#__users` WHERE `id`= ' . intval($mail->sentby) . ' LIMIT 1');
            $sentbyname = $db->loadResult();
        }
        $this->assignRef('sentbyname', $sentbyname);
        if (JRequest::getVar('task', '') == 'replacetags') {
            $mailerHelper = acymailing::get('helper.mailer');
            JPluginHelper::importPlugin('acymailing');
            $dispatcher =& JDispatcher::getInstance();
            $dispatcher->trigger('acymailing_replacetags', array(&$mail));
            if (!empty($mail->altbody)) {
                $mail->altbody = $mailerHelper->textVersion($mail->altbody, false);
            }
        }
        $values = null;
        $listmailClass = acymailing::get('class.listmail');
        $lists = $listmailClass->getLists($mailid);
        $copyAllLists = $lists;
        foreach ($copyAllLists as $listid => $oneList) {
            if (!$oneList->published or empty($my->id) or empty($my->gid)) {
                unset($lists[$listid]);
                continue;
            }
            if ($oneList->access_manage == 'all') {
                continue;
            }
            if ((int) $my->id == (int) $oneList->userid) {
                continue;
            }
            if (!in_array($my->gid, explode(',', $oneList->access_manage))) {
                unset($lists[$listid]);
                continue;
            }
        }
        if (empty($lists)) {
            $app =& JFactory::getApplication();
            $app->enqueueMessage('You don\'t have the rights to add or edit an e-mail', 'error');
            $app->redirect(acymailing::completeLink('lists', false, true));
        }
        jimport('joomla.html.pane');
        $tabs =& JPane::getInstance('tabs');
        $values->maxupload = acymailing::bytes(ini_get('upload_max_filesize')) > acymailing::bytes(ini_get('post_max_size')) ? ini_get('post_max_size') : ini_get('upload_max_filesize');
        $toggleClass = acymailing::get('helper.toggle');
        $editor = acymailing::get('helper.editor');
        $editor->name = 'editor_body';
        $editor->content = $mail->body;
        $js = "function updateEditor(htmlvalue){";
        $js .= 'if(htmlvalue == \'0\'){window.document.getElementById("htmlfieldset").style.display = \'none\'}else{window.document.getElementById("htmlfieldset").style.display = \'block\'}';
        $js .= '}';
        $js .= 'window.addEvent(\'load\', function(){ updateEditor(' . $mail->html . '); });';
        $script = 'function addFileLoader(){
		var divfile=window.document.getElementById("loadfile");
		var input = document.createElement(\'input\');
		input.type = \'file\';
		input.size = \'30\';
		input.name = \'attachments[]\';
		divfile.appendChild(document.createElement(\'br\'));
		divfile.appendChild(input);}
		';
        $script .= 'function submitbutton(pressbutton){
						if (pressbutton == \'cancel\') {
							submitform( pressbutton );
							return;
						}';
        $script .= 'if(window.document.getElementById("subject").value.length < 2){alert(\'' . JText::_('ENTER_SUBJECT', true) . '\'); return false;}';
        $script .= $editor->jsCode();
        $script .= 'submitform( pressbutton );}';
        $script .= "function changeTemplate(newhtml,newtext,newsubject,stylesheet,fromname,fromemail,replyname,replyemail,tempid){\r\r\n\t\t\tif(newhtml.length>2){" . $editor->setContent('newhtml') . "}\r\r\n\t\t\tvar vartextarea =\$('altbody'); if(newtext.length>2) vartextarea.setHTML(newtext);\r\r\n\t\t\tdocument.getElementById('tempid').value = tempid;\r\r\n\t\t\tif(fromname.length>1){document.getElementById('fromname').value = fromname;}\r\r\n\t\t\tif(fromemail.length>1){document.getElementById('fromemail').value = fromemail;}\r\r\n\t\t\tif(replyname.length>1){document.getElementById('replyname').value = replyname;}\r\r\n\t\t\tif(replyemail.length>1){document.getElementById('replyemail').value = replyemail;}\r\r\n\t\t\tif(newsubject.length>1){document.getElementById('subject').value = newsubject;}\r\r\n\t\t}\r\r\n\t\t";
        $script .= "function insertTag(tag){ try{jInsertEditorText(tag,'editor_body'); return true;} catch(err){alert('Your editor does not enable AcyMailing to automatically insert the tag, please copy/paste it manually in your Newsletter'); return false;}}";
        $script .= "window.addEvent('domready', function(){ mytoolbar = \$('toolbar'); if(!mytoolbar) return true; mytoolbar.addEvent('mouseover', function(){ try{IeCursorFix();}catch(e){} }); }); ";
        $doc =& JFactory::getDocument();
        $doc->addScriptDeclaration($js . $script);
        $toggleClass = acymailing::get('helper.toggle');
        $toggleClass->ctrl = 'newsletter';
        $toggleClass->extra = '&listid=' . JRequest::getInt('listid');
        $this->assignRef('lists', $lists);
        $this->assignRef('editor', $editor);
        $this->assignRef('mail', $mail);
        $this->assignRef('tabs', $tabs);
        $this->assignRef('values', $values);
        $this->assignRef('toggleClass', $toggleClass);
    }
コード例 #6
0
ファイル: view.html.php プロジェクト: rlee1962/diylegalcenter
    function form()
    {
        $mailid = acymailing::getCID('mailid');
        if (empty($mailid)) {
            $mailid = JRequest::getString('mailid');
        }
        $mailClass = acymailing::get('class.mail');
        $mail = $mailClass->get($mailid);
        if (empty($mail)) {
            $config =& acymailing::config();
            $mail->created = time();
            $mail->fromname = $config->get('from_name');
            $mail->fromemail = $config->get('from_email');
            $mail->replyname = $config->get('reply_name');
            $mail->replyemail = $config->get('reply_email');
            $mail->subject = '';
            $mail->type = JRequest::getString('type');
            $mail->published = 1;
            $mail->visible = 0;
            $mail->html = 1;
            $mail->body = '';
            $mail->altbody = '';
            $mail->tempid = 0;
        }
        jimport('joomla.html.pane');
        $tabs =& JPane::getInstance('tabs');
        $values = null;
        $values->maxupload = acymailing::bytes(ini_get('upload_max_filesize')) > acymailing::bytes(ini_get('post_max_size')) ? ini_get('post_max_size') : ini_get('upload_max_filesize');
        $toggleClass = acymailing::get('helper.toggle');
        $editor = acymailing::get('helper.editor');
        $editor->name = 'editor_body';
        $editor->content = $mail->body;
        $js = "function updateEditor(htmlvalue){";
        $js .= 'if(htmlvalue == \'0\'){window.document.getElementById("htmlfieldset").style.display = \'none\'}else{window.document.getElementById("htmlfieldset").style.display = \'block\'}';
        $js .= '}';
        $js .= 'window.addEvent(\'load\', function(){ updateEditor(' . $mail->html . '); });';
        $script = 'function addFileLoader(){
		var divfile=window.document.getElementById("loadfile");
		var input = document.createElement(\'input\');
		input.type = \'file\';
		input.size = \'30\';
		input.name = \'attachments[]\';
		divfile.appendChild(document.createElement(\'br\'));
		divfile.appendChild(input);}
		';
        $script .= 'function submitbutton(pressbutton){
						if (pressbutton == \'cancel\') {
							submitform( pressbutton );
							return;
						}';
        $script .= 'if(window.document.getElementById("subject").value.length < 2){alert(\'' . JText::_('ENTER_SUBJECT', true) . '\'); return false;}';
        $script .= $editor->jsCode();
        $script .= 'submitform( pressbutton );}';
        $script .= "function changeTemplate(newhtml,newtext,tempid){\r\r\n\t\t\tif(newhtml.length>2){" . $editor->setContent('newhtml') . "}\r\r\n\t\t\tvar vartextarea =\$('altbody'); if(newtext.length>2){vartextarea.setHTML(newtext);}\r\r\n\t\t\tvar vartempid =\$('tempid'); vartempid.value = tempid;\r\r\n\t\t}";
        $script .= "function insertTag(tag){jInsertEditorText(tag,'editor_body');}";
        $doc =& JFactory::getDocument();
        $doc->addScriptDeclaration($js . $script);
        $doc->addStyleSheet(ACYMAILING_CSS . 'frontendedition.css');
        $this->assignRef('toggleClass', $toggleClass);
        $this->assignRef('editor', $editor);
        $this->assignRef('values', $values);
        $this->assignRef('mail', $mail);
        $this->assignRef('tabs', $tabs);
    }