function Field($properties = array())
 {
     Requirements::css(MARKDOWN_BASE . '/css/MarkdownEditorField.css');
     Requirements::javascript(MARKDOWN_BASE . '/thirdparty/ace/src-min-noconflict/ace.js');
     Requirements::javascript(MARKDOWN_BASE . '/js/MarkdownEditorField.js');
     return parent::Field($properties);
 }
Esempio n. 2
0
 /**
  * Quick smoke test to ensure that text is being encoded properly.
  */
 function testTextEncoding()
 {
     $inputText = "These are some unicodes: äöü";
     $field = new TextareaField("Test", "Test");
     $field->setValue($inputText);
     $this->assertContains('These are some unicodes: äöü', $field->Field());
 }
 /**
  * @return string
  */
 function Field($properties = array())
 {
     self::include_js($this->markupType, $this->includeCallback);
     $settings = ucfirst($this->markupType);
     // add JS
     Requirements::customScript('jQuery().ready(function () { jQuery("#' . $this->id() . '").markItUp(my' . $settings . 'Settings)});');
     return parent::Field($properties);
 }
 function Field()
 {
     Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js");
     Requirements::javascript("dataobject_manager/code/simple_wysiwyg_field/javascript/htmlbox.min.js");
     Requirements::javascript("dataobject_manager/code/simple_wysiwyg_field/javascript/xhtml.js");
     Requirements::customScript($this->buildJS());
     return parent::Field();
 }
Esempio n. 5
0
 public function Field($properties = array())
 {
     $this->addExtraClass('stacked');
     Requirements::javascript(POSTMARK_RELATIVE_PATH . '/thirdparty/quill/quill.min.js');
     Requirements::javascript(POSTMARK_RELATIVE_PATH . '/javascript/QuillEditorField.js');
     Requirements::css(POSTMARK_RELATIVE_PATH . '/thirdparty/quill/quill.snow.css');
     Requirements::css(POSTMARK_RELATIVE_PATH . '/css/QuillEditorField.css');
     return parent::Field($properties);
 }
 /**
  * HTML for the column, content of the <td> element.
  *
  * @param  GridField $gridField
  * @param  DataObject $record - Record displayed in this row
  * @param  string $columnName
  * @return string - HTML for the column. Return NULL to skip.
  */
 public function getColumnContent($gridField, $record, $columnName)
 {
     $field = new TextareaField('MetaDescription');
     $value = $gridField->getDataFieldValue($record, $columnName);
     $value = $this->formatValue($gridField, $record, $columnName, $value);
     $field->setName($this->getFieldName($field->getName(), $gridField, $record));
     $field->setValue($value);
     return $field->Field() . $this->getErrorMessages();
 }
 function Field($properties = array())
 {
     $acePath = $this->getAcePath();
     Requirements::javascript($acePath . "ace.js");
     Requirements::javascript($acePath . "mode-" . $this->getMode() . ".js");
     //	Requirements::javascript($acePath . "worker-" . $this->getMode() . ".js");
     Requirements::javascript("codeeditorfield/javascript/CodeEditorField.js");
     Requirements::css("codeeditorfield/css/CodeEditorField.css");
     return parent::Field($properties);
 }
Esempio n. 8
0
    /**
     * Quick smoke test to ensure that text is being encoded properly.
     */
    function testTextEncoding()
    {
        $inputText = "This is my <text>\nWhat's on a new-line?\nThese are some unicodes: äöü&<>";
        $field = new TextareaField("Test", "Test", 5, 20);
        $field->setValue($inputText);
        $this->assertEquals(<<<HTML
<textarea id="Test" name="Test" rows="5" cols="20">This is my &lt;text&gt;
What's on a new-line?
These are some unicodes: &auml;&ouml;&uuml;&amp;&lt;&gt;</textarea>
HTML
, $field->Field());
    }
Esempio n. 9
0
 /**
  * @return string
  */
 public function Field($properties = array())
 {
     // mark up broken links
     $value = Injector::inst()->create('HTMLValue', $this->value);
     if ($links = $value->getElementsByTagName('a')) {
         foreach ($links as $link) {
             $matches = array();
             if (preg_match('/\\[sitetree_link(?:\\s*|%20|,)?id=([0-9]+)\\]/i', $link->getAttribute('href'), $matches)) {
                 if (!DataObject::get_by_id('SiteTree', $matches[1])) {
                     $class = $link->getAttribute('class');
                     $link->setAttribute('class', $class ? "{$class} ss-broken" : 'ss-broken');
                 }
             }
             if (preg_match('/\\[file_link(?:\\s*|%20|,)?id=([0-9]+)\\]/i', $link->getAttribute('href'), $matches)) {
                 if (!DataObject::get_by_id('File', $matches[1])) {
                     $class = $link->getAttribute('class');
                     $link->setAttribute('class', $class ? "{$class} ss-broken" : 'ss-broken');
                 }
             }
         }
     }
     $properties['Value'] = htmlentities($value->getContent(), ENT_COMPAT, 'UTF-8');
     return parent::Field($properties);
 }
 public function Field($properties = array())
 {
     // Include requirements
     $this->getEditorConfig()->init();
     return parent::Field($properties);
 }
 function Field()
 {
     Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js");
     Requirements::javascript("dataobject_manager/code/simple_tinymce_field/javascript/tiny_mce/jquery.tinymce.js");
     Requirements::javascript("dataobject_manager/code/simple_tinymce_field/javascript/tiny_mce/tiny_mce.js");
     Requirements::customScript($this->buildJS());
     return parent::Field();
 }
 public function Field($properties = array())
 {
     Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/expandable/jquery.expandable.js');
     Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/ExpandableTextareaField.js');
     return parent::Field($properties);
 }
 /**
  * @return string
  */
 public function Field($properties = array())
 {
     // Before rendering our field, require our custom script
     Requirements::javascriptTemplate("trumbowyg-htmleditor/javascript/trumbowyg-init.js", array('ID' => $this->ID(), "Buttons" => $this->getButtonsJS()));
     return parent::Field($properties);
 }
