Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class EditFileViewer extends FullDocumentViewer {
- protected function getHtml($item, $full) {
- $resourceUrl = $this->getResourceUrl();
- $settings = $this->getSettings();
- // read file
- $html = '';
- $stream = $item->read();
- while (!feof($stream))
- $html .= fread($stream, 1024);
- fclose($stream);
- //form submit url
- $submit_url = $this->getServiceUrl("filesystem", array($item->publicId(), "content"), TRUE);
- return <<<HTML
- <html>
- <head>
- <title>{$item->name()}</title>
- <link rel="stylesheet" href="/mollify/client/themes/basic/style.css">
- <style type="text/css">
- textarea {
- font: normal normal normal 0.9em/1.2em "Courier New", Courier, serif;
- width: 100%;
- height: 88%;
- margin-bottom: 1em;
- padding: 0.5em;
- outline: none;
- background-color: #EEE;
- border: 1px solid #999;
- }
- form {
- margin: 0;
- }
- .right {
- float: right;
- margin-right: 1em;
- }
- </style>
- </head>
- <body>
- <form action="$submit_url" method="POST" accept-charset="utf-8">
- <textarea name="data">$html</textarea>
- <input class="mollify-dialog-button" type="submit" value="Save">
- <input class="mollify-dialog-button right" type="reset" value="Revert">
- </form>
- </body>
- </html>
- HTML;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment