Пример #1
0
    def get_content_by_location_identifier(self, request):
        db = CSVDataProvider()
        system = check_auth(self, request, db)

        language = request.language.split('-')[0]

        #initialize response
        response = EndUserScanResponseMessage()

        #get marker
        marker = db.get_marker(request.location_identifier)

        #get spot connected to marker
        spot = db.get_spot(marker.spot_id)

        #get content
        content = db.get_content_by_id(spot.content)
        content_message = content.to_enduser_message(language,
                                                     system,
                                                     full=True)

        #set status flags
        #on the CSV backend both always have to be true
        response.has_spot = bool_to_string(True)
        response.has_content = bool_to_string(True)

        #get system name
        system_name = system.name
        l_infos = system.localized_information
        for info in l_infos:  #try to find selected language
            if info.language == content_message.language:
                system_name = info.display_name

        #get settings
        settings = db.get_settings()
        response.app_id_google_play = settings[1]
        response.app_id_itunes = settings[0]

        #render message
        response.system_name = system_name
        response.system_url = system.base_url  #not needed in apps or wordpress
        response.system_id = 1  #always 1, because this is single tenant

        response.content = content_message

        #render message
        if string_to_bool(request.include_style):
            response.style = content.style.to_enduser_message()

        if string_to_bool(request.include_menu):
            response.menu = db.get_menu().to_enduser_message(
                content_message.language, system, db)

        return response
Пример #2
0
    def get_content_by_location_identifier(self, request):
        db = CSVDataProvider()
        system = check_auth(self,request,db)
        
        language = request.language.split('-')[0]
        
        #initialize response
        response = EndUserScanResponseMessage()
        
        #get marker
        marker = db.get_marker(request.location_identifier)
        
        #get spot connected to marker
        spot = db.get_spot(marker.spot_id)
        
        #get content
        content = db.get_content_by_id(spot.content)
        content_message = content.to_enduser_message(language, system, full=True)
        
        #set status flags
        #on the CSV backend both always have to be true
        response.has_spot = bool_to_string(True)
        response.has_content = bool_to_string(True)
        
        #get system name
        system_name = system.name
        l_infos = system.localized_information
        for info in l_infos: #try to find selected language
            if info.language == content_message.language:
                system_name = info.display_name
        
        #get settings
        settings = db.get_settings()
        response.app_id_google_play = settings[1]
        response.app_id_itunes = settings[0]

        #render message
        response.system_name = system_name
        response.system_url = system.base_url #not needed in apps or wordpress
        response.system_id = 1 #always 1, because this is single tenant
        
        response.content = content_message
        
        #render message
        if string_to_bool(request.include_style):
            response.style = content.style.to_enduser_message()
        
        if string_to_bool(request.include_menu):
            response.menu = db.get_menu().to_enduser_message(content_message.language, system, db)

        return response
Пример #3
0
    def get_content_by_content_id_full(self, request):
        db = CSVDataProvider()
        system = check_auth(self, request, db)

        request.language = request.language.split('-')[0]

        content_id = request.content_id

        response = EndUserSignleContentResponseMessage()

        #get Content
        content = db.get_content_by_id(content_id)

        #deliver full content?
        full = True if hasattr(
            request,
            "full") == True and request.full != None and string_to_bool(
                request.full) == True else False

        content_message = content.to_enduser_message(request.language,
                                                     system,
                                                     full=full)
        response.content = content_message

        #get system name
        system_name = system.name
        l_infos = system.localized_information
        for info in l_infos:  #try to find selected language
            if info.language == content_message.language:
                system_name = info.display_name

        #get settings
        settings = db.get_settings()
        response.app_id_google_play = settings[1]
        response.app_id_itunes = settings[0]

        #render message
        response.system_name = system_name
        response.system_url = system.base_url  #not needed in apps or wordpress
        response.system_id = 1  #always 1, because this is single tenant

        if string_to_bool(request.include_style):
            response.style = content.style.to_enduser_message()

        if string_to_bool(request.include_menu):
            response.menu = db.get_menu().to_enduser_message(
                content_message.language, system, db)

        return response
Пример #4
0
    def get_content_by_content_id_full(self, request):
        db = CSVDataProvider()
        system = check_auth(self,request,db)

        request.language = request.language.split('-')[0]

        content_id = request.content_id
        
        response = EndUserSignleContentResponseMessage()

        #get Content
        content = db.get_content_by_id(content_id)

        #deliver full content?
        full = True if hasattr(request,"full") == True and request.full != None and string_to_bool(request.full) == True else False

        content_message = content.to_enduser_message(request.language, system, full=full)
        response.content = content_message
        
        #get system name
        system_name = system.name
        l_infos = system.localized_information
        for info in l_infos: #try to find selected language
            if info.language == content_message.language:
                system_name = info.display_name
                
        #get settings
        settings = db.get_settings()
        response.app_id_google_play = settings[1]
        response.app_id_itunes = settings[0]

        #render message
        response.system_name = system_name
        response.system_url = system.base_url #not needed in apps or wordpress
        response.system_id = 1 #always 1, because this is single tenant

        
        if string_to_bool(request.include_style):
            response.style = content.style.to_enduser_message()
        
        if string_to_bool(request.include_menu):
            response.menu = db.get_menu().to_enduser_message(content_message.language, system, db)

        return response