WHY QUICK_EDIT?
Quick Manager+, which has replaced quick_edit as the legacy front-end editor, is no doubt the way of the future. However, those of us who build sites for end-users may find that quick_edit is better in several ways.
QM+ recently added the edit buttons inline with the TVs on the page, which is a nice improvement. QuickEdit, however, is not only familiar to our end-users, but also allows editing of the content without opening all of the page settings at the same time. The advantages are two-fold:
1. The end user has a better feel for the page placement of what is being edited in the WYSIWYG editor.
2. Quick edit allows you to go directly to page (Resource) settings via the Quick_Edit drop down menu without opening them all, every time you edit a content area.
QM+ opens the settings all at once, similar to the settings found in the manager. This causes the editor to lose it’s feeling of proximity to the content on the page. This is not only overwhelming for an entry level end user, but is redundant in-as-much-as we may as well edit from the manager with the tree column minimized.
How-to install Quick_edit in Evolution 1.x.x
It has been said that if you install .9.6, which has quick_edit included, and then upgrade to 1.0.4 without installing Quick Manager, you will still have Quick_edit installed. I have had it work and not work. If you already have 1.x.x installed you can follow the 25 steps below to continue to use Quick_Edit.
STEP 1
Download the quick_edit.zip attached to this post
(or find it in your MODx .9.6.3 download at: assets/modules/quick_edit)
or download MODx .9.6.3 from
http://modxcms.com/forums/index.php/topic,30198.msg183309.html#msg183309
Step 2
Unzip the download. (Stating the obvious ’cause I like "25 Steps")
Step 3
Upload the quick_edit folder to assets/modules/
If MODx is located in your root site directory, your result should look like:
public_html/assets/modules/quick_edit
Step 4
In MODx Manager, navigate to MODULES> MANAGE MODULES
Step 5
Click on "New Module"
Step 6
"General" tab settings:
Module name: QuickEdit
Description: Edit pages from the front end of the site
Paste the following into the "Module code (php)"
/*
* Written by: Adam Crownoble
* Contact: [email protected]
* Created: 8/14/2005
* Updated: 8/20/2005 - Added documentation page support
* Updated: 11/27/2005 - Added show Manager & Help link options and apply (AJAX saving)
* Updated: 12/05/2005 - Added editable fields as configuration option
* For: MODx cms (modxcms.com)
* Name: QuickEdit
* Description: Edit pages from the frontend of the site
* Parameters: &mod_path=Module Path (from site root);string;assets/modules/quick_edit &show_manager_link=Show Manager Link;int;1 &show_help_link=Show Help Link;int;1 &editable=Editable Fields;string;pagetitle,longtitle,description,content,alias,introtext,menutitle,published,hidemenu,menuindex,searchable,cacheable
* Parameter sharing: enabled
* Dependencies: QuickEdit plugin
*/
/*
License
QuickEdit - A MODx module which allows the editing of content via
the frontent of the site
Copyright (C) 2005 Adam Crownoble
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// Set configuration variables if not already set
if(!isset($mod_path)) { $mod_path = 'assets/modules/quick_edit'; }
if(!isset($show_manager_link)) { $show_manager_link = 1; }
if(!isset($show_help_link)) { $show_help_link = 1; }
if(!isset($editable)) { $editable = 'pagetitle,longtitle,description,content,alias,introtext,menutitle,published,hidemenu,menuindex,searchable,cacheable,template'; }
$basePath = $modx->config['base_path'];
// If we cant't find the module files...
if(!file_exists($basePath.$mod_path)) {
// Log an error
$error_message = '<strong>QuickEdit module not found!</strong></p><p>Edit the QuickEdit module, click the Configuration tab and change the Module Path to point to the module.</p>';
$modx->Event->alert($error_message);
$modx->logEvent(0, 3, $error_message, 'QuickEditor');
} else {
$GLOBALS['qe_editable'] = $editable;
$GLOBALS['quick_edit_path'] = $mod_path;
include($basePath.$mod_path.'/editor.class.inc.php');
$qe = new QuickEditor;
$html = '';
$doc_id = 0;
$var_id = 0;
$mod_id = 0;
$save = 0;
$ajax = 0;
$apply = 0;
if(isset($_REQUEST['doc'])) $doc_id = $_REQUEST['doc'];
if(isset($_REQUEST['var'])) $var_id = $_REQUEST['var'];
if(isset($_REQUEST['id'])) $mod_id = $_REQUEST['id'];
if(isset($_REQUEST['save'])) $save = $_REQUEST['save'];
if(isset($_REQUEST['ajax'])) $ajax = $_REQUEST['ajax'];
if($doc_id && $var_id && $save && $ajax) {
$qe->save($doc_id, $var_id);
} elseif($doc_id && $var_id && $save) {
$qe->save($doc_id, $var_id);
$qe->renderSaveAndCloseHTML();
} elseif($doc_id && $var_id) {
$qe->renderEditorHTML($doc_id, $var_id, $mod_id);
} else {
include($basePath.$mod_path.'/documentation.php');
}
}
Step 7
Click on the "Configuration" tab
Step 8
Put a check mark in "Enable"
Step 8
Copy and past the line below into the "Module Configuration" text area:
&mod_path=Module Path (from site root);string;assets/modules/quick_edit &show_manager_link=Show Manager Link;int;1 &show_help_link=Show Help Link;int;1 &editable=Editable Fields;string;pagetitle,longtitle,description,content,alias,introtext,menutitle,published,hidemenu,menuindex,searchable,cacheable,template
Step 10
Click on the button on the right side of the text area (Ballon tooltip when hovering over the button is "Update parameter display"
Step 11
A new form should have opened immediately below the "Module Configuration" with a table heading of "Parameter Value".
Step 12
The default values:
Module Path: assets/modules/quick_edit
Show Manager Link: 1
Show Help Link: 1
Editable Fields: pagetitle,longtitle,description,content,alias,introtext,menutitle,published,hidemenu,menuindex,searchable,cacheable,template
Step 13
Click on "Save"
Step 14
Navigate to "ELEMENTS > MANAGE ELEMENTS and click on the "Plugins" tab
Step 15
Click on "New Plugin"
On the "General" tab fill in as follows:
Plugin Name: QuickEdit
Description: Front-end Content Editor.
Paste the following Code into the "Plugin code (php) text area:
/*
* Written by: Adam Crownoble
* Contact: [email protected]
* Created: 8/14/2005
* Updated: 11/27/2005 - Added support for show Manager & Help links option
* Updated: 12/05/2005 - Added support for editable fields as a module configuration option
* For: MODx cms (modxcms.com)
* Name: QuickEdit
* Description: Renders QuickEdit links in the frontend
* Shared parameters from: QuickEdit module
* Events: OnParseDocument, OnWebPagePrerender
*/
/*
License
QuickEdit - A MODx module which allows the editing of content via
the frontent of the site
Copyright (C) 2005 Adam Crownoble
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// Don't do anything if we aren't logged in
if(isset($_SESSION['mgrValidated']) && $_SESSION['mgrValidated']) {
// Set configuration variables if not already set
if(!isset($mod_path)) { $mod_path = $modx->config['base_path'].'assets/modules/quick_edit'; }
if(!isset($show_manager_link)) { $show_manager_link = 1; }
if(!isset($show_help_link)) { $show_help_link = 1; }
if(!isset($editable)) { $editable = 'pagetitle,longtitle,description,content,alias,introtext,menutitle,published,hidemenu,menuindex,searchable,cacheable'; }
// If we can't find the module files...
if(!file_exists($mod_path)) {
// Only log the error if we haven't already logged it...
if(!isset($GLOBALS['quick_edit_not_found_sent'])) {
// Set a global variable so that we can only log this once
$GLOBALS['quick_edit_not_found_sent'] = true;
// Log an error
$error_message = '<strong>QuickEdit module not found!</strong></p><p>Edit the QuickEdit module, click the Configuration tab and change the Module Path to point to the module.</p>';
$modx->logEvent(0, 3, $error_message, 'QuickEditor');
}
} else {
// Set globals from QE Module's shared paramaters so we can get them from the frontend
$GLOBALS['qe_show_manager_link'] = $show_manager_link;
$GLOBALS['qe_show_help_link'] = $show_help_link;
$GLOBALS['qe_editable'] = $editable;
// Set the mod_path as a global variable
$GLOBALS['quick_edit_path'] = $mod_path;
if (!class_exists('Output')) include_once($mod_path.'/output.class.inc.php');
$outputObject = new Output;
switch($modx->Event->name) {
case 'OnParseDocument' :
$outputObject->output = $modx->documentOutput;
// Merge QuickEdit comment into the output
$outputObject->mergeTags();
break;
case 'OnWebPagePrerender' :
$outputObject->output = &$modx->documentOutput;
include_once($mod_path.'/module.class.inc.php');
$module = new Module;
$module->getIdFromDependentPluginName($modx->Event->activePlugin);
// Replace QuickEdit comments with QuickEdit links
$outputObject->mergeLinks($module->id);
break;
}
// Set the event output
$modx->documentOutput = $outputObject->output;
// Logout ?
$qe_logout= (isset($_GET['QuickEdit_logout'])? $_GET['QuickEdit_logout']: '');
if($qe_logout == 'logout') {
$_SESSION = array();
}
}
}
Step 16
Navigate back to MODULES>MANAGE MODULES. There will be a new module called quick_edit.
Step 17
Click on "quick_edit" Notice that there is now a new tab called "Dependencies"
Step 18
Click on the "Dependencies" tab and then click on "Manage Dependencies".
Step 19
Click on "Add Plugin" and place a check mark on "QuickEdit" and then click on "Insert"
Step 20
Now you should see QuickEdit under the "Element Name" column and Plugin under the "Type" column.
Click "Close."
Step 21
Navigate to "ELEMENTS > MANAGE ELEMENTS and click on the "Plugins" tab then click on "QuickEdit".
Step 22
Click on the "Configuration" tab then click on the drop-down for "Import Module shared Parameters" and select "QuickEdit"
Step 23
Click on the "System Events" tab.
Step 24
Select the following Check Boxes (both are in the first section):
OnParseDocument
OnWebPagePrerender
Step 25
Click "Save"
Congratulations! Open a preview of any page with a [*content*] TV and test your results.