Enhanced Frontend Editor (Easy)

If you have created additional (non official) documentation or tutorials or something like that please post this here
Post Reply
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

Enhanced Frontend Editor (Easy)

Post by phalancs »

Just created an enhancement for the frontend-editor i could no more live without :)

As simple as it gets. This Tweak adds:
1. "Go to Backend" Button
2. "New structure" (below active structure) button
3. "New article" (into active structure) button

Installation:
1. create "more_fe_links.php" and paste the code below
2. put the file into "template/inc_script/frontend_render/"

The box is only visible to logged in admin, also requires the frontend editor to be enabled

Image

Code: Select all

<?php

// =========================================================================
//
// ADMIN-BOX V1.0
// 10.10.2011
// www.enym.com - Konstantin Schultes 
//
// This script enhances the frontend-Editor. Just create a file like 
// "more_fe_links.php" and put it into "template/inc_script/frontend_render/"
// Basic editing tasks will be much easier then! Enjoy :) 
//
// What it does:
// Adds: "Go to Backend" Button
// Adds: "New structure" (below active structure) button
// Adds: "New article" (into active structure) button
//
//==========================================================================


// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
   die("You Cannot Access This Script Directly, Have a Nice Day."); }
// ----------------------------------------------------------------

              	
if(FE_EDIT_LINK && $_SESSION['wcs_user_admin']=='1') {

//ADD SOME CSS for (THE ADMIN BOX
$block['custom_htmlhead']['mycss']  = '<style type="text/css">  

#admin_box1 { 
    position: absolute;
    right: 80px;
    top: 3px;
    color: white;
    border: 1px solid #030;
    padding: 3px;
    background-position: center center;
    background-repeat: no-repeat;
    height: 16px;
    width: 16px;
    cursor: pointer;
    z-index: 10000;
    background-color:#8cb963;
}

#admin_box2 { 
    position: absolute;
    right: 31px;
    top: 3px;
    color: white;
    border: 1px solid #030;
    padding: 3px;
    background-position: center center;
    background-repeat: no-repeat;
    height: 16px;
    width: 37px;
    cursor: pointer;
    z-index: 10000;
    background-color:#fff58a;
}

</style>';

//ADD THE ADMIN BOX
    $content['all'] .= '<div id="admin_box1"><a href="phpwcms.php?do=admin&p=6"><img src="img/famfamfam/action_go.gif" title="Administration" border="0"></a></div>';
    $content['all'] .= '<div id="admin_box2"><a href="phpwcms.php?do=admin&p=6&struct='.$GLOBALS ['content']['cat_id'].'"><img src="img/famfamfam/page_white_add.gif" style="margin-right:3px;" title="New structure" border="0"></a>';
    $content['all'] .= '<a href="phpwcms.php?do=articles&p=1&struct='.$GLOBALS ['content']['cat_id'].'"><img src="img/famfamfam/layout_add.png" title="New article" border="0"></a></div>';
}

?>
2008
pepe
Posts: 3954
Joined: Mon 19. Jan 2004, 13:46

Re: Enhanced Frontend Editor (Easy)

Post by pepe »

Great solution, thanks for sharing...

The only thing i have changed, setting the targets to _blank... works like a charm :D
thoblerone
Posts: 110
Joined: Fri 27. Jan 2006, 23:34
Location: Essen, Germany
Contact:

Re: Enhanced Frontend Editor (Easy)

Post by thoblerone »

Yep, really charming.

I like pepe's suggestion with the target better.

But I used target="phpwcms_backend" instead. Using _blank will give you a new page every time you edit something. The named target will open just one and then reuse the instance of the backend page.

Thomas
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

Re: Enhanced Frontend Editor (Easy)

Post by phalancs »

Wow, never knew i could use a page name!!! Lol....

edit: and it doesnt work...
2008
thoblerone
Posts: 110
Joined: Fri 27. Jan 2006, 23:34
Location: Essen, Germany
Contact:

Re: Enhanced Frontend Editor (Easy)

Post by thoblerone »

@phalancs

The end of the more _fe_links looks like that

Code: Select all

        $content['all'] .= '<div id="admin_box1"><a href="phpwcms.php?do=admin&p=6" target="backend"><img src="img/famfamfam/action_go.gif" title="Administration" border="0"></a></div>';
        $content['all'] .= '<div id="admin_box2"><a href="phpwcms.php?do=admin&p=6&struct='.$GLOBALS ['content']['cat_id'].'" target="backend"><img src="img/famfamfam/page_white_add.gif" style="margin-right:3px;" title="New structure" border="0"></a>';
        $content['all'] .= '<a href="phpwcms.php?do=articles&p=1&struct='.$GLOBALS ['content']['cat_id'].'" target="backend"><img src="img/famfamfam/layout_add.png" title="New article" border="0"></a></div>';
And works fine on my Firefox and IE. This does not cover the other fe-edit-links for the content parts. These links are generated in /include/inc_front/front.func.inc.php at line 3538ff:

Code: Select all

	$link  = '<a href="'.PHPWCMS_URL.'phpwcms.php?'.$href.'" target="backend" ';
	$link .= 'class="fe-link fe-'.$type.'" title="'.$title.'">';
On which browser did you test?
Thomas
Last edited by thoblerone on Sat 3. Mar 2012, 15:26, edited 1 time in total.
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

Re: Enhanced Frontend Editor (Easy)

Post by phalancs »

Ok. Will try that. Tested on chrome. :)
2008
Post Reply