Improved "there isn't a page..." message on search page. Fixes #49.

This commit is contained in:
Starbeamrainbowlabs 2016-03-12 19:02:36 +00:00
parent 5cf850f0ba
commit f6f38adae3
4 changed files with 29 additions and 3 deletions

View File

@ -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.

View File

@ -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 <https://github.com/nibreh/>
* #8 - Rogue <datalist /> tag - nibreh <https://github.com/nibreh/>
@ -1761,7 +1762,19 @@ register_module([
}
else
{
$content .= "<p>There isn't a page called $query on $settings->sitename, but you can <a href='?action=edit&page=" . rawurlencode($query) . "'>create it</a>.</p>";
$content .= "<p>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 <a href='?action=login&returnto=" . rawurlencode($_SERVER["REQUEST_URI"]) . "'>logging in</a>.";
}
}
else
{
$content .= "can <a href='?action=edit&page=" . rawurlencode($query) . "'>create it</a>.</p>";
}
}
$i = 0; // todo use $_GET["offset"] and $_GET["result-count"] or something

View File

@ -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
},
{

View File

@ -91,7 +91,19 @@ register_module([
}
else
{
$content .= "<p>There isn't a page called $query on $settings->sitename, but you can <a href='?action=edit&page=" . rawurlencode($query) . "'>create it</a>.</p>";
$content .= "<p>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 <a href='?action=login&returnto=" . rawurlencode($_SERVER["REQUEST_URI"]) . "'>logging in</a>.";
}
}
else
{
$content .= "can <a href='?action=edit&page=" . rawurlencode($query) . "'>create it</a>.</p>";
}
}
$i = 0; // todo use $_GET["offset"] and $_GET["result-count"] or something