QuickManager+

@author Mikko Lammi, www.maagit.fi/quickmanager-plus
@license GNU General Public License (GPL v3), www.gnu.org/copyleft/gpl.html
@version 1.5.5 updated 12/01/2011
@requirements MODX 1.0.0+                

Description

QuickManager+ enables front-end content editing.

Installation

If this is an update from earlier version delete first your old QuickManager+ plugin and all files at "assets/plugins/qm/".

1. Extract all files from package to site root.

NOTICE: If you are using Mac OS X don't extract files to the site root or you will overwrite your whole assets folder.

2. Create plugin with

3. Copy paste plugin code:

/**
 * QuickManager+
 *
 * @author Mikko Lammi, www.maagit.fi/quickmanager-plus
 * @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html
 * @version 1.5.5 updated 12/01/2011   
 */

// In manager
if (isset($_SESSION['mgrValidated'])) {

    $show = TRUE;
   
    if ($disabled  != '') {
        $arr = explode(",", $disabled );
        if (in_array($modx->documentIdentifier, $arr)) {
            $show = FALSE;
        }
    }
   
    if ($show) {
        // Replace [*#tv*] with QM+ edit TV button placeholders
        if ($tvbuttons == 'true') {
            $e = $modx->Event;
            if ($e->name == 'OnParseDocument') {
                 $output = &$modx->documentOutput;             
                 $output = preg_replace('~\[\*#(.*?)\*\]~', '<!-- '.$tvbclass.' $1 -->[*$1*]', $output);  
                 $modx->documentOutput = $output;
             }   
         }
        // In manager
        if (isset($_SESSION['mgrValidated'])) {
            include_once($modx->config['base_path'].'assets/plugins/qm/qm.inc.php');
            $qm = new Qm($modx, $jqpath, $loadmanagerjq, $loadfrontendjq, $noconflictjq, $loadtb, $tbwidth, $tbheight, $hidefields, $hidetabs, $hidesections, $addbutton, $tpltype, $tplid, $custombutton, $managerbutton, $logout, $autohide, $editbuttons, $editbclass, $newbuttons, $newbclass, $tvbuttons, $tvbclass);
        }
    }
}

4. Check events:

NOTICE: Make sure QuickManager+ is the first plugin on OnParseDocument event: Elements > Manage Elements > Plugins > Edit Plugin Execution Order by Event > OnParseDocument

5. Copy paste plugin default configuration:

&jqpath=Path to jQuery;text;assets/js/jquery-1.4.4.min.js &loadmanagerjq=Load jQuery in manager;list;true,false;false &loadfrontendjq=Load jQuery in front-end;list;true,false;true &noconflictjq=jQuery noConflict mode in front-end;list;true,false;true &loadtb=Load modal box in front-end;list;true,false;true &tbwidth=Modal box window width;text;80% &tbheight=Modal box window height;text;90% &hidefields=Hide document fields from front-end editors;text;parent &hidetabs=Hide document tabs from front-end editors;text; &hidesections=Hide document sections from front-end editors;text; &addbutton=Show add document here button;list;true,false;true &tpltype=New document template type;list;parent,id,selected;parent &tplid=New document template id;int;3  &custombutton=Custom buttons;textarea; &1=undefined;; &managerbutton=Show go to manager button;list;true,false;true &logout=Logout to;list;manager,front-end;manager &disabled=Plugin disabled on documents;text; &autohide=Autohide toolbar;list;true,false;true &editbuttons=Inline edit buttons;list;true,false;false &editbclass=Edit button CSS class;text;qm-edit &newbuttons=Inline new resource buttons;list;true,false;false &newbclass=New resource button CSS class;text;qm-new &tvbuttons=Inline template variable buttons;list;true,false;false &tvbclass=Template variable button CSS class;text;qm-tv

6. Save plugin.   

+ 7. Rich text editors (optional)

If you don't need inline template variable buttons you can skip this.

