openas Plugin

Compatible with DokuWiki

  • 2012-01-25 "Angua" yes
  • 2011-05-25 "Rincewind" yes
  • 2010-11-07 "Anteater" yes

plugin File utility for moving/renaming files, saving-as, and creating new pages from templates

Last updated on
2011-05-29
Provides
Syntax, Action

Tagged with file, pagemove, template

Installation

:!: External requirements: This plugin requires the following additional component that must be installed separately if you wish to use the templating facility: newpagetemplate

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.

If you cannot use with Plugin Manager with the above URL, use the following: http://www.mturner.org/userfiles/openas.tgz

Examples/Usage

This plugin facilitates renaming (i.e. moving) pages, saving as (i.e. saving a page under a new name without deleting the original), and creating new pages from templates.

There are three syntax formats:

      ~~SaveAS>newname~~        
      ~~MoveTO>newname~~
      ~~OpenAS>newname#template>newpagevars~~

newname can be a namespace:pagename

The SaveAS form will create a new page from the old page but leave the old page in tact.

The MoveTO form will create a new page from the old page and delete the old page. However, it will not delete the old page unless it is certain that the new page is in place, so that there is no danger of losing the old page.

The OpenAS form requires the newpagetemplate plugin. This form will open the page newname, using the specified template. The current implementation of the OpenAS plugin assumes that all your templates will be found in the pagetemplates directory (i.e the :pagetemplates namespace). The newpagevars attribute follows the format described on the newpagetemplate newpagetemplate page. Here is a sample:

 ~~OpenAS>hello_temp#homepagetemplate>@HI@,HOWDY!;@BYE@,Good Bye~~

This will open up the page :hello_temp, using the homepagetemplate (which is :pagetemplates:homepagetemplate) and it will fill in any of the substitution variables defined on the newpagetemplate plugin page, as well as the variables defined by newpagevars (which in this example are: @HI@ and @BYE). Please see the newpagetemplate page for complete details on using the newpagetemplate plugin.

How it works

Once the page with the syntax markup is saved, it will now show a yellow box with a link. Clicking on this link will perform the desired action. In the case of pages which have been moved or saved-as, the new page will already be created. In the case of a page which has been moved, the original page will remain on the server until you have linked to the new page, at which time the old page will be deleted. In the case of new page templates, the new page will open with the macro values filled in. The ~~SaveAS>name~~ and ~~MoveTO>name~~ will be removed from the newly created pages.

MoveTO is not a comprehensive page-move facility. It does not preserve backlinks—links to this page that are made in other pages. However, a development version addresses this issue.

Syntax

     ~~SaveAS>newname~~        
     ~~MoveTO>newname~~
     ~~OpenAS>newname#template>newpagevars~~
  1. newname is the page name with its namespace, as in :namespace:newname
  2. template is the name of a template which will be found in :pagetemplates
  3. newpagevars has this format: @macro_1@,value_1;@macro_2@,value_2;. . .
    • this follows the format of the newpagetemplate plugin for specifying macros and their substitution values.

Development

Pagemove

There is now an alternate version of this plugin in which the the MoveTo option has been updated to a pagemove facility. It can be downloaded from the following URL: https://github.com/turnermm/OpenAs-plugin-for-Dokuwiki/zipball/pagemove.

In this version all backlinks to the page being moved are updated to the page id of the new page.

The plugin takes into consideration page locking. So, if a page with backlinks is currently in use, it is not updated until the user with the lock exits the page. The original page remains in place until all of the pages with backlinks have been updated. Once all backlinks have been updated, the original page is removed.

Metadata and Indexing

This plugin does not update the Dokuwki history or indexing for the updated files. If you want to re-index your site, you can use the searchindex plugin.

Images

The plugin in its present form does not update relative image links. If images are inserted using the media manager, this should not be an issue.

Backup

There is a backup system. A new meta directory is created: data/meta/openas, where the original backlink pages are stored. The pre-updated versions of these pages are created with the .mvd extension. And the page which has been moved to the new id is backup up with the .orig extension. The .orig and .mvd files are numbered, with the highest number being the most recent.

Note This is still a work in progress. It seems fine, but test on your system to be sure it works for you.

FAQ

Discusssion

For discussion, please use the dokuwiki forum. There is also a discussion page.

plugin/openas.txt · Last modified: 2012/03/09 03:32 by turnermm
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsGitXRefTranslate