Exemple #1
0
def submitForm(request):
    """ show form to submit new object description """
    if not request.user.is_authenticated():
        return HttpResponseRedirect("/login")

    return render_to_response('submitObject.html',
                              roboearth.webpage_values(request))
Exemple #2
0
def registerForm(request, error=False):
    """ show form to register new user """
    if request.user.is_authenticated():
        return HttpResponseRedirect("/")

    values = {'error' : error}
    return render_to_response('register.html', roboearth.webpage_values(request,values))
Exemple #3
0
    def output(objects, query, semantic):
        template = loader.get_template('showObject.html')
        values = {'Objects' : objects,
                  'is_auth' : request.user.is_authenticated(),
                  'Query' : query,
                  'Semantic' : semantic}

        return render_to_response('showObject.html', roboearth.webpage_values(request,values))
Exemple #4
0
def loginForm(request, error=False):
    """ show login form """
    if request.user.is_authenticated():
        return HttpResponseRedirect("/")

    values = {'error' : error}
    
    return render_to_response('login.html', roboearth.webpage_values(request,values))
Exemple #5
0
def success(request, nextPage='/'):
    """ page for successful operations:

    nextPage : which page should be shown after the success notice
    """
    template = loader.get_template('successMessage.html')
    webpage_values = Context(
        roboearth.webpage_values(request, {'nextPage': nextPage}))
    return template.render(webpage_values)
Exemple #6
0
def submitForm(request):
    """ show form to submit new robot locations """
    if not request.user.is_authenticated():
        return HttpResponseRedirect("/login")

    values = {}  #'Environments' : hbase_op.list_all("Environments")}

    return render_to_response('submitRobot.html',
                              roboearth.webpage_values(request, values))
Exemple #7
0
def success(request, nextPage='/'):
    """ page for successful operations:

    nextPage : which page should be shown after the success notice
    """
    template = loader.get_template('successMessage.html')
    webpage_values = Context(roboearth.webpage_values(request,
                                                      {'nextPage' : nextPage}))
    return template.render(webpage_values)
Exemple #8
0
    def output(recipes, query, semantic):
        values = {
            'Recipes': recipes,
            'is_auth': request.user.is_authenticated(),
            'Query': query,
            'Semantic': semantic
        }

        return render_to_response('showRecipe.html',
                                  roboearth.webpage_values(request, values))
Exemple #9
0
    def output(robots):
        template = loader.get_template('showRobot.html')
        values = {
            'Robots': robots,
            'is_auth': request.user.is_authenticated(),
            'my_robots': True
        }

        return render_to_response('showRobot.html',
                                  roboearth.webpage_values(request, values))
Exemple #10
0
    def output(objects, query, semantic):
        template = loader.get_template('showObject.html')
        values = {
            'Objects': objects,
            'is_auth': request.user.is_authenticated(),
            'Query': query,
            'Semantic': semantic
        }

        return render_to_response('showObject.html',
                                  roboearth.webpage_values(request, values))
Exemple #11
0
def newsfeed(request):
    """ show the newsfeed from a specific user
    """
    if not request.user.is_authenticated():
        return HttpResponseRedirect("/login")

    values = {'Domain' : roboearth.DOMAIN,
                      'news' : transaction.getNewsfeed(request.user.username),
                      }

    return render_to_response('newsfeed.html', roboearth.webpage_values(request,values))
Exemple #12
0
def profile(request):
    """ show the profil of the authenticated user """
    if not request.user.is_authenticated():
        return HttpResponseRedirect("/")

    template = loader.get_template('profile.html')
    values = {'username' : request.user.username,
              'email' : request.user.email,
              'api_key' : api_keys.objects.get(pk=request.user.username).key}

    return render_to_response('profile.html', roboearth.webpage_values(request,values))
Exemple #13
0
def dbContent(request):
    """ DEPRECIATED: show the complete content of the database
    """
    
    try:
        template = loader.get_template('showDBcontent.html')
        webpage_values = Context(roboearth.webpage_values(request,
                                                          {'Recipes' : recipes.get(numOfVersions=3),
                                                           'Objects' : objects.get(numOfVersions=3)}))
        return HttpResponse(template.render(webpage_values))
    except roboearth.DBException, err:
        return HttpResponse(error(request, errorType=2, errorMessage=err.__str__()))
