====== new page dialog Plugin ======
---- plugin ----
description: Yet another “New Page Dialog”, with focus on the way people are used to store files. It aims to resemble a regular “Save As” dialog with “Add Folder” functionality.
author : Pierre Spring
email : pierre.spring@liip.ch
type : action
lastupdate : 2011-04-04
compatible : 2008-05-05
depends :
conflicts :
similar : addnewpage, npd
tags : button, form, create, !obsolete
downloadurl: https://github.com/caillou/dokuwiki-plugin-npd/tarball/master
sourcerepo : https://github.com/caillou/dokuwiki-plugin-npd
bugtracker : https://github.com/caillou/dokuwiki-plugin-npd/issues
securityissue: XSS vulnerability, not escaped properly.
----
**:!: Deprecated :!:** - For usage with current versions of DokuWiki, please use the new [[plugin:npd|New Page Dialog Plugin]], an adopted and forked version of this plugin.
===== Installation =====
==== Install via SVN ====
go into the ''/lib/plugins'' directory and type:
svn co http://svn.bitflux.org/repos/public/misc/dokuwiki/plugins/npd
==== Download Zip/Tar ====
* **Zip:** https://github.com/caillou/dokuwiki-plugin-npd/zipball/master
* **Tar:** https://github.com/caillou/dokuwiki-plugin-npd/tarball/master
==== Add Button to Template ====
Decide where you want to insert the "Create New Page" button in your template and insert the following code:
if (!plugin_isdisabled('npd') && ($npd = plugin_load('helper', 'npd'))) {
$npd->html_new_page_button();
}
Most likely you want to do that in the ''/lib/tpl/default/main.php'' inside the ''%%
Note that the button will only be shown, if the browser is JavaScript enabled.
===== Changelog =====
* 2008-07-11 **Version 0.4:**
* fixed compatibility with DokuWiki 2008-05-05
* 2008-05-27 **Version 0.3:**
* added many localisations
* added configuration in order to choose either bottom or link
* 2007-02-18 **Version 0.2:**
* added German language //(thanks to Tblue)//
* bugfix for "empty namespaces"
* 2007-02-17 **Version 0.1:**
* initial upload
===== Demo =====
A demo of this plugin can be seen at the [[http://fckw.demo.liip.ch/|fckw plugin demo wiki]]. FIXME
===== Screenshots =====
{{ http://wiki.caillou.ch/_media/playground:npd_dialog.png?w=&h=&cache=cache }}
{{ http://wiki.caillou.ch/_media/playground:npd_createnewfolder.png?w=&h=&cache=cache }}
{{ http://wiki.caillou.ch/_media/playground:npd_editfoldername.png?w=&h=&cache=cache }}
===== Localization =====
Please feel free too add your localizations here, I'll add them into the plugin ASAP.
===== Known Issues =====
Please report bugs here:
* Since I updated DokuWiki to the latest release 2009-12-25 "Lemming" this plugin (version 0.5 2008-01-10) doesn't work anymore. The plugin-link /doku.php?id=start&idx=:&npd=1& open a new window, but show the startpage of DokuWiki. Any suggestions?
* The same has happened in my case.
* I've to the same problem in my DokuWiki and was unable to find a solution yet.
* me too here
* [2012] me too :-(
* It seems this plugin is not compatible with the indexmenu plugin as it attaches events to the standard index menu tree of DokuWiki and not the indexmenu tree. If there could be any chance to disable the indexmenu plugin in the 'new page' window shown by npd then the problem would be solved, using the standard index tree for the 'new page' window and the indexmenu tree for the rest of the wiki.
* The issue happens only when the [[.:indexmenu#replace index]] indexmenu option is enabled. A workaround patch is available in the [[.:indexmenu:discussion#incompatibility with npd plugin]] discussion. --- //[[samuele@samuele.netsons.org|Samuele Tognini]] 2009/05/08 16:42//
* Hi, I am having the same problem as that described below with DokuWiki 2008-05-05 and npd version 0.4 - pages are not created in the sub-namespace selected but directly under wiki. Any suggestions ?
*
case 'edit':
#most complicated type - we need to decide on current action
if($ACT == 'show' || $ACT == 'search'){
if($INFO['writable']){
if(!empty($INFO['draft'])){
echo html_btn('draft',$ID,'e',array('do' => 'draft'),'post');
}else{
if($INFO['exists']){
echo html_btn('edit',$ID,'e',array('do' => 'edit','rev' => $REV),'post');
}else{
echo html_btn('create',$ID,'e',array('do' => 'edit','rev' => $REV),'post');
}
}
}else{
if(!actionOK('source')) return false; //pseudo action
echo html_btn('source',$ID,'v',array('do' => 'edit','rev' => $REV),'post');
}
}else{
echo html_btn('show',$ID,'v',array('do' => 'show'));
}
break;
\\
And then change it to this (ie. comment the create button):\\
\\
case 'edit':
#most complicated type - we need to decide on current action
if($ACT == 'show' || $ACT == 'search'){
if($INFO['writable']){
if(!empty($INFO['draft'])){
echo html_btn('draft',$ID,'e',array('do' => 'draft'),'post');
}else{
if($INFO['exists']){
echo html_btn('edit',$ID,'e',array('do' => 'edit','rev' => $REV),'post');
/* }else{
echo html_btn('create',$ID,'e',array('do' => 'edit','rev' => $REV),'post');*/
}
}
}else{
if(!actionOK('source')) return false; //pseudo action
echo html_btn('source',$ID,'v',array('do' => 'edit','rev' => $REV),'post');
}
}else{
echo html_btn('show',$ID,'v',array('do' => 'show'));
}
break;
\\
That's all folks!\\
\\
> What about simply not calling tpl_button('edit') in the main.php of the template in case of the "show" action?
if($ACT != 'show') tpl_button('edit');
--- //[[chi@chimeric.de|Michael Klier]] 2008/04/19 01:29//
> I get rid from default button in so manner.
. . . . . .
--- //[[truvazia@gmail.com|Vasiliy Pedak]] 2011/01/23 22:13//
===== Discussion =====
* Ditto. It simply doesn't work deeper than 2 sub-namespaces (DokuWiki 2008-05-05 & 2009-02-14). The good news is, that the code snipped doesn't make it worse :-) ,André 2009/04/20
* I am having the same problem as Thomas (on DokuWiki 2008-05-05). Any ideas on how to get this working? John, 2009/03/03
* For some reason, I cannot descend deeper than 2 sub-namespaces. When I click on the third namspace (no matter if I click on the "+" or the name itself), the focus where the new page is created, is back on the root namespace (similar to felix's and glufu's problem). The code snippet glufu provided doesn't work either. I use the latest version (via SVN). Is there a solution? - Thomas, 2009/01/15
* Zip file download link 404s, at least as of 2008/06/07. Don't know about SVN, since SVN isn't working right on my server. But could someone please fix the zip link? Thx much. --- //[[mbl@lelnet.com|Matt Landry]] 2008/06/07// \\
* Hi, it would be great if this plugin would also support an actionlink style link. I would happily integrate support for this plugin into the [[:Template#Arctic]] Template ;-) which supports both types of actionlinks. --- //[[chi@chimeric.de|Michael Klier]] 2008/04/19 01:27// \\
* Same here, I'm using Arctic Template and the button is simply ugly =) --- //[[none@none.none|Benoit P.]] 2008/05/13 14:26// \\
* Hi chimeric and benoit: i added the config in version 0.3 ... install the plugin, go to \\ admin -> configuration settings -> npd plugin settings \\ and choose link --- //[[pierre.spring@liip.ch|pierre spring]] 2008/06/27 23:25// \\
* Hey, I'm using artic template, too. It really looks fine with 'link' :-) But there is another Problem. I can't create new pages in subdirectories. The new page will be created at the Namespace "Start - NewPage", where Start is my Index page. --- //[[felix.weber@kh-ap.de|Felix Weber]] 2008/08/13 16:42// \\
* Fine work but i have the same problem like Felix. The value of npd_ns is empty in function npd_save (main.php). BTW: it would be nice if you could implement a exclude function to hide some namespaces in a future version? --- [[mailto:no@mail.com|Glufu]] 2008/08/14 10:19
* You must not click on the name of the namespace but on the little '+' on the left of the namespace. 2008/27/14 10:44
* my whishlist (14-set-2008)
* if you click on + of a namespace, the page is created in that namespace. Please do the same if the user click on the namespace name. Because the page is created on the root folder if the user click on a namespace name
* when the user is editing a page, do not show the "Create new page" button, it does confuse some users
* it does not work in Google Chrome browser
* a __MACOSX plugin is installed, but there is no info about it. For what is that plugin?
* I'm not sure if this solution is okay, but I fixed the problem of felix and me with this snipped of code:
. . . . . .
function setNameSpace(node){
var nameSpace = '';
nameSpace = node.parentNode.parentNode.innerHTML;
if (nameSpace.substring(0,8) == '
just add ist to the main.php of this template and add the following line at the and of the function getEventElement(e)
setNameSpace(node);
[[mailto:no@mail.com|Glufu]] 2008/09/23 12:09
* It would if the dialog would open and expand/focus on the current namespace/path when "Create new page" is pressed.
* To resolve the problem with the creation after 2 sub-namespaces (DokuWiki 2008-05-05 & 2009-02-14) :
Replace in the file **plugins/npd/tpl/main.php**
- "/>
+
and in the function npd_save :
- opener.location.href = "doku.php?do=editfckw&id=" + $('npd_ns').value + ":" + page_name;
+ opener.location.href = "doku.php?do=editfckw&id=" + $('npd_ns').value + "%3A" + page_name;
[[mailto:flosox@mail.com|SoX]] 2009/05/29 17:51
* Here below you can find a patch (shown as result of a "diff" command) that solves most issues we could find in this plugin
* All namespace structure levels are reachable
* All "clics" have a correct behavior
* Tested with Firefox and IE
//Some of the presented code lines come from tips found on the web, thanks to their respective authors//
diff -r npd_original/helper.php npd_patch/helper.php
4a5
> * @author Patched by Benoît Locher and Matthieu Rioteau
80c81
< $ret .= ''.$label.'';
---
> $ret .= ''.$label.'';
83c84
< $ret .= '