-
-
Notifications
You must be signed in to change notification settings - Fork 1
Adds recyclebin interface #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rohnsha0
wants to merge
20
commits into
main
Choose a base branch
from
plip-recyclebin-interface
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
005380f
refactor(recyclebin): move interface from Products.CMFPlone
rohnsha0 6f8d473
lint
rohnsha0 df8e4dc
Merge branch 'main' into plip-recyclebin-interface
rohnsha0 835d025
changelog
rohnsha0 c40997d
Merge branch 'main' into plip-recyclebin-interface
rohnsha0 73cf713
feat(recyclebin): add restore_to_initial_state option to IRecycleBinC…
rohnsha0 abaefca
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 4ff27e8
fix(recyclebin): change target_container schema type to Choice for be…
rohnsha0 be666cb
fix(recyclebin): change target_container schema type to TextLine for …
rohnsha0 6550420
fix(recyclebin): update string literals to use PloneMessageFactory fo…
rohnsha0 1ac9807
refactor(recyclebin): remove IRecycleBinForm and IRecycleBinItemForm …
rohnsha0 b9d70d5
Merge branch 'main' into plip-recyclebin-interface
davisagli ab9a99b
Merge remote-tracking branch 'origin/main' into plip-recyclebin-inter…
davisagli 2797d75
Remove maximum_size from recyclebin interface
cekk 032274f
Merge pull request #113 from plone/cekk_remove_maximum_size_from_recy…
davisagli 9306510
Merge remote-tracking branch 'origin/main' into plip-recyclebin-inter…
cekk bc154f0
add search method
cekk 2beae74
Merge branch 'main' into plip-recyclebin-interface
jensens f772b2f
Merge branch 'main' into plip-recyclebin-interface
rohnsha0 e372ed7
Merge remote-tracking branch 'origin/main' into plip-recyclebin-inter…
davisagli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Adds interface for recyclebin functionality @rohnsha0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| """Interfaces for the Plone Recycle Bin functionality.""" | ||
|
|
||
| from zope import schema | ||
| from zope.interface import Interface | ||
|
|
||
|
|
||
| class IRecycleBinControlPanelSettings(Interface): | ||
| """Interface for recycle bin settings""" | ||
|
|
||
| recycling_enabled = schema.Bool( | ||
| title="Enable the recycle bin", | ||
| description="Enable or disable the recycle bin feature.", | ||
| default=False, | ||
| required=False, | ||
| ) | ||
|
|
||
| retention_period = schema.Int( | ||
| title="Retention period", | ||
| description="Number of days to keep deleted items in the recycle bin. Set to '0' to disable automatic purging.", | ||
| default=30, | ||
| min=0, | ||
| ) | ||
|
|
||
| maximum_size = schema.Int( | ||
| title="Maximum size", | ||
| description="Maximum size of the recycle bin in MB. When the total size of items in the recycle bin exceeds its maximum size, the oldest items in the recycle bin will be permanently purged.", | ||
| default=100, | ||
| min=10, | ||
| ) | ||
|
|
||
| restore_to_initial_state = schema.Bool( | ||
| title="Restore to initial workflow state", | ||
| description="When enabled, restored content will be set to its initial workflow state (usually 'draft') instead of the workflow state it was in when deleted.", | ||
| default=False, | ||
| required=False, | ||
| ) | ||
|
|
||
|
|
||
| class IRecycleBin(Interface): | ||
| """Interface for the recycle bin functionality""" | ||
|
|
||
| def add_item(obj, original_container, original_path): | ||
| """Add deleted item to recycle bin | ||
|
|
||
| Args: | ||
| obj: The object being deleted | ||
| original_container: The parent container before deletion | ||
| original_path: The full path to the object before deletion | ||
|
|
||
| Returns: | ||
| The ID of the item in the recycle bin | ||
| """ | ||
|
|
||
| def get_items(): | ||
| """Return all items in recycle bin | ||
|
|
||
| Returns: | ||
| A list of dictionaries with information about deleted items | ||
| """ | ||
|
|
||
| def get_item(item_id): | ||
| """Get a specific deleted item by ID | ||
|
|
||
| Args: | ||
| item_id: The ID of the deleted item in the recycle bin | ||
|
|
||
| Returns: | ||
| Dictionary with item information or None if not found | ||
| """ | ||
|
|
||
| def restore_item(item_id, target_container=None): | ||
| """Restore item to original location or specified container | ||
|
|
||
| Args: | ||
| item_id: The ID of the item in the recycle bin | ||
| target_container: Optional target container to restore to | ||
| (defaults to original container) | ||
|
|
||
| Returns: | ||
| The restored object or None if restore failed | ||
| """ | ||
|
|
||
| def purge_item(item_id): | ||
| """Permanently delete an item | ||
|
|
||
| Args: | ||
| item_id: The ID of the item in the recycle bin | ||
|
|
||
| Returns: | ||
| Boolean indicating success | ||
| """ | ||
|
|
||
| def purge_expired_items(): | ||
| """Purge items that exceed the retention period | ||
|
|
||
| Returns: | ||
| Number of items purged | ||
| """ | ||
|
|
||
| def is_enabled(): | ||
| """Check if recycle bin is enabled in the registry settings | ||
|
|
||
| Returns: | ||
| Boolean indicating whether recycle bin is enabled | ||
| """ | ||
|
|
||
|
|
||
| class IRecycleBinForm(Interface): | ||
| """Schema for the recycle bin form""" | ||
|
|
||
| selected_items = schema.List( | ||
| title="Selected Items", | ||
| description="Selected items for operations", | ||
| value_type=schema.TextLine(), | ||
| required=False, | ||
| ) | ||
|
|
||
|
|
||
| class IRecycleBinItemForm(Interface): | ||
| """Schema for the recycle bin item form""" | ||
|
|
||
| target_container = schema.Choice( | ||
| title="Target container", | ||
| description="Choose the container where the item should be restored when original location no longer exists", | ||
| vocabulary="plone.recyclebin.RestoreContainers", | ||
|
davisagli marked this conversation as resolved.
Outdated
|
||
| required=False, | ||
| ) | ||
|
davisagli marked this conversation as resolved.
Outdated
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.