Question
Has anyone worked out a scheme to allow twiki to manage plain-text system (or other) files using its browser based editor and revision control? Now that a lot of people understand the twiki framework and how to review recent changes it would be nice to be able to use it for other tasks that involve file changes on the server. Is there any way to set up a wrapper page that would include a separate plain text file and make that only part that show up in the edit field? The aliases file for email would be a good example of something that could be managed this way. I'd expect to add a link in the wrapper portion that would install the file after the contents have been changed and it should probably also be able to show current differences between the system copy and the twiki-managed copy. These scripts might have addional authentication requirements so a large group might be able to edit proposed changes but only a smaller set would be able to activate them.
--
LesMikesell - 19 Apr 2003
Answer
This sounds like a Plugin question. Create a Plugin that takes action based on Plugin variables you introduce to manipulate external text files. Use
TWikiAccessControl to protect certain actions to a certain group. Example actions, assuming the Plugin is called
ManageAliasPlugin:
-
%MANAGEALIAS{ action="show" }% would show the external alias file content
-
%MANAGEALIAS{ action="diff" }% would compare the current TWiki topic content with the alias file
-
%MANAGEALIAS{ action="update" confirm="yes" }% would update the alias file with the current TWiki topic content, possible with start and end markers like <!--ALIAS_START--> and <!--ALIAS_END-->
This
"update" action could be in a topic dedicated to confirm updates, e.g. add a form with a hidden field called "confirm" with value "yes" and an [
Update alias file ] button. The form calls its own topic, thus passes a
confirm=yes parameter which can be used to trigger an action.
Example content of the confirm update topic:
%MANAGEALIAS{ action="update" confirm="%URLPARAM{"confirm"}%" }%
<form name="new" action="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%INTURLENCODE{"%WEB%/%TOPIC%"}%">
<input type="hidden" name="confirm" value="yes" />
<input type="submit" value="Update alias file" />
</form>
Content renders like this:
Would you like to update the alias file?
The latest
SpreadSheetPlugin magic simulates the output of the variable
%MANAGEALIAS{ action="update" confirm="%URLPARAM{"confirm"}%" }%
Notice that with this approach all logic is centralized in the Plugin itself, e.g. the Plugin is easy to maintain.
--
PeterThoeny - 20 Apr 2003