Ejemplo n.º 1
0
 public function getElementHtml()
 {
     if ($this->getWysiwyg() === true) {
         $element = $this->getState() == 'html' ? '' : $this->getHtmlId();
         $html = '
             <textarea name="' . $this->getName() . '" title="' . $this->getTitle() . '" id="' . $this->getHtmlId() . '" class="textarea ' . $this->getClass() . '" ' . $this->serialize($this->getHtmlAttributes()) . ' >' . $this->getEscapedValue() . '</textarea>
     		<script language="javascript" type="text/javascript" src="' . $this->getForm()->getBaseUrl() . 'js/tiny_mce/tiny_mce.js"></script>
     		<script language="javascript" type="text/javascript">
                /* tinyMCE.init({
                     mode : "exact",
                     theme : "' . $this->getTheme() . '",
                     elements : "' . $element . '",
                     theme_advanced_toolbar_location : "top",
                     theme_advanced_toolbar_align : "left",
                     theme_advanced_path_location : "bottom",
                     extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
                     theme_advanced_resize_horizontal : "false",
                     theme_advanced_resizing : "false",
                     apply_source_formatting : "true",
                     convert_urls : "false",
                     force_br_newlines : "true",
                     doctype : \'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\'
                 });*/
             </script>';
         /*plugins : "inlinepopups,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
           theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
           theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
           theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
           theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,|,visualchars,nonbreaking"*/
         $html .= $this->getAfterElementHtml();
         return $html;
     } else {
         return parent::getElementHtml();
     }
 }
Ejemplo n.º 2
0
 /**
  * Retrieve additional html and put it at the end of element html
  *
  * @access public
  * @return string
  * @author Ultimate Module Creator
  */
 public function getAfterElementHtml()
 {
     $html = parent::getAfterElementHtml();
     $disabled = $this->getDisabled() || $this->getReadonly();
     $html .= Mage::getSingleton('core/layout')->createBlock('adminhtml/widget_button', '', array('label' => Mage::helper('catalog')->__('WYSIWYG Editor'), 'type' => 'button', 'disabled' => $disabled, 'class' => $disabled ? 'disabled btn-wysiwyg' : 'btn-wysiwyg', 'onclick' => 'catalogWysiwygEditor.open(\'' . Mage::helper('adminhtml')->getUrl('*/*/wysiwyg') . '\', \'' . $this->getHtmlId() . '\')'))->toHtml();
     return $html;
 }
 public function getElementHtml()
 {
     $helper = Mage::helper('ebayenterprise_cmsassets');
     $this->addClass('code-editor');
     $this->setStyle(EbayEnterprise_CmsAssets_Helper_Data::EDITOR_STYLE);
     return parent::getElementHtml();
 }
Ejemplo n.º 4
0
 public function getAfterElementHtml()
 {
     $html = parent::getAfterElementHtml();
     if ($this->isWysiwygAllowed()) {
         $html .= Mage::getSingleton('core/layout')->createBlock('adminhtml/widget_button', '', array('label' => Mage::helper('catalog')->__('WYSIWYG Editor'), 'type' => 'button', 'disabled' => false, 'class' => '', 'onclick' => 'uVendorWysiwygEditor.open(\'' . Mage::helper('adminhtml')->getUrl('*/*/wysiwyg') . '\', \'' . $this->getHtmlId() . '\')'))->toHtml();
     }
     return $html;
 }
Ejemplo n.º 5
0
 public function getAfterElementHtml()
 {
     $html = Varien_Data_Form_Element_Textarea::getAfterElementHtml();
     if ($this->getIsWysiwygEnabled()) {
         $disabled = $this->getDisabled() || $this->getReadonly();
         $html .= Mage::getSingleton('core/layout')->createBlock('adminhtml/widget_button', '', array('label' => Mage::helper('catalog')->__('WYSIWYG Editor'), 'type' => 'button', 'disabled' => $disabled, 'class' => $disabled ? 'disabled' : '', 'onclick' => 'catalogWysiwygEditor.open(\'' . Mage::helper('adminhtml')->getUrl('customgrid/custom_grid_editor_product/wysiwyg') . '\', \'' . $this->getHtmlId() . '\')'))->toHtml();
     }
     return $html;
 }
Ejemplo n.º 6
0
 /**
  * Retrieve additional html and put it at the end of element html
  *
  * @return string
  */
 public function getAfterElementHtml()
 {
     $html = parent::getAfterElementHtml();
     if ($this->getIsWysiwygEnabled()) {
         $disabled = $this->getDisabled() || $this->getReadonly();
         $html .= Mage::getSingleton('Mage_Core_Model_Layout')->createBlock('Mage_Adminhtml_Block_Widget_Button', '', array('label' => Mage::helper('Mage_Catalog_Helper_Data')->__('WYSIWYG Editor'), 'type' => 'button', 'disabled' => $disabled, 'class' => $disabled ? 'disabled' : '', 'onclick' => 'catalogWysiwygEditor.open(\'' . Mage::helper('Mage_Adminhtml_Helper_Data')->getUrl('*/*/wysiwyg') . '\', \'' . $this->getHtmlId() . '\')'))->toHtml();
     }
     return $html;
 }
