DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:openas

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:openas [2017-04-08 02:08] – [OpenAS] turnermmplugin:openas [2024-01-02 14:08] (current) – similar to bureaucracy plugin and move plugin Aleksandr
Line 1: Line 1:
 ====== openas Plugin ====== ====== openas Plugin ======
- 
- 
  
 ---- plugin ---- ---- plugin ----
-description: File utility for moving/renaming files, saving copies, creating new pages from templates  +description: File utility for moving/renaming files, saving copies, creating new pages from templates 
-author     :  Myron turner +author     : Myron Turner 
-email      :  turnermm02@shaw.ca +email      : turnermm02@shaw.ca 
-type       :  syntax,action +type       : syntax,action 
-lastupdate : 2017-04-07 +lastupdate : 2022-02-14 
-compatible : anteater,rincewind,angua,adora belle,weatherwax,binky,"ponder stibbons",hrun,detritus,"Elenor Of Tsort","Frusterick Manners"+compatible : AnteaterRincewindAnguaAdora BelleWeatherwaxBinkyPonder StibbonsHrunDdetritus, Elenor of Tsort, Frusterick Manners, Greebo, Hogfather
 depends    : newpagetemplate depends    : newpagetemplate
 conflicts  conflicts 
-similar    : +similar    : bureaucracy, move
 tags       : pagemove, file, template,rename,move,form tags       : pagemove, file, template,rename,move,form
  
Line 18: Line 16:
 bugtracker : https://github.com/turnermm/OpenAs-plugin-for-Dokuwiki/issues bugtracker : https://github.com/turnermm/OpenAs-plugin-for-Dokuwiki/issues
 sourcerepo : https://github.com/turnermm/OpenAs-plugin-for-Dokuwiki/ sourcerepo : https://github.com/turnermm/OpenAs-plugin-for-Dokuwiki/
-donationurl: +donationurl: http://mturner.org/userfiles/donate.php
 ---- ----
- 
  
 ===== Installation ===== ===== Installation =====
- 
  
 :!: **External requirements:** This plugin requires the following additional component that must be installed separately if you wish to use the templating facility: [[plugin:newpagetemplate]] :!: **External requirements:** This plugin requires the following additional component that must be installed separately if you wish to use the templating facility: [[plugin:newpagetemplate]]
  
- +Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
- +
-Install the plugin using the [[plugin:plugin|Plugin Manager]] and the download URL above, which points to latest version of the pluginFor manual installs, refer to [[:Plugins]] on how to install plugins manually. +
  
  
Line 39: Line 32:
 There are three syntax formats: There are three syntax formats:
  