Exemple #14
0
def subscriptions(request):
    """ show all subscriptions of a user
    """
    if not request.user.is_authenticated():
        return HttpResponseRedirect("/login")

    try:
        values = {'Domain' : roboearth.DOMAIN,
                  'Subscriptions' : transaction.getSubscriptions(username=request.user.username),
                  }

        return render_to_response('subscriptions.html', roboearth.webpage_values(request,values))
    except Exception, err:
        return HttpResponse(views.error(request, nextPage="/", errorType=2, errorMessage=err.__str__()))
Exemple #15
0
def deleteEntity(request):
    """ get called for delete operations, expected data: table and rowKey
    """
    if not request.user.is_authenticated():
        return HttpResponseRedirect("/login")

    if request.user.username != request.POST['author']:
        return HttpResponse(error(request, errorType=0, errorMessage="User not allowed to delete " + request.POST['rowKey']))

    webpage_values = roboearth.webpage_values(request,
                                              {'table' : request.POST['table'],
                                               'binary' : '0',
                                               'row_key' : request.POST['rowKey']})
    
    return render_to_response('confirmDeleteRequest.html', webpage_values)
Exemple #16
0
def error(request, nextPage='/', errorType=0, errorMessage=""):
    """ show error page:

    nextPage : what page should be shown after the error notice

    errorType : "0" -> "unknown error", "1" -> "data not valid", "2" -> "hadoop error"

    errorMessage : the message of the error notice
    """
    template = loader.get_template('errorMessage.html')
    webpage_values = Context(roboearth.webpage_values(request,
                                                      {'nextPage' : nextPage,
                                                       'errorType' : roboearth.ERROR_TYPES[errorType],
                                                       'errorMessage' : errorMessage}))
    return template.render(webpage_values)
Exemple #17
0
def dbContent(request):
    """ DEPRECIATED: show the complete content of the database
    """

    try:
        template = loader.get_template('showDBcontent.html')
        webpage_values = Context(
            roboearth.webpage_values(
                request, {
                    'Recipes': recipes.get(numOfVersions=3),
                    'Objects': objects.get(numOfVersions=3)
                }))
        return HttpResponse(template.render(webpage_values))
    except roboearth.DBException, err:
        return HttpResponse(
            error(request, errorType=2, errorMessage=err.__str__()))
Exemple #18
0
def manage(request):
    """ admin view to manage registered users """
    if not request.user.is_authenticated() or request.user.is_superuser==False:
        return HttpResponseRedirect("/")

    users = User.objects.all()
    users_list = list()
    for u in users:
        users_list.append({'username' : u.username,
                           'first_name' : u.first_name,
                           'last_name' : u.last_name,
                           'email' : u.email,
                           'is_active' : u.is_active,
                           'is_superuser' : u.is_superuser})
        
    values = {'Users' : users_list}

    return render_to_response('manage.html', roboearth.webpage_values(request,values))
Exemple #19
0
def error(request, nextPage='/', errorType=0, errorMessage=""):
    """ show error page:

    nextPage : what page should be shown after the error notice

    errorType : "0" -> "unknown error", "1" -> "data not valid", "2" -> "hadoop error"

    errorMessage : the message of the error notice
    """
    template = loader.get_template('errorMessage.html')
    webpage_values = Context(
        roboearth.webpage_values(
            request, {
                'nextPage': nextPage,
                'errorType': roboearth.ERROR_TYPES[errorType],
                'errorMessage': errorMessage
            }))
    return template.render(webpage_values)
Exemple #20
0
def deleteEntity(request):
    """ get called for delete operations, expected data: table and rowKey
    """
    if not request.user.is_authenticated():
        return HttpResponseRedirect("/login")

    if request.user.username != request.POST['author']:
        return HttpResponse(
            error(request,
                  errorType=0,
                  errorMessage="User not allowed to delete " +
                  request.POST['rowKey']))

    webpage_values = roboearth.webpage_values(
        request, {
            'table': request.POST['table'],
            'binary': '0',
            'row_key': request.POST['rowKey']
        })

    return render_to_response('confirmDeleteRequest.html', webpage_values)
