DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:addnewpage

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:addnewpage [2012-09-16 08:02] – [do=addnewpage] 92.225.179.87plugin:addnewpage [2024-02-15 21:47] (current) Aleksandr
Line 2: Line 2:
  
 ---- plugin ---- ---- plugin ----
-description: This plugin adds a selection box and an input box for adding a new page +description: Put ‘add new page’ forms within pages, with optional namespace selection 
-author     : iDo +author     : Damien Regad, Benjamin Santalucia, Sam Wilson and other contributors 
-email      : ido@idotech.info+email      : dregad@mantisbt.org
 type       : syntax type       : syntax
-lastupdate : 2009-04-23 +lastupdate : 2023-05-10 
-compatible : 2009-02-14rincewindangua+compatible : Rincewind, Angua, Adora Belle, Ponder Stibbons, Hrun, Detritus, Elenor of Tsort, Frusterick Manners, Greebo, Hogfather, IgorJack JackrumKaos
 depends    :  depends    : 
-conflicts addnewpage_old +conflicts  :  
-similar    : new_page_dialog+similar    : new_page_dialog, npd, catlist
 tags       : button, form, create tags       : button, form, create
-downloadurl: http://dokuplugins.idotech.info/addnewpage.zip 
----- 
  
-This is the new RELEASE for the DokuWiki 2009-02-14 version. If you want the old version see [[plugin:addnewpage_old]] +downloadurlhttps://github.com/dregad/dokuwiki-plugin-addnewpage/zipball/master 
- +bugtracker https://github.com/dregad/dokuwiki-plugin-addnewpage/issues 
-This plugin adds a selection box and an input box for adding a new page. +sourcerepo https://github.com/dregad/dokuwiki-plugin-addnewpage 
- +donationurlhttps://github.com/sponsors/dregad
-The selection box contains all namespaces of your wiki. +
-===== Demo ===== +
-<del>You can [[http://www.wikistuce.info/doku.php?id=nouvelle_page|see the plugin in action here]].</del> FIXME (broken link) +
- +
- +
- +
- +
- +
-====== syntax ====== +
- +
-Just write  +
-  {{NEWPAGE}}  +
- +
-or +
-  {{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 ====== +
- +
-Install the plugin using the [[plugin:plugin|Plugin Manager]] and the download URL above. Refer to [[:Plugins]] on how to install plugins manually. +
- +
-====== 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 : +
-<code php> +
-<?php +
-echo p_render('xhtml',p_get_instructions('{{NEWPAGE}}'),$info); +
-?>  +
-</code> +
- +
-__Hint__: If you like to add an icon stored in "lib/images/icons/page_new.gif" you can use this in your template, when you have added action.php as described [[#do_addnewpage|below]] +
-<code> +
-<a href="<?php echo wl($ID, 'do=addnewpage')?>"><img src="<?php echo DOKU_BASE?>lib/images/icons/page_new.gif" alt="new PAGE" /></a> +
-</code> +
- +
-====== Language ====== +
-  * French +
-  * English +
-  * arabic +
-  * Italian (incomplete) +
-  * Russian +
-  * Ukrainian +
-  * German +
-  * Spanish +
-  * Traditional Chinese +
-  * Chinese (Simplified) +
-  * Japanese +
-  * Swedish +
-  * Korean +
-  * Vietnamese +
-  * Other ? add here or mail me : [[ido@woow-fr.com|ido@woow-fr.com]] +
- +
-===== Language files ===== +
-==== French ==== +
-=== lang.php === +
-<code 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"; +
-?> +
-</code> +
-=== settings.php === +
-<code 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}}"; +
-?> +
-</code> +
- +
-==== English ==== +
-I made a few linguistic fixes to make it more English :-+
- +
-=== lang.php === +
-<code php> +
-<?php +
-/+
-English language file +
- *+
-$lang['namespaceRoot']="Root"; +
-$lang['okbutton'    = 'Add page'; +
-$lang['nooption'] ="You are not allowed to add pages"; +
-//Setup VIMexet ts=2 enc=utf-8 : +
-?> +
-</code> +
-=== settings.php === +
-<code 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)" +
-?> +
-</code> +
- +
- +
- +
- +
- +
-==== German ==== +
-=== lang.php === +
-<code 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 : +
-?> +
-</code> +
- +
-=== settings.php === +
-<code 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." +
-?> +
-</code> +
- +
- +
- +
-==== Spanish ==== +
-=== lang.php === +
-<code php> +
-<?php +
-/* +
-Spanish language file (Paraguay) +
- */ +
-$lang['namespaceRoot'] = "Raiz"; +
-$lang['okbutton'     = "Agregar pagina"; +
-$lang['nooption'     = "Ud. no tiene privilegios para crear la pagina"; +
-//Setup VIMexet ts=2 enc=utf-8 : +
-?> +
-</code> +
-=== settings.php === +
-<code 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 privilegiosSi el usuario no tiene permiso de crear una pagina, simplemente se oculta el codigo {{NEWPAGE}}" +
-?> +
-</code> +
- +
- +
- +
- +
- +
- +
-==== Portuguese ==== +
-=== lang.php === +
-<code php> +
-<?php +
-/* +
-Portuguese language file +
- */ +
-$lang['namespaceRoot']="Raiz"; +
-$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 : +
-?> +
-</code> +
-=== settings.php === +
-<code php> +
-<?php +
-/*USE : UTF8*/ +
- +
-/* +
- * Portuguese language file +
- */ +
-$lang['addpage_exclude'        = "Diretórios(namespace) excluídos (separados com ;)"; +
-$lang['addpage_showroot'       = "Mostrar raiz do diretório(namespace)"; +
-$lang['addpage_hide'] = "Quando a sintaxe {{NEWPAGE>[ns]}} é usada a seleção do namespace é escondida, senão mostra sub-namespace ativo"; +
-$lang['addpage_hideACL'        = "Esconde {{NEWPAGE}} se o usuário não possuir permissão para adicionar páginas (Quando desmarcado exibe mensagens)"; +
-?> +
-</code> +
- +
- +
-====  Traditional Chinese ==== +
-=== lang.php === +
-<code php> +
-<?php +
-/+
-Traditional Chinese language file +
- */ +
-$lang['namespaceRoot']="最上層(Root)"; +
-$lang['okbutton'    ="新增頁面"; +
-$lang['nooption'    ="你沒有權限執行新增頁面的動作"; +
-//Setup VIM: ex: et ts=2 enc=utf-8 : +
-?> +
-</code> +
-=== settings.php === +
-<code 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'        ="沒有打勾 : 表示當使用者沒有新增頁面權限時就顯示沒有權限的訊息而不會顯示出新增頁面的輸入欄." +
-?> +
-</code> +
- +
-====  Chinese(Simplified) ==== +
-=== lang.php === +
-<code php> +
-<?php +
-/* +
- * Chinese(Simplified) language file +
- */ +
-$lang['namespaceRoot']="根部命名空间"; +
-$lang['okbutton'    ="增加页面"; +
-$lang['nooption'    ="抱歉,您没有权限增加页面"; +
-//Setup VIM: ex: et ts=2 enc=utf-8 : +
-?> +
-</code> +
-=== settings.php === +
-<code php> +
-<?php +
-/* +
-  Chinese(Simplified) language file +
- */ +
-$lang['addpage_exclude'        = "排除的命名空间(使用;来分隔命名空间)"; +
-$lang['addpage_showroot'       = "显示根部命名空间"; +
-$lang['addpage_hide'] = "在使用 {{NEWPAGE>[ns]}} 时不显示命名空间的选择(未勾选则仅显示子命名空间)"; +
-$lang['addpage_hideACL'        ="用户没有新增页面权限时隐藏{{NEWPAGE}}(若未勾选则显示信息)" +
-?> +
-</code> +
- +
-==== Italian ==== +
- +
- +
-=== lang.php === +
-<code php> +
-<?php +
-/* +
-Italian language file +
- */ +
-$lang['namespaceRoot']="Root"; +
-$lang['okbutton'    = 'Aggiungi pagina'; +
-$lang['nooption'] ="Non hai i permessi per creare una nuova pagina"; +
-//Setup VIMexet ts=2 enc=utf-8 : +
-?> +
-</code> +
-=== settings.php === +
-<code 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)" +
-?> +
-</code> +
- +
- +
- +
- +
- +
- +
-==== Japanese ==== +
- +
-=== lang.php === +
- +
-<code php> +
-<?php +
-/+
-Japanese language file +
- */ +
-$lang['namespaceRoot']="ルート"; +
-$lang['okbutton'    = 'ページ追加'; +
-$lang['nooption'] ="ページの追加が許可されていません"; +
-//Setup VIM: ex: et ts=2 enc=utf-8 : +
-?> +
-</code> +
- +
-=== settings.php === +
- +
-<code php> +
-<?php +
-/*USE : UTF8*/ +
-  +
-/* +
- * Japanese language file +
- */ +
-$lang['addpage_exclude'        = "除外する名前空間(; 区切り)"; +
-$lang['addpage_showroot'] = "ルート名前空間を表示"; +
-$lang['addpage_hide'] = "{{NEWPAGE>[ns]}} 構文使用時: 名前空間選択リストを表示しない(チェックなし: 下位名前空間のみを表示)"; +
-$lang['addpage_hideACL']="ページ追加の権限を持たないユーザーに対しては {{NEWPAGE}} を表示しない(チェックなしの場合にはメッセージを表示)" +
-?> +
-</code> +
- +
-==== Swedish ==== +
- +
-=== lang.php === +
- +
-<code 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"; +
-?> +
-</code> +
- +
-=== settings.php === +
- +
-<code 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)" +
-?> +
-</code> +
-==== Russian ==== +
- +
- +
-=== lang.php === +
-<code php> +
-<?php +
-/* +
- * Russian language file +
- */ +
-$lang['encoding' = 'utf-8'; +
- +
-$lang['direction'] = 'ltr'; +
- +
-$lang['namespaceRoot'] = 'Корневое пространство имен'; +
-$lang['okbutton'     = 'Добавить страницу'; +
-//Setup VIM: ex: et ts=2 enc=utf-8 : +
-</code> +
-=== settings.php === +
-<code php> +
-<?php +
-/*USE : UTF8*/ +
- +
-/* +
- * Russian language file +
- */ +
-$lang['addpage_exclude' = "Исключённые пространства имён (рязделяйте точкой с запятой (;))"; +
-$lang['addpage_showroot'] = "Отображать корневое пространство имён"; +
-$lang['addpage_hide'    = "При использовании {{NEWPAGE>[ns]}} скрывать выбор пространств имён (Если этот пункт не выбран, отображать только подпространства имён)"; +
-$lang['addpage_hideACL' = "Скрывать {{NEWPAGE}}, если пользователь не имеет прав добавлять страницы (выводить сообщение, если этот пункт не выбран)" +
-</code> +
- +
-==== Ukrainian ==== +
- +
-=== lang.php === +
-<code php> +
-<?php +
-/* +
-Ukrainian language file +
-*/ +
-$lang['encoding'  = 'utf-8'; +
- +
-$lang['direction' = 'ltr'; +
- +
-$lang['namespaceRoot'    = 'Кореневий простір імен'; +
-$lang['okbutton'    = 'Додати сторінку'; +
-//Setup VIM: ex: et ts=2 enc=utf-8 : +
-?> +
-</code> +
-=== settings.php === +
-<code php> +
-<?php +
-/*USE : UTF8*/ +
- +
-/* +
- * Ukrainian language file +
- */ +
-$lang['addpage_exclude'        = "Виключені простори імен (розділені ;)"; +
-$lang['addpage_showroot'] = "Відображати кореневий простір імен"; +
-$lang['addpage_hide'] = "При застосуванні {{NEWPAGE>[ns]}} сховати вибір простору імен (якщо вибрано цей пункт  - відображати тільки підпростір імен)"; +
-$lang['addpage_hideACL']="Сховати {{NEWPAGE}}, якщо користувач не має прав додавати сторінки (відображати повідомлення, якщо цей пункт не вибрано)" +
-?> +
-</code> +
- +
-==== Arabic ==== +
-you will need to [[#rtl_problem_fix|apply RTL fix below]] +
- +
-=== lang.php === +
-<code php> +
-<?php +
-/* +
-Arabic language file by Ojuba.org team <core AT ojuba DOT org> +
- */ +
-$lang['namespaceRoot']="الجذر"; +
-$lang['okbutton'    = 'أضف الصفحة'; +
-$lang['nooption'] ="لا يسمح لك إضافة الصفحات"; +
-//Setup VIM: ex: et ts=2 enc=utf-8 : +
-?> +
-</code> +
-=== settings.php === +
-<code php> +
-<?php +
-/*USE : UTF8*/ +
-  +
-/* +
- * Arabic language file by Ojuba.org team <core AT ojuba DOT org> +
- */ +
-$lang['addpage_exclude'        = "الفضاءات المسثناة (تفصل بينها ;)"; +
-$lang['addpage_showroot'] = "اعرض فضاء الجذر"; +
-$lang['addpage_hide'] = "عند استعمال صيغة {{NEWPAGE>[ns]}}: أخفي اختيار فضاء التسمية (وإلا فإنه سيظهر الفضاءات الفرعية)"; +
-$lang['addpage_hideACL']="اخفاء {{NEWPAGE}} إن لم يكن للمستخدم الحق في إضافة صفحات (وإلا فإنها ستظهر)" +
-?> +
-</code> +
- +
- +
-==== Korean ==== +
-=== lang.php === +
-<code php> +
-<?php +
-/* +
-Korean language file +
- */ +
-$lang['namespaceRoot']="루트"; +
-$lang['okbutton'    = '페이지 추가'; +
-$lang['nooption'] ="페이지를 추가할 권한이 없습니다"; +
-//Setup VIM: ex: et ts=2 enc=utf-8 : +
-?> +
-</code> +
-=== settings.php === +
-<code php> +
-<?php +
-/*USE : UTF8*/ +
- +
-/* +
- * Korean language file +
- */ +
-$lang['addpage_exclude'        = "제외할 네임스페이스 (;로 구분)"; +
-$lang['addpage_showroot'] = "루트 네임스페이스 표시"; +
-$lang['addpage_hide'] = "{{NEWPAGE>[ns]}} 구문 사용시: 네임스페이스 리스트를 비표시 (비체크: 하위 네임스페이스만 보여줌)"; +
-$lang['addpage_hideACL']="사용자가 페이지를 추가할 권한이 없을 때 {{NEWPAGE}}를 비표시 (비체크: 메세지를 표시)" +
-?> +
-</code> +
- +
- +
- +
-==== Vietnamese ==== +
- +
-=== lang.php === +
-<code php> +
-<?php +
-/* +
-Vietnamese language file +
- */ +
-$lang['namespaceRoot']="Gốc"; +
-$lang['okbutton'    = 'Tạo trang mới'; +
-$lang['nooption'] ="Bạn không được phép tạo trang mới"; +
-//Setup VIM: ex: et ts=2 enc=utf-8 : +
-?> +
-</code> +
-=== settings.php === +
-<code php> +
-<?php +
-/*USE : UTF8*/ +
- +
-/* +
- * Vietnamese language file +
- */ +
-$lang['addpage_exclude'        = "Bỏ tên miền (ngăn cách bằng dấu ;)"; +
-$lang['addpage_showroot'] = "Hiển thị tên miền gốc"; +
-$lang['addpage_hide'] = "Khi bạn chọn syntax {{NEWPAGE>[ns]}}: Ẩn khả năng lựa chọn tên miền (không chọn: chỉ hiển thị tên miền phụ)"; +
-$lang['addpage_hideACL']="Ẩn {{NEWPAGE}} nếu người dùng không được phép tạo trang mới (hiển thị tin nhắn nếu không chọn)" +
-?> +
-</code> +
- +
- +
- +
- +
-====== 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 <nowiki>{{NEWPAGE[>namespace]}}</nowiki> (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 : [[plugin:addnewpage_old]] +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
-====== Discussion ====== +
-==== addnewpage as a part of the admin page ==== +
-Is there a possibilty to add the plugin as a part of the admin page, like the plugins pagemove or upgrade ? +
-- oscon, 2010-11-15 +
-==== Only one newpage per page ====  +
-Freight has written here, that only one NEWPAGE is allowed on one site, I think, it is very big lack of functionality.+
  
 +screenshot_img: :plugin:addnewpage_ns_nothidden.png
 ---- ----
  
-It also doesn't work after rc2009-02-14. Can anyone suggest how to fix this. This is a really useful plugin.+===== Installation =====
  
-----+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
-After installing Release rc2009-01-30 addnewpage does not work anymore. Can anybody help me?+===== Description =====
  
----- +This plugin allows you to add new-page forms to wiki pagesso that users can simply enter the title of new page and go straight to the editing form (rather than first creating link to the page, or typing the URL directly).
-I am not sure where exactly to put the above PHP code (from the [[plugin:addnewpage#tips|Tips]] section) into my template.  Can anyone please advise? [[jsb@greatertalent.com|help me]] +
->Put it where you want to see the new page forms. (\lib\tpl\default\main.php)\\  +
->>I'm new to XHTMLPHP and DokuWiki, and I'm trying to add the addnewpage plugin to the bar_ _topleft. When I add the PHP code from the [[plugin:addnewpage#tips|Tips section]] it always wraps it in <p>...</p>, and having 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 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.  --- //[[dokuwiki@dsslib.com|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 itbut you can use PHP: +
-<code php> +
-$out = p_render('xhtml',p_get_instructions('{{NEWPAGE}}'),$info); +
-echo str_replace(array("<p>","</p>"),array("",""),$out); +
-</code> +
->>> or if it doesn't work : +
-<code php> +
-ob_start(); +
-echo p_render('xhtml',p_get_instructions('{{NEWPAGE}}'),$info); +
-$out = ob_get_clean(); +
-echo str_replace(array("<p>","</p>"),array("",""),$out); +
-</code>  +
->>>> 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: +
-<code php> +
-<?php echo str_replace(array("<p>","</p>"),array("",""),p_render('xhtml',p_get_instructions('{{NEWPAGE}}'),$info))?> +
-</code> +
->>>> 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.   --- //[[dokuwiki@dsslib.com|Arnoud]] 2007-01-31 22:28//+
  
-<del> +The target namespace for the new page can either be selected from a drop-down list in the new-page formor specified in the form [[#syntax]]. Only namespaces to which the user is permitted to write are shown.
-===== 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 todaybut you fill the [namespaceparameter as an default into the fieldIn addition, you hide the fieldThis should work! +
-\\ +
-what do you think about this?\\+
  
-Martin +The plugin can pair with the [[plugin:newpagetemplate|newpagetemplate Plugin]to start with a predefined template instead of an empty page.
-> Hello, I think about this functionality. But I don't now what's better between your option and this option : the <code>{{NEWPAGE>[namespace]}}</code> use [namesapceas 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 >  +The form submit button is disabled if there is no text in the title field.
-</del>+
  
 +===== Usage =====
  
 +Put ''%%{{NEWPAGE}}%%'' anywhere in a wiki page to get a new-page-title text entry box, and a namespace selection drop-down menu.  More details in the [[#Syntax]] section below.
  
-<del>+==== Screenshots ====
  
-===== Script Bug ===== +| {{:plugin:addnewpage_nooptions.png }}    | The default form has drop-down with all namespaces of the wiki and a text field for the pagename| 
-Also the new version contains the same bugI found now the problem:\\ +| {{:plugin:addnewpage_ns_hidden.png }}    | ''%%{{NEWPAGE>test}}%%'' with configuration option "Hide namespace selection" enabled| 
-script does not contain an error, it is 3 character long prefix in the file, which is not indicated by normal text editors (probably code-head, "EFBBBF"). use a hexeditor to see and delete it. The script mash by pure ASCII-text, without binary head.\\ +| {{:plugin:addnewpage_ns_nothidden.png }} | ''%%{{NEWPAGE>test}}%%'' with configuration option "Hide namespace selectiondisabled. | 
-(I put a German translation, it was deletedWhy?) +| {{http://i.imgur.com/gQ6yl0Y.png }} | Parent namespaces are greyed-out where the user has no access to add pages|
-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, "EFBBBFis 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. (ß => ß, ü => ü) +
-</del>+
  
  
-By testing the new release, now with %%{{NEWPAGE}}%% its only the root in the list, nothing else. \\ +===== Syntax =====
->Ok, I've just fix it ! sorry ;)+
  
-I'm always getting an error after I've put the <nowiki>{{NEWPAGE[>namespace]}}</nowiki> into the page and save, here's the error I get: +==== Basic ====
-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 latest DokuWiki release ?+
  
-<del><nowiki> +The basic syntax is:
-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> +  {{NEWPAGE}} 
---- 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">'; +Orto specify a namespace:
-                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> +
-</nowiki></del>+
  
-Maybe a user have generally the right to add pages, but only in a specific namespace. +  {{NEWPAGE>namespace}}
-<code> +
-#--- in acl.auth.php +
-#--- NOT "test" inside the ListBox/ComboBox +
-*         @user       8 +
-test:   @user       1+
  
-or+Where ''namespace'' is the target namespace for the new page. 
 +When this is specified, the namespace selection box can either be hidden (which it is by default) or set to show only sub-namespaces of the given one. 
 +This is configured in the main wiki configuration manager. 
 +If ''@PAGE@'' (or ''@NS@'') is given, the current page ID (or its namespace) will be used (e.g. for use in [[:namespace templates]]; see below).
  
-#--- ONLY "test" inside the ListBox/ComboBox +==== Creating a namespace ====
-*         @user       1 +
-test:   @user       8 +
-</code>+
  
-had the same effect like the option ''addpage_hide''(could replace this option) +It is possible to use the ''@INPUT@'' placeholder to reference the user's input in the namespace specificationFor example,
-<code> +
-{{NEWPAGE[>ns][;ns][;ns]}} only this namespaces +
-{{NEWPAGE[<ns][;ns][;ns]}} everything except this namespaces +
-</code>+
  
-(I am unfortunately not a good PHP programmer)+  {{NEWPAGE>foo:@INPUT@:start}}
  
-> Actually, if 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+will create new namespace within the //foo// namespace. 
  
------- 
  
 +==== Date/time-based naming ====
  
-==== Newpagetemplate patch ====+The plugin supports usage of [[https://www.php.net/manual/en/function.strftime.php|strftime placeholders]] in the namespace config. This allows adding date elements to the namespace specification
  
-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>project:notes:@INPUT@_%Y-%m-%d}} 
-<code> +  {{NEWPAGE>reports:%Y:week_%W}}
-{{NEWPAGE>ns|newpagetemplate=:pagetemplate:newpagetemplate&newpagevars=@NEWVAR@,test value}} +
-</code> +
-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'the patch:+When used together with the [[#configuration_and_settings|autopage]] option to hide the input field, a daily page can be created with a single button click
  
-<code> +  {{NEWPAGE>journal:%Y-%m-%d?autopage}}
---- 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>'; +
-</code> +
-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 [[plugin:newpagetemplate]] that I wrote into the addnewpage plugin, that would be great too.  Thanks again for such a great plugin!+
  
-----+==== Configuration overrides ====
  
-Regarding this patch: How can I apply itI tried +It is possible to override the plugin's [[#configuration_and_settings|configuration]] for a single usage of the syntax, by specifying a ''?'' followed by the config's name with an optional ''no'' prefix to negate it. Values for non-boolean configs can be provided with ''='', separated by '';''. Multiple overrides can be given, separated by '','' or ''&''
  
-  cat the-patch.diff | patch -p0+General syntax:
  
-in the plugin directorybut all three hunks were rejectedAny idea why?+  ?[no]<option_1>[=value_1[;value_2]...][,[no]<option_2>]...
  
--- Niklas Volbers+Examples:
  
-you should run it within the addnewpage plugin directory; it modifies the syntax.php file; or you can [[https://www.cnaf.infn.it/~andreozzi/tmp/syntax.php.txt|get the modified syntax.php]] (remove the .txt at the end). +  * overwrite the default hide setting <code> 
- +{{NEWPAGE>namespace?nohide}}
--- Sergio +
- +
-> The patched syntax.php of the addnewpage-plugin is not available anymore in the above link. Could anybody please upload the patched code? Because of a lack of php-knowledge, I failed in patching it manually. +
- +
----- +
- +
-<del>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 for 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!</del> +
- +
-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:  +
-<code> +
-     $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>';+
 </code> </code>
- +  * custom namespace exclusion and hide root <code> 
-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:  +{{NEWPAGE>namespace?exclude=project;reports&noshowroot}}
- +
-<code> +
-<?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"); +
-?>+
 </code> </code>
  
-Change the 'intranet.local' to your server name. Hope this helps someone. +==== New-page templates ====
  
-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 couple of other issues. +This plugin is also compatible with the [[:plugin:newpagetemplate|newpagetemplate plugin]] (note that this is a separate feature to the [[#namespace templates]] described below). To specify template to be used with the new page, use one of the following syntaxes:
  
----- +| ''%%{{NEWPAGE#newtpl}}%%'' | Use the ''newtpl'' template | 
-Does anyone know where to get the plugin code described [[plugin:newpagebutton|here]]? I need combo namespace + page adder. -TLL 6/26/07+| ''%%{{NEWPAGE#newtpl1,newtpl2}}%%'' | Present drop-down list of ''newtpl1'' and\\ ''newtpl2'', allowing the user to choose one | 
 +| ''%%{{NEWPAGE#newtpl1|Title One,newtpl2|Title Two}}%%'' | The same as above, but with nicer titles |
  
---- +In all of these, the basic ''>namespace'' syntax can be included before the hash ''#'' character.
-The combo only shows "root" is does not show the other namespaces - any reason why?+
  
 +==== Multiple occurences ====
  
 +The ''%%{{NEWPAGE}}%%'' syntax may be added multiple times on the same page.
  
-==== Add New Page Redirect to Current Page ====+==== Site templates ====
  
----- +To include an add-new-page form in a [[:template|Site Template]]use the following line:
-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 heresame 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: 
-<code>"?id="+document.getElementById('np_cat').value+':'+document.getElementById('addnewpage_title').value</code> 
-by 
-<code>"/{SERVERBASEADRESS}/doku.php/"+document.getElementById('np_cat').value+':'+document.getElementById('addnewpage_tit 
-le').value</code> 
- 
-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 
- 
-<code> 
-?id= 
-</code> 
- 
-with  
- 
-<code> 
-/{SERVERBASEADRESS}/doku.php/?id= 
-</code> 
- 
---- 
- 
-I had the exact same issue (but with again a slightly different solution :); I replaced 
- 
-<code> 
-?id= 
-</code> 
- 
-with  
- 
-<code> 
-/dokuwiki/doku.php?id= 
-</code> 
- 
-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 
- 
----- 
- 
-If you are using Firefox press CTRL+F5 to force the browser to reload all of your wiki content. ;) ~jjwin2k  
- 
----- 
- 
-For me Ctrl-F5 was not enough but 'touch /etc/dokuwiki/local.php' and then Ctrl-F5 helped ~dworki 11/07/01 
- 
----- 
- 
-I only had this problem when using several addnewpage-tags per wikipage. With one addnewpage-tag it worked. 
- 
-===== Namespace Fix ===== 
- 
-Syntax <code>{{ADDNEWPAGE>.}}</code> 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** 
 <code php> <code php>
-  /**  +<?php echo p_render('xhtml',p_get_instructions('{{NEWPAGE}}'),$info?>
-   * 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; +
-  }+
 </code> </code>
  
-and change in function **_makecombo**: +==== Namespace Templates ====
-<code> +
--- 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) .'"/>'; +
-</code>+
  
-FIXME This works only if namespace separator not "/"+Add-new-page forms can also be added to [[:Namespace Templates]].  The replacement patterns ''@ID@'' and ''@NS@'' can be used in the plugin's ''namespace'' parameter.
  
--- //Ramirez// +===== Configuration and Settings =====
- +
-==== Sidebar fix ==== +
- +
-If you want to use <nowiki>{{ADDNEWPAGE>.}}</nowiki> in a sidebar you should change the ''_parse_ns'' function to +
-<code php> +
-  function _parse_ns ($ns) { +
-    global $INFO; +
-    $ns=preg_replace("/^\.(:|$)/",dirname(str_replace(':','/',$INFO['id']))."$1",$ns); +
-    $ns=str_replace("/",":",$ns); +
-    $ns = cleanID($ns); +
-    return $ns; +
-  } +
-</code> +
-so the namespace is relative to the main page (not the sidebar's namespace). --- [[user>rikblok|Rik Blok]] //2011/02/26 03:44// +
-==== Namespace Fix - Combo box fix ==== +
- +
-Rather than changing this line like so: +
-<code> +
-if(($data != "") && ($hide)) return '<input type="hidden" name="np_cat" id="np_cat" value="'. $data .'"/>'; +
-</code> +
-I left it alone and simply added this: +
-<code> +
- $data $this->_parse_ns($data); +
-</code> +
-In function **_makecombo** after the line: +
-<code> +
-$hide=$this->getConf('addpage_hide'); +
-</code> +
- +
- +
->Hello, I am trying to define a newpage button with a certain namespaces of 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: +
- +
-<code> +
-{{NEWPAGE>[:temadigital]}} +
-</code>+
  
->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 wayThank you!+You can configure the plugin in the Config Manager of DokuWikiThere are four settings:
  
-[[felipe.uderman@gmail.com uderman]]+  - **Excluded namespaces** (''exclude'') — A semicolon-separated list of namespaces that should be excluded from the namespace selection list. Default: ''wiki;playground''
 +  - **Show root namespace** (''showroot'') — Whether to show the wiki's root namespace in the namespace selection list. Default: true. 
 +  - **Hide namespace selection** (''hide'') — Hide the namespace selection list. Only applies if a namespace is given (see [[#syntax|above]])Default: true. 
 +  - **Hide "access denied" message** (''hideACL'') — Do not show the "You are not allowed to add pages" message when the user doesn't have permission to create pages. Default: false (i.e. do show the message). 
 +  - **Hide the input box** (''autopage'') — The preconfigured namespace is treated as a full page ID. Use with [[#date_time-based_naming|date placeholders]]). Default: false.
    
  
-===== submit with ENTER in IE BUG=====+=====FAQ=====
  
-if you submit the form <del>clicking in the button</del> **hitting enter key** it works in FF, not in IE+=== Why is a privileged user not allowed to add pages? ===
  
-there is solution...+Logged in as administrator, why do I get //You are not allowed to add pages// error message ?
  
-Function setname() never fired in this case.. because it's bind to buttom.onclick event. I think it must be bound to form.onsubmit+> This is a [[https://github.com/dregad/dokuwiki-plugin-addnewpage/issues/38|known problem]], caused by cachingAs a workaround, add ''%%~~NOCACHE~~%%'' to the page that contains the form.
  
-So in syntax.php: 
  
-  find +=== Addnewpage form on the admin page? ===
-  $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;">';+
  
 +Is there a possibility to add the plugin as a part of the admin page, like the plugins pagemove or upgrade?
  
-  2008/01/08 miguelito...+> Not currently, but this can be done by modifying your template and including the addnewpage form only when ''$ACT=='admin'''
  
----- +=== More than one form per page? ===
-===== do=addnewpage =====+
  
-Useful plugin. How about an addnewpage command action. +Is it possible to have more than one new-page form on a page?
-<code php action.php> +
-<?php+
  
-if(!defined('DOKU_INC')) die();+> Yes. Nothing special needs to be done to permit this, just add the markup wherever you want the forms to appear.
  
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +=== Can the textbox be pre-populated with a value? Specifically, the ID variable? (Trying to have a user search for a pagethen use this plugin to create the page if they don't find what they're looking for...) ===
-require_once(DOKU_PLUGIN.'action.php');+
  
 +=== How can a add_page form add in the site template automaticaly? Where to place the php statements? ===
  
-class action_plugin_addnewpage extends DokuWiki_Action_Plugin +===== Development =====
-{+
  
-    var $doc;+==== Issues and feature requests ====
  
 +Please report all bugs and feature requests through the 
 +[[https://github.com/dregad/dokuwiki-plugin-addnewpage/issues|issue-tracking system on Github]].
  
-    function getInfo () +Items of general interest should be added to the [[#faq|FAQ above]].
-    { +
-        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 ) +==== Releases ====
-    { +
-        $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, '_handle_act', array()); +
-        $controller->register_hook('TPL_ACT_UNKNOWN', 'BEFORE', $this, '_handle_tpl_act', array()); +
-    }+
  
 +{{rss>https://github.com/dregad/dokuwiki-plugin-addnewpage/releases.atom 5}}
  
-    function _handle_act( & $event, $param ) +The complete [[https://github.com/dregad/dokuwiki-plugin-addnewpage/releases|list of releases and change log]] is available on Github.
-    { +
-        if ( $event->data != 'addnewpage'+
-            return; +
-        $event->preventDefault(); +
-    }+
  
  
-    function _handle_tpl_act ( & $event, $param ) +=== Recent commits ===
-    { +
-        if ( $event->data !'addnewpage'+
-            return; +
-        $event->preventDefault();+
  
-        $this->doc = '';+{{rss>https://github.com/dregad/dokuwiki-plugin-addnewpage/commits/master.atom 5 author date}}
  
-        if ( +Full [[https://github.com/dregad/dokuwiki-plugin-addnewpage/commits/master|Git log]].
-            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'); +
-    }+
  
-} 
-</code> 
-Just copy the code into action.php in the addnewpage directory. 
  
-//5.7.2008 Peter// +==== Legacy releases ====
-----+
  
-===== Add page plugin doesn't work with non-English characters (subnamespace) =====+=== Before development moved to Github ===
  
-I just realized that if you put a subnamespace under a namespace written with non-English charactersthe plugin won't work correctly.+  * 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) 
 +  * 2007-01-13: Add new functionality with the syntax <nowiki>{{NEWPAGE[>namespace]}}</nowiki> (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 Releaseold version [used to be] at ''plugin:addnewpage_old''
  
-It doesn't show the subnamespace in the list+=== When this plugin was 'addnewpage_old' ===
  
-for exampleif there'a subnamespace called B put under a namespace A written in Chinese, the B won't appear in the list, even it do exist.+  * 2006-11-14: Fixed: bug with new dokuwiki version.  Added italian language file. 
 +  * 2006-07-05: Fixed: Zip file is now ok.  Added: Russian language file. 
 +  * 2006-06-20 : Fixed: Problem with the empty select boxAdded: Multilanguage Support; Root Namespace (see Kibi'comment); The selected line is now the same as the current namespace (see Kibi's comment);
  
-Any one could fix this? 
  
-> This may work. +===== History Credits =====
-+
-> Replace below (around line 153) in function _getnslist in syntax.php file  +
-><code php> +
-$r=$this->_getnslist($tns.'/'.$v['id']); +
-</code> +
-> with +
-><code php> +
-$r=$this->_getnslist($tns.'/'.urlencode($v['id'])); +
-</code>+
  
 +The plugin was [[plugin:addnewpage_old?rev=1366805333|originally written]] by Benjamin Santalucia (aka iDo) in 2006.
 +It was forked after the 2009-02-14 release of Dokuwiki, and moved to GitHub by [[https://github.com/hamstar|Robert McLeod]] in 2012.
 +Refer to the [[#legacy_releases|Legacy Releases]] section for details on what happened in those early, pre-GitHub years.
  
->我用中文的时候也遇到了上面所说的问题,也按照上面所说的操作去做了,发现不起作用,不过我也得到了启发,就像解决中文文件名的问题那样来解决。 +In 2013, [[https://github.com/samwilson|Sam Wilson]] picked up the plugin'maintenance and actively supported it until he stopped using DokuWiki at the end of 2016During this time, he merged several improvements and fixes contributed by these fine people:
->类似上面所说的,只是把153行的 +
-><code php> +
-$r=$this->_getnslist($tns.'/'.$v['id']); +
-</code> +
-改为 +
-><code php> +
-$r=$this->_getnslist($tns.'/'.mb_convert_encoding($v['id'],"GBK","UTF-8")); +
-</code> +
-我的系统是WinXP,测试正常。 +
- +
-[[http://forum.dokuwiki.org/thread/5546|另外一种方法可以参考这里]] +
-===== Plugin is incompatible with DokuWiki Release 2009-02-14 ===== +
- +
-After upgrading to Release 2009-02-14, this plugin no longer works. Adding:  +
- +
-<code> +
-{{NEWPAGE}}  +
-</code> +
- +
-does not result in any output. However, Peter Niebling'action script still works. +
- +
-Is this going to be fixed? +
- +
-> this can be fixed by replacing the handle function with this +
-> <code php> +
-function handle($match, $state, $pos, &$handler){ +
-        $ns = substr($match, 10, -2);  // strip markup +
-       return array($ns); +
-+
-</code> +
->  +
-and add the line to the top of the render function +
-> <code php> +
-$data = $data[0]; +
-</code> +
-> this should fix it +
-> greetings, dominik +
->>Thanks a lot, I've updated the zip file +
- +
-===== RTL problem fix ===== +
-this script hardcodes left, it should use right in RTL languages +
- +
-this is a simple patch +
- +
-<code diff> +
---- syntax.php~ 2009-06-13 23:32:11.850768437 +0300 +
-+++ syntax.php 2009-06-13 23:32:11.885643342 +0300 +
-@@ -44,7 +44,8 @@ +
-  return true; +
-  }  +
-  +
--     $renderer->doc .= '<div class="addnewpage_form" id="addnewpage_form" align="left">'; +
-+     if ($lang['direction']=='rtl') {$my_align='rihgt';} else {$my_align='left';+
-+     $renderer->doc .= '<div class="addnewpage_form" id="addnewpage_form" align="'.$my_align.'">'; +
-      $renderer->doc .= '<form name="editform" id="editform" method="post" action="" accept-charset="'.$lang['encoding'].'" onsubmit="setName();return true;">'; +
-      $renderer->doc .= $cmb; +
-      $renderer->doc .= '<input class="edit" type="text" name="title" id="addnewpage_title" size="20" maxlength="255" tabindex="2" />'; +
-</code> +
- +
-===== Conflict with other JavaScript ===== +
-I encountered confliction other JavaScript's function name. Since 'setName' likes to occur commonly, I recommend change the name of the function more specific, such as 'setAddPageName' Change scripts in both JavaScript script(script.js) and HTML producing script(syntax.php). +
- +
-**script.js** +
-  #2  function setAddPageName() { +
-**syntax.php** +
-  #50 ... onsubmit="setAddPageName();... +
-   +
-  +
-===== Remove language sections on page ===== +
- +
-Could you please remove the packaged language sections of this page, since most of them are in the plugin archive. Thanks  --- [[user>lupo49]] //2011/01/23 15:16// +
- +
-===== Usage in Template: not valid  ===== +
-If you use this in a template and add a namespace to it, the > will be recognized as closing tag. The same happens with &gt;. Can something be done about it? +
-   <?php +
-  echo p_render('xhtml',p_get_instructions('{{NEWPAGE> }}'),$info); +
-   ?>  +
-Feb.06.2011 +
- +
-===== XHTML validation fails ===== +
- +
-I have found that XHTML validation fails at (at least) two places: +
- +
-  * the %%<div class="addnewpage_form">%% tag comes inside a %%<p>%% tag +
-  * some %%option%% elements inside the %%<select class="edit" >%% pull-down selector come with invalid %%selected="true"%% attributes +
- +
-Here is a patch (please note that I use Unix end-of-line style)Thanks for this plugin and the time spent in maintenance. +
- +
-<code diff syntax.diff> +
---- syntax.php.orig 2011-05-09 13:12:46.000000000 +0200 +
-+++ syntax.php 2011-05-09 13:16:40.000000000 +0200 +
-@@ -15,6 +15,7 @@ +
-         ); +
-     } +
-   +
-+    function getPType(){ return 'block';+
-  +
-     function getType(){ +
-         return 'substition'; +
-@@ -98,12 +99,12 @@ +
-   +
-  if ($data=='') { +
-  if (!$root_disabled) { +
-- $ret.='<option '.(($ns=='')?'selected="true"':'').' value="">'.((@$this->getLang('namespaceRoot'))?$this->getLang('namespaceRoot'):'top').'</option>'; +
-+ $ret.='<option '.(($ns=='')?'selected="selected"':'').' value="">'.((@$this->getLang('namespaceRoot'))?$this->getLang('namespaceRoot'):'top').'</option>'; +
-  $someopt=true; +
- +
-  } else { +
-  if (!$root_disabled) { +
-- $ret.='<option '.(($ns==$data)?'selected="true"':'').' value="'.$data.'">'.$data.'</option>'; +
-+ $ret.='<option '.(($ns==$data)?'selected="selected"':'').' value="'.$data.'">'.$data.'</option>'; +
-  $someopt=true; +
- +
-   +
-@@ -116,7 +117,7 @@ +
-  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>'; +
-+ $ret.='<option '.(($ns==$v)?'selected="selected"':'').' value="'.$v.'">'.$vv.'</option>'; +
-  $someopt=true; +
-  } +
-  $ret.='</select>'; +
-</code>+
  
-benat2011-05-09+  * Michael Braun 
 +  * Róbert Toth (FurloSK) 
 +  * Gerrit Uitslag ([[user>Klap-in]]) added support for [[plugin:newpagetemplate]] plugin in 2014 
 +  * Albert Cherndisabling of restricted parent namespaces in 2015
  
 +In May 2023, Damien Regad decided to take over the plugin's maintenance.
  
 +Thanks to [[https://github.com/dregad/dokuwiki-plugin-addnewpage/graphs/contributors|all the people who contributed]] to this plugin over the years.
  
  
  
-===== Showing some namespaces in root but not all? ===== 
-I installed this on Dokuwiki last release I think 4/11/2011 and I notice that only some items in the \\ root are displaying on the menu but not all sub-namespaces and not all namespaces? I'm not sure how to fix this?  
plugin/addnewpage.1347775349.txt.gz · Last modified: 2012-09-16 08:02 by 92.225.179.87

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki