├── .gitattributes ├── .mailmap ├── README.md ├── conf ├── default.php └── metadata.php ├── lang ├── ar │ ├── lang.php │ └── settings.php ├── bg │ ├── lang.php │ └── settings.php ├── ca │ ├── lang.php │ └── settings.php ├── ckb │ ├── lang.php │ └── settings.php ├── cs │ ├── lang.php │ └── settings.php ├── da │ ├── lang.php │ └── settings.php ├── de-informal │ ├── lang.php │ └── settings.php ├── de │ ├── lang.php │ └── settings.php ├── en │ ├── lang.php │ └── settings.php ├── eo │ ├── lang.php │ └── settings.php ├── es │ ├── lang.php │ └── settings.php ├── fa │ ├── lang.php │ └── settings.php ├── fr │ ├── lang.php │ └── settings.php ├── hu │ ├── lang.php │ └── settings.php ├── it │ ├── lang.php │ └── settings.php ├── ja │ ├── lang.php │ └── settings.php ├── ko │ ├── lang.php │ └── settings.php ├── nl │ ├── lang.php │ └── settings.php ├── no │ ├── lang.php │ └── settings.php ├── pl │ ├── lang.php │ └── settings.php ├── pt-br │ ├── lang.php │ └── settings.php ├── pt │ ├── lang.php │ └── settings.php ├── ru │ ├── lang.php │ └── settings.php ├── sv │ ├── lang.php │ └── settings.php ├── uk │ ├── lang.php │ └── settings.php ├── vi │ ├── lang.php │ └── settings.php ├── zh-tw │ ├── lang.php │ └── settings.php └── zh │ ├── lang.php │ └── settings.php ├── plugin.info.txt ├── script.js ├── style.less └── syntax.php /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Robert McLeod 2 | Michael Kraemer 3 | Michael Kraemer 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Add New Page Plugin for DokuWiki 2 | 3 | Copyright (c) 2006 Benjamin Santalucia 4 | Copyright (c) 2013 Sam Wilson 5 | Copyright (c) 2023 Damien Regad 6 | 7 | The plugin lets users put *add new page* forms within pages, with optional namespace selection. 8 | 9 | ## License 10 | 11 | This program is free software; you can redistribute it and/or modify 12 | it under the terms of the 13 | [GNU General Public License, version 2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) 14 | or later. 15 | 16 | This program is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | GNU General Public License for more details. 20 | 21 | ## Installation and Configuration 22 | 23 | Please refer to 24 | [the plugin's wiki page](https://www.dokuwiki.org/plugin:addnewpage) 25 | for information on how to install, configure and use this plugin in DokuWiki. 26 | 27 | 28 | ## Support 29 | 30 | Source code and support for this plugin can be found at 31 | 32 | 33 | ## Credits 34 | 35 | The plugin was originally written by [Benjamin Santalucia](https://github.com/ben8p) (aka iDo) in 2006. It was forked after the 2009-02-14 release of Dokuwiki, and moved to GitHub by [Robert McLeod](https://github.com/hamstar) in 2012. 36 | Refer to the [Legacy Releases section](https://www.dokuwiki.org/plugin:addnewpage#legacy_releases) in the plugin's home page for details on what happened in those early, pre-GitHub years. 37 | 38 | In 2013, [Sam Wilson](https://github.com/samwilson) picked up the plugin's maintenance and actively supported it until he stopped using DokuWiki at the end of 2016. 39 | During this time, he merged several improvements and fixes contributed by these fine people: 40 | 41 | - [Michael Braun](https://github.com/michael-dev) 42 | - [Róbert Toth](https://github.com/FurloSK) 43 | - [Gerrit Uitslag](https://github.com/klap-in) added support for newpagetemplate plugin in 2014 44 | - [Albert Chern](https://github.com/achern), disabling of restricted parent namespaces in 2015 45 | 46 | In May 2023, [Damien Regad](https://github.com/dregad) decided to take over the plugin's maintenance. 47 | 48 | Thanks to [all the people who contributed](https://github.com/dregad/dokuwiki-plugin-addnewpage/graphs/contributors) to this plugin over the years. 49 | -------------------------------------------------------------------------------- /conf/default.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['namespaceRoot'] = 'الجذر'; 9 | $lang['okbutton'] = 'أضف صفحة'; 10 | $lang['nooption'] = 'لا يسمح لك إضافة صفحات'; 11 | -------------------------------------------------------------------------------- /lang/ar/settings.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['addpage_exclude'] = 'النطقات المسثناة (يفصل بينها بـ ;)'; 9 | $lang['addpage_showroot'] = 'اعرض نطاق الجذر'; 10 | $lang['addpage_hide'] = 'عند استعمال صيغة {{صفحة جديدة>[ns]}}: أخفي اختيار تسمية النطاق (وإلا فإنه سيظهر النطاق الفرعية)'; 11 | $lang['addpage_hideACL'] = 'اخفاء {{صفحة جديد}} إن لم يكن للمستخدم الحق في إضافة صفحات (وإلا فإنها ستظهر)'; 12 | -------------------------------------------------------------------------------- /lang/bg/lang.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['namespaceRoot'] = 'Основно именно пространство'; 9 | $lang['okbutton'] = 'Добави страница'; 10 | $lang['nooption'] = 'Нямате право да създавате страница тук'; 11 | -------------------------------------------------------------------------------- /lang/bg/settings.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['addpage_exclude'] = 'Списък с изключени именни пространства (разделени със знак ;)'; 9 | $lang['addpage_showroot'] = 'Покажи основното именно пространство'; 10 | $lang['addpage_hide'] = 'Когато се използва синтаксиса {{NEWPAGE>[ns]}}: Скрий избора на именно пространство (ако не е избрано: покажи само дъщерните именни пространства)'; 11 | $lang['addpage_hideACL'] = 'Скрий {{NEWPAGE}}, ако потребителят няма права да добавя страници (покажи съобщение, ако не е избрано)'; 12 | -------------------------------------------------------------------------------- /lang/ca/lang.php: -------------------------------------------------------------------------------- 1 | [ns]}}: Oculta la selecció d'espais de nom (desmarcat: només mostra els subespais de nom)"; 10 | $lang['addpage_hideACL'] = "Si desmarcat, mostra un missatge quan l'usuari no té permisos suficients per crear una pàgina. Si no, occulta {{NEWPAGE}}"; 11 | -------------------------------------------------------------------------------- /lang/ckb/lang.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['namespaceRoot'] = 'ڕەگ'; 9 | $lang['okbutton'] = 'زیادکردنی لاپەڕە'; 10 | $lang['nooption'] = 'تۆ ڕێگەت پێنەدراوە لاپەڕەزیاد بکەیت'; 11 | -------------------------------------------------------------------------------- /lang/ckb/settings.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['addpage_exclude'] = 'بۆشایی ناوی بەدەرکراو (جیاکراونەتەوە لەگەڵ ;)'; 9 | $lang['addpage_showroot'] = 'بۆشایی ناوی ڕەگ نیشان بدە'; 10 | $lang['addpage_hide'] = 'کاتێک تۆ {{NEWPAGE>[ns]}} ڕستەسازی بەکاردێنیت: شاردنەوەی دیاریکردنی بۆشایی ناو (نەپشکندراوە: تەنها ژێربۆشایی پیشان بدە)'; 11 | $lang['addpage_hideACL'] = 'شاردنەوە {{NEWPAGE}} ئەگەر بەکارهێنەر مافی ئەوەی نییە لاپەڕەزیاد بکات (نیشاندانی پەیام ئەگەر نەپشکنرابێت)'; 12 | -------------------------------------------------------------------------------- /lang/cs/lang.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Jaroslav Lichtblau 8 | */ 9 | $lang['namespaceRoot'] = 'Kořen'; 10 | $lang['name'] = 'Název stránky'; 11 | $lang['okbutton'] = 'Přidat stránku'; 12 | $lang['nooption'] = 'Nejste oprávněni přidávat stránky'; 13 | -------------------------------------------------------------------------------- /lang/cs/settings.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Jaroslav Lichtblau 8 | */ 9 | $lang['addpage_exclude'] = 'Vyloučit jmenné prostory (oddělené středníkem ;)'; 10 | $lang['addpage_showroot'] = 'Zobrazit kořenový jmenný prostor'; 11 | $lang['addpage_hide'] = 'Pokud použijete syntaxi {{NEWPAGE>[ns]}}: Skrýt výběr jmenného prostoru (pokud není zaškrtnuto zobrazit pouze jmenné podprostory)'; 12 | $lang['addpage_hideACL'] = 'Skrýt {{NEWPAGE}} pokud uživatel nemá práva přidávat stránky (pokud není zaškrtnuto zobrazit zprávu)'; 13 | $lang['addpage_autopage'] = 'Nezobrazovat vstupní pole, předkonfigurovaný jmenný prostor je považován za úplné ID stránky (má smysl u zástupných symbolů data)'; 14 | -------------------------------------------------------------------------------- /lang/da/lang.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['namespaceRoot'] = 'Rod'; 9 | $lang['okbutton'] = 'Tilføj side'; 10 | $lang['nooption'] = 'Du har ikke tilladelse til at tilføje sider'; 11 | -------------------------------------------------------------------------------- /lang/da/settings.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['addpage_exclude'] = 'Ekskluderet navnerum (separeret med ;)'; 9 | $lang['addpage_showroot'] = 'Vis rod-navnerum'; 10 | $lang['addpage_hide'] = 'Når du benytter {{NEWPAGE>[ns]}} syntaks: Skjul valgte navnerum (umarkeret: vis kun under-navnerum)'; 11 | $lang['addpage_hideACL'] = 'Skjul {{NEWPAGE}} hvis brugeren ikke har rettigheder til at tilføje sider (vis meddelelse hvis umarkeret)'; 12 | -------------------------------------------------------------------------------- /lang/de-informal/lang.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Michael 8 | */ 9 | $lang['namespaceRoot'] = 'Wurzel'; 10 | $lang['name'] = 'Seiten Name'; 11 | $lang['okbutton'] = 'Seite hinzufügen'; 12 | $lang['nooption'] = 'Du besitzt nicht die Benutzerrechte um Seiten hinzuzufügen.'; 13 | -------------------------------------------------------------------------------- /lang/de-informal/settings.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Michael 8 | */ 9 | $lang['addpage_exclude'] = 'Namespaces ausschließen (getrennt mit ; )'; 10 | $lang['addpage_showroot'] = 'Wurzel-Namespace anzeigen'; 11 | $lang['addpage_hide'] = '{{NEWPAGE>[ns]}} Syntax: Ausgewählt, diese Namespace-Auswahl verbergen. Nicht ausgewählt, nur diese Namespace-Auswahl anzeigen.'; 12 | $lang['addpage_hideACL'] = 'Verberge {{NEWPAGE}} wenn ein Benutzer keine Berechtigung hat Seiten hinzuzufügen 13 | Ausgewählt: Anzeige wird verborgen 14 | Nicht ausgewählt: es wird eine Fehlermeldung ausgegeben'; 15 | -------------------------------------------------------------------------------- /lang/de/lang.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Joerg 8 | * @author Michael 9 | */ 10 | $lang['namespaceRoot'] = 'Wurzel'; 11 | $lang['name'] = 'Seitenname'; 12 | $lang['okbutton'] = 'Seite hinzufügen'; 13 | $lang['nooption'] = 'Du besitzt nicht die Benutzerrechte, um Seiten hinzuzufügen.'; 14 | -------------------------------------------------------------------------------- /lang/de/settings.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Joerg 8 | */ 9 | $lang['addpage_exclude'] = 'Namensräume ausschließen (getrennt mit ; )'; 10 | $lang['addpage_showroot'] = 'Wurzel-Namensraum anzeigen'; 11 | $lang['addpage_hide'] = '{{NEWPAGE>[ns]}} Syntax: Ausgewählt, diese Namespace-Auswahl verbergen. Nicht ausgewählt, nur diese Namespace-Auswahl anzeigen.'; 12 | $lang['addpage_hideACL'] = 'Verberge {{NEWPAGE}} wenn ein Benutzer keine Berechtigung hat Seiten hinzuzufügen 13 | Ausgewählt: Anzeige wird verborgen 14 | Nicht ausgewählt: es wird eine Fehlermeldung ausgegeben'; 15 | $lang['addpage_autopage'] = 'Zeige keine Eingabemaske, der vorkonfigurierte Namensraum wird als Gesamtseiten ID behandelt (sinnvoll mit Platzhaltern für Datumsangaben)'; 16 | -------------------------------------------------------------------------------- /lang/en/lang.php: -------------------------------------------------------------------------------- 1 | [ns]}} syntax: Hide namespace selection (unchecked: show only subnamespaces)"; 10 | $lang['addpage_hideACL'] = "Hide {{NEWPAGE}} if user does not have rights to add pages (show message if unchecked)"; 11 | $lang['addpage_autopage'] = "Don't show the input box, the preconfigured namespace is treated as a full page ID. (makes sense with date placeholders)"; 12 | -------------------------------------------------------------------------------- /lang/eo/lang.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['namespaceRoot'] = 'Bazo'; 9 | $lang['okbutton'] = 'Aldoni paĝon'; 10 | $lang['nooption'] = 'Vi ne rajtas aldoni paĝojn'; 11 | -------------------------------------------------------------------------------- /lang/eo/settings.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['addpage_exclude'] = 'Ekskludi nomspacojn (disigitaj per ;)'; 9 | $lang['addpage_showroot'] = 'Montri nomspacon'; 10 | $lang['addpage_hide'] = 'Se vi uzas {{NEWPAGE>[ns]}}-sintakson: Ĉu kaŝi la nomspac-selekton? (malplena: montri nur subnomspacojn)'; 11 | $lang['addpage_hideACL'] = 'Kaŝi {{NEWPAGE}} se uzanto ne rajtas aldoni paĝojn (montri mesaĝon, se malplena)'; 12 | -------------------------------------------------------------------------------- /lang/es/lang.php: -------------------------------------------------------------------------------- 1 | [dir]}}: se oculta el selector de directorio (desmarcado: muestra solo sub-directorios (sub-namespaces))"; 10 | $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}}"; 11 | -------------------------------------------------------------------------------- /lang/fa/lang.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['namespaceRoot'] = 'ریشه'; 9 | $lang['okbutton'] = 'اضافه‌کردن صفحه'; 10 | $lang['nooption'] = 'شما امکان اضافه کردن صفحه‌ها را ندارید'; 11 | -------------------------------------------------------------------------------- /lang/fa/settings.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['addpage_exclude'] = 'حذف فضاهای نام (جدا کردن از هم با ;)'; 9 | $lang['addpage_showroot'] = 'نمایش فضای‌نام ریشه'; 10 | $lang['addpage_hide'] = 'زمانی که استفاده می‌کنید از {{NEWPAGE>[ns]}} نحو: مخفی سازی فضای‌نام انتخابی 11 | (تیک: نمایش تمام فضاهای زیر نام)'; 12 | $lang['addpage_hideACL'] = 'مخفی کردن {{NEWPAGE}} اگر کاربران'; 13 | -------------------------------------------------------------------------------- /lang/fr/lang.php: -------------------------------------------------------------------------------- 1 | [ns]}} : cache la selection de catégorie (décoché: affiche uniquement les sous-catégories)"; 10 | $lang['addpage_hideACL'] = "Si non cochée, affiche un message lorsque l'utilisateur n'a pas les droits d'ajout de page. Sinon, cache simplement {{NEWPAGE}}"; 11 | $lang['addpage_autopage'] = "Ne pas afficher le champ de saisie; la catégorie préconfigurée est traitée comme un identifiant de page complet (utile avec des attributs de date)"; 12 | -------------------------------------------------------------------------------- /lang/hu/lang.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['namespaceRoot'] = 'Kiindulónévtér'; 9 | $lang['okbutton'] = 'Oldal hozzáadása'; 10 | $lang['nooption'] = 'Nincs jogosultságod oldal létrehozásához'; 11 | -------------------------------------------------------------------------------- /lang/hu/settings.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['addpage_exclude'] = 'Elrejtett névterek (pontosvesszővel elválasztva)'; 9 | $lang['addpage_showroot'] = 'Kiindulónévtér mutatása'; 10 | $lang['addpage_hide'] = 'A {{NEWPAGE>[ns]}} szintaxis használatakor: Névtérválasztó lista elrejtése (ha nincs bejelölve: mutatja az alnévtereket)'; 11 | $lang['addpage_hideACL'] = 'A {{NEWPAGE}} elrejtése ha a felhasználónak nincs jogosultsága oldal létrehozásához (ha nincs bejelölve, egy üzenet fog megjelenni)'; 12 | -------------------------------------------------------------------------------- /lang/it/lang.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Mirko 8 | */ 9 | $lang['namespaceRoot'] = 'Root'; 10 | $lang['okbutton'] = 'Aggiungi Pagina'; 11 | $lang['nooption'] = 'Non sei autorizzato ad aggiungere nuove pagine'; 12 | -------------------------------------------------------------------------------- /lang/it/settings.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['addpage_hideACL'] = 'Nascondi {{NEWPAGE}} se l\'utente non è autorizzato ad aggiungere pagine(mostra il messaggio se non è selezionato)'; 9 | -------------------------------------------------------------------------------- /lang/ja/lang.php: -------------------------------------------------------------------------------- 1 | [ns]}} 構文使用時: 名前空間選択リストを表示しない(チェックなし: 下位名前空間のみを表示)"; 10 | $lang['addpage_hideACL'] = "ページ追加の権限を持たないユーザーに対しては {{NEWPAGE}} を表示しない(チェックなしの場合にはメッセージを表示)"; 11 | -------------------------------------------------------------------------------- /lang/ko/lang.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['namespaceRoot'] = '루트'; 9 | $lang['okbutton'] = '문서 추가'; 10 | $lang['nooption'] = '문서를 추가할 권한이 없습니다'; 11 | -------------------------------------------------------------------------------- /lang/ko/settings.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['addpage_exclude'] = '제외할 이름공간 (;로 구분)'; 9 | $lang['addpage_showroot'] = '루트 이름공간 보이기'; 10 | $lang['addpage_hide'] = '{{NEWPAGE>[ns]}} 구문을 사용할 때: 이름공간 선택을 숨기기 (체크하지 않음: 하위 이름공간만 보이기)'; 11 | $lang['addpage_hideACL'] = '사용자가 문서를 추가할 권한이 없을 때 {{NEWPAGE}} 숨기기 (체크하지 않으면 메시지 보이기)'; 12 | -------------------------------------------------------------------------------- /lang/nl/lang.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['namespaceRoot'] = 'Root'; 9 | $lang['okbutton'] = 'Pagina toevoegen'; 10 | $lang['nooption'] = 'U heeft geen rechten om pagina\'s toe te voegen'; 11 | -------------------------------------------------------------------------------- /lang/nl/settings.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['addpage_exclude'] = 'Uitgesloten naamruimte\'s (gescheiden door ;)'; 9 | $lang['addpage_showroot'] = 'Toon root naamruimte'; 10 | $lang['addpage_hide'] = 'Bij gebruik van {{NEWPAGE>[ns]}} syntax: Verberg naamruimte selectie (niet aangevinkt: toon enkel sub naamruimte\'s)'; 11 | $lang['addpage_hideACL'] = 'Verberg {{NEWPAGE}} wanneer de gebruiker geen rechten heeft om pagina\'s toe te voegen (toon melding wanneer niet aangevinkt)'; 12 | -------------------------------------------------------------------------------- /lang/no/lang.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['namespaceRoot'] = 'Rot'; 9 | $lang['okbutton'] = 'Legg til ny side'; 10 | $lang['nooption'] = 'Du har ikke tilgang til å legge til sider'; 11 | -------------------------------------------------------------------------------- /lang/no/settings.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['addpage_exclude'] = 'Utelatte navnerom (separert med ;)'; 9 | $lang['addpage_showroot'] = 'Vis rot-navnerom'; 10 | $lang['addpage_hide'] = 'Når du bruker {{NEWPAGE>[ns]}} syntaks: skjul valg av navnerom (ikke avhuket: vis bare undernavnerom)'; 11 | $lang['addpage_hideACL'] = 'Skjul {NEWPAGE}} dersom bruker ikke har tilgang til å legge til sider (ikke avhuket: vis tilbakemelding) '; 12 | -------------------------------------------------------------------------------- /lang/pl/lang.php: -------------------------------------------------------------------------------- 1 | [nazwa]}}: Ukryj nazwę grupy (niezaznaczone: pokaż tylko podnazwy)"; 10 | $lang['addpage_hideACL'] = "Ukryj {{NEWPAGE}} jeżeli użytkownicy nie posiadają uprawnień dodawania nowych stron (pokaż komunikat jeśli niezaznaczone)"; 11 | -------------------------------------------------------------------------------- /lang/pt-br/lang.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Samory Pereira Santos 8 | */ 9 | $lang['namespaceRoot'] = 'Raiz'; 10 | $lang['name'] = 'Nome da página'; 11 | $lang['okbutton'] = 'Adicionar página'; 12 | $lang['nooption'] = 'Você não tem permissão para adicionar páginas'; 13 | -------------------------------------------------------------------------------- /lang/pt-br/settings.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Alexandre Belchior 8 | * @author Samory Pereira Santos 9 | */ 10 | $lang['addpage_exclude'] = 'Excluir namespaces (separar com ;)'; 11 | $lang['addpage_showroot'] = 'Mostrar namespace raiz'; 12 | $lang['addpage_hide'] = 'Quando você usa a sintaxe {{NEWPAGE>[ns]}} : Oculta a seleção do namespace (desmarcado: mostra apenas os subnamespaces)'; 13 | $lang['addpage_hideACL'] = 'Ocultar {{NEWPAGE}} se o usuário não tiver direitos para adicionar páginas (mostre a mensagem se desmarcada)'; 14 | $lang['addpage_autopage'] = 'Não mostre a caixa de entrada, o namespace pré-configurado é tratado como um ID de página inteira. (faz sentido com placeholders de data)'; 15 | -------------------------------------------------------------------------------- /lang/pt/lang.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['namespaceRoot'] = 'Raiz'; 9 | $lang['okbutton'] = 'Adicionar página'; 10 | $lang['nooption'] = 'Não está autorizado para adicionar páginas'; 11 | -------------------------------------------------------------------------------- /lang/pt/settings.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['addpage_exclude'] = 'Espaços do nome excluídos (separados com ;)'; 9 | $lang['addpage_showroot'] = 'Mostrar espaço do nome da raiz'; 10 | $lang['addpage_hide'] = 'Quando utiliza a sintaxe {{NEWPAGE>[ns]}} : Ocultar a seleção do espaço do nome (desmarcado : mostrar apenas sub-espaço do nome)'; 11 | $lang['addpage_hideACL'] = 'Ocultar {{NEWPAGE}} se o utilizador não possuir permissões para adicionar páginas (mostrar mensagem se desmarcado).'; 12 | -------------------------------------------------------------------------------- /lang/ru/lang.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $lang['namespaceRoot'] = 'Корневой уровень'; 9 | $lang['name'] = 'Имя страницы'; 10 | $lang['okbutton'] = 'Добавить страницу'; 11 | $lang['nooption'] = 'Вы не можете добавлять страницы'; 12 | -------------------------------------------------------------------------------- /lang/ru/settings.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Aleksandr Selivanov 8 | */ 9 | $lang['addpage_exclude'] = 'Исключаемые пространства имен (разделитель — точка с запятой)'; 10 | $lang['addpage_showroot'] = 'Показать корневое пространство имён'; 11 | $lang['addpage_hide'] = 'При использовании синтаксиса {{NEWPAGE>[ns]}} скрывать выбор пространства имён. (Если флажок снят, будут показываться только подпространства имён.)'; 12 | $lang['addpage_hideACL'] = 'Скрыть {{NEWPAGE}}, если пользователь не имеет прав на добавление страниц. (Если флажок снят, будет отображаться сообщение.)'; 13 | -------------------------------------------------------------------------------- /lang/sv/lang.php: -------------------------------------------------------------------------------- 1 | [ns]}} syntax: Dölj val av namnrymd (ej ikryssad: visa bara undernamnrymder)"; 10 | $lang['addpage_hideACL'] = "Dölj {{NEWPAGE}} om användaren inte har rättighet att skapa sidor (visa meddelande om ej ikryssad)"; 11 | -------------------------------------------------------------------------------- /lang/uk/lang.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | $lang['namespaceRoot'] = 'Кореневий простір імен'; 11 | $lang['okbutton'] = 'Додати сторінку'; 12 | $lang['nooption'] = 'Ви не можете додавати сторінки'; 13 | -------------------------------------------------------------------------------- /lang/uk/settings.php: -------------------------------------------------------------------------------- 1 | [ns]}} сховати вибір простору імен (якщо вибрано цей пункт - відображати тільки підпростір імен)'; 13 | $lang['addpage_hideACL'] = 'Сховати {{NEWPAGE}}, якщо користувач не має прав додавати сторінки (відображати повідомлення, якщо цей пункт не вибрано)'; 14 | -------------------------------------------------------------------------------- /lang/vi/lang.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | $lang['addpage_exclude'] = 'Trừ không gian tên (ngăn cách bằng dấu ;)'; 12 | $lang['addpage_showroot'] = 'Hiển thị không gian tên gốc'; 13 | $lang['addpage_hide'] = 'Khi bạn chọn syntax {{NEWPAGE>[ns]}}: Ẩn khả năng lựa chọn không gian tên (không chọn: chỉ hiển thị không gian tên con)'; 14 | $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)'; 15 | -------------------------------------------------------------------------------- /lang/zh-tw/lang.php: -------------------------------------------------------------------------------- 1 | [ns]}} 語法時不要顯示出命名空間(namespace)的選項, 沒有打勾就會列出指定命名空間(namespace)底下所有的子命名空間(subnamespace)項目"; 10 | $lang['addpage_hideACL'] = "沒有打勾 : 表示當使用者沒有新增頁面權限時就顯示沒有權限的訊息而不會顯示出新增頁面的輸入欄."; 11 | -------------------------------------------------------------------------------- /lang/zh/lang.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | $lang['namespaceRoot'] = '根部命名空间'; 11 | $lang['name'] = '页面名称'; 12 | $lang['okbutton'] = '增加页面'; 13 | $lang['nooption'] = '抱歉,您没有权限增加页面'; 14 | -------------------------------------------------------------------------------- /lang/zh/settings.php: -------------------------------------------------------------------------------- 1 | [ns]}} 时不显示命名空间的选择(未勾选则仅显示子命名空间)'; 13 | $lang['addpage_hideACL'] = '用户没有新增页面权限时隐藏{{NEWPAGE}}(若未勾选则显示信息)'; 14 | -------------------------------------------------------------------------------- /plugin.info.txt: -------------------------------------------------------------------------------- 1 | # General Plugin Info 2 | base addnewpage 3 | author Damien Regad, Benjamin Santalucia, Sam Wilson and other contributors 4 | email dregad@mantisbt.org 5 | date 2025-04-22 6 | name Add New Page plugin 7 | desc Adds a "new page form" to any wiki page. 8 | url https://www.dokuwiki.org/plugin:addnewpage 9 | -------------------------------------------------------------------------------- /script.js: -------------------------------------------------------------------------------- 1 | jQuery(function () { 2 | jQuery(".addnewpage form").each(function () { 3 | let $form = jQuery(this); 4 | let $ns = $form.find("[name='np_cat']"); 5 | let $title = $form.find("input[name='title']"); 6 | let $id = $form.find("input[name='id']"); 7 | let $submit = $form.find(':submit'); 8 | 9 | // disable submit unless something is in input or input is disabled 10 | if ($title.attr('type') === 'text') { 11 | $submit.attr('disabled', 'disabled'); 12 | $title.on('input', function () { 13 | if ($title.val().length > 0) { 14 | $submit.removeAttr('disabled'); 15 | } else { 16 | $submit.attr('disabled', 'disabled'); 17 | } 18 | }); 19 | } 20 | 21 | // Change the form's page-ID field on submit 22 | $form.on("submit", function () { 23 | const PLACEHOLDER = "@INPUT@"; 24 | 25 | // Build the new page ID 26 | let page_id = $ns.val(); 27 | if (page_id.indexOf(PLACEHOLDER) !== -1) { 28 | // Process the placeholder 29 | page_id = page_id.replace(PLACEHOLDER, $title.val()); 30 | } else { 31 | // There is no placeholder, just append the user's input 32 | page_id += ":" + $title.val(); 33 | } 34 | 35 | // Save the new page ID in the hidden form field 36 | $id.val(page_id); 37 | 38 | // Clean up the form vars, just to make the resultant URL a bit nicer 39 | $ns.prop("disabled", true); 40 | $title.prop("disabled", true); 41 | 42 | return true; 43 | }); 44 | 45 | }); 46 | }); 47 | -------------------------------------------------------------------------------- /style.less: -------------------------------------------------------------------------------- 1 | div.addnewpage { 2 | select, input { 3 | margin-right: 3px; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /syntax.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Sam Wilson 8 | * 9 | * @noinspection PhpUnused 10 | * @noinspection PhpMissingParamTypeInspection, PhpMissingReturnTypeInspection 11 | */ 12 | 13 | use dokuwiki\Extension\SyntaxPlugin; 14 | use dokuwiki\File\PageResolver; 15 | 16 | // must be run within Dokuwiki 17 | if(!defined('DOKU_INC')) die(); 18 | 19 | class syntax_plugin_addnewpage extends SyntaxPlugin { 20 | 21 | /** @var array the parsed options */ 22 | protected $options; 23 | 24 | /** 25 | * Syntax Type 26 | */ 27 | public function getType() { 28 | return 'substition'; 29 | } 30 | 31 | /** 32 | * Paragraph Type 33 | */ 34 | public function getPType() { 35 | return 'block'; 36 | } 37 | 38 | /** 39 | * @return int 40 | */ 41 | public function getSort() { 42 | return 199; 43 | } 44 | 45 | /** 46 | * @param string $mode 47 | */ 48 | public function connectTo($mode) { 49 | $this->Lexer->addSpecialPattern('\{\{NEWPAGE[^\}]*\}\}', $mode, 'plugin_addnewpage'); 50 | } 51 | 52 | /** 53 | * Handler to prepare matched data for the rendering process. 54 | * 55 | * Handled syntax options: 56 | * - {{NEWPAGE}} 57 | * - {{NEWPAGE>your:namespace}} 58 | * - {{NEWPAGE>your:namespace:@INPUT@:start}} 59 | * - {{NEWPAGE>your:namespace:[date formats]}} {@see strftime()} 60 | * - {{NEWPAGE?config_overrides}} 61 | * - {{NEWPAGE?label=custom}} 62 | * - {{NEWPAGE#newtpl1,newtpl2}} 63 | * - {{NEWPAGE#newtpl1|Title1,newtpl2|Title1}} 64 | * - {{NEWPAGE>your:namespace#newtpl1|Title1,newtpl2|Title1}} 65 | * - {{NEWPAGE>your:namespace#newtpl1|Title1,newtpl2|Title1#@HI@,Howdy}} 66 | * 67 | * Refer to {@see https://www.dokuwiki.org/plugin:addnewpage} for details. 68 | * 69 | * @param string $match The text matched by the patterns 70 | * @param int $state The lexer state for the match 71 | * @param int $pos The character position of the matched text 72 | * @param Doku_Handler $handler The Doku_Handler object 73 | * 74 | * @return array Return an array with all data you want to use in render 75 | * @codingStandardsIgnoreStart 76 | */ 77 | public function handle($match, $state, $pos, Doku_Handler $handler) { 78 | /* @codingStandardsIgnoreEnd */ 79 | $match = substr($match, 9, -2); // strip markup 80 | 81 | $data = array( 82 | 'namespace' => '', 83 | 'newpagetemplates' => array(), 84 | 'newpagevars' => '', 85 | 'options' => array( 86 | 'exclude' => $this->getConf('addpage_exclude'), 87 | 'showroot' => $this->getConf('addpage_showroot'), 88 | 'hide' => $this->getConf('addpage_hide'), 89 | 'hideacl' => $this->getConf('addpage_hideACL'), 90 | 'autopage' => $this->getConf('addpage_autopage'), 91 | 'label' => 'okbutton', 92 | ) 93 | ); 94 | 95 | if(preg_match('/>(.*?)(#|\?|$)/', $match, $m)) { 96 | $data['namespace'] = trim($m[1]); 97 | } 98 | 99 | # Extract the newpagetemplate plugin parameters 100 | # - after the initial #: the template name 101 | # - after optional 2nd #: custom variable names 102 | if(preg_match('/#(.*?)(?:#(.*?))?(?:\?|$)/', $match, $m)) { 103 | $data['newpagetemplates'] = array_map('trim', explode(',', $m[1])); 104 | $data['newpagevars'] = trim($m[2] ?? ''); 105 | } 106 | 107 | if(preg_match('/\?(.*?)(#|$)/', $match, $m)) { 108 | $this->_parseOptions($m[1], $data['options']); 109 | } 110 | 111 | return $data; 112 | } 113 | 114 | /** 115 | * Create the new-page form. 116 | * 117 | * @param $format string output format being rendered 118 | * @param $renderer Doku_Renderer the current renderer object 119 | * @param $data array data created by handler() 120 | * @return boolean rendered correctly? 121 | */ 122 | public function render($format, Doku_Renderer $renderer, $data) { 123 | global $lang; 124 | 125 | // make options available in class 126 | $this->options = $data['options']; 127 | 128 | if($format == 'xhtml') { 129 | $disablecache = false; 130 | $namespaceinput = $this->_htmlNamespaceInput($data['namespace'], $disablecache); 131 | if($namespaceinput === false) { 132 | if($this->options['hideacl']) { 133 | $renderer->doc .= ''; 134 | } else { 135 | $renderer->doc .= $this->getLang('nooption'); 136 | } 137 | return true; 138 | } 139 | if($disablecache) $renderer->info['cache'] = false; 140 | 141 | $newpagetemplateinput = $this->_htmlTemplateInput($data['newpagetemplates']); 142 | 143 | $input = 'text'; 144 | if($this->options['autopage']) $input = 'hidden'; 145 | 146 | // Button label. If given string is not localized, use it as-is 147 | $label = $this->getLang($this->options['label']); 148 | if (!$label) { 149 | $label = $this->options['label']; 150 | } 151 | 152 | $form = '