Exemple #21
0
 def output(result, query):
     template = loader.get_template('serql.html')
     values = {'query' : query,
               'result' : result}
 
     return render_to_response('serql.html', roboearth.webpage_values(request,values))
Exemple #22
0
def submitForm(request):
    """ show form to submit new action recipes """
    if not request.user.is_authenticated():
        return HttpResponseRedirect("/login")

    return render_to_response("submitRecipe.html", roboearth.webpage_values(request))
Exemple #23
0
def documentation(request):
    """ show documentation page for the REST-API """
    template = loader.get_template('documentation.html')
    webpage_values = Context(roboearth.webpage_values(request))
    
    return HttpResponse(template.render(webpage_values))
Exemple #24
0
def startPage(request):
    """ show start page """
    template = loader.get_template('index.html')
    webpage_values = Context(roboearth.webpage_values(request))
    
    return template.render(webpage_values)
Exemple #25
0
def requestForm(request):
    """ show form to request environment """
    return render_to_response('requestEnvironment.html',
                              roboearth.webpage_values(request))
Exemple #26
0
def requestForm(request):
    """ show form to request action recipes """
    return render_to_response('requestRecipe.html',
                              roboearth.webpage_values(request))
Exemple #27
0
def serql(request):
    """ show the web page to execute serql queries """   
    return render_to_response('serql.html', roboearth.webpage_values(request))
Exemple #28
0
def about(request):
    """ show general information about RoboEarth """
    template = loader.get_template('about.html')
    webpage_values = Context(roboearth.webpage_values(request))
    
    return HttpResponse(template.render(webpage_values))
Exemple #29
0
def requestForm(request):
    """ show form to request environment """
    return render_to_response('requestEnvironment.html', roboearth.webpage_values(request))
Exemple #30
0
def about(request):
    """ show general information about RoboEarth """
    template = loader.get_template('about.html')
    webpage_values = Context(roboearth.webpage_values(request))

    return HttpResponse(template.render(webpage_values))
Exemple #31
0
def startPage(request):
    """ show start page """
    template = loader.get_template('index.html')
    webpage_values = Context(roboearth.webpage_values(request))

    return template.render(webpage_values)
Exemple #32
0
    def output(recipes, query, semantic):
        values = {"Recipes": recipes, "is_auth": request.user.is_authenticated(), "Query": query, "Semantic": semantic}

        return render_to_response("showRecipe.html", roboearth.webpage_values(request, values))
Exemple #33
0
def submitForm(request):
    """ show form to submit new object description """
    if not request.user.is_authenticated():
        return HttpResponseRedirect("/login")
    
    return render_to_response('submitObject.html', roboearth.webpage_values(request))
Exemple #34
0
def documentation(request):
    """ show documentation page for the REST-API """
    template = loader.get_template('documentation.html')
    webpage_values = Context(roboearth.webpage_values(request))

    return HttpResponse(template.render(webpage_values))
Exemple #35
0
def requestForm(request):
    """ show form to request action recipes """
    return render_to_response("requestRecipe.html", roboearth.webpage_values(request))
Exemple #36
0
def requestForm(request):
    """ show form to request robot location """
    return render_to_response('requestRobot.html',
                              roboearth.webpage_values(request))
Exemple #37
0
def serql(request):
    """ show the web page to execute serql queries """
    return render_to_response('serql.html', roboearth.webpage_values(request))
Exemple #38
0
def created(request):
    """ user account successful created """
    if request.user.is_authenticated():
        return HttpResponseRedirect("/")

    return render_to_response('registration_finished.html', roboearth.webpage_values(request))
Exemple #39
0
    def output(result, query):
        template = loader.get_template('serql.html')
        values = {'query': query, 'result': result}

        return render_to_response('serql.html',
                                  roboearth.webpage_values(request, values))
Exemple #40
0
def requestForm(request):
    """ show form to request object description """
    return render_to_response('requestObject.html',
                              roboearth.webpage_values(request))
Exemple #41
0
def requestForm(request):
    """ show form to request object description """
    return render_to_response('requestObject.html', roboearth.webpage_values(request))