# Path: ringo/lib/helpers/appinfo.py
# def get_path_to(location, app=None):
#     """Will return the full pathname the given file name with in the
#     path. path is relativ to the application package (pkg_ressource
#     location + ressource name). You can define a alternative
#     application."""
#     if app:
#         app_name = app
#     else:
#         app_name = get_app_name()
#     base_path = os.path.join(get_app_location(app_name), app_name)
#     return os.path.join(base_path, location)
# 
# def get_app_inheritance_path():
#     """Returns a list of application names. The names describe the path
#     to the root of the application inheritance. e.g if the current
#     application is 'foo' which is based and 'bar' which is based on
#     'ringo' the function will return the follwing result: ['foo', 'bar',
#     'ringo'].
# 
#     The default path is [<nameofcurrentapp>, "ringo"]. The path can be
#     extended by setting the app.base config variable.
# 
#     :returns: List of application name which build the inheritance path.
#     """
#     path = ['ringo']
#     registry = get_current_registry()
#     settings = registry.settings
#     base = settings.get("app.base")
#     if base:
#         path.append(base)
#     path.append(get_app_name())
#     return reversed(path)
# 
# Path: ringo/lib/helpers/misc.py
# def dynamic_import(cl):
#     d = cl.rfind(".")
#     classname = cl[d + 1:len(cl)]
#     m = __import__(cl[0:d], globals(), locals(), [classname])
#     return getattr(m, classname)


import base64
import logging
import os
import json
from ringo.lib.helpers import get_path_to, get_app_inheritance_path, dynamic_import
from ringo.lib.cache import CACHE_TABLE_CONFIG
        from ringo.lib.security import has_role

    def is_advancedsearch(self, default=False):
        settings = self.get_settings()
        return settings.get("advancedsearch", default)

    def get_columns(self, user=None):
        """Return a list of configured columns within the configuration.
        Each colum is a dictionary containing the one or more available
        configuration attributes."""
        cols = []
        config = self.config.get(self.name)
        for col in config.get('columns'):
            if user and col.get("roles"):
                # Check if user has on of the required roles.
                roles = col.get("roles").split(",") + ['admin']
                for role in roles:
                    if has_role(user, role):
                        cols.append(col)
                        break
            else:
                cols.append(col)
        return cols

    def get_column_index(self, name):
        """Will return the index of the column in the overview. Index is
        count from left to right. This method is used to match the
        configured columns in this configuration with the columns in the
        datatables which can be addressed by its index. Please note the
        the index of the datatables columns are increased by 1. So you
        will need to add 1 to the result of this method."""

# Path: ringo/lib/helpers/appinfo.py
# def get_path_to(location, app=None):
#     """Will return the full pathname the given file name with in the
#     path. path is relativ to the application package (pkg_ressource
#     location + ressource name). You can define a alternative
#     application."""
#     if app:
#         app_name = app
#     else:
#         app_name = get_app_name()
#     base_path = os.path.join(get_app_location(app_name), app_name)
#     return os.path.join(base_path, location)
# 
# def get_app_inheritance_path():
#     """Returns a list of application names. The names describe the path
#     to the root of the application inheritance. e.g if the current
#     application is 'foo' which is based and 'bar' which is based on
#     'ringo' the function will return the follwing result: ['foo', 'bar',
#     'ringo'].
# 
#     The default path is [<nameofcurrentapp>, "ringo"]. The path can be
#     extended by setting the app.base config variable.
# 
#     :returns: List of application name which build the inheritance path.
#     """
#     path = ['ringo']
#     registry = get_current_registry()
#     settings = registry.settings
#     base = settings.get("app.base")
#     if base:
#         path.append(base)
#     path.append(get_app_name())
#     return reversed(path)
# 
# Path: ringo/lib/helpers/misc.py
# def dynamic_import(cl):
#     d = cl.rfind(".")
#     classname = cl[d + 1:len(cl)]
#     m = __import__(cl[0:d], globals(), locals(), [classname])
#     return getattr(m, classname)


# Path: ringo/lib/table.py
import base64
import logging
import os
import json
from ringo.lib.helpers import get_path_to, get_app_inheritance_path, dynamic_import
from ringo.lib.cache import CACHE_TABLE_CONFIG
        from ringo.lib.security import has_role


    def is_advancedsearch(self, default=False):
        settings = self.get_settings()
        return settings.get("advancedsearch", default)

    def get_columns(self, user=None):
        """Return a list of configured columns within the configuration.
        Each colum is a dictionary containing the one or more available
        configuration attributes."""
        cols = []
        config = self.config.get(self.name)
        for col in config.get('columns'):
            if user and col.get("roles"):
                # Check if user has on of the required roles.
                roles = col.get("roles").split(",") + ['admin']
                for role in roles:
                    if has_role(user, role):
                        cols.append(col)
                        break
            else:
                cols.append(col)
        return cols

    def get_column_index(self, name):
        """Will return the index of the column in the overview. Index is
        count from left to right. This method is used to match the
        configured columns in this configuration with the columns in the
        datatables which can be addressed by its index. Please note the
        the index of the datatables columns are increased by 1. So you
        will need to add 1 to the result of this method."""

        for num, col in enumerate(self.get_columns()):