Commit cab094bb authored by Hanno Schlichting's avatar Hanno Schlichting

Remove ZMI copy/cut/paste and re-ordering features.

parent 670a68ea
......@@ -30,6 +30,8 @@ Features Added
Restructuring
+++++++++++++
- Remove ZMI copy/cut/paste and re-ordering features.
- Drop `OFS.History` functionality.
- Removed ZMI export/import feature.
......
......@@ -159,7 +159,6 @@ class FactoryDispatcher(Implicit):
def manage_main(trueself, self, REQUEST, update_menu=0):
"""Implement a contents view by redirecting to the true view
"""
d = update_menu and '/manage_main?update_menu=1' or '/manage_main'
REQUEST['RESPONSE'].redirect(self.DestinationURL() + d)
REQUEST['RESPONSE'].redirect(self.DestinationURL() + '/manage_main')
InitializeClass(FactoryDispatcher)
......@@ -2,13 +2,6 @@
<html>
<head>
<title>Zope on &dtml-BASE0;</title>
<script type="text/javascript">
<!--
function update_menu() {
window.manage_menu.location.href=window.manage_menu.location.href;
}
//-->
</script>
</head>
<frameset cols="250, *">
......
......@@ -117,9 +117,6 @@ class CopyContainer(Base):
cp = (1, oblist)
cp = _cb_encode(cp)
if REQUEST is not None:
resp = REQUEST['RESPONSE']
resp.setCookie('__cp', cp, path='%s' % cookie_path(REQUEST))
REQUEST['__cp'] = cp
return self.manage_main(self, REQUEST)
return cp
......@@ -143,9 +140,6 @@ class CopyContainer(Base):
cp = (0, oblist)
cp = _cb_encode(cp)
if REQUEST is not None:
resp = REQUEST['RESPONSE']
resp.setCookie('__cp', cp, path='%s' % cookie_path(REQUEST))
REQUEST['__cp'] = cp
return self.manage_main(self, REQUEST)
return cp
......@@ -177,18 +171,13 @@ class CopyContainer(Base):
Also sends IObjectCopiedEvent and IObjectClonedEvent
or IObjectWillBeMovedEvent and IObjectMovedEvent.
"""
if cb_copy_data is not None:
cp = cb_copy_data
elif REQUEST is not None and '__cp' in REQUEST:
cp = REQUEST['__cp']
else:
cp = None
cp = cb_copy_data
if cp is None:
raise CopyError(eNoData)
try:
op, mdatas = _cb_decode(cp)
except:
except Exception:
raise CopyError(eInvalid)
oblist = []
......@@ -199,7 +188,7 @@ class CopyContainer(Base):
ob = m.bind(app)
except ConflictError:
raise
except:
except Exception:
raise CopyError(eNotFound)
self._verifyObjectPaste(ob, validate_src=op + 1)
oblist.append(ob)
......@@ -216,7 +205,7 @@ class CopyContainer(Base):
ob._notifyOfCopyTo(self, op=0)
except ConflictError:
raise
except:
except Exception:
raise CopyError(MessageDialog(
title="Copy Error",
message=sys.exc_info()[1],
......@@ -241,8 +230,7 @@ class CopyContainer(Base):
notify(ObjectClonedEvent(ob))
if REQUEST is not None:
return self.manage_main(self, REQUEST, update_menu=1,
cb_dataValid=1)
return self.manage_main(self, REQUEST)
elif op == 1:
# Move operation
......@@ -255,7 +243,7 @@ class CopyContainer(Base):
ob._notifyOfCopyTo(self, op=1)
except ConflictError:
raise
except:
except Exception:
raise CopyError(MessageDialog(
title="Move Error",
message=sys.exc_info()[1],
......@@ -308,13 +296,7 @@ class CopyContainer(Base):
ob.manage_changeOwnershipType(explicit=0)
if REQUEST is not None:
REQUEST['RESPONSE'].setCookie(
'__cp', 'deleted',
path='%s' % cookie_path(REQUEST),
expires='Wed, 31-Dec-97 23:59:59 GMT')
REQUEST['__cp'] = None
return self.manage_main(self, REQUEST, update_menu=1,
cb_dataValid=0)
return self.manage_main(self, REQUEST)
return result
......@@ -330,7 +312,7 @@ class CopyContainer(Base):
if ids[i] != new_ids[i]:
self.manage_renameObject(ids[i], new_ids[i], REQUEST)
if REQUEST is not None:
return self.manage_main(self, REQUEST, update_menu=1)
return self.manage_main(self, REQUEST)
return None
security.declareProtected(view_management_screens, 'manage_renameObject')
......@@ -339,7 +321,7 @@ class CopyContainer(Base):
"""
try:
self._checkId(new_id)
except:
except Exception:
raise CopyError(MessageDialog(
title='Invalid Id',
message=sys.exc_info()[1],
......@@ -357,7 +339,7 @@ class CopyContainer(Base):
ob._notifyOfCopyTo(self, op=1)
except ConflictError:
raise
except:
except Exception:
raise CopyError(MessageDialog(
title="Rename Error",
message=sys.exc_info()[1],
......@@ -392,7 +374,7 @@ class CopyContainer(Base):
ob._postCopy(self, op=1)
if REQUEST is not None:
return self.manage_main(self, REQUEST, update_menu=1)
return self.manage_main(self, REQUEST)
return None
# Why did we give this a manage_ prefix if its really
......@@ -408,7 +390,7 @@ class CopyContainer(Base):
raise CopyError(eNotSupported % escape(ob.getId()))
try:
self._checkId(id)
except:
except Exception:
raise CopyError(MessageDialog(
title='Invalid Id',
message=sys.exc_info()[1],
......@@ -420,7 +402,7 @@ class CopyContainer(Base):
ob._notifyOfCopyTo(self, op=0)
except ConflictError:
raise
except:
except Exception:
raise CopyError(MessageDialog(
title="Clone Error",
message=sys.exc_info()[1],
......@@ -442,30 +424,6 @@ class CopyContainer(Base):
return ob
def cb_dataValid(self):
# Return true if clipboard data seems valid.
try:
_cb_decode(self.REQUEST['__cp'])
except Exception:
return 0
return 1
def cb_dataItems(self):
# List of objects in the clip board
try:
cp = _cb_decode(self.REQUEST['__cp'])
except Exception:
return []
oblist = []
app = self.getPhysicalRoot()
for mdata in cp[1]:
m = loadMoniker(mdata)
oblist.append(m.bind(app))
return oblist
validClipData = cb_dataValid
def _verifyObjectPaste(self, object, validate_src=1):
# Verify whether the current user is allowed to paste the
# passed object into self. This is determined by checking
......@@ -511,7 +469,7 @@ class CopyContainer(Base):
# clipboard.
try:
parent = aq_parent(aq_inner(object))
except:
except Exception:
parent = None
if not sm.validate(None, parent, None, object):
......@@ -658,12 +616,6 @@ def _cb_decode(s, maxsize=8192):
return loads(data)
def cookie_path(request):
# Return a "path" value for use in a cookie that refers
# to the root of the Zope object space.
return request['BASEPATH1'] or "/"
fMessageDialog = HTML("""
<HTML>
<HEAD>
......
......@@ -47,7 +47,7 @@ def manage_addFolder(self, id, title='',
self._setObject(id, ob)
ob = self._getOb(id)
if REQUEST is not None:
return self.manage_main(self, REQUEST, update_menu=1)
return self.manage_main(self, REQUEST)
class Folder(
......
......@@ -549,7 +549,7 @@ class ObjectManager(CopyContainer,
self._delObject(id)
del ids[-1]
if REQUEST is not None:
return self.manage_main(self, REQUEST, update_menu=1)
return self.manage_main(self, REQUEST)
security.declareProtected(access_contents_information, 'tpValues')
def tpValues(self):
......
......@@ -65,8 +65,8 @@ class OrderSupport(object):
message = 'Error: %s' % (errmsg)
else:
message = 'Error: No items were specified!'
return self.manage_main(self, REQUEST, skey='position',
manage_tabs_message=message, update_menu=1)
return self.manage_main(self, REQUEST,
manage_tabs_message=message)
security.declareProtected(manage_properties, 'manage_move_objects_down')
def manage_move_objects_down(self, REQUEST, ids=None, delta=1):
......@@ -81,8 +81,8 @@ class OrderSupport(object):
message = 'Error: %s' % (errmsg)
else:
message = 'Error: No items were specified!'
return self.manage_main(self, REQUEST, skey='position',
manage_tabs_message=message, update_menu=1)
return self.manage_main(self, REQUEST,
manage_tabs_message=message)
security.declareProtected(manage_properties, 'manage_move_objects_to_top')
def manage_move_objects_to_top(self, REQUEST, ids=None):
......@@ -97,8 +97,8 @@ class OrderSupport(object):
message = 'Error: %s' % (errmsg)
else:
message = 'Error: No items were specified!'
return self.manage_main(self, REQUEST, skey='position',
manage_tabs_message=message, update_menu=1)
return self.manage_main(self, REQUEST,
manage_tabs_message=message)
security.declareProtected(
manage_properties, 'manage_move_objects_to_bottom')
......@@ -114,15 +114,15 @@ class OrderSupport(object):
message = 'Error: %s' % (errmsg)
else:
message = 'Error: No items were specified!'
return self.manage_main(self, REQUEST, skey='position',
manage_tabs_message=message, update_menu=1)
return self.manage_main(self, REQUEST,
manage_tabs_message=message)
security.declareProtected(manage_properties, 'manage_set_default_sorting')
def manage_set_default_sorting(self, REQUEST, key, reverse):
""" Set default sorting key and direction.
"""
self.setDefaultSorting(key, reverse)
return self.manage_main(self, REQUEST, update_menu=1)
return self.manage_main(self, REQUEST)
security.declareProtected(manage_properties, 'moveObjectsByDelta')
def moveObjectsByDelta(self, ids, delta, subset_ids=None,
......
......@@ -32,7 +32,7 @@ def manage_addOrderedFolder(self, id, title='', createPublic=0, createUserF=0,
self._setObject(id, ob)
ob = self._getOb(id)
if REQUEST:
return self.manage_main(self, REQUEST, update_menu=1)
return self.manage_main(self, REQUEST)
class OrderedFolder(OrderSupport, Folder):
......
<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>
<form action="&dtml-URL1;" name="objectItems" method="POST">
<dtml-if show_results>
......@@ -62,13 +37,6 @@ are shown.
<div class="form-element">
<input type="submit" name="ZCacheManager_setAssociations:method"
value="Save Changes">
<script type="text/javascript">
<!--
if (document.forms[0]) {
document.write('<input class="form-element" type="submit" name="selectButton" value="Select All" onClick="toggleSelect(); return false">')
}
//-->
</script>
</div>
</td>
</tr>
......@@ -142,4 +110,3 @@ Search subfolders
</form>
<dtml-var manage_page_footer>
<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>
<!-- Add object widget -->
<br />
<dtml-if filtered_meta_types>
......@@ -61,47 +36,21 @@ function toggleSelect() {
<form action="<dtml-var "REQUEST.URL1" html_quote>/" name="objectItems" method="post">
<dtml-if objectItems>
<dtml-let hasOrderSupport="_.getattr(this().aq_explicit, 'has_order_support', 0)">
<dtml-unless skey>
<dtml-if hasOrderSupport>
<dtml-call expr="REQUEST.set('skey', getDefaultSorting()[0])">
<dtml-call expr="REQUEST.set('rkey', getDefaultSorting()[1])">
<dtml-else>
<dtml-call expr="REQUEST.set('skey', 'id')">
</dtml-if>
</dtml-unless>
<dtml-unless rkey><dtml-call expr="REQUEST.set('rkey', '')"></dtml-unless>
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr class="list-header">
<td width="5%" align="right" colspan="2"><div
class="list-item"><a href="./manage_main?skey=meta_type<dtml-if
"skey == 'meta_type' and not rkey">&amp;rkey=meta_type</dtml-if>"><dtml-if
"skey == 'meta_type' or rkey == 'meta_type'"
><strong>Type</strong><dtml-else>Type</dtml-if></a></div>
</td>
<td width="50%" align="left"><div class="list-item"><a
href="./manage_main?skey=id<dtml-if
"skey == 'id' and not rkey">&amp;rkey=id</dtml-if>"><dtml-if
"skey == 'id' or rkey == 'id'"
><strong>Name</strong><dtml-else>Name</dtml-if></a></div>
<td width="5%" align="right" colspan="2">
<div class="list-item">Type</div>
</td>
<td width="15%" align="left"><div class="list-item"><a
href="./manage_main?skey=get_size<dtml-if
"skey == 'get_size' and not rkey">&amp;rkey=get_size</dtml-if>"><dtml-if
"skey == 'get_size' or rkey == 'get_size'"
><strong>Size</strong><dtml-else>Size</dtml-if></a></div>
<td width="50%" align="left">
<div class="list-item">Name</div>
</td>
<dtml-if hasOrderSupport>
<td width="10%" align="left"><div class="list-item"><a
href="./manage_main?skey=position"><dtml-if
"skey == 'position'"
><strong>Position</strong><dtml-else>Position</dtml-if></a></div>
<td width="15%" align="left">
<div class="list-item">Size</div>
</td>
</dtml-if>
</tr>
<dtml-in objectItems sort_expr="skey+'/cmp/asc'" reverse_expr="rkey">
<dtml-in objectItems>
<dtml-if sequence-odd>
<tr class="row-normal">
<dtml-else>
......@@ -151,18 +100,6 @@ function toggleSelect() {
</div>
</td>
</dtml-with>
<dtml-if hasOrderSupport>
<td>
<div class="list-item">
<dtml-if "skey == 'position'">
<dtml-var sequence-number>
<dtml-else>
...
</dtml-if>
</div>
</td>
</dtml-if>
</tr>
</dtml-in>
</table>
......@@ -172,74 +109,15 @@ function toggleSelect() {
<td align="left" valign="top" width="16"></td>
<td align="left" valign="top">
<div class="form-element">
<dtml-unless dontAllowCopyAndPaste>
<input class="form-element" type="submit" name="manage_renameForm:method"
value="Rename" />
<dtml-if "_.SecurityCheckPermission('Delete objects',this())">
<input class="form-element" type="submit" name="manage_cutObjects:method"
value="Cut" />
</dtml-if>
<input class="form-element" type="submit" name="manage_copyObjects:method"
value="Copy" />
<dtml-if cb_dataValid>
<input class="form-element" type="submit" name="manage_pasteObjects:method"
value="Paste" />
</dtml-if>
</dtml-unless>
<dtml-if "_.SecurityCheckPermission('Delete objects',this())">
<input class="form-element" type="submit" name="manage_delObjects:method"
value="Delete" />
</dtml-if>
<script type="text/javascript">
<!--
if (document.forms[0]) {
document.write('<input class="form-element" type="submit" name="selectButton" value="Select All" onclick="toggleSelect(); return false">')
}
//-->
</script>
</div>
</td>
</tr>
<dtml-if "hasOrderSupport and
_.SecurityCheckPermission( 'Manage properties', this() )">
<tr>
<td align="left" valign="top" width="16"></td>
<td align="left" valign="top">
<div class="form-element">
<dtml-if expr="skey == 'position' and _.len(objectItems) > 1">
<input class="form-element" type="submit"
name="manage_move_objects_up:method" value="Up" />
/
<input class="form-element" type="submit"
name="manage_move_objects_down:method" value="Down" />
by
<select name="delta:int">
<dtml-in "_.range(1,_.min(5,_.len(objectIds())))">
<option>&dtml-sequence-item;</option>
</dtml-in>
<dtml-in "_.range(5,_.len(objectIds()),5)">
<option>&dtml-sequence-item;</option>
</dtml-in>
</select>
<input class="form-element" type="submit"
name="manage_move_objects_to_top:method" value="Top" />
<input class="form-element" type="submit"
name="manage_move_objects_to_bottom:method" value="Bottom" />
</dtml-if>
<dtml-unless expr="(skey, rkey and 1 or 0) == getDefaultSorting()">
<input type="hidden" name="key" value="&dtml-skey;">
<input type="hidden" name="reverse" value="&dtml-rkey;">
<input class="form-element" type="submit"
name="manage_set_default_sorting:method"
value="Set View as Default" />
</dtml-unless>
</div>
</td>
</tr>
</dtml-if>
</table>
</dtml-let>
<dtml-else>
<table cellspacing="0" cellpadding="2" border="0">
<tr>
......@@ -248,26 +126,10 @@ if (document.forms[0]) {
There are currently no items in <em>&dtml-title_or_id;</em>
<br /><br />
</div>
<dtml-unless dontAllowCopyAndPaste>
<dtml-if cb_dataValid>
<div class="form-element">
<input class="form-element" type="submit" name="manage_pasteObjects:method"
value="Paste" />
</div>
</dtml-if>
</dtml-unless>
</td>
</tr>
</table>
</dtml-if>
</form>
<dtml-if update_menu>
<script type="text/javascript">
<!--
window.parent.update_menu();
//-->
</script>
</dtml-if>
<dtml-var manage_page_footer>
......@@ -609,14 +609,6 @@ class ICopyContainer(Interface):
"""Clone an object, creating a new object with the given id.
"""
def cb_dataValid():
"""Return true if clipboard data seems valid.
"""
def cb_dataItems():
"""List of objects in the clip board.
"""
def _verifyObjectPaste(object, validate_src=1):
"""Verify whether the current user is allowed to paste the passed
object into self. This is determined by checking to see if the
......
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