Source for file FckTextArea.class.php

Documentation is available at FckTextArea.class.php

  1. <?php
  2. /**
  3. * @since 9/6/07
  4. * @package polyphony.wizard
  5. *
  6. * @copyright Copyright &copy; 2007, Middlebury College
  7. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  8. *
  9. * @version $Id: FckTextArea.class.php,v 1.3 2007/09/19 14:04:50 adamfranco Exp $
  10. */
  11.  
  12. require_once(dirname(__FILE__)."/WTextArea.class.php");
  13. require_once(POLYPHONY.'/javascript/fckeditor/fckeditor.php');
  14.  
  15. /**
  16. * The FckTextArea uses the FCKEditor from http://www.fckeditor.net/ to do
  17. * WYSIWYG editing of text
  18. *
  19. * @since 9/6/07
  20. * @package polyphony.wizard
  21. *
  22. * @copyright Copyright &copy; 2007, Middlebury College
  23. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  24. *
  25. * @version $Id: FckTextArea.class.php,v 1.3 2007/09/19 14:04:50 adamfranco Exp $
  26. */
  27. class FckTextArea
  28. extends WTextArea
  29. {
  30. /**
  31. * Virtual Constructor
  32. * @param integer $rows
  33. * @param integer $cols
  34. * @access public
  35. * @return ref object
  36. * @static
  37. */
  38. public static function withRowsAndColumns ($rows, $cols, $class = 'FckTextArea') {
  39. return parent::withRowsAndColumns($rows, $cols, $class);
  40. }
  41. /**
  42. * @var object $editor;
  43. * @access private
  44. * @since 9/6/07
  45. */
  46. public $editor;
  47. /**
  48. * Constructor
  49. *
  50. * @return void
  51. * @access public
  52. * @since 9/5/07
  53. */
  54. public function __construct () {
  55. parent::__construct();
  56. $this->editor = new FCKeditor(null);
  57. $this->editor->BasePath = POLYPHONY_PATH."/javascript/fckeditor/" ;
  58. // Set defaults
  59. $this->editor->Height = '400px';
  60. $this->editor->Config['EnterMode'] = "br";
  61. $this->editor->Config['ShiftEnterMode'] = "p";
  62. $this->editor->Config['ImageBrowser'] = "false";
  63. $this->editor->Config['LinkBrowser'] = 'false';
  64. $this->editor->Config['FlashBrowser'] = 'false';
  65. $this->editor->Config['ImageUpload'] = "false";
  66. $this->editor->Config['LinkUpload'] = 'false';
  67. $this->editor->Config['FlashUpload'] = 'false';
  68. $this->editor->Config['LinkDlgHideTarget'] = "false";
  69. $this->editor->Config['LinkDlgHideAdvanced'] = "false";
  70. $this->editor->Config['ImageDlgHideLink'] = "false";
  71. $this->editor->Config['ImageDlgHideAdvanced'] = "false";
  72. $this->editor->Config['FlashDlgHideAdvanced'] = "false";
  73. }
  74. /**
  75. * Set a file browser URL and enable uploading. This is a helper method, the
  76. * same effect can be accomplished by modifying the editor configuration
  77. * directly.
  78. *
  79. * @param string $url
  80. * @return void
  81. * @access public
  82. * @since 9/6/07
  83. */
  84. public function enableFileBrowsingAtUrl ( $url) {
  85. $this->editor->Config['ImageBrowser'] = "true";
  86. $this->editor->Config['ImageBrowserURL'] = str_replace('&amp;', '&', $url);
  87. $this->editor->Config['FlashBrowser'] = 'true';
  88. $this->editor->Config['FlashBrowserURL'] = str_replace('&amp;', '&', $url);
  89. }
  90. /**
  91. * Returns a block of XHTML-valid code that contains markup for this specific
  92. * component.
  93. * @param string $fieldName The field name to use when outputting form data or
  94. * similar parameters/information.
  95. * @access public
  96. * @return string
  97. */
  98. public function getMarkup ($fieldName) {
  99. $this->editor->InstanceName = $fieldName;
  100. $this->editor->Value = $this->_value;
  101. $this->editor->Create();
  102. }
  103. }
  104.  
  105. ?>

Documentation generated on Wed, 19 Sep 2007 10:23:07 -0400 by phpDocumentor 1.3.0RC3