Skip to content

Commit

Permalink
Fixes #1 by allowing 'new' buttons to always be accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
SoarinFerret committed Sep 15, 2020
1 parent 19fa8d7 commit 9bf7f34
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions action.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function addNewPageButton(Doku_Event $event) {
$event->data['view'] !== 'page'
|| $this->getConf('hideNewPage')
|| !page_exists($ID)
|| !(substr_compare($ID, ":start", -strlen(":start")) === 0)
|| ($this->getConf('onlyShowNewButtonsOnStart') && !(substr_compare($ID, ":start", -strlen(":start")) === 0))
) {
return;
}
Expand All @@ -111,7 +111,7 @@ public function addNewFolderButton(Doku_Event $event) {
$event->data['view'] !== 'page'
|| $this->getConf('hideNewFolder')
|| !page_exists($ID)
|| !(substr_compare($ID, ":start", -strlen(":start")) === 0)
|| ($this->getConf('onlyShowNewButtonsOnStart') && !(substr_compare($ID, ":start", -strlen(":start")) === 0))
) {
return;
}
Expand Down
3 changes: 2 additions & 1 deletion conf/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
$conf['hideDelete'] = 0;
$conf['hideNewPage'] = 0;
$conf['hideNewFolder'] = 0;
$conf['usePrompt'] = 0;
$conf['usePrompt'] = 0;
$conf['onlyShowNewButtonsOnStart'] = 0;
3 changes: 2 additions & 1 deletion conf/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
$meta['hideDelete'] = array('onoff');
$meta['hideNewPage'] = array('onoff');
$meta['hideNewFolder'] = array('onoff');
$meta['usePrompt'] = array('onoff');
$meta['usePrompt'] = array('onoff');
$meta['onlyShowNewButtonsOnStart'] = array('onoff');
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ services:
dokuwiki:
environment:
- DOKUWIKI_PASSWORD=password
image: bitnami/dokuwiki:latest
image: bitnami/dokuwiki:20200729
ports:
- "8080:80"
- "8080:8080"
volumes:
- $PWD:/bitnami/dokuwiki/lib/plugins/pagebuttons
- $PWD:/pagebuttons
3 changes: 2 additions & 1 deletion lang/en/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
$lang['hideDelete'] = 'Disable the delete button';
$lang['hideNewPage'] = 'Disable the New Page button';
$lang['hideNewFolder'] = 'Disable the New Folder button';
$lang['usePrompt'] = 'Use JS Prompt method instead of modal - some themes do not properly implement modals';
$lang['usePrompt'] = 'Use JS Prompt method instead of modal - some themes do not properly implement modals';
$lang['onlyShowNewButtonsOnStart'] = 'Only show the new page and new folder buttons on :start pages';
2 changes: 1 addition & 1 deletion plugin.info.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
base pagebuttons
author Cody Ernesti
email [email protected]
date 2020-06-11
date 2020-09-14
name Page Buttons plugin
desc Adds a PageMenu button to Delete the current page, add a subpage, and add a subfolder
url https://www.dokuwiki.org/plugin:pagebuttons
4 changes: 2 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jQuery(function() {
jQuery('.newfolderbutton a').click(function(f) {
f.preventDefault();

var pre_url = window.location.href.substring(0, window.location.href.indexOf(JSINFO['id'])) + JSINFO['id'].replace(":start","");
var pre_url = window.location.href.substring(0, window.location.href.indexOf(JSINFO['id'])) + JSINFO['namespace'];

if(usePrompt){
var page = window.prompt(LANG.plugins.pagebuttons.newfolder_prompt);
Expand Down Expand Up @@ -128,7 +128,7 @@ jQuery(function() {
jQuery('.newpagebutton a').click(function(p) {
p.preventDefault();

var pre_url = window.location.href.substring(0, window.location.href.indexOf(JSINFO['id'])) + JSINFO['id'].replace(":start","");
var pre_url = window.location.href.substring(0, window.location.href.indexOf(JSINFO['id'])) + JSINFO['namespace'];

if(usePrompt){
var page = window.prompt(LANG.plugins.pagebuttons.newpage_prompt);
Expand Down

0 comments on commit 9bf7f34

Please sign in to comment.