diff --git a/README.md b/README.md index f29e248..338a8f5 100755 --- a/README.md +++ b/README.md @@ -170,17 +170,6 @@ Include custom links in the sidebar. } ``` -###File editor: -![File editor](https://f.cloud.github.com/assets/1788727/1954191/44358884-81d1-11e3-859d-254b9fb81808.png) - -Enable front-end Markdown editor. _Disabled by default_. - -```json -{ - "file_editor": true -} -``` - ###Google Analytics: This will embed the google analytics tracking code. diff --git a/docs/00_Getting_Started.md b/docs/00_Getting_Started.md index a5809ac..8ddeebe 100644 --- a/docs/00_Getting_Started.md +++ b/docs/00_Getting_Started.md @@ -181,17 +181,6 @@ Include custom links in the sidebar. } ``` -### File editor: -![File editor](https://f.cloud.github.com/assets/1788727/1954191/44358884-81d1-11e3-859d-254b9fb81808.png) - -Enable front-end Markdown editor. _Disabled by default_. - -```json -{ - "file_editor": true -} -``` - ### Google Analytics: This will embed the google analytics tracking code. diff --git a/docs/config.json b/docs/config.json index a2dfbef..c09beac 100644 --- a/docs/config.json +++ b/docs/config.json @@ -10,7 +10,6 @@ "breadcrumb_separator": "Chevrons", "date_modified": true, "float": true, - "file_editor": false, "repo": "justinwalsh/daux.io", "ignore": { "files": ["Work_In_Progress.md"], diff --git a/global.json b/global.json index d1b9c10..da50b16 100644 --- a/global.json +++ b/global.json @@ -23,7 +23,6 @@ "toggle_code": false, "date_modified": false, "float": false, - "file_editor": false, "timezone": "America/Los_Angeles", "google_analytics": false, diff --git a/libs/Server/Server.php b/libs/Server/Server.php index 2740339..80b9963 100644 --- a/libs/Server/Server.php +++ b/libs/Server/Server.php @@ -104,46 +104,11 @@ class Server $request = $this->getRequest(); $request = urldecode($request); - $request_type = isset($query['method']) ? $query['method'] : ''; if ($request == 'first_page') { $request = $this->daux->tree->getFirstPage()->getUri(); } - switch ($request_type) { - case 'DauxEdit': - if (!$this->daux->options['file_editor']) { - throw new Exception('Editing is currently disabled in config'); - } - - $content = isset($query['markdown']) ? $query['markdown'] : ''; - return $this->saveFile($request, $content); - - default: - return $this->getPage($request); - } - } - - /** - * @param string $request - * @param string $content - * @return SimplePage - * - * @throws Exception - * @throws NotFoundException - */ - private function saveFile($request, $content) - { - $file = $this->getFile($request); - - if ($file === false) { - throw new NotFoundException('The Page you requested is yet to be made. Try again later.'); - } - - if (!$file->write($content)) { - throw new Exception('The file you wish to write to is not writable.'); - } - - return new SimplePage('Success', 'Successfully Edited'); + return $this->getPage($request); } /** diff --git a/libs/Tree/Entry.php b/libs/Tree/Entry.php index 9815adf..d7f38d2 100644 --- a/libs/Tree/Entry.php +++ b/libs/Tree/Entry.php @@ -181,20 +181,6 @@ abstract class Entry $this->index_page = false; } - /** - * @param string $content - * @return bool - */ - public function write($content) - { - if (!is_writable($this->local_path)) { - return false; - } - - file_put_contents($this->local_path, $content); - return true; - } - /** * @return string */ diff --git a/resources/js/editor.js b/resources/js/editor.js deleted file mode 100644 index 9209d59..0000000 --- a/resources/js/editor.js +++ /dev/null @@ -1,53 +0,0 @@ -$(document).ready(function() { - var markdown_editor = $("#markdown_editor"), - save_editor = $(".save_editor"), - editor = $(".editor"); - - $("#editThis").click(function() { - editor.css({"display":"block"}); - markdown_editor.autosize().val(); - }); - - $(".closeEditor").click(function() { - editor.css({"display":"none"}); - }); - - save_editor.click(function() { - var original_text = save_editor.text(); - save_editor.text("Saving...").addClass("disabled"); - - $.post(window.location.href, {markdown: markdown_editor.val(), method: 'DauxEdit' }, function() { - save_editor.text("Done! Reloading page in 5 seconds. You can cancel it with ESC key"); - - var timeout = setTimeout(function() { - location.reload() - }, 5000); // lie - - $(document).keyup(function(e) { - if (e.keyCode == 27) { // esc key - clearTimeout(timeout); - save_editor.text("Page reload cancelled"); - setTimeout(function() { - save_editor.text(original_text).removeClass('disabled'); - }, 2000); - } - }); - }).fail(function() { - save_editor.removeClass('disabled').addClass("btn-danger").text("Failed :( - try checking your read/write permissions"); - setTimeout(function() { - save_editor.text(original_text).removeClass('btn-danger'); - },5000); - }); - }); -}); - - - - -/*! - Autosize v1.18.4 - 2014-01-11 - Automatically adjust textarea height based on user input. - (c) 2014 Jack Moore - http://www.jacklmoore.com/autosize - license: http://www.opensource.org/licenses/mit-license.php -*/ -!function(a){var b,c={className:"autosizejs",append:"",callback:!1,resizeDelay:10,placeholder:!0},d=' -
- - diff --git a/templates/layout/00_layout.php b/templates/layout/00_layout.php index 19abf8f..d0d94dc 100644 --- a/templates/layout/00_layout.php +++ b/templates/layout/00_layout.php @@ -47,8 +47,6 @@ '; ?> - - '; ?>