def get_admin_menu(self, context, can_change, is_staff): """ Builds the 'admin menu' (the one with the cogwheel) """ admin_items = [ ListItem( 'admin', _('Site Administration'), reverse('admin:index'), icon=cms_static_url('images/toolbar/icons/icon_admin.png')), ] if can_change and self.request.current_page: admin_items.append( ListItem( 'settings', _('Page Settings'), _get_page_admin_url, icon=cms_static_url('images/toolbar/icons/icon_page.png'))) if 'reversion' in settings.INSTALLED_APPS: admin_items.append( ListItem('history', _('View History'), _get_page_history_url, icon=cms_static_url( 'images/toolbar/icons/icon_history.png'))) return List(RIGHT, 'admin', _('Admin'), cms_static_url('images/toolbar/icons/icon_admin.png'), items=admin_items)
def get_page_menu(self, context, can_change, is_staff): """ Builds the 'page menu' """ menu_items = [ ListItem('overview', _('Move/add Pages'), reverse('admin:cms_page_changelist'), icon=cms_static_url('images/toolbar/icons/icon_sitemap.png')), ] menu_items.append( ListItem('addchild', _('Add child page'), _get_add_child_url, icon=cms_static_url('images/toolbar/icons/icon_child.png')) ) menu_items.append( ListItem('addsibling', _('Add sibling page'), _get_add_sibling_url, icon=cms_static_url('images/toolbar/icons/icon_sibling.png')) ) menu_items.append( ListItem('delete', _('Delete Page'), _get_delete_url, icon=cms_static_url('images/toolbar/icons/icon_delete.png')) ) return List(RIGHT, 'page', _('Page'), cms_static_url('images/toolbar/icons/icon_page.png'), items=menu_items)
def get_template_menu(self, context, can_change, is_staff): menu_items = [] page = self.request.current_page.get_draft_object() url = reverse('admin:cms_page_change_template', args=(page.pk, )) for path, name in get_cms_setting('TEMPLATES'): args = urllib.urlencode({'template': path}) css = 'template' if page.get_template() == path: css += ' active' menu_items.append( ListItem(css, name, '%s?%s' % (url, args), 'POST'), ) return List(RIGHT, 'templates', _('Template'), '', items=menu_items)