Commit eec9a477 authored by Hanno Schlichting's avatar Hanno Schlichting

Remove `Control_Panel/DavLocks`.

parent dd08c570
......@@ -21,7 +21,7 @@ Features Added
Restructuring
+++++++++++++
- Remove `Control_Panel/DebugInfo`.
- Remove `Control_Panel` `/DebugInfo` and `/DavLocks`.
- Remove profiling support via `publisher-profile-file` directive.
......
......@@ -23,7 +23,6 @@ from AccessControl.requestmethod import requestmethod
from Acquisition import Implicit
from App.CacheManager import CacheManager
from App.config import getConfiguration
from App.DavLockManager import DavLockManager
from App.special_dtml import DTMLFile
from App.version_txt import version_txt
from OFS.Folder import Folder
......@@ -128,7 +127,6 @@ class ApplicationManager(Folder, CacheManager):
__roles__ = ('Manager',)
isPrincipiaFolderish = 1
Database = DatabaseChooser('Database') # DatabaseManager()
DavLocks = DavLockManager()
manage = manage_main = DTMLFile('dtml/cpContents', globals())
manage_main._setName('manage_main')
......@@ -136,8 +134,6 @@ class ApplicationManager(Folder, CacheManager):
_objects = (
{'id': 'Database',
'meta_type': Database.meta_type},
{'id': 'DavLocks',
'meta_type': DavLocks.meta_type},
)
manage_options = ({'label': 'Control Panel', 'action': 'manage_main'}, )
......
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
from AccessControl.class_init import InitializeClass
from AccessControl.SecurityInfo import ClassSecurityInfo
from Acquisition import aq_base
from Acquisition import Implicit
from App.special_dtml import DTMLFile
from OFS.SimpleItem import Item
from webdav.Lockable import wl_isLocked
class DavLockManager(Item, Implicit):
id = 'DavLockManager'
name = title = 'WebDAV Lock Manager'
meta_type = 'WebDAV Lock Manager'
security = ClassSecurityInfo()
security.declareProtected('Manage WebDAV Locks',
'findLockedObjects', 'manage_davlocks',
'manage_unlockObjects')
security.declarePrivate('unlockObjects')
manage_davlocks = manage_main = manage = DTMLFile(
'dtml/davLockManager', globals())
manage_davlocks._setName('manage_davlocks')
manage_options = ({'label': 'Write Locks', 'action': 'manage_main'}, )
def findLockedObjects(self, frompath=''):
app = self.getPhysicalRoot()
if frompath:
if frompath[0] == '/':
frompath = frompath[1:]
# since the above will turn '/' into an empty string, check
# for truth before chopping a final slash
if frompath and frompath[-1] == '/':
frompath= frompath[:-1]
# Now we traverse to the node specified in the 'frompath' if
# the user chose to filter the search, and run a ZopeFind with
# the expression 'wl_isLocked()' to find locked objects.
obj = app.unrestrictedTraverse(frompath)
lockedobjs = self._findapply(obj, path=frompath)
return lockedobjs
def unlockObjects(self, paths=[]):
app = self.getPhysicalRoot()
for path in paths:
ob = app.unrestrictedTraverse(path)
ob.wl_clearLocks()
def manage_unlockObjects(self, paths=[], REQUEST=None):
" Management screen action to unlock objects. "
if paths:
self.unlockObjects(paths)
if REQUEST is not None:
m = '%s objects unlocked.' % len(paths)
return self.manage_davlocks(self, REQUEST, manage_tabs_message=m)
def _findapply(self, obj, result=None, path=''):
# recursive function to actually dig through and find the locked
# objects.
if result is None:
result = []
base = aq_base(obj)
if not hasattr(base, 'objectItems'):
return result
try:
items = obj.objectItems()
except Exception:
return result
addresult = result.append
for id, ob in items:
if path:
p = '%s/%s' % (path, id)
else:
p = id
dflag = hasattr(ob, '_p_changed') and (ob._p_changed == None)
bs = aq_base(ob)
if wl_isLocked(ob):
li = []
addlockinfo = li.append
for token, lock in ob.wl_lockItems():
addlockinfo({'owner': lock.getCreatorPath(),
'token': token})
addresult((p, li))
dflag = 0
if hasattr(bs, 'objectItems'):
self._findapply(ob, result, p)
if dflag:
ob._p_deactivate()
return result
InitializeClass(DavLockManager)
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<script type="text/javascript">
<!--
isSelected = false;
function toggleSelect() {
if (isSelected == false) {
for (i = 0; i < document.objectItems.length; i++)
document.objectItems.elements[i].checked = true ;
isSelected = true;
document.objectItems.selectButton.value = "Deselect All";
return isSelected;
}
else {
for (i = 0; i < document.objectItems.length; i++)
document.objectItems.elements[i].checked = false ;
isSelected = false;
document.objectItems.selectButton.value = "Select All";
return isSelected;
}
}
//-->
</script>
<dtml-let from_path="REQUEST.form.get('frompath',None)"
lockedobjs="from_path and findLockedObjects(frompath=from_path) or []">
<dtml-if lockedobjs>
<p class="std-text">All locked objects
<dtml-if frompath>from path <em>&dtml-frompath;</em></dtml-if>
are listed below.</p>
<dtml-else>
<p class="std-text">No locked objects
<dtml-if frompath>from path <em>&dtml-frompath;</em></dtml-if>
were found.</p>
</dtml-if>
<form action="&dtml-URL0;" name="finderform">
<p class="std-text">Search for locked objects starting from path:
<input type="text" size="14" name="frompath" value="&dtml.missing-frompath;"
class="form-element" />
<input type="submit" value="Go" class="form-element" />
</p>
</form>
<form action="manage_unlockObjects" name="objectItems" method="post">
<dtml-if lockedobjs>
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr class="list-header">
<td width="60%" class="list-item">Locked Item</td>
<td width="40%" class="list-item">Lock Info</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<dtml-in lockedobjs>
<dtml-if sequence-odd>
<tr class="row-normal">
<dtml-else>
<tr class="row-hilite">
</dtml-if sequence-odd>
<td align="left" valign="top" width="16">
<input type="checkbox" name="paths:list" value="&dtml-sequence-key;"
id="cb_&dtml-sequence-index;" />
</td>
<td align="left" valign="top" width="16">
</td>
<td align="left" valign="top" class="list-item">
<label for="cb_&dtml-sequence-index;">&dtml-sequence-key;</label>
</td>
<td align="left" valign="top" width="40%" class="list-item">
<dtml-in sequence-item mapping>
<strong>Owner:</strong> &dtml-owner;,
<strong>Token:</strong> &dtml-token;<br />
</dtml-in>
</td>
</tr>
</dtml-in lockedobjs>
</table>
<input type="hidden" name="frompath" value="&dtml.missing-frompath;" />
<script type="text/javascript">
<!--
document.write('<input class="form-element" type="button" name="selectButton" value="Select All" onClick="toggleSelect(); return false">')
//-->
</script>
&nbsp; <input class="form-element" type="submit" value="Unlock objects" />
</dtml-if>
</form>
</dtml-let>
<dtml-var manage_page_footer>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment