-
-
Notifications
You must be signed in to change notification settings - Fork 31
Move plone.app.linkintegrity Classic-UI templates/views
#389
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
Merged
Merged
Changes from all commits
Commits
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,2 @@ | ||
| Move ``plone.app.linkintegrity`` template/views to ``plone.app.layout.views.linkintegrity`` | ||
| [petschki] |
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
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
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
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,76 @@ | ||
| from Acquisition import aq_inner | ||
| from datetime import datetime | ||
| from datetime import timedelta | ||
| from plone.app.linkintegrity.browser.info import ( | ||
| DeleteConfirmationInfo as DeleteConfirmationInfoAPI, | ||
| ) | ||
| from plone.app.linkintegrity.handlers import modifiedContent | ||
| from plone.base import PloneMessageFactory as _ | ||
| from Products.CMFCore.utils import getToolByName | ||
| from Products.Five import BrowserView | ||
| from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile | ||
| from Products.statusmessages.interfaces import IStatusMessage | ||
| from transaction import savepoint | ||
| from zExceptions import NotFound | ||
|
|
||
| import logging | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class DeleteConfirmationInfo(DeleteConfirmationInfoAPI): | ||
| template = ViewPageTemplateFile( | ||
| "templates/linkintegrity_delete_confirmation_info.pt" | ||
| ) | ||
|
|
||
|
|
||
| class UpdateView(BrowserView): | ||
| """Iterate over all catalogued items and update linkintegrity-information.""" | ||
|
|
||
| def __call__(self): | ||
| context = aq_inner(self.context) | ||
| request = aq_inner(self.request) | ||
| if "update" in request.form or "delete_all" in request.form: | ||
| starttime = datetime.now() | ||
| count = self.update() | ||
| duration = timedelta(seconds=(datetime.now() - starttime).seconds) | ||
| msg = _( | ||
| "linkintegrity_update_info", | ||
| default="Link integrity information updated for ${count} " | ||
| + "items in ${time} seconds.", | ||
| mapping={"count": count, "time": str(duration)}, | ||
| ) | ||
| IStatusMessage(request).add(msg, type="info") | ||
| msg = "Updated {} items in {} seconds".format( | ||
| count, | ||
| str(duration), | ||
| ) | ||
| logger.info(msg) | ||
| request.RESPONSE.redirect(getToolByName(context, "portal_url")()) | ||
| elif "cancel" in request.form: | ||
| msg = _("Update cancelled.") | ||
| IStatusMessage(request).add(msg, type="info") | ||
| request.RESPONSE.redirect(getToolByName(context, "portal_url")()) | ||
| else: | ||
| return self.index() | ||
|
|
||
| def update(self): | ||
| catalog = getToolByName(self.context, "portal_catalog") | ||
| count = 0 | ||
|
|
||
| for brain in catalog(): | ||
| try: | ||
| obj = brain.getObject() | ||
| except (AttributeError, NotFound, KeyError): | ||
| msg = "Catalog inconsistency: {0} not found!" | ||
| logger.error(msg.format(brain.getPath()), exc_info=1) | ||
| continue | ||
| try: | ||
| modifiedContent(obj, "dummy event parameter") | ||
| count += 1 | ||
| except Exception: | ||
| msg = "Error updating linkintegrity-info for {0}." | ||
| logger.error(msg.format(obj.absolute_url()), exc_info=1) | ||
| if count % 1000 == 0: | ||
| savepoint(optimistic=True) | ||
| return count |
135 changes: 135 additions & 0 deletions
135
src/plone/app/layout/controlpanels/templates/linkintegrity_delete_confirmation_info.pt
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,135 @@ | ||
| <html xmlns="http://www.w3.org/1999/xhtml" | ||
| xmlns:i18n="http://xml.zope.org/namespaces/i18n" | ||
| xmlns:metal="http://xml.zope.org/namespaces/metal" | ||
| xmlns:tal="http://xml.zope.org/namespaces/tal" | ||
| lang="en" | ||
| xml:lang="en" | ||
| tal:omit-tag="" | ||
| i18n:domain="plone" | ||
| > | ||
| <body tal:define=" | ||
| breaches python:view.breaches; | ||
| " | ||
| tal:omit-tag="" | ||
| > | ||
|
|
||
| <h2 tal:condition="breaches" | ||
| i18n:translate="linkintegrity_breaches_title" | ||
| >Potential link breakage</h2> | ||
|
|
||
| <div id="content-core"> | ||
|
|
||
| <p tal:condition="breaches" | ||
| i18n:translate="linkintegrity_instructions" | ||
| > | ||
| By deleting this item, you will break links that exist in the items listed | ||
| below. If this is indeed what you want to do, we recommend that you remove | ||
| these references first. | ||
| </p> | ||
|
|
||
| <div tal:define=" | ||
| token context/@@authenticator/token; | ||
| "> | ||
| <article class="breach-container" | ||
| tal:repeat="breach breaches" | ||
| > | ||
|
|
||
| <tal:target tal:define=" | ||
| target breach/target; | ||
| "> | ||
| <header><a href="${target/url}" | ||
| tal:content="target/title" | ||
| ></a></header> | ||
| <p> | ||
| <span i18n:translate="linkintegrity_is_referenced"> | ||
| This | ||
| <span tal:content="target/type_title" | ||
| i18n:name="portal_type" | ||
| ></span> | ||
| is referenced by the following items: | ||
| </span> | ||
| </p> | ||
| </tal:target> | ||
|
|
||
| <ul> | ||
| <li class="breach-item" | ||
| tal:repeat="source python:breach['sources']" | ||
| > | ||
| <tal:visible condition="source/accessible"> | ||
| <a tal:content="source/title" | ||
| tal:attributes=" | ||
| href source/url; | ||
| " | ||
| ></a> | ||
| [<a target="_blank" | ||
| tal:attributes=" | ||
| href string:${source/url}/edit?_authenticator=${token}; | ||
| " | ||
| i18n:translate="linkintegrity_edit_in_new_window" | ||
| >Edit in new window</a>] | ||
| </tal:visible> | ||
| <tal:private condition="not: source/accessible" | ||
| i18n:translate="linkintegrity_item_not_accessible" | ||
| > | ||
| The item is not accessible. | ||
| </tal:private> | ||
| </li> | ||
| </ul> | ||
|
|
||
| </article> | ||
|
|
||
| <div tal:define=" | ||
| breach_count view/breach_count; | ||
| " | ||
| tal:condition="breach_count" | ||
| > | ||
|
|
||
| <h2 i18n:translate="deleting_overview">Deleting overview</h2> | ||
| <p> | ||
| <span tal:define=" | ||
| refs python:len(breach_count); | ||
| " | ||
| i18n:translate="selected_folders_with_content" | ||
| > | ||
| Number of selected, non-empty folders: | ||
| <strong><span tal:replace="refs" | ||
| i18n:name="refs" | ||
| ></span></strong> | ||
| </span> | ||
| </p> | ||
| <ul> | ||
| <li tal:repeat="content python:breach_count"> | ||
| <span i18n:translate="deleting_contents"> | ||
| Following content within | ||
| <strong><span tal:replace="content" | ||
| i18n:name="content" | ||
| ></span></strong> | ||
| will also be deleted: | ||
| </span><br /> | ||
| <ul> | ||
| <li tal:define=" | ||
| objects view/objects; | ||
| " | ||
| tal:repeat="item python:range(3) " | ||
| > | ||
| <span tal:replace="python: breach_count[content][item]"></span> | ||
| <span tal:replace="python: objects[item]"></span> | ||
| </li> | ||
| </ul> | ||
| </li> | ||
| </ul> | ||
|
|
||
| </div> | ||
|
|
||
| <p tal:condition="breaches" | ||
| i18n:translate="linkintegrity_delete_anyway" | ||
| > | ||
| Would you like to delete it anyway? | ||
| </p> | ||
|
|
||
| </div> | ||
|
|
||
| </div> | ||
|
|
||
| </body> | ||
| </html> |
58 changes: 58 additions & 0 deletions
58
src/plone/app/layout/controlpanels/templates/linkintegrity_update.pt
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,58 @@ | ||
| <html xmlns="http://www.w3.org/1999/xhtml" | ||
| xmlns:i18n="http://xml.zope.org/namespaces/i18n" | ||
| xmlns:metal="http://xml.zope.org/namespaces/metal" | ||
| xmlns:tal="http://xml.zope.org/namespaces/tal" | ||
| lang="en" | ||
| metal:use-macro="here/main_template/macros/master" | ||
| xml:lang="en" | ||
| tal:omit-tag="" | ||
| i18n:domain="plone" | ||
| > | ||
|
|
||
| <head> | ||
| <metal:block fill-slot="top_slot" | ||
| tal:define=" | ||
| dummy python:request.set('disable_border',1); | ||
| " | ||
| /> | ||
| </head> | ||
|
|
||
| <body> | ||
| <metal:main fill-slot="main"> | ||
|
|
||
| <h1 class="documentFirstHeading" | ||
| i18n:translate="linkintegrity_update_title" | ||
| >Update link integrity information</h1> | ||
|
|
||
| <div id="content-core"> | ||
|
|
||
| <p i18n:translate="linkintegrity_update_instructions"> | ||
| Clicking the below button will cause link integrity information to be | ||
| updated. This might take a while, especially for bigger sites... | ||
| </p> | ||
|
|
||
| <form action="updateLinkIntegrityInformation" | ||
| method="post" | ||
| tal:attributes=" | ||
| action request/URL; | ||
| " | ||
| > | ||
| <input class="destructive" | ||
| name="update" | ||
| type="submit" | ||
| value="Update" | ||
| i18n:attributes="value" | ||
| /> | ||
| <input class="standalone" | ||
| name="cancel" | ||
| type="submit" | ||
| value="Cancel" | ||
| i18n:attributes="value" | ||
| /> | ||
| </form> | ||
|
|
||
| </div> | ||
|
|
||
| </metal:main> | ||
| </body> | ||
| </html> |
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
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
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
Oops, something went wrong.
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.