DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:database

DataBase Plugin

Compatible with DokuWiki

2006-11-06

plugin Design your own database and manage the data within the wiki

Last updated on
2008-05-19
Provides
Action

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to database2

Tagged with database

:!: The download file has wrong folder structure and must be manually installed (should only contain database/…)

:!: Somehow this plugin breaks plugins info pages in admin panel. Disable this plugin to get it back to work.

Download database.zip
Installation The zip should be extracted into your wiki folder
Demo Demo at Langham Associates Dead link
web.archive.org
Main page DataBase at Langham Associates Dead link

Description

The database Plugin lets you create tables and columns and to populate them with content.

The content can then be sorted and filtered by any of the columns.

There are a number of built-in lookups such as Gender, i.e. Male and Female, Title, i.e. Mr., Ms, etc.

You can also use the contents of one table as a reference table, for example a table of countries can be used so that the name of the country is only held once in one table and other tables refer to it.

Components

Security

The same access levels are used in the database as are used in the wiki.

  • Readers will be able to view any data but not change it - this is the access to the demo version
  • Editors will be able to edit records as well as view them
  • Creators will be able to create, edit and view records
  • Deleters will be able to delete, create, edit and view records
  • Admin users will be able to create tables as well as delete, create, edit and view records

Getting Started

A new namespace named database is created, and within that there is one folder called “Create table”.

Any actions within the database namespace are intercepted by the new database functionality.

For example when the “Create table” folder is clicked, the admin user is prompted:

  • to enter the table name and to click a button to create it.
  • then to create the first column in the table
  • then to create more columns as required

Tables

Table names must be unique and contain at least one column. They are generally plural and capitalized, e.g. Countries

Reference Tables

Reference tables must consist of at least two columns in this order:

  1. A column of type number which is unique
  2. A column of any type which is the value to be referenced

e.g. A Countries reference table would have a unique number column and the column containing the name of the country.

Columns

A column must have the following:

  • a name which is unique within that table
  • a label which is used to prompt the user for input and must also be unique within the table
  • an indication of whether or not it is mandatory
  • an indication of whether or not it is unique
  • an indication of whether or not it is visible
  • one of the types which are described below

Column Types

  • String
  • Number
  • Date of the format yyyy/mm/dd
  • An internal link to a page on the wiki using the DokuWiki standard syntax
  • An external link to a URL using the DokuWiki standard syntax
  • Lookup one of the pre-set lookups such as Gender, title, YesAndNo
  • Reference a table which has already been created and its first field is unique and numeric

Features

  • Search/Sort facility allows sorting on any column in the table
  • Search/Sort facility allows filtering using % as wildcard at start or end of any string, number or date
  • Users will only see buttons to which they have access
  • An optimistic locking strategy is employed and, to avoid lost updates, if someone else has changed a record whilst you have been making changes, your changes will be rejected

Demo

Try this plugin on the Playground at Langham Associates.(Dead Link)

The following buttons are not available in this playground version:

  • Admin the table structure
  • Create new record
  • Edit a row
  • Delete a row

The option to Create Table will produce the message that you do not have sufficient privilege.

Feedback

After installing database (1.0.4) and choosing French language, none of my dokuwiki pages were displayed correctly (but works fine if English is chosen). To make it work, I changed all '' by \' in lang/fr/lang.fr. Hope it can help.

- Emmanuel Poirier 2009/8/20

Had to fix a typo in lib/plugins/database/action.php in line 72 which obviously must be

$IDX = getID();

(missing X).

Any chance to make it compatible with 2008-05-05 DokuWiki version?

Clicking on any of the nodes of the index related to > database does nothing, but copying the link URL of a node and opening it in a new tab does the trick. I don't know if this is a problem with the browser and JavaScript or something, but I tested it in Fire Fox and Opera. Also, isn't there a way to delete or rearrange columns? What about deleting tables from the admin interface? The only way I seem to be able to do it is to delete the directory and all contents for each table. - The Music Guy 2008/7/1 4:04 CST

Dirty hack to enable Database v1.0.4 with DokuWiki 2008-05-05: Please note: This hack is not scalable (i.e. you cannot upgrade DokuWiki and expect everything to work while this hack is implemented).. I'm rewriting a part of DokuWiki itself.. But it works.. When you upgrade to a new DokuWiki, simply remove the below hack first.

To install, copy the below code into a file called script.js and place it in your /lib/plugins/database/ library. This will prevent Ajax from hooking the database namespace.

if (index) {
    /**
     * Rewrite of 'treeattach' from index.js file
     */
    index.treeattach = function(obj){
        if(!obj) return;
 
        var items = getElementsByClass('idx_dir',obj,'a');
 
		if (items && items.length > 0 && items[items.length-1].firstChild.innerHTML == 'Create table')
			return;
 
        for(var i=0; i<items.length; i++){
            var elem = items[i];
 
            // attach action to make the link clickable by AJAX
            addEvent(elem,'click',function(e){ return index.toggle(e,this); });
        }
 
    }	
}

