Exemplo n.º 1
0
 def __call__(self):
     context = self.context
     title = safe_unicode(context.title_or_id())
     if not has_permission('Copy or Move', context):
         msg = _(u'Permission denied to cut ${title}.',
                 mapping={u'title': title})
         msg = self.context.translate(msg)
         raise Unauthorized, msg
     try:
         lock_info = context.restrictedTraverse('plone_lock_info')
     except AttributeError:
         lock_info = None
     if lock_info is not None and lock_info.is_locked():
         msg = _(u'${title} is locked and cannot be cut.',
                 mapping={u'title': title})
         msg = self.context.translate(msg)
         raise Exception, msg
     parent = aq_parent(aq_inner(context))
     try:
         parent.manage_cutObjects(context.getId(), self.request)
     except CopyError:
         msg = _(u'${title} is not moveable.',
                 mapping={u'title': title})
         msg = self.context.translate(msg)
         raise Exception, msg
     self.request.response.setCookie('__fct', self.context.UID(), path='/')
     msg = _(u'${title} cut.', mapping={u'title': title})
     msg = self.context.translate(msg)
     transaction_note('Cut object %s' % context.absolute_url())
     return msg, None
Exemplo n.º 2
0
 def enabled(self):
     uid = self._uid
     # if control panel or addons uid, disable edit
     if uid in [CP_UID, ADDONS_UID]:
         return False
     # if control panel item uid, disable
     cp_item = ControlPanelItems(self.context).item_by_id(uid)
     if cp_item:
         return False
     # check permission
     if not has_permission('Modify portal content', self.context):
         return False
     return True
Exemplo n.º 3
0
 def items(self):
     uid = self.request.get('uid', 'plone_content')
     ret = list()
     if self.request.getURL()[:-17] != self.context.absolute_url():
         uid = 'plone_content'
     items = [
         ('plone_content', _('Content'), 'logoIcon.png'),
     ]
     if has_permission('Manage portal', self.context):
         items += [
             ('plone_control_panel', _('Control Panel'), 'site_icon.png'),
             ('plone_addons', _('Addon Configuration'), 'product_icon.png'),
         ]
     for id, title, icon in items:
         ret.append(nav_item(item_id(id),
                             icon,
                             title,
                             True,
                             uid == id and True or False))
     return ret
Exemplo n.º 4
0
 def __call__(self):
     context = self.context
     title = safe_unicode(context.title_or_id())
     if not has_permission('Copy or Move', context):
         msg = _(u'Permission denied to copy ${title}.',
                 mapping={u'title': title})
         msg = self.context.translate(msg)
         raise Unauthorized, msg
     parent = aq_parent(aq_inner(context))
     try:
         parent.manage_copyObjects(context.getId(), self.request)
     except CopyError:
         msg = _(u'${title} is not copyable.',
                 mapping={u'title': title})
         msg = self.context.translate(msg)
         raise Exception, msg
     msg = _(u'${title} copied.',
             mapping={u'title': title})
     msg = self.context.translate(msg)
     transaction_note('Copied object %s' % context.absolute_url())
     return msg, None
Exemplo n.º 5
0
 def enabled(self):
     if not has_permission('Delete objects', self.context):
         return False
     return True
Exemplo n.º 6
0
 def enabled(self):
     if not has_permission('Add portal content', self.context):
         return False
     if self.context.cb_dataValid:
         return True
     return False
Exemplo n.º 7
0
 def enabled(self):
     if not has_permission('Copy or Move', self.context):
         return False
     return True