About Sitellite       Screenshots       Downloads       Forge      Documentation       Community       Support

You are here: Home / Deleting pages/files


Deleting pages/files

Forum / General / Deleting pages/files

Reply         Subscribe         Start new thread         Syndicated Feed (RSS)        

Displaying 1 to 3 of 3 Previous   1   Next
Author Message
re599

Posts: 25
Location: Oxfordshire, UK
Deleting pages/files - Posted: March 4, 2008 - 7:23 AM Quote and reply
Is there any way to set things so that if a user tries to delete a page there is a check made on the dependancies. I want a message ideally that says if you delete these pages links on these pages will be brokem. Then the user has the option of either deleting the page and breaking the links or cancalling the deletion.

I don't really want to lock the file/page because the user deleting the page might not own the dependant files, so can't update them.

Bob

Back to top View user profile     Contact this member
lux

Posts: 656
Location: Manitoba, Canada
Re: Deleting pages/files - Posted: March 4, 2008 - 5:02 PM Quote and reply
re599 said:
Is there any way to set things so that if a user tries to delete a page there is a check made on the dependancies. I want a message ideally that says if you delete these pages links on these pages will be brokem. Then the user has the option of either deleting the page and breaking the links or cancalling the deletion.

I don't really want to lock the file/page because the user deleting the page might not own the dependant files, so can't update them.

Bob


The delete workflow is actually triggered after them delete has been made, but because of the versioning a workflow action could still check and undelete or notify the user if the deleted page is linked to. For example:

loader_import ('cms.Versioning.Rex');

// limit to delete action and to web pages
if ($parameters['transition'] == 'delete' && $parameters['collection'] == 'sitellite_page') {
    // get a count of pages linking to this one
    $count = db_shift ('select count(*) from sitellite_page where body like ?', '%/' . $parameters['key'] . '"');

    if ($count) {
        // there are links, restore and alert
        $rex = new Rex ('sitellite_page');
        $history = $rex->getHistory ($parameters['key'], false, 1);
        $rex->restore ($parameters['key'], $history[0]->sv_autoid, array ());

        echo $count . ' pages link to this one still.';
        exit;
    }
}


Another option would be to add a new transition in the workflow of the delete action to be triggered before it's executed. That's probably more logical since it doesn't delete the page then check. I'll see about adding a few more of these workflow triggers for the next beta update, since they're easy to add and that would make it a bit more flexible.

Lux

Back to top View user profile     Contact this member
lux

Posts: 656
Location: Manitoba, Canada
Re: Deleting pages/files - Posted: March 11, 2008 - 2:28 AM Quote and reply
lux said:
Another option would be to add a new transition in the workflow of the delete action to be triggered before it's executed. That's probably more logical since it doesn't delete the page then check. I'll see about adding a few more of these workflow triggers for the next beta update, since they're easy to add and that would make it a bit more flexible.


I did end up adding a new workflow trigger to the delete function before the delete itself occurs (called 'pre-delete' instead of 'delete') so in the next release (very close now, hopefully sometime this week) anyone will be able to create a workflow action that gets called this way if you want.

Cheers,

Lux

Back to top View user profile     Contact this member
 

Sitellite 5 Beta


Copyright © 2009, SIMIAN systems Inc.
All rights reserved. Privacy policy
Some of the icons on this site were created by the Gnome Project.