DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:netlogo

This is an old revision of the document!


NetLogo Plugin

Compatible with DokuWiki

Angua, Adora Belle

plugin Embed a NetLogo applet in your DokuWiki page.

Last updated on
2012-10-20
Provides
Syntax
Repository
Source

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 applet

Tagged with applet, programming

NetLogo is a multi-agent programmable modeling environment. It is used by tens of thousands of students, teachers and researchers worldwide. It is authored by Uri Wilensky and developed at the CCL. You can download it free of charge.

The NetLogo plugin for DokuWiki allows wiki editors to embed NetLogo applets in their pages. When NetLogo files (with extension .nlogo) are uploaded to the server and included in a page as media this plugin executes the file in the NetLogo Java applet.1)

Installation

This plugin will embed .nlogo files uploaded to your DokuWiki server. To allow upload you must add the following line to conf/mime.local.conf

nlogo    !application/octet-stream

:!: External requirements: This plugin requires that the user has Java installed to run the applet.

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

Examples/Usage

See an implementation of Conway's Game of Life for a demonstration of this plugin in action.

Syntax

Basic syntax

You can include uploaded .nlogo files with curly brackets, similar to internal images. Optionally you can specify the size of them. If a user has uploaded applet.nlogo to the current namespace, the following are valid syntax:

Real size:                        {{applet.nlogo}}
Resize to given width:            {{applet.nlogo?500}}
Resize to given width and height: {{applet.nlogo?800x500}}

Note that NetLogo applets may not present properly if resized to smaller than their default size.

By using left or right whitespaces you can choose the alignment.

Right:  {{ applet.png}} 
Left:   {{applet.png }}
Center: {{ applet.png }}

Only files on the current server, uploaded to the DokuWiki media folder are permitted. The NetLogo plugin respects ACLs: an applet will only be executed if the viewer has permission to read the file. Otherwise an error message is displayed.

Unlike images and other media files, titles are not allowed. If a title is included a download link will be presented instead:

{{applet.nlogo|Click to download applet}}

Advanced syntax

Instead of adding a title to create a download link, you may add a ?do=download parameter to the link. The following are equivalent:

{{applet.nlogo|}}
{{applet.nlogo?do=download}}

By default the .nlogo file determines the version of NetLogo executed. You may override this behaviour by specifying your own version as a parameter in the link:

Centered without version:       {{ applet.nlogo }}
Centered with version:          {{ applet.nlogo?version=5.0.3 }}
Centered with size and version: {{ applet.nlogo?800x500&version=5.0.3 }}

You may want to present the source code to the file directly in the wiki page. To do so add ?do=code to the link:

{{applet.nlogo?do=code}}

Currently, the raw code is simply dumped to the page without formatting. The author hopes to use code blocks with syntax highlighting in the future.

NetLogo allow for extra information to be added in a “Info” tab. To present this information add ?do=info to the link:

{{applet.nlogo?do=info}}

Currently, the text is dumped to the page without formatting. The author hopes to render the text (as markdown) in the future so that headers, links, and other formatting are correctly displayed.

Configuration and Settings

None at this time.

Development

How it works

The first and biggest challenge I had in developing this plugin was figuring out how to handle security. I couldn't just allow the NetLogo applet to access the .nlogo file directly because:

  1. It wouldn't work on most DokuWiki installs (direct file access is usually disabled), and
  2. It wouldn't respect DokuWiki access permissions.

A user should only be able to run the file if he/she has permission to read it.

FIXME

Rik Blok 2012/10/27 04:34

Change Log

Known Bugs and Issues

ToDo/Wish List

This plugin is intended only as a proof-of-concept. Others are encouraged to fork this plugin and develop it further. Please send a pull request to the master branch on significant improvements.

Here are some improvements the author hopes to see implemented:

  • The ?do=info option should render the information. Maybe using the markdown plugin?
  • The ?do=code option should render the code, preferably with syntax highlighting.
  • Options (such as the applet download url) are hard-coded. Should be moved to configuration.
  • Is it possible (and a good idea?) to automatically modify conf/mime.local.conf so the administrator doesn't have to fiddle with code to get this plugin working?

Discussion

1)
Your browser must be configured to run Java.
plugin/netlogo.1351311396.txt.gz · Last modified: 2012-10-27 06:16 by rikblok

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