Beispiel #1
0
 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_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)
Beispiel #3
0
 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)
Beispiel #4
0
 def _media(self):
     media = super(TinyMCEEditor, self)._media()
     media.add_js([cms_static_url(path) for path in (
             'js/plugins/admincompat.js',
             )])
     media.add_css({"all": [cms_static_url(path) for path in (
             'css/jquery/cupertino/jquery-ui.css',
             'css/tinymce_toolbar.css')]})
     return media
Beispiel #5
0
 class Media:
     js = [cms_static_url(path) for path in (
         'js/libs/jquery.ui.core.js',
         'js/libs/jquery.ui.sortable.js',
         'js/plugin_editor.js',
     )]
     css = {
         'all': [cms_static_url(path) for path in (
             'css/plugin_editor.css',
         )]
     }
Beispiel #6
0
 def _media(self):
     media = super(TinyMCEEditor, self)._media()
     media.add_js(
         [cms_static_url(path) for path in ('js/plugins/admincompat.js', )])
     media.add_css({
         "all": [
             cms_static_url(path)
             for path in ('css/jquery/cupertino/jquery-ui.css',
                          'css/tinymce_toolbar.css')
         ]
     })
     return media
Beispiel #7
0
 class Media:
     js = [cms_static_url(path) for path in (
         'wymeditor/jquery.wymeditor.js',
         'wymeditor/plugins/resizable/jquery.wymeditor.resizable.js',
         'js/wymeditor.placeholdereditor.js',
         'js/libs/jquery.ui.core.js',
         'js/placeholder_editor_registry.js',
     )]
     css = {
         'all': [cms_static_url(path) for path in (
                     'css/jquery/cupertino/jquery-ui.css',
                 )],
     }
Beispiel #8
0
 def _media(self):
     media = super(TinyMCEEditor, self)._media()
     media.add_js([cms_static_url(path) for path in (
       'js/tinymce.placeholdereditor.js',
       'js/libs/jquery.ui.core.js',
       'js/placeholder_editor_registry.js',
     )])
     media.add_css({
         "all": [
             cms_static_url(path) for path in ('css/jquery/cupertino/jquery-ui.css',
                                               'css/tinymce_toolbar.css')
         ]
     })
     
     return media
Beispiel #9
0
 class Media:
     js = [
         # '/static/jquery/jquery.min.js',
         settings.ADMIN_MEDIA_PREFIX + 'js/jquery.min.js',
         cms_static_url('js/libs/jquery.ui.core.js'),
     ]
     css = {'all': ('/static/jquery/themes/base/ui.all.css', )}
Beispiel #10
0
 class Media:
     js = [
         cms_static_url('js/libs/jquery.ui.core.js'),
     ]
     css = {
         'all': ('/static/jquery/themes/base/ui.all.css',)
     }
Beispiel #11
0
 class Media:
     js = [
         settings.ADMIN_MEDIA_PREFIX + 'js/jquery.min.js',
         cms_static_url('js/libs/jquery.ui.core.js'),
         settings.CMS_MEDIA_URL + 'js/placeholder_editor_registry.js',
         'combobox/ui.combobox.js',
     ]
     css = {'all': ['combobox/ui.combobox.css']}
Beispiel #12
0
 class Media:
     js = [
         cms_static_url(path) for path in (
             'js/plugins/admincompat.js',
             'wymeditor/jquery.wymeditor.js',
             'wymeditor/plugins/resizable/jquery.wymeditor.resizable.js',
         )
     ]
Beispiel #13
0
    def _media(self):
        media = super(TinyMCEEditor, self)._media()
        media.add_js([
            cms_static_url(path) for path in (
                'js/tinymce.placeholdereditor.js',
                'js/libs/jquery.ui.core.js',
                'js/placeholder_editor_registry.js',
            )
        ])
        media.add_css({
            "all": [
                cms_static_url(path)
                for path in ('css/jquery/cupertino/jquery-ui.css',
                             'css/tinymce_toolbar.css')
            ]
        })

        return media
Beispiel #14
0
 class Media:
     css = {
         'all': [cms_static_url(path) for path in (
             'css/rte.css',
             'css/pages.css',
             'css/change_form.css',
             'css/jquery.dialog.css',
             'css/plugin_editor.css',
         )]
     }
     js = ['%sjs/jquery.min.js' % settings.ADMIN_MEDIA_PREFIX] + [cms_static_url(path) for path in [
             'js/plugins/admincompat.js',
             'js/csrf.js',
             'js/libs/jquery.query.js',
             'js/libs/jquery.ui.core.js',
             'js/libs/jquery.ui.dialog.js',
         ]
     ]
