Confirm deletion of page layout & templates

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
TomC
Posts: 3
Joined: Tue 13. Sep 2005, 15:32
Location: Ontario, Canada

Confirm deletion of page layout & templates

Post by TomC »

For the phpwcms versions as of this writing, 'page layouts' and 'templates' get "deleted" without a final confirmation so one wrong click could be frustrating (I realize they are still hidden in the database though). So the following changes add that extra level of safety, just like what exists currently when deleting categories, articles, and files.

I have tried to adhere to Oliver's existing code syntax, but please feel free to make any changes. If these changes eventually make it into the next version then I guess these 4 new additional language includes will need to be made for all supported languages, correct?

I tested these changes on phpwcms version: 1.2.5-DEV

Page Layout
Note: if you are using another language other than english then you will need to substitute the 'en' folder below with your language folder name.

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#

include/inc_lang/backend/en/lang.inc.php


#
#-----[ FIND ]------------------------------------------
#

$BL['be_admin_page_edit']               = 'edit pagelayout';


#
#-----[ AFTER, ADD ]------------------------------------
#

$BL['be_admin_page_del_page']           = 'delete page layout';
$BL['be_admin_page_del_jsmsg']          = 'Do you really want to delete page layout?';

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#

include/inc_tmpl/admin.pagelayout.tmpl.php


#
#-----[ FIND ]------------------------------------------
#

echo 'title="delete pagelayout: '.html_specialchars($row["pagelayout_name"]).'">';


#
#-----[ REPLACE WITH ]----------------------------------
#

echo 'title="'.$GLOBALS['BL']['be_admin_page_del_page'].': ['.html_specialchars($row["pagelayout_name"]).']" onClick="GP_popupConfirmMsg(\''.$GLOBALS['BL']['be_admin_page_del_jsmsg'].'\n['.html_specialchars($row["pagelayout_name"]).']\');return document.MM_returnValue">';
Templates
Note: if you are using another language other than english then you will need to substitute the 'en' folder below with your language folder name.

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#

include/inc_lang/backend/en/lang.inc.php


#
#-----[ FIND ]------------------------------------------
#

$BL['be_admin_tmpl_name']               = 'name';


#
#-----[ AFTER, ADD ]------------------------------------
#

$BL['be_admin_tmpl_del_tmpl']           = 'delete template';
$BL['be_admin_tmpl_del_jsmsg']          = 'Do you really want to delete template?';

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#

include/inc_tmpl/admin.templates.tmpl.php


#
#-----[ FIND ]------------------------------------------
#

echo 'title="delete template: '.html_specialchars($row["template_name"]).'">';


#
#-----[ REPLACE WITH ]----------------------------------
#

echo 'title="'.$GLOBALS['BL']['be_admin_tmpl_del_tmpl'].': ['.html_specialchars($row["template_name"]).']" onClick="GP_popupConfirmMsg(\''.$GLOBALS['BL']['be_admin_tmpl_del_jsmsg'].'\n['.html_specialchars($row["template_name"]).']\');return document.MM_returnValue">';
Thanks again Oliver for phpwcms!
Tom
Ben
Posts: 558
Joined: Wed 14. Jan 2004, 08:05
Location: Atlanta
Contact:

Post by Ben »

Cool mod, TomC. This feature would be great to have added to wcms core. I've accidentally killed a template or two in my day :cry:
Post Reply