* Author: Reini Urban * * KNOWN ISSUES: * This is a dirty hack into the whole system. To display the page as frameset * we must know in advance about the plugin existence. * 1. We can buffer the output stream (which in certain cases is not doable). * 2. Check the page content for the start string 'setArg('framesrc', $src); * $request->redirect('frameset', $request->getName()); * In any cases we can now serve only specific templates with the new frame * argument. The whole page is now ?frame=html (before it was named "top") * For the Sidebar theme we provide a left frame also, otherwise * only top, content and bottom. * * This plugin doesn't return a typical html stream inside a , only a * which has to go before , right after . * */ class WikiPlugin_FrameInclude extends WikiPlugin { function getName() { return _("FrameInclude"); } function getDescription() { return _("Displays a url in a seperate frame inside our body. Only one frame allowed."); } function getDefaultArguments() { return array( 'src' => false, // the src url to include 'name' => 'content', // name of our frame 'title' => false, 'rows' => '10%,*,10%', // names: top, $name, bottom 'cols' => '10%,*', // names: left, $name // only useful on Theme "Sidebar" 'frameborder' => 0, 'marginwidth' => false, 'marginheight' => false, 'noresize' => false, 'scrolling' => 'auto', // '[ yes | no | auto ]' ); } function run($dbi, $argstr, $request) { global $Theme; extract($this->getArgs($argstr, $request)); if (!$src) return $this->error(sprintf(_("%s parameter missing"), 'src')); // FIXME: unmunged url hack $src = preg_replace('/src=(.*)\Z/','$1',$argstr); // How to normalize url's to compare against recursion? if ($src == $request->getURLtoSelf() ) { return $this->error(sprintf(_("recursive inclusion of url %s"), $src)); } // pass FRAMEPARAMS directly to the Template call in Template.php:214 // which goes right after $topuri = $request->getURLtoSelf('frame=top'); $bottomuri = $request->getURLtoSelf('frame=bottom'); $top = ""; $bottom = ""; $content = ""; // include this into top.tmpl instead //$memo = HTML(HTML::p(array('class' => 'transclusion-title'), // fmt("Included frame from %s", $src))); if ($Theme == 'Sidebar') { // left also"\n". $lefturi = $request->getURLtoSelf('frame=navbar'); $frameset = "\n". "\n". " $top\n". " \n". " \n". " $content\n". " \n". "\n"; } else { // only top, body, bottom $frameset = "\n". "\n". " $top\n". " $content\n". "\n"; } // Other options: // 1) either change the whole output stream to // head, $frameset, body (buffered) // 2) redirect to ?frameset=pagename // $request->setArg('framesrc', $src); // $request->redirect('frameset', $request->getName()); return $frameset; } }; // This is an excerpt from the CSS file. (from IncludePage) // // .transclusion-title { // font-style: oblique; // font-size: 0.75em; // text-decoration: underline; // text-align: right; // } // // DIV.transclusion { // background: lightgreen; // border: thin; // border-style: solid; // padding-left: 0.8em; // padding-right: 0.8em; // padding-top: 0px; // padding-bottom: 0px; // margin: 0.5ex 0px; // } // For emacs users // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: ?>