- Philip Soeberg 2008/8/25 2:45 CET

Version 1.0.4 creates the necessary directories automatically and can be installed using the DokuWiki plugin managerLangham 2008/05/19 20:45

Create Table does nothing: If a click on “Create Table” doesn't do anything you might have forgotten to copy the files to lib/plugins. At least it happened to me. The .tgz file contains the page-files (/pages/database) for the new namespace AND a 'database' folder (/lib/plugins/database) for the plugin. Stephan 2007/11/17 17:38

Great plugin. I see a lot of potential with this. I have a couple ideas for some enhancements that could allow some additional functionality. One enhancement would be to allow a field to be used as a link to another wiki page. Another would be the ability to hide the first field in a table used as a reference when displaying or adding new records. This would be useful in situations where that field is simply used as a key to the record and the actual number used has no relationship with the other data in the table. — Gary 2007/05/08 22:29

Version 1.0.3 provides both internal and external links and also allows fields to be hidden — Langham 2007/07/23 21:33

It looks great and I'd love to use it, however, I can't get it installed. When I click on “Create Table” I get a definition and data page under that directory - both say “This Topic Does Not Exist, Yet.” Any pointers would be welcome! — Kai 2007-05-22

It seems to install fine on my wiki but I can't seem to find anywhere where I can click on “Create Table” or otherwise use the database plugin. I've been looking for something like this for a while and I'd like to give it a go. Another question…are you able to have duplicate data in here or will it give an error if you accidentally add some guy's name twice? — Rob May 24, 2007 13:36

To avoid duplicates, you can choose to make a field unique, which should solve the problem. Alternatively, any record which is a complete duplicate of an existing record, i.e. all fields matching, will be rejected. — Langham 2007/07/23 21:33

Nevermind - found it! I went to my home page of the wiki and clicked in “Index” in the lower right. There, I found the “Database” namespace and got in from there. — Rob May 25, 2007 08:38

In version 1.0.1 you state that the reference data was “fixed” to be sorted alphabetically. Can the user opt instead to have the reference data sorted by index, so that (ie.) statuses of “Open, Modified, Closed” can be presented in that order? That being said – this is a great plugin! – it obviously was quite an undertaking. — Greg July 26, 2007 11:10EDT

I'm using the latest DokuWiki (June 2007) but there is no database namespace in index page. I also use Monowiki template. What could be the problem? Thanks, Corey (aliasonline@mac.com) (7-30-07)

I've installed under windows system but seem not work.. When I try to open db appear “Unable to open the file C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\dokuwiki/data/pages/database/05-/definition.txt when attempting to read” Cicca Aug 01, 2007

I've installed the plugin (v1.0.3) through the Plugin manager, and I was told that two plugins were installed: “data” and “lib” and I've found two new directiries created: “lib/plugins/data/pages/database/etc” and “lib/plugins/lib/plugins/database/etc”, that is the plugin was unpacked to the wrong place. I have my data dir moved out of the document root as described in wiki:security. — Alexander Zubkov, 2007-08-19 11:54

I am having the same issue as Kai above. What is the fix? — Greg 2007-08-21

Really great! I´m using it in a project where my students can save their data. Only a request: would be possible storing databases in different namespaces? Each of my students has been assigned a namespace and I would like to limit each one to his or her own database. (sorry about my English).

For those who have problems (@Kai): I had the same problem. I think, I've got a corrupt zip-file. Download the *.tar.gz-Version, this works fine for me - now! - — Bastian 2007-10-24

I cant see any 'create tables' button? I think the tar.gz file is corrupt? any ideas? when i go to 'Plugin Management' i see “Plugin: database Source:

  unknown

Installed:

  unknown This plugin returned no information, it may be invalid"

This looks corrupt to me? Dean

To get version of 2007-07-18 working I found I had to download the tar.gz file to the root of the wiki directory and unpack if there. There were then two 'Create table' placeholders in data/pages/database/ ('Create Table' and Create table). I deleted of these and then it appeared to work fine. Tim

Is there a way to modify the size of each collum? I would like to have them smaler because I want to display a table with 10 colums and they don't fit into the page.

Help!!, I disintalled the plugin and deleted the files of an old table,and re-installed the plugin, now I get this message when I try to open a new table: Unable to open the file path/data/pages/database/01-/definition.txt when attempting to read TableDefinition : id too large is there any other file that I have to delete?, what can I do ? Peter 2009-2-13

10-feb-2014 Hello guys, the source link to download is outdated. Please advise. Thanks. Fran

plugin/database.txt · Last modified: 2023-12-21 19:01 by Aleksandr

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