DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:npd

Differences

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

Link to this comparison view

Next revision
Previous revision
plugin:npd [2014-01-23 15:58] – created cstuderplugin:npd [2022-07-29 23:22] (current) Klap-in
Line 6: Line 6:
 email      : cstuder@existenz.ch  email      : cstuder@existenz.ch 
 type       : action type       : action
-lastupdate : 2014-01-23 +lastupdate : 2015-11-05 
-compatible : weatherwax, binky+compatible : weatherwax, binky, ponder stibbons
 depends    :  depends    : 
 conflicts  conflicts 
Line 13: Line 13:
 tags       : button, form, create tags       : button, form, create
  
-downloadurl: # eg. http://github.com/cstuder/dokuwiki-plugin-npd/zipball/master +downloadurl: https://github.com/meteotest/npd/archive/master.zip 
-bugtracker : # eg. http://github.com/cstuder/dokuwiki-plugin-npd/issues +bugtracker : https://github.com/meteotest/npd/issues 
-sourcerepo : # eg. http://github.com/cstuder/dokuwiki-plugin-npd/+sourcerepo :https://github.com/meteotest/npd
 donationurl:  donationurl: 
  
Line 23: Line 23:
 ===== Installation ===== ===== Installation =====
  
-Install the plugin using the [[plugin:plugin|Plugin Manager]] and the download URL above, which points to latest version of the plugin. Refer to [[:Plugins]] on how to install plugins manually.+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
 ==== Add Button to Template ==== ==== Add Button to Template ====
Line 61: Line 61:
 ===== Configuration and Settings ===== ===== Configuration and Settings =====
  
 +Note: Configuration settings of plugins can be controlled by the [[plugin:config|Configuration Manager plugin]].
 ==== Plugin NTP Link Type ==== ==== Plugin NTP Link Type ====
-If set to ''link'' (Default), will generate a HTML link element. Otherwise the setting ''button'' will create a form element with a button, approximately like this: 
  
-<code html>+This setting controls the appearance of the page creation action: 
 + 
 +  * The value ''link'' will cause it to appear as an HTML link element, similar to this: \\ <html> <a href="...">Create New Page</a> </html> 
 + 
 +  * The value ''button'' (default) will cause it to appear as an HTML form element with a button, approximately like this: \\ <html>
 <form> <form>
-  <div class="no"> +<div class="no"> 
-    <input class="button" />; +<input class="button"/> 
-  </div>+</div>
 </form> </form>
-</code>+</html>
  
-Choose this according to your template.+Choose this setting according to your template.
  
 ===== Development ===== ===== Development =====
Line 79: Line 83:
  
 === Change Log === === Change Log ===
 +  * **2015-11-05**
 +    * Fixes an issue with adding a page below two levels, by thylacine222
 +    * Updates spanish localization by Patricio Parraguez
 +    * Updates korean localization by Myeongjin
 +    * Adds bulgarian localization by Neli Dimitrova
 +
 +  * **2014-06-16**
 +    * Adds japanese localization by Hideaki SAWADA
 +    * Adds informal german localization
  
   * **2014-01-23**   * **2014-01-23**
Line 87: Line 100:
 ===== FAQ ===== ===== FAQ =====
  
 +===== Known issues =====
 +Adding this button to a template is rather cumbersome and breaks when a template is updated. There must be a better way to do this.
  
 ===== Discussion ===== ===== Discussion =====
 +
 +==== No-name behaviour and integration ====
 +
 +Dear author of this plugin, thanks for the plugin and some feedback: I like the general idea and I tried it for our local wiki, because I see the same problem for new users as you. However, two points finally stopped me using it, and I would like to inform you about them :
 +  * **Plugin accepts "no name" creation**: The more important point. In the dialog box, creation of a page is possible without typing the name. A default name is then assumed (I think it was "page title"). This will lead to many pages with this standard name all over the namespaces, because people tend to forget. It should IMHO rather refuse to create a page if no name was typed (silently or infobox).
 +  * The integration into the template proved to be a bit difficult, although I got more or less there in the end. ((Using the default "Dokuwiki" template (the old "default" template as assumed in the description here is not the default any more), I wanted to put it into the page actions menu floating on the right. With the button it is not possible, but with the settings of the plugin set to "link" and putting ''<li></li>'' around it, it shows up. Drawback: the icon is the standard "edit" pencil, and I did not see how to change it.)) Obviously, this is primarily a template question, but on the plugin side, a more flexible integration might be possible: Now, the plugin provides only a whole block of html code (either button or link with stuff around), but providing the pure url (maybe via another function like html_new_page_url) would be more flexible for integration.
 +
 +Best, Nøk (@2014-03-12)
 +
 +
 +Hi @all,
 +
 +my simple complete solution of adding new pages is to show a little text-input field to give a name.
 +The value will be sent by jQ to DW.
 +
 +See the simple script to put in the main.php of your theme:
 +
 +<code>
 +// 2 lines of php (of course in  a php area ;-)
 +
 + $uriinput = ($_SERVER['REQUEST_URI']);
 + $urioutput = basename($uriinput); 
 +
 +
 +// and the following inside a html area
 +
 +<script type="text/javascript">
 +//<![CDATA[
 +if (typeof jQuery == 'undefined') {
 +    var script = document.createElement('script');
 +    script.type = "text/javascript";
 +    script.src = "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
 +    document.getElementsByTagName('head')[0].appendChild(script);
 +};
 +
 +$("#create_new_page").on("submit", function(event){     
 +    event.preventDefault();
 +    name = $("#jq_read_field").val();    
 +    if (name <> 0)
 +    { 
 +        window.location.href = "/?id="+ name +"";
 +    }
 +    else
 +    {
 +        alert("Please enter a name for your page.");
 +    }
 +});
 +//]]>
 +</script>
 +
 +<form method="get" id="create_new_page">
 +  <input class="edit" type="text" name="id" id="jq_read_field" value="<?php echo $urioutput; ?>" size="32" maxlength="100" />
 +<input type="submit" value="Go" />
 +</form>
 +</code>
 +
 +Onload value of field will be actual site and if you type something in and press go, the script will send you to the page or if its not existing, to a blank.
 +
 +Cheers
 +
 +==== Adjusting the action appearance to the toolbar of the dokuwiki template ====
 +
 +The ''dokuwiki'' template of the current DokuWiki version (Hrun) has a nice toolbar to the right of each page, with icons that pop out a menu when hovering over them. While the ''link'' appearance of this plugin matches that better than the ''button'' appearance, it still looks inconsistent.
 +
 +Changing the ''link'' case in the file ''dokuwiki/lib/plugins/npd/helper.php'' as follows lets the "Create New Page" action have the same appearance as the actions in that toolbar:
 +
 +<code php>
 +  case 'link':
 +    $ret .= '<li><a rel="nofollow" href="'.$url.'" style="display:none;" id="npd__create_button" class="action create" title="'.$label.'"><span>'.$label.'</span></a></li>';
 +    break;
 +</code>
 +
 +Using ''class=″action create″'' selects the page creation icon from the pagetools icons of the ''dokuwiki'' template, it looks like the pen of the edit icon, with a plus-sign in the lower right corner.
 +
 +Happy adjusting!
 +
 +
  
  
plugin/npd.1390489125.txt.gz · Last modified: 2014-01-23 15:58 by cstuder

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