Пример #1
0
 def edition_tabs(self):
     views = []
     context = self.context
     navigation_mode = is_navigation_mode(context)
     # edit mode
     views.append({'name': '/;fo_switch_mode?mode=0',
                   'label': MSG(u'On'),
                   'class': 'active' if not navigation_mode else None})
     views.append({'name': '/;fo_switch_mode?mode=1',
                   'label': MSG(u'Off'),
                   'class': 'active' if navigation_mode else None})
     return views
Пример #2
0
 def get_scripts(self, context):
     scripts = BaseSkin.get_scripts(self, context)
     # In edition mode we add fancybox script
     edit_mode = is_navigation_mode(context) is False
     ac = context.resource.get_access_control()
     is_admin = ac.is_allowed_to_edit(context.user, context.resource)
     if edit_mode is True or is_admin:
         scripts.append("/ui/common/js/fancybox/jquery.fancybox-1.3.1.pack.js")
     scripts.append("/ui/common/js/javascript.js")
     scripts.append("/ui/common/js/jquery.multiselect2side/javascript.js")
     # Do not had a scritp several times
     single_sripts = []
     for script in scripts:
         if script not in single_sripts:
             single_sripts.append(script)
     return single_sripts
Пример #3
0
 def get_styles(self, context):
     styles = BaseSkin.get_styles(self, context)
     if styles.count('/ui/aruni/aruni.css'):
         styles.remove('/ui/aruni/aruni.css')
     # insert common style after bo.css
     styles.insert(1, '/ui/common/style.css')
     if self.add_common_nav_css:
         styles.append('/ui/common/menu.css')
     styles.append('/ui/common/js/jquery.multiselect2side/style.css')
     # In edition mode we add fancybox css
     edit_mode = is_navigation_mode(context) is False
     ac = context.resource.get_access_control()
     is_admin = ac.is_allowed_to_edit(context.user, context.resource)
     if edit_mode is True or is_admin:
         styles.append('/ui/common/js/fancybox/jquery.fancybox-1.3.1.css')
         styles.append('/ui/common/bo.css')
     # Do not had a style several times
     # Do not tweak cascading by calling reversed before and after
     single_styles = []
     for style in reversed(styles):
         if style not in single_styles:
             single_styles.append(style)
     return list(reversed(single_styles))
Пример #4
0
 def build_nav_namespace(self, context):
     data = self.nav_data
     menu = context.site_root.get_resource(data['src'])
     ns = get_menu_namespace(context,
         data['depth'], data['show_first_child'],
         flat=data['flat'], menu=menu)
     if is_navigation_mode(context) is True:
         return ns
     # Add [+] item in menu (To edit)
     ac = menu.get_access_control()
     if ac.is_allowed_to_edit(context.user, menu):
         ns['items'].append(
             {'active': False,
              'class': None,
              'description': None,
              'id': 'menu_edit_menu', # FIXME
              'in_path': False,
              'items': [],
              'path': context.get_link(menu),
              'real_path': menu.get_abspath(),
              'target': '_top',
              'title': u'+'})
     return ns
Пример #5
0
 def build_nav_namespace(self, context):
     data = self.nav_data
     menu = context.site_root.get_resource(data["src"])
     ns = get_menu_namespace(context, data["depth"], data["show_first_child"], flat=data["flat"], menu=menu)
     if is_navigation_mode(context) is True:
         return ns
     # Add [+] item in menu (To edit)
     ac = menu.get_access_control()
     if ac.is_allowed_to_edit(context.user, menu):
         ns["items"].append(
             {
                 "active": False,
                 "class": None,
                 "description": None,
                 "id": "menu_edit_menu",  # FIXME
                 "in_path": False,
                 "items": [],
                 "path": context.get_link(menu),
                 "real_path": menu.get_abspath(),
                 "target": "_top",
                 "title": u"+",
             }
         )
     return ns
Пример #6
0
 def description(self):
     context = get_context()
     if is_navigation_mode(context):
         return MSG(u'Change to edition mode')
     return MSG(u'Change to navigation mode')