' 153 | . '

' 155 | . $namespaceinput 156 | . '' 158 | . $newpagetemplateinput 159 | . '' 160 | . '' 161 | . '' 162 | . '' 163 | . '
' 164 | . '

'; 165 | 166 | $renderer->doc .= $form; 167 | 168 | return true; 169 | } 170 | return false; 171 | } 172 | 173 | /** 174 | * Overwrites the $options with the ones parsed from $optstr 175 | * 176 | * @param string $optstr 177 | * @param array $options 178 | * @author Andreas Gohr 179 | */ 180 | protected function _parseOptions($optstr, &$options) { 181 | $opts = preg_split('/[,&]/', $optstr); 182 | 183 | foreach($opts as $opt) { 184 | $opt_lower = strtolower(trim($opt)); 185 | $val = true; 186 | // booleans can be negated with a no prefix 187 | if(substr($opt_lower, 0, 2) == 'no') { 188 | $opt_lower = substr($opt, 2); 189 | $val = false; 190 | } 191 | 192 | // not a known option? might be a key=value pair 193 | if(!isset($options[$opt_lower])) { 194 | $split = array_map('trim', sexplode('=', $opt, 2)); 195 | $opt_lower = strtolower($split[0]); 196 | $val = $split[1]; 197 | } 198 | 199 | // still unknown? skip it 200 | if(!isset($options[$opt_lower])) continue; 201 | 202 | // overwrite the current value 203 | $options[$opt_lower] = $val; 204 | } 205 | } 206 | 207 | /** 208 | * Parse namespace request 209 | * 210 | * This creates the final ID to be created (still having an @INPUT@ variable 211 | * which is filled in via JavaScript) 212 | * 213 | * @author Samuele Tognini 214 | * @author Michael Braun 215 | * @author Andreas Gohr 216 | * @param string $ns The namespace as given in the syntax 217 | * @return string 218 | */ 219 | protected function _parseNS($ns) { 220 | global $INFO; 221 | 222 | $selfid = $INFO['id']; 223 | $selfns = getNS($selfid); 224 | // replace the input variable with something unique that survives cleanID 225 | $keep = sha1(time()); 226 | 227 | // by default append the input to the namespace (except on autopage) 228 | if(strpos($ns, '@INPUT@') === false && !$this->options['autopage']) $ns .= ":@INPUT@"; 229 | 230 | // date replacements 231 | $ns = dformat(null, $ns); 232 | 233 | // placeholders 234 | $replacements = array( 235 | '/\//' => ':', // forward slashes to colons 236 | '/@PAGE@/' => $selfid, 237 | '/@NS@/' => $selfns, 238 | '/^\.(:|\/|$)/' => "$selfns:", 239 | '/@INPUT@/' => $keep, 240 | ); 241 | $ns = preg_replace(array_keys($replacements), array_values($replacements), $ns); 242 | 243 | // clean up, then reinsert the input variable 244 | $ns = cleanID($ns); 245 | return str_replace($keep, '@INPUT@', $ns); 246 | } 247 | 248 | /** 249 | * Create the HTML Select element for namespace selection. 250 | * 251 | * @param string|false $dest_ns The destination namespace, or false if none provided. 252 | * @param bool $disablecache reference indicates if caching need to be disabled 253 | * @global string $ID The page ID 254 | * @return string Select element with appropriate NS selected. 255 | */ 256 | protected function _htmlNamespaceInput($dest_ns, &$disablecache) { 257 | global $ID; 258 | $disablecache = false; 259 | 260 | // If a NS has been provided: 261 | // Whether to hide the NS selection (otherwise, show only subnamespaces). 262 | $hide = $this->options['hide']; 263 | 264 | $parsed_dest_ns = $this->_parseNS($dest_ns); 265 | // Whether the user can create pages in the provided NS (or root, if no 266 | // destination NS has been set. 267 | $can_create = (auth_quickaclcheck($parsed_dest_ns . ":") >= AUTH_CREATE); 268 | 269 | //namespace given, but hidden 270 | if($hide && !empty($dest_ns)) { 271 | if($can_create) { 272 | return ''; 273 | } else { 274 | return false; 275 | } 276 | } 277 | 278 | //show select of given namespace 279 | $currentns = getNS($ID); 280 | 281 | $ret = ''; 332 | 333 | if($someopt) { 334 | return $ret; 335 | } else { 336 | return false; 337 | } 338 | } 339 | 340 | /** 341 | * Get a list of namespaces below the given namespace. 342 | * Recursively fetches subnamespaces. 343 | * 344 | * @param string $topns The top namespace 345 | * @return array Multi-dimensional array of all namespaces below $tns 346 | */ 347 | protected function _getNamespaceList($topns = '') { 348 | global $conf; 349 | 350 | $topns = utf8_encodeFN(str_replace(':', '/', $topns)); 351 | 352 | $excludes = $this->options['exclude']; 353 | if($excludes == "") { 354 | $excludes = array(); 355 | } else { 356 | $excludes = @explode(';', strtolower($excludes)); 357 | } 358 | $searchdata = array(); 359 | search($searchdata, $conf['datadir'], 'search_namespaces', array(), $topns); 360 | 361 | $namespaces = array(); 362 | foreach($searchdata as $ns) { 363 | foreach($excludes as $exclude) { 364 | if(!empty($exclude) && strpos($ns['id'], $exclude) === 0) { 365 | continue 2; 366 | } 367 | } 368 | $namespaces[] = $ns['id']; 369 | } 370 | 371 | return $namespaces; 372 | } 373 | 374 | /** 375 | * Create html for selection of namespace templates 376 | * 377 | * @param array $newpagetemplates array of namespace templates 378 | * @return string html of select or hidden input 379 | */ 380 | public function _htmlTemplateInput($newpagetemplates) { 381 | $cnt = count($newpagetemplates); 382 | if($cnt < 1 || $cnt == 1 && $newpagetemplates[0] == '') { 383 | $input = ''; 384 | 385 | } else { 386 | if($cnt == 1) { 387 | list($template,) = $this->_parseNSTemplatePage($newpagetemplates[0]); 388 | $input = ''; 389 | } else { 390 | $first = true; 391 | $input = ''; 401 | } 402 | $input = DOKU_TAB . DOKU_TAB . $input . DOKU_LF; 403 | } 404 | return $input; 405 | } 406 | 407 | /** 408 | * Parses and resolves the namespace template page 409 | * 410 | * @param $nstemplate 411 | * @return array 412 | */ 413 | protected function _parseNSTemplatePage($nstemplate) { 414 | global $ID; 415 | 416 | @list($template, $name) = explode('|', $nstemplate, 2); 417 | $template = (new PageResolver($ID))->resolveId($template); 418 | if (is_null($name)) $name = $template; 419 | 420 | return array($template, $name); 421 | } 422 | 423 | } 424 | --------------------------------------------------------------------------------