Deleted Page "Trash Bin" Addon -- need help

Permalink 1 user found helpful
Hi,
I've been working on a "trash bin" addon so that when you delete pages, they get moved to an out-of-the-way location instead of being permanently removed from your site. (You can permanently remove them by deleting from the trash bin).

I've got it mostly working but ran out of time and there are still two outstanding issues:

1) Pages that are moved to the trash bin (a dashboard single_page) still show up in search results. I have zero knowledge about how C5 search works, so I don't know what to do about this. Maybe there's some 'exclude_from_search' attribute that can be set when the page is moved there? but then what if it's un-deleted (moved out of the trash bin)?

2) There is a lot of code in here to get pages to display using their own theme instead of the dashboard theme (this is what took the most time actually). Part of that code looks to the requested page's path to check if it's underneath the trash bin's path. But SOMETIMES when you move the page to the trash bin, its cache doesn't get cleared (even though I AM calling $page->refreshCache() after every move), and so it still thinks it's at the old path, which means it's not overwriting the dashboard theme (which means the user can't access the admin toolbar to move/delete it).

If anyone wants to help with this that would be great, as I'd love to get this up on the marketplace for people to use. If you just want to try it out and do some more testing, that would be good too (just post back here with any bugs or issues you discover).

Thanks!

-Jordan

1 Attachment

jordanlev
 
Mnkras replied on at Permalink Reply
Mnkras
exclude_sitemapxml
exclude_search_index

are the 2 page attributes you need to apply, to exclude from the search, after that you need to run the jobs though
Mnkras replied on at Permalink Reply
Mnkras
and for the theme thing, you can do something like:

[code]
$v = View::getInstance();
$v->setThemeByPath('/dashboard/sitemap/trash', 'theme_handle');

and just getting the theme handle from the page
Mnkras replied on at Permalink Reply
Mnkras
nvm just read your comment,
jordanlev replied on at Permalink Reply
jordanlev
Thanks Mnkras,
So do you have any thoughts as to what happens if someone moves a page back OUT of the trash?

My first thought is to add a new table when the package is installed that stores the original value for each page's exclude_sitemapxml, exclude_search_index (and exclude_pagelist and exclude_nav for good measure) when they're moved into the trash. Then when moved out it can set them back. But this sounds like a big pain in the neck to implement -- definitely more time than I was hoping to spend on this thing.

Wanna help?
ptheis replied on at Permalink Reply
ptheis
jordanlev-
i just installed your 0.9 beta and it seems to be working great, with the inclusion in search being a pretty big caveat.
The manager of the largest site I work with in C5 just deleted a page; luckily I had a database backup form a couple of days ago and was able to reconstruct the data from backup.
your solution would be far more desirable.
just out of curiosity - has there been any headway with this project? given a reasonable cost ($15 to $20) this would be an easy sale to this particular customer.

thanks!
jordanlev replied on at Permalink Reply
jordanlev
Hi ptheis,
Thanks for the feedback. Actually I gave up on this a while back because I kept running into little annoying problems (nothing that caused data loss, but just kind of UI annoyances with the process in general). I think this thing is doable, but I just don't have the time for it. I was hoping that by posting it here, other interested developers could help out, but I guess no one else has time either :)

Best of luck!

-Jordan
hereNT replied on at Permalink Reply
hereNT
I have a new add-on in the marketplace that allows you to undelete pages. It won't help you for the page that you deleted, but it will help you with deleting pages once you've installed it:

http://www.concrete5.org/marketplace/addons/recycle-bin/...

I think it's probably pretty close to jordanlev's add on but I developed it totally independently after someone asked for this functionality during a recent totally random webcast. I didn't do anything with page search, and I haven't noticed anything with pages caching the dashboard theme, but I think I might have to look into those two use cases now.