From f6f38adae3cacd1f56968869ff19605ab2346541 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sat, 12 Mar 2016 19:02:36 +0000 Subject: [PATCH] Improved "there isn't a page..." message on search page. Fixes #49. --- Changelog.md | 1 + build/index.php | 15 ++++++++++++++- module_index.json | 2 +- modules/feature-search.php | 14 +++++++++++++- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 6c28b04..6361c94 100644 --- a/Changelog.md +++ b/Changelog.md @@ -20,6 +20,7 @@ - Removed parsedown from the `parser-parsedown` module and replaced it with code that automatically downloads parsedown and parsedown extra on the first run. - Removed Slimdown add from the parsedown parser and replaced it with a custom extension of parsedown extra. - Moved printable button to bottom bar and changed display text to "Printable version". + - Improved the "There isn't a page called..." message you sometimes see when searching. ## Fixed - Removed debug statement from the redirect page module. diff --git a/build/index.php b/build/index.php index edef5e4..cc638ed 100644 --- a/build/index.php +++ b/build/index.php @@ -11,6 +11,7 @@ $start_time = time(true); * Credits: * Code by @Starbeamrainbowlabs * Slimdown - by Johnny Broadway from https://gist.github.com/jbroadway/2836900 + * Parsedown - by erusev and others on github from http://parsedown.org/ * Bug reports: * #2 - Incorrect closing tag - nibreh * #8 - Rogue tag - nibreh @@ -1761,7 +1762,19 @@ register_module([ } else { - $content .= "

There isn't a page called $query on $settings->sitename, but you can create it.

"; + $content .= "

There isn't a page called $query on $settings->sitename, but you "; + if((!$settings->anonedits && !$env->is_logged_in) || !$settings->editing) + { + $content .= "do not have permission to create it."; + if(!$env->is_logged_in) + { + $content .= " You could try logging in."; + } + } + else + { + $content .= "can create it.

"; + } } $i = 0; // todo use $_GET["offset"] and $_GET["result-count"] or something diff --git a/module_index.json b/module_index.json index 0688b3c..1953965 100644 --- a/module_index.json +++ b/module_index.json @@ -59,7 +59,7 @@ "author": "Starbeamrainbowlabs", "description": "Adds proper search functionality to Pepperminty Wiki using an inverted index to provide a full text search engine. If pages don't show up, then you might have hit a stop word. If not, try requesting the `invindex-rebuild` action to rebuild the inverted index from scratch.", "id": "feature-search", - "lastupdate": 1457808707, + "lastupdate": 1457809238, "optional": false }, { diff --git a/modules/feature-search.php b/modules/feature-search.php index 42ac94b..27b72fb 100644 --- a/modules/feature-search.php +++ b/modules/feature-search.php @@ -91,7 +91,19 @@ register_module([ } else { - $content .= "

There isn't a page called $query on $settings->sitename, but you can create it.

"; + $content .= "

There isn't a page called $query on $settings->sitename, but you "; + if((!$settings->anonedits && !$env->is_logged_in) || !$settings->editing) + { + $content .= "do not have permission to create it."; + if(!$env->is_logged_in) + { + $content .= " You could try logging in."; + } + } + else + { + $content .= "can create it.

"; + } } $i = 0; // todo use $_GET["offset"] and $_GET["result-count"] or something