Ejemplo n.º 1
0
    def action(**kwargs):
        """
        implementation of map-message specific actions
        :param kwargs: list of parameters: action, mid and all arguments of ajax requests
        :return: results of action
        """
        if kwargs.get('action') == 'render':
            """
            render string with restructured text engine
            """
            return getreStructuredText(kwargs.get('text'))

        elif kwargs.get('action') == 'mapconfig':
            """
            open overlay map with config values
            """
            try:
                config = json.loads(kwargs.get('config', ''))
            except ValueError:
                config = {}
            if not config.get('lat'):
                config['lat'] = Settings.get('defaultLat')
            if not config.get('lng'):
                config['lng'] = Settings.get('defaultLng')
            config['map'] = Map.getDefaultMap()
            kwargs.update(**config)
            #print ">>>>>", kwargs
            return render_template("frontend.messages_map.html", **kwargs)
        return ""
Ejemplo n.º 2
0
    def action(**kwargs):
        """
        implementation of map-message specific actions
        :param kwargs: list of parameters: action, mid and all arguments of ajax requests
        :return: results of action
        """
        if kwargs.get('action') == 'render':
            """
            render string with restructured text engine
            """
            return getreStructuredText(kwargs.get('text'))

        elif kwargs.get('action') == 'mapconfig':
            """
            open overlay map with config values
            """
            try:
                config = json.loads(kwargs.get('config', ''))
            except ValueError:
                config = {}
            if not config.get('lat'):
                config['lat'] = Settings.get('defaultLat')
            if not config.get('lng'):
                config['lng'] = Settings.get('defaultLng')
            config['map'] = Map.getDefaultMap()
            kwargs.update(**config)
            #print ">>>>>", kwargs
            return render_template("frontend.messages_map.html", **kwargs)
        return ""
Ejemplo n.º 3
0
 def action(**kwargs):
     """
     implementation of text-message specific actions
     :param kwargs: list of parameters: action, mid and all arguments of ajax requests
     :return: results of action
     """
     if kwargs.get('action') == 'render':
         """
         render string with restructured text engine
         """
         return getreStructuredText(kwargs.get('template'))
     return ""
Ejemplo n.º 4
0
 def action(**kwargs):
     """
     implementation of text-message specific actions
     :param kwargs: list of parameters: action, mid and all arguments of ajax requests
     :return: results of action
     """
     if kwargs.get('action') == 'render':
         """
         render string with restructured text engine
         """
         return getreStructuredText(kwargs.get('template'))
     return ""
def getFrontendData(self):
    """
    Deliver frontend content of module messages (ajax)

    :return: rendered template as string or json dict
    """
    if request.args.get('action') == 'messagetypefields':
        impl = filter(lambda x: x[0] == request.args.get('messagetypename'), MessageType.getMessageTypes())
        if len(impl) > 0:
            return impl[0][1].getEditorContent(**dict(message=Messages('', '', '', '', 0, impl[0][0])))

    elif request.args.get('action') == 'render':
        return {'text': getreStructuredText(request.form.get('template'))}
    return ""