public function __construct() { parent::__construct(); $self = $this; $this->add(new Link('home', function () use($self) { $self->setPage(HomePage::getIdentifier()); })); $files = array('index.php', 'assets/AbstractPage.php', 'assets/AbstractPage.html', 'assets/SamplePageClassAuthorisationStrategy.php'); $files = array_merge($files, $this->getInvolvedFiles()); $sourceLink = new Link('source', function () use($self, $files) { $self->setPage(new SourcePage($files)); }); $sourceLink->setPopupSettings(new PopupSettings('Source Code', '900px', '600px')); $this->add($sourceLink); }
public function __construct($files) { parent::__construct(); $self = $this; $this->add(new ListView('files', function (ListItem $item) use($self) { $link = new AjaxLink('link', function (AjaxRequestTarget $target) use($item, $self) { $panel = $self->getPanel(); $target->add($panel); $newPanel = new CodeOutputPanel('code', $item->getModelObject()); $newPanel->setOutputMarkupId(true); $self->getPanel()->addOrReplace($newPanel); }); $item->add($link); $link->add(new Label('fileName', $item->getModel())); }, new ArrayModel($files))); $this->panel = new MarkupContainer('wrapper'); $this->add($this->panel); $this->panel->setOutputMarkupId(true); $codePanel = new CodeOutputPanel('code', $files[0]); $this->panel->add($codePanel); }