Add New Page Plugin

addnewpage plugin by iDo

Last updated on 2008-01-10. Provides Syntax.
Compatible with DokuWiki 2006-11-06.

Conflicts with addnewpage_old!
Similar to new_page_dialog.

Tagged with add, button, create, form.

This is the new RELEASE for the DokuWiki 2006-11-06 version. If you want the old version see addnewpage_old

This plugin adds a selection box and an input box for adding a new page.
The selection box contains all namespaces of your wiki.

This plugin was inspired from newpagebutton.

Demo

syntax

Just write

{{NEWPAGE}} 

newpage or

{{NEWPAGE>[namespace]}}

newpage_namespace

where “namespace” is your namespace. If you use a namespace in the line, you can :

  • hide the select box
  • or show only subnamespace

To configure it, use the config manager.

Installation

With plugin manager, use this zip : http://dokuplugins.idotech.info/addnewpage.zip

Configuration

You can configure the plugin in the Config Manager of DokuWiki.

Tips

If you want to show the add new page forms out of a page (for example in your template), put this line where you want to see the plugin :

<?php
echo p_render('xhtml',p_get_instructions('{{NEWPAGE}}'),$info);
?>

Language

  • French
  • English
  • Italian (incomplete)
  • Russian (incomplete)
  • German
  • Spanish
  • Traditional Chinese
  • Japanese
  • Swedish
  • Other ? add here or mail me : ido@woow-fr.com

Language files

French

lang.php

<?php
/*USE : UTF8*/
/*
French language file
*/
$lang['namespaceRoot']     = 'Racine';
$lang['okbutton']     = 'Cr&eacute;er';
$lang['nooption']		="Vous n'avez pas les droits pour ajouter une page";
?>

settings.php

<?php
/*USE : UTF8*/
 
/*
 * French language file
 */
$lang['addpage_exclude']         = "namespaces &agrave; exclure (s&eacute;par&eacute;s par un ;)";
$lang['addpage_showroot'] 		 = "Afficher le namespace racine";
$lang['addpage_hide'] 		 = "Quand vous utlisez la syntaxe {{NEWPAGE>[ns]}} : Cache la selection de namespace (décoché: affiche uniquement les sous-namespaces)";
$lang['addpage_hideACL']="Si non cochée, affiche un message lorsque l'utlisateur n'a pas les droits d'ajout de page. Sinon, cache simplement {{NEWPAGE}}";
?>

English

I made a few linguistic fixes to make it more English :-)

lang.php

<?php
/*
English language file
 */
$lang['namespaceRoot']="Root";
$lang['okbutton']     = 'Add page';
$lang['nooption']		="You are not allowed to add pages";
//Setup VIM: ex: et ts=2 enc=utf-8 :
?>

settings.php

<?php
/*USE : UTF8*/
 
/*
 * English language file
 */
$lang['addpage_exclude']         = "Excluded namespaces (separated with ;)";
$lang['addpage_showroot'] 		 = "Show root namespace";
$lang['addpage_hide'] 		 = "When you use {{NEWPAGE>[ns]}} syntax: Hide namespace selection (unchecked: show only subnamespaces)";
$lang['addpage_hideACL']="Hide {{NEWPAGE}} if user does not have rights to add pages (show message if unchecked)"
?>

German

lang.php

<?php
/*
German language file
 */
$lang['namespaceRoot']=":Wurzel";
$lang['okbutton']     = 'Seite hinzufügen';
$lang['nooption']		="Sie besitzen nicht die Benutzerrechte um Seiten hinzuzufügen.";
//Setup VIM: ex: et ts=2 enc=utf-8 :
?>

settings.php

<?php
/*USE : UTF8*/
 
/*
 * German language file
 */
$lang['addpage_exclude']         = "Namespaces ausschließen (getrennt mit ; )";
$lang['addpage_showroot']        = "Wurzel-Namespace anzeigen";
$lang['addpage_hide']            = "{{NEWPAGE>[ns]}} Syntax: Ausgewählt, diese Namespace-Selektion verbergen. Nicht ausgewählt, nur diese Namespace-Selektion anzeigen.";
$lang['addpage_hideACL']="Wenn ein Benutzer keine Berechtigung hat: Ausgewählt, Anzeige wird verborgen. Nicht ausgewählt, Es wird eine Fehlermeldung ausgegeben."
?>

