TWiki
>
TWiki Web
>
AttachContentPlugin
(23 Jan 2019,
TWikiAdminUser
)
(raw view)
---+!! Attach Content Plugin <!-- Contributions to this plugin are appreciated. Please update the plugin page at http://twiki.org/cgi-bin/view/Plugins/AttachContentPlugin or provide feedback at http://twiki.org/cgi-bin/view/Plugins/AttachContentPluginDev. If you are a TWiki contributor please update the plugin in the SVN repository. --> <sticky> <div style="float:right; background-color:#EBEEF0; margin:0 0 20px 20px; padding: 0 10px 0 10px;"> %TOC{title="Page contents"}% </div> </sticky> %SHORTDESCRIPTION% ---++ Overview This plugin puts any text between a =%<nop>STARTATTACH{"filename"}%= and =%<nop>ENDATTACH%= into an attachment with the given filename. Pass filename, topic, web or comment as parameters. The plugin refreshes the attachment when the topic is saved, or viewed. This plugin is written specifically to be able to put css into topic(s) and still be able to have efficient stylesheets: i.e., without the overhead of TWiki processing. The feature can be used for many other things where you want TWiki to generate a plain text file a smart way. %BR% For example: write a =SEARCH= in a topic and save the search results to an XML file. The XML data can be used for efficient look-up. ---++ Syntax Rules Write: <pre> %<nop>STARTATTACH{"filename"}% content-to-be-saved %<nop>ENDATTACH% </pre> You can pass a number of parameters: ---+++ Parameters | *Parameter* | *Description* | *Default* | *Example* | | =topic= | Topic to save the attachment to. | =none= (the current topic is used) | =topic="WebHome"= | | =web= | Web where the save topic is located. | =none= (the current Web is used) | =web="Main"= | | =comment= | Attachment comment text. | the default =ATTACHCONTENTCOMMENT= text is defined in the plugin Configuration settings | =comment="User data as of %<nop>DATE%"= | | =hide= | Use =hide="on"= to hide the attachment in normal topic view. | =off= | =hide="on"= | | =keeppars= | Keep paragraph <p /> tags, <nop> tags, and square bracket type links | The default =KEEPPARS= setting is defined in the plugin Configuration settings | =keeppars="on"= | | =attachonview=| Do/not do action in view | The default =ATTACHONVIEW= setting is defined in the plugin Configuration settings ) | =attachonview="1"= | ---++++ Special note on use of =attachview= If the global flag is enabled (using =configure=), attachments are saved every time on page view which could * slow down page views * increase server load * makes pages look updated even if there is no update (recent changes and e-mail notification) * saves pages regardless of access control (for example as TWikiGuest if not logged in) The =attachview= parameter allows a targeted save on view, to apply only on the pages that need this feature ---++ Examples ---+++ Creating a color scheme See: PatternSkinColorSettings. This topic uses !AttachContentPlugin to write a CSS file for colors. Color values are set dynamically in the topic. On topic save the CSS file is attached to the topic and can be referred to using variable =USERCOLORSURL=. #UserDataXml ---+++ User data XML <a href="%SCRIPTURL{save}%/%WEB%/%TOPIC%?action_save=1">Update user data XML</a> <verbatim> %STARTATTACH{"userdata.xml" comment="User data as of %DATE%"}% <?xml version="1.0" encoding="ISO-8859-1"?> <users> %SEARCH{ "[F]irstName.*value=.*()" web="%MAINWEB%" type="regex" nonoise="on" excludetopic="UserForm,TWikiContributor,TWikiGuest,UnknownUser" format="<user><firstname><![CDATA[$formfield(FirstName)]]></firstname><lastname><![CDATA[$formfield(LastName)]]></lastname><url><![CDATA[%SCRIPTURL{view}%/%WEB%/$topic]]></url></user>" }% </users> %ENDATTACH% </verbatim> #PluginSettings ---++ Plugin Settings Plugin settings are stored as preferences variables. To reference a plugin setting write ==%<nop><plugin>_<setting>%==, i.e. ==%<nop>CACHECONTENTPLUGIN_SHORTDESCRIPTION%== * One line description, is shown in the %SYSTEMWEB%.TextFormattingRules topic: * Set SHORTDESCRIPTION = Saves dynamic topic text to an attachment * Debug plugin: (This needs to be set up in =configure=. This setting will have no effect. See output in =data/debug.txt=) * Set DEBUG = 0 ---++ Plugin Installation Instructions __Note:__ You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running. You may also choose to install this plugin using the "Find More Extensions" link on the =configure= script of your TWiki installation, or do so manually using the instructions below. * Download the ZIP file from the Plugin web (see below) * Unzip ==%TOPIC%.zip== in your twiki installation directory. Content: | *File:* | *Description:* | | ==data/TWiki/%TOPIC%.txt== | Plugin topic | | ==lib/TWiki/Plugins/%TOPIC%.pm== | Plugin Perl module | * Visit =configure= in your TWiki installation, and enable the plugin in the {Plugins} section. * Test if the installation was successful: <a href="%SCRIPTURL{save}%/%WEB%/%TOPIC%?action_save=1">Update user data XML</a> to see if an attachment is created/updated ---++ Plugin Info | Plugin Author: | TWiki:Main.MeredithLesly, TWiki:Main.KennethLavrsen, TWiki:Main.ArthurClemens | | Copyright: | © 2006 TWiki:Main.MeredithLesly, %BR% © 2006-2007 TWiki:Main.KennethLavrsen, %BR% © 2007 TWiki:Main.ArthurClemens, %BR% © 2006-2011 TWiki:TWiki.TWikiContributor | | License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | | Plugin Version: | 21431 (2011-06-06) | | Change History: | <!-- versions below in reverse order --> | | 2011-06-06: | TWikibug:Item6745: Control attachment save on view behavior with global flag, and override individually with parameter. Also move plugin settings from topic to configure -- TWiki:Main.DipuDeshmukh | | 2011-06-03: | TWikibug:Item6725: Change global package variables from "use vars" to "ours" -- TWiki:Main.PeterThoeny | | 2011-06-03: | TWikibug:Item6745: Enhancement to allow attach on Topic view, not just on save -- TWiki:Main.DipuDeshmukh | | 2010-07-27: | TWikibug:Item6530: Doc fixes; changing TWIKIWEB to SYSTEMWEB | | 16 Apr 2007 (2.2.0) | Kenneth Lavrsen: Add added =keeppars= parameter. Settings change to being plugin settings only. Removal of plugin tags fixed so text between is still visible. | | 15 Apr 2007 (2.1.0) | Arthur Clemens: added parameters =web=, =topic=, =comment= and =hide=. Plugin tags are removed from view. Added configurable default comment. | | 19 Oct 2006 (2.0) | TWiki:Main.KennethLavrsen<br />Fixed major security issue. Original version allowed /../ in the filename so files could be stored everywhere<br />Plugin now cleans up the its work area and no longer leaves temporary files<br />Temporary filenames made pseudo random to avoid race condition<br />Plugin now also removed nops and TML square bracket links<br />Attachment is no longer saved when uploading other files and changing attributes. | | 09 Feb 2006 (1.0) | Initial version | | TWiki Dependency: | $TWiki::Plugins::VERSION 1.1 | | CPAN Dependencies: | none | | Other Dependencies: | none | | Perl Version: | 5.005 | | License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | | TWiki:Plugins/Benchmark: | %SYSTEMWEB%.GoodStyle nn%, %SYSTEMWEB%.FormattedSearch nn%, %TOPIC% nn% | | Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC% | | Feedback: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev | | Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Appraisal | __Related Topics:__ %SYSTEMWEB%.TWikiPreferences, %SYSTEMWEB%.TWikiPlugins
Attachments
Attachments
Topic attachments
I
Attachment
History
Action
Size
Date
Who
Comment
xml
userdata.xml
r1
manage
0.8 K
23 Jan 2019 - 14:08
TWikiAdminUser
User data as of 23 Jan 2019
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r3 - 23 Jan 2019
-
TWikiAdminUser
Home
Site map
JUNOProjectTemplateWeb web
TWiki web
TWiki Web
User registration
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
User Reference
ATasteOfTWiki
TextFormattingRules
TWikiVariables
FormattedSearch
QuerySearch
TWikiDocGraphics
TWikiSkinBrowser
InstalledPlugins
Admin Maintenance
Reference Manual
InterWikis
ManagingUsers
ManagingWebs
TWikiSiteTools
TWikiPreferences
WebPreferences
Categories
Admin Documentation
Admin Tools
Developer Doc
User Documentation
User Tools
Account
Log In
Register User
Български
Cesky
Dansk
Deutsch
English
Español
_Français_
Italiano
日本語
한글
Nederlands
Polski
Português
Русский
Svenska
简体中文
簡體中文
E
dit
A
ttach
Copyright © 1999-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback
Note:
Please contribute updates to this topic on TWiki.org at
TWiki:TWiki.AttachContentPlugin
.