-        ~~SaveAS>newname~~         +  ~~SaveAS>newname~~ 
-        ~~MoveTO>newname~~ +  ~~MoveTO>newname~~ 
-        ~~OpenAS>newname#template>newpagevars~~+  ~~OpenAS>newname#template>newpagevars~~ 
 + 
 +  - ''newname'' is the page name with its namespace, as in '':namespace:newname'' 
 +  - ''template'' is the name of a template which will be found in :''pagetemplates'' 
 +  - ''newpagevars'' has this format: @macro_1@,value_1;@macro_2@,value_2;. . . 
 +    * this follows the format of the [[plugin:newpagetemplate#example|newpagetemplate]] plugin for specifying macros and their substitution values.
  
-   - ''newname'' is the page name with its namespace, as in '':namespace:newname''     
-   - ''template'' is the name of a template which will be found in :''pagetemplates''   
-   - ''newpagevars'' has this format:  @macro_1@,value_1;@macro_2@,value_2;. . . 
-            *  this follows the format of the [[plugin:newpagetemplate#example|newpagetemplate]] plugin for specifying macros and their substitution values. 
-  
  
 ==== SaveAS ==== ==== SaveAS ====
  
-The SaveAS form will create a new page from the old page but leave the old page in tact.+The SaveAS form will create a new page from the old page but leave the old page intact.
  
-==== MoveTO ==== 
  
 +==== MoveTO ====
  
-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 MoveTo form performs a limited page move: it preserves backlinks and implements a number of other features, as described below in the [[#pagemove]] section.+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 MoveTo form performs a limited page move: it preserves backlinks and implements a number of other features, as described below in the [[#pagemove]] section.
  
 ==== OpenAS ==== ==== OpenAS ====
  
-The OpenAS form requires the newpagetemplate plugin.  This form will open the page ''newname'', using the specified template.  The ''newpagevars'' attribute follows the format described on the  [[:plugin:newpagetemplate|newpagetemplate page]]. Here is a sample:+The OpenAS form requires the newpagetemplate plugin. This form will open the page ''newname'', using the specified template. The ''newpagevars'' attribute follows the format described on the [[:plugin:newpagetemplate|newpagetemplate page]]. Here is a sample:
  
-   ~~OpenAS>hello_temp#:pagetemplates:pagetemplates:homepagetemplate>@HI@,HOWDY!;@BYE@,Good Bye~~+  ~~OpenAS>hello_temp#:pagetemplates:homepagetemplate>@HI@,HOWDY!;@BYE@,Good Bye~~
  
-This will open up the page :hello_temp, using the homepagetemplate (:pagetemplates:homepagetemplate) and it will fill in any of the substitution variables defined on the newpagetemplate plugin page, as well as the variables defined +This will open up the page :hello_temp, using the ''homepagetemplate'' in the '':pagetemplatesnamespace'', 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 [[:plugin:newpagetemplate|newpagetemplate page]] for complete details on using the newpagetemplate plugin.+by ''newpagevars'' (which in this example are: @HI@ and @BYE@). Please see the [[:plugin:newpagetemplate|newpagetemplate page]] for complete details on using the newpagetemplate plugin.
  
-There is an expanded syntax for this form of the plugin which gives it significantly greater flexiblity. See [[##expanded_syntax_for_the_openas_format|below]].+There is an expanded syntax for this form of the plugin which gives it significantly greater flexiblity. See [[#expanded_syntax_for_the_openas_format|below]].
  
  
 ===== How it works ===== ===== 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, but links will not be updated until the new page is accessed from the link in the yellow box.  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.+ 
 +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, but links will not be updated until the new page is accessed from the link in the yellow box. 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.
  
  
 === Relative Links === === Relative Links ===
-Relative links will be re-written to the newly created file as absolute links.  This is true of both the SaveAS and the MoveTO forms, 
- 
  
 +Relative links will be re-written to the newly created file as absolute links. This is true of both the SaveAS and the MoveTO forms,
  
  
 ===== Pagemove ===== ===== Pagemove =====
  
-In the MoveTo option, all backlinks to the page being moved are updated to the page id of the new page.  +In the MoveTo option, 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.+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== == 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 [[plugin:searchindex]] plugin. +This plugin does not update the DokuWiki history or indexing for the updated files If you want to re-index your site, you can use the [[plugin:searchindex]] plugin.
  
  
 == Images == == 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.  For this situation try the [[plugin:move]] plugin.+ 
 +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. For this situation try the [[plugin:move]] plugin. 
  
 == Backup == == 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 backed up with the ''.orig'' extension.  The ''.orig'' and  ''.mvd'' files are numbered, with the highest number being the most recent.+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 backed up with the ''.orig'' extension. The ''.orig'' and ''.mvd'' files are numbered, with the highest number being the most recent
 + 
 + 
 +===== Security ===== 
 + 
 +There is basic built-in security for the **SaveAS** and **MoveTo** operations. They check to make sure that the user has at least ''edit'' permission for the file which is being copied from and ''create'' permission for the new file that is being created. 
 + 
 +Both **SaveAS** and **MoveTo** can be protected as well by standard acl rules which control who has access to the pages where the plugin code is embedded. Similarly the **OpenAs** operation can be protected by the site's [[:acl|]] rules. 
 + 
 + 
 +==== Spoofed URLs ==== 
 + 
 +The plugin also intercepts any attempts to access the file system through spoofed urls. For these cases the url is redirected to another page. By default the redirection goes to an image in the plugin'
 +images directory, which displays a 404 notice. This can be changed in the Configuration manager either to a new image or page in the images directory or to an external url. If you use the images directory, your url should take this form: 
 + 
 +  * ''</your_dokuwiki/>lib/plugins/openas/images/404.jpg''. \\ Note: this url does not take the domain.
  
 ===== Expanded Syntax for the OpenAs Format===== ===== Expanded Syntax for the OpenAs Format=====
  
-With the expanded syntax, it is not necessary to pre-insert the ''newpagevars'' and their values into the page, as described [[#openas|above]].  Instead you can create an HTML Form, from which th plugin will take the names of the variables and their values.  The benefit of this, of course, is that the values are not pre-set by the plugin. +With the expanded syntax, it is not necessary to pre-insert the ''newpagevars'' and their values into the page, as described [[#openas|above]]. Instead you can create an HTML Form, from which the plugin will take the names of the variables and their values. The benefit of this, of course, is that the values are not pre-set by the plugin. 
-Different values can be entered for each access of the form.  + 
 +Different values can be entered for each access of the form.
  
 This is the expanded syntax. This is the expanded syntax.
 <code> <code>
-    ~OpenAsVarsStart~~ +~~OpenAsVarsStart~~ 
-    ~~OpenAsVAR>ReplacementVar~~   +~~OpenAsVAR>VAR-1~~ 
-    ~~OpenAsVAR>ReplacementVar~~   +~~OpenAsVAR>VAR_2~~ 
-    ~~OpenAsVarsClose~~ +~~OpenAsNUM>VAR_3~~ 
-    ~~OpenAS>SAVEAS_PAGE#yourtemplate>~~+~~OpenAsVAR>TAreaOpen:VAR_4~~ 
 +~~OpenAsVAR>TAreaClose~~ 
 +~~OpenAsVarsClose~~ 
 +~~OpenAS>SAVEAS_PAGE#template>~~ 
 +</code>
  
-</code>    +The ''OpenAsVAR'' creates an HTML textbox 24 characters wide, whereAS ''OpenAsNUM'' creates a textbox 10 charaCters wide. The ''TArea'' pair creates an HTML textarea.
  
-:!: Important: ''SAVEAS_PAGE'' is a placeholder and must appear in your plugin markup exactly as illustrated above. It will place a textbox on your page which asks for the ''page id'' The user will get a link to ''SAVEAS_PAGE''. When the user clicks on the link, this placeholder will be replaced by the ''page id'' from the texbox.  See the illustration [[#result|below]]. 
  
-This format will create a Form with two text boxes.  ''ReplacementVar'' is the name of a variable which is included in the template.  So, for instance, if the ''ReplacementVar'' is ''NAME'', then the plugin will replace ''@NAME@'' in the template with the value entered into the textbox.  You can create as many textboxes as you need  +The ''~~OpenAS>SAVEAS_PAGE#yourtemplate>~~'' entry must be outside of the ''VarsStart'' and ''VarsClose'' block.
  
-Each instance of ~~OpenAsVAR>ReplacementVar~~ can be prefaced by a desciptive label, for instance: +:!Important: ''SAVEAS_PAGE'' is a placeholder and must appear in your plugin markup exactly as illustrated above. It will place a textbox on your page which asks for the ''page id''. The user will get a link to ''SAVEAS_PAGE''. When the user clicks on the link, this placeholder will be replaced by the ''page id'' from the textbox. See the illustration [[#result|below]].
-     First Name~~OpenAsVAR>FNAME~~   +
-The Replacement variables are case-sensitive.  There is one formatting feature, which will help to arrange the textboxes on your page; this is the Dokuwiki line-break: ''%%\\%%''  The textboxes can be interspersed with text; you can use the line-breaks to help format the text.+
  
-You can use the ''~~OpenAS>SAVEAS_PAGE#yourtemplate>~~'' makup on its own.  The link will redirect to new page which has been captured from the ''page id'' textbox.  It is also possible to include predefined valuesas illustrated in the basic syntax form [[#openas|above]].  It is also possible to combine predefined values with values captured from the Form. +This above markup will create a Form with two text boxes and one textarea. ''ReplacementVar'' is the name of variable which is included in the template. So, for instance, if the ''ReplacementVar'' is ''NAME''then the plugin will replace ''@NAME@'' in the template with the value entered into the textbox. You can create as many textboxes as you need.
-===== Example ===== +
-===== Markup =====+
  
-<code> +Each instance of ~~OpenAsVAR>ReplacementVar~~ can be prefaced by a descriptive label, for instance:
-~~OpenAsVarsStart~~+
  
-Name: ~~OpenAsVAR>name~~  +  First Name: ~~OpenAsVAR>FNAME~~ 
 +  ** First Name: ** ~~OpenAsVAR>FNAME~~
  
-Age~~OpenAsVAR>AGE~~  \\ +The Replacement variables are case-sensitive. There are two formatting features. The first will help to arrange the input elements on your page; this is the Dokuwiki line-break''%%\\%%''. The input elements can be interspersed with text. The double asterisks are place-holders for marking up the text as one of: ''bold'', ''underline'', ''italic'', or ''none''. The selection of which markup to use is made in the Configuration Manager by means of the ''label'' option.
  
-Address: ~~OpenAsVAR>ADDR1~~+You can use the ''~~OpenAS>SAVEAS_PAGE#yourtemplate>~~'' with or without predefined values. It is also possible to include predefined values, as illustrated in the basic syntax form [[#openas|above]], and to combine predefined values with values captured from the Form. The link will redirect to a new page which has been invoked by the link with data captured from the parameters in the form.
  
-Address 2: ~~OpenAsVAR>ADDR2~~   
  
 +===== Example =====
 +
 +
 +===== Markup =====
 +
 +<code>
 +~~OpenAsVarsStart~~
 +** Name: ** ~~OpenAsVAR>name~~
 +** Age:** ~~OpenAsVAR>AGE~~\\
 +** Address: ** ~~OpenAsVAR>ADDR1~~
 +** Address 2: ** ~~OpenAsVAR>ADDR2~~\\
 +** Details: ** ~~OpenAsVAR>TAreaOpen:DETAILS~~
 +~~OpenAsVAR>TAreaClose~~
 ~~OpenAsVarsClose~~ ~~OpenAsVarsClose~~
  
-~~OpenAS>wiki:SAVEAS_PAGE#yourtemplate>@HI@,Howdy!!;@BYE@,Good Bye~~+~~OpenAS>wiki:SAVEAS_PAGE#test:openas:template_1>@HI@,HOWDY!;@BYE@,Good Bye~~
 </code> </code>
  
 +This labels surrounded by asterisks (i.e. %%**%% Name: %%**%%) can be configured from the Configuration Settings as bold, italic, or underlined. Default is ''none'', no formatting.
  
 ===== Result ===== ===== Result =====
  
-{{ http://i1369.photobucket.com/albums/ag206/turnermm03/openas_exp2_zpsnprufria.png?480  }}+{{ https://i.imgur.com/JchEQ5b.png?480&recache }}
  
-The Name, Age and Addr fields will be added to the  HI and BYE fields.  The HI and BYE are constants, pre-set, the others are set by the user and will differ from page to page.  +The Name, Age and Addr fields will be added to the HI and BYE fields. The HI and BYE are constants, pre-set, the others are set by the user and will differ from page to page. 
  
 ==== Change Log ==== ==== Change Log ====
 +
 {{rss>https://github.com/turnermm/OpenAs-plugin-for-Dokuwiki/commits/master.atom date count=15}} {{rss>https://github.com/turnermm/OpenAs-plugin-for-Dokuwiki/commits/master.atom date count=15}}
-Complete listing of Changes: https://github.com/turnermm/OpenAs-plugin-for-Dokuwiki/commits/master 
-===== Discussion ===== 
  
-For discussion, please use the dokuwiki [[http://forum.dokuwiki.org|forum]], the above-listed Bugs button, or the  +Complete listing of changes: https://github.com/turnermm/OpenAs-plugin-for-Dokuwiki/commits/master
-[[plugin:openas:discussion]] page.+
  
  
 +===== Discussion =====
  
 +For discussion, please use the DokuWiki [[https://forum.dokuwiki.org/|forum]], the above-listed Bugs button, or the [[~:discussion]] page.
  
plugin/openas.1491610134.txt.gz · Last modified: 2017-04-08 02:08 by turnermm

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