Spanish

lang.php

<?php
/*
Spanish language file (Paraguay)
 */
$lang['namespaceRoot'] = "Raiz";
$lang['okbutton']      = "Agregar pagina";
$lang['nooption']      = "Ud. no tiene privilegios para crear la pagina";
//Setup VIM: ex: et ts=2 enc=utf-8 :
?>

settings.php

<?php
/*USE : UTF8*/
 
/*
 * Spanish language file
 */
$lang['addpage_exclude']  = "excluir directorio(namespace) separados por punto y coma (;)";
$lang['addpage_showroot'] = "Mostrar directorio(namespace) raiz";
$lang['addpage_hide']     = "cuando se usa la sintaxis {{NEWPAGE>[dir]}}: se oculta el selector de directorio (desmarcado: muestra solo sub-directorios (sub-namespaces))";
$lang['addpage_hideACL']  = "si esta desmarcado, muesta un mensaje de error de privilegios. Si el usuario no tiene permiso de crear una pagina, simplemente se oculta el codigo {{NEWPAGE}}"
?>

Portuguese

lang.php

<?php
/*
Portuguese language file
 */
$lang['namespaceRoot']="Root";
$lang['okbutton']     = 'Incluir Página';
$lang['nooption']     ="Você não tem permissão para incluir página";
//Setup VIM: ex: et ts=2 enc=utf-8 :
?>

settings.php

<?php
/*USE : UTF8*/
 
/*
 * Portuguese language file
 */
$lang['addpage_exclude']         = "excluído namespace (separados com ;)";
$lang['addpage_showroot']        = "Mostrar raiz do namespace";
$lang['addpage_hide'] 		 = "Quando voce usa {{NEWPAGE>[ns]}} sintaxe : esconde a seleção do namespace (desmarcado : mostra sub-namespace ativo)";
$lang['addpage_hideACL']         ="se desmarcado, mostra mensagem sobre direitos senão simplismente esconde {{NEWPAGE}} quando o usuário não possui permissões para incluir uma página."
?>

Traditional Chinese

lang.php

<?php
/*
Traditional Chinese language file
 */
$lang['namespaceRoot']="最上層(Root)";
$lang['okbutton']     ="新增頁面";
$lang['nooption']     ="你沒有權限執行新增頁面的動作";
//Setup VIM: ex: et ts=2 enc=utf-8 :
?>

settings.php

<?php
/*
 *  Traditional Chinese file
 */
$lang['addpage_exclude']         = "排除哪些命名空間(namespace), 使用 ; 來區分多個命名空間(namespace)";
$lang['addpage_showroot']        = "顯示最上層(Root)命名空間(namespace)";
$lang['addpage_hide'] 		 = "使用 {{NEWPAGE>[ns]}} 語法時不要顯示出命名空間(namespace)的選項, 沒有打勾就會列出指定命名空間(namespace)底下所有的子命名空間(subnamespace)項目";
$lang['addpage_hideACL']         ="沒有打勾 : 表示當使用者沒有新增頁面權限時就顯示沒有權限的訊息而不會顯示出新增頁面的輸入欄."
?>

Italian

lang.php

<?php
/*
Italian language file
 */
$lang['namespaceRoot']="Root";
$lang['okbutton']     = 'Aggiungi pagina';
$lang['nooption']		="Non hai i permessi per creare una nuova pagina";
//Setup VIM: ex: et ts=2 enc=utf-8 :
?>

settings.php

<?php
/*USE : UTF8*/
 
/*
 * Italian language file
 */
$lang['addpage_exclude']         = "Escludi namespaces (separati con ;)";
$lang['addpage_showroot'] 		 = "Mostra root namespace";
$lang['addpage_hide'] 		 = "Quando usi la sintassi {{NEWPAGE>[ns]}} : Nascondi il namespace selezionato (deseleziona: mostra solo i sotto-namespaces)";
$lang['addpage_hideACL']="Nascondi {{NEWPAGE}} se l'utente non ha i diritti per visualizzare la pagina (mostra il messaggio se deselezionato)"
?>

Japanese

lang.php

<?php
/*
Japanese language file
 */
$lang['namespaceRoot']="ルート";
$lang['okbutton']     = 'ページ追加';
$lang['nooption']		="ページの追加が許可されていません";
//Setup VIM: ex: et ts=2 enc=utf-8 :
?>

settings.php

<?php
/*USE : UTF8*/
 
/*
 * Japanese language file
 */
$lang['addpage_exclude']         = "除外する名前空間(; 区切り)";
$lang['addpage_showroot'] 		 = "ルート名前空間を表示";
$lang['addpage_hide'] 		 = "{{NEWPAGE>[ns]}} 構文使用時: 名前空間選択リストを表示しない(チェックなし: 下位名前空間のみを表示)";
$lang['addpage_hideACL']="ページ追加の権限を持たないユーザーに対しては {{NEWPAGE}} を表示しない(チェックなしの場合にはメッセージを表示)"
?>

Swedish

lang.php

<?php
 
/*
 * Swedish language file
 * Save file as UTF8.
 */
 
$lang['namespaceRoot'] = "Rot";
$lang['okbutton']      = "Skapa sida";
$lang['nooption']      = "Du har inte behörighet att skapa sidor";
?>

settings.php

<?php
 
/*
 * Swedish language file
 * Save file as UTF8.
 */
 
$lang['addpage_exclude']  = "Exkluderade namnrymder (separera med ;)";
$lang['addpage_showroot'] = "Visa rotrymd";
$lang['addpage_hide']     = "När du använder {{NEWPAGE>[ns]}} syntax: Dölj val av namnrymd (ej ikryssad: visa bara undernamnrymder)";
$lang['addpage_hideACL']  = "Dölj {{NEWPAGE}} om användaren inte har rättighet att skapa sidor (visa meddelande om ej ikryssad)"
?>

History

  • 2008-01-10 : New zip file with some correction (the submit bug in IE, the namespace ”.”) and all new language are added
  • 2007-05-19 : Portuguese language definitions added for completely hide NEWPAGE by GibaPhp
  • 2007-01-21 : Can configure if you want to add some message about rights or completely hide NEWPAGE
  • 2007-01-21 : Now support ACL (thanks to 66[dot]7[dot]118[dot]82 (FIXME) )
  • 2007-01-13 : Add new functionality with the syntax {{NEWPAGE[>namespace]}} (thanks to Martin)
  • 2007-01-12 : Remove 4 invisible hex chars in script.js, adding Italian and Russian (incomplete)
  • 2007-01-11 : Fix encoding problem (with old noaccent function)
  • 2006-12-20 : New Release, old version on : addnewpage_old

Discussion

I am not sure where exactly to put the above PHP code (from the Tips section) into my template. Can anyone please advise? help me

Put it where you want to see the new page forms. (\lib\tpl\default\main.php)
I'm new to XHTML, PHP and DokuWiki, and I'm trying to add the addnewpage plugin to the bar_ _topleft. When I add the PHP code from the Tips section it always wraps it in <p>…</p>, and having a two line top bar really breaks the lay-out. Here's my research up until now:
When using the plugin within the Wiki page itself, the <p> is not added. So I started looking at the php echo command, but a plain text echo command does not add the <p> either. Next I looked into the syntax.php of the plugin, and p_render/p_get_instructions in the DokuWiki PHP x-ref, but am still at a loss on where the <p> is added. I'm assuming it is the difference between block and in-line rendering, but I don't know how to influence that.
Any help on where to start looking, or how to prevent the <p> from being generated is greatly appreciated. — Arnoud 2007-01-27 19:27
The <p></p> are added by DokuWiki… I don't know if there is a tips include in DokuWiki to remove it, but you can use php :
$out = p_render('xhtml',p_get_instructions('{{NEWPAGE}}'),$info);
echo str_replace(array("<p>","</p>"),array("",""),$out);
or if it doesn't work :
ob_start();
echo p_render('xhtml',p_get_instructions('{{NEWPAGE}}'),$info);
$out = ob_get_clean();
echo str_replace(array("<p>","</p>"),array("",""),$out);
OK, I got it working now, but I had to change a few small things. This is the code I added to the bar_ _topleft in the main.php of my template:
<?php echo str_replace(array("<p>","</p>"),array("",""),p_render('xhtml',p_get_instructions('{{NEWPAGE}}'),$info))?>
Secondly I needed to change the <div>..</div> pair in the plugin/addnewpage/syntax.php with their <span>..</span> counterparts. All this together works like a charm! Thanks for the code snippet, and plug-in. — Arnoud 2007-01-31 22:28