Beispiel #15
0
 def media(self):
     js = [cms_static_url(path) for path in (
         'js/libs/jquery.ui.core.js',
         'js/libs/jquery.ui.sortable.js',
         )]
     media = super(ImageInline, self).media
     if js[-1] not in media._js:
         ix = media._js.index(INLINE_ORDERING_JS)
         media._js[ix:ix] = js
     return media
Beispiel #16
0
 class Media:
     css = {
         'all': [
             cms_static_url(path) for path in (
                 'css/rte.css',
                 'css/change_form.css',
                 'css/jquery.dialog.css',
                 'css/plugin_editor.css',
             )
         ]
     }
     js = [
         cms_static_url(path) for path in [
             'js/plugins/admincompat.js',
             'js/csrf.js',
             'js/libs/jquery.query.js',
             'js/libs/jquery.ui.core.js',
             'js/libs/jquery.ui.dialog.js',
         ]
     ]
Beispiel #17
0
    def get_items(self, context, **kwargs):
        """
        Get the CMS items on the toolbar
        """
        items = [
            Anchor(LEFT, 'logo', _('django CMS'), 'https://www.django-cms.org'),
        ]

        self.page_states = []

        # Store access property values to avoid having to recompute them
        is_staff = self.is_staff
        can_change = self.can_change
        edit_mode = self.edit_mode

        if can_change:
            items.append(
                self.edit_mode_switcher
            )

        if is_staff:

            current_page = self.request.current_page

            if current_page:
                # publish button
                if edit_mode:
                    if current_page.has_publish_permission(self.request):
                        items.append(
                            GetButton(RIGHT, 'moderator', _("Publish"), _get_publish_url)
                        )
                    if self.revert_button.is_enabled_for(self.request):
                        items.append(self.revert_button)

                # The 'templates' Menu
                if can_change:
                    items.append(self.get_template_menu(context, can_change, is_staff))

                # The 'page' Menu
                items.append(self.get_page_menu(context, can_change, is_staff))

            # The 'Admin' Menu
            items.append(self.get_admin_menu(context, can_change, is_staff))

        if not self.request.user.is_authenticated():
            items.append(
                TemplateHTML(LEFT, 'login', 'cms/toolbar/items/login.html')
            )
        else:
            items.append(
                GetButton(RIGHT, 'logout', _('Logout'), '?cms-toolbar-logout',
                          cms_static_url('images/toolbar/icons/icon_lock.png'))
            )
        return items
Beispiel #18
0
    def get_items(self, context, **kwargs):
        """
        Get the CMS items on the toolbar
        """
        items = [
            Anchor(LEFT, 'logo', _('django CMS'),
                   'https://www.django-cms.org'),
        ]

        self.page_states = []

        # Store access property values to avoid having to recompute them
        is_staff = self.is_staff
        can_change = self.can_change
        edit_mode = self.edit_mode

        if can_change:
            items.append(self.edit_mode_switcher)

        if is_staff:

            current_page = self.request.current_page

            if current_page:
                # publish button
                if edit_mode:
                    if current_page.has_publish_permission(self.request):
                        items.append(
                            GetButton(RIGHT, 'moderator', _("Publish"),
                                      _get_publish_url))
                    if self.revert_button.is_enabled_for(self.request):
                        items.append(self.revert_button)

                # The 'templates' Menu
                if can_change:
                    items.append(
                        self.get_template_menu(context, can_change, is_staff))

                # The 'page' Menu
                items.append(self.get_page_menu(context, can_change, is_staff))

            # The 'Admin' Menu
            items.append(self.get_admin_menu(context, can_change, is_staff))

        if not self.request.user.is_authenticated():
            items.append(
                TemplateHTML(LEFT, 'login', 'cms/toolbar/items/login.html'))
        else:
            items.append(
                GetButton(
                    RIGHT, 'logout', _('Logout'), '?cms-toolbar-logout',
                    cms_static_url('images/toolbar/icons/icon_lock.png')))
        return items
Beispiel #19
0
 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:
         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)