Esempio n. 14
0
	/**
	 * Quick smoke test to ensure that text is being encoded properly.
	 */
	function testTextEncoding() {
		$inputText = "This is my <text>These are some unicodes: äöü&<>";
		$field = new TextareaField("Test", "Test");
		$field->setValue($inputText);
		$this->assertContains('This is my &lt;text&gt;These are some unicodes: &auml;&ouml;&uuml;&amp;&lt;&gt;', $field->Field());
	}
 public function Field($properties = array())
 {
     return parent::Field($properties);
 }
Esempio n. 16
0
 function Field()
 {
     Requirements::javascript($this->BaseHref() . "jsparty/jquery/jquery.js");
     Requirements::javascript($this->BaseHref() . "dataobject_manager/code/simple_tinymce_field/javascript/tiny_mce/jquery.tinymce.js");
     Requirements::javascript($this->BaseHref() . "dataobject_manager/code/simple_tinymce_field/javascript/tiny_mce/tiny_mce.js");
     Requirements::customScript($this->buildJS());
     return parent::Field();
 }
 function Field($properties = array())
 {
     Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/LimitedTextareaField.js');
     return parent::Field($properties);
 }
    function Field($properties = array())
    {
        $toolbar = $this->getToolbar();
        if ($toolbar) {
            $toolbar = "'" . $toolbar . "'";
        } else {
            $toolbar = 'false';
        }
        $menubar = $this->getMenubar();
        if ($menubar) {
            $menubar = "'" . $menubar . "'";
        } else {
            $menubar = 'false';
        }
        $skin = $this->config()->skin;
        $plugins = $this->getPlugins();
        $tools = '';
        if (strpos($plugins, 'table') !== false) {
            $tools = "\n    tools: 'inserttable',";
        }
        // We should update the hidden textarea to make sure validation still works
        Requirements::customScript('var simpleTinymceSetup = function(editor) {
    editor.on("change",function(e) {
        document.getElementById(e.target.id).innerHTML = e.target.contentDocument.innerHTML
    });
}', 'simpleTinymceSetup');
        // Init instance
        Requirements::customScript('tinymce.init({
    selector: "#' . $this->ID() . '",
    statusbar : false,
    skin: "' . $skin . '",
    setup: simpleTinymceSetup,
    autoresize_bottom_margin : 0,
    menubar: ' . $menubar . ',
    toolbar: ' . $toolbar . ',
    plugins: ["' . $plugins . '"],' . $tools . '
 });');
        return parent::Field($properties);
    }
    public function Field($properties = array())
    {
        if ($this->fileManager) {
            $this->enableFileManager();
        }
        $toolbar = $this->getToolbar();
        if ($toolbar) {
            $toolbar = "'" . $toolbar . "'";
        } else {
            $toolbar = 'false';
        }
        $menubar = $this->getMenubar();
        if ($menubar) {
            $menubar = "'" . $menubar . "'";
        } else {
            $menubar = 'false';
        }
        $skin = $this->config()->skin;
        $plugins = $this->getPlugins();
        $extraJsInit = '';
        if (strpos($plugins, 'table') !== false) {
            $extraJsInit .= ",\n    tools: 'inserttable'";
        }
        if ($this->fileManager) {
            $fileManagerPlugin = 'plugin.min.js';
            if (Director::isDev()) {
                $fileManagerPlugin = 'plugin.js';
            }
            $extraJsInit .= ",\n    external_filemanager_path: '/form-extras/javascript/tinymce/filemanager/'";
            $extraJsInit .= ",\n    filemanager_title: '" . _t('SimpleTinyMceField.FILEMANAGER', "File Manager") . "'";
            $extraJsInit .= ",\n    external_plugins: {'filemanager':'/form-extras/javascript/tinymce/filemanager/" . $fileManagerPlugin . "'}";
        }
        // We should update the hidden textarea to make sure validation still works
        Requirements::customScript('var simpleTinymceSetup = function(editor) {
    editor.on("change",function(e) {
        document.getElementById(e.target.id).innerHTML = e.target.contentDocument.innerHTML
    });
}', 'simpleTinymceSetup');
        // Init instance
        Requirements::customScript('tinymce.init({
    selector: "#' . $this->ID() . '",
    statusbar : false,
    skin: "' . $skin . '",
    image_advtab: true,
    document_base_url: "' . Director::baseURL() . '",
    setup: simpleTinymceSetup,
    autoresize_bottom_margin : 0,
    menubar: ' . $menubar . ',
    toolbar: ' . $toolbar . ',
    plugins: ["' . $plugins . '"]' . $extraJsInit . '
 });');
        return parent::Field($properties);
    }