/** * Build the content for this action * * @return void * @access public * @since 5/8/07 */ function buildContent() { SegueAjaxPlugin::writeAjaxLib(); /********************************************************* * Other headers and footers *********************************************************/ $harmoni = Harmoni::instance(); $outputHandler = $harmoni->getOutputHandler(); UserDataHelper::writeHeadJs(); ob_start(); print Segue_MediaLibrary::getHeadHtml(); $outputHandler->setHead($outputHandler->getHead() . ob_get_clean()); parent::buildContent(); }
/** * Build the content for this action * * @return boolean * @access public * @since 4/26/05 */ function execute() { ob_start(); $harmoni = Harmoni::instance(); /********************************************************* * Other headers and footers *********************************************************/ $outputHandler = $harmoni->getOutputHandler(); // Add our common Harmoni javascript libraries require POLYPHONY_DIR . "/main/library/Harmoni.js.inc.php"; print Segue_MediaLibrary::getHeadHtml(); $outputHandler->setHead(ob_get_clean()); UserDataHelper::writeHeadJs(); // Get the plugin asset id $harmoni->request->startNamespace('plugin_manager'); $id = RequestContext::value('plugin_id'); if (RequestContext::value('extended') == 'true') { $showExtended = true; } else { $showExtended = false; } $harmoni->request->endNamespace(); // Get the plugin asset object $repositoryManager = Services::getService("Repository"); $idManager = Services::getService("Id"); $repository = $repositoryManager->getRepository($idManager->getId("edu.middlebury.segue.sites_repository")); $asset = $repository->getAsset($idManager->getId($id)); $pluginManager = Services::getService("Plugs"); $plugin = $pluginManager->getPlugin($asset); if (!is_object($plugin)) { print $plugin; } else { if ($showExtended) { print $plugin->executeAndGetExtendedMarkup(TRUE); } else { print $plugin->executeAndGetMarkup(TRUE); } } // exit(); $block = new UnstyledBlock(ob_get_clean()); return $block; }
/** * Execute this action. * * @return mixed * @access public * @since 4/25/05 */ function execute() { $title = $this->getHeadingText(); $harmoni = Harmoni::instance(); $harmoni->request->startNamespace('media'); $nodeId = RequestContext::value('node'); $harmoni->request->endNamespace(); $POLYPHONY_PATH = POLYPHONY_PATH; $MYPATH = MYPATH; print <<<END <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> \t<title>{$title}</title> END; require POLYPHONY_DIR . "/main/library/Harmoni.js.inc.php"; print UserDataHelper::getHeadJs(); print Segue_MediaLibrary::getHeadHtml(); print <<<END \t \t<script type='text/javascript'> \t\t// <![CDATA[ \t\t \t\tMediaLibrary.prototype.onClose = function () { \t\t\twindow.close(); \t\t} \t\t \t\t// ]]> \t</script> \t </head> <body onload="this.onUse = function (mediaFile) { window.opener.SetUrl(mediaFile.getUrl());}; MediaLibrary.run('{$nodeId}', this); "> \t </body> </html> END; exit; }
/** * 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"; }
/** * Add the header controls to the main screen gui component * * @param object Component $mainScreen * @return object Component The allWrapper * @access public * @since 4/7/08 */ public function addHeaderControls(Component $mainScreen) { $harmoni = Harmoni::instance(); /********************************************************* * Additional setup *********************************************************/ $rootSiteComponent = SiteDispatcher::getCurrentRootNode(); $outputHandler = $harmoni->getOutputHandler(); /********************************************************* * Theme *********************************************************/ $outputHandler->setCurrentTheme($rootSiteComponent->getTheme()); /********************************************************* * Other headers and footers *********************************************************/ // Remove any existing title tags from the head text print preg_replace("/<title>[^<]*<\\/title>/", "", $outputHandler->getHead()); //Add our new title print "\n\t\t<title>"; print strip_tags(SiteDispatcher::getCurrentNode()->acceptVisitor(new BreadCrumbsVisitor(SiteDispatcher::getCurrentNode()))); print "</title>"; // Add our common Harmoni javascript libraries require POLYPHONY_DIR . "/main/library/Harmoni.js.inc.php"; print Segue_MediaLibrary::getHeadHtml(); $outputHandler->setHead(ob_get_clean()); UserDataHelper::writeHeadJs(); // Add the RSS head links RssLinkPrinter::addHeadLinks(SiteDispatcher::getCurrentNode()); // Add the selection Panel Segue_Selection::instance()->addHeadJavascript(); $allWrapper = new Container(new YLayout(), BLANK, 1); if (defined('SEGUE_SITE_HEADER')) { $this->siteMessage = $allWrapper->add(new Component($this->getSegueSiteHeader(), BLANK, 1), "100%", null, CENTER, TOP); } // :: login, links and commands $this->headRow = $allWrapper->add(new Container(new XLayout(), BLANK, 1), $rootSiteComponent->getWidth(), null, CENTER, TOP); $this->leftHeadColumn = $this->headRow->add($this->getSegueLinksComponent(), null, null, LEFT, TOP); $rightHeadColumn = $this->headRow->add(new Container(new YLayout(), BLANK, 1), null, null, CENTER, TOP); $rightHeadColumn->add($this->getLoginComponent(), null, null, RIGHT, TOP); if ($this->isAuthorizedToExecute()) { $rightHeadColumn->add($this->getCommandsComponent(), null, null, RIGHT, TOP); } $allWrapper->add($mainScreen, $rootSiteComponent->getWidth(), null, CENTER, TOP); // :: Top Row :: // $this->headRow = $mainScreen->add( // new Container(new XLayout, HEADER, 1), // "100%", null, CENTER, TOP); // $this->leftHeadColumn = $this->headRow->add( // new UnstyledBlock("<h1>".$rootSiteComponent->getTitleMarkup()."</h1>"), // null, null, LEFT, TOP); return $allWrapper; }
/** * 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; }