Beispiel #20
0
    def get_items(self, context, **kwargs):
        """
        Get the CMS items on the toolbar
        """
        items = [
            Anchor(LEFT, 'logo', _('django CMS'),
                   'https://www.django-cms.org'),
        ]

        self.page_states = []

        if self.is_staff:

            items.append(self.edit_mode_switcher)

            if self.request.current_page:
                states = self.request.current_page.last_page_states()
                has_states = states.exists()
                self.page_states = states
                if has_states:
                    items.append(
                        TemplateHTML(LEFT, 'status',
                                     'cms/toolbar/items/status.html'))

                # publish button
                if self.edit_mode and settings.CMS_MODERATOR:
                    moderator_state = page_moderator_state(
                        self.request, self.request.current_page)
                    should_approve = moderator_state['state'] >= I_APPROVE
                    has_perms = self.request.current_page.has_moderate_permission(
                        self.request)
                    if should_approve and has_perms:
                        label = moderator_state['label']
                        urlgetter = _get_approve_url
                    elif has_perms:
                        label = _("Publish")
                        urlgetter = _get_publish_url
                    else:
                        urlgetter = _get_approve_url
                        label = _("Request Approval")
                    items.append(
                        GetButton(RIGHT, 'moderator', label, urlgetter))

                # The 'templates' Menu
                items.append(
                    self.get_template_menu(context, self.can_change,
                                           self.is_staff))

                # The 'page' Menu
                items.append(
                    self.get_page_menu(context, self.can_change,
                                       self.is_staff))

            # The 'Admin' Menu
            items.append(
                self.get_admin_menu(context, self.can_change, self.is_staff))

            items.append(
                GetButton(
                    RIGHT, 'logout', _('Logout'), '?cms-toolbar-logout',
                    cms_static_url('images/toolbar/icons/icon_lock.png')))
        elif not self.request.user.is_authenticated():
            items.append(
                TemplateHTML(LEFT, 'login', 'cms/toolbar/items/login.html'))
        else:
            items.append(
                GetButton(
                    RIGHT, 'logout', _('Logout'), '?cms-toolbar-logout',
                    cms_static_url('images/toolbar/icons/icon_lock.png')))
        return items
Beispiel #21
0
 def get_items(self, context, **kwargs):
     """
     Get the CMS items on the toolbar
     """
     items = [
         Anchor(LEFT, 'logo', _('django CMS'), 'https://www.django-cms.org'),
     ]
     
     self.page_states = []
     
     
     if self.is_staff:
         
         items.append(
             self.edit_mode_switcher
         )
         
         if self.request.current_page:
             states = self.request.current_page.last_page_states()
             has_states = states.exists()
             self.page_states = states
             if has_states:
                 items.append(
                     TemplateHTML(LEFT, 'status',
                                  'cms/toolbar/items/status.html')
                 )
             
             # publish button
             if self.edit_mode and settings.CMS_MODERATOR:
                 moderator_state = page_moderator_state(self.request, self.request.current_page)
                 should_approve = moderator_state['state'] >= I_APPROVE
                 has_perms = self.request.current_page.has_moderate_permission(self.request)
                 if should_approve and has_perms:
                     label = moderator_state['label']
                     urlgetter = _get_approve_url
                 elif has_perms:
                     label = _("Publish")
                     urlgetter = _get_publish_url
                 else:
                     urlgetter = _get_approve_url
                     label = _("Request Approval")
                 items.append(
                     GetButton(RIGHT, 'moderator', label, urlgetter)
                 )
         
             # The 'templates' Menu
             items.append(self.get_template_menu(context, self.can_change, self.is_staff))
             
             # The 'page' Menu
             items.append(self.get_page_menu(context, self.can_change, self.is_staff))
         
         # The 'Admin' Menu
         items.append(self.get_admin_menu(context, self.can_change, self.is_staff))
         
         items.append(
             GetButton(RIGHT, 'logout', _('Logout'), '?cms-toolbar-logout',
                       cms_static_url('images/toolbar/icons/icon_lock.png'))
         )
     elif not self.request.user.is_authenticated():
         items.append(
             TemplateHTML(LEFT, 'login', 'cms/toolbar/items/login.html')
         )
     else:
         items.append(
             GetButton(RIGHT, 'logout', _('Logout'), '?cms-toolbar-logout',
                       cms_static_url('images/toolbar/icons/icon_lock.png'))
         )
     return items
    "{'name': 'H1', 'title': 'Heading_1', 'css': 'wym_containers_h1'}",
    "{'name': 'H2', 'title': 'Heading_2', 'css': 'wym_containers_h2'}",
    "{'name': 'H3', 'title': 'Heading_3', 'css': 'wym_containers_h3'}",
    "{'name': 'H4', 'title': 'Heading_4', 'css': 'wym_containers_h4'}",
    "{'name': 'H5', 'title': 'Heading_5', 'css': 'wym_containers_h5'}",
    "{'name': 'H6', 'title': 'Heading_6', 'css': 'wym_containers_h6'}",
    "{'name': 'PRE', 'title': 'Preformatted', 'css': 'wym_containers_pre'}",
    "{'name': 'BLOCKQUOTE', 'title': 'Blockquote', 'css': 'wym_containers_blockquote'}",
    "{'name': 'TH', 'title': 'Table_Header', 'css': 'wym_containers_th'}",
])

WYM_CONTAINERS = getattr(settings, "WYM_CONTAINERS", WYM_CONTAINERS)