===== Enhancements ===== I would like to use the plugin in a wiki with a lot of namespaces and it would be great if the syntax would allow to preset the namespace where the new page should be created in! e.g. <code>newpage_namespace</code>
this would be benefit so that the users of the wiki do not need to understand the structure of the wiki.

The idea of how to implement this would be that you could use the same code as today, but you fill the [namespace] parameter as an default into the field. In addition, you hide the field. This should work!
what do you think about this?
Martin > Hello, I think about this functionnality. But I don't now what's better between your option and this option : the <code>newpage_namespace</code> use [namesapce] as root and only show namespace and subnamespace… » Hi, I implemented to code already… so if you want to use it please give me your email and I can send it to you… I do not have any preferences for the option : or >

===== Script Bug ===== Also the new version contains the same bug. I found now the problem:
script does not contain an error, it is a 3 character long prefix in the file, which is not indicated by normal text editors (probably a code-head, “EFBBBF”). use a hexeditor to see and delete it. The script mash by pure ASCII-text, without binary head.
(I put a German translation, it was deleted. Why?) > I update again the zip without this invisible hex code… It works better? > I never see you translation, could you add here again? Or direct mail me it ⇒ ido@woow-fr.com » Now it works :-). » (I think it is the editor you use, I found this head too in the PHP files, “EFBBBF” is a UTF8 Head (http://www.fileformat.info/info/unicode/char/feff/index.htm). Only Opera seems to have the script-problem, if you want test it once.) » The German text is already Unicode coded, you can copy it as ASCII. (ß ⇒ ß, ü ⇒ ü)

By testing the new release, now with {{NEWPAGE}} its only the root in the list, nothing else.

Ok, i've just fix it ! sorry ;)

I'm always getting an error after I've put the {{NEWPAGE[>namespace]}} into the page and save, here's the error I get: Fatal error: Call to undefined function: getconf() in /../lib/plugins/addnewpage/syntax.php on line 56 Is there any particular reason why I would be getting this?

Do you use the lastest DokuWiki release ?

I have a bunch of users on my wiki, each with there own namespace that they can put stuff in. It gets really confusing for them to see all the namespaces, especially when they can only create pages in just a few of them. Here is the patch that I made that will restrict the selection box to namespaces in which the current user can actually create a new page. If the showroot option is true, then the root will always be shown, but may be disabled if the permissions aren't right. (The disabling seems to work in Firefox, but not in Safari). <code> --- syntax.php 2007-01-13 10:36:42.000000000 -0700 +++ syntax.php 2007-01-17 18:33:13.000000000 -0700 @@ -66,15 +66,19 @@ $ret='<select class="edit" id="np_cat" name="np_cat" tabindex="1">'; if ($this->getConf('addpage_showroot')) { + if(auth_quickaclcheck($data.":") < AUTH_CREATE) $root_disabled='DISABLED="true"'; + else $root_disabled=''; if ($data=='') - $ret.='<option '.(($ns=='')?'selected="true"':'').' value="">'.((@$this->getLang('namespaceRoot'))?$this->get Lang('namespaceRoot'):'top').'</option>'; + $ret.='<option '.(($ns=='')?'selected="true"':'').' '.$root_disabled.' value="">'.((@$this->getLang('namespac eRoot'))?$this->getLang('namespaceRoot'):'top').'</option>'; else - $ret.='<option '.(($ns==$data)?'selected="true"':'').' value="'.$data.'">'.$data.'</option>'; + $ret.='<option '.(($ns==$data)?'selected="true"':'').' '.$root_disabled.' value="'.$data.'">'.$data.'</option >'; } foreach ($r as $k => $v) { if ($data != '') { if (strpos(":".$v,":".$data.":")===false) continue; } + if(auth_quickaclcheck($v.":") < AUTH_CREATE) continue; $vv=explode(':',$v); $vv=str_repeat('&nbsp;&nbsp;',substr_count($v, ':')).$vv[count($vv)-1]; $ret.='<option '.(($ns==$v)?'selected="true"':'').' value="'.$v.'">'.$vv.'</option>'; </code>

Maybe a user have generally the right to add pages, but only in a specific namespace.

#--- in acl.auth.php
#--- NOT "test" inside the ListBox/ComboBox
*         @user       8
test:*    @user       1

or

#--- ONLY "test" inside the ListBox/ComboBox
*         @user       1
test:*    @user       8

had the same effect like the option addpage_hide. (could replace this option)

{{NEWPAGE[>ns][;ns][;ns]}} only this namespaces
{{NEWPAGE[<ns][;ns][;ns]}} everything except this namespaces

(I am unfortunately not a good PHP programmer)

Actualy if a user have write access in ns1:ns2 and not in ns1:ns2:ns3 and again write access in ns1:ns2:ns3:ns4, NEWPAGE only show ns1:ns2 and ns1:ns2:ns3:ns4

I just added an action plugin that allows a user to specify a template to use when creating a page. The point of the plugin was to extend the addnewpage plugin so that the user could write something like:

{{NEWPAGE>ns|newpagetemplate=:pagetemplate:newpagetemplate&newpagevars=@NEWVAR@,test value}}

and the page :pagetemplate:newpagetemplate would function as a namespace template for the new page (i.e., the :pagetemplate:newpagetemplate would be copied into the edit box, with a few substitutions). I've modified the addnewpage plugin to accommodate this functionality. Basically what the modification does is parses everything following the “|” into separate hidden input fields in the form and then passes those along with the form. So really, you could specify whatever parameters you wanted to pass with the form using this new syntax.

Here's the patch:

--- syntax.php
+++ syntax.php
@@ -28,8 +28,8 @@
     }
 
     function handle($match, $state, $pos, &$handler){
-         $ns = substr($match, 10, -2);  // strip markup
-      return $ns;
+          $ns = explode('|',substr($match, 10, -2),2);  // strip markup
+          return array(trim($ns[0]),trim($ns[1]));
     }
     
  
@@ -38,7 +38,7 @@
                $renderer->info['cache'] = false;
     
                if ($mode == 'xhtml') {
-                       $cmb=$this->_makecombo($data);
+                       $cmb=$this->_makecombo($data[0]);
                        if ($cmb==$this->getLang('nooption')) {
                                $renderer->doc .=(!$this->getConf('addpage_hideACL'))?$cmb:'';
                                return true;
@@ -49,7 +49,15 @@
                    $renderer->doc .= $cmb;
                    $renderer->doc .= '<input class="edit" type="text" name="title" id="addnewpage_title" size="20" maxlength="255" tabindex="2" />';
                        $renderer->doc .= '<input type="hidden" name="do" id="do" value="edit" />';
-                   $renderer->doc .= '<input class="button" type="submit" value="'.((@$this->getLang('okbutton'))?$this->getLang('okbutton'):'ok').'" tabindex="3"  onclick="setName();" />';
+                        if(strlen($data[1])>1) {
+                         $t=explode("&",$data[1]);
+                         foreach($t as $value) {
+                           $parameter=explode("=",$value,2);
+                           $renderer->doc .= '<input type="hidden" name="'.htmlentities(trim($parameter[0]),ENT_QUOTES).'" id="'.htmlentities(trim($parameter[0]),ENT_QUOTES).'" value="'.htmlentities(trim($parameter[1]),ENT_QUOTES).'" />';
+                         }
+                       }
+
+                       $renderer->doc .= '<input class="button" type="submit" value="'.((@$this->getLang('okbutton'))?$this->getLang('okbutton'):'ok').'" tabindex="3"  onclick="setName();" />';
                    $renderer->doc .= '</form>';
                    $renderer->doc .= '</div>';

If you'd like to roll this into the official addnewpage plugin, that would be great! If you'd like to incorporate the action plugin newpagetemplate that I wrote into the addnewpage plugin, that would be great too. Thanks again for such a great plugin!


Regarding this patch: How can I apply it? I tried

cat the-patch.diff | patch -p0

in the plugin directory, but all three hunks were rejected. Any idea why?

– Niklas Volbers

you should run it within the addnewpage plugin directory; it modifies the syntax.php file; or you can get the modified syntax.php (remove the .txt at the end).

– Sergio

I have a problem with the combination of addnewpage and newpagetemplate. On their own, both plugins works well. I am using the modified syntax.php vor the addnewpage-plugin, that I downloaded from above. When using the “special” Syntax for addnewpage with newpagetemplate, I will be linked to the editbox of the page (containg the link). Some idea whats going wrong? Thanks!

Found the problem: There may only be on “addnewpage” on a page. – Freight

Is there any way to make it so that not only the namespace is shown as a combo box but the pagename as well? Better yet make it like an AJAX-enabled history text field. I always find it a pain to find the name of the link before I get insert it, i.e. I have to leave the page I'm editing and go to the page I want to link to find it's correct link name. – Stef

I found there was a problem with the JavaScript being overridden in Internet Explorer. I couldn't track down the source of the problem, so I modified the code slightly. In Syntax I made the following changes:

		    $renderer->doc .= '<div class="addnewpage_form" id="addnewpage_form" align="left">';
		    $renderer->doc .= '<form name="editform" method="post" action="/wiki/newpage.php" accept-charset="'.$lang['encoding'].'">';
		    $renderer->doc .= 'Section (namespace):';
			$renderer->doc .= $this->_makecombo();
			$renderer->doc .= '<br />Page shortname:';
		    $renderer->doc .= '<input class="edit" type="text" name="title" id="addnewpage_title" size="20" maxlength="255" tabindex="2" />';    
		    $renderer->doc .= '<input class="button" type="submit" value="'.((@$this->getLang('okbutton'))?$this->getLang('okbutton'):'ok').'" tabindex="3"  onclick="v=document.location.href.split(\'?\');x=v[0]+\'?id=\'+document.getElementById(\'np_cat\').value+\':\'+noaccent(document.getElementById(\'addnewpage_title\').value)+\'&do=edit\';document.location.href=x;return false;" />';
		    $renderer->doc .= '</form>';
		    $renderer->doc .= '</div>';

And I made a page called newpage.php that I put in the wiki directory (where I keep my wiki). That file contains the following:

<?php
if (!empty($_POST["namespace"])) {
	$namespace = $_POST["namespace"];
} else {
	$namespace = '';
}
if (!empty($_POST["title"])) {
	$title = $_POST["title"];
} else {
	$title = '';
}
header("Location: http://intranet.local/wiki/home?id=" . $namespace . ":" . $title . "&do=edit");
?>

Change the 'intranet.local' to your server name. Hope this helps someone.

Obviously, incredibly quick and dirty and not at all secure - don't use it anywhere public would be my advice - I plan to clean it up when I've sorted out a couple of other issues.


Does anyone know where to get the plugin code described here? I need a combo namespace + page adder. -TLL 6/26/07

— Teh combo only shows “root” is does not show the other namespaces - any reason why?

Add New Page Redirect to Current Page


When I click the “Add new page”-Button I get always redirected to the page where I placed the NewPage-Field and can edit that page but no new one - can anyone confirm that? I'm using DokuWiki-2007-06-26


Same here, same DokuWiki version (2007-06-26b). Plugin “addnewpage” (2007-01) opens only the current page.


That´s what I get, too (same version).

I had this problem, but I realized it was because I had two NEWPAGE buttons on the same page. They both receive the same name so the second one would not work and only opened the current page for editing.

I had the problem with “Add new page” redirect to current page. I was able to twinkle some settings to make it work. All changes are related to script.js which is in charge of creating the correct action in formula posted to web server. I had to change:

"?id="+document.getElementById('np_cat').value+':'+document.getElementById('addnewpage_title').value

by

"/{SERVERBASEADRESS}/doku.php/"+document.getElementById('np_cat').value+':'+document.getElementById('addnewpage_tit
le').value

where SERVERBASEADRESS is the absolute path in the URL before doku.php.

For example in my case, with URL, http://gandalf/wikitris/doku.php… SERVERBASEADDRESS is 'wikitris'

(ie. replace ?id= by /wikitris/doku.php/ )


I had the same issue with redirection (v. 2007-06-26b) to the current page and I tried the above workaround. However I had to replace

?id=

with

/{SERVERBASEADRESS}/doku.php/?id=

I had the exact same issue (but with again a slightly different solution :); I replaced

?id=

with

/dokuwiki/doku.php?id=

I have the DokuWiki folder installed in the root folder of my Web server (I'm using Apache, so in my case this is htdocs/)

:?:

UPDATE:

I think the problem is related to the dokuwiki directory not being in the “DocumentRoot” of the webserver, I installed the plugin on another server, which is accessed via a “http://wiki” “VirtualHost”, and the problem doesn't appear there.


I've tried all of these fixes here, and it still doesn't work. I can confirm that the problem is NOT related to the DokuWiki dir not being in the “DocumentRoot” of the webserver, because mine is in the DocumentRoot of the server. To me, it seems that the problem is that the plugin isn't picking up the text that I write into the editbox. I can't figure out how I could fix that if that would be the case. Any ideas? Thanks! –jasonskipper 01/22/08

UPDATE

This is strange, but I tried putting everything back to NORMAL, and it just suddenly worked. It didn't work at first, and it didn't work with any of the changes, but now it works with just ?id=… –jasonskipper 01/22/08


Same problem here, but only in IE6. The plugin works “out of the box” in Firefox, in IE6 the current page is opened for editing. Have tried suggested workarounds above without success. DokuWiki 2007-06-26b in IIS6. - Daniel Lindgren 2008-02-05

UPDATE

A day later it works in IE6 too. Haven't done a thing. Is there some kind of time period that has to pass in DokuWiki before the plugin functions properly? — Daniel Lindgren 2008-02-06


I use DokuWiki 2008-03-31 with Firefox, and I have the same problem. I'll try to solve it. Any idea of where the problem is??


This is strange, but I tried putting everything back to NORMAL, and it just suddenly worked. It didn't work at first, and it didn't work with any of
the changes, but now it works with just ?id=… –jasonskipper 01/22/08

I can confirm this. I started debugging the problem by sticking alerts, and commenting out the do=edit in render. Then, once I took them all back out, it started working. I even did a diff between my local install and a new download just to make sure I didn't change anything. The ONLY thing that is different is whitespace. So strange… ~TommyWang 08/29/08


I had this problem too! After clearing browser's offline repository and all the other information like cookies, caches, etc, then it works! It seems like JavaScript problem. ~Samsee 10/07/09

Namespace Fix

Syntax

{{ADDNEWPAGE>.}}

does not work because the script doesn't interpret dot as the current namespace. Here is a fix (code I took from the indexmenu plugin):

I add this function in /lib/plugins/addnewpage/syntax.php

  /** 
   * Parse namespace request
   *
   * @author  Samuele Tognini <samuele@cli.di.unipi.it>
   */
  function _parse_ns ($ns) {
    global $ID;
    $ns=preg_replace("/^\.(:|$)/",dirname(str_replace(':','/',$ID))."$1",$ns);
    $ns=str_replace("/",":",$ns);
    $ns = cleanID($ns);
    return $ns;
  }

and change in function _makecombo:

-- if (($data != "") && ($hide)) return '<input type="hidden" name="np_cat" id="np_cat" value="'. $data .'"/>';
++ if (($data != "") && ($hide)) return '<input type="hidden" name="np_cat" id="np_cat" value="'. $this->_parse_ns($data) .'"/>';

FIXME This works only if namespace separator not ”/”

Ramirez

Namespace Fix - Combo box fix

Rather than changing this line like so:

if(($data != "") && ($hide)) return '<input type="hidden" name="np_cat" id="np_cat" value="'. $data .'"/>';

I left it alone and simply added this:

 $data = $this->_parse_ns($data);

In function _makecombo after the line:

$hide=$this->getConf('addpage_hide');
Hello, I am trying to define a newpage button with a certain namespaces af a certain namespace showing on a combo box, but it is not working. The only way I can see a combo box is if I use newpage alone. Is it possible? I am trying the following syntax, where temadigital is a namespace that contains the namespaces that I would like the user to choose when creating a new page:
{{NEWPAGE>[:temadigital]}}
And also, I have noticed that the latest version of this plugin already have the changes made by Samuele Tognini. I have tried to apply the fix proposed just above, but it did not worked neither way. Thank you!

uderman

submit with ENTER in IE BUG

if you submit the form clicking in the button hitting enter key it works in FF, not in IE

there is a solution…

Function setname() never fired in this case.. because it´s bind to buttom.onclick event. I think it must be binded to form.onsubmit

So in syntax.php:

find
$renderer->doc .= '<form name="editform" id="editform" method="post" action="" accept-charset="'.$lang['encoding'].'">';
change to:
$renderer->doc .= '<form name="editform" id="editform" method="post" action="" accept-charset="'.$lang['encoding'].'" onsubmit="setName();return true;">';
2008/01/08 miguelito...

do=addnewpage

Useful plugin. How about an addnewpage command action.

<?php

if(!defined('DOKU_INC')) die();

if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'action.php');


class action_plugin_addnewpage extends DokuWiki_Action_Plugin
{

    var $doc;


    function getInfo ()
    {
        return array(
            'author' => 'Peter Niebling',
            'email'  => 'peter.niebling@co-met.info',
            'date'   => '5.7.2008',
            'name'   => 'addnewpage (action component)',
            'desc'   => 'Provides do=addnewpage command action',
            'url'    => 'http://www.co-met.info',
        );
    }


    function register ( & $controller )
    {
        $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, '_handle_act', array());
        $controller->register_hook('TPL_ACT_UNKNOWN', 'BEFORE', $this, '_handle_tpl_act', array());
    }


    function _handle_act( & $event, $param )
    {
        if ( $event->data != 'addnewpage' )
            return;
        $event->preventDefault();
    }


    function _handle_tpl_act ( & $event, $param )
    {
        if ( $event->data != 'addnewpage' )
            return;
        $event->preventDefault();

        $this->doc = '';

        if (
            auth_quickaclcheck($_REQUEST['id']) >= AUTH_CREATE
            and
            ( $syntax = plugin_load('syntax','addnewpage') )
            and
            $syntax->render('xhtml',$this,trim($_REQUEST['ns']))
            and
            $this->doc
        )
            print('<h5>'.$syntax->getLang('okbutton').'</h5>'.$this->doc); // Title could be better ?!
        else
            print p_locale_xhtml('denied');
    }

}

Just copy the code into action.php in the addnewpage directory.

5.7.2008 Peter


Russian

lang.php

<?php
/*
Russian language file
 */
$lang['namespaceRoot']="Root";
$lang['okbutton']     = 'Добавить страницу';
$lang['nooption']		="У вас нет прав для создания страницы";
//Setup VIM: ex: et ts=2 enc=utf-8 :
?>

settings.php

<?php
/*USE : UTF8*/
 
/*
 * Russian language file
 */
$lang['addpage_exclude']         = "Исключенные пространства имен (разделены ;)";
$lang['addpage_showroot'] 		 = "Показать корневое пространство имен";
$lang['addpage_hide'] 		 = "Когда вы используете {{NEWPAGE>[ns]}} синакис: спрятать выделение пространства имен (не отмеченно: показывать только подпространства имен')";
$lang['addpage_hideACL']="Спрятать {{NEWPAGE}} если пользователь не имеет прав на добавление страниц (показать сообщение если не отмеченно)"
?>
 
plugin/addnewpage.txt · Last modified: 2009/01/03 01:27 by 70.103.232.219
 

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported

Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsDarcsXRefTranslate