Jifty::Plugin::EditInPlace::Action::FileEditor.3pm

Langue: en

Autres versions - même langue

Version: 2009-02-12 (ubuntu - 07/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

Jifty::Plugin::EditInPlace::Action::FileEditor - file editor for EditInPlace plugin

DESCRIPTION

This action allows you to edit mason components (and eventually libraries) using Jifty's Action system. It should only be enabled when you're running Jifty in "DevelMode".

WARNING

THIS ACTION LETS YOU REMOTELY EDIT EXECUTABLE CODE.

THIS IS DANGEROUS

new

Create a new "FileEditor" action.

arguments

Sets up this action's arguments.
path
Where to save the file
file_type
(One of mason_component or library)
source_path
Where to read the file from.
destination_path
Where to write the file to. If the current user can't write to the source_path, defaults to something inside the app's directory.
content
The actual content of the file we're editing.

get_default_content

Finds the version of the "source_path" (of type "file_type") and loads it into "content".

validate_destination_path PATH

Returns true if the user can write to the directory "PATH". False otherwise. Should be refactored to a "path_writable" routine and a trivial validator.

take_action

Writes the "content" out to the "destination_path".