WYM_CLASSES = ",\n".join([
    "{'name': 'date', 'title': 'PARA: Date', 'expr': 'p'}",
    "{'name': 'hidden-note', 'title': 'PARA: Hidden note', 'expr': 'p[@class!=\"important\"]'}",
])

WYM_STYLES = ",\n".join([
    "{'name': '.hidden-note', 'css': 'color: #999; border: 2px solid #ccc;'}",
    "{'name': '.date', 'css': 'background-color: #ff9; border: 2px solid #ee9;'}",
])

WYM_CLASSES = getattr(settings, "WYM_CLASSES", WYM_CLASSES)
WYM_STYLES = getattr(settings, "WYM_STYLES", WYM_STYLES)

#Advantageously replaces WYM_CLASSES and WYM_STYLES
##Prepare url for wymeditor.css
WYM_STYLESHEET = getattr(settings, "WYM_STYLESHEET",
                         '"%s"' % cms_static_url('css/wymeditor.css'))
Beispiel #23
0
    "{'name': 'P', 'title': 'Paragraph', 'css': 'wym_containers_p'}",
    "{'name': 'H1', 'title': 'Heading_1', 'css': 'wym_containers_h1'}",
    "{'name': 'H2', 'title': 'Heading_2', 'css': 'wym_containers_h2'}",
    "{'name': 'H3', 'title': 'Heading_3', 'css': 'wym_containers_h3'}",
    "{'name': 'H4', 'title': 'Heading_4', 'css': 'wym_containers_h4'}",
    "{'name': 'H5', 'title': 'Heading_5', 'css': 'wym_containers_h5'}",
    "{'name': 'H6', 'title': 'Heading_6', 'css': 'wym_containers_h6'}",
    "{'name': 'PRE', 'title': 'Preformatted', 'css': 'wym_containers_pre'}",
    "{'name': 'BLOCKQUOTE', 'title': 'Blockquote', 'css': 'wym_containers_blockquote'}",
    "{'name': 'TH', 'title': 'Table_Header', 'css': 'wym_containers_th'}",
])
    
WYM_CONTAINERS = getattr(settings, "WYM_CONTAINERS", WYM_CONTAINERS)

WYM_CLASSES = ",\n".join([
    "{'name': 'date', 'title': 'PARA: Date', 'expr': 'p'}",
    "{'name': 'hidden-note', 'title': 'PARA: Hidden note', 'expr': 'p[@class!=\"important\"]'}",
])
    
WYM_STYLES = ",\n".join([
    "{'name': '.hidden-note', 'css': 'color: #999; border: 2px solid #ccc;'}",
    "{'name': '.date', 'css': 'background-color: #ff9; border: 2px solid #ee9;'}",
])

WYM_CLASSES = getattr(settings, "WYM_CLASSES", WYM_CLASSES)
WYM_STYLES = getattr(settings, "WYM_STYLES", WYM_STYLES)

#Advantageously replaces WYM_CLASSES and WYM_STYLES
##Prepare url for wymeditor.css
WYM_STYLESHEET = getattr(settings, "WYM_STYLESHEET",  '"%s"' % cms_static_url('css/wymeditor.css'))
Beispiel #24
0
#-*- coding: utf-8 -*-

from django.conf import settings

STATICMEDIA_PREFIX = getattr(settings, 'WIDGETRY_STATICMEDIA_PREFIX', None)
if not STATICMEDIA_PREFIX:
    STATICMEDIA_PREFIX = (getattr(settings,'STATIC_URL', None) or settings.MEDIA_URL) + 'widgetry/'

JQUERY_URLS = getattr(settings, 'WIDGETRY_JQUERY_URLS', getattr(settings, 'JQUERY_URLS', None))
if not JQUERY_URLS:
    JQUERY_URLS = {
            'core': STATICMEDIA_PREFIX + 'js/jquery-1.3.2.js',
            'admincompat': STATICMEDIA_PREFIX + 'js/admincompat.js',
            'ui.core': STATICMEDIA_PREFIX + 'js/ui/ui.core.js',
            'ui.tabs': STATICMEDIA_PREFIX + 'js/ui/ui.tabs.js',
            'plugins.fkautocomplete': STATICMEDIA_PREFIX + 'js/plugins/jquery.fkautocomplete.js',
            'plugins.autocomplete': STATICMEDIA_PREFIX + 'js/plugins/jquery.autocomplete.js',
        }
    if 'cms' in settings.INSTALLED_APPS:
        # use whatever js is provided by the cms, to avoid loading the same js twice.
        from cms.utils import cms_static_url
        JQUERY_URLS['core'] = cms_static_url('js/libs/jquery.query.js')
        JQUERY_URLS['admincompat'] = cms_static_url('js/plugins/admincompat.js')
        JQUERY_URLS['ui.core'] = cms_static_url('js/libs/jquery.ui.core.js')