/** * Get fckeditor specified by this->textEditor * * @string $fieldname The field-name to user for the editor * @string $value The value to display in the editor. * @return void * @access public * @since 8/22/07 */ function printFckEditor($fieldname, $value) { $oFCKeditor = new FCKeditor($fieldname); $oFCKeditor->Config['EnterMode'] = "br"; $oFCKeditor->Config['ShiftEnterMode'] = "p"; $oFCKeditor->Config['ImageBrowser'] = "true"; $harmoni = Harmoni::instance(); $harmoni->request->startNamespace('media'); $oFCKeditor->Config['ImageBrowserURL'] = str_replace('&', '&', $harmoni->request->quickURL('media', 'filebrowser', array('node' => $this->getId()))); $harmoni->request->endNamespace(); $oFCKeditor->Config['ImageBrowserWindowWidth'] = "700"; $oFCKeditor->Config['ImageBrowserWindowHeight'] = "600"; $oFCKeditor->Config['LinkDlgHideTarget'] = "false"; $oFCKeditor->Config['LinkDlgHideAdvanced'] = "false"; $oFCKeditor->Config['ImageDlgHideLink'] = "false"; $oFCKeditor->Config['ImageDlgHideAdvanced'] = "false"; $oFCKeditor->Config['FlashDlgHideAdvanced'] = "false"; $oFCKeditor->BasePath = POLYPHONY_PATH . "/javascript/fckeditor/"; $oFCKeditor->Config['CustomConfigurationsPath'] = MYPATH . '/javascript/fck_custom_config.js'; $oFCKeditor->Value = $value; $oFCKeditor->Height = '300'; // $oFCKeditor->Width = '400' ; $oFCKeditor->ToolbarSet = 'ContentBlock'; $oFCKeditor->Create(); $writeJsCallback = "function (htmlString) { " . "var oEditor = FCKeditorAPI.GetInstance('" . $fieldname . "'); " . "oEditor.InsertHtml(htmlString); " . "}"; print "\n\t" . Segue_MediaLibrary::getMediaButtons($this->getId(), $writeJsCallback); // Add an event check on back button to confirm that the user wants to // leave with their editor open. $string = _("You have edits open. Any changes will be lost."); print "\n<script type='text/javascript'>\n// <![CDATA[ \n\n\t\twindow.addUnloadConfirmationForElement(\"{$fieldname}\", \"{$string}\");\n\t\n// ]]>\n</script>\n"; }
/** * Return the a {@link WizardComponent} to allow editing of your * plugin in the Wizard. * * @return object WizardComponent * @access public * @since 5/8/07 */ function getWizardComponent() { $wrapper = new WComponentCollection(); $harmoni = Harmoni::instance(); ob_start(); $property = $wrapper->addComponent('comment', new WTextField()); $property->setSize(80); $property->setStartingDisplayText(_("Add a comment about your changes here.")); $property = $wrapper->addComponent('content', HtmlTextArea::withRowsAndColumns(20, 80)); $property->setValue($this->applyEditorSafeTextTemplates($this->cleanHTML($this->untokenizeLocalUrls($this->getContent())))); $property->chooseEditor('fck'); $fckArea = $property->getEditor('fck'); $fckArea->setOption('ToolbarSet', 'ContentBlock'); $fckArea->setConfigOption('CustomConfigurationsPath', MYPATH . '/javascript/fck_custom_config.js'); $fckArea->setConfigOption('ImageBrowserWindowWidth', '700'); $fckArea->setConfigOption('ImageBrowserWindowHeight', '600'); $fckTextArea = $property->getEditor('fck'); $harmoni->request->startNamespace('media'); $fckTextArea->enableFileBrowsingAtUrl($harmoni->request->quickURL('media', 'filebrowser', array('node' => $this->getId()))); $harmoni->request->endNamespace(); $writeJsCallback = "function (htmlString) { " . "edInsertContent(this.form.elements['[[fieldname:]]'], htmlString); " . "}"; $property->addPostHtml('none', "<br/>" . Segue_MediaLibrary::getMediaButtons($this->getId(), $writeJsCallback)); $writeJsCallback = "function (htmlString) { " . "var oEditor = FCKeditorAPI.GetInstance('[[fieldname:]]'); " . "oEditor.InsertHtml(htmlString); " . "}"; $property->addPostHtml('fck', "<br/>" . Segue_MediaLibrary::getMediaButtons($this->getId(), $writeJsCallback)); print "[[content]]"; print $this->getWikiHelp(); $property = $wrapper->addComponent('abstractLength', new WTextField()); $property->setSize(3); $property->setValue($this->getRawDescription()); print "\n\t<br/>"; print _("Abstract to [[abstractLength]] words. (Enter '0' for no abstract)"); print "\n\t<br/>"; print "\n\t<br/>"; print "[[comment]]"; $wrapper->setContent(ob_get_clean()); return $wrapper; }