Ejemplo n.º 7
0
 /**
  * Retrives element html
  * @return string
  */
 public function getElementHtml()
 {
     /** @var Magpleasure_Common_Block_Adminhtml_Widget_Form_Wysiwyg_Renderer $renderer */
     $renderer = Mage::app()->getLayout()->createBlock('magpleasure/adminhtml_widget_form_wysiwyg_renderer');
     if ($renderer) {
         return $renderer->setData($this->getData())->toHtml();
     } else {
         return parent::getElementHtml();
     }
 }
Ejemplo n.º 8
0
 /**
  * Retrieve additional html and put it at the end of element html
  *
  * @return string
  */
 public function getAfterElementHtml()
 {
     $this->jsHelper()->setConfig('url.wysiwyg', $this->urlTemplateHelper()->encodeAttribute($this->createUrl()->getUrl('adminhtml/mana/wysiwyg', array('element_id' => '__0__', 'store_id' => $this->adminHelper()->getStore()->getId()))));
     $html = parent::getAfterElementHtml();
     if ($this->getIsWysiwygEnabled()) {
         $disabled = $this->getDisabled() || $this->getReadonly();
         $html .= Mage::getSingleton('core/layout')->createBlock('adminhtml/widget_button', '', array('label' => Mage::helper('catalog')->__('WYSIWYG Editor'), 'type' => 'button', 'disabled' => $disabled, 'class' => $disabled ? 'disabled' : ''))->toHtml();
     }
     return $html;
 }
Ejemplo n.º 9
0
    public function getElementHtml()
    {
        $js = '
            <script type="text/javascript">
            //<![CDATA[
                openEditorPopup = function(url, name, specs, parent) {
                    if ((typeof popups == "undefined") || popups[name] == undefined || popups[name].closed) {
                        if (typeof popups == "undefined") {
                            popups = new Array();
                        }
                        var opener = (parent != undefined ? parent : window);
                        popups[name] = opener.open(url, name, specs);
                    } else {
                        popups[name].focus();
                    }
                    return popups[name];
                }

                closeEditorPopup = function(name) {
                    if ((typeof popups != "undefined") && popups[name] != undefined && !popups[name].closed) {
                        popups[name].close();
                    }
                }
            //]]>
            </script>';
        if ($this->isEnabled()) {
            // add Firebug notice translations
            $this->getConfig()->addData(array('firebug_warning_title' => $this->translate('Warning'), 'firebug_warning_text' => $this->translate('Firebug is known to make the WYSIWYG editor slow unless it is turned off or configured properly.'), 'firebug_warning_anchor' => $this->translate('Hide')));
            $translatedString = array('Insert Image...' => $this->translate('Insert Image...'), 'Insert Media...' => $this->translate('Insert Media...'), 'Insert File...' => $this->translate('Insert File...'));
            $jsSetupObject = 'wysiwyg' . $this->getHtmlId();
            $html = $this->_getButtonsHtml() . '<textarea name="' . $this->getName() . '" title="' . $this->getTitle() . '" id="' . $this->getHtmlId() . '" class="textarea ' . $this->getClass() . '" ' . $this->serialize($this->getHtmlAttributes()) . ' >' . $this->getEscapedValue() . '</textarea>

                ' . $js . '

                <script type="text/javascript">
                //<![CDATA[
                    if ("undefined" != typeof(Translator)) {
                        Translator.add(' . Zend_Json::encode($translatedString) . ');
                    }
                    ' . $jsSetupObject . ' = new tinyMceWysiwygSetup("' . $this->getHtmlId() . '", ' . Zend_Json::encode($this->getConfig()) . ');

                    ' . ($this->isHidden() ? '' : ($this->getForceLoad() ? $jsSetupObject . '.setup("exact");' : 'Event.observe(window, "load", ' . $jsSetupObject . '.setup.bind(' . $jsSetupObject . ', "exact"));')) . '
                    editorFormValidationHandler = ' . $jsSetupObject . '.onFormValidation.bind(' . $jsSetupObject . ');
                    Event.observe("toggle' . $this->getHtmlId() . '", "click", ' . $jsSetupObject . '.toggle.bind(' . $jsSetupObject . '));
                    varienGlobalEvents.attachEventHandler("formSubmit", editorFormValidationHandler);
                    varienGlobalEvents.attachEventHandler("tinymceBeforeSetContent", ' . $jsSetupObject . '.beforeSetContent.bind(' . $jsSetupObject . '));
                    varienGlobalEvents.attachEventHandler("tinymceSaveContent", ' . $jsSetupObject . '.saveContent.bind(' . $jsSetupObject . '));
                    varienGlobalEvents.clearEventHandlers("open_browser_callback");
                    varienGlobalEvents.attachEventHandler("open_browser_callback", ' . $jsSetupObject . '.openFileBrowser.bind(' . $jsSetupObject . '));
                //]]>
                </script>';
            $html = $this->_wrapIntoContainer($html);
            $html .= $this->getAfterElementHtml();
            return $html;
        } else {
            // Display only buttons to additional features
            if ($this->getConfig('widget_window_url')) {
                $html = $this->_getButtonsHtml() . $js . parent::getElementHtml();
                $html = $this->_wrapIntoContainer($html);
                return $html;
            }
            return parent::getElementHtml();
        }
    }
Ejemplo n.º 10
0
 public function __construct($attributes = array())
 {
     parent::__construct($attributes);
 }
Ejemplo n.º 11
0
 public function getHtmlAttributes()
 {
     $attributes = parent::getHtmlAttributes();
     $attributes[] = 'placeholder';
     return $attributes;
 }