You don't need to change anything if your rich text editor version is at least:
- TinyMCE 3.3.6r2 for MODX
- CKEditor 3.3 for modx alpha 3

Now the hardest part. To get rich text editors to work properly with QuickManager+ inline template variable buttons you will need to edit the rich text editor plugin code. If you won't do this change the rich text editors will use web theme buttons when editing richtext template variables.

TinyMCE 3.2.4.1 (MODX 1.0.2 and below):

In MODX manager go to: Elements > Manage Elements > Plugins > TinyMCE

Replace line:
if(isset($forfrontend)||$modx->isFrontend()){

With:
if(isset($forfrontend)||($modx->isFrontend() && (intval($_GET['quickmanagertv'] != 1) && !(isset($_SESSION['mgrValidated']))))){

TinyMCE 3.3.2 (MODX 1.0.3) and 3.3.5.1 (MODX 1.0.4):

In MODX manager go to: Elements > Manage Elements > Plugins > TinyMCE

Replace line:
if($modx->isBackend())

With:
if($modx->isBackend() || (intval($_GET['quickmanagertv']) == 1 && isset($_SESSION['mgrValidated'])))

Configuration

Go to plugin configuration tab.

Configuration option Default value Possible values Instructions
Path to jQuery   assets/js/jquery-1.4.4.min.js   text Path to your jQuery script. 
Load jQuery in manager  true true || false Prevent loading jQuery twice if you are already using some other plugin which loads jQuery such as ManagerManager.
Load jQuery in front-end  true true || false   Prevent loading jQuery twice if you are already using it in your site template.
jQuery noConflict mode in front-end true true || false Define if jQuery should use noConflict mode. NoConflict mode is useful if you use other JavaScript libraries in front-end such as Mootools.
Load modal box in front-end  true true || false   Prevent loading the modal box JavaScript (ColorBox) twice if you are already using it in your site template.
Modal box window width 80% number || percent Define modal box (ColorBox) window width, for example: 800 or 75%.
Modal box window height 90% number || percent Define modal box (ColorBox) window height, for example: 500 or 75%.
Hide document fields from front-end editors  parent text Separate fields with commas, for example: parent,template,menuindex

Parent selection doesn't work at all with QuickManager+ due missing menu tree frame, so it should be hidden from front-end editors.

Possible fields to hide: content, pagetitle, longtitle, menuindex, parent, description, alias, link_attributes, introtext, template, menutitle

NOTICE! Hiding document fields may not work if fields are moved to other tabs with ManagerManager plugin.
Hide document tabs from front-end editors
text Separate tabs with commas, for example: settings,access

Possible tabs to hide: general, settings, access

NOTICE! Hiding tabs may not work properly if tab order is changed with ManagerManager plugin.
Hide document sections from front-end editors
text Separate sections with commas, for example: content,tvs

Possible sections to hide: docsettings, content, tvs

NOTICE! Hiding sections may not work properly if you are hiding sections with ManagerManager plugin.
Show add document here button  true true || false   Define if it's possible to add documents with QuickManager+.
New document template type  parent parent || id || selected  How to determine a new document template:

- parent: Use parent document template
- id: Use template based on id number
- selected: Define template based on parent document "inheritTpl" template variable used by Inherit Selected Template Plugin. You don't have to install the plugin, but you still have to have "inheritTpl" template variable on parent document with correct template id number.
New document template id 3 number Define which template id to use with new documents. Used only if new document template type is id.
Custom buttons
text Define custom buttons, for example add document to site root or add news document

- New document button: 'button title','new','parent id','template id','visible for user role ids'

- Link button: 'button title','link','http://www.example.com','','visible for user role ids'

- Modal button: 'button title','modal','http://www.example.com','','visible for user role ids'

MODX link tag, e.g. [~23~], works for link and modal button links.
MODX id tag [*id*] works, e.g. http://www.example.com?refererMODXPageId=[*id*]
Every custom button has individual CSS class, e.g. qm-custom-"index"

Visible for user role ids: leave empty to accept all roles, role 1 = Administrator

Separate different buttons with ||

Basic example:
'Site statistics','link','http://www.google.com/analytics/','',''

Advanced example:
'New root document','new','0','3',''||'Add news','new','10','4','4,5,6'||'For admins only','link','[~45~]','','1,4'||'Site statistics','modal','http://www.google.com/analytics/','','1,4'
Show go to manager button true true || false Define is go to manager button visible.
Logout to manager manager || front-end Define where to logout: to manager login screen or to active document on front-end.
Plugin disabled on documents

text Document id numbers where the plugin is disabled.
Separate fields with commas, for example: 34,22,7,19
Autohide toolbar
true
true || false Define if toolbar hides automatically or is always visible (manually close the toolbar by clicking MODX logo or X button)
Inline edit buttons
false
true || false Define if special edit buttons are searched inside content.

Purpose:
Edit any page from other page, e.g. for editing ditto listings.

How it works:
- Add anywhere in to your page: <!-- "Edit button CSS class" "document id to be edited" '"Button title"' -->
- This will create an edit button inside your page when logged in manager
- For regular visitors it will be shown as a regular HTML comment visible only in the HTML source code

Basic example:
- Add in to your template <!-- qm-edit 1 'Edit this' -->
- Creates button to edit page id 1

Advanced example:
- Add in to your Ditto template chunk: <!-- qm-edit [+id+] 'Edit news item' -->
- Creates edit buttons for news listings etc. inside the container page

NOTICE! Button title will fail if you use accented characters. Use HTML entities instead, for example &auml;
Edit button CSS class qm-edit
text
Default qm-edit class can be found at: assets/plugins/qm/css/style.css

You can use your own class if you want to make your own edit button or for added security measure.
Inline new resource buttons false
true || false Define if special new resource buttons are searched inside content.

Purpose:
Create any page from other page, e.g. create new news items.

How it works:
- Add anywhere in to your page: <!-- "New resource button CSS class" "parent id" "template id" '"Button title"' -->
- This will create an new resource button inside your page when logged in manager
- For regular visitors it will be shown as a regular HTML comment visible only in the HTML source code

Basic example:
- Add in to your template <!-- qm-new 1 3 'New news item' -->
- Creates new resource button
- Parent id: 1 (new resource will be created under document id 1)
- Template id: 3 (uses template id 3)
- Button title: New news item

NOTICE! Button title will fail if you use accented characters. Use HTML entities instead, for example &auml;
New resource button CSS class qm-new
text
Default qm-new class can be found at: assets/plugins/qm/css/style.css

You can use your own class if you want to make your own new resource button or for added security measure.
Inline template variable buttons false
true || false Define if special template variable buttons are searched inside content.

Purpose:
Edit any template variable.

Editable default MODX fields:
pagetitle, longtitle, description, content, menutitle, introtext

How it works:
- Add anywhere in to your page: [*#tvName*], notice the "#"
  OR
- Add anywhere in to your page: <!-- "Template variable button CSS class" "tvName" -->
- This will create a template variable button inside your page when logged in manager
- For regular visitors it will be shown as a regular HTML comment visible only in the HTML source code

Basic example:
- Add in to your template [*#tvName*]
- Creates button to edit tvName template variable (and outputs the template variable)

Advanced example:
- Add in to your template: <!-- qm-tv tvName -->
- Creates button to edit tvName template variable
Template variable button CSS class qm-tv text
Default qm-tv class can be found at: assets/plugins/qm/css/style.css

You can use your own class if you want to make your own template variable button or for added security measure.

How to use

Just login, open frontend and enjoy!

Known issues

Special thanks

Changelog

1.5.5 - 12/01/2011
1.5.4 - 03/01/2011
1.5.3 - 12/10/2010
1.5.2 - 14/09/2010
1.5.1 - 02/08/2010
1.5
1.4.1
1.4
1.3.4.1
1.3.4
1.3.3
1.3.2.1
1.3.2
1.3.1
1.3
1